[Scummvm-git-logs] scummvm master -> 2e4a711ab223fc1013bd2c4be15950a218aba3f7
sev-
noreply at scummvm.org
Fri Dec 23 13:12:21 UTC 2022
This automated email contains information about 454 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
500713d41e HPL1: add engine template and basic detection
6c2973bf50 HPL1: add engine code
b35fd9d1b8 HPL1: add license header
87d8541ba5 HPL1: improve formatting
7f956b585b HPL1: remove double license
ef1a306510 HPL1: replace file I/O and string type in tinyxml
0d954919d1 HPL1: replace sprintf usage in tinyxml
c5e44bdeb7 HPL1: fix platform in detection tables
ed75b13485 HPL1: move debug channels to dedicated header
3d09e8dfe4 HPL1: fix formatting and add debug levels
5034b2588c HPL1: replace implementation of logging functions
5ccf079d02 HPL1: remove log writer class
f7f0937818 HPL1: modify config file load and save functions
fd70cae8dd HPL1: replace script loading implementation
700f99561d HPL1: replace file finding functions
fb53fd4038 HPL1: add header including all engine components
65b7a4740f HPL1: add game code
ebb6ad1a25 HPL1: fix module.mk
76a777aa99 HPL1: add check after opening the config file
47004e102d HPL1: remove tinyxml string implementation
c0ddf435e5 HPL1: remove unused message box functions
5f351698c8 HPL1: remove unused Platform class
45278f7010 HPL1: replace pixel format classes
f831725d0c HPL1: replace bitmap implementation
3a690a2a90 HPL1: move implementation of LowLevelResourcesSDL
1424428d8d HPL1: fix module.mk and rename Bitmap2D.h
6276485657 HPL1: replace implementation of OpenBrowserWindow
c4ce14c383 HPL1: remove system dependent include
c5e11ac738 HPL1: remove system dependent includes
2844bc52bd HPL1: Fix warnings
93630a54a8 HPL1: Fix more warnings
e2ba61965a HPL1: Fix more virtual classes warnings
e9713c5698 HPL1: fix missing virtual destructor warnings
e41c214d40 HPL1: Fix more warnings
056a7f702e HPL1: replace image loading
3c0dfdf49f COMMON: fix move assignment operator in ScopedPtr
68b3663916 HPL1: fix formatting
9665183e0f HPL1: add game entry point and fix linking errors
8157f39c55 HPL1: fix formatting
fd7fff7e41 HPL1: move game setup class
7d46984d84 HPL1: move LowLevelSystem implementation
81a930c78a HPL1: fix module.mk
dded0c3ca5 HPL1: add string helper functions
e134735bbd HPL1: modify API for bitmap2D
dfa544ae09 HPL1: replace font loading implementation
794bb8d457 HPL1: add feature check for arbitrary resolutions
60b069c791 HPL1: fix image loading
8ed2780112 HPL1: add opengl debug channel
d1420cb546 HPL1: Fix more warnings
25972424dd HPL1: add logging functions
0e7414cfdb HPL1: add opengl header and debug utilities
db0488d535 HPL1: implement LowLevelGraphicsSDL
4d2a7b4a5b HPL1: add implementation for SDLTexture
f304b0e029 HPL1: fix bitmap2D
8e8a0423a2 HPL1: fix opengl call in SDLTexture class
76c540b1bf HPL1: refactor LowLevelPicture class
7f3967b9eb HPL1: initialize parameter in LowLevelGraphicsSDL
e32922d487 HPL1: implement VertexBufferVBO class
db47003e99 HPL1: fix bug in opengl debug macro
02112a69fb HPL1: expand the api of bitmap2D
a8eed15267 HPL1: fix font loading
737f61d4b3 HPL1: get the game to display loading screen
e7bfaff2f5 HPL1: Set fixed pixel format as RGBA
90e62871c2 IMAGES: W/A to allow pass JPEG with 4 components as RGBA.
c64157c686 HPL1: cleanup bitmap2D class
9b6c47de96 HPL1: fix pixel format set in LowLevelGraphicsSDL
6c4c5c0cab HPL1: Fix more warnings and some formatting fixes
078199cd69 HPL1: replace FatalError function with error
de03b0de95 IMAGES: Added comments describing use case for CMYK color space format
7a11a02837 HPL1: Rename target penumbra_overture -> penumbraoverture
f5a58d657b HPL1: Added temporarily means to close the game window
985d692483 HPL1: Do not be a CPU hog
bbe9e1395f HPL1: Remove graphics initialization from engine skeleton
a9b02db1df HPL1: fix bugs in bitmap2D and fix font rendering
45fd4424fa HPL1: remove broken logging
aa52aafe81 IMAGES: force alpha decoding for BMP images
99b9a54110 HPL1: fix debug functions
9eadad06cc HPL1: implement LowLevelInputSDL class
a2d839ea30 HPL1: implement MouseSDL class
8bcc9be062 HPL1: implement KeyboardSDL class
00a968fc8c HPL1: get input to work
0c97cf0386 HPL1: Fix warnings
e5d9d4cc69 HPL1: add utilities to vector3 class
b412b8fbfc HPL1: replace newton library header
1ec1c49dfe HPL1: implement ColliderShapeNewton class
8e4738f6fd HPL1: implement PhysicsBodyNewton class
6439edf99d HPL1: implement PhysicsMaterialNewton class
374e3c1c3d HPL1: cleanup PhysicsJointScrewNewton class
548b4c4233 HPL1: implement PhysicsWorldNewton class
520a35e7fa HPL1: add newton library code
a424a85fdb HPL1: Fix warnings
e3c3d70c47 HPL1: add missing files to module.mk
98c92aba29 HPL1: add angelscript code
a9290eeb6d HPL1: add and replace angelscript add-ons
a1b2054f95 HPL1: modify implementation of SqScript
ff6c653c8d HPL1: enable mesh loaders
e777ca4b24 HPL1: enable OcclusionQueryOGL class
3f426575c0 HPL1: enable physics system creation
1478794e63 HPL1: fix opengl texture formats
acfcb879c4 HPL1: remove shader creation
0c83a0deb7 HPL1: fix collision processing
cb22b849df HPL1: enable scripting system and fix related bugs
b1eb9ec428 HPL1: set default graphics setting to very low
46a2bc94b6 HPL1: fix texture formats
aa5c9ad567 HPL1: fix bug and cleanup PhysicsBodyNewton
268a9ad324 HPL1: cleanup PhysicsJointBallNewton
e288254747 HPL1: add magic numbers to fix physics bug
b986ef9903 HPL1: fix player collisions
a659b5900d HPL1: fix uninitialized variables
6c6cb16bd1 HPL1: remove unused scripting calling conventions
9fc769c68c HPL1: fix return value in script macros
422283601c HPL1: fix memory fault in mesh loader
c3fa0236d1 HPL1: specify source for collision fix
f47dd3ed85 HPL1: add shader files
6ae37f24c7 HPL1: fix null pointer dereference
5619712707 HPL1: add renderer debug channel
30fe64422e HPL1: replace shader implementation and use
a8b8b5263f OPENGL: add hpl1 shaders directory in shader class
73bb027ee1 HPL1: Ported fix from HPL1R project. Don't scale refs.
cdfd9643d6 HPL1: move and fix game shaders
1111f30594 HPL1: fix bug with shader name concatenation
520817276e HPL1: fix uniform setter for vec4f in shader class
001a8c7879 HPL1: remove separate shader usage
ff521fce43 HPL1: fix shader code
7df36793ca HPL1: fix SetMatrixf method in shader class
7488c38644 HPL1: fix texture coordinate inputs in shaders
b3804858e1 HPL1: Fixed typo in shader vLightDir vs vLighDir
bf97e541c7 HPL1: fix diffuse light shader
c7c923d21e HPL1: fix wrong texture units
b63ed0b537 HPL1: fix replacement for tex2Dproj
f30a1e139c HPL1: replace std::sort usage
d3cb9949bf HPL1: fix textures in shaders
cdd329a915 HPL1: fix shader
c5bd9a9586 HPL1: cleanup shader SetMatrixf
1a8d5f167f HPL1: fix bug in physics library's r-b tree
e79425c75e HPL1: fix shader destruction in Material_Alpha
8a229f29b3 HPL1: add audio debug channel and update flag list
fffb115212 HPL1: cleanup automatically added headers
1f96617cf2 HPL1: implement sound data class
a0fb2759a7 HPL1: implement minimal sound channel class
60828f7bbb HPL1: enable sound loading and add error logging
5525f8e59d HPL1: fix audio classes
e0253d2db1 HPL1: add newline in log messages
cf0bb2ad12 HPL1: fix audio bug
6a97b0bd24 HPL1: fix missing return value
96fbd51dee HPL1: add wav as a supported format
a1562f0a29 HPL1: enable functionality in LowLevelSound
ac049c0e30 HPL1: implement disabled SoundChannel methods
0b8b6289c0 HPL1: add unimplemented macro
66c4f7dbdf HPL1: cleanup low level sound class
53c28a1686 HPL1: cleanup sound channel class
2080b8b502 HPL1: fix possible use of uninitialised variable
2b089fb89f HPL1: rename engine's matrix header
c051f506fc HPL1: remove unneeded pragma
0a33c0ba44 HPL1: fix physics library for windows build
4c723d5938 HPL1: fix memory leak and warning in bitmap2D
26493e4738 HPL1: fix incorrect file handeling code
3a7f09fa34 HPL1: fix possible use of uninitialised variables
1562494f38 HPL1: fix incorrect delete
9931ba9458 HPL1: fix deletion of invalid shader
0bd8a3dac4 HPL1: remove unused code from engine skeleton
267f577501 HPL1: Fixed uninitialaized variable reported by valgrind
96768dcde7 JANITORIAL: Fix line endings
75ffdcddde HPL1: Fixed uninitilized variables reported by valgrind
29b490a6d9 HPL1: change function implementation in physics library
0a4d20e13e HPL1: fix bug in sound channel class
cb27b2a5d9 HPL1: fix sound not looping
3364154c65 HPL1: enable sound channel setters
d6281dfbb3 HPL1: fix audio looping forever
c4f8cc612c HPL1: fix audio pause to better reflect the original
fe7ca96161 HPL1: fix TBN matrix in shaders
89d73841ad HPL1: fix memory leak in shader class
5c90f1612f HPL1: Remove trailing semicolons
28746360b6 HPL1: Fix warnings
4ce0626efb HPL1: Fix more warnings
1b75f03005 HPL1: correct types in fragment shaders
d62a0bfc39 HPL1: fix setMatrixf method in shader class
22186b423b HPL1: cleanup shader code
c7301270e5 HPL1: fix shader getter in material additive
6765ad7b76 HPL1: fix color output in vertex shader
775f18cfc1 HPL1: fix fog shaders
b9a3a6bc19 HPL1: fix opengl errors in texture class
24eca8b7a1 HPL1: fix opengl errors and improve formatting
4384e71d43 HPL1: improve formatting in opengl error messages
0ee8e7e915 HPL1: Fixed unused or shadow variables compiler warnings
a726df6451 HPL1: Put assert on unhandled case in iMaterial_BaseLight::getGpuProgram()
18e46c2d6e HPL1: remove separate shader usage
df5cbb7cf1 HPL1: Fixed previous warning fix. Based on few lines above parethness suppose to be different.
02285e0198 HPL1: Fix warning
6fc11767ad HPL1: add error message in unimplemented class
00cfff4496 HPL1: fix and add fallback01 shaders
a16a4aa8f7 HPL1: implement material class for medium graphics
3666b1b73d HPL1: replace const_cast
e5a768fa5a HPL1: fix shader
0d8ac87aca HPL1: fix wrong conditional
729522a764 HPL1: fix file name comment in shader code
daa34d1ffb HPL1: fix fallback01 shader
8ed22968fc HPL1: move ambient shader setup and remove duplicate
e01139bbfc HPL1: enable class used for low graphics setting
808f6c68a2 HPL1: cleanup material fallback classes
00ea41f318 HPL1: remove impl files from engine header
570c30ade0 HPL1: implement limits on playing sound channels
584f1aaf4e HPL1: unify checks for shaders
39a545f740 HPL1: remove ATI fragment shader enum and fix comments
2521f68410 HPL1: enable shaders by default
f58839ad47 HPL1: remove unneeded opengl error check
e499aa7a4c HPL1: cleanup playChannel implementation
4851b7d6bd HPL1: remove useless check
e647ce5f40 HPL1: cleanup and improve logging in LowLevelSound
c2c1726d41 HPL1: improve logging in sound channel class
87656fbe55 HPL1: fix bugs in sound channel class
ee8f35ba22 HPL1: disable loading files from the cache folder
2bf971bef9 HPL1: add debug channel for game saves
a41b8d026c HPL1: replace files with generic streams in tinyxml
b29fa18e84 HPL1: replace stoi input type
6893577def HPL1: implement getDate
75c6146843 HPL1: implement saves
12fcee8864 HPL1: implement favourite saves
3e02539687 HPL1: add exit condition
76fc907457 HPL1: implement keymap support
e3bd86aaa4 HPL1: fix function to get the latest save
02caa68e79 HPL1: disable menu to change key mapping in the game
7c80f99276 HPL1: change save file name pattern
a50e2e14ee HPL1: fix error in xml library
3b87609666 HPL1: implement save detection
7fac2674d7 HPL1: add basic support for extended save format
8f8617a5d7 HPL1: format opengl files
fa822ef0c2 HPL1: implement thumbnail method in metaengine
630623c997 HPL1: use standard naming scheme for saves
f02bc0929a HPL1: move saves after save effects
0942081ad0 HPL1: override engine pause method
f0fdb51faf HPL1: implement save deletion in the game
ceeb9105cb HPL1: fix bug in function that returns free save slot
3c005d841e HPL1: implement removal of old save files
8a85e1c2b9 HPL1: move hplMain to engine run
eabf877903 HPL1: update game's menu after pause
c9e0b7733c HPL1: implement save loading method
10f2042131 HPL1: implement loading from the launcher
63669c9552 HPL1: fix crash in language selection
e3b4ac75b3 HPL1: remove audio section from the game's menu
a47377eeaf HPL1: replace user config file usage
5a6d6cb557 HPL1: fix string comparison
1257df0654 HPL1: add array add-on for the scripting library
2280049615 HPL1: check for equality with 0 on ray intersect
95ccf4fd70 HPL1: allow if with empty statements in scripts
7fd63e902b HPL1: fix material water and implement water shaders
d0dbf8fb5a HPL1: fix issue with crane in level 11 not updating
4a52032bde HPL1: remove optimisations in collider creation
b4af807761 HPL1: Remove Unecessary Semicolons Causing GCC Compiler Warnings
1b4ce6ebad HPL1: Fix Struct vs. Class Mismatch Causing GCC Compiler Warning
3f040f0bf0 HPL1: Fix Various GCC Shadowing Warnings in Angelscript Library
ea4f1c156d HPL1: Fix GCC Compiler Warnings from Missing Debug Statement Formats
a170c19fb6 HPL1: Fix Bug in Game Script Functions Causing GCC Shadowing Warning
3f77311c6e HPL1: Fix Misleading Indentation in Newton Shape Collision Function
bec138584c HPL1: Fix Various Cast Qualifier GCC Warnings in Anglescript Array Code
17bb4057dd HPL1: Fix Shadowing Warning in Engine Sub Mesh Entity Code
941946918e HPL1: Remove Dead Code from Engine Math Classes
4f35777b7c HPL1: Fix GCC Compiler Fallthrough Warnings in TinyXML Parser Code
8e596f5956 HPL1: Remove Set But Unused Variables in Newton Physics World Update Code
ac7ef360b1 HPL1: Remove Set But Unused Variables from Save Effect Handler Code
1cc005c871 HPL1: Fix GCC Fallthrough Warning in Effect Handler Code
bffe62b1c1 HPL1: Fix Signed vs. Unsigned Comparison GCC Warnings in Text Box Widget
c21269a615 HPL1: Fix Unused Variable GCC Compiler Warnings in Penumbra Overture Code
52a350773d HPL1: Fix Signed vs. Unsigned Comparison GCC Warning in Engine String Class
0bbf3899b2 HPL1: Fix Undefined Symbol Warning in Angelscript Compiler Code
1ef5a8194f HPL1: Fix Signed vs. Unsigned Comparison GCC Warnings in Overture Code
31a0f13b17 HPL1: Comment Unused Variable Causing Compiler Warning in Overture Code
93420be1f7 HPL1: Fix Signed vs. Unsigned Comparison GCC Compiler Warning
cea34770ba HPL1: Correct Function Call Parameter in 3D Renderer Graphics Code
d2e0084024 HPL1: fix fallthrough in case statement
9088e974fc HPL1: fix wrong variables in loop
c010a76731 HPL1: fix use of input parametrs in shader code
d1a909d6c9 HPL1: Fix warnings
757ed9b608 HPL1: implement Material_EnvMap_Reflect class
fdaa24b34b HPL1: remove double assignment
5c1bcaf01a HPL1: Fix Likely Cut and Paste Code Error Causing GCC Compiler Warning
10c50494b7 HPL1: Fix Unused Variables GCC Compiler Warnings in Physics 2D Collision
b3e6c36c28 HPL1: Fix Unused Variable Compiler Warnings in Penumbra Overturn Player Code
af2a0395b4 HPL1: Fix Unused Variables Compiler Warnings in Physics World Code
638edcb723 HPL1: Fix Problematic Memset Usage to Clear Class in Newton Physics Code
4b6eca0024 HPL1: Avoid Unused Variable GCC Warnings From Savegame Header Macros
47ffd3f418 HPL1: save sound fading speed
28bbd7124b HPL1: stop sound if out of range and fading
84a35b37ee HPL1: implement check for shaders
4adc41c2fa HPL1: add check for shaders in low level graphics
8bee6d1219 HPL1: selectively disable shader settings
0791019e23 HPL1: remove header for temporary types
33bd657cbc HPL1: fix shader check
e60398f271 HPL1: add compile time opengl checks
95791efb81 HPL1: rename shaders
18d97d1053 HPL1: remove commented out code in shader
5e300864a3 HPL1: remove unused vColor shader input/output
0f4923309c HPL1: Fix Remaining Unused Variable GCC Compiler Warnings
cbf5acb057 HPL1: Fix Unused Variable GCC Compiler Warning in Engine Sound Handler
43c7f23891 HPL1: Fix Unused Variable GCC Compiler Warning in Penumbra Player Interact
029fcb96bf HPL1: Fix GCC Set But Unused Variable Warnings in Newton Physics Code
304a2df165 HPL1: add basic tinygl impl classes
6474ec9c6c HPL1: remove hardcoded screen size values
63aa82a6b2 HPL1: cleanup software low level gfx class
5b2f89bd0d HPL1: fix buffer drawing for software renderer
cdbaf97461 HPL1: Silence compiler warning
0bcf354fdc HPL1: Silence warning
6612ec03a7 HPL1: Fix Some GCC Shadowing Warnings in Newton Physics Library Core Code
5d4819583d HPL1: Fixes for Shadowing Warnings in Newton Convex Hull 3D Code
c32a471c0c HPL1: Fixes for Shadowing Warnings in Newton Convex Hull 4D Code
be4e90fa2b HPL1: Fix Shadowing GCC Compiler Warnings in Newton Core Matrix Code
ea7588227d HPL1: Fix Space vs. Tab Indentation Inconsistency in Newton Memory Code
d6f8a61503 HPL1: improve null pointer safety in TextureManager
60331b024f HPL1: improve null pointer safety in Light3D
158ea72be6 HPL1: Fix GCC Compiler Undefined Symbol Warnings in Angelscript String Code
5578b91a10 HPL1: Fix GCC Shadowing Warnings in Newton Core Code
16a30f8278 HPL1: Fix GCC Compiler Warnings in Low Level Graphics TGL Code
feeec55a7c HPL1: implement occlusion query tgl stub
66e6614db6 HPL1: remove commented code
1334e8f901 HPL1: Fix Incorrect STL Vector Resize Method Call in GUI Code
c91737c5f5 HPL1: Change Image Entity Handle From Unsigned to Signed Vector Type
354464ea97 HPL1: Fix Cut and Paste Error in Engine Material Manager Code
2c9264070f HPL1: Fix Shadowing Compiler Warnings in Newton Library Polygon Soup Builder
2237da1cbf HPL1: partial cleanup of TGLTexture
152009b18f HPL1: enable software renderer usage
97b0b966dc HPL1: Fix Some Shadowing Compiler Warnings in Newton Polyhedra Code
19d952f3b0 HPL1: Further Shadowing Compiler Warning Fixes in Newton Polyhedra Code
605756f515 HPL1: Fix Enumerated vs. Non-Enumerated Conditional GCC Compiler Warning
4d140170ea HPL1: add debug channel for textures
43d27c121f HPL1: add logging in texture wrap setters
1ff72fbb06 HPL1: use texture debug channel in texture classes
3049bb1e01 HPL1: Fix Duplicated Branch GCC Compiler Warning in Player Helper Code
060031ebff HPL1: Fix Signed vs. Unsigned Comparison GCC Compiler Warnings
2c2509bcb6 HPL1: disable texture wrap options in tgl texture
74cc0517a1 HPL1: Fix Type Limits GCC Compiler Warnings in Angelscript String Interface
d0e388671d HPL1: Further GCC Compiler Shadowing Warning Fixes
fb96678f50 HPL1: Further Fixes for GCC Shadowing Compiler Warnings in Newton Library
2df5054417 HPL1: remove rand usage
af0dea70c0 HPL1: fix range in random number generator
d60d57f86e HPL1: Further Fixes for GCC Shadowing Warnings in Newton Physics Library
4cd3902fb0 HPL1: replace std::list with Common::List
2860ff2c1c HPL1: Further GCC Compiler Shadowing Warning Fixes for Newton Physics
7f6929771b HPL1: Further Fixes For GCC Compiler Shadowing Warnings in Newton Physics
0e3c23fc9d HPL1: Further Fixes for GCC Shadowing Warnings in Newton Physics
ab03db95f7 HPL1: fix wrong variable use in newton code
78a528792b HPL1: remove unused code for managing directories
fc5bda73fa HPL1: Further Fixes for GCC Shadowing Warnings in Newton Physics
4c6c678769 HPL1: replace std::(w)string usage in engine code
a4cfa2657f HPL1: remove temporary string compatibility fixes
da41603796 HPL1: remove explicit string conversions
d3b09efda9 HPL1: Fix compilation
22e9977a65 HPL1: Fix Implicit Fallthrough GCC Compiler Warnings in Grid Map 2D Code
f253aac8f4 HPL1: Fix Fallthrough GCC Compiler Warnings in Angelscript Library Code
f84ac3b461 HPL1: Fix Remaining Fallthrough GCC Compiler Warnings
c84c49f8c2 HPL1: Fix Various Shadowing GCC Compiler Warnings in Newton Physics Code
f84fcd859c HPL1: Further Fixes for GCC Compiler Shadowing Warnings in Newton Physics
5fbabcd79d HPL1: add static string class
e16c50932d HPL1: remove static Common::String usage
fddac1b1ba HPL1: Fix Remaining GCC Shadowing Warnings in Newton Physics Code
0fdd6cb20a HPL1: Fix GCC Warning for Memset of Non-Trivial Structure
6442dc1c23 HPL1: Further Fix For GCC Memset on Non-Trivial Structure Compiler Warning
3705c8c5b4 HPL1: create algorithms header
a373f201d5 HPL1: replace std::vector with Common::Array
b4a8a249d1 HPL1: Fix Memset on Non-Trivial Structure GCC Compiler Warning
25ac4c8e4b HPL1: add std::set implementation
4181cc7ae1 HPL1: replace std::set with Hpl1::std::set
87f4c2a656 HPL1: improve search for std::set replacement
fe212f664d HPL1: replace std::multiset with Hpl1::std::multiset
bdcd3ff81a HPL1: Remove <string.h> includes
8641896f01 HPL1: sprintf -> snprintf
65ee75176f HPL1: Removed more system includes
0380cfb41f HPL1: Fix Compilation
912403d72e HPL1: add Hpl1::std::map and Hpl1::std::pair
81138eb006 HPL1: replace std::map with Hpl1::std::map
2e0cb7b5da HPL1: add upper/lowerBound to algorithm header
b586b4bd71 HPL1: cleanup Hpl1::std::map
0eafb65d43 HPL1: fix formatting
edffe61371 HPL1: fix use after free
452debbed8 HPL1: fix formatting
167483079e HPL1: cleanup loop implementation
98daf3635a HPL1: remove equality compairisons in Hpl1::std::map
d4d0f6a372 HPL1: fix compairison in Hpl1::std::map
df31024236 HPL1: add std::multimap replacement
e68551b516 HPL1: replace std::multimap -> Hpl1::std::multimap
c4d83a8e9b HPL1: remove unused standard library headers
084155c2fe HPL1: replace std::greater with Common::Greater
13a7b1379a HPL1: replace instance of std::min and std::max
125de63a68 HPL1: remove std::string from MemoryManager
784915388b HPL1: remove unused header in Hpl1::std::map
e0731245f0 HPL1: fix compilation
a804c81f29 HPL1: remove std::string from angelscript add-ons
eb78910594 HPL1: remove unused includes
9296d9aea4 HPL1: improve Hpl1::std::*map erase method
eab1cbd3cf HPL1: add removeIf to algorithm header
d5762cd762 HPL1: fix heap use after free
cb965171e9 HPL1: remove std::map use in angelscript add-on
04c611f015 HPL1: fix insert method in Hpl1::std::map
c96deb63e9 HPL1: fix memory leak
90d9e0407a HPL1: remove unused system headers
a252ea4cf3 HPL1: remove unused files
80c5519886 HPL1: replace qsort with Common::sort
e6064bd291 HPL1: fix missing return statement
4f27acda36 HPL1: replace uint with unsigned
47049227b2 HPL1: replace c++ limits header with c equivalent
b8843c8eb4 HPL1: fix string compairison
aec5a0f7ac HPL1: add shaders to Makefile.common and scummvm.rc
7e75e4684d HPL1: Run astyle over libraries
ae1dc3c285 HPL1: Fix warnings
430dfffa26 HPL1: Fix more warnings
0f1f2b9946 HPL1: Fix more const warnings
65935ec05e HPL1: remove globals in serialization macros
2db6ed40b4 TINYGL: reduce memory allocation
07642582a0 HPL1: remove unused files
204945ad31 HPL1: use full paths in include directives
96ed9b9f79 HPL1: make StaticString constructor constexpr
e29771eff7 HPL1: make SerializeMemberField constructor constexpr
772906a5cb HPL1: fix global costructors used in serialization
43a5b6f3ad HPL1: Fix warning
0fb2d3c8db HPL1: Fix more warnings
4571fc3e2c HPL1: fix warnings
76a9976c37 HPL1: More const correctness
1a3ddfab1c HPL1: More const corrections
08311ab215 HPL1: Fix more warnings
13b899b8e4 HPL1: move global instance to class scope
72c336296f HPL1: make Vector2 constructors constexpr
8eb558a3ba HPL1: fix global destructor warnings
6c697ab1b5 HPL1: fix globals in material classes
c3a08880e3 HPL1: fix global destructor warnings
c1f076187b HPL1: fix warnings
f0e312d990 HPL1: Fix more const correctness
3b9e91a624 HPL1: Fix const correctness
24544e49db HPL1: Fix const correctness in Newton.cpp. Finally!
224e3fee5f HPL1: Rename Hpl1::set:: to Hpl1::Set:: namespace
53e37dc6ad HPL1: Remove system-wide includes and removed std:: usage
ed26bf2058 HPL1: Fix more warnings
d136002e3e HPL1: remove unused files
14c9853dd8 HPL1: make Vector3 constructors constexpr
286cfc695c HPL1: fix global constructors warnings
42f30493ee HPL1: make Matrix constructor constexpr
5cce4db808 HPL1: fix warnings
4eaa2688d0 HPL1: make Quaternion constructor constexpr
f7026c047c HPL1: Remove usage of std::abs
9cdcde7ea5 HPL1: Fix more warnings
619418f450 HPL1: implement collider rendering
99f161cdcd HPL1: make PhysicsRayParams constructor constexpr
71607c5efb HPL1: fix const correctness in dgTree
acf96eed73 HPL1: fix const correctness in dgNode
bcefae41b4 HPL1: remove unused global variable
08f287f8bc HPL1: Fix const correctness
a0725536ce HPL1: Fix more const correctness
b6c650c320 HPL1: Fixed warnings
ec8cd95382 HPL1: remove global variable
53363ce2c7 HPL1: remove global cleanup class
a669751864 HPL1: fix warnings
92d017e5b4 HPL1: move global initialization of static members
66f620e585 HPL1: remove unused classes
c74813af6c HPL1: move global initialization of static member
b5b3c485df HPL1: fix warnings
2e4a711ab2 HPL1: make global const varialbes constexpr
Commit: 500713d41ea6ac8ed9ed7f600455bbf835f1fd4a
https://github.com/scummvm/scummvm/commit/500713d41ea6ac8ed9ed7f600455bbf835f1fd4a
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:25+01:00
Commit Message:
HPL1: add engine template and basic detection
Changed paths:
A engines/hpl1/configure.engine
A engines/hpl1/console.cpp
A engines/hpl1/console.h
A engines/hpl1/credits.pl
A engines/hpl1/detection.cpp
A engines/hpl1/detection.h
A engines/hpl1/detection_tables.h
A engines/hpl1/hpl1.cpp
A engines/hpl1/hpl1.h
A engines/hpl1/metaengine.cpp
A engines/hpl1/metaengine.h
A engines/hpl1/module.mk
diff --git a/engines/hpl1/configure.engine b/engines/hpl1/configure.engine
new file mode 100644
index 00000000000..e15c24dd1eb
--- /dev/null
+++ b/engines/hpl1/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine hpl1 "Hpl1" yes
diff --git a/engines/hpl1/console.cpp b/engines/hpl1/console.cpp
new file mode 100644
index 00000000000..c9d08d87e4f
--- /dev/null
+++ b/engines/hpl1/console.cpp
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "hpl1/console.h"
+
+namespace Hpl1 {
+
+Console::Console() : GUI::Debugger() {
+ registerCmd("test", WRAP_METHOD(Console, Cmd_test));
+}
+
+Console::~Console() {
+}
+
+bool Console::Cmd_test(int argc, const char **argv) {
+ debugPrintf("Test\n");
+ return true;
+}
+
+} // namespace Hpl1
diff --git a/engines/hpl1/console.h b/engines/hpl1/console.h
new file mode 100644
index 00000000000..93f10668b27
--- /dev/null
+++ b/engines/hpl1/console.h
@@ -0,0 +1,40 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_CONSOLE_H
+#define HPL1_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Hpl1 {
+
+class Console : public GUI::Debugger {
+private:
+ bool Cmd_test(int argc, const char **argv);
+public:
+ Console();
+ ~Console() override;
+};
+
+} // End of namespace Hpl1
+
+#endif
diff --git a/engines/hpl1/credits.pl b/engines/hpl1/credits.pl
new file mode 100644
index 00000000000..91918098c30
--- /dev/null
+++ b/engines/hpl1/credits.pl
@@ -0,0 +1,3 @@
+begin_section("Hpl1");
+ add_person("Name 1", "Handle 1", "");
+end_section();
diff --git a/engines/hpl1/detection.cpp b/engines/hpl1/detection.cpp
new file mode 100644
index 00000000000..53a48e97706
--- /dev/null
+++ b/engines/hpl1/detection.cpp
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "base/plugins.h"
+#include "common/config-manager.h"
+#include "common/file.h"
+#include "common/md5.h"
+#include "common/str-array.h"
+#include "common/translation.h"
+#include "common/util.h"
+#include "hpl1/detection.h"
+#include "hpl1/detection_tables.h"
+
+const DebugChannelDef Hpl1MetaEngineDetection::debugFlagList[] = {
+ { Hpl1::kDebugGraphics, "Graphics", "Graphics debug level" },
+ { Hpl1::kDebugPath, "Path", "Pathfinding debug level" },
+ { Hpl1::kDebugFilePath, "FilePath", "File path debug level" },
+ { Hpl1::kDebugScan, "Scan", "Scan for unrecognised games" },
+ { Hpl1::kDebugScript, "Script", "Enable debug script dump" },
+ DEBUG_CHANNEL_END
+};
+
+Hpl1MetaEngineDetection::Hpl1MetaEngineDetection() : AdvancedMetaEngineDetection(Hpl1::GAME_DESCRIPTIONS,
+ sizeof(ADGameDescription), Hpl1::GAME_NAMES) {
+}
+
+DetectedGames Hpl1MetaEngineDetection::detectGames(const Common::FSList &fslist, uint32 skipADFlags, bool skipIncomplete) {
+ DetectedGames games;
+ for(auto file : fslist) {
+ if (file.getName() == "Penumbra.exe")
+ games.push_back(DetectedGame(getName(), Hpl1::GAME_NAMES[0]));
+ }
+ return games;
+}
+
+PlainGameList Hpl1MetaEngineDetection::getSupportedGames() const {
+ return PlainGameList(Hpl1::GAME_NAMES);
+}
+
+PlainGameDescriptor findGame(const char *gameid) {
+ return Hpl1::GAME_NAMES[0];
+}
+
+REGISTER_PLUGIN_STATIC(HPL1_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, Hpl1MetaEngineDetection);
diff --git a/engines/hpl1/detection.h b/engines/hpl1/detection.h
new file mode 100644
index 00000000000..3846265c0de
--- /dev/null
+++ b/engines/hpl1/detection.h
@@ -0,0 +1,73 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_DETECTION_H
+#define HPL1_DETECTION_H
+
+#include "engines/advancedDetector.h"
+
+namespace Hpl1 {
+
+enum Hpl1DebugChannels {
+ kDebugGraphics = 1 << 0,
+ kDebugPath = 1 << 1,
+ kDebugScan = 1 << 2,
+ kDebugFilePath = 1 << 3,
+ kDebugScript = 1 << 4
+};
+
+extern const PlainGameDescriptor GAME_NAMES[];
+
+extern const ADGameDescription GAME_DESCRIPTIONS[];
+
+} // namespace Hpl1
+
+class Hpl1MetaEngineDetection : public AdvancedMetaEngineDetection {
+ static const DebugChannelDef debugFlagList[];
+
+public:
+ Hpl1MetaEngineDetection();
+ ~Hpl1MetaEngineDetection() override {}
+
+ const char *getName() const override {
+ return "hpl1";
+ }
+
+ const char *getEngineName() const override {
+ return "HPL1";
+ }
+
+ const char *getOriginalCopyright() const override {
+ return "HPL1 (C) Frictional Games AB";
+ }
+
+ const DebugChannelDef *getDebugChannels() const override {
+ return debugFlagList;
+ }
+
+ DetectedGames detectGames(const Common::FSList &fslist, uint32 skipADFlags, bool skipIncomplete) override;
+
+ PlainGameList getSupportedGames() const override;
+
+ PlainGameDescriptor findGame(const char *gameid);
+};
+
+#endif
diff --git a/engines/hpl1/detection_tables.h b/engines/hpl1/detection_tables.h
new file mode 100644
index 00000000000..a486a6afd80
--- /dev/null
+++ b/engines/hpl1/detection_tables.h
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Hpl1 {
+
+const PlainGameDescriptor GAME_NAMES[] = {
+ { "penumbra_overture", "Penumbra: Overture" },
+ { 0, 0 }
+};
+
+const ADGameDescription GAME_DESCRIPTIONS[] = {
+ {
+ "penumbra_overture",
+ nullptr,
+ AD_ENTRY1s("Penumbra.exe", nullptr, -1),
+ Common::Language::EN_ANY,
+ Common::Platform::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+
+ AD_TABLE_END_MARKER
+};
+
+} // namespace Hpl1
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
new file mode 100644
index 00000000000..2a9e46deb6e
--- /dev/null
+++ b/engines/hpl1/hpl1.cpp
@@ -0,0 +1,107 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "hpl1/hpl1.h"
+#include "hpl1/detection.h"
+#include "hpl1/console.h"
+#include "common/scummsys.h"
+#include "common/config-manager.h"
+#include "common/debug-channels.h"
+#include "common/events.h"
+#include "common/system.h"
+#include "engines/util.h"
+#include "graphics/palette.h"
+
+namespace Hpl1 {
+
+Hpl1Engine *g_engine;
+
+Hpl1Engine::Hpl1Engine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst),
+ _gameDescription(gameDesc), _randomSource("Hpl1") {
+ g_engine = this;
+}
+
+Hpl1Engine::~Hpl1Engine() {
+ delete _screen;
+}
+
+uint32 Hpl1Engine::getFeatures() const {
+ return _gameDescription->flags;
+}
+
+Common::String Hpl1Engine::getGameId() const {
+ return _gameDescription->gameId;
+}
+
+Common::Error Hpl1Engine::run() {
+ // Initialize 320x200 paletted graphics mode
+ initGraphics(320, 200);
+ _screen = new Graphics::Screen();
+
+ // Set the engine's debugger console
+ setDebugger(new Console());
+
+ // If a savegame was selected from the launcher, load it
+ int saveSlot = ConfMan.getInt("save_slot");
+ if (saveSlot != -1)
+ (void)loadGameState(saveSlot);
+
+ // Draw a series of boxes on screen as a sample
+ for (int i = 0; i < 100; ++i)
+ _screen->frameRect(Common::Rect(i, i, 320 - i, 200 - i), i);
+ _screen->update();
+
+ // Simple event handling loop
+ byte pal[256 * 3] = { 0 };
+ Common::Event e;
+ int offset = 0;
+
+ while (!shouldQuit()) {
+ while (g_system->getEventManager()->pollEvent(e)) {
+ }
+
+ // Cycle through a simple palette
+ ++offset;
+ for (int i = 0; i < 256; ++i)
+ pal[i * 3 + 1] = (i + offset) % 256;
+ g_system->getPaletteManager()->setPalette(pal, 0, 256);
+ _screen->update();
+
+ // Delay for a bit. All events loops should have a delay
+ // to prevent the system being unduly loaded
+ g_system->delayMillis(10);
+ }
+
+ return Common::kNoError;
+}
+
+Common::Error Hpl1Engine::syncGame(Common::Serializer &s) {
+ // The Serializer has methods isLoading() and isSaving()
+ // if you need to specific steps; for example setting
+ // an array size after reading it's length, whereas
+ // for saving it would write the existing array's length
+ int dummy = 0;
+ s.syncAsUint32LE(dummy);
+
+ return Common::kNoError;
+}
+
+} // namespace Hpl1
diff --git a/engines/hpl1/hpl1.h b/engines/hpl1/hpl1.h
new file mode 100644
index 00000000000..61ae2af27ba
--- /dev/null
+++ b/engines/hpl1/hpl1.h
@@ -0,0 +1,105 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_HPL1_H
+#define HPL1_HPL1_H
+
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/error.h"
+#include "common/fs.h"
+#include "common/hash-str.h"
+#include "common/random.h"
+#include "common/serializer.h"
+#include "common/util.h"
+#include "engines/engine.h"
+#include "engines/savestate.h"
+#include "graphics/screen.h"
+
+#include "hpl1/detection.h"
+
+namespace Hpl1 {
+
+struct Hpl1GameDescription;
+
+class Hpl1Engine : public Engine {
+private:
+ const ADGameDescription *_gameDescription;
+ Common::RandomSource _randomSource;
+protected:
+ // Engine APIs
+ Common::Error run() override;
+public:
+ Graphics::Screen *_screen = nullptr;
+public:
+ Hpl1Engine(OSystem *syst, const ADGameDescription *gameDesc);
+ ~Hpl1Engine() override;
+
+ uint32 getFeatures() const;
+
+ /**
+ * Returns the game Id
+ */
+ Common::String getGameId() const;
+
+ /**
+ * Gets a random number
+ */
+ uint32 getRandomNumber(uint maxNum) {
+ return _randomSource.getRandomNumber(maxNum);
+ }
+
+ bool hasFeature(EngineFeature f) const override {
+ return
+ (f == kSupportsLoadingDuringRuntime) ||
+ (f == kSupportsSavingDuringRuntime) ||
+ (f == kSupportsReturnToLauncher);
+ };
+
+ bool canLoadGameStateCurrently() override {
+ return true;
+ }
+ bool canSaveGameStateCurrently() override {
+ return true;
+ }
+
+ /**
+ * Uses a serializer to allow implementing savegame
+ * loading and saving using a single method
+ */
+ Common::Error syncGame(Common::Serializer &s);
+
+ Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) {
+ Common::Serializer s(nullptr, stream);
+ return syncGame(s);
+ }
+ Common::Error loadGameStream(Common::SeekableReadStream *stream) {
+ Common::Serializer s(stream, nullptr);
+ return syncGame(s);
+ }
+};
+
+extern Hpl1Engine *g_engine;
+#define SHOULD_QUIT ::Hpl1::g_engine->shouldQuit()
+
+} // namespace Hpl1
+
+#endif
diff --git a/engines/hpl1/metaengine.cpp b/engines/hpl1/metaengine.cpp
new file mode 100644
index 00000000000..c857b4d2039
--- /dev/null
+++ b/engines/hpl1/metaengine.cpp
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "hpl1/metaengine.h"
+#include "hpl1/detection.h"
+#include "hpl1/hpl1.h"
+
+const char *Hpl1MetaEngine::getName() const {
+ return "hpl1";
+}
+
+Common::Error Hpl1MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ *engine = new Hpl1::Hpl1Engine(syst, desc);
+ return Common::kNoError;
+}
+
+bool Hpl1MetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSavesUseExtendedFormat) ||
+ (f == kSimpleSavesNames) ||
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDeleteSave) ||
+ (f == kSavesSupportMetaInfo) ||
+ (f == kSavesSupportThumbnail) ||
+ (f == kSupportsLoadingDuringStartup);
+}
+
+
+#if PLUGIN_ENABLED_DYNAMIC(HPL1)
+REGISTER_PLUGIN_DYNAMIC(HPL1, PLUGIN_TYPE_ENGINE, Hpl1MetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(HPL1, PLUGIN_TYPE_ENGINE, Hpl1MetaEngine);
+#endif
diff --git a/engines/hpl1/metaengine.h b/engines/hpl1/metaengine.h
new file mode 100644
index 00000000000..4156502d681
--- /dev/null
+++ b/engines/hpl1/metaengine.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_METAENGINE_H
+#define HPL1_METAENGINE_H
+
+#include "engines/advancedDetector.h"
+
+class Hpl1MetaEngine : public AdvancedMetaEngine {
+public:
+ const char *getName() const override;
+
+ Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
+
+ /**
+ * Determine whether the engine supports the specified MetaEngine feature.
+ *
+ * Used by e.g. the launcher to determine whether to enable the Load button.
+ */
+ bool hasFeature(MetaEngineFeature f) const override;
+};
+
+#endif
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
new file mode 100644
index 00000000000..08f5b4ea3e3
--- /dev/null
+++ b/engines/hpl1/module.mk
@@ -0,0 +1,17 @@
+MODULE := engines/hpl1
+
+MODULE_OBJS := \
+ hpl1.o \
+ console.o \
+ metaengine.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_HPL1), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
+
+# Detection objects
+DETECT_OBJS += $(MODULE)/detection.o
Commit: 6c2973bf50f6e565613365d09585dfe19d6bb623
https://github.com/scummvm/scummvm/commit/6c2973bf50f6e565613365d09585dfe19d6bb623
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:25+01:00
Commit Message:
HPL1: add engine code
Changed paths:
A engines/hpl1/engine/ai/AI.cpp
A engines/hpl1/engine/ai/AI.h
A engines/hpl1/engine/ai/AINodeContainer.cpp
A engines/hpl1/engine/ai/AINodeContainer.h
A engines/hpl1/engine/ai/AINodeGenerator.cpp
A engines/hpl1/engine/ai/AINodeGenerator.h
A engines/hpl1/engine/ai/AStar.cpp
A engines/hpl1/engine/ai/AStar.h
A engines/hpl1/engine/ai/StateMachine.cpp
A engines/hpl1/engine/ai/StateMachine.h
A engines/hpl1/engine/game/Game.cpp
A engines/hpl1/engine/game/Game.h
A engines/hpl1/engine/game/GameTypes.cpp
A engines/hpl1/engine/game/GameTypes.h
A engines/hpl1/engine/game/LowLevelGameSetup.h
A engines/hpl1/engine/game/SaveGame.cpp
A engines/hpl1/engine/game/SaveGame.h
A engines/hpl1/engine/game/ScriptFuncs.cpp
A engines/hpl1/engine/game/ScriptFuncs.h
A engines/hpl1/engine/game/Updateable.h
A engines/hpl1/engine/game/Updater.cpp
A engines/hpl1/engine/game/Updater.h
A engines/hpl1/engine/graphics/Animation.cpp
A engines/hpl1/engine/graphics/Animation.h
A engines/hpl1/engine/graphics/AnimationTrack.cpp
A engines/hpl1/engine/graphics/AnimationTrack.h
A engines/hpl1/engine/graphics/BackgroundImage.cpp
A engines/hpl1/engine/graphics/BackgroundImage.h
A engines/hpl1/engine/graphics/Beam.cpp
A engines/hpl1/engine/graphics/Beam.h
A engines/hpl1/engine/graphics/BillBoard.cpp
A engines/hpl1/engine/graphics/BillBoard.h
A engines/hpl1/engine/graphics/Bitmap2D.h
A engines/hpl1/engine/graphics/Bone.cpp
A engines/hpl1/engine/graphics/Bone.h
A engines/hpl1/engine/graphics/BoneState.cpp
A engines/hpl1/engine/graphics/BoneState.h
A engines/hpl1/engine/graphics/Color.cpp
A engines/hpl1/engine/graphics/Color.h
A engines/hpl1/engine/graphics/FontData.cpp
A engines/hpl1/engine/graphics/FontData.h
A engines/hpl1/engine/graphics/GPUProgram.cpp
A engines/hpl1/engine/graphics/GPUProgram.h
A engines/hpl1/engine/graphics/GfxObject.cpp
A engines/hpl1/engine/graphics/GfxObject.h
A engines/hpl1/engine/graphics/Graphics.cpp
A engines/hpl1/engine/graphics/Graphics.h
A engines/hpl1/engine/graphics/GraphicsDrawer.cpp
A engines/hpl1/engine/graphics/GraphicsDrawer.h
A engines/hpl1/engine/graphics/GraphicsTypes.h
A engines/hpl1/engine/graphics/ImageEntityData.cpp
A engines/hpl1/engine/graphics/ImageEntityData.h
A engines/hpl1/engine/graphics/LowLevelGraphics.h
A engines/hpl1/engine/graphics/LowLevelPicture.h
A engines/hpl1/engine/graphics/Material.cpp
A engines/hpl1/engine/graphics/Material.h
A engines/hpl1/engine/graphics/MaterialHandler.cpp
A engines/hpl1/engine/graphics/MaterialHandler.h
A engines/hpl1/engine/graphics/Material_Additive.cpp
A engines/hpl1/engine/graphics/Material_Additive.h
A engines/hpl1/engine/graphics/Material_Alpha.cpp
A engines/hpl1/engine/graphics/Material_Alpha.h
A engines/hpl1/engine/graphics/Material_BaseLight.cpp
A engines/hpl1/engine/graphics/Material_BaseLight.h
A engines/hpl1/engine/graphics/Material_Bump.cpp
A engines/hpl1/engine/graphics/Material_Bump.h
A engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
A engines/hpl1/engine/graphics/Material_BumpColorSpec.h
A engines/hpl1/engine/graphics/Material_BumpSpec.cpp
A engines/hpl1/engine/graphics/Material_BumpSpec.h
A engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
A engines/hpl1/engine/graphics/Material_BumpSpec2D.h
A engines/hpl1/engine/graphics/Material_Diffuse.cpp
A engines/hpl1/engine/graphics/Material_Diffuse.h
A engines/hpl1/engine/graphics/Material_Diffuse2D.cpp
A engines/hpl1/engine/graphics/Material_Diffuse2D.h
A engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.cpp
A engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
A engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.cpp
A engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
A engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
A engines/hpl1/engine/graphics/Material_DiffuseSpec.h
A engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
A engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
A engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
A engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
A engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
A engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
A engines/hpl1/engine/graphics/Material_Flat.cpp
A engines/hpl1/engine/graphics/Material_Flat.h
A engines/hpl1/engine/graphics/Material_FontNormal.cpp
A engines/hpl1/engine/graphics/Material_FontNormal.h
A engines/hpl1/engine/graphics/Material_Modulative.cpp
A engines/hpl1/engine/graphics/Material_Modulative.h
A engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
A engines/hpl1/engine/graphics/Material_ModulativeX2.h
A engines/hpl1/engine/graphics/Material_Smoke2D.cpp
A engines/hpl1/engine/graphics/Material_Smoke2D.h
A engines/hpl1/engine/graphics/Material_Water.cpp
A engines/hpl1/engine/graphics/Material_Water.h
A engines/hpl1/engine/graphics/Mesh.cpp
A engines/hpl1/engine/graphics/Mesh.h
A engines/hpl1/engine/graphics/Mesh2d.cpp
A engines/hpl1/engine/graphics/Mesh2d.h
A engines/hpl1/engine/graphics/MeshCreator.cpp
A engines/hpl1/engine/graphics/MeshCreator.h
A engines/hpl1/engine/graphics/OcclusionQuery.h
A engines/hpl1/engine/graphics/ParticleEmitter.cpp
A engines/hpl1/engine/graphics/ParticleEmitter.h
A engines/hpl1/engine/graphics/ParticleEmitter2D.cpp
A engines/hpl1/engine/graphics/ParticleEmitter2D.h
A engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
A engines/hpl1/engine/graphics/ParticleEmitter3D.h
A engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
A engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
A engines/hpl1/engine/graphics/ParticleSystem3D.cpp
A engines/hpl1/engine/graphics/ParticleSystem3D.h
A engines/hpl1/engine/graphics/PixelFormat.h
A engines/hpl1/engine/graphics/RenderList.cpp
A engines/hpl1/engine/graphics/RenderList.h
A engines/hpl1/engine/graphics/RenderObject2D.cpp
A engines/hpl1/engine/graphics/RenderObject2D.h
A engines/hpl1/engine/graphics/RenderState.cpp
A engines/hpl1/engine/graphics/RenderState.h
A engines/hpl1/engine/graphics/Renderable.cpp
A engines/hpl1/engine/graphics/Renderable.h
A engines/hpl1/engine/graphics/Renderer2D.cpp
A engines/hpl1/engine/graphics/Renderer2D.h
A engines/hpl1/engine/graphics/Renderer3D.cpp
A engines/hpl1/engine/graphics/Renderer3D.h
A engines/hpl1/engine/graphics/RendererPostEffects.cpp
A engines/hpl1/engine/graphics/RendererPostEffects.h
A engines/hpl1/engine/graphics/Skeleton.cpp
A engines/hpl1/engine/graphics/Skeleton.h
A engines/hpl1/engine/graphics/SubMesh.cpp
A engines/hpl1/engine/graphics/SubMesh.h
A engines/hpl1/engine/graphics/Texture.h
A engines/hpl1/engine/graphics/VertexBuffer.h
A engines/hpl1/engine/graphics/VideoStream.h
A engines/hpl1/engine/gui/Gui.cpp
A engines/hpl1/engine/gui/Gui.h
A engines/hpl1/engine/gui/GuiGfxElement.cpp
A engines/hpl1/engine/gui/GuiGfxElement.h
A engines/hpl1/engine/gui/GuiMaterial.h
A engines/hpl1/engine/gui/GuiMaterialBasicTypes.cpp
A engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
A engines/hpl1/engine/gui/GuiPopUp.cpp
A engines/hpl1/engine/gui/GuiPopUp.h
A engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
A engines/hpl1/engine/gui/GuiPopUpMessageBox.h
A engines/hpl1/engine/gui/GuiSet.cpp
A engines/hpl1/engine/gui/GuiSet.h
A engines/hpl1/engine/gui/GuiSkin.cpp
A engines/hpl1/engine/gui/GuiSkin.h
A engines/hpl1/engine/gui/GuiTypes.h
A engines/hpl1/engine/gui/Widget.cpp
A engines/hpl1/engine/gui/Widget.h
A engines/hpl1/engine/gui/WidgetBaseClasses.cpp
A engines/hpl1/engine/gui/WidgetBaseClasses.h
A engines/hpl1/engine/gui/WidgetButton.cpp
A engines/hpl1/engine/gui/WidgetButton.h
A engines/hpl1/engine/gui/WidgetCheckBox.cpp
A engines/hpl1/engine/gui/WidgetCheckBox.h
A engines/hpl1/engine/gui/WidgetComboBox.cpp
A engines/hpl1/engine/gui/WidgetComboBox.h
A engines/hpl1/engine/gui/WidgetFrame.cpp
A engines/hpl1/engine/gui/WidgetFrame.h
A engines/hpl1/engine/gui/WidgetImage.cpp
A engines/hpl1/engine/gui/WidgetImage.h
A engines/hpl1/engine/gui/WidgetLabel.cpp
A engines/hpl1/engine/gui/WidgetLabel.h
A engines/hpl1/engine/gui/WidgetListBox.cpp
A engines/hpl1/engine/gui/WidgetListBox.h
A engines/hpl1/engine/gui/WidgetSlider.cpp
A engines/hpl1/engine/gui/WidgetSlider.h
A engines/hpl1/engine/gui/WidgetTextBox.cpp
A engines/hpl1/engine/gui/WidgetTextBox.h
A engines/hpl1/engine/gui/WidgetWindow.cpp
A engines/hpl1/engine/gui/WidgetWindow.h
A engines/hpl1/engine/haptic/Haptic.cpp
A engines/hpl1/engine/haptic/Haptic.h
A engines/hpl1/engine/haptic/HapticForce.h
A engines/hpl1/engine/haptic/HapticShape.h
A engines/hpl1/engine/haptic/HapticSurface.h
A engines/hpl1/engine/haptic/HapticTypes.h
A engines/hpl1/engine/haptic/LowLevelHaptic.cpp
A engines/hpl1/engine/haptic/LowLevelHaptic.h
A engines/hpl1/engine/impl/CGProgram.cpp
A engines/hpl1/engine/impl/CGProgram.h
A engines/hpl1/engine/impl/CharacterBodyNewton.cpp
A engines/hpl1/engine/impl/CharacterBodyNewton.h
A engines/hpl1/engine/impl/CollideShapeNewton.cpp
A engines/hpl1/engine/impl/CollideShapeNewton.h
A engines/hpl1/engine/impl/KeyboardSDL.cpp
A engines/hpl1/engine/impl/KeyboardSDL.h
A engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
A engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
A engines/hpl1/engine/impl/LowLevelInputSDL.cpp
A engines/hpl1/engine/impl/LowLevelInputSDL.h
A engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
A engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
A engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
A engines/hpl1/engine/impl/LowLevelResourcesSDL.h
A engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
A engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
A engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
A engines/hpl1/engine/impl/LowLevelSystemSDL.h
A engines/hpl1/engine/impl/MeshLoaderCollada.cpp
A engines/hpl1/engine/impl/MeshLoaderCollada.h
A engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
A engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
A engines/hpl1/engine/impl/MeshLoaderMSH.cpp
A engines/hpl1/engine/impl/MeshLoaderMSH.h
A engines/hpl1/engine/impl/MouseSDL.cpp
A engines/hpl1/engine/impl/MouseSDL.h
A engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
A engines/hpl1/engine/impl/OcclusionQueryOGL.h
A engines/hpl1/engine/impl/OpenALSoundChannel.cpp
A engines/hpl1/engine/impl/OpenALSoundChannel.h
A engines/hpl1/engine/impl/OpenALSoundData.cpp
A engines/hpl1/engine/impl/OpenALSoundData.h
A engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
A engines/hpl1/engine/impl/OpenALSoundEnvironment.h
A engines/hpl1/engine/impl/PBuffer.cpp
A engines/hpl1/engine/impl/PBuffer.h
A engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
A engines/hpl1/engine/impl/PhysicsBodyNewton.h
A engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
A engines/hpl1/engine/impl/PhysicsControllerNewton.h
A engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
A engines/hpl1/engine/impl/PhysicsJointBallNewton.h
A engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
A engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
A engines/hpl1/engine/impl/PhysicsJointNewton.h
A engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
A engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
A engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
A engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
A engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
A engines/hpl1/engine/impl/PhysicsMaterialNewton.h
A engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
A engines/hpl1/engine/impl/PhysicsWorldNewton.h
A engines/hpl1/engine/impl/Platform.cpp
A engines/hpl1/engine/impl/Platform.h
A engines/hpl1/engine/impl/SDLBitmap2D.cpp
A engines/hpl1/engine/impl/SDLBitmap2D.h
A engines/hpl1/engine/impl/SDLFontData.cpp
A engines/hpl1/engine/impl/SDLFontData.h
A engines/hpl1/engine/impl/SDLGameSetup.cpp
A engines/hpl1/engine/impl/SDLGameSetup.h
A engines/hpl1/engine/impl/SDLPixelFormat.h
A engines/hpl1/engine/impl/SDLTexture.cpp
A engines/hpl1/engine/impl/SDLTexture.h
A engines/hpl1/engine/impl/SqScript.cpp
A engines/hpl1/engine/impl/SqScript.h
A engines/hpl1/engine/impl/VertexBufferOGL.cpp
A engines/hpl1/engine/impl/VertexBufferOGL.h
A engines/hpl1/engine/impl/VertexBufferVBO.cpp
A engines/hpl1/engine/impl/VertexBufferVBO.h
A engines/hpl1/engine/impl/VideoStreamTheora.cpp
A engines/hpl1/engine/impl/VideoStreamTheora.h
A engines/hpl1/engine/impl/scriptstring.cpp
A engines/hpl1/engine/impl/scriptstring.h
A engines/hpl1/engine/impl/stdstring.cpp
A engines/hpl1/engine/impl/stdstring.h
A engines/hpl1/engine/impl/temp-types.h
A engines/hpl1/engine/impl/tinyXML/tinystr.cpp
A engines/hpl1/engine/impl/tinyXML/tinystr.h
A engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
A engines/hpl1/engine/impl/tinyXML/tinyxml.h
A engines/hpl1/engine/impl/tinyXML/tinyxmlerror.cpp
A engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
A engines/hpl1/engine/input/Action.cpp
A engines/hpl1/engine/input/Action.h
A engines/hpl1/engine/input/ActionHaptic.cpp
A engines/hpl1/engine/input/ActionHaptic.h
A engines/hpl1/engine/input/ActionKeyboard.cpp
A engines/hpl1/engine/input/ActionKeyboard.h
A engines/hpl1/engine/input/ActionMouseButton.cpp
A engines/hpl1/engine/input/ActionMouseButton.h
A engines/hpl1/engine/input/Input.cpp
A engines/hpl1/engine/input/Input.h
A engines/hpl1/engine/input/InputDevice.cpp
A engines/hpl1/engine/input/InputDevice.h
A engines/hpl1/engine/input/InputTypes.h
A engines/hpl1/engine/input/Keyboard.cpp
A engines/hpl1/engine/input/Keyboard.h
A engines/hpl1/engine/input/LowLevelInput.h
A engines/hpl1/engine/input/Mouse.cpp
A engines/hpl1/engine/input/Mouse.h
A engines/hpl1/engine/libraries/angelscript/angelscript.h
A engines/hpl1/engine/libraries/newton/Newton.h
A engines/hpl1/engine/math/BoundingVolume.cpp
A engines/hpl1/engine/math/BoundingVolume.h
A engines/hpl1/engine/math/CRC.cpp
A engines/hpl1/engine/math/CRC.h
A engines/hpl1/engine/math/Frustum.cpp
A engines/hpl1/engine/math/Frustum.h
A engines/hpl1/engine/math/Math.cpp
A engines/hpl1/engine/math/Math.h
A engines/hpl1/engine/math/MathTypes.cpp
A engines/hpl1/engine/math/MathTypes.h
A engines/hpl1/engine/math/Matrix.h
A engines/hpl1/engine/math/MeshTypes.cpp
A engines/hpl1/engine/math/MeshTypes.h
A engines/hpl1/engine/math/PidController.h
A engines/hpl1/engine/math/Quaternion.cpp
A engines/hpl1/engine/math/Quaternion.h
A engines/hpl1/engine/math/Spring.cpp
A engines/hpl1/engine/math/Spring.h
A engines/hpl1/engine/math/Vector2.h
A engines/hpl1/engine/math/Vector3.h
A engines/hpl1/engine/physics/Body2D.cpp
A engines/hpl1/engine/physics/Body2D.h
A engines/hpl1/engine/physics/CharacterBody.cpp
A engines/hpl1/engine/physics/CharacterBody.h
A engines/hpl1/engine/physics/CollideData.h
A engines/hpl1/engine/physics/CollideData2D.h
A engines/hpl1/engine/physics/CollideShape.h
A engines/hpl1/engine/physics/Collider2D.cpp
A engines/hpl1/engine/physics/Collider2D.h
A engines/hpl1/engine/physics/LowLevelPhysics.h
A engines/hpl1/engine/physics/Physics.cpp
A engines/hpl1/engine/physics/Physics.h
A engines/hpl1/engine/physics/PhysicsBody.cpp
A engines/hpl1/engine/physics/PhysicsBody.h
A engines/hpl1/engine/physics/PhysicsController.cpp
A engines/hpl1/engine/physics/PhysicsController.h
A engines/hpl1/engine/physics/PhysicsJoint.cpp
A engines/hpl1/engine/physics/PhysicsJoint.h
A engines/hpl1/engine/physics/PhysicsJointBall.cpp
A engines/hpl1/engine/physics/PhysicsJointBall.h
A engines/hpl1/engine/physics/PhysicsJointHinge.cpp
A engines/hpl1/engine/physics/PhysicsJointHinge.h
A engines/hpl1/engine/physics/PhysicsJointScrew.cpp
A engines/hpl1/engine/physics/PhysicsJointScrew.h
A engines/hpl1/engine/physics/PhysicsJointSlider.cpp
A engines/hpl1/engine/physics/PhysicsJointSlider.h
A engines/hpl1/engine/physics/PhysicsMaterial.h
A engines/hpl1/engine/physics/PhysicsWorld.cpp
A engines/hpl1/engine/physics/PhysicsWorld.h
A engines/hpl1/engine/physics/SurfaceData.cpp
A engines/hpl1/engine/physics/SurfaceData.h
A engines/hpl1/engine/resources/AnimationManager.cpp
A engines/hpl1/engine/resources/AnimationManager.h
A engines/hpl1/engine/resources/ConfigFile.cpp
A engines/hpl1/engine/resources/ConfigFile.h
A engines/hpl1/engine/resources/EntityLoader_Object.cpp
A engines/hpl1/engine/resources/EntityLoader_Object.h
A engines/hpl1/engine/resources/FileSearcher.cpp
A engines/hpl1/engine/resources/FileSearcher.h
A engines/hpl1/engine/resources/FontManager.cpp
A engines/hpl1/engine/resources/FontManager.h
A engines/hpl1/engine/resources/FrameBase.h
A engines/hpl1/engine/resources/FrameBitmap.cpp
A engines/hpl1/engine/resources/FrameBitmap.h
A engines/hpl1/engine/resources/FrameTexture.cpp
A engines/hpl1/engine/resources/FrameTexture.h
A engines/hpl1/engine/resources/GpuProgramManager.cpp
A engines/hpl1/engine/resources/GpuProgramManager.h
A engines/hpl1/engine/resources/ImageEntityManager.cpp
A engines/hpl1/engine/resources/ImageEntityManager.h
A engines/hpl1/engine/resources/ImageManager.cpp
A engines/hpl1/engine/resources/ImageManager.h
A engines/hpl1/engine/resources/LanguageFile.cpp
A engines/hpl1/engine/resources/LanguageFile.h
A engines/hpl1/engine/resources/LowLevelResources.h
A engines/hpl1/engine/resources/MaterialManager.cpp
A engines/hpl1/engine/resources/MaterialManager.h
A engines/hpl1/engine/resources/MeshLoader.h
A engines/hpl1/engine/resources/MeshLoaderHandler.cpp
A engines/hpl1/engine/resources/MeshLoaderHandler.h
A engines/hpl1/engine/resources/MeshManager.cpp
A engines/hpl1/engine/resources/MeshManager.h
A engines/hpl1/engine/resources/ParticleManager.cpp
A engines/hpl1/engine/resources/ParticleManager.h
A engines/hpl1/engine/resources/ResourceBase.cpp
A engines/hpl1/engine/resources/ResourceBase.h
A engines/hpl1/engine/resources/ResourceImage.cpp
A engines/hpl1/engine/resources/ResourceImage.h
A engines/hpl1/engine/resources/ResourceManager.cpp
A engines/hpl1/engine/resources/ResourceManager.h
A engines/hpl1/engine/resources/Resources.cpp
A engines/hpl1/engine/resources/Resources.h
A engines/hpl1/engine/resources/ResourcesTypes.h
A engines/hpl1/engine/resources/ScriptManager.cpp
A engines/hpl1/engine/resources/ScriptManager.h
A engines/hpl1/engine/resources/SoundEntityManager.cpp
A engines/hpl1/engine/resources/SoundEntityManager.h
A engines/hpl1/engine/resources/SoundManager.cpp
A engines/hpl1/engine/resources/SoundManager.h
A engines/hpl1/engine/resources/TextureManager.cpp
A engines/hpl1/engine/resources/TextureManager.h
A engines/hpl1/engine/resources/TileSetManager.cpp
A engines/hpl1/engine/resources/TileSetManager.h
A engines/hpl1/engine/resources/VideoManager.cpp
A engines/hpl1/engine/resources/VideoManager.h
A engines/hpl1/engine/scene/AnimationState.cpp
A engines/hpl1/engine/scene/AnimationState.h
A engines/hpl1/engine/scene/Area2D.cpp
A engines/hpl1/engine/scene/Area2D.h
A engines/hpl1/engine/scene/Camera.h
A engines/hpl1/engine/scene/Camera2D.cpp
A engines/hpl1/engine/scene/Camera2D.h
A engines/hpl1/engine/scene/Camera3D.cpp
A engines/hpl1/engine/scene/Camera3D.h
A engines/hpl1/engine/scene/ColliderEntity.cpp
A engines/hpl1/engine/scene/ColliderEntity.h
A engines/hpl1/engine/scene/Entity.cpp
A engines/hpl1/engine/scene/Entity.h
A engines/hpl1/engine/scene/Entity2D.cpp
A engines/hpl1/engine/scene/Entity2D.h
A engines/hpl1/engine/scene/Entity3D.cpp
A engines/hpl1/engine/scene/Entity3D.h
A engines/hpl1/engine/scene/GridMap2D.cpp
A engines/hpl1/engine/scene/GridMap2D.h
A engines/hpl1/engine/scene/ImageEntity.cpp
A engines/hpl1/engine/scene/ImageEntity.h
A engines/hpl1/engine/scene/Light.cpp
A engines/hpl1/engine/scene/Light.h
A engines/hpl1/engine/scene/Light2D.cpp
A engines/hpl1/engine/scene/Light2D.h
A engines/hpl1/engine/scene/Light2DPoint.cpp
A engines/hpl1/engine/scene/Light2DPoint.h
A engines/hpl1/engine/scene/Light3D.cpp
A engines/hpl1/engine/scene/Light3D.h
A engines/hpl1/engine/scene/Light3DPoint.cpp
A engines/hpl1/engine/scene/Light3DPoint.h
A engines/hpl1/engine/scene/Light3DSpot.cpp
A engines/hpl1/engine/scene/Light3DSpot.h
A engines/hpl1/engine/scene/MeshEntity.cpp
A engines/hpl1/engine/scene/MeshEntity.h
A engines/hpl1/engine/scene/MultiImageEntity.cpp
A engines/hpl1/engine/scene/MultiImageEntity.h
A engines/hpl1/engine/scene/Node.cpp
A engines/hpl1/engine/scene/Node.h
A engines/hpl1/engine/scene/Node2D.cpp
A engines/hpl1/engine/scene/Node2D.h
A engines/hpl1/engine/scene/Node3D.cpp
A engines/hpl1/engine/scene/Node3D.h
A engines/hpl1/engine/scene/NodeState.cpp
A engines/hpl1/engine/scene/NodeState.h
A engines/hpl1/engine/scene/PortalContainer.cpp
A engines/hpl1/engine/scene/PortalContainer.h
A engines/hpl1/engine/scene/RenderableContainer.h
A engines/hpl1/engine/scene/Scene.cpp
A engines/hpl1/engine/scene/Scene.h
A engines/hpl1/engine/scene/SectorVisibility.cpp
A engines/hpl1/engine/scene/SectorVisibility.h
A engines/hpl1/engine/scene/SoundEntity.cpp
A engines/hpl1/engine/scene/SoundEntity.h
A engines/hpl1/engine/scene/SoundSource.cpp
A engines/hpl1/engine/scene/SoundSource.h
A engines/hpl1/engine/scene/SubMeshEntity.cpp
A engines/hpl1/engine/scene/SubMeshEntity.h
A engines/hpl1/engine/scene/Tile.cpp
A engines/hpl1/engine/scene/Tile.h
A engines/hpl1/engine/scene/TileData.cpp
A engines/hpl1/engine/scene/TileData.h
A engines/hpl1/engine/scene/TileLayer.cpp
A engines/hpl1/engine/scene/TileLayer.h
A engines/hpl1/engine/scene/TileMap.cpp
A engines/hpl1/engine/scene/TileMap.h
A engines/hpl1/engine/scene/TileMapIt.h
A engines/hpl1/engine/scene/TileMapLineIt.cpp
A engines/hpl1/engine/scene/TileMapLineIt.h
A engines/hpl1/engine/scene/TileMapRectIt.cpp
A engines/hpl1/engine/scene/TileMapRectIt.h
A engines/hpl1/engine/scene/TileSet.cpp
A engines/hpl1/engine/scene/TileSet.h
A engines/hpl1/engine/scene/World2D.cpp
A engines/hpl1/engine/scene/World2D.h
A engines/hpl1/engine/scene/World3D.cpp
A engines/hpl1/engine/scene/World3D.h
A engines/hpl1/engine/sound/LowLevelSound.cpp
A engines/hpl1/engine/sound/LowLevelSound.h
A engines/hpl1/engine/sound/MusicHandler.cpp
A engines/hpl1/engine/sound/MusicHandler.h
A engines/hpl1/engine/sound/Sound.cpp
A engines/hpl1/engine/sound/Sound.h
A engines/hpl1/engine/sound/SoundChannel.h
A engines/hpl1/engine/sound/SoundData.h
A engines/hpl1/engine/sound/SoundEntityData.cpp
A engines/hpl1/engine/sound/SoundEntityData.h
A engines/hpl1/engine/sound/SoundEnvironment.h
A engines/hpl1/engine/sound/SoundHandler.cpp
A engines/hpl1/engine/sound/SoundHandler.h
A engines/hpl1/engine/system/BinTree.h
A engines/hpl1/engine/system/Container.cpp
A engines/hpl1/engine/system/Container.h
A engines/hpl1/engine/system/LogicTimer.cpp
A engines/hpl1/engine/system/LogicTimer.h
A engines/hpl1/engine/system/LowLevelSystem.h
A engines/hpl1/engine/system/MemoryManager.cpp
A engines/hpl1/engine/system/MemoryManager.h
A engines/hpl1/engine/system/Script.h
A engines/hpl1/engine/system/SerializeClass.cpp
A engines/hpl1/engine/system/SerializeClass.h
A engines/hpl1/engine/system/String.cpp
A engines/hpl1/engine/system/String.h
A engines/hpl1/engine/system/System.cpp
A engines/hpl1/engine/system/System.h
A engines/hpl1/engine/system/SystemTypes.h
engines/hpl1/credits.pl
engines/hpl1/module.mk
diff --git a/engines/hpl1/credits.pl b/engines/hpl1/credits.pl
index 91918098c30..1fa1d19cc78 100644
--- a/engines/hpl1/credits.pl
+++ b/engines/hpl1/credits.pl
@@ -1,3 +1,3 @@
-begin_section("Hpl1");
- add_person("Name 1", "Handle 1", "");
-end_section();
+begin_section("Hpl1");
+ add_person("Name 1", "Handle 1", "");
+end_section();
diff --git a/engines/hpl1/engine/ai/AI.cpp b/engines/hpl1/engine/ai/AI.cpp
new file mode 100644
index 00000000000..6c68a87f280
--- /dev/null
+++ b/engines/hpl1/engine/ai/AI.cpp
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/ai/AI.h"
+
+#include "hpl1/engine/ai/AINodeGenerator.h"
+#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/MemoryManager.h"
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cAI::cAI() : iUpdateable("HPL_AI")
+ {
+ mpAINodeGenerator = hplNew( cAINodeGenerator, () );
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAI::~cAI()
+ {
+ hplDelete(mpAINodeGenerator);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cAI::Reset()
+ {
+
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cAI::Update(float afTimeStep)
+ {
+
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cAI::Init()
+ {
+
+ }
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/ai/AI.h b/engines/hpl1/engine/ai/AI.h
new file mode 100644
index 00000000000..173987fc2fb
--- /dev/null
+++ b/engines/hpl1/engine/ai/AI.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_AI_H
+#define HPL_AI_H
+
+#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/game/GameTypes.h"
+
+#include "hpl1/engine/game/Updateable.h"
+
+namespace hpl {
+
+ class cAINodeGenerator;
+
+ class cAI : public iUpdateable
+ {
+ public:
+ cAI();
+ ~cAI();
+
+ void Reset();
+ void Update(float afTimeStep);
+
+ void Init();
+
+ cAINodeGenerator *GetNodeGenerator(){ return mpAINodeGenerator;}
+
+ private:
+ cAINodeGenerator *mpAINodeGenerator;
+ };
+
+};
+#endif // HPL_AI_H
diff --git a/engines/hpl1/engine/ai/AINodeContainer.cpp b/engines/hpl1/engine/ai/AINodeContainer.cpp
new file mode 100644
index 00000000000..05e9bc803f9
--- /dev/null
+++ b/engines/hpl1/engine/ai/AINodeContainer.cpp
@@ -0,0 +1,648 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/ai/AINodeContainer.h"
+
+#include "hpl1/engine/scene/World3D.h"
+#include "hpl1/engine/physics/PhysicsBody.h"
+#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/system/LowLevelSystem.h"
+
+#include "hpl1/engine/math/Math.h"
+
+
+#include "hpl1/engine/impl/tinyXML/tinyxml.h"
+
+#include <algorithm>
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // AI NODE
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cAINode::cAINode()
+ {
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAINode::~cAINode()
+ {
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cAINode::AddEdge(cAINode *pNode)
+ {
+ cAINodeEdge Edge;
+
+ Edge.mpNode = pNode;
+ Edge.mfDistance = cMath::Vector3Dist(mvPosition, pNode->mvPosition);
+ Edge.mfSqrDistance = cMath::Vector3DistSqr(mvPosition, pNode->mvPosition);
+
+ mvEdges.push_back(Edge);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // RAY INTERSECT
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cAINodeRayCallback::Reset()
+ {
+ mbIntersected = false;
+ mpCallback = NULL;
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cAINodeRayCallback::Intersected()
+ {
+ return mbIntersected;
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cAINodeRayCallback::BeforeIntersect(iPhysicsBody *pBody)
+ {
+ if(pBody->GetCollideCharacter()==false) return false;
+
+ if( (mFlags & eAIFreePathFlag_SkipStatic) && pBody->GetMass() == 0) return false;
+
+ if( (mFlags & eAIFreePathFlag_SkipDynamic) &&
+ (pBody->GetMass() > 0 || pBody->IsCharacter()) ) return false;
+
+ if( (mFlags & eAIFreePathFlag_SkipVolatile) && pBody->IsVolatile()) return false;
+
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cAINodeRayCallback::OnIntersect(iPhysicsBody *pBody,cPhysicsRayParams *apParams)
+ {
+ if(mpCallback)
+ {
+ if(mpCallback->Intersects(pBody,apParams))
+ {
+ mbIntersected = true;
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ mbIntersected = true;
+ return false;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cAINodeIterator::cAINodeIterator(cAINodeContainer *apContainer, const cVector3f &avPos, float afRadius)
+ {
+ mpContainer = apContainer;
+ mvPosition = avPos;
+ mfRadius = afRadius;
+
+ //Calculate local position
+ cVector2f vLocalPos(mvPosition.x, mvPosition.z);
+ vLocalPos -= mpContainer->mvMinGridPos;
+
+ cVector2f vLocalStart = vLocalPos - cVector2f(afRadius);
+ cVector2f vLocalEnd = vLocalPos + cVector2f(afRadius);
+
+ mvStartGridPos = mpContainer->GetGridPosFromLocal(vLocalStart);
+ mvEndGridPos = mpContainer->GetGridPosFromLocal(vLocalEnd);
+ mvGridPos = mvStartGridPos;
+
+ mpNodeList = &mpContainer->GetGrid(mvGridPos)->mlstNodes;
+ while(mpNodeList->empty())
+ {
+ if(IncGridPos())
+ {
+ mpNodeList = &mpContainer->GetGrid(mvGridPos)->mlstNodes;
+ }
+ else
+ {
+ mpNodeList = NULL;
+ break;
+ }
+ }
+
+ if(mpNodeList){
+ mNodeIt = mpNodeList->begin();
+ }
+
+ //Log("--------------------------------------\n");
+ //Log("Iterating (%d %d) -> (%d %d)\n", mvStartGridPos.x,mvStartGridPos.y,
+ // mvEndGridPos.x,mvEndGridPos.y);
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cAINodeIterator::HasNext()
+ {
+ if(mpNodeList==NULL || mpNodeList->empty()) return false;
+
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAINode *cAINodeIterator::Next()
+ {
+ cAINode* pNode = *mNodeIt;
+
+ ++mNodeIt;
+ if(mNodeIt == mpNodeList->end())
+ {
+ if(IncGridPos())
+ {
+ mpNodeList = &mpContainer->GetGrid(mvGridPos)->mlstNodes;
+ while(mpNodeList->empty())
+ {
+ if(IncGridPos()){
+ mpNodeList = &mpContainer->GetGrid(mvGridPos)->mlstNodes;
+ }
+ else{
+ mpNodeList = NULL;
+ break;
+ }
+ }
+ }
+ else
+ {
+ mpNodeList = NULL;
+ }
+
+ if(mpNodeList) mNodeIt = mpNodeList->begin();
+ }
+
+ return pNode;
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cAINodeIterator::IncGridPos()
+ {
+ mvGridPos.x++;
+ if(mvGridPos.x > mvEndGridPos.x)
+ {
+ mvGridPos.x = mvStartGridPos.x;
+ mvGridPos.y++;
+ if(mvGridPos.y > mvEndGridPos.y){
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cAINodeContainer::cAINodeContainer( const tString& asName, const tString &asNodeName,
+ cWorld3D *apWorld, const cVector3f &avCollideSize)
+ {
+ mpWorld = apWorld;
+ mvSize = avCollideSize;
+ msName = asName;
+ msNodeName = asNodeName;
+
+ mpRayCallback = hplNew( cAINodeRayCallback, () );
+
+ mlMaxNodeEnds = 5;
+ mlMinNodeEnds = 2;
+ mfMaxEndDistance = 3.0f;
+ mfMaxHeight = 0.1f;
+
+ mlNodesPerGrid = 6;
+
+ mbNodeIsAtCenter = true;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAINodeContainer::~cAINodeContainer()
+ {
+ hplDelete(mpRayCallback);
+
+ STLDeleteAll(mvNodes);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cAINodeContainer::ReserveSpace(size_t alReserveSpace)
+ {
+ mvNodes.reserve(alReserveSpace);
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cAINodeContainer::AddNode(const tString &asName, const cVector3f &avPosition, void *apUserData)
+ {
+ cAINode *pNode = hplNew( cAINode, () );
+ pNode->msName = asName;
+ pNode->mvPosition = avPosition;
+ pNode->mpUserData = apUserData;
+
+ mvNodes.push_back(pNode);
+ m_mapNodes.insert(tAINodeMap::value_type(asName,pNode));
+ }
+
+ //-----------------------------------------------------------------------
+
+ int cAINodeContainer::GetNodeNum() const
+ {
+ return (int)mvNodes.size();
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAINode* cAINodeContainer::GetNodeFromName(const tString &asName)
+ {
+ tAINodeMapIt it = m_mapNodes.find(asName);
+ if(it == m_mapNodes.end())
+ {
+ return NULL;
+ }
+
+ return it->second;
+
+ //return (cAINode*)STLFindByName(mvNodes,asName);
+ }
+
+ //-----------------------------------------------------------------------
+
+ class cSortEndNodes
+ {
+ public:
+ bool operator()(const cAINodeEdge &aEndA, const cAINodeEdge &aEndB)
+ {
+ return aEndA.mfDistance < aEndB.mfDistance;
+ }
+ };
+
+ void cAINodeContainer::Compile()
+ {
+ BuildNodeGridMap();
+
+ tAINodeVecIt CurrentNodeIt = mvNodes.begin();
+ for(; CurrentNodeIt != mvNodes.end(); ++CurrentNodeIt)
+ {
+ cAINode *pNode = *CurrentNodeIt;
+
+ ////////////////////////////////////////
+ //Add the ends that are connected to the node.
+ /*Log("Node %s checks: ",pNode->GetName().c_str());
+ tAINodeVecIt EndNodeIt = mvNodes.begin();
+ for(; EndNodeIt != mvNodes.end(); ++EndNodeIt)
+ {
+ cAINode *pEndNode = *EndNodeIt;
+
+ if(pEndNode == pNode) continue;
+ float fDist = cMath::Vector3Dist(pNode->mvPosition, pEndNode->mvPosition);
+ if(fDist > mfMaxEndDistance*2) continue;
+ Log("'%s'(%f) ",pEndNode->GetName().c_str(),fDist);
+
+ float fHeight = fabs(pNode->mvPosition.y - pEndNode->mvPosition.y);
+
+ if( fHeight <= mfMaxHeight &&
+ FreePath(pNode->mvPosition, pEndNode->mvPosition,-1,eAIFreePathFlag_SkipDynamic))
+ {
+ pNode->AddEdge(pEndNode);
+ Log("Added!");
+ }
+ Log(", ");
+ }
+ Log("\n");*/
+ //Log("Node %s checks: ",pNode->GetName().c_str());
+ cAINodeIterator nodeIt = GetNodeIterator(pNode->mvPosition,mfMaxEndDistance*1.5f);
+ while(nodeIt.HasNext())
+ {
+ cAINode *pEndNode = nodeIt.Next();
+
+ if(pEndNode == pNode) continue;
+ float fDist = cMath::Vector3Dist(pNode->mvPosition, pEndNode->mvPosition);
+ if(fDist > mfMaxEndDistance*2) continue;
+ //Log("'%s'(%f) ",pEndNode->GetName().c_str(),fDist);
+
+ float fHeight = fabs(pNode->mvPosition.y - pEndNode->mvPosition.y);
+
+ tAIFreePathFlag flag = eAIFreePathFlag_SkipDynamic | eAIFreePathFlag_SkipVolatile;
+ if( fHeight <= mfMaxHeight &&
+ FreePath(pNode->mvPosition, pEndNode->mvPosition,-1,flag))
+ {
+ pNode->AddEdge(pEndNode);
+ //Log("Added!");
+ }
+ //Log(", ");
+ }
+ //Log("\n");
+
+
+ ///////////////////////////////////////
+ //Sort nodes and remove unwanted ones.
+ std::sort(pNode->mvEdges.begin(), pNode->mvEdges.end(), cSortEndNodes());
+
+ //Resize if to too large
+ if(mlMaxNodeEnds > 0 && (int)pNode->mvEdges.size() > mlMaxNodeEnds)
+ {
+ pNode->mvEdges.resize(mlMaxNodeEnds);
+ }
+
+ //Remove ends to far, but skip if min nodes is not met
+ for(size_t i=0; i< pNode->mvEdges.size(); ++i)
+ {
+ if( pNode->mvEdges[i].mfDistance > mfMaxEndDistance && (int)i >= mlMinNodeEnds)
+ {
+ pNode->mvEdges.resize(i);
+ break;
+ }
+ }
+
+ //Log(" Final edge count: %d\n",pNode->mvEdges.size());
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cAINodeContainer::BuildNodeGridMap()
+ {
+ bool bLog=false;
+
+ if(bLog)Log("Nodes: %d\n",mvNodes.size());
+
+ ////////////////////////////////////
+ // Calculate min and max
+ cVector2f vMin(mvNodes[0]->GetPosition().x,mvNodes[0]->GetPosition().z);
+ cVector2f vMax(mvNodes[0]->GetPosition().x,mvNodes[0]->GetPosition().z);
+
+ for(size_t i=1; i< mvNodes.size(); ++i)
+ {
+ cAINode *pNode = mvNodes[i];
+
+ if(vMin.x > pNode->GetPosition().x) vMin.x = pNode->GetPosition().x;
+ if(vMin.y > pNode->GetPosition().z) vMin.y = pNode->GetPosition().z;
+
+ if(vMax.x < pNode->GetPosition().x) vMax.x = pNode->GetPosition().x;
+ if(vMax.y < pNode->GetPosition().z) vMax.y = pNode->GetPosition().z;
+ }
+
+ mvMinGridPos = vMin;
+ mvMaxGridPos = vMax;
+
+ ////////////////////////////////////
+ // Determine size of grids
+ int lGridNum = (int)(sqrt((float)mvNodes.size() / (float)mlNodesPerGrid)+0.5f)+1;
+
+ if(bLog)Log("Grid Num: %d\n",lGridNum);
+
+ mvGridMapSize.x = lGridNum;
+ mvGridMapSize.y = lGridNum;
+
+ //+1 to fix so that nodes on the border has a grid)
+ mvGrids.resize((lGridNum+1) * (lGridNum+1));
+
+ mvGridSize = (mvMaxGridPos - mvMinGridPos);
+ mvGridSize.x /= (float)mvGridMapSize.x;
+ mvGridSize.y /= (float)mvGridMapSize.y;
+
+ if(bLog)Log("GridSize: %f : %f\n",mvGridSize.x,mvGridSize.y);
+ if(bLog)Log("MinPos: %s\n",mvMinGridPos.ToString().c_str());
+ if(bLog)Log("MaxPos: %s\n",mvMaxGridPos.ToString().c_str());
+
+ ////////////////////////////////////
+ // Add nodes to grid
+ for(size_t i=0; i< mvNodes.size(); ++i)
+ {
+ cAINode *pNode = mvNodes[i];
+
+ cVector2f vLocalPos(pNode->GetPosition().x, pNode->GetPosition().z);
+ vLocalPos -= mvMinGridPos;
+
+ cVector2l vGridPos(0);
+ //Have checks so we are sure there is no division by zero.
+ if(mvGridSize.x >0)
+ vGridPos.x = (int)(vLocalPos.x / mvGridSize.x);
+ if(mvGridSize.y >0)
+ vGridPos.y = (int)(vLocalPos.y / mvGridSize.y);
+
+ if(false)Log("Adding node %d, world: (%s) local (%s), at %d : %d\n",i,
+ pNode->GetPosition().ToString().c_str(),
+ vLocalPos.ToString().c_str(),
+ vGridPos.x,vGridPos.y);
+
+ mvGrids[vGridPos.y * (mvGridMapSize.x+1) + vGridPos.x].mlstNodes.push_back(pNode);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAINodeIterator cAINodeContainer::GetNodeIterator(const cVector3f &avPosition, float afRadius)
+ {
+ return cAINodeIterator(this,avPosition, afRadius);
+ }
+
+ //-----------------------------------------------------------------------
+
+ static const cVector2f gvPosAdds[] = {cVector2f(0,0),
+ cVector2f(1,0),
+ cVector2f(-1,0),
+ cVector2f(0,1),
+ cVector2f(0,-1)
+ };
+
+ bool cAINodeContainer::FreePath(const cVector3f &avStart, const cVector3f &avEnd, int alRayNum,
+ tAIFreePathFlag aFlags,iAIFreePathCallback *apCallback)
+ {
+ iPhysicsWorld *pPhysicsWorld = mpWorld->GetPhysicsWorld();
+ if(pPhysicsWorld==NULL) return true;
+
+
+ if(alRayNum<0 || alRayNum>5) alRayNum =5;
+
+ /////////////////////////////
+ //Calculate the right vector
+ const cVector3f vForward = cMath::Vector3Normalize(avEnd - avStart);
+ const cVector3f vUp = cVector3f(0,1.0f,0);
+ const cVector3f vRight = cMath::Vector3Cross(vForward, vUp);
+
+ //Get the center
+ const cVector3f vStartCenter = mbNodeIsAtCenter ? avStart : avStart + cVector3f(0,mvSize.y/2,0);
+ const cVector3f vEndCenter = mbNodeIsAtCenter ? avEnd : avEnd + cVector3f(0,mvSize.y/2,0);
+
+ //Get the half with and height. Make them a little smaller so that player can slide over funk on floor.
+ const float fHalfWidth = mvSize.x * 0.4f;
+ const float fHalfHeight = mvSize.y * 0.4f;
+
+ //Setup ray callback
+ mpRayCallback->SetFlags(aFlags);
+
+ //Iterate through all the rays.
+ for(int i=0; i< alRayNum; ++i)
+ {
+ cVector3f vAdd = vRight * (gvPosAdds[i].x*fHalfWidth) + vUp * (gvPosAdds[i].y*fHalfHeight);
+ cVector3f vStart = vStartCenter + vAdd;
+ cVector3f vEnd = vEndCenter + vAdd;
+
+ mpRayCallback->Reset();
+ mpRayCallback->mpCallback = apCallback;
+
+ pPhysicsWorld->CastRay(mpRayCallback,vStart,vEnd,false,false,false,true);
+
+ if(mpRayCallback->Intersected()) return false;
+ }
+
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cAINodeContainer::SaveToFile(const tString &asFile)
+ {
+ TiXmlDocument* pXmlDoc = hplNew( TiXmlDocument,(asFile.c_str()) );
+
+ TiXmlElement *pRootElem = static_cast<TiXmlElement*>(pXmlDoc->InsertEndChild(TiXmlElement("AINodes")));
+
+ for(size_t i=0; i< mvNodes.size(); ++i)
+ {
+ cAINode * pNode = mvNodes[i];
+ TiXmlElement *pNodeElem = static_cast<TiXmlElement*>(pRootElem->InsertEndChild(TiXmlElement("Node")));
+
+ pNodeElem->SetAttribute("Name", pNode->GetName().c_str());
+
+ for(int edge =0; edge < pNode->GetEdgeNum(); ++edge)
+ {
+ cAINodeEdge *pEdge = pNode->GetEdge(edge);
+ TiXmlElement *pEdgeElem = static_cast<TiXmlElement*>(pNodeElem->InsertEndChild(TiXmlElement("Edge")));
+
+ pEdgeElem->SetAttribute("Node", pEdge->mpNode->GetName().c_str());
+ tString sDistance = cString::ToString(pEdge->mfDistance);
+ pEdgeElem->SetAttribute("Distance", sDistance.c_str());
+ }
+ }
+
+ if(pXmlDoc->SaveFile()==false)
+ {
+ Error("Couldn't save XML file %s\n",asFile.c_str());
+ }
+ hplDelete(pXmlDoc);
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cAINodeContainer::LoadFromFile(const tString &asFile)
+ {
+ BuildNodeGridMap();
+
+ TiXmlDocument* pXmlDoc = hplNew( TiXmlDocument, (asFile.c_str()) );
+ if(pXmlDoc->LoadFile()==false)
+ {
+ Warning("Couldn't open XML file %s\n",asFile.c_str());
+ hplDelete(pXmlDoc);
+ return;
+ }
+
+ TiXmlElement *pRootElem = pXmlDoc->RootElement();
+
+ TiXmlElement *pNodeElem = pRootElem->FirstChildElement("Node");
+ for(; pNodeElem != NULL; pNodeElem = pNodeElem->NextSiblingElement("Node"))
+ {
+ tString sName = cString::ToString(pNodeElem->Attribute("Name"),"");
+
+ cAINode *pNode = GetNodeFromName(sName);
+
+ TiXmlElement *pEdgeElem = pNodeElem->FirstChildElement("Edge");
+ for(; pEdgeElem != NULL; pEdgeElem = pEdgeElem->NextSiblingElement("Edge"))
+ {
+ tString sNodeName = cString::ToString(pEdgeElem->Attribute("Node"),"");
+ cAINode *pEdgeNode = GetNodeFromName(sNodeName);
+
+ cAINodeEdge Edge;
+ Edge.mpNode = pEdgeNode;
+ Edge.mfDistance = cString::ToFloat(pEdgeElem->Attribute("Distance"),0);
+ Edge.mfSqrDistance = Edge.mfDistance*Edge.mfDistance;
+
+ pNode->mvEdges.push_back(Edge);
+ }
+ }
+
+ hplDelete(pXmlDoc);
+ }
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PRIVATE METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cVector2l cAINodeContainer::GetGridPosFromLocal(const cVector2f &avLocalPos)
+ {
+ cVector2l vGridPos;
+ vGridPos.x = (int)(avLocalPos.x / mvGridSize.x);
+ vGridPos.y = (int)(avLocalPos.y / mvGridSize.y);
+
+ if(vGridPos.x <0)vGridPos.x =0;
+ if(vGridPos.y <0)vGridPos.y =0;
+ if(vGridPos.x > mvGridMapSize.x) vGridPos.x = mvGridMapSize.x;
+ if(vGridPos.y > mvGridMapSize.y) vGridPos.y = mvGridMapSize.y;
+
+ return vGridPos;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAIGridNode* cAINodeContainer::GetGrid(const cVector2l& avPos)
+ {
+ int lIndex = avPos.y * (mvGridMapSize.x+1) + avPos.x;
+ //Log(" index: %d Max: %d\n",lIndex,(int)mvGrids.size());
+
+ return &mvGrids[lIndex];
+ }
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/ai/AINodeContainer.h b/engines/hpl1/engine/ai/AINodeContainer.h
new file mode 100644
index 00000000000..7dcad7da4f8
--- /dev/null
+++ b/engines/hpl1/engine/ai/AINodeContainer.h
@@ -0,0 +1,299 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_AI_NODE_CONTAINER_H
+#define HPL_AI_NODE_CONTAINER_H
+
+#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/math/MathTypes.h"
+
+#include "hpl1/engine/physics/PhysicsWorld.h"
+
+namespace hpl {
+
+ class cWorld3D;
+
+ //--------------------------------
+
+ typedef tFlag tAIFreePathFlag;
+
+ #define eAIFreePathFlag_SkipStatic (0x00000001)
+ #define eAIFreePathFlag_SkipDynamic (0x00000002)
+ #define eAIFreePathFlag_SkipVolatile (0x00000004)
+
+
+ //--------------------------------
+ class cAINode;
+
+ class cAINodeEdge
+ {
+ public:
+ float mfDistance;
+ float mfSqrDistance;
+ cAINode *mpNode;
+ };
+
+ typedef std::vector<cAINodeEdge> tAINodeEdgeVec;
+ typedef tAINodeEdgeVec::iterator tAINodeEdgeVecIt;
+
+ //--------------------------------
+
+ class cAINode
+ {
+ friend class cAINodeContainer;
+ public:
+ cAINode();
+ ~cAINode();
+
+ void AddEdge(cAINode *pNode);
+
+ int GetEdgeNum() const { return (int)mvEdges.size();}
+ inline cAINodeEdge* GetEdge(int alIdx) { return &mvEdges[alIdx];}
+
+ const cVector3f& GetPosition(){ return mvPosition;}
+
+ const tString& GetName(){ return msName;}
+
+ private:
+ tString msName;
+ cVector3f mvPosition;
+ void *mpUserData;
+
+ tAINodeEdgeVec mvEdges;
+ };
+
+ typedef std::vector<cAINode*> tAINodeVec;
+ typedef tAINodeVec::iterator tAINodeVecIt;
+
+ typedef std::list<cAINode*> tAINodeList;
+ typedef tAINodeList::iterator tAINodeListIt;
+
+ typedef std::map<tString,cAINode*> tAINodeMap;
+ typedef tAINodeMap::iterator tAINodeMapIt;
+
+ //--------------------------------
+
+ class iAIFreePathCallback
+ {
+ public:
+ virtual bool Intersects(iPhysicsBody *pBody,cPhysicsRayParams *apParams)=0;
+ };
+
+ //--------------------------------
+
+ class cAINodeRayCallback : public iPhysicsRayCallback
+ {
+ public:
+ void Reset();
+ void SetFlags(tAIFreePathFlag aFlags){ mFlags = aFlags;}
+
+ bool BeforeIntersect(iPhysicsBody *pBody);
+ bool OnIntersect(iPhysicsBody *pBody,cPhysicsRayParams *apParams);
+
+ bool Intersected();
+
+ iAIFreePathCallback *mpCallback;
+
+ private:
+ bool mbIntersected;
+ tAIFreePathFlag mFlags;
+ };
+
+ //--------------------------------
+
+ class cAIGridNode
+ {
+ public:
+ tAINodeList mlstNodes;
+ };
+
+ //--------------------------------
+ class cAINodeContainer;
+
+ class cAINodeIterator
+ {
+ public:
+ cAINodeIterator(cAINodeContainer *apContainer, const cVector3f &avPos, float afRadius);
+
+ bool HasNext();
+ cAINode *Next();
+
+ private:
+ bool IncGridPos();
+
+ cAINodeContainer *mpContainer;
+ cVector3f mvPosition;
+ float mfRadius;
+ cVector2l mvStartGridPos;
+ cVector2l mvEndGridPos;
+ cVector2l mvGridPos;
+
+ tAINodeList *mpNodeList;
+ tAINodeListIt mNodeIt;
+ };
+
+ //--------------------------------
+
+ class cAINodeContainer
+ {
+ friend class cAINodeIterator;
+ public:
+ cAINodeContainer( const tString& asName,const tString &asNodeName,
+ cWorld3D *apWorld, const cVector3f &avCollideSize);
+ ~cAINodeContainer();
+
+ const tString& GetNodeName(){ return msNodeName;}
+ const tString& GetName(){ return msName;}
+
+ const cVector3f& GetCollideSize(){ return mvSize;}
+
+ /**
+ * Reserves spaces for nodes.
+ * \param alReserveSpace Number of nodes to reserve space for.
+ */
+ void ReserveSpace(size_t alReserveSpace);
+
+ /**
+ * Adds a new node to the container.
+ * \param &asName Name of the node
+ * \param &avPosition Position of the node.
+ * \param *apUserData Data supplied by user.
+ */
+ void AddNode(const tString &asName, const cVector3f &avPosition, void *apUserData=NULL);
+
+ /**
+ * Get the number of nodes.
+ */
+ int GetNodeNum() const;
+
+ /**
+ * Get a node.
+ * \param alIdx index of node.
+ */
+ inline cAINode* GetNode(int alIdx){return mvNodes[alIdx];}
+
+ /**
+ * Gets a node based on the name.
+ * \param &asName Name of the node.
+ */
+ cAINode* GetNodeFromName(const tString &asName);
+
+
+ /**
+ * Compile the added nodes.
+ */
+ void Compile();
+
+ /**
+ * Build a grid map for nodes. (Used internally mostly)
+ */
+ void BuildNodeGridMap();
+
+ /**
+ * Returns a node iterator. Note that the radius is not checked, some nodes may lie outside.
+ * \param &avPosition
+ * \param afRadius
+ * \return
+ */
+ cAINodeIterator GetNodeIterator(const cVector3f &avPosition, float afRadius);
+
+ /**
+ * Checks for a free path using the containers collide size.
+ * \param &avStart
+ * \param &avEnd
+ * \param alRayNum The max number of rays cast, -1 = maximum
+ * \param alFlags Set Flags for the ray casting.
+ * \param apCallback Check for every body and overrides alFlags.
+ * \return
+ */
+ bool FreePath(const cVector3f &avStart, const cVector3f &avEnd, int alRayNum=-1,
+ tAIFreePathFlag aFlags=0, iAIFreePathCallback *apCallback=NULL);
+
+
+ /**
+ * Sets the max number of end node added to a node.
+ * \param alX The max number, -1 = unlimited
+ */
+ void SetMaxEdges(int alX){ mlMaxNodeEnds = alX;}
+
+ /**
+ * Sets the min number of end node added to a node. This overrides max distance when needed.
+ */
+ void SetMinEdges(int alX){ mlMinNodeEnds = alX;}
+
+ /**
+ * Sets the max distance for an end node.
+ * \param afX
+ */
+ void SetMaxEdgeDistance(float afX){ mfMaxEndDistance = afX;}
+
+ float GetMaxEdgeDistance() const { return mfMaxEndDistance;}
+
+ void SetMaxHeight(float afX){ mfMaxHeight = afX;}
+ float GetMaxHeight()const{ return mfMaxHeight;}
+
+ /**
+ * When calculating if there is a free path between two nodes. Is the node postion the center of the collider.
+ * If not the position is the feet postion.
+ */
+ void SetNodeIsAtCenter(bool abX){ mbNodeIsAtCenter = abX;}
+ bool GetNodeIsAtCenter(){ return mbNodeIsAtCenter;}
+
+
+ /**
+ * Saves all the node connections to file.
+ */
+ void SaveToFile(const tString &asFile);
+ /**
+ * Loads all node connections from file. Only to be done after all nodes are loaded.
+ */
+ void LoadFromFile(const tString &asFile);
+
+ private:
+ cVector2l GetGridPosFromLocal(const cVector2f &avLocalPos);
+ cAIGridNode* GetGrid(const cVector2l& avPos);
+
+ tString msName;
+ tString msNodeName;
+
+ cWorld3D *mpWorld;
+ cVector3f mvSize;
+
+ cAINodeRayCallback *mpRayCallback;
+ tAINodeVec mvNodes;
+ tAINodeMap m_mapNodes;
+
+ bool mbNodeIsAtCenter;
+
+ cVector2l mvGridMapSize;
+ cVector2f mvGridSize;
+ cVector2f mvMinGridPos;
+ cVector2f mvMaxGridPos;
+ int mlNodesPerGrid;
+
+ std::vector<cAIGridNode> mvGrids;
+
+ //properties
+ int mlMaxNodeEnds;
+ int mlMinNodeEnds;
+ float mfMaxEndDistance;
+ float mfMaxHeight;
+ };
+
+};
+#endif // HPL_AI_NODE_CONTAINER_H
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.cpp b/engines/hpl1/engine/ai/AINodeGenerator.cpp
new file mode 100644
index 00000000000..7ce3aead0f0
--- /dev/null
+++ b/engines/hpl1/engine/ai/AINodeGenerator.cpp
@@ -0,0 +1,349 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/ai/AINodeGenerator.h"
+
+#include "hpl1/engine/scene/World3D.h"
+
+#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/System.h"
+#include "hpl1/engine/system/String.h"
+
+#include "hpl1/engine/resources/Resources.h"
+#include "hpl1/engine/resources/FileSearcher.h"
+
+#include "hpl1/engine/physics/PhysicsWorld.h"
+#include "hpl1/engine/physics/PhysicsBody.h"
+
+#include "hpl1/engine/impl/tinyXML/tinyxml.h"
+
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // PARAMS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cAINodeGeneratorParams::cAINodeGeneratorParams()
+ {
+ msNodeType = "node";
+
+ mfHeightFromGround = 0.1f;
+ mfMinWallDist = 0.4f;
+
+ mvMinPos = cVector3f(-10000, -10000, -10000);
+ mvMaxPos = cVector3f(10000, 10000, 10000);
+
+ mfGridSize = 0.4f;
+ }
+
+ //-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
+
+ class cCollideRayCallback : public iPhysicsRayCallback
+ {
+ public:
+ bool OnIntersect(iPhysicsBody *pBody,cPhysicsRayParams *apParams)
+ {
+ if(pBody->GetMass()!=0) return true;
+
+ mbIntersected = true;
+ mvPos = apParams->mvPoint;
+ mfDist = apParams->mfDist;
+
+ return false;
+ }
+
+ bool mbIntersected;
+ cVector3f mvPos;
+ float mfDist;
+ };
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cAINodeGenerator::cAINodeGenerator()
+ {
+
+ }
+
+ cAINodeGenerator::~cAINodeGenerator()
+ {
+
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ static cCollideRayCallback gCollideRayCallback;
+
+ //-----------------------------------------------------------------------
+
+ void cAINodeGenerator::Generate(cWorld3D* apWorld,cAINodeGeneratorParams *apParams)
+ {
+ mpWorld = apWorld;
+ mpParams = apParams;
+
+ iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
+
+ bool mbLoadFromFile=false;
+
+ cSystem *pSystem = apWorld->GetSystem();
+ cResources *pResources = apWorld->GetResources();
+ cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
+
+ mpNodeList = apWorld->GetAINodeList(mpParams->msNodeType);
+
+ if(mpWorld->GetFileName() != "")
+ {
+ tString sPath = pFileSearcher->GetFilePath(mpWorld->GetFileName());
+ tWString sSaveFile = cString::To16Char(cString::SetFileExt(sPath,"ainodes"));
+
+ if(sPath != "" && FileExists(sSaveFile))
+ {
+ cDate mapDate = FileModifiedDate( cString::To16Char(sPath));
+ cDate saveDate = FileModifiedDate(sSaveFile);
+
+ //If the save file is newer than the map load from it.
+ if(saveDate > mapDate)
+ {
+ LoadFromFile();
+ return;
+ }
+ }
+ }
+
+
+ /////////////////////////////////
+ // Get the size of the world
+ cPhysicsBodyIterator it = pPhysicsWorld->GetBodyIterator();
+ cVector3f vWorldMax(-100000,-100000,-100000);
+ cVector3f vWorldMin( 100000, 100000, 100000);
+
+ while(it.HasNext())
+ {
+ iPhysicsBody *pBody = it.Next();
+
+ cVector3f vMin = pBody->GetBV()->GetMin();
+ cVector3f vMax = pBody->GetBV()->GetMax();
+
+ //X
+ if(vWorldMin.x > vMin.x) vWorldMin.x = vMin.x;
+ if(vWorldMax.x < vMax.x) vWorldMax.x = vMax.x;
+
+ //Y
+ if(vWorldMin.y > vMin.y) vWorldMin.y = vMin.y;
+ if(vWorldMax.y < vMax.y) vWorldMax.y = vMax.y;
+
+ //Z
+ if(vWorldMin.z > vMin.z) vWorldMin.z = vMin.z;
+ if(vWorldMax.z < vMax.z) vWorldMax.z = vMax.z;
+ }
+
+ //Make the world small according to grid size.
+ vWorldMin.x += mpParams->mfGridSize;
+ vWorldMin.z += mpParams->mfGridSize;
+ vWorldMax.x -= mpParams->mfGridSize;
+ vWorldMax.z -= mpParams->mfGridSize;
+
+ /////////////////////////////////////////
+ //Check against the user set min and max
+ if(vWorldMin.x < mpParams->mvMinPos.x) vWorldMin.x = mpParams->mvMinPos.x;
+ if(vWorldMax.x > mpParams->mvMaxPos.x) vWorldMax.x = mpParams->mvMaxPos.x;
+
+ if(vWorldMin.y < mpParams->mvMinPos.y) vWorldMin.y = mpParams->mvMinPos.y;
+ if(vWorldMax.y > mpParams->mvMaxPos.y) vWorldMax.y = mpParams->mvMaxPos.y;
+
+ if(vWorldMin.z < mpParams->mvMinPos.z) vWorldMin.z = mpParams->mvMinPos.z;
+ if(vWorldMax.z > mpParams->mvMaxPos.z) vWorldMax.z = mpParams->mvMaxPos.z;
+
+
+ /////////////////////////////////////////
+ //Place the nodes in the world
+ cVector3f vPos(vWorldMin.x,0,vWorldMin.z);
+
+ while(vPos.z <= vWorldMax.z)
+ {
+ cVector3f vStart(vPos.x, vWorldMax.y, vPos.z);
+ cVector3f vEnd(vPos.x, vWorldMin.y, vPos.z);
+
+ pPhysicsWorld->CastRay(this,vStart,vEnd,false,false,true);
+
+ //Log("Pos: %s Min: %s Max: %s\n",vPos.ToString().c_str(),
+ // vWorldMin.ToString().c_str(),
+ // vWorldMax.ToString().c_str());
+
+ vPos.x += apParams->mfGridSize;
+ if(vPos.x > vWorldMax.x)
+ {
+ vPos.x = vWorldMin.x;
+ vPos.z += apParams->mfGridSize;
+ }
+ }
+
+ /////////////////////////////////////////
+ //Check so that the nodes are not too close to walls
+ cVector3f vEnds[4] = { cVector3f(mpParams->mfMinWallDist,0,0),
+ cVector3f(-mpParams->mfMinWallDist,0,0),
+ cVector3f(0,0,mpParams->mfMinWallDist),
+ cVector3f(0,0,-mpParams->mfMinWallDist)
+ };
+
+ cVector3f vPushBackDirs[4] = { cVector3f(-1,0,0),
+ cVector3f(1,0,0),
+ cVector3f(0,0,-1),
+ cVector3f(0,0,1)
+ };
+
+ tTempAiNodeListIt nodeIt = mpNodeList->begin();
+ for(; nodeIt != mpNodeList->end(); ++nodeIt)
+ {
+ cTempAiNode &Node = *nodeIt;
+
+ //Check if there are any walls close by.
+ for(int i=0; i<4; ++i)
+ {
+ gCollideRayCallback.mbIntersected = false;
+ pPhysicsWorld->CastRay(&gCollideRayCallback,Node.mvPos,Node.mvPos + vEnds[i],true,false,true);
+
+ if(gCollideRayCallback.mbIntersected)
+ {
+ //Log("Walldistance %f : Add: (%s) Push (%s) Min: %f\n",gCollideRayCallback.mfDist,
+ // vEnds[i].ToString().c_str(),
+ // vPushBackDirs[i].ToString().c_str(),
+ // mpParams->mfMinWallDist);
+ if(gCollideRayCallback.mfDist < mpParams->mfMinWallDist)
+ {
+ Node.mvPos += vPushBackDirs[i] * (mpParams->mfMinWallDist - gCollideRayCallback.mfDist);
+ }
+ }
+ }
+ }
+
+ ///////////////////////////////////////////
+ // Save to file
+
+ SaveToFile();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PRIVATE
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ bool cAINodeGenerator::OnIntersect(iPhysicsBody *pBody,cPhysicsRayParams *apParams)
+ {
+ if(pBody->GetMass() != 0) return true;
+
+ iPhysicsWorld *pPhysicsWorld = mpWorld->GetPhysicsWorld();
+
+ cVector3f vPosition = apParams->mvPoint + cVector3f(0,mpParams->mfHeightFromGround,0);
+
+ mpNodeList->push_back(cTempAiNode(vPosition,""));
+
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cAINodeGenerator::SaveToFile()
+ {
+ if(mpWorld->GetFileName() == "") return;
+
+ cSystem *pSystem = mpWorld->GetSystem();
+ cResources *pResources = mpWorld->GetResources();
+ cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
+
+ tString sMapPath = pFileSearcher->GetFilePath(mpWorld->GetFileName());
+ tString sSaveFile = cString::SetFileExt(sMapPath,"ainodes");
+
+ TiXmlDocument* pXmlDoc = hplNew( TiXmlDocument, (sSaveFile.c_str()) );
+
+ TiXmlElement *pRootElem = static_cast<TiXmlElement*>(pXmlDoc->InsertEndChild(TiXmlElement("AiNodes")));
+
+ tTempAiNodeListIt nodeIt = mpNodeList->begin();
+ for(; nodeIt != mpNodeList->end(); ++nodeIt)
+ {
+ cTempAiNode &Node = *nodeIt;
+ TiXmlElement *pNodeElem = static_cast<TiXmlElement*>(pRootElem->InsertEndChild(TiXmlElement("Node")));
+
+ tString sPos = cString::ToString(Node.mvPos.x)+" " +
+ cString::ToString(Node.mvPos.y)+" " +
+ cString::ToString(Node.mvPos.z);
+ pNodeElem->SetAttribute("Pos",sPos.c_str());
+ pNodeElem->SetAttribute("Name", Node.msName.c_str());
+ }
+
+ if(pXmlDoc->SaveFile()==false)
+ {
+ Error("Couldn't save XML file %s\n",sSaveFile.c_str());
+ }
+ hplDelete(pXmlDoc);
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cAINodeGenerator::LoadFromFile()
+ {
+ if(mpWorld->GetFileName() == "") return;
+
+ cSystem *pSystem = mpWorld->GetSystem();
+ cResources *pResources = mpWorld->GetResources();
+ cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
+
+ tString sMapPath = pFileSearcher->GetFilePath(mpWorld->GetFileName());
+ tString sSaveFile = cString::SetFileExt(sMapPath,"ainodes");
+
+ TiXmlDocument* pXmlDoc = hplNew( TiXmlDocument, (sSaveFile.c_str()) );
+ if(pXmlDoc->LoadFile()==false)
+ {
+ Warning("Couldn't open XML file %s\n",sSaveFile.c_str());
+ hplDelete(pXmlDoc);
+ return;
+ }
+
+ TiXmlElement *pRootElem = pXmlDoc->RootElement();
+
+ TiXmlElement *pNodeElem = pRootElem->FirstChildElement("Node");
+ for(; pNodeElem != NULL; pNodeElem = pNodeElem->NextSiblingElement("Node"))
+ {
+ cVector3f vPos = cString::ToVector3f(pNodeElem->Attribute("Pos"),0);
+ tString sName = cString::ToString(pNodeElem->Attribute("Name"),"");
+
+ mpNodeList->push_back(cTempAiNode(vPos,sName));
+ }
+
+ hplDelete(pXmlDoc);
+ }
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.h b/engines/hpl1/engine/ai/AINodeGenerator.h
new file mode 100644
index 00000000000..1086d73ffc0
--- /dev/null
+++ b/engines/hpl1/engine/ai/AINodeGenerator.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_AI_NODE_GENERATOR_H
+#define HPL_AI_NODE_GENERATOR_H
+
+#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/game/GameTypes.h"
+
+#include "hpl1/engine/physics/PhysicsWorld.h"
+#include "hpl1/engine/scene/World3D.h"
+
+namespace hpl {
+
+ class cWorld3D;
+
+ //-------------------------------
+
+ class cAINodeGeneratorParams
+ {
+ public:
+ cAINodeGeneratorParams();
+
+ tString msNodeType;
+
+ float mfHeightFromGround;
+ float mfMinWallDist;
+
+ cVector3f mvMinPos;
+ cVector3f mvMaxPos;
+
+ float mfGridSize;
+ };
+
+ //-------------------------------
+
+ class cAINodeGenerator : public iPhysicsRayCallback
+ {
+ public:
+ cAINodeGenerator();
+ ~cAINodeGenerator();
+
+ void Generate(cWorld3D* apWorld,cAINodeGeneratorParams *apParams);
+
+ private:
+ bool OnIntersect(iPhysicsBody *pBody,cPhysicsRayParams *apParams);
+
+ void SaveToFile();
+ void LoadFromFile();
+
+ cAINodeGeneratorParams *mpParams;
+ cWorld3D* mpWorld;
+ tTempAiNodeList *mpNodeList;
+ };
+
+};
+#endif // HPL_AI_NODE_GENERATOR_H
diff --git a/engines/hpl1/engine/ai/AStar.cpp b/engines/hpl1/engine/ai/AStar.cpp
new file mode 100644
index 00000000000..2dcfdf49562
--- /dev/null
+++ b/engines/hpl1/engine/ai/AStar.cpp
@@ -0,0 +1,345 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/ai/AStar.h"
+
+#include "hpl1/engine/ai/AINodeContainer.h"
+
+#include "hpl1/engine/math/Math.h"
+
+#include "hpl1/engine/system/LowLevelSystem.h"
+
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // NODE
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cAStarNode::cAStarNode(cAINode *apAINode)
+ {
+ mpParent = NULL;
+ mpAINode = apAINode;
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cAStarNodeCompare::operator()(cAStarNode* apNodeA,cAStarNode* apNodeB) const
+ {
+ return apNodeA->mpAINode < apNodeB->mpAINode;
+ }
+
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cAStarHandler::cAStarHandler(cAINodeContainer *apContainer)
+ {
+ mlMaxIterations = -1;
+
+ mpContainer = apContainer;
+
+ mpCallback = NULL;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAStarHandler::~cAStarHandler()
+ {
+ STLDeleteAll(m_setClosedList);
+ STLDeleteAll(m_setOpenList);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ bool cAStarHandler::GetPath(const cVector3f& avStart, const cVector3f& avGoal,tAINodeList *apNodeList)
+ {
+ /////////////////////////////////////////////////
+ // check if there is free path from start to goal
+ if(mpContainer->FreePath(avStart,avGoal,3))
+ {
+ mpGoalNode = NULL;
+ return true;
+ }
+
+ ////////////////////////////////////////////////
+ //Reset all variables
+ //These should just be cleared and pools used instead.
+ STLDeleteAll(m_setClosedList);
+ STLDeleteAll(m_setOpenList);
+ m_setGoalNodes.clear();
+ mpGoalNode=NULL;
+
+ //Set goal position
+ mvGoal = avGoal;
+
+ float fMaxHeight = mpContainer->GetMaxHeight()*1.5f;
+
+ ////////////////////////////////////////////////
+ //Find nodes reachable from the start and goal position (use double 2*2 distance)
+ float fMaxDist = mpContainer->GetMaxEdgeDistance()*2; //float fMaxDist = mpContainer->GetMaxEdgeDistance()*mpContainer->GetMaxEdgeDistance()*4;
+
+ /////////////////////
+ //Check with Start
+ //Log(" Get Start\n");
+ cAINodeIterator startNodeIt = mpContainer->GetNodeIterator(avStart,fMaxDist);
+ while(startNodeIt.HasNext())
+ {
+ cAINode *pAINode = startNodeIt.Next();
+ //Log("Check node: %s\n",pAINode->GetName().c_str());
+
+ float fHeight = fabs(avStart.y - pAINode->GetPosition().y);
+ float fDist = cMath::Vector3Dist(avStart,pAINode->GetPosition()); //float fDist = cMath::Vector3DistSqr(avStart,pAINode->GetPosition());
+ if(fDist < fMaxDist && fHeight <= fMaxHeight)
+ {
+ //Check if path is clear
+ if(mpContainer->FreePath(avStart,pAINode->GetPosition(),-1,
+ eAIFreePathFlag_SkipDynamic))
+ {
+ AddOpenNode(pAINode,NULL,fDist);
+ }
+ }
+ }
+ //Log(" Found start\n");
+
+ ////////////////////////////////
+ //Check with Goal
+ //Log(" Get Goal\n");
+ cAINodeIterator goalNodeIt = mpContainer->GetNodeIterator(avGoal,fMaxDist);
+ while(goalNodeIt.HasNext())
+ {
+ cAINode *pAINode = goalNodeIt.Next();
+ //Log("Check node: %s\n",pAINode->GetName().c_str());
+
+ float fHeight = fabs(avGoal.y - pAINode->GetPosition().y);
+ float fDist = cMath::Vector3Dist(avGoal,pAINode->GetPosition()); //fDist = cMath::Vector3DistSqr(avGoal,pAINode->GetPosition());
+ if(fDist < fMaxDist && fHeight <= fMaxHeight)
+ {
+ //Check if path is clear
+ if(mpContainer->FreePath(avGoal,pAINode->GetPosition(),3))
+ {
+ m_setGoalNodes.insert(pAINode);
+ }
+ }
+ }
+ //Log(" Found goal\n");
+
+ /*for(int i=0; i<mpContainer->GetNodeNum(); ++i)
+ {
+ cAINode *pAINode = mpContainer->GetNode(i);
+
+ ////////////////////////////////
+ //Check with Start
+ float fHeight = fabs(avStart.y - pAINode->GetPosition().y);
+ float fDist = cMath::Vector3Dist(avStart,pAINode->GetPosition());
+ //float fDist = cMath::Vector3DistSqr(avStart,pAINode->GetPosition());
+ if(fDist < fMaxDist && fHeight <= fMaxHeight)
+ {
+ //Check if path is clear
+ if(mpContainer->FreePath(avStart,pAINode->GetPosition(),-1))
+ {
+ AddOpenNode(pAINode,NULL,fDist);
+ }
+ }
+
+ ////////////////////////////////
+ //Check with Goal
+ fHeight = fabs(avGoal.y - pAINode->GetPosition().y);
+ fDist = cMath::Vector3Dist(avGoal,pAINode->GetPosition());
+ //fDist = cMath::Vector3DistSqr(avGoal,pAINode->GetPosition());
+ if(fDist < fMaxDist && fHeight <= fMaxHeight)
+ {
+ //Check if path is clear
+ if(mpContainer->FreePath(avGoal,pAINode->GetPosition(),3))
+ {
+ m_setGoalNodes.insert(pAINode);
+ }
+ }
+ }*/
+
+ ////////////////////////////////////////////////
+ //Iterate the algorithm
+ IterateAlgorithm();
+
+ ////////////////////////////////////////////////
+ //Check if goal was found, if so build path.
+ if(mpGoalNode)
+ {
+ if(apNodeList)
+ {
+ cAStarNode *pParentNode = mpGoalNode;
+ while(pParentNode != NULL)
+ {
+ apNodeList->push_back(pParentNode->mpAINode);
+ pParentNode = pParentNode->mpParent;
+ }
+ }
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PRIVATE METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cAStarHandler::IterateAlgorithm()
+ {
+ int lIterationCount=0;
+ while(m_setOpenList.empty()==false && (mlMaxIterations <0 || lIterationCount < mlMaxIterations))
+ {
+ cAStarNode *pNode = GetBestNode();
+ cAINode *pAINode = pNode->mpAINode;
+
+ //////////////////////
+ // Check if current node can reach goal
+ if(IsGoalNode(pAINode))
+ {
+ mpGoalNode = pNode;
+ break;
+ }
+
+ /////////////////////
+ //Add nodes connected to current
+ int lEdgeCount = pAINode->GetEdgeNum();
+ for(int i=0; i< lEdgeCount; ++i)
+ {
+ cAINodeEdge *pEdge = pAINode->GetEdge(i);
+
+ if(mpCallback == NULL || mpCallback->CanAddNode(pAINode, pEdge->mpNode))
+ {
+ AddOpenNode(pEdge->mpNode, pNode, pNode->mfDistance + pEdge->mfDistance);
+ //AddOpenNode(pEdge->mpNode, pNode, pNode->mfDistance + pEdge->mfSqrDistance);
+ }
+ }
+
+ ++lIterationCount;
+ }
+ }
+
+
+ //-----------------------------------------------------------------------
+
+ void cAStarHandler::AddOpenNode(cAINode *apAINode, cAStarNode *apParent, float afDistance)
+ {
+ //TODO: free path check with dynamic objects here.
+
+ //TODO: Some pooling here would be good.
+ cAStarNode *pNode = hplNew( cAStarNode, (apAINode) );
+
+ //Check if it is in closed list.
+ tAStarNodeSetIt it = m_setClosedList.find(pNode);
+ if(it != m_setClosedList.end()){
+ hplDelete(pNode);
+ return;
+ }
+
+ //Try to add it to the open list
+ std::pair<tAStarNodeSetIt, bool> testPair = m_setOpenList.insert(pNode);
+ if(testPair.second == false){
+ hplDelete(pNode);
+ return;
+ }
+
+ pNode->mfDistance = afDistance;
+ pNode->mfCost = Cost(afDistance,apAINode,apParent) + Heuristic(pNode->mpAINode->GetPosition(), mvGoal);
+ pNode->mpParent = apParent;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAStarNode* cAStarHandler::GetBestNode()
+ {
+ tAStarNodeSetIt it = m_setOpenList.begin();
+ tAStarNodeSetIt bestIt = it;
+ cAStarNode* pBestNode = *it; ++it;
+
+ //Iterate open list and find the best node.
+ for(; it != m_setOpenList.end(); ++it)
+ {
+ cAStarNode *pNode = *it;
+ if(pBestNode->mfCost > pNode->mfCost)
+ {
+ pBestNode = pNode;
+ bestIt = it;
+ }
+ }
+
+ //Remove node from open
+ m_setOpenList.erase(bestIt);
+
+ //Add to closed list
+ m_setClosedList.insert(pBestNode);
+
+ return pBestNode;
+ }
+
+ //-----------------------------------------------------------------------
+
+ float cAStarHandler::Cost(float afDistance, cAINode *apAINode, cAStarNode *apParent)
+ {
+ if(apParent)
+ {
+ float fHeight = (1+fabs(apAINode->GetPosition().y - apParent->mpAINode->GetPosition().y));
+ return afDistance * fHeight;
+ }
+ else
+ return afDistance;
+ }
+
+ //-----------------------------------------------------------------------
+
+ float cAStarHandler::Heuristic(const cVector3f& avStart, const cVector3f& avGoal)
+ {
+ //return cMath::Vector3DistSqr(avStart, avGoal);
+ return cMath::Vector3Dist(avStart, avGoal);
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cAStarHandler::IsGoalNode(cAINode *apAINode)
+ {
+ tAINodeSetIt it = m_setGoalNodes.find(apAINode);
+ if(it == m_setGoalNodes.end()) return false;
+
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/ai/AStar.h b/engines/hpl1/engine/ai/AStar.h
new file mode 100644
index 00000000000..b71f49b2ef7
--- /dev/null
+++ b/engines/hpl1/engine/ai/AStar.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_A_STAR_H
+#define HPL_A_STAR_H
+
+#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/game/GameTypes.h"
+#include "hpl1/engine/math/MathTypes.h"
+
+namespace hpl {
+
+ class cAINodeContainer;
+ class cAINode;
+
+ //--------------------------------------
+
+ typedef std::set<cAINode*> tAINodeSet;
+ typedef tAINodeSet::iterator tAINodeSetIt;
+
+ //--------------------------------------
+
+ typedef std::list<cAINode*> tAINodeList;
+ typedef tAINodeList::iterator tAINodeListIt;
+
+ //--------------------------------------
+
+ class cAStarNode
+ {
+ public:
+ cAStarNode(cAINode *apAINode);
+
+ float mfCost;
+ float mfDistance;
+
+ cAStarNode *mpParent;
+ cAINode *mpAINode;
+ };
+
+ class cAStarNodeCompare
+ {
+ public:
+ bool operator()(cAStarNode* apNodeA,cAStarNode* apNodeB) const;
+ };
+
+
+ typedef std::set<cAStarNode*,cAStarNodeCompare> tAStarNodeSet;
+ typedef tAStarNodeSet::iterator tAStarNodeSetIt;
+
+ //--------------------------------------
+ class cAStarHandler;
+
+ class iAStarCallback
+ {
+ public:
+ virtual ~iAStarCallback(){}
+
+ virtual bool CanAddNode(cAINode *apParentNode,cAINode *apChildNode)=0;
+ };
+
+ //--------------------------------------
+
+ class cAStarHandler
+ {
+ public:
+ cAStarHandler(cAINodeContainer *apContainer);
+ ~cAStarHandler();
+
+ bool GetPath(const cVector3f& avStart, const cVector3f& avGoal, tAINodeList *apNodeList);
+
+ /**
+ * Set max number of times the algorithm is iterated.
+ * \param alX -1 = until OpenList is empty
+ */
+ void SetMaxIterations(int alX){ mlMaxIterations = alX;}
+
+ void SetCallback(iAStarCallback *apCallback){ mpCallback = apCallback;}
+
+ private:
+ void IterateAlgorithm();
+
+ void AddOpenNode(cAINode *apAINode, cAStarNode *apParent, float afDistance);
+
+ cAStarNode* GetBestNode();
+
+ float Cost(float afDistance, cAINode *apAINode, cAStarNode *apParent);
+ float Heuristic(const cVector3f& avStart, const cVector3f& avGoal);
+
+ bool IsGoalNode(cAINode *apAINode);
+
+ cVector3f mvGoal;
+
+ cAStarNode* mpGoalNode;
+ tAINodeSet m_setGoalNodes;
+
+ cAINodeContainer *mpContainer;
+
+ int mlMaxIterations;
+
+ iAStarCallback *mpCallback;
+
+ tAStarNodeSet m_setOpenList;
+ tAStarNodeSet m_setClosedList;
+ };
+
+};
+#endif // HPL_A_STAR_H
diff --git a/engines/hpl1/engine/ai/StateMachine.cpp b/engines/hpl1/engine/ai/StateMachine.cpp
new file mode 100644
index 00000000000..e0160ce02e1
--- /dev/null
+++ b/engines/hpl1/engine/ai/StateMachine.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/ai/StateMachine.h"
+
+#include "hpl1/engine/system/LowLevelSystem.h"
+
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // STATE
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ iAIState::iAIState()
+ {
+ mfTimeCount = 0;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void iAIState::Sleep(float afTime)
+ {
+
+ }
+
+ //-----------------------------------------------------------------------
+
+ void iAIState::Update(float afTime)
+ {
+ //Update according to the time step
+ mfTimeCount += afTime;
+ while(mfTimeCount >= mfUpdateStep)
+ {
+ OnUpdate(mfUpdateStep);
+ mfTimeCount -= mfUpdateStep;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cStateMachine::cStateMachine()
+ {
+ mbActive = true;
+
+ mpCurrentState = NULL;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cStateMachine::~cStateMachine()
+ {
+ STLMapDeleteAll(m_mapStates);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cStateMachine::Update(float afTime)
+ {
+ if(mbActive== false || mpCurrentState==NULL) return;
+
+ mpCurrentState->Update(afTime);
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cStateMachine::AddState(iAIState *apState, const tString& asName, int alId, float afUpdateStep)
+ {
+ apState->SetStateMachine(this);
+ apState->mlId = alId;
+ apState->msName = asName;
+ apState->mfUpdateStep = afUpdateStep;
+
+ if(m_mapStates.empty()) mpCurrentState = apState;
+
+ m_mapStates.insert(tAIStateMap::value_type(alId, apState));
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cStateMachine::ChangeState(int alId)
+ {
+ if(alId == mpCurrentState->GetId()) return;
+
+ iAIState *pState = GetState(alId);
+ if(pState==NULL){
+ Warning("State %d does not exist!\n",alId); return;
+ }
+
+ if(mpCurrentState) mpCurrentState->OnLeaveState(pState->GetId());
+ pState->OnEnterState(mpCurrentState==NULL ? -1 : mpCurrentState->GetId());
+
+ mpCurrentState = pState;
+ }
+
+ //-----------------------------------------------------------------------
+
+ iAIState* cStateMachine::GetState(int alId)
+ {
+ tAIStateMapIt it = m_mapStates.find(alId);
+ if(it == m_mapStates.end()) return NULL;
+
+ return it->second;
+ }
+ //-----------------------------------------------------------------------
+
+ iAIState* cStateMachine::CurrentState()
+ {
+ return mpCurrentState;
+ }
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/ai/StateMachine.h b/engines/hpl1/engine/ai/StateMachine.h
new file mode 100644
index 00000000000..9d7a0b57a49
--- /dev/null
+++ b/engines/hpl1/engine/ai/StateMachine.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_STATE_MACHINE_H
+#define HPL_STATE_MACHINE_H
+
+#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/game/GameTypes.h"
+
+#include <map>
+
+namespace hpl {
+
+ //-----------------------------------------
+ class cStateMachine;
+
+ class iAIState
+ {
+ friend class cStateMachine;
+ public:
+ iAIState();
+ virtual ~iAIState(){}
+
+ virtual void OnUpdate(float afTime)=0;
+
+ virtual void OnEnterState(int alLastState)=0;
+ virtual void OnLeaveState(int alNextState)=0;
+
+ int GetId(){ return mlId;}
+ const tString& GetName(){ return msName;}
+ float GetUpdateStep(){ return mfUpdateStep;}
+
+ void Sleep(float afTime);
+
+ protected:
+ int mlId;
+ tString msName;
+ float mfUpdateStep;
+ cStateMachine *mpStateMachine;
+
+ private:
+ void Update(float afTime);
+ void SetStateMachine(cStateMachine *apStateMachine){ mpStateMachine = apStateMachine;}
+
+ float mfTimeCount;
+ };
+
+ typedef std::map<int, iAIState*> tAIStateMap;
+ typedef tAIStateMap::iterator tAIStateMapIt;
+
+ //-----------------------------------------
+
+ class cStateMachine
+ {
+ public:
+ cStateMachine();
+ virtual ~cStateMachine();
+
+ void Update(float afTime);
+
+ /**
+ * Adds a new state to the state machine. The state machine will destroy them when deleted.
+ */
+ void AddState(iAIState *apState, const tString& asName, int alId, float afUpdateStep);
+
+ void ChangeState(int alId);
+
+ void SetActive(bool abX){ mbActive = abX;}
+ bool IsActive(){ return mbActive;}
+
+ iAIState* GetState(int alId);
+
+ iAIState* CurrentState();
+
+ private:
+ bool mbActive;
+
+ tAIStateMap m_mapStates;
+
+ iAIState *mpCurrentState;
+ };
+
+};
+#endif // HPL_STATE_MACHINE_H
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
new file mode 100644
index 00000000000..ff8b35bdaeb
--- /dev/null
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -0,0 +1,593 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/game/Game.h"
+
+#include "hpl1/engine/system/System.h"
+#include "hpl1/engine/system/LogicTimer.h"
+#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/input/Input.h"
+#include "hpl1/engine/input/Mouse.h"
+#include "hpl1/engine/resources/Resources.h"
+#include "hpl1/engine/graphics/Graphics.h"
+#include "hpl1/engine/graphics/LowLevelGraphics.h"
+#include "hpl1/engine/game/Updater.h"
+#include "hpl1/engine/game/ScriptFuncs.h"
+#include "hpl1/engine/graphics/Renderer3D.h"
+
+#include "hpl1/engine/gui/Gui.h"
+
+#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/game/LowLevelGameSetup.h"
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // FPS COUNTER
+ //////////////////////////////////////////////////////////////////////////
+
+ cFPSCounter::cFPSCounter(iLowLevelSystem* apLowLevelSystem)
+ {
+ mfFPS = 60;
+
+ mlFramecounter=0;
+ mfFrametimestart=0;
+ mfFrametime=0;
+
+ mfUpdateRate = 1;
+
+ mpLowLevelSystem = apLowLevelSystem;
+
+ mfFrametimestart = ((float)GetApplicationTime()) / 1000.0f;
+ }
+
+ void cFPSCounter::AddFrame()
+ {
+ mlFramecounter++;
+
+ mfFrametime = (((float)GetApplicationTime()) / 1000.0f) - mfFrametimestart;
+
+ // update the timer
+ if (mfFrametime >= mfUpdateRate)
+ {
+ mfFPS = ((float)mlFramecounter)/mfFrametime;
+ mlFramecounter = 0;
+ mfFrametimestart = ((float)GetApplicationTime()) / 1000.0f;
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SETUP VAR CONTAINER
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cSetupVarContainer::cSetupVarContainer()
+ {
+ msBlank = "";
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ void cSetupVarContainer::AddString(const tString& asName, const tString& asValue)
+ {
+ std::map<tString, tString>::value_type val(asName,asValue);
+ m_mapVars.insert(val);
+ }
+
+ void cSetupVarContainer::AddInt(const tString& asName, int alValue)
+ {
+ AddString(asName, cString::ToString(alValue));
+ }
+ void cSetupVarContainer::AddFloat(const tString& asName, float afValue)
+ {
+ AddString(asName, cString::ToString(afValue));
+ }
+ void cSetupVarContainer::AddBool(const tString& asName, bool abValue)
+ {
+ AddString(asName, abValue ? "true" : "false");
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ const tString& cSetupVarContainer::GetString(const tString& asName)
+ {
+ std::map<tString, tString>::iterator it = m_mapVars.find(asName);
+ if(it == m_mapVars.end()) return msBlank;
+ else return it->second;
+ }
+
+ float cSetupVarContainer::GetFloat(const tString& asName, float afDefault)
+ {
+ const tString& sVal = GetString(asName);
+ if(sVal == "")
+ return afDefault;
+ else
+ return cString::ToFloat(sVal.c_str(),afDefault);
+ }
+ int cSetupVarContainer::GetInt(const tString& asName, int alDefault)
+ {
+ const tString& sVal = GetString(asName);
+ if(sVal == "")
+ return alDefault;
+ else
+ return cString::ToInt(sVal.c_str(),alDefault);
+ }
+ bool cSetupVarContainer::GetBool(const tString& asName, bool abDefault)
+ {
+ const tString& sVal = GetString(asName);
+ if(sVal == "")
+ return abDefault;
+ else
+ return cString::ToBool(sVal.c_str(),abDefault);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cGame::cGame(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars)
+ {
+ GameInit(apGameSetup,aVars);
+ }
+
+
+ //-----------------------------------------------------------------------
+
+ cGame::cGame(iLowLevelGameSetup *apGameSetup,int alWidth, int alHeight, int alBpp, bool abFullscreen,
+ unsigned int alUpdateRate,int alMultisampling)
+ {
+ cSetupVarContainer Vars;
+ Vars.AddInt("ScreenWidth",alWidth);
+ Vars.AddInt("ScreenHeight",alHeight);
+ Vars.AddInt("ScreenBpp",alBpp);
+ Vars.AddBool("Fullscreen",abFullscreen);
+ Vars.AddInt("Multisampling",alMultisampling);
+ Vars.AddInt("LogicUpdateRate",alUpdateRate);
+ GameInit(apGameSetup,Vars);
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cGame::GameInit(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars)
+ {
+ mpGameSetup = apGameSetup;
+
+ Log("Creating Engine Modules\n");
+ Log("--------------------------------------------------------\n");
+
+ //Create the modules that game connects to and init them!
+ Log(" Creating graphics module\n");
+ mpGraphics = mpGameSetup->CreateGraphics();
+
+ Log(" Creating system module\n");
+ mpSystem = mpGameSetup->CreateSystem();
+
+ Log(" Creating resource module\n");
+ mpResources = mpGameSetup->CreateResources(mpGraphics);
+
+ Log(" Creating input module\n");
+ mpInput = mpGameSetup->CreateInput(mpGraphics);
+
+ Log(" Creating sound module\n");
+ mpSound = mpGameSetup->CreateSound();
+
+ Log(" Creating physics module\n");
+ mpPhysics = mpGameSetup->CreatePhysics();
+
+ Log(" Creating ai module\n");
+ mpAI = mpGameSetup->CreateAI();
+
+ Log(" Creating gui module\n");
+ mpGui = hplNew(cGui,());
+
+ Log(" Creating haptic module\n");
+#ifdef INCLUDE_HAPTIC
+ mpHaptic = mpGameSetup->CreateHaptic();
+#else
+ mpHaptic = NULL;
+#endif
+
+
+ Log(" Creating scene module\n");
+ mpScene = mpGameSetup->CreateScene(mpGraphics, mpResources, mpSound,mpPhysics,mpSystem,mpAI,mpHaptic);
+
+ Log("--------------------------------------------------------\n\n");
+
+
+ //Init the resources
+ mpResources->Init(mpGraphics,mpSystem, mpSound,mpScene,mpGui);
+
+ //Init the graphics
+ mpGraphics->Init(aVars.GetInt("ScreenWidth",800),
+ aVars.GetInt("ScreenHeight",600),
+ aVars.GetInt("ScreenBpp",32),
+ aVars.GetBool("Fullscreen",false),
+ aVars.GetInt("Multisampling",0),
+ aVars.GetString("WindowCaption"),
+ mpResources);
+
+ //Init Sound
+ mpSound->Init(mpResources, aVars.GetBool("UseSoundHardware",true),
+ aVars.GetBool("ForceGeneric",false),
+ aVars.GetBool("UseEnvironmentalAudio", false),
+ aVars.GetInt("MaxSoundChannels",32),
+ aVars.GetInt("StreamUpdateFreq",10),
+ aVars.GetBool("UseSoundThreading",true),
+ aVars.GetBool("UseVoiceManagement",true),
+ aVars.GetInt("MaxMonoChannelsHint",0),
+ aVars.GetInt("MaxStereoChannelsHint",0),
+ aVars.GetInt("StreamBufferSize",4096),
+ aVars.GetInt("StreamBufferCount",8),
+ aVars.GetBool("LowLevelSoundLogging", false),
+ aVars.GetString("DeviceName"));
+
+ //Init physics
+ mpPhysics->Init(mpResources);
+
+ //Init AI
+ mpAI->Init();
+
+ //Init Gui
+ mpGui->Init(mpResources,mpGraphics,mpSound,mpScene);
+
+ //Init haptic
+ if(mpHaptic) mpHaptic->Init(mpResources);
+
+ Log("Initializing Game Module\n");
+ Log("--------------------------------------------------------\n");
+ //Create the updatehandler
+ Log(" Adding engine updates\n");
+ mpUpdater = hplNew( cUpdater,(mpSystem->GetLowLevel()));
+
+ //Add some loaded modules to the updater
+ mpUpdater->AddGlobalUpdate(mpInput);
+ mpUpdater->AddGlobalUpdate(mpPhysics);
+ mpUpdater->AddGlobalUpdate(mpScene);
+ mpUpdater->AddGlobalUpdate(mpSound);
+ mpUpdater->AddGlobalUpdate(mpAI);
+ mpUpdater->AddGlobalUpdate(mpGui);
+ mpUpdater->AddGlobalUpdate(mpResources);
+ if(mpHaptic) mpUpdater->AddGlobalUpdate(mpHaptic);
+
+ //Setup the "default" updater container
+ mpUpdater->AddContainer("Default");
+ mpUpdater->SetContainer("Default");
+
+ //Create the logic timer.
+ mpLogicTimer = mpSystem->CreateLogicTimer(aVars.GetInt("LogicUpdateRate",800));
+
+ //Init some standard script funcs
+ Log(" Initializing script functions\n");
+ cScriptFuncs::Init(mpGraphics,mpResources,mpSystem,mpInput,mpScene,mpSound,this);
+
+ //Since game is not done:
+ mbGameIsDone=false;
+
+ mbRenderOnce = false;
+
+ mfUpdateTime =0;
+ mfGameTime =0;
+
+ mbLimitFPS = true;
+
+ mpFPSCounter = hplNew( cFPSCounter,(mpSystem->GetLowLevel()) );
+ Log("--------------------------------------------------------\n\n");
+
+ Log("User Initialization\n");
+ Log("--------------------------------------------------------\n");
+ }
+
+ //-----------------------------------------------------------------------
+
+ cGame::~cGame()
+ {
+ Log("--------------------------------------------------------\n\n");
+
+ hplDelete(mpLogicTimer);
+ hplDelete(mpFPSCounter);
+
+ hplDelete(mpUpdater);
+
+ hplDelete(mpGui);
+ hplDelete(mpScene);
+ if(mpHaptic) hplDelete(mpHaptic);
+ hplDelete(mpInput);
+ hplDelete(mpSound);
+ hplDelete(mpGraphics);
+ hplDelete(mpResources);
+ hplDelete(mpPhysics);
+ hplDelete(mpAI);
+ hplDelete(mpSystem);
+
+ Log(" Deleting game setup provided by user\n");
+ hplDelete(mpGameSetup);
+
+ Log("HPL Exit was successful!\n");
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHOD
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ int glClearUpdateCheck=0;
+ void cGame::Run()
+ {
+ //Log line that ends user init.
+ Log("--------------------------------------------------------\n\n");
+
+ bool bDone = false;
+ double fNumOfTimes=0;
+ double fMediumTime=0;
+
+ mpUpdater->OnStart();
+
+ mpLogicTimer->Reset();
+
+ //Loop the game... fix the var...
+ unsigned long lTempTime = GetApplicationTime();
+
+ //reset the mouse, really reset the damn thing :P
+ for(int i=0;i<10;i++) mpInput->GetMouse()->Reset();
+
+
+ Log("Game Running\n");
+ Log("--------------------------------------------------------\n");
+
+ mfFrameTime = 0;
+ unsigned long lTempFrameTime = GetApplicationTime();
+
+ bool mbIsUpdated = true;
+
+ //cMemoryManager::SetLogCreation(true);
+
+ while(!mbGameIsDone)
+ {
+ //Log("-----------------\n");
+ //////////////////////////
+ //Update logic.
+ while(mpLogicTimer->WantUpdate() && !mbGameIsDone)
+ {
+ unsigned int lUpdateTime = GetApplicationTime();
+
+ mpUpdater->Update(GetStepSize());
+
+ unsigned int lDeltaTime = GetApplicationTime() - lUpdateTime;
+ mfUpdateTime = (float)(lDeltaTime) / 1000.0f;
+
+ mbIsUpdated = true;
+
+ glClearUpdateCheck++;
+ if(glClearUpdateCheck % 500 == 0)
+ {
+ if(mpUpdater->GetCurrentContainerName() == "Default") ClearUpdateLogFile();
+ }
+
+ mfGameTime += GetStepSize();
+ }
+ mpLogicTimer->EndUpdateLoop();
+
+
+ //If not making a single rendering is better to use gpu and
+ //cpu at the same time and make query checks etc after logic update.
+ //If any delete has occured in the update this might crash. so skip it for now.
+ /*if(mbRenderOnce==false) {
+ mpGraphics->GetRenderer3D()->FetchOcclusionQueries();
+ mpUpdater->OnPostBufferSwap();
+ }*/
+
+ //Draw graphics!
+ if(mbRenderOnce && bDone)continue;
+ if(mbRenderOnce)bDone = true;
+
+
+ if(mbIsUpdated)
+ {
+ mpScene->UpdateRenderList(mfFrameTime);
+ if(mbLimitFPS==false) mbIsUpdated = false;
+ }
+
+ if(mbLimitFPS==false || mbIsUpdated)
+ {
+ //LogUpdate("----------- RENDER GFX START --------------\n");
+
+ mbIsUpdated = false;
+
+ //Get the the from the last frame.
+ mfFrameTime = ((float)(GetApplicationTime() - lTempFrameTime))/1000;
+ lTempFrameTime = GetApplicationTime();
+
+ //Draw this frame
+ //unsigned long lFTime = GetApplicationTime();
+ mpUpdater->OnDraw();
+ mpScene->Render(mpUpdater,mfFrameTime);
+ //if(mpScene->GetDrawScene()) LogUpdate("FrameTime: %d ms\n", GetApplicationTime() - lFTime);
+
+ //Update fps counter.
+ mpFPSCounter->AddFrame();
+
+ //Update the screen.
+ mpGraphics->GetLowLevel()->SwapBuffers();
+ //Log("Swap done: %d\n", GetApplicationTime());
+ //if(mbRenderOnce)
+ {
+ mpGraphics->GetRenderer3D()->FetchOcclusionQueries();
+ mpUpdater->OnPostBufferSwap();
+ }
+
+ fNumOfTimes++;
+ }
+
+ //if(cMemoryManager::GetLogCreation())
+ //{
+ //cMemoryManager::SetLogCreation(false);
+ //Log("----\nCreations made: %d\n------\n",cMemoryManager::GetCreationCount());
+ //}
+ }
+ Log("--------------------------------------------------------\n\n");
+
+ Log("Statistics\n");
+ Log("--------------------------------------------------------\n");
+
+ unsigned long lTime = GetApplicationTime() - lTempTime;
+ fMediumTime = fNumOfTimes/(((double)lTime)/1000);
+
+ Log(" Medium framerate: %f\n", fMediumTime);
+ Log("--------------------------------------------------------\n\n");
+
+ Log("User Exit\n");
+ Log("--------------------------------------------------------\n");
+
+ mpUpdater->OnExit();
+ }
+ //-----------------------------------------------------------------------
+
+ void cGame::Exit()
+ {
+ mbGameIsDone = true;
+ }
+ //-----------------------------------------------------------------------
+
+ void cGame::ResetLogicTimer()
+ {
+ mpLogicTimer->Reset();
+ }
+
+ void cGame::SetUpdatesPerSec(int alUpdatesPerSec)
+ {
+ mpLogicTimer->SetUpdatesPerSec(alUpdatesPerSec);
+ }
+
+ int cGame::GetUpdatesPerSec()
+ {
+ return mpLogicTimer->GetUpdatesPerSec();
+ }
+
+ float cGame::GetStepSize()
+ {
+ return mpLogicTimer->GetStepSize();
+ }
+
+ //-----------------------------------------------------------------------
+
+ cScene* cGame::GetScene()
+ {
+ return mpScene;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cResources* cGame::GetResources()
+ {
+ return mpResources;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cGraphics* cGame::GetGraphics()
+ {
+ return mpGraphics;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cSystem* cGame::GetSystem()
+ {
+ return mpSystem;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cInput* cGame::GetInput()
+ {
+ return mpInput;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cSound* cGame::GetSound()
+ {
+ return mpSound;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cPhysics* cGame::GetPhysics()
+ {
+ return mpPhysics;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAI* cGame::GetAI()
+ {
+ return mpAI;
+ }
+
+
+ //-----------------------------------------------------------------------
+
+ cGui* cGame::GetGui()
+ {
+ return mpGui;
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ cHaptic* cGame::GetHaptic()
+ {
+ return mpHaptic;
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ cUpdater* cGame::GetUpdater()
+ {
+ return mpUpdater;
+ }
+
+ float cGame::GetFPS()
+ {
+ return mpFPSCounter->mfFPS;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cGame::SetFPSUpdateRate(float afSec)
+ {
+ mpFPSCounter->mfUpdateRate = afSec;
+ }
+ float cGame::GetFPSUpdateRate()
+ {
+ return mpFPSCounter->mfUpdateRate;
+ }
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/game/Game.h b/engines/hpl1/engine/game/Game.h
new file mode 100644
index 00000000000..73ae64b7878
--- /dev/null
+++ b/engines/hpl1/engine/game/Game.h
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_GAME_H
+#define HPL_GAME_H
+
+#include "hpl1/engine/system/SystemTypes.h"
+
+namespace hpl {
+
+ class cUpdater;
+ class iLowLevelGameSetup;
+ class iLowLevelSystem;
+ class cLogicTimer;
+
+ class cSystem;
+ class cInput;
+ class cResources;
+ class cGraphics;
+ class cScene;
+ class cSound;
+ class cPhysics;
+ class cAI;
+ class cHaptic;
+ class cGui;
+
+ class cFPSCounter
+ {
+ public:
+ cFPSCounter(iLowLevelSystem* apLowLevelSystem);
+
+ void AddFrame();
+
+ float mfFPS;
+ float mfUpdateRate;
+ private:
+ iLowLevelSystem* mpLowLevelSystem;
+ int mlFramecounter;
+ float mfFrametimestart;
+ float mfFrametime;
+ };
+
+ //---------------------------------------------------
+
+ class cSetupVarContainer
+ {
+ public:
+ cSetupVarContainer();
+
+ void AddString(const tString& asName, const tString& asValue);
+
+ void AddInt(const tString& asName, int alValue);
+ void AddFloat(const tString& asName, float afValue);
+ void AddBool(const tString& asName, bool abValue);
+
+ const tString& GetString(const tString& asName);
+
+ float GetFloat(const tString& asName, float afDefault);
+ int GetInt(const tString& asName,int alDefault);
+ bool GetBool(const tString& asName, bool abDefault);
+ private:
+ std::map<tString, tString> m_mapVars;
+ tString msBlank;
+ };
+
+ //---------------------------------------------------
+
+ class cGame
+ {
+ public:
+ cGame(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars);
+ cGame(iLowLevelGameSetup *apGameSetup,int alWidth, int alHeight, int alBpp, bool abFullscreen,
+ unsigned int alUpdateRate=60,int alMultisampling=0);
+ ~cGame();
+ private:
+ void GameInit(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars);
+
+ public:
+
+ /**
+ * Starts the game loop. To make stuff run they must be added as updatables..
+ */
+ void Run();
+ /**
+ * Exists the game.
+ * \todo is this a good way to do it? Should game be global. If so, make a singleton.
+ */
+ void Exit();
+
+ /**
+ *
+ * \return A pointer to Scene
+ */
+ cScene* GetScene();
+ /**
+ *
+ * \return A pointer to Resources
+ */
+ cResources* GetResources();
+
+ /**
+ *
+ * \return A pointer to the Updater
+ */
+ cUpdater* GetUpdater();
+
+ /**
+ *
+ * \return A pointer to the System
+ */
+ cSystem* GetSystem();
+
+ /**
+ *
+ * \return A pointer to the Input
+ */
+ cInput* GetInput();
+
+ /**
+ *
+ * \return A pointer to the Graphics
+ */
+ cGraphics* GetGraphics();
+ /**
+ *
+ * \return A pointer to the Sound
+ */
+ cSound* GetSound();
+ /**
+ *
+ * \return A pointer to the Physics
+ */
+ cPhysics* GetPhysics();
+
+ /**
+ *
+ * \return A pointer to the AI
+ */
+ cAI* GetAI();
+
+ /**
+ *
+ * \return A pointer to the Gui
+ */
+ cGui* GetGui();
+
+ /**
+ *
+ * \return A pointer to the haptic
+ */
+ cHaptic* GetHaptic();
+
+ void ResetLogicTimer();
+ void SetUpdatesPerSec(int alUpdatesPerSec);
+ int GetUpdatesPerSec();
+ float GetStepSize();
+
+ cLogicTimer* GetLogicTimer(){ return mpLogicTimer;}
+
+ float GetFPS();
+
+ void SetFPSUpdateRate(float afSec);
+ float GetFPSUpdateRate();
+
+ void SetRenderOnce(bool abX){mbRenderOnce = abX;}
+
+ float GetFrameTime(){ return mfFrameTime;}
+
+ float GetUpdateTime(){ return mfUpdateTime;}
+
+ double GetGameTime(){ return mfGameTime;}
+
+ void SetLimitFPS(bool abX){ mbLimitFPS = abX;}
+ bool GetLimitFPS(){ return mbLimitFPS;}
+
+ private:
+ bool mbGameIsDone;
+
+ bool mbRenderOnce;
+
+ float mfFrameTime;
+
+ float mfUpdateTime;
+
+ double mfGameTime;
+
+ iLowLevelGameSetup *mpGameSetup;
+ cUpdater *mpUpdater;
+ cLogicTimer *mpLogicTimer;
+
+ cFPSCounter* mpFPSCounter;
+
+ bool mbLimitFPS;
+
+ //Modules that Game connnect to:
+ cResources *mpResources;
+ cSystem *mpSystem;
+ cInput *mpInput;
+ cGraphics *mpGraphics;
+ cScene *mpScene;
+ cSound *mpSound;
+ cPhysics *mpPhysics;
+ cAI *mpAI;
+ cHaptic *mpHaptic;
+ cGui *mpGui;
+ };
+
+};
+#endif // HPL_GAME_H
diff --git a/engines/hpl1/engine/game/GameTypes.cpp b/engines/hpl1/engine/game/GameTypes.cpp
new file mode 100644
index 00000000000..896bd566d05
--- /dev/null
+++ b/engines/hpl1/engine/game/GameTypes.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/game/GameTypes.h"
+
+#include "hpl1/engine/system/LowLevelSystem.h"
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cScriptVar::cScriptVar()
+ {
+
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // SERIALIZE
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ kBeginSerializeBase(cScriptVar)
+ kSerializeVar(msName, eSerializeType_String)
+ kSerializeVar(mlVal, eSerializeType_Int32)
+ kEndSerialize()
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/game/GameTypes.h b/engines/hpl1/engine/game/GameTypes.h
new file mode 100644
index 00000000000..e0a47399ef9
--- /dev/null
+++ b/engines/hpl1/engine/game/GameTypes.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_GAME_TYPES_H
+#define HPL_GAME_TYPES_H
+
+#include <map>
+
+#include "hpl1/engine/system/SerializeClass.h"
+
+namespace hpl {
+
+ class cScriptVar : public iSerializable
+ {
+ kSerializableClassInit(cScriptVar)
+ public:
+ cScriptVar();
+
+ tString msName;
+ int mlVal;
+ };
+
+ typedef std::map<tString,cScriptVar> tScriptVarMap;
+ typedef tScriptVarMap::iterator tScriptVarMapIt;
+
+};
+
+#endif // HPL_GAME_TYPES_H
diff --git a/engines/hpl1/engine/game/LowLevelGameSetup.h b/engines/hpl1/engine/game/LowLevelGameSetup.h
new file mode 100644
index 00000000000..d7ae3e81c7f
--- /dev/null
+++ b/engines/hpl1/engine/game/LowLevelGameSetup.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_LOWLEVELGAMESETUP_H
+#define HPL_LOWLEVELGAMESETUP_H
+
+#include "hpl1/engine/system/System.h"
+#include "hpl1/engine/input/Input.h"
+#include "hpl1/engine/graphics/Graphics.h"
+#include "hpl1/engine/resources/Resources.h"
+#include "hpl1/engine/scene/Scene.h"
+#include "hpl1/engine/sound/Sound.h"
+#include "hpl1/engine/physics/Physics.h"
+#include "hpl1/engine/ai/AI.h"
+#include "hpl1/engine/haptic/Haptic.h"
+
+namespace hpl {
+
+ class iLowLevelGameSetup
+ {
+ public:
+ virtual ~iLowLevelGameSetup(){}
+
+ virtual cInput* CreateInput(cGraphics* apGraphics)=0;
+ virtual cSystem* CreateSystem()=0;
+ virtual cGraphics* CreateGraphics()=0;
+ virtual cResources* CreateResources(cGraphics* apGraphics)=0;
+ virtual cScene* CreateScene(cGraphics* apGraphics, cResources* apResources, cSound* apSound,
+ cPhysics *apPhysics, cSystem *apSystem,cAI *apAI,cHaptic *apHaptic)=0;
+ virtual cSound* CreateSound()=0;
+ virtual cPhysics* CreatePhysics()=0;
+ virtual cAI* CreateAI()=0;
+ virtual cHaptic* CreateHaptic()=0;
+ };
+};
+#endif // HPL_LOWLEVELGAMESETUP_H
diff --git a/engines/hpl1/engine/game/SaveGame.cpp b/engines/hpl1/engine/game/SaveGame.cpp
new file mode 100644
index 00000000000..ca21172cb6b
--- /dev/null
+++ b/engines/hpl1/engine/game/SaveGame.cpp
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/game/SaveGame.h"
+
+#include "hpl1/engine/system/LowLevelSystem.h"
+
+namespace hpl {
+
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // SAVE GAME DATA
+ //////////////////////////////////////////////////////////////////////////
+
+ //------------------------------------------------------------------------
+
+ //Serialize iSaveGame
+ kBeginSerializeBaseVirtual(iSaveData)
+ kSerializeVar(mlSaveDataId, eSerializeType_Int32)
+ kEndSerialize()
+
+ //------------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // SAVE GAME OBJECT
+ //////////////////////////////////////////////////////////////////////////
+
+ int iSaveObject::_mlGlobalIdCount =0;
+
+ //------------------------------------------------------------------------
+
+ iSaveObject::iSaveObject()
+ {
+ mlSaveObjectId = _mlGlobalIdCount++;
+ if(_mlGlobalIdCount <0) _mlGlobalIdCount=0;
+
+ mbIsSaved = true;
+ }
+
+ iSaveObject::~iSaveObject()
+ {
+
+ }
+
+ //------------------------------------------------------------------------
+
+ void iSaveObject::SaveToSaveData(iSaveData *apSaveData)
+ {
+ apSaveData->mlSaveDataId = mlSaveObjectId;
+ }
+
+ //------------------------------------------------------------------------
+
+ void iSaveObject::LoadFromSaveData(iSaveData *apSaveData)
+ {
+ mlSaveObjectId = apSaveData->mlSaveDataId;
+ mpSaveData = apSaveData;
+ }
+
+ //------------------------------------------------------------------------
+
+ void iSaveObject::SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame)
+ {
+
+ }
+
+ //------------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // SAVE GAME CONTAINER
+ //////////////////////////////////////////////////////////////////////////
+
+ //------------------------------------------------------------------------
+
+ cSaveObjectHandler::cSaveObjectHandler()
+ {
+
+ }
+
+ cSaveObjectHandler::~cSaveObjectHandler()
+ {
+
+ }
+
+ //------------------------------------------------------------------------
+
+ void cSaveObjectHandler::Add(iSaveObject *pObject)
+ {
+ m_mapSaveObjects.insert(tSaveObjectMap::value_type(pObject->GetSaveObjectId(),pObject));
+ }
+
+ //------------------------------------------------------------------------
+
+ iSaveObject* cSaveObjectHandler::Get(int alId)
+ {
+ tSaveObjectMapIt it = m_mapSaveObjects.find(alId);
+ if(it== m_mapSaveObjects.end()){
+ Warning("Couldn't find save object with id %d\n",alId);
+ return NULL;
+ }
+
+ return it->second;
+ }
+
+ //------------------------------------------------------------------------
+
+ cSaveObjectIterator cSaveObjectHandler::GetIterator()
+ {
+ return cSaveObjectIterator(&m_mapSaveObjects);
+ }
+
+ //------------------------------------------------------------------------
+
+ void cSaveObjectHandler::SetUpAll(cGame *apGame)
+ {
+ int lMaxId =0;
+
+ tSaveObjectMapIt it = m_mapSaveObjects.begin();
+ for(; it != m_mapSaveObjects.end(); ++it)
+ {
+ iSaveObject *pObject = it->second;
+
+ if(pObject->GetSaveObjectId() > lMaxId) lMaxId = pObject->GetSaveObjectId();
+
+ pObject->SaveDataSetup(this,apGame);
+ }
+
+ iSaveObject::_mlGlobalIdCount = lMaxId;
+ }
+
+ //------------------------------------------------------------------------
+
+ void cSaveObjectHandler::Clear()
+ {
+ m_mapSaveObjects.clear();
+ }
+
+ //------------------------------------------------------------------------
+
+ size_t cSaveObjectHandler::Size()
+ {
+ return m_mapSaveObjects.size();
+ }
+
+ //------------------------------------------------------------------------
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // SAVE DATA CONTAINER
+ //////////////////////////////////////////////////////////////////////////
+
+ //------------------------------------------------------------------------
+
+ cSaveDataHandler::cSaveDataHandler()
+ {
+
+ }
+
+ cSaveDataHandler::~cSaveDataHandler()
+ {
+
+ }
+
+ //------------------------------------------------------------------------
+
+ void cSaveDataHandler::Add(iSaveData *pData)
+ {
+ m_mapSaveData.insert(tSaveDataMap::value_type(pData->GetSaveCreatePrio(), pData));
+ }
+
+ cSaveDataIterator cSaveDataHandler::GetIterator()
+ {
+ return cSaveDataIterator(&m_mapSaveData);
+ }
+
+ void cSaveDataHandler::Clear()
+ {
+ m_mapSaveData.clear();
+ }
+
+ size_t cSaveDataHandler::Size()
+ {
+ return m_mapSaveData.size();
+ }
+
+ //------------------------------------------------------------------------
+
+ void cSaveDataHandler::AddVoidPtr(void **apPtr)
+ {
+ iSaveData** pDataPtr = (iSaveData**)apPtr;
+ Add(*pDataPtr);
+ }
+ void cSaveDataHandler::AddVoidClass(void *apClass)
+ {
+ iSaveData* pData = (iSaveData*)(apClass);
+ Add(pData);
+ }
+
+ iContainerIterator* cSaveDataHandler::CreateIteratorPtr()
+ {
+ return hplNew( cSaveDataIterator, (&m_mapSaveData) );
+ }
+
+ //------------------------------------------------------------------------
+
+
+}
diff --git a/engines/hpl1/engine/game/SaveGame.h b/engines/hpl1/engine/game/SaveGame.h
new file mode 100644
index 00000000000..626e222d08a
--- /dev/null
+++ b/engines/hpl1/engine/game/SaveGame.h
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_SAVE_GAME_H
+#define HPL_SAVE_GAME_H
+
+#include <map>
+
+#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/system/SerializeClass.h"
+
+class TiXmlElement;
+
+#define kSaveData_LoadFromBegin(aClass) \
+ super::LoadFromSaveData(apSaveData); \
+ cSaveData_##aClass *pData = static_cast<cSaveData_##aClass*>(apSaveData);
+
+#define kSaveData_SaveToBegin(aClass) \
+ super::SaveToSaveData(apSaveData);\
+ cSaveData_##aClass *pData = static_cast<cSaveData_##aClass*>(apSaveData);
+
+#define kSaveData_SetupBegin(aClass) \
+ super::SaveDataSetup(apSaveObjectHandler,apGame);\
+ cSaveData_##aClass *pData = static_cast<cSaveData_##aClass*>(mpSaveData); \
+ const char *sClassNameString = #aClass;
+
+#define kSaveData_BaseClass(aClass) class cSaveData_##aClass : public iSaveData
+#define kSaveData_ChildClass(aParent, aChild) class cSaveData_##aChild : public cSaveData_##aParent
+
+#define kSaveData_ClassInit(aClass) kSerializableClassInit(cSaveData_##aClass)
+
+//////////////////////////////////////////////
+//Helpers to copy data.
+#define kSaveData_SaveTo(aVar) pData->aVar = aVar;
+#define kSaveData_LoadFrom(aVar) aVar = pData->aVar;
+
+#define kSaveData_SaveObject(aObject, aId) \
+ if(aObject) \
+ pData->aId = aObject->GetSaveObjectId(); \
+ else \
+ pData->aId = -1;
+
+//Only used in setup:
+#define kSaveData_LoadObject(aObject, aId,aClass) \
+ if(pData->aId == -1) \
+ aObject = NULL; \
+ else {\
+ aObject = static_cast<aClass>(apSaveObjectHandler->Get(pData->aId)); \
+ }
+
+
+
+//////////////////////////////////////////////
+//Helpers to copy containers with SaveDataId
+#define kSaveData_SaveIdList(aSrcList,aSrcIt,aDestList) \
+ pData->aDestList.Clear(); \
+ for(aSrcIt it = aSrcList.begin();it != aSrcList.end();++it) \
+ { \
+ pData->aDestList.Add((*it)->GetSaveObjectId()); \
+ }
+
+//Only used in setup:
+#define kSaveData_LoadIdList(aSrcList,aDestList, aClass) \
+ { cContainerListIterator<int> it = pData->aDestList.GetIterator(); \
+ aSrcList.clear(); \
+ while(it.HasNext()) \
+ { \
+ int lId = it.Next(); \
+ iSaveObject* pObject = apSaveObjectHandler->Get(lId); \
+ if(pObject==NULL) \
+ { \
+ continue; \
+ } \
+ aSrcList.push_back(static_cast<aClass>(pObject)); \
+ } \
+ }
+
+
+
+namespace hpl {
+
+ //--------------------------------------------------------
+
+
+ class cSaveObjectHandler;
+ class iSaveObject;
+ class cGame;
+
+ /**
+ * This is data that is created by a SaveObject and the data can be loaded into the object.
+ */
+ class iSaveData : public iSerializable
+ {
+ kSerializableClassInit(iSaveData)
+ public:
+ int mlSaveDataId;
+
+ /**
+ * Creates the SaveObject using previously saved objects and the data in this class.
+ */
+ virtual iSaveObject* CreateSaveObject(cSaveObjectHandler *apSaveObjectHandler,cGame *apGame)=0;
+
+ /**
+ * The lower number the earlier it will be created.
+ */
+ virtual int GetSaveCreatePrio()=0;
+ };
+
+
+
+ //--------------------------------------------------------
+
+ /**
+ * This is class is inherited by object that are to be saved.
+ */
+ class iSaveObject
+ {
+ friend class cSaveObjectHandler;
+ public:
+ iSaveObject();
+ ~iSaveObject();
+
+ /**
+ * Get a unique id for this object.
+ */
+ int GetSaveObjectId(){ return mlSaveObjectId;}
+
+ /**
+ * Save it's data to a SaveData
+ */
+ virtual void SaveToSaveData(iSaveData *apSaveData);
+ /**
+ * Load it's data from a SaveData
+ */
+ virtual void LoadFromSaveData(iSaveData *apSaveData);
+
+ /**
+ * Creates the SaveData that this class uses.
+ */
+ virtual iSaveData* CreateSaveData()=0;
+
+ /**
+ * After all objects have been created, this function is called to enable setup.
+ */
+ virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame);
+
+ void SetIsSaved(bool abX){ mbIsSaved = abX;}
+ bool IsSaved(){ return mbIsSaved;}
+
+ protected:
+ iSaveData *mpSaveData;
+ private:
+ int mlSaveObjectId;
+ bool mbIsSaved;
+ static int _mlGlobalIdCount;
+ };
+
+ //---------------------------------------------------------
+
+ typedef std::multimap<int, iSaveObject*> tSaveObjectMap;
+ typedef tSaveObjectMap::iterator tSaveObjectMapIt;
+
+ typedef cSTLMapIterator<iSaveObject*,tSaveObjectMap,tSaveObjectMapIt> cSaveObjectIterator;
+
+ /**
+ * This store all the SaveObjects created at load time.
+ */
+ class cSaveObjectHandler
+ {
+ public:
+ cSaveObjectHandler();
+ ~cSaveObjectHandler();
+
+ public:
+ void Add(iSaveObject *pObject);
+
+ iSaveObject* Get(int alId);
+
+ cSaveObjectIterator GetIterator();
+
+ void SetUpAll(cGame *apGame);
+
+ void Clear();
+ size_t Size();
+
+ private:
+
+ tSaveObjectMap m_mapSaveObjects;
+ };
+
+ //---------------------------------------------------------
+
+ typedef std::multimap<int, iSaveData*> tSaveDataMap;
+ typedef tSaveDataMap::iterator tSaveDataMapIt;
+
+ typedef cSTLMapIterator<iSaveData*,tSaveDataMap,tSaveDataMapIt> cSaveDataIterator;
+
+ /**
+ * Used to keep track of save data.
+ */
+ class cSaveDataHandler : public iContainer
+ {
+ public:
+ cSaveDataHandler();
+ ~cSaveDataHandler();
+
+ void Add(iSaveData *pData);
+
+ cSaveDataIterator GetIterator();
+
+ void Clear();
+ size_t Size();
+
+ private:
+ void AddVoidPtr(void **apPtr);
+ void AddVoidClass(void *apClass);
+
+ iContainerIterator* CreateIteratorPtr();
+
+ tSaveDataMap m_mapSaveData;
+ };
+
+ //---------------------------------------------------------
+
+};
+#endif // HPL_SAVE_GAME_H
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
new file mode 100644
index 00000000000..e25f7d86e05
--- /dev/null
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -0,0 +1,1582 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/game/ScriptFuncs.h"
+
+#include <stdlib.h>
+#include <math.h>
+#include <stdlib.h>
+#include <time.h>
+
+#include "hpl1/engine/game/Game.h"
+#include "hpl1/engine/graphics/Graphics.h"
+#include "hpl1/engine/sound/Sound.h"
+#include "hpl1/engine/resources/Resources.h"
+#include "hpl1/engine/math/Math.h"
+#include "hpl1/engine/scene/Scene.h"
+#include "hpl1/engine/scene/Light3D.h"
+#include "hpl1/engine/scene/World3D.h"
+#include "hpl1/engine/scene/SoundEntity.h"
+#include "hpl1/engine/scene/PortalContainer.h"
+#include "hpl1/engine/input/Input.h"
+#include "hpl1/engine/system/System.h"
+#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/sound/MusicHandler.h"
+#include "hpl1/engine/resources/SoundManager.h"
+#include "hpl1/engine/resources/SoundEntityManager.h"
+#include "hpl1/engine/resources/TextureManager.h"
+#include "hpl1/engine/sound/SoundData.h"
+#include "hpl1/engine/sound/SoundChannel.h"
+#include "hpl1/engine/sound/SoundHandler.h"
+#include "hpl1/engine/sound/SoundEntityData.h"
+#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/physics/PhysicsJoint.h"
+#include "hpl1/engine/physics/PhysicsJointHinge.h"
+#include "hpl1/engine/physics/PhysicsJointScrew.h"
+#include "hpl1/engine/physics/PhysicsJointSlider.h"
+#include "hpl1/engine/physics/PhysicsBody.h"
+#include "hpl1/engine/physics/PhysicsController.h"
+#include "hpl1/engine/system/Script.h"
+#include "hpl1/engine/graphics/ParticleSystem3D.h"
+#include "hpl1/engine/scene/MeshEntity.h"
+#include "hpl1/engine/graphics/BillBoard.h"
+#include "hpl1/engine/graphics/Beam.h"
+#include "hpl1/engine/graphics/Renderer3D.h"
+#include "hpl1/engine/libraries/angelscript/angelscript.h"
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // JOINT CALLBACK
+ //////////////////////////////////////////////////////////////////////////
+
+ cScriptJointCallback::cScriptJointCallback(cScene *apScene)
+ {
+ mpScene = apScene;
+
+ msMaxFunc = "";
+ msMinFunc = "";
+ }
+
+ void cScriptJointCallback::OnMinLimit(iPhysicsJoint *apJoint)
+ {
+ if(msMinFunc!="")
+ {
+ iScript *pScript = mpScene->GetWorld3D()->GetScript();
+
+ tString sCommand = msMinFunc + "(\"" + apJoint->GetName() + "\")";
+ if(pScript->Run(sCommand)==false){
+ Warning("Couldn't run script command '%s'\n",sCommand.c_str());
+ }
+
+ }
+ }
+
+ void cScriptJointCallback::OnMaxLimit(iPhysicsJoint *apJoint)
+ {
+ if(msMaxFunc!="")
+ {
+ iScript *pScript = mpScene->GetWorld3D()->GetScript();
+
+ tString sCommand = msMaxFunc + "(\"" + apJoint->GetName() + "\")";
+ if(pScript->Run(sCommand)==false){
+ Warning("Couldn't run script command '%s'\n",sCommand.c_str());
+ }
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ static cResources *gpResources=NULL;
+ static cSystem *gpSystem=NULL;
+ static cInput *gpInput=NULL;
+ static cGraphics *gpGraphics=NULL;
+ static cScene *gpScene=NULL;
+ static cSound *gpSound=NULL;
+ static cGame *gpGame=NULL;
+
+ //-----------------------------------------------------------------------
+
+ static void __stdcall Print(std::string asText)
+ {
+ Log(asText.c_str());
+ }
+ SCRIPT_DEFINE_FUNC_1(void, Print, string)
+
+ static std::string __stdcall FloatToString(float afX)
+ {
+ char sTemp[30];
+ sprintf(sTemp,"%f",afX);
+ return (std::string) sTemp;
+ }
+ SCRIPT_DEFINE_FUNC_1(string, FloatToString, float)
+
+ static std::string __stdcall IntToString(int alX)
+ {
+ char sTemp[30];
+ sprintf(sTemp,"%d",alX);
+ return (std::string) sTemp;
+ }
+ SCRIPT_DEFINE_FUNC_1(string, IntToString, int)
+
+ static float __stdcall RandFloat(float afMin, float afMax)
+ {
+ return cMath::RandRectf(afMin,afMax);
+ }
+ SCRIPT_DEFINE_FUNC_2(float, RandFloat, float, float)
+
+ static int __stdcall RandInt(int alMin, int alMax)
+ {
+ return cMath::RandRectl(alMin,alMax);
+ }
+ SCRIPT_DEFINE_FUNC_2(int, RandInt, int, int)
+
+ static bool __stdcall StringContains(std::string asString, std::string asSubString)
+ {
+ return cString::GetLastStringPos(asString,asSubString)>=0;
+ }
+ SCRIPT_DEFINE_FUNC_2(bool, StringContains, string, string)
+
+ static void __stdcall ResetLogicTimer()
+ {
+ gpGame->ResetLogicTimer();
+ }
+ SCRIPT_DEFINE_FUNC(void, ResetLogicTimer)
+
+ /////////////////////////////////////////////////////////////////////////
+ /////// RENDERER //////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Sets ambient light color-
+ **/
+ static void __stdcall SetAmbientColor(float afR, float afG, float afB)
+ {
+ gpGraphics->GetRenderer3D()->SetAmbientColor(cColor(afR,afG,afB,1.0f));
+ }
+ SCRIPT_DEFINE_FUNC_3(void, SetAmbientColor, float, float, float)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Sets if the skybox should be active
+ **/
+ static void __stdcall SetSkyboxActive(bool abX)
+ {
+ gpGraphics->GetRenderer3D()->SetSkyBoxActive(abX);
+ }
+ SCRIPT_DEFINE_FUNC_1(void, SetSkyboxActive, bool)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Sets the skybox color.
+ **/
+ static void __stdcall SetSkyboxColor(float afR, float afG, float afB, float afA)
+ {
+ gpGraphics->GetRenderer3D()->SetSkyBoxColor(cColor(afR,afG,afB,afA));
+ }
+ SCRIPT_DEFINE_FUNC_4(void, SetSkyboxColor, float, float, float, float)
+
+ //-----------------------------------------------------------------------
+
+
+ /**
+ * Sets the skybox
+ * \param asTexture Name of the cube map texture to use
+ **/
+ static void __stdcall SetSkybox(std::string asTexture)
+ {
+ if(asTexture!="")
+ {
+ iTexture *pTex = gpResources->GetTextureManager()->CreateCubeMap(asTexture,false);
+ gpGraphics->GetRenderer3D()->SetSkyBox(pTex,true);
+ }
+ else
+ {
+ gpGraphics->GetRenderer3D()->SetSkyBox(NULL,false);
+ }
+ }
+ SCRIPT_DEFINE_FUNC_1(void, SetSkybox, string)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Creates a particle system and attaches it to the camera.
+ * \param asName Name of particle system
+ * \param asType The type of particle system (file)
+ **/
+ static void __stdcall CreateParticleSystemOnCamera(std::string asName,std::string asType)
+ {
+ cParticleSystem3D *pPS = gpScene->GetWorld3D()->CreateParticleSystem(asName,asType,
+ 1,cMatrixf::Identity);
+ if(pPS)
+ {
+ cCamera3D *pCam = static_cast<cCamera3D*>(gpScene->GetCamera());
+ pCam->AttachEntity(pPS);
+ }
+ }
+ SCRIPT_DEFINE_FUNC_2(void, CreateParticleSystemOnCamera, string, string)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Sets if fog should be active
+ * \param abX If the fog is active or not.
+ **/
+ static void __stdcall SetFogActive(bool abX)
+ {
+ gpGraphics->GetRenderer3D()->SetFogActive(abX);
+ }
+ SCRIPT_DEFINE_FUNC_1(void, SetFogActive, bool)
+
+ /**
+ * Sets if the fog should be used to cull non-visible objects
+ * \param abX If the culling is active or not.
+ **/
+ static void __stdcall SetFogCulling(bool abX)
+ {
+ gpGraphics->GetRenderer3D()->SetFogCulling(abX);
+ }
+ SCRIPT_DEFINE_FUNC_1(void, SetFogCulling, bool)
+
+ /**
+ * Creates a particle system and attaches it to the camera.
+ * \param afStart Start of fog color
+ * \param afStart End of fog fade. After this limit all geometry is full fog color.
+ * \param afR, afG, afB Color of Fog.
+ **/
+ static void __stdcall SetFogProperties(float afStart, float afEnd, float afR,float afG, float afB)
+ {
+ gpGraphics->GetRenderer3D()->SetFogStart(afStart);
+ gpGraphics->GetRenderer3D()->SetFogEnd(afEnd);
+ gpGraphics->GetRenderer3D()->SetFogColor(cColor(afR,afG,afB,1.0f));
+ }
+ SCRIPT_DEFINE_FUNC_5(void, SetFogProperties, float, float, float, float, float)
+
+ //-----------------------------------------------------------------------
+
+ static void __stdcall SetSectorProperties(std::string asSector, float afAmbR,float afAmbG, float afAmbB)
+ {
+ cPortalContainer *pContainer = gpScene->GetWorld3D()->GetPortalContainer();
+
+ cSector *pSector = pContainer->GetSector(asSector);
+ if(pSector == NULL){
+ Warning("Could not find sector '%s'\n", asSector.c_str());
+ return;
+ }
+
+ pSector->SetAmbientColor(cColor(afAmbR, afAmbG, afAmbB,1));
+ }
+ SCRIPT_DEFINE_FUNC_4(void, SetSectorProperties, string, float, float, float)
+
+ //-----------------------------------------------------------------------
+
+ static void __stdcall SetSectorPortalActive(std::string asSector, int alPortal, bool abActive)
+ {
+ cPortalContainer *pContainer = gpScene->GetWorld3D()->GetPortalContainer();
+
+ cSector *pSector = pContainer->GetSector(asSector);
+ if(pSector == NULL){
+ Warning("Could not find sector '%s'\n", asSector.c_str());
+ return;
+ }
+
+ cPortal *pPortal = pSector->GetPortal(alPortal);
+ if(pPortal==NULL)
+ {
+ Warning("Could not find portal %d in sector '%s'\n",alPortal,asSector.c_str());
+ return;
+ }
+
+ pPortal->SetActive(abActive);
+ }
+ SCRIPT_DEFINE_FUNC_3(void, SetSectorPortalActive, string, int, bool)
+
+ /////////////////////////////////////////////////////////////////////////
+ /////// RESOURCES //////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets a string in the current language.
+ * \param asCat The translation category
+ * \param asName The name of the category entry.
+ **/
+ static std::string __stdcall Translate(std::string asCat, std::string asName)
+ {
+ tWString wsText = gpResources->Translate(asCat,asName);
+ return cString::To8Char(wsText);
+ }
+ SCRIPT_DEFINE_FUNC_2(string, Translate, string, string)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Preloads the data for a sound.
+ * \param asFile This can be a wav, ogg, mp3 or snt file.
+ **/
+ static void __stdcall PreloadSound(std::string asFile)
+ {
+ tString sExt = cString::ToLowerCase(cString::GetFileExt(asFile));
+ if(sExt=="snt")
+ {
+ cSoundEntityData *pData = gpResources->GetSoundEntityManager()->CreateSoundEntity(asFile);
+ if(pData == NULL) {
+ Warning("Couldn't preload sound '%s'\n",asFile.c_str());
+ return;
+ }
+
+ if(pData->GetMainSoundName() != ""){
+ iSoundChannel *pChannel = gpSound->GetSoundHandler()->CreateChannel(pData->GetMainSoundName(),0);
+ hplDelete(pChannel);
+ }
+ if(pData->GetStartSoundName() != ""){
+ iSoundChannel *pChannel = gpSound->GetSoundHandler()->CreateChannel(pData->GetStartSoundName(),0);
+ hplDelete(pChannel);
+ }
+ if(pData->GetStopSoundName() != ""){
+ iSoundChannel *pChannel = gpSound->GetSoundHandler()->CreateChannel(pData->GetStopSoundName(),0);
+ hplDelete(pChannel);
+ }
+ }
+ else
+ {
+ iSoundData *pSound = gpResources->GetSoundManager()->CreateSoundData(asFile,false);
+ if(pSound){
+ Warning("Couldn't preload sound '%s'\n",asFile.c_str());
+ }
+ }
+ }
+ SCRIPT_DEFINE_FUNC_1(void, PreloadSound, string)
+
+ //-----------------------------------------------------------------------
+
+ /////////////////////////////////////////////////////////////////////////
+ /////// MESH ENTITY //////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ static void __stdcall SetMeshActive(std::string asName, bool abActive)
+ {
+ cMeshEntity *pEnt = gpScene->GetWorld3D()->GetMeshEntity(asName);
+ if(pEnt==NULL){
+ Warning("Didn't find mesh entity '%s'\n",asName.c_str());
+ return;
+ }
+
+ pEnt->SetActive(abActive);
+ pEnt->SetVisible(abActive);
+ }
+ SCRIPT_DEFINE_FUNC_2(void, SetMeshActive, string, bool)
+
+ //-----------------------------------------------------------------------
+
+ /////////////////////////////////////////////////////////////////////////
+ /////// PARTICLE SYSTEM //////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Create a particle system at the position of an area
+ * \param asName The name of the particle system.
+ * \param abActive If it should be active or not.
+ **/
+ static void __stdcall SetParticleSystemActive(std::string asName, bool abActive)
+ {
+ cParticleSystem3D *pPS = gpScene->GetWorld3D()->GetParticleSystem(asName);
+ if(pPS==NULL){
+ Warning("Didn't find particle system '%s'\n",asName.c_str());
+ return;
+ }
+
+ pPS->SetActive(abActive);
+ pPS->SetVisible(abActive);
+ }
+ SCRIPT_DEFINE_FUNC_2(void, SetParticleSystemActive, string, bool)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Create a particle system at the position of an area
+ * \param asName The name of the particle system.
+ * \param asType The type of aprticle system
+ * \param asArea The name of the area
+ * \param X Y and Z the variables of the particle system.
+ **/
+ static void __stdcall CreateParticleSystem(std::string asName, std::string asType, std::string asArea,
+ float afX, float afY, float afZ)
+ {
+ cAreaEntity* pArea = gpScene->GetWorld3D()->GetAreaEntity(asArea);
+ if(pArea==NULL){
+ Warning("Couldn't find area '%s'\n",asArea.c_str());
+ return;
+ }
+
+ cParticleSystem3D *pPS = gpScene->GetWorld3D()->CreateParticleSystem(asName,asType,
+ cVector3f(afX,afY,afZ),pArea->m_mtxTransform);
+ if(pPS==NULL){
+ Warning("No particle system of type '%s'\n",asType.c_str());
+ return;
+ }
+ }
+ SCRIPT_DEFINE_FUNC_6(void, CreateParticleSystem, string, string, string, float, float, float)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Kill a particle system
+ * \param asName The name of the particle system.
+ **/
+ static void __stdcall KillParticleSystem(std::string asName)
+ {
+ /*cParticleSystem3D *pPS = gpScene->GetWorld3D()->GetParticleSystem(asName);
+ if(pPS==NULL){
+ Warning("Didn't find particle system '%s'\n",asName.c_str());
+ return;
+ }
+ pPS->Kill();*/
+
+ bool bFound = false;
+ cParticleSystem3DIterator it = gpScene->GetWorld3D()->GetParticleSystemIterator();
+ while(it.HasNext())
+ {
+ cParticleSystem3D *pPS = it.Next();
+
+ if(pPS->GetName() == asName)
+ {
+ pPS->Kill();
+ bFound = true;
+ }
+ }
+
+ if(!bFound) Warning("Didn't find particle system '%s'\n",asName.c_str());
+ }
+ SCRIPT_DEFINE_FUNC_1(void, KillParticleSystem, string)
+
+ //-----------------------------------------------------------------------
+
+ /////////////////////////////////////////////////////////////////////////
+ /////// BEAM //////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+
+ /**
+ * Creates an a beam between two areas
+ * \param asName
+ * \param asFile
+ * \param asStartArea
+ * \param asEndArea
+ */
+ static void __stdcall CreateBeam(std::string asName, std::string asFile,
+ std::string asStartArea, std::string asEndArea)
+ {
+ cAreaEntity* pStartArea = gpScene->GetWorld3D()->GetAreaEntity(asStartArea);
+ if(pStartArea==NULL){
+ Warning("Couldn't find area '%s'\n",asStartArea.c_str());
+ return;
+ }
+
+ cAreaEntity* pEndArea = gpScene->GetWorld3D()->GetAreaEntity(asEndArea);
+ if(pEndArea==NULL){
+ Warning("Couldn't find area '%s'\n",asEndArea.c_str());
+ return;
+ }
+
+ cBeam *pBeam = gpScene->GetWorld3D()->CreateBeam(asName);
+
+ if(pBeam->LoadXMLProperties(asFile)==false)
+ {
+ Error("Couldn't create beam from file '%s'\n",asFile.c_str());
+ gpScene->GetWorld3D()->DestroyBeam(pBeam);
+ return;
+ }
+
+ pBeam->SetPosition(pStartArea->m_mtxTransform.GetTranslation());
+ pBeam->GetEnd()->SetPosition(pEndArea->m_mtxTransform.GetTranslation());
+ }
+ SCRIPT_DEFINE_FUNC_4(void, CreateBeam, string, string, string, string)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Destroys a beam
+ * \param asName
+ */
+ static void __stdcall DestroyBeam(std::string asName)
+ {
+ cBeam* pBeam = gpScene->GetWorld3D()->GetBeam(asName);
+ if(pBeam==NULL)
+ {
+ Warning("Couldn't find beam '%s'\n",asName.c_str());
+ return;
+ }
+
+ gpScene->GetWorld3D()->DestroyBeam(pBeam);
+ }
+ SCRIPT_DEFINE_FUNC_1(void, DestroyBeam, string)
+
+ //-----------------------------------------------------------------------
+
+
+
+ /////////////////////////////////////////////////////////////////////////
+ /////// LIGHT //////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Fades a sound to a color and a radius
+ * \param asName The name of the light
+ * \param afR The red channel to fade to.
+ * \param afG The green channel to fade to.
+ * \param afB The blue channel to fade to.
+ * \param afA The alpha channel to fade to.
+ * \param afRadius The radius to fade to.
+ * \param afTime The amount of seconds the fade should last.
+ **/
+ static void __stdcall FadeLight3D(std::string asName, float afR,float afG, float afB, float afA,
+ float afRadius, float afTime)
+ {
+ iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
+ if(pLight==NULL)
+ {
+ Warning("Couldn't find light '%s'\n",asName.c_str());
+ return;
+ }
+
+ pLight->FadeTo(cColor(afR,afG,afB,afA),afRadius, afTime);
+ pLight->SetVisible(true);
+ pLight->UpdateLight(2.0f/60.0f);
+ }
+ SCRIPT_DEFINE_FUNC_7(void, FadeLight3D, string, float, float, float, float, float, float)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Attaches a billboard to a light
+ * \param asBillboardName The billbaord name
+ * \param asLightName The light name
+ * \param abX True if it should be attached, false if you want to remove.
+ **/
+ static void __stdcall AttachBillboardToLight3D(std::string asBillboardName, std::string asLightName,bool abX)
+ {
+ iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asLightName);
+ if(pLight==NULL)
+ {
+ Warning("Couldn't find light '%s'\n",asLightName.c_str());
+ return;
+ }
+
+ cBillboard *pBillboard = gpScene->GetWorld3D()->GetBillboard(asBillboardName);
+ if(pBillboard==NULL)
+ {
+ Warning("Couldn't find billboard '%s'\n",asBillboardName.c_str());
+ return;
+ }
+
+ if(abX)
+ pLight->AttachBillboard(pBillboard);
+ else
+ pLight->RemoveBillboard(pBillboard);
+ }
+ SCRIPT_DEFINE_FUNC_3(void, AttachBillboardToLight3D, string, string, bool)
+
+ //-----------------------------------------------------------------------
+
+
+ /**
+ * Sets on/off a light
+ * \param asName The light name
+ * \param abX if the light should be on or off.
+ **/
+ static void __stdcall SetLight3DVisible(std::string asName, bool abX)
+ {
+ iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
+ if(pLight==NULL)
+ {
+ Warning("Couldn't find light '%s'\n",asName.c_str());
+ return;
+ }
+
+ pLight->SetVisible(abX);
+ }
+ SCRIPT_DEFINE_FUNC_2(void, SetLight3DVisible, string, bool)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Sets on/off for affect only in sector where centre is.
+ * \param asName The light name
+ * \param abX if the light should only affects objects in same sector or not.
+ **/
+ static void __stdcall SetLight3DOnlyAffectInSector(std::string asName, bool abX)
+ {
+ iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
+ if(pLight==NULL)
+ {
+ Warning("Couldn't find light '%s'\n",asName.c_str());
+ return;
+ }
+
+ pLight->SetOnlyAffectInSector(abX);
+ }
+ SCRIPT_DEFINE_FUNC_2(void, SetLight3DOnlyAffectInSector, string, bool)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Sets flickering on/off a light
+ * \param asName The light name
+ * \param abX if the light flicker should be on or off.
+ **/
+ static void __stdcall SetLight3DFlickerActive(std::string asName, bool abX)
+ {
+ iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
+ if(pLight==NULL)
+ {
+ Warning("Couldn't find light '%s'\n",asName.c_str());
+ return;
+ }
+
+ pLight->SetFlickerActive(abX);
+ }
+ SCRIPT_DEFINE_FUNC_2(void, SetLight3DFlickerActive, string, bool)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Sets flickering parameters
+ * \param asName The light name
+ * \param abR, afG, afB, afA The color of the light when off
+ * \param afRadius The radius of the light when off.
+ * \param afOnMinLength Minimum time before going from off to on.
+ * \param afOnMaxLength Maximum time before going from off to on.
+ * \param asOnSound Name of the sound played when going from off to on. "" means no sound.
+ * \param asOnPS Name of the particle system played when going from off to on. "" means none.
+ * \param afOffMinLength Minimum time before going from on to off.
+ * \param afOffMaxLength Maximum time before going from on to off.
+ * \param asOffSound Name of the sound played when going from on to off. "" means no sound.
+ * \param asOffPS Name of the particle system played when going from on to off. "" means none.
+ * \param abFade If there should be a fade between off and on.
+ * \param afOnFadeLength Fade length from off to on.
+ * \param afOffFadeLength Fade length from on to off.
+ **/
+ static void __stdcall SetLight3DFlicker(std::string asName,
+ float afR,float afG, float afB, float afA,
+ float afRadius,
+
+ float afOnMinLength, float afOnMaxLength,
+ std::string asOnSound,std::string asOnPS,
+
+ float afOffMinLength, float afOffMaxLength,
+ std::string asOffSound,std::string asOffPS,
+
+ bool abFade,
+ float afOnFadeLength, float afOffFadeLength)
+ {
+ iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
+ if(pLight==NULL)
+ {
+ Warning("Couldn't find light '%s'\n",asName.c_str());
+ return;
+ }
+
+ pLight->SetFlicker(cColor(afR,afG,afB,afA),afRadius,
+ afOnMinLength, afOnMaxLength,asOnSound,asOnPS,
+ afOffMinLength, afOffMaxLength,asOffSound,asOffPS,
+ abFade,afOnFadeLength,afOffFadeLength);
+ }
+ SCRIPT_DEFINE_FUNC_17(void, SetLight3DFlicker, string,
+ float, float, float, float,
+ float, float, float, string, string, float, float, string, string, bool, float, float)
+
+ //-----------------------------------------------------------------------
+
+ /////////////////////////////////////////////////////////////////////////
+ /////// SOUND //////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////
+
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Creates a sound entity at the postion of an area.
+ * \param asName Name of the sound area
+ * \param asFile The snt file to load.
+ * \param asArea The area to create at.
+ */
+ static void __stdcall CreateSoundEntity(std::string asName, std::string asFile,
+ std::string asArea)
+ {
+ cAreaEntity* pArea = gpScene->GetWorld3D()->GetAreaEntity(asArea);
+ if(pArea==NULL){
+ Warning("Couldn't find area '%s'\n",asArea.c_str());
+ return;
+ }
+
+ cSoundEntity *pSound = gpScene->GetWorld3D()->CreateSoundEntity(asName,asFile,true);
+ if(pSound==NULL)
+ {
+ Warning("Couldn't create sound entity '%s'\n",asFile.c_str());
+ return;
+ }
+
+ pSound->SetPosition(pArea->m_mtxTransform.GetTranslation());
+ }
+ SCRIPT_DEFINE_FUNC_3(void, CreateSoundEntity, string, string, string)
+ //-----------------------------------------------------------------------
+
+ /**
+ * Play a sound entity
+ * \param asName The entity name
+ * \param abPlayStart If the start sound should be played.
+ **/
+ static void __stdcall PlaySoundEntity(std::string asName, bool abPlayStart)
+ {
+ cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
+ if(pSound==NULL)
+ {
+ Warning("Couldn't find sound entity '%s'\n",asName.c_str());
+ return;
+ }
+
+ pSound->Play(abPlayStart);
+ }
+ SCRIPT_DEFINE_FUNC_2(void, PlaySoundEntity, string, bool)
+
+ /**
+ * Stop a sound entity
+ * \param asName The entity name
+ * \param abPlayEnd If the end sound should be played.
+ **/
+ static void __stdcall StopSoundEntity(std::string asName, bool abPlayEnd)
+ {
+ cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
+ if(pSound==NULL)
+ {
+ Warning("Couldn't find sound entity '%s'\n",asName.c_str());
+ return;
+ }
+
+ pSound->Stop(abPlayEnd);
+ }
+ SCRIPT_DEFINE_FUNC_2(void, StopSoundEntity, string, bool)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Play a sound entity fading it
+ * \param asName The entity name
+ * \param afSpeed Volume increase per second.
+ **/
+ static void __stdcall FadeInSoundEntity(std::string asName, float afSpeed)
+ {
+ cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
+ if(pSound==NULL)
+ {
+ Warning("Couldn't find sound entity '%s'\n",asName.c_str());
+ return;
+ }
+
+ pSound->FadeIn(afSpeed);
+ }
+ SCRIPT_DEFINE_FUNC_2(void, FadeInSoundEntity, string, float)
+
+ /**
+ * Stop a sound entity fading it
+ * \param asName The entity name
+ * \param afSpeed Volume decrease per second.
+ **/
+ static void __stdcall FadeOutSoundEntity(std::string asName, float afSpeed)
+ {
+ cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
+ if(pSound==NULL)
+ {
+ Warning("Couldn't find sound entity '%s'\n",asName.c_str());
+ return;
+ }
+
+ pSound->FadeOut(afSpeed);
+ }
+ SCRIPT_DEFINE_FUNC_2(void, FadeOutSoundEntity, string, float)
+
+ //-----------------------------------------------------------------------
+
+ static void __stdcall PlayMusic(std::string asName, float afVol, float afStepSize, bool abLoop)
+ {
+ gpSound->GetMusicHandler()->Play(asName,afVol,afStepSize,abLoop);
+ }
+ SCRIPT_DEFINE_FUNC_4(void, PlayMusic, string, float, float, bool)
+
+ //-----------------------------------------------------------------------
+
+ static void __stdcall StopMusic(float afStepSize)
+ {
+ gpSound->GetMusicHandler()->Stop(afStepSize);
+ }
+ SCRIPT_DEFINE_FUNC_1(void, StopMusic, float)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Play a sound gui sound, with out any position.
+ * \param asName The sound name
+ * \param afVol Volume of the sound
+ **/
+ static void __stdcall PlayGuiSound(std::string asName, float afVol)
+ {
+ gpSound->GetSoundHandler()->PlayGui(asName,false,afVol);
+ }
+ SCRIPT_DEFINE_FUNC_2(void, PlayGuiSound, string, float)
+
+ /////////////////////////////////////////////////////////////////////////
+ /////// PHYSICS //////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Sets a callback for a joint.
+ * The syntax for the function is: void MyFunction(string asJointName)
+ * \param asJointName The joint name
+ * \param asType The type, can be: "OnMax" or "OnMin".
+ * \param asFunc The script function to be called. Must be in the current script file. "" = disabled.
+ **/
+ static void __stdcall SetJointCallback(std::string asJointName, std::string asType,
+ std::string asFunc)
+ {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if(pJoint==NULL){
+ Warning("Couldn't find joint '%s'\n",asJointName.c_str());return;
+ }
+
+ int lType = 0;
+ tString sLowName = cString::ToLowerCase(asType);
+ if(sLowName == "onmax") lType = 1;
+ if(sLowName == "onmin") lType = 2;
+
+ if(lType ==0){
+ Warning("Joint callback type '%s' does not exist\n",asType.c_str()); return;
+ }
+
+ cScriptJointCallback *pCallback = static_cast<cScriptJointCallback*>(pJoint->GetCallback());
+ if(pCallback==NULL)
+ {
+ pCallback = hplNew( cScriptJointCallback, (gpScene) );
+ pJoint->SetCallback(pCallback,true);
+ }
+
+ if(lType==1) pCallback->msMaxFunc = asFunc;
+ if(lType==2) pCallback->msMinFunc = asFunc;
+ }
+ SCRIPT_DEFINE_FUNC_3(void, SetJointCallback, string, string, string)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Breaks a joint.
+ * \param asJointName The joint name
+ **/
+ static void __stdcall BreakJoint(std::string asJointName)
+ {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if(pJoint==NULL){
+ Warning("Couldn't find joint '%s'\n",asJointName.c_str());return;
+ }
+
+ pJoint->Break();
+ }
+ SCRIPT_DEFINE_FUNC_1(void, BreakJoint, string)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Sets if a joint controller is active or not.
+ * \param asJointName The joint name
+ * \param asCtrlName The controller name
+ * \param abActive If the controller is to be active or not.
+ **/
+ static void __stdcall SetJointControllerActive(std::string asJointName,std::string asCtrlName, bool abActive)
+ {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if(pJoint==NULL){
+ Warning("Couldn't find joint '%s'\n",asJointName.c_str());return;
+ }
+
+ iPhysicsController *pCtrl = pJoint->GetController(asCtrlName);
+ if(pCtrl==NULL){
+ Warning("Couldn't find controller %s in joint '%s'\n",asCtrlName.c_str(),asJointName.c_str());return;
+ }
+
+ pCtrl->SetActive(abActive);
+ }
+ SCRIPT_DEFINE_FUNC_3(void, SetJointControllerActive, string, string, bool)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Change the active controller. All other controllers are set to false.
+ * \param asJointName The joint name
+ * \param asCtrlName The controller name
+ **/
+ static void __stdcall ChangeJointController(std::string asJointName,std::string asCtrlName)
+ {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if(pJoint==NULL){
+ Warning("Couldn't find joint '%s'\n",asJointName.c_str());return;
+ }
+
+ if(pJoint->ChangeController(asCtrlName)==false)
+ {
+ Warning("Couldn't find controller %s in joint '%s'\n",asCtrlName.c_str(),asJointName.c_str());
+ return;
+ }
+ }
+ SCRIPT_DEFINE_FUNC_2(void, ChangeJointController, string, string)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Sets if a joint controller is active or not.
+ * \param asJointName The joint name
+ * \param asCtrlName The controller name
+ * \param asProperty Property to change, can be "DestValue"
+ * \param afValue Value to set it to.
+ **/
+ static void __stdcall SetJointControllerPropertyFloat(std::string asJointName,std::string asCtrlName,
+ std::string asProperty, float afValue)
+ {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if(pJoint==NULL){
+ Warning("Couldn't find joint '%s'\n",asJointName.c_str());return;
+ }
+
+ iPhysicsController *pCtrl = pJoint->GetController(asCtrlName);
+ if(pCtrl==NULL){
+ Warning("Couldn't find controller %s in joint '%s'\n",asCtrlName.c_str(),asJointName.c_str());return;
+ }
+
+ if(asProperty == "DestValue")
+ {
+ pCtrl->SetDestValue(afValue);
+ }
+ }
+ SCRIPT_DEFINE_FUNC_4(void, SetJointControllerPropertyFloat, string, string, string, float)
+
+ //-----------------------------------------------------------------------
+
+
+ /**
+ * Gets a property from the joint.
+ * Valid properties are:
+ * "Angle" The angle between the bodies (in degrees) (Not working for ball joint)
+ * "Distance" The distance between the bodies (in meter)
+ * "LinearSpeed" The relative linear speed between the bodies (in m/s)
+ * "AngularSpeed" The relative angular speed between the bodies (in m/s)
+ * "Force" The size of the force (in newton, kg*m/s^2).
+ * "MaxLimit" The max limit (meters or degrees)
+ * "MinLimit" The in limit (meters or degrees)
+ * \param asJointName The joint name
+ * \param asProp The property to get
+ **/
+ static float __stdcall GetJointProperty(std::string asJointName, std::string asProp)
+ {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if(pJoint==NULL){
+ Warning("Couldn't find joint '%s'\n",asJointName.c_str());return 0;
+ }
+
+ tString sLowProp = cString::ToLowerCase(asProp);
+
+ if(sLowProp == "angle")
+ {
+ return cMath::ToDeg(pJoint->GetAngle());
+ }
+ else if(sLowProp == "distance")
+ {
+ return pJoint->GetDistance();
+ }
+ else if(sLowProp == "linearspeed")
+ {
+ return pJoint->GetVelocity().Length();
+ }
+ else if(sLowProp == "angularspeed")
+ {
+ return pJoint->GetAngularVelocity().Length();
+ }
+ else if(sLowProp == "force")
+ {
+ return pJoint->GetForce().Length();
+ }
+ /////////////////////////////
+ // Min Limit
+ else if(sLowProp == "minlimit")
+ {
+ switch(pJoint->GetType())
+ {
+ case ePhysicsJointType_Hinge:
+ {
+ iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge*>(pJoint);
+ return cMath::ToDeg(pHingeJoint->GetMinAngle());
+ }
+ case ePhysicsJointType_Screw:
+ {
+ iPhysicsJointScrew *pScrewJoint = static_cast<iPhysicsJointScrew*>(pJoint);
+ return pScrewJoint->GetMinDistance();
+ }
+ case ePhysicsJointType_Slider:
+ {
+ iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider*>(pJoint);
+ return pSliderJoint->GetMinDistance();
+ }
+ }
+ }
+ /////////////////////////////
+ // Max Limit
+ else if(sLowProp == "maxlimit")
+ {
+ switch(pJoint->GetType())
+ {
+ case ePhysicsJointType_Hinge:
+ {
+ iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge*>(pJoint);
+ return cMath::ToDeg(pHingeJoint->GetMaxAngle());
+ }
+ case ePhysicsJointType_Screw:
+ {
+ iPhysicsJointScrew *pScrewJoint = static_cast<iPhysicsJointScrew*>(pJoint);
+ return pScrewJoint->GetMaxDistance();
+ }
+ case ePhysicsJointType_Slider:
+ {
+ iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider*>(pJoint);
+ return pSliderJoint->GetMaxDistance();
+ }
+ }
+
+ }
+
+ Warning("Joint property '%s' does not exist!\n",asProp.c_str());
+ return 0;
+ }
+ SCRIPT_DEFINE_FUNC_2(float, GetJointProperty, string, string)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Gets a property from the body.
+ * Valid properties are:
+ * "Mass" The mass of the body (in kg)
+ * "LinearSpeed" The linear speed the body has (in m/s)
+ * "AngularSpeed" The angular speed the body has (in m/s)
+ * \param asBodyName The body name
+ * \param asProp The property to get
+ **/
+ static float __stdcall GetBodyProperty(std::string asBodyName, std::string asProp)
+ {
+ iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
+ if(pBody==NULL){
+ Warning("Couldn't find Body '%s'\n",asBodyName.c_str());return 0;
+ }
+
+ tString sLowProp = cString::ToLowerCase(asProp);
+
+ if(sLowProp == "mass")
+ {
+ return pBody->GetMass();
+ }
+ else if(sLowProp == "linearspeed")
+ {
+ return pBody->GetLinearVelocity().Length();
+ }
+ else if(sLowProp == "angularspeed")
+ {
+ return pBody->GetAngularVelocity().Length();
+ }
+
+ Warning("Body property '%s' does not exist!\n",asProp.c_str());
+ return 0;
+ }
+ SCRIPT_DEFINE_FUNC_2(float, GetBodyProperty, string, string)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Sets a property to the body.
+ * Valid properties are:
+ * "Mass" The mass of the body (in kg)
+ * "CollideCharacter" 0 = false 1=true
+ * \param asBodyName The body name
+ * \param asProp The property to get
+ * \param afVal The new value of the property
+ **/
+ static void __stdcall SetBodyProperty(std::string asBodyName, std::string asProp, float afVal)
+ {
+ iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
+ if(pBody==NULL){
+ Warning("Couldn't find Body '%s'\n",asBodyName.c_str());return;
+ }
+
+ tString sLowProp = cString::ToLowerCase(asProp);
+
+ if(sLowProp == "mass")
+ {
+ pBody->SetMass(afVal);
+ pBody->SetEnabled(true);
+
+ if(afVal == 0)
+ {
+ pBody->SetLinearVelocity(0);
+ pBody->SetAngularVelocity(0);
+ }
+
+ return;
+ }
+ else if(sLowProp == "collidecharacter")
+ {
+ pBody->SetCollideCharacter(afVal <0.05 ? false : true);
+ return;
+ }
+ else if(sLowProp == "hasgravity")
+ {
+ pBody->SetCollideCharacter(afVal <0.05 ? false : true);
+ return;
+ }
+
+
+ Warning("Body property '%s' does not exist!\n",asProp.c_str());
+ }
+ SCRIPT_DEFINE_FUNC_3(void, SetBodyProperty, string, string, float)
+
+ //-----------------------------------------------------------------------
+
+ static void __stdcall AttachBodiesWithJoint(std::string asParentName, std::string asChildName, std::string asJointName)
+ {
+ iPhysicsBody *pParent = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asParentName);
+ if(pParent==NULL){
+ Warning("Couldn't find Body '%s'\n",asParentName.c_str());return;
+ }
+
+ iPhysicsBody *pChild = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asChildName);
+ if(pChild==NULL){
+ Warning("Couldn't find Body '%s'\n",asChildName.c_str());return;
+ }
+
+ iPhysicsWorld *pPhysicsWorld = gpScene->GetWorld3D()->GetPhysicsWorld();
+
+ cVector3f vPivot = (pParent->GetLocalPosition() + pChild->GetLocalPosition()) * 0.5f;
+ cVector3f vDir = cMath::Vector3Normalize(pChild->GetLocalPosition() - pParent->GetLocalPosition());
+
+ iPhysicsJointSlider *pJoint = pPhysicsWorld->CreateJointSlider(asJointName,vPivot,vDir,pParent,pChild);
+
+ pJoint->SetMinDistance(-0.01f);
+ pJoint->SetMaxDistance(0.01f);
+ }
+ SCRIPT_DEFINE_FUNC_3(void, AttachBodiesWithJoint, string, string, string)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Sets a property to the joint.
+ * Valid properties are:
+ * "MinLimit" The min limit (depends on joint, does not work on ball)
+ * "MaxLimit" The max limit (depends on joint, does not work on ball)
+ * \param asJointName The body name
+ * \param asProp The property to get
+ * \param afVal The new value of the property
+ **/
+ static void __stdcall SetJointProperty(std::string asJointName, std::string asProp, float afVal)
+ {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if(pJoint==NULL){
+ Warning("Couldn't find joint '%s'\n",asJointName.c_str());return;
+ }
+
+ tString sLowProp = cString::ToLowerCase(asProp);
+
+ if(pJoint->GetChildBody()) pJoint->GetChildBody()->SetEnabled(true);
+ if(pJoint->GetParentBody()) pJoint->GetParentBody()->SetEnabled(true);
+
+ /////////////////////////////
+ // Min Limit
+ if(sLowProp == "minlimit")
+ {
+ switch(pJoint->GetType())
+ {
+ case ePhysicsJointType_Hinge:
+ {
+ iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge*>(pJoint);
+ pHingeJoint->SetMinAngle(cMath::ToRad(afVal));
+ break;
+ }
+ case ePhysicsJointType_Screw:
+ {
+ iPhysicsJointScrew *pScrewJoint = static_cast<iPhysicsJointScrew*>(pJoint);
+ pScrewJoint->SetMinDistance(afVal);
+ break;
+ }
+ case ePhysicsJointType_Slider:
+ {
+ iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider*>(pJoint);
+ pSliderJoint->SetMinDistance(afVal);
+ break;
+ }
+ }
+ }
+ /////////////////////////////
+ // Max Limit
+ else if(sLowProp == "maxlimit")
+ {
+ switch(pJoint->GetType())
+ {
+ case ePhysicsJointType_Hinge:
+ {
+ iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge*>(pJoint);
+ pHingeJoint->SetMaxAngle(cMath::ToRad(afVal));
+ break;
+ }
+ case ePhysicsJointType_Screw:
+ {
+ iPhysicsJointScrew *pScrewJoint = static_cast<iPhysicsJointScrew*>(pJoint);
+ pScrewJoint->SetMaxDistance(afVal);
+ break;
+ }
+ case ePhysicsJointType_Slider:
+ {
+ iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider*>(pJoint);
+ pSliderJoint->SetMaxDistance(afVal);
+ break;
+ }
+ }
+
+ }
+ else
+ {
+ Warning("Joint property '%s' does not exist!\n",asProp.c_str());
+ }
+ }
+ SCRIPT_DEFINE_FUNC_3(void, SetJointProperty, string, string, float)
+
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Adds a force to the body. This can either be in the bodies local coord system or the world's.
+ * \param asBodyName The body name
+ * \param asCoordType The coordinate system type. "World" or "Local".
+ * \param afX force in the x direction. (in newton, kg*m/s^2)
+ * \param afY force in the y direction. (in newton, kg*m/s^2)
+ * \param afZ force in the z direction. (in newton, kg*m/s^2)
+ **/
+ static void __stdcall AddBodyForce(std::string asBodyName, std::string asCoordType,
+ float afX, float afY, float afZ)
+ {
+ iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
+ if(pBody==NULL){
+ Warning("Couldn't find Body '%s'\n",asBodyName.c_str());return;
+ }
+
+ int lType =0;
+ tString sLowType = cString::ToLowerCase(asCoordType);
+
+ if(sLowType == "world") lType = 1;
+ else if(sLowType == "local") lType =2;
+
+ if(lType==0){
+ Warning("Coord system type '%s' is not valid.\n",asCoordType.c_str());
+ return;
+ }
+
+ if(lType==1)
+ {
+ pBody->AddForce(cVector3f(afX,afY,afZ));
+ }
+ else if(lType==2)
+ {
+ cVector3f vWorldForce = cMath::MatrixMul(pBody->GetLocalMatrix().GetRotation(),
+ cVector3f(afX,afY,afZ));
+ pBody->AddForce(vWorldForce);
+ }
+ }
+ SCRIPT_DEFINE_FUNC_5(void, AddBodyForce, string, string, float, float, float)
+
+ //-----------------------------------------------------------------------
+
+ /**
+ * Adds an impule (a change in velocity) to the body. This can either be in the bodies local coord system or the world's.
+ * \param asBodyName The body name
+ * \param asCoordType The coordinate system type. "World" or "Local".
+ * \param afX velocity in the x direction. (in m/s)
+ * \param afY velocity in the y direction. (in m/s)
+ * \param afZ velocity in the z direction. (in m/s)
+ **/
+ static void __stdcall AddBodyImpulse(std::string asBodyName, std::string asCoordType,
+ float afX, float afY, float afZ)
+ {
+ iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
+ if(pBody==NULL){
+ Warning("Couldn't find Body '%s'\n",asBodyName.c_str());return;
+ }
+
+ int lType =0;
+ tString sLowType = cString::ToLowerCase(asCoordType);
+
+ if(sLowType == "world") lType = 1;
+ else if(sLowType == "local") lType =2;
+
+ if(lType==0){
+ Warning("Coord system type '%s' is not valid.\n",asCoordType.c_str());
+ return;
+ }
+
+ if(lType==1)
+ {
+ pBody->AddImpulse(cVector3f(afX,afY,afZ));
+ }
+ else if(lType==2)
+ {
+ cVector3f vWorldForce = cMath::MatrixMul(pBody->GetLocalMatrix().GetRotation(),
+ cVector3f(afX,afY,afZ));
+ pBody->AddImpulse(vWorldForce);
+ }
+ }
+ SCRIPT_DEFINE_FUNC_5(void, AddBodyImpulse, string, string, float, float, float)
+
+ //-----------------------------------------------------------------------
+
+
+ /////////////////////////////////////////////////////////////////////////
+ /////// LOCAL VARS //////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////
+
+ static void __stdcall CreateLocalVar(std::string asName, int alVal)
+ {
+ if(gpScene->GetLocalVar(asName)==NULL)
+ {
+ cScriptVar* pVar = gpScene->CreateLocalVar(asName);
+ pVar->mlVal = alVal;
+ }
+ }
+ SCRIPT_DEFINE_FUNC_2(void, CreateLocalVar, string, int)
+
+ static void __stdcall SetLocalVar(std::string asName, int alVal)
+ {
+ cScriptVar* pVar = gpScene->CreateLocalVar(asName);
+ pVar->mlVal = alVal;
+ }
+ SCRIPT_DEFINE_FUNC_2(void, SetLocalVar, string, int)
+
+ static void __stdcall AddLocalVar(std::string asName, int alVal)
+ {
+ cScriptVar* pVar = gpScene->CreateLocalVar(asName);
+ pVar->mlVal += alVal;
+ }
+ SCRIPT_DEFINE_FUNC_2(void, AddLocalVar, string, int)
+
+ static int __stdcall GetLocalVar(std::string asName)
+ {
+ cScriptVar* pVar = gpScene->GetLocalVar(asName);
+ if(pVar==NULL)
+ {
+ Error("Couldn't find local var '%s'\n",asName.c_str());
+ return 0;
+ }
+ return pVar->mlVal;
+ }
+ SCRIPT_DEFINE_FUNC_1(int, GetLocalVar, string)
+
+ //-----------------------------------------------------------------------
+ /////////////////////////////////////////////////////////////////////////
+ /////// GLOBAL VARS //////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////
+
+ static void __stdcall CreateGlobalVar(std::string asName, int alVal)
+ {
+ if(gpScene->GetGlobalVar(asName)==NULL)
+ {
+ cScriptVar* pVar = gpScene->CreateGlobalVar(asName);
+ pVar->mlVal = alVal;
+ }
+ }
+ SCRIPT_DEFINE_FUNC_2(void, CreateGlobalVar, string, int)
+
+ static void __stdcall SetGlobalVar(std::string asName, int alVal)
+ {
+ cScriptVar* pVar = gpScene->CreateGlobalVar(asName);
+ pVar->mlVal = alVal;
+ }
+ SCRIPT_DEFINE_FUNC_2(void, SetGlobalVar, string, int)
+
+
+ static void __stdcall AddGlobalVar(std::string asName, int alVal)
+ {
+ cScriptVar* pVar = gpScene->CreateGlobalVar(asName);
+ pVar->mlVal += alVal;
+ }
+ SCRIPT_DEFINE_FUNC_2(void, AddGlobalVar, string, int)
+
+
+ static int __stdcall GetGlobalVar(std::string asName)
+ {
+ cScriptVar* pVar = gpScene->GetGlobalVar(asName);
+ if(pVar==NULL)
+ {
+ Error("Couldn't find global var '%s'\n",asName.c_str());
+ return 0;
+ }
+ return pVar->mlVal;
+ }
+ SCRIPT_DEFINE_FUNC_1(int, GetGlobalVar, string)
+
+ //-----------------------------------------------------------------------
+
+
+
+ void cScriptFuncs::Init( cGraphics* apGraphics,
+ cResources *apResources,
+ cSystem *apSystem,
+ cInput *apInput,
+ cScene *apScene,
+ cSound *apSound,
+ cGame *apGame
+ )
+ {
+ gpGraphics = apGraphics;
+ gpResources = apResources;
+ gpSystem = apSystem;
+ gpInput = apInput;
+ gpScene = apScene;
+ gpSound = apSound;
+ gpGame = apGame;
+
+ //General
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(Print));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FloatToString));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(IntToString));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(RandFloat));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(RandInt));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(StringContains));
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(ResetLogicTimer));
+
+ //Renderer
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetAmbientColor));
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSkybox));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSkyboxActive));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSkyboxColor));
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateParticleSystemOnCamera));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFogActive));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFogCulling));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFogProperties));
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSectorProperties));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSectorPortalActive));
+
+
+ //Resources
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PreloadSound));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(Translate));
+
+ //Mesh Entity
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetMeshActive));
+
+ //Beams
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateBeam));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(DestroyBeam));
+
+ //Particle systems
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetParticleSystemActive));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateParticleSystem));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(KillParticleSystem));
+
+ //Light
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeLight3D));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AttachBillboardToLight3D));
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DVisible));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DFlickerActive));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DFlicker));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DOnlyAffectInSector));
+
+ //Sound
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlayMusic));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(StopMusic));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlaySoundEntity));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(StopSoundEntity));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeInSoundEntity));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeOutSoundEntity));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlayGuiSound));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateSoundEntity));
+
+
+ //Physics
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointCallback));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(BreakJoint));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetJointProperty));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetBodyProperty));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetBodyProperty));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointProperty));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AttachBodiesWithJoint));
+
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointControllerActive));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(ChangeJointController));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointControllerPropertyFloat));
+
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddBodyForce));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddBodyImpulse));
+
+ //Local vars
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateLocalVar));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLocalVar));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddLocalVar));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetLocalVar));
+
+ //Global vars
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateGlobalVar));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetGlobalVar));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddGlobalVar));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetGlobalVar));
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PRIVATE METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+
+
+ //-----------------------------------------------------------------------
+
+}
diff --git a/engines/hpl1/engine/game/ScriptFuncs.h b/engines/hpl1/engine/game/ScriptFuncs.h
new file mode 100644
index 00000000000..d0d420acdba
--- /dev/null
+++ b/engines/hpl1/engine/game/ScriptFuncs.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_SCRIPT_FUNCS_H
+#define HPL_SCRIPT_FUNCS_H
+
+#include "hpl1/engine/physics/PhysicsJoint.h"
+
+namespace hpl {
+
+ class cGraphics;
+ class cResources;
+ class cSystem;
+ class cSound;
+ class cScene;
+ class cInput;
+ class cGame;
+
+
+
+ //---------------------------------------
+
+ class cScriptJointCallback : public iPhysicsJointCallback
+ {
+ public:
+ cScriptJointCallback(cScene *apScene);
+
+ void OnMinLimit(iPhysicsJoint *apJoint);
+ void OnMaxLimit(iPhysicsJoint *apJoint);
+
+ bool IsScript(){ return true;}
+
+ tString msMaxFunc;
+ tString msMinFunc;
+
+ cScene *mpScene;
+ };
+
+ //---------------------------------------
+
+ class cScriptFuncs
+ {
+ public:
+ static void Init( cGraphics* apGraphics,
+ cResources *apResources,
+ cSystem *apSystem,
+ cInput *apInput,
+ cScene *apScene,
+ cSound *apSound,
+ cGame *apGame
+ );
+ };
+
+};
+#endif // HPL_SCRIPT_FUNCS_H
diff --git a/engines/hpl1/engine/game/Updateable.h b/engines/hpl1/engine/game/Updateable.h
new file mode 100644
index 00000000000..c653823676a
--- /dev/null
+++ b/engines/hpl1/engine/game/Updateable.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_UPDATEABLE_H
+#define HPL_UPDATEABLE_H
+
+#include "hpl1/engine/system/SystemTypes.h"
+
+namespace hpl {
+
+ class iUpdateable
+ {
+ public:
+ iUpdateable(const tString& asName) : msName(asName){}
+
+ virtual void OnDraw(){}
+
+ virtual void OnPostSceneDraw(){}
+
+ virtual void OnPostGUIDraw(){}
+
+ virtual void OnPostBufferSwap(){}
+
+ virtual void OnStart(){}
+
+ virtual void Update(float afTimeStep){}
+
+ virtual void OnExit(){}
+
+ virtual void Reset(){}
+
+ const tString& GetName(){ return msName;}
+
+ private:
+ tString msName;
+ };
+};
+
+#endif // HPL_UPDATEABLE_H
diff --git a/engines/hpl1/engine/game/Updater.cpp b/engines/hpl1/engine/game/Updater.cpp
new file mode 100644
index 00000000000..43d6c29fd7b
--- /dev/null
+++ b/engines/hpl1/engine/game/Updater.cpp
@@ -0,0 +1,299 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/game/Updater.h"
+
+#include "hpl1/engine/game/Updateable.h"
+#include "hpl1/engine/system/LowLevelSystem.h"
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cUpdater::cUpdater(iLowLevelSystem *apLowLevelSystem)
+ {
+ mpCurrentUpdates = NULL;
+
+ mpLowLevelSystem = apLowLevelSystem;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cUpdater::~cUpdater()
+ {
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHOD
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cUpdater::OnDraw()
+ {
+ for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
+ {
+ (*it)->OnDraw();
+ }
+
+ if(mpCurrentUpdates)
+ {
+ for(tUpdateableListIt it = mpCurrentUpdates->begin();it!=mpCurrentUpdates->end();++it)
+ {
+ (*it)->OnDraw();
+ }
+ }
+ }
+ //-----------------------------------------------------------------------
+
+ void cUpdater::OnPostSceneDraw()
+ {
+ for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
+ {
+ (*it)->OnPostSceneDraw();
+ }
+
+ if(mpCurrentUpdates)
+ {
+ for(tUpdateableListIt it = mpCurrentUpdates->begin();it!=mpCurrentUpdates->end();++it)
+ {
+ (*it)->OnPostSceneDraw();
+ }
+ }
+ }
+
+ void cUpdater::OnPostGUIDraw()
+ {
+ for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
+ {
+ (*it)->OnPostGUIDraw();
+ }
+
+ if(mpCurrentUpdates)
+ {
+ for(tUpdateableListIt it = mpCurrentUpdates->begin();it!=mpCurrentUpdates->end();++it)
+ {
+ (*it)->OnPostGUIDraw();
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cUpdater::OnPostBufferSwap()
+ {
+ for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
+ {
+ (*it)->OnPostBufferSwap();
+ }
+
+ if(mpCurrentUpdates)
+ {
+ for(tUpdateableListIt it = mpCurrentUpdates->begin();it!=mpCurrentUpdates->end();++it)
+ {
+ (*it)->OnPostBufferSwap();
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cUpdater::OnStart()
+ {
+ for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
+ {
+ (*it)->OnStart();
+ }
+
+ tUpdateContainerMapIt ContIt = m_mapUpdateContainer.begin();
+ while(ContIt != m_mapUpdateContainer.end())
+ {
+ tUpdateableListIt UpIt = ContIt->second.begin();
+ while(UpIt != ContIt->second.end())
+ {
+ (*UpIt)->OnStart();
+ UpIt++;
+ }
+
+ ContIt++;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cUpdater::Reset()
+ {
+ for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
+ {
+ (*it)->Reset();
+ }
+
+ tUpdateContainerMapIt ContIt = m_mapUpdateContainer.begin();
+ while(ContIt != m_mapUpdateContainer.end())
+ {
+
+ tUpdateableList *pUpdates = &ContIt->second;
+ tUpdateableListIt UpIt = pUpdates->begin();
+ while(UpIt != pUpdates->end())
+ {
+ iUpdateable *pUpdate = *UpIt;
+
+ pUpdate->Reset();
+
+ ++UpIt;
+ }
+
+ ++ContIt;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cUpdater::OnExit()
+ {
+ for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
+ {
+ //Log(" Exiting %s\n",(*it)->GetName().c_str());
+ (*it)->OnExit();
+ }
+
+ tUpdateContainerMapIt ContIt = m_mapUpdateContainer.begin();
+ while(ContIt != m_mapUpdateContainer.end())
+ {
+ tUpdateableListIt UpIt = ContIt->second.begin();
+ while(UpIt != ContIt->second.end())
+ {
+ //Log(" Exiting %s\n",(*UpIt)->GetName().c_str());
+ (*UpIt)->OnExit();
+ UpIt++;
+ }
+
+ ContIt++;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cUpdater::Update(float afTimeStep)
+ {
+ for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
+ {
+ START_TIMING_EX((*it)->GetName().c_str(),game)
+ (*it)->Update(afTimeStep);
+ STOP_TIMING(game)
+ }
+
+ if(mpCurrentUpdates)
+ {
+ tUpdateableList *pList = mpCurrentUpdates;
+ for(tUpdateableListIt it = pList->begin();it!=pList->end();++it)
+ {
+ START_TIMING_EX((*it)->GetName().c_str(),game)
+ (*it)->Update(afTimeStep);
+ STOP_TIMING(game)
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ bool cUpdater::SetContainer(tString asContainer)
+ {
+ tUpdateContainerMapIt it = m_mapUpdateContainer.find(asContainer);
+ if(it == m_mapUpdateContainer.end()) return false;
+
+ msCurrentUpdates = asContainer;
+ if(msCurrentUpdates == "Default"){
+ SetUpdateLogActive(true);
+ }
+ else {
+ SetUpdateLogActive(false);
+ }
+
+ mpCurrentUpdates = &it->second;
+
+ return true;
+ }
+
+ tString cUpdater::GetCurrentContainerName()
+ {
+ if(mpCurrentUpdates==NULL) return "";
+
+ return msCurrentUpdates;
+
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cUpdater::AddContainer(tString asName)
+ {
+ //Create the value for the map with key and Updateable
+ tUpdateContainerMap::value_type val = tUpdateContainerMap::value_type(
+ asName, tUpdateableList());
+ //Add it to the map
+ m_mapUpdateContainer.insert(val);
+
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cUpdater::AddUpdate(tString asContainer, iUpdateable* apUpdate)
+ {
+ if(apUpdate==NULL){
+ Error("Couldn't add NULL updatable!");
+ return false;
+ }
+
+ //Search the map for the container name
+ tUpdateContainerMapIt it = m_mapUpdateContainer.find(asContainer);
+ if(it == m_mapUpdateContainer.end()) return false;
+
+ //Add the updatable
+ it->second.push_back(apUpdate);
+
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cUpdater::AddGlobalUpdate(iUpdateable* apUpdate)
+ {
+ mlstGlobalUpdateableList.push_back(apUpdate);
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PRIVATE METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/game/Updater.h b/engines/hpl1/engine/game/Updater.h
new file mode 100644
index 00000000000..09b791c38ea
--- /dev/null
+++ b/engines/hpl1/engine/game/Updater.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_UPDATER_H
+#define HPL_UPDATER_H
+
+#include <map>
+#include <list>
+
+#include "hpl1/engine/system/SystemTypes.h"
+
+namespace hpl {
+
+ class iUpdateable;
+ class iLowLevelSystem;
+
+ typedef std::list<iUpdateable*> tUpdateableList;
+ typedef tUpdateableList::iterator tUpdateableListIt;
+
+ typedef std::map<tString, tUpdateableList> tUpdateContainerMap;
+ typedef tUpdateContainerMap::iterator tUpdateContainerMapIt;
+
+ class cUpdater
+ {
+ public:
+ cUpdater(iLowLevelSystem *apLowLevelSystem);
+ ~cUpdater();
+
+ void Reset();
+
+ void OnDraw();
+ void OnPostSceneDraw();
+ void OnPostGUIDraw();
+ void OnPostBufferSwap();
+
+ void OnStart();
+
+ void Update(float afTimeStep);
+
+ void OnExit();
+
+ /**
+ * Sets the active update container to be used.
+ * \param asContainer Name of the contianer
+ * \return
+ */
+ bool SetContainer(tString asContainer);
+
+ /**
+ * Gets the name of the current container in use.
+ * \return name of current container.
+ */
+ tString GetCurrentContainerName();
+ /**
+ * Adds a new container
+ * \todo change name to state instead of container?
+ * \param asName Name for the new container.
+ * \return
+ */
+ bool AddContainer(tString asName);
+ /**
+ * Adds a new update in a container.
+ * \param asContainer Container name
+ * \param apUpdate pointer to the class that will be updated
+ * \return
+ */
+ bool AddUpdate(tString asContainer, iUpdateable* apUpdate);
+ /**
+ * Adds a global update that runs no matter what container is set
+ * \param apUpdate
+ * \return
+ */
+ bool AddGlobalUpdate(iUpdateable* apUpdate);
+
+ private:
+ tString msCurrentUpdates;
+
+ tUpdateContainerMap m_mapUpdateContainer;
+
+ iLowLevelSystem *mpLowLevelSystem;
+
+ tUpdateableList *mpCurrentUpdates;
+ tUpdateableList mlstGlobalUpdateableList;
+ };
+};
+#endif // HPL_UPDATER_H
diff --git a/engines/hpl1/engine/graphics/Animation.cpp b/engines/hpl1/engine/graphics/Animation.cpp
new file mode 100644
index 00000000000..ee3736f1a33
--- /dev/null
+++ b/engines/hpl1/engine/graphics/Animation.cpp
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/graphics/Animation.h"
+
+#include "hpl1/engine/math/Math.h"
+#include "hpl1/engine/graphics/AnimationTrack.h"
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cAnimation::cAnimation(const tString &asName, const tString &asFile) : iResourceBase(asName,0)
+ {
+ msAnimName = "";
+ msFileName = asFile;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAnimation::~cAnimation()
+ {
+ STLDeleteAll(mvTracks);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ float cAnimation::GetLength()
+ {
+ return mfLength;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cAnimation::SetLength(float afTime)
+ {
+ mfLength = afTime;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAnimationTrack* cAnimation::CreateTrack(const tString &asName, tAnimTransformFlag aFlags)
+ {
+ cAnimationTrack *pTrack = hplNew( cAnimationTrack,(asName, aFlags, this) );
+
+ mvTracks.push_back(pTrack);
+
+ return pTrack;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAnimationTrack* cAnimation::GetTrack(int alIndex)
+ {
+ return mvTracks[alIndex];
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAnimationTrack* cAnimation::GetTrackByName(const tString &asName)
+ {
+ for(size_t i=0; i< mvTracks.size(); ++i)
+ {
+ if(asName == tString(mvTracks[i]->GetName()))
+ {
+ return mvTracks[i];
+ }
+ }
+
+ return NULL;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cAnimation::ResizeTracks(int alNum)
+ {
+ mvTracks.reserve(alNum);
+ }
+
+ //-----------------------------------------------------------------------
+
+ int cAnimation::GetTrackNum()
+ {
+ return (int)mvTracks.size();
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // PRIVATE METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/graphics/Animation.h b/engines/hpl1/engine/graphics/Animation.h
new file mode 100644
index 00000000000..ba653e43eff
--- /dev/null
+++ b/engines/hpl1/engine/graphics/Animation.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_ANIMATION_H
+#define HPL_ANIMATION_H
+
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/graphics/GraphicsTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/resources/ResourceBase.h"
+
+namespace hpl {
+
+ class cAnimationTrack;
+
+ typedef std::vector<cAnimationTrack*> tAnimationTrackVec;
+ typedef tAnimationTrackVec::iterator tAnimationTrackVecIt;
+
+ class cAnimation : public iResourceBase
+ {
+ public:
+ cAnimation(const tString &asName, const tString &asFile);
+ ~cAnimation();
+
+ float GetLength();
+ void SetLength(float afTime);
+
+ cAnimationTrack* CreateTrack(const tString &asName, tAnimTransformFlag aFlags);
+ cAnimationTrack* GetTrack(int alIndex);
+ cAnimationTrack* GetTrackByName(const tString &asName);
+ void ResizeTracks(int alNum);
+ int GetTrackNum();
+
+ const char* GetAnimationName(){ return msAnimName.c_str();}
+ void SetAnimationName(const tString &asName){ msAnimName =asName;}
+
+ tString& GetFileName(){ return msFileName;}
+
+ //Resources implementation
+ bool Reload(){ return false;}
+ void Unload(){}
+ void Destroy(){}
+
+ private:
+ tString msAnimName;
+ tString msFileName;
+
+ float mfLength;
+
+ tAnimationTrackVec mvTracks;
+ };
+
+};
+#endif // HPL_ANIMATION_H
diff --git a/engines/hpl1/engine/graphics/AnimationTrack.cpp b/engines/hpl1/engine/graphics/AnimationTrack.cpp
new file mode 100644
index 00000000000..f9e9c31ecf7
--- /dev/null
+++ b/engines/hpl1/engine/graphics/AnimationTrack.cpp
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/graphics/AnimationTrack.h"
+
+#include "hpl1/engine/math/Math.h"
+#include "hpl1/engine/graphics/Animation.h"
+#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/scene/Node3D.h"
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cAnimationTrack::cAnimationTrack(const tString &asName, tAnimTransformFlag aTransformFlags,
+ cAnimation *apParent)
+ {
+ msName = asName;
+ mTransformFlags = aTransformFlags;
+ mpParent = apParent;
+
+ mfMaxFrameTime = 0;
+
+ mlNodeIdx = -1;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cAnimationTrack::~cAnimationTrack()
+ {
+ STLDeleteAll(mvKeyFrames);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cAnimationTrack::ResizeKeyFrames(int alSize)
+ {
+ mvKeyFrames.reserve(alSize);
+ }
+
+ //-----------------------------------------------------------------------
+
+ cKeyFrame* cAnimationTrack::CreateKeyFrame(float afTime)
+ {
+ cKeyFrame* pFrame = hplNew( cKeyFrame,());
+ pFrame->time = afTime;
+
+ //Check so that this is the first
+ if(afTime > mfMaxFrameTime || mvKeyFrames.empty())
+ {
+ mvKeyFrames.push_back(pFrame);
+ mfMaxFrameTime = afTime;
+ }
+ else
+ {
+ tKeyFramePtrVecIt it = mvKeyFrames.begin();
+ for(; it != mvKeyFrames.end(); it++)
+ {
+ if(afTime < (*it)->time)
+ {
+ break;
+ }
+ }
+ mvKeyFrames.insert(it,pFrame);
+ }
+
+ return pFrame;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cAnimationTrack::ApplyToNode(cNode3D* apNode, float afTime, float afWeight)
+ {
+ cKeyFrame Frame = GetInterpolatedKeyFrame(afTime);
+
+ //Scale
+ //Skip this for now...
+ /*cVector3f vOne(1,1,1);
+ cVector3f vScale = (Frame.scale - vOne)*afWeight + vOne;
+ apNode->AddScale(vScale);*/
+
+ //Rotation
+ cQuaternion qRot = cMath::QuaternionSlerp(afWeight, cQuaternion::Identity, Frame.rotation, true);
+ apNode->AddRotation(qRot);
+
+ //Translation
+ cVector3f vTrans = Frame.trans * afWeight;
+ apNode->AddTranslation(vTrans);
+ }
+
+ //-----------------------------------------------------------------------
+
+ cKeyFrame cAnimationTrack::GetInterpolatedKeyFrame(float afTime)
+ {
+ cKeyFrame ResultKeyFrame;
+ ResultKeyFrame.time = afTime;
+
+ cKeyFrame *pKeyFrameA = NULL;
+ cKeyFrame *pKeyFrameB = NULL;
+
+ float fT = GetKeyFramesAtTime(afTime, &pKeyFrameA, &pKeyFrameB);
+
+
+ if(fT == 0.0f)
+ {
+ ResultKeyFrame.rotation = pKeyFrameA->rotation;
+ ResultKeyFrame.scale = pKeyFrameA->scale;
+ ResultKeyFrame.trans = pKeyFrameA->trans;
+ }
+ else
+ {
+ //Do a linear interpolation
+ //This should include spline stuff later on.
+
+ ResultKeyFrame.rotation = cMath::QuaternionSlerp(fT, pKeyFrameA->rotation,
+ pKeyFrameB->rotation, true);
+
+ ResultKeyFrame.scale = pKeyFrameA->scale * (1 - fT) + pKeyFrameB->scale * fT;
+ ResultKeyFrame.trans = pKeyFrameA->trans * (1 - fT) + pKeyFrameB->trans * fT;
+ }
+
+ return ResultKeyFrame;
+ }
+
+ //-----------------------------------------------------------------------
+
+ float cAnimationTrack::GetKeyFramesAtTime(float afTime, cKeyFrame** apKeyFrameA,cKeyFrame** apKeyFrameB)
+ {
+ float fTotalAnimLength = mpParent->GetLength();
+
+ // Wrap time
+ //Not sure it is a good idea to clamp the length.
+ //But wrapping screws loop mode up.
+ //Wrap(..., totalLength + kEpislon), migh work though.
+ afTime = cMath::Clamp(afTime, 0, fTotalAnimLength);
+
+ //If longer than max time return last frame and first
+ if(afTime >= mfMaxFrameTime)
+ {
+ *apKeyFrameA = mvKeyFrames[mvKeyFrames.size()-1];
+ *apKeyFrameB = mvKeyFrames[0];
+
+ //Get T between end to start again. (the last frame doesn't mean the anim is over.
+ // In that case wrap to the first frame).
+ float fDeltaT = fTotalAnimLength - (*apKeyFrameA)->time;
+
+ //If animation time is >= max time might as well just return the last frame.
+ //Not sure if this is good for some looping anims, in that case check the code.
+ return 0.0f;//(afTime - (*apKeyFrameA)->time) / fDeltaT;
+ }
+
+ //Get the number of frames
+ const int lSize = (int)mvKeyFrames.size();
+
+ //Find the second frame.
+ int lIdxB=-1;
+ for(int i=0; i< lSize; i++)
+ {
+ if(afTime <= mvKeyFrames[i]->time)
+ {
+ lIdxB = i;
+ break;
+ }
+ }
+
+ //If first frame was found, the lowest time is not 0.
+ //If so return the first frame only.
+ if(lIdxB == 0)
+ {
+ *apKeyFrameA = mvKeyFrames[0];
+ *apKeyFrameB = mvKeyFrames[0];
+ return 0.0f;
+ }
+
+ //Get the frames
+ *apKeyFrameA = mvKeyFrames[lIdxB-1];
+ *apKeyFrameB = mvKeyFrames[lIdxB];
+
+ float fDeltaT = (*apKeyFrameB)->time - (*apKeyFrameA)->time;
+
+ return (afTime - (*apKeyFrameA)->time) / fDeltaT;
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // PRIVATE METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/graphics/AnimationTrack.h b/engines/hpl1/engine/graphics/AnimationTrack.h
new file mode 100644
index 00000000000..03e1a0f0bd2
--- /dev/null
+++ b/engines/hpl1/engine/graphics/AnimationTrack.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_ANIMATION_TRACK_H
+#define HPL_ANIMATION_TRACK_H
+
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/graphics/GraphicsTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
+
+namespace hpl {
+
+ class cAnimation;
+ class cNode3D;
+
+ class cAnimationTrack
+ {
+ public:
+ cAnimationTrack(const tString &asName, tAnimTransformFlag aTransformFlags, cAnimation *apParent);
+ ~cAnimationTrack();
+
+ void ResizeKeyFrames(int alSize);
+
+ /**
+ * Creates a new key frame. These should be added in sequential order.
+ * \param afTime the time for the key frame.
+ */
+ cKeyFrame* CreateKeyFrame(float afTime);
+
+ inline cKeyFrame* GetKeyFrame(int alIndex){ return mvKeyFrames[alIndex];}
+ inline int GetKeyFrameNum(){ return (int) mvKeyFrames.size();}
+
+ inline tAnimTransformFlag GetTransformFlags(){ return mTransformFlags;}
+
+ /**
+ * Apply the animation to a node. The method uses Node->AddXXX() so Update matrix must be called
+ * for the transformation to be applied.
+ * \param apNode The node with it's base pose
+ * \param afTime The time at which to apply the animation
+ * \param afWeight The weight of the animation, a value from 0 to 1.
+ */
+ void ApplyToNode(cNode3D* apNode, float afTime, float afWeight);
+
+ /**
+ * Get a KeyFrame that contains an interpolated value.
+ * \param afTime The time from wihcih to create the keyframe.
+ */
+ cKeyFrame GetInterpolatedKeyFrame(float afTime);
+
+ /**
+ * Gets key frames between for a specific time.
+ * \param afTime The time
+ * \param &apKeyFrameA The frame that is equal to or before time
+ * \param &apKeyFrameB The frame that is after time.
+ * \return Weight of the different frames. 0 = 100% A, 1 = 100% B 0.5 = 50% A and 50% B
+ */
+ float GetKeyFramesAtTime(float afTime, cKeyFrame** apKeyFrameA,cKeyFrame** apKeyFrameB);
+
+ const char* GetName(){ return msName.c_str();}
+
+ void SetNodeIndex(int alIndex){ mlNodeIdx = alIndex;}
+ int GetNodeIndex(){ return mlNodeIdx;}
+
+ private:
+ tString msName;
+
+ int mlNodeIdx;
+
+ tKeyFramePtrVec mvKeyFrames;
+ tAnimTransformFlag mTransformFlags;
+
+ float mfMaxFrameTime;
+
+ cAnimation* mpParent;
+ };
+
+};
+#endif // HPL_ANIMATION_TRACK_H
diff --git a/engines/hpl1/engine/graphics/BackgroundImage.cpp b/engines/hpl1/engine/graphics/BackgroundImage.cpp
new file mode 100644
index 00000000000..009d4073b10
--- /dev/null
+++ b/engines/hpl1/engine/graphics/BackgroundImage.cpp
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/graphics/BackgroundImage.h"
+#include "hpl1/engine/math/Math.h"
+
+namespace hpl {
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cBackgroundImage::cBackgroundImage(iMaterial* apMat,const cVector3f& avPos, bool abTile ,
+ const cVector2f& avSize, const cVector2f& avPosPercent, const cVector2f& avVel)
+ {
+ mpMaterial = apMat;
+
+ mvPos = avPos;
+ mbTile = abTile;
+ mvSize = avSize;
+ mvPosPercent = avPosPercent;
+ mvVel = avVel;
+
+ mvVtx = apMat->GetImage(eMaterialTexture_Diffuse)->GetVertexVecCopy(0,mvSize);
+ for(int i=0;i<(int)mvVtx.size();i++)
+ {
+ mvVtx[i].pos.z = mvPos.z;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ cBackgroundImage::~cBackgroundImage()
+ {
+ hplDelete(mpMaterial);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cBackgroundImage::Draw(const cRect2f& aCollideRect, iLowLevelGraphics * apLowLevelGraphics)
+ {
+ tVector3fList lstPositions;
+ cVector3f vScreenPos (aCollideRect.x * mvPosPercent.x - mvPos.x,
+ aCollideRect.y * mvPosPercent.y, mvPos.z -mvPos.y);
+
+ //Calulate at what positions(s) the background is to be drawn.
+ if(mbTile)
+ {
+ //The number of images needed.
+ cVector2l vNum;
+ vNum.x = (int)(aCollideRect.w / mvSize.x)+1;
+ vNum.y = (int)(aCollideRect.h / mvSize.y)+1;
+
+ cVector2f vStartPos;
+ if(vScreenPos.x>=0)
+ vStartPos.x = mvSize.x - cMath::Modulus(vScreenPos.x, mvSize.x );
+ else
+ vStartPos.x = cMath::Modulus(vScreenPos.x, mvSize.x );
+
+ if(vScreenPos.y>=0)
+ vStartPos.y = mvSize.y - cMath::Modulus(vScreenPos.y, mvSize.y );
+ else
+ vStartPos.y = cMath::Modulus(vScreenPos.y, mvSize.y );
+
+ //Log("Screen: %f : %f\n",vScreenPos.x, vScreenPos.y);
+ //Log("Start: %f : %f\n",vStartPos.x, vStartPos.y);
+ //Log("Pos: %f : %f\n",mvPos.x, mvPos.y);
+
+ if(vStartPos.x >0){
+ vStartPos.x -= mvSize.x;
+ vNum.x++;
+ }
+ if(vStartPos.y >0){
+ vStartPos.y -= mvSize.y;
+ vNum.y++;
+ }
+
+ for(int x=0; x<vNum.x; x++)
+ for(int y=0; y<vNum.y; y++)
+ {
+ lstPositions.push_back(cVector3f(vStartPos.x + mvSize.x*x,
+ vStartPos.y + mvSize.y*y,vScreenPos.z));
+ }
+ }
+ else
+ {
+ cRect2f Rect(vScreenPos.x, vScreenPos.y, mvSize.x, mvSize.y);
+
+ if(cMath::BoxCollision(aCollideRect, Rect))
+ {
+ lstPositions.push_back(vScreenPos);
+ }
+ }
+
+
+ // Draw the images
+ mpMaterial->StartRendering(eMaterialRenderType_Diffuse,NULL,NULL);
+
+ int lIdxAdd=0;
+
+ tVector3fListIt it = lstPositions.begin();
+ for(;it!= lstPositions.end();it++)
+ {
+ mvVtx[0].pos.x = it->x;
+ mvVtx[0].pos.y = it->y;
+ apLowLevelGraphics->AddVertexToBatch(mvVtx[0]);
+
+ mvVtx[1].pos.x = it->x + mvSize.x;
+ mvVtx[1].pos.y = it->y;
+ apLowLevelGraphics->AddVertexToBatch(mvVtx[1]);
+
+ mvVtx[2].pos.x = it->x + mvSize.x;
+ mvVtx[2].pos.y = it->y + mvSize.y;
+ apLowLevelGraphics->AddVertexToBatch(mvVtx[2]);
+
+ mvVtx[3].pos.x = it->x;
+ mvVtx[3].pos.y = it->y + mvSize.y;
+ apLowLevelGraphics->AddVertexToBatch(mvVtx[3]);
+
+ apLowLevelGraphics->AddIndexToBatch(lIdxAdd + 0);
+ apLowLevelGraphics->AddIndexToBatch(lIdxAdd + 1);
+ apLowLevelGraphics->AddIndexToBatch(lIdxAdd + 2);
+ apLowLevelGraphics->AddIndexToBatch(lIdxAdd + 3);
+
+ /*apLowLevelGraphics->AddIndexToBatch(lIdxAdd + 2);
+ apLowLevelGraphics->AddIndexToBatch(lIdxAdd + 3);
+ apLowLevelGraphics->AddIndexToBatch(lIdxAdd + 0);*/
+
+ lIdxAdd+=4;
+ }
+
+ do
+ {
+ apLowLevelGraphics->FlushQuadBatch(mpMaterial->GetBatchFlags(eMaterialRenderType_Diffuse),false);
+ }
+ while(mpMaterial->NextPass(eMaterialRenderType_Diffuse));
+
+ apLowLevelGraphics->ClearBatch();
+
+ mpMaterial->EndRendering(eMaterialRenderType_Diffuse);
+ }
+ //-----------------------------------------------------------------------
+
+ void cBackgroundImage::Update()
+ {
+ mvPos += mvVel;
+
+ if(mbTile)
+ {
+ if(mvPos.x>=mvSize.x)mvPos.x = mvPos.x - mvSize.x;
+ if(mvPos.y>=mvSize.y)mvPos.y = mvPos.y - mvSize.y;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/graphics/BackgroundImage.h b/engines/hpl1/engine/graphics/BackgroundImage.h
new file mode 100644
index 00000000000..8c2d28d0a0c
--- /dev/null
+++ b/engines/hpl1/engine/graphics/BackgroundImage.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_BACKGROUND_IMAGE_H
+#define HPL_BACKGROUND_IMAGE_H
+
+#include <map>
+#include "hpl1/engine/graphics/GraphicsTypes.h"
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/graphics/Material.h"
+
+namespace hpl {
+
+ class cBackgroundImage
+ {
+ public:
+ cBackgroundImage(iMaterial* apMat,const cVector3f& avPos, bool abTile,
+ const cVector2f& avSize, const cVector2f& avPosPercent, const cVector2f& avVel);
+ ~cBackgroundImage();
+
+ void Draw(const cRect2f& aCollideRect, iLowLevelGraphics * apLowLevelGraphics);
+
+ void Update();
+
+ private:
+ iMaterial *mpMaterial;
+
+ tVertexVec mvVtx;
+
+ cVector3f mvPos;
+ bool mbTile;
+ cVector2f mvSize;
+ cVector2f mvPosPercent;
+ cVector2f mvVel;
+ };
+
+ typedef std::map<float,cBackgroundImage*> tBackgroundImageMap;
+ typedef tBackgroundImageMap::iterator tBackgroundImageMapIt;
+};
+#endif // HPL_BACKGROUND_IMAGE_H
diff --git a/engines/hpl1/engine/graphics/Beam.cpp b/engines/hpl1/engine/graphics/Beam.cpp
new file mode 100644
index 00000000000..e17ca6044b9
--- /dev/null
+++ b/engines/hpl1/engine/graphics/Beam.cpp
@@ -0,0 +1,502 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/graphics/Beam.h"
+
+#include "hpl1/engine/impl/tinyXML/tinyxml.h"
+
+#include "hpl1/engine/resources/Resources.h"
+#include "hpl1/engine/resources/MaterialManager.h"
+#include "hpl1/engine/resources/FileSearcher.h"
+#include "hpl1/engine/graphics/VertexBuffer.h"
+#include "hpl1/engine/graphics/Material.h"
+#include "hpl1/engine/graphics/Graphics.h"
+#include "hpl1/engine/graphics/LowLevelGraphics.h"
+#include "hpl1/engine/scene/Camera3D.h"
+#include "hpl1/engine/scene/World3D.h"
+#include "hpl1/engine/scene/Scene.h"
+#include "hpl1/engine/math/Math.h"
+
+#include "hpl1/engine/game/Game.h"
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cBeam::cBeam(const tString asName, cResources *apResources,cGraphics *apGraphics) :
+ iRenderable(asName)
+ {
+ mpMaterialManager = apResources->GetMaterialManager();
+ mpFileSearcher = apResources->GetFileSearcher();
+ mpLowLevelGraphics = apGraphics->GetLowLevel();
+
+ msFileName = "";
+
+ mvSize = 1;
+
+ mbTileHeight = true;
+
+ mColor = cColor(1,1,1,1);
+
+ mpMaterial = NULL;
+
+ mlLastRenderCount = -1;
+
+
+ mpVtxBuffer = mpLowLevelGraphics->CreateVertexBuffer(
+ eVertexFlag_Position | eVertexFlag_Color0 | eVertexFlag_Texture0 |
+ eVertexFlag_Normal,
+ eVertexBufferDrawType_Tri, eVertexBufferUsageType_Dynamic,4,6);
+
+
+
+ cVector3f vCoords[4] = {cVector3f((mvSize.x/2),-(mvSize.y/2),0),
+ cVector3f(-(mvSize.x/2),-(mvSize.y/2),0),
+ cVector3f(-(mvSize.x/2),(mvSize.y/2),0),
+ cVector3f((mvSize.x/2),(mvSize.y/2),0)};
+
+ cVector3f vTexCoords[4] = {cVector3f(1,1,0), //Bottom left
+ cVector3f(-1,1,0), //Bottom right
+ cVector3f(-1,-1,0), //Top left
+ cVector3f(1,-1,0)}; //Top right
+
+ for(int i=0;i<4;i++)
+ {
+ mpVtxBuffer->AddVertex(eVertexFlag_Position, vCoords[i]);
+ mpVtxBuffer->AddColor(eVertexFlag_Color0, cColor(1,1,1,1));
+ mpVtxBuffer->AddVertex(eVertexFlag_Texture0, (vTexCoords[i] + cVector2f(1,1))/2);
+ mpVtxBuffer->AddVertex(eVertexFlag_Normal,cVector3f(0,0,1));
+ }
+
+ for(int i=0;i<3;i++) mpVtxBuffer->AddIndex(i);
+ for(int i=2;i<5;i++) mpVtxBuffer->AddIndex(i==4?0:i);
+
+ mpVtxBuffer->Compile(eVertexCompileFlag_CreateTangents);
+
+ mpEnd = hplNew( cBeamEnd, (asName + "_end",this));
+ mpEnd->AddCallback(&mEndCallback);
+
+ //Some temp setup
+ mBoundingVolume.SetSize(cVector3f(mvSize.x, mvSize.y, mvSize.x));
+
+ mbApplyTransformToBV = false;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cBeam::~cBeam()
+ {
+ hplDelete(mpEnd);
+ if(mpMaterial) mpMaterialManager->Destroy(mpMaterial);
+ if(mpVtxBuffer) hplDelete(mpVtxBuffer);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cBeam::SetSize(const cVector2f& avSize)
+ {
+ mvSize = avSize;
+ mBoundingVolume.SetSize(cVector3f(mvSize.x, mvSize.y, mvSize.x));
+
+ SetTransformUpdated();
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBeam::SetTileHeight(bool abX)
+ {
+ if(mbTileHeight == abX) return;
+
+ mbTileHeight = abX;
+
+ SetTransformUpdated();
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBeam::SetMultiplyAlphaWithColor(bool abX)
+ {
+ if(mbMultiplyAlphaWithColor == abX) return;
+
+ mbMultiplyAlphaWithColor = abX;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBeam::SetColor(const cColor &aColor)
+ {
+ if(mColor == aColor) return;
+
+ mColor = aColor;
+
+ float *pColors = mpVtxBuffer->GetArray(eVertexFlag_Color0);
+
+ //Change "lower colors"
+ if(mbMultiplyAlphaWithColor)
+ {
+ for(int i=0; i<2;++i)
+ {
+ pColors[0] = mColor.r * mColor.a;
+ pColors[1] = mColor.g * mColor.a;
+ pColors[2] = mColor.b * mColor.a;
+ pColors[3] = mColor.a;
+ pColors+=4;
+ }
+ }
+ else
+ {
+ for(int i=0; i<2;++i)
+ {
+ pColors[0] = mColor.r;
+ pColors[1] = mColor.g;
+ pColors[2] = mColor.b;
+ pColors[3] = mColor.a;
+ pColors+=4;
+ }
+ }
+ mpVtxBuffer->UpdateData(eVertexFlag_Color0,false);
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBeam::SetMaterial(iMaterial * apMaterial)
+ {
+ mpMaterial = apMaterial;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cBoundingVolume* cBeam::GetBoundingVolume()
+ {
+ if(mbUpdateBoundingVolume)
+ {
+ cVector3f vMax = GetWorldPosition();
+ cVector3f vMin = vMax;
+ cVector3f vEnd = mpEnd->GetWorldPosition();
+
+ if(vMax.x < vEnd.x) vMax.x = vEnd.x;
+ if(vMax.y < vEnd.y) vMax.y = vEnd.y;
+ if(vMax.z < vEnd.z) vMax.z = vEnd.z;
+
+ if(vMin.x > vEnd.x) vMin.x = vEnd.x;
+ if(vMin.y > vEnd.y) vMin.y = vEnd.y;
+ if(vMin.z > vEnd.z) vMin.z = vEnd.z;
+
+ vMin -= cVector3f(mvSize.x);
+ vMax += cVector3f(mvSize.x);
+
+ mBoundingVolume.SetLocalMinMax(vMin,vMax);
+
+ mbUpdateBoundingVolume = false;
+ }
+
+ return &mBoundingVolume;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBeam::UpdateGraphics(cCamera3D *apCamera,float afFrameTime, cRenderList *apRenderList)
+ {
+ if( mlStartTransformCount == GetTransformUpdateCount() &&
+ mlEndTransformCount == GetTransformUpdateCount())
+ {
+ return;
+ }
+
+ ////////////////////////////////
+ //Get Axis
+ mvAxis = mpEnd->GetWorldPosition() - GetWorldPosition();
+
+ mvMidPosition =GetWorldPosition() + mvAxis*0.5f;
+ float fDist = mvAxis.Length();
+
+ mvAxis.Normalise();
+
+ ////////////////////////////////
+ //Update vertex buffer
+ cVector2f vBeamSize = cVector2f(mvSize.x, fDist);
+
+ float *pPos = mpVtxBuffer->GetArray(eVertexFlag_Position);
+ float *pTex = mpVtxBuffer->GetArray(eVertexFlag_Texture0);
+
+ cVector3f vCoords[4] = {cVector3f((vBeamSize.x/2),-(vBeamSize.y/2),0),
+ cVector3f(-(vBeamSize.x/2),-(vBeamSize.y/2),0),
+ cVector3f(-(vBeamSize.x/2),(vBeamSize.y/2),0),
+ cVector3f((vBeamSize.x/2),(vBeamSize.y/2),0)};
+
+ cVector3f vTexCoords[4];
+ if(mbTileHeight)
+ {
+ vTexCoords[0] = cVector3f(1,1,0); //Bottom left
+ vTexCoords[1] = cVector3f(0,1,0); //Bottom right
+ vTexCoords[2] = cVector3f(0,-fDist/mvSize.y,0); //Top left
+ vTexCoords[3] = cVector3f(1,-fDist/mvSize.y,0); //Top right
+ }
+ else
+ {
+ vTexCoords[0] = cVector3f(1,1,0); //Bottom left
+ vTexCoords[1] = cVector3f(0,1,0); //Bottom right
+ vTexCoords[2] = cVector3f(0,0,0); //Top left
+ vTexCoords[3] = cVector3f(1,0,0); //Top right
+ }
+
+ for(int i=0; i<4;++i)
+ {
+ pPos[0] = vCoords[i].x;
+ pPos[1] = vCoords[i].y;
+ pPos[2] = vCoords[i].z;
+ pPos+=4;
+
+ pTex[0] = vTexCoords[i].x;
+ pTex[1] = vTexCoords[i].y;
+ pTex+=3;
+ }
+
+ if(mpMaterial->IsTransperant())
+ {
+ mpVtxBuffer->UpdateData(eVertexFlag_Position | eVertexFlag_Texture0,false);
+ }
+ else
+ {
+ mpVtxBuffer->UpdateData(eVertexFlag_Position | eVertexFlag_Texture0,false);
+ }
+
+
+
+ }
+
+ //-----------------------------------------------------------------------
+
+ cMatrixf* cBeam::GetModelMatrix(cCamera3D *apCamera)
+ {
+ if(apCamera==NULL)return &GetWorldMatrix();
+
+ m_mtxTempTransform = GetWorldMatrix();
+ cVector3f vForward, vRight, vUp;
+
+ cVector3f vCameraForward = apCamera->GetPosition() - GetWorldPosition();
+ vCameraForward.Normalise();
+
+ vUp = mvAxis;//cMath::MatrixMul(GetWorldMatrix().GetRotation(),mvAxis);
+ //vUp.Normalise();
+
+ if(vUp == vForward)
+ {
+ vRight = cMath::Vector3Cross(vUp, vCameraForward);
+ Warning("Beam Right vector is not correct! Contact programmer!\n");
+ }
+ else
+ vRight = cMath::Vector3Cross(vUp, vCameraForward);
+
+ vRight.Normalise();
+ vForward = cMath::Vector3Cross(vRight, vUp);
+
+ //Set right vector
+ m_mtxTempTransform.m[0][0] = vRight.x;
+ m_mtxTempTransform.m[1][0] = vRight.y;
+ m_mtxTempTransform.m[2][0] = vRight.z;
+
+ //Set up vector
+ m_mtxTempTransform.m[0][1] = vUp.x;
+ m_mtxTempTransform.m[1][1] = vUp.y;
+ m_mtxTempTransform.m[2][1] = vUp.z;
+
+ //Set forward vector
+ m_mtxTempTransform.m[0][2] = vForward.x;
+ m_mtxTempTransform.m[1][2] = vForward.y;
+ m_mtxTempTransform.m[2][2] = vForward.z;
+
+ m_mtxTempTransform.SetTranslation(mvMidPosition);
+
+ return &m_mtxTempTransform;
+ }
+
+ //-----------------------------------------------------------------------
+
+ int cBeam::GetMatrixUpdateCount()
+ {
+ return GetTransformUpdateCount();
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ bool cBeam::LoadXMLProperties(const tString asFile)
+ {
+ msFileName = asFile;
+
+ tString sNewFile = cString::SetFileExt(asFile,"beam");
+ tString sPath = mpFileSearcher->GetFilePath(sNewFile);
+ if(sPath != "")
+ {
+ TiXmlDocument *pDoc = hplNew( TiXmlDocument, (sPath.c_str()) );
+ if(pDoc->LoadFile())
+ {
+ TiXmlElement *pRootElem = pDoc->RootElement();
+
+ TiXmlElement *pMainElem = pRootElem->FirstChildElement("MAIN");
+ if(pMainElem!=NULL)
+ {
+ tString sMaterial = cString::ToString(pMainElem->Attribute("Material"),"");
+ cVector2f vSize = cString::ToVector2f(pMainElem->Attribute("Size"),1);
+
+ bool bTileHeight = cString::ToBool(pMainElem->Attribute("TileHeight"),true);
+ bool bMultiplyAlphaWithColor = cString::ToBool(pMainElem->Attribute("MultiplyAlphaWithColor"),false);
+
+ cColor StartColor = cString::ToColor(pMainElem->Attribute("StartColor"),cColor(1,1));
+ cColor EndColor = cString::ToColor(pMainElem->Attribute("EndColor"),cColor(1,1));
+
+
+ SetSize(vSize);
+ SetTileHeight(bTileHeight);
+ SetMultiplyAlphaWithColor(bMultiplyAlphaWithColor);
+ SetColor(StartColor);
+ mpEnd->SetColor(EndColor);
+
+ /////////////////
+ //Load material
+ iMaterial *pMat = mpMaterialManager->CreateMaterial(sMaterial);
+ if(pMat) {
+ SetMaterial(pMat);
+ }
+ else{
+ Error("Couldn't load material '%s' in Beam file '%s'",
+ sMaterial.c_str(), sNewFile.c_str());
+ return false;
+ }
+ }
+ else
+ {
+ Error("Cannot find main element in %s\n",sNewFile.c_str());
+ return false;
+ }
+ }
+ else
+ {
+ Error("Couldn't load file '%s'\n",sNewFile.c_str());
+ }
+ hplDelete(pDoc);
+ }
+ else
+ {
+ Error("Couldn't find file '%s'\n",sNewFile.c_str());
+ return false;
+ }
+
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cBeam::IsVisible()
+ {
+ if(mColor.r <= 0 && mColor.g <= 0 && mColor.b <= 0) return false;
+
+ return IsRendered();
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // BEAM END TRANSFORM UPDATE CALLBACK
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cBeamEnd_UpdateCallback::OnTransformUpdate(iEntity3D * apEntity)
+ {
+ cBeamEnd *pEnd = static_cast<cBeamEnd*>(apEntity);
+
+ pEnd->mpBeam->SetTransformUpdated(true);
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // BEAM END
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cBeamEnd::SetColor(const cColor &aColor)
+ {
+ if(mColor == aColor) return;
+
+ mColor = aColor;
+
+ float *pColors = mpBeam->mpVtxBuffer->GetArray(eVertexFlag_Color0);
+
+ //Change "upper colors"
+ pColors+= 4*2;
+ if(mpBeam->mbMultiplyAlphaWithColor)
+ {
+ for(int i=0; i<2;++i)
+ {
+ pColors[0] = mColor.r * mColor.a;
+ pColors[1] = mColor.g * mColor.a;
+ pColors[2] = mColor.b * mColor.a;
+ pColors[3] = mColor.a;
+ pColors+=4;
+ }
+ }
+ else
+ {
+ for(int i=0; i<2;++i)
+ {
+ pColors[0] = mColor.r;
+ pColors[1] = mColor.g;
+ pColors[2] = mColor.b;
+ pColors[3] = mColor.a;
+ pColors+=4;
+ }
+ }
+
+ mpBeam->mpVtxBuffer->UpdateData(eVertexFlag_Color0,false);
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // PRIVATE METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // SAVE OBJECT STUFF
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
+
+}
diff --git a/engines/hpl1/engine/graphics/Beam.h b/engines/hpl1/engine/graphics/Beam.h
new file mode 100644
index 00000000000..298c374eeff
--- /dev/null
+++ b/engines/hpl1/engine/graphics/Beam.h
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_BEAM_H
+#define HPL_BEAM_H
+
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/graphics/GraphicsTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/scene/Entity3D.h"
+#include "hpl1/engine/graphics/Renderable.h"
+#include "RenderList.h"
+
+namespace hpl {
+
+ class cMaterialManager;
+ class cResources;
+ class cGraphics;
+ class cFileSearcher;
+ class iLowLevelGraphics;
+ class iMaterial;
+ class iVertexBuffer;
+
+ //------------------------------------------
+
+ class cBeam;
+ class cBeamEnd : public iEntity3D
+ {
+ friend class cBeam;
+ friend class cBeamEnd_UpdateCallback;
+ public:
+ cBeamEnd(const tString asName, cBeam *apBeam) : iEntity3D(asName),
+ mColor(1,1),mpBeam(apBeam) {}
+
+ void SetColor(const cColor &aColor);
+ const cColor& GetColor(){ return mColor;}
+
+ /////////////////////////////////
+ //Entity implementation
+ tString GetEntityType(){ return "BeamEnd";}
+ private:
+ cColor mColor;
+ cBeam *mpBeam;
+ };
+
+ //------------------------------------------
+
+ class cBeamEnd_UpdateCallback : public iEntityCallback
+ {
+ public:
+ void OnTransformUpdate(iEntity3D * apEntity);
+ };
+
+ //------------------------------------------
+
+ class cBeam : public iRenderable
+ {
+ typedef iRenderable super;
+ friend class cBeamEnd;
+ public:
+ cBeam(const tString asName, cResources *apResources,cGraphics *apGraphics);
+ ~cBeam();
+
+ void SetMaterial(iMaterial * apMaterial);
+
+ const tString& GetFileName(){return msFileName;}
+
+ /**
+ * Set the size. X= the thickness of the line, width of texture used. Y = the length that one texture height takes.
+ * \param avSize
+ */
+ void SetSize(const cVector2f& avSize);
+ cVector2f GetSize(){ return mvSize;}
+
+ void SetColor(const cColor &aColor);
+ const cColor& GetColor(){ return mColor;}
+
+ void SetTileHeight(bool abX);
+ bool GetTileHeight(){ return mbTileHeight;}
+
+ void SetMultiplyAlphaWithColor(bool abX);
+ bool GetMultiplyAlphaWithColor(){ return mbMultiplyAlphaWithColor;}
+
+ cBeamEnd* GetEnd(){ return mpEnd;}
+
+ bool LoadXMLProperties(const tString asFile);
+
+ cVector3f GetAxis(){ return mvAxis;}
+ cVector3f GetMidPosition(){ return mvMidPosition;}
+
+ /////////////////////////////////
+ //Entity implementation
+ tString GetEntityType(){ return "Beam";}
+
+ bool IsVisible();
+ void SetVisible(bool abVisible){ SetRendered(abVisible); }
+
+ //Renderable implementations
+ iMaterial *GetMaterial(){ return mpMaterial;}
+ iVertexBuffer* GetVertexBuffer(){return mpVtxBuffer;}
+
+ void UpdateGraphics(cCamera3D *apCamera,float afFrameTime, cRenderList *apRenderList);
+
+ bool IsShadowCaster(){ return false;}
+
+ cBoundingVolume* GetBoundingVolume();
+
+ cMatrixf* GetModelMatrix(cCamera3D *apCamera);
+
+ int GetMatrixUpdateCount();
+
+
+ eRenderableType GetRenderType(){ return eRenderableType_ParticleSystem;}
+ private:
+ cMaterialManager* mpMaterialManager;
+ cFileSearcher *mpFileSearcher;
+ iLowLevelGraphics* mpLowLevelGraphics;
+
+ iMaterial *mpMaterial;
+ iVertexBuffer* mpVtxBuffer;
+
+ cBeamEnd *mpEnd;
+
+ tString msFileName;
+
+ int mlStartTransformCount;
+ int mlEndTransformCount;
+
+ cMatrixf m_mtxTempTransform;
+
+ int mlLastRenderCount;
+
+ cBeamEnd_UpdateCallback mEndCallback;
+
+ cVector2f mvSize;
+
+ cVector3f mvAxis;
+ cVector3f mvMidPosition;
+
+ bool mbTileHeight;
+ bool mbMultiplyAlphaWithColor;
+
+ cColor mColor;
+ };
+
+};
+#endif // HPL_BEAM_H
diff --git a/engines/hpl1/engine/graphics/BillBoard.cpp b/engines/hpl1/engine/graphics/BillBoard.cpp
new file mode 100644
index 00000000000..92c744ea2e8
--- /dev/null
+++ b/engines/hpl1/engine/graphics/BillBoard.cpp
@@ -0,0 +1,658 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/graphics/BillBoard.h"
+
+#include "hpl1/engine/impl/tinyXML/tinyxml.h"
+
+#include "hpl1/engine/resources/Resources.h"
+#include "hpl1/engine/resources/MaterialManager.h"
+#include "hpl1/engine/resources/FileSearcher.h"
+#include "hpl1/engine/graphics/VertexBuffer.h"
+#include "hpl1/engine/graphics/Material.h"
+#include "hpl1/engine/graphics/Graphics.h"
+#include "hpl1/engine/graphics/MeshCreator.h"
+#include "hpl1/engine/graphics/LowLevelGraphics.h"
+#include "hpl1/engine/scene/Camera3D.h"
+#include "hpl1/engine/scene/World3D.h"
+#include "hpl1/engine/scene/Scene.h"
+#include "hpl1/engine/math/Math.h"
+
+#include "hpl1/engine/game/Game.h"
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cBillboard::cBillboard(const tString asName,const cVector2f& avSize, cResources *apResources,
+ cGraphics *apGraphics) :
+ iRenderable(asName)
+ {
+ mpMaterialManager = apResources->GetMaterialManager();
+ mpFileSearcher = apResources->GetFileSearcher();
+ mpLowLevelGraphics = apGraphics->GetLowLevel();
+ mpMeshCreator = apGraphics->GetMeshCreator();
+
+ mpHaloSourceBuffer = mpMeshCreator->CreateBoxVertexBuffer(1);
+
+ mvSize = avSize;
+ mvAxis = cVector3f(0,1,0);
+
+ mColor = cColor(1,1,1,1);
+ mfForwardOffset =0;
+ mfHaloAlpha = 1.0f;
+
+ mType = eBillboardType_Point;
+
+ mpMaterial = NULL;
+
+ mlLastRenderCount = -1;
+
+ mpVtxBuffer = mpLowLevelGraphics->CreateVertexBuffer(
+ eVertexFlag_Position | eVertexFlag_Color0 | eVertexFlag_Texture0 |
+ eVertexFlag_Normal,
+ eVertexBufferDrawType_Tri, eVertexBufferUsageType_Dynamic,4,6);
+
+
+
+ cVector3f vCoords[4] = {cVector3f((mvSize.x/2),-(mvSize.y/2),0),
+ cVector3f(-(mvSize.x/2),-(mvSize.y/2),0),
+ cVector3f(-(mvSize.x/2),(mvSize.y/2),0),
+ cVector3f((mvSize.x/2),(mvSize.y/2),0)};
+
+ cVector3f vTexCoords[4] = {cVector3f(1,-1,0),
+ cVector3f(-1,-1,0),
+ cVector3f(-1,1,0),
+ cVector3f(1,1,0)};
+ for(int i=0;i<4;i++)
+ {
+ mpVtxBuffer->AddVertex(eVertexFlag_Position, vCoords[i]);
+ mpVtxBuffer->AddColor(eVertexFlag_Color0, cColor(1,1,1,1));
+ mpVtxBuffer->AddVertex(eVertexFlag_Texture0, (vTexCoords[i] + cVector2f(1,1))/2 );
+ mpVtxBuffer->AddVertex(eVertexFlag_Normal,cVector3f(0,0,1));
+ }
+
+ for(int i=0;i<3;i++) mpVtxBuffer->AddIndex(i);
+ for(int i=2;i<5;i++) mpVtxBuffer->AddIndex(i==4?0:i);
+
+ mpVtxBuffer->Compile(eVertexCompileFlag_CreateTangents);
+
+ mbIsHalo = false;
+ mbHaloSourceIsParent = false;
+ mvHaloSourceSize = 1;
+
+
+ mBoundingVolume.SetSize(cVector3f(mvSize.x, mvSize.y, mvSize.x));
+ }
+
+ //-----------------------------------------------------------------------
+
+ cBillboard::~cBillboard()
+ {
+ if(mpMaterial) mpMaterialManager->Destroy(mpMaterial);
+ if(mpVtxBuffer) hplDelete(mpVtxBuffer);
+ if(mpHaloSourceBuffer) hplDelete(mpHaloSourceBuffer);
+
+ if(mQueryObject.mpQuery)
+ mpLowLevelGraphics->DestroyOcclusionQuery(mQueryObject.mpQuery);
+ if(mMaxQueryObject.mpQuery)
+ mpLowLevelGraphics->DestroyOcclusionQuery(mMaxQueryObject.mpQuery);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::SetSize(const cVector2f& avSize)
+ {
+ mvSize = avSize;
+ mBoundingVolume.SetSize(cVector3f(mvSize.x, mvSize.y, mvSize.x));
+
+ float *pPos = mpVtxBuffer->GetArray(eVertexFlag_Position);
+
+ cVector3f vCoords[4] = {cVector3f((mvSize.x/2),-(mvSize.y/2),0),
+ cVector3f(-(mvSize.x/2),-(mvSize.y/2),0),
+ cVector3f(-(mvSize.x/2),(mvSize.y/2),0),
+ cVector3f((mvSize.x/2),(mvSize.y/2),0)};
+
+ for(int i=0; i<4;++i)
+ {
+ pPos[0] = vCoords[i].x;
+ pPos[1] = vCoords[i].y;
+ pPos[2] = vCoords[i].z;
+ pPos+=4;
+ }
+
+ mpVtxBuffer->UpdateData(eVertexFlag_Position,false);
+
+ if(mType == eBillboardType_Axis) SetAxis(mvAxis);
+
+ SetTransformUpdated();
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::SetType(eBillboardType aType)
+ {
+ mType = aType;
+
+ SetAxis(mvAxis);
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::SetAxis(const cVector3f& avAxis)
+ {
+ mvAxis = avAxis;
+ mvAxis.Normalise();
+
+ //This is a quick fix so the bounding box is correct for non up-pointing axises
+ if(mType == eBillboardType_Axis && mvAxis != cVector3f(0,1,0))
+ {
+ float fMax = mvSize.x;
+ if(fMax < mvSize.y) fMax = mvSize.y;
+
+ fMax *= kSqrt2f;
+
+ mBoundingVolume.SetSize(fMax);
+
+ SetTransformUpdated();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::SetColor(const cColor &aColor)
+ {
+ if(mColor == aColor) return;
+
+ mColor = aColor;
+
+ float *pColors = mpVtxBuffer->GetArray(eVertexFlag_Color0);
+
+ for(int i=0; i<4;++i)
+ {
+ pColors[0] = mColor.r * mfHaloAlpha;
+ pColors[1] = mColor.g * mfHaloAlpha;
+ pColors[2] = mColor.b * mfHaloAlpha;
+ pColors[3] = mColor.a * mfHaloAlpha;
+ pColors+=4;
+ }
+
+ mpVtxBuffer->UpdateData(eVertexFlag_Color0,false);
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::SetHaloAlpha(float afX)
+ {
+ if(mfHaloAlpha == afX)
+ {
+ return;
+ }
+
+ mfHaloAlpha = afX;
+
+ float *pColors = mpVtxBuffer->GetArray(eVertexFlag_Color0);
+
+ for(int i=0; i<4;++i)
+ {
+ pColors[0] = mColor.r * mfHaloAlpha;
+ pColors[1] = mColor.g * mfHaloAlpha;
+ pColors[2] = mColor.b * mfHaloAlpha;
+ pColors[3] = mColor.a * mfHaloAlpha;
+ pColors+=4;
+ }
+
+ mpVtxBuffer->UpdateData(eVertexFlag_Color0,false);
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::SetForwardOffset(float afOffset)
+ {
+ mfForwardOffset = afOffset;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::SetMaterial(iMaterial * apMaterial)
+ {
+ mpMaterial = apMaterial;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cBoundingVolume* cBillboard::GetBoundingVolume()
+ {
+ return &mBoundingVolume;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::UpdateGraphics(cCamera3D *apCamera,float afFrameTime, cRenderList *apRenderList)
+ {
+ if(mbIsHalo==false) return;
+
+ ////////////////////////
+ //Set the alpha
+ float fAlpha = 0;
+
+ if(mlLastRenderCount == apRenderList->GetLastRenderCount())
+ {
+ if(mMaxQueryObject.mpQuery->GetSampleCount()>0)
+ {
+ fAlpha = (float)mQueryObject.mpQuery->GetSampleCount() /
+ (float)mMaxQueryObject.mpQuery->GetSampleCount();
+ }
+ }
+ SetHaloAlpha(fAlpha);
+ mlLastRenderCount = apRenderList->GetRenderCount();
+
+ ////////////////////////
+ //Add the queries
+ if(mbHaloSourceIsParent)
+ {
+ iRenderable *pParent = static_cast<iRenderable*>(GetEntityParent());
+ if(pParent==NULL)
+ {
+ Error("Billboard %s has no parent!\n",msName.c_str());
+ return;
+ }
+
+ iVertexBuffer *pVtxBuffer = pParent->GetVertexBuffer();
+ if(pVtxBuffer==NULL)
+ {
+ Error("Billboard '%s' parent '%s' as NULL vertex buffer!\n",msName.c_str(),
+ pParent->GetName().c_str());
+ return;
+ }
+
+ mQueryObject.mpMatrix = pParent->GetModelMatrix(apCamera);
+ mQueryObject.mpVtxBuffer = pVtxBuffer;
+
+ mMaxQueryObject.mpMatrix = pParent->GetModelMatrix(apCamera);
+ mMaxQueryObject.mpVtxBuffer = pVtxBuffer;
+ }
+ else
+ {
+ mQueryObject.mpMatrix = &GetWorldMatrix();
+ mQueryObject.mpVtxBuffer = mpHaloSourceBuffer;
+
+ mMaxQueryObject.mpMatrix = &GetWorldMatrix();
+ mMaxQueryObject.mpVtxBuffer = mpHaloSourceBuffer;
+ }
+
+ mQueryObject.mbDepthTest = true;
+ mMaxQueryObject.mbDepthTest = false;
+
+ apRenderList->AddOcclusionQuery(&mQueryObject);
+ apRenderList->AddOcclusionQuery(&mMaxQueryObject);
+
+ }
+
+ //-----------------------------------------------------------------------
+
+ cMatrixf* cBillboard::GetModelMatrix(cCamera3D *apCamera)
+ {
+ if(apCamera==NULL)return &GetWorldMatrix();
+
+ m_mtxTempTransform = GetWorldMatrix();
+ cVector3f vForward, vRight, vUp;
+
+ cVector3f vCameraForward = apCamera->GetPosition() - GetWorldPosition();
+ vCameraForward.Normalise();
+
+ if(mType == eBillboardType_Point)
+ {
+ vForward = vCameraForward;
+ vRight = cMath::Vector3Cross(apCamera->GetViewMatrix().GetUp(), vForward);
+ vUp = cMath::Vector3Cross(vForward,vRight);
+ }
+ else if(mType == eBillboardType_Axis)
+ {
+ vUp = cMath::MatrixMul(GetWorldMatrix().GetRotation(),mvAxis);
+ vUp.Normalise();
+
+ if(vUp == vForward)
+ {
+ vRight = cMath::Vector3Cross(vUp, vCameraForward);
+ Warning("Billboard Right vector is not correct! Contact programmer!\n");
+ }
+ else
+ vRight = cMath::Vector3Cross(vUp, vCameraForward);
+
+ vRight.Normalise();
+ vForward = cMath::Vector3Cross(vRight, vUp);
+
+ //vForward.Normalise();
+ //vUp.Normalise();
+ }
+
+ if(mfForwardOffset!=0)
+ {
+ cVector3f vPos = m_mtxTempTransform.GetTranslation();
+ vPos += vCameraForward * mfForwardOffset;
+ m_mtxTempTransform.SetTranslation(vPos);
+ }
+
+ //Set right vector
+ m_mtxTempTransform.m[0][0] = vRight.x;
+ m_mtxTempTransform.m[1][0] = vRight.y;
+ m_mtxTempTransform.m[2][0] = vRight.z;
+
+ //Set up vector
+ m_mtxTempTransform.m[0][1] = vUp.x;
+ m_mtxTempTransform.m[1][1] = vUp.y;
+ m_mtxTempTransform.m[2][1] = vUp.z;
+
+ //Set forward vector
+ m_mtxTempTransform.m[0][2] = vForward.x;
+ m_mtxTempTransform.m[1][2] = vForward.y;
+ m_mtxTempTransform.m[2][2] = vForward.z;
+
+ return &m_mtxTempTransform;
+ }
+
+ //-----------------------------------------------------------------------
+
+ int cBillboard::GetMatrixUpdateCount()
+ {
+ return GetTransformUpdateCount();
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ void cBillboard::LoadXMLProperties(const tString asFile)
+ {
+ tString sNewFile = cString::SetFileExt(asFile,"bnt");
+ tString sPath = mpFileSearcher->GetFilePath(sNewFile);
+ if(sPath != "")
+ {
+ TiXmlDocument *pDoc = hplNew( TiXmlDocument, (sPath.c_str()) );
+ if(pDoc->LoadFile())
+ {
+ TiXmlElement *pRootElem = pDoc->RootElement();
+
+ TiXmlElement *pMainElem = pRootElem->FirstChildElement("MAIN");
+ if(pMainElem!=NULL)
+ {
+ mType = ToType(pMainElem->Attribute("Type"));
+ tString sMaterial = cString::ToString(pMainElem->Attribute("Material"),"");
+ bool bUsesOffset = cString::ToBool(pMainElem->Attribute("UseOffset"),false);
+ if(bUsesOffset==false) mfForwardOffset =0;
+
+ /////////////////
+ //Halo stuff
+ bool bIsHalo = cString::ToBool(pMainElem->Attribute("IsHalo"),false);
+ SetIsHalo(bIsHalo);
+
+ if(bIsHalo)
+ {
+ bool bHaloSourceIsParent = cString::ToBool(pMainElem->Attribute("HaloSourceIsParent"),false);
+ SetHaloSourceIsParent(bHaloSourceIsParent);
+
+ if(bHaloSourceIsParent == false)
+ {
+ tString sSizeVec = cString::ToString(pMainElem->Attribute("HaloSourceSize"),"1 1 1");
+ tFloatVec vSizeValues;
+ cString::GetFloatVec(sSizeVec,vSizeValues,NULL);
+ SetHaloSourceSize(cVector3f(vSizeValues[0],vSizeValues[1],vSizeValues[2]));
+ }
+ }
+
+ /////////////////
+ //Load material
+ iMaterial *pMat = mpMaterialManager->CreateMaterial(sMaterial);
+ if(pMat)
+ {
+ SetMaterial(pMat);
+ }
+ else
+ {
+ Error("Couldn't load material '%s' in billboard file '%s'",
+ sMaterial.c_str(), sNewFile.c_str());
+ }
+ }
+ else
+ {
+ Error("Cannot find main element in %s\n",sNewFile.c_str());
+ }
+ }
+ else
+ {
+ Error("Couldn't load file '%s'\n",sNewFile.c_str());
+ }
+ hplDelete(pDoc);
+ }
+ else
+ {
+ Error("Couldn't find file '%s'\n",sNewFile.c_str());
+ }
+
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cBillboard::IsVisible()
+ {
+ if(mColor.r <= 0 && mColor.g <= 0 && mColor.b <= 0) return false;
+
+ return IsRendered();
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::SetIsHalo(bool abX)
+ {
+ mbIsHalo = abX;
+
+ if(mbIsHalo)
+ {
+ mQueryObject.mpQuery = mpLowLevelGraphics->CreateOcclusionQuery();
+ mMaxQueryObject.mpQuery = mpLowLevelGraphics->CreateOcclusionQuery();
+
+ mfHaloAlpha = 1; //THis is to make sure that the new alpha is set to the mesh.
+ SetHaloAlpha(0);
+ }
+ else if(mQueryObject.mpQuery)
+ {
+ mpLowLevelGraphics->DestroyOcclusionQuery(mQueryObject.mpQuery);
+ mpLowLevelGraphics->DestroyOcclusionQuery(mMaxQueryObject.mpQuery);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::SetHaloSourceSize(const cVector3f &avSize)
+ {
+ mvHaloSourceSize = avSize;
+
+ UpdateSourceBufferSize();
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::SetHaloSourceIsParent(bool abX)
+ {
+ mbHaloSourceIsParent = abX;
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // PRIVATE METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ eBillboardType cBillboard::ToType(const char* apString)
+ {
+ if(apString==NULL) return eBillboardType_Point;
+
+ tString sType = cString::ToLowerCase(apString);
+
+ if(sType == "point") return eBillboardType_Point;
+ else if(sType == "axis") return eBillboardType_Axis;
+
+ Warning("Invalid billboard type '%s'\n",apString);
+
+ return eBillboardType_Point;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::UpdateSourceBufferSize()
+ {
+ int lNum = mpHaloSourceBuffer->GetVertexNum();
+ float *pPositions = mpHaloSourceBuffer->GetArray(eVertexFlag_Position);
+
+ for(int i=0; i<lNum;++i)
+ {
+ //X
+ if(pPositions[0] < 0)
+ pPositions[0] = -mvHaloSourceSize.x*0.5f;
+ else
+ pPositions[0] = mvHaloSourceSize.x*0.5f;
+ //Y
+ if(pPositions[1] < 0)
+ pPositions[1] = -mvHaloSourceSize.y*0.5f;
+ else
+ pPositions[1] = mvHaloSourceSize.y*0.5f;
+ //Z
+ if(pPositions[2] < 0)
+ pPositions[2] = -mvHaloSourceSize.z*0.5f;
+ else
+ pPositions[2] = mvHaloSourceSize.z*0.5f;
+
+ pPositions += 4;
+ }
+
+ mpHaloSourceBuffer->UpdateData(eVertexFlag_Position, false);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // SAVE OBJECT STUFF
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ kBeginSerialize(cSaveData_cBillboard,cSaveData_iRenderable)
+ kSerializeVar(msMaterial,eSerializeType_String)
+
+ kSerializeVar(mType,eSerializeType_Int32)
+ kSerializeVar(mvSize,eSerializeType_Vector3f)
+ kSerializeVar(mvAxis,eSerializeType_Vector3f)
+ kSerializeVar(mfForwardOffset,eSerializeType_Float32)
+ kSerializeVar(mColor,eSerializeType_Color)
+ kSerializeVar(mfHaloAlpha, eSerializeType_Float32)
+
+ kSerializeVar(mbIsHalo, eSerializeType_Bool)
+ kSerializeVar(mvHaloSourceSize, eSerializeType_Vector3f)
+ kSerializeVar(mbHaloSourceIsParent, eSerializeType_Bool)
+ kEndSerialize()
+
+ //-----------------------------------------------------------------------
+
+ iSaveObject* cSaveData_cBillboard::CreateSaveObject(cSaveObjectHandler *apSaveObjectHandler,cGame *apGame)
+ {
+ cWorld3D *pWorld = apGame->GetScene()->GetWorld3D();
+
+ cBillboard *pBill = pWorld->CreateBillboard(msName,mvSize,msMaterial);
+
+ return pBill;
+ }
+
+ //-----------------------------------------------------------------------
+
+ int cSaveData_cBillboard::GetSaveCreatePrio()
+ {
+ return 3;
+ }
+
+ //-----------------------------------------------------------------------
+
+ iSaveData* cBillboard::CreateSaveData()
+ {
+ return hplNew( cSaveData_cBillboard, () );
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::SaveToSaveData(iSaveData *apSaveData)
+ {
+ kSaveData_SaveToBegin(cBillboard);
+
+ pData->msMaterial = mpMaterial==NULL ? "" : mpMaterial->GetName();
+
+ kSaveData_SaveTo(mType);
+ kSaveData_SaveTo(mvSize);
+ kSaveData_SaveTo(mvAxis);
+ kSaveData_SaveTo(mfForwardOffset);
+ kSaveData_SaveTo(mColor);
+ kSaveData_SaveTo(mfHaloAlpha);
+
+ kSaveData_SaveTo(mbIsHalo);
+ kSaveData_SaveTo(mvHaloSourceSize);
+ kSaveData_SaveTo(mbHaloSourceIsParent);
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::LoadFromSaveData(iSaveData *apSaveData)
+ {
+ kSaveData_LoadFromBegin(cBillboard);
+
+ mType = (eBillboardType) pData->mType;
+ kSaveData_LoadFrom(mvSize);
+ kSaveData_LoadFrom(mvAxis);
+ kSaveData_LoadFrom(mfForwardOffset);
+ kSaveData_LoadFrom(mColor);
+ kSaveData_LoadFrom(mfHaloAlpha);
+
+ SetIsHalo(pData->mbIsHalo);
+ SetHaloSourceSize(pData->mvHaloSourceSize);
+ SetHaloSourceIsParent(pData->mbHaloSourceIsParent);
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBillboard::SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame)
+ {
+ kSaveData_SetupBegin(cBillboard);
+
+ if(mbIsHalo)
+ {
+ //Log("Setting up halo billboard '%s'\n",msName.c_str());
+ }
+ }
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/graphics/BillBoard.h b/engines/hpl1/engine/graphics/BillBoard.h
new file mode 100644
index 00000000000..925f4289387
--- /dev/null
+++ b/engines/hpl1/engine/graphics/BillBoard.h
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_BILLBOARD_H
+#define HPL_BILLBOARD_H
+
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/graphics/GraphicsTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/scene/Entity3D.h"
+#include "hpl1/engine/graphics/Renderable.h"
+#include "RenderList.h"
+
+namespace hpl {
+
+ enum eBillboardType
+ {
+ eBillboardType_Point,
+ eBillboardType_Axis,
+ eBillboardType_LastEnum
+ };
+
+ class cMaterialManager;
+ class cResources;
+ class cGraphics;
+ class cMeshCreator;
+ class cFileSearcher;
+ class iLowLevelGraphics;
+ class iMaterial;
+ class iVertexBuffer;
+ class iOcclusionQuery;
+
+ //------------------------------------------
+
+ kSaveData_ChildClass(iRenderable,cBillboard)
+ {
+ kSaveData_ClassInit(cBillboard)
+ public:
+ tString msMaterial;
+
+ int mType;
+ cVector2f mvSize;
+ cVector3f mvAxis;
+ float mfForwardOffset;
+ cColor mColor;
+ float mfHaloAlpha;
+
+ bool mbIsHalo;
+ cVector3f mvHaloSourceSize;
+ bool mbHaloSourceIsParent;
+
+ virtual iSaveObject* CreateSaveObject(cSaveObjectHandler *apSaveObjectHandler,cGame *apGame);
+ virtual int GetSaveCreatePrio();
+ };
+
+ //------------------------------------------
+
+ class cBillboard : public iRenderable
+ {
+ typedef iRenderable super;
+ public:
+ cBillboard(const tString asName,const cVector2f& avSize, cResources *apResources,
+ cGraphics *apGraphics);
+ ~cBillboard();
+
+ void SetMaterial(iMaterial * apMaterial);
+
+ void SetSize(const cVector2f& avSize);
+ cVector2f GetSize(){ return mvSize;}
+
+ void SetType(eBillboardType aType);
+ eBillboardType GetType(){ return mType;}
+
+ void SetAxis(const cVector3f& avAxis);
+ cVector3f GetAxis(){ return mvAxis;}
+
+ void SetForwardOffset(float afOffset);
+ float GetForwardOffset(){ return mfForwardOffset;}
+
+ void SetColor(const cColor &aColor);
+ const cColor& GetColor(){ return mColor;}
+
+ void SetHaloAlpha(float afX);
+ float GetHaloAlpha(){ return mfHaloAlpha;}
+
+ void LoadXMLProperties(const tString asFile);
+
+ /////////////////////////////////
+ //Halo stuff
+ void SetIsHalo(bool abX);
+ bool IsHalo(){ return mbIsHalo;}
+
+ void SetHaloSourceSize(const cVector3f &avSize);
+ cVector3f GetHaloSourceSize(){return mvHaloSourceSize;}
+
+ void SetHaloSourceIsParent(bool abX);
+ bool GetHaloSourceIsParent(){ return mbHaloSourceIsParent;}
+
+ iOcclusionQuery* GetQuery(){ return mQueryObject.mpQuery;}
+ iOcclusionQuery* GetMaxQuery(){ return mMaxQueryObject.mpQuery;}
+
+ /////////////////////////////////
+ //Entity implementation
+ tString GetEntityType(){ return "Billboard";}
+
+ bool IsVisible();
+ void SetVisible(bool abVisible){ SetRendered(abVisible); }
+
+ //Renderable implementations
+ iMaterial *GetMaterial(){ return mpMaterial;}
+ iVertexBuffer* GetVertexBuffer(){return mpVtxBuffer;}
+
+ void UpdateGraphics(cCamera3D *apCamera,float afFrameTime, cRenderList *apRenderList);
+
+ bool IsShadowCaster(){ return false;}
+
+ cBoundingVolume* GetBoundingVolume();
+
+ cMatrixf* GetModelMatrix(cCamera3D *apCamera);
+
+ int GetMatrixUpdateCount();
+
+ eRenderableType GetRenderType(){ return eRenderableType_ParticleSystem;}
+
+ //SaveObject implementation
+ virtual iSaveData* CreateSaveData();
+ virtual void SaveToSaveData(iSaveData *apSaveData);
+ virtual void LoadFromSaveData(iSaveData *apSaveData);
+ virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame);
+
+ private:
+ eBillboardType ToType(const char* apString);
+
+ void UpdateSourceBufferSize();
+
+ cMaterialManager* mpMaterialManager;
+ cFileSearcher *mpFileSearcher;
+ iLowLevelGraphics* mpLowLevelGraphics;
+ cMeshCreator *mpMeshCreator;
+
+ iMaterial *mpMaterial;
+ iVertexBuffer* mpVtxBuffer;
+
+ iVertexBuffer* mpHaloSourceBuffer;
+
+ cMatrixf m_mtxTempTransform;
+
+ eBillboardType mType;
+ cVector2f mvSize;
+ cVector3f mvAxis;
+
+ int mlLastRenderCount;
+
+ bool mbIsHalo;
+ cVector3f mvHaloSourceSize;
+ bool mbHaloSourceIsParent;
+ cOcclusionQueryObject mQueryObject;
+ cOcclusionQueryObject mMaxQueryObject;
+
+ float mfForwardOffset;
+ cColor mColor;
+ float mfHaloAlpha;
+ };
+
+};
+#endif // HPL_BILLBOARD_H
diff --git a/engines/hpl1/engine/graphics/Bitmap2D.h b/engines/hpl1/engine/graphics/Bitmap2D.h
new file mode 100644
index 00000000000..07975afbf85
--- /dev/null
+++ b/engines/hpl1/engine/graphics/Bitmap2D.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_BITMAP2D_H
+#define HPL_BITMAP2D_H
+
+#include "hpl1/engine/graphics/LowLevelPicture.h"
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/graphics/GraphicsTypes.h"
+
+
+namespace hpl {
+
+ class iPixelFormat;
+
+ class iBitmap2D : public iLowLevelPicture
+ {
+ public:
+ iBitmap2D(tString asType,iPixelFormat *apPxlFmt) : iLowLevelPicture(asType){}
+ virtual ~iBitmap2D() {}
+
+ /**
+ * Save the bitmap to file
+ * \param asFile
+ * \return
+ */
+ virtual bool SaveToFile(const tString& asFile)=0;
+
+ /**
+ * Draw the bitmap onto another
+ * \param *apBmp Destination
+ * \param &avPos Position on new map
+ */
+ virtual void DrawToBitmap(iBitmap2D *apBmp, const cVector2l &avPos)=0;
+ /**
+ * Creates a new size for the bitmap. (all previous content is erased
+ * \param avSize
+ * \param alBpp
+ * \return
+ */
+ virtual bool Create(cVector2l avSize, unsigned int alBpp)=0;
+
+ /**
+ * Draws a solid rect onto the bitmap. IF h and w is than w and how of the bitmap is used.
+ * \param &aRect
+ * \param &aColor
+ */
+ virtual void FillRect(const cRect2l &aRect, const cColor &aColor)=0;
+
+ /**
+ * Get a pointer to the raw pixel data.
+ */
+ virtual void* GetRawData()=0;
+
+ /**
+ * Get the number of color channels in the image.
+ * \return
+ */
+ virtual int GetNumChannels()=0;
+ };
+
+ typedef std::vector<iBitmap2D*> tBitmap2DVec;
+ typedef std::vector<iBitmap2D*>::iterator tBitmap2DVecIt;
+
+};
+#endif // HPL_BITMAP2D_H
diff --git a/engines/hpl1/engine/graphics/Bone.cpp b/engines/hpl1/engine/graphics/Bone.cpp
new file mode 100644
index 00000000000..54c28b2fdc0
--- /dev/null
+++ b/engines/hpl1/engine/graphics/Bone.cpp
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/graphics/Bone.h"
+
+#include "hpl1/engine/graphics/Skeleton.h"
+#include "hpl1/engine/math/Math.h"
+
+#include "hpl1/engine/system/LowLevelSystem.h"
+
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cBone::cBone(const tString &asName, cSkeleton* apSkeleton)
+ {
+ msName = asName;
+ mpSkeleton = apSkeleton;
+ mpParent = NULL;
+
+ mbNeedsUpdate = true;
+
+ mlValue = 0;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cBone::~cBone()
+ {
+ STLDeleteAll(mlstChildren);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cBone* cBone::CreateChildBone(const tString &asName)
+ {
+ cBone *pBone = hplNew(cBone,(asName, mpSkeleton) );
+ pBone->mpParent = this;
+
+ mlstChildren.push_back(pBone);
+ mpSkeleton->AddBone(pBone);
+
+ return pBone;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBone::SetTransform(const cMatrixf &a_mtxTransform)
+ {
+ m_mtxTransform = a_mtxTransform;
+
+ NeedsUpdate();
+ }
+
+ //-----------------------------------------------------------------------
+
+ const cMatrixf& cBone::GetLocalTransform()
+ {
+ return m_mtxTransform;
+ }
+
+ const cMatrixf& cBone::GetWorldTransform()
+ {
+ UpdateMatrix();
+
+ return m_mtxWorldTransform;
+ }
+
+ const cMatrixf& cBone::GetInvWorldTransform()
+ {
+ UpdateMatrix();
+
+ return m_mtxInvWorldTransform;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBone::Detach()
+ {
+ if(mpParent == NULL) return;
+
+ tBoneListIt it = mpParent->mlstChildren.begin();
+ for(;it != mpParent->mlstChildren.end(); it++)
+ {
+ if(*it == this)
+ {
+ mpParent->mlstChildren.erase(it);
+ break;
+ }
+ }
+
+ mpSkeleton->RemoveBone(this);
+ }
+
+ //-----------------------------------------------------------------------
+
+ cBoneIterator cBone::GetChildIterator()
+ {
+ return cBoneIterator(&mlstChildren);
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBone::UpdateMatrix()
+ {
+ if(mbNeedsUpdate == false) return;
+
+ if(mpParent==NULL)
+ {
+ m_mtxWorldTransform = m_mtxTransform;
+ }
+ else
+ {
+ m_mtxWorldTransform = cMath::MatrixMul(mpParent->GetWorldTransform(),m_mtxTransform);
+ }
+
+ m_mtxInvWorldTransform = cMath::MatrixInverse(m_mtxWorldTransform);
+
+ mbNeedsUpdate = false;
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PRIVATE METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cBone::NeedsUpdate()
+ {
+ mbNeedsUpdate = true;
+
+ tBoneListIt it = mlstChildren.begin();
+ for(;it != mlstChildren.end(); it++)
+ {
+ cBone* pBone = *it;
+
+ pBone->NeedsUpdate();
+ }
+ }
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/graphics/Bone.h b/engines/hpl1/engine/graphics/Bone.h
new file mode 100644
index 00000000000..bd50446e5d2
--- /dev/null
+++ b/engines/hpl1/engine/graphics/Bone.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_BONE_H
+#define HPL_BONE_H
+
+#include <map>
+
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/graphics/GraphicsTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
+
+namespace hpl {
+
+ class cSkeleton;
+ class cBone;
+
+ typedef std::list<cBone*> tBoneList;
+ typedef tBoneList::iterator tBoneListIt;
+
+ typedef cSTLIterator<cBone*,tBoneList,tBoneListIt> cBoneIterator;
+
+ class cBone
+ {
+ friend class cSkeleton;
+ public:
+ cBone(const tString &asName, cSkeleton* apSkeleton);
+ ~cBone();
+
+ cBone* CreateChildBone(const tString &asName);
+
+ void SetTransform(const cMatrixf &a_mtxTransform);
+ const cMatrixf& GetLocalTransform();
+ const cMatrixf& GetWorldTransform();
+ const cMatrixf& GetInvWorldTransform();
+
+ const tString& GetName(){ return msName;}
+
+ cBoneIterator GetChildIterator();
+
+ void Detach();
+
+ cBone* GetParent(){ return mpParent;}
+
+ //Needed for some loading stuff..
+ int GetValue(){ return mlValue;}
+ void SetValue(int alVal){ mlValue = alVal;}
+
+ private:
+ void NeedsUpdate();
+
+ void UpdateMatrix();
+
+ tString msName;
+
+ cMatrixf m_mtxTransform;
+
+ cMatrixf m_mtxWorldTransform;
+ cMatrixf m_mtxInvWorldTransform;
+
+ cBone* mpParent;
+ tBoneList mlstChildren;
+
+ cSkeleton* mpSkeleton;
+
+ bool mbNeedsUpdate;
+
+ int mlValue;
+ };
+
+};
+#endif // HPL_BONE_H
diff --git a/engines/hpl1/engine/graphics/BoneState.cpp b/engines/hpl1/engine/graphics/BoneState.cpp
new file mode 100644
index 00000000000..d9985b02746
--- /dev/null
+++ b/engines/hpl1/engine/graphics/BoneState.cpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/graphics/BoneState.h"
+
+#include "hpl1/engine/physics/PhysicsBody.h"
+
+#include "hpl1/engine/math/Math.h"
+
+#include "hpl1/engine/system/LowLevelSystem.h"
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cBoneState::cBoneState(const tString &asName,bool abAutoDeleteChildren) : cNode3D(asName,abAutoDeleteChildren)
+ {
+ mpBody = NULL;
+ mpColliderBody = NULL;
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cBoneState::SetBody(iPhysicsBody *apBody)
+ {
+ mpBody = apBody;
+ }
+ iPhysicsBody* cBoneState::GetBody()
+ {
+ return mpBody;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBoneState::SetColliderBody(iPhysicsBody *apBody)
+ {
+ mpColliderBody = apBody;
+ }
+ iPhysicsBody* cBoneState::GetColliderBody()
+ {
+ return mpColliderBody;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void cBoneState::SetBodyMatrix(const cMatrixf &a_mtxBody)
+ {
+ m_mtxBody = a_mtxBody;
+ m_mtxInvBody = cMath::MatrixInverse(m_mtxBody);
+ }
+
+ const cMatrixf& cBoneState::GetBodyMatrix()
+ {
+ return m_mtxBody;
+ }
+
+ const cMatrixf& cBoneState::GetInvBodyMatrix()
+ {
+ return m_mtxInvBody;
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // PRIVATE METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+
+ //-----------------------------------------------------------------------
+
+
+}
diff --git a/engines/hpl1/engine/graphics/BoneState.h b/engines/hpl1/engine/graphics/BoneState.h
new file mode 100644
index 00000000000..81bbb6ec72f
--- /dev/null
+++ b/engines/hpl1/engine/graphics/BoneState.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_BONE_STATE_H
+#define HPL_BONE_STATE_H
+
+#include "hpl1/engine/scene/Node3D.h"
+
+namespace hpl {
+
+ class iPhysicsBody;
+
+ class cBoneState : public cNode3D
+ {
+ public:
+ cBoneState(const tString &asName, bool abAutoDeleteChildren);
+
+ void SetBody(iPhysicsBody *apBody);
+ iPhysicsBody* GetBody();
+
+ void SetColliderBody(iPhysicsBody *apBody);
+ iPhysicsBody* GetColliderBody();
+
+ void SetBodyMatrix(const cMatrixf &a_mtxBody);
+ const cMatrixf& GetBodyMatrix();
+ const cMatrixf& GetInvBodyMatrix();
+
+ private:
+ iPhysicsBody *mpBody;
+ cMatrixf m_mtxBody;
+ cMatrixf m_mtxInvBody;
+
+ iPhysicsBody *mpColliderBody;
+ };
+
+};
+#endif // HPL_BONE_STATE_H
diff --git a/engines/hpl1/engine/graphics/Color.cpp b/engines/hpl1/engine/graphics/Color.cpp
new file mode 100644
index 00000000000..087513f5a0a
--- /dev/null
+++ b/engines/hpl1/engine/graphics/Color.cpp
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/graphics/Color.h"
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cColor::cColor(float afR, float afG, float afB, float afA)
+ {
+ r = afR; g = afG; b = afB; a = afA;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cColor::cColor(float afR, float afG, float afB)
+ {
+ r = afR; g = afG; b = afB; a = 1;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cColor::cColor()
+ {
+ r = 0; g = 0; b = 0; a = 1;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cColor::cColor(float afVal)
+ {
+ r = afVal; g = afVal; b = afVal; a = 1;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cColor::cColor(float afVal, float afA)
+ {
+ r = afVal; g = afVal; b = afVal; a = afA;
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void cColor::FromVec(float *apV)
+ {
+ r = apV[0];
+ g = apV[1];
+ b = apV[2];
+ a = apV[3];
+ }
+
+ //-----------------------------------------------------------------------
+
+ cColor cColor::operator*(float afVal) const
+ {
+ cColor col;
+ col.r = r * afVal;
+ col.g = g * afVal;
+ col.b = b * afVal;
+ col.a = a * afVal;
+ return col;
+ }
+
+ cColor cColor::operator/(float afVal) const
+ {
+ cColor col;
+ col.r = r / afVal;
+ col.g = g / afVal;
+ col.b = b / afVal;
+ col.a = a / afVal;
+ return col;
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ cColor cColor::operator+(const cColor &aCol) const
+ {
+ return cColor(
+ r + aCol.r,
+ g + aCol.g,
+ b + aCol.b,
+ a + aCol.a
+ );
+ }
+
+ cColor cColor::operator-(const cColor &aCol) const
+ {
+ return cColor(
+ r - aCol.r,
+ g - aCol.g,
+ b - aCol.b,
+ a - aCol.a
+ );
+ }
+
+ cColor cColor::operator*(const cColor &aCol) const
+ {
+ return cColor(
+ r * aCol.r,
+ g * aCol.g,
+ b * aCol.b,
+ a * aCol.a
+ );
+ }
+
+ cColor cColor::operator/(const cColor &aCol) const
+ {
+ return cColor(
+ r / aCol.r,
+ g / aCol.g,
+ b / aCol.b,
+ a / aCol.a
+ );
+ }
+
+ //-----------------------------------------------------------------------
+
+ bool cColor::operator==(cColor aCol) const
+ {
+ if(r == aCol.r && g == aCol.g && b == aCol.b && a == aCol.a)
+ return true;
+ else
+ return false;
+ }
+
+ //-----------------------------------------------------------------------
+
+ tString cColor::ToString() const
+ {
+ char buf[512];
+ sprintf(buf,"%f : %f : %f : %f",r,g,b,a);
+ tString str = buf;
+ return str;
+ }
+
+
+ //-----------------------------------------------------------------------
+
+ tString cColor::ToFileString() const
+ {
+ char buf[512];
+ sprintf(buf,"%g %g %g %g",r,g,b,a);
+ tString str = buf;
+ return str;
+ }
+
+
+ //-----------------------------------------------------------------------
+}
diff --git a/engines/hpl1/engine/graphics/Color.h b/engines/hpl1/engine/graphics/Color.h
new file mode 100644
index 00000000000..925670fbf57
--- /dev/null
+++ b/engines/hpl1/engine/graphics/Color.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_COLOR_H
+#define HPL_COLOR_H
+
+#include <list>
+#include <vector>
+
+#include "hpl1/engine/system/SystemTypes.h"
+
+namespace hpl {
+
+ class cColor
+ {
+ public:
+ float r,g,b,a;
+
+ cColor(float afR, float afG, float afB, float afA);
+ cColor(float afR, float afG, float afB);
+ cColor();
+ cColor(float afVal);
+ cColor(float afVal, float afA);
+
+ cColor operator*(float afVal) const;
+ cColor operator/(float afVal) const;
+
+ cColor operator+(const cColor &aCol) const;
+ cColor operator-(const cColor &aCol) const;
+ cColor operator*(const cColor &aCol) const;
+ cColor operator/(const cColor &aCol) const;
+
+ bool operator==(cColor aCol) const;
+
+ tString ToString() const;
+
+ tString ToFileString() const;
+
+ void FromVec(float *apV);
+ };
+
+ typedef std::list<cColor> tColorList;
+ typedef tColorList::iterator tColorListIt;
+
+ typedef std::vector<cColor> tColorVec;
+ typedef tColorVec::iterator tColorVecIt;
+
+};
+#endif // HPL_COLOR_H
diff --git a/engines/hpl1/engine/graphics/FontData.cpp b/engines/hpl1/engine/graphics/FontData.cpp
new file mode 100644
index 00000000000..e8cb4b5a1bb
--- /dev/null
+++ b/engines/hpl1/engine/graphics/FontData.cpp
@@ -0,0 +1,386 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/graphics/FontData.h"
+#include <stdarg.h>
+#include <stdlib.h>
+
+#include "hpl1/engine/system/LowLevelSystem.h"
+
+#include "hpl1/engine/graphics/GraphicsDrawer.h"
+#include "hpl1/engine/graphics/GfxObject.h"
+
+#include "hpl1/engine/resources/ResourceImage.h"
+
+#include "hpl1/engine/gui/GuiGfxElement.h"
+#include "hpl1/engine/gui/Gui.h"
+
+namespace hpl {
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+
+ //-----------------------------------------------------------------------
+
+ cGlyph::cGlyph( cGfxObject *apObject, cGuiGfxElement *apGuiGfx,const cVector2f &avOffset,
+ const cVector2f &avSize, float afAdvance)
+ {
+ mpGfxObject = apObject;
+ mpGuiGfx = apGuiGfx;
+ mvOffset = avOffset;
+ mvSize = avSize;
+ mfAdvance = afAdvance;
+ }
+
+
+
+ cGlyph::~cGlyph()
+ {
+ if(mpGfxObject) hplDelete(mpGfxObject);
+ if(mpGuiGfx) hplDelete(mpGuiGfx);
+
+ }
+
+ //-----------------------------------------------------------------------
+
+ iFontData::iFontData(const tString &asName,iLowLevelGraphics* apLowLevelGraphics)
+ : iResourceBase(asName,0)
+ {
+ mpLowLevelGraphics = apLowLevelGraphics;
+ }
+
+ //-----------------------------------------------------------------------
+
+ iFontData::~iFontData()
+ {
+ for(int i=0;i<(int)mvGlyphs.size();i++)
+ {
+ if(mvGlyphs[i]) hplDelete(mvGlyphs[i]);
+ }
+ }
+
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ void iFontData::Draw(const cVector3f& avPos,const cVector2f& avSize, const cColor& aCol,
+ eFontAlign aAlign, const wchar_t* fmt,...)
+ {
+ wchar_t sText[256];
+ va_list ap;
+ if (fmt == NULL) return;
+ va_start(ap, fmt);
+ vswprintf(sText, 255, fmt, ap);
+ va_end(ap);
+
+
+ int lCount=0;
+ float lXAdd =0;
+ cVector3f vPos = avPos;
+
+ if(aAlign == eFontAlign_Center){
+ vPos.x -= GetLength(avSize, sText)/2;
+ }
+ else if(aAlign == eFontAlign_Right)
+ {
+ vPos.x -= GetLength(avSize, sText);
+ }
+
+ while(sText[lCount] != 0)
+ {
+ wchar_t lGlyphNum = ((wchar_t)sText[lCount]);
+ if(lGlyphNum<mlFirstChar || lGlyphNum>mlLastChar){
+ lCount++;
+ continue;
+ }
+ lGlyphNum -= mlFirstChar;
+
+
+ cGlyph *pGlyph = mvGlyphs[lGlyphNum];
+ if(pGlyph)
+ {
+ cVector2f vOffset(pGlyph->mvOffset * avSize);
+ cVector2f vSize(pGlyph->mvSize * avSize);
+
+ mpGraphicsDrawer->DrawGfxObject(pGlyph->mpGfxObject,vPos + vOffset,vSize,aCol);
+
+ vPos.x += pGlyph->mfAdvance*avSize.x;
+ }
+ lCount++;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ int iFontData::DrawWordWrap(cVector3f avPos,float afLength,float afFontHeight,cVector2f avSize,const cColor& aCol,
+ eFontAlign aAlign, const tWString &asString)
+ {
+ int rows = 0;
+
+ unsigned int pos;
+ unsigned int first_letter=0;
+ unsigned int last_space=0;
+
+ tUIntList RowLengthList;
+
+ float fTextLength;
+
+ for(pos = 0; pos < asString.size();pos++)
+ {
+ if(asString[pos] == _W(' ') || asString[pos] == _W('\n'))
+ {
+ tWString temp = asString.substr(first_letter, pos-first_letter);
+ fTextLength = GetLength(avSize,temp.c_str());
+
+ bool nothing = true;
+ if(fTextLength > afLength)
+ {
+ rows++;
+ RowLengthList.push_back(last_space);
+ first_letter=last_space+1;
+ last_space = pos;
+ nothing = false;
+ }
+ if(asString[pos] == _W('\n'))
+ {
+ last_space = pos;
+ first_letter=last_space+1;
+ RowLengthList.push_back(last_space-1);
+ rows++;
+ nothing = false;
+ }
+ if(nothing)
+ {
+ last_space = pos;
+ }
+ }
+ }
+ tWString temp = asString.substr(first_letter, pos-first_letter);
+ fTextLength = GetLength(avSize,temp.c_str());
+ if(fTextLength > afLength)
+ {
+ rows++;
+ RowLengthList.push_back(last_space);
+ }
+
+ if(rows==0)
+ {
+ Draw(avPos,avSize,aCol,aAlign,_W("%ls"),asString.c_str());
+ }
+ else
+ {
+ first_letter=0;
+ unsigned int i=0;
+
+ for(tUIntListIt it = RowLengthList.begin();it != RowLengthList.end();++it)
+ {
+ Draw(cVector3f(avPos.x,avPos.y + i*afFontHeight,avPos.z),avSize,aCol,aAlign,
+ _W("%ls"),asString.substr(first_letter,*it-first_letter).c_str());
+ i++;
+ first_letter = *it+1;
+ }
+ Draw(cVector3f(avPos.x,avPos.y + i*afFontHeight,avPos.z),avSize,aCol,aAlign,
+ _W("%ls"),asString.substr(first_letter).c_str());
+
+ }
+
+ return rows;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void iFontData::GetWordWrapRows(float afLength,float afFontHeight,cVector2f avSize,
+ const tWString& asString,tWStringVec *apRowVec)
+ {
+ int rows = 0;
+
+ unsigned int pos;
+ unsigned int first_letter=0;
+ unsigned int last_space=0;
+
+ tUIntList RowLengthList;
+
+ float fTextLength;
+
+ for(pos = 0; pos < asString.size();pos++)
+ {
+ //Log("char: %d\n",(char)asString[pos]);
+ if(asString[pos] == _W(' ') || asString[pos] == _W('\n'))
+ {
+ tWString temp = asString.substr(first_letter, pos-first_letter);
+ fTextLength = GetLength(avSize,temp.c_str());
+
+ //Log("r:%d p:%d f:%d l:%d Temp:'%s'\n",rows,pos,first_letter,last_space,
+ //temp.c_str());
+ bool nothing = true;
+ if(fTextLength > afLength)
+ {
+ rows++;
+ RowLengthList.push_back(last_space);
+ first_letter=last_space+1;
+ last_space = pos;
+ nothing = false;
+ }
+ if(asString[pos] == _W('\n'))
+ {
+ last_space = pos;
+ first_letter=last_space+1;
+ RowLengthList.push_back(last_space);
+ rows++;
+ nothing = false;
+ }
+ if(nothing)
+ {
+ last_space = pos;
+ }
+ }
+ }
+ tWString temp = asString.substr(first_letter, pos-first_letter);
+ fTextLength = GetLength(avSize,temp.c_str());
+ if(fTextLength > afLength)
+ {
+ rows++;
+ RowLengthList.push_back(last_space);
+ }
+
+ if(rows==0)
+ {
+ apRowVec->push_back(asString.c_str());
+ }
+ else
+ {
+ first_letter=0;
+ unsigned int i=0;
+
+ for(tUIntListIt it = RowLengthList.begin();it != RowLengthList.end();++it)
+ {
+ apRowVec->push_back(asString.substr(first_letter,*it-first_letter).c_str());
+ i++;
+ first_letter = *it+1;
+ }
+ apRowVec->push_back(asString.substr(first_letter).c_str());
+
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ float iFontData::GetLength(const cVector2f& avSize,const wchar_t* sText)
+ {
+ int lCount=0;
+ float lXAdd =0;
+ float fLength =0;
+ while(sText[lCount] != 0)
+ {
+ unsigned short lGlyphNum = ((wchar_t)sText[lCount]);
+ if(lGlyphNum<mlFirstChar || lGlyphNum>mlLastChar){
+ lCount++;
+ continue;
+ }
+ lGlyphNum -= mlFirstChar;
+
+
+ cGlyph *pGlyph = mvGlyphs[lGlyphNum];
+ if(pGlyph)
+ {
+ cVector2f vOffset(pGlyph->mvOffset * avSize);
+ cVector2f vSize(pGlyph->mvSize * avSize);
+
+ fLength += pGlyph->mfAdvance*avSize.x;
+ }
+ lCount++;
+ }
+
+ return fLength;
+ }
+
+ //-----------------------------------------------------------------------
+
+
+ float iFontData::GetLengthFmt(const cVector2f& avSize,const wchar_t* fmt,...)
+ {
+ wchar_t sText[256];
+ va_list ap;
+ if (fmt == NULL) return 0;
+ va_start(ap, fmt);
+ vswprintf(sText, 255, fmt, ap);
+ va_end(ap);
+
+ return GetLength(avSize, sText);
+ }
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PRIVATE METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cGlyph* iFontData::CreateGlyph(iBitmap2D* apBmp, const cVector2l &avOffset,const cVector2l &avSize,
+ const cVector2l& avFontSize, int alAdvance)
+ {
+ //Here the bitmap should be saved to diskk for faster loading.
+
+ //////////////////////////
+ //Gfx object
+ cGfxObject* pObject = mpGraphicsDrawer->CreateGfxObject(apBmp,"fontnormal",false);
+
+ //////////////////////////
+ //Gui gfx
+ cGuiGfxElement* pGuiGfx = mpGui->CreateGfxFilledRect(cColor(1,1),eGuiMaterial_FontNormal,false);
+ cResourceImage *pImage = pObject->GetMaterial()->GetImage(eMaterialTexture_Diffuse);
+ pImage->IncUserCount();
+ pGuiGfx->AddImage(pImage);
+
+ //////////////////////////
+ //Sizes
+ cVector2f vSize;
+ vSize.x = ((float)avSize.x)/((float)avFontSize.x) * mvSizeRatio.x;
+ vSize.y = ((float)avSize.y)/((float)avFontSize.y) * mvSizeRatio.y;
+
+ cVector2f vOffset;
+ vOffset.x = ((float)avOffset.x)/((float)avFontSize.x);
+ vOffset.y = ((float)avOffset.y)/((float)avFontSize.y);
+
+ float fAdvance = ((float)alAdvance)/((float)avFontSize.x) * mvSizeRatio.x;
+
+ cGlyph* pGlyph = hplNew( cGlyph,(pObject,pGuiGfx,vOffset,vSize,fAdvance));
+
+ return pGlyph;
+ }
+
+ //-----------------------------------------------------------------------
+
+ void iFontData::AddGlyph(cGlyph *apGlyph)
+ {
+ mvGlyphs.push_back(apGlyph);
+ }
+
+
+
+ //-----------------------------------------------------------------------
+
+}
diff --git a/engines/hpl1/engine/graphics/FontData.h b/engines/hpl1/engine/graphics/FontData.h
new file mode 100644
index 00000000000..a3e67c4ce7f
--- /dev/null
+++ b/engines/hpl1/engine/graphics/FontData.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_FONTDATA_H
+#define HPL_FONTDATA_H
+
+#include <vector>
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/graphics/GraphicsTypes.h"
+#include "hpl1/engine/resources/ResourceBase.h"
+#include "hpl1/engine/resources/LowLevelResources.h"
+
+namespace hpl {
+
+ class ImageManager;
+ class iLowLevelGraphics;
+ class cGraphicsDrawer;
+ class cGfxObject;
+ class iBitmap2D;
+ class cGuiGfxElement;
+ class cGui;
+
+ //------------------------------------------------
+
+ class cGlyph
+ {
+ public:
+ cGlyph( cGfxObject *apObject,cGuiGfxElement *apGuiGfx,const cVector2f &avOffset,
+ const cVector2f &avSize, float afAdvance);
+ ~cGlyph();
+
+ cGfxObject *mpGfxObject;
+ cGuiGfxElement *mpGuiGfx;
+ cVector2f mvOffset;
+ cVector2f mvSize;
+ float mfAdvance;
+ };
+
+ typedef std::vector<cGlyph*> tGlyphVec;
+ typedef tGlyphVec::iterator tGlyphVecIt;
+
+ class iFontData : public iResourceBase
+ {
+ public:
+ iFontData(const tString &asName, iLowLevelGraphics* apLowLevelGraphics);
+ ~iFontData();
+
+ virtual bool CreateFromFontFile(const tString &asFileName, int alSize,unsigned short alFirstChar,
+ unsigned short alLastChar)=0;
+
+ virtual bool CreateFromBitmapFile(const tString &asFileName)=0;
+
+
+ bool Reload(){ return false;}
+ void Unload(){}
+ void Destroy(){}
+
+ /**
+ * Used internally
+ */
+ void SetUp(cGraphicsDrawer *apGraphicsDrawer, iLowLevelResources* apLowLevelResources,
+ cGui *apGui)
+ {
+ mpGraphicsDrawer = apGraphicsDrawer;
+ mpLowLevelResources = apLowLevelResources;
+ mpGui = apGui;
+ }
+
+ /**
+ * Used internally
+ * \param alNum
+ * \return
+ */
+ inline cGlyph* GetGlyph(int alNum)const { return mvGlyphs[alNum];}
+
+ inline unsigned short GetFirstChar(){ return mlFirstChar;}
+ inline unsigned short GetLastChar(){ return mlLastChar;}
+
+ inline const cVector2f& GetSizeRatio()const{ return mvSizeRatio;}
+
+ /**
+ * Draw a string.
+ * \param avPos Screen pos
+ * \param avSize size of the characters
+ * \param aCol color
+ * \param mAlign alignment
+ * \param fmt
+ * \param ...
+ */
+ void Draw(const cVector3f& avPos,const cVector2f& avSize, const cColor& aCol,eFontAlign mAlign,
+ const wchar_t* fmt,...);
+ /**
+ * Draw a string with word wrap.
+ * \param avPos Screen pos
+ * \param afLength Max length of a line
+ * \param afFontHeight The distance from base of character above to base of character below
+ * \param avSize size of the characters
+ * \param aCol color
+ * \param aAlign alignment
+ * \param asString
+ * \return Extra number of rows generated.
+ */
+ int DrawWordWrap(cVector3f avPos,float afLength,float afFontHeight,cVector2f avSize,const cColor& aCol,
+ eFontAlign aAlign, const tWString &asString);
+
+
+ void GetWordWrapRows(float afLength,float afFontHeight,cVector2f avSize,const tWString& asString,
+ tWStringVec *apRowVec);
+
+ /**
+ * Get height of the font.
+ * \return
+ */
+ inline float GetHeight()const{ return mfHeight; }
+
+ /**
+ * Get the length in virtual screen size "pixels" of a formated string
+ * \param avSize size of the characters
+ * \param fmt
+ * \param ...
+ * \return
+ */
+ float GetLengthFmt(const cVector2f& avSize,const wchar_t* fmt,...);
+ /**
+ * Get the length in virtual screen size "pixels" of a string
+ * \param avSize size of the characters
+ * \param sText
+ * \return
+ */
+ float GetLength(const cVector2f& avSize,const wchar_t* sText);
+
+ protected:
+ iLowLevelGraphics* mpLowLevelGraphics;
+ iLowLevelResources* mpLowLevelResources;
+ cGraphicsDrawer *mpGraphicsDrawer;
+ cGui *mpGui;
+
+ tGlyphVec mvGlyphs;
+
+ float mfHeight;
+ unsigned short mlFirstChar;
+ unsigned short mlLastChar;
+
+ cVector2f mvSizeRatio;
+
+ cGlyph* CreateGlyph(iBitmap2D* apBmp, const cVector2l &avOffset,const cVector2l &avSize,
+ const cVector2l& avFontSize, int alAdvance);
+ void AddGlyph(cGlyph *apGlyph);
+ };
+
+};
+#endif // HPL_FONTDATA_H
diff --git a/engines/hpl1/engine/graphics/GPUProgram.cpp b/engines/hpl1/engine/graphics/GPUProgram.cpp
new file mode 100644
index 00000000000..213f0cc4572
--- /dev/null
+++ b/engines/hpl1/engine/graphics/GPUProgram.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/graphics/GPUProgram.h"
+
+namespace hpl{
+
+ bool iGpuProgram::mbDebugInfo=false;
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
+
+}
diff --git a/engines/hpl1/engine/graphics/GPUProgram.h b/engines/hpl1/engine/graphics/GPUProgram.h
new file mode 100644
index 00000000000..c028bb01a81
--- /dev/null
+++ b/engines/hpl1/engine/graphics/GPUProgram.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_GPU_PROGRAM_H
+#define HPL_GPU_PROGRAM_H
+
+#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/resources/ResourceBase.h"
+#include "hpl1/engine/graphics/GraphicsTypes.h"
+
+namespace hpl {
+
+ class iTexture;
+
+ enum eGpuProgramType
+ {
+ eGpuProgramType_Vertex,
+ eGpuProgramType_Fragment,
+ eGpuProgramType_LastEnum
+ };
+
+ enum eGpuProgramMatrix
+ {
+ eGpuProgramMatrix_View,
+ eGpuProgramMatrix_Projection,
+ eGpuProgramMatrix_Texture,
+ eGpuProgramMatrix_ViewProjection,
+ eGpuProgramMatrix_LastEnum
+ };
+
+ enum eGpuProgramMatrixOp
+ {
+ eGpuProgramMatrixOp_Identity,
+ eGpuProgramMatrixOp_Inverse,
+ eGpuProgramMatrixOp_Transpose,
+ eGpuProgramMatrixOp_InverseTranspose,
+ eGpuProgramMatrixOp_LastEnum
+ };
+
+
+ class iGpuProgram : public iResourceBase
+ {
+ public:
+ iGpuProgram(tString asName, eGpuProgramType aType) : iResourceBase(asName,0){
+ mProgramType = aType;
+ }
+ virtual ~iGpuProgram(){}
+
+ static void SetLogDebugInformation(bool abX){mbDebugInfo = abX;}
+
+ /**
+ * Create a from a file. Used internally
+ * \param asFile
+ * \param asEntry
+ * \return
+ */
+ virtual bool CreateFromFile(const tString& asFile, const tString& asEntry)=0;
+
+ /**
+ * Bind the program to the GPU
+ */
+ virtual void Bind()=0;
+ /**
+ * Unbind the program to the GPU
+ */
+ virtual void UnBind()=0;
+
+ virtual bool SetFloat(const tString& asName, float afX)=0;
+
+ bool SetVec2f(const tString& asName, const cVector2f avVec)
+ {
+ return SetVec2f(asName,avVec.x, avVec.y);
+ }
+ virtual bool SetVec2f(const tString& asName, float afX,float afY)=0;
+
+ bool SetVec3f(const tString& asName, const cVector3f& avVec)
+ {
+ return SetVec3f(asName, avVec.x,avVec.y,avVec.z);
+ }
+ bool SetColor3f(const tString& asName, const cColor &aCol)
+ {
+ return SetVec3f(asName,aCol.r, aCol.g, aCol.b);
+ }
+ virtual bool SetVec3f(const tString& asName, float afX,float afY,float afZ)=0;
+
+ bool SetColor4f(const tString& asName, const cColor &aCol)
+ {
+ return SetVec4f(asName,aCol.r, aCol.g, aCol.b, aCol.a);
+ }
+ virtual bool SetVec4f(const tString& asName, float afX,float afY,float afZ, float afW)=0;
+
+ virtual bool SetMatrixf(const tString& asName, const cMatrixf& mMtx)=0;
+ virtual bool SetMatrixf(const tString& asName, eGpuProgramMatrix mType,
+ eGpuProgramMatrixOp mOp)=0;
+
+ virtual bool SetTexture(const tString& asName,iTexture* apTexture, bool abAutoDisable=true)=0;
+ virtual bool SetTextureToUnit(int alUnit, iTexture* apTexture)=0;
+
+
+ eGpuProgramType GetType() { return mProgramType;}
+
+ protected:
+ eGpuProgramType mProgramType;
+
+ static bool mbDebugInfo;
+ };
+};
+#endif // HPL_GPU_PROGRAM_H
diff --git a/engines/hpl1/engine/graphics/GfxObject.cpp b/engines/hpl1/engine/graphics/GfxObject.cpp
new file mode 100644
index 00000000000..4956a444bcf
--- /dev/null
+++ b/engines/hpl1/engine/graphics/GfxObject.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/graphics/GfxObject.h"
+
+#include "hpl1/engine/graphics/Material.h"
+
+
+namespace hpl {
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cGfxObject::cGfxObject(iMaterial* apMat,const tString& asFile, bool abIsImage)
+ {
+ mpMat = apMat;
+
+ msSourceFile = asFile;
+
+ mbIsImage = abIsImage;
+
+ if(mbIsImage)
+ {
+ mvVtx = apMat->GetImage(eMaterialTexture_Diffuse)->GetVertexVecCopy(0,-1);
+ }
+ else
+ {
+ mvVtx.push_back(cVertex(cVector3f(0,0,0),cVector2f(0,0),cColor(1,1)) );
+ mvVtx.push_back(cVertex(cVector3f(1,0,0),cVector2f(1,0),cColor(1,1)) );
+ mvVtx.push_back(cVertex(cVector3f(1,1,0),cVector2f(1,1),cColor(1,1)) );
+ mvVtx.push_back(cVertex(cVector3f(0,1,0),cVector2f(0,1),cColor(1,1)) );
+ }
+ }
+
+ //-----------------------------------------------------------------------
+
+ cGfxObject::~cGfxObject()
+ {
+ hplDelete(mpMat);
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
+
+}
diff --git a/engines/hpl1/engine/graphics/GfxObject.h b/engines/hpl1/engine/graphics/GfxObject.h
new file mode 100644
index 00000000000..dd35918c106
--- /dev/null
+++ b/engines/hpl1/engine/graphics/GfxObject.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HPL_GFX_OBJECT_H
+#define HPL_GFX_OBJECT_H
+
+#include <vector>
+#include "hpl1/engine/graphics/GraphicsTypes.h"
+
+namespace hpl {
+
+ class iMaterial;
+
+ class cGfxObject
+ {
+ public:
+ cGfxObject(iMaterial* apMat,const tString& asFile, bool abIsImage);
+ ~cGfxObject();
+
+ iMaterial* GetMaterial() const{ return mpMat;}
+ cVertex* GetVtxPtr(int alNum){ return &mvVtx[alNum];}
+ tVertexVec* GetVertexVec(){ return &mvVtx;}
+
+ const tString& GetSourceFile(){ return msSourceFile;}
+
+ bool IsImage(){ return mbIsImage;}
+
+ private:
+ tVertexVec mvVtx;
+ iMaterial* mpMat;
+ float mfZ;
+ bool mbIsImage;
+
+ tString msSourceFile;
+ };
+
+ typedef std::vector<cGfxObject> tGfxObjectVec;
+ typedef tGfxObjectVec::iterator tGfxObjectVecIt;
+};
+#endif // HPL_GFX_OBJECT_H
diff --git a/engines/hpl1/engine/graphics/Graphics.cpp b/engines/hpl1/engine/graphics/Graphics.cpp
new file mode 100644
index 00000000000..2d11968ccee
--- /dev/null
+++ b/engines/hpl1/engine/graphics/Graphics.cpp
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ *
+ * HPL1 Engine is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HPL1 Engine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "hpl1/engine/graphics/Graphics.h"
+
+#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/graphics/LowLevelGraphics.h"
+#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/graphics/GraphicsDrawer.h"
+#include "hpl1/engine/graphics/Renderer2D.h"
+#include "hpl1/engine/graphics/Renderer3D.h"
+#include "hpl1/engine/graphics/RendererPostEffects.h"
+#include "hpl1/engine/graphics/RenderList.h"
+#include "hpl1/engine/graphics/MaterialHandler.h"
+#include "hpl1/engine/graphics/MeshCreator.h"
+#include "hpl1/engine/game/Updateable.h"
+#include "hpl1/engine/resources/Resources.h"
+
+//2D Materials
+#include "hpl1/engine/graphics/Material_BumpSpec2D.h"
+#include "hpl1/engine/graphics/Material_Diffuse2D.h"
+#include "hpl1/engine/graphics/Material_DiffuseAdditive2D.h"
+#include "hpl1/engine/graphics/Material_DiffuseAlpha2D.h"
+#include "hpl1/engine/graphics/Material_Smoke2D.h"
+#include "hpl1/engine/graphics/Material_FontNormal.h"
+
+//3D Materials
+#include "hpl1/engine/graphics/Material_Alpha.h"
+#include "hpl1/engine/graphics/Material_Diffuse.h"
+#include "hpl1/engine/graphics/Material_DiffuseSpec.h"
+#include "hpl1/engine/graphics/Material_Bump.h"
+#include "hpl1/engine/graphics/Material_BumpSpec.h"
+#include "hpl1/engine/graphics/Material_BumpColorSpec.h"
+#include "hpl1/engine/graphics/Material_Additive.h"
+#include "hpl1/engine/graphics/Material_Flat.h"
+#include "hpl1/engine/graphics/Material_Modulative.h"
+#include "hpl1/engine/graphics/Material_ModulativeX2.h"
+#include "hpl1/engine/graphics/Material_Alpha.h"
+#include "hpl1/engine/graphics/Material_EnvMap_Reflect.h"
+#include "hpl1/engine/graphics/Material_Water.h"
+
+namespace hpl {
+
+ //////////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ cGraphics::cGraphics(iLowLevelGraphics *apLowLevelGraphics, iLowLevelResources *apLowLevelResources)
+ {
+ mpLowLevelGraphics = apLowLevelGraphics;
+ mpLowLevelResources = apLowLevelResources;
+
+ mpDrawer = NULL;
+ mpMeshCreator = NULL;
+ mpMaterialHandler = NULL;
+ mpRenderer2D = NULL;
+ mpRenderer3D = NULL;
+ mpRendererPostEffects = NULL;
+ }
+
+ //-----------------------------------------------------------------------
+
+ cGraphics::~cGraphics()
+ {
+ Log("Exiting Graphics Module\n");
+ Log("--------------------------------------------------------\n");
+
+ hplDelete(mpRenderer2D);
+ hplDelete(mpRenderer3D);
+ hplDelete(mpRendererPostEffects);
+ hplDelete(mpDrawer);
+ hplDelete(mpMeshCreator);
+ hplDelete(mpMaterialHandler);
+ hplDelete(mpRenderList);
+
+ Log("--------------------------------------------------------\n\n");
+ }
+
+ //-----------------------------------------------------------------------
+
+ //////////////////////////////////////////////////////////////////////////
+ // PUBLIC METHODS
+ //////////////////////////////////////////////////////////////////////////
+
+ //-----------------------------------------------------------------------
+
+ bool cGraphics::Init( int alWidth, int alHeight, int alBpp, int abFullscreen,
+ int alMultisampling,const tString &asWindowCaption,
+ cResources* apResources)
+ {
+ Log("Initializing Graphics Module\n");
+ Log("--------------------------------------------------------\n");
+
+ //Setup the graphic directories:
+ apResources->AddResourceDir("core/programs");
+ apResources->AddResourceDir("core/textures");
+
+ Log(" Init low level graphics\n");
+ mpLowLevelGraphics->Init(alWidth,alHeight,alBpp,abFullscreen,alMultisampling,asWindowCaption);
+
+ Log(" Creating graphic systems\n");
+ mpMaterialHandler = hplNew( cMaterialHandler,(this, apResources));
+ mpDrawer = hplNew( cGraphicsDrawer,(mpLowLevelGraphics,mpMaterialHandler,apResources));
+ mpRenderer2D = hplNew( cRenderer2D,(mpLowLevelGraphics,apResources,mpDrawer));
+ mpRenderList = hplNew( cRenderList,(this));
+ mpMeshCreator = hplNew( cMeshCreator,(mpLowLevelGraphics, apResources));
+ mpRenderer3D = hplNew( cRenderer3D,(mpLowLevelGraphics,apResources,mpMeshCreator,mpRenderList));
+ mpRendererPostEffects = hplNew( cRendererPostEffects,(mpLowLevelGraphics,apResources,mpRenderList,
+ mpRenderer3D));
+ mpRenderer3D->SetPostEffects(mpRendererPostEffects);
+
+
+ //Add all the materials.
+ //2D
+ Log(" Adding engine materials\n");
+ mpMaterialHandler->Add(hplNew( cMaterialType_BumpSpec2D,() ) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_DiffuseAdditive2D,()) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_DiffuseAlpha2D,()) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_Diffuse2D,()) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_Smoke2D,()) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_FontNormal,()) );
+
+ //3D
+ mpMaterialHandler->Add(hplNew( cMaterialType_Diffuse,()) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_Bump,()) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_DiffuseSpec,()) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_BumpSpec,()) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_BumpColorSpec,()) );
+
+ mpMaterialHandler->Add(hplNew( cMaterialType_Additive,()) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_Alpha,()) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_Flat,()) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_Modulative,()) );
+ mpMaterialHandler->Add(hplNew( cMaterialType_ModulativeX2,()) );
+
+ mpMaterialHandler->Add(hplNew( cMaterialType_EnvMap_Reflect,()) );
+
+ mpMaterialHandler->Add(hplNew( cMaterialType_Water,()) );
+
+ Log("--------------------------------------------------------\n\n");
+
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+
+ iLowLevelGraphics* cGraphics::GetLowLevel()
+ {
+ return mpLowLevelGraphics;
+ }
+
Commit: b35fd9d1b85409eacc31402dec860b14355eca3d
https://github.com/scummvm/scummvm/commit/b35fd9d1b85409eacc31402dec860b14355eca3d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:26+01:00
Commit Message:
HPL1: add license header
Changed paths:
engines/hpl1/engine/ai/AI.cpp
engines/hpl1/engine/ai/AI.h
engines/hpl1/engine/ai/AINodeContainer.cpp
engines/hpl1/engine/ai/AINodeContainer.h
engines/hpl1/engine/ai/AINodeGenerator.cpp
engines/hpl1/engine/ai/AINodeGenerator.h
engines/hpl1/engine/ai/AStar.cpp
engines/hpl1/engine/ai/AStar.h
engines/hpl1/engine/ai/StateMachine.cpp
engines/hpl1/engine/ai/StateMachine.h
engines/hpl1/engine/game/Game.cpp
engines/hpl1/engine/game/Game.h
engines/hpl1/engine/game/GameTypes.cpp
engines/hpl1/engine/game/GameTypes.h
engines/hpl1/engine/game/LowLevelGameSetup.h
engines/hpl1/engine/game/SaveGame.cpp
engines/hpl1/engine/game/SaveGame.h
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/game/ScriptFuncs.h
engines/hpl1/engine/game/Updateable.h
engines/hpl1/engine/game/Updater.cpp
engines/hpl1/engine/game/Updater.h
engines/hpl1/engine/graphics/Animation.cpp
engines/hpl1/engine/graphics/Animation.h
engines/hpl1/engine/graphics/AnimationTrack.cpp
engines/hpl1/engine/graphics/AnimationTrack.h
engines/hpl1/engine/graphics/BackgroundImage.cpp
engines/hpl1/engine/graphics/BackgroundImage.h
engines/hpl1/engine/graphics/Beam.cpp
engines/hpl1/engine/graphics/Beam.h
engines/hpl1/engine/graphics/BillBoard.cpp
engines/hpl1/engine/graphics/BillBoard.h
engines/hpl1/engine/graphics/Bitmap2D.h
engines/hpl1/engine/graphics/Bone.cpp
engines/hpl1/engine/graphics/Bone.h
engines/hpl1/engine/graphics/BoneState.cpp
engines/hpl1/engine/graphics/BoneState.h
engines/hpl1/engine/graphics/Color.cpp
engines/hpl1/engine/graphics/Color.h
engines/hpl1/engine/graphics/FontData.cpp
engines/hpl1/engine/graphics/FontData.h
engines/hpl1/engine/graphics/GPUProgram.cpp
engines/hpl1/engine/graphics/GPUProgram.h
engines/hpl1/engine/graphics/GfxObject.cpp
engines/hpl1/engine/graphics/GfxObject.h
engines/hpl1/engine/graphics/Graphics.cpp
engines/hpl1/engine/graphics/Graphics.h
engines/hpl1/engine/graphics/GraphicsDrawer.cpp
engines/hpl1/engine/graphics/GraphicsDrawer.h
engines/hpl1/engine/graphics/GraphicsTypes.h
engines/hpl1/engine/graphics/ImageEntityData.cpp
engines/hpl1/engine/graphics/ImageEntityData.h
engines/hpl1/engine/graphics/LowLevelGraphics.h
engines/hpl1/engine/graphics/LowLevelPicture.h
engines/hpl1/engine/graphics/Material.cpp
engines/hpl1/engine/graphics/Material.h
engines/hpl1/engine/graphics/MaterialHandler.cpp
engines/hpl1/engine/graphics/MaterialHandler.h
engines/hpl1/engine/graphics/Material_Additive.cpp
engines/hpl1/engine/graphics/Material_Additive.h
engines/hpl1/engine/graphics/Material_Alpha.cpp
engines/hpl1/engine/graphics/Material_Alpha.h
engines/hpl1/engine/graphics/Material_BaseLight.cpp
engines/hpl1/engine/graphics/Material_BaseLight.h
engines/hpl1/engine/graphics/Material_Bump.cpp
engines/hpl1/engine/graphics/Material_Bump.h
engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
engines/hpl1/engine/graphics/Material_BumpColorSpec.h
engines/hpl1/engine/graphics/Material_BumpSpec.cpp
engines/hpl1/engine/graphics/Material_BumpSpec.h
engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
engines/hpl1/engine/graphics/Material_BumpSpec2D.h
engines/hpl1/engine/graphics/Material_Diffuse.cpp
engines/hpl1/engine/graphics/Material_Diffuse.h
engines/hpl1/engine/graphics/Material_Diffuse2D.cpp
engines/hpl1/engine/graphics/Material_Diffuse2D.h
engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.cpp
engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.cpp
engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
engines/hpl1/engine/graphics/Material_DiffuseSpec.h
engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
engines/hpl1/engine/graphics/Material_Flat.cpp
engines/hpl1/engine/graphics/Material_Flat.h
engines/hpl1/engine/graphics/Material_FontNormal.cpp
engines/hpl1/engine/graphics/Material_FontNormal.h
engines/hpl1/engine/graphics/Material_Modulative.cpp
engines/hpl1/engine/graphics/Material_Modulative.h
engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
engines/hpl1/engine/graphics/Material_ModulativeX2.h
engines/hpl1/engine/graphics/Material_Smoke2D.cpp
engines/hpl1/engine/graphics/Material_Smoke2D.h
engines/hpl1/engine/graphics/Material_Water.cpp
engines/hpl1/engine/graphics/Material_Water.h
engines/hpl1/engine/graphics/Mesh.cpp
engines/hpl1/engine/graphics/Mesh.h
engines/hpl1/engine/graphics/Mesh2d.cpp
engines/hpl1/engine/graphics/Mesh2d.h
engines/hpl1/engine/graphics/MeshCreator.cpp
engines/hpl1/engine/graphics/MeshCreator.h
engines/hpl1/engine/graphics/OcclusionQuery.h
engines/hpl1/engine/graphics/ParticleEmitter.cpp
engines/hpl1/engine/graphics/ParticleEmitter.h
engines/hpl1/engine/graphics/ParticleEmitter2D.cpp
engines/hpl1/engine/graphics/ParticleEmitter2D.h
engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
engines/hpl1/engine/graphics/ParticleEmitter3D.h
engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
engines/hpl1/engine/graphics/ParticleSystem3D.cpp
engines/hpl1/engine/graphics/ParticleSystem3D.h
engines/hpl1/engine/graphics/PixelFormat.h
engines/hpl1/engine/graphics/RenderList.cpp
engines/hpl1/engine/graphics/RenderList.h
engines/hpl1/engine/graphics/RenderObject2D.cpp
engines/hpl1/engine/graphics/RenderObject2D.h
engines/hpl1/engine/graphics/RenderState.cpp
engines/hpl1/engine/graphics/RenderState.h
engines/hpl1/engine/graphics/Renderable.cpp
engines/hpl1/engine/graphics/Renderable.h
engines/hpl1/engine/graphics/Renderer2D.cpp
engines/hpl1/engine/graphics/Renderer2D.h
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/engine/graphics/Renderer3D.h
engines/hpl1/engine/graphics/RendererPostEffects.cpp
engines/hpl1/engine/graphics/RendererPostEffects.h
engines/hpl1/engine/graphics/Skeleton.cpp
engines/hpl1/engine/graphics/Skeleton.h
engines/hpl1/engine/graphics/SubMesh.cpp
engines/hpl1/engine/graphics/SubMesh.h
engines/hpl1/engine/graphics/Texture.h
engines/hpl1/engine/graphics/VertexBuffer.h
engines/hpl1/engine/graphics/VideoStream.h
engines/hpl1/engine/gui/Gui.cpp
engines/hpl1/engine/gui/Gui.h
engines/hpl1/engine/gui/GuiGfxElement.cpp
engines/hpl1/engine/gui/GuiGfxElement.h
engines/hpl1/engine/gui/GuiMaterial.h
engines/hpl1/engine/gui/GuiMaterialBasicTypes.cpp
engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
engines/hpl1/engine/gui/GuiPopUp.cpp
engines/hpl1/engine/gui/GuiPopUp.h
engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
engines/hpl1/engine/gui/GuiPopUpMessageBox.h
engines/hpl1/engine/gui/GuiSet.cpp
engines/hpl1/engine/gui/GuiSet.h
engines/hpl1/engine/gui/GuiSkin.cpp
engines/hpl1/engine/gui/GuiSkin.h
engines/hpl1/engine/gui/GuiTypes.h
engines/hpl1/engine/gui/Widget.cpp
engines/hpl1/engine/gui/Widget.h
engines/hpl1/engine/gui/WidgetBaseClasses.cpp
engines/hpl1/engine/gui/WidgetBaseClasses.h
engines/hpl1/engine/gui/WidgetButton.cpp
engines/hpl1/engine/gui/WidgetButton.h
engines/hpl1/engine/gui/WidgetCheckBox.cpp
engines/hpl1/engine/gui/WidgetCheckBox.h
engines/hpl1/engine/gui/WidgetComboBox.cpp
engines/hpl1/engine/gui/WidgetComboBox.h
engines/hpl1/engine/gui/WidgetFrame.cpp
engines/hpl1/engine/gui/WidgetFrame.h
engines/hpl1/engine/gui/WidgetImage.cpp
engines/hpl1/engine/gui/WidgetImage.h
engines/hpl1/engine/gui/WidgetLabel.cpp
engines/hpl1/engine/gui/WidgetLabel.h
engines/hpl1/engine/gui/WidgetListBox.cpp
engines/hpl1/engine/gui/WidgetListBox.h
engines/hpl1/engine/gui/WidgetSlider.cpp
engines/hpl1/engine/gui/WidgetSlider.h
engines/hpl1/engine/gui/WidgetTextBox.cpp
engines/hpl1/engine/gui/WidgetTextBox.h
engines/hpl1/engine/gui/WidgetWindow.cpp
engines/hpl1/engine/gui/WidgetWindow.h
engines/hpl1/engine/haptic/Haptic.cpp
engines/hpl1/engine/haptic/Haptic.h
engines/hpl1/engine/haptic/HapticForce.h
engines/hpl1/engine/haptic/HapticShape.h
engines/hpl1/engine/haptic/HapticSurface.h
engines/hpl1/engine/haptic/HapticTypes.h
engines/hpl1/engine/haptic/LowLevelHaptic.cpp
engines/hpl1/engine/haptic/LowLevelHaptic.h
engines/hpl1/engine/impl/CGProgram.cpp
engines/hpl1/engine/impl/CGProgram.h
engines/hpl1/engine/impl/CharacterBodyNewton.cpp
engines/hpl1/engine/impl/CharacterBodyNewton.h
engines/hpl1/engine/impl/CollideShapeNewton.cpp
engines/hpl1/engine/impl/CollideShapeNewton.h
engines/hpl1/engine/impl/KeyboardSDL.cpp
engines/hpl1/engine/impl/KeyboardSDL.h
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
engines/hpl1/engine/impl/LowLevelInputSDL.cpp
engines/hpl1/engine/impl/LowLevelInputSDL.h
engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
engines/hpl1/engine/impl/LowLevelResourcesSDL.h
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
engines/hpl1/engine/impl/LowLevelSystemSDL.h
engines/hpl1/engine/impl/MeshLoaderCollada.cpp
engines/hpl1/engine/impl/MeshLoaderCollada.h
engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
engines/hpl1/engine/impl/MeshLoaderMSH.cpp
engines/hpl1/engine/impl/MeshLoaderMSH.h
engines/hpl1/engine/impl/MouseSDL.cpp
engines/hpl1/engine/impl/MouseSDL.h
engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
engines/hpl1/engine/impl/OcclusionQueryOGL.h
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
engines/hpl1/engine/impl/OpenALSoundChannel.h
engines/hpl1/engine/impl/OpenALSoundData.cpp
engines/hpl1/engine/impl/OpenALSoundData.h
engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
engines/hpl1/engine/impl/OpenALSoundEnvironment.h
engines/hpl1/engine/impl/PBuffer.cpp
engines/hpl1/engine/impl/PBuffer.h
engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
engines/hpl1/engine/impl/PhysicsBodyNewton.h
engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
engines/hpl1/engine/impl/PhysicsControllerNewton.h
engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
engines/hpl1/engine/impl/PhysicsJointBallNewton.h
engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
engines/hpl1/engine/impl/PhysicsJointNewton.h
engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
engines/hpl1/engine/impl/PhysicsMaterialNewton.h
engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
engines/hpl1/engine/impl/PhysicsWorldNewton.h
engines/hpl1/engine/impl/Platform.h
engines/hpl1/engine/impl/SDLBitmap2D.cpp
engines/hpl1/engine/impl/SDLBitmap2D.h
engines/hpl1/engine/impl/SDLFontData.cpp
engines/hpl1/engine/impl/SDLFontData.h
engines/hpl1/engine/impl/SDLGameSetup.cpp
engines/hpl1/engine/impl/SDLGameSetup.h
engines/hpl1/engine/impl/SDLPixelFormat.h
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/SDLTexture.h
engines/hpl1/engine/impl/SqScript.cpp
engines/hpl1/engine/impl/SqScript.h
engines/hpl1/engine/impl/VertexBufferOGL.cpp
engines/hpl1/engine/impl/VertexBufferOGL.h
engines/hpl1/engine/impl/VertexBufferVBO.cpp
engines/hpl1/engine/impl/VertexBufferVBO.h
engines/hpl1/engine/impl/VideoStreamTheora.cpp
engines/hpl1/engine/impl/VideoStreamTheora.h
engines/hpl1/engine/input/Action.cpp
engines/hpl1/engine/input/Action.h
engines/hpl1/engine/input/ActionHaptic.cpp
engines/hpl1/engine/input/ActionHaptic.h
engines/hpl1/engine/input/ActionKeyboard.cpp
engines/hpl1/engine/input/ActionKeyboard.h
engines/hpl1/engine/input/ActionMouseButton.cpp
engines/hpl1/engine/input/ActionMouseButton.h
engines/hpl1/engine/input/Input.cpp
engines/hpl1/engine/input/Input.h
engines/hpl1/engine/input/InputDevice.cpp
engines/hpl1/engine/input/InputDevice.h
engines/hpl1/engine/input/InputTypes.h
engines/hpl1/engine/input/Keyboard.cpp
engines/hpl1/engine/input/Keyboard.h
engines/hpl1/engine/input/LowLevelInput.h
engines/hpl1/engine/input/Mouse.cpp
engines/hpl1/engine/input/Mouse.h
engines/hpl1/engine/math/BoundingVolume.cpp
engines/hpl1/engine/math/BoundingVolume.h
engines/hpl1/engine/math/CRC.cpp
engines/hpl1/engine/math/CRC.h
engines/hpl1/engine/math/Frustum.cpp
engines/hpl1/engine/math/Frustum.h
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/math/Math.h
engines/hpl1/engine/math/MathTypes.cpp
engines/hpl1/engine/math/MathTypes.h
engines/hpl1/engine/math/Matrix.h
engines/hpl1/engine/math/MeshTypes.cpp
engines/hpl1/engine/math/MeshTypes.h
engines/hpl1/engine/math/PidController.h
engines/hpl1/engine/math/Quaternion.cpp
engines/hpl1/engine/math/Quaternion.h
engines/hpl1/engine/math/Spring.cpp
engines/hpl1/engine/math/Spring.h
engines/hpl1/engine/math/Vector2.h
engines/hpl1/engine/math/Vector3.h
engines/hpl1/engine/physics/Body2D.cpp
engines/hpl1/engine/physics/Body2D.h
engines/hpl1/engine/physics/CharacterBody.cpp
engines/hpl1/engine/physics/CharacterBody.h
engines/hpl1/engine/physics/CollideData.h
engines/hpl1/engine/physics/CollideData2D.h
engines/hpl1/engine/physics/CollideShape.h
engines/hpl1/engine/physics/Collider2D.cpp
engines/hpl1/engine/physics/Collider2D.h
engines/hpl1/engine/physics/LowLevelPhysics.h
engines/hpl1/engine/physics/Physics.cpp
engines/hpl1/engine/physics/Physics.h
engines/hpl1/engine/physics/PhysicsBody.cpp
engines/hpl1/engine/physics/PhysicsBody.h
engines/hpl1/engine/physics/PhysicsController.cpp
engines/hpl1/engine/physics/PhysicsController.h
engines/hpl1/engine/physics/PhysicsJoint.cpp
engines/hpl1/engine/physics/PhysicsJoint.h
engines/hpl1/engine/physics/PhysicsJointBall.cpp
engines/hpl1/engine/physics/PhysicsJointBall.h
engines/hpl1/engine/physics/PhysicsJointHinge.cpp
engines/hpl1/engine/physics/PhysicsJointHinge.h
engines/hpl1/engine/physics/PhysicsJointScrew.cpp
engines/hpl1/engine/physics/PhysicsJointScrew.h
engines/hpl1/engine/physics/PhysicsJointSlider.cpp
engines/hpl1/engine/physics/PhysicsJointSlider.h
engines/hpl1/engine/physics/PhysicsMaterial.h
engines/hpl1/engine/physics/PhysicsWorld.cpp
engines/hpl1/engine/physics/PhysicsWorld.h
engines/hpl1/engine/physics/SurfaceData.cpp
engines/hpl1/engine/physics/SurfaceData.h
engines/hpl1/engine/resources/AnimationManager.cpp
engines/hpl1/engine/resources/AnimationManager.h
engines/hpl1/engine/resources/ConfigFile.cpp
engines/hpl1/engine/resources/ConfigFile.h
engines/hpl1/engine/resources/EntityLoader_Object.cpp
engines/hpl1/engine/resources/EntityLoader_Object.h
engines/hpl1/engine/resources/FileSearcher.cpp
engines/hpl1/engine/resources/FileSearcher.h
engines/hpl1/engine/resources/FontManager.cpp
engines/hpl1/engine/resources/FontManager.h
engines/hpl1/engine/resources/FrameBase.h
engines/hpl1/engine/resources/FrameBitmap.cpp
engines/hpl1/engine/resources/FrameBitmap.h
engines/hpl1/engine/resources/FrameTexture.cpp
engines/hpl1/engine/resources/FrameTexture.h
engines/hpl1/engine/resources/GpuProgramManager.cpp
engines/hpl1/engine/resources/GpuProgramManager.h
engines/hpl1/engine/resources/ImageEntityManager.cpp
engines/hpl1/engine/resources/ImageEntityManager.h
engines/hpl1/engine/resources/ImageManager.cpp
engines/hpl1/engine/resources/ImageManager.h
engines/hpl1/engine/resources/LanguageFile.cpp
engines/hpl1/engine/resources/LanguageFile.h
engines/hpl1/engine/resources/LowLevelResources.h
engines/hpl1/engine/resources/MaterialManager.cpp
engines/hpl1/engine/resources/MaterialManager.h
engines/hpl1/engine/resources/MeshLoader.h
engines/hpl1/engine/resources/MeshLoaderHandler.cpp
engines/hpl1/engine/resources/MeshLoaderHandler.h
engines/hpl1/engine/resources/MeshManager.cpp
engines/hpl1/engine/resources/MeshManager.h
engines/hpl1/engine/resources/ParticleManager.cpp
engines/hpl1/engine/resources/ParticleManager.h
engines/hpl1/engine/resources/ResourceBase.cpp
engines/hpl1/engine/resources/ResourceBase.h
engines/hpl1/engine/resources/ResourceImage.cpp
engines/hpl1/engine/resources/ResourceImage.h
engines/hpl1/engine/resources/ResourceManager.cpp
engines/hpl1/engine/resources/ResourceManager.h
engines/hpl1/engine/resources/Resources.cpp
engines/hpl1/engine/resources/Resources.h
engines/hpl1/engine/resources/ResourcesTypes.h
engines/hpl1/engine/resources/ScriptManager.cpp
engines/hpl1/engine/resources/ScriptManager.h
engines/hpl1/engine/resources/SoundEntityManager.cpp
engines/hpl1/engine/resources/SoundEntityManager.h
engines/hpl1/engine/resources/SoundManager.cpp
engines/hpl1/engine/resources/SoundManager.h
engines/hpl1/engine/resources/TextureManager.cpp
engines/hpl1/engine/resources/TextureManager.h
engines/hpl1/engine/resources/TileSetManager.cpp
engines/hpl1/engine/resources/TileSetManager.h
engines/hpl1/engine/resources/VideoManager.cpp
engines/hpl1/engine/resources/VideoManager.h
engines/hpl1/engine/scene/AnimationState.cpp
engines/hpl1/engine/scene/AnimationState.h
engines/hpl1/engine/scene/Area2D.cpp
engines/hpl1/engine/scene/Area2D.h
engines/hpl1/engine/scene/Camera.h
engines/hpl1/engine/scene/Camera2D.cpp
engines/hpl1/engine/scene/Camera2D.h
engines/hpl1/engine/scene/Camera3D.cpp
engines/hpl1/engine/scene/Camera3D.h
engines/hpl1/engine/scene/ColliderEntity.cpp
engines/hpl1/engine/scene/ColliderEntity.h
engines/hpl1/engine/scene/Entity.cpp
engines/hpl1/engine/scene/Entity.h
engines/hpl1/engine/scene/Entity2D.cpp
engines/hpl1/engine/scene/Entity2D.h
engines/hpl1/engine/scene/Entity3D.cpp
engines/hpl1/engine/scene/Entity3D.h
engines/hpl1/engine/scene/GridMap2D.cpp
engines/hpl1/engine/scene/GridMap2D.h
engines/hpl1/engine/scene/ImageEntity.cpp
engines/hpl1/engine/scene/ImageEntity.h
engines/hpl1/engine/scene/Light.cpp
engines/hpl1/engine/scene/Light.h
engines/hpl1/engine/scene/Light2D.cpp
engines/hpl1/engine/scene/Light2D.h
engines/hpl1/engine/scene/Light2DPoint.cpp
engines/hpl1/engine/scene/Light2DPoint.h
engines/hpl1/engine/scene/Light3D.cpp
engines/hpl1/engine/scene/Light3D.h
engines/hpl1/engine/scene/Light3DPoint.cpp
engines/hpl1/engine/scene/Light3DPoint.h
engines/hpl1/engine/scene/Light3DSpot.cpp
engines/hpl1/engine/scene/Light3DSpot.h
engines/hpl1/engine/scene/MeshEntity.cpp
engines/hpl1/engine/scene/MeshEntity.h
engines/hpl1/engine/scene/MultiImageEntity.cpp
engines/hpl1/engine/scene/MultiImageEntity.h
engines/hpl1/engine/scene/Node.cpp
engines/hpl1/engine/scene/Node.h
engines/hpl1/engine/scene/Node2D.cpp
engines/hpl1/engine/scene/Node2D.h
engines/hpl1/engine/scene/Node3D.cpp
engines/hpl1/engine/scene/Node3D.h
engines/hpl1/engine/scene/NodeState.cpp
engines/hpl1/engine/scene/NodeState.h
engines/hpl1/engine/scene/PortalContainer.cpp
engines/hpl1/engine/scene/PortalContainer.h
engines/hpl1/engine/scene/RenderableContainer.h
engines/hpl1/engine/scene/Scene.cpp
engines/hpl1/engine/scene/Scene.h
engines/hpl1/engine/scene/SectorVisibility.cpp
engines/hpl1/engine/scene/SectorVisibility.h
engines/hpl1/engine/scene/SoundEntity.cpp
engines/hpl1/engine/scene/SoundEntity.h
engines/hpl1/engine/scene/SoundSource.cpp
engines/hpl1/engine/scene/SoundSource.h
engines/hpl1/engine/scene/SubMeshEntity.cpp
engines/hpl1/engine/scene/SubMeshEntity.h
engines/hpl1/engine/scene/Tile.cpp
engines/hpl1/engine/scene/Tile.h
engines/hpl1/engine/scene/TileData.cpp
engines/hpl1/engine/scene/TileData.h
engines/hpl1/engine/scene/TileLayer.cpp
engines/hpl1/engine/scene/TileLayer.h
engines/hpl1/engine/scene/TileMap.cpp
engines/hpl1/engine/scene/TileMap.h
engines/hpl1/engine/scene/TileMapIt.h
engines/hpl1/engine/scene/TileMapLineIt.cpp
engines/hpl1/engine/scene/TileMapLineIt.h
engines/hpl1/engine/scene/TileMapRectIt.cpp
engines/hpl1/engine/scene/TileMapRectIt.h
engines/hpl1/engine/scene/TileSet.cpp
engines/hpl1/engine/scene/TileSet.h
engines/hpl1/engine/scene/World2D.cpp
engines/hpl1/engine/scene/World2D.h
engines/hpl1/engine/scene/World3D.cpp
engines/hpl1/engine/scene/World3D.h
engines/hpl1/engine/sound/LowLevelSound.cpp
engines/hpl1/engine/sound/LowLevelSound.h
engines/hpl1/engine/sound/MusicHandler.cpp
engines/hpl1/engine/sound/MusicHandler.h
engines/hpl1/engine/sound/Sound.cpp
engines/hpl1/engine/sound/Sound.h
engines/hpl1/engine/sound/SoundChannel.h
engines/hpl1/engine/sound/SoundData.h
engines/hpl1/engine/sound/SoundEntityData.cpp
engines/hpl1/engine/sound/SoundEntityData.h
engines/hpl1/engine/sound/SoundEnvironment.h
engines/hpl1/engine/sound/SoundHandler.cpp
engines/hpl1/engine/sound/SoundHandler.h
engines/hpl1/engine/system/BinTree.h
engines/hpl1/engine/system/Container.cpp
engines/hpl1/engine/system/Container.h
engines/hpl1/engine/system/LogicTimer.cpp
engines/hpl1/engine/system/LogicTimer.h
engines/hpl1/engine/system/LowLevelSystem.h
engines/hpl1/engine/system/MemoryManager.cpp
engines/hpl1/engine/system/MemoryManager.h
engines/hpl1/engine/system/Script.h
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/engine/system/SerializeClass.h
engines/hpl1/engine/system/String.cpp
engines/hpl1/engine/system/String.h
engines/hpl1/engine/system/System.cpp
engines/hpl1/engine/system/System.h
engines/hpl1/engine/system/SystemTypes.h
diff --git a/engines/hpl1/engine/ai/AI.cpp b/engines/hpl1/engine/ai/AI.cpp
index 6c68a87f280..dc332ce8af6 100644
--- a/engines/hpl1/engine/ai/AI.cpp
+++ b/engines/hpl1/engine/ai/AI.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/ai/AI.h"
#include "hpl1/engine/ai/AINodeGenerator.h"
diff --git a/engines/hpl1/engine/ai/AI.h b/engines/hpl1/engine/ai/AI.h
index 173987fc2fb..f7d395fcc24 100644
--- a/engines/hpl1/engine/ai/AI.h
+++ b/engines/hpl1/engine/ai/AI.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_AI_H
#define HPL_AI_H
diff --git a/engines/hpl1/engine/ai/AINodeContainer.cpp b/engines/hpl1/engine/ai/AINodeContainer.cpp
index 05e9bc803f9..63441e34547 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.cpp
+++ b/engines/hpl1/engine/ai/AINodeContainer.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/ai/AINodeContainer.h"
#include "hpl1/engine/scene/World3D.h"
diff --git a/engines/hpl1/engine/ai/AINodeContainer.h b/engines/hpl1/engine/ai/AINodeContainer.h
index 7dcad7da4f8..bf65afa9ca8 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.h
+++ b/engines/hpl1/engine/ai/AINodeContainer.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_AI_NODE_CONTAINER_H
#define HPL_AI_NODE_CONTAINER_H
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.cpp b/engines/hpl1/engine/ai/AINodeGenerator.cpp
index 7ce3aead0f0..5bdcca82324 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.cpp
+++ b/engines/hpl1/engine/ai/AINodeGenerator.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/ai/AINodeGenerator.h"
#include "hpl1/engine/scene/World3D.h"
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.h b/engines/hpl1/engine/ai/AINodeGenerator.h
index 1086d73ffc0..1d84ba68b1e 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.h
+++ b/engines/hpl1/engine/ai/AINodeGenerator.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_AI_NODE_GENERATOR_H
#define HPL_AI_NODE_GENERATOR_H
diff --git a/engines/hpl1/engine/ai/AStar.cpp b/engines/hpl1/engine/ai/AStar.cpp
index 2dcfdf49562..f5848ca7bc9 100644
--- a/engines/hpl1/engine/ai/AStar.cpp
+++ b/engines/hpl1/engine/ai/AStar.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/ai/AStar.h"
#include "hpl1/engine/ai/AINodeContainer.h"
diff --git a/engines/hpl1/engine/ai/AStar.h b/engines/hpl1/engine/ai/AStar.h
index b71f49b2ef7..270264cb6c4 100644
--- a/engines/hpl1/engine/ai/AStar.h
+++ b/engines/hpl1/engine/ai/AStar.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_A_STAR_H
#define HPL_A_STAR_H
diff --git a/engines/hpl1/engine/ai/StateMachine.cpp b/engines/hpl1/engine/ai/StateMachine.cpp
index e0160ce02e1..ef618da6257 100644
--- a/engines/hpl1/engine/ai/StateMachine.cpp
+++ b/engines/hpl1/engine/ai/StateMachine.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/ai/StateMachine.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/ai/StateMachine.h b/engines/hpl1/engine/ai/StateMachine.h
index 9d7a0b57a49..f410653de65 100644
--- a/engines/hpl1/engine/ai/StateMachine.h
+++ b/engines/hpl1/engine/ai/StateMachine.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_STATE_MACHINE_H
#define HPL_STATE_MACHINE_H
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index ff8b35bdaeb..42861f55aca 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/game/Game.h"
#include "hpl1/engine/system/System.h"
diff --git a/engines/hpl1/engine/game/Game.h b/engines/hpl1/engine/game/Game.h
index 73ae64b7878..3c73d9c8da1 100644
--- a/engines/hpl1/engine/game/Game.h
+++ b/engines/hpl1/engine/game/Game.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GAME_H
#define HPL_GAME_H
diff --git a/engines/hpl1/engine/game/GameTypes.cpp b/engines/hpl1/engine/game/GameTypes.cpp
index 896bd566d05..6ea578821c7 100644
--- a/engines/hpl1/engine/game/GameTypes.cpp
+++ b/engines/hpl1/engine/game/GameTypes.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/game/GameTypes.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/game/GameTypes.h b/engines/hpl1/engine/game/GameTypes.h
index e0a47399ef9..28c3a22220a 100644
--- a/engines/hpl1/engine/game/GameTypes.h
+++ b/engines/hpl1/engine/game/GameTypes.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GAME_TYPES_H
#define HPL_GAME_TYPES_H
diff --git a/engines/hpl1/engine/game/LowLevelGameSetup.h b/engines/hpl1/engine/game/LowLevelGameSetup.h
index d7ae3e81c7f..fc01dfc3fdb 100644
--- a/engines/hpl1/engine/game/LowLevelGameSetup.h
+++ b/engines/hpl1/engine/game/LowLevelGameSetup.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_LOWLEVELGAMESETUP_H
#define HPL_LOWLEVELGAMESETUP_H
diff --git a/engines/hpl1/engine/game/SaveGame.cpp b/engines/hpl1/engine/game/SaveGame.cpp
index ca21172cb6b..693028e96d3 100644
--- a/engines/hpl1/engine/game/SaveGame.cpp
+++ b/engines/hpl1/engine/game/SaveGame.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/game/SaveGame.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/game/SaveGame.h b/engines/hpl1/engine/game/SaveGame.h
index 626e222d08a..3978e6ac6bf 100644
--- a/engines/hpl1/engine/game/SaveGame.h
+++ b/engines/hpl1/engine/game/SaveGame.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_SAVE_GAME_H
#define HPL_SAVE_GAME_H
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index e25f7d86e05..7e7005e0d0f 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/game/ScriptFuncs.h"
#include <stdlib.h>
diff --git a/engines/hpl1/engine/game/ScriptFuncs.h b/engines/hpl1/engine/game/ScriptFuncs.h
index d0d420acdba..f42e310e42a 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.h
+++ b/engines/hpl1/engine/game/ScriptFuncs.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_SCRIPT_FUNCS_H
#define HPL_SCRIPT_FUNCS_H
diff --git a/engines/hpl1/engine/game/Updateable.h b/engines/hpl1/engine/game/Updateable.h
index c653823676a..90c2d951600 100644
--- a/engines/hpl1/engine/game/Updateable.h
+++ b/engines/hpl1/engine/game/Updateable.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_UPDATEABLE_H
#define HPL_UPDATEABLE_H
diff --git a/engines/hpl1/engine/game/Updater.cpp b/engines/hpl1/engine/game/Updater.cpp
index 43d6c29fd7b..585d2f30894 100644
--- a/engines/hpl1/engine/game/Updater.cpp
+++ b/engines/hpl1/engine/game/Updater.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/game/Updater.h"
#include "hpl1/engine/game/Updateable.h"
diff --git a/engines/hpl1/engine/game/Updater.h b/engines/hpl1/engine/game/Updater.h
index 09b791c38ea..c23c653b550 100644
--- a/engines/hpl1/engine/game/Updater.h
+++ b/engines/hpl1/engine/game/Updater.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_UPDATER_H
#define HPL_UPDATER_H
diff --git a/engines/hpl1/engine/graphics/Animation.cpp b/engines/hpl1/engine/graphics/Animation.cpp
index ee3736f1a33..4fc8d081e5b 100644
--- a/engines/hpl1/engine/graphics/Animation.cpp
+++ b/engines/hpl1/engine/graphics/Animation.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Animation.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/graphics/Animation.h b/engines/hpl1/engine/graphics/Animation.h
index ba653e43eff..f8cc2e40267 100644
--- a/engines/hpl1/engine/graphics/Animation.h
+++ b/engines/hpl1/engine/graphics/Animation.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_ANIMATION_H
#define HPL_ANIMATION_H
diff --git a/engines/hpl1/engine/graphics/AnimationTrack.cpp b/engines/hpl1/engine/graphics/AnimationTrack.cpp
index f9e9c31ecf7..0ad689cf726 100644
--- a/engines/hpl1/engine/graphics/AnimationTrack.cpp
+++ b/engines/hpl1/engine/graphics/AnimationTrack.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/AnimationTrack.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/graphics/AnimationTrack.h b/engines/hpl1/engine/graphics/AnimationTrack.h
index 03e1a0f0bd2..45fe1698759 100644
--- a/engines/hpl1/engine/graphics/AnimationTrack.h
+++ b/engines/hpl1/engine/graphics/AnimationTrack.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_ANIMATION_TRACK_H
#define HPL_ANIMATION_TRACK_H
diff --git a/engines/hpl1/engine/graphics/BackgroundImage.cpp b/engines/hpl1/engine/graphics/BackgroundImage.cpp
index 009d4073b10..77fab873ee0 100644
--- a/engines/hpl1/engine/graphics/BackgroundImage.cpp
+++ b/engines/hpl1/engine/graphics/BackgroundImage.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/BackgroundImage.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/graphics/BackgroundImage.h b/engines/hpl1/engine/graphics/BackgroundImage.h
index 8c2d28d0a0c..adb5fc46ea5 100644
--- a/engines/hpl1/engine/graphics/BackgroundImage.h
+++ b/engines/hpl1/engine/graphics/BackgroundImage.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_BACKGROUND_IMAGE_H
#define HPL_BACKGROUND_IMAGE_H
diff --git a/engines/hpl1/engine/graphics/Beam.cpp b/engines/hpl1/engine/graphics/Beam.cpp
index e17ca6044b9..f3a28e4ad52 100644
--- a/engines/hpl1/engine/graphics/Beam.cpp
+++ b/engines/hpl1/engine/graphics/Beam.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Beam.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
diff --git a/engines/hpl1/engine/graphics/Beam.h b/engines/hpl1/engine/graphics/Beam.h
index 298c374eeff..86c1043ae8b 100644
--- a/engines/hpl1/engine/graphics/Beam.h
+++ b/engines/hpl1/engine/graphics/Beam.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_BEAM_H
#define HPL_BEAM_H
diff --git a/engines/hpl1/engine/graphics/BillBoard.cpp b/engines/hpl1/engine/graphics/BillBoard.cpp
index 92c744ea2e8..7c160f11ac0 100644
--- a/engines/hpl1/engine/graphics/BillBoard.cpp
+++ b/engines/hpl1/engine/graphics/BillBoard.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/BillBoard.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
diff --git a/engines/hpl1/engine/graphics/BillBoard.h b/engines/hpl1/engine/graphics/BillBoard.h
index 925f4289387..fc1484d0c08 100644
--- a/engines/hpl1/engine/graphics/BillBoard.h
+++ b/engines/hpl1/engine/graphics/BillBoard.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_BILLBOARD_H
#define HPL_BILLBOARD_H
diff --git a/engines/hpl1/engine/graphics/Bitmap2D.h b/engines/hpl1/engine/graphics/Bitmap2D.h
index 07975afbf85..14abab7f7ca 100644
--- a/engines/hpl1/engine/graphics/Bitmap2D.h
+++ b/engines/hpl1/engine/graphics/Bitmap2D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_BITMAP2D_H
#define HPL_BITMAP2D_H
diff --git a/engines/hpl1/engine/graphics/Bone.cpp b/engines/hpl1/engine/graphics/Bone.cpp
index 54c28b2fdc0..9ee1172cf2b 100644
--- a/engines/hpl1/engine/graphics/Bone.cpp
+++ b/engines/hpl1/engine/graphics/Bone.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Bone.h"
#include "hpl1/engine/graphics/Skeleton.h"
diff --git a/engines/hpl1/engine/graphics/Bone.h b/engines/hpl1/engine/graphics/Bone.h
index bd50446e5d2..7407639dc3b 100644
--- a/engines/hpl1/engine/graphics/Bone.h
+++ b/engines/hpl1/engine/graphics/Bone.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_BONE_H
#define HPL_BONE_H
diff --git a/engines/hpl1/engine/graphics/BoneState.cpp b/engines/hpl1/engine/graphics/BoneState.cpp
index d9985b02746..414994a5345 100644
--- a/engines/hpl1/engine/graphics/BoneState.cpp
+++ b/engines/hpl1/engine/graphics/BoneState.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/BoneState.h"
#include "hpl1/engine/physics/PhysicsBody.h"
diff --git a/engines/hpl1/engine/graphics/BoneState.h b/engines/hpl1/engine/graphics/BoneState.h
index 81bbb6ec72f..3ec8fe73fb9 100644
--- a/engines/hpl1/engine/graphics/BoneState.h
+++ b/engines/hpl1/engine/graphics/BoneState.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_BONE_STATE_H
#define HPL_BONE_STATE_H
diff --git a/engines/hpl1/engine/graphics/Color.cpp b/engines/hpl1/engine/graphics/Color.cpp
index 087513f5a0a..71fe25458f8 100644
--- a/engines/hpl1/engine/graphics/Color.cpp
+++ b/engines/hpl1/engine/graphics/Color.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Color.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Color.h b/engines/hpl1/engine/graphics/Color.h
index 925670fbf57..6a80dc921cd 100644
--- a/engines/hpl1/engine/graphics/Color.h
+++ b/engines/hpl1/engine/graphics/Color.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_COLOR_H
#define HPL_COLOR_H
diff --git a/engines/hpl1/engine/graphics/FontData.cpp b/engines/hpl1/engine/graphics/FontData.cpp
index e8cb4b5a1bb..83d0966e013 100644
--- a/engines/hpl1/engine/graphics/FontData.cpp
+++ b/engines/hpl1/engine/graphics/FontData.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/FontData.h"
#include <stdarg.h>
#include <stdlib.h>
diff --git a/engines/hpl1/engine/graphics/FontData.h b/engines/hpl1/engine/graphics/FontData.h
index a3e67c4ce7f..052a99ba137 100644
--- a/engines/hpl1/engine/graphics/FontData.h
+++ b/engines/hpl1/engine/graphics/FontData.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_FONTDATA_H
#define HPL_FONTDATA_H
diff --git a/engines/hpl1/engine/graphics/GPUProgram.cpp b/engines/hpl1/engine/graphics/GPUProgram.cpp
index 213f0cc4572..fc60e97cfed 100644
--- a/engines/hpl1/engine/graphics/GPUProgram.cpp
+++ b/engines/hpl1/engine/graphics/GPUProgram.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/GPUProgram.h"
namespace hpl{
diff --git a/engines/hpl1/engine/graphics/GPUProgram.h b/engines/hpl1/engine/graphics/GPUProgram.h
index c028bb01a81..b70296a1bf2 100644
--- a/engines/hpl1/engine/graphics/GPUProgram.h
+++ b/engines/hpl1/engine/graphics/GPUProgram.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GPU_PROGRAM_H
#define HPL_GPU_PROGRAM_H
diff --git a/engines/hpl1/engine/graphics/GfxObject.cpp b/engines/hpl1/engine/graphics/GfxObject.cpp
index 4956a444bcf..44812d3e87b 100644
--- a/engines/hpl1/engine/graphics/GfxObject.cpp
+++ b/engines/hpl1/engine/graphics/GfxObject.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/GfxObject.h"
#include "hpl1/engine/graphics/Material.h"
diff --git a/engines/hpl1/engine/graphics/GfxObject.h b/engines/hpl1/engine/graphics/GfxObject.h
index dd35918c106..97646981630 100644
--- a/engines/hpl1/engine/graphics/GfxObject.h
+++ b/engines/hpl1/engine/graphics/GfxObject.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GFX_OBJECT_H
#define HPL_GFX_OBJECT_H
diff --git a/engines/hpl1/engine/graphics/Graphics.cpp b/engines/hpl1/engine/graphics/Graphics.cpp
index 2d11968ccee..93e0223170d 100644
--- a/engines/hpl1/engine/graphics/Graphics.cpp
+++ b/engines/hpl1/engine/graphics/Graphics.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Graphics.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/graphics/Graphics.h b/engines/hpl1/engine/graphics/Graphics.h
index 0c211cd0aa5..9f58004a867 100644
--- a/engines/hpl1/engine/graphics/Graphics.h
+++ b/engines/hpl1/engine/graphics/Graphics.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GRAPHICS_H
#define HPL_GRAPHICS_H
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.cpp b/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
index 1ff7b07803a..d4134908a80 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/GraphicsDrawer.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.h b/engines/hpl1/engine/graphics/GraphicsDrawer.h
index d9f38aa51b9..2c6f7e4e1ca 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.h
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GRAPHICSDRAWER_H
#define HPL_GRAPHICSDRAWER_H
diff --git a/engines/hpl1/engine/graphics/GraphicsTypes.h b/engines/hpl1/engine/graphics/GraphicsTypes.h
index c3839d07bde..b9b6423c8d2 100644
--- a/engines/hpl1/engine/graphics/GraphicsTypes.h
+++ b/engines/hpl1/engine/graphics/GraphicsTypes.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GRAPHICSTYPES_H
#define HPL_GRAPHICSTYPES_H
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.cpp b/engines/hpl1/engine/graphics/ImageEntityData.cpp
index e2c6007ad63..aac6ce53a12 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.cpp
+++ b/engines/hpl1/engine/graphics/ImageEntityData.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/ImageEntityData.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/resources/Resources.h"
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.h b/engines/hpl1/engine/graphics/ImageEntityData.h
index 1d461b85796..55c6aa099d1 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.h
+++ b/engines/hpl1/engine/graphics/ImageEntityData.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_IMAGE_ENTITY_DATA_H
#define HPL_IMAGE_ENTITY_DATA_H
diff --git a/engines/hpl1/engine/graphics/LowLevelGraphics.h b/engines/hpl1/engine/graphics/LowLevelGraphics.h
index 2a2a0d3d26e..420e6507094 100644
--- a/engines/hpl1/engine/graphics/LowLevelGraphics.h
+++ b/engines/hpl1/engine/graphics/LowLevelGraphics.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_LOWLEVELGRAPHICS_H
#define HPL_LOWLEVELGRAPHICS_H
diff --git a/engines/hpl1/engine/graphics/LowLevelPicture.h b/engines/hpl1/engine/graphics/LowLevelPicture.h
index 50dfdfba796..37d513cccc3 100644
--- a/engines/hpl1/engine/graphics/LowLevelPicture.h
+++ b/engines/hpl1/engine/graphics/LowLevelPicture.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_LOWLEVEL_PICTURE_H
#define HPL_LOWLEVEL_PICTURE_H
diff --git a/engines/hpl1/engine/graphics/Material.cpp b/engines/hpl1/engine/graphics/Material.cpp
index 0612d39f425..e8135001cbe 100644
--- a/engines/hpl1/engine/graphics/Material.cpp
+++ b/engines/hpl1/engine/graphics/Material.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/graphics/Renderer3D.h"
diff --git a/engines/hpl1/engine/graphics/Material.h b/engines/hpl1/engine/graphics/Material.h
index b31ba88f8b5..c4213a73f2c 100644
--- a/engines/hpl1/engine/graphics/Material.h
+++ b/engines/hpl1/engine/graphics/Material.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_H
#define HPL_MATERIAL_H
diff --git a/engines/hpl1/engine/graphics/MaterialHandler.cpp b/engines/hpl1/engine/graphics/MaterialHandler.cpp
index 8d376835c83..7c557230cbc 100644
--- a/engines/hpl1/engine/graphics/MaterialHandler.cpp
+++ b/engines/hpl1/engine/graphics/MaterialHandler.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/MaterialHandler.h"
#include "hpl1/engine/resources/ResourceImage.h"
#include "hpl1/engine/graphics/Graphics.h"
diff --git a/engines/hpl1/engine/graphics/MaterialHandler.h b/engines/hpl1/engine/graphics/MaterialHandler.h
index 7a1f11b1348..2527c2a01bc 100644
--- a/engines/hpl1/engine/graphics/MaterialHandler.h
+++ b/engines/hpl1/engine/graphics/MaterialHandler.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIALHANDLER_H
#define HPL_MATERIALHANDLER_H
diff --git a/engines/hpl1/engine/graphics/Material_Additive.cpp b/engines/hpl1/engine/graphics/Material_Additive.cpp
index 290de404542..c6132b0162a 100644
--- a/engines/hpl1/engine/graphics/Material_Additive.cpp
+++ b/engines/hpl1/engine/graphics/Material_Additive.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_Additive.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/graphics/Renderer3D.h"
diff --git a/engines/hpl1/engine/graphics/Material_Additive.h b/engines/hpl1/engine/graphics/Material_Additive.h
index 82ee54fedf1..cd274dd8a24 100644
--- a/engines/hpl1/engine/graphics/Material_Additive.h
+++ b/engines/hpl1/engine/graphics/Material_Additive.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_ADDITIVE_H
#define HPL_MATERIAL_ADDITIVE_H
diff --git a/engines/hpl1/engine/graphics/Material_Alpha.cpp b/engines/hpl1/engine/graphics/Material_Alpha.cpp
index cb05cbf2cca..526ca2204f9 100644
--- a/engines/hpl1/engine/graphics/Material_Alpha.cpp
+++ b/engines/hpl1/engine/graphics/Material_Alpha.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_Alpha.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/graphics/Renderer3D.h"
diff --git a/engines/hpl1/engine/graphics/Material_Alpha.h b/engines/hpl1/engine/graphics/Material_Alpha.h
index 96f5ef7c0e0..0be0041acbc 100644
--- a/engines/hpl1/engine/graphics/Material_Alpha.h
+++ b/engines/hpl1/engine/graphics/Material_Alpha.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_ALPHA_H
#define HPL_MATERIAL_ALPHA_H
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
index 429b1be30d2..e385bd33127 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_BaseLight.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/scene/Light.h"
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.h b/engines/hpl1/engine/graphics/Material_BaseLight.h
index cc10111b845..33a74ab91b1 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_BASE_LIGHT_H
#define HPL_MATERIAL_BASE_LIGHT_H
diff --git a/engines/hpl1/engine/graphics/Material_Bump.cpp b/engines/hpl1/engine/graphics/Material_Bump.cpp
index 55b3f21bb8b..db59347bf8c 100644
--- a/engines/hpl1/engine/graphics/Material_Bump.cpp
+++ b/engines/hpl1/engine/graphics/Material_Bump.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_Bump.h"
#include "hpl1/engine/graphics/Material_Fallback01_BaseLight.h"
diff --git a/engines/hpl1/engine/graphics/Material_Bump.h b/engines/hpl1/engine/graphics/Material_Bump.h
index 7b1e1922312..c89faf88c2f 100644
--- a/engines/hpl1/engine/graphics/Material_Bump.h
+++ b/engines/hpl1/engine/graphics/Material_Bump.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_BUMP_H
#define HPL_MATERIAL_BUMP_H
diff --git a/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp b/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
index ad1cf28705d..8bfbe349ff8 100644
--- a/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_BumpColorSpec.h"
#include "hpl1/engine/graphics/Material_Fallback01_BaseLight.h"
diff --git a/engines/hpl1/engine/graphics/Material_BumpColorSpec.h b/engines/hpl1/engine/graphics/Material_BumpColorSpec.h
index dd54b8e5800..fd6613051e0 100644
--- a/engines/hpl1/engine/graphics/Material_BumpColorSpec.h
+++ b/engines/hpl1/engine/graphics/Material_BumpColorSpec.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_BUMP_COLOR_SPEC_H
#define HPL_MATERIAL_BUMP_COLOR_SPEC_H
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec.cpp b/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
index 50f2e550a56..44ddcf85a82 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_BumpSpec.h"
#include "hpl1/engine/graphics/Material_Fallback01_BaseLight.h"
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec.h b/engines/hpl1/engine/graphics/Material_BumpSpec.h
index 2581b4a1f8f..a71ecb4e131 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec.h
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_BUMP_SPEC_H
#define HPL_MATERIAL_BUMP_SPEC_H
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp b/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
index 7f6c5e4659a..aaf815aabb9 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_BumpSpec2D.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/scene/Light.h"
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec2D.h b/engines/hpl1/engine/graphics/Material_BumpSpec2D.h
index f4c0190cb53..73d4b4eb502 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec2D.h
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec2D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_BUMP_SPEC2D_H
#define HPL_MATERIAL_BUMP_SPEC2D_H
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse.cpp b/engines/hpl1/engine/graphics/Material_Diffuse.cpp
index 3c73b82a61a..f3c69f083c2 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse.cpp
+++ b/engines/hpl1/engine/graphics/Material_Diffuse.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_Diffuse.h"
#include "hpl1/engine/graphics/Material_Fallback01_BaseLight.h"
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse.h b/engines/hpl1/engine/graphics/Material_Diffuse.h
index d3d1003983e..4f0e9705c32 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse.h
+++ b/engines/hpl1/engine/graphics/Material_Diffuse.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_DIFFUSE_H
#define HPL_MATERIAL_DIFFUSE_H
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse2D.cpp b/engines/hpl1/engine/graphics/Material_Diffuse2D.cpp
index f3a44a8ec2c..d1261d8ab4c 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse2D.cpp
+++ b/engines/hpl1/engine/graphics/Material_Diffuse2D.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_Diffuse2D.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/scene/Light.h"
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse2D.h b/engines/hpl1/engine/graphics/Material_Diffuse2D.h
index 6d54c438246..9f5f8310ca5 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse2D.h
+++ b/engines/hpl1/engine/graphics/Material_Diffuse2D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_DIFFUSE2D_H
#define HPL_MATERIAL_DIFFUSE2D_H
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.cpp b/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.cpp
index 7a6c90690cf..6c3c2881b6d 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.cpp
+++ b/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_DiffuseAdditive2D.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h b/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
index 98c924d794e..8f958432e49 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
+++ b/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_DIFFUSE_ADDITIVE2D_H
#define HPL_MATERIAL_DIFFUSE_ADDITIVE2D_H
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.cpp b/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.cpp
index 88b0ed614f6..7cbc354f472 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.cpp
+++ b/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_DiffuseAlpha2D.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h b/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
index c2dbc72a161..130a4521626 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
+++ b/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_DIFFUSE_ALPHA2D_H
#define HPL_MATERIAL_DIFFUSE_ALPHA2D_H
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp b/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
index 884e38b04f3..b3c5bd571ad 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_DiffuseSpec.h"
#include "hpl1/engine/graphics/Material_Fallback01_BaseLight.h"
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseSpec.h b/engines/hpl1/engine/graphics/Material_DiffuseSpec.h
index ca423471dc6..2c81f445f47 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseSpec.h
+++ b/engines/hpl1/engine/graphics/Material_DiffuseSpec.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_DIFFUSE_SPEC_H
#define HPL_MATERIAL_DIFFUSE_SPEC_H
diff --git a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
index d3f96eec9e5..7208f71c94b 100644
--- a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
+++ b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_EnvMap_Reflect.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/graphics/Renderer3D.h"
diff --git a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
index ac7fe1e2dbb..670dd3e5e93 100644
--- a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
+++ b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_ENVMAP_REFLECT_H
#define HPL_MATERIAL_ENVMAP_REFLECT_H
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
index fa6d3f48afe..cb36bc24225 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_Fallback01_BaseLight.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/scene/Light.h"
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
index b273c123ae5..3918a59a011 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_FALLBACK01_BASE_LIGHT_H
#define HPL_MATERIAL_FALLBACK01_BASE_LIGHT_H
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
index 4b6808fb82d..4ff7614c4b4 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_Fallback02_BaseLight.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/scene/Light.h"
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
index a1c18008578..697b7dbbbfa 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_FALLBACK02_BASE_LIGHT_H
#define HPL_MATERIAL_FALLBACK02_BASE_LIGHT_H
diff --git a/engines/hpl1/engine/graphics/Material_Flat.cpp b/engines/hpl1/engine/graphics/Material_Flat.cpp
index 3fc6d776b71..71093cf2277 100644
--- a/engines/hpl1/engine/graphics/Material_Flat.cpp
+++ b/engines/hpl1/engine/graphics/Material_Flat.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_Flat.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/scene/Light.h"
diff --git a/engines/hpl1/engine/graphics/Material_Flat.h b/engines/hpl1/engine/graphics/Material_Flat.h
index d8f3ebe8f69..ce6b3e957ae 100644
--- a/engines/hpl1/engine/graphics/Material_Flat.h
+++ b/engines/hpl1/engine/graphics/Material_Flat.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_FLAT_H
#define HPL_MATERIAL_FLAT_H
diff --git a/engines/hpl1/engine/graphics/Material_FontNormal.cpp b/engines/hpl1/engine/graphics/Material_FontNormal.cpp
index 7cff5c1f2b7..c49c8717350 100644
--- a/engines/hpl1/engine/graphics/Material_FontNormal.cpp
+++ b/engines/hpl1/engine/graphics/Material_FontNormal.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_FontNormal.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Material_FontNormal.h b/engines/hpl1/engine/graphics/Material_FontNormal.h
index 4f977a1bb97..4e1e3b188da 100644
--- a/engines/hpl1/engine/graphics/Material_FontNormal.h
+++ b/engines/hpl1/engine/graphics/Material_FontNormal.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_FONTNORMAL_H
#define HPL_MATERIAL_FONTNORMAL_H
diff --git a/engines/hpl1/engine/graphics/Material_Modulative.cpp b/engines/hpl1/engine/graphics/Material_Modulative.cpp
index 6d32eed49ed..675836167fc 100644
--- a/engines/hpl1/engine/graphics/Material_Modulative.cpp
+++ b/engines/hpl1/engine/graphics/Material_Modulative.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_Modulative.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/graphics/Renderer3D.h"
diff --git a/engines/hpl1/engine/graphics/Material_Modulative.h b/engines/hpl1/engine/graphics/Material_Modulative.h
index 2585695fcce..e0aebde1ea9 100644
--- a/engines/hpl1/engine/graphics/Material_Modulative.h
+++ b/engines/hpl1/engine/graphics/Material_Modulative.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_MODULATIVE_H
#define HPL_MATERIAL_MODULATIVE_H
diff --git a/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp b/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
index 2d16ea44b46..0167aa421bf 100644
--- a/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
+++ b/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_ModulativeX2.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/graphics/Renderer3D.h"
diff --git a/engines/hpl1/engine/graphics/Material_ModulativeX2.h b/engines/hpl1/engine/graphics/Material_ModulativeX2.h
index 21e85b7bc8a..4b40ed72e49 100644
--- a/engines/hpl1/engine/graphics/Material_ModulativeX2.h
+++ b/engines/hpl1/engine/graphics/Material_ModulativeX2.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_MODULATIVE_X_2_H
#define HPL_MATERIAL_MODULATIVE_X_2_H
diff --git a/engines/hpl1/engine/graphics/Material_Smoke2D.cpp b/engines/hpl1/engine/graphics/Material_Smoke2D.cpp
index 79493a7d551..bf0ff2d484a 100644
--- a/engines/hpl1/engine/graphics/Material_Smoke2D.cpp
+++ b/engines/hpl1/engine/graphics/Material_Smoke2D.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_Smoke2D.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Material_Smoke2D.h b/engines/hpl1/engine/graphics/Material_Smoke2D.h
index aa338d8d201..8f00664521a 100644
--- a/engines/hpl1/engine/graphics/Material_Smoke2D.h
+++ b/engines/hpl1/engine/graphics/Material_Smoke2D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_SMOKE2D_H
#define HPL_MATERIAL_SMOKE2D_H
diff --git a/engines/hpl1/engine/graphics/Material_Water.cpp b/engines/hpl1/engine/graphics/Material_Water.cpp
index edfd8613722..42fcaf64924 100644
--- a/engines/hpl1/engine/graphics/Material_Water.cpp
+++ b/engines/hpl1/engine/graphics/Material_Water.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Material_Water.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/graphics/Renderer3D.h"
diff --git a/engines/hpl1/engine/graphics/Material_Water.h b/engines/hpl1/engine/graphics/Material_Water.h
index 1370bdf5f03..baa5589f563 100644
--- a/engines/hpl1/engine/graphics/Material_Water.h
+++ b/engines/hpl1/engine/graphics/Material_Water.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MATERIAL_WATER_H
#define HPL_MATERIAL_WATER_H
diff --git a/engines/hpl1/engine/graphics/Mesh.cpp b/engines/hpl1/engine/graphics/Mesh.cpp
index 0a3a14f6a54..043ec0a3ab6 100644
--- a/engines/hpl1/engine/graphics/Mesh.cpp
+++ b/engines/hpl1/engine/graphics/Mesh.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Mesh.h"
#include "hpl1/engine/graphics/SubMesh.h"
diff --git a/engines/hpl1/engine/graphics/Mesh.h b/engines/hpl1/engine/graphics/Mesh.h
index bd67a193202..3072dc0f793 100644
--- a/engines/hpl1/engine/graphics/Mesh.h
+++ b/engines/hpl1/engine/graphics/Mesh.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MESH_H
#define HPL_MESH_H
diff --git a/engines/hpl1/engine/graphics/Mesh2d.cpp b/engines/hpl1/engine/graphics/Mesh2d.cpp
index c78a889779a..3a632b10c4e 100644
--- a/engines/hpl1/engine/graphics/Mesh2d.cpp
+++ b/engines/hpl1/engine/graphics/Mesh2d.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Mesh2d.h"
#include <math.h>
#include "hpl1/engine/math/MathTypes.h"
diff --git a/engines/hpl1/engine/graphics/Mesh2d.h b/engines/hpl1/engine/graphics/Mesh2d.h
index 6b8bbe79311..b596ebd8382 100644
--- a/engines/hpl1/engine/graphics/Mesh2d.h
+++ b/engines/hpl1/engine/graphics/Mesh2d.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MESH2D_H
#define HPL_MESH2D_H
diff --git a/engines/hpl1/engine/graphics/MeshCreator.cpp b/engines/hpl1/engine/graphics/MeshCreator.cpp
index e93c8913651..615977a4bd9 100644
--- a/engines/hpl1/engine/graphics/MeshCreator.cpp
+++ b/engines/hpl1/engine/graphics/MeshCreator.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/MeshCreator.h"
#include "hpl1/engine/graphics/Mesh2d.h"
#include "hpl1/engine/system/String.h"
diff --git a/engines/hpl1/engine/graphics/MeshCreator.h b/engines/hpl1/engine/graphics/MeshCreator.h
index 043e425e1f5..9b6cd8498b5 100644
--- a/engines/hpl1/engine/graphics/MeshCreator.h
+++ b/engines/hpl1/engine/graphics/MeshCreator.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MESHCREATOR_H
#define HPL_MESHCREATOR_H
diff --git a/engines/hpl1/engine/graphics/OcclusionQuery.h b/engines/hpl1/engine/graphics/OcclusionQuery.h
index 94171e2711a..1d4ea412c29 100644
--- a/engines/hpl1/engine/graphics/OcclusionQuery.h
+++ b/engines/hpl1/engine/graphics/OcclusionQuery.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_OCCLUSION_QUERY_H
#define HPL_OCCLUSION_QUERY_H
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter.cpp b/engines/hpl1/engine/graphics/ParticleEmitter.cpp
index df3602ab1d3..1a14a53081c 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/ParticleEmitter.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/resources/Resources.h"
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter.h b/engines/hpl1/engine/graphics/ParticleEmitter.h
index 28e33f72d3a..11264f10fef 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PARTICLE_EMITTER_H
#define HPL_PARTICLE_EMITTER_H
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter2D.cpp b/engines/hpl1/engine/graphics/ParticleEmitter2D.cpp
index ce26d9d7e35..63ed5b57ff5 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter2D.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter2D.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
/*#include "hpl1/engine/graphics/ParticleSystem2D.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/resources/Resources.h"
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter2D.h b/engines/hpl1/engine/graphics/ParticleEmitter2D.h
index f970fd7db42..d9fc7cb02a3 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter2D.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter2D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
/*#ifndef HPL_PARTICLE_SYSTEM_2D_H
#define HPL_PARTICLE_SYSTEM_2D_H
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp b/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
index 561c1c3b302..f03b3aca84c 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/ParticleEmitter3D.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/resources/Resources.h"
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D.h b/engines/hpl1/engine/graphics/ParticleEmitter3D.h
index 1cd7ee25944..7dc91d619f1 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PARTICLE_EMITTER_3D_H
#define HPL_PARTICLE_EMITTER_3D_H
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
index b2f3f7e4c1b..d5db7b78b9a 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
// NEW
#include "hpl1/engine/graphics/Graphics.h"
// ---
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
index 069635eaf85..7bcb66346b0 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PARTICLE_EMITTER_3D_USER_DATA_H
#define HPL_PARTICLE_EMITTER_3D_USER_DATA_H
diff --git a/engines/hpl1/engine/graphics/ParticleSystem3D.cpp b/engines/hpl1/engine/graphics/ParticleSystem3D.cpp
index 73aa68c15f5..fa6a0b2fe21 100644
--- a/engines/hpl1/engine/graphics/ParticleSystem3D.cpp
+++ b/engines/hpl1/engine/graphics/ParticleSystem3D.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/ParticleSystem3D.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
diff --git a/engines/hpl1/engine/graphics/ParticleSystem3D.h b/engines/hpl1/engine/graphics/ParticleSystem3D.h
index a2d6041f7e4..0343ede4afb 100644
--- a/engines/hpl1/engine/graphics/ParticleSystem3D.h
+++ b/engines/hpl1/engine/graphics/ParticleSystem3D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PARTICLE_SYSTEM_3D_H
#define HPL_PARTICLE_SYSTEM_3D_H
diff --git a/engines/hpl1/engine/graphics/PixelFormat.h b/engines/hpl1/engine/graphics/PixelFormat.h
index b3c752cf4bc..fbcb2aec7e3 100644
--- a/engines/hpl1/engine/graphics/PixelFormat.h
+++ b/engines/hpl1/engine/graphics/PixelFormat.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PIXELFORMAT_H
#define HPL_PIXELFORMAT_H
diff --git a/engines/hpl1/engine/graphics/RenderList.cpp b/engines/hpl1/engine/graphics/RenderList.cpp
index 1757c29fb6e..e8de1d9c78d 100644
--- a/engines/hpl1/engine/graphics/RenderList.cpp
+++ b/engines/hpl1/engine/graphics/RenderList.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/RenderList.h"
#include "hpl1/engine/graphics/Renderable.h"
#include "hpl1/engine/scene/MeshEntity.h"
diff --git a/engines/hpl1/engine/graphics/RenderList.h b/engines/hpl1/engine/graphics/RenderList.h
index a91607c7c49..8732258ac64 100644
--- a/engines/hpl1/engine/graphics/RenderList.h
+++ b/engines/hpl1/engine/graphics/RenderList.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_RENDER_LIST_H
#define HPL_RENDER_LIST_H
diff --git a/engines/hpl1/engine/graphics/RenderObject2D.cpp b/engines/hpl1/engine/graphics/RenderObject2D.cpp
index 6e9cfd3b403..34c70201415 100644
--- a/engines/hpl1/engine/graphics/RenderObject2D.cpp
+++ b/engines/hpl1/engine/graphics/RenderObject2D.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/RenderObject2D.h"
#include "hpl1/engine/graphics/Material.h"
diff --git a/engines/hpl1/engine/graphics/RenderObject2D.h b/engines/hpl1/engine/graphics/RenderObject2D.h
index f8756da09c4..6a8b2eba022 100644
--- a/engines/hpl1/engine/graphics/RenderObject2D.h
+++ b/engines/hpl1/engine/graphics/RenderObject2D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_RENDEROBJECT2D_H
#define HPL_RENDEROBJECT2D_H
diff --git a/engines/hpl1/engine/graphics/RenderState.cpp b/engines/hpl1/engine/graphics/RenderState.cpp
index 1f4ab272d24..5a9396e7896 100644
--- a/engines/hpl1/engine/graphics/RenderState.cpp
+++ b/engines/hpl1/engine/graphics/RenderState.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/RenderState.h"
#include "hpl1/engine/graphics/Renderer3D.h"
diff --git a/engines/hpl1/engine/graphics/RenderState.h b/engines/hpl1/engine/graphics/RenderState.h
index 717e036e256..0062bead093 100644
--- a/engines/hpl1/engine/graphics/RenderState.h
+++ b/engines/hpl1/engine/graphics/RenderState.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_RENDER_SET_H
#define HPL_RENDER_SET_H
diff --git a/engines/hpl1/engine/graphics/Renderable.cpp b/engines/hpl1/engine/graphics/Renderable.cpp
index b3b2cf6fe69..038f3f2d092 100644
--- a/engines/hpl1/engine/graphics/Renderable.cpp
+++ b/engines/hpl1/engine/graphics/Renderable.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Renderable.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/graphics/Renderable.h b/engines/hpl1/engine/graphics/Renderable.h
index 62528c0f2cd..b7a6e0e926c 100644
--- a/engines/hpl1/engine/graphics/Renderable.h
+++ b/engines/hpl1/engine/graphics/Renderable.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_RENDERABLE_H
#define HPL_RENDERABLE_H
diff --git a/engines/hpl1/engine/graphics/Renderer2D.cpp b/engines/hpl1/engine/graphics/Renderer2D.cpp
index f36957f4dd3..13aa7f8eb6d 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer2D.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/graphics/Texture.h"
#include "hpl1/engine/scene/Light2D.h"
diff --git a/engines/hpl1/engine/graphics/Renderer2D.h b/engines/hpl1/engine/graphics/Renderer2D.h
index 1efdb1d9405..3efae5078dc 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.h
+++ b/engines/hpl1/engine/graphics/Renderer2D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_RENDERER2D_H
#define HPL_RENDERER2D_H
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index 919e088010a..df80bc09beb 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Renderer3D.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/graphics/Renderer3D.h b/engines/hpl1/engine/graphics/Renderer3D.h
index 71c73ec67be..eac6523f22d 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.h
+++ b/engines/hpl1/engine/graphics/Renderer3D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_RENDERER3D_H
#define HPL_RENDERER3D_H
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.cpp b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
index 6bb22a8cabd..12ded3ec530 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.cpp
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/RendererPostEffects.h"
#include "hpl1/engine/graphics/Texture.h"
#include "hpl1/engine/scene/Scene.h"
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.h b/engines/hpl1/engine/graphics/RendererPostEffects.h
index e55943a20a3..f8f7be5d943 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.h
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_RENDERER_POST_EFFECTS_H
#define HPL_RENDERER_POST_EFFECTS_H
diff --git a/engines/hpl1/engine/graphics/Skeleton.cpp b/engines/hpl1/engine/graphics/Skeleton.cpp
index e1d5de1bfc6..e85a956f450 100644
--- a/engines/hpl1/engine/graphics/Skeleton.cpp
+++ b/engines/hpl1/engine/graphics/Skeleton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/Skeleton.h"
#include "hpl1/engine/graphics/Bone.h"
diff --git a/engines/hpl1/engine/graphics/Skeleton.h b/engines/hpl1/engine/graphics/Skeleton.h
index 82dc038259d..b2d42d4cbe2 100644
--- a/engines/hpl1/engine/graphics/Skeleton.h
+++ b/engines/hpl1/engine/graphics/Skeleton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_SKELETON_H
#define HPL_SKELETON_H
diff --git a/engines/hpl1/engine/graphics/SubMesh.cpp b/engines/hpl1/engine/graphics/SubMesh.cpp
index f02078f1d0e..2a46db1963b 100644
--- a/engines/hpl1/engine/graphics/SubMesh.cpp
+++ b/engines/hpl1/engine/graphics/SubMesh.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/graphics/SubMesh.h"
#include "hpl1/engine/graphics/Mesh.h"
diff --git a/engines/hpl1/engine/graphics/SubMesh.h b/engines/hpl1/engine/graphics/SubMesh.h
index 21fde55c31b..9086da45a61 100644
--- a/engines/hpl1/engine/graphics/SubMesh.h
+++ b/engines/hpl1/engine/graphics/SubMesh.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_SUB_MESH_H
#define HPL_SUB_MESH_H
diff --git a/engines/hpl1/engine/graphics/Texture.h b/engines/hpl1/engine/graphics/Texture.h
index e6de9916cd7..37ec36f6c0b 100644
--- a/engines/hpl1/engine/graphics/Texture.h
+++ b/engines/hpl1/engine/graphics/Texture.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_TEXTURE_H
#define HPL_TEXTURE_H
diff --git a/engines/hpl1/engine/graphics/VertexBuffer.h b/engines/hpl1/engine/graphics/VertexBuffer.h
index f37b5974cd6..71860f109ac 100644
--- a/engines/hpl1/engine/graphics/VertexBuffer.h
+++ b/engines/hpl1/engine/graphics/VertexBuffer.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_VERTEXBUFFER_H
#define HPL_VERTEXBUFFER_H
diff --git a/engines/hpl1/engine/graphics/VideoStream.h b/engines/hpl1/engine/graphics/VideoStream.h
index b8ba55f1930..45b92fc8e49 100644
--- a/engines/hpl1/engine/graphics/VideoStream.h
+++ b/engines/hpl1/engine/graphics/VideoStream.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_VIDEO_STREAM_H
#define HPL_VIDEO_STREAM_H
diff --git a/engines/hpl1/engine/gui/Gui.cpp b/engines/hpl1/engine/gui/Gui.cpp
index 94af8e13cb1..81dea141a19 100644
--- a/engines/hpl1/engine/gui/Gui.cpp
+++ b/engines/hpl1/engine/gui/Gui.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/Gui.h"
#include "hpl1/engine/graphics/Graphics.h"
diff --git a/engines/hpl1/engine/gui/Gui.h b/engines/hpl1/engine/gui/Gui.h
index cd654cae7ba..9cba2c5b517 100644
--- a/engines/hpl1/engine/gui/Gui.h
+++ b/engines/hpl1/engine/gui/Gui.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GUI_H
#define HPL_GUI_H
diff --git a/engines/hpl1/engine/gui/GuiGfxElement.cpp b/engines/hpl1/engine/gui/GuiGfxElement.cpp
index 63f45903754..cc7e5ff2cd9 100644
--- a/engines/hpl1/engine/gui/GuiGfxElement.cpp
+++ b/engines/hpl1/engine/gui/GuiGfxElement.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/GuiGfxElement.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/GuiGfxElement.h b/engines/hpl1/engine/gui/GuiGfxElement.h
index ddaf8315f9e..27a989b2fda 100644
--- a/engines/hpl1/engine/gui/GuiGfxElement.h
+++ b/engines/hpl1/engine/gui/GuiGfxElement.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GUI_GFX_ELEMENT_H
#define HPL_GUI_GFX_ELEMENT_H
diff --git a/engines/hpl1/engine/gui/GuiMaterial.h b/engines/hpl1/engine/gui/GuiMaterial.h
index aafb5a922de..03ba4ac85b0 100644
--- a/engines/hpl1/engine/gui/GuiMaterial.h
+++ b/engines/hpl1/engine/gui/GuiMaterial.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GUI_MATERIAL_H
#define HPL_GUI_MATERIAL_H
diff --git a/engines/hpl1/engine/gui/GuiMaterialBasicTypes.cpp b/engines/hpl1/engine/gui/GuiMaterialBasicTypes.cpp
index 0e45d9f693e..cda00ef4951 100644
--- a/engines/hpl1/engine/gui/GuiMaterialBasicTypes.cpp
+++ b/engines/hpl1/engine/gui/GuiMaterialBasicTypes.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/GuiMaterialBasicTypes.h"
#include "hpl1/engine/graphics/LowLevelGraphics.h"
diff --git a/engines/hpl1/engine/gui/GuiMaterialBasicTypes.h b/engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
index 740d5a40035..894389d0b9d 100644
--- a/engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
+++ b/engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GUI_MATERIAL_BASIC_TYPES_H
#define HPL_GUI_MATERIAL_BASIC_TYPES_H
diff --git a/engines/hpl1/engine/gui/GuiPopUp.cpp b/engines/hpl1/engine/gui/GuiPopUp.cpp
index 54ffa856b11..7fa0af1c433 100644
--- a/engines/hpl1/engine/gui/GuiPopUp.cpp
+++ b/engines/hpl1/engine/gui/GuiPopUp.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/GuiPopUp.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/GuiPopUp.h b/engines/hpl1/engine/gui/GuiPopUp.h
index e3de3daf090..9976ddc34bc 100644
--- a/engines/hpl1/engine/gui/GuiPopUp.h
+++ b/engines/hpl1/engine/gui/GuiPopUp.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GUI_POP_UP_H
#define HPL_GUI_POP_UP_H
diff --git a/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp b/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
index 2dc4097fcb2..4f9e06be27f 100644
--- a/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
+++ b/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/GuiPopUpMessageBox.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/GuiPopUpMessageBox.h b/engines/hpl1/engine/gui/GuiPopUpMessageBox.h
index d3d7cbd28b5..f9e8dbc9bcd 100644
--- a/engines/hpl1/engine/gui/GuiPopUpMessageBox.h
+++ b/engines/hpl1/engine/gui/GuiPopUpMessageBox.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GUI_POP_UP_MESSAGE_BOX_H
#define HPL_GUI_POP_UP_MESSAGE_BOX_H
diff --git a/engines/hpl1/engine/gui/GuiSet.cpp b/engines/hpl1/engine/gui/GuiSet.cpp
index 12375b3d143..3a912a5ee64 100644
--- a/engines/hpl1/engine/gui/GuiSet.cpp
+++ b/engines/hpl1/engine/gui/GuiSet.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/GuiSet.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/GuiSet.h b/engines/hpl1/engine/gui/GuiSet.h
index ccf7332383a..0cfdfac217b 100644
--- a/engines/hpl1/engine/gui/GuiSet.h
+++ b/engines/hpl1/engine/gui/GuiSet.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GUI_SET_H
#define HPL_GUI_SET_H
diff --git a/engines/hpl1/engine/gui/GuiSkin.cpp b/engines/hpl1/engine/gui/GuiSkin.cpp
index 2d653643052..36b5486857f 100644
--- a/engines/hpl1/engine/gui/GuiSkin.cpp
+++ b/engines/hpl1/engine/gui/GuiSkin.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/GuiSkin.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/GuiSkin.h b/engines/hpl1/engine/gui/GuiSkin.h
index 1b99b4d04f4..db95fad3be6 100644
--- a/engines/hpl1/engine/gui/GuiSkin.h
+++ b/engines/hpl1/engine/gui/GuiSkin.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GUI_SKIN_H
#define HPL_GUI_SKIN_H
diff --git a/engines/hpl1/engine/gui/GuiTypes.h b/engines/hpl1/engine/gui/GuiTypes.h
index 3b47a1bec9d..25f49ac6da5 100644
--- a/engines/hpl1/engine/gui/GuiTypes.h
+++ b/engines/hpl1/engine/gui/GuiTypes.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_GUI_TYPES_H
#define HPL_GUI_TYPES_H
diff --git a/engines/hpl1/engine/gui/Widget.cpp b/engines/hpl1/engine/gui/Widget.cpp
index 6ef8de2baeb..14d87899b5e 100644
--- a/engines/hpl1/engine/gui/Widget.cpp
+++ b/engines/hpl1/engine/gui/Widget.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/Widget.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/Widget.h b/engines/hpl1/engine/gui/Widget.h
index 0a2bb638a62..c1bd6bea230 100644
--- a/engines/hpl1/engine/gui/Widget.h
+++ b/engines/hpl1/engine/gui/Widget.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_WIDGET_H
#define HPL_WIDGET_H
diff --git a/engines/hpl1/engine/gui/WidgetBaseClasses.cpp b/engines/hpl1/engine/gui/WidgetBaseClasses.cpp
index d127b1243bd..c8f17f1ff52 100644
--- a/engines/hpl1/engine/gui/WidgetBaseClasses.cpp
+++ b/engines/hpl1/engine/gui/WidgetBaseClasses.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/WidgetBaseClasses.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/WidgetBaseClasses.h b/engines/hpl1/engine/gui/WidgetBaseClasses.h
index 61b6b614eac..df3f0c2dff4 100644
--- a/engines/hpl1/engine/gui/WidgetBaseClasses.h
+++ b/engines/hpl1/engine/gui/WidgetBaseClasses.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_WIDGET_BASE_CLASSES_H
#define HPL_WIDGET_BASE_CLASSES_H
diff --git a/engines/hpl1/engine/gui/WidgetButton.cpp b/engines/hpl1/engine/gui/WidgetButton.cpp
index 6c62a93a332..ebcedac6231 100644
--- a/engines/hpl1/engine/gui/WidgetButton.cpp
+++ b/engines/hpl1/engine/gui/WidgetButton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/WidgetButton.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/WidgetButton.h b/engines/hpl1/engine/gui/WidgetButton.h
index 79798795cc7..2b73c3b40a6 100644
--- a/engines/hpl1/engine/gui/WidgetButton.h
+++ b/engines/hpl1/engine/gui/WidgetButton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_WIDGET_BUTTON_H
#define HPL_WIDGET_BUTTON_H
diff --git a/engines/hpl1/engine/gui/WidgetCheckBox.cpp b/engines/hpl1/engine/gui/WidgetCheckBox.cpp
index 3879018c3f5..2e88c01fb2a 100644
--- a/engines/hpl1/engine/gui/WidgetCheckBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetCheckBox.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/WidgetCheckBox.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/WidgetCheckBox.h b/engines/hpl1/engine/gui/WidgetCheckBox.h
index 9f456d51e49..542be4ed21d 100644
--- a/engines/hpl1/engine/gui/WidgetCheckBox.h
+++ b/engines/hpl1/engine/gui/WidgetCheckBox.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_WIDGET_CHECK_BOX_H
#define HPL_WIDGET_CHECK_BOX_H
diff --git a/engines/hpl1/engine/gui/WidgetComboBox.cpp b/engines/hpl1/engine/gui/WidgetComboBox.cpp
index 41bc76dd7be..c149ac54b25 100644
--- a/engines/hpl1/engine/gui/WidgetComboBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetComboBox.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/WidgetComboBox.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/WidgetComboBox.h b/engines/hpl1/engine/gui/WidgetComboBox.h
index 2fc261fec1f..3482a3aa976 100644
--- a/engines/hpl1/engine/gui/WidgetComboBox.h
+++ b/engines/hpl1/engine/gui/WidgetComboBox.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_WIDGET_COMBO_BOX_H
#define HPL_WIDGET_COMBO_BOX_H
diff --git a/engines/hpl1/engine/gui/WidgetFrame.cpp b/engines/hpl1/engine/gui/WidgetFrame.cpp
index 5a3752a33f3..41773e32d42 100644
--- a/engines/hpl1/engine/gui/WidgetFrame.cpp
+++ b/engines/hpl1/engine/gui/WidgetFrame.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/WidgetFrame.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/WidgetFrame.h b/engines/hpl1/engine/gui/WidgetFrame.h
index dada0f277ea..f6cbf98d887 100644
--- a/engines/hpl1/engine/gui/WidgetFrame.h
+++ b/engines/hpl1/engine/gui/WidgetFrame.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_WIDGET_FRAME_H
#define HPL_WIDGET_FRAME_H
diff --git a/engines/hpl1/engine/gui/WidgetImage.cpp b/engines/hpl1/engine/gui/WidgetImage.cpp
index b15eb4f7f56..7b014852acc 100644
--- a/engines/hpl1/engine/gui/WidgetImage.cpp
+++ b/engines/hpl1/engine/gui/WidgetImage.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/WidgetImage.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/WidgetImage.h b/engines/hpl1/engine/gui/WidgetImage.h
index 988ddce26fe..d40b23a528f 100644
--- a/engines/hpl1/engine/gui/WidgetImage.h
+++ b/engines/hpl1/engine/gui/WidgetImage.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_WIDGET_IMAGE_H
#define HPL_WIDGET_IMAGE_H
diff --git a/engines/hpl1/engine/gui/WidgetLabel.cpp b/engines/hpl1/engine/gui/WidgetLabel.cpp
index f67090cafe1..73c339308be 100644
--- a/engines/hpl1/engine/gui/WidgetLabel.cpp
+++ b/engines/hpl1/engine/gui/WidgetLabel.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/WidgetLabel.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/WidgetLabel.h b/engines/hpl1/engine/gui/WidgetLabel.h
index bb3a4b87f8b..d9e1d943786 100644
--- a/engines/hpl1/engine/gui/WidgetLabel.h
+++ b/engines/hpl1/engine/gui/WidgetLabel.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_WIDGET_LABEL_H
#define HPL_WIDGET_LABEL_H
diff --git a/engines/hpl1/engine/gui/WidgetListBox.cpp b/engines/hpl1/engine/gui/WidgetListBox.cpp
index 4519ed0e1fb..ec732010c09 100644
--- a/engines/hpl1/engine/gui/WidgetListBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetListBox.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/WidgetListBox.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/WidgetListBox.h b/engines/hpl1/engine/gui/WidgetListBox.h
index 0dfb43e0996..2734d8e154d 100644
--- a/engines/hpl1/engine/gui/WidgetListBox.h
+++ b/engines/hpl1/engine/gui/WidgetListBox.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_WIDGET_LIST_BOX_H
#define HPL_WIDGET_LIST_BOX_H
diff --git a/engines/hpl1/engine/gui/WidgetSlider.cpp b/engines/hpl1/engine/gui/WidgetSlider.cpp
index 236e594198c..c0c7f0e7cda 100644
--- a/engines/hpl1/engine/gui/WidgetSlider.cpp
+++ b/engines/hpl1/engine/gui/WidgetSlider.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/WidgetSlider.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/WidgetSlider.h b/engines/hpl1/engine/gui/WidgetSlider.h
index e97e735a945..796767d6033 100644
--- a/engines/hpl1/engine/gui/WidgetSlider.h
+++ b/engines/hpl1/engine/gui/WidgetSlider.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_WIDGET_SLIDER_H
#define HPL_WIDGET_SLIDER_H
diff --git a/engines/hpl1/engine/gui/WidgetTextBox.cpp b/engines/hpl1/engine/gui/WidgetTextBox.cpp
index 51bc4b123a8..ee74369ff42 100644
--- a/engines/hpl1/engine/gui/WidgetTextBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetTextBox.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/WidgetTextBox.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/WidgetTextBox.h b/engines/hpl1/engine/gui/WidgetTextBox.h
index 85674250403..a90bbf842b6 100644
--- a/engines/hpl1/engine/gui/WidgetTextBox.h
+++ b/engines/hpl1/engine/gui/WidgetTextBox.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_WIDGET_TEXT_BOX_H
#define HPL_WIDGET_TEXT_BOX_H
diff --git a/engines/hpl1/engine/gui/WidgetWindow.cpp b/engines/hpl1/engine/gui/WidgetWindow.cpp
index f2c292d43c4..47249d2fde6 100644
--- a/engines/hpl1/engine/gui/WidgetWindow.cpp
+++ b/engines/hpl1/engine/gui/WidgetWindow.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/gui/WidgetWindow.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/gui/WidgetWindow.h b/engines/hpl1/engine/gui/WidgetWindow.h
index 37e115bc446..d57e7d16cad 100644
--- a/engines/hpl1/engine/gui/WidgetWindow.h
+++ b/engines/hpl1/engine/gui/WidgetWindow.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_WIDGET_WINDOW_H
#define HPL_WIDGET_WINDOW_H
diff --git a/engines/hpl1/engine/haptic/Haptic.cpp b/engines/hpl1/engine/haptic/Haptic.cpp
index 84d6aef2086..69c2473f58d 100644
--- a/engines/hpl1/engine/haptic/Haptic.cpp
+++ b/engines/hpl1/engine/haptic/Haptic.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/haptic/Haptic.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/haptic/LowLevelHaptic.h"
diff --git a/engines/hpl1/engine/haptic/Haptic.h b/engines/hpl1/engine/haptic/Haptic.h
index 38929b4c53a..1e7d7b64d6e 100644
--- a/engines/hpl1/engine/haptic/Haptic.h
+++ b/engines/hpl1/engine/haptic/Haptic.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_HAPTIC_H
#define HPL_HAPTIC_H
diff --git a/engines/hpl1/engine/haptic/HapticForce.h b/engines/hpl1/engine/haptic/HapticForce.h
index 0ac0677b7db..eb9baf57cee 100644
--- a/engines/hpl1/engine/haptic/HapticForce.h
+++ b/engines/hpl1/engine/haptic/HapticForce.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_HAPTIC_FORCE_H
#define HPL_HAPTIC_FORCE_H
diff --git a/engines/hpl1/engine/haptic/HapticShape.h b/engines/hpl1/engine/haptic/HapticShape.h
index 514ae83bc2b..a2c3d62b8d9 100644
--- a/engines/hpl1/engine/haptic/HapticShape.h
+++ b/engines/hpl1/engine/haptic/HapticShape.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_HAPTIC_SHAPE_H
#define HPL_HAPTIC_SHAPE_H
diff --git a/engines/hpl1/engine/haptic/HapticSurface.h b/engines/hpl1/engine/haptic/HapticSurface.h
index d3ee9147f81..31803ef98cd 100644
--- a/engines/hpl1/engine/haptic/HapticSurface.h
+++ b/engines/hpl1/engine/haptic/HapticSurface.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_HAPTIC_SURFACE_H
#define HPL_HAPTIC_SURFACE_H
diff --git a/engines/hpl1/engine/haptic/HapticTypes.h b/engines/hpl1/engine/haptic/HapticTypes.h
index 8573f1bbf2a..80a7906ec02 100644
--- a/engines/hpl1/engine/haptic/HapticTypes.h
+++ b/engines/hpl1/engine/haptic/HapticTypes.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_HAPTIC_TYPES_H
#define HPL_HAPTIC_TYPES_H
diff --git a/engines/hpl1/engine/haptic/LowLevelHaptic.cpp b/engines/hpl1/engine/haptic/LowLevelHaptic.cpp
index e05018b15ac..ad9f0c506cc 100644
--- a/engines/hpl1/engine/haptic/LowLevelHaptic.cpp
+++ b/engines/hpl1/engine/haptic/LowLevelHaptic.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/haptic/LowLevelHaptic.h"
#include "hpl1/engine/haptic/HapticSurface.h"
diff --git a/engines/hpl1/engine/haptic/LowLevelHaptic.h b/engines/hpl1/engine/haptic/LowLevelHaptic.h
index 2cebffafc02..fea6b905959 100644
--- a/engines/hpl1/engine/haptic/LowLevelHaptic.h
+++ b/engines/hpl1/engine/haptic/LowLevelHaptic.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_LOW_LEVEL_HAPTIC_H
#define HPL_LOW_LEVEL_HAPTIC_H
diff --git a/engines/hpl1/engine/impl/CGProgram.cpp b/engines/hpl1/engine/impl/CGProgram.cpp
index e6d989f462d..3a74d2128b5 100644
--- a/engines/hpl1/engine/impl/CGProgram.cpp
+++ b/engines/hpl1/engine/impl/CGProgram.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/CGProgram.h"
#include "hpl1/engine/impl/SDLTexture.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/impl/CGProgram.h b/engines/hpl1/engine/impl/CGProgram.h
index 03037e75a9f..219018c32d1 100644
--- a/engines/hpl1/engine/impl/CGProgram.h
+++ b/engines/hpl1/engine/impl/CGProgram.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_CGPROGRAM_H
#define HPL_CGPROGRAM_H
diff --git a/engines/hpl1/engine/impl/CharacterBodyNewton.cpp b/engines/hpl1/engine/impl/CharacterBodyNewton.cpp
index c1cd81068e6..40d3ee51538 100644
--- a/engines/hpl1/engine/impl/CharacterBodyNewton.cpp
+++ b/engines/hpl1/engine/impl/CharacterBodyNewton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/CharacterBodyNewton.h"
#include "hpl1/engine/physics/CollideShape.h"
diff --git a/engines/hpl1/engine/impl/CharacterBodyNewton.h b/engines/hpl1/engine/impl/CharacterBodyNewton.h
index b5968b84b25..484d8abb665 100644
--- a/engines/hpl1/engine/impl/CharacterBodyNewton.h
+++ b/engines/hpl1/engine/impl/CharacterBodyNewton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_CHARACTER_BODY_NEWTON_H
#define HPL_CHARACTER_BODY_NEWTON_H
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.cpp b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
index 57735911221..8efedc36ddc 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.cpp
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/CollideShapeNewton.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.h b/engines/hpl1/engine/impl/CollideShapeNewton.h
index 3cee82b32a9..ff5cba51893 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.h
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_COLLIDE_SHAPE_NEWTON_H
#define HPL_COLLIDE_SHAPE_NEWTON_H
diff --git a/engines/hpl1/engine/impl/KeyboardSDL.cpp b/engines/hpl1/engine/impl/KeyboardSDL.cpp
index ff342933cd6..0d8cccdad98 100644
--- a/engines/hpl1/engine/impl/KeyboardSDL.cpp
+++ b/engines/hpl1/engine/impl/KeyboardSDL.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/KeyboardSDL.h"
//#include "SDL/SDL.h"
diff --git a/engines/hpl1/engine/impl/KeyboardSDL.h b/engines/hpl1/engine/impl/KeyboardSDL.h
index 2e378dc2f4d..da868ed38ec 100644
--- a/engines/hpl1/engine/impl/KeyboardSDL.h
+++ b/engines/hpl1/engine/impl/KeyboardSDL.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_KEYBOARD_SDL_H
#define HPL_KEYBOARD_SDL_H
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 4b5ba03a7bd..6bbab83abc0 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#if 0//def WIN32
#pragma comment(lib, "OpenGL32.lib")
#pragma comment(lib, "GLu32.lib")
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
index 474abb339e0..063be848637 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_LOWLEVELGRAPHICS_SDL_H
#define HPL_LOWLEVELGRAPHICS_SDL_H
diff --git a/engines/hpl1/engine/impl/LowLevelInputSDL.cpp b/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
index 85fd640b791..2b645763315 100644
--- a/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/LowLevelInputSDL.h"
#include "hpl1/engine/impl/MouseSDL.h"
diff --git a/engines/hpl1/engine/impl/LowLevelInputSDL.h b/engines/hpl1/engine/impl/LowLevelInputSDL.h
index f34742df857..c739b16896b 100644
--- a/engines/hpl1/engine/impl/LowLevelInputSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelInputSDL.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_LOWLEVELINPUT_SDL_H
#define HPL_LOWLEVELINPUT_SDL_H
diff --git a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
index 448c022d5db..0d4ae88fc58 100644
--- a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
+++ b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#pragma comment(lib, "newton.lib")
#include "hpl1/engine/impl/LowLevelPhysicsNewton.h"
diff --git a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
index 17bc2f6c29a..9aeb09cc14c 100644
--- a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
+++ b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_LOWLEVELPHYSICS_NEWTON_H
#define HPL_LOWLEVELPHYSICS_NEWTON_H
diff --git a/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp b/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
index 7c2a7ea3126..e117e3089ae 100644
--- a/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/LowLevelResourcesSDL.h"
#include "hpl1/engine/impl/SDLBitmap2D.h"
#include "hpl1/engine/impl/MeshLoaderMSH.h"
diff --git a/engines/hpl1/engine/impl/LowLevelResourcesSDL.h b/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
index 2f6bbe22504..c4f64d052b1 100644
--- a/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_LOWLEVELRESOURCES_SDL_H
#define HPL_LOWLEVELRESOURCES_SDL_H
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
index 72b04afa94f..dccc2fe9293 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -17,6 +38,7 @@
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/impl/OpenALSoundData.h"
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
index 95512a507e7..91bb7131de4 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_LOWLEVELSOUND_OPENAL_H
#define HPL_LOWLEVELSOUND_OPENAL_H
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
index 33c4cf4730b..4b5e92ba0e0 100644
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
//#include <vld.h>
//Use this to check for memory leaks!
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.h b/engines/hpl1/engine/impl/LowLevelSystemSDL.h
index 435a1cc3c53..9d98dccd1f6 100644
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelSystemSDL.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_LOWLEVELSYSTEM_SDL_H
#define HPL_LOWLEVELSYSTEM_SDL_H
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
index c559e164771..13df1eefa0c 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/MeshLoaderCollada.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.h b/engines/hpl1/engine/impl/MeshLoaderCollada.h
index 9c803cb1b06..c89776e3a3b 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.h
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MESH_LOADER_COLLADA_H
#define HPL_MESH_LOADER_COLLADA_H
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
index a3faa5fe7db..2370860adb0 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/MeshLoaderCollada.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
index c4cec49ddd9..90234f28f8e 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/MeshLoaderCollada.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/impl/MeshLoaderMSH.cpp b/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
index 49dceb7bbad..8f16e1fac36 100644
--- a/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/MeshLoaderMSH.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/impl/MeshLoaderMSH.h b/engines/hpl1/engine/impl/MeshLoaderMSH.h
index 7aaa080d822..00aaa2cfa65 100644
--- a/engines/hpl1/engine/impl/MeshLoaderMSH.h
+++ b/engines/hpl1/engine/impl/MeshLoaderMSH.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MESH_LOADER_MSH_H
#define HPL_MESH_LOADER_MSH_H
diff --git a/engines/hpl1/engine/impl/MouseSDL.cpp b/engines/hpl1/engine/impl/MouseSDL.cpp
index 7583566a8b4..9385bcb2476 100644
--- a/engines/hpl1/engine/impl/MouseSDL.cpp
+++ b/engines/hpl1/engine/impl/MouseSDL.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/MouseSDL.h"
//#include "SDL/SDL.h"
diff --git a/engines/hpl1/engine/impl/MouseSDL.h b/engines/hpl1/engine/impl/MouseSDL.h
index 9398b07543b..1e21c53325a 100644
--- a/engines/hpl1/engine/impl/MouseSDL.h
+++ b/engines/hpl1/engine/impl/MouseSDL.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_MOUSE_SDL_H
#define HPL_MOUSE_SDL_H
diff --git a/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp b/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
index 4c3d7129e85..0163929b92d 100644
--- a/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
+++ b/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/OcclusionQueryOGL.h"
//#include <GL/GLee.h>
diff --git a/engines/hpl1/engine/impl/OcclusionQueryOGL.h b/engines/hpl1/engine/impl/OcclusionQueryOGL.h
index 653d005a6d1..27e2f7b78d8 100644
--- a/engines/hpl1/engine/impl/OcclusionQueryOGL.h
+++ b/engines/hpl1/engine/impl/OcclusionQueryOGL.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_OCCLUSION_QUERY_OGL_H
#define HPL_OCCLUSION_QUERY_OGL_H
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index f6127dd8471..4d6c11370ee 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/OpenALSoundChannel.h"
#include "hpl1/engine/impl/OpenALSoundData.h"
#include "hpl1/engine/resources/SoundManager.h"
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.h b/engines/hpl1/engine/impl/OpenALSoundChannel.h
index e30edf07a88..ac0cf24280e 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.h
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_OPENAL_SOUND_CHANNEL_H
#define HPL_OPENAL_SOUND_CHANNEL_H
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.cpp b/engines/hpl1/engine/impl/OpenALSoundData.cpp
index c721e31c340..911c93a1bef 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundData.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/OpenALSoundData.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/impl/OpenALSoundChannel.h"
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.h b/engines/hpl1/engine/impl/OpenALSoundData.h
index 5340155006a..df08e9ad237 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.h
+++ b/engines/hpl1/engine/impl/OpenALSoundData.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_OPENAL_SOUND_DATA_H
#define HPL_OPENAL_SOUND_DATA_H
diff --git a/engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp b/engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
index a4f5e013511..2463f6ac21f 100644
--- a/engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/OpenALSoundEnvironment.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
diff --git a/engines/hpl1/engine/impl/OpenALSoundEnvironment.h b/engines/hpl1/engine/impl/OpenALSoundEnvironment.h
index e0365177416..731a035daa7 100644
--- a/engines/hpl1/engine/impl/OpenALSoundEnvironment.h
+++ b/engines/hpl1/engine/impl/OpenALSoundEnvironment.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_OPENALSOUNDENVIRONMENT_H
#define HPL_OPENALSOUNDENVIRONMENT_H
diff --git a/engines/hpl1/engine/impl/PBuffer.cpp b/engines/hpl1/engine/impl/PBuffer.cpp
index 60aca19b529..ece8f2b1b4b 100644
--- a/engines/hpl1/engine/impl/PBuffer.cpp
+++ b/engines/hpl1/engine/impl/PBuffer.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#if 0
#include "hpl1/engine/impl/PBuffer.h"
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
diff --git a/engines/hpl1/engine/impl/PBuffer.h b/engines/hpl1/engine/impl/PBuffer.h
index a7ba9e69d5e..891e9712863 100644
--- a/engines/hpl1/engine/impl/PBuffer.h
+++ b/engines/hpl1/engine/impl/PBuffer.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#if 0
#ifndef HPL_P_BUFFER_H
#define HPL_P_BUFFER_H
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
index 8581ebcd347..8d28ae68af9 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/PhysicsBodyNewton.h"
#include "hpl1/engine/impl/CollideShapeNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.h b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
index 641509e35bc..8b4baf90137 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PHYSICS_BODY_NEWTON_H
#define HPL_PHYSICS_BODY_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsControllerNewton.cpp b/engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
index befde367f3e..71289519e10 100644
--- a/engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/PhysicsControllerNewton.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
diff --git a/engines/hpl1/engine/impl/PhysicsControllerNewton.h b/engines/hpl1/engine/impl/PhysicsControllerNewton.h
index a6cd314e885..3dc4dda0816 100644
--- a/engines/hpl1/engine/impl/PhysicsControllerNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsControllerNewton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PHYSICS_CONTROLLER_NEWTON_H
#define HPL_PHYSICS_CONTROLLER_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
index 496ff398fa0..fcc4e4c03d6 100644
--- a/engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/PhysicsJointBallNewton.h"
#include "hpl1/engine/impl/PhysicsBodyNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsJointBallNewton.h b/engines/hpl1/engine/impl/PhysicsJointBallNewton.h
index 50ce834058d..e534428329f 100644
--- a/engines/hpl1/engine/impl/PhysicsJointBallNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointBallNewton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PHYSICS_JOINT_BALL_NEWTON_H
#define HPL_PHYSICS_JOINT_BALL_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
index 30f4a92a839..52459a1e9f2 100644
--- a/engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/PhysicsJointHingeNewton.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/impl/PhysicsJointHingeNewton.h b/engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
index 261b5a78515..321193226a1 100644
--- a/engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PHYSICS_JOINT_HINGE_NEWTON_H
#define HPL_PHYSICS_JOINT_HINGE_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointNewton.h b/engines/hpl1/engine/impl/PhysicsJointNewton.h
index 53e22aa5cac..ff09e2e1f02 100644
--- a/engines/hpl1/engine/impl/PhysicsJointNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointNewton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PHYSICS_JOINT_NEWTON_H
#define HPL_PHYSICS_JOINT_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
index 8877e05dad0..f4b2821675f 100644
--- a/engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/PhysicsJointScrewNewton.h"
#include "hpl1/engine/impl/PhysicsBodyNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsJointScrewNewton.h b/engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
index 330b6241425..7c02f3ff608 100644
--- a/engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PHYSICS_JOINT_SCREW_NEWTON_H
#define HPL_PHYSICS_JOINT_SCREW_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
index ef6f508eecc..8f2e4e9db35 100644
--- a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/PhysicsJointSliderNewton.h"
#include "hpl1/engine/impl/PhysicsBodyNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.h b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
index 7e0bf902759..a8d078d1758 100644
--- a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PHYSICS_JOINT_SLIDER_NEWTON_H
#define HPL_PHYSICS_JOINT_SLIDER_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
index b8824d115be..ab9f1c82641 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/PhysicsMaterialNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.h b/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
index bd676dc30b0..13be34c352e 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PHYSICS_MATERIAL_NEWTON_H
#define HPL_PHYSICS_MATERIAL_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
index fcb4b8d27b0..4d86e9b5641 100644
--- a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
#include "hpl1/engine/impl/CollideShapeNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsWorldNewton.h b/engines/hpl1/engine/impl/PhysicsWorldNewton.h
index 50c4a185585..02eb8b112b5 100644
--- a/engines/hpl1/engine/impl/PhysicsWorldNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsWorldNewton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_PHYSICS_WORLD_NEWTON_H
#define HPL_PHYSICS_WORLD_NEWTON_H
diff --git a/engines/hpl1/engine/impl/Platform.h b/engines/hpl1/engine/impl/Platform.h
index 740dc6526da..3584415ecb9 100644
--- a/engines/hpl1/engine/impl/Platform.h
+++ b/engines/hpl1/engine/impl/Platform.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef PLATFORM_H_
#define PLATFORM_H_
#include "hpl1/engine/system/String.h"
diff --git a/engines/hpl1/engine/impl/SDLBitmap2D.cpp b/engines/hpl1/engine/impl/SDLBitmap2D.cpp
index e1f557c34f1..cc794535baf 100644
--- a/engines/hpl1/engine/impl/SDLBitmap2D.cpp
+++ b/engines/hpl1/engine/impl/SDLBitmap2D.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/SDLBitmap2D.h"
diff --git a/engines/hpl1/engine/impl/SDLBitmap2D.h b/engines/hpl1/engine/impl/SDLBitmap2D.h
index 57c284f751f..2cb6ef4fa60 100644
--- a/engines/hpl1/engine/impl/SDLBitmap2D.h
+++ b/engines/hpl1/engine/impl/SDLBitmap2D.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_SDL_BITMAP2D_H
#define HPL_SDL_BITMAP2D_H
diff --git a/engines/hpl1/engine/impl/SDLFontData.cpp b/engines/hpl1/engine/impl/SDLFontData.cpp
index 698ac706ac4..26043bb49e7 100644
--- a/engines/hpl1/engine/impl/SDLFontData.cpp
+++ b/engines/hpl1/engine/impl/SDLFontData.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/SDLFontData.h"
#include "hpl1/engine/graphics/GraphicsDrawer.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/impl/SDLFontData.h b/engines/hpl1/engine/impl/SDLFontData.h
index a254faa1c6c..09d53876be3 100644
--- a/engines/hpl1/engine/impl/SDLFontData.h
+++ b/engines/hpl1/engine/impl/SDLFontData.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_SDL_FONTDATA_H
#define HPL_SDL_FONTDATA_H
diff --git a/engines/hpl1/engine/impl/SDLGameSetup.cpp b/engines/hpl1/engine/impl/SDLGameSetup.cpp
index 870e2049cee..89121cd9d72 100644
--- a/engines/hpl1/engine/impl/SDLGameSetup.cpp
+++ b/engines/hpl1/engine/impl/SDLGameSetup.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#if 0//def WIN32
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
diff --git a/engines/hpl1/engine/impl/SDLGameSetup.h b/engines/hpl1/engine/impl/SDLGameSetup.h
index 3ac5accba29..eed1149ff7b 100644
--- a/engines/hpl1/engine/impl/SDLGameSetup.h
+++ b/engines/hpl1/engine/impl/SDLGameSetup.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_SDL_GAMESETUP_H
#define HPL_SDL_GAMESETUP_H
diff --git a/engines/hpl1/engine/impl/SDLPixelFormat.h b/engines/hpl1/engine/impl/SDLPixelFormat.h
index 90a7e7ccfef..0b58fda8bb5 100644
--- a/engines/hpl1/engine/impl/SDLPixelFormat.h
+++ b/engines/hpl1/engine/impl/SDLPixelFormat.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_SDL_PIXELFORMAT_H
#define HPL_SDL_PIXELFORMAT_H
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index 99fd02c7518..e1f223d689f 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/SDLTexture.h"
#include "hpl1/engine/impl/SDLBitmap2D.h"
diff --git a/engines/hpl1/engine/impl/SDLTexture.h b/engines/hpl1/engine/impl/SDLTexture.h
index 4ebaba0b092..4eea84edf29 100644
--- a/engines/hpl1/engine/impl/SDLTexture.h
+++ b/engines/hpl1/engine/impl/SDLTexture.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_SDL_TEXTURE_H
#define HPL_SDL_TEXTURE_H
diff --git a/engines/hpl1/engine/impl/SqScript.cpp b/engines/hpl1/engine/impl/SqScript.cpp
index 0b94a61584f..a24d8e86ad0 100644
--- a/engines/hpl1/engine/impl/SqScript.cpp
+++ b/engines/hpl1/engine/impl/SqScript.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/SqScript.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/system/String.h"
diff --git a/engines/hpl1/engine/impl/SqScript.h b/engines/hpl1/engine/impl/SqScript.h
index 2064161c756..bb942cec05c 100644
--- a/engines/hpl1/engine/impl/SqScript.h
+++ b/engines/hpl1/engine/impl/SqScript.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_SQ_SCRIPT_H
#define HPL_SQ_SCRIPT_H
diff --git a/engines/hpl1/engine/impl/VertexBufferOGL.cpp b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
index f0ed7c59f21..301f741bff7 100644
--- a/engines/hpl1/engine/impl/VertexBufferOGL.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/VertexBufferOGL.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/impl/VertexBufferOGL.h b/engines/hpl1/engine/impl/VertexBufferOGL.h
index 61bb59406d4..7a4bb737680 100644
--- a/engines/hpl1/engine/impl/VertexBufferOGL.h
+++ b/engines/hpl1/engine/impl/VertexBufferOGL.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_VERTEXBUFFER_OGL_H
#define HPL_VERTEXBUFFER_OGL_H
diff --git a/engines/hpl1/engine/impl/VertexBufferVBO.cpp b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
index e2742c6183d..623524b57b5 100644
--- a/engines/hpl1/engine/impl/VertexBufferVBO.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/impl/VertexBufferVBO.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/impl/VertexBufferVBO.h b/engines/hpl1/engine/impl/VertexBufferVBO.h
index 1a3c7fe6da6..5c9de99f9d4 100644
--- a/engines/hpl1/engine/impl/VertexBufferVBO.h
+++ b/engines/hpl1/engine/impl/VertexBufferVBO.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_VERTEXBUFFER_VBO_H
#define HPL_VERTEXBUFFER_VBO_H
diff --git a/engines/hpl1/engine/impl/VideoStreamTheora.cpp b/engines/hpl1/engine/impl/VideoStreamTheora.cpp
index 6f209c6b853..91a6ad6db90 100644
--- a/engines/hpl1/engine/impl/VideoStreamTheora.cpp
+++ b/engines/hpl1/engine/impl/VideoStreamTheora.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#if 0
#include "hpl1/engine/impl/VideoStreamTheora.h"
diff --git a/engines/hpl1/engine/impl/VideoStreamTheora.h b/engines/hpl1/engine/impl/VideoStreamTheora.h
index b66bc493a20..13a074e0131 100644
--- a/engines/hpl1/engine/impl/VideoStreamTheora.h
+++ b/engines/hpl1/engine/impl/VideoStreamTheora.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#if 0//ndef HPL_VIDEO_STREAM_THEORA_H
#define HPL_VIDEO_STREAM_THEORA_H
diff --git a/engines/hpl1/engine/input/Action.cpp b/engines/hpl1/engine/input/Action.cpp
index 662d8ec6fe2..d4c19460446 100644
--- a/engines/hpl1/engine/input/Action.cpp
+++ b/engines/hpl1/engine/input/Action.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/input/Action.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/input/Action.h b/engines/hpl1/engine/input/Action.h
index cc7051f9454..62447c9cf64 100644
--- a/engines/hpl1/engine/input/Action.h
+++ b/engines/hpl1/engine/input/Action.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_ACTION_H
#define HPL_ACTION_H
diff --git a/engines/hpl1/engine/input/ActionHaptic.cpp b/engines/hpl1/engine/input/ActionHaptic.cpp
index f849e3b0a34..48058f4ba5b 100644
--- a/engines/hpl1/engine/input/ActionHaptic.cpp
+++ b/engines/hpl1/engine/input/ActionHaptic.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/input/ActionHaptic.h"
#include "hpl1/engine/input/Input.h"
#include "hpl1/engine/haptic/Haptic.h"
diff --git a/engines/hpl1/engine/input/ActionHaptic.h b/engines/hpl1/engine/input/ActionHaptic.h
index 92208f47528..e2536f762b0 100644
--- a/engines/hpl1/engine/input/ActionHaptic.h
+++ b/engines/hpl1/engine/input/ActionHaptic.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_ACTION_HAPTIC_H
#define HPL_ACTION_HAPTIC_H
diff --git a/engines/hpl1/engine/input/ActionKeyboard.cpp b/engines/hpl1/engine/input/ActionKeyboard.cpp
index 7e08983aa91..e5a0475e804 100644
--- a/engines/hpl1/engine/input/ActionKeyboard.cpp
+++ b/engines/hpl1/engine/input/ActionKeyboard.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/input/ActionKeyboard.h"
#include "hpl1/engine/input/Input.h"
#include "hpl1/engine/input/Keyboard.h"
diff --git a/engines/hpl1/engine/input/ActionKeyboard.h b/engines/hpl1/engine/input/ActionKeyboard.h
index fe6e4f6f631..c5366112d7d 100644
--- a/engines/hpl1/engine/input/ActionKeyboard.h
+++ b/engines/hpl1/engine/input/ActionKeyboard.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_ACTIONKEYBOARD_H
#define HPL_ACTIONKEYBOARD_H
diff --git a/engines/hpl1/engine/input/ActionMouseButton.cpp b/engines/hpl1/engine/input/ActionMouseButton.cpp
index 4a63705d513..9e27fdc7753 100644
--- a/engines/hpl1/engine/input/ActionMouseButton.cpp
+++ b/engines/hpl1/engine/input/ActionMouseButton.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/input/ActionMouseButton.h"
#include "hpl1/engine/input/Input.h"
#include "hpl1/engine/input/Mouse.h"
diff --git a/engines/hpl1/engine/input/ActionMouseButton.h b/engines/hpl1/engine/input/ActionMouseButton.h
index 35686daf997..4772eb224e0 100644
--- a/engines/hpl1/engine/input/ActionMouseButton.h
+++ b/engines/hpl1/engine/input/ActionMouseButton.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_ACTIONMOUSEBUTTON_H
#define HPL_ACTIONMOUSEBUTTON_H
diff --git a/engines/hpl1/engine/input/Input.cpp b/engines/hpl1/engine/input/Input.cpp
index 5953fe4f7ce..0b38340fd30 100644
--- a/engines/hpl1/engine/input/Input.cpp
+++ b/engines/hpl1/engine/input/Input.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "hpl1/engine/input/Input.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/input/Mouse.h"
diff --git a/engines/hpl1/engine/input/Input.h b/engines/hpl1/engine/input/Input.h
index c2434ab0cfe..6bfde4d9b70 100644
--- a/engines/hpl1/engine/input/Input.h
+++ b/engines/hpl1/engine/input/Input.h
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
/*
* Copyright (C) 2006-2010 - Frictional Games
*
@@ -16,6 +37,7 @@
* You should have received a copy of the GNU General Public License
* along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef HPL_INPUT_H
#define HPL_INPUT_H
diff --git a/engines/hpl1/engine/input/InputDevice.cpp b/engines/hpl1/engine/input/InputDevice.cpp
index 5fb649763da..34527efb45c 100644
--- a/engines/hpl1/engine/input/InputDevice.cpp
+++ b/engines/hpl1/engine/input/InputDevice.cpp
@@ -1,3 +1,24 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
Commit: 87d8541ba5612e8d8bb743d02a5b5c8c0e482b34
https://github.com/scummvm/scummvm/commit/87d8541ba5612e8d8bb743d02a5b5c8c0e482b34
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:26+01:00
Commit Message:
HPL1: improve formatting
Changed paths:
engines/hpl1/console.cpp
engines/hpl1/console.h
engines/hpl1/detection.h
engines/hpl1/detection_tables.h
engines/hpl1/engine/ai/AI.cpp
engines/hpl1/engine/ai/AI.h
engines/hpl1/engine/ai/AINodeContainer.cpp
engines/hpl1/engine/ai/AINodeContainer.h
engines/hpl1/engine/ai/AINodeGenerator.cpp
engines/hpl1/engine/ai/AINodeGenerator.h
engines/hpl1/engine/ai/AStar.cpp
engines/hpl1/engine/ai/AStar.h
engines/hpl1/engine/ai/StateMachine.cpp
engines/hpl1/engine/ai/StateMachine.h
engines/hpl1/engine/game/Game.cpp
engines/hpl1/engine/game/Game.h
engines/hpl1/engine/game/GameTypes.cpp
engines/hpl1/engine/game/GameTypes.h
engines/hpl1/engine/game/LowLevelGameSetup.h
engines/hpl1/engine/game/SaveGame.cpp
engines/hpl1/engine/game/SaveGame.h
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/game/ScriptFuncs.h
engines/hpl1/engine/game/Updateable.h
engines/hpl1/engine/game/Updater.cpp
engines/hpl1/engine/game/Updater.h
engines/hpl1/engine/graphics/Animation.cpp
engines/hpl1/engine/graphics/Animation.h
engines/hpl1/engine/graphics/AnimationTrack.cpp
engines/hpl1/engine/graphics/AnimationTrack.h
engines/hpl1/engine/graphics/BackgroundImage.cpp
engines/hpl1/engine/graphics/BackgroundImage.h
engines/hpl1/engine/graphics/Beam.cpp
engines/hpl1/engine/graphics/Beam.h
engines/hpl1/engine/graphics/BillBoard.cpp
engines/hpl1/engine/graphics/BillBoard.h
engines/hpl1/engine/graphics/Bitmap2D.h
engines/hpl1/engine/graphics/Bone.cpp
engines/hpl1/engine/graphics/Bone.h
engines/hpl1/engine/graphics/BoneState.cpp
engines/hpl1/engine/graphics/BoneState.h
engines/hpl1/engine/graphics/Color.cpp
engines/hpl1/engine/graphics/Color.h
engines/hpl1/engine/graphics/FontData.cpp
engines/hpl1/engine/graphics/FontData.h
engines/hpl1/engine/graphics/GPUProgram.cpp
engines/hpl1/engine/graphics/GPUProgram.h
engines/hpl1/engine/graphics/GfxObject.cpp
engines/hpl1/engine/graphics/GfxObject.h
engines/hpl1/engine/graphics/Graphics.cpp
engines/hpl1/engine/graphics/Graphics.h
engines/hpl1/engine/graphics/GraphicsDrawer.cpp
engines/hpl1/engine/graphics/GraphicsDrawer.h
engines/hpl1/engine/graphics/GraphicsTypes.h
engines/hpl1/engine/graphics/ImageEntityData.cpp
engines/hpl1/engine/graphics/ImageEntityData.h
engines/hpl1/engine/graphics/LowLevelGraphics.h
engines/hpl1/engine/graphics/LowLevelPicture.h
engines/hpl1/engine/graphics/Material.cpp
engines/hpl1/engine/graphics/Material.h
engines/hpl1/engine/graphics/MaterialHandler.cpp
engines/hpl1/engine/graphics/MaterialHandler.h
engines/hpl1/engine/graphics/Material_Additive.cpp
engines/hpl1/engine/graphics/Material_Additive.h
engines/hpl1/engine/graphics/Material_Alpha.cpp
engines/hpl1/engine/graphics/Material_Alpha.h
engines/hpl1/engine/graphics/Material_BaseLight.cpp
engines/hpl1/engine/graphics/Material_BaseLight.h
engines/hpl1/engine/graphics/Material_Bump.cpp
engines/hpl1/engine/graphics/Material_Bump.h
engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
engines/hpl1/engine/graphics/Material_BumpColorSpec.h
engines/hpl1/engine/graphics/Material_BumpSpec.cpp
engines/hpl1/engine/graphics/Material_BumpSpec.h
engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
engines/hpl1/engine/graphics/Material_BumpSpec2D.h
engines/hpl1/engine/graphics/Material_Diffuse.cpp
engines/hpl1/engine/graphics/Material_Diffuse.h
engines/hpl1/engine/graphics/Material_Diffuse2D.cpp
engines/hpl1/engine/graphics/Material_Diffuse2D.h
engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.cpp
engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.cpp
engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
engines/hpl1/engine/graphics/Material_DiffuseSpec.h
engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
engines/hpl1/engine/graphics/Material_Flat.cpp
engines/hpl1/engine/graphics/Material_Flat.h
engines/hpl1/engine/graphics/Material_FontNormal.cpp
engines/hpl1/engine/graphics/Material_FontNormal.h
engines/hpl1/engine/graphics/Material_Modulative.cpp
engines/hpl1/engine/graphics/Material_Modulative.h
engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
engines/hpl1/engine/graphics/Material_ModulativeX2.h
engines/hpl1/engine/graphics/Material_Smoke2D.cpp
engines/hpl1/engine/graphics/Material_Smoke2D.h
engines/hpl1/engine/graphics/Material_Water.cpp
engines/hpl1/engine/graphics/Material_Water.h
engines/hpl1/engine/graphics/Mesh.cpp
engines/hpl1/engine/graphics/Mesh.h
engines/hpl1/engine/graphics/Mesh2d.cpp
engines/hpl1/engine/graphics/Mesh2d.h
engines/hpl1/engine/graphics/MeshCreator.cpp
engines/hpl1/engine/graphics/MeshCreator.h
engines/hpl1/engine/graphics/OcclusionQuery.h
engines/hpl1/engine/graphics/ParticleEmitter.cpp
engines/hpl1/engine/graphics/ParticleEmitter.h
engines/hpl1/engine/graphics/ParticleEmitter2D.cpp
engines/hpl1/engine/graphics/ParticleEmitter2D.h
engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
engines/hpl1/engine/graphics/ParticleEmitter3D.h
engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
engines/hpl1/engine/graphics/ParticleSystem3D.cpp
engines/hpl1/engine/graphics/ParticleSystem3D.h
engines/hpl1/engine/graphics/PixelFormat.h
engines/hpl1/engine/graphics/RenderList.cpp
engines/hpl1/engine/graphics/RenderList.h
engines/hpl1/engine/graphics/RenderObject2D.cpp
engines/hpl1/engine/graphics/RenderObject2D.h
engines/hpl1/engine/graphics/RenderState.cpp
engines/hpl1/engine/graphics/RenderState.h
engines/hpl1/engine/graphics/Renderable.cpp
engines/hpl1/engine/graphics/Renderable.h
engines/hpl1/engine/graphics/Renderer2D.cpp
engines/hpl1/engine/graphics/Renderer2D.h
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/engine/graphics/Renderer3D.h
engines/hpl1/engine/graphics/RendererPostEffects.cpp
engines/hpl1/engine/graphics/RendererPostEffects.h
engines/hpl1/engine/graphics/Skeleton.cpp
engines/hpl1/engine/graphics/Skeleton.h
engines/hpl1/engine/graphics/SubMesh.cpp
engines/hpl1/engine/graphics/SubMesh.h
engines/hpl1/engine/graphics/Texture.h
engines/hpl1/engine/graphics/VertexBuffer.h
engines/hpl1/engine/graphics/VideoStream.h
engines/hpl1/engine/gui/Gui.cpp
engines/hpl1/engine/gui/Gui.h
engines/hpl1/engine/gui/GuiGfxElement.cpp
engines/hpl1/engine/gui/GuiGfxElement.h
engines/hpl1/engine/gui/GuiMaterial.h
engines/hpl1/engine/gui/GuiMaterialBasicTypes.cpp
engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
engines/hpl1/engine/gui/GuiPopUp.cpp
engines/hpl1/engine/gui/GuiPopUp.h
engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
engines/hpl1/engine/gui/GuiPopUpMessageBox.h
engines/hpl1/engine/gui/GuiSet.cpp
engines/hpl1/engine/gui/GuiSet.h
engines/hpl1/engine/gui/GuiSkin.cpp
engines/hpl1/engine/gui/GuiSkin.h
engines/hpl1/engine/gui/GuiTypes.h
engines/hpl1/engine/gui/Widget.cpp
engines/hpl1/engine/gui/Widget.h
engines/hpl1/engine/gui/WidgetBaseClasses.cpp
engines/hpl1/engine/gui/WidgetBaseClasses.h
engines/hpl1/engine/gui/WidgetButton.cpp
engines/hpl1/engine/gui/WidgetButton.h
engines/hpl1/engine/gui/WidgetCheckBox.cpp
engines/hpl1/engine/gui/WidgetCheckBox.h
engines/hpl1/engine/gui/WidgetComboBox.cpp
engines/hpl1/engine/gui/WidgetComboBox.h
engines/hpl1/engine/gui/WidgetFrame.cpp
engines/hpl1/engine/gui/WidgetFrame.h
engines/hpl1/engine/gui/WidgetImage.cpp
engines/hpl1/engine/gui/WidgetImage.h
engines/hpl1/engine/gui/WidgetLabel.cpp
engines/hpl1/engine/gui/WidgetLabel.h
engines/hpl1/engine/gui/WidgetListBox.cpp
engines/hpl1/engine/gui/WidgetListBox.h
engines/hpl1/engine/gui/WidgetSlider.cpp
engines/hpl1/engine/gui/WidgetSlider.h
engines/hpl1/engine/gui/WidgetTextBox.cpp
engines/hpl1/engine/gui/WidgetTextBox.h
engines/hpl1/engine/gui/WidgetWindow.cpp
engines/hpl1/engine/gui/WidgetWindow.h
engines/hpl1/engine/haptic/Haptic.cpp
engines/hpl1/engine/haptic/Haptic.h
engines/hpl1/engine/haptic/HapticForce.h
engines/hpl1/engine/haptic/HapticShape.h
engines/hpl1/engine/haptic/HapticSurface.h
engines/hpl1/engine/haptic/HapticTypes.h
engines/hpl1/engine/haptic/LowLevelHaptic.cpp
engines/hpl1/engine/haptic/LowLevelHaptic.h
engines/hpl1/engine/impl/CGProgram.cpp
engines/hpl1/engine/impl/CGProgram.h
engines/hpl1/engine/impl/CharacterBodyNewton.cpp
engines/hpl1/engine/impl/CharacterBodyNewton.h
engines/hpl1/engine/impl/CollideShapeNewton.cpp
engines/hpl1/engine/impl/CollideShapeNewton.h
engines/hpl1/engine/impl/KeyboardSDL.cpp
engines/hpl1/engine/impl/KeyboardSDL.h
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
engines/hpl1/engine/impl/LowLevelInputSDL.cpp
engines/hpl1/engine/impl/LowLevelInputSDL.h
engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
engines/hpl1/engine/impl/LowLevelResourcesSDL.h
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
engines/hpl1/engine/impl/LowLevelSystemSDL.h
engines/hpl1/engine/impl/MeshLoaderCollada.cpp
engines/hpl1/engine/impl/MeshLoaderCollada.h
engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
engines/hpl1/engine/impl/MeshLoaderMSH.cpp
engines/hpl1/engine/impl/MeshLoaderMSH.h
engines/hpl1/engine/impl/MouseSDL.cpp
engines/hpl1/engine/impl/MouseSDL.h
engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
engines/hpl1/engine/impl/OcclusionQueryOGL.h
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
engines/hpl1/engine/impl/OpenALSoundChannel.h
engines/hpl1/engine/impl/OpenALSoundData.cpp
engines/hpl1/engine/impl/OpenALSoundData.h
engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
engines/hpl1/engine/impl/OpenALSoundEnvironment.h
engines/hpl1/engine/impl/PBuffer.h
engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
engines/hpl1/engine/impl/PhysicsBodyNewton.h
engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
engines/hpl1/engine/impl/PhysicsControllerNewton.h
engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
engines/hpl1/engine/impl/PhysicsJointBallNewton.h
engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
engines/hpl1/engine/impl/PhysicsJointNewton.h
engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
engines/hpl1/engine/impl/PhysicsMaterialNewton.h
engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
engines/hpl1/engine/impl/PhysicsWorldNewton.h
engines/hpl1/engine/impl/Platform.cpp
engines/hpl1/engine/impl/Platform.h
engines/hpl1/engine/impl/SDLBitmap2D.cpp
engines/hpl1/engine/impl/SDLBitmap2D.h
engines/hpl1/engine/impl/SDLFontData.cpp
engines/hpl1/engine/impl/SDLFontData.h
engines/hpl1/engine/impl/SDLGameSetup.cpp
engines/hpl1/engine/impl/SDLGameSetup.h
engines/hpl1/engine/impl/SDLPixelFormat.h
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/SDLTexture.h
engines/hpl1/engine/impl/SqScript.cpp
engines/hpl1/engine/impl/SqScript.h
engines/hpl1/engine/impl/VertexBufferOGL.cpp
engines/hpl1/engine/impl/VertexBufferOGL.h
engines/hpl1/engine/impl/VertexBufferVBO.cpp
engines/hpl1/engine/impl/VertexBufferVBO.h
engines/hpl1/engine/impl/VideoStreamTheora.cpp
engines/hpl1/engine/impl/VideoStreamTheora.h
engines/hpl1/engine/impl/scriptstring.cpp
engines/hpl1/engine/impl/scriptstring.h
engines/hpl1/engine/impl/stdstring.cpp
engines/hpl1/engine/impl/temp-types.h
engines/hpl1/engine/impl/tinyXML/tinystr.cpp
engines/hpl1/engine/impl/tinyXML/tinystr.h
engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
engines/hpl1/engine/impl/tinyXML/tinyxml.h
engines/hpl1/engine/impl/tinyXML/tinyxmlerror.cpp
engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
engines/hpl1/engine/input/Action.cpp
engines/hpl1/engine/input/Action.h
engines/hpl1/engine/input/ActionHaptic.cpp
engines/hpl1/engine/input/ActionHaptic.h
engines/hpl1/engine/input/ActionKeyboard.cpp
engines/hpl1/engine/input/ActionKeyboard.h
engines/hpl1/engine/input/ActionMouseButton.cpp
engines/hpl1/engine/input/ActionMouseButton.h
engines/hpl1/engine/input/Input.cpp
engines/hpl1/engine/input/Input.h
engines/hpl1/engine/input/InputDevice.cpp
engines/hpl1/engine/input/InputDevice.h
engines/hpl1/engine/input/InputTypes.h
engines/hpl1/engine/input/Keyboard.cpp
engines/hpl1/engine/input/Keyboard.h
engines/hpl1/engine/input/LowLevelInput.h
engines/hpl1/engine/input/Mouse.cpp
engines/hpl1/engine/input/Mouse.h
engines/hpl1/engine/math/BoundingVolume.cpp
engines/hpl1/engine/math/BoundingVolume.h
engines/hpl1/engine/math/CRC.cpp
engines/hpl1/engine/math/CRC.h
engines/hpl1/engine/math/Frustum.cpp
engines/hpl1/engine/math/Frustum.h
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/math/Math.h
engines/hpl1/engine/math/MathTypes.cpp
engines/hpl1/engine/math/MathTypes.h
engines/hpl1/engine/math/Matrix.h
engines/hpl1/engine/math/MeshTypes.cpp
engines/hpl1/engine/math/MeshTypes.h
engines/hpl1/engine/math/PidController.h
engines/hpl1/engine/math/Quaternion.cpp
engines/hpl1/engine/math/Quaternion.h
engines/hpl1/engine/math/Spring.h
engines/hpl1/engine/math/Vector2.h
engines/hpl1/engine/math/Vector3.h
engines/hpl1/engine/physics/Body2D.cpp
engines/hpl1/engine/physics/Body2D.h
engines/hpl1/engine/physics/CharacterBody.cpp
engines/hpl1/engine/physics/CharacterBody.h
engines/hpl1/engine/physics/CollideData.h
engines/hpl1/engine/physics/CollideData2D.h
engines/hpl1/engine/physics/CollideShape.h
engines/hpl1/engine/physics/Collider2D.cpp
engines/hpl1/engine/physics/Collider2D.h
engines/hpl1/engine/physics/LowLevelPhysics.h
engines/hpl1/engine/physics/Physics.cpp
engines/hpl1/engine/physics/Physics.h
engines/hpl1/engine/physics/PhysicsBody.cpp
engines/hpl1/engine/physics/PhysicsBody.h
engines/hpl1/engine/physics/PhysicsController.cpp
engines/hpl1/engine/physics/PhysicsController.h
engines/hpl1/engine/physics/PhysicsJoint.cpp
engines/hpl1/engine/physics/PhysicsJoint.h
engines/hpl1/engine/physics/PhysicsJointBall.cpp
engines/hpl1/engine/physics/PhysicsJointBall.h
engines/hpl1/engine/physics/PhysicsJointHinge.cpp
engines/hpl1/engine/physics/PhysicsJointHinge.h
engines/hpl1/engine/physics/PhysicsJointScrew.cpp
engines/hpl1/engine/physics/PhysicsJointScrew.h
engines/hpl1/engine/physics/PhysicsJointSlider.cpp
engines/hpl1/engine/physics/PhysicsJointSlider.h
engines/hpl1/engine/physics/PhysicsMaterial.h
engines/hpl1/engine/physics/PhysicsWorld.cpp
engines/hpl1/engine/physics/PhysicsWorld.h
engines/hpl1/engine/physics/SurfaceData.cpp
engines/hpl1/engine/physics/SurfaceData.h
engines/hpl1/engine/resources/AnimationManager.cpp
engines/hpl1/engine/resources/AnimationManager.h
engines/hpl1/engine/resources/ConfigFile.cpp
engines/hpl1/engine/resources/ConfigFile.h
engines/hpl1/engine/resources/EntityLoader_Object.cpp
engines/hpl1/engine/resources/EntityLoader_Object.h
engines/hpl1/engine/resources/FileSearcher.cpp
engines/hpl1/engine/resources/FileSearcher.h
engines/hpl1/engine/resources/FontManager.h
engines/hpl1/engine/resources/FrameBase.h
engines/hpl1/engine/resources/FrameBitmap.h
engines/hpl1/engine/resources/FrameTexture.cpp
engines/hpl1/engine/resources/FrameTexture.h
engines/hpl1/engine/resources/GpuProgramManager.cpp
engines/hpl1/engine/resources/GpuProgramManager.h
engines/hpl1/engine/resources/ImageEntityManager.cpp
engines/hpl1/engine/resources/ImageEntityManager.h
engines/hpl1/engine/resources/ImageManager.cpp
engines/hpl1/engine/resources/ImageManager.h
engines/hpl1/engine/resources/LanguageFile.cpp
engines/hpl1/engine/resources/LanguageFile.h
engines/hpl1/engine/resources/LowLevelResources.h
engines/hpl1/engine/resources/MaterialManager.cpp
engines/hpl1/engine/resources/MaterialManager.h
engines/hpl1/engine/resources/MeshLoader.h
engines/hpl1/engine/resources/MeshLoaderHandler.cpp
engines/hpl1/engine/resources/MeshLoaderHandler.h
engines/hpl1/engine/resources/MeshManager.cpp
engines/hpl1/engine/resources/MeshManager.h
engines/hpl1/engine/resources/ParticleManager.cpp
engines/hpl1/engine/resources/ParticleManager.h
engines/hpl1/engine/resources/ResourceBase.cpp
engines/hpl1/engine/resources/ResourceBase.h
engines/hpl1/engine/resources/ResourceImage.cpp
engines/hpl1/engine/resources/ResourceImage.h
engines/hpl1/engine/resources/ResourceManager.cpp
engines/hpl1/engine/resources/ResourceManager.h
engines/hpl1/engine/resources/Resources.cpp
engines/hpl1/engine/resources/Resources.h
engines/hpl1/engine/resources/ResourcesTypes.h
engines/hpl1/engine/resources/ScriptManager.cpp
engines/hpl1/engine/resources/ScriptManager.h
engines/hpl1/engine/resources/SoundEntityManager.cpp
engines/hpl1/engine/resources/SoundEntityManager.h
engines/hpl1/engine/resources/SoundManager.cpp
engines/hpl1/engine/resources/SoundManager.h
engines/hpl1/engine/resources/TextureManager.cpp
engines/hpl1/engine/resources/TextureManager.h
engines/hpl1/engine/resources/TileSetManager.cpp
engines/hpl1/engine/resources/TileSetManager.h
engines/hpl1/engine/resources/VideoManager.cpp
engines/hpl1/engine/resources/VideoManager.h
engines/hpl1/engine/scene/AnimationState.cpp
engines/hpl1/engine/scene/AnimationState.h
engines/hpl1/engine/scene/Area2D.cpp
engines/hpl1/engine/scene/Area2D.h
engines/hpl1/engine/scene/Camera.h
engines/hpl1/engine/scene/Camera2D.cpp
engines/hpl1/engine/scene/Camera2D.h
engines/hpl1/engine/scene/Camera3D.cpp
engines/hpl1/engine/scene/Camera3D.h
engines/hpl1/engine/scene/ColliderEntity.cpp
engines/hpl1/engine/scene/ColliderEntity.h
engines/hpl1/engine/scene/Entity.cpp
engines/hpl1/engine/scene/Entity.h
engines/hpl1/engine/scene/Entity2D.cpp
engines/hpl1/engine/scene/Entity2D.h
engines/hpl1/engine/scene/Entity3D.cpp
engines/hpl1/engine/scene/Entity3D.h
engines/hpl1/engine/scene/GridMap2D.cpp
engines/hpl1/engine/scene/GridMap2D.h
engines/hpl1/engine/scene/ImageEntity.cpp
engines/hpl1/engine/scene/ImageEntity.h
engines/hpl1/engine/scene/Light.cpp
engines/hpl1/engine/scene/Light.h
engines/hpl1/engine/scene/Light2D.cpp
engines/hpl1/engine/scene/Light2D.h
engines/hpl1/engine/scene/Light2DPoint.cpp
engines/hpl1/engine/scene/Light2DPoint.h
engines/hpl1/engine/scene/Light3D.cpp
engines/hpl1/engine/scene/Light3D.h
engines/hpl1/engine/scene/Light3DPoint.cpp
engines/hpl1/engine/scene/Light3DPoint.h
engines/hpl1/engine/scene/Light3DSpot.cpp
engines/hpl1/engine/scene/Light3DSpot.h
engines/hpl1/engine/scene/MeshEntity.cpp
engines/hpl1/engine/scene/MeshEntity.h
engines/hpl1/engine/scene/MultiImageEntity.cpp
engines/hpl1/engine/scene/MultiImageEntity.h
engines/hpl1/engine/scene/Node.cpp
engines/hpl1/engine/scene/Node.h
engines/hpl1/engine/scene/Node2D.cpp
engines/hpl1/engine/scene/Node2D.h
engines/hpl1/engine/scene/Node3D.cpp
engines/hpl1/engine/scene/Node3D.h
engines/hpl1/engine/scene/NodeState.cpp
engines/hpl1/engine/scene/NodeState.h
engines/hpl1/engine/scene/PortalContainer.cpp
engines/hpl1/engine/scene/PortalContainer.h
engines/hpl1/engine/scene/RenderableContainer.h
engines/hpl1/engine/scene/Scene.cpp
engines/hpl1/engine/scene/Scene.h
engines/hpl1/engine/scene/SectorVisibility.cpp
engines/hpl1/engine/scene/SectorVisibility.h
engines/hpl1/engine/scene/SoundEntity.cpp
engines/hpl1/engine/scene/SoundEntity.h
engines/hpl1/engine/scene/SoundSource.cpp
engines/hpl1/engine/scene/SoundSource.h
engines/hpl1/engine/scene/SubMeshEntity.cpp
engines/hpl1/engine/scene/SubMeshEntity.h
engines/hpl1/engine/scene/Tile.cpp
engines/hpl1/engine/scene/Tile.h
engines/hpl1/engine/scene/TileData.cpp
engines/hpl1/engine/scene/TileData.h
engines/hpl1/engine/scene/TileLayer.cpp
engines/hpl1/engine/scene/TileLayer.h
engines/hpl1/engine/scene/TileMap.cpp
engines/hpl1/engine/scene/TileMap.h
engines/hpl1/engine/scene/TileMapIt.h
engines/hpl1/engine/scene/TileMapLineIt.cpp
engines/hpl1/engine/scene/TileMapLineIt.h
engines/hpl1/engine/scene/TileMapRectIt.cpp
engines/hpl1/engine/scene/TileMapRectIt.h
engines/hpl1/engine/scene/TileSet.cpp
engines/hpl1/engine/scene/TileSet.h
engines/hpl1/engine/scene/World2D.cpp
engines/hpl1/engine/scene/World2D.h
engines/hpl1/engine/scene/World3D.cpp
engines/hpl1/engine/scene/World3D.h
engines/hpl1/engine/sound/LowLevelSound.cpp
engines/hpl1/engine/sound/LowLevelSound.h
engines/hpl1/engine/sound/MusicHandler.cpp
engines/hpl1/engine/sound/MusicHandler.h
engines/hpl1/engine/sound/Sound.cpp
engines/hpl1/engine/sound/Sound.h
engines/hpl1/engine/sound/SoundChannel.h
engines/hpl1/engine/sound/SoundData.h
engines/hpl1/engine/sound/SoundEntityData.cpp
engines/hpl1/engine/sound/SoundEntityData.h
engines/hpl1/engine/sound/SoundEnvironment.h
engines/hpl1/engine/sound/SoundHandler.cpp
engines/hpl1/engine/sound/SoundHandler.h
engines/hpl1/engine/system/BinTree.h
engines/hpl1/engine/system/Container.cpp
engines/hpl1/engine/system/Container.h
engines/hpl1/engine/system/LogicTimer.cpp
engines/hpl1/engine/system/LogicTimer.h
engines/hpl1/engine/system/LowLevelSystem.h
engines/hpl1/engine/system/MemoryManager.cpp
engines/hpl1/engine/system/MemoryManager.h
engines/hpl1/engine/system/Script.h
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/engine/system/SerializeClass.h
engines/hpl1/engine/system/String.cpp
engines/hpl1/engine/system/String.h
engines/hpl1/engine/system/System.cpp
engines/hpl1/engine/system/System.h
engines/hpl1/engine/system/SystemTypes.h
engines/hpl1/hpl1.cpp
engines/hpl1/hpl1.h
engines/hpl1/metaengine.cpp
diff --git a/engines/hpl1/console.cpp b/engines/hpl1/console.cpp
index c9d08d87e4f..ee5b29ae58a 100644
--- a/engines/hpl1/console.cpp
+++ b/engines/hpl1/console.cpp
@@ -24,7 +24,7 @@
namespace Hpl1 {
Console::Console() : GUI::Debugger() {
- registerCmd("test", WRAP_METHOD(Console, Cmd_test));
+ registerCmd("test", WRAP_METHOD(Console, Cmd_test));
}
Console::~Console() {
diff --git a/engines/hpl1/console.h b/engines/hpl1/console.h
index 93f10668b27..124c647a618 100644
--- a/engines/hpl1/console.h
+++ b/engines/hpl1/console.h
@@ -30,6 +30,7 @@ namespace Hpl1 {
class Console : public GUI::Debugger {
private:
bool Cmd_test(int argc, const char **argv);
+
public:
Console();
~Console() override;
diff --git a/engines/hpl1/detection.h b/engines/hpl1/detection.h
index 3846265c0de..561e1021d25 100644
--- a/engines/hpl1/detection.h
+++ b/engines/hpl1/detection.h
@@ -28,10 +28,10 @@ namespace Hpl1 {
enum Hpl1DebugChannels {
kDebugGraphics = 1 << 0,
- kDebugPath = 1 << 1,
- kDebugScan = 1 << 2,
+ kDebugPath = 1 << 1,
+ kDebugScan = 1 << 2,
kDebugFilePath = 1 << 3,
- kDebugScript = 1 << 4
+ kDebugScript = 1 << 4
};
extern const PlainGameDescriptor GAME_NAMES[];
@@ -65,9 +65,9 @@ public:
DetectedGames detectGames(const Common::FSList &fslist, uint32 skipADFlags, bool skipIncomplete) override;
- PlainGameList getSupportedGames() const override;
+ PlainGameList getSupportedGames() const override;
- PlainGameDescriptor findGame(const char *gameid);
+ PlainGameDescriptor findGame(const char *gameid);
};
#endif
diff --git a/engines/hpl1/detection_tables.h b/engines/hpl1/detection_tables.h
index a486a6afd80..5560467cc30 100644
--- a/engines/hpl1/detection_tables.h
+++ b/engines/hpl1/detection_tables.h
@@ -22,22 +22,18 @@
namespace Hpl1 {
const PlainGameDescriptor GAME_NAMES[] = {
- { "penumbra_overture", "Penumbra: Overture" },
- { 0, 0 }
-};
+ {"penumbra_overture", "Penumbra: Overture"},
+ {0, 0}};
const ADGameDescription GAME_DESCRIPTIONS[] = {
- {
- "penumbra_overture",
- nullptr,
- AD_ENTRY1s("Penumbra.exe", nullptr, -1),
- Common::Language::EN_ANY,
- Common::Platform::kPlatformDOS,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
- },
+ {"penumbra_overture",
+ nullptr,
+ AD_ENTRY1s("Penumbra.exe", nullptr, -1),
+ Common::Language::EN_ANY,
+ Common::Platform::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)},
- AD_TABLE_END_MARKER
-};
+ AD_TABLE_END_MARKER};
} // namespace Hpl1
diff --git a/engines/hpl1/engine/ai/AI.cpp b/engines/hpl1/engine/ai/AI.cpp
index dc332ce8af6..d96817491b8 100644
--- a/engines/hpl1/engine/ai/AI.cpp
+++ b/engines/hpl1/engine/ai/AI.cpp
@@ -46,50 +46,42 @@
namespace hpl {
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAI::cAI() : iUpdateable("HPL_AI")
- {
- mpAINodeGenerator = hplNew( cAINodeGenerator, () );
- }
-
- //-----------------------------------------------------------------------
-
- cAI::~cAI()
- {
- hplDelete(mpAINodeGenerator);
- }
-
- //-----------------------------------------------------------------------
-
- //////////////////////////////////////////////////////////////////////////
- // PUBLIC METHODS
- //////////////////////////////////////////////////////////////////////////
+cAI::cAI() : iUpdateable("HPL_AI") {
+ mpAINodeGenerator = hplNew(cAINodeGenerator, ());
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cAI::Reset()
- {
+cAI::~cAI() {
+ hplDelete(mpAINodeGenerator);
+}
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
- void cAI::Update(float afTimeStep)
- {
+//-----------------------------------------------------------------------
- }
+void cAI::Reset() {
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cAI::Init()
- {
+void cAI::Update(float afTimeStep) {
+}
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+void cAI::Init() {
}
+
+//-----------------------------------------------------------------------
+} // namespace hpl
diff --git a/engines/hpl1/engine/ai/AI.h b/engines/hpl1/engine/ai/AI.h
index f7d395fcc24..5be5bc280c2 100644
--- a/engines/hpl1/engine/ai/AI.h
+++ b/engines/hpl1/engine/ai/AI.h
@@ -41,31 +41,30 @@
#ifndef HPL_AI_H
#define HPL_AI_H
-#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/game/GameTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/game/Updateable.h"
namespace hpl {
- class cAINodeGenerator;
+class cAINodeGenerator;
- class cAI : public iUpdateable
- {
- public:
- cAI();
- ~cAI();
+class cAI : public iUpdateable {
+public:
+ cAI();
+ ~cAI();
- void Reset();
- void Update(float afTimeStep);
+ void Reset();
+ void Update(float afTimeStep);
- void Init();
+ void Init();
- cAINodeGenerator *GetNodeGenerator(){ return mpAINodeGenerator;}
-
- private:
- cAINodeGenerator *mpAINodeGenerator;
- };
+ cAINodeGenerator *GetNodeGenerator() { return mpAINodeGenerator; }
+private:
+ cAINodeGenerator *mpAINodeGenerator;
};
+
+}; // namespace hpl
#endif // HPL_AI_H
diff --git a/engines/hpl1/engine/ai/AINodeContainer.cpp b/engines/hpl1/engine/ai/AINodeContainer.cpp
index 63441e34547..6f4fa4408b3 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.cpp
+++ b/engines/hpl1/engine/ai/AINodeContainer.cpp
@@ -40,631 +40,592 @@
#include "hpl1/engine/ai/AINodeContainer.h"
-#include "hpl1/engine/scene/World3D.h"
#include "hpl1/engine/physics/PhysicsBody.h"
-#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/scene/World3D.h"
#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/String.h"
#include "hpl1/engine/math/Math.h"
-
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include <algorithm>
namespace hpl {
- //////////////////////////////////////////////////////////////////////////
- // AI NODE
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// AI NODE
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAINode::cAINode()
- {
- }
+cAINode::cAINode() {
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAINode::~cAINode()
- {
- }
+cAINode::~cAINode() {
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cAINode::AddEdge(cAINode *pNode)
- {
- cAINodeEdge Edge;
+void cAINode::AddEdge(cAINode *pNode) {
+ cAINodeEdge Edge;
- Edge.mpNode = pNode;
- Edge.mfDistance = cMath::Vector3Dist(mvPosition, pNode->mvPosition);
- Edge.mfSqrDistance = cMath::Vector3DistSqr(mvPosition, pNode->mvPosition);
+ Edge.mpNode = pNode;
+ Edge.mfDistance = cMath::Vector3Dist(mvPosition, pNode->mvPosition);
+ Edge.mfSqrDistance = cMath::Vector3DistSqr(mvPosition, pNode->mvPosition);
- mvEdges.push_back(Edge);
- }
+ mvEdges.push_back(Edge);
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // RAY INTERSECT
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// RAY INTERSECT
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cAINodeRayCallback::Reset()
- {
- mbIntersected = false;
- mpCallback = NULL;
- }
+void cAINodeRayCallback::Reset() {
+ mbIntersected = false;
+ mpCallback = NULL;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- bool cAINodeRayCallback::Intersected()
- {
- return mbIntersected;
- }
+bool cAINodeRayCallback::Intersected() {
+ return mbIntersected;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- bool cAINodeRayCallback::BeforeIntersect(iPhysicsBody *pBody)
- {
- if(pBody->GetCollideCharacter()==false) return false;
+bool cAINodeRayCallback::BeforeIntersect(iPhysicsBody *pBody) {
+ if (pBody->GetCollideCharacter() == false)
+ return false;
- if( (mFlags & eAIFreePathFlag_SkipStatic) && pBody->GetMass() == 0) return false;
+ if ((mFlags & eAIFreePathFlag_SkipStatic) && pBody->GetMass() == 0)
+ return false;
- if( (mFlags & eAIFreePathFlag_SkipDynamic) &&
- (pBody->GetMass() > 0 || pBody->IsCharacter()) ) return false;
+ if ((mFlags & eAIFreePathFlag_SkipDynamic) &&
+ (pBody->GetMass() > 0 || pBody->IsCharacter()))
+ return false;
- if( (mFlags & eAIFreePathFlag_SkipVolatile) && pBody->IsVolatile()) return false;
+ if ((mFlags & eAIFreePathFlag_SkipVolatile) && pBody->IsVolatile())
+ return false;
- return true;
- }
+ return true;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- bool cAINodeRayCallback::OnIntersect(iPhysicsBody *pBody,cPhysicsRayParams *apParams)
- {
- if(mpCallback)
- {
- if(mpCallback->Intersects(pBody,apParams))
- {
- mbIntersected = true;
- return false;
- }
- else
- {
- return true;
- }
- }
- else
- {
+bool cAINodeRayCallback::OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
+ if (mpCallback) {
+ if (mpCallback->Intersects(pBody, apParams)) {
mbIntersected = true;
return false;
+ } else {
+ return true;
}
+ } else {
+ mbIntersected = true;
+ return false;
}
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAINodeIterator::cAINodeIterator(cAINodeContainer *apContainer, const cVector3f &avPos, float afRadius)
- {
- mpContainer = apContainer;
- mvPosition = avPos;
- mfRadius = afRadius;
+cAINodeIterator::cAINodeIterator(cAINodeContainer *apContainer, const cVector3f &avPos, float afRadius) {
+ mpContainer = apContainer;
+ mvPosition = avPos;
+ mfRadius = afRadius;
- //Calculate local position
- cVector2f vLocalPos(mvPosition.x, mvPosition.z);
- vLocalPos -= mpContainer->mvMinGridPos;
+ // Calculate local position
+ cVector2f vLocalPos(mvPosition.x, mvPosition.z);
+ vLocalPos -= mpContainer->mvMinGridPos;
- cVector2f vLocalStart = vLocalPos - cVector2f(afRadius);
- cVector2f vLocalEnd = vLocalPos + cVector2f(afRadius);
+ cVector2f vLocalStart = vLocalPos - cVector2f(afRadius);
+ cVector2f vLocalEnd = vLocalPos + cVector2f(afRadius);
- mvStartGridPos = mpContainer->GetGridPosFromLocal(vLocalStart);
- mvEndGridPos = mpContainer->GetGridPosFromLocal(vLocalEnd);
- mvGridPos = mvStartGridPos;
+ mvStartGridPos = mpContainer->GetGridPosFromLocal(vLocalStart);
+ mvEndGridPos = mpContainer->GetGridPosFromLocal(vLocalEnd);
+ mvGridPos = mvStartGridPos;
- mpNodeList = &mpContainer->GetGrid(mvGridPos)->mlstNodes;
- while(mpNodeList->empty())
- {
- if(IncGridPos())
- {
- mpNodeList = &mpContainer->GetGrid(mvGridPos)->mlstNodes;
- }
- else
- {
- mpNodeList = NULL;
- break;
- }
- }
-
- if(mpNodeList){
- mNodeIt = mpNodeList->begin();
+ mpNodeList = &mpContainer->GetGrid(mvGridPos)->mlstNodes;
+ while (mpNodeList->empty()) {
+ if (IncGridPos()) {
+ mpNodeList = &mpContainer->GetGrid(mvGridPos)->mlstNodes;
+ } else {
+ mpNodeList = NULL;
+ break;
}
+ }
- //Log("--------------------------------------\n");
- //Log("Iterating (%d %d) -> (%d %d)\n", mvStartGridPos.x,mvStartGridPos.y,
- // mvEndGridPos.x,mvEndGridPos.y);
+ if (mpNodeList) {
+ mNodeIt = mpNodeList->begin();
}
- //-----------------------------------------------------------------------
+ // Log("--------------------------------------\n");
+ // Log("Iterating (%d %d) -> (%d %d)\n", mvStartGridPos.x,mvStartGridPos.y,
+ // mvEndGridPos.x,mvEndGridPos.y);
+}
- bool cAINodeIterator::HasNext()
- {
- if(mpNodeList==NULL || mpNodeList->empty()) return false;
+//-----------------------------------------------------------------------
- return true;
- }
+bool cAINodeIterator::HasNext() {
+ if (mpNodeList == NULL || mpNodeList->empty())
+ return false;
- //-----------------------------------------------------------------------
+ return true;
+}
- cAINode *cAINodeIterator::Next()
- {
- cAINode* pNode = *mNodeIt;
+//-----------------------------------------------------------------------
- ++mNodeIt;
- if(mNodeIt == mpNodeList->end())
- {
- if(IncGridPos())
- {
- mpNodeList = &mpContainer->GetGrid(mvGridPos)->mlstNodes;
- while(mpNodeList->empty())
- {
- if(IncGridPos()){
- mpNodeList = &mpContainer->GetGrid(mvGridPos)->mlstNodes;
- }
- else{
- mpNodeList = NULL;
- break;
- }
+cAINode *cAINodeIterator::Next() {
+ cAINode *pNode = *mNodeIt;
+
+ ++mNodeIt;
+ if (mNodeIt == mpNodeList->end()) {
+ if (IncGridPos()) {
+ mpNodeList = &mpContainer->GetGrid(mvGridPos)->mlstNodes;
+ while (mpNodeList->empty()) {
+ if (IncGridPos()) {
+ mpNodeList = &mpContainer->GetGrid(mvGridPos)->mlstNodes;
+ } else {
+ mpNodeList = NULL;
+ break;
}
}
- else
- {
- mpNodeList = NULL;
- }
-
- if(mpNodeList) mNodeIt = mpNodeList->begin();
+ } else {
+ mpNodeList = NULL;
}
- return pNode;
+ if (mpNodeList)
+ mNodeIt = mpNodeList->begin();
}
- //-----------------------------------------------------------------------
+ return pNode;
+}
- bool cAINodeIterator::IncGridPos()
- {
- mvGridPos.x++;
- if(mvGridPos.x > mvEndGridPos.x)
- {
- mvGridPos.x = mvStartGridPos.x;
- mvGridPos.y++;
- if(mvGridPos.y > mvEndGridPos.y){
- return false;
- }
- }
+//-----------------------------------------------------------------------
- return true;
+bool cAINodeIterator::IncGridPos() {
+ mvGridPos.x++;
+ if (mvGridPos.x > mvEndGridPos.x) {
+ mvGridPos.x = mvStartGridPos.x;
+ mvGridPos.y++;
+ if (mvGridPos.y > mvEndGridPos.y) {
+ return false;
+ }
}
- //-----------------------------------------------------------------------
+ return true;
+}
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
- cAINodeContainer::cAINodeContainer( const tString& asName, const tString &asNodeName,
- cWorld3D *apWorld, const cVector3f &avCollideSize)
- {
- mpWorld = apWorld;
- mvSize = avCollideSize;
- msName = asName;
- msNodeName = asNodeName;
+//-----------------------------------------------------------------------
- mpRayCallback = hplNew( cAINodeRayCallback, () );
+cAINodeContainer::cAINodeContainer(const tString &asName, const tString &asNodeName,
+ cWorld3D *apWorld, const cVector3f &avCollideSize) {
+ mpWorld = apWorld;
+ mvSize = avCollideSize;
+ msName = asName;
+ msNodeName = asNodeName;
- mlMaxNodeEnds = 5;
- mlMinNodeEnds = 2;
- mfMaxEndDistance = 3.0f;
- mfMaxHeight = 0.1f;
+ mpRayCallback = hplNew(cAINodeRayCallback, ());
- mlNodesPerGrid = 6;
+ mlMaxNodeEnds = 5;
+ mlMinNodeEnds = 2;
+ mfMaxEndDistance = 3.0f;
+ mfMaxHeight = 0.1f;
- mbNodeIsAtCenter = true;
- }
+ mlNodesPerGrid = 6;
- //-----------------------------------------------------------------------
+ mbNodeIsAtCenter = true;
+}
- cAINodeContainer::~cAINodeContainer()
- {
- hplDelete(mpRayCallback);
+//-----------------------------------------------------------------------
- STLDeleteAll(mvNodes);
- }
+cAINodeContainer::~cAINodeContainer() {
+ hplDelete(mpRayCallback);
- //-----------------------------------------------------------------------
+ STLDeleteAll(mvNodes);
+}
- //////////////////////////////////////////////////////////////////////////
- // PUBLIC METHODS
- //////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
- void cAINodeContainer::ReserveSpace(size_t alReserveSpace)
- {
- mvNodes.reserve(alReserveSpace);
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
-
- void cAINodeContainer::AddNode(const tString &asName, const cVector3f &avPosition, void *apUserData)
- {
- cAINode *pNode = hplNew( cAINode, () );
- pNode->msName = asName;
- pNode->mvPosition = avPosition;
- pNode->mpUserData = apUserData;
+void cAINodeContainer::ReserveSpace(size_t alReserveSpace) {
+ mvNodes.reserve(alReserveSpace);
+}
- mvNodes.push_back(pNode);
- m_mapNodes.insert(tAINodeMap::value_type(asName,pNode));
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+void cAINodeContainer::AddNode(const tString &asName, const cVector3f &avPosition, void *apUserData) {
+ cAINode *pNode = hplNew(cAINode, ());
+ pNode->msName = asName;
+ pNode->mvPosition = avPosition;
+ pNode->mpUserData = apUserData;
- int cAINodeContainer::GetNodeNum() const
- {
- return (int)mvNodes.size();
- }
+ mvNodes.push_back(pNode);
+ m_mapNodes.insert(tAINodeMap::value_type(asName, pNode));
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAINode* cAINodeContainer::GetNodeFromName(const tString &asName)
- {
- tAINodeMapIt it = m_mapNodes.find(asName);
- if(it == m_mapNodes.end())
- {
- return NULL;
- }
+int cAINodeContainer::GetNodeNum() const {
+ return (int)mvNodes.size();
+}
- return it->second;
+//-----------------------------------------------------------------------
- //return (cAINode*)STLFindByName(mvNodes,asName);
+cAINode *cAINodeContainer::GetNodeFromName(const tString &asName) {
+ tAINodeMapIt it = m_mapNodes.find(asName);
+ if (it == m_mapNodes.end()) {
+ return NULL;
}
- //-----------------------------------------------------------------------
+ return it->second;
- class cSortEndNodes
- {
- public:
- bool operator()(const cAINodeEdge &aEndA, const cAINodeEdge &aEndB)
- {
- return aEndA.mfDistance < aEndB.mfDistance;
- }
- };
-
- void cAINodeContainer::Compile()
- {
- BuildNodeGridMap();
-
- tAINodeVecIt CurrentNodeIt = mvNodes.begin();
- for(; CurrentNodeIt != mvNodes.end(); ++CurrentNodeIt)
- {
- cAINode *pNode = *CurrentNodeIt;
-
- ////////////////////////////////////////
- //Add the ends that are connected to the node.
- /*Log("Node %s checks: ",pNode->GetName().c_str());
- tAINodeVecIt EndNodeIt = mvNodes.begin();
- for(; EndNodeIt != mvNodes.end(); ++EndNodeIt)
- {
- cAINode *pEndNode = *EndNodeIt;
-
- if(pEndNode == pNode) continue;
- float fDist = cMath::Vector3Dist(pNode->mvPosition, pEndNode->mvPosition);
- if(fDist > mfMaxEndDistance*2) continue;
- Log("'%s'(%f) ",pEndNode->GetName().c_str(),fDist);
+ // return (cAINode*)STLFindByName(mvNodes,asName);
+}
- float fHeight = fabs(pNode->mvPosition.y - pEndNode->mvPosition.y);
+//-----------------------------------------------------------------------
- if( fHeight <= mfMaxHeight &&
- FreePath(pNode->mvPosition, pEndNode->mvPosition,-1,eAIFreePathFlag_SkipDynamic))
- {
- pNode->AddEdge(pEndNode);
- Log("Added!");
- }
- Log(", ");
- }
- Log("\n");*/
- //Log("Node %s checks: ",pNode->GetName().c_str());
- cAINodeIterator nodeIt = GetNodeIterator(pNode->mvPosition,mfMaxEndDistance*1.5f);
- while(nodeIt.HasNext())
- {
- cAINode *pEndNode = nodeIt.Next();
+class cSortEndNodes {
+public:
+ bool operator()(const cAINodeEdge &aEndA, const cAINodeEdge &aEndB) {
+ return aEndA.mfDistance < aEndB.mfDistance;
+ }
+};
- if(pEndNode == pNode) continue;
- float fDist = cMath::Vector3Dist(pNode->mvPosition, pEndNode->mvPosition);
- if(fDist > mfMaxEndDistance*2) continue;
- //Log("'%s'(%f) ",pEndNode->GetName().c_str(),fDist);
+void cAINodeContainer::Compile() {
+ BuildNodeGridMap();
- float fHeight = fabs(pNode->mvPosition.y - pEndNode->mvPosition.y);
+ tAINodeVecIt CurrentNodeIt = mvNodes.begin();
+ for (; CurrentNodeIt != mvNodes.end(); ++CurrentNodeIt) {
+ cAINode *pNode = *CurrentNodeIt;
- tAIFreePathFlag flag = eAIFreePathFlag_SkipDynamic | eAIFreePathFlag_SkipVolatile;
- if( fHeight <= mfMaxHeight &&
- FreePath(pNode->mvPosition, pEndNode->mvPosition,-1,flag))
- {
- pNode->AddEdge(pEndNode);
- //Log("Added!");
- }
- //Log(", ");
- }
- //Log("\n");
+ ////////////////////////////////////////
+ // Add the ends that are connected to the node.
+ /*Log("Node %s checks: ",pNode->GetName().c_str());
+ tAINodeVecIt EndNodeIt = mvNodes.begin();
+ for(; EndNodeIt != mvNodes.end(); ++EndNodeIt)
+ {
+ cAINode *pEndNode = *EndNodeIt;
+ if(pEndNode == pNode) continue;
+ float fDist = cMath::Vector3Dist(pNode->mvPosition, pEndNode->mvPosition);
+ if(fDist > mfMaxEndDistance*2) continue;
+ Log("'%s'(%f) ",pEndNode->GetName().c_str(),fDist);
- ///////////////////////////////////////
- //Sort nodes and remove unwanted ones.
- std::sort(pNode->mvEdges.begin(), pNode->mvEdges.end(), cSortEndNodes());
+ float fHeight = fabs(pNode->mvPosition.y - pEndNode->mvPosition.y);
- //Resize if to too large
- if(mlMaxNodeEnds > 0 && (int)pNode->mvEdges.size() > mlMaxNodeEnds)
+ if( fHeight <= mfMaxHeight &&
+ FreePath(pNode->mvPosition, pEndNode->mvPosition,-1,eAIFreePathFlag_SkipDynamic))
{
- pNode->mvEdges.resize(mlMaxNodeEnds);
+ pNode->AddEdge(pEndNode);
+ Log("Added!");
}
-
- //Remove ends to far, but skip if min nodes is not met
- for(size_t i=0; i< pNode->mvEdges.size(); ++i)
- {
- if( pNode->mvEdges[i].mfDistance > mfMaxEndDistance && (int)i >= mlMinNodeEnds)
- {
- pNode->mvEdges.resize(i);
- break;
- }
+ Log(", ");
+ }
+ Log("\n");*/
+ // Log("Node %s checks: ",pNode->GetName().c_str());
+ cAINodeIterator nodeIt = GetNodeIterator(pNode->mvPosition, mfMaxEndDistance * 1.5f);
+ while (nodeIt.HasNext()) {
+ cAINode *pEndNode = nodeIt.Next();
+
+ if (pEndNode == pNode)
+ continue;
+ float fDist = cMath::Vector3Dist(pNode->mvPosition, pEndNode->mvPosition);
+ if (fDist > mfMaxEndDistance * 2)
+ continue;
+ // Log("'%s'(%f) ",pEndNode->GetName().c_str(),fDist);
+
+ float fHeight = fabs(pNode->mvPosition.y - pEndNode->mvPosition.y);
+
+ tAIFreePathFlag flag = eAIFreePathFlag_SkipDynamic | eAIFreePathFlag_SkipVolatile;
+ if (fHeight <= mfMaxHeight &&
+ FreePath(pNode->mvPosition, pEndNode->mvPosition, -1, flag)) {
+ pNode->AddEdge(pEndNode);
+ // Log("Added!");
}
+ // Log(", ");
+ }
+ // Log("\n");
- //Log(" Final edge count: %d\n",pNode->mvEdges.size());
+ ///////////////////////////////////////
+ // Sort nodes and remove unwanted ones.
+ std::sort(pNode->mvEdges.begin(), pNode->mvEdges.end(), cSortEndNodes());
+
+ // Resize if to too large
+ if (mlMaxNodeEnds > 0 && (int)pNode->mvEdges.size() > mlMaxNodeEnds) {
+ pNode->mvEdges.resize(mlMaxNodeEnds);
}
- }
- //-----------------------------------------------------------------------
+ // Remove ends to far, but skip if min nodes is not met
+ for (size_t i = 0; i < pNode->mvEdges.size(); ++i) {
+ if (pNode->mvEdges[i].mfDistance > mfMaxEndDistance && (int)i >= mlMinNodeEnds) {
+ pNode->mvEdges.resize(i);
+ break;
+ }
+ }
- void cAINodeContainer::BuildNodeGridMap()
- {
- bool bLog=false;
+ // Log(" Final edge count: %d\n",pNode->mvEdges.size());
+ }
+}
- if(bLog)Log("Nodes: %d\n",mvNodes.size());
+//-----------------------------------------------------------------------
- ////////////////////////////////////
- // Calculate min and max
- cVector2f vMin(mvNodes[0]->GetPosition().x,mvNodes[0]->GetPosition().z);
- cVector2f vMax(mvNodes[0]->GetPosition().x,mvNodes[0]->GetPosition().z);
+void cAINodeContainer::BuildNodeGridMap() {
+ bool bLog = false;
- for(size_t i=1; i< mvNodes.size(); ++i)
- {
- cAINode *pNode = mvNodes[i];
+ if (bLog)
+ Log("Nodes: %d\n", mvNodes.size());
- if(vMin.x > pNode->GetPosition().x) vMin.x = pNode->GetPosition().x;
- if(vMin.y > pNode->GetPosition().z) vMin.y = pNode->GetPosition().z;
+ ////////////////////////////////////
+ // Calculate min and max
+ cVector2f vMin(mvNodes[0]->GetPosition().x, mvNodes[0]->GetPosition().z);
+ cVector2f vMax(mvNodes[0]->GetPosition().x, mvNodes[0]->GetPosition().z);
- if(vMax.x < pNode->GetPosition().x) vMax.x = pNode->GetPosition().x;
- if(vMax.y < pNode->GetPosition().z) vMax.y = pNode->GetPosition().z;
- }
+ for (size_t i = 1; i < mvNodes.size(); ++i) {
+ cAINode *pNode = mvNodes[i];
- mvMinGridPos = vMin;
- mvMaxGridPos = vMax;
+ if (vMin.x > pNode->GetPosition().x)
+ vMin.x = pNode->GetPosition().x;
+ if (vMin.y > pNode->GetPosition().z)
+ vMin.y = pNode->GetPosition().z;
- ////////////////////////////////////
- // Determine size of grids
- int lGridNum = (int)(sqrt((float)mvNodes.size() / (float)mlNodesPerGrid)+0.5f)+1;
+ if (vMax.x < pNode->GetPosition().x)
+ vMax.x = pNode->GetPosition().x;
+ if (vMax.y < pNode->GetPosition().z)
+ vMax.y = pNode->GetPosition().z;
+ }
- if(bLog)Log("Grid Num: %d\n",lGridNum);
+ mvMinGridPos = vMin;
+ mvMaxGridPos = vMax;
- mvGridMapSize.x = lGridNum;
- mvGridMapSize.y = lGridNum;
+ ////////////////////////////////////
+ // Determine size of grids
+ int lGridNum = (int)(sqrt((float)mvNodes.size() / (float)mlNodesPerGrid) + 0.5f) + 1;
- //+1 to fix so that nodes on the border has a grid)
- mvGrids.resize((lGridNum+1) * (lGridNum+1));
+ if (bLog)
+ Log("Grid Num: %d\n", lGridNum);
- mvGridSize = (mvMaxGridPos - mvMinGridPos);
- mvGridSize.x /= (float)mvGridMapSize.x;
- mvGridSize.y /= (float)mvGridMapSize.y;
+ mvGridMapSize.x = lGridNum;
+ mvGridMapSize.y = lGridNum;
- if(bLog)Log("GridSize: %f : %f\n",mvGridSize.x,mvGridSize.y);
- if(bLog)Log("MinPos: %s\n",mvMinGridPos.ToString().c_str());
- if(bLog)Log("MaxPos: %s\n",mvMaxGridPos.ToString().c_str());
+ //+1 to fix so that nodes on the border has a grid)
+ mvGrids.resize((lGridNum + 1) * (lGridNum + 1));
- ////////////////////////////////////
- // Add nodes to grid
- for(size_t i=0; i< mvNodes.size(); ++i)
- {
- cAINode *pNode = mvNodes[i];
+ mvGridSize = (mvMaxGridPos - mvMinGridPos);
+ mvGridSize.x /= (float)mvGridMapSize.x;
+ mvGridSize.y /= (float)mvGridMapSize.y;
- cVector2f vLocalPos(pNode->GetPosition().x, pNode->GetPosition().z);
- vLocalPos -= mvMinGridPos;
+ if (bLog)
+ Log("GridSize: %f : %f\n", mvGridSize.x, mvGridSize.y);
+ if (bLog)
+ Log("MinPos: %s\n", mvMinGridPos.ToString().c_str());
+ if (bLog)
+ Log("MaxPos: %s\n", mvMaxGridPos.ToString().c_str());
- cVector2l vGridPos(0);
- //Have checks so we are sure there is no division by zero.
- if(mvGridSize.x >0)
- vGridPos.x = (int)(vLocalPos.x / mvGridSize.x);
- if(mvGridSize.y >0)
- vGridPos.y = (int)(vLocalPos.y / mvGridSize.y);
+ ////////////////////////////////////
+ // Add nodes to grid
+ for (size_t i = 0; i < mvNodes.size(); ++i) {
+ cAINode *pNode = mvNodes[i];
- if(false)Log("Adding node %d, world: (%s) local (%s), at %d : %d\n",i,
- pNode->GetPosition().ToString().c_str(),
- vLocalPos.ToString().c_str(),
- vGridPos.x,vGridPos.y);
+ cVector2f vLocalPos(pNode->GetPosition().x, pNode->GetPosition().z);
+ vLocalPos -= mvMinGridPos;
- mvGrids[vGridPos.y * (mvGridMapSize.x+1) + vGridPos.x].mlstNodes.push_back(pNode);
- }
- }
+ cVector2l vGridPos(0);
+ // Have checks so we are sure there is no division by zero.
+ if (mvGridSize.x > 0)
+ vGridPos.x = (int)(vLocalPos.x / mvGridSize.x);
+ if (mvGridSize.y > 0)
+ vGridPos.y = (int)(vLocalPos.y / mvGridSize.y);
- //-----------------------------------------------------------------------
+ if (false)
+ Log("Adding node %d, world: (%s) local (%s), at %d : %d\n", i,
+ pNode->GetPosition().ToString().c_str(),
+ vLocalPos.ToString().c_str(),
+ vGridPos.x, vGridPos.y);
- cAINodeIterator cAINodeContainer::GetNodeIterator(const cVector3f &avPosition, float afRadius)
- {
- return cAINodeIterator(this,avPosition, afRadius);
+ mvGrids[vGridPos.y * (mvGridMapSize.x + 1) + vGridPos.x].mlstNodes.push_back(pNode);
}
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- static const cVector2f gvPosAdds[] = {cVector2f(0,0),
- cVector2f(1,0),
- cVector2f(-1,0),
- cVector2f(0,1),
- cVector2f(0,-1)
- };
+cAINodeIterator cAINodeContainer::GetNodeIterator(const cVector3f &avPosition, float afRadius) {
+ return cAINodeIterator(this, avPosition, afRadius);
+}
- bool cAINodeContainer::FreePath(const cVector3f &avStart, const cVector3f &avEnd, int alRayNum,
- tAIFreePathFlag aFlags,iAIFreePathCallback *apCallback)
- {
- iPhysicsWorld *pPhysicsWorld = mpWorld->GetPhysicsWorld();
- if(pPhysicsWorld==NULL) return true;
+//-----------------------------------------------------------------------
+static const cVector2f gvPosAdds[] = {cVector2f(0, 0),
+ cVector2f(1, 0),
+ cVector2f(-1, 0),
+ cVector2f(0, 1),
+ cVector2f(0, -1)};
- if(alRayNum<0 || alRayNum>5) alRayNum =5;
+bool cAINodeContainer::FreePath(const cVector3f &avStart, const cVector3f &avEnd, int alRayNum,
+ tAIFreePathFlag aFlags, iAIFreePathCallback *apCallback) {
+ iPhysicsWorld *pPhysicsWorld = mpWorld->GetPhysicsWorld();
+ if (pPhysicsWorld == NULL)
+ return true;
- /////////////////////////////
- //Calculate the right vector
- const cVector3f vForward = cMath::Vector3Normalize(avEnd - avStart);
- const cVector3f vUp = cVector3f(0,1.0f,0);
- const cVector3f vRight = cMath::Vector3Cross(vForward, vUp);
+ if (alRayNum < 0 || alRayNum > 5)
+ alRayNum = 5;
- //Get the center
- const cVector3f vStartCenter = mbNodeIsAtCenter ? avStart : avStart + cVector3f(0,mvSize.y/2,0);
- const cVector3f vEndCenter = mbNodeIsAtCenter ? avEnd : avEnd + cVector3f(0,mvSize.y/2,0);
+ /////////////////////////////
+ // Calculate the right vector
+ const cVector3f vForward = cMath::Vector3Normalize(avEnd - avStart);
+ const cVector3f vUp = cVector3f(0, 1.0f, 0);
+ const cVector3f vRight = cMath::Vector3Cross(vForward, vUp);
- //Get the half with and height. Make them a little smaller so that player can slide over funk on floor.
- const float fHalfWidth = mvSize.x * 0.4f;
- const float fHalfHeight = mvSize.y * 0.4f;
+ // Get the center
+ const cVector3f vStartCenter = mbNodeIsAtCenter ? avStart : avStart + cVector3f(0, mvSize.y / 2, 0);
+ const cVector3f vEndCenter = mbNodeIsAtCenter ? avEnd : avEnd + cVector3f(0, mvSize.y / 2, 0);
- //Setup ray callback
- mpRayCallback->SetFlags(aFlags);
+ // Get the half with and height. Make them a little smaller so that player can slide over funk on floor.
+ const float fHalfWidth = mvSize.x * 0.4f;
+ const float fHalfHeight = mvSize.y * 0.4f;
- //Iterate through all the rays.
- for(int i=0; i< alRayNum; ++i)
- {
- cVector3f vAdd = vRight * (gvPosAdds[i].x*fHalfWidth) + vUp * (gvPosAdds[i].y*fHalfHeight);
- cVector3f vStart = vStartCenter + vAdd;
- cVector3f vEnd = vEndCenter + vAdd;
+ // Setup ray callback
+ mpRayCallback->SetFlags(aFlags);
- mpRayCallback->Reset();
- mpRayCallback->mpCallback = apCallback;
+ // Iterate through all the rays.
+ for (int i = 0; i < alRayNum; ++i) {
+ cVector3f vAdd = vRight * (gvPosAdds[i].x * fHalfWidth) + vUp * (gvPosAdds[i].y * fHalfHeight);
+ cVector3f vStart = vStartCenter + vAdd;
+ cVector3f vEnd = vEndCenter + vAdd;
- pPhysicsWorld->CastRay(mpRayCallback,vStart,vEnd,false,false,false,true);
+ mpRayCallback->Reset();
+ mpRayCallback->mpCallback = apCallback;
- if(mpRayCallback->Intersected()) return false;
- }
+ pPhysicsWorld->CastRay(mpRayCallback, vStart, vEnd, false, false, false, true);
- return true;
+ if (mpRayCallback->Intersected())
+ return false;
}
- //-----------------------------------------------------------------------
+ return true;
+}
- void cAINodeContainer::SaveToFile(const tString &asFile)
- {
- TiXmlDocument* pXmlDoc = hplNew( TiXmlDocument,(asFile.c_str()) );
+//-----------------------------------------------------------------------
- TiXmlElement *pRootElem = static_cast<TiXmlElement*>(pXmlDoc->InsertEndChild(TiXmlElement("AINodes")));
+void cAINodeContainer::SaveToFile(const tString &asFile) {
+ TiXmlDocument *pXmlDoc = hplNew(TiXmlDocument, (asFile.c_str()));
- for(size_t i=0; i< mvNodes.size(); ++i)
- {
- cAINode * pNode = mvNodes[i];
- TiXmlElement *pNodeElem = static_cast<TiXmlElement*>(pRootElem->InsertEndChild(TiXmlElement("Node")));
+ TiXmlElement *pRootElem = static_cast<TiXmlElement *>(pXmlDoc->InsertEndChild(TiXmlElement("AINodes")));
- pNodeElem->SetAttribute("Name", pNode->GetName().c_str());
+ for (size_t i = 0; i < mvNodes.size(); ++i) {
+ cAINode *pNode = mvNodes[i];
+ TiXmlElement *pNodeElem = static_cast<TiXmlElement *>(pRootElem->InsertEndChild(TiXmlElement("Node")));
- for(int edge =0; edge < pNode->GetEdgeNum(); ++edge)
- {
- cAINodeEdge *pEdge = pNode->GetEdge(edge);
- TiXmlElement *pEdgeElem = static_cast<TiXmlElement*>(pNodeElem->InsertEndChild(TiXmlElement("Edge")));
+ pNodeElem->SetAttribute("Name", pNode->GetName().c_str());
- pEdgeElem->SetAttribute("Node", pEdge->mpNode->GetName().c_str());
- tString sDistance = cString::ToString(pEdge->mfDistance);
- pEdgeElem->SetAttribute("Distance", sDistance.c_str());
- }
- }
+ for (int edge = 0; edge < pNode->GetEdgeNum(); ++edge) {
+ cAINodeEdge *pEdge = pNode->GetEdge(edge);
+ TiXmlElement *pEdgeElem = static_cast<TiXmlElement *>(pNodeElem->InsertEndChild(TiXmlElement("Edge")));
- if(pXmlDoc->SaveFile()==false)
- {
- Error("Couldn't save XML file %s\n",asFile.c_str());
+ pEdgeElem->SetAttribute("Node", pEdge->mpNode->GetName().c_str());
+ tString sDistance = cString::ToString(pEdge->mfDistance);
+ pEdgeElem->SetAttribute("Distance", sDistance.c_str());
}
- hplDelete(pXmlDoc);
}
- //-----------------------------------------------------------------------
+ if (pXmlDoc->SaveFile() == false) {
+ Error("Couldn't save XML file %s\n", asFile.c_str());
+ }
+ hplDelete(pXmlDoc);
+}
- void cAINodeContainer::LoadFromFile(const tString &asFile)
- {
- BuildNodeGridMap();
+//-----------------------------------------------------------------------
- TiXmlDocument* pXmlDoc = hplNew( TiXmlDocument, (asFile.c_str()) );
- if(pXmlDoc->LoadFile()==false)
- {
- Warning("Couldn't open XML file %s\n",asFile.c_str());
- hplDelete(pXmlDoc);
- return;
- }
+void cAINodeContainer::LoadFromFile(const tString &asFile) {
+ BuildNodeGridMap();
- TiXmlElement *pRootElem = pXmlDoc->RootElement();
+ TiXmlDocument *pXmlDoc = hplNew(TiXmlDocument, (asFile.c_str()));
+ if (pXmlDoc->LoadFile() == false) {
+ Warning("Couldn't open XML file %s\n", asFile.c_str());
+ hplDelete(pXmlDoc);
+ return;
+ }
- TiXmlElement *pNodeElem = pRootElem->FirstChildElement("Node");
- for(; pNodeElem != NULL; pNodeElem = pNodeElem->NextSiblingElement("Node"))
- {
- tString sName = cString::ToString(pNodeElem->Attribute("Name"),"");
+ TiXmlElement *pRootElem = pXmlDoc->RootElement();
- cAINode *pNode = GetNodeFromName(sName);
+ TiXmlElement *pNodeElem = pRootElem->FirstChildElement("Node");
+ for (; pNodeElem != NULL; pNodeElem = pNodeElem->NextSiblingElement("Node")) {
+ tString sName = cString::ToString(pNodeElem->Attribute("Name"), "");
- TiXmlElement *pEdgeElem = pNodeElem->FirstChildElement("Edge");
- for(; pEdgeElem != NULL; pEdgeElem = pEdgeElem->NextSiblingElement("Edge"))
- {
- tString sNodeName = cString::ToString(pEdgeElem->Attribute("Node"),"");
- cAINode *pEdgeNode = GetNodeFromName(sNodeName);
+ cAINode *pNode = GetNodeFromName(sName);
- cAINodeEdge Edge;
- Edge.mpNode = pEdgeNode;
- Edge.mfDistance = cString::ToFloat(pEdgeElem->Attribute("Distance"),0);
- Edge.mfSqrDistance = Edge.mfDistance*Edge.mfDistance;
+ TiXmlElement *pEdgeElem = pNodeElem->FirstChildElement("Edge");
+ for (; pEdgeElem != NULL; pEdgeElem = pEdgeElem->NextSiblingElement("Edge")) {
+ tString sNodeName = cString::ToString(pEdgeElem->Attribute("Node"), "");
+ cAINode *pEdgeNode = GetNodeFromName(sNodeName);
- pNode->mvEdges.push_back(Edge);
- }
- }
+ cAINodeEdge Edge;
+ Edge.mpNode = pEdgeNode;
+ Edge.mfDistance = cString::ToFloat(pEdgeElem->Attribute("Distance"), 0);
+ Edge.mfSqrDistance = Edge.mfDistance * Edge.mfDistance;
- hplDelete(pXmlDoc);
+ pNode->mvEdges.push_back(Edge);
+ }
}
- //-----------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // PRIVATE METHODS
- //////////////////////////////////////////////////////////////////////////
+ hplDelete(pXmlDoc);
+}
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
- cVector2l cAINodeContainer::GetGridPosFromLocal(const cVector2f &avLocalPos)
- {
- cVector2l vGridPos;
- vGridPos.x = (int)(avLocalPos.x / mvGridSize.x);
- vGridPos.y = (int)(avLocalPos.y / mvGridSize.y);
+//-----------------------------------------------------------------------
- if(vGridPos.x <0)vGridPos.x =0;
- if(vGridPos.y <0)vGridPos.y =0;
- if(vGridPos.x > mvGridMapSize.x) vGridPos.x = mvGridMapSize.x;
- if(vGridPos.y > mvGridMapSize.y) vGridPos.y = mvGridMapSize.y;
+cVector2l cAINodeContainer::GetGridPosFromLocal(const cVector2f &avLocalPos) {
+ cVector2l vGridPos;
+ vGridPos.x = (int)(avLocalPos.x / mvGridSize.x);
+ vGridPos.y = (int)(avLocalPos.y / mvGridSize.y);
- return vGridPos;
- }
+ if (vGridPos.x < 0)
+ vGridPos.x = 0;
+ if (vGridPos.y < 0)
+ vGridPos.y = 0;
+ if (vGridPos.x > mvGridMapSize.x)
+ vGridPos.x = mvGridMapSize.x;
+ if (vGridPos.y > mvGridMapSize.y)
+ vGridPos.y = mvGridMapSize.y;
- //-----------------------------------------------------------------------
+ return vGridPos;
+}
- cAIGridNode* cAINodeContainer::GetGrid(const cVector2l& avPos)
- {
- int lIndex = avPos.y * (mvGridMapSize.x+1) + avPos.x;
- //Log(" index: %d Max: %d\n",lIndex,(int)mvGrids.size());
+//-----------------------------------------------------------------------
- return &mvGrids[lIndex];
- }
+cAIGridNode *cAINodeContainer::GetGrid(const cVector2l &avPos) {
+ int lIndex = avPos.y * (mvGridMapSize.x + 1) + avPos.x;
+ // Log(" index: %d Max: %d\n",lIndex,(int)mvGrids.size());
- //-----------------------------------------------------------------------
+ return &mvGrids[lIndex];
}
+
+//-----------------------------------------------------------------------
+} // namespace hpl
diff --git a/engines/hpl1/engine/ai/AINodeContainer.h b/engines/hpl1/engine/ai/AINodeContainer.h
index bf65afa9ca8..505f1e96a1c 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.h
+++ b/engines/hpl1/engine/ai/AINodeContainer.h
@@ -41,281 +41,272 @@
#ifndef HPL_AI_NODE_CONTAINER_H
#define HPL_AI_NODE_CONTAINER_H
-#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
namespace hpl {
- class cWorld3D;
+class cWorld3D;
- //--------------------------------
+//--------------------------------
- typedef tFlag tAIFreePathFlag;
+typedef tFlag tAIFreePathFlag;
- #define eAIFreePathFlag_SkipStatic (0x00000001)
- #define eAIFreePathFlag_SkipDynamic (0x00000002)
- #define eAIFreePathFlag_SkipVolatile (0x00000004)
+#define eAIFreePathFlag_SkipStatic (0x00000001)
+#define eAIFreePathFlag_SkipDynamic (0x00000002)
+#define eAIFreePathFlag_SkipVolatile (0x00000004)
+//--------------------------------
+class cAINode;
- //--------------------------------
- class cAINode;
+class cAINodeEdge {
+public:
+ float mfDistance;
+ float mfSqrDistance;
+ cAINode *mpNode;
+};
- class cAINodeEdge
- {
- public:
- float mfDistance;
- float mfSqrDistance;
- cAINode *mpNode;
- };
+typedef std::vector<cAINodeEdge> tAINodeEdgeVec;
+typedef tAINodeEdgeVec::iterator tAINodeEdgeVecIt;
- typedef std::vector<cAINodeEdge> tAINodeEdgeVec;
- typedef tAINodeEdgeVec::iterator tAINodeEdgeVecIt;
+//--------------------------------
- //--------------------------------
+class cAINode {
+ friend class cAINodeContainer;
- class cAINode
- {
- friend class cAINodeContainer;
- public:
- cAINode();
- ~cAINode();
+public:
+ cAINode();
+ ~cAINode();
- void AddEdge(cAINode *pNode);
+ void AddEdge(cAINode *pNode);
- int GetEdgeNum() const { return (int)mvEdges.size();}
- inline cAINodeEdge* GetEdge(int alIdx) { return &mvEdges[alIdx];}
+ int GetEdgeNum() const { return (int)mvEdges.size(); }
+ inline cAINodeEdge *GetEdge(int alIdx) { return &mvEdges[alIdx]; }
- const cVector3f& GetPosition(){ return mvPosition;}
+ const cVector3f &GetPosition() { return mvPosition; }
- const tString& GetName(){ return msName;}
+ const tString &GetName() { return msName; }
- private:
- tString msName;
- cVector3f mvPosition;
- void *mpUserData;
+private:
+ tString msName;
+ cVector3f mvPosition;
+ void *mpUserData;
- tAINodeEdgeVec mvEdges;
- };
+ tAINodeEdgeVec mvEdges;
+};
- typedef std::vector<cAINode*> tAINodeVec;
- typedef tAINodeVec::iterator tAINodeVecIt;
+typedef std::vector<cAINode *> tAINodeVec;
+typedef tAINodeVec::iterator tAINodeVecIt;
- typedef std::list<cAINode*> tAINodeList;
- typedef tAINodeList::iterator tAINodeListIt;
+typedef std::list<cAINode *> tAINodeList;
+typedef tAINodeList::iterator tAINodeListIt;
- typedef std::map<tString,cAINode*> tAINodeMap;
- typedef tAINodeMap::iterator tAINodeMapIt;
+typedef std::map<tString, cAINode *> tAINodeMap;
+typedef tAINodeMap::iterator tAINodeMapIt;
- //--------------------------------
+//--------------------------------
- class iAIFreePathCallback
- {
- public:
- virtual bool Intersects(iPhysicsBody *pBody,cPhysicsRayParams *apParams)=0;
- };
+class iAIFreePathCallback {
+public:
+ virtual bool Intersects(iPhysicsBody *pBody, cPhysicsRayParams *apParams) = 0;
+};
- //--------------------------------
+//--------------------------------
- class cAINodeRayCallback : public iPhysicsRayCallback
- {
- public:
- void Reset();
- void SetFlags(tAIFreePathFlag aFlags){ mFlags = aFlags;}
+class cAINodeRayCallback : public iPhysicsRayCallback {
+public:
+ void Reset();
+ void SetFlags(tAIFreePathFlag aFlags) { mFlags = aFlags; }
- bool BeforeIntersect(iPhysicsBody *pBody);
- bool OnIntersect(iPhysicsBody *pBody,cPhysicsRayParams *apParams);
+ bool BeforeIntersect(iPhysicsBody *pBody);
+ bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
- bool Intersected();
+ bool Intersected();
- iAIFreePathCallback *mpCallback;
+ iAIFreePathCallback *mpCallback;
- private:
- bool mbIntersected;
- tAIFreePathFlag mFlags;
- };
+private:
+ bool mbIntersected;
+ tAIFreePathFlag mFlags;
+};
- //--------------------------------
+//--------------------------------
- class cAIGridNode
- {
- public:
- tAINodeList mlstNodes;
- };
+class cAIGridNode {
+public:
+ tAINodeList mlstNodes;
+};
- //--------------------------------
- class cAINodeContainer;
+//--------------------------------
+class cAINodeContainer;
- class cAINodeIterator
- {
- public:
- cAINodeIterator(cAINodeContainer *apContainer, const cVector3f &avPos, float afRadius);
+class cAINodeIterator {
+public:
+ cAINodeIterator(cAINodeContainer *apContainer, const cVector3f &avPos, float afRadius);
- bool HasNext();
- cAINode *Next();
+ bool HasNext();
+ cAINode *Next();
- private:
- bool IncGridPos();
+private:
+ bool IncGridPos();
- cAINodeContainer *mpContainer;
- cVector3f mvPosition;
- float mfRadius;
- cVector2l mvStartGridPos;
- cVector2l mvEndGridPos;
- cVector2l mvGridPos;
+ cAINodeContainer *mpContainer;
+ cVector3f mvPosition;
+ float mfRadius;
+ cVector2l mvStartGridPos;
+ cVector2l mvEndGridPos;
+ cVector2l mvGridPos;
- tAINodeList *mpNodeList;
- tAINodeListIt mNodeIt;
- };
+ tAINodeList *mpNodeList;
+ tAINodeListIt mNodeIt;
+};
- //--------------------------------
+//--------------------------------
- class cAINodeContainer
- {
+class cAINodeContainer {
friend class cAINodeIterator;
- public:
- cAINodeContainer( const tString& asName,const tString &asNodeName,
- cWorld3D *apWorld, const cVector3f &avCollideSize);
- ~cAINodeContainer();
-
- const tString& GetNodeName(){ return msNodeName;}
- const tString& GetName(){ return msName;}
-
- const cVector3f& GetCollideSize(){ return mvSize;}
-
- /**
- * Reserves spaces for nodes.
- * \param alReserveSpace Number of nodes to reserve space for.
- */
- void ReserveSpace(size_t alReserveSpace);
-
- /**
- * Adds a new node to the container.
- * \param &asName Name of the node
- * \param &avPosition Position of the node.
- * \param *apUserData Data supplied by user.
- */
- void AddNode(const tString &asName, const cVector3f &avPosition, void *apUserData=NULL);
-
- /**
- * Get the number of nodes.
- */
- int GetNodeNum() const;
-
- /**
- * Get a node.
- * \param alIdx index of node.
- */
- inline cAINode* GetNode(int alIdx){return mvNodes[alIdx];}
-
- /**
- * Gets a node based on the name.
- * \param &asName Name of the node.
- */
- cAINode* GetNodeFromName(const tString &asName);
-
-
- /**
- * Compile the added nodes.
- */
- void Compile();
-
- /**
- * Build a grid map for nodes. (Used internally mostly)
- */
- void BuildNodeGridMap();
-
- /**
- * Returns a node iterator. Note that the radius is not checked, some nodes may lie outside.
- * \param &avPosition
- * \param afRadius
- * \return
- */
- cAINodeIterator GetNodeIterator(const cVector3f &avPosition, float afRadius);
-
- /**
- * Checks for a free path using the containers collide size.
- * \param &avStart
- * \param &avEnd
- * \param alRayNum The max number of rays cast, -1 = maximum
- * \param alFlags Set Flags for the ray casting.
- * \param apCallback Check for every body and overrides alFlags.
- * \return
- */
- bool FreePath(const cVector3f &avStart, const cVector3f &avEnd, int alRayNum=-1,
- tAIFreePathFlag aFlags=0, iAIFreePathCallback *apCallback=NULL);
-
-
- /**
- * Sets the max number of end node added to a node.
- * \param alX The max number, -1 = unlimited
- */
- void SetMaxEdges(int alX){ mlMaxNodeEnds = alX;}
-
- /**
- * Sets the min number of end node added to a node. This overrides max distance when needed.
- */
- void SetMinEdges(int alX){ mlMinNodeEnds = alX;}
-
- /**
- * Sets the max distance for an end node.
- * \param afX
- */
- void SetMaxEdgeDistance(float afX){ mfMaxEndDistance = afX;}
-
- float GetMaxEdgeDistance() const { return mfMaxEndDistance;}
-
- void SetMaxHeight(float afX){ mfMaxHeight = afX;}
- float GetMaxHeight()const{ return mfMaxHeight;}
-
- /**
- * When calculating if there is a free path between two nodes. Is the node postion the center of the collider.
- * If not the position is the feet postion.
- */
- void SetNodeIsAtCenter(bool abX){ mbNodeIsAtCenter = abX;}
- bool GetNodeIsAtCenter(){ return mbNodeIsAtCenter;}
-
-
- /**
- * Saves all the node connections to file.
- */
- void SaveToFile(const tString &asFile);
- /**
- * Loads all node connections from file. Only to be done after all nodes are loaded.
- */
- void LoadFromFile(const tString &asFile);
-
- private:
- cVector2l GetGridPosFromLocal(const cVector2f &avLocalPos);
- cAIGridNode* GetGrid(const cVector2l& avPos);
-
- tString msName;
- tString msNodeName;
-
- cWorld3D *mpWorld;
- cVector3f mvSize;
-
- cAINodeRayCallback *mpRayCallback;
- tAINodeVec mvNodes;
- tAINodeMap m_mapNodes;
-
- bool mbNodeIsAtCenter;
-
- cVector2l mvGridMapSize;
- cVector2f mvGridSize;
- cVector2f mvMinGridPos;
- cVector2f mvMaxGridPos;
- int mlNodesPerGrid;
-
- std::vector<cAIGridNode> mvGrids;
-
- //properties
- int mlMaxNodeEnds;
- int mlMinNodeEnds;
- float mfMaxEndDistance;
- float mfMaxHeight;
- };
+public:
+ cAINodeContainer(const tString &asName, const tString &asNodeName,
+ cWorld3D *apWorld, const cVector3f &avCollideSize);
+ ~cAINodeContainer();
+
+ const tString &GetNodeName() { return msNodeName; }
+ const tString &GetName() { return msName; }
+
+ const cVector3f &GetCollideSize() { return mvSize; }
+
+ /**
+ * Reserves spaces for nodes.
+ * \param alReserveSpace Number of nodes to reserve space for.
+ */
+ void ReserveSpace(size_t alReserveSpace);
+
+ /**
+ * Adds a new node to the container.
+ * \param &asName Name of the node
+ * \param &avPosition Position of the node.
+ * \param *apUserData Data supplied by user.
+ */
+ void AddNode(const tString &asName, const cVector3f &avPosition, void *apUserData = NULL);
+
+ /**
+ * Get the number of nodes.
+ */
+ int GetNodeNum() const;
+
+ /**
+ * Get a node.
+ * \param alIdx index of node.
+ */
+ inline cAINode *GetNode(int alIdx) { return mvNodes[alIdx]; }
+
+ /**
+ * Gets a node based on the name.
+ * \param &asName Name of the node.
+ */
+ cAINode *GetNodeFromName(const tString &asName);
+
+ /**
+ * Compile the added nodes.
+ */
+ void Compile();
+
+ /**
+ * Build a grid map for nodes. (Used internally mostly)
+ */
+ void BuildNodeGridMap();
+
+ /**
+ * Returns a node iterator. Note that the radius is not checked, some nodes may lie outside.
+ * \param &avPosition
+ * \param afRadius
+ * \return
+ */
+ cAINodeIterator GetNodeIterator(const cVector3f &avPosition, float afRadius);
+
+ /**
+ * Checks for a free path using the containers collide size.
+ * \param &avStart
+ * \param &avEnd
+ * \param alRayNum The max number of rays cast, -1 = maximum
+ * \param alFlags Set Flags for the ray casting.
+ * \param apCallback Check for every body and overrides alFlags.
+ * \return
+ */
+ bool FreePath(const cVector3f &avStart, const cVector3f &avEnd, int alRayNum = -1,
+ tAIFreePathFlag aFlags = 0, iAIFreePathCallback *apCallback = NULL);
+
+ /**
+ * Sets the max number of end node added to a node.
+ * \param alX The max number, -1 = unlimited
+ */
+ void SetMaxEdges(int alX) { mlMaxNodeEnds = alX; }
+
+ /**
+ * Sets the min number of end node added to a node. This overrides max distance when needed.
+ */
+ void SetMinEdges(int alX) { mlMinNodeEnds = alX; }
+
+ /**
+ * Sets the max distance for an end node.
+ * \param afX
+ */
+ void SetMaxEdgeDistance(float afX) { mfMaxEndDistance = afX; }
+
+ float GetMaxEdgeDistance() const { return mfMaxEndDistance; }
+
+ void SetMaxHeight(float afX) { mfMaxHeight = afX; }
+ float GetMaxHeight() const { return mfMaxHeight; }
+
+ /**
+ * When calculating if there is a free path between two nodes. Is the node postion the center of the collider.
+ * If not the position is the feet postion.
+ */
+ void SetNodeIsAtCenter(bool abX) { mbNodeIsAtCenter = abX; }
+ bool GetNodeIsAtCenter() { return mbNodeIsAtCenter; }
+
+ /**
+ * Saves all the node connections to file.
+ */
+ void SaveToFile(const tString &asFile);
+ /**
+ * Loads all node connections from file. Only to be done after all nodes are loaded.
+ */
+ void LoadFromFile(const tString &asFile);
+
+private:
+ cVector2l GetGridPosFromLocal(const cVector2f &avLocalPos);
+ cAIGridNode *GetGrid(const cVector2l &avPos);
+
+ tString msName;
+ tString msNodeName;
+
+ cWorld3D *mpWorld;
+ cVector3f mvSize;
+
+ cAINodeRayCallback *mpRayCallback;
+ tAINodeVec mvNodes;
+ tAINodeMap m_mapNodes;
+
+ bool mbNodeIsAtCenter;
+
+ cVector2l mvGridMapSize;
+ cVector2f mvGridSize;
+ cVector2f mvMinGridPos;
+ cVector2f mvMaxGridPos;
+ int mlNodesPerGrid;
+
+ std::vector<cAIGridNode> mvGrids;
+
+ // properties
+ int mlMaxNodeEnds;
+ int mlMinNodeEnds;
+ float mfMaxEndDistance;
+ float mfMaxHeight;
};
+
+}; // namespace hpl
#endif // HPL_AI_NODE_CONTAINER_H
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.cpp b/engines/hpl1/engine/ai/AINodeGenerator.cpp
index 5bdcca82324..1ecb5904032 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.cpp
+++ b/engines/hpl1/engine/ai/AINodeGenerator.cpp
@@ -43,329 +43,315 @@
#include "hpl1/engine/scene/World3D.h"
#include "hpl1/engine/system/LowLevelSystem.h"
-#include "hpl1/engine/system/System.h"
#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/system/System.h"
-#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/resources/FileSearcher.h"
+#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/physics/PhysicsWorld.h"
#include "hpl1/engine/physics/PhysicsBody.h"
+#include "hpl1/engine/physics/PhysicsWorld.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
-
namespace hpl {
- //////////////////////////////////////////////////////////////////////////
- // PARAMS
- //////////////////////////////////////////////////////////////////////////
-
- //-----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////
+// PARAMS
+//////////////////////////////////////////////////////////////////////////
- cAINodeGeneratorParams::cAINodeGeneratorParams()
- {
- msNodeType = "node";
+//-----------------------------------------------------------------------
- mfHeightFromGround = 0.1f;
- mfMinWallDist = 0.4f;
+cAINodeGeneratorParams::cAINodeGeneratorParams() {
+ msNodeType = "node";
- mvMinPos = cVector3f(-10000, -10000, -10000);
- mvMaxPos = cVector3f(10000, 10000, 10000);
+ mfHeightFromGround = 0.1f;
+ mfMinWallDist = 0.4f;
- mfGridSize = 0.4f;
- }
-
- //-----------------------------------------------------------------------
-
- //-----------------------------------------------------------------------
-
- class cCollideRayCallback : public iPhysicsRayCallback
- {
- public:
- bool OnIntersect(iPhysicsBody *pBody,cPhysicsRayParams *apParams)
- {
- if(pBody->GetMass()!=0) return true;
-
- mbIntersected = true;
- mvPos = apParams->mvPoint;
- mfDist = apParams->mfDist;
-
- return false;
- }
+ mvMinPos = cVector3f(-10000, -10000, -10000);
+ mvMaxPos = cVector3f(10000, 10000, 10000);
- bool mbIntersected;
- cVector3f mvPos;
- float mfDist;
- };
-
- //-----------------------------------------------------------------------
-
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
+ mfGridSize = 0.4f;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAINodeGenerator::cAINodeGenerator()
- {
+//-----------------------------------------------------------------------
- }
+class cCollideRayCallback : public iPhysicsRayCallback {
+public:
+ bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
+ if (pBody->GetMass() != 0)
+ return true;
- cAINodeGenerator::~cAINodeGenerator()
- {
+ mbIntersected = true;
+ mvPos = apParams->mvPoint;
+ mfDist = apParams->mfDist;
+ return false;
}
- //-----------------------------------------------------------------------
+ bool mbIntersected;
+ cVector3f mvPos;
+ float mfDist;
+};
- //////////////////////////////////////////////////////////////////////////
- // PUBLIC METHODS
- //////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
- static cCollideRayCallback gCollideRayCallback;
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
-
- void cAINodeGenerator::Generate(cWorld3D* apWorld,cAINodeGeneratorParams *apParams)
- {
- mpWorld = apWorld;
- mpParams = apParams;
+cAINodeGenerator::cAINodeGenerator() {
+}
- iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
+cAINodeGenerator::~cAINodeGenerator() {
+}
- bool mbLoadFromFile=false;
+//-----------------------------------------------------------------------
- cSystem *pSystem = apWorld->GetSystem();
- cResources *pResources = apWorld->GetResources();
- cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
- mpNodeList = apWorld->GetAINodeList(mpParams->msNodeType);
+//-----------------------------------------------------------------------
- if(mpWorld->GetFileName() != "")
- {
- tString sPath = pFileSearcher->GetFilePath(mpWorld->GetFileName());
- tWString sSaveFile = cString::To16Char(cString::SetFileExt(sPath,"ainodes"));
+static cCollideRayCallback gCollideRayCallback;
- if(sPath != "" && FileExists(sSaveFile))
- {
- cDate mapDate = FileModifiedDate( cString::To16Char(sPath));
- cDate saveDate = FileModifiedDate(sSaveFile);
+//-----------------------------------------------------------------------
- //If the save file is newer than the map load from it.
- if(saveDate > mapDate)
- {
- LoadFromFile();
- return;
- }
- }
- }
+void cAINodeGenerator::Generate(cWorld3D *apWorld, cAINodeGeneratorParams *apParams) {
+ mpWorld = apWorld;
+ mpParams = apParams;
+ iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
- /////////////////////////////////
- // Get the size of the world
- cPhysicsBodyIterator it = pPhysicsWorld->GetBodyIterator();
- cVector3f vWorldMax(-100000,-100000,-100000);
- cVector3f vWorldMin( 100000, 100000, 100000);
+ bool mbLoadFromFile = false;
- while(it.HasNext())
- {
- iPhysicsBody *pBody = it.Next();
+ cSystem *pSystem = apWorld->GetSystem();
+ cResources *pResources = apWorld->GetResources();
+ cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
- cVector3f vMin = pBody->GetBV()->GetMin();
- cVector3f vMax = pBody->GetBV()->GetMax();
+ mpNodeList = apWorld->GetAINodeList(mpParams->msNodeType);
- //X
- if(vWorldMin.x > vMin.x) vWorldMin.x = vMin.x;
- if(vWorldMax.x < vMax.x) vWorldMax.x = vMax.x;
+ if (mpWorld->GetFileName() != "") {
+ tString sPath = pFileSearcher->GetFilePath(mpWorld->GetFileName());
+ tWString sSaveFile = cString::To16Char(cString::SetFileExt(sPath, "ainodes"));
- //Y
- if(vWorldMin.y > vMin.y) vWorldMin.y = vMin.y;
- if(vWorldMax.y < vMax.y) vWorldMax.y = vMax.y;
+ if (sPath != "" && FileExists(sSaveFile)) {
+ cDate mapDate = FileModifiedDate(cString::To16Char(sPath));
+ cDate saveDate = FileModifiedDate(sSaveFile);
- //Z
- if(vWorldMin.z > vMin.z) vWorldMin.z = vMin.z;
- if(vWorldMax.z < vMax.z) vWorldMax.z = vMax.z;
+ // If the save file is newer than the map load from it.
+ if (saveDate > mapDate) {
+ LoadFromFile();
+ return;
+ }
}
+ }
- //Make the world small according to grid size.
- vWorldMin.x += mpParams->mfGridSize;
- vWorldMin.z += mpParams->mfGridSize;
- vWorldMax.x -= mpParams->mfGridSize;
- vWorldMax.z -= mpParams->mfGridSize;
-
- /////////////////////////////////////////
- //Check against the user set min and max
- if(vWorldMin.x < mpParams->mvMinPos.x) vWorldMin.x = mpParams->mvMinPos.x;
- if(vWorldMax.x > mpParams->mvMaxPos.x) vWorldMax.x = mpParams->mvMaxPos.x;
-
- if(vWorldMin.y < mpParams->mvMinPos.y) vWorldMin.y = mpParams->mvMinPos.y;
- if(vWorldMax.y > mpParams->mvMaxPos.y) vWorldMax.y = mpParams->mvMaxPos.y;
-
- if(vWorldMin.z < mpParams->mvMinPos.z) vWorldMin.z = mpParams->mvMinPos.z;
- if(vWorldMax.z > mpParams->mvMaxPos.z) vWorldMax.z = mpParams->mvMaxPos.z;
-
-
- /////////////////////////////////////////
- //Place the nodes in the world
- cVector3f vPos(vWorldMin.x,0,vWorldMin.z);
-
- while(vPos.z <= vWorldMax.z)
- {
- cVector3f vStart(vPos.x, vWorldMax.y, vPos.z);
- cVector3f vEnd(vPos.x, vWorldMin.y, vPos.z);
-
- pPhysicsWorld->CastRay(this,vStart,vEnd,false,false,true);
-
- //Log("Pos: %s Min: %s Max: %s\n",vPos.ToString().c_str(),
- // vWorldMin.ToString().c_str(),
- // vWorldMax.ToString().c_str());
+ /////////////////////////////////
+ // Get the size of the world
+ cPhysicsBodyIterator it = pPhysicsWorld->GetBodyIterator();
+ cVector3f vWorldMax(-100000, -100000, -100000);
+ cVector3f vWorldMin(100000, 100000, 100000);
+
+ while (it.HasNext()) {
+ iPhysicsBody *pBody = it.Next();
+
+ cVector3f vMin = pBody->GetBV()->GetMin();
+ cVector3f vMax = pBody->GetBV()->GetMax();
+
+ // X
+ if (vWorldMin.x > vMin.x)
+ vWorldMin.x = vMin.x;
+ if (vWorldMax.x < vMax.x)
+ vWorldMax.x = vMax.x;
+
+ // Y
+ if (vWorldMin.y > vMin.y)
+ vWorldMin.y = vMin.y;
+ if (vWorldMax.y < vMax.y)
+ vWorldMax.y = vMax.y;
+
+ // Z
+ if (vWorldMin.z > vMin.z)
+ vWorldMin.z = vMin.z;
+ if (vWorldMax.z < vMax.z)
+ vWorldMax.z = vMax.z;
+ }
- vPos.x += apParams->mfGridSize;
- if(vPos.x > vWorldMax.x)
- {
- vPos.x = vWorldMin.x;
- vPos.z += apParams->mfGridSize;
- }
+ // Make the world small according to grid size.
+ vWorldMin.x += mpParams->mfGridSize;
+ vWorldMin.z += mpParams->mfGridSize;
+ vWorldMax.x -= mpParams->mfGridSize;
+ vWorldMax.z -= mpParams->mfGridSize;
+
+ /////////////////////////////////////////
+ // Check against the user set min and max
+ if (vWorldMin.x < mpParams->mvMinPos.x)
+ vWorldMin.x = mpParams->mvMinPos.x;
+ if (vWorldMax.x > mpParams->mvMaxPos.x)
+ vWorldMax.x = mpParams->mvMaxPos.x;
+
+ if (vWorldMin.y < mpParams->mvMinPos.y)
+ vWorldMin.y = mpParams->mvMinPos.y;
+ if (vWorldMax.y > mpParams->mvMaxPos.y)
+ vWorldMax.y = mpParams->mvMaxPos.y;
+
+ if (vWorldMin.z < mpParams->mvMinPos.z)
+ vWorldMin.z = mpParams->mvMinPos.z;
+ if (vWorldMax.z > mpParams->mvMaxPos.z)
+ vWorldMax.z = mpParams->mvMaxPos.z;
+
+ /////////////////////////////////////////
+ // Place the nodes in the world
+ cVector3f vPos(vWorldMin.x, 0, vWorldMin.z);
+
+ while (vPos.z <= vWorldMax.z) {
+ cVector3f vStart(vPos.x, vWorldMax.y, vPos.z);
+ cVector3f vEnd(vPos.x, vWorldMin.y, vPos.z);
+
+ pPhysicsWorld->CastRay(this, vStart, vEnd, false, false, true);
+
+ // Log("Pos: %s Min: %s Max: %s\n",vPos.ToString().c_str(),
+ // vWorldMin.ToString().c_str(),
+ // vWorldMax.ToString().c_str());
+
+ vPos.x += apParams->mfGridSize;
+ if (vPos.x > vWorldMax.x) {
+ vPos.x = vWorldMin.x;
+ vPos.z += apParams->mfGridSize;
}
+ }
- /////////////////////////////////////////
- //Check so that the nodes are not too close to walls
- cVector3f vEnds[4] = { cVector3f(mpParams->mfMinWallDist,0,0),
- cVector3f(-mpParams->mfMinWallDist,0,0),
- cVector3f(0,0,mpParams->mfMinWallDist),
- cVector3f(0,0,-mpParams->mfMinWallDist)
- };
-
- cVector3f vPushBackDirs[4] = { cVector3f(-1,0,0),
- cVector3f(1,0,0),
- cVector3f(0,0,-1),
- cVector3f(0,0,1)
- };
-
- tTempAiNodeListIt nodeIt = mpNodeList->begin();
- for(; nodeIt != mpNodeList->end(); ++nodeIt)
- {
- cTempAiNode &Node = *nodeIt;
-
- //Check if there are any walls close by.
- for(int i=0; i<4; ++i)
- {
- gCollideRayCallback.mbIntersected = false;
- pPhysicsWorld->CastRay(&gCollideRayCallback,Node.mvPos,Node.mvPos + vEnds[i],true,false,true);
-
- if(gCollideRayCallback.mbIntersected)
- {
- //Log("Walldistance %f : Add: (%s) Push (%s) Min: %f\n",gCollideRayCallback.mfDist,
- // vEnds[i].ToString().c_str(),
- // vPushBackDirs[i].ToString().c_str(),
- // mpParams->mfMinWallDist);
- if(gCollideRayCallback.mfDist < mpParams->mfMinWallDist)
- {
- Node.mvPos += vPushBackDirs[i] * (mpParams->mfMinWallDist - gCollideRayCallback.mfDist);
- }
+ /////////////////////////////////////////
+ // Check so that the nodes are not too close to walls
+ cVector3f vEnds[4] = {cVector3f(mpParams->mfMinWallDist, 0, 0),
+ cVector3f(-mpParams->mfMinWallDist, 0, 0),
+ cVector3f(0, 0, mpParams->mfMinWallDist),
+ cVector3f(0, 0, -mpParams->mfMinWallDist)};
+
+ cVector3f vPushBackDirs[4] = {cVector3f(-1, 0, 0),
+ cVector3f(1, 0, 0),
+ cVector3f(0, 0, -1),
+ cVector3f(0, 0, 1)};
+
+ tTempAiNodeListIt nodeIt = mpNodeList->begin();
+ for (; nodeIt != mpNodeList->end(); ++nodeIt) {
+ cTempAiNode &Node = *nodeIt;
+
+ // Check if there are any walls close by.
+ for (int i = 0; i < 4; ++i) {
+ gCollideRayCallback.mbIntersected = false;
+ pPhysicsWorld->CastRay(&gCollideRayCallback, Node.mvPos, Node.mvPos + vEnds[i], true, false, true);
+
+ if (gCollideRayCallback.mbIntersected) {
+ // Log("Walldistance %f : Add: (%s) Push (%s) Min: %f\n",gCollideRayCallback.mfDist,
+ // vEnds[i].ToString().c_str(),
+ // vPushBackDirs[i].ToString().c_str(),
+ // mpParams->mfMinWallDist);
+ if (gCollideRayCallback.mfDist < mpParams->mfMinWallDist) {
+ Node.mvPos += vPushBackDirs[i] * (mpParams->mfMinWallDist - gCollideRayCallback.mfDist);
}
}
}
-
- ///////////////////////////////////////////
- // Save to file
-
- SaveToFile();
}
- //////////////////////////////////////////////////////////////////////////
- // PRIVATE
- //////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////
+ // Save to file
- //-----------------------------------------------------------------------
+ SaveToFile();
+}
- bool cAINodeGenerator::OnIntersect(iPhysicsBody *pBody,cPhysicsRayParams *apParams)
- {
- if(pBody->GetMass() != 0) return true;
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE
+//////////////////////////////////////////////////////////////////////////
- iPhysicsWorld *pPhysicsWorld = mpWorld->GetPhysicsWorld();
+//-----------------------------------------------------------------------
- cVector3f vPosition = apParams->mvPoint + cVector3f(0,mpParams->mfHeightFromGround,0);
+bool cAINodeGenerator::OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
+ if (pBody->GetMass() != 0)
+ return true;
- mpNodeList->push_back(cTempAiNode(vPosition,""));
+ iPhysicsWorld *pPhysicsWorld = mpWorld->GetPhysicsWorld();
- return true;
- }
+ cVector3f vPosition = apParams->mvPoint + cVector3f(0, mpParams->mfHeightFromGround, 0);
- //-----------------------------------------------------------------------
+ mpNodeList->push_back(cTempAiNode(vPosition, ""));
- void cAINodeGenerator::SaveToFile()
- {
- if(mpWorld->GetFileName() == "") return;
+ return true;
+}
- cSystem *pSystem = mpWorld->GetSystem();
- cResources *pResources = mpWorld->GetResources();
- cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
+//-----------------------------------------------------------------------
- tString sMapPath = pFileSearcher->GetFilePath(mpWorld->GetFileName());
- tString sSaveFile = cString::SetFileExt(sMapPath,"ainodes");
+void cAINodeGenerator::SaveToFile() {
+ if (mpWorld->GetFileName() == "")
+ return;
- TiXmlDocument* pXmlDoc = hplNew( TiXmlDocument, (sSaveFile.c_str()) );
+ cSystem *pSystem = mpWorld->GetSystem();
+ cResources *pResources = mpWorld->GetResources();
+ cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
- TiXmlElement *pRootElem = static_cast<TiXmlElement*>(pXmlDoc->InsertEndChild(TiXmlElement("AiNodes")));
+ tString sMapPath = pFileSearcher->GetFilePath(mpWorld->GetFileName());
+ tString sSaveFile = cString::SetFileExt(sMapPath, "ainodes");
- tTempAiNodeListIt nodeIt = mpNodeList->begin();
- for(; nodeIt != mpNodeList->end(); ++nodeIt)
- {
- cTempAiNode &Node = *nodeIt;
- TiXmlElement *pNodeElem = static_cast<TiXmlElement*>(pRootElem->InsertEndChild(TiXmlElement("Node")));
+ TiXmlDocument *pXmlDoc = hplNew(TiXmlDocument, (sSaveFile.c_str()));
- tString sPos = cString::ToString(Node.mvPos.x)+" " +
- cString::ToString(Node.mvPos.y)+" " +
- cString::ToString(Node.mvPos.z);
- pNodeElem->SetAttribute("Pos",sPos.c_str());
- pNodeElem->SetAttribute("Name", Node.msName.c_str());
- }
+ TiXmlElement *pRootElem = static_cast<TiXmlElement *>(pXmlDoc->InsertEndChild(TiXmlElement("AiNodes")));
- if(pXmlDoc->SaveFile()==false)
- {
- Error("Couldn't save XML file %s\n",sSaveFile.c_str());
- }
- hplDelete(pXmlDoc);
+ tTempAiNodeListIt nodeIt = mpNodeList->begin();
+ for (; nodeIt != mpNodeList->end(); ++nodeIt) {
+ cTempAiNode &Node = *nodeIt;
+ TiXmlElement *pNodeElem = static_cast<TiXmlElement *>(pRootElem->InsertEndChild(TiXmlElement("Node")));
+
+ tString sPos = cString::ToString(Node.mvPos.x) + " " +
+ cString::ToString(Node.mvPos.y) + " " +
+ cString::ToString(Node.mvPos.z);
+ pNodeElem->SetAttribute("Pos", sPos.c_str());
+ pNodeElem->SetAttribute("Name", Node.msName.c_str());
}
- //-----------------------------------------------------------------------
+ if (pXmlDoc->SaveFile() == false) {
+ Error("Couldn't save XML file %s\n", sSaveFile.c_str());
+ }
+ hplDelete(pXmlDoc);
+}
- void cAINodeGenerator::LoadFromFile()
- {
- if(mpWorld->GetFileName() == "") return;
+//-----------------------------------------------------------------------
- cSystem *pSystem = mpWorld->GetSystem();
- cResources *pResources = mpWorld->GetResources();
- cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
+void cAINodeGenerator::LoadFromFile() {
+ if (mpWorld->GetFileName() == "")
+ return;
- tString sMapPath = pFileSearcher->GetFilePath(mpWorld->GetFileName());
- tString sSaveFile = cString::SetFileExt(sMapPath,"ainodes");
+ cSystem *pSystem = mpWorld->GetSystem();
+ cResources *pResources = mpWorld->GetResources();
+ cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
- TiXmlDocument* pXmlDoc = hplNew( TiXmlDocument, (sSaveFile.c_str()) );
- if(pXmlDoc->LoadFile()==false)
- {
- Warning("Couldn't open XML file %s\n",sSaveFile.c_str());
- hplDelete(pXmlDoc);
- return;
- }
+ tString sMapPath = pFileSearcher->GetFilePath(mpWorld->GetFileName());
+ tString sSaveFile = cString::SetFileExt(sMapPath, "ainodes");
- TiXmlElement *pRootElem = pXmlDoc->RootElement();
+ TiXmlDocument *pXmlDoc = hplNew(TiXmlDocument, (sSaveFile.c_str()));
+ if (pXmlDoc->LoadFile() == false) {
+ Warning("Couldn't open XML file %s\n", sSaveFile.c_str());
+ hplDelete(pXmlDoc);
+ return;
+ }
- TiXmlElement *pNodeElem = pRootElem->FirstChildElement("Node");
- for(; pNodeElem != NULL; pNodeElem = pNodeElem->NextSiblingElement("Node"))
- {
- cVector3f vPos = cString::ToVector3f(pNodeElem->Attribute("Pos"),0);
- tString sName = cString::ToString(pNodeElem->Attribute("Name"),"");
+ TiXmlElement *pRootElem = pXmlDoc->RootElement();
- mpNodeList->push_back(cTempAiNode(vPos,sName));
- }
+ TiXmlElement *pNodeElem = pRootElem->FirstChildElement("Node");
+ for (; pNodeElem != NULL; pNodeElem = pNodeElem->NextSiblingElement("Node")) {
+ cVector3f vPos = cString::ToVector3f(pNodeElem->Attribute("Pos"), 0);
+ tString sName = cString::ToString(pNodeElem->Attribute("Name"), "");
- hplDelete(pXmlDoc);
+ mpNodeList->push_back(cTempAiNode(vPos, sName));
}
- //-----------------------------------------------------------------------
+ hplDelete(pXmlDoc);
}
+
+//-----------------------------------------------------------------------
+} // namespace hpl
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.h b/engines/hpl1/engine/ai/AINodeGenerator.h
index 1d84ba68b1e..59cf6f9eef0 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.h
+++ b/engines/hpl1/engine/ai/AINodeGenerator.h
@@ -41,54 +41,52 @@
#ifndef HPL_AI_NODE_GENERATOR_H
#define HPL_AI_NODE_GENERATOR_H
-#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/game/GameTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
#include "hpl1/engine/scene/World3D.h"
namespace hpl {
- class cWorld3D;
-
- //-------------------------------
+class cWorld3D;
- class cAINodeGeneratorParams
- {
- public:
- cAINodeGeneratorParams();
+//-------------------------------
- tString msNodeType;
+class cAINodeGeneratorParams {
+public:
+ cAINodeGeneratorParams();
- float mfHeightFromGround;
- float mfMinWallDist;
+ tString msNodeType;
- cVector3f mvMinPos;
- cVector3f mvMaxPos;
+ float mfHeightFromGround;
+ float mfMinWallDist;
- float mfGridSize;
- };
+ cVector3f mvMinPos;
+ cVector3f mvMaxPos;
- //-------------------------------
+ float mfGridSize;
+};
- class cAINodeGenerator : public iPhysicsRayCallback
- {
- public:
- cAINodeGenerator();
- ~cAINodeGenerator();
+//-------------------------------
- void Generate(cWorld3D* apWorld,cAINodeGeneratorParams *apParams);
+class cAINodeGenerator : public iPhysicsRayCallback {
+public:
+ cAINodeGenerator();
+ ~cAINodeGenerator();
- private:
- bool OnIntersect(iPhysicsBody *pBody,cPhysicsRayParams *apParams);
+ void Generate(cWorld3D *apWorld, cAINodeGeneratorParams *apParams);
- void SaveToFile();
- void LoadFromFile();
+private:
+ bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
- cAINodeGeneratorParams *mpParams;
- cWorld3D* mpWorld;
- tTempAiNodeList *mpNodeList;
- };
+ void SaveToFile();
+ void LoadFromFile();
+ cAINodeGeneratorParams *mpParams;
+ cWorld3D *mpWorld;
+ tTempAiNodeList *mpNodeList;
};
+
+}; // namespace hpl
#endif // HPL_AI_NODE_GENERATOR_H
diff --git a/engines/hpl1/engine/ai/AStar.cpp b/engines/hpl1/engine/ai/AStar.cpp
index f5848ca7bc9..a015e5ff48e 100644
--- a/engines/hpl1/engine/ai/AStar.cpp
+++ b/engines/hpl1/engine/ai/AStar.cpp
@@ -46,322 +46,290 @@
#include "hpl1/engine/system/LowLevelSystem.h"
-
namespace hpl {
- //////////////////////////////////////////////////////////////////////////
- // NODE
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// NODE
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAStarNode::cAStarNode(cAINode *apAINode)
- {
- mpParent = NULL;
- mpAINode = apAINode;
- }
+cAStarNode::cAStarNode(cAINode *apAINode) {
+ mpParent = NULL;
+ mpAINode = apAINode;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- bool cAStarNodeCompare::operator()(cAStarNode* apNodeA,cAStarNode* apNodeB) const
- {
- return apNodeA->mpAINode < apNodeB->mpAINode;
- }
+bool cAStarNodeCompare::operator()(cAStarNode *apNodeA, cAStarNode *apNodeB) const {
+ return apNodeA->mpAINode < apNodeB->mpAINode;
+}
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+cAStarHandler::cAStarHandler(cAINodeContainer *apContainer) {
+ mlMaxIterations = -1;
- cAStarHandler::cAStarHandler(cAINodeContainer *apContainer)
- {
- mlMaxIterations = -1;
+ mpContainer = apContainer;
- mpContainer = apContainer;
+ mpCallback = NULL;
+}
- mpCallback = NULL;
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+cAStarHandler::~cAStarHandler() {
+ STLDeleteAll(m_setClosedList);
+ STLDeleteAll(m_setOpenList);
+}
- cAStarHandler::~cAStarHandler()
- {
- STLDeleteAll(m_setClosedList);
- STLDeleteAll(m_setOpenList);
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////
- // PUBLIC METHODS
- //////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+bool cAStarHandler::GetPath(const cVector3f &avStart, const cVector3f &avGoal, tAINodeList *apNodeList) {
+ /////////////////////////////////////////////////
+ // check if there is free path from start to goal
+ if (mpContainer->FreePath(avStart, avGoal, 3)) {
+ mpGoalNode = NULL;
+ return true;
+ }
- bool cAStarHandler::GetPath(const cVector3f& avStart, const cVector3f& avGoal,tAINodeList *apNodeList)
- {
- /////////////////////////////////////////////////
- // check if there is free path from start to goal
- if(mpContainer->FreePath(avStart,avGoal,3))
- {
- mpGoalNode = NULL;
- return true;
+ ////////////////////////////////////////////////
+ // Reset all variables
+ // These should just be cleared and pools used instead.
+ STLDeleteAll(m_setClosedList);
+ STLDeleteAll(m_setOpenList);
+ m_setGoalNodes.clear();
+ mpGoalNode = NULL;
+
+ // Set goal position
+ mvGoal = avGoal;
+
+ float fMaxHeight = mpContainer->GetMaxHeight() * 1.5f;
+
+ ////////////////////////////////////////////////
+ // Find nodes reachable from the start and goal position (use double 2*2 distance)
+ float fMaxDist = mpContainer->GetMaxEdgeDistance() * 2; // float fMaxDist = mpContainer->GetMaxEdgeDistance()*mpContainer->GetMaxEdgeDistance()*4;
+
+ /////////////////////
+ // Check with Start
+ // Log(" Get Start\n");
+ cAINodeIterator startNodeIt = mpContainer->GetNodeIterator(avStart, fMaxDist);
+ while (startNodeIt.HasNext()) {
+ cAINode *pAINode = startNodeIt.Next();
+ // Log("Check node: %s\n",pAINode->GetName().c_str());
+
+ float fHeight = fabs(avStart.y - pAINode->GetPosition().y);
+ float fDist = cMath::Vector3Dist(avStart, pAINode->GetPosition()); // float fDist = cMath::Vector3DistSqr(avStart,pAINode->GetPosition());
+ if (fDist < fMaxDist && fHeight <= fMaxHeight) {
+ // Check if path is clear
+ if (mpContainer->FreePath(avStart, pAINode->GetPosition(), -1,
+ eAIFreePathFlag_SkipDynamic)) {
+ AddOpenNode(pAINode, NULL, fDist);
+ }
}
+ }
+ // Log(" Found start\n");
+
+ ////////////////////////////////
+ // Check with Goal
+ // Log(" Get Goal\n");
+ cAINodeIterator goalNodeIt = mpContainer->GetNodeIterator(avGoal, fMaxDist);
+ while (goalNodeIt.HasNext()) {
+ cAINode *pAINode = goalNodeIt.Next();
+ // Log("Check node: %s\n",pAINode->GetName().c_str());
+
+ float fHeight = fabs(avGoal.y - pAINode->GetPosition().y);
+ float fDist = cMath::Vector3Dist(avGoal, pAINode->GetPosition()); // fDist = cMath::Vector3DistSqr(avGoal,pAINode->GetPosition());
+ if (fDist < fMaxDist && fHeight <= fMaxHeight) {
+ // Check if path is clear
+ if (mpContainer->FreePath(avGoal, pAINode->GetPosition(), 3)) {
+ m_setGoalNodes.insert(pAINode);
+ }
+ }
+ }
+ // Log(" Found goal\n");
- ////////////////////////////////////////////////
- //Reset all variables
- //These should just be cleared and pools used instead.
- STLDeleteAll(m_setClosedList);
- STLDeleteAll(m_setOpenList);
- m_setGoalNodes.clear();
- mpGoalNode=NULL;
-
- //Set goal position
- mvGoal = avGoal;
-
- float fMaxHeight = mpContainer->GetMaxHeight()*1.5f;
-
- ////////////////////////////////////////////////
- //Find nodes reachable from the start and goal position (use double 2*2 distance)
- float fMaxDist = mpContainer->GetMaxEdgeDistance()*2; //float fMaxDist = mpContainer->GetMaxEdgeDistance()*mpContainer->GetMaxEdgeDistance()*4;
+ /*for(int i=0; i<mpContainer->GetNodeNum(); ++i)
+ {
+ cAINode *pAINode = mpContainer->GetNode(i);
- /////////////////////
+ ////////////////////////////////
//Check with Start
- //Log(" Get Start\n");
- cAINodeIterator startNodeIt = mpContainer->GetNodeIterator(avStart,fMaxDist);
- while(startNodeIt.HasNext())
+ float fHeight = fabs(avStart.y - pAINode->GetPosition().y);
+ float fDist = cMath::Vector3Dist(avStart,pAINode->GetPosition());
+ //float fDist = cMath::Vector3DistSqr(avStart,pAINode->GetPosition());
+ if(fDist < fMaxDist && fHeight <= fMaxHeight)
{
- cAINode *pAINode = startNodeIt.Next();
- //Log("Check node: %s\n",pAINode->GetName().c_str());
-
- float fHeight = fabs(avStart.y - pAINode->GetPosition().y);
- float fDist = cMath::Vector3Dist(avStart,pAINode->GetPosition()); //float fDist = cMath::Vector3DistSqr(avStart,pAINode->GetPosition());
- if(fDist < fMaxDist && fHeight <= fMaxHeight)
+ //Check if path is clear
+ if(mpContainer->FreePath(avStart,pAINode->GetPosition(),-1))
{
- //Check if path is clear
- if(mpContainer->FreePath(avStart,pAINode->GetPosition(),-1,
- eAIFreePathFlag_SkipDynamic))
- {
- AddOpenNode(pAINode,NULL,fDist);
- }
+ AddOpenNode(pAINode,NULL,fDist);
}
}
- //Log(" Found start\n");
////////////////////////////////
//Check with Goal
- //Log(" Get Goal\n");
- cAINodeIterator goalNodeIt = mpContainer->GetNodeIterator(avGoal,fMaxDist);
- while(goalNodeIt.HasNext())
+ fHeight = fabs(avGoal.y - pAINode->GetPosition().y);
+ fDist = cMath::Vector3Dist(avGoal,pAINode->GetPosition());
+ //fDist = cMath::Vector3DistSqr(avGoal,pAINode->GetPosition());
+ if(fDist < fMaxDist && fHeight <= fMaxHeight)
{
- cAINode *pAINode = goalNodeIt.Next();
- //Log("Check node: %s\n",pAINode->GetName().c_str());
-
- float fHeight = fabs(avGoal.y - pAINode->GetPosition().y);
- float fDist = cMath::Vector3Dist(avGoal,pAINode->GetPosition()); //fDist = cMath::Vector3DistSqr(avGoal,pAINode->GetPosition());
- if(fDist < fMaxDist && fHeight <= fMaxHeight)
+ //Check if path is clear
+ if(mpContainer->FreePath(avGoal,pAINode->GetPosition(),3))
{
- //Check if path is clear
- if(mpContainer->FreePath(avGoal,pAINode->GetPosition(),3))
- {
- m_setGoalNodes.insert(pAINode);
- }
+ m_setGoalNodes.insert(pAINode);
}
}
- //Log(" Found goal\n");
-
- /*for(int i=0; i<mpContainer->GetNodeNum(); ++i)
- {
- cAINode *pAINode = mpContainer->GetNode(i);
-
- ////////////////////////////////
- //Check with Start
- float fHeight = fabs(avStart.y - pAINode->GetPosition().y);
- float fDist = cMath::Vector3Dist(avStart,pAINode->GetPosition());
- //float fDist = cMath::Vector3DistSqr(avStart,pAINode->GetPosition());
- if(fDist < fMaxDist && fHeight <= fMaxHeight)
- {
- //Check if path is clear
- if(mpContainer->FreePath(avStart,pAINode->GetPosition(),-1))
- {
- AddOpenNode(pAINode,NULL,fDist);
- }
+ }*/
+
+ ////////////////////////////////////////////////
+ // Iterate the algorithm
+ IterateAlgorithm();
+
+ ////////////////////////////////////////////////
+ // Check if goal was found, if so build path.
+ if (mpGoalNode) {
+ if (apNodeList) {
+ cAStarNode *pParentNode = mpGoalNode;
+ while (pParentNode != NULL) {
+ apNodeList->push_back(pParentNode->mpAINode);
+ pParentNode = pParentNode->mpParent;
}
-
- ////////////////////////////////
- //Check with Goal
- fHeight = fabs(avGoal.y - pAINode->GetPosition().y);
- fDist = cMath::Vector3Dist(avGoal,pAINode->GetPosition());
- //fDist = cMath::Vector3DistSqr(avGoal,pAINode->GetPosition());
- if(fDist < fMaxDist && fHeight <= fMaxHeight)
- {
- //Check if path is clear
- if(mpContainer->FreePath(avGoal,pAINode->GetPosition(),3))
- {
- m_setGoalNodes.insert(pAINode);
- }
- }
- }*/
-
- ////////////////////////////////////////////////
- //Iterate the algorithm
- IterateAlgorithm();
-
- ////////////////////////////////////////////////
- //Check if goal was found, if so build path.
- if(mpGoalNode)
- {
- if(apNodeList)
- {
- cAStarNode *pParentNode = mpGoalNode;
- while(pParentNode != NULL)
- {
- apNodeList->push_back(pParentNode->mpAINode);
- pParentNode = pParentNode->mpParent;
- }
- }
-
- return true;
- }
- else
- {
- return false;
}
+
+ return true;
+ } else {
+ return false;
}
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // PRIVATE METHODS
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cAStarHandler::IterateAlgorithm()
- {
- int lIterationCount=0;
- while(m_setOpenList.empty()==false && (mlMaxIterations <0 || lIterationCount < mlMaxIterations))
- {
- cAStarNode *pNode = GetBestNode();
- cAINode *pAINode = pNode->mpAINode;
+void cAStarHandler::IterateAlgorithm() {
+ int lIterationCount = 0;
+ while (m_setOpenList.empty() == false && (mlMaxIterations < 0 || lIterationCount < mlMaxIterations)) {
+ cAStarNode *pNode = GetBestNode();
+ cAINode *pAINode = pNode->mpAINode;
- //////////////////////
- // Check if current node can reach goal
- if(IsGoalNode(pAINode))
- {
- mpGoalNode = pNode;
- break;
- }
-
- /////////////////////
- //Add nodes connected to current
- int lEdgeCount = pAINode->GetEdgeNum();
- for(int i=0; i< lEdgeCount; ++i)
- {
- cAINodeEdge *pEdge = pAINode->GetEdge(i);
+ //////////////////////
+ // Check if current node can reach goal
+ if (IsGoalNode(pAINode)) {
+ mpGoalNode = pNode;
+ break;
+ }
- if(mpCallback == NULL || mpCallback->CanAddNode(pAINode, pEdge->mpNode))
- {
- AddOpenNode(pEdge->mpNode, pNode, pNode->mfDistance + pEdge->mfDistance);
- //AddOpenNode(pEdge->mpNode, pNode, pNode->mfDistance + pEdge->mfSqrDistance);
- }
+ /////////////////////
+ // Add nodes connected to current
+ int lEdgeCount = pAINode->GetEdgeNum();
+ for (int i = 0; i < lEdgeCount; ++i) {
+ cAINodeEdge *pEdge = pAINode->GetEdge(i);
+
+ if (mpCallback == NULL || mpCallback->CanAddNode(pAINode, pEdge->mpNode)) {
+ AddOpenNode(pEdge->mpNode, pNode, pNode->mfDistance + pEdge->mfDistance);
+ // AddOpenNode(pEdge->mpNode, pNode, pNode->mfDistance + pEdge->mfSqrDistance);
}
-
- ++lIterationCount;
}
- }
+ ++lIterationCount;
+ }
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cAStarHandler::AddOpenNode(cAINode *apAINode, cAStarNode *apParent, float afDistance)
- {
- //TODO: free path check with dynamic objects here.
+void cAStarHandler::AddOpenNode(cAINode *apAINode, cAStarNode *apParent, float afDistance) {
+ // TODO: free path check with dynamic objects here.
- //TODO: Some pooling here would be good.
- cAStarNode *pNode = hplNew( cAStarNode, (apAINode) );
+ // TODO: Some pooling here would be good.
+ cAStarNode *pNode = hplNew(cAStarNode, (apAINode));
- //Check if it is in closed list.
- tAStarNodeSetIt it = m_setClosedList.find(pNode);
- if(it != m_setClosedList.end()){
- hplDelete(pNode);
- return;
- }
-
- //Try to add it to the open list
- std::pair<tAStarNodeSetIt, bool> testPair = m_setOpenList.insert(pNode);
- if(testPair.second == false){
- hplDelete(pNode);
- return;
- }
+ // Check if it is in closed list.
+ tAStarNodeSetIt it = m_setClosedList.find(pNode);
+ if (it != m_setClosedList.end()) {
+ hplDelete(pNode);
+ return;
+ }
- pNode->mfDistance = afDistance;
- pNode->mfCost = Cost(afDistance,apAINode,apParent) + Heuristic(pNode->mpAINode->GetPosition(), mvGoal);
- pNode->mpParent = apParent;
+ // Try to add it to the open list
+ std::pair<tAStarNodeSetIt, bool> testPair = m_setOpenList.insert(pNode);
+ if (testPair.second == false) {
+ hplDelete(pNode);
+ return;
}
- //-----------------------------------------------------------------------
+ pNode->mfDistance = afDistance;
+ pNode->mfCost = Cost(afDistance, apAINode, apParent) + Heuristic(pNode->mpAINode->GetPosition(), mvGoal);
+ pNode->mpParent = apParent;
+}
- cAStarNode* cAStarHandler::GetBestNode()
- {
- tAStarNodeSetIt it = m_setOpenList.begin();
- tAStarNodeSetIt bestIt = it;
- cAStarNode* pBestNode = *it; ++it;
+//-----------------------------------------------------------------------
- //Iterate open list and find the best node.
- for(; it != m_setOpenList.end(); ++it)
- {
- cAStarNode *pNode = *it;
- if(pBestNode->mfCost > pNode->mfCost)
- {
- pBestNode = pNode;
- bestIt = it;
- }
+cAStarNode *cAStarHandler::GetBestNode() {
+ tAStarNodeSetIt it = m_setOpenList.begin();
+ tAStarNodeSetIt bestIt = it;
+ cAStarNode *pBestNode = *it;
+ ++it;
+
+ // Iterate open list and find the best node.
+ for (; it != m_setOpenList.end(); ++it) {
+ cAStarNode *pNode = *it;
+ if (pBestNode->mfCost > pNode->mfCost) {
+ pBestNode = pNode;
+ bestIt = it;
}
+ }
- //Remove node from open
- m_setOpenList.erase(bestIt);
+ // Remove node from open
+ m_setOpenList.erase(bestIt);
- //Add to closed list
- m_setClosedList.insert(pBestNode);
+ // Add to closed list
+ m_setClosedList.insert(pBestNode);
- return pBestNode;
- }
+ return pBestNode;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- float cAStarHandler::Cost(float afDistance, cAINode *apAINode, cAStarNode *apParent)
- {
- if(apParent)
- {
- float fHeight = (1+fabs(apAINode->GetPosition().y - apParent->mpAINode->GetPosition().y));
- return afDistance * fHeight;
- }
- else
- return afDistance;
- }
-
- //-----------------------------------------------------------------------
+float cAStarHandler::Cost(float afDistance, cAINode *apAINode, cAStarNode *apParent) {
+ if (apParent) {
+ float fHeight = (1 + fabs(apAINode->GetPosition().y - apParent->mpAINode->GetPosition().y));
+ return afDistance * fHeight;
+ } else
+ return afDistance;
+}
- float cAStarHandler::Heuristic(const cVector3f& avStart, const cVector3f& avGoal)
- {
- //return cMath::Vector3DistSqr(avStart, avGoal);
- return cMath::Vector3Dist(avStart, avGoal);
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+float cAStarHandler::Heuristic(const cVector3f &avStart, const cVector3f &avGoal) {
+ // return cMath::Vector3DistSqr(avStart, avGoal);
+ return cMath::Vector3Dist(avStart, avGoal);
+}
- bool cAStarHandler::IsGoalNode(cAINode *apAINode)
- {
- tAINodeSetIt it = m_setGoalNodes.find(apAINode);
- if(it == m_setGoalNodes.end()) return false;
+//-----------------------------------------------------------------------
- return true;
- }
+bool cAStarHandler::IsGoalNode(cAINode *apAINode) {
+ tAINodeSetIt it = m_setGoalNodes.find(apAINode);
+ if (it == m_setGoalNodes.end())
+ return false;
- //-----------------------------------------------------------------------
+ return true;
}
+
+//-----------------------------------------------------------------------
+} // namespace hpl
diff --git a/engines/hpl1/engine/ai/AStar.h b/engines/hpl1/engine/ai/AStar.h
index 270264cb6c4..93d733bfd2d 100644
--- a/engines/hpl1/engine/ai/AStar.h
+++ b/engines/hpl1/engine/ai/AStar.h
@@ -41,104 +41,99 @@
#ifndef HPL_A_STAR_H
#define HPL_A_STAR_H
-#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/game/GameTypes.h"
#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
namespace hpl {
- class cAINodeContainer;
- class cAINode;
-
- //--------------------------------------
-
- typedef std::set<cAINode*> tAINodeSet;
- typedef tAINodeSet::iterator tAINodeSetIt;
+class cAINodeContainer;
+class cAINode;
- //--------------------------------------
+//--------------------------------------
- typedef std::list<cAINode*> tAINodeList;
- typedef tAINodeList::iterator tAINodeListIt;
+typedef std::set<cAINode *> tAINodeSet;
+typedef tAINodeSet::iterator tAINodeSetIt;
- //--------------------------------------
+//--------------------------------------
- class cAStarNode
- {
- public:
- cAStarNode(cAINode *apAINode);
+typedef std::list<cAINode *> tAINodeList;
+typedef tAINodeList::iterator tAINodeListIt;
- float mfCost;
- float mfDistance;
+//--------------------------------------
- cAStarNode *mpParent;
- cAINode *mpAINode;
- };
+class cAStarNode {
+public:
+ cAStarNode(cAINode *apAINode);
- class cAStarNodeCompare
- {
- public:
- bool operator()(cAStarNode* apNodeA,cAStarNode* apNodeB) const;
- };
+ float mfCost;
+ float mfDistance;
+ cAStarNode *mpParent;
+ cAINode *mpAINode;
+};
- typedef std::set<cAStarNode*,cAStarNodeCompare> tAStarNodeSet;
- typedef tAStarNodeSet::iterator tAStarNodeSetIt;
+class cAStarNodeCompare {
+public:
+ bool operator()(cAStarNode *apNodeA, cAStarNode *apNodeB) const;
+};
- //--------------------------------------
- class cAStarHandler;
+typedef std::set<cAStarNode *, cAStarNodeCompare> tAStarNodeSet;
+typedef tAStarNodeSet::iterator tAStarNodeSetIt;
- class iAStarCallback
- {
- public:
- virtual ~iAStarCallback(){}
+//--------------------------------------
+class cAStarHandler;
- virtual bool CanAddNode(cAINode *apParentNode,cAINode *apChildNode)=0;
- };
+class iAStarCallback {
+public:
+ virtual ~iAStarCallback() {}
- //--------------------------------------
+ virtual bool CanAddNode(cAINode *apParentNode, cAINode *apChildNode) = 0;
+};
- class cAStarHandler
- {
- public:
- cAStarHandler(cAINodeContainer *apContainer);
- ~cAStarHandler();
+//--------------------------------------
- bool GetPath(const cVector3f& avStart, const cVector3f& avGoal, tAINodeList *apNodeList);
+class cAStarHandler {
+public:
+ cAStarHandler(cAINodeContainer *apContainer);
+ ~cAStarHandler();
- /**
- * Set max number of times the algorithm is iterated.
- * \param alX -1 = until OpenList is empty
- */
- void SetMaxIterations(int alX){ mlMaxIterations = alX;}
+ bool GetPath(const cVector3f &avStart, const cVector3f &avGoal, tAINodeList *apNodeList);
- void SetCallback(iAStarCallback *apCallback){ mpCallback = apCallback;}
+ /**
+ * Set max number of times the algorithm is iterated.
+ * \param alX -1 = until OpenList is empty
+ */
+ void SetMaxIterations(int alX) { mlMaxIterations = alX; }
- private:
- void IterateAlgorithm();
+ void SetCallback(iAStarCallback *apCallback) { mpCallback = apCallback; }
- void AddOpenNode(cAINode *apAINode, cAStarNode *apParent, float afDistance);
+private:
+ void IterateAlgorithm();
- cAStarNode* GetBestNode();
+ void AddOpenNode(cAINode *apAINode, cAStarNode *apParent, float afDistance);
- float Cost(float afDistance, cAINode *apAINode, cAStarNode *apParent);
- float Heuristic(const cVector3f& avStart, const cVector3f& avGoal);
+ cAStarNode *GetBestNode();
- bool IsGoalNode(cAINode *apAINode);
+ float Cost(float afDistance, cAINode *apAINode, cAStarNode *apParent);
+ float Heuristic(const cVector3f &avStart, const cVector3f &avGoal);
- cVector3f mvGoal;
+ bool IsGoalNode(cAINode *apAINode);
- cAStarNode* mpGoalNode;
- tAINodeSet m_setGoalNodes;
+ cVector3f mvGoal;
- cAINodeContainer *mpContainer;
+ cAStarNode *mpGoalNode;
+ tAINodeSet m_setGoalNodes;
- int mlMaxIterations;
+ cAINodeContainer *mpContainer;
- iAStarCallback *mpCallback;
+ int mlMaxIterations;
- tAStarNodeSet m_setOpenList;
- tAStarNodeSet m_setClosedList;
- };
+ iAStarCallback *mpCallback;
+ tAStarNodeSet m_setOpenList;
+ tAStarNodeSet m_setClosedList;
};
+
+}; // namespace hpl
#endif // HPL_A_STAR_H
diff --git a/engines/hpl1/engine/ai/StateMachine.cpp b/engines/hpl1/engine/ai/StateMachine.cpp
index ef618da6257..ea84d0180b9 100644
--- a/engines/hpl1/engine/ai/StateMachine.cpp
+++ b/engines/hpl1/engine/ai/StateMachine.cpp
@@ -42,123 +42,116 @@
#include "hpl1/engine/system/LowLevelSystem.h"
-
namespace hpl {
- //////////////////////////////////////////////////////////////////////////
- // STATE
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// STATE
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- iAIState::iAIState()
- {
- mfTimeCount = 0;
- }
+iAIState::iAIState() {
+ mfTimeCount = 0;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void iAIState::Sleep(float afTime)
- {
+void iAIState::Sleep(float afTime) {
+}
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
-
- void iAIState::Update(float afTime)
- {
- //Update according to the time step
- mfTimeCount += afTime;
- while(mfTimeCount >= mfUpdateStep)
- {
- OnUpdate(mfUpdateStep);
- mfTimeCount -= mfUpdateStep;
- }
+void iAIState::Update(float afTime) {
+ // Update according to the time step
+ mfTimeCount += afTime;
+ while (mfTimeCount >= mfUpdateStep) {
+ OnUpdate(mfUpdateStep);
+ mfTimeCount -= mfUpdateStep;
}
+}
- //-----------------------------------------------------------------------
-
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
-
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cStateMachine::cStateMachine()
- {
- mbActive = true;
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
- mpCurrentState = NULL;
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+cStateMachine::cStateMachine() {
+ mbActive = true;
- cStateMachine::~cStateMachine()
- {
- STLMapDeleteAll(m_mapStates);
- }
+ mpCurrentState = NULL;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // PUBLIC METHODS
- //////////////////////////////////////////////////////////////////////////
+cStateMachine::~cStateMachine() {
+ STLMapDeleteAll(m_mapStates);
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cStateMachine::Update(float afTime)
- {
- if(mbActive== false || mpCurrentState==NULL) return;
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
- mpCurrentState->Update(afTime);
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+void cStateMachine::Update(float afTime) {
+ if (mbActive == false || mpCurrentState == NULL)
+ return;
- void cStateMachine::AddState(iAIState *apState, const tString& asName, int alId, float afUpdateStep)
- {
- apState->SetStateMachine(this);
- apState->mlId = alId;
- apState->msName = asName;
- apState->mfUpdateStep = afUpdateStep;
+ mpCurrentState->Update(afTime);
+}
- if(m_mapStates.empty()) mpCurrentState = apState;
+//-----------------------------------------------------------------------
- m_mapStates.insert(tAIStateMap::value_type(alId, apState));
- }
+void cStateMachine::AddState(iAIState *apState, const tString &asName, int alId, float afUpdateStep) {
+ apState->SetStateMachine(this);
+ apState->mlId = alId;
+ apState->msName = asName;
+ apState->mfUpdateStep = afUpdateStep;
- //-----------------------------------------------------------------------
+ if (m_mapStates.empty())
+ mpCurrentState = apState;
- void cStateMachine::ChangeState(int alId)
- {
- if(alId == mpCurrentState->GetId()) return;
+ m_mapStates.insert(tAIStateMap::value_type(alId, apState));
+}
- iAIState *pState = GetState(alId);
- if(pState==NULL){
- Warning("State %d does not exist!\n",alId); return;
- }
+//-----------------------------------------------------------------------
- if(mpCurrentState) mpCurrentState->OnLeaveState(pState->GetId());
- pState->OnEnterState(mpCurrentState==NULL ? -1 : mpCurrentState->GetId());
+void cStateMachine::ChangeState(int alId) {
+ if (alId == mpCurrentState->GetId())
+ return;
- mpCurrentState = pState;
+ iAIState *pState = GetState(alId);
+ if (pState == NULL) {
+ Warning("State %d does not exist!\n", alId);
+ return;
}
- //-----------------------------------------------------------------------
+ if (mpCurrentState)
+ mpCurrentState->OnLeaveState(pState->GetId());
+ pState->OnEnterState(mpCurrentState == NULL ? -1 : mpCurrentState->GetId());
- iAIState* cStateMachine::GetState(int alId)
- {
- tAIStateMapIt it = m_mapStates.find(alId);
- if(it == m_mapStates.end()) return NULL;
+ mpCurrentState = pState;
+}
- return it->second;
- }
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- iAIState* cStateMachine::CurrentState()
- {
- return mpCurrentState;
- }
+iAIState *cStateMachine::GetState(int alId) {
+ tAIStateMapIt it = m_mapStates.find(alId);
+ if (it == m_mapStates.end())
+ return NULL;
- //-----------------------------------------------------------------------
+ return it->second;
}
+//-----------------------------------------------------------------------
+
+iAIState *cStateMachine::CurrentState() {
+ return mpCurrentState;
+}
+
+//-----------------------------------------------------------------------
+} // namespace hpl
diff --git a/engines/hpl1/engine/ai/StateMachine.h b/engines/hpl1/engine/ai/StateMachine.h
index f410653de65..16de77102fc 100644
--- a/engines/hpl1/engine/ai/StateMachine.h
+++ b/engines/hpl1/engine/ai/StateMachine.h
@@ -41,81 +41,80 @@
#ifndef HPL_STATE_MACHINE_H
#define HPL_STATE_MACHINE_H
-#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/game/GameTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
#include <map>
namespace hpl {
- //-----------------------------------------
- class cStateMachine;
+//-----------------------------------------
+class cStateMachine;
- class iAIState
- {
+class iAIState {
friend class cStateMachine;
- public:
- iAIState();
- virtual ~iAIState(){}
- virtual void OnUpdate(float afTime)=0;
+public:
+ iAIState();
+ virtual ~iAIState() {}
- virtual void OnEnterState(int alLastState)=0;
- virtual void OnLeaveState(int alNextState)=0;
+ virtual void OnUpdate(float afTime) = 0;
- int GetId(){ return mlId;}
- const tString& GetName(){ return msName;}
- float GetUpdateStep(){ return mfUpdateStep;}
+ virtual void OnEnterState(int alLastState) = 0;
+ virtual void OnLeaveState(int alNextState) = 0;
- void Sleep(float afTime);
+ int GetId() { return mlId; }
+ const tString &GetName() { return msName; }
+ float GetUpdateStep() { return mfUpdateStep; }
- protected:
- int mlId;
- tString msName;
- float mfUpdateStep;
- cStateMachine *mpStateMachine;
+ void Sleep(float afTime);
- private:
- void Update(float afTime);
- void SetStateMachine(cStateMachine *apStateMachine){ mpStateMachine = apStateMachine;}
+protected:
+ int mlId;
+ tString msName;
+ float mfUpdateStep;
+ cStateMachine *mpStateMachine;
- float mfTimeCount;
- };
+private:
+ void Update(float afTime);
+ void SetStateMachine(cStateMachine *apStateMachine) { mpStateMachine = apStateMachine; }
- typedef std::map<int, iAIState*> tAIStateMap;
- typedef tAIStateMap::iterator tAIStateMapIt;
+ float mfTimeCount;
+};
- //-----------------------------------------
+typedef std::map<int, iAIState *> tAIStateMap;
+typedef tAIStateMap::iterator tAIStateMapIt;
- class cStateMachine
- {
- public:
- cStateMachine();
- virtual ~cStateMachine();
+//-----------------------------------------
- void Update(float afTime);
+class cStateMachine {
+public:
+ cStateMachine();
+ virtual ~cStateMachine();
- /**
- * Adds a new state to the state machine. The state machine will destroy them when deleted.
- */
- void AddState(iAIState *apState, const tString& asName, int alId, float afUpdateStep);
+ void Update(float afTime);
- void ChangeState(int alId);
+ /**
+ * Adds a new state to the state machine. The state machine will destroy them when deleted.
+ */
+ void AddState(iAIState *apState, const tString &asName, int alId, float afUpdateStep);
- void SetActive(bool abX){ mbActive = abX;}
- bool IsActive(){ return mbActive;}
+ void ChangeState(int alId);
- iAIState* GetState(int alId);
+ void SetActive(bool abX) { mbActive = abX; }
+ bool IsActive() { return mbActive; }
- iAIState* CurrentState();
+ iAIState *GetState(int alId);
- private:
- bool mbActive;
+ iAIState *CurrentState();
- tAIStateMap m_mapStates;
+private:
+ bool mbActive;
- iAIState *mpCurrentState;
- };
+ tAIStateMap m_mapStates;
+ iAIState *mpCurrentState;
};
+
+}; // namespace hpl
#endif // HPL_STATE_MACHINE_H
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index 42861f55aca..881eff806d8 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -40,576 +40,534 @@
#include "hpl1/engine/game/Game.h"
-#include "hpl1/engine/system/System.h"
-#include "hpl1/engine/system/LogicTimer.h"
-#include "hpl1/engine/system/String.h"
-#include "hpl1/engine/input/Input.h"
-#include "hpl1/engine/input/Mouse.h"
-#include "hpl1/engine/resources/Resources.h"
+#include "hpl1/engine/game/ScriptFuncs.h"
+#include "hpl1/engine/game/Updater.h"
#include "hpl1/engine/graphics/Graphics.h"
#include "hpl1/engine/graphics/LowLevelGraphics.h"
-#include "hpl1/engine/game/Updater.h"
-#include "hpl1/engine/game/ScriptFuncs.h"
#include "hpl1/engine/graphics/Renderer3D.h"
+#include "hpl1/engine/input/Input.h"
+#include "hpl1/engine/input/Mouse.h"
+#include "hpl1/engine/resources/Resources.h"
+#include "hpl1/engine/system/LogicTimer.h"
+#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/system/System.h"
#include "hpl1/engine/gui/Gui.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/game/LowLevelGameSetup.h"
+#include "hpl1/engine/system/LowLevelSystem.h"
namespace hpl {
- //////////////////////////////////////////////////////////////////////////
- // FPS COUNTER
- //////////////////////////////////////////////////////////////////////////
-
- cFPSCounter::cFPSCounter(iLowLevelSystem* apLowLevelSystem)
- {
- mfFPS = 60;
-
- mlFramecounter=0;
- mfFrametimestart=0;
- mfFrametime=0;
-
- mfUpdateRate = 1;
+//////////////////////////////////////////////////////////////////////////
+// FPS COUNTER
+//////////////////////////////////////////////////////////////////////////
- mpLowLevelSystem = apLowLevelSystem;
+cFPSCounter::cFPSCounter(iLowLevelSystem *apLowLevelSystem) {
+ mfFPS = 60;
- mfFrametimestart = ((float)GetApplicationTime()) / 1000.0f;
- }
+ mlFramecounter = 0;
+ mfFrametimestart = 0;
+ mfFrametime = 0;
- void cFPSCounter::AddFrame()
- {
- mlFramecounter++;
+ mfUpdateRate = 1;
- mfFrametime = (((float)GetApplicationTime()) / 1000.0f) - mfFrametimestart;
+ mpLowLevelSystem = apLowLevelSystem;
- // update the timer
- if (mfFrametime >= mfUpdateRate)
- {
- mfFPS = ((float)mlFramecounter)/mfFrametime;
- mlFramecounter = 0;
- mfFrametimestart = ((float)GetApplicationTime()) / 1000.0f;
- }
- }
+ mfFrametimestart = ((float)GetApplicationTime()) / 1000.0f;
+}
- //////////////////////////////////////////////////////////////////////////
- // SETUP VAR CONTAINER
- //////////////////////////////////////////////////////////////////////////
+void cFPSCounter::AddFrame() {
+ mlFramecounter++;
- //-----------------------------------------------------------------------
+ mfFrametime = (((float)GetApplicationTime()) / 1000.0f) - mfFrametimestart;
- cSetupVarContainer::cSetupVarContainer()
- {
- msBlank = "";
+ // update the timer
+ if (mfFrametime >= mfUpdateRate) {
+ mfFPS = ((float)mlFramecounter) / mfFrametime;
+ mlFramecounter = 0;
+ mfFrametimestart = ((float)GetApplicationTime()) / 1000.0f;
}
+}
- //-----------------------------------------------------------------------
-
+//////////////////////////////////////////////////////////////////////////
+// SETUP VAR CONTAINER
+//////////////////////////////////////////////////////////////////////////
- void cSetupVarContainer::AddString(const tString& asName, const tString& asValue)
- {
- std::map<tString, tString>::value_type val(asName,asValue);
- m_mapVars.insert(val);
- }
+//-----------------------------------------------------------------------
- void cSetupVarContainer::AddInt(const tString& asName, int alValue)
- {
- AddString(asName, cString::ToString(alValue));
- }
- void cSetupVarContainer::AddFloat(const tString& asName, float afValue)
- {
- AddString(asName, cString::ToString(afValue));
- }
- void cSetupVarContainer::AddBool(const tString& asName, bool abValue)
- {
- AddString(asName, abValue ? "true" : "false");
- }
+cSetupVarContainer::cSetupVarContainer() {
+ msBlank = "";
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
+void cSetupVarContainer::AddString(const tString &asName, const tString &asValue) {
+ std::map<tString, tString>::value_type val(asName, asValue);
+ m_mapVars.insert(val);
+}
- const tString& cSetupVarContainer::GetString(const tString& asName)
- {
- std::map<tString, tString>::iterator it = m_mapVars.find(asName);
- if(it == m_mapVars.end()) return msBlank;
- else return it->second;
- }
+void cSetupVarContainer::AddInt(const tString &asName, int alValue) {
+ AddString(asName, cString::ToString(alValue));
+}
+void cSetupVarContainer::AddFloat(const tString &asName, float afValue) {
+ AddString(asName, cString::ToString(afValue));
+}
+void cSetupVarContainer::AddBool(const tString &asName, bool abValue) {
+ AddString(asName, abValue ? "true" : "false");
+}
- float cSetupVarContainer::GetFloat(const tString& asName, float afDefault)
- {
- const tString& sVal = GetString(asName);
- if(sVal == "")
- return afDefault;
- else
- return cString::ToFloat(sVal.c_str(),afDefault);
- }
- int cSetupVarContainer::GetInt(const tString& asName, int alDefault)
- {
- const tString& sVal = GetString(asName);
- if(sVal == "")
- return alDefault;
- else
- return cString::ToInt(sVal.c_str(),alDefault);
- }
- bool cSetupVarContainer::GetBool(const tString& asName, bool abDefault)
- {
- const tString& sVal = GetString(asName);
- if(sVal == "")
- return abDefault;
- else
- return cString::ToBool(sVal.c_str(),abDefault);
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+const tString &cSetupVarContainer::GetString(const tString &asName) {
+ std::map<tString, tString>::iterator it = m_mapVars.find(asName);
+ if (it == m_mapVars.end())
+ return msBlank;
+ else
+ return it->second;
+}
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
+float cSetupVarContainer::GetFloat(const tString &asName, float afDefault) {
+ const tString &sVal = GetString(asName);
+ if (sVal == "")
+ return afDefault;
+ else
+ return cString::ToFloat(sVal.c_str(), afDefault);
+}
+int cSetupVarContainer::GetInt(const tString &asName, int alDefault) {
+ const tString &sVal = GetString(asName);
+ if (sVal == "")
+ return alDefault;
+ else
+ return cString::ToInt(sVal.c_str(), alDefault);
+}
+bool cSetupVarContainer::GetBool(const tString &asName, bool abDefault) {
+ const tString &sVal = GetString(asName);
+ if (sVal == "")
+ return abDefault;
+ else
+ return cString::ToBool(sVal.c_str(), abDefault);
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cGame::cGame(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars)
- {
- GameInit(apGameSetup,aVars);
- }
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+cGame::cGame(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars) {
+ GameInit(apGameSetup, aVars);
+}
- cGame::cGame(iLowLevelGameSetup *apGameSetup,int alWidth, int alHeight, int alBpp, bool abFullscreen,
- unsigned int alUpdateRate,int alMultisampling)
- {
- cSetupVarContainer Vars;
- Vars.AddInt("ScreenWidth",alWidth);
- Vars.AddInt("ScreenHeight",alHeight);
- Vars.AddInt("ScreenBpp",alBpp);
- Vars.AddBool("Fullscreen",abFullscreen);
- Vars.AddInt("Multisampling",alMultisampling);
- Vars.AddInt("LogicUpdateRate",alUpdateRate);
- GameInit(apGameSetup,Vars);
- }
+//-----------------------------------------------------------------------
+
+cGame::cGame(iLowLevelGameSetup *apGameSetup, int alWidth, int alHeight, int alBpp, bool abFullscreen,
+ unsigned int alUpdateRate, int alMultisampling) {
+ cSetupVarContainer Vars;
+ Vars.AddInt("ScreenWidth", alWidth);
+ Vars.AddInt("ScreenHeight", alHeight);
+ Vars.AddInt("ScreenBpp", alBpp);
+ Vars.AddBool("Fullscreen", abFullscreen);
+ Vars.AddInt("Multisampling", alMultisampling);
+ Vars.AddInt("LogicUpdateRate", alUpdateRate);
+ GameInit(apGameSetup, Vars);
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cGame::GameInit(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars)
- {
- mpGameSetup = apGameSetup;
+void cGame::GameInit(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars) {
+ mpGameSetup = apGameSetup;
- Log("Creating Engine Modules\n");
- Log("--------------------------------------------------------\n");
+ Log("Creating Engine Modules\n");
+ Log("--------------------------------------------------------\n");
- //Create the modules that game connects to and init them!
- Log(" Creating graphics module\n");
- mpGraphics = mpGameSetup->CreateGraphics();
+ // Create the modules that game connects to and init them!
+ Log(" Creating graphics module\n");
+ mpGraphics = mpGameSetup->CreateGraphics();
- Log(" Creating system module\n");
- mpSystem = mpGameSetup->CreateSystem();
+ Log(" Creating system module\n");
+ mpSystem = mpGameSetup->CreateSystem();
- Log(" Creating resource module\n");
- mpResources = mpGameSetup->CreateResources(mpGraphics);
+ Log(" Creating resource module\n");
+ mpResources = mpGameSetup->CreateResources(mpGraphics);
- Log(" Creating input module\n");
- mpInput = mpGameSetup->CreateInput(mpGraphics);
+ Log(" Creating input module\n");
+ mpInput = mpGameSetup->CreateInput(mpGraphics);
- Log(" Creating sound module\n");
- mpSound = mpGameSetup->CreateSound();
+ Log(" Creating sound module\n");
+ mpSound = mpGameSetup->CreateSound();
- Log(" Creating physics module\n");
- mpPhysics = mpGameSetup->CreatePhysics();
+ Log(" Creating physics module\n");
+ mpPhysics = mpGameSetup->CreatePhysics();
- Log(" Creating ai module\n");
- mpAI = mpGameSetup->CreateAI();
+ Log(" Creating ai module\n");
+ mpAI = mpGameSetup->CreateAI();
- Log(" Creating gui module\n");
- mpGui = hplNew(cGui,());
+ Log(" Creating gui module\n");
+ mpGui = hplNew(cGui, ());
- Log(" Creating haptic module\n");
+ Log(" Creating haptic module\n");
#ifdef INCLUDE_HAPTIC
- mpHaptic = mpGameSetup->CreateHaptic();
+ mpHaptic = mpGameSetup->CreateHaptic();
#else
- mpHaptic = NULL;
+ mpHaptic = NULL;
#endif
+ Log(" Creating scene module\n");
+ mpScene = mpGameSetup->CreateScene(mpGraphics, mpResources, mpSound, mpPhysics, mpSystem, mpAI, mpHaptic);
+
+ Log("--------------------------------------------------------\n\n");
+
+ // Init the resources
+ mpResources->Init(mpGraphics, mpSystem, mpSound, mpScene, mpGui);
+
+ // Init the graphics
+ mpGraphics->Init(aVars.GetInt("ScreenWidth", 800),
+ aVars.GetInt("ScreenHeight", 600),
+ aVars.GetInt("ScreenBpp", 32),
+ aVars.GetBool("Fullscreen", false),
+ aVars.GetInt("Multisampling", 0),
+ aVars.GetString("WindowCaption"),
+ mpResources);
+
+ // Init Sound
+ mpSound->Init(mpResources, aVars.GetBool("UseSoundHardware", true),
+ aVars.GetBool("ForceGeneric", false),
+ aVars.GetBool("UseEnvironmentalAudio", false),
+ aVars.GetInt("MaxSoundChannels", 32),
+ aVars.GetInt("StreamUpdateFreq", 10),
+ aVars.GetBool("UseSoundThreading", true),
+ aVars.GetBool("UseVoiceManagement", true),
+ aVars.GetInt("MaxMonoChannelsHint", 0),
+ aVars.GetInt("MaxStereoChannelsHint", 0),
+ aVars.GetInt("StreamBufferSize", 4096),
+ aVars.GetInt("StreamBufferCount", 8),
+ aVars.GetBool("LowLevelSoundLogging", false),
+ aVars.GetString("DeviceName"));
+
+ // Init physics
+ mpPhysics->Init(mpResources);
+
+ // Init AI
+ mpAI->Init();
+
+ // Init Gui
+ mpGui->Init(mpResources, mpGraphics, mpSound, mpScene);
+
+ // Init haptic
+ if (mpHaptic)
+ mpHaptic->Init(mpResources);
+
+ Log("Initializing Game Module\n");
+ Log("--------------------------------------------------------\n");
+ // Create the updatehandler
+ Log(" Adding engine updates\n");
+ mpUpdater = hplNew(cUpdater, (mpSystem->GetLowLevel()));
+
+ // Add some loaded modules to the updater
+ mpUpdater->AddGlobalUpdate(mpInput);
+ mpUpdater->AddGlobalUpdate(mpPhysics);
+ mpUpdater->AddGlobalUpdate(mpScene);
+ mpUpdater->AddGlobalUpdate(mpSound);
+ mpUpdater->AddGlobalUpdate(mpAI);
+ mpUpdater->AddGlobalUpdate(mpGui);
+ mpUpdater->AddGlobalUpdate(mpResources);
+ if (mpHaptic)
+ mpUpdater->AddGlobalUpdate(mpHaptic);
+
+ // Setup the "default" updater container
+ mpUpdater->AddContainer("Default");
+ mpUpdater->SetContainer("Default");
+
+ // Create the logic timer.
+ mpLogicTimer = mpSystem->CreateLogicTimer(aVars.GetInt("LogicUpdateRate", 800));
+
+ // Init some standard script funcs
+ Log(" Initializing script functions\n");
+ cScriptFuncs::Init(mpGraphics, mpResources, mpSystem, mpInput, mpScene, mpSound, this);
+
+ // Since game is not done:
+ mbGameIsDone = false;
+
+ mbRenderOnce = false;
+
+ mfUpdateTime = 0;
+ mfGameTime = 0;
+
+ mbLimitFPS = true;
+
+ mpFPSCounter = hplNew(cFPSCounter, (mpSystem->GetLowLevel()));
+ Log("--------------------------------------------------------\n\n");
+
+ Log("User Initialization\n");
+ Log("--------------------------------------------------------\n");
+}
- Log(" Creating scene module\n");
- mpScene = mpGameSetup->CreateScene(mpGraphics, mpResources, mpSound,mpPhysics,mpSystem,mpAI,mpHaptic);
-
- Log("--------------------------------------------------------\n\n");
-
-
- //Init the resources
- mpResources->Init(mpGraphics,mpSystem, mpSound,mpScene,mpGui);
-
- //Init the graphics
- mpGraphics->Init(aVars.GetInt("ScreenWidth",800),
- aVars.GetInt("ScreenHeight",600),
- aVars.GetInt("ScreenBpp",32),
- aVars.GetBool("Fullscreen",false),
- aVars.GetInt("Multisampling",0),
- aVars.GetString("WindowCaption"),
- mpResources);
-
- //Init Sound
- mpSound->Init(mpResources, aVars.GetBool("UseSoundHardware",true),
- aVars.GetBool("ForceGeneric",false),
- aVars.GetBool("UseEnvironmentalAudio", false),
- aVars.GetInt("MaxSoundChannels",32),
- aVars.GetInt("StreamUpdateFreq",10),
- aVars.GetBool("UseSoundThreading",true),
- aVars.GetBool("UseVoiceManagement",true),
- aVars.GetInt("MaxMonoChannelsHint",0),
- aVars.GetInt("MaxStereoChannelsHint",0),
- aVars.GetInt("StreamBufferSize",4096),
- aVars.GetInt("StreamBufferCount",8),
- aVars.GetBool("LowLevelSoundLogging", false),
- aVars.GetString("DeviceName"));
-
- //Init physics
- mpPhysics->Init(mpResources);
-
- //Init AI
- mpAI->Init();
-
- //Init Gui
- mpGui->Init(mpResources,mpGraphics,mpSound,mpScene);
-
- //Init haptic
- if(mpHaptic) mpHaptic->Init(mpResources);
-
- Log("Initializing Game Module\n");
- Log("--------------------------------------------------------\n");
- //Create the updatehandler
- Log(" Adding engine updates\n");
- mpUpdater = hplNew( cUpdater,(mpSystem->GetLowLevel()));
-
- //Add some loaded modules to the updater
- mpUpdater->AddGlobalUpdate(mpInput);
- mpUpdater->AddGlobalUpdate(mpPhysics);
- mpUpdater->AddGlobalUpdate(mpScene);
- mpUpdater->AddGlobalUpdate(mpSound);
- mpUpdater->AddGlobalUpdate(mpAI);
- mpUpdater->AddGlobalUpdate(mpGui);
- mpUpdater->AddGlobalUpdate(mpResources);
- if(mpHaptic) mpUpdater->AddGlobalUpdate(mpHaptic);
+//-----------------------------------------------------------------------
- //Setup the "default" updater container
- mpUpdater->AddContainer("Default");
- mpUpdater->SetContainer("Default");
+cGame::~cGame() {
+ Log("--------------------------------------------------------\n\n");
- //Create the logic timer.
- mpLogicTimer = mpSystem->CreateLogicTimer(aVars.GetInt("LogicUpdateRate",800));
+ hplDelete(mpLogicTimer);
+ hplDelete(mpFPSCounter);
- //Init some standard script funcs
- Log(" Initializing script functions\n");
- cScriptFuncs::Init(mpGraphics,mpResources,mpSystem,mpInput,mpScene,mpSound,this);
+ hplDelete(mpUpdater);
- //Since game is not done:
- mbGameIsDone=false;
+ hplDelete(mpGui);
+ hplDelete(mpScene);
+ if (mpHaptic)
+ hplDelete(mpHaptic);
+ hplDelete(mpInput);
+ hplDelete(mpSound);
+ hplDelete(mpGraphics);
+ hplDelete(mpResources);
+ hplDelete(mpPhysics);
+ hplDelete(mpAI);
+ hplDelete(mpSystem);
- mbRenderOnce = false;
+ Log(" Deleting game setup provided by user\n");
+ hplDelete(mpGameSetup);
- mfUpdateTime =0;
- mfGameTime =0;
+ Log("HPL Exit was successful!\n");
+}
- mbLimitFPS = true;
+//-----------------------------------------------------------------------
- mpFPSCounter = hplNew( cFPSCounter,(mpSystem->GetLowLevel()) );
- Log("--------------------------------------------------------\n\n");
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHOD
+//////////////////////////////////////////////////////////////////////////
- Log("User Initialization\n");
- Log("--------------------------------------------------------\n");
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+int glClearUpdateCheck = 0;
+void cGame::Run() {
+ // Log line that ends user init.
+ Log("--------------------------------------------------------\n\n");
- cGame::~cGame()
- {
- Log("--------------------------------------------------------\n\n");
+ bool bDone = false;
+ double fNumOfTimes = 0;
+ double fMediumTime = 0;
- hplDelete(mpLogicTimer);
- hplDelete(mpFPSCounter);
+ mpUpdater->OnStart();
- hplDelete(mpUpdater);
+ mpLogicTimer->Reset();
- hplDelete(mpGui);
- hplDelete(mpScene);
- if(mpHaptic) hplDelete(mpHaptic);
- hplDelete(mpInput);
- hplDelete(mpSound);
- hplDelete(mpGraphics);
- hplDelete(mpResources);
- hplDelete(mpPhysics);
- hplDelete(mpAI);
- hplDelete(mpSystem);
+ // Loop the game... fix the var...
+ unsigned long lTempTime = GetApplicationTime();
- Log(" Deleting game setup provided by user\n");
- hplDelete(mpGameSetup);
+ // reset the mouse, really reset the damn thing :P
+ for (int i = 0; i < 10; i++)
+ mpInput->GetMouse()->Reset();
- Log("HPL Exit was successful!\n");
- }
+ Log("Game Running\n");
+ Log("--------------------------------------------------------\n");
- //-----------------------------------------------------------------------
+ mfFrameTime = 0;
+ unsigned long lTempFrameTime = GetApplicationTime();
- //////////////////////////////////////////////////////////////////////////
- // PUBLIC METHOD
- //////////////////////////////////////////////////////////////////////////
+ bool mbIsUpdated = true;
- //-----------------------------------------------------------------------
+ // cMemoryManager::SetLogCreation(true);
- int glClearUpdateCheck=0;
- void cGame::Run()
- {
- //Log line that ends user init.
- Log("--------------------------------------------------------\n\n");
+ while (!mbGameIsDone) {
+ // Log("-----------------\n");
+ //////////////////////////
+ // Update logic.
+ while (mpLogicTimer->WantUpdate() && !mbGameIsDone) {
+ unsigned int lUpdateTime = GetApplicationTime();
- bool bDone = false;
- double fNumOfTimes=0;
- double fMediumTime=0;
+ mpUpdater->Update(GetStepSize());
- mpUpdater->OnStart();
+ unsigned int lDeltaTime = GetApplicationTime() - lUpdateTime;
+ mfUpdateTime = (float)(lDeltaTime) / 1000.0f;
- mpLogicTimer->Reset();
+ mbIsUpdated = true;
- //Loop the game... fix the var...
- unsigned long lTempTime = GetApplicationTime();
+ glClearUpdateCheck++;
+ if (glClearUpdateCheck % 500 == 0) {
+ if (mpUpdater->GetCurrentContainerName() == "Default")
+ ClearUpdateLogFile();
+ }
- //reset the mouse, really reset the damn thing :P
- for(int i=0;i<10;i++) mpInput->GetMouse()->Reset();
+ mfGameTime += GetStepSize();
+ }
+ mpLogicTimer->EndUpdateLoop();
+
+ // If not making a single rendering is better to use gpu and
+ // cpu at the same time and make query checks etc after logic update.
+ // If any delete has occured in the update this might crash. so skip it for now.
+ /*if(mbRenderOnce==false) {
+ mpGraphics->GetRenderer3D()->FetchOcclusionQueries();
+ mpUpdater->OnPostBufferSwap();
+ }*/
+
+ // Draw graphics!
+ if (mbRenderOnce && bDone)
+ continue;
+ if (mbRenderOnce)
+ bDone = true;
+
+ if (mbIsUpdated) {
+ mpScene->UpdateRenderList(mfFrameTime);
+ if (mbLimitFPS == false)
+ mbIsUpdated = false;
+ }
+ if (mbLimitFPS == false || mbIsUpdated) {
+ // LogUpdate("----------- RENDER GFX START --------------\n");
- Log("Game Running\n");
- Log("--------------------------------------------------------\n");
+ mbIsUpdated = false;
- mfFrameTime = 0;
- unsigned long lTempFrameTime = GetApplicationTime();
+ // Get the the from the last frame.
+ mfFrameTime = ((float)(GetApplicationTime() - lTempFrameTime)) / 1000;
+ lTempFrameTime = GetApplicationTime();
- bool mbIsUpdated = true;
+ // Draw this frame
+ // unsigned long lFTime = GetApplicationTime();
+ mpUpdater->OnDraw();
+ mpScene->Render(mpUpdater, mfFrameTime);
+ // if(mpScene->GetDrawScene()) LogUpdate("FrameTime: %d ms\n", GetApplicationTime() - lFTime);
- //cMemoryManager::SetLogCreation(true);
+ // Update fps counter.
+ mpFPSCounter->AddFrame();
- while(!mbGameIsDone)
- {
- //Log("-----------------\n");
- //////////////////////////
- //Update logic.
- while(mpLogicTimer->WantUpdate() && !mbGameIsDone)
+ // Update the screen.
+ mpGraphics->GetLowLevel()->SwapBuffers();
+ // Log("Swap done: %d\n", GetApplicationTime());
+ // if(mbRenderOnce)
{
- unsigned int lUpdateTime = GetApplicationTime();
-
- mpUpdater->Update(GetStepSize());
-
- unsigned int lDeltaTime = GetApplicationTime() - lUpdateTime;
- mfUpdateTime = (float)(lDeltaTime) / 1000.0f;
-
- mbIsUpdated = true;
-
- glClearUpdateCheck++;
- if(glClearUpdateCheck % 500 == 0)
- {
- if(mpUpdater->GetCurrentContainerName() == "Default") ClearUpdateLogFile();
- }
-
- mfGameTime += GetStepSize();
- }
- mpLogicTimer->EndUpdateLoop();
-
-
- //If not making a single rendering is better to use gpu and
- //cpu at the same time and make query checks etc after logic update.
- //If any delete has occured in the update this might crash. so skip it for now.
- /*if(mbRenderOnce==false) {
mpGraphics->GetRenderer3D()->FetchOcclusionQueries();
mpUpdater->OnPostBufferSwap();
- }*/
-
- //Draw graphics!
- if(mbRenderOnce && bDone)continue;
- if(mbRenderOnce)bDone = true;
-
-
- if(mbIsUpdated)
- {
- mpScene->UpdateRenderList(mfFrameTime);
- if(mbLimitFPS==false) mbIsUpdated = false;
}
- if(mbLimitFPS==false || mbIsUpdated)
- {
- //LogUpdate("----------- RENDER GFX START --------------\n");
-
- mbIsUpdated = false;
-
- //Get the the from the last frame.
- mfFrameTime = ((float)(GetApplicationTime() - lTempFrameTime))/1000;
- lTempFrameTime = GetApplicationTime();
-
- //Draw this frame
- //unsigned long lFTime = GetApplicationTime();
- mpUpdater->OnDraw();
- mpScene->Render(mpUpdater,mfFrameTime);
- //if(mpScene->GetDrawScene()) LogUpdate("FrameTime: %d ms\n", GetApplicationTime() - lFTime);
-
- //Update fps counter.
- mpFPSCounter->AddFrame();
-
- //Update the screen.
- mpGraphics->GetLowLevel()->SwapBuffers();
- //Log("Swap done: %d\n", GetApplicationTime());
- //if(mbRenderOnce)
- {
- mpGraphics->GetRenderer3D()->FetchOcclusionQueries();
- mpUpdater->OnPostBufferSwap();
- }
-
- fNumOfTimes++;
- }
-
- //if(cMemoryManager::GetLogCreation())
- //{
- //cMemoryManager::SetLogCreation(false);
- //Log("----\nCreations made: %d\n------\n",cMemoryManager::GetCreationCount());
- //}
+ fNumOfTimes++;
}
- Log("--------------------------------------------------------\n\n");
-
- Log("Statistics\n");
- Log("--------------------------------------------------------\n");
-
- unsigned long lTime = GetApplicationTime() - lTempTime;
- fMediumTime = fNumOfTimes/(((double)lTime)/1000);
-
- Log(" Medium framerate: %f\n", fMediumTime);
- Log("--------------------------------------------------------\n\n");
-
- Log("User Exit\n");
- Log("--------------------------------------------------------\n");
- mpUpdater->OnExit();
+ // if(cMemoryManager::GetLogCreation())
+ //{
+ // cMemoryManager::SetLogCreation(false);
+ // Log("----\nCreations made: %d\n------\n",cMemoryManager::GetCreationCount());
+ //}
}
- //-----------------------------------------------------------------------
+ Log("--------------------------------------------------------\n\n");
- void cGame::Exit()
- {
- mbGameIsDone = true;
- }
- //-----------------------------------------------------------------------
+ Log("Statistics\n");
+ Log("--------------------------------------------------------\n");
- void cGame::ResetLogicTimer()
- {
- mpLogicTimer->Reset();
- }
+ unsigned long lTime = GetApplicationTime() - lTempTime;
+ fMediumTime = fNumOfTimes / (((double)lTime) / 1000);
- void cGame::SetUpdatesPerSec(int alUpdatesPerSec)
- {
- mpLogicTimer->SetUpdatesPerSec(alUpdatesPerSec);
- }
+ Log(" Medium framerate: %f\n", fMediumTime);
+ Log("--------------------------------------------------------\n\n");
- int cGame::GetUpdatesPerSec()
- {
- return mpLogicTimer->GetUpdatesPerSec();
- }
+ Log("User Exit\n");
+ Log("--------------------------------------------------------\n");
- float cGame::GetStepSize()
- {
- return mpLogicTimer->GetStepSize();
- }
+ mpUpdater->OnExit();
+}
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+void cGame::Exit() {
+ mbGameIsDone = true;
+}
+//-----------------------------------------------------------------------
- cScene* cGame::GetScene()
- {
- return mpScene;
- }
+void cGame::ResetLogicTimer() {
+ mpLogicTimer->Reset();
+}
- //-----------------------------------------------------------------------
+void cGame::SetUpdatesPerSec(int alUpdatesPerSec) {
+ mpLogicTimer->SetUpdatesPerSec(alUpdatesPerSec);
+}
- cResources* cGame::GetResources()
- {
- return mpResources;
- }
+int cGame::GetUpdatesPerSec() {
+ return mpLogicTimer->GetUpdatesPerSec();
+}
- //-----------------------------------------------------------------------
+float cGame::GetStepSize() {
+ return mpLogicTimer->GetStepSize();
+}
- cGraphics* cGame::GetGraphics()
- {
- return mpGraphics;
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+cScene *cGame::GetScene() {
+ return mpScene;
+}
- cSystem* cGame::GetSystem()
- {
- return mpSystem;
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+cResources *cGame::GetResources() {
+ return mpResources;
+}
- cInput* cGame::GetInput()
- {
- return mpInput;
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+cGraphics *cGame::GetGraphics() {
+ return mpGraphics;
+}
- cSound* cGame::GetSound()
- {
- return mpSound;
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+cSystem *cGame::GetSystem() {
+ return mpSystem;
+}
- cPhysics* cGame::GetPhysics()
- {
- return mpPhysics;
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+cInput *cGame::GetInput() {
+ return mpInput;
+}
- cAI* cGame::GetAI()
- {
- return mpAI;
- }
+//-----------------------------------------------------------------------
+cSound *cGame::GetSound() {
+ return mpSound;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cGui* cGame::GetGui()
- {
- return mpGui;
- }
+cPhysics *cGame::GetPhysics() {
+ return mpPhysics;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
+cAI *cGame::GetAI() {
+ return mpAI;
+}
- cHaptic* cGame::GetHaptic()
- {
- return mpHaptic;
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+cGui *cGame::GetGui() {
+ return mpGui;
+}
+//-----------------------------------------------------------------------
- cUpdater* cGame::GetUpdater()
- {
- return mpUpdater;
- }
+cHaptic *cGame::GetHaptic() {
+ return mpHaptic;
+}
- float cGame::GetFPS()
- {
- return mpFPSCounter->mfFPS;
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+cUpdater *cGame::GetUpdater() {
+ return mpUpdater;
+}
- void cGame::SetFPSUpdateRate(float afSec)
- {
- mpFPSCounter->mfUpdateRate = afSec;
- }
- float cGame::GetFPSUpdateRate()
- {
- return mpFPSCounter->mfUpdateRate;
- }
+float cGame::GetFPS() {
+ return mpFPSCounter->mfFPS;
+}
+
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+void cGame::SetFPSUpdateRate(float afSec) {
+ mpFPSCounter->mfUpdateRate = afSec;
}
+float cGame::GetFPSUpdateRate() {
+ return mpFPSCounter->mfUpdateRate;
+}
+
+//-----------------------------------------------------------------------
+} // namespace hpl
diff --git a/engines/hpl1/engine/game/Game.h b/engines/hpl1/engine/game/Game.h
index 3c73d9c8da1..2e1af913b6f 100644
--- a/engines/hpl1/engine/game/Game.h
+++ b/engines/hpl1/engine/game/Game.h
@@ -45,202 +45,201 @@
namespace hpl {
- class cUpdater;
- class iLowLevelGameSetup;
- class iLowLevelSystem;
- class cLogicTimer;
-
- class cSystem;
- class cInput;
- class cResources;
- class cGraphics;
- class cScene;
- class cSound;
- class cPhysics;
- class cAI;
- class cHaptic;
- class cGui;
-
- class cFPSCounter
- {
- public:
- cFPSCounter(iLowLevelSystem* apLowLevelSystem);
-
- void AddFrame();
-
- float mfFPS;
- float mfUpdateRate;
- private:
- iLowLevelSystem* mpLowLevelSystem;
- int mlFramecounter;
- float mfFrametimestart;
- float mfFrametime;
- };
-
- //---------------------------------------------------
-
- class cSetupVarContainer
- {
- public:
- cSetupVarContainer();
-
- void AddString(const tString& asName, const tString& asValue);
-
- void AddInt(const tString& asName, int alValue);
- void AddFloat(const tString& asName, float afValue);
- void AddBool(const tString& asName, bool abValue);
-
- const tString& GetString(const tString& asName);
-
- float GetFloat(const tString& asName, float afDefault);
- int GetInt(const tString& asName,int alDefault);
- bool GetBool(const tString& asName, bool abDefault);
- private:
- std::map<tString, tString> m_mapVars;
- tString msBlank;
- };
-
- //---------------------------------------------------
-
- class cGame
- {
- public:
- cGame(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars);
- cGame(iLowLevelGameSetup *apGameSetup,int alWidth, int alHeight, int alBpp, bool abFullscreen,
- unsigned int alUpdateRate=60,int alMultisampling=0);
- ~cGame();
- private:
- void GameInit(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars);
-
- public:
-
- /**
- * Starts the game loop. To make stuff run they must be added as updatables..
- */
- void Run();
- /**
- * Exists the game.
- * \todo is this a good way to do it? Should game be global. If so, make a singleton.
- */
- void Exit();
-
- /**
- *
- * \return A pointer to Scene
- */
- cScene* GetScene();
- /**
- *
- * \return A pointer to Resources
- */
- cResources* GetResources();
-
- /**
- *
- * \return A pointer to the Updater
- */
- cUpdater* GetUpdater();
-
- /**
- *
- * \return A pointer to the System
- */
- cSystem* GetSystem();
-
- /**
- *
- * \return A pointer to the Input
- */
- cInput* GetInput();
-
- /**
- *
- * \return A pointer to the Graphics
- */
- cGraphics* GetGraphics();
- /**
- *
- * \return A pointer to the Sound
- */
- cSound* GetSound();
- /**
- *
- * \return A pointer to the Physics
- */
- cPhysics* GetPhysics();
-
- /**
- *
- * \return A pointer to the AI
- */
- cAI* GetAI();
-
- /**
- *
- * \return A pointer to the Gui
- */
- cGui* GetGui();
-
- /**
- *
- * \return A pointer to the haptic
- */
- cHaptic* GetHaptic();
-
- void ResetLogicTimer();
- void SetUpdatesPerSec(int alUpdatesPerSec);
- int GetUpdatesPerSec();
- float GetStepSize();
-
- cLogicTimer* GetLogicTimer(){ return mpLogicTimer;}
-
- float GetFPS();
-
- void SetFPSUpdateRate(float afSec);
- float GetFPSUpdateRate();
-
- void SetRenderOnce(bool abX){mbRenderOnce = abX;}
-
- float GetFrameTime(){ return mfFrameTime;}
-
- float GetUpdateTime(){ return mfUpdateTime;}
-
- double GetGameTime(){ return mfGameTime;}
-
- void SetLimitFPS(bool abX){ mbLimitFPS = abX;}
- bool GetLimitFPS(){ return mbLimitFPS;}
-
- private:
- bool mbGameIsDone;
-
- bool mbRenderOnce;
-
- float mfFrameTime;
-
- float mfUpdateTime;
-
- double mfGameTime;
-
- iLowLevelGameSetup *mpGameSetup;
- cUpdater *mpUpdater;
- cLogicTimer *mpLogicTimer;
-
- cFPSCounter* mpFPSCounter;
-
- bool mbLimitFPS;
-
- //Modules that Game connnect to:
- cResources *mpResources;
- cSystem *mpSystem;
- cInput *mpInput;
- cGraphics *mpGraphics;
- cScene *mpScene;
- cSound *mpSound;
- cPhysics *mpPhysics;
- cAI *mpAI;
- cHaptic *mpHaptic;
- cGui *mpGui;
- };
+class cUpdater;
+class iLowLevelGameSetup;
+class iLowLevelSystem;
+class cLogicTimer;
+
+class cSystem;
+class cInput;
+class cResources;
+class cGraphics;
+class cScene;
+class cSound;
+class cPhysics;
+class cAI;
+class cHaptic;
+class cGui;
+
+class cFPSCounter {
+public:
+ cFPSCounter(iLowLevelSystem *apLowLevelSystem);
+
+ void AddFrame();
+
+ float mfFPS;
+ float mfUpdateRate;
+
+private:
+ iLowLevelSystem *mpLowLevelSystem;
+ int mlFramecounter;
+ float mfFrametimestart;
+ float mfFrametime;
+};
+
+//---------------------------------------------------
+
+class cSetupVarContainer {
+public:
+ cSetupVarContainer();
+
+ void AddString(const tString &asName, const tString &asValue);
+
+ void AddInt(const tString &asName, int alValue);
+ void AddFloat(const tString &asName, float afValue);
+ void AddBool(const tString &asName, bool abValue);
+ const tString &GetString(const tString &asName);
+
+ float GetFloat(const tString &asName, float afDefault);
+ int GetInt(const tString &asName, int alDefault);
+ bool GetBool(const tString &asName, bool abDefault);
+
+private:
+ std::map<tString, tString> m_mapVars;
+ tString msBlank;
};
+
+//---------------------------------------------------
+
+class cGame {
+public:
+ cGame(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars);
+ cGame(iLowLevelGameSetup *apGameSetup, int alWidth, int alHeight, int alBpp, bool abFullscreen,
+ unsigned int alUpdateRate = 60, int alMultisampling = 0);
+ ~cGame();
+
+private:
+ void GameInit(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars);
+
+public:
+ /**
+ * Starts the game loop. To make stuff run they must be added as updatables..
+ */
+ void Run();
+ /**
+ * Exists the game.
+ * \todo is this a good way to do it? Should game be global. If so, make a singleton.
+ */
+ void Exit();
+
+ /**
+ *
+ * \return A pointer to Scene
+ */
+ cScene *GetScene();
+ /**
+ *
+ * \return A pointer to Resources
+ */
+ cResources *GetResources();
+
+ /**
+ *
+ * \return A pointer to the Updater
+ */
+ cUpdater *GetUpdater();
+
+ /**
+ *
+ * \return A pointer to the System
+ */
+ cSystem *GetSystem();
+
+ /**
+ *
+ * \return A pointer to the Input
+ */
+ cInput *GetInput();
+
+ /**
+ *
+ * \return A pointer to the Graphics
+ */
+ cGraphics *GetGraphics();
+ /**
+ *
+ * \return A pointer to the Sound
+ */
+ cSound *GetSound();
+ /**
+ *
+ * \return A pointer to the Physics
+ */
+ cPhysics *GetPhysics();
+
+ /**
+ *
+ * \return A pointer to the AI
+ */
+ cAI *GetAI();
+
+ /**
+ *
+ * \return A pointer to the Gui
+ */
+ cGui *GetGui();
+
+ /**
+ *
+ * \return A pointer to the haptic
+ */
+ cHaptic *GetHaptic();
+
+ void ResetLogicTimer();
+ void SetUpdatesPerSec(int alUpdatesPerSec);
+ int GetUpdatesPerSec();
+ float GetStepSize();
+
+ cLogicTimer *GetLogicTimer() { return mpLogicTimer; }
+
+ float GetFPS();
+
+ void SetFPSUpdateRate(float afSec);
+ float GetFPSUpdateRate();
+
+ void SetRenderOnce(bool abX) { mbRenderOnce = abX; }
+
+ float GetFrameTime() { return mfFrameTime; }
+
+ float GetUpdateTime() { return mfUpdateTime; }
+
+ double GetGameTime() { return mfGameTime; }
+
+ void SetLimitFPS(bool abX) { mbLimitFPS = abX; }
+ bool GetLimitFPS() { return mbLimitFPS; }
+
+private:
+ bool mbGameIsDone;
+
+ bool mbRenderOnce;
+
+ float mfFrameTime;
+
+ float mfUpdateTime;
+
+ double mfGameTime;
+
+ iLowLevelGameSetup *mpGameSetup;
+ cUpdater *mpUpdater;
+ cLogicTimer *mpLogicTimer;
+
+ cFPSCounter *mpFPSCounter;
+
+ bool mbLimitFPS;
+
+ // Modules that Game connnect to:
+ cResources *mpResources;
+ cSystem *mpSystem;
+ cInput *mpInput;
+ cGraphics *mpGraphics;
+ cScene *mpScene;
+ cSound *mpSound;
+ cPhysics *mpPhysics;
+ cAI *mpAI;
+ cHaptic *mpHaptic;
+ cGui *mpGui;
+};
+
+}; // namespace hpl
#endif // HPL_GAME_H
diff --git a/engines/hpl1/engine/game/GameTypes.cpp b/engines/hpl1/engine/game/GameTypes.cpp
index 6ea578821c7..e2cd646e446 100644
--- a/engines/hpl1/engine/game/GameTypes.cpp
+++ b/engines/hpl1/engine/game/GameTypes.cpp
@@ -44,29 +44,27 @@
namespace hpl {
- //////////////////////////////////////////////////////////////////////////
- // CONSTRCTORS
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// CONSTRCTORS
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cScriptVar::cScriptVar()
- {
-
- }
+cScriptVar::cScriptVar() {
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // SERIALIZE
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// SERIALIZE
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- kBeginSerializeBase(cScriptVar)
+kBeginSerializeBase(cScriptVar)
kSerializeVar(msName, eSerializeType_String)
- kSerializeVar(mlVal, eSerializeType_Int32)
- kEndSerialize()
+ kSerializeVar(mlVal, eSerializeType_Int32)
+ kEndSerialize()
- //-----------------------------------------------------------------------
-}
+//-----------------------------------------------------------------------
+} // namespace hpl
diff --git a/engines/hpl1/engine/game/GameTypes.h b/engines/hpl1/engine/game/GameTypes.h
index 28c3a22220a..f460f8ebd95 100644
--- a/engines/hpl1/engine/game/GameTypes.h
+++ b/engines/hpl1/engine/game/GameTypes.h
@@ -47,19 +47,16 @@
namespace hpl {
- class cScriptVar : public iSerializable
- {
- kSerializableClassInit(cScriptVar)
- public:
- cScriptVar();
+class cScriptVar : public iSerializable {
+ kSerializableClassInit(cScriptVar) public : cScriptVar();
- tString msName;
- int mlVal;
- };
+ tString msName;
+ int mlVal;
+};
- typedef std::map<tString,cScriptVar> tScriptVarMap;
- typedef tScriptVarMap::iterator tScriptVarMapIt;
+typedef std::map<tString, cScriptVar> tScriptVarMap;
+typedef tScriptVarMap::iterator tScriptVarMapIt;
-};
+}; // namespace hpl
#endif // HPL_GAME_TYPES_H
diff --git a/engines/hpl1/engine/game/LowLevelGameSetup.h b/engines/hpl1/engine/game/LowLevelGameSetup.h
index fc01dfc3fdb..536f0cc7dec 100644
--- a/engines/hpl1/engine/game/LowLevelGameSetup.h
+++ b/engines/hpl1/engine/game/LowLevelGameSetup.h
@@ -41,33 +41,32 @@
#ifndef HPL_LOWLEVELGAMESETUP_H
#define HPL_LOWLEVELGAMESETUP_H
-#include "hpl1/engine/system/System.h"
-#include "hpl1/engine/input/Input.h"
+#include "hpl1/engine/ai/AI.h"
#include "hpl1/engine/graphics/Graphics.h"
+#include "hpl1/engine/haptic/Haptic.h"
+#include "hpl1/engine/input/Input.h"
+#include "hpl1/engine/physics/Physics.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/scene/Scene.h"
#include "hpl1/engine/sound/Sound.h"
-#include "hpl1/engine/physics/Physics.h"
-#include "hpl1/engine/ai/AI.h"
-#include "hpl1/engine/haptic/Haptic.h"
+#include "hpl1/engine/system/System.h"
namespace hpl {
- class iLowLevelGameSetup
- {
- public:
- virtual ~iLowLevelGameSetup(){}
+class iLowLevelGameSetup {
+public:
+ virtual ~iLowLevelGameSetup() {}
- virtual cInput* CreateInput(cGraphics* apGraphics)=0;
- virtual cSystem* CreateSystem()=0;
- virtual cGraphics* CreateGraphics()=0;
- virtual cResources* CreateResources(cGraphics* apGraphics)=0;
- virtual cScene* CreateScene(cGraphics* apGraphics, cResources* apResources, cSound* apSound,
- cPhysics *apPhysics, cSystem *apSystem,cAI *apAI,cHaptic *apHaptic)=0;
- virtual cSound* CreateSound()=0;
- virtual cPhysics* CreatePhysics()=0;
- virtual cAI* CreateAI()=0;
- virtual cHaptic* CreateHaptic()=0;
- };
+ virtual cInput *CreateInput(cGraphics *apGraphics) = 0;
+ virtual cSystem *CreateSystem() = 0;
+ virtual cGraphics *CreateGraphics() = 0;
+ virtual cResources *CreateResources(cGraphics *apGraphics) = 0;
+ virtual cScene *CreateScene(cGraphics *apGraphics, cResources *apResources, cSound *apSound,
+ cPhysics *apPhysics, cSystem *apSystem, cAI *apAI, cHaptic *apHaptic) = 0;
+ virtual cSound *CreateSound() = 0;
+ virtual cPhysics *CreatePhysics() = 0;
+ virtual cAI *CreateAI() = 0;
+ virtual cHaptic *CreateHaptic() = 0;
};
+}; // namespace hpl
#endif // HPL_LOWLEVELGAMESETUP_H
diff --git a/engines/hpl1/engine/game/SaveGame.cpp b/engines/hpl1/engine/game/SaveGame.cpp
index 693028e96d3..3607975cc97 100644
--- a/engines/hpl1/engine/game/SaveGame.cpp
+++ b/engines/hpl1/engine/game/SaveGame.cpp
@@ -44,18 +44,16 @@
namespace hpl {
+//////////////////////////////////////////////////////////////////////////
+// SAVE GAME DATA
+//////////////////////////////////////////////////////////////////////////
+//------------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // SAVE GAME DATA
- //////////////////////////////////////////////////////////////////////////
-
- //------------------------------------------------------------------------
-
- //Serialize iSaveGame
- kBeginSerializeBaseVirtual(iSaveData)
+// Serialize iSaveGame
+kBeginSerializeBaseVirtual(iSaveData)
kSerializeVar(mlSaveDataId, eSerializeType_Int32)
- kEndSerialize()
+ kEndSerialize()
//------------------------------------------------------------------------
@@ -63,183 +61,154 @@ namespace hpl {
// SAVE GAME OBJECT
//////////////////////////////////////////////////////////////////////////
- int iSaveObject::_mlGlobalIdCount =0;
-
- //------------------------------------------------------------------------
-
- iSaveObject::iSaveObject()
- {
- mlSaveObjectId = _mlGlobalIdCount++;
- if(_mlGlobalIdCount <0) _mlGlobalIdCount=0;
-
- mbIsSaved = true;
- }
-
- iSaveObject::~iSaveObject()
- {
+ int iSaveObject::_mlGlobalIdCount = 0;
- }
+//------------------------------------------------------------------------
- //------------------------------------------------------------------------
-
- void iSaveObject::SaveToSaveData(iSaveData *apSaveData)
- {
- apSaveData->mlSaveDataId = mlSaveObjectId;
- }
+iSaveObject::iSaveObject() {
+ mlSaveObjectId = _mlGlobalIdCount++;
+ if (_mlGlobalIdCount < 0)
+ _mlGlobalIdCount = 0;
- //------------------------------------------------------------------------
+ mbIsSaved = true;
+}
- void iSaveObject::LoadFromSaveData(iSaveData *apSaveData)
- {
- mlSaveObjectId = apSaveData->mlSaveDataId;
- mpSaveData = apSaveData;
- }
+iSaveObject::~iSaveObject() {
+}
- //------------------------------------------------------------------------
+//------------------------------------------------------------------------
- void iSaveObject::SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame)
- {
+void iSaveObject::SaveToSaveData(iSaveData *apSaveData) {
+ apSaveData->mlSaveDataId = mlSaveObjectId;
+}
- }
+//------------------------------------------------------------------------
- //------------------------------------------------------------------------
+void iSaveObject::LoadFromSaveData(iSaveData *apSaveData) {
+ mlSaveObjectId = apSaveData->mlSaveDataId;
+ mpSaveData = apSaveData;
+}
- //////////////////////////////////////////////////////////////////////////
- // SAVE GAME CONTAINER
- //////////////////////////////////////////////////////////////////////////
+//------------------------------------------------------------------------
- //------------------------------------------------------------------------
+void iSaveObject::SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame) {
+}
- cSaveObjectHandler::cSaveObjectHandler()
- {
+//------------------------------------------------------------------------
- }
+//////////////////////////////////////////////////////////////////////////
+// SAVE GAME CONTAINER
+//////////////////////////////////////////////////////////////////////////
- cSaveObjectHandler::~cSaveObjectHandler()
- {
+//------------------------------------------------------------------------
- }
+cSaveObjectHandler::cSaveObjectHandler() {
+}
- //------------------------------------------------------------------------
+cSaveObjectHandler::~cSaveObjectHandler() {
+}
- void cSaveObjectHandler::Add(iSaveObject *pObject)
- {
- m_mapSaveObjects.insert(tSaveObjectMap::value_type(pObject->GetSaveObjectId(),pObject));
- }
+//------------------------------------------------------------------------
- //------------------------------------------------------------------------
+void cSaveObjectHandler::Add(iSaveObject *pObject) {
+ m_mapSaveObjects.insert(tSaveObjectMap::value_type(pObject->GetSaveObjectId(), pObject));
+}
- iSaveObject* cSaveObjectHandler::Get(int alId)
- {
- tSaveObjectMapIt it = m_mapSaveObjects.find(alId);
- if(it== m_mapSaveObjects.end()){
- Warning("Couldn't find save object with id %d\n",alId);
- return NULL;
- }
+//------------------------------------------------------------------------
- return it->second;
+iSaveObject *cSaveObjectHandler::Get(int alId) {
+ tSaveObjectMapIt it = m_mapSaveObjects.find(alId);
+ if (it == m_mapSaveObjects.end()) {
+ Warning("Couldn't find save object with id %d\n", alId);
+ return NULL;
}
- //------------------------------------------------------------------------
-
- cSaveObjectIterator cSaveObjectHandler::GetIterator()
- {
- return cSaveObjectIterator(&m_mapSaveObjects);
- }
-
- //------------------------------------------------------------------------
+ return it->second;
+}
- void cSaveObjectHandler::SetUpAll(cGame *apGame)
- {
- int lMaxId =0;
+//------------------------------------------------------------------------
- tSaveObjectMapIt it = m_mapSaveObjects.begin();
- for(; it != m_mapSaveObjects.end(); ++it)
- {
- iSaveObject *pObject = it->second;
+cSaveObjectIterator cSaveObjectHandler::GetIterator() {
+ return cSaveObjectIterator(&m_mapSaveObjects);
+}
- if(pObject->GetSaveObjectId() > lMaxId) lMaxId = pObject->GetSaveObjectId();
+//------------------------------------------------------------------------
- pObject->SaveDataSetup(this,apGame);
- }
+void cSaveObjectHandler::SetUpAll(cGame *apGame) {
+ int lMaxId = 0;
- iSaveObject::_mlGlobalIdCount = lMaxId;
- }
+ tSaveObjectMapIt it = m_mapSaveObjects.begin();
+ for (; it != m_mapSaveObjects.end(); ++it) {
+ iSaveObject *pObject = it->second;
- //------------------------------------------------------------------------
+ if (pObject->GetSaveObjectId() > lMaxId)
+ lMaxId = pObject->GetSaveObjectId();
- void cSaveObjectHandler::Clear()
- {
- m_mapSaveObjects.clear();
+ pObject->SaveDataSetup(this, apGame);
}
- //------------------------------------------------------------------------
+ iSaveObject::_mlGlobalIdCount = lMaxId;
+}
- size_t cSaveObjectHandler::Size()
- {
- return m_mapSaveObjects.size();
- }
+//------------------------------------------------------------------------
- //------------------------------------------------------------------------
+void cSaveObjectHandler::Clear() {
+ m_mapSaveObjects.clear();
+}
+//------------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // SAVE DATA CONTAINER
- //////////////////////////////////////////////////////////////////////////
-
- //------------------------------------------------------------------------
+size_t cSaveObjectHandler::Size() {
+ return m_mapSaveObjects.size();
+}
- cSaveDataHandler::cSaveDataHandler()
- {
+//------------------------------------------------------------------------
- }
+//////////////////////////////////////////////////////////////////////////
+// SAVE DATA CONTAINER
+//////////////////////////////////////////////////////////////////////////
- cSaveDataHandler::~cSaveDataHandler()
- {
+//------------------------------------------------------------------------
- }
+cSaveDataHandler::cSaveDataHandler() {
+}
- //------------------------------------------------------------------------
+cSaveDataHandler::~cSaveDataHandler() {
+}
- void cSaveDataHandler::Add(iSaveData *pData)
- {
- m_mapSaveData.insert(tSaveDataMap::value_type(pData->GetSaveCreatePrio(), pData));
- }
+//------------------------------------------------------------------------
- cSaveDataIterator cSaveDataHandler::GetIterator()
- {
- return cSaveDataIterator(&m_mapSaveData);
- }
+void cSaveDataHandler::Add(iSaveData *pData) {
+ m_mapSaveData.insert(tSaveDataMap::value_type(pData->GetSaveCreatePrio(), pData));
+}
- void cSaveDataHandler::Clear()
- {
- m_mapSaveData.clear();
- }
+cSaveDataIterator cSaveDataHandler::GetIterator() {
+ return cSaveDataIterator(&m_mapSaveData);
+}
- size_t cSaveDataHandler::Size()
- {
- return m_mapSaveData.size();
- }
+void cSaveDataHandler::Clear() {
+ m_mapSaveData.clear();
+}
- //------------------------------------------------------------------------
+size_t cSaveDataHandler::Size() {
+ return m_mapSaveData.size();
+}
- void cSaveDataHandler::AddVoidPtr(void **apPtr)
- {
- iSaveData** pDataPtr = (iSaveData**)apPtr;
- Add(*pDataPtr);
- }
- void cSaveDataHandler::AddVoidClass(void *apClass)
- {
- iSaveData* pData = (iSaveData*)(apClass);
- Add(pData);
- }
+//------------------------------------------------------------------------
- iContainerIterator* cSaveDataHandler::CreateIteratorPtr()
- {
- return hplNew( cSaveDataIterator, (&m_mapSaveData) );
- }
+void cSaveDataHandler::AddVoidPtr(void **apPtr) {
+ iSaveData **pDataPtr = (iSaveData **)apPtr;
+ Add(*pDataPtr);
+}
+void cSaveDataHandler::AddVoidClass(void *apClass) {
+ iSaveData *pData = (iSaveData *)(apClass);
+ Add(pData);
+}
- //------------------------------------------------------------------------
+iContainerIterator *cSaveDataHandler::CreateIteratorPtr() {
+ return hplNew(cSaveDataIterator, (&m_mapSaveData));
+}
+//------------------------------------------------------------------------
-}
+} // namespace hpl
diff --git a/engines/hpl1/engine/game/SaveGame.h b/engines/hpl1/engine/game/SaveGame.h
index 3978e6ac6bf..8b9e576cd27 100644
--- a/engines/hpl1/engine/game/SaveGame.h
+++ b/engines/hpl1/engine/game/SaveGame.h
@@ -43,23 +43,23 @@
#include <map>
-#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/system/SerializeClass.h"
+#include "hpl1/engine/system/SystemTypes.h"
class TiXmlElement;
-#define kSaveData_LoadFromBegin(aClass) \
- super::LoadFromSaveData(apSaveData); \
- cSaveData_##aClass *pData = static_cast<cSaveData_##aClass*>(apSaveData);
+#define kSaveData_LoadFromBegin(aClass) \
+ super::LoadFromSaveData(apSaveData); \
+ cSaveData_##aClass *pData = static_cast<cSaveData_##aClass *>(apSaveData);
-#define kSaveData_SaveToBegin(aClass) \
- super::SaveToSaveData(apSaveData);\
- cSaveData_##aClass *pData = static_cast<cSaveData_##aClass*>(apSaveData);
+#define kSaveData_SaveToBegin(aClass) \
+ super::SaveToSaveData(apSaveData); \
+ cSaveData_##aClass *pData = static_cast<cSaveData_##aClass *>(apSaveData);
-#define kSaveData_SetupBegin(aClass) \
- super::SaveDataSetup(apSaveObjectHandler,apGame);\
- cSaveData_##aClass *pData = static_cast<cSaveData_##aClass*>(mpSaveData); \
- const char *sClassNameString = #aClass;
+#define kSaveData_SetupBegin(aClass) \
+ super::SaveDataSetup(apSaveObjectHandler, apGame); \
+ cSaveData_##aClass *pData = static_cast<cSaveData_##aClass *>(mpSaveData); \
+ const char *sClassNameString = #aClass;
#define kSaveData_BaseClass(aClass) class cSaveData_##aClass : public iSaveData
#define kSaveData_ChildClass(aParent, aChild) class cSaveData_##aChild : public cSaveData_##aParent
@@ -67,197 +67,183 @@ class TiXmlElement;
#define kSaveData_ClassInit(aClass) kSerializableClassInit(cSaveData_##aClass)
//////////////////////////////////////////////
-//Helpers to copy data.
+// Helpers to copy data.
#define kSaveData_SaveTo(aVar) pData->aVar = aVar;
#define kSaveData_LoadFrom(aVar) aVar = pData->aVar;
-#define kSaveData_SaveObject(aObject, aId) \
- if(aObject) \
- pData->aId = aObject->GetSaveObjectId(); \
- else \
- pData->aId = -1;
-
-//Only used in setup:
-#define kSaveData_LoadObject(aObject, aId,aClass) \
- if(pData->aId == -1) \
- aObject = NULL; \
- else {\
- aObject = static_cast<aClass>(apSaveObjectHandler->Get(pData->aId)); \
- }
-
+#define kSaveData_SaveObject(aObject, aId) \
+ if (aObject) \
+ pData->aId = aObject->GetSaveObjectId(); \
+ else \
+ pData->aId = -1;
+// Only used in setup:
+#define kSaveData_LoadObject(aObject, aId, aClass) \
+ if (pData->aId == -1) \
+ aObject = NULL; \
+ else { \
+ aObject = static_cast<aClass>(apSaveObjectHandler->Get(pData->aId)); \
+ }
//////////////////////////////////////////////
-//Helpers to copy containers with SaveDataId
-#define kSaveData_SaveIdList(aSrcList,aSrcIt,aDestList) \
- pData->aDestList.Clear(); \
- for(aSrcIt it = aSrcList.begin();it != aSrcList.end();++it) \
- { \
- pData->aDestList.Add((*it)->GetSaveObjectId()); \
- }
-
-//Only used in setup:
-#define kSaveData_LoadIdList(aSrcList,aDestList, aClass) \
- { cContainerListIterator<int> it = pData->aDestList.GetIterator(); \
- aSrcList.clear(); \
- while(it.HasNext()) \
- { \
- int lId = it.Next(); \
- iSaveObject* pObject = apSaveObjectHandler->Get(lId); \
- if(pObject==NULL) \
- { \
- continue; \
- } \
- aSrcList.push_back(static_cast<aClass>(pObject)); \
- } \
- }
-
-
+// Helpers to copy containers with SaveDataId
+#define kSaveData_SaveIdList(aSrcList, aSrcIt, aDestList) \
+ pData->aDestList.Clear(); \
+ for (aSrcIt it = aSrcList.begin(); it != aSrcList.end(); ++it) { \
+ pData->aDestList.Add((*it)->GetSaveObjectId()); \
+ }
+
+// Only used in setup:
+#define kSaveData_LoadIdList(aSrcList, aDestList, aClass) \
+ { \
+ cContainerListIterator<int> it = pData->aDestList.GetIterator(); \
+ aSrcList.clear(); \
+ while (it.HasNext()) { \
+ int lId = it.Next(); \
+ iSaveObject *pObject = apSaveObjectHandler->Get(lId); \
+ if (pObject == NULL) { \
+ continue; \
+ } \
+ aSrcList.push_back(static_cast<aClass>(pObject)); \
+ } \
+ }
namespace hpl {
- //--------------------------------------------------------
+//--------------------------------------------------------
+class cSaveObjectHandler;
+class iSaveObject;
+class cGame;
- class cSaveObjectHandler;
- class iSaveObject;
- class cGame;
+/**
+ * This is data that is created by a SaveObject and the data can be loaded into the object.
+ */
+class iSaveData : public iSerializable {
+ kSerializableClassInit(iSaveData) public : int mlSaveDataId;
/**
- * This is data that is created by a SaveObject and the data can be loaded into the object.
- */
- class iSaveData : public iSerializable
- {
- kSerializableClassInit(iSaveData)
- public:
- int mlSaveDataId;
+ * Creates the SaveObject using previously saved objects and the data in this class.
+ */
+ virtual iSaveObject *CreateSaveObject(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame) = 0;
- /**
- * Creates the SaveObject using previously saved objects and the data in this class.
- */
- virtual iSaveObject* CreateSaveObject(cSaveObjectHandler *apSaveObjectHandler,cGame *apGame)=0;
+ /**
+ * The lower number the earlier it will be created.
+ */
+ virtual int GetSaveCreatePrio() = 0;
+};
- /**
- * The lower number the earlier it will be created.
- */
- virtual int GetSaveCreatePrio()=0;
- };
+//--------------------------------------------------------
+/**
+ * This is class is inherited by object that are to be saved.
+ */
+class iSaveObject {
+ friend class cSaveObjectHandler;
+public:
+ iSaveObject();
+ ~iSaveObject();
- //--------------------------------------------------------
+ /**
+ * Get a unique id for this object.
+ */
+ int GetSaveObjectId() { return mlSaveObjectId; }
/**
- * This is class is inherited by object that are to be saved.
- */
- class iSaveObject
- {
- friend class cSaveObjectHandler;
- public:
- iSaveObject();
- ~iSaveObject();
-
- /**
- * Get a unique id for this object.
- */
- int GetSaveObjectId(){ return mlSaveObjectId;}
-
- /**
- * Save it's data to a SaveData
- */
- virtual void SaveToSaveData(iSaveData *apSaveData);
- /**
- * Load it's data from a SaveData
- */
- virtual void LoadFromSaveData(iSaveData *apSaveData);
-
- /**
- * Creates the SaveData that this class uses.
- */
- virtual iSaveData* CreateSaveData()=0;
-
- /**
- * After all objects have been created, this function is called to enable setup.
- */
- virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame);
-
- void SetIsSaved(bool abX){ mbIsSaved = abX;}
- bool IsSaved(){ return mbIsSaved;}
-
- protected:
- iSaveData *mpSaveData;
- private:
- int mlSaveObjectId;
- bool mbIsSaved;
- static int _mlGlobalIdCount;
- };
-
- //---------------------------------------------------------
-
- typedef std::multimap<int, iSaveObject*> tSaveObjectMap;
- typedef tSaveObjectMap::iterator tSaveObjectMapIt;
-
- typedef cSTLMapIterator<iSaveObject*,tSaveObjectMap,tSaveObjectMapIt> cSaveObjectIterator;
+ * Save it's data to a SaveData
+ */
+ virtual void SaveToSaveData(iSaveData *apSaveData);
+ /**
+ * Load it's data from a SaveData
+ */
+ virtual void LoadFromSaveData(iSaveData *apSaveData);
/**
- * This store all the SaveObjects created at load time.
- */
- class cSaveObjectHandler
- {
- public:
- cSaveObjectHandler();
- ~cSaveObjectHandler();
+ * Creates the SaveData that this class uses.
+ */
+ virtual iSaveData *CreateSaveData() = 0;
- public:
- void Add(iSaveObject *pObject);
+ /**
+ * After all objects have been created, this function is called to enable setup.
+ */
+ virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame);
- iSaveObject* Get(int alId);
+ void SetIsSaved(bool abX) { mbIsSaved = abX; }
+ bool IsSaved() { return mbIsSaved; }
- cSaveObjectIterator GetIterator();
+protected:
+ iSaveData *mpSaveData;
- void SetUpAll(cGame *apGame);
+private:
+ int mlSaveObjectId;
+ bool mbIsSaved;
+ static int _mlGlobalIdCount;
+};
- void Clear();
- size_t Size();
+//---------------------------------------------------------
- private:
+typedef std::multimap<int, iSaveObject *> tSaveObjectMap;
+typedef tSaveObjectMap::iterator tSaveObjectMapIt;
- tSaveObjectMap m_mapSaveObjects;
- };
+typedef cSTLMapIterator<iSaveObject *, tSaveObjectMap, tSaveObjectMapIt> cSaveObjectIterator;
- //---------------------------------------------------------
+/**
+ * This store all the SaveObjects created at load time.
+ */
+class cSaveObjectHandler {
+public:
+ cSaveObjectHandler();
+ ~cSaveObjectHandler();
- typedef std::multimap<int, iSaveData*> tSaveDataMap;
- typedef tSaveDataMap::iterator tSaveDataMapIt;
+public:
+ void Add(iSaveObject *pObject);
- typedef cSTLMapIterator<iSaveData*,tSaveDataMap,tSaveDataMapIt> cSaveDataIterator;
+ iSaveObject *Get(int alId);
- /**
- * Used to keep track of save data.
- */
- class cSaveDataHandler : public iContainer
- {
- public:
- cSaveDataHandler();
- ~cSaveDataHandler();
+ cSaveObjectIterator GetIterator();
- void Add(iSaveData *pData);
+ void SetUpAll(cGame *apGame);
- cSaveDataIterator GetIterator();
+ void Clear();
+ size_t Size();
- void Clear();
- size_t Size();
+private:
+ tSaveObjectMap m_mapSaveObjects;
+};
+
+//---------------------------------------------------------
- private:
- void AddVoidPtr(void **apPtr);
- void AddVoidClass(void *apClass);
+typedef std::multimap<int, iSaveData *> tSaveDataMap;
+typedef tSaveDataMap::iterator tSaveDataMapIt;
- iContainerIterator* CreateIteratorPtr();
+typedef cSTLMapIterator<iSaveData *, tSaveDataMap, tSaveDataMapIt> cSaveDataIterator;
- tSaveDataMap m_mapSaveData;
- };
+/**
+ * Used to keep track of save data.
+ */
+class cSaveDataHandler : public iContainer {
+public:
+ cSaveDataHandler();
+ ~cSaveDataHandler();
- //---------------------------------------------------------
+ void Add(iSaveData *pData);
+ cSaveDataIterator GetIterator();
+
+ void Clear();
+ size_t Size();
+
+private:
+ void AddVoidPtr(void **apPtr);
+ void AddVoidClass(void *apClass);
+
+ iContainerIterator *CreateIteratorPtr();
+
+ tSaveDataMap m_mapSaveData;
};
+
+//---------------------------------------------------------
+
+}; // namespace hpl
#endif // HPL_SAVE_GAME_H
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index 7e7005e0d0f..8e283df09f5 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -40,1565 +40,1424 @@
#include "hpl1/engine/game/ScriptFuncs.h"
-#include <stdlib.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include "hpl1/engine/game/Game.h"
+#include "hpl1/engine/graphics/Beam.h"
+#include "hpl1/engine/graphics/BillBoard.h"
#include "hpl1/engine/graphics/Graphics.h"
-#include "hpl1/engine/sound/Sound.h"
-#include "hpl1/engine/resources/Resources.h"
+#include "hpl1/engine/graphics/ParticleSystem3D.h"
+#include "hpl1/engine/graphics/Renderer3D.h"
+#include "hpl1/engine/input/Input.h"
+#include "hpl1/engine/libraries/angelscript/angelscript.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/scene/Scene.h"
+#include "hpl1/engine/physics/PhysicsBody.h"
+#include "hpl1/engine/physics/PhysicsController.h"
+#include "hpl1/engine/physics/PhysicsJoint.h"
+#include "hpl1/engine/physics/PhysicsJointHinge.h"
+#include "hpl1/engine/physics/PhysicsJointScrew.h"
+#include "hpl1/engine/physics/PhysicsJointSlider.h"
+#include "hpl1/engine/resources/Resources.h"
+#include "hpl1/engine/resources/SoundEntityManager.h"
+#include "hpl1/engine/resources/SoundManager.h"
+#include "hpl1/engine/resources/TextureManager.h"
#include "hpl1/engine/scene/Light3D.h"
-#include "hpl1/engine/scene/World3D.h"
-#include "hpl1/engine/scene/SoundEntity.h"
+#include "hpl1/engine/scene/MeshEntity.h"
#include "hpl1/engine/scene/PortalContainer.h"
-#include "hpl1/engine/input/Input.h"
-#include "hpl1/engine/system/System.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/scene/Scene.h"
+#include "hpl1/engine/scene/SoundEntity.h"
+#include "hpl1/engine/scene/World3D.h"
#include "hpl1/engine/sound/MusicHandler.h"
-#include "hpl1/engine/resources/SoundManager.h"
-#include "hpl1/engine/resources/SoundEntityManager.h"
-#include "hpl1/engine/resources/TextureManager.h"
-#include "hpl1/engine/sound/SoundData.h"
+#include "hpl1/engine/sound/Sound.h"
#include "hpl1/engine/sound/SoundChannel.h"
-#include "hpl1/engine/sound/SoundHandler.h"
+#include "hpl1/engine/sound/SoundData.h"
#include "hpl1/engine/sound/SoundEntityData.h"
-#include "hpl1/engine/system/String.h"
-#include "hpl1/engine/physics/PhysicsJoint.h"
-#include "hpl1/engine/physics/PhysicsJointHinge.h"
-#include "hpl1/engine/physics/PhysicsJointScrew.h"
-#include "hpl1/engine/physics/PhysicsJointSlider.h"
-#include "hpl1/engine/physics/PhysicsBody.h"
-#include "hpl1/engine/physics/PhysicsController.h"
+#include "hpl1/engine/sound/SoundHandler.h"
+#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/system/Script.h"
-#include "hpl1/engine/graphics/ParticleSystem3D.h"
-#include "hpl1/engine/scene/MeshEntity.h"
-#include "hpl1/engine/graphics/BillBoard.h"
-#include "hpl1/engine/graphics/Beam.h"
-#include "hpl1/engine/graphics/Renderer3D.h"
-#include "hpl1/engine/libraries/angelscript/angelscript.h"
+#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/system/System.h"
namespace hpl {
- //////////////////////////////////////////////////////////////////////////
- // JOINT CALLBACK
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// JOINT CALLBACK
+//////////////////////////////////////////////////////////////////////////
- cScriptJointCallback::cScriptJointCallback(cScene *apScene)
- {
- mpScene = apScene;
-
- msMaxFunc = "";
- msMinFunc = "";
- }
+cScriptJointCallback::cScriptJointCallback(cScene *apScene) {
+ mpScene = apScene;
- void cScriptJointCallback::OnMinLimit(iPhysicsJoint *apJoint)
- {
- if(msMinFunc!="")
- {
- iScript *pScript = mpScene->GetWorld3D()->GetScript();
+ msMaxFunc = "";
+ msMinFunc = "";
+}
- tString sCommand = msMinFunc + "(\"" + apJoint->GetName() + "\")";
- if(pScript->Run(sCommand)==false){
- Warning("Couldn't run script command '%s'\n",sCommand.c_str());
- }
+void cScriptJointCallback::OnMinLimit(iPhysicsJoint *apJoint) {
+ if (msMinFunc != "") {
+ iScript *pScript = mpScene->GetWorld3D()->GetScript();
+ tString sCommand = msMinFunc + "(\"" + apJoint->GetName() + "\")";
+ if (pScript->Run(sCommand) == false) {
+ Warning("Couldn't run script command '%s'\n", sCommand.c_str());
}
}
+}
- void cScriptJointCallback::OnMaxLimit(iPhysicsJoint *apJoint)
- {
- if(msMaxFunc!="")
- {
- iScript *pScript = mpScene->GetWorld3D()->GetScript();
+void cScriptJointCallback::OnMaxLimit(iPhysicsJoint *apJoint) {
+ if (msMaxFunc != "") {
+ iScript *pScript = mpScene->GetWorld3D()->GetScript();
- tString sCommand = msMaxFunc + "(\"" + apJoint->GetName() + "\")";
- if(pScript->Run(sCommand)==false){
- Warning("Couldn't run script command '%s'\n",sCommand.c_str());
- }
+ tString sCommand = msMaxFunc + "(\"" + apJoint->GetName() + "\")";
+ if (pScript->Run(sCommand) == false) {
+ Warning("Couldn't run script command '%s'\n", sCommand.c_str());
}
}
+}
- //////////////////////////////////////////////////////////////////////////
- // PUBLIC METHODS
- //////////////////////////////////////////////////////////////////////////
-
- static cResources *gpResources=NULL;
- static cSystem *gpSystem=NULL;
- static cInput *gpInput=NULL;
- static cGraphics *gpGraphics=NULL;
- static cScene *gpScene=NULL;
- static cSound *gpSound=NULL;
- static cGame *gpGame=NULL;
-
- //-----------------------------------------------------------------------
-
- static void __stdcall Print(std::string asText)
- {
- Log(asText.c_str());
- }
- SCRIPT_DEFINE_FUNC_1(void, Print, string)
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
- static std::string __stdcall FloatToString(float afX)
- {
- char sTemp[30];
- sprintf(sTemp,"%f",afX);
- return (std::string) sTemp;
- }
- SCRIPT_DEFINE_FUNC_1(string, FloatToString, float)
+static cResources *gpResources = NULL;
+static cSystem *gpSystem = NULL;
+static cInput *gpInput = NULL;
+static cGraphics *gpGraphics = NULL;
+static cScene *gpScene = NULL;
+static cSound *gpSound = NULL;
+static cGame *gpGame = NULL;
- static std::string __stdcall IntToString(int alX)
- {
- char sTemp[30];
- sprintf(sTemp,"%d",alX);
- return (std::string) sTemp;
- }
- SCRIPT_DEFINE_FUNC_1(string, IntToString, int)
+//-----------------------------------------------------------------------
- static float __stdcall RandFloat(float afMin, float afMax)
- {
- return cMath::RandRectf(afMin,afMax);
- }
- SCRIPT_DEFINE_FUNC_2(float, RandFloat, float, float)
+static void __stdcall Print(std::string asText) {
+ Log(asText.c_str());
+}
+SCRIPT_DEFINE_FUNC_1(void, Print, string)
- static int __stdcall RandInt(int alMin, int alMax)
- {
- return cMath::RandRectl(alMin,alMax);
- }
- SCRIPT_DEFINE_FUNC_2(int, RandInt, int, int)
+static std::string __stdcall FloatToString(float afX) {
+ char sTemp[30];
+ sprintf(sTemp, "%f", afX);
+ return (std::string)sTemp;
+}
+SCRIPT_DEFINE_FUNC_1(string, FloatToString, float)
- static bool __stdcall StringContains(std::string asString, std::string asSubString)
- {
- return cString::GetLastStringPos(asString,asSubString)>=0;
- }
- SCRIPT_DEFINE_FUNC_2(bool, StringContains, string, string)
+static std::string __stdcall IntToString(int alX) {
+ char sTemp[30];
+ sprintf(sTemp, "%d", alX);
+ return (std::string)sTemp;
+}
+SCRIPT_DEFINE_FUNC_1(string, IntToString, int)
- static void __stdcall ResetLogicTimer()
- {
- gpGame->ResetLogicTimer();
- }
- SCRIPT_DEFINE_FUNC(void, ResetLogicTimer)
+static float __stdcall RandFloat(float afMin, float afMax) {
+ return cMath::RandRectf(afMin, afMax);
+}
+SCRIPT_DEFINE_FUNC_2(float, RandFloat, float, float)
- /////////////////////////////////////////////////////////////////////////
- /////// RENDERER //////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
+static int __stdcall RandInt(int alMin, int alMax) {
+ return cMath::RandRectl(alMin, alMax);
+}
+SCRIPT_DEFINE_FUNC_2(int, RandInt, int, int)
- //-----------------------------------------------------------------------
+static bool __stdcall StringContains(std::string asString, std::string asSubString) {
+ return cString::GetLastStringPos(asString, asSubString) >= 0;
+}
+SCRIPT_DEFINE_FUNC_2(bool, StringContains, string, string)
- /**
- * Sets ambient light color-
- **/
- static void __stdcall SetAmbientColor(float afR, float afG, float afB)
- {
- gpGraphics->GetRenderer3D()->SetAmbientColor(cColor(afR,afG,afB,1.0f));
- }
- SCRIPT_DEFINE_FUNC_3(void, SetAmbientColor, float, float, float)
+static void __stdcall ResetLogicTimer() {
+ gpGame->ResetLogicTimer();
+}
+SCRIPT_DEFINE_FUNC(void, ResetLogicTimer)
- //-----------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////
+/////// RENDERER //////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
- /**
- * Sets if the skybox should be active
- **/
- static void __stdcall SetSkyboxActive(bool abX)
- {
- gpGraphics->GetRenderer3D()->SetSkyBoxActive(abX);
- }
- SCRIPT_DEFINE_FUNC_1(void, SetSkyboxActive, bool)
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+/**
+ * Sets ambient light color-
+ **/
+static void __stdcall SetAmbientColor(float afR, float afG, float afB) {
+ gpGraphics->GetRenderer3D()->SetAmbientColor(cColor(afR, afG, afB, 1.0f));
+}
+SCRIPT_DEFINE_FUNC_3(void, SetAmbientColor, float, float, float)
- /**
- * Sets the skybox color.
- **/
- static void __stdcall SetSkyboxColor(float afR, float afG, float afB, float afA)
- {
- gpGraphics->GetRenderer3D()->SetSkyBoxColor(cColor(afR,afG,afB,afA));
- }
- SCRIPT_DEFINE_FUNC_4(void, SetSkyboxColor, float, float, float, float)
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+/**
+ * Sets if the skybox should be active
+ **/
+static void __stdcall SetSkyboxActive(bool abX) {
+ gpGraphics->GetRenderer3D()->SetSkyBoxActive(abX);
+}
+SCRIPT_DEFINE_FUNC_1(void, SetSkyboxActive, bool)
+//-----------------------------------------------------------------------
- /**
- * Sets the skybox
- * \param asTexture Name of the cube map texture to use
- **/
- static void __stdcall SetSkybox(std::string asTexture)
- {
- if(asTexture!="")
- {
- iTexture *pTex = gpResources->GetTextureManager()->CreateCubeMap(asTexture,false);
- gpGraphics->GetRenderer3D()->SetSkyBox(pTex,true);
- }
- else
- {
- gpGraphics->GetRenderer3D()->SetSkyBox(NULL,false);
- }
- }
- SCRIPT_DEFINE_FUNC_1(void, SetSkybox, string)
-
- //-----------------------------------------------------------------------
-
- /**
- * Creates a particle system and attaches it to the camera.
- * \param asName Name of particle system
- * \param asType The type of particle system (file)
- **/
- static void __stdcall CreateParticleSystemOnCamera(std::string asName,std::string asType)
- {
- cParticleSystem3D *pPS = gpScene->GetWorld3D()->CreateParticleSystem(asName,asType,
- 1,cMatrixf::Identity);
- if(pPS)
- {
- cCamera3D *pCam = static_cast<cCamera3D*>(gpScene->GetCamera());
- pCam->AttachEntity(pPS);
- }
+/**
+ * Sets the skybox color.
+ **/
+static void __stdcall SetSkyboxColor(float afR, float afG, float afB, float afA) {
+ gpGraphics->GetRenderer3D()->SetSkyBoxColor(cColor(afR, afG, afB, afA));
+}
+SCRIPT_DEFINE_FUNC_4(void, SetSkyboxColor, float, float, float, float)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Sets the skybox
+ * \param asTexture Name of the cube map texture to use
+ **/
+static void __stdcall SetSkybox(std::string asTexture) {
+ if (asTexture != "") {
+ iTexture *pTex = gpResources->GetTextureManager()->CreateCubeMap(asTexture, false);
+ gpGraphics->GetRenderer3D()->SetSkyBox(pTex, true);
+ } else {
+ gpGraphics->GetRenderer3D()->SetSkyBox(NULL, false);
}
- SCRIPT_DEFINE_FUNC_2(void, CreateParticleSystemOnCamera, string, string)
-
- //-----------------------------------------------------------------------
-
- /**
- * Sets if fog should be active
- * \param abX If the fog is active or not.
- **/
- static void __stdcall SetFogActive(bool abX)
- {
- gpGraphics->GetRenderer3D()->SetFogActive(abX);
- }
- SCRIPT_DEFINE_FUNC_1(void, SetFogActive, bool)
-
- /**
- * Sets if the fog should be used to cull non-visible objects
- * \param abX If the culling is active or not.
- **/
- static void __stdcall SetFogCulling(bool abX)
- {
- gpGraphics->GetRenderer3D()->SetFogCulling(abX);
- }
- SCRIPT_DEFINE_FUNC_1(void, SetFogCulling, bool)
-
- /**
- * Creates a particle system and attaches it to the camera.
- * \param afStart Start of fog color
- * \param afStart End of fog fade. After this limit all geometry is full fog color.
- * \param afR, afG, afB Color of Fog.
- **/
- static void __stdcall SetFogProperties(float afStart, float afEnd, float afR,float afG, float afB)
- {
- gpGraphics->GetRenderer3D()->SetFogStart(afStart);
- gpGraphics->GetRenderer3D()->SetFogEnd(afEnd);
- gpGraphics->GetRenderer3D()->SetFogColor(cColor(afR,afG,afB,1.0f));
- }
- SCRIPT_DEFINE_FUNC_5(void, SetFogProperties, float, float, float, float, float)
-
- //-----------------------------------------------------------------------
-
- static void __stdcall SetSectorProperties(std::string asSector, float afAmbR,float afAmbG, float afAmbB)
- {
- cPortalContainer *pContainer = gpScene->GetWorld3D()->GetPortalContainer();
-
- cSector *pSector = pContainer->GetSector(asSector);
- if(pSector == NULL){
- Warning("Could not find sector '%s'\n", asSector.c_str());
- return;
- }
-
- pSector->SetAmbientColor(cColor(afAmbR, afAmbG, afAmbB,1));
+}
+SCRIPT_DEFINE_FUNC_1(void, SetSkybox, string)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Creates a particle system and attaches it to the camera.
+ * \param asName Name of particle system
+ * \param asType The type of particle system (file)
+ **/
+static void __stdcall CreateParticleSystemOnCamera(std::string asName, std::string asType) {
+ cParticleSystem3D *pPS = gpScene->GetWorld3D()->CreateParticleSystem(asName, asType,
+ 1, cMatrixf::Identity);
+ if (pPS) {
+ cCamera3D *pCam = static_cast<cCamera3D *>(gpScene->GetCamera());
+ pCam->AttachEntity(pPS);
}
- SCRIPT_DEFINE_FUNC_4(void, SetSectorProperties, string, float, float, float)
+}
+SCRIPT_DEFINE_FUNC_2(void, CreateParticleSystemOnCamera, string, string)
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- static void __stdcall SetSectorPortalActive(std::string asSector, int alPortal, bool abActive)
- {
- cPortalContainer *pContainer = gpScene->GetWorld3D()->GetPortalContainer();
+/**
+ * Sets if fog should be active
+ * \param abX If the fog is active or not.
+ **/
+static void __stdcall SetFogActive(bool abX) {
+ gpGraphics->GetRenderer3D()->SetFogActive(abX);
+}
+SCRIPT_DEFINE_FUNC_1(void, SetFogActive, bool)
+
+/**
+ * Sets if the fog should be used to cull non-visible objects
+ * \param abX If the culling is active or not.
+ **/
+static void __stdcall SetFogCulling(bool abX) {
+ gpGraphics->GetRenderer3D()->SetFogCulling(abX);
+}
+SCRIPT_DEFINE_FUNC_1(void, SetFogCulling, bool)
+
+/**
+ * Creates a particle system and attaches it to the camera.
+ * \param afStart Start of fog color
+ * \param afStart End of fog fade. After this limit all geometry is full fog color.
+ * \param afR, afG, afB Color of Fog.
+ **/
+static void __stdcall SetFogProperties(float afStart, float afEnd, float afR, float afG, float afB) {
+ gpGraphics->GetRenderer3D()->SetFogStart(afStart);
+ gpGraphics->GetRenderer3D()->SetFogEnd(afEnd);
+ gpGraphics->GetRenderer3D()->SetFogColor(cColor(afR, afG, afB, 1.0f));
+}
+SCRIPT_DEFINE_FUNC_5(void, SetFogProperties, float, float, float, float, float)
- cSector *pSector = pContainer->GetSector(asSector);
- if(pSector == NULL){
- Warning("Could not find sector '%s'\n", asSector.c_str());
- return;
- }
+//-----------------------------------------------------------------------
- cPortal *pPortal = pSector->GetPortal(alPortal);
- if(pPortal==NULL)
- {
- Warning("Could not find portal %d in sector '%s'\n",alPortal,asSector.c_str());
- return;
- }
+static void __stdcall SetSectorProperties(std::string asSector, float afAmbR, float afAmbG, float afAmbB) {
+ cPortalContainer *pContainer = gpScene->GetWorld3D()->GetPortalContainer();
- pPortal->SetActive(abActive);
- }
- SCRIPT_DEFINE_FUNC_3(void, SetSectorPortalActive, string, int, bool)
-
- /////////////////////////////////////////////////////////////////////////
- /////// RESOURCES //////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
-
- //-----------------------------------------------------------------------
- /**
- * Gets a string in the current language.
- * \param asCat The translation category
- * \param asName The name of the category entry.
- **/
- static std::string __stdcall Translate(std::string asCat, std::string asName)
- {
- tWString wsText = gpResources->Translate(asCat,asName);
- return cString::To8Char(wsText);
- }
- SCRIPT_DEFINE_FUNC_2(string, Translate, string, string)
-
- //-----------------------------------------------------------------------
-
- /**
- * Preloads the data for a sound.
- * \param asFile This can be a wav, ogg, mp3 or snt file.
- **/
- static void __stdcall PreloadSound(std::string asFile)
- {
- tString sExt = cString::ToLowerCase(cString::GetFileExt(asFile));
- if(sExt=="snt")
- {
- cSoundEntityData *pData = gpResources->GetSoundEntityManager()->CreateSoundEntity(asFile);
- if(pData == NULL) {
- Warning("Couldn't preload sound '%s'\n",asFile.c_str());
- return;
- }
-
- if(pData->GetMainSoundName() != ""){
- iSoundChannel *pChannel = gpSound->GetSoundHandler()->CreateChannel(pData->GetMainSoundName(),0);
- hplDelete(pChannel);
- }
- if(pData->GetStartSoundName() != ""){
- iSoundChannel *pChannel = gpSound->GetSoundHandler()->CreateChannel(pData->GetStartSoundName(),0);
- hplDelete(pChannel);
- }
- if(pData->GetStopSoundName() != ""){
- iSoundChannel *pChannel = gpSound->GetSoundHandler()->CreateChannel(pData->GetStopSoundName(),0);
- hplDelete(pChannel);
- }
- }
- else
- {
- iSoundData *pSound = gpResources->GetSoundManager()->CreateSoundData(asFile,false);
- if(pSound){
- Warning("Couldn't preload sound '%s'\n",asFile.c_str());
- }
- }
+ cSector *pSector = pContainer->GetSector(asSector);
+ if (pSector == NULL) {
+ Warning("Could not find sector '%s'\n", asSector.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_1(void, PreloadSound, string)
-
- //-----------------------------------------------------------------------
- /////////////////////////////////////////////////////////////////////////
- /////// MESH ENTITY //////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
+ pSector->SetAmbientColor(cColor(afAmbR, afAmbG, afAmbB, 1));
+}
+SCRIPT_DEFINE_FUNC_4(void, SetSectorProperties, string, float, float, float)
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- static void __stdcall SetMeshActive(std::string asName, bool abActive)
- {
- cMeshEntity *pEnt = gpScene->GetWorld3D()->GetMeshEntity(asName);
- if(pEnt==NULL){
- Warning("Didn't find mesh entity '%s'\n",asName.c_str());
- return;
- }
+static void __stdcall SetSectorPortalActive(std::string asSector, int alPortal, bool abActive) {
+ cPortalContainer *pContainer = gpScene->GetWorld3D()->GetPortalContainer();
- pEnt->SetActive(abActive);
- pEnt->SetVisible(abActive);
+ cSector *pSector = pContainer->GetSector(asSector);
+ if (pSector == NULL) {
+ Warning("Could not find sector '%s'\n", asSector.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_2(void, SetMeshActive, string, bool)
-
- //-----------------------------------------------------------------------
-
- /////////////////////////////////////////////////////////////////////////
- /////// PARTICLE SYSTEM //////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+ cPortal *pPortal = pSector->GetPortal(alPortal);
+ if (pPortal == NULL) {
+ Warning("Could not find portal %d in sector '%s'\n", alPortal, asSector.c_str());
+ return;
+ }
- /**
- * Create a particle system at the position of an area
- * \param asName The name of the particle system.
- * \param abActive If it should be active or not.
- **/
- static void __stdcall SetParticleSystemActive(std::string asName, bool abActive)
- {
- cParticleSystem3D *pPS = gpScene->GetWorld3D()->GetParticleSystem(asName);
- if(pPS==NULL){
- Warning("Didn't find particle system '%s'\n",asName.c_str());
+ pPortal->SetActive(abActive);
+}
+SCRIPT_DEFINE_FUNC_3(void, SetSectorPortalActive, string, int, bool)
+
+/////////////////////////////////////////////////////////////////////////
+/////// RESOURCES //////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+/**
+ * Gets a string in the current language.
+ * \param asCat The translation category
+ * \param asName The name of the category entry.
+ **/
+static std::string __stdcall Translate(std::string asCat, std::string asName) {
+ tWString wsText = gpResources->Translate(asCat, asName);
+ return cString::To8Char(wsText);
+}
+SCRIPT_DEFINE_FUNC_2(string, Translate, string, string)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Preloads the data for a sound.
+ * \param asFile This can be a wav, ogg, mp3 or snt file.
+ **/
+static void __stdcall PreloadSound(std::string asFile) {
+ tString sExt = cString::ToLowerCase(cString::GetFileExt(asFile));
+ if (sExt == "snt") {
+ cSoundEntityData *pData = gpResources->GetSoundEntityManager()->CreateSoundEntity(asFile);
+ if (pData == NULL) {
+ Warning("Couldn't preload sound '%s'\n", asFile.c_str());
return;
}
- pPS->SetActive(abActive);
- pPS->SetVisible(abActive);
- }
- SCRIPT_DEFINE_FUNC_2(void, SetParticleSystemActive, string, bool)
-
- //-----------------------------------------------------------------------
-
- /**
- * Create a particle system at the position of an area
- * \param asName The name of the particle system.
- * \param asType The type of aprticle system
- * \param asArea The name of the area
- * \param X Y and Z the variables of the particle system.
- **/
- static void __stdcall CreateParticleSystem(std::string asName, std::string asType, std::string asArea,
- float afX, float afY, float afZ)
- {
- cAreaEntity* pArea = gpScene->GetWorld3D()->GetAreaEntity(asArea);
- if(pArea==NULL){
- Warning("Couldn't find area '%s'\n",asArea.c_str());
- return;
+ if (pData->GetMainSoundName() != "") {
+ iSoundChannel *pChannel = gpSound->GetSoundHandler()->CreateChannel(pData->GetMainSoundName(), 0);
+ hplDelete(pChannel);
}
-
- cParticleSystem3D *pPS = gpScene->GetWorld3D()->CreateParticleSystem(asName,asType,
- cVector3f(afX,afY,afZ),pArea->m_mtxTransform);
- if(pPS==NULL){
- Warning("No particle system of type '%s'\n",asType.c_str());
- return;
+ if (pData->GetStartSoundName() != "") {
+ iSoundChannel *pChannel = gpSound->GetSoundHandler()->CreateChannel(pData->GetStartSoundName(), 0);
+ hplDelete(pChannel);
}
- }
- SCRIPT_DEFINE_FUNC_6(void, CreateParticleSystem, string, string, string, float, float, float)
-
- //-----------------------------------------------------------------------
-
- /**
- * Kill a particle system
- * \param asName The name of the particle system.
- **/
- static void __stdcall KillParticleSystem(std::string asName)
- {
- /*cParticleSystem3D *pPS = gpScene->GetWorld3D()->GetParticleSystem(asName);
- if(pPS==NULL){
- Warning("Didn't find particle system '%s'\n",asName.c_str());
- return;
+ if (pData->GetStopSoundName() != "") {
+ iSoundChannel *pChannel = gpSound->GetSoundHandler()->CreateChannel(pData->GetStopSoundName(), 0);
+ hplDelete(pChannel);
}
- pPS->Kill();*/
-
- bool bFound = false;
- cParticleSystem3DIterator it = gpScene->GetWorld3D()->GetParticleSystemIterator();
- while(it.HasNext())
- {
- cParticleSystem3D *pPS = it.Next();
-
- if(pPS->GetName() == asName)
- {
- pPS->Kill();
- bFound = true;
- }
+ } else {
+ iSoundData *pSound = gpResources->GetSoundManager()->CreateSoundData(asFile, false);
+ if (pSound) {
+ Warning("Couldn't preload sound '%s'\n", asFile.c_str());
}
-
- if(!bFound) Warning("Didn't find particle system '%s'\n",asName.c_str());
}
- SCRIPT_DEFINE_FUNC_1(void, KillParticleSystem, string)
-
- //-----------------------------------------------------------------------
-
- /////////////////////////////////////////////////////////////////////////
- /////// BEAM //////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
+}
+SCRIPT_DEFINE_FUNC_1(void, PreloadSound, string)
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////
+/////// MESH ENTITY //////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
- /**
- * Creates an a beam between two areas
- * \param asName
- * \param asFile
- * \param asStartArea
- * \param asEndArea
- */
- static void __stdcall CreateBeam(std::string asName, std::string asFile,
- std::string asStartArea, std::string asEndArea)
- {
- cAreaEntity* pStartArea = gpScene->GetWorld3D()->GetAreaEntity(asStartArea);
- if(pStartArea==NULL){
- Warning("Couldn't find area '%s'\n",asStartArea.c_str());
- return;
- }
+//-----------------------------------------------------------------------
- cAreaEntity* pEndArea = gpScene->GetWorld3D()->GetAreaEntity(asEndArea);
- if(pEndArea==NULL){
- Warning("Couldn't find area '%s'\n",asEndArea.c_str());
- return;
- }
+static void __stdcall SetMeshActive(std::string asName, bool abActive) {
+ cMeshEntity *pEnt = gpScene->GetWorld3D()->GetMeshEntity(asName);
+ if (pEnt == NULL) {
+ Warning("Didn't find mesh entity '%s'\n", asName.c_str());
+ return;
+ }
- cBeam *pBeam = gpScene->GetWorld3D()->CreateBeam(asName);
+ pEnt->SetActive(abActive);
+ pEnt->SetVisible(abActive);
+}
+SCRIPT_DEFINE_FUNC_2(void, SetMeshActive, string, bool)
+
+//-----------------------------------------------------------------------
+
+/////////////////////////////////////////////////////////////////////////
+/////// PARTICLE SYSTEM //////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+/**
+ * Create a particle system at the position of an area
+ * \param asName The name of the particle system.
+ * \param abActive If it should be active or not.
+ **/
+static void __stdcall SetParticleSystemActive(std::string asName, bool abActive) {
+ cParticleSystem3D *pPS = gpScene->GetWorld3D()->GetParticleSystem(asName);
+ if (pPS == NULL) {
+ Warning("Didn't find particle system '%s'\n", asName.c_str());
+ return;
+ }
- if(pBeam->LoadXMLProperties(asFile)==false)
- {
- Error("Couldn't create beam from file '%s'\n",asFile.c_str());
- gpScene->GetWorld3D()->DestroyBeam(pBeam);
- return;
- }
+ pPS->SetActive(abActive);
+ pPS->SetVisible(abActive);
+}
+SCRIPT_DEFINE_FUNC_2(void, SetParticleSystemActive, string, bool)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Create a particle system at the position of an area
+ * \param asName The name of the particle system.
+ * \param asType The type of aprticle system
+ * \param asArea The name of the area
+ * \param X Y and Z the variables of the particle system.
+ **/
+static void __stdcall CreateParticleSystem(std::string asName, std::string asType, std::string asArea,
+ float afX, float afY, float afZ) {
+ cAreaEntity *pArea = gpScene->GetWorld3D()->GetAreaEntity(asArea);
+ if (pArea == NULL) {
+ Warning("Couldn't find area '%s'\n", asArea.c_str());
+ return;
+ }
- pBeam->SetPosition(pStartArea->m_mtxTransform.GetTranslation());
- pBeam->GetEnd()->SetPosition(pEndArea->m_mtxTransform.GetTranslation());
+ cParticleSystem3D *pPS = gpScene->GetWorld3D()->CreateParticleSystem(asName, asType,
+ cVector3f(afX, afY, afZ), pArea->m_mtxTransform);
+ if (pPS == NULL) {
+ Warning("No particle system of type '%s'\n", asType.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_4(void, CreateBeam, string, string, string, string)
+}
+SCRIPT_DEFINE_FUNC_6(void, CreateParticleSystem, string, string, string, float, float, float)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Kill a particle system
+ * \param asName The name of the particle system.
+ **/
+static void __stdcall KillParticleSystem(std::string asName) {
+ /*cParticleSystem3D *pPS = gpScene->GetWorld3D()->GetParticleSystem(asName);
+ if(pPS==NULL){
+ Warning("Didn't find particle system '%s'\n",asName.c_str());
+ return;
+ }
+ pPS->Kill();*/
- //-----------------------------------------------------------------------
+ bool bFound = false;
+ cParticleSystem3DIterator it = gpScene->GetWorld3D()->GetParticleSystemIterator();
+ while (it.HasNext()) {
+ cParticleSystem3D *pPS = it.Next();
- /**
- * Destroys a beam
- * \param asName
- */
- static void __stdcall DestroyBeam(std::string asName)
- {
- cBeam* pBeam = gpScene->GetWorld3D()->GetBeam(asName);
- if(pBeam==NULL)
- {
- Warning("Couldn't find beam '%s'\n",asName.c_str());
- return;
+ if (pPS->GetName() == asName) {
+ pPS->Kill();
+ bFound = true;
}
-
- gpScene->GetWorld3D()->DestroyBeam(pBeam);
}
- SCRIPT_DEFINE_FUNC_1(void, DestroyBeam, string)
- //-----------------------------------------------------------------------
-
-
-
- /////////////////////////////////////////////////////////////////////////
- /////// LIGHT //////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
-
- //-----------------------------------------------------------------------
+ if (!bFound)
+ Warning("Didn't find particle system '%s'\n", asName.c_str());
+}
+SCRIPT_DEFINE_FUNC_1(void, KillParticleSystem, string)
- /**
- * Fades a sound to a color and a radius
- * \param asName The name of the light
- * \param afR The red channel to fade to.
- * \param afG The green channel to fade to.
- * \param afB The blue channel to fade to.
- * \param afA The alpha channel to fade to.
- * \param afRadius The radius to fade to.
- * \param afTime The amount of seconds the fade should last.
- **/
- static void __stdcall FadeLight3D(std::string asName, float afR,float afG, float afB, float afA,
- float afRadius, float afTime)
- {
- iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
- if(pLight==NULL)
- {
- Warning("Couldn't find light '%s'\n",asName.c_str());
- return;
- }
+//-----------------------------------------------------------------------
- pLight->FadeTo(cColor(afR,afG,afB,afA),afRadius, afTime);
- pLight->SetVisible(true);
- pLight->UpdateLight(2.0f/60.0f);
- }
- SCRIPT_DEFINE_FUNC_7(void, FadeLight3D, string, float, float, float, float, float, float)
-
- //-----------------------------------------------------------------------
-
- /**
- * Attaches a billboard to a light
- * \param asBillboardName The billbaord name
- * \param asLightName The light name
- * \param abX True if it should be attached, false if you want to remove.
- **/
- static void __stdcall AttachBillboardToLight3D(std::string asBillboardName, std::string asLightName,bool abX)
- {
- iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asLightName);
- if(pLight==NULL)
- {
- Warning("Couldn't find light '%s'\n",asLightName.c_str());
- return;
- }
+/////////////////////////////////////////////////////////////////////////
+/////// BEAM //////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
- cBillboard *pBillboard = gpScene->GetWorld3D()->GetBillboard(asBillboardName);
- if(pBillboard==NULL)
- {
- Warning("Couldn't find billboard '%s'\n",asBillboardName.c_str());
- return;
- }
+//-----------------------------------------------------------------------
- if(abX)
- pLight->AttachBillboard(pBillboard);
- else
- pLight->RemoveBillboard(pBillboard);
+/**
+ * Creates an a beam between two areas
+ * \param asName
+ * \param asFile
+ * \param asStartArea
+ * \param asEndArea
+ */
+static void __stdcall CreateBeam(std::string asName, std::string asFile,
+ std::string asStartArea, std::string asEndArea) {
+ cAreaEntity *pStartArea = gpScene->GetWorld3D()->GetAreaEntity(asStartArea);
+ if (pStartArea == NULL) {
+ Warning("Couldn't find area '%s'\n", asStartArea.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_3(void, AttachBillboardToLight3D, string, string, bool)
-
- //-----------------------------------------------------------------------
+ cAreaEntity *pEndArea = gpScene->GetWorld3D()->GetAreaEntity(asEndArea);
+ if (pEndArea == NULL) {
+ Warning("Couldn't find area '%s'\n", asEndArea.c_str());
+ return;
+ }
- /**
- * Sets on/off a light
- * \param asName The light name
- * \param abX if the light should be on or off.
- **/
- static void __stdcall SetLight3DVisible(std::string asName, bool abX)
- {
- iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
- if(pLight==NULL)
- {
- Warning("Couldn't find light '%s'\n",asName.c_str());
- return;
- }
+ cBeam *pBeam = gpScene->GetWorld3D()->CreateBeam(asName);
- pLight->SetVisible(abX);
+ if (pBeam->LoadXMLProperties(asFile) == false) {
+ Error("Couldn't create beam from file '%s'\n", asFile.c_str());
+ gpScene->GetWorld3D()->DestroyBeam(pBeam);
+ return;
}
- SCRIPT_DEFINE_FUNC_2(void, SetLight3DVisible, string, bool)
- //-----------------------------------------------------------------------
+ pBeam->SetPosition(pStartArea->m_mtxTransform.GetTranslation());
+ pBeam->GetEnd()->SetPosition(pEndArea->m_mtxTransform.GetTranslation());
+}
+SCRIPT_DEFINE_FUNC_4(void, CreateBeam, string, string, string, string)
- /**
- * Sets on/off for affect only in sector where centre is.
- * \param asName The light name
- * \param abX if the light should only affects objects in same sector or not.
- **/
- static void __stdcall SetLight3DOnlyAffectInSector(std::string asName, bool abX)
- {
- iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
- if(pLight==NULL)
- {
- Warning("Couldn't find light '%s'\n",asName.c_str());
- return;
- }
+//-----------------------------------------------------------------------
- pLight->SetOnlyAffectInSector(abX);
+/**
+ * Destroys a beam
+ * \param asName
+ */
+static void __stdcall DestroyBeam(std::string asName) {
+ cBeam *pBeam = gpScene->GetWorld3D()->GetBeam(asName);
+ if (pBeam == NULL) {
+ Warning("Couldn't find beam '%s'\n", asName.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_2(void, SetLight3DOnlyAffectInSector, string, bool)
-
- //-----------------------------------------------------------------------
- /**
- * Sets flickering on/off a light
- * \param asName The light name
- * \param abX if the light flicker should be on or off.
- **/
- static void __stdcall SetLight3DFlickerActive(std::string asName, bool abX)
- {
- iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
- if(pLight==NULL)
- {
- Warning("Couldn't find light '%s'\n",asName.c_str());
- return;
- }
+ gpScene->GetWorld3D()->DestroyBeam(pBeam);
+}
+SCRIPT_DEFINE_FUNC_1(void, DestroyBeam, string)
+
+//-----------------------------------------------------------------------
+
+/////////////////////////////////////////////////////////////////////////
+/////// LIGHT //////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+/**
+ * Fades a sound to a color and a radius
+ * \param asName The name of the light
+ * \param afR The red channel to fade to.
+ * \param afG The green channel to fade to.
+ * \param afB The blue channel to fade to.
+ * \param afA The alpha channel to fade to.
+ * \param afRadius The radius to fade to.
+ * \param afTime The amount of seconds the fade should last.
+ **/
+static void __stdcall FadeLight3D(std::string asName, float afR, float afG, float afB, float afA,
+ float afRadius, float afTime) {
+ iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
+ if (pLight == NULL) {
+ Warning("Couldn't find light '%s'\n", asName.c_str());
+ return;
+ }
- pLight->SetFlickerActive(abX);
- }
- SCRIPT_DEFINE_FUNC_2(void, SetLight3DFlickerActive, string, bool)
-
- //-----------------------------------------------------------------------
-
- /**
- * Sets flickering parameters
- * \param asName The light name
- * \param abR, afG, afB, afA The color of the light when off
- * \param afRadius The radius of the light when off.
- * \param afOnMinLength Minimum time before going from off to on.
- * \param afOnMaxLength Maximum time before going from off to on.
- * \param asOnSound Name of the sound played when going from off to on. "" means no sound.
- * \param asOnPS Name of the particle system played when going from off to on. "" means none.
- * \param afOffMinLength Minimum time before going from on to off.
- * \param afOffMaxLength Maximum time before going from on to off.
- * \param asOffSound Name of the sound played when going from on to off. "" means no sound.
- * \param asOffPS Name of the particle system played when going from on to off. "" means none.
- * \param abFade If there should be a fade between off and on.
- * \param afOnFadeLength Fade length from off to on.
- * \param afOffFadeLength Fade length from on to off.
- **/
- static void __stdcall SetLight3DFlicker(std::string asName,
- float afR,float afG, float afB, float afA,
- float afRadius,
-
- float afOnMinLength, float afOnMaxLength,
- std::string asOnSound,std::string asOnPS,
-
- float afOffMinLength, float afOffMaxLength,
- std::string asOffSound,std::string asOffPS,
-
- bool abFade,
- float afOnFadeLength, float afOffFadeLength)
- {
- iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
- if(pLight==NULL)
- {
- Warning("Couldn't find light '%s'\n",asName.c_str());
- return;
- }
+ pLight->FadeTo(cColor(afR, afG, afB, afA), afRadius, afTime);
+ pLight->SetVisible(true);
+ pLight->UpdateLight(2.0f / 60.0f);
+}
+SCRIPT_DEFINE_FUNC_7(void, FadeLight3D, string, float, float, float, float, float, float)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Attaches a billboard to a light
+ * \param asBillboardName The billbaord name
+ * \param asLightName The light name
+ * \param abX True if it should be attached, false if you want to remove.
+ **/
+static void __stdcall AttachBillboardToLight3D(std::string asBillboardName, std::string asLightName, bool abX) {
+ iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asLightName);
+ if (pLight == NULL) {
+ Warning("Couldn't find light '%s'\n", asLightName.c_str());
+ return;
+ }
- pLight->SetFlicker(cColor(afR,afG,afB,afA),afRadius,
- afOnMinLength, afOnMaxLength,asOnSound,asOnPS,
- afOffMinLength, afOffMaxLength,asOffSound,asOffPS,
- abFade,afOnFadeLength,afOffFadeLength);
+ cBillboard *pBillboard = gpScene->GetWorld3D()->GetBillboard(asBillboardName);
+ if (pBillboard == NULL) {
+ Warning("Couldn't find billboard '%s'\n", asBillboardName.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_17(void, SetLight3DFlicker, string,
- float, float, float, float,
- float, float, float, string, string, float, float, string, string, bool, float, float)
- //-----------------------------------------------------------------------
+ if (abX)
+ pLight->AttachBillboard(pBillboard);
+ else
+ pLight->RemoveBillboard(pBillboard);
+}
+SCRIPT_DEFINE_FUNC_3(void, AttachBillboardToLight3D, string, string, bool)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Sets on/off a light
+ * \param asName The light name
+ * \param abX if the light should be on or off.
+ **/
+static void __stdcall SetLight3DVisible(std::string asName, bool abX) {
+ iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
+ if (pLight == NULL) {
+ Warning("Couldn't find light '%s'\n", asName.c_str());
+ return;
+ }
- /////////////////////////////////////////////////////////////////////////
- /////// SOUND //////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
+ pLight->SetVisible(abX);
+}
+SCRIPT_DEFINE_FUNC_2(void, SetLight3DVisible, string, bool)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Sets on/off for affect only in sector where centre is.
+ * \param asName The light name
+ * \param abX if the light should only affects objects in same sector or not.
+ **/
+static void __stdcall SetLight3DOnlyAffectInSector(std::string asName, bool abX) {
+ iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
+ if (pLight == NULL) {
+ Warning("Couldn't find light '%s'\n", asName.c_str());
+ return;
+ }
+ pLight->SetOnlyAffectInSector(abX);
+}
+SCRIPT_DEFINE_FUNC_2(void, SetLight3DOnlyAffectInSector, string, bool)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Sets flickering on/off a light
+ * \param asName The light name
+ * \param abX if the light flicker should be on or off.
+ **/
+static void __stdcall SetLight3DFlickerActive(std::string asName, bool abX) {
+ iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
+ if (pLight == NULL) {
+ Warning("Couldn't find light '%s'\n", asName.c_str());
+ return;
+ }
- //-----------------------------------------------------------------------
+ pLight->SetFlickerActive(abX);
+}
+SCRIPT_DEFINE_FUNC_2(void, SetLight3DFlickerActive, string, bool)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Sets flickering parameters
+ * \param asName The light name
+ * \param abR, afG, afB, afA The color of the light when off
+ * \param afRadius The radius of the light when off.
+ * \param afOnMinLength Minimum time before going from off to on.
+ * \param afOnMaxLength Maximum time before going from off to on.
+ * \param asOnSound Name of the sound played when going from off to on. "" means no sound.
+ * \param asOnPS Name of the particle system played when going from off to on. "" means none.
+ * \param afOffMinLength Minimum time before going from on to off.
+ * \param afOffMaxLength Maximum time before going from on to off.
+ * \param asOffSound Name of the sound played when going from on to off. "" means no sound.
+ * \param asOffPS Name of the particle system played when going from on to off. "" means none.
+ * \param abFade If there should be a fade between off and on.
+ * \param afOnFadeLength Fade length from off to on.
+ * \param afOffFadeLength Fade length from on to off.
+ **/
+static void __stdcall SetLight3DFlicker(std::string asName,
+ float afR, float afG, float afB, float afA,
+ float afRadius,
+
+ float afOnMinLength, float afOnMaxLength,
+ std::string asOnSound, std::string asOnPS,
+
+ float afOffMinLength, float afOffMaxLength,
+ std::string asOffSound, std::string asOffPS,
+
+ bool abFade,
+ float afOnFadeLength, float afOffFadeLength) {
+ iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
+ if (pLight == NULL) {
+ Warning("Couldn't find light '%s'\n", asName.c_str());
+ return;
+ }
- /**
- * Creates a sound entity at the postion of an area.
- * \param asName Name of the sound area
- * \param asFile The snt file to load.
- * \param asArea The area to create at.
- */
- static void __stdcall CreateSoundEntity(std::string asName, std::string asFile,
- std::string asArea)
- {
- cAreaEntity* pArea = gpScene->GetWorld3D()->GetAreaEntity(asArea);
- if(pArea==NULL){
- Warning("Couldn't find area '%s'\n",asArea.c_str());
- return;
- }
+ pLight->SetFlicker(cColor(afR, afG, afB, afA), afRadius,
+ afOnMinLength, afOnMaxLength, asOnSound, asOnPS,
+ afOffMinLength, afOffMaxLength, asOffSound, asOffPS,
+ abFade, afOnFadeLength, afOffFadeLength);
+}
+SCRIPT_DEFINE_FUNC_17(void, SetLight3DFlicker, string,
+ float, float, float, float,
+ float, float, float, string, string, float, float, string, string, bool, float, float)
- cSoundEntity *pSound = gpScene->GetWorld3D()->CreateSoundEntity(asName,asFile,true);
- if(pSound==NULL)
- {
- Warning("Couldn't create sound entity '%s'\n",asFile.c_str());
- return;
- }
+//-----------------------------------------------------------------------
- pSound->SetPosition(pArea->m_mtxTransform.GetTranslation());
- }
- SCRIPT_DEFINE_FUNC_3(void, CreateSoundEntity, string, string, string)
- //-----------------------------------------------------------------------
-
- /**
- * Play a sound entity
- * \param asName The entity name
- * \param abPlayStart If the start sound should be played.
- **/
- static void __stdcall PlaySoundEntity(std::string asName, bool abPlayStart)
- {
- cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
- if(pSound==NULL)
- {
- Warning("Couldn't find sound entity '%s'\n",asName.c_str());
- return;
- }
+/////////////////////////////////////////////////////////////////////////
+/////// SOUND //////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
- pSound->Play(abPlayStart);
- }
- SCRIPT_DEFINE_FUNC_2(void, PlaySoundEntity, string, bool)
-
- /**
- * Stop a sound entity
- * \param asName The entity name
- * \param abPlayEnd If the end sound should be played.
- **/
- static void __stdcall StopSoundEntity(std::string asName, bool abPlayEnd)
- {
- cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
- if(pSound==NULL)
- {
- Warning("Couldn't find sound entity '%s'\n",asName.c_str());
- return;
- }
+//-----------------------------------------------------------------------
- pSound->Stop(abPlayEnd);
+/**
+ * Creates a sound entity at the postion of an area.
+ * \param asName Name of the sound area
+ * \param asFile The snt file to load.
+ * \param asArea The area to create at.
+ */
+static void __stdcall CreateSoundEntity(std::string asName, std::string asFile,
+ std::string asArea) {
+ cAreaEntity *pArea = gpScene->GetWorld3D()->GetAreaEntity(asArea);
+ if (pArea == NULL) {
+ Warning("Couldn't find area '%s'\n", asArea.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_2(void, StopSoundEntity, string, bool)
-
- //-----------------------------------------------------------------------
-
- /**
- * Play a sound entity fading it
- * \param asName The entity name
- * \param afSpeed Volume increase per second.
- **/
- static void __stdcall FadeInSoundEntity(std::string asName, float afSpeed)
- {
- cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
- if(pSound==NULL)
- {
- Warning("Couldn't find sound entity '%s'\n",asName.c_str());
- return;
- }
-
- pSound->FadeIn(afSpeed);
- }
- SCRIPT_DEFINE_FUNC_2(void, FadeInSoundEntity, string, float)
-
- /**
- * Stop a sound entity fading it
- * \param asName The entity name
- * \param afSpeed Volume decrease per second.
- **/
- static void __stdcall FadeOutSoundEntity(std::string asName, float afSpeed)
- {
- cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
- if(pSound==NULL)
- {
- Warning("Couldn't find sound entity '%s'\n",asName.c_str());
- return;
- }
- pSound->FadeOut(afSpeed);
+ cSoundEntity *pSound = gpScene->GetWorld3D()->CreateSoundEntity(asName, asFile, true);
+ if (pSound == NULL) {
+ Warning("Couldn't create sound entity '%s'\n", asFile.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_2(void, FadeOutSoundEntity, string, float)
- //-----------------------------------------------------------------------
-
- static void __stdcall PlayMusic(std::string asName, float afVol, float afStepSize, bool abLoop)
- {
- gpSound->GetMusicHandler()->Play(asName,afVol,afStepSize,abLoop);
+ pSound->SetPosition(pArea->m_mtxTransform.GetTranslation());
+}
+SCRIPT_DEFINE_FUNC_3(void, CreateSoundEntity, string, string, string)
+//-----------------------------------------------------------------------
+
+/**
+ * Play a sound entity
+ * \param asName The entity name
+ * \param abPlayStart If the start sound should be played.
+ **/
+static void __stdcall PlaySoundEntity(std::string asName, bool abPlayStart) {
+ cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
+ if (pSound == NULL) {
+ Warning("Couldn't find sound entity '%s'\n", asName.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_4(void, PlayMusic, string, float, float, bool)
-
- //-----------------------------------------------------------------------
- static void __stdcall StopMusic(float afStepSize)
- {
- gpSound->GetMusicHandler()->Stop(afStepSize);
+ pSound->Play(abPlayStart);
+}
+SCRIPT_DEFINE_FUNC_2(void, PlaySoundEntity, string, bool)
+
+/**
+ * Stop a sound entity
+ * \param asName The entity name
+ * \param abPlayEnd If the end sound should be played.
+ **/
+static void __stdcall StopSoundEntity(std::string asName, bool abPlayEnd) {
+ cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
+ if (pSound == NULL) {
+ Warning("Couldn't find sound entity '%s'\n", asName.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_1(void, StopMusic, float)
- //-----------------------------------------------------------------------
+ pSound->Stop(abPlayEnd);
+}
+SCRIPT_DEFINE_FUNC_2(void, StopSoundEntity, string, bool)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Play a sound entity fading it
+ * \param asName The entity name
+ * \param afSpeed Volume increase per second.
+ **/
+static void __stdcall FadeInSoundEntity(std::string asName, float afSpeed) {
+ cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
+ if (pSound == NULL) {
+ Warning("Couldn't find sound entity '%s'\n", asName.c_str());
+ return;
+ }
- /**
- * Play a sound gui sound, with out any position.
- * \param asName The sound name
- * \param afVol Volume of the sound
- **/
- static void __stdcall PlayGuiSound(std::string asName, float afVol)
- {
- gpSound->GetSoundHandler()->PlayGui(asName,false,afVol);
+ pSound->FadeIn(afSpeed);
+}
+SCRIPT_DEFINE_FUNC_2(void, FadeInSoundEntity, string, float)
+
+/**
+ * Stop a sound entity fading it
+ * \param asName The entity name
+ * \param afSpeed Volume decrease per second.
+ **/
+static void __stdcall FadeOutSoundEntity(std::string asName, float afSpeed) {
+ cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
+ if (pSound == NULL) {
+ Warning("Couldn't find sound entity '%s'\n", asName.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_2(void, PlayGuiSound, string, float)
- /////////////////////////////////////////////////////////////////////////
- /////// PHYSICS //////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
+ pSound->FadeOut(afSpeed);
+}
+SCRIPT_DEFINE_FUNC_2(void, FadeOutSoundEntity, string, float)
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- /**
- * Sets a callback for a joint.
- * The syntax for the function is: void MyFunction(string asJointName)
- * \param asJointName The joint name
- * \param asType The type, can be: "OnMax" or "OnMin".
- * \param asFunc The script function to be called. Must be in the current script file. "" = disabled.
- **/
- static void __stdcall SetJointCallback(std::string asJointName, std::string asType,
- std::string asFunc)
- {
- iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
- if(pJoint==NULL){
- Warning("Couldn't find joint '%s'\n",asJointName.c_str());return;
- }
+static void __stdcall PlayMusic(std::string asName, float afVol, float afStepSize, bool abLoop) {
+ gpSound->GetMusicHandler()->Play(asName, afVol, afStepSize, abLoop);
+}
+SCRIPT_DEFINE_FUNC_4(void, PlayMusic, string, float, float, bool)
- int lType = 0;
- tString sLowName = cString::ToLowerCase(asType);
- if(sLowName == "onmax") lType = 1;
- if(sLowName == "onmin") lType = 2;
+//-----------------------------------------------------------------------
- if(lType ==0){
- Warning("Joint callback type '%s' does not exist\n",asType.c_str()); return;
- }
+static void __stdcall StopMusic(float afStepSize) {
+ gpSound->GetMusicHandler()->Stop(afStepSize);
+}
+SCRIPT_DEFINE_FUNC_1(void, StopMusic, float)
- cScriptJointCallback *pCallback = static_cast<cScriptJointCallback*>(pJoint->GetCallback());
- if(pCallback==NULL)
- {
- pCallback = hplNew( cScriptJointCallback, (gpScene) );
- pJoint->SetCallback(pCallback,true);
- }
+//-----------------------------------------------------------------------
- if(lType==1) pCallback->msMaxFunc = asFunc;
- if(lType==2) pCallback->msMinFunc = asFunc;
+/**
+ * Play a sound gui sound, with out any position.
+ * \param asName The sound name
+ * \param afVol Volume of the sound
+ **/
+static void __stdcall PlayGuiSound(std::string asName, float afVol) {
+ gpSound->GetSoundHandler()->PlayGui(asName, false, afVol);
+}
+SCRIPT_DEFINE_FUNC_2(void, PlayGuiSound, string, float)
+
+/////////////////////////////////////////////////////////////////////////
+/////// PHYSICS //////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+/**
+ * Sets a callback for a joint.
+ * The syntax for the function is: void MyFunction(string asJointName)
+ * \param asJointName The joint name
+ * \param asType The type, can be: "OnMax" or "OnMin".
+ * \param asFunc The script function to be called. Must be in the current script file. "" = disabled.
+ **/
+static void __stdcall SetJointCallback(std::string asJointName, std::string asType,
+ std::string asFunc) {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if (pJoint == NULL) {
+ Warning("Couldn't find joint '%s'\n", asJointName.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_3(void, SetJointCallback, string, string, string)
-
- //-----------------------------------------------------------------------
- /**
- * Breaks a joint.
- * \param asJointName The joint name
- **/
- static void __stdcall BreakJoint(std::string asJointName)
- {
- iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
- if(pJoint==NULL){
- Warning("Couldn't find joint '%s'\n",asJointName.c_str());return;
- }
+ int lType = 0;
+ tString sLowName = cString::ToLowerCase(asType);
+ if (sLowName == "onmax")
+ lType = 1;
+ if (sLowName == "onmin")
+ lType = 2;
- pJoint->Break();
+ if (lType == 0) {
+ Warning("Joint callback type '%s' does not exist\n", asType.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_1(void, BreakJoint, string)
- //-----------------------------------------------------------------------
+ cScriptJointCallback *pCallback = static_cast<cScriptJointCallback *>(pJoint->GetCallback());
+ if (pCallback == NULL) {
+ pCallback = hplNew(cScriptJointCallback, (gpScene));
+ pJoint->SetCallback(pCallback, true);
+ }
- /**
- * Sets if a joint controller is active or not.
- * \param asJointName The joint name
- * \param asCtrlName The controller name
- * \param abActive If the controller is to be active or not.
- **/
- static void __stdcall SetJointControllerActive(std::string asJointName,std::string asCtrlName, bool abActive)
- {
- iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
- if(pJoint==NULL){
- Warning("Couldn't find joint '%s'\n",asJointName.c_str());return;
- }
+ if (lType == 1)
+ pCallback->msMaxFunc = asFunc;
+ if (lType == 2)
+ pCallback->msMinFunc = asFunc;
+}
+SCRIPT_DEFINE_FUNC_3(void, SetJointCallback, string, string, string)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Breaks a joint.
+ * \param asJointName The joint name
+ **/
+static void __stdcall BreakJoint(std::string asJointName) {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if (pJoint == NULL) {
+ Warning("Couldn't find joint '%s'\n", asJointName.c_str());
+ return;
+ }
- iPhysicsController *pCtrl = pJoint->GetController(asCtrlName);
- if(pCtrl==NULL){
- Warning("Couldn't find controller %s in joint '%s'\n",asCtrlName.c_str(),asJointName.c_str());return;
- }
+ pJoint->Break();
+}
+SCRIPT_DEFINE_FUNC_1(void, BreakJoint, string)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Sets if a joint controller is active or not.
+ * \param asJointName The joint name
+ * \param asCtrlName The controller name
+ * \param abActive If the controller is to be active or not.
+ **/
+static void __stdcall SetJointControllerActive(std::string asJointName, std::string asCtrlName, bool abActive) {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if (pJoint == NULL) {
+ Warning("Couldn't find joint '%s'\n", asJointName.c_str());
+ return;
+ }
- pCtrl->SetActive(abActive);
+ iPhysicsController *pCtrl = pJoint->GetController(asCtrlName);
+ if (pCtrl == NULL) {
+ Warning("Couldn't find controller %s in joint '%s'\n", asCtrlName.c_str(), asJointName.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_3(void, SetJointControllerActive, string, string, bool)
- //-----------------------------------------------------------------------
+ pCtrl->SetActive(abActive);
+}
+SCRIPT_DEFINE_FUNC_3(void, SetJointControllerActive, string, string, bool)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Change the active controller. All other controllers are set to false.
+ * \param asJointName The joint name
+ * \param asCtrlName The controller name
+ **/
+static void __stdcall ChangeJointController(std::string asJointName, std::string asCtrlName) {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if (pJoint == NULL) {
+ Warning("Couldn't find joint '%s'\n", asJointName.c_str());
+ return;
+ }
- /**
- * Change the active controller. All other controllers are set to false.
- * \param asJointName The joint name
- * \param asCtrlName The controller name
- **/
- static void __stdcall ChangeJointController(std::string asJointName,std::string asCtrlName)
- {
- iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
- if(pJoint==NULL){
- Warning("Couldn't find joint '%s'\n",asJointName.c_str());return;
- }
+ if (pJoint->ChangeController(asCtrlName) == false) {
+ Warning("Couldn't find controller %s in joint '%s'\n", asCtrlName.c_str(), asJointName.c_str());
+ return;
+ }
+}
+SCRIPT_DEFINE_FUNC_2(void, ChangeJointController, string, string)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Sets if a joint controller is active or not.
+ * \param asJointName The joint name
+ * \param asCtrlName The controller name
+ * \param asProperty Property to change, can be "DestValue"
+ * \param afValue Value to set it to.
+ **/
+static void __stdcall SetJointControllerPropertyFloat(std::string asJointName, std::string asCtrlName,
+ std::string asProperty, float afValue) {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if (pJoint == NULL) {
+ Warning("Couldn't find joint '%s'\n", asJointName.c_str());
+ return;
+ }
- if(pJoint->ChangeController(asCtrlName)==false)
- {
- Warning("Couldn't find controller %s in joint '%s'\n",asCtrlName.c_str(),asJointName.c_str());
- return;
- }
+ iPhysicsController *pCtrl = pJoint->GetController(asCtrlName);
+ if (pCtrl == NULL) {
+ Warning("Couldn't find controller %s in joint '%s'\n", asCtrlName.c_str(), asJointName.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_2(void, ChangeJointController, string, string)
-
- //-----------------------------------------------------------------------
-
- /**
- * Sets if a joint controller is active or not.
- * \param asJointName The joint name
- * \param asCtrlName The controller name
- * \param asProperty Property to change, can be "DestValue"
- * \param afValue Value to set it to.
- **/
- static void __stdcall SetJointControllerPropertyFloat(std::string asJointName,std::string asCtrlName,
- std::string asProperty, float afValue)
- {
- iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
- if(pJoint==NULL){
- Warning("Couldn't find joint '%s'\n",asJointName.c_str());return;
- }
- iPhysicsController *pCtrl = pJoint->GetController(asCtrlName);
- if(pCtrl==NULL){
- Warning("Couldn't find controller %s in joint '%s'\n",asCtrlName.c_str(),asJointName.c_str());return;
- }
+ if (asProperty == "DestValue") {
+ pCtrl->SetDestValue(afValue);
+ }
+}
+SCRIPT_DEFINE_FUNC_4(void, SetJointControllerPropertyFloat, string, string, string, float)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Gets a property from the joint.
+ * Valid properties are:
+ * "Angle" The angle between the bodies (in degrees) (Not working for ball joint)
+ * "Distance" The distance between the bodies (in meter)
+ * "LinearSpeed" The relative linear speed between the bodies (in m/s)
+ * "AngularSpeed" The relative angular speed between the bodies (in m/s)
+ * "Force" The size of the force (in newton, kg*m/s^2).
+ * "MaxLimit" The max limit (meters or degrees)
+ * "MinLimit" The in limit (meters or degrees)
+ * \param asJointName The joint name
+ * \param asProp The property to get
+ **/
+static float __stdcall GetJointProperty(std::string asJointName, std::string asProp) {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if (pJoint == NULL) {
+ Warning("Couldn't find joint '%s'\n", asJointName.c_str());
+ return 0;
+ }
- if(asProperty == "DestValue")
- {
- pCtrl->SetDestValue(afValue);
- }
+ tString sLowProp = cString::ToLowerCase(asProp);
+
+ if (sLowProp == "angle") {
+ return cMath::ToDeg(pJoint->GetAngle());
+ } else if (sLowProp == "distance") {
+ return pJoint->GetDistance();
+ } else if (sLowProp == "linearspeed") {
+ return pJoint->GetVelocity().Length();
+ } else if (sLowProp == "angularspeed") {
+ return pJoint->GetAngularVelocity().Length();
+ } else if (sLowProp == "force") {
+ return pJoint->GetForce().Length();
}
- SCRIPT_DEFINE_FUNC_4(void, SetJointControllerPropertyFloat, string, string, string, float)
-
- //-----------------------------------------------------------------------
-
-
- /**
- * Gets a property from the joint.
- * Valid properties are:
- * "Angle" The angle between the bodies (in degrees) (Not working for ball joint)
- * "Distance" The distance between the bodies (in meter)
- * "LinearSpeed" The relative linear speed between the bodies (in m/s)
- * "AngularSpeed" The relative angular speed between the bodies (in m/s)
- * "Force" The size of the force (in newton, kg*m/s^2).
- * "MaxLimit" The max limit (meters or degrees)
- * "MinLimit" The in limit (meters or degrees)
- * \param asJointName The joint name
- * \param asProp The property to get
- **/
- static float __stdcall GetJointProperty(std::string asJointName, std::string asProp)
- {
- iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
- if(pJoint==NULL){
- Warning("Couldn't find joint '%s'\n",asJointName.c_str());return 0;
+ /////////////////////////////
+ // Min Limit
+ else if (sLowProp == "minlimit") {
+ switch (pJoint->GetType()) {
+ case ePhysicsJointType_Hinge: {
+ iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge *>(pJoint);
+ return cMath::ToDeg(pHingeJoint->GetMinAngle());
}
-
- tString sLowProp = cString::ToLowerCase(asProp);
-
- if(sLowProp == "angle")
- {
- return cMath::ToDeg(pJoint->GetAngle());
+ case ePhysicsJointType_Screw: {
+ iPhysicsJointScrew *pScrewJoint = static_cast<iPhysicsJointScrew *>(pJoint);
+ return pScrewJoint->GetMinDistance();
}
- else if(sLowProp == "distance")
- {
- return pJoint->GetDistance();
+ case ePhysicsJointType_Slider: {
+ iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider *>(pJoint);
+ return pSliderJoint->GetMinDistance();
}
- else if(sLowProp == "linearspeed")
- {
- return pJoint->GetVelocity().Length();
}
- else if(sLowProp == "angularspeed")
- {
- return pJoint->GetAngularVelocity().Length();
+ }
+ /////////////////////////////
+ // Max Limit
+ else if (sLowProp == "maxlimit") {
+ switch (pJoint->GetType()) {
+ case ePhysicsJointType_Hinge: {
+ iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge *>(pJoint);
+ return cMath::ToDeg(pHingeJoint->GetMaxAngle());
}
- else if(sLowProp == "force")
- {
- return pJoint->GetForce().Length();
+ case ePhysicsJointType_Screw: {
+ iPhysicsJointScrew *pScrewJoint = static_cast<iPhysicsJointScrew *>(pJoint);
+ return pScrewJoint->GetMaxDistance();
}
- /////////////////////////////
- // Min Limit
- else if(sLowProp == "minlimit")
- {
- switch(pJoint->GetType())
- {
- case ePhysicsJointType_Hinge:
- {
- iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge*>(pJoint);
- return cMath::ToDeg(pHingeJoint->GetMinAngle());
- }
- case ePhysicsJointType_Screw:
- {
- iPhysicsJointScrew *pScrewJoint = static_cast<iPhysicsJointScrew*>(pJoint);
- return pScrewJoint->GetMinDistance();
- }
- case ePhysicsJointType_Slider:
- {
- iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider*>(pJoint);
- return pSliderJoint->GetMinDistance();
- }
- }
+ case ePhysicsJointType_Slider: {
+ iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider *>(pJoint);
+ return pSliderJoint->GetMaxDistance();
}
- /////////////////////////////
- // Max Limit
- else if(sLowProp == "maxlimit")
- {
- switch(pJoint->GetType())
- {
- case ePhysicsJointType_Hinge:
- {
- iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge*>(pJoint);
- return cMath::ToDeg(pHingeJoint->GetMaxAngle());
- }
- case ePhysicsJointType_Screw:
- {
- iPhysicsJointScrew *pScrewJoint = static_cast<iPhysicsJointScrew*>(pJoint);
- return pScrewJoint->GetMaxDistance();
- }
- case ePhysicsJointType_Slider:
- {
- iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider*>(pJoint);
- return pSliderJoint->GetMaxDistance();
- }
- }
-
}
+ }
- Warning("Joint property '%s' does not exist!\n",asProp.c_str());
+ Warning("Joint property '%s' does not exist!\n", asProp.c_str());
+ return 0;
+}
+SCRIPT_DEFINE_FUNC_2(float, GetJointProperty, string, string)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Gets a property from the body.
+ * Valid properties are:
+ * "Mass" The mass of the body (in kg)
+ * "LinearSpeed" The linear speed the body has (in m/s)
+ * "AngularSpeed" The angular speed the body has (in m/s)
+ * \param asBodyName The body name
+ * \param asProp The property to get
+ **/
+static float __stdcall GetBodyProperty(std::string asBodyName, std::string asProp) {
+ iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
+ if (pBody == NULL) {
+ Warning("Couldn't find Body '%s'\n", asBodyName.c_str());
return 0;
}
- SCRIPT_DEFINE_FUNC_2(float, GetJointProperty, string, string)
-
- //-----------------------------------------------------------------------
-
- /**
- * Gets a property from the body.
- * Valid properties are:
- * "Mass" The mass of the body (in kg)
- * "LinearSpeed" The linear speed the body has (in m/s)
- * "AngularSpeed" The angular speed the body has (in m/s)
- * \param asBodyName The body name
- * \param asProp The property to get
- **/
- static float __stdcall GetBodyProperty(std::string asBodyName, std::string asProp)
- {
- iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
- if(pBody==NULL){
- Warning("Couldn't find Body '%s'\n",asBodyName.c_str());return 0;
- }
- tString sLowProp = cString::ToLowerCase(asProp);
+ tString sLowProp = cString::ToLowerCase(asProp);
- if(sLowProp == "mass")
- {
- return pBody->GetMass();
- }
- else if(sLowProp == "linearspeed")
- {
- return pBody->GetLinearVelocity().Length();
- }
- else if(sLowProp == "angularspeed")
- {
- return pBody->GetAngularVelocity().Length();
- }
-
- Warning("Body property '%s' does not exist!\n",asProp.c_str());
- return 0;
+ if (sLowProp == "mass") {
+ return pBody->GetMass();
+ } else if (sLowProp == "linearspeed") {
+ return pBody->GetLinearVelocity().Length();
+ } else if (sLowProp == "angularspeed") {
+ return pBody->GetAngularVelocity().Length();
}
- SCRIPT_DEFINE_FUNC_2(float, GetBodyProperty, string, string)
-
- //-----------------------------------------------------------------------
-
- /**
- * Sets a property to the body.
- * Valid properties are:
- * "Mass" The mass of the body (in kg)
- * "CollideCharacter" 0 = false 1=true
- * \param asBodyName The body name
- * \param asProp The property to get
- * \param afVal The new value of the property
- **/
- static void __stdcall SetBodyProperty(std::string asBodyName, std::string asProp, float afVal)
- {
- iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
- if(pBody==NULL){
- Warning("Couldn't find Body '%s'\n",asBodyName.c_str());return;
- }
- tString sLowProp = cString::ToLowerCase(asProp);
+ Warning("Body property '%s' does not exist!\n", asProp.c_str());
+ return 0;
+}
+SCRIPT_DEFINE_FUNC_2(float, GetBodyProperty, string, string)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Sets a property to the body.
+ * Valid properties are:
+ * "Mass" The mass of the body (in kg)
+ * "CollideCharacter" 0 = false 1=true
+ * \param asBodyName The body name
+ * \param asProp The property to get
+ * \param afVal The new value of the property
+ **/
+static void __stdcall SetBodyProperty(std::string asBodyName, std::string asProp, float afVal) {
+ iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
+ if (pBody == NULL) {
+ Warning("Couldn't find Body '%s'\n", asBodyName.c_str());
+ return;
+ }
- if(sLowProp == "mass")
- {
- pBody->SetMass(afVal);
- pBody->SetEnabled(true);
+ tString sLowProp = cString::ToLowerCase(asProp);
- if(afVal == 0)
- {
- pBody->SetLinearVelocity(0);
- pBody->SetAngularVelocity(0);
- }
+ if (sLowProp == "mass") {
+ pBody->SetMass(afVal);
+ pBody->SetEnabled(true);
- return;
- }
- else if(sLowProp == "collidecharacter")
- {
- pBody->SetCollideCharacter(afVal <0.05 ? false : true);
- return;
- }
- else if(sLowProp == "hasgravity")
- {
- pBody->SetCollideCharacter(afVal <0.05 ? false : true);
- return;
+ if (afVal == 0) {
+ pBody->SetLinearVelocity(0);
+ pBody->SetAngularVelocity(0);
}
-
- Warning("Body property '%s' does not exist!\n",asProp.c_str());
+ return;
+ } else if (sLowProp == "collidecharacter") {
+ pBody->SetCollideCharacter(afVal < 0.05 ? false : true);
+ return;
+ } else if (sLowProp == "hasgravity") {
+ pBody->SetCollideCharacter(afVal < 0.05 ? false : true);
+ return;
}
- SCRIPT_DEFINE_FUNC_3(void, SetBodyProperty, string, string, float)
-
- //-----------------------------------------------------------------------
- static void __stdcall AttachBodiesWithJoint(std::string asParentName, std::string asChildName, std::string asJointName)
- {
- iPhysicsBody *pParent = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asParentName);
- if(pParent==NULL){
- Warning("Couldn't find Body '%s'\n",asParentName.c_str());return;
- }
-
- iPhysicsBody *pChild = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asChildName);
- if(pChild==NULL){
- Warning("Couldn't find Body '%s'\n",asChildName.c_str());return;
- }
-
- iPhysicsWorld *pPhysicsWorld = gpScene->GetWorld3D()->GetPhysicsWorld();
+ Warning("Body property '%s' does not exist!\n", asProp.c_str());
+}
+SCRIPT_DEFINE_FUNC_3(void, SetBodyProperty, string, string, float)
- cVector3f vPivot = (pParent->GetLocalPosition() + pChild->GetLocalPosition()) * 0.5f;
- cVector3f vDir = cMath::Vector3Normalize(pChild->GetLocalPosition() - pParent->GetLocalPosition());
+//-----------------------------------------------------------------------
- iPhysicsJointSlider *pJoint = pPhysicsWorld->CreateJointSlider(asJointName,vPivot,vDir,pParent,pChild);
+static void __stdcall AttachBodiesWithJoint(std::string asParentName, std::string asChildName, std::string asJointName) {
+ iPhysicsBody *pParent = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asParentName);
+ if (pParent == NULL) {
+ Warning("Couldn't find Body '%s'\n", asParentName.c_str());
+ return;
+ }
- pJoint->SetMinDistance(-0.01f);
- pJoint->SetMaxDistance(0.01f);
+ iPhysicsBody *pChild = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asChildName);
+ if (pChild == NULL) {
+ Warning("Couldn't find Body '%s'\n", asChildName.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_3(void, AttachBodiesWithJoint, string, string, string)
- //-----------------------------------------------------------------------
+ iPhysicsWorld *pPhysicsWorld = gpScene->GetWorld3D()->GetPhysicsWorld();
- /**
- * Sets a property to the joint.
- * Valid properties are:
- * "MinLimit" The min limit (depends on joint, does not work on ball)
- * "MaxLimit" The max limit (depends on joint, does not work on ball)
- * \param asJointName The body name
- * \param asProp The property to get
- * \param afVal The new value of the property
- **/
- static void __stdcall SetJointProperty(std::string asJointName, std::string asProp, float afVal)
- {
- iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
- if(pJoint==NULL){
- Warning("Couldn't find joint '%s'\n",asJointName.c_str());return;
- }
+ cVector3f vPivot = (pParent->GetLocalPosition() + pChild->GetLocalPosition()) * 0.5f;
+ cVector3f vDir = cMath::Vector3Normalize(pChild->GetLocalPosition() - pParent->GetLocalPosition());
- tString sLowProp = cString::ToLowerCase(asProp);
-
- if(pJoint->GetChildBody()) pJoint->GetChildBody()->SetEnabled(true);
- if(pJoint->GetParentBody()) pJoint->GetParentBody()->SetEnabled(true);
-
- /////////////////////////////
- // Min Limit
- if(sLowProp == "minlimit")
- {
- switch(pJoint->GetType())
- {
- case ePhysicsJointType_Hinge:
- {
- iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge*>(pJoint);
- pHingeJoint->SetMinAngle(cMath::ToRad(afVal));
- break;
- }
- case ePhysicsJointType_Screw:
- {
- iPhysicsJointScrew *pScrewJoint = static_cast<iPhysicsJointScrew*>(pJoint);
- pScrewJoint->SetMinDistance(afVal);
- break;
- }
- case ePhysicsJointType_Slider:
- {
- iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider*>(pJoint);
- pSliderJoint->SetMinDistance(afVal);
- break;
- }
- }
- }
- /////////////////////////////
- // Max Limit
- else if(sLowProp == "maxlimit")
- {
- switch(pJoint->GetType())
- {
- case ePhysicsJointType_Hinge:
- {
- iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge*>(pJoint);
- pHingeJoint->SetMaxAngle(cMath::ToRad(afVal));
- break;
- }
- case ePhysicsJointType_Screw:
- {
- iPhysicsJointScrew *pScrewJoint = static_cast<iPhysicsJointScrew*>(pJoint);
- pScrewJoint->SetMaxDistance(afVal);
- break;
- }
- case ePhysicsJointType_Slider:
- {
- iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider*>(pJoint);
- pSliderJoint->SetMaxDistance(afVal);
- break;
- }
- }
+ iPhysicsJointSlider *pJoint = pPhysicsWorld->CreateJointSlider(asJointName, vPivot, vDir, pParent, pChild);
- }
- else
- {
- Warning("Joint property '%s' does not exist!\n",asProp.c_str());
- }
+ pJoint->SetMinDistance(-0.01f);
+ pJoint->SetMaxDistance(0.01f);
+}
+SCRIPT_DEFINE_FUNC_3(void, AttachBodiesWithJoint, string, string, string)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Sets a property to the joint.
+ * Valid properties are:
+ * "MinLimit" The min limit (depends on joint, does not work on ball)
+ * "MaxLimit" The max limit (depends on joint, does not work on ball)
+ * \param asJointName The body name
+ * \param asProp The property to get
+ * \param afVal The new value of the property
+ **/
+static void __stdcall SetJointProperty(std::string asJointName, std::string asProp, float afVal) {
+ iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
+ if (pJoint == NULL) {
+ Warning("Couldn't find joint '%s'\n", asJointName.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_3(void, SetJointProperty, string, string, float)
-
-
- //-----------------------------------------------------------------------
-
- /**
- * Adds a force to the body. This can either be in the bodies local coord system or the world's.
- * \param asBodyName The body name
- * \param asCoordType The coordinate system type. "World" or "Local".
- * \param afX force in the x direction. (in newton, kg*m/s^2)
- * \param afY force in the y direction. (in newton, kg*m/s^2)
- * \param afZ force in the z direction. (in newton, kg*m/s^2)
- **/
- static void __stdcall AddBodyForce(std::string asBodyName, std::string asCoordType,
- float afX, float afY, float afZ)
- {
- iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
- if(pBody==NULL){
- Warning("Couldn't find Body '%s'\n",asBodyName.c_str());return;
- }
- int lType =0;
- tString sLowType = cString::ToLowerCase(asCoordType);
+ tString sLowProp = cString::ToLowerCase(asProp);
- if(sLowType == "world") lType = 1;
- else if(sLowType == "local") lType =2;
+ if (pJoint->GetChildBody())
+ pJoint->GetChildBody()->SetEnabled(true);
+ if (pJoint->GetParentBody())
+ pJoint->GetParentBody()->SetEnabled(true);
- if(lType==0){
- Warning("Coord system type '%s' is not valid.\n",asCoordType.c_str());
- return;
+ /////////////////////////////
+ // Min Limit
+ if (sLowProp == "minlimit") {
+ switch (pJoint->GetType()) {
+ case ePhysicsJointType_Hinge: {
+ iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge *>(pJoint);
+ pHingeJoint->SetMinAngle(cMath::ToRad(afVal));
+ break;
}
-
- if(lType==1)
- {
- pBody->AddForce(cVector3f(afX,afY,afZ));
+ case ePhysicsJointType_Screw: {
+ iPhysicsJointScrew *pScrewJoint = static_cast<iPhysicsJointScrew *>(pJoint);
+ pScrewJoint->SetMinDistance(afVal);
+ break;
+ }
+ case ePhysicsJointType_Slider: {
+ iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider *>(pJoint);
+ pSliderJoint->SetMinDistance(afVal);
+ break;
}
- else if(lType==2)
- {
- cVector3f vWorldForce = cMath::MatrixMul(pBody->GetLocalMatrix().GetRotation(),
- cVector3f(afX,afY,afZ));
- pBody->AddForce(vWorldForce);
}
}
- SCRIPT_DEFINE_FUNC_5(void, AddBodyForce, string, string, float, float, float)
-
- //-----------------------------------------------------------------------
-
- /**
- * Adds an impule (a change in velocity) to the body. This can either be in the bodies local coord system or the world's.
- * \param asBodyName The body name
- * \param asCoordType The coordinate system type. "World" or "Local".
- * \param afX velocity in the x direction. (in m/s)
- * \param afY velocity in the y direction. (in m/s)
- * \param afZ velocity in the z direction. (in m/s)
- **/
- static void __stdcall AddBodyImpulse(std::string asBodyName, std::string asCoordType,
- float afX, float afY, float afZ)
- {
- iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
- if(pBody==NULL){
- Warning("Couldn't find Body '%s'\n",asBodyName.c_str());return;
+ /////////////////////////////
+ // Max Limit
+ else if (sLowProp == "maxlimit") {
+ switch (pJoint->GetType()) {
+ case ePhysicsJointType_Hinge: {
+ iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge *>(pJoint);
+ pHingeJoint->SetMaxAngle(cMath::ToRad(afVal));
+ break;
}
-
- int lType =0;
- tString sLowType = cString::ToLowerCase(asCoordType);
-
- if(sLowType == "world") lType = 1;
- else if(sLowType == "local") lType =2;
-
- if(lType==0){
- Warning("Coord system type '%s' is not valid.\n",asCoordType.c_str());
- return;
+ case ePhysicsJointType_Screw: {
+ iPhysicsJointScrew *pScrewJoint = static_cast<iPhysicsJointScrew *>(pJoint);
+ pScrewJoint->SetMaxDistance(afVal);
+ break;
}
-
- if(lType==1)
- {
- pBody->AddImpulse(cVector3f(afX,afY,afZ));
+ case ePhysicsJointType_Slider: {
+ iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider *>(pJoint);
+ pSliderJoint->SetMaxDistance(afVal);
+ break;
}
- else if(lType==2)
- {
- cVector3f vWorldForce = cMath::MatrixMul(pBody->GetLocalMatrix().GetRotation(),
- cVector3f(afX,afY,afZ));
- pBody->AddImpulse(vWorldForce);
}
- }
- SCRIPT_DEFINE_FUNC_5(void, AddBodyImpulse, string, string, float, float, float)
- //-----------------------------------------------------------------------
+ } else {
+ Warning("Joint property '%s' does not exist!\n", asProp.c_str());
+ }
+}
+SCRIPT_DEFINE_FUNC_3(void, SetJointProperty, string, string, float)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Adds a force to the body. This can either be in the bodies local coord system or the world's.
+ * \param asBodyName The body name
+ * \param asCoordType The coordinate system type. "World" or "Local".
+ * \param afX force in the x direction. (in newton, kg*m/s^2)
+ * \param afY force in the y direction. (in newton, kg*m/s^2)
+ * \param afZ force in the z direction. (in newton, kg*m/s^2)
+ **/
+static void __stdcall AddBodyForce(std::string asBodyName, std::string asCoordType,
+ float afX, float afY, float afZ) {
+ iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
+ if (pBody == NULL) {
+ Warning("Couldn't find Body '%s'\n", asBodyName.c_str());
+ return;
+ }
+ int lType = 0;
+ tString sLowType = cString::ToLowerCase(asCoordType);
- /////////////////////////////////////////////////////////////////////////
- /////// LOCAL VARS //////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
+ if (sLowType == "world")
+ lType = 1;
+ else if (sLowType == "local")
+ lType = 2;
- static void __stdcall CreateLocalVar(std::string asName, int alVal)
- {
- if(gpScene->GetLocalVar(asName)==NULL)
- {
- cScriptVar* pVar = gpScene->CreateLocalVar(asName);
- pVar->mlVal = alVal;
- }
+ if (lType == 0) {
+ Warning("Coord system type '%s' is not valid.\n", asCoordType.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_2(void, CreateLocalVar, string, int)
- static void __stdcall SetLocalVar(std::string asName, int alVal)
- {
- cScriptVar* pVar = gpScene->CreateLocalVar(asName);
- pVar->mlVal = alVal;
+ if (lType == 1) {
+ pBody->AddForce(cVector3f(afX, afY, afZ));
+ } else if (lType == 2) {
+ cVector3f vWorldForce = cMath::MatrixMul(pBody->GetLocalMatrix().GetRotation(),
+ cVector3f(afX, afY, afZ));
+ pBody->AddForce(vWorldForce);
}
- SCRIPT_DEFINE_FUNC_2(void, SetLocalVar, string, int)
-
- static void __stdcall AddLocalVar(std::string asName, int alVal)
- {
- cScriptVar* pVar = gpScene->CreateLocalVar(asName);
- pVar->mlVal += alVal;
+}
+SCRIPT_DEFINE_FUNC_5(void, AddBodyForce, string, string, float, float, float)
+
+//-----------------------------------------------------------------------
+
+/**
+ * Adds an impule (a change in velocity) to the body. This can either be in the bodies local coord system or the world's.
+ * \param asBodyName The body name
+ * \param asCoordType The coordinate system type. "World" or "Local".
+ * \param afX velocity in the x direction. (in m/s)
+ * \param afY velocity in the y direction. (in m/s)
+ * \param afZ velocity in the z direction. (in m/s)
+ **/
+static void __stdcall AddBodyImpulse(std::string asBodyName, std::string asCoordType,
+ float afX, float afY, float afZ) {
+ iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
+ if (pBody == NULL) {
+ Warning("Couldn't find Body '%s'\n", asBodyName.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_2(void, AddLocalVar, string, int)
- static int __stdcall GetLocalVar(std::string asName)
- {
- cScriptVar* pVar = gpScene->GetLocalVar(asName);
- if(pVar==NULL)
- {
- Error("Couldn't find local var '%s'\n",asName.c_str());
- return 0;
- }
- return pVar->mlVal;
- }
- SCRIPT_DEFINE_FUNC_1(int, GetLocalVar, string)
+ int lType = 0;
+ tString sLowType = cString::ToLowerCase(asCoordType);
- //-----------------------------------------------------------------------
- /////////////////////////////////////////////////////////////////////////
- /////// GLOBAL VARS //////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
+ if (sLowType == "world")
+ lType = 1;
+ else if (sLowType == "local")
+ lType = 2;
- static void __stdcall CreateGlobalVar(std::string asName, int alVal)
- {
- if(gpScene->GetGlobalVar(asName)==NULL)
- {
- cScriptVar* pVar = gpScene->CreateGlobalVar(asName);
- pVar->mlVal = alVal;
- }
+ if (lType == 0) {
+ Warning("Coord system type '%s' is not valid.\n", asCoordType.c_str());
+ return;
}
- SCRIPT_DEFINE_FUNC_2(void, CreateGlobalVar, string, int)
- static void __stdcall SetGlobalVar(std::string asName, int alVal)
- {
- cScriptVar* pVar = gpScene->CreateGlobalVar(asName);
- pVar->mlVal = alVal;
+ if (lType == 1) {
+ pBody->AddImpulse(cVector3f(afX, afY, afZ));
+ } else if (lType == 2) {
+ cVector3f vWorldForce = cMath::MatrixMul(pBody->GetLocalMatrix().GetRotation(),
+ cVector3f(afX, afY, afZ));
+ pBody->AddImpulse(vWorldForce);
}
- SCRIPT_DEFINE_FUNC_2(void, SetGlobalVar, string, int)
-
+}
+SCRIPT_DEFINE_FUNC_5(void, AddBodyImpulse, string, string, float, float, float)
- static void __stdcall AddGlobalVar(std::string asName, int alVal)
- {
- cScriptVar* pVar = gpScene->CreateGlobalVar(asName);
- pVar->mlVal += alVal;
- }
- SCRIPT_DEFINE_FUNC_2(void, AddGlobalVar, string, int)
+//-----------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////
+/////// LOCAL VARS //////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
- static int __stdcall GetGlobalVar(std::string asName)
- {
- cScriptVar* pVar = gpScene->GetGlobalVar(asName);
- if(pVar==NULL)
- {
- Error("Couldn't find global var '%s'\n",asName.c_str());
- return 0;
- }
- return pVar->mlVal;
+static void __stdcall CreateLocalVar(std::string asName, int alVal) {
+ if (gpScene->GetLocalVar(asName) == NULL) {
+ cScriptVar *pVar = gpScene->CreateLocalVar(asName);
+ pVar->mlVal = alVal;
}
- SCRIPT_DEFINE_FUNC_1(int, GetGlobalVar, string)
-
- //-----------------------------------------------------------------------
-
-
-
- void cScriptFuncs::Init( cGraphics* apGraphics,
- cResources *apResources,
- cSystem *apSystem,
- cInput *apInput,
- cScene *apScene,
- cSound *apSound,
- cGame *apGame
- )
- {
- gpGraphics = apGraphics;
- gpResources = apResources;
- gpSystem = apSystem;
- gpInput = apInput;
- gpScene = apScene;
- gpSound = apSound;
- gpGame = apGame;
-
- //General
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(Print));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FloatToString));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(IntToString));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(RandFloat));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(RandInt));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(StringContains));
-
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(ResetLogicTimer));
-
- //Renderer
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetAmbientColor));
-
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSkybox));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSkyboxActive));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSkyboxColor));
-
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateParticleSystemOnCamera));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFogActive));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFogCulling));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFogProperties));
-
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSectorProperties));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSectorPortalActive));
-
-
- //Resources
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PreloadSound));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(Translate));
-
- //Mesh Entity
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetMeshActive));
-
- //Beams
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateBeam));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(DestroyBeam));
-
- //Particle systems
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetParticleSystemActive));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateParticleSystem));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(KillParticleSystem));
-
- //Light
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeLight3D));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AttachBillboardToLight3D));
-
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DVisible));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DFlickerActive));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DFlicker));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DOnlyAffectInSector));
-
- //Sound
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlayMusic));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(StopMusic));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlaySoundEntity));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(StopSoundEntity));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeInSoundEntity));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeOutSoundEntity));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlayGuiSound));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateSoundEntity));
+}
+SCRIPT_DEFINE_FUNC_2(void, CreateLocalVar, string, int)
+static void __stdcall SetLocalVar(std::string asName, int alVal) {
+ cScriptVar *pVar = gpScene->CreateLocalVar(asName);
+ pVar->mlVal = alVal;
+}
+SCRIPT_DEFINE_FUNC_2(void, SetLocalVar, string, int)
- //Physics
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointCallback));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(BreakJoint));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetJointProperty));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetBodyProperty));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetBodyProperty));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointProperty));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AttachBodiesWithJoint));
+static void __stdcall AddLocalVar(std::string asName, int alVal) {
+ cScriptVar *pVar = gpScene->CreateLocalVar(asName);
+ pVar->mlVal += alVal;
+}
+SCRIPT_DEFINE_FUNC_2(void, AddLocalVar, string, int)
+static int __stdcall GetLocalVar(std::string asName) {
+ cScriptVar *pVar = gpScene->GetLocalVar(asName);
+ if (pVar == NULL) {
+ Error("Couldn't find local var '%s'\n", asName.c_str());
+ return 0;
+ }
+ return pVar->mlVal;
+}
+SCRIPT_DEFINE_FUNC_1(int, GetLocalVar, string)
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointControllerActive));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(ChangeJointController));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointControllerPropertyFloat));
+//-----------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////
+/////// GLOBAL VARS //////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+static void __stdcall CreateGlobalVar(std::string asName, int alVal) {
+ if (gpScene->GetGlobalVar(asName) == NULL) {
+ cScriptVar *pVar = gpScene->CreateGlobalVar(asName);
+ pVar->mlVal = alVal;
+ }
+}
+SCRIPT_DEFINE_FUNC_2(void, CreateGlobalVar, string, int)
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddBodyForce));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddBodyImpulse));
+static void __stdcall SetGlobalVar(std::string asName, int alVal) {
+ cScriptVar *pVar = gpScene->CreateGlobalVar(asName);
+ pVar->mlVal = alVal;
+}
+SCRIPT_DEFINE_FUNC_2(void, SetGlobalVar, string, int)
- //Local vars
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateLocalVar));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLocalVar));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddLocalVar));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetLocalVar));
+static void __stdcall AddGlobalVar(std::string asName, int alVal) {
+ cScriptVar *pVar = gpScene->CreateGlobalVar(asName);
+ pVar->mlVal += alVal;
+}
+SCRIPT_DEFINE_FUNC_2(void, AddGlobalVar, string, int)
- //Global vars
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateGlobalVar));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetGlobalVar));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddGlobalVar));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetGlobalVar));
+static int __stdcall GetGlobalVar(std::string asName) {
+ cScriptVar *pVar = gpScene->GetGlobalVar(asName);
+ if (pVar == NULL) {
+ Error("Couldn't find global var '%s'\n", asName.c_str());
+ return 0;
}
+ return pVar->mlVal;
+}
+SCRIPT_DEFINE_FUNC_1(int, GetGlobalVar, string)
+
+//-----------------------------------------------------------------------
+
+void cScriptFuncs::Init(cGraphics *apGraphics,
+ cResources *apResources,
+ cSystem *apSystem,
+ cInput *apInput,
+ cScene *apScene,
+ cSound *apSound,
+ cGame *apGame) {
+ gpGraphics = apGraphics;
+ gpResources = apResources;
+ gpSystem = apSystem;
+ gpInput = apInput;
+ gpScene = apScene;
+ gpSound = apSound;
+ gpGame = apGame;
+
+ // General
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(Print));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FloatToString));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(IntToString));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(RandFloat));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(RandInt));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(StringContains));
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(ResetLogicTimer));
+
+ // Renderer
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetAmbientColor));
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSkybox));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSkyboxActive));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSkyboxColor));
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateParticleSystemOnCamera));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFogActive));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFogCulling));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFogProperties));
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSectorProperties));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSectorPortalActive));
+
+ // Resources
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PreloadSound));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(Translate));
+
+ // Mesh Entity
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetMeshActive));
+
+ // Beams
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateBeam));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(DestroyBeam));
+
+ // Particle systems
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetParticleSystemActive));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateParticleSystem));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(KillParticleSystem));
+
+ // Light
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeLight3D));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AttachBillboardToLight3D));
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DVisible));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DFlickerActive));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DFlicker));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DOnlyAffectInSector));
+
+ // Sound
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlayMusic));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(StopMusic));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlaySoundEntity));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(StopSoundEntity));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeInSoundEntity));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeOutSoundEntity));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlayGuiSound));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateSoundEntity));
+
+ // Physics
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointCallback));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(BreakJoint));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetJointProperty));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetBodyProperty));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetBodyProperty));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointProperty));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AttachBodiesWithJoint));
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointControllerActive));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(ChangeJointController));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointControllerPropertyFloat));
+
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddBodyForce));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddBodyImpulse));
+
+ // Local vars
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateLocalVar));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLocalVar));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddLocalVar));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetLocalVar));
+
+ // Global vars
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateGlobalVar));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetGlobalVar));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddGlobalVar));
+ gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetGlobalVar));
+}
- //-----------------------------------------------------------------------
-
- //////////////////////////////////////////////////////////////////////////
- // PRIVATE METHODS
- //////////////////////////////////////////////////////////////////////////
-
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
-}
+} // namespace hpl
diff --git a/engines/hpl1/engine/game/ScriptFuncs.h b/engines/hpl1/engine/game/ScriptFuncs.h
index f42e310e42a..66822929f26 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.h
+++ b/engines/hpl1/engine/game/ScriptFuncs.h
@@ -45,48 +45,43 @@
namespace hpl {
- class cGraphics;
- class cResources;
- class cSystem;
- class cSound;
- class cScene;
- class cInput;
- class cGame;
+class cGraphics;
+class cResources;
+class cSystem;
+class cSound;
+class cScene;
+class cInput;
+class cGame;
+//---------------------------------------
+class cScriptJointCallback : public iPhysicsJointCallback {
+public:
+ cScriptJointCallback(cScene *apScene);
- //---------------------------------------
+ void OnMinLimit(iPhysicsJoint *apJoint);
+ void OnMaxLimit(iPhysicsJoint *apJoint);
- class cScriptJointCallback : public iPhysicsJointCallback
- {
- public:
- cScriptJointCallback(cScene *apScene);
+ bool IsScript() { return true; }
- void OnMinLimit(iPhysicsJoint *apJoint);
- void OnMaxLimit(iPhysicsJoint *apJoint);
+ tString msMaxFunc;
+ tString msMinFunc;
- bool IsScript(){ return true;}
-
- tString msMaxFunc;
- tString msMinFunc;
-
- cScene *mpScene;
- };
-
- //---------------------------------------
-
- class cScriptFuncs
- {
- public:
- static void Init( cGraphics* apGraphics,
- cResources *apResources,
- cSystem *apSystem,
- cInput *apInput,
- cScene *apScene,
- cSound *apSound,
- cGame *apGame
- );
- };
+ cScene *mpScene;
+};
+//---------------------------------------
+
+class cScriptFuncs {
+public:
+ static void Init(cGraphics *apGraphics,
+ cResources *apResources,
+ cSystem *apSystem,
+ cInput *apInput,
+ cScene *apScene,
+ cSound *apSound,
+ cGame *apGame);
};
+
+}; // namespace hpl
#endif // HPL_SCRIPT_FUNCS_H
diff --git a/engines/hpl1/engine/game/Updateable.h b/engines/hpl1/engine/game/Updateable.h
index 90c2d951600..dd5f162ac26 100644
--- a/engines/hpl1/engine/game/Updateable.h
+++ b/engines/hpl1/engine/game/Updateable.h
@@ -45,32 +45,31 @@
namespace hpl {
- class iUpdateable
- {
- public:
- iUpdateable(const tString& asName) : msName(asName){}
+class iUpdateable {
+public:
+ iUpdateable(const tString &asName) : msName(asName) {}
- virtual void OnDraw(){}
+ virtual void OnDraw() {}
- virtual void OnPostSceneDraw(){}
+ virtual void OnPostSceneDraw() {}
- virtual void OnPostGUIDraw(){}
+ virtual void OnPostGUIDraw() {}
- virtual void OnPostBufferSwap(){}
+ virtual void OnPostBufferSwap() {}
- virtual void OnStart(){}
+ virtual void OnStart() {}
- virtual void Update(float afTimeStep){}
+ virtual void Update(float afTimeStep) {}
- virtual void OnExit(){}
+ virtual void OnExit() {}
- virtual void Reset(){}
+ virtual void Reset() {}
- const tString& GetName(){ return msName;}
+ const tString &GetName() { return msName; }
- private:
- tString msName;
- };
+private:
+ tString msName;
};
+}; // namespace hpl
#endif // HPL_UPDATEABLE_H
diff --git a/engines/hpl1/engine/game/Updater.cpp b/engines/hpl1/engine/game/Updater.cpp
index 585d2f30894..95eecc7c69e 100644
--- a/engines/hpl1/engine/game/Updater.cpp
+++ b/engines/hpl1/engine/game/Updater.cpp
@@ -45,277 +45,236 @@
namespace hpl {
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cUpdater::cUpdater(iLowLevelSystem *apLowLevelSystem)
- {
- mpCurrentUpdates = NULL;
+cUpdater::cUpdater(iLowLevelSystem *apLowLevelSystem) {
+ mpCurrentUpdates = NULL;
- mpLowLevelSystem = apLowLevelSystem;
- }
+ mpLowLevelSystem = apLowLevelSystem;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cUpdater::~cUpdater()
- {
- }
+cUpdater::~cUpdater() {
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // PUBLIC METHOD
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHOD
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cUpdater::OnDraw()
- {
- for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
- {
+void cUpdater::OnDraw() {
+ for (tUpdateableListIt it = mlstGlobalUpdateableList.begin(); it != mlstGlobalUpdateableList.end(); ++it) {
+ (*it)->OnDraw();
+ }
+
+ if (mpCurrentUpdates) {
+ for (tUpdateableListIt it = mpCurrentUpdates->begin(); it != mpCurrentUpdates->end(); ++it) {
(*it)->OnDraw();
}
+ }
+}
+//-----------------------------------------------------------------------
- if(mpCurrentUpdates)
- {
- for(tUpdateableListIt it = mpCurrentUpdates->begin();it!=mpCurrentUpdates->end();++it)
- {
- (*it)->OnDraw();
- }
- }
+void cUpdater::OnPostSceneDraw() {
+ for (tUpdateableListIt it = mlstGlobalUpdateableList.begin(); it != mlstGlobalUpdateableList.end(); ++it) {
+ (*it)->OnPostSceneDraw();
}
- //-----------------------------------------------------------------------
- void cUpdater::OnPostSceneDraw()
- {
- for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
- {
+ if (mpCurrentUpdates) {
+ for (tUpdateableListIt it = mpCurrentUpdates->begin(); it != mpCurrentUpdates->end(); ++it) {
(*it)->OnPostSceneDraw();
}
+ }
+}
- if(mpCurrentUpdates)
- {
- for(tUpdateableListIt it = mpCurrentUpdates->begin();it!=mpCurrentUpdates->end();++it)
- {
- (*it)->OnPostSceneDraw();
- }
- }
+void cUpdater::OnPostGUIDraw() {
+ for (tUpdateableListIt it = mlstGlobalUpdateableList.begin(); it != mlstGlobalUpdateableList.end(); ++it) {
+ (*it)->OnPostGUIDraw();
}
- void cUpdater::OnPostGUIDraw()
- {
- for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
- {
+ if (mpCurrentUpdates) {
+ for (tUpdateableListIt it = mpCurrentUpdates->begin(); it != mpCurrentUpdates->end(); ++it) {
(*it)->OnPostGUIDraw();
}
-
- if(mpCurrentUpdates)
- {
- for(tUpdateableListIt it = mpCurrentUpdates->begin();it!=mpCurrentUpdates->end();++it)
- {
- (*it)->OnPostGUIDraw();
- }
- }
}
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cUpdater::OnPostBufferSwap()
- {
- for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
- {
- (*it)->OnPostBufferSwap();
- }
+void cUpdater::OnPostBufferSwap() {
+ for (tUpdateableListIt it = mlstGlobalUpdateableList.begin(); it != mlstGlobalUpdateableList.end(); ++it) {
+ (*it)->OnPostBufferSwap();
+ }
- if(mpCurrentUpdates)
- {
- for(tUpdateableListIt it = mpCurrentUpdates->begin();it!=mpCurrentUpdates->end();++it)
- {
- (*it)->OnPostBufferSwap();
- }
+ if (mpCurrentUpdates) {
+ for (tUpdateableListIt it = mpCurrentUpdates->begin(); it != mpCurrentUpdates->end(); ++it) {
+ (*it)->OnPostBufferSwap();
}
}
+}
- //-----------------------------------------------------------------------
-
- void cUpdater::OnStart()
- {
- for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
- {
- (*it)->OnStart();
- }
+//-----------------------------------------------------------------------
- tUpdateContainerMapIt ContIt = m_mapUpdateContainer.begin();
- while(ContIt != m_mapUpdateContainer.end())
- {
- tUpdateableListIt UpIt = ContIt->second.begin();
- while(UpIt != ContIt->second.end())
- {
- (*UpIt)->OnStart();
- UpIt++;
- }
-
- ContIt++;
- }
+void cUpdater::OnStart() {
+ for (tUpdateableListIt it = mlstGlobalUpdateableList.begin(); it != mlstGlobalUpdateableList.end(); ++it) {
+ (*it)->OnStart();
}
- //-----------------------------------------------------------------------
-
- void cUpdater::Reset()
- {
- for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
- {
- (*it)->Reset();
+ tUpdateContainerMapIt ContIt = m_mapUpdateContainer.begin();
+ while (ContIt != m_mapUpdateContainer.end()) {
+ tUpdateableListIt UpIt = ContIt->second.begin();
+ while (UpIt != ContIt->second.end()) {
+ (*UpIt)->OnStart();
+ UpIt++;
}
- tUpdateContainerMapIt ContIt = m_mapUpdateContainer.begin();
- while(ContIt != m_mapUpdateContainer.end())
- {
+ ContIt++;
+ }
+}
- tUpdateableList *pUpdates = &ContIt->second;
- tUpdateableListIt UpIt = pUpdates->begin();
- while(UpIt != pUpdates->end())
- {
- iUpdateable *pUpdate = *UpIt;
+//-----------------------------------------------------------------------
- pUpdate->Reset();
+void cUpdater::Reset() {
+ for (tUpdateableListIt it = mlstGlobalUpdateableList.begin(); it != mlstGlobalUpdateableList.end(); ++it) {
+ (*it)->Reset();
+ }
- ++UpIt;
- }
+ tUpdateContainerMapIt ContIt = m_mapUpdateContainer.begin();
+ while (ContIt != m_mapUpdateContainer.end()) {
- ++ContIt;
- }
- }
+ tUpdateableList *pUpdates = &ContIt->second;
+ tUpdateableListIt UpIt = pUpdates->begin();
+ while (UpIt != pUpdates->end()) {
+ iUpdateable *pUpdate = *UpIt;
- //-----------------------------------------------------------------------
+ pUpdate->Reset();
- void cUpdater::OnExit()
- {
- for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
- {
- //Log(" Exiting %s\n",(*it)->GetName().c_str());
- (*it)->OnExit();
+ ++UpIt;
}
- tUpdateContainerMapIt ContIt = m_mapUpdateContainer.begin();
- while(ContIt != m_mapUpdateContainer.end())
- {
- tUpdateableListIt UpIt = ContIt->second.begin();
- while(UpIt != ContIt->second.end())
- {
- //Log(" Exiting %s\n",(*UpIt)->GetName().c_str());
- (*UpIt)->OnExit();
- UpIt++;
- }
-
- ContIt++;
- }
+ ++ContIt;
}
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cUpdater::Update(float afTimeStep)
- {
- for(tUpdateableListIt it = mlstGlobalUpdateableList.begin();it!=mlstGlobalUpdateableList.end();++it)
- {
- START_TIMING_EX((*it)->GetName().c_str(),game)
- (*it)->Update(afTimeStep);
- STOP_TIMING(game)
- }
+void cUpdater::OnExit() {
+ for (tUpdateableListIt it = mlstGlobalUpdateableList.begin(); it != mlstGlobalUpdateableList.end(); ++it) {
+ // Log(" Exiting %s\n",(*it)->GetName().c_str());
+ (*it)->OnExit();
+ }
- if(mpCurrentUpdates)
- {
- tUpdateableList *pList = mpCurrentUpdates;
- for(tUpdateableListIt it = pList->begin();it!=pList->end();++it)
- {
- START_TIMING_EX((*it)->GetName().c_str(),game)
- (*it)->Update(afTimeStep);
- STOP_TIMING(game)
- }
+ tUpdateContainerMapIt ContIt = m_mapUpdateContainer.begin();
+ while (ContIt != m_mapUpdateContainer.end()) {
+ tUpdateableListIt UpIt = ContIt->second.begin();
+ while (UpIt != ContIt->second.end()) {
+ // Log(" Exiting %s\n",(*UpIt)->GetName().c_str());
+ (*UpIt)->OnExit();
+ UpIt++;
}
- }
- //-----------------------------------------------------------------------
+ ContIt++;
+ }
+}
+//-----------------------------------------------------------------------
- bool cUpdater::SetContainer(tString asContainer)
- {
- tUpdateContainerMapIt it = m_mapUpdateContainer.find(asContainer);
- if(it == m_mapUpdateContainer.end()) return false;
+void cUpdater::Update(float afTimeStep) {
+ for (tUpdateableListIt it = mlstGlobalUpdateableList.begin(); it != mlstGlobalUpdateableList.end(); ++it) {
+ START_TIMING_EX((*it)->GetName().c_str(), game)
+ (*it)->Update(afTimeStep);
+ STOP_TIMING(game)
+ }
- msCurrentUpdates = asContainer;
- if(msCurrentUpdates == "Default"){
- SetUpdateLogActive(true);
- }
- else {
- SetUpdateLogActive(false);
+ if (mpCurrentUpdates) {
+ tUpdateableList *pList = mpCurrentUpdates;
+ for (tUpdateableListIt it = pList->begin(); it != pList->end(); ++it) {
+ START_TIMING_EX((*it)->GetName().c_str(), game)
+ (*it)->Update(afTimeStep);
+ STOP_TIMING(game)
}
-
- mpCurrentUpdates = &it->second;
-
- return true;
}
+}
- tString cUpdater::GetCurrentContainerName()
- {
- if(mpCurrentUpdates==NULL) return "";
+//-----------------------------------------------------------------------
- return msCurrentUpdates;
+bool cUpdater::SetContainer(tString asContainer) {
+ tUpdateContainerMapIt it = m_mapUpdateContainer.find(asContainer);
+ if (it == m_mapUpdateContainer.end())
+ return false;
+ msCurrentUpdates = asContainer;
+ if (msCurrentUpdates == "Default") {
+ SetUpdateLogActive(true);
+ } else {
+ SetUpdateLogActive(false);
}
- //-----------------------------------------------------------------------
+ mpCurrentUpdates = &it->second;
- bool cUpdater::AddContainer(tString asName)
- {
- //Create the value for the map with key and Updateable
- tUpdateContainerMap::value_type val = tUpdateContainerMap::value_type(
- asName, tUpdateableList());
- //Add it to the map
- m_mapUpdateContainer.insert(val);
+ return true;
+}
- return true;
- }
+tString cUpdater::GetCurrentContainerName() {
+ if (mpCurrentUpdates == NULL)
+ return "";
- //-----------------------------------------------------------------------
+ return msCurrentUpdates;
+}
- bool cUpdater::AddUpdate(tString asContainer, iUpdateable* apUpdate)
- {
- if(apUpdate==NULL){
- Error("Couldn't add NULL updatable!");
- return false;
- }
+//-----------------------------------------------------------------------
- //Search the map for the container name
- tUpdateContainerMapIt it = m_mapUpdateContainer.find(asContainer);
- if(it == m_mapUpdateContainer.end()) return false;
+bool cUpdater::AddContainer(tString asName) {
+ // Create the value for the map with key and Updateable
+ tUpdateContainerMap::value_type val = tUpdateContainerMap::value_type(
+ asName, tUpdateableList());
+ // Add it to the map
+ m_mapUpdateContainer.insert(val);
- //Add the updatable
- it->second.push_back(apUpdate);
+ return true;
+}
+
+//-----------------------------------------------------------------------
- return true;
+bool cUpdater::AddUpdate(tString asContainer, iUpdateable *apUpdate) {
+ if (apUpdate == NULL) {
+ Error("Couldn't add NULL updatable!");
+ return false;
}
- //-----------------------------------------------------------------------
+ // Search the map for the container name
+ tUpdateContainerMapIt it = m_mapUpdateContainer.find(asContainer);
+ if (it == m_mapUpdateContainer.end())
+ return false;
- bool cUpdater::AddGlobalUpdate(iUpdateable* apUpdate)
- {
- mlstGlobalUpdateableList.push_back(apUpdate);
- return true;
- }
+ // Add the updatable
+ it->second.push_back(apUpdate);
- //-----------------------------------------------------------------------
+ return true;
+}
- //////////////////////////////////////////////////////////////////////////
- // PRIVATE METHODS
- //////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+bool cUpdater::AddGlobalUpdate(iUpdateable *apUpdate) {
+ mlstGlobalUpdateableList.push_back(apUpdate);
+ return true;
+}
+//-----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
-}
+//-----------------------------------------------------------------------
+
+//-----------------------------------------------------------------------
+} // namespace hpl
diff --git a/engines/hpl1/engine/game/Updater.h b/engines/hpl1/engine/game/Updater.h
index c23c653b550..02179ee8191 100644
--- a/engines/hpl1/engine/game/Updater.h
+++ b/engines/hpl1/engine/game/Updater.h
@@ -41,83 +41,82 @@
#ifndef HPL_UPDATER_H
#define HPL_UPDATER_H
-#include <map>
#include <list>
+#include <map>
#include "hpl1/engine/system/SystemTypes.h"
namespace hpl {
- class iUpdateable;
- class iLowLevelSystem;
-
- typedef std::list<iUpdateable*> tUpdateableList;
- typedef tUpdateableList::iterator tUpdateableListIt;
-
- typedef std::map<tString, tUpdateableList> tUpdateContainerMap;
- typedef tUpdateContainerMap::iterator tUpdateContainerMapIt;
-
- class cUpdater
- {
- public:
- cUpdater(iLowLevelSystem *apLowLevelSystem);
- ~cUpdater();
-
- void Reset();
-
- void OnDraw();
- void OnPostSceneDraw();
- void OnPostGUIDraw();
- void OnPostBufferSwap();
-
- void OnStart();
-
- void Update(float afTimeStep);
-
- void OnExit();
-
- /**
- * Sets the active update container to be used.
- * \param asContainer Name of the contianer
- * \return
- */
- bool SetContainer(tString asContainer);
-
- /**
- * Gets the name of the current container in use.
- * \return name of current container.
- */
- tString GetCurrentContainerName();
- /**
- * Adds a new container
- * \todo change name to state instead of container?
- * \param asName Name for the new container.
- * \return
- */
- bool AddContainer(tString asName);
- /**
- * Adds a new update in a container.
- * \param asContainer Container name
- * \param apUpdate pointer to the class that will be updated
- * \return
- */
- bool AddUpdate(tString asContainer, iUpdateable* apUpdate);
- /**
- * Adds a global update that runs no matter what container is set
- * \param apUpdate
- * \return
- */
- bool AddGlobalUpdate(iUpdateable* apUpdate);
-
- private:
- tString msCurrentUpdates;
-
- tUpdateContainerMap m_mapUpdateContainer;
-
- iLowLevelSystem *mpLowLevelSystem;
-
- tUpdateableList *mpCurrentUpdates;
- tUpdateableList mlstGlobalUpdateableList;
- };
+class iUpdateable;
+class iLowLevelSystem;
+
+typedef std::list<iUpdateable *> tUpdateableList;
+typedef tUpdateableList::iterator tUpdateableListIt;
+
+typedef std::map<tString, tUpdateableList> tUpdateContainerMap;
+typedef tUpdateContainerMap::iterator tUpdateContainerMapIt;
+
+class cUpdater {
+public:
+ cUpdater(iLowLevelSystem *apLowLevelSystem);
+ ~cUpdater();
+
+ void Reset();
+
+ void OnDraw();
+ void OnPostSceneDraw();
+ void OnPostGUIDraw();
+ void OnPostBufferSwap();
+
+ void OnStart();
+
+ void Update(float afTimeStep);
+
+ void OnExit();
+
+ /**
+ * Sets the active update container to be used.
+ * \param asContainer Name of the contianer
+ * \return
+ */
+ bool SetContainer(tString asContainer);
+
+ /**
+ * Gets the name of the current container in use.
+ * \return name of current container.
+ */
+ tString GetCurrentContainerName();
+ /**
+ * Adds a new container
+ * \todo change name to state instead of container?
+ * \param asName Name for the new container.
+ * \return
+ */
+ bool AddContainer(tString asName);
+ /**
+ * Adds a new update in a container.
+ * \param asContainer Container name
+ * \param apUpdate pointer to the class that will be updated
+ * \return
+ */
+ bool AddUpdate(tString asContainer, iUpdateable *apUpdate);
+ /**
+ * Adds a global update that runs no matter what container is set
+ * \param apUpdate
+ * \return
+ */
+ bool AddGlobalUpdate(iUpdateable *apUpdate);
+
+private:
+ tString msCurrentUpdates;
+
+ tUpdateContainerMap m_mapUpdateContainer;
+
+ iLowLevelSystem *mpLowLevelSystem;
+
+ tUpdateableList *mpCurrentUpdates;
+ tUpdateableList mlstGlobalUpdateableList;
};
+}; // namespace hpl
#endif // HPL_UPDATER_H
diff --git a/engines/hpl1/engine/graphics/Animation.cpp b/engines/hpl1/engine/graphics/Animation.cpp
index 4fc8d081e5b..9ed48dce137 100644
--- a/engines/hpl1/engine/graphics/Animation.cpp
+++ b/engines/hpl1/engine/graphics/Animation.cpp
@@ -40,105 +40,93 @@
#include "hpl1/engine/graphics/Animation.h"
-#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/graphics/AnimationTrack.h"
+#include "hpl1/engine/math/Math.h"
namespace hpl {
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAnimation::cAnimation(const tString &asName, const tString &asFile) : iResourceBase(asName,0)
- {
- msAnimName = "";
- msFileName = asFile;
- }
+cAnimation::cAnimation(const tString &asName, const tString &asFile) : iResourceBase(asName, 0) {
+ msAnimName = "";
+ msFileName = asFile;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAnimation::~cAnimation()
- {
- STLDeleteAll(mvTracks);
- }
+cAnimation::~cAnimation() {
+ STLDeleteAll(mvTracks);
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // PUBLIC METHODS
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- float cAnimation::GetLength()
- {
- return mfLength;
- }
+float cAnimation::GetLength() {
+ return mfLength;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cAnimation::SetLength(float afTime)
- {
- mfLength = afTime;
- }
+void cAnimation::SetLength(float afTime) {
+ mfLength = afTime;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAnimationTrack* cAnimation::CreateTrack(const tString &asName, tAnimTransformFlag aFlags)
- {
- cAnimationTrack *pTrack = hplNew( cAnimationTrack,(asName, aFlags, this) );
+cAnimationTrack *cAnimation::CreateTrack(const tString &asName, tAnimTransformFlag aFlags) {
+ cAnimationTrack *pTrack = hplNew(cAnimationTrack, (asName, aFlags, this));
- mvTracks.push_back(pTrack);
+ mvTracks.push_back(pTrack);
- return pTrack;
- }
+ return pTrack;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAnimationTrack* cAnimation::GetTrack(int alIndex)
- {
- return mvTracks[alIndex];
- }
+cAnimationTrack *cAnimation::GetTrack(int alIndex) {
+ return mvTracks[alIndex];
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAnimationTrack* cAnimation::GetTrackByName(const tString &asName)
- {
- for(size_t i=0; i< mvTracks.size(); ++i)
- {
- if(asName == tString(mvTracks[i]->GetName()))
- {
- return mvTracks[i];
- }
+cAnimationTrack *cAnimation::GetTrackByName(const tString &asName) {
+ for (size_t i = 0; i < mvTracks.size(); ++i) {
+ if (asName == tString(mvTracks[i]->GetName())) {
+ return mvTracks[i];
}
-
- return NULL;
}
- //-----------------------------------------------------------------------
+ return NULL;
+}
- void cAnimation::ResizeTracks(int alNum)
- {
- mvTracks.reserve(alNum);
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+void cAnimation::ResizeTracks(int alNum) {
+ mvTracks.reserve(alNum);
+}
- int cAnimation::GetTrackNum()
- {
- return (int)mvTracks.size();
- }
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+int cAnimation::GetTrackNum() {
+ return (int)mvTracks.size();
+}
+//-----------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // PRIVATE METHODS
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
-}
+//-----------------------------------------------------------------------
+} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/Animation.h b/engines/hpl1/engine/graphics/Animation.h
index f8cc2e40267..bde7c293a99 100644
--- a/engines/hpl1/engine/graphics/Animation.h
+++ b/engines/hpl1/engine/graphics/Animation.h
@@ -41,51 +41,50 @@
#ifndef HPL_ANIMATION_H
#define HPL_ANIMATION_H
-#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
-#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/resources/ResourceBase.h"
+#include "hpl1/engine/system/SystemTypes.h"
namespace hpl {
- class cAnimationTrack;
-
- typedef std::vector<cAnimationTrack*> tAnimationTrackVec;
- typedef tAnimationTrackVec::iterator tAnimationTrackVecIt;
+class cAnimationTrack;
- class cAnimation : public iResourceBase
- {
- public:
- cAnimation(const tString &asName, const tString &asFile);
- ~cAnimation();
+typedef std::vector<cAnimationTrack *> tAnimationTrackVec;
+typedef tAnimationTrackVec::iterator tAnimationTrackVecIt;
- float GetLength();
- void SetLength(float afTime);
+class cAnimation : public iResourceBase {
+public:
+ cAnimation(const tString &asName, const tString &asFile);
+ ~cAnimation();
- cAnimationTrack* CreateTrack(const tString &asName, tAnimTransformFlag aFlags);
- cAnimationTrack* GetTrack(int alIndex);
- cAnimationTrack* GetTrackByName(const tString &asName);
- void ResizeTracks(int alNum);
- int GetTrackNum();
+ float GetLength();
+ void SetLength(float afTime);
- const char* GetAnimationName(){ return msAnimName.c_str();}
- void SetAnimationName(const tString &asName){ msAnimName =asName;}
+ cAnimationTrack *CreateTrack(const tString &asName, tAnimTransformFlag aFlags);
+ cAnimationTrack *GetTrack(int alIndex);
+ cAnimationTrack *GetTrackByName(const tString &asName);
+ void ResizeTracks(int alNum);
+ int GetTrackNum();
- tString& GetFileName(){ return msFileName;}
+ const char *GetAnimationName() { return msAnimName.c_str(); }
+ void SetAnimationName(const tString &asName) { msAnimName = asName; }
- //Resources implementation
- bool Reload(){ return false;}
- void Unload(){}
- void Destroy(){}
+ tString &GetFileName() { return msFileName; }
- private:
- tString msAnimName;
- tString msFileName;
+ // Resources implementation
+ bool Reload() { return false; }
+ void Unload() {}
+ void Destroy() {}
- float mfLength;
+private:
+ tString msAnimName;
+ tString msFileName;
- tAnimationTrackVec mvTracks;
- };
+ float mfLength;
+ tAnimationTrackVec mvTracks;
};
+
+}; // namespace hpl
#endif // HPL_ANIMATION_H
diff --git a/engines/hpl1/engine/graphics/AnimationTrack.cpp b/engines/hpl1/engine/graphics/AnimationTrack.cpp
index 0ad689cf726..f6d2f77560e 100644
--- a/engines/hpl1/engine/graphics/AnimationTrack.cpp
+++ b/engines/hpl1/engine/graphics/AnimationTrack.cpp
@@ -40,202 +40,181 @@
#include "hpl1/engine/graphics/AnimationTrack.h"
-#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/graphics/Animation.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/scene/Node3D.h"
+#include "hpl1/engine/system/LowLevelSystem.h"
namespace hpl {
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAnimationTrack::cAnimationTrack(const tString &asName, tAnimTransformFlag aTransformFlags,
- cAnimation *apParent)
- {
- msName = asName;
- mTransformFlags = aTransformFlags;
- mpParent = apParent;
+cAnimationTrack::cAnimationTrack(const tString &asName, tAnimTransformFlag aTransformFlags,
+ cAnimation *apParent) {
+ msName = asName;
+ mTransformFlags = aTransformFlags;
+ mpParent = apParent;
- mfMaxFrameTime = 0;
+ mfMaxFrameTime = 0;
- mlNodeIdx = -1;
- }
+ mlNodeIdx = -1;
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cAnimationTrack::~cAnimationTrack()
- {
- STLDeleteAll(mvKeyFrames);
- }
+cAnimationTrack::~cAnimationTrack() {
+ STLDeleteAll(mvKeyFrames);
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // PUBLIC METHODS
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- void cAnimationTrack::ResizeKeyFrames(int alSize)
- {
- mvKeyFrames.reserve(alSize);
- }
+void cAnimationTrack::ResizeKeyFrames(int alSize) {
+ mvKeyFrames.reserve(alSize);
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cKeyFrame* cAnimationTrack::CreateKeyFrame(float afTime)
- {
- cKeyFrame* pFrame = hplNew( cKeyFrame,());
- pFrame->time = afTime;
+cKeyFrame *cAnimationTrack::CreateKeyFrame(float afTime) {
+ cKeyFrame *pFrame = hplNew(cKeyFrame, ());
+ pFrame->time = afTime;
- //Check so that this is the first
- if(afTime > mfMaxFrameTime || mvKeyFrames.empty())
- {
- mvKeyFrames.push_back(pFrame);
- mfMaxFrameTime = afTime;
- }
- else
- {
- tKeyFramePtrVecIt it = mvKeyFrames.begin();
- for(; it != mvKeyFrames.end(); it++)
- {
- if(afTime < (*it)->time)
- {
- break;
- }
+ // Check so that this is the first
+ if (afTime > mfMaxFrameTime || mvKeyFrames.empty()) {
+ mvKeyFrames.push_back(pFrame);
+ mfMaxFrameTime = afTime;
+ } else {
+ tKeyFramePtrVecIt it = mvKeyFrames.begin();
+ for (; it != mvKeyFrames.end(); it++) {
+ if (afTime < (*it)->time) {
+ break;
}
- mvKeyFrames.insert(it,pFrame);
}
-
- return pFrame;
+ mvKeyFrames.insert(it, pFrame);
}
- //-----------------------------------------------------------------------
-
- void cAnimationTrack::ApplyToNode(cNode3D* apNode, float afTime, float afWeight)
- {
- cKeyFrame Frame = GetInterpolatedKeyFrame(afTime);
+ return pFrame;
+}
- //Scale
- //Skip this for now...
- /*cVector3f vOne(1,1,1);
- cVector3f vScale = (Frame.scale - vOne)*afWeight + vOne;
- apNode->AddScale(vScale);*/
+//-----------------------------------------------------------------------
- //Rotation
- cQuaternion qRot = cMath::QuaternionSlerp(afWeight, cQuaternion::Identity, Frame.rotation, true);
- apNode->AddRotation(qRot);
+void cAnimationTrack::ApplyToNode(cNode3D *apNode, float afTime, float afWeight) {
+ cKeyFrame Frame = GetInterpolatedKeyFrame(afTime);
- //Translation
- cVector3f vTrans = Frame.trans * afWeight;
- apNode->AddTranslation(vTrans);
- }
+ // Scale
+ // Skip this for now...
+ /*cVector3f vOne(1,1,1);
+ cVector3f vScale = (Frame.scale - vOne)*afWeight + vOne;
+ apNode->AddScale(vScale);*/
- //-----------------------------------------------------------------------
+ // Rotation
+ cQuaternion qRot = cMath::QuaternionSlerp(afWeight, cQuaternion::Identity, Frame.rotation, true);
+ apNode->AddRotation(qRot);
- cKeyFrame cAnimationTrack::GetInterpolatedKeyFrame(float afTime)
- {
- cKeyFrame ResultKeyFrame;
- ResultKeyFrame.time = afTime;
+ // Translation
+ cVector3f vTrans = Frame.trans * afWeight;
+ apNode->AddTranslation(vTrans);
+}
- cKeyFrame *pKeyFrameA = NULL;
- cKeyFrame *pKeyFrameB = NULL;
+//-----------------------------------------------------------------------
- float fT = GetKeyFramesAtTime(afTime, &pKeyFrameA, &pKeyFrameB);
+cKeyFrame cAnimationTrack::GetInterpolatedKeyFrame(float afTime) {
+ cKeyFrame ResultKeyFrame;
+ ResultKeyFrame.time = afTime;
+ cKeyFrame *pKeyFrameA = NULL;
+ cKeyFrame *pKeyFrameB = NULL;
- if(fT == 0.0f)
- {
- ResultKeyFrame.rotation = pKeyFrameA->rotation;
- ResultKeyFrame.scale = pKeyFrameA->scale;
- ResultKeyFrame.trans = pKeyFrameA->trans;
- }
- else
- {
- //Do a linear interpolation
- //This should include spline stuff later on.
+ float fT = GetKeyFramesAtTime(afTime, &pKeyFrameA, &pKeyFrameB);
- ResultKeyFrame.rotation = cMath::QuaternionSlerp(fT, pKeyFrameA->rotation,
- pKeyFrameB->rotation, true);
+ if (fT == 0.0f) {
+ ResultKeyFrame.rotation = pKeyFrameA->rotation;
+ ResultKeyFrame.scale = pKeyFrameA->scale;
+ ResultKeyFrame.trans = pKeyFrameA->trans;
+ } else {
+ // Do a linear interpolation
+ // This should include spline stuff later on.
- ResultKeyFrame.scale = pKeyFrameA->scale * (1 - fT) + pKeyFrameB->scale * fT;
- ResultKeyFrame.trans = pKeyFrameA->trans * (1 - fT) + pKeyFrameB->trans * fT;
- }
+ ResultKeyFrame.rotation = cMath::QuaternionSlerp(fT, pKeyFrameA->rotation,
+ pKeyFrameB->rotation, true);
- return ResultKeyFrame;
+ ResultKeyFrame.scale = pKeyFrameA->scale * (1 - fT) + pKeyFrameB->scale * fT;
+ ResultKeyFrame.trans = pKeyFrameA->trans * (1 - fT) + pKeyFrameB->trans * fT;
}
- //-----------------------------------------------------------------------
+ return ResultKeyFrame;
+}
- float cAnimationTrack::GetKeyFramesAtTime(float afTime, cKeyFrame** apKeyFrameA,cKeyFrame** apKeyFrameB)
- {
- float fTotalAnimLength = mpParent->GetLength();
+//-----------------------------------------------------------------------
- // Wrap time
- //Not sure it is a good idea to clamp the length.
- //But wrapping screws loop mode up.
- //Wrap(..., totalLength + kEpislon), migh work though.
- afTime = cMath::Clamp(afTime, 0, fTotalAnimLength);
+float cAnimationTrack::GetKeyFramesAtTime(float afTime, cKeyFrame **apKeyFrameA, cKeyFrame **apKeyFrameB) {
+ float fTotalAnimLength = mpParent->GetLength();
- //If longer than max time return last frame and first
- if(afTime >= mfMaxFrameTime)
- {
- *apKeyFrameA = mvKeyFrames[mvKeyFrames.size()-1];
- *apKeyFrameB = mvKeyFrames[0];
+ // Wrap time
+ // Not sure it is a good idea to clamp the length.
+ // But wrapping screws loop mode up.
+ // Wrap(..., totalLength + kEpislon), migh work though.
+ afTime = cMath::Clamp(afTime, 0, fTotalAnimLength);
- //Get T between end to start again. (the last frame doesn't mean the anim is over.
- // In that case wrap to the first frame).
- float fDeltaT = fTotalAnimLength - (*apKeyFrameA)->time;
+ // If longer than max time return last frame and first
+ if (afTime >= mfMaxFrameTime) {
+ *apKeyFrameA = mvKeyFrames[mvKeyFrames.size() - 1];
+ *apKeyFrameB = mvKeyFrames[0];
- //If animation time is >= max time might as well just return the last frame.
- //Not sure if this is good for some looping anims, in that case check the code.
- return 0.0f;//(afTime - (*apKeyFrameA)->time) / fDeltaT;
- }
+ // Get T between end to start again. (the last frame doesn't mean the anim is over.
+ // In that case wrap to the first frame).
+ float fDeltaT = fTotalAnimLength - (*apKeyFrameA)->time;
- //Get the number of frames
- const int lSize = (int)mvKeyFrames.size();
+ // If animation time is >= max time might as well just return the last frame.
+ // Not sure if this is good for some looping anims, in that case check the code.
+ return 0.0f; //(afTime - (*apKeyFrameA)->time) / fDeltaT;
+ }
- //Find the second frame.
- int lIdxB=-1;
- for(int i=0; i< lSize; i++)
- {
- if(afTime <= mvKeyFrames[i]->time)
- {
- lIdxB = i;
- break;
- }
- }
+ // Get the number of frames
+ const int lSize = (int)mvKeyFrames.size();
- //If first frame was found, the lowest time is not 0.
- //If so return the first frame only.
- if(lIdxB == 0)
- {
- *apKeyFrameA = mvKeyFrames[0];
- *apKeyFrameB = mvKeyFrames[0];
- return 0.0f;
+ // Find the second frame.
+ int lIdxB = -1;
+ for (int i = 0; i < lSize; i++) {
+ if (afTime <= mvKeyFrames[i]->time) {
+ lIdxB = i;
+ break;
}
+ }
- //Get the frames
- *apKeyFrameA = mvKeyFrames[lIdxB-1];
- *apKeyFrameB = mvKeyFrames[lIdxB];
+ // If first frame was found, the lowest time is not 0.
+ // If so return the first frame only.
+ if (lIdxB == 0) {
+ *apKeyFrameA = mvKeyFrames[0];
+ *apKeyFrameB = mvKeyFrames[0];
+ return 0.0f;
+ }
- float fDeltaT = (*apKeyFrameB)->time - (*apKeyFrameA)->time;
+ // Get the frames
+ *apKeyFrameA = mvKeyFrames[lIdxB - 1];
+ *apKeyFrameB = mvKeyFrames[lIdxB];
- return (afTime - (*apKeyFrameA)->time) / fDeltaT;
- }
+ float fDeltaT = (*apKeyFrameB)->time - (*apKeyFrameA)->time;
- //-----------------------------------------------------------------------
+ return (afTime - (*apKeyFrameA)->time) / fDeltaT;
+}
+//-----------------------------------------------------------------------
- //////////////////////////////////////////////////////////////////////////
- // PRIVATE METHODS
- //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
-}
+//-----------------------------------------------------------------------
+} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/AnimationTrack.h b/engines/hpl1/engine/graphics/AnimationTrack.h
index 45fe1698759..0bbde75795e 100644
--- a/engines/hpl1/engine/graphics/AnimationTrack.h
+++ b/engines/hpl1/engine/graphics/AnimationTrack.h
@@ -41,75 +41,74 @@
#ifndef HPL_ANIMATION_TRACK_H
#define HPL_ANIMATION_TRACK_H
-#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
+#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
namespace hpl {
- class cAnimation;
- class cNode3D;
+class cAnimation;
+class cNode3D;
- class cAnimationTrack
- {
- public:
- cAnimationTrack(const tString &asName, tAnimTransformFlag aTransformFlags, cAnimation *apParent);
- ~cAnimationTrack();
+class cAnimationTrack {
+public:
+ cAnimationTrack(const tString &asName, tAnimTransformFlag aTransformFlags, cAnimation *apParent);
+ ~cAnimationTrack();
- void ResizeKeyFrames(int alSize);
+ void ResizeKeyFrames(int alSize);
- /**
- * Creates a new key frame. These should be added in sequential order.
- * \param afTime the time for the key frame.
- */
- cKeyFrame* CreateKeyFrame(float afTime);
+ /**
+ * Creates a new key frame. These should be added in sequential order.
+ * \param afTime the time for the key frame.
+ */
+ cKeyFrame *CreateKeyFrame(float afTime);
- inline cKeyFrame* GetKeyFrame(int alIndex){ return mvKeyFrames[alIndex];}
- inline int GetKeyFrameNum(){ return (int) mvKeyFrames.size();}
+ inline cKeyFrame *GetKeyFrame(int alIndex) { return mvKeyFrames[alIndex]; }
+ inline int GetKeyFrameNum() { return (int)mvKeyFrames.size(); }
- inline tAnimTransformFlag GetTransformFlags(){ return mTransformFlags;}
+ inline tAnimTransformFlag GetTransformFlags() { return mTransformFlags; }
- /**
- * Apply the animation to a node. The method uses Node->AddXXX() so Update matrix must be called
- * for the transformation to be applied.
- * \param apNode The node with it's base pose
- * \param afTime The time at which to apply the animation
- * \param afWeight The weight of the animation, a value from 0 to 1.
- */
- void ApplyToNode(cNode3D* apNode, float afTime, float afWeight);
+ /**
+ * Apply the animation to a node. The method uses Node->AddXXX() so Update matrix must be called
+ * for the transformation to be applied.
+ * \param apNode The node with it's base pose
+ * \param afTime The time at which to apply the animation
+ * \param afWeight The weight of the animation, a value from 0 to 1.
+ */
+ void ApplyToNode(cNode3D *apNode, float afTime, float afWeight);
- /**
- * Get a KeyFrame that contains an interpolated value.
- * \param afTime The time from wihcih to create the keyframe.
- */
- cKeyFrame GetInterpolatedKeyFrame(float afTime);
+ /**
+ * Get a KeyFrame that contains an interpolated value.
+ * \param afTime The time from wihcih to create the keyframe.
+ */
+ cKeyFrame GetInterpolatedKeyFrame(float afTime);
- /**
- * Gets key frames between for a specific time.
- * \param afTime The time
- * \param &apKeyFrameA The frame that is equal to or before time
- * \param &apKeyFrameB The frame that is after time.
- * \return Weight of the different frames. 0 = 100% A, 1 = 100% B 0.5 = 50% A and 50% B
- */
- float GetKeyFramesAtTime(float afTime, cKeyFrame** apKeyFrameA,cKeyFrame** apKeyFrameB);
+ /**
+ * Gets key frames between for a specific time.
+ * \param afTime The time
+ * \param &apKeyFrameA The frame that is equal to or before time
+ * \param &apKeyFrameB The frame that is after time.
+ * \return Weight of the different frames. 0 = 100% A, 1 = 100% B 0.5 = 50% A and 50% B
+ */
+ float GetKeyFramesAtTime(float afTime, cKeyFrame **apKeyFrameA, cKeyFrame **apKeyFrameB);
- const char* GetName(){ return msName.c_str();}
+ const char *GetName() { return msName.c_str(); }
- void SetNodeIndex(int alIndex){ mlNodeIdx = alIndex;}
- int GetNodeIndex(){ return mlNodeIdx;}
+ void SetNodeIndex(int alIndex) { mlNodeIdx = alIndex; }
+ int GetNodeIndex() { return mlNodeIdx; }
- private:
- tString msName;
+private:
+ tString msName;
- int mlNodeIdx;
+ int mlNodeIdx;
- tKeyFramePtrVec mvKeyFrames;
- tAnimTransformFlag mTransformFlags;
+ tKeyFramePtrVec mvKeyFrames;
+ tAnimTransformFlag mTransformFlags;
- float mfMaxFrameTime;
-
- cAnimation* mpParent;
- };
+ float mfMaxFrameTime;
+ cAnimation *mpParent;
};
+
+}; // namespace hpl
#endif // HPL_ANIMATION_TRACK_H
diff --git a/engines/hpl1/engine/graphics/BackgroundImage.cpp b/engines/hpl1/engine/graphics/BackgroundImage.cpp
index 77fab873ee0..72e30d4a21f 100644
--- a/engines/hpl1/engine/graphics/BackgroundImage.cpp
+++ b/engines/hpl1/engine/graphics/BackgroundImage.cpp
@@ -43,160 +43,146 @@
namespace hpl {
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
+cBackgroundImage::cBackgroundImage(iMaterial *apMat, const cVector3f &avPos, bool abTile,
+ const cVector2f &avSize, const cVector2f &avPosPercent, const cVector2f &avVel) {
+ mpMaterial = apMat;
- cBackgroundImage::cBackgroundImage(iMaterial* apMat,const cVector3f& avPos, bool abTile ,
- const cVector2f& avSize, const cVector2f& avPosPercent, const cVector2f& avVel)
- {
- mpMaterial = apMat;
+ mvPos = avPos;
+ mbTile = abTile;
+ mvSize = avSize;
+ mvPosPercent = avPosPercent;
+ mvVel = avVel;
- mvPos = avPos;
- mbTile = abTile;
- mvSize = avSize;
- mvPosPercent = avPosPercent;
- mvVel = avVel;
-
- mvVtx = apMat->GetImage(eMaterialTexture_Diffuse)->GetVertexVecCopy(0,mvSize);
- for(int i=0;i<(int)mvVtx.size();i++)
- {
- mvVtx[i].pos.z = mvPos.z;
- }
+ mvVtx = apMat->GetImage(eMaterialTexture_Diffuse)->GetVertexVecCopy(0, mvSize);
+ for (int i = 0; i < (int)mvVtx.size(); i++) {
+ mvVtx[i].pos.z = mvPos.z;
}
+}
- //-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
- cBackgroundImage::~cBackgroundImage()
- {
Commit: 7f956b585b70ce700a33ff512cfed9f283feb1bd
https://github.com/scummvm/scummvm/commit/7f956b585b70ce700a33ff512cfed9f283feb1bd
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:26+01:00
Commit Message:
HPL1: remove double license
Changed paths:
engines/hpl1/engine/ai/AI.cpp
engines/hpl1/engine/ai/AI.h
engines/hpl1/engine/ai/AINodeContainer.cpp
engines/hpl1/engine/ai/AINodeContainer.h
engines/hpl1/engine/ai/AINodeGenerator.cpp
engines/hpl1/engine/ai/AINodeGenerator.h
engines/hpl1/engine/ai/AStar.cpp
engines/hpl1/engine/ai/AStar.h
engines/hpl1/engine/ai/StateMachine.cpp
engines/hpl1/engine/ai/StateMachine.h
engines/hpl1/engine/game/Game.cpp
engines/hpl1/engine/game/Game.h
engines/hpl1/engine/game/GameTypes.cpp
engines/hpl1/engine/game/GameTypes.h
engines/hpl1/engine/game/LowLevelGameSetup.h
engines/hpl1/engine/game/SaveGame.cpp
engines/hpl1/engine/game/SaveGame.h
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/game/ScriptFuncs.h
engines/hpl1/engine/game/Updateable.h
engines/hpl1/engine/game/Updater.cpp
engines/hpl1/engine/game/Updater.h
engines/hpl1/engine/graphics/Animation.cpp
engines/hpl1/engine/graphics/Animation.h
engines/hpl1/engine/graphics/AnimationTrack.cpp
engines/hpl1/engine/graphics/AnimationTrack.h
engines/hpl1/engine/graphics/BackgroundImage.cpp
engines/hpl1/engine/graphics/BackgroundImage.h
engines/hpl1/engine/graphics/Beam.cpp
engines/hpl1/engine/graphics/Beam.h
engines/hpl1/engine/graphics/BillBoard.cpp
engines/hpl1/engine/graphics/BillBoard.h
engines/hpl1/engine/graphics/Bitmap2D.h
engines/hpl1/engine/graphics/Bone.cpp
engines/hpl1/engine/graphics/Bone.h
engines/hpl1/engine/graphics/BoneState.cpp
engines/hpl1/engine/graphics/BoneState.h
engines/hpl1/engine/graphics/Color.cpp
engines/hpl1/engine/graphics/Color.h
engines/hpl1/engine/graphics/FontData.cpp
engines/hpl1/engine/graphics/FontData.h
engines/hpl1/engine/graphics/GPUProgram.cpp
engines/hpl1/engine/graphics/GPUProgram.h
engines/hpl1/engine/graphics/GfxObject.cpp
engines/hpl1/engine/graphics/GfxObject.h
engines/hpl1/engine/graphics/Graphics.cpp
engines/hpl1/engine/graphics/Graphics.h
engines/hpl1/engine/graphics/GraphicsDrawer.cpp
engines/hpl1/engine/graphics/GraphicsDrawer.h
engines/hpl1/engine/graphics/GraphicsTypes.h
engines/hpl1/engine/graphics/ImageEntityData.cpp
engines/hpl1/engine/graphics/ImageEntityData.h
engines/hpl1/engine/graphics/LowLevelGraphics.h
engines/hpl1/engine/graphics/LowLevelPicture.h
engines/hpl1/engine/graphics/Material.cpp
engines/hpl1/engine/graphics/Material.h
engines/hpl1/engine/graphics/MaterialHandler.cpp
engines/hpl1/engine/graphics/MaterialHandler.h
engines/hpl1/engine/graphics/Material_Additive.cpp
engines/hpl1/engine/graphics/Material_Additive.h
engines/hpl1/engine/graphics/Material_Alpha.cpp
engines/hpl1/engine/graphics/Material_Alpha.h
engines/hpl1/engine/graphics/Material_BaseLight.cpp
engines/hpl1/engine/graphics/Material_BaseLight.h
engines/hpl1/engine/graphics/Material_Bump.cpp
engines/hpl1/engine/graphics/Material_Bump.h
engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
engines/hpl1/engine/graphics/Material_BumpColorSpec.h
engines/hpl1/engine/graphics/Material_BumpSpec.cpp
engines/hpl1/engine/graphics/Material_BumpSpec.h
engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
engines/hpl1/engine/graphics/Material_BumpSpec2D.h
engines/hpl1/engine/graphics/Material_Diffuse.cpp
engines/hpl1/engine/graphics/Material_Diffuse.h
engines/hpl1/engine/graphics/Material_Diffuse2D.cpp
engines/hpl1/engine/graphics/Material_Diffuse2D.h
engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.cpp
engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.cpp
engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
engines/hpl1/engine/graphics/Material_DiffuseSpec.h
engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
engines/hpl1/engine/graphics/Material_Flat.cpp
engines/hpl1/engine/graphics/Material_Flat.h
engines/hpl1/engine/graphics/Material_FontNormal.cpp
engines/hpl1/engine/graphics/Material_FontNormal.h
engines/hpl1/engine/graphics/Material_Modulative.cpp
engines/hpl1/engine/graphics/Material_Modulative.h
engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
engines/hpl1/engine/graphics/Material_ModulativeX2.h
engines/hpl1/engine/graphics/Material_Smoke2D.cpp
engines/hpl1/engine/graphics/Material_Smoke2D.h
engines/hpl1/engine/graphics/Material_Water.cpp
engines/hpl1/engine/graphics/Material_Water.h
engines/hpl1/engine/graphics/Mesh.cpp
engines/hpl1/engine/graphics/Mesh.h
engines/hpl1/engine/graphics/Mesh2d.cpp
engines/hpl1/engine/graphics/Mesh2d.h
engines/hpl1/engine/graphics/MeshCreator.cpp
engines/hpl1/engine/graphics/MeshCreator.h
engines/hpl1/engine/graphics/OcclusionQuery.h
engines/hpl1/engine/graphics/ParticleEmitter.cpp
engines/hpl1/engine/graphics/ParticleEmitter.h
engines/hpl1/engine/graphics/ParticleEmitter2D.cpp
engines/hpl1/engine/graphics/ParticleEmitter2D.h
engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
engines/hpl1/engine/graphics/ParticleEmitter3D.h
engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
engines/hpl1/engine/graphics/ParticleSystem3D.cpp
engines/hpl1/engine/graphics/ParticleSystem3D.h
engines/hpl1/engine/graphics/PixelFormat.h
engines/hpl1/engine/graphics/RenderList.cpp
engines/hpl1/engine/graphics/RenderList.h
engines/hpl1/engine/graphics/RenderObject2D.cpp
engines/hpl1/engine/graphics/RenderObject2D.h
engines/hpl1/engine/graphics/RenderState.cpp
engines/hpl1/engine/graphics/RenderState.h
engines/hpl1/engine/graphics/Renderable.cpp
engines/hpl1/engine/graphics/Renderable.h
engines/hpl1/engine/graphics/Renderer2D.cpp
engines/hpl1/engine/graphics/Renderer2D.h
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/engine/graphics/Renderer3D.h
engines/hpl1/engine/graphics/RendererPostEffects.cpp
engines/hpl1/engine/graphics/RendererPostEffects.h
engines/hpl1/engine/graphics/Skeleton.cpp
engines/hpl1/engine/graphics/Skeleton.h
engines/hpl1/engine/graphics/SubMesh.cpp
engines/hpl1/engine/graphics/SubMesh.h
engines/hpl1/engine/graphics/Texture.h
engines/hpl1/engine/graphics/VertexBuffer.h
engines/hpl1/engine/graphics/VideoStream.h
engines/hpl1/engine/gui/Gui.cpp
engines/hpl1/engine/gui/Gui.h
engines/hpl1/engine/gui/GuiGfxElement.cpp
engines/hpl1/engine/gui/GuiGfxElement.h
engines/hpl1/engine/gui/GuiMaterial.h
engines/hpl1/engine/gui/GuiMaterialBasicTypes.cpp
engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
engines/hpl1/engine/gui/GuiPopUp.cpp
engines/hpl1/engine/gui/GuiPopUp.h
engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
engines/hpl1/engine/gui/GuiPopUpMessageBox.h
engines/hpl1/engine/gui/GuiSet.cpp
engines/hpl1/engine/gui/GuiSet.h
engines/hpl1/engine/gui/GuiSkin.cpp
engines/hpl1/engine/gui/GuiSkin.h
engines/hpl1/engine/gui/GuiTypes.h
engines/hpl1/engine/gui/Widget.cpp
engines/hpl1/engine/gui/Widget.h
engines/hpl1/engine/gui/WidgetBaseClasses.cpp
engines/hpl1/engine/gui/WidgetBaseClasses.h
engines/hpl1/engine/gui/WidgetButton.cpp
engines/hpl1/engine/gui/WidgetButton.h
engines/hpl1/engine/gui/WidgetCheckBox.cpp
engines/hpl1/engine/gui/WidgetCheckBox.h
engines/hpl1/engine/gui/WidgetComboBox.cpp
engines/hpl1/engine/gui/WidgetComboBox.h
engines/hpl1/engine/gui/WidgetFrame.cpp
engines/hpl1/engine/gui/WidgetFrame.h
engines/hpl1/engine/gui/WidgetImage.cpp
engines/hpl1/engine/gui/WidgetImage.h
engines/hpl1/engine/gui/WidgetLabel.cpp
engines/hpl1/engine/gui/WidgetLabel.h
engines/hpl1/engine/gui/WidgetListBox.cpp
engines/hpl1/engine/gui/WidgetListBox.h
engines/hpl1/engine/gui/WidgetSlider.cpp
engines/hpl1/engine/gui/WidgetSlider.h
engines/hpl1/engine/gui/WidgetTextBox.cpp
engines/hpl1/engine/gui/WidgetTextBox.h
engines/hpl1/engine/gui/WidgetWindow.cpp
engines/hpl1/engine/gui/WidgetWindow.h
engines/hpl1/engine/haptic/Haptic.cpp
engines/hpl1/engine/haptic/Haptic.h
engines/hpl1/engine/haptic/HapticForce.h
engines/hpl1/engine/haptic/HapticShape.h
engines/hpl1/engine/haptic/HapticSurface.h
engines/hpl1/engine/haptic/HapticTypes.h
engines/hpl1/engine/haptic/LowLevelHaptic.cpp
engines/hpl1/engine/haptic/LowLevelHaptic.h
engines/hpl1/engine/impl/CGProgram.cpp
engines/hpl1/engine/impl/CGProgram.h
engines/hpl1/engine/impl/CharacterBodyNewton.cpp
engines/hpl1/engine/impl/CharacterBodyNewton.h
engines/hpl1/engine/impl/CollideShapeNewton.cpp
engines/hpl1/engine/impl/CollideShapeNewton.h
engines/hpl1/engine/impl/KeyboardSDL.cpp
engines/hpl1/engine/impl/KeyboardSDL.h
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
engines/hpl1/engine/impl/LowLevelInputSDL.cpp
engines/hpl1/engine/impl/LowLevelInputSDL.h
engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
engines/hpl1/engine/impl/LowLevelResourcesSDL.h
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
engines/hpl1/engine/impl/LowLevelSystemSDL.h
engines/hpl1/engine/impl/MeshLoaderCollada.cpp
engines/hpl1/engine/impl/MeshLoaderCollada.h
engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
engines/hpl1/engine/impl/MeshLoaderMSH.cpp
engines/hpl1/engine/impl/MeshLoaderMSH.h
engines/hpl1/engine/impl/MouseSDL.cpp
engines/hpl1/engine/impl/MouseSDL.h
engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
engines/hpl1/engine/impl/OcclusionQueryOGL.h
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
engines/hpl1/engine/impl/OpenALSoundChannel.h
engines/hpl1/engine/impl/OpenALSoundData.cpp
engines/hpl1/engine/impl/OpenALSoundData.h
engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
engines/hpl1/engine/impl/OpenALSoundEnvironment.h
engines/hpl1/engine/impl/PBuffer.cpp
engines/hpl1/engine/impl/PBuffer.h
engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
engines/hpl1/engine/impl/PhysicsBodyNewton.h
engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
engines/hpl1/engine/impl/PhysicsControllerNewton.h
engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
engines/hpl1/engine/impl/PhysicsJointBallNewton.h
engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
engines/hpl1/engine/impl/PhysicsJointNewton.h
engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
engines/hpl1/engine/impl/PhysicsMaterialNewton.h
engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
engines/hpl1/engine/impl/PhysicsWorldNewton.h
engines/hpl1/engine/impl/Platform.h
engines/hpl1/engine/impl/SDLBitmap2D.cpp
engines/hpl1/engine/impl/SDLBitmap2D.h
engines/hpl1/engine/impl/SDLFontData.cpp
engines/hpl1/engine/impl/SDLFontData.h
engines/hpl1/engine/impl/SDLGameSetup.cpp
engines/hpl1/engine/impl/SDLGameSetup.h
engines/hpl1/engine/impl/SDLPixelFormat.h
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/SDLTexture.h
engines/hpl1/engine/impl/SqScript.cpp
engines/hpl1/engine/impl/SqScript.h
engines/hpl1/engine/impl/VertexBufferOGL.cpp
engines/hpl1/engine/impl/VertexBufferOGL.h
engines/hpl1/engine/impl/VertexBufferVBO.cpp
engines/hpl1/engine/impl/VertexBufferVBO.h
engines/hpl1/engine/impl/VideoStreamTheora.cpp
engines/hpl1/engine/impl/VideoStreamTheora.h
engines/hpl1/engine/input/Action.cpp
engines/hpl1/engine/input/Action.h
engines/hpl1/engine/input/ActionHaptic.cpp
engines/hpl1/engine/input/ActionHaptic.h
engines/hpl1/engine/input/ActionKeyboard.cpp
engines/hpl1/engine/input/ActionKeyboard.h
engines/hpl1/engine/input/ActionMouseButton.cpp
engines/hpl1/engine/input/ActionMouseButton.h
engines/hpl1/engine/input/Input.cpp
engines/hpl1/engine/input/Input.h
engines/hpl1/engine/input/InputDevice.cpp
engines/hpl1/engine/input/InputDevice.h
engines/hpl1/engine/input/InputTypes.h
engines/hpl1/engine/input/Keyboard.cpp
engines/hpl1/engine/input/Keyboard.h
engines/hpl1/engine/input/LowLevelInput.h
engines/hpl1/engine/input/Mouse.cpp
engines/hpl1/engine/input/Mouse.h
engines/hpl1/engine/math/BoundingVolume.cpp
engines/hpl1/engine/math/BoundingVolume.h
engines/hpl1/engine/math/CRC.cpp
engines/hpl1/engine/math/CRC.h
engines/hpl1/engine/math/Frustum.cpp
engines/hpl1/engine/math/Frustum.h
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/math/Math.h
engines/hpl1/engine/math/MathTypes.cpp
engines/hpl1/engine/math/MathTypes.h
engines/hpl1/engine/math/Matrix.h
engines/hpl1/engine/math/MeshTypes.cpp
engines/hpl1/engine/math/MeshTypes.h
engines/hpl1/engine/math/PidController.h
engines/hpl1/engine/math/Quaternion.cpp
engines/hpl1/engine/math/Quaternion.h
engines/hpl1/engine/math/Spring.cpp
engines/hpl1/engine/math/Spring.h
engines/hpl1/engine/math/Vector2.h
engines/hpl1/engine/math/Vector3.h
engines/hpl1/engine/physics/Body2D.cpp
engines/hpl1/engine/physics/Body2D.h
engines/hpl1/engine/physics/CharacterBody.cpp
engines/hpl1/engine/physics/CharacterBody.h
engines/hpl1/engine/physics/CollideData.h
engines/hpl1/engine/physics/CollideData2D.h
engines/hpl1/engine/physics/CollideShape.h
engines/hpl1/engine/physics/Collider2D.cpp
engines/hpl1/engine/physics/Collider2D.h
engines/hpl1/engine/physics/LowLevelPhysics.h
engines/hpl1/engine/physics/Physics.cpp
engines/hpl1/engine/physics/Physics.h
engines/hpl1/engine/physics/PhysicsBody.cpp
engines/hpl1/engine/physics/PhysicsBody.h
engines/hpl1/engine/physics/PhysicsController.cpp
engines/hpl1/engine/physics/PhysicsController.h
engines/hpl1/engine/physics/PhysicsJoint.cpp
engines/hpl1/engine/physics/PhysicsJoint.h
engines/hpl1/engine/physics/PhysicsJointBall.cpp
engines/hpl1/engine/physics/PhysicsJointBall.h
engines/hpl1/engine/physics/PhysicsJointHinge.cpp
engines/hpl1/engine/physics/PhysicsJointHinge.h
engines/hpl1/engine/physics/PhysicsJointScrew.cpp
engines/hpl1/engine/physics/PhysicsJointScrew.h
engines/hpl1/engine/physics/PhysicsJointSlider.cpp
engines/hpl1/engine/physics/PhysicsJointSlider.h
engines/hpl1/engine/physics/PhysicsMaterial.h
engines/hpl1/engine/physics/PhysicsWorld.cpp
engines/hpl1/engine/physics/PhysicsWorld.h
engines/hpl1/engine/physics/SurfaceData.cpp
engines/hpl1/engine/physics/SurfaceData.h
engines/hpl1/engine/resources/AnimationManager.cpp
engines/hpl1/engine/resources/AnimationManager.h
engines/hpl1/engine/resources/ConfigFile.cpp
engines/hpl1/engine/resources/ConfigFile.h
engines/hpl1/engine/resources/EntityLoader_Object.cpp
engines/hpl1/engine/resources/EntityLoader_Object.h
engines/hpl1/engine/resources/FileSearcher.cpp
engines/hpl1/engine/resources/FileSearcher.h
engines/hpl1/engine/resources/FontManager.cpp
engines/hpl1/engine/resources/FontManager.h
engines/hpl1/engine/resources/FrameBase.h
engines/hpl1/engine/resources/FrameBitmap.cpp
engines/hpl1/engine/resources/FrameBitmap.h
engines/hpl1/engine/resources/FrameTexture.cpp
engines/hpl1/engine/resources/FrameTexture.h
engines/hpl1/engine/resources/GpuProgramManager.cpp
engines/hpl1/engine/resources/GpuProgramManager.h
engines/hpl1/engine/resources/ImageEntityManager.cpp
engines/hpl1/engine/resources/ImageEntityManager.h
engines/hpl1/engine/resources/ImageManager.cpp
engines/hpl1/engine/resources/ImageManager.h
engines/hpl1/engine/resources/LanguageFile.cpp
engines/hpl1/engine/resources/LanguageFile.h
engines/hpl1/engine/resources/LowLevelResources.h
engines/hpl1/engine/resources/MaterialManager.cpp
engines/hpl1/engine/resources/MaterialManager.h
engines/hpl1/engine/resources/MeshLoader.h
engines/hpl1/engine/resources/MeshLoaderHandler.cpp
engines/hpl1/engine/resources/MeshLoaderHandler.h
engines/hpl1/engine/resources/MeshManager.cpp
engines/hpl1/engine/resources/MeshManager.h
engines/hpl1/engine/resources/ParticleManager.cpp
engines/hpl1/engine/resources/ParticleManager.h
engines/hpl1/engine/resources/ResourceBase.cpp
engines/hpl1/engine/resources/ResourceBase.h
engines/hpl1/engine/resources/ResourceImage.cpp
engines/hpl1/engine/resources/ResourceImage.h
engines/hpl1/engine/resources/ResourceManager.cpp
engines/hpl1/engine/resources/ResourceManager.h
engines/hpl1/engine/resources/Resources.cpp
engines/hpl1/engine/resources/Resources.h
engines/hpl1/engine/resources/ResourcesTypes.h
engines/hpl1/engine/resources/ScriptManager.cpp
engines/hpl1/engine/resources/ScriptManager.h
engines/hpl1/engine/resources/SoundEntityManager.cpp
engines/hpl1/engine/resources/SoundEntityManager.h
engines/hpl1/engine/resources/SoundManager.cpp
engines/hpl1/engine/resources/SoundManager.h
engines/hpl1/engine/resources/TextureManager.cpp
engines/hpl1/engine/resources/TextureManager.h
engines/hpl1/engine/resources/TileSetManager.cpp
engines/hpl1/engine/resources/TileSetManager.h
engines/hpl1/engine/resources/VideoManager.cpp
engines/hpl1/engine/resources/VideoManager.h
engines/hpl1/engine/scene/AnimationState.cpp
engines/hpl1/engine/scene/AnimationState.h
engines/hpl1/engine/scene/Area2D.cpp
engines/hpl1/engine/scene/Area2D.h
engines/hpl1/engine/scene/Camera.h
engines/hpl1/engine/scene/Camera2D.cpp
engines/hpl1/engine/scene/Camera2D.h
engines/hpl1/engine/scene/Camera3D.cpp
engines/hpl1/engine/scene/Camera3D.h
engines/hpl1/engine/scene/ColliderEntity.cpp
engines/hpl1/engine/scene/ColliderEntity.h
engines/hpl1/engine/scene/Entity.cpp
engines/hpl1/engine/scene/Entity.h
engines/hpl1/engine/scene/Entity2D.cpp
engines/hpl1/engine/scene/Entity2D.h
engines/hpl1/engine/scene/Entity3D.cpp
engines/hpl1/engine/scene/Entity3D.h
engines/hpl1/engine/scene/GridMap2D.cpp
engines/hpl1/engine/scene/GridMap2D.h
engines/hpl1/engine/scene/ImageEntity.cpp
engines/hpl1/engine/scene/ImageEntity.h
engines/hpl1/engine/scene/Light.cpp
engines/hpl1/engine/scene/Light.h
engines/hpl1/engine/scene/Light2D.cpp
engines/hpl1/engine/scene/Light2D.h
engines/hpl1/engine/scene/Light2DPoint.cpp
engines/hpl1/engine/scene/Light2DPoint.h
engines/hpl1/engine/scene/Light3D.cpp
engines/hpl1/engine/scene/Light3D.h
engines/hpl1/engine/scene/Light3DPoint.cpp
engines/hpl1/engine/scene/Light3DPoint.h
engines/hpl1/engine/scene/Light3DSpot.cpp
engines/hpl1/engine/scene/Light3DSpot.h
engines/hpl1/engine/scene/MeshEntity.cpp
engines/hpl1/engine/scene/MeshEntity.h
engines/hpl1/engine/scene/MultiImageEntity.cpp
engines/hpl1/engine/scene/MultiImageEntity.h
engines/hpl1/engine/scene/Node.cpp
engines/hpl1/engine/scene/Node.h
engines/hpl1/engine/scene/Node2D.cpp
engines/hpl1/engine/scene/Node2D.h
engines/hpl1/engine/scene/Node3D.cpp
engines/hpl1/engine/scene/Node3D.h
engines/hpl1/engine/scene/NodeState.cpp
engines/hpl1/engine/scene/NodeState.h
engines/hpl1/engine/scene/PortalContainer.cpp
engines/hpl1/engine/scene/PortalContainer.h
engines/hpl1/engine/scene/RenderableContainer.h
engines/hpl1/engine/scene/Scene.cpp
engines/hpl1/engine/scene/Scene.h
engines/hpl1/engine/scene/SectorVisibility.cpp
engines/hpl1/engine/scene/SectorVisibility.h
engines/hpl1/engine/scene/SoundEntity.cpp
engines/hpl1/engine/scene/SoundEntity.h
engines/hpl1/engine/scene/SoundSource.cpp
engines/hpl1/engine/scene/SoundSource.h
engines/hpl1/engine/scene/SubMeshEntity.cpp
engines/hpl1/engine/scene/SubMeshEntity.h
engines/hpl1/engine/scene/Tile.cpp
engines/hpl1/engine/scene/Tile.h
engines/hpl1/engine/scene/TileData.cpp
engines/hpl1/engine/scene/TileData.h
engines/hpl1/engine/scene/TileLayer.cpp
engines/hpl1/engine/scene/TileLayer.h
engines/hpl1/engine/scene/TileMap.cpp
engines/hpl1/engine/scene/TileMap.h
engines/hpl1/engine/scene/TileMapIt.h
engines/hpl1/engine/scene/TileMapLineIt.cpp
engines/hpl1/engine/scene/TileMapLineIt.h
engines/hpl1/engine/scene/TileMapRectIt.cpp
engines/hpl1/engine/scene/TileMapRectIt.h
engines/hpl1/engine/scene/TileSet.cpp
engines/hpl1/engine/scene/TileSet.h
engines/hpl1/engine/scene/World2D.cpp
engines/hpl1/engine/scene/World2D.h
engines/hpl1/engine/scene/World3D.cpp
engines/hpl1/engine/scene/World3D.h
engines/hpl1/engine/sound/LowLevelSound.cpp
engines/hpl1/engine/sound/LowLevelSound.h
engines/hpl1/engine/sound/MusicHandler.cpp
engines/hpl1/engine/sound/MusicHandler.h
engines/hpl1/engine/sound/Sound.cpp
engines/hpl1/engine/sound/Sound.h
engines/hpl1/engine/sound/SoundChannel.h
engines/hpl1/engine/sound/SoundData.h
engines/hpl1/engine/sound/SoundEntityData.cpp
engines/hpl1/engine/sound/SoundEntityData.h
engines/hpl1/engine/sound/SoundEnvironment.h
engines/hpl1/engine/sound/SoundHandler.cpp
engines/hpl1/engine/sound/SoundHandler.h
engines/hpl1/engine/system/BinTree.h
engines/hpl1/engine/system/Container.cpp
engines/hpl1/engine/system/Container.h
engines/hpl1/engine/system/LogicTimer.cpp
engines/hpl1/engine/system/LogicTimer.h
engines/hpl1/engine/system/LowLevelSystem.h
engines/hpl1/engine/system/MemoryManager.cpp
engines/hpl1/engine/system/MemoryManager.h
engines/hpl1/engine/system/Script.h
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/engine/system/SerializeClass.h
engines/hpl1/engine/system/String.cpp
engines/hpl1/engine/system/String.h
engines/hpl1/engine/system/System.cpp
engines/hpl1/engine/system/System.h
engines/hpl1/engine/system/SystemTypes.h
engines/hpl1/hpl1.cpp
diff --git a/engines/hpl1/engine/ai/AI.cpp b/engines/hpl1/engine/ai/AI.cpp
index d96817491b8..b71997c8456 100644
--- a/engines/hpl1/engine/ai/AI.cpp
+++ b/engines/hpl1/engine/ai/AI.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/ai/AI.h"
diff --git a/engines/hpl1/engine/ai/AI.h b/engines/hpl1/engine/ai/AI.h
index 5be5bc280c2..4c4d9fe0440 100644
--- a/engines/hpl1/engine/ai/AI.h
+++ b/engines/hpl1/engine/ai/AI.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_AI_H
diff --git a/engines/hpl1/engine/ai/AINodeContainer.cpp b/engines/hpl1/engine/ai/AINodeContainer.cpp
index 6f4fa4408b3..fc31fcaffa7 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.cpp
+++ b/engines/hpl1/engine/ai/AINodeContainer.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/ai/AINodeContainer.h"
diff --git a/engines/hpl1/engine/ai/AINodeContainer.h b/engines/hpl1/engine/ai/AINodeContainer.h
index 505f1e96a1c..638005ec4b9 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.h
+++ b/engines/hpl1/engine/ai/AINodeContainer.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_AI_NODE_CONTAINER_H
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.cpp b/engines/hpl1/engine/ai/AINodeGenerator.cpp
index 1ecb5904032..007e0e1bf8d 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.cpp
+++ b/engines/hpl1/engine/ai/AINodeGenerator.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/ai/AINodeGenerator.h"
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.h b/engines/hpl1/engine/ai/AINodeGenerator.h
index 59cf6f9eef0..d963b651c71 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.h
+++ b/engines/hpl1/engine/ai/AINodeGenerator.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_AI_NODE_GENERATOR_H
diff --git a/engines/hpl1/engine/ai/AStar.cpp b/engines/hpl1/engine/ai/AStar.cpp
index a015e5ff48e..29ad084e648 100644
--- a/engines/hpl1/engine/ai/AStar.cpp
+++ b/engines/hpl1/engine/ai/AStar.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/ai/AStar.h"
diff --git a/engines/hpl1/engine/ai/AStar.h b/engines/hpl1/engine/ai/AStar.h
index 93d733bfd2d..26233f8e65b 100644
--- a/engines/hpl1/engine/ai/AStar.h
+++ b/engines/hpl1/engine/ai/AStar.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_A_STAR_H
diff --git a/engines/hpl1/engine/ai/StateMachine.cpp b/engines/hpl1/engine/ai/StateMachine.cpp
index ea84d0180b9..40dde878a84 100644
--- a/engines/hpl1/engine/ai/StateMachine.cpp
+++ b/engines/hpl1/engine/ai/StateMachine.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/ai/StateMachine.h"
diff --git a/engines/hpl1/engine/ai/StateMachine.h b/engines/hpl1/engine/ai/StateMachine.h
index 16de77102fc..b94beb9f18c 100644
--- a/engines/hpl1/engine/ai/StateMachine.h
+++ b/engines/hpl1/engine/ai/StateMachine.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_STATE_MACHINE_H
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index 881eff806d8..c543a49bff7 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/game/Game.h"
diff --git a/engines/hpl1/engine/game/Game.h b/engines/hpl1/engine/game/Game.h
index 2e1af913b6f..2e668448e5c 100644
--- a/engines/hpl1/engine/game/Game.h
+++ b/engines/hpl1/engine/game/Game.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GAME_H
diff --git a/engines/hpl1/engine/game/GameTypes.cpp b/engines/hpl1/engine/game/GameTypes.cpp
index e2cd646e446..783453daa29 100644
--- a/engines/hpl1/engine/game/GameTypes.cpp
+++ b/engines/hpl1/engine/game/GameTypes.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/game/GameTypes.h"
diff --git a/engines/hpl1/engine/game/GameTypes.h b/engines/hpl1/engine/game/GameTypes.h
index f460f8ebd95..ca05e495009 100644
--- a/engines/hpl1/engine/game/GameTypes.h
+++ b/engines/hpl1/engine/game/GameTypes.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GAME_TYPES_H
diff --git a/engines/hpl1/engine/game/LowLevelGameSetup.h b/engines/hpl1/engine/game/LowLevelGameSetup.h
index 536f0cc7dec..678a224c645 100644
--- a/engines/hpl1/engine/game/LowLevelGameSetup.h
+++ b/engines/hpl1/engine/game/LowLevelGameSetup.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOWLEVELGAMESETUP_H
diff --git a/engines/hpl1/engine/game/SaveGame.cpp b/engines/hpl1/engine/game/SaveGame.cpp
index 3607975cc97..5a74a7976fa 100644
--- a/engines/hpl1/engine/game/SaveGame.cpp
+++ b/engines/hpl1/engine/game/SaveGame.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/game/SaveGame.h"
diff --git a/engines/hpl1/engine/game/SaveGame.h b/engines/hpl1/engine/game/SaveGame.h
index 8b9e576cd27..b71b8fc1550 100644
--- a/engines/hpl1/engine/game/SaveGame.h
+++ b/engines/hpl1/engine/game/SaveGame.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SAVE_GAME_H
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index 8e283df09f5..1eda414dbc2 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/game/ScriptFuncs.h"
diff --git a/engines/hpl1/engine/game/ScriptFuncs.h b/engines/hpl1/engine/game/ScriptFuncs.h
index 66822929f26..8b54c9f94f5 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.h
+++ b/engines/hpl1/engine/game/ScriptFuncs.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SCRIPT_FUNCS_H
diff --git a/engines/hpl1/engine/game/Updateable.h b/engines/hpl1/engine/game/Updateable.h
index dd5f162ac26..5f741dbdbd6 100644
--- a/engines/hpl1/engine/game/Updateable.h
+++ b/engines/hpl1/engine/game/Updateable.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_UPDATEABLE_H
diff --git a/engines/hpl1/engine/game/Updater.cpp b/engines/hpl1/engine/game/Updater.cpp
index 95eecc7c69e..67c91cb22db 100644
--- a/engines/hpl1/engine/game/Updater.cpp
+++ b/engines/hpl1/engine/game/Updater.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/game/Updater.h"
diff --git a/engines/hpl1/engine/game/Updater.h b/engines/hpl1/engine/game/Updater.h
index 02179ee8191..cf28daa9095 100644
--- a/engines/hpl1/engine/game/Updater.h
+++ b/engines/hpl1/engine/game/Updater.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_UPDATER_H
diff --git a/engines/hpl1/engine/graphics/Animation.cpp b/engines/hpl1/engine/graphics/Animation.cpp
index 9ed48dce137..843b1b5b4c9 100644
--- a/engines/hpl1/engine/graphics/Animation.cpp
+++ b/engines/hpl1/engine/graphics/Animation.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Animation.h"
diff --git a/engines/hpl1/engine/graphics/Animation.h b/engines/hpl1/engine/graphics/Animation.h
index bde7c293a99..43c86d10b99 100644
--- a/engines/hpl1/engine/graphics/Animation.h
+++ b/engines/hpl1/engine/graphics/Animation.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_ANIMATION_H
diff --git a/engines/hpl1/engine/graphics/AnimationTrack.cpp b/engines/hpl1/engine/graphics/AnimationTrack.cpp
index f6d2f77560e..540f6444c86 100644
--- a/engines/hpl1/engine/graphics/AnimationTrack.cpp
+++ b/engines/hpl1/engine/graphics/AnimationTrack.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/AnimationTrack.h"
diff --git a/engines/hpl1/engine/graphics/AnimationTrack.h b/engines/hpl1/engine/graphics/AnimationTrack.h
index 0bbde75795e..bdb9a27273c 100644
--- a/engines/hpl1/engine/graphics/AnimationTrack.h
+++ b/engines/hpl1/engine/graphics/AnimationTrack.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_ANIMATION_TRACK_H
diff --git a/engines/hpl1/engine/graphics/BackgroundImage.cpp b/engines/hpl1/engine/graphics/BackgroundImage.cpp
index 72e30d4a21f..848b5b8e89f 100644
--- a/engines/hpl1/engine/graphics/BackgroundImage.cpp
+++ b/engines/hpl1/engine/graphics/BackgroundImage.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/BackgroundImage.h"
diff --git a/engines/hpl1/engine/graphics/BackgroundImage.h b/engines/hpl1/engine/graphics/BackgroundImage.h
index ae601c1dbe8..36ef38bf78d 100644
--- a/engines/hpl1/engine/graphics/BackgroundImage.h
+++ b/engines/hpl1/engine/graphics/BackgroundImage.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_BACKGROUND_IMAGE_H
diff --git a/engines/hpl1/engine/graphics/Beam.cpp b/engines/hpl1/engine/graphics/Beam.cpp
index 2676d59dee9..607cf08d664 100644
--- a/engines/hpl1/engine/graphics/Beam.cpp
+++ b/engines/hpl1/engine/graphics/Beam.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Beam.h"
diff --git a/engines/hpl1/engine/graphics/Beam.h b/engines/hpl1/engine/graphics/Beam.h
index 184e136b3f5..5c49e172c69 100644
--- a/engines/hpl1/engine/graphics/Beam.h
+++ b/engines/hpl1/engine/graphics/Beam.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_BEAM_H
diff --git a/engines/hpl1/engine/graphics/BillBoard.cpp b/engines/hpl1/engine/graphics/BillBoard.cpp
index 7171ec9d9eb..2b760bfe85d 100644
--- a/engines/hpl1/engine/graphics/BillBoard.cpp
+++ b/engines/hpl1/engine/graphics/BillBoard.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/BillBoard.h"
diff --git a/engines/hpl1/engine/graphics/BillBoard.h b/engines/hpl1/engine/graphics/BillBoard.h
index c01107ae58b..09c64a1f81d 100644
--- a/engines/hpl1/engine/graphics/BillBoard.h
+++ b/engines/hpl1/engine/graphics/BillBoard.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_BILLBOARD_H
diff --git a/engines/hpl1/engine/graphics/Bitmap2D.h b/engines/hpl1/engine/graphics/Bitmap2D.h
index ccc89e26238..5ae83f43178 100644
--- a/engines/hpl1/engine/graphics/Bitmap2D.h
+++ b/engines/hpl1/engine/graphics/Bitmap2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_BITMAP2D_H
diff --git a/engines/hpl1/engine/graphics/Bone.cpp b/engines/hpl1/engine/graphics/Bone.cpp
index b200b82cf0b..134109b866f 100644
--- a/engines/hpl1/engine/graphics/Bone.cpp
+++ b/engines/hpl1/engine/graphics/Bone.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Bone.h"
diff --git a/engines/hpl1/engine/graphics/Bone.h b/engines/hpl1/engine/graphics/Bone.h
index 3733cf65eaa..9d67757fde0 100644
--- a/engines/hpl1/engine/graphics/Bone.h
+++ b/engines/hpl1/engine/graphics/Bone.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_BONE_H
diff --git a/engines/hpl1/engine/graphics/BoneState.cpp b/engines/hpl1/engine/graphics/BoneState.cpp
index 58c9736c69d..5633862698b 100644
--- a/engines/hpl1/engine/graphics/BoneState.cpp
+++ b/engines/hpl1/engine/graphics/BoneState.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/BoneState.h"
diff --git a/engines/hpl1/engine/graphics/BoneState.h b/engines/hpl1/engine/graphics/BoneState.h
index 01f4c7b62d6..4118d39f771 100644
--- a/engines/hpl1/engine/graphics/BoneState.h
+++ b/engines/hpl1/engine/graphics/BoneState.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_BONE_STATE_H
diff --git a/engines/hpl1/engine/graphics/Color.cpp b/engines/hpl1/engine/graphics/Color.cpp
index 4559b1a9a26..9effc9427fe 100644
--- a/engines/hpl1/engine/graphics/Color.cpp
+++ b/engines/hpl1/engine/graphics/Color.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Color.h"
diff --git a/engines/hpl1/engine/graphics/Color.h b/engines/hpl1/engine/graphics/Color.h
index 5e72e4b8cca..f2ade5e39d1 100644
--- a/engines/hpl1/engine/graphics/Color.h
+++ b/engines/hpl1/engine/graphics/Color.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_COLOR_H
diff --git a/engines/hpl1/engine/graphics/FontData.cpp b/engines/hpl1/engine/graphics/FontData.cpp
index 756606b42ba..093aa4d3d11 100644
--- a/engines/hpl1/engine/graphics/FontData.cpp
+++ b/engines/hpl1/engine/graphics/FontData.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/FontData.h"
diff --git a/engines/hpl1/engine/graphics/FontData.h b/engines/hpl1/engine/graphics/FontData.h
index c3b965273fa..f989ecbdeb3 100644
--- a/engines/hpl1/engine/graphics/FontData.h
+++ b/engines/hpl1/engine/graphics/FontData.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_FONTDATA_H
diff --git a/engines/hpl1/engine/graphics/GPUProgram.cpp b/engines/hpl1/engine/graphics/GPUProgram.cpp
index 5fd9b039e03..160d225d17b 100644
--- a/engines/hpl1/engine/graphics/GPUProgram.cpp
+++ b/engines/hpl1/engine/graphics/GPUProgram.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/GPUProgram.h"
diff --git a/engines/hpl1/engine/graphics/GPUProgram.h b/engines/hpl1/engine/graphics/GPUProgram.h
index 294522259fa..9f479fa056c 100644
--- a/engines/hpl1/engine/graphics/GPUProgram.h
+++ b/engines/hpl1/engine/graphics/GPUProgram.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GPU_PROGRAM_H
diff --git a/engines/hpl1/engine/graphics/GfxObject.cpp b/engines/hpl1/engine/graphics/GfxObject.cpp
index 2b83e6ea697..ee5cbc949e1 100644
--- a/engines/hpl1/engine/graphics/GfxObject.cpp
+++ b/engines/hpl1/engine/graphics/GfxObject.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/GfxObject.h"
diff --git a/engines/hpl1/engine/graphics/GfxObject.h b/engines/hpl1/engine/graphics/GfxObject.h
index e4514cc32ef..d125137ee5c 100644
--- a/engines/hpl1/engine/graphics/GfxObject.h
+++ b/engines/hpl1/engine/graphics/GfxObject.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GFX_OBJECT_H
diff --git a/engines/hpl1/engine/graphics/Graphics.cpp b/engines/hpl1/engine/graphics/Graphics.cpp
index 9c7a1e39e0e..eeb4a613341 100644
--- a/engines/hpl1/engine/graphics/Graphics.cpp
+++ b/engines/hpl1/engine/graphics/Graphics.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Graphics.h"
diff --git a/engines/hpl1/engine/graphics/Graphics.h b/engines/hpl1/engine/graphics/Graphics.h
index 48ba35e1cbc..89f5c82f59c 100644
--- a/engines/hpl1/engine/graphics/Graphics.h
+++ b/engines/hpl1/engine/graphics/Graphics.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GRAPHICS_H
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.cpp b/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
index 109876581b4..79cd4763819 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/GraphicsDrawer.h"
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.h b/engines/hpl1/engine/graphics/GraphicsDrawer.h
index 7a09eedfc75..e70cc539985 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.h
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GRAPHICSDRAWER_H
diff --git a/engines/hpl1/engine/graphics/GraphicsTypes.h b/engines/hpl1/engine/graphics/GraphicsTypes.h
index 757bb5bb346..d0c78d22fba 100644
--- a/engines/hpl1/engine/graphics/GraphicsTypes.h
+++ b/engines/hpl1/engine/graphics/GraphicsTypes.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GRAPHICSTYPES_H
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.cpp b/engines/hpl1/engine/graphics/ImageEntityData.cpp
index bf36a6669a1..788aece4557 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.cpp
+++ b/engines/hpl1/engine/graphics/ImageEntityData.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/ImageEntityData.h"
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.h b/engines/hpl1/engine/graphics/ImageEntityData.h
index 0b4304a873c..b67701bfaf4 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.h
+++ b/engines/hpl1/engine/graphics/ImageEntityData.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_IMAGE_ENTITY_DATA_H
diff --git a/engines/hpl1/engine/graphics/LowLevelGraphics.h b/engines/hpl1/engine/graphics/LowLevelGraphics.h
index b4a9c5963c7..d3a1fc5ca93 100644
--- a/engines/hpl1/engine/graphics/LowLevelGraphics.h
+++ b/engines/hpl1/engine/graphics/LowLevelGraphics.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOWLEVELGRAPHICS_H
diff --git a/engines/hpl1/engine/graphics/LowLevelPicture.h b/engines/hpl1/engine/graphics/LowLevelPicture.h
index ede75eb89f2..c5143bf0ce1 100644
--- a/engines/hpl1/engine/graphics/LowLevelPicture.h
+++ b/engines/hpl1/engine/graphics/LowLevelPicture.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOWLEVEL_PICTURE_H
diff --git a/engines/hpl1/engine/graphics/Material.cpp b/engines/hpl1/engine/graphics/Material.cpp
index 624ebdde6de..d9d41a2a769 100644
--- a/engines/hpl1/engine/graphics/Material.cpp
+++ b/engines/hpl1/engine/graphics/Material.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material.h"
diff --git a/engines/hpl1/engine/graphics/Material.h b/engines/hpl1/engine/graphics/Material.h
index e543bf438f4..694fa81ab54 100644
--- a/engines/hpl1/engine/graphics/Material.h
+++ b/engines/hpl1/engine/graphics/Material.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_H
diff --git a/engines/hpl1/engine/graphics/MaterialHandler.cpp b/engines/hpl1/engine/graphics/MaterialHandler.cpp
index 4b158195bf7..6dcfa4f5c92 100644
--- a/engines/hpl1/engine/graphics/MaterialHandler.cpp
+++ b/engines/hpl1/engine/graphics/MaterialHandler.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/MaterialHandler.h"
diff --git a/engines/hpl1/engine/graphics/MaterialHandler.h b/engines/hpl1/engine/graphics/MaterialHandler.h
index 1e6747f9bbe..200ba86f5b4 100644
--- a/engines/hpl1/engine/graphics/MaterialHandler.h
+++ b/engines/hpl1/engine/graphics/MaterialHandler.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIALHANDLER_H
diff --git a/engines/hpl1/engine/graphics/Material_Additive.cpp b/engines/hpl1/engine/graphics/Material_Additive.cpp
index 4fa23f21995..1f44606e186 100644
--- a/engines/hpl1/engine/graphics/Material_Additive.cpp
+++ b/engines/hpl1/engine/graphics/Material_Additive.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_Additive.h"
diff --git a/engines/hpl1/engine/graphics/Material_Additive.h b/engines/hpl1/engine/graphics/Material_Additive.h
index b4b13ef1f24..1d76d65ac7e 100644
--- a/engines/hpl1/engine/graphics/Material_Additive.h
+++ b/engines/hpl1/engine/graphics/Material_Additive.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_ADDITIVE_H
diff --git a/engines/hpl1/engine/graphics/Material_Alpha.cpp b/engines/hpl1/engine/graphics/Material_Alpha.cpp
index 4170df578f4..cdbfc06f15b 100644
--- a/engines/hpl1/engine/graphics/Material_Alpha.cpp
+++ b/engines/hpl1/engine/graphics/Material_Alpha.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_Alpha.h"
diff --git a/engines/hpl1/engine/graphics/Material_Alpha.h b/engines/hpl1/engine/graphics/Material_Alpha.h
index 716300a8bf0..f18a30f760c 100644
--- a/engines/hpl1/engine/graphics/Material_Alpha.h
+++ b/engines/hpl1/engine/graphics/Material_Alpha.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_ALPHA_H
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
index c5619e593ab..d96fa171cc0 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_BaseLight.h"
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.h b/engines/hpl1/engine/graphics/Material_BaseLight.h
index b4f53b9dd0c..3be9aba876c 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_BASE_LIGHT_H
diff --git a/engines/hpl1/engine/graphics/Material_Bump.cpp b/engines/hpl1/engine/graphics/Material_Bump.cpp
index e24381eb587..ac7b50c7069 100644
--- a/engines/hpl1/engine/graphics/Material_Bump.cpp
+++ b/engines/hpl1/engine/graphics/Material_Bump.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_Bump.h"
diff --git a/engines/hpl1/engine/graphics/Material_Bump.h b/engines/hpl1/engine/graphics/Material_Bump.h
index 927961a93dc..02a009604b8 100644
--- a/engines/hpl1/engine/graphics/Material_Bump.h
+++ b/engines/hpl1/engine/graphics/Material_Bump.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_BUMP_H
diff --git a/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp b/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
index 9b32205387c..4dc825a278f 100644
--- a/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_BumpColorSpec.h"
diff --git a/engines/hpl1/engine/graphics/Material_BumpColorSpec.h b/engines/hpl1/engine/graphics/Material_BumpColorSpec.h
index 5d657971e0b..e04d4e24889 100644
--- a/engines/hpl1/engine/graphics/Material_BumpColorSpec.h
+++ b/engines/hpl1/engine/graphics/Material_BumpColorSpec.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_BUMP_COLOR_SPEC_H
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec.cpp b/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
index 476e45cbbb3..b8a20b7cba7 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_BumpSpec.h"
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec.h b/engines/hpl1/engine/graphics/Material_BumpSpec.h
index e3e266414c0..30cd4e9a1e2 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec.h
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_BUMP_SPEC_H
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp b/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
index 17e8514dd25..babfb230d2d 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_BumpSpec2D.h"
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec2D.h b/engines/hpl1/engine/graphics/Material_BumpSpec2D.h
index 57857f6365d..426d2db7fe1 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec2D.h
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_BUMP_SPEC2D_H
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse.cpp b/engines/hpl1/engine/graphics/Material_Diffuse.cpp
index 394350fc847..19c7ffc2df8 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse.cpp
+++ b/engines/hpl1/engine/graphics/Material_Diffuse.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_Diffuse.h"
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse.h b/engines/hpl1/engine/graphics/Material_Diffuse.h
index b6939f0d40f..c0bdcb13464 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse.h
+++ b/engines/hpl1/engine/graphics/Material_Diffuse.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_DIFFUSE_H
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse2D.cpp b/engines/hpl1/engine/graphics/Material_Diffuse2D.cpp
index c823f90a28a..11f1b741d22 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse2D.cpp
+++ b/engines/hpl1/engine/graphics/Material_Diffuse2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_Diffuse2D.h"
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse2D.h b/engines/hpl1/engine/graphics/Material_Diffuse2D.h
index 8e0b98ba19c..e1bf65e4fe7 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse2D.h
+++ b/engines/hpl1/engine/graphics/Material_Diffuse2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_DIFFUSE2D_H
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.cpp b/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.cpp
index 3f873d97228..417a77455e8 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.cpp
+++ b/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_DiffuseAdditive2D.h"
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h b/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
index be8ef836f61..bcf5b292227 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
+++ b/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_DIFFUSE_ADDITIVE2D_H
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.cpp b/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.cpp
index 487b3d00aeb..4ba95d4f249 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.cpp
+++ b/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_DiffuseAlpha2D.h"
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h b/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
index 6a9c734ce67..c7da246069d 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
+++ b/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_DIFFUSE_ALPHA2D_H
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp b/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
index b368c901005..e9c3a682c1b 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_DiffuseSpec.h"
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseSpec.h b/engines/hpl1/engine/graphics/Material_DiffuseSpec.h
index b88e546ace1..d8be8af996c 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseSpec.h
+++ b/engines/hpl1/engine/graphics/Material_DiffuseSpec.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_DIFFUSE_SPEC_H
diff --git a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
index e5c89b90528..d3d049dc23e 100644
--- a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
+++ b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_EnvMap_Reflect.h"
diff --git a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
index 2ba4cda80b7..308e80ec63c 100644
--- a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
+++ b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_ENVMAP_REFLECT_H
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
index 7cd929fc00c..1fb014fa3c9 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_Fallback01_BaseLight.h"
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
index b0f7df9a3a2..0f46ed175bf 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_FALLBACK01_BASE_LIGHT_H
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
index cd9869861c4..b09dde36b18 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_Fallback02_BaseLight.h"
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
index d2a7d873f09..460619b425b 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_FALLBACK02_BASE_LIGHT_H
diff --git a/engines/hpl1/engine/graphics/Material_Flat.cpp b/engines/hpl1/engine/graphics/Material_Flat.cpp
index 05246d8e89c..14c2fd52a05 100644
--- a/engines/hpl1/engine/graphics/Material_Flat.cpp
+++ b/engines/hpl1/engine/graphics/Material_Flat.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_Flat.h"
diff --git a/engines/hpl1/engine/graphics/Material_Flat.h b/engines/hpl1/engine/graphics/Material_Flat.h
index 33f6dc5956d..327b67d2c73 100644
--- a/engines/hpl1/engine/graphics/Material_Flat.h
+++ b/engines/hpl1/engine/graphics/Material_Flat.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_FLAT_H
diff --git a/engines/hpl1/engine/graphics/Material_FontNormal.cpp b/engines/hpl1/engine/graphics/Material_FontNormal.cpp
index a863d4b87ae..4e967d421f0 100644
--- a/engines/hpl1/engine/graphics/Material_FontNormal.cpp
+++ b/engines/hpl1/engine/graphics/Material_FontNormal.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_FontNormal.h"
diff --git a/engines/hpl1/engine/graphics/Material_FontNormal.h b/engines/hpl1/engine/graphics/Material_FontNormal.h
index 4149a35c2c6..533c7c7d419 100644
--- a/engines/hpl1/engine/graphics/Material_FontNormal.h
+++ b/engines/hpl1/engine/graphics/Material_FontNormal.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_FONTNORMAL_H
diff --git a/engines/hpl1/engine/graphics/Material_Modulative.cpp b/engines/hpl1/engine/graphics/Material_Modulative.cpp
index 2a61eb3595b..2f38ed32f31 100644
--- a/engines/hpl1/engine/graphics/Material_Modulative.cpp
+++ b/engines/hpl1/engine/graphics/Material_Modulative.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_Modulative.h"
diff --git a/engines/hpl1/engine/graphics/Material_Modulative.h b/engines/hpl1/engine/graphics/Material_Modulative.h
index f088745d706..09a8505a322 100644
--- a/engines/hpl1/engine/graphics/Material_Modulative.h
+++ b/engines/hpl1/engine/graphics/Material_Modulative.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_MODULATIVE_H
diff --git a/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp b/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
index 8bb5a22e916..65e336edc42 100644
--- a/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
+++ b/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_ModulativeX2.h"
diff --git a/engines/hpl1/engine/graphics/Material_ModulativeX2.h b/engines/hpl1/engine/graphics/Material_ModulativeX2.h
index e636ce3e999..79ee6bedbae 100644
--- a/engines/hpl1/engine/graphics/Material_ModulativeX2.h
+++ b/engines/hpl1/engine/graphics/Material_ModulativeX2.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_MODULATIVE_X_2_H
diff --git a/engines/hpl1/engine/graphics/Material_Smoke2D.cpp b/engines/hpl1/engine/graphics/Material_Smoke2D.cpp
index 2aae7d2b729..449d193d398 100644
--- a/engines/hpl1/engine/graphics/Material_Smoke2D.cpp
+++ b/engines/hpl1/engine/graphics/Material_Smoke2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_Smoke2D.h"
diff --git a/engines/hpl1/engine/graphics/Material_Smoke2D.h b/engines/hpl1/engine/graphics/Material_Smoke2D.h
index 09e3d91b85b..25abeef8042 100644
--- a/engines/hpl1/engine/graphics/Material_Smoke2D.h
+++ b/engines/hpl1/engine/graphics/Material_Smoke2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_SMOKE2D_H
diff --git a/engines/hpl1/engine/graphics/Material_Water.cpp b/engines/hpl1/engine/graphics/Material_Water.cpp
index c1978df80ea..9e2218e695e 100644
--- a/engines/hpl1/engine/graphics/Material_Water.cpp
+++ b/engines/hpl1/engine/graphics/Material_Water.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Material_Water.h"
diff --git a/engines/hpl1/engine/graphics/Material_Water.h b/engines/hpl1/engine/graphics/Material_Water.h
index 43534fd0729..4ca01c781fa 100644
--- a/engines/hpl1/engine/graphics/Material_Water.h
+++ b/engines/hpl1/engine/graphics/Material_Water.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_WATER_H
diff --git a/engines/hpl1/engine/graphics/Mesh.cpp b/engines/hpl1/engine/graphics/Mesh.cpp
index 015ced71d9b..6025ee10096 100644
--- a/engines/hpl1/engine/graphics/Mesh.cpp
+++ b/engines/hpl1/engine/graphics/Mesh.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Mesh.h"
diff --git a/engines/hpl1/engine/graphics/Mesh.h b/engines/hpl1/engine/graphics/Mesh.h
index 7f13c48088e..3445e279301 100644
--- a/engines/hpl1/engine/graphics/Mesh.h
+++ b/engines/hpl1/engine/graphics/Mesh.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MESH_H
diff --git a/engines/hpl1/engine/graphics/Mesh2d.cpp b/engines/hpl1/engine/graphics/Mesh2d.cpp
index 6f9ce7c9c90..21572a9d9d6 100644
--- a/engines/hpl1/engine/graphics/Mesh2d.cpp
+++ b/engines/hpl1/engine/graphics/Mesh2d.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Mesh2d.h"
diff --git a/engines/hpl1/engine/graphics/Mesh2d.h b/engines/hpl1/engine/graphics/Mesh2d.h
index a89938dbe14..92a26b0ddf2 100644
--- a/engines/hpl1/engine/graphics/Mesh2d.h
+++ b/engines/hpl1/engine/graphics/Mesh2d.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MESH2D_H
diff --git a/engines/hpl1/engine/graphics/MeshCreator.cpp b/engines/hpl1/engine/graphics/MeshCreator.cpp
index 8dd1261c715..aa0601c8484 100644
--- a/engines/hpl1/engine/graphics/MeshCreator.cpp
+++ b/engines/hpl1/engine/graphics/MeshCreator.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/MeshCreator.h"
diff --git a/engines/hpl1/engine/graphics/MeshCreator.h b/engines/hpl1/engine/graphics/MeshCreator.h
index a7e0ceb5018..5df9574d8c5 100644
--- a/engines/hpl1/engine/graphics/MeshCreator.h
+++ b/engines/hpl1/engine/graphics/MeshCreator.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MESHCREATOR_H
diff --git a/engines/hpl1/engine/graphics/OcclusionQuery.h b/engines/hpl1/engine/graphics/OcclusionQuery.h
index 2e5ece1d5de..d684968ccfe 100644
--- a/engines/hpl1/engine/graphics/OcclusionQuery.h
+++ b/engines/hpl1/engine/graphics/OcclusionQuery.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_OCCLUSION_QUERY_H
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter.cpp b/engines/hpl1/engine/graphics/ParticleEmitter.cpp
index 278b7e850a4..0f5176d07a6 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/ParticleEmitter.h"
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter.h b/engines/hpl1/engine/graphics/ParticleEmitter.h
index 10c0bb49a73..7bec1947953 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PARTICLE_EMITTER_H
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter2D.cpp b/engines/hpl1/engine/graphics/ParticleEmitter2D.cpp
index 22921929a80..8ceadc676cb 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter2D.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
/*#include "hpl1/engine/graphics/ParticleSystem2D.h"
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter2D.h b/engines/hpl1/engine/graphics/ParticleEmitter2D.h
index bfd19ebda4a..1c2e5ed5e45 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter2D.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
/*#ifndef HPL_PARTICLE_SYSTEM_2D_H
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp b/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
index b8c2d8da1f7..4d65e675417 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/ParticleEmitter3D.h"
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D.h b/engines/hpl1/engine/graphics/ParticleEmitter3D.h
index 2483e0a72c6..a5874ef9b3d 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PARTICLE_EMITTER_3D_H
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
index f3f938c521c..8ccf1f58449 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
// NEW
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
index b2e88a25a43..8e801bf8432 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PARTICLE_EMITTER_3D_USER_DATA_H
diff --git a/engines/hpl1/engine/graphics/ParticleSystem3D.cpp b/engines/hpl1/engine/graphics/ParticleSystem3D.cpp
index 3abe0b36e24..d856c285980 100644
--- a/engines/hpl1/engine/graphics/ParticleSystem3D.cpp
+++ b/engines/hpl1/engine/graphics/ParticleSystem3D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/ParticleSystem3D.h"
diff --git a/engines/hpl1/engine/graphics/ParticleSystem3D.h b/engines/hpl1/engine/graphics/ParticleSystem3D.h
index 3930c7cc47f..687c7382c07 100644
--- a/engines/hpl1/engine/graphics/ParticleSystem3D.h
+++ b/engines/hpl1/engine/graphics/ParticleSystem3D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PARTICLE_SYSTEM_3D_H
diff --git a/engines/hpl1/engine/graphics/PixelFormat.h b/engines/hpl1/engine/graphics/PixelFormat.h
index e1e773c72e2..27076dea287 100644
--- a/engines/hpl1/engine/graphics/PixelFormat.h
+++ b/engines/hpl1/engine/graphics/PixelFormat.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PIXELFORMAT_H
diff --git a/engines/hpl1/engine/graphics/RenderList.cpp b/engines/hpl1/engine/graphics/RenderList.cpp
index 4cb78de3ee6..eb76ce79cd9 100644
--- a/engines/hpl1/engine/graphics/RenderList.cpp
+++ b/engines/hpl1/engine/graphics/RenderList.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/RenderList.h"
diff --git a/engines/hpl1/engine/graphics/RenderList.h b/engines/hpl1/engine/graphics/RenderList.h
index 51a53214298..69425caa6b4 100644
--- a/engines/hpl1/engine/graphics/RenderList.h
+++ b/engines/hpl1/engine/graphics/RenderList.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_RENDER_LIST_H
diff --git a/engines/hpl1/engine/graphics/RenderObject2D.cpp b/engines/hpl1/engine/graphics/RenderObject2D.cpp
index 1eeb7aa6f28..c43b02429d1 100644
--- a/engines/hpl1/engine/graphics/RenderObject2D.cpp
+++ b/engines/hpl1/engine/graphics/RenderObject2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/RenderObject2D.h"
diff --git a/engines/hpl1/engine/graphics/RenderObject2D.h b/engines/hpl1/engine/graphics/RenderObject2D.h
index 278c00de79b..21cf2507f9f 100644
--- a/engines/hpl1/engine/graphics/RenderObject2D.h
+++ b/engines/hpl1/engine/graphics/RenderObject2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_RENDEROBJECT2D_H
diff --git a/engines/hpl1/engine/graphics/RenderState.cpp b/engines/hpl1/engine/graphics/RenderState.cpp
index ed61614f6b2..88ab3ac1de1 100644
--- a/engines/hpl1/engine/graphics/RenderState.cpp
+++ b/engines/hpl1/engine/graphics/RenderState.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/RenderState.h"
diff --git a/engines/hpl1/engine/graphics/RenderState.h b/engines/hpl1/engine/graphics/RenderState.h
index 0fa015af134..0ae71023266 100644
--- a/engines/hpl1/engine/graphics/RenderState.h
+++ b/engines/hpl1/engine/graphics/RenderState.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_RENDER_SET_H
diff --git a/engines/hpl1/engine/graphics/Renderable.cpp b/engines/hpl1/engine/graphics/Renderable.cpp
index 0c01a1becf0..52889d7180a 100644
--- a/engines/hpl1/engine/graphics/Renderable.cpp
+++ b/engines/hpl1/engine/graphics/Renderable.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Renderable.h"
diff --git a/engines/hpl1/engine/graphics/Renderable.h b/engines/hpl1/engine/graphics/Renderable.h
index 6d9820443f2..81ab541736d 100644
--- a/engines/hpl1/engine/graphics/Renderable.h
+++ b/engines/hpl1/engine/graphics/Renderable.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_RENDERABLE_H
diff --git a/engines/hpl1/engine/graphics/Renderer2D.cpp b/engines/hpl1/engine/graphics/Renderer2D.cpp
index 65c7e25d508..203513af953 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Renderer2D.h"
diff --git a/engines/hpl1/engine/graphics/Renderer2D.h b/engines/hpl1/engine/graphics/Renderer2D.h
index f34667e0bcf..4170b8c2687 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.h
+++ b/engines/hpl1/engine/graphics/Renderer2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_RENDERER2D_H
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index dbe233724e8..47efbc7b07f 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Renderer3D.h"
diff --git a/engines/hpl1/engine/graphics/Renderer3D.h b/engines/hpl1/engine/graphics/Renderer3D.h
index 8abc7ff198f..e1f462bd8bf 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.h
+++ b/engines/hpl1/engine/graphics/Renderer3D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_RENDERER3D_H
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.cpp b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
index c5c28f6a508..9dbddb44ca8 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.cpp
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/RendererPostEffects.h"
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.h b/engines/hpl1/engine/graphics/RendererPostEffects.h
index fb291264014..7df7c8f72e2 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.h
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_RENDERER_POST_EFFECTS_H
diff --git a/engines/hpl1/engine/graphics/Skeleton.cpp b/engines/hpl1/engine/graphics/Skeleton.cpp
index 9b58ee34657..9a6f43d78b6 100644
--- a/engines/hpl1/engine/graphics/Skeleton.cpp
+++ b/engines/hpl1/engine/graphics/Skeleton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/Skeleton.h"
diff --git a/engines/hpl1/engine/graphics/Skeleton.h b/engines/hpl1/engine/graphics/Skeleton.h
index 2bf27226c3b..5c1b9b8e920 100644
--- a/engines/hpl1/engine/graphics/Skeleton.h
+++ b/engines/hpl1/engine/graphics/Skeleton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SKELETON_H
diff --git a/engines/hpl1/engine/graphics/SubMesh.cpp b/engines/hpl1/engine/graphics/SubMesh.cpp
index 855ab67849a..7106865c57c 100644
--- a/engines/hpl1/engine/graphics/SubMesh.cpp
+++ b/engines/hpl1/engine/graphics/SubMesh.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/graphics/SubMesh.h"
diff --git a/engines/hpl1/engine/graphics/SubMesh.h b/engines/hpl1/engine/graphics/SubMesh.h
index 8c0e81c7917..43327bc1c6b 100644
--- a/engines/hpl1/engine/graphics/SubMesh.h
+++ b/engines/hpl1/engine/graphics/SubMesh.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SUB_MESH_H
diff --git a/engines/hpl1/engine/graphics/Texture.h b/engines/hpl1/engine/graphics/Texture.h
index 4cbb44ab680..2d482e4c842 100644
--- a/engines/hpl1/engine/graphics/Texture.h
+++ b/engines/hpl1/engine/graphics/Texture.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_TEXTURE_H
diff --git a/engines/hpl1/engine/graphics/VertexBuffer.h b/engines/hpl1/engine/graphics/VertexBuffer.h
index 6b91f6eb110..5f79d52e8b9 100644
--- a/engines/hpl1/engine/graphics/VertexBuffer.h
+++ b/engines/hpl1/engine/graphics/VertexBuffer.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_VERTEXBUFFER_H
diff --git a/engines/hpl1/engine/graphics/VideoStream.h b/engines/hpl1/engine/graphics/VideoStream.h
index b2f34c911c0..a86390b4a37 100644
--- a/engines/hpl1/engine/graphics/VideoStream.h
+++ b/engines/hpl1/engine/graphics/VideoStream.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_VIDEO_STREAM_H
diff --git a/engines/hpl1/engine/gui/Gui.cpp b/engines/hpl1/engine/gui/Gui.cpp
index cfe075a3385..60eaa053764 100644
--- a/engines/hpl1/engine/gui/Gui.cpp
+++ b/engines/hpl1/engine/gui/Gui.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/Gui.h"
diff --git a/engines/hpl1/engine/gui/Gui.h b/engines/hpl1/engine/gui/Gui.h
index c3cd18eb19b..20bc16967c3 100644
--- a/engines/hpl1/engine/gui/Gui.h
+++ b/engines/hpl1/engine/gui/Gui.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GUI_H
diff --git a/engines/hpl1/engine/gui/GuiGfxElement.cpp b/engines/hpl1/engine/gui/GuiGfxElement.cpp
index 7e7b510f70e..5d1e85b1628 100644
--- a/engines/hpl1/engine/gui/GuiGfxElement.cpp
+++ b/engines/hpl1/engine/gui/GuiGfxElement.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/GuiGfxElement.h"
diff --git a/engines/hpl1/engine/gui/GuiGfxElement.h b/engines/hpl1/engine/gui/GuiGfxElement.h
index b39f3ffd8b6..587f0de07f6 100644
--- a/engines/hpl1/engine/gui/GuiGfxElement.h
+++ b/engines/hpl1/engine/gui/GuiGfxElement.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GUI_GFX_ELEMENT_H
diff --git a/engines/hpl1/engine/gui/GuiMaterial.h b/engines/hpl1/engine/gui/GuiMaterial.h
index fce7e9ec11c..b20ed673a5d 100644
--- a/engines/hpl1/engine/gui/GuiMaterial.h
+++ b/engines/hpl1/engine/gui/GuiMaterial.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GUI_MATERIAL_H
diff --git a/engines/hpl1/engine/gui/GuiMaterialBasicTypes.cpp b/engines/hpl1/engine/gui/GuiMaterialBasicTypes.cpp
index 06791af1bbe..535c48e0bc0 100644
--- a/engines/hpl1/engine/gui/GuiMaterialBasicTypes.cpp
+++ b/engines/hpl1/engine/gui/GuiMaterialBasicTypes.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/GuiMaterialBasicTypes.h"
diff --git a/engines/hpl1/engine/gui/GuiMaterialBasicTypes.h b/engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
index 18e6420a5cf..908e12a7ca3 100644
--- a/engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
+++ b/engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GUI_MATERIAL_BASIC_TYPES_H
diff --git a/engines/hpl1/engine/gui/GuiPopUp.cpp b/engines/hpl1/engine/gui/GuiPopUp.cpp
index 114bd2052d2..ff81388f01f 100644
--- a/engines/hpl1/engine/gui/GuiPopUp.cpp
+++ b/engines/hpl1/engine/gui/GuiPopUp.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/GuiPopUp.h"
diff --git a/engines/hpl1/engine/gui/GuiPopUp.h b/engines/hpl1/engine/gui/GuiPopUp.h
index fa9d9d06b7c..964d5bc5163 100644
--- a/engines/hpl1/engine/gui/GuiPopUp.h
+++ b/engines/hpl1/engine/gui/GuiPopUp.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GUI_POP_UP_H
diff --git a/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp b/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
index 987f6c640b1..50cbbd4f814 100644
--- a/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
+++ b/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/GuiPopUpMessageBox.h"
diff --git a/engines/hpl1/engine/gui/GuiPopUpMessageBox.h b/engines/hpl1/engine/gui/GuiPopUpMessageBox.h
index 191b6876421..f239a4504d0 100644
--- a/engines/hpl1/engine/gui/GuiPopUpMessageBox.h
+++ b/engines/hpl1/engine/gui/GuiPopUpMessageBox.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GUI_POP_UP_MESSAGE_BOX_H
diff --git a/engines/hpl1/engine/gui/GuiSet.cpp b/engines/hpl1/engine/gui/GuiSet.cpp
index 27400e69031..16892af11f0 100644
--- a/engines/hpl1/engine/gui/GuiSet.cpp
+++ b/engines/hpl1/engine/gui/GuiSet.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/GuiSet.h"
diff --git a/engines/hpl1/engine/gui/GuiSet.h b/engines/hpl1/engine/gui/GuiSet.h
index 7dd76f30230..f9dd18e9753 100644
--- a/engines/hpl1/engine/gui/GuiSet.h
+++ b/engines/hpl1/engine/gui/GuiSet.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GUI_SET_H
diff --git a/engines/hpl1/engine/gui/GuiSkin.cpp b/engines/hpl1/engine/gui/GuiSkin.cpp
index c36705bfe60..f1845f11df1 100644
--- a/engines/hpl1/engine/gui/GuiSkin.cpp
+++ b/engines/hpl1/engine/gui/GuiSkin.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/GuiSkin.h"
diff --git a/engines/hpl1/engine/gui/GuiSkin.h b/engines/hpl1/engine/gui/GuiSkin.h
index 06e3b8bfe90..b288aaf2b7d 100644
--- a/engines/hpl1/engine/gui/GuiSkin.h
+++ b/engines/hpl1/engine/gui/GuiSkin.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GUI_SKIN_H
diff --git a/engines/hpl1/engine/gui/GuiTypes.h b/engines/hpl1/engine/gui/GuiTypes.h
index 8168da78926..bb7aa52a94e 100644
--- a/engines/hpl1/engine/gui/GuiTypes.h
+++ b/engines/hpl1/engine/gui/GuiTypes.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GUI_TYPES_H
diff --git a/engines/hpl1/engine/gui/Widget.cpp b/engines/hpl1/engine/gui/Widget.cpp
index 48737035c65..bd58dc752bc 100644
--- a/engines/hpl1/engine/gui/Widget.cpp
+++ b/engines/hpl1/engine/gui/Widget.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/Widget.h"
diff --git a/engines/hpl1/engine/gui/Widget.h b/engines/hpl1/engine/gui/Widget.h
index 29bce09e84b..3edccbf4eeb 100644
--- a/engines/hpl1/engine/gui/Widget.h
+++ b/engines/hpl1/engine/gui/Widget.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_WIDGET_H
diff --git a/engines/hpl1/engine/gui/WidgetBaseClasses.cpp b/engines/hpl1/engine/gui/WidgetBaseClasses.cpp
index 340e9d0b9fa..add76219504 100644
--- a/engines/hpl1/engine/gui/WidgetBaseClasses.cpp
+++ b/engines/hpl1/engine/gui/WidgetBaseClasses.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/WidgetBaseClasses.h"
diff --git a/engines/hpl1/engine/gui/WidgetBaseClasses.h b/engines/hpl1/engine/gui/WidgetBaseClasses.h
index 31ae1a3b7e3..7db8dcace57 100644
--- a/engines/hpl1/engine/gui/WidgetBaseClasses.h
+++ b/engines/hpl1/engine/gui/WidgetBaseClasses.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_WIDGET_BASE_CLASSES_H
diff --git a/engines/hpl1/engine/gui/WidgetButton.cpp b/engines/hpl1/engine/gui/WidgetButton.cpp
index 0db92a106ff..bf8ff994929 100644
--- a/engines/hpl1/engine/gui/WidgetButton.cpp
+++ b/engines/hpl1/engine/gui/WidgetButton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/WidgetButton.h"
diff --git a/engines/hpl1/engine/gui/WidgetButton.h b/engines/hpl1/engine/gui/WidgetButton.h
index 3f8667feb59..df3e6f0a2dc 100644
--- a/engines/hpl1/engine/gui/WidgetButton.h
+++ b/engines/hpl1/engine/gui/WidgetButton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_WIDGET_BUTTON_H
diff --git a/engines/hpl1/engine/gui/WidgetCheckBox.cpp b/engines/hpl1/engine/gui/WidgetCheckBox.cpp
index f3ac17414b7..eb4c9ba7ca0 100644
--- a/engines/hpl1/engine/gui/WidgetCheckBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetCheckBox.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/WidgetCheckBox.h"
diff --git a/engines/hpl1/engine/gui/WidgetCheckBox.h b/engines/hpl1/engine/gui/WidgetCheckBox.h
index ad9399afeea..ba86393ed98 100644
--- a/engines/hpl1/engine/gui/WidgetCheckBox.h
+++ b/engines/hpl1/engine/gui/WidgetCheckBox.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_WIDGET_CHECK_BOX_H
diff --git a/engines/hpl1/engine/gui/WidgetComboBox.cpp b/engines/hpl1/engine/gui/WidgetComboBox.cpp
index fa8123b28ed..8f4b404391e 100644
--- a/engines/hpl1/engine/gui/WidgetComboBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetComboBox.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/WidgetComboBox.h"
diff --git a/engines/hpl1/engine/gui/WidgetComboBox.h b/engines/hpl1/engine/gui/WidgetComboBox.h
index 346428015b6..9dd66f605ef 100644
--- a/engines/hpl1/engine/gui/WidgetComboBox.h
+++ b/engines/hpl1/engine/gui/WidgetComboBox.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_WIDGET_COMBO_BOX_H
diff --git a/engines/hpl1/engine/gui/WidgetFrame.cpp b/engines/hpl1/engine/gui/WidgetFrame.cpp
index 2a95b9b5969..5720667ab89 100644
--- a/engines/hpl1/engine/gui/WidgetFrame.cpp
+++ b/engines/hpl1/engine/gui/WidgetFrame.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/WidgetFrame.h"
diff --git a/engines/hpl1/engine/gui/WidgetFrame.h b/engines/hpl1/engine/gui/WidgetFrame.h
index f1948d9937f..1ae08f2523f 100644
--- a/engines/hpl1/engine/gui/WidgetFrame.h
+++ b/engines/hpl1/engine/gui/WidgetFrame.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_WIDGET_FRAME_H
diff --git a/engines/hpl1/engine/gui/WidgetImage.cpp b/engines/hpl1/engine/gui/WidgetImage.cpp
index fc9e11c5ade..972fd77736a 100644
--- a/engines/hpl1/engine/gui/WidgetImage.cpp
+++ b/engines/hpl1/engine/gui/WidgetImage.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/WidgetImage.h"
diff --git a/engines/hpl1/engine/gui/WidgetImage.h b/engines/hpl1/engine/gui/WidgetImage.h
index 4a36746bcb4..52de304f54a 100644
--- a/engines/hpl1/engine/gui/WidgetImage.h
+++ b/engines/hpl1/engine/gui/WidgetImage.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_WIDGET_IMAGE_H
diff --git a/engines/hpl1/engine/gui/WidgetLabel.cpp b/engines/hpl1/engine/gui/WidgetLabel.cpp
index 630e3381c2f..581059eea97 100644
--- a/engines/hpl1/engine/gui/WidgetLabel.cpp
+++ b/engines/hpl1/engine/gui/WidgetLabel.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/WidgetLabel.h"
diff --git a/engines/hpl1/engine/gui/WidgetLabel.h b/engines/hpl1/engine/gui/WidgetLabel.h
index c5f37296ac5..400ef3e08b9 100644
--- a/engines/hpl1/engine/gui/WidgetLabel.h
+++ b/engines/hpl1/engine/gui/WidgetLabel.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_WIDGET_LABEL_H
diff --git a/engines/hpl1/engine/gui/WidgetListBox.cpp b/engines/hpl1/engine/gui/WidgetListBox.cpp
index 65cfaf5495d..8d2a1ef6075 100644
--- a/engines/hpl1/engine/gui/WidgetListBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetListBox.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/WidgetListBox.h"
diff --git a/engines/hpl1/engine/gui/WidgetListBox.h b/engines/hpl1/engine/gui/WidgetListBox.h
index c178b2b4bf8..a93afc666e4 100644
--- a/engines/hpl1/engine/gui/WidgetListBox.h
+++ b/engines/hpl1/engine/gui/WidgetListBox.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_WIDGET_LIST_BOX_H
diff --git a/engines/hpl1/engine/gui/WidgetSlider.cpp b/engines/hpl1/engine/gui/WidgetSlider.cpp
index 50a2bdc4866..588eb681a40 100644
--- a/engines/hpl1/engine/gui/WidgetSlider.cpp
+++ b/engines/hpl1/engine/gui/WidgetSlider.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/WidgetSlider.h"
diff --git a/engines/hpl1/engine/gui/WidgetSlider.h b/engines/hpl1/engine/gui/WidgetSlider.h
index a65eade93f8..a79bd22c03d 100644
--- a/engines/hpl1/engine/gui/WidgetSlider.h
+++ b/engines/hpl1/engine/gui/WidgetSlider.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_WIDGET_SLIDER_H
diff --git a/engines/hpl1/engine/gui/WidgetTextBox.cpp b/engines/hpl1/engine/gui/WidgetTextBox.cpp
index 705285b2b1f..a1863c5722f 100644
--- a/engines/hpl1/engine/gui/WidgetTextBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetTextBox.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/WidgetTextBox.h"
diff --git a/engines/hpl1/engine/gui/WidgetTextBox.h b/engines/hpl1/engine/gui/WidgetTextBox.h
index 885c05889d6..5e774b8d9bb 100644
--- a/engines/hpl1/engine/gui/WidgetTextBox.h
+++ b/engines/hpl1/engine/gui/WidgetTextBox.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_WIDGET_TEXT_BOX_H
diff --git a/engines/hpl1/engine/gui/WidgetWindow.cpp b/engines/hpl1/engine/gui/WidgetWindow.cpp
index 8e77e832e00..b314243a696 100644
--- a/engines/hpl1/engine/gui/WidgetWindow.cpp
+++ b/engines/hpl1/engine/gui/WidgetWindow.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/gui/WidgetWindow.h"
diff --git a/engines/hpl1/engine/gui/WidgetWindow.h b/engines/hpl1/engine/gui/WidgetWindow.h
index 3b9495db42e..dee0691260e 100644
--- a/engines/hpl1/engine/gui/WidgetWindow.h
+++ b/engines/hpl1/engine/gui/WidgetWindow.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_WIDGET_WINDOW_H
diff --git a/engines/hpl1/engine/haptic/Haptic.cpp b/engines/hpl1/engine/haptic/Haptic.cpp
index 593037356bc..95bfe416e32 100644
--- a/engines/hpl1/engine/haptic/Haptic.cpp
+++ b/engines/hpl1/engine/haptic/Haptic.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/haptic/Haptic.h"
diff --git a/engines/hpl1/engine/haptic/Haptic.h b/engines/hpl1/engine/haptic/Haptic.h
index ffd1349d902..a612e2a7efa 100644
--- a/engines/hpl1/engine/haptic/Haptic.h
+++ b/engines/hpl1/engine/haptic/Haptic.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_HAPTIC_H
diff --git a/engines/hpl1/engine/haptic/HapticForce.h b/engines/hpl1/engine/haptic/HapticForce.h
index efe9147583d..745a30b662b 100644
--- a/engines/hpl1/engine/haptic/HapticForce.h
+++ b/engines/hpl1/engine/haptic/HapticForce.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_HAPTIC_FORCE_H
diff --git a/engines/hpl1/engine/haptic/HapticShape.h b/engines/hpl1/engine/haptic/HapticShape.h
index 5c7747ea15e..7acd6c5b9e9 100644
--- a/engines/hpl1/engine/haptic/HapticShape.h
+++ b/engines/hpl1/engine/haptic/HapticShape.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_HAPTIC_SHAPE_H
diff --git a/engines/hpl1/engine/haptic/HapticSurface.h b/engines/hpl1/engine/haptic/HapticSurface.h
index d6e4e8191a3..4f9e9664c46 100644
--- a/engines/hpl1/engine/haptic/HapticSurface.h
+++ b/engines/hpl1/engine/haptic/HapticSurface.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_HAPTIC_SURFACE_H
diff --git a/engines/hpl1/engine/haptic/HapticTypes.h b/engines/hpl1/engine/haptic/HapticTypes.h
index e20c8986906..3ce25296943 100644
--- a/engines/hpl1/engine/haptic/HapticTypes.h
+++ b/engines/hpl1/engine/haptic/HapticTypes.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_HAPTIC_TYPES_H
diff --git a/engines/hpl1/engine/haptic/LowLevelHaptic.cpp b/engines/hpl1/engine/haptic/LowLevelHaptic.cpp
index 8082803ae21..e750364a448 100644
--- a/engines/hpl1/engine/haptic/LowLevelHaptic.cpp
+++ b/engines/hpl1/engine/haptic/LowLevelHaptic.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/haptic/LowLevelHaptic.h"
diff --git a/engines/hpl1/engine/haptic/LowLevelHaptic.h b/engines/hpl1/engine/haptic/LowLevelHaptic.h
index c7163b948dd..9c5ebe36e89 100644
--- a/engines/hpl1/engine/haptic/LowLevelHaptic.h
+++ b/engines/hpl1/engine/haptic/LowLevelHaptic.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOW_LEVEL_HAPTIC_H
diff --git a/engines/hpl1/engine/impl/CGProgram.cpp b/engines/hpl1/engine/impl/CGProgram.cpp
index 19f0901224f..917c6c41c35 100644
--- a/engines/hpl1/engine/impl/CGProgram.cpp
+++ b/engines/hpl1/engine/impl/CGProgram.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/CGProgram.h"
diff --git a/engines/hpl1/engine/impl/CGProgram.h b/engines/hpl1/engine/impl/CGProgram.h
index 5834bac229b..495895a09b2 100644
--- a/engines/hpl1/engine/impl/CGProgram.h
+++ b/engines/hpl1/engine/impl/CGProgram.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_CGPROGRAM_H
diff --git a/engines/hpl1/engine/impl/CharacterBodyNewton.cpp b/engines/hpl1/engine/impl/CharacterBodyNewton.cpp
index 843939baa78..c32ec28d43c 100644
--- a/engines/hpl1/engine/impl/CharacterBodyNewton.cpp
+++ b/engines/hpl1/engine/impl/CharacterBodyNewton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/CharacterBodyNewton.h"
diff --git a/engines/hpl1/engine/impl/CharacterBodyNewton.h b/engines/hpl1/engine/impl/CharacterBodyNewton.h
index 5245982870f..b259f0e6a2e 100644
--- a/engines/hpl1/engine/impl/CharacterBodyNewton.h
+++ b/engines/hpl1/engine/impl/CharacterBodyNewton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_CHARACTER_BODY_NEWTON_H
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.cpp b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
index a26fbe2c416..8e53b58751c 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.cpp
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/CollideShapeNewton.h"
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.h b/engines/hpl1/engine/impl/CollideShapeNewton.h
index a5d5e0982be..47a6ded009b 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.h
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_COLLIDE_SHAPE_NEWTON_H
diff --git a/engines/hpl1/engine/impl/KeyboardSDL.cpp b/engines/hpl1/engine/impl/KeyboardSDL.cpp
index 0d28d1c61c4..72ee006795f 100644
--- a/engines/hpl1/engine/impl/KeyboardSDL.cpp
+++ b/engines/hpl1/engine/impl/KeyboardSDL.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/KeyboardSDL.h"
diff --git a/engines/hpl1/engine/impl/KeyboardSDL.h b/engines/hpl1/engine/impl/KeyboardSDL.h
index a12fabc883f..dc426812fef 100644
--- a/engines/hpl1/engine/impl/KeyboardSDL.h
+++ b/engines/hpl1/engine/impl/KeyboardSDL.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_KEYBOARD_SDL_H
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 9bece6c30ed..26827d759d4 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#if 0 // def WIN32
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
index e4e5fb6cf08..c301224ed01 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOWLEVELGRAPHICS_SDL_H
diff --git a/engines/hpl1/engine/impl/LowLevelInputSDL.cpp b/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
index d78781cfe15..6f16a303166 100644
--- a/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/LowLevelInputSDL.h"
diff --git a/engines/hpl1/engine/impl/LowLevelInputSDL.h b/engines/hpl1/engine/impl/LowLevelInputSDL.h
index 5ee8ec4798e..e655f937273 100644
--- a/engines/hpl1/engine/impl/LowLevelInputSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelInputSDL.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOWLEVELINPUT_SDL_H
diff --git a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
index bbfb0a2b129..f1943f02370 100644
--- a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
+++ b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma comment(lib, "newton.lib")
diff --git a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
index bd484071bd3..0530c58bda6 100644
--- a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
+++ b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOWLEVELPHYSICS_NEWTON_H
diff --git a/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp b/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
index 13cb2c5ea1f..1a063c37272 100644
--- a/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/LowLevelResourcesSDL.h"
diff --git a/engines/hpl1/engine/impl/LowLevelResourcesSDL.h b/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
index bbbe6ac09b0..4300d2c7032 100644
--- a/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOWLEVELRESOURCES_SDL_H
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
index a366ce33883..eba39ac58fe 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
index dbde21c4e56..02f7df02299 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOWLEVELSOUND_OPENAL_H
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
index 7654d708e0a..278c2206a86 100644
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
//#include <vld.h>
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.h b/engines/hpl1/engine/impl/LowLevelSystemSDL.h
index 4304bbc1d47..4c4c07efbe4 100644
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelSystemSDL.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOWLEVELSYSTEM_SDL_H
@@ -43,7 +30,6 @@
#include "hpl1/engine/libraries/angelscript/angelscript.h"
#include "hpl1/engine/system/LowLevelSystem.h"
-#include <stdio.h>
namespace hpl {
@@ -61,8 +47,6 @@ public:
private:
void ReopenFile();
- //--file handeling--
- FILE *mpFile;
tWString msFileName;
};
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
index c6aa53e5e14..b0a684ca7d1 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/MeshLoaderCollada.h"
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.h b/engines/hpl1/engine/impl/MeshLoaderCollada.h
index b8b667e0eeb..f1ea32e2b01 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.h
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MESH_LOADER_COLLADA_H
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
index 708a5ed959f..ce29ed2b0c6 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/MeshLoaderCollada.h"
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
index 250034faf7b..8258667f554 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/MeshLoaderCollada.h"
diff --git a/engines/hpl1/engine/impl/MeshLoaderMSH.cpp b/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
index 5b346f382fe..ba29278cb74 100644
--- a/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/MeshLoaderMSH.h"
diff --git a/engines/hpl1/engine/impl/MeshLoaderMSH.h b/engines/hpl1/engine/impl/MeshLoaderMSH.h
index c2b88d07c6a..3d2e3096c5c 100644
--- a/engines/hpl1/engine/impl/MeshLoaderMSH.h
+++ b/engines/hpl1/engine/impl/MeshLoaderMSH.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MESH_LOADER_MSH_H
diff --git a/engines/hpl1/engine/impl/MouseSDL.cpp b/engines/hpl1/engine/impl/MouseSDL.cpp
index 319baa994ee..065bdf6335a 100644
--- a/engines/hpl1/engine/impl/MouseSDL.cpp
+++ b/engines/hpl1/engine/impl/MouseSDL.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/MouseSDL.h"
diff --git a/engines/hpl1/engine/impl/MouseSDL.h b/engines/hpl1/engine/impl/MouseSDL.h
index 954c9883759..85d144fe8ad 100644
--- a/engines/hpl1/engine/impl/MouseSDL.h
+++ b/engines/hpl1/engine/impl/MouseSDL.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MOUSE_SDL_H
diff --git a/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp b/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
index 3a93d232ba5..d2812452b60 100644
--- a/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
+++ b/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/OcclusionQueryOGL.h"
diff --git a/engines/hpl1/engine/impl/OcclusionQueryOGL.h b/engines/hpl1/engine/impl/OcclusionQueryOGL.h
index ec264e48752..19f2e2f8428 100644
--- a/engines/hpl1/engine/impl/OcclusionQueryOGL.h
+++ b/engines/hpl1/engine/impl/OcclusionQueryOGL.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_OCCLUSION_QUERY_OGL_H
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index 5f62e2856d9..0647b55d8e6 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/OpenALSoundChannel.h"
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.h b/engines/hpl1/engine/impl/OpenALSoundChannel.h
index ecdfd3b7407..e6789e44c6f 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.h
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_OPENAL_SOUND_CHANNEL_H
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.cpp b/engines/hpl1/engine/impl/OpenALSoundData.cpp
index 69c9525c294..ce5c10e5b66 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundData.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/OpenALSoundData.h"
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.h b/engines/hpl1/engine/impl/OpenALSoundData.h
index 243685c3406..8e307c84512 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.h
+++ b/engines/hpl1/engine/impl/OpenALSoundData.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_OPENAL_SOUND_DATA_H
diff --git a/engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp b/engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
index 6a0ee97c9ca..9a120874a89 100644
--- a/engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/OpenALSoundEnvironment.h"
diff --git a/engines/hpl1/engine/impl/OpenALSoundEnvironment.h b/engines/hpl1/engine/impl/OpenALSoundEnvironment.h
index d2b344ea188..cc223085566 100644
--- a/engines/hpl1/engine/impl/OpenALSoundEnvironment.h
+++ b/engines/hpl1/engine/impl/OpenALSoundEnvironment.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_OPENALSOUNDENVIRONMENT_H
diff --git a/engines/hpl1/engine/impl/PBuffer.cpp b/engines/hpl1/engine/impl/PBuffer.cpp
index ece8f2b1b4b..659ad0325de 100644
--- a/engines/hpl1/engine/impl/PBuffer.cpp
+++ b/engines/hpl1/engine/impl/PBuffer.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#if 0
diff --git a/engines/hpl1/engine/impl/PBuffer.h b/engines/hpl1/engine/impl/PBuffer.h
index ed0e5359579..69d3cc732d9 100644
--- a/engines/hpl1/engine/impl/PBuffer.h
+++ b/engines/hpl1/engine/impl/PBuffer.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#if 0
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
index 782cf95448c..981ed7fe3ab 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/PhysicsBodyNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.h b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
index 46c0c465f9f..38a2c026604 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_BODY_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsControllerNewton.cpp b/engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
index a4ec9d8bc9d..50ee3988aa4 100644
--- a/engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/PhysicsControllerNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsControllerNewton.h b/engines/hpl1/engine/impl/PhysicsControllerNewton.h
index 64428f917e6..875fb1dfd91 100644
--- a/engines/hpl1/engine/impl/PhysicsControllerNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsControllerNewton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_CONTROLLER_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
index 9878d9250ad..d10daa04080 100644
--- a/engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/PhysicsJointBallNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsJointBallNewton.h b/engines/hpl1/engine/impl/PhysicsJointBallNewton.h
index e635b579157..4fe160cf847 100644
--- a/engines/hpl1/engine/impl/PhysicsJointBallNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointBallNewton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_JOINT_BALL_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
index ee54d55d91c..0bd42693f31 100644
--- a/engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/PhysicsJointHingeNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsJointHingeNewton.h b/engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
index f4d93b12618..f7964a95960 100644
--- a/engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_JOINT_HINGE_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointNewton.h b/engines/hpl1/engine/impl/PhysicsJointNewton.h
index 55863b96ca8..511fa0be35f 100644
--- a/engines/hpl1/engine/impl/PhysicsJointNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointNewton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_JOINT_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
index 23dd1453649..693b5d532e9 100644
--- a/engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/PhysicsJointScrewNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsJointScrewNewton.h b/engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
index f87d1c72040..99c8c73c2ac 100644
--- a/engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_JOINT_SCREW_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
index 5d7d8ed5bb3..30c91bf175f 100644
--- a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/PhysicsJointSliderNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.h b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
index 09b7734f9ea..01769da7158 100644
--- a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_JOINT_SLIDER_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
index 7ef53a88ee0..ce505696b1a 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/PhysicsMaterialNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.h b/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
index 6c709f05dda..8939e8cb79c 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_MATERIAL_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
index 3c7a883bf80..66ecb9088b9 100644
--- a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsWorldNewton.h b/engines/hpl1/engine/impl/PhysicsWorldNewton.h
index 8136f3fd134..89110efbd1f 100644
--- a/engines/hpl1/engine/impl/PhysicsWorldNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsWorldNewton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_WORLD_NEWTON_H
diff --git a/engines/hpl1/engine/impl/Platform.h b/engines/hpl1/engine/impl/Platform.h
index c537191df35..9186050b14a 100644
--- a/engines/hpl1/engine/impl/Platform.h
+++ b/engines/hpl1/engine/impl/Platform.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLATFORM_H_
diff --git a/engines/hpl1/engine/impl/SDLBitmap2D.cpp b/engines/hpl1/engine/impl/SDLBitmap2D.cpp
index 6fb64cceed3..78201cc8b39 100644
--- a/engines/hpl1/engine/impl/SDLBitmap2D.cpp
+++ b/engines/hpl1/engine/impl/SDLBitmap2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/SDLBitmap2D.h"
diff --git a/engines/hpl1/engine/impl/SDLBitmap2D.h b/engines/hpl1/engine/impl/SDLBitmap2D.h
index ed537d1730c..f5a6142d35d 100644
--- a/engines/hpl1/engine/impl/SDLBitmap2D.h
+++ b/engines/hpl1/engine/impl/SDLBitmap2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SDL_BITMAP2D_H
diff --git a/engines/hpl1/engine/impl/SDLFontData.cpp b/engines/hpl1/engine/impl/SDLFontData.cpp
index 2af987a4350..094da30a65b 100644
--- a/engines/hpl1/engine/impl/SDLFontData.cpp
+++ b/engines/hpl1/engine/impl/SDLFontData.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/SDLFontData.h"
diff --git a/engines/hpl1/engine/impl/SDLFontData.h b/engines/hpl1/engine/impl/SDLFontData.h
index e407715258a..bb275bf40d2 100644
--- a/engines/hpl1/engine/impl/SDLFontData.h
+++ b/engines/hpl1/engine/impl/SDLFontData.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SDL_FONTDATA_H
diff --git a/engines/hpl1/engine/impl/SDLGameSetup.cpp b/engines/hpl1/engine/impl/SDLGameSetup.cpp
index c7ca58eb469..de6172cb984 100644
--- a/engines/hpl1/engine/impl/SDLGameSetup.cpp
+++ b/engines/hpl1/engine/impl/SDLGameSetup.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#if 0 // def WIN32
diff --git a/engines/hpl1/engine/impl/SDLGameSetup.h b/engines/hpl1/engine/impl/SDLGameSetup.h
index 961d0605ec6..45d3f493fcd 100644
--- a/engines/hpl1/engine/impl/SDLGameSetup.h
+++ b/engines/hpl1/engine/impl/SDLGameSetup.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SDL_GAMESETUP_H
diff --git a/engines/hpl1/engine/impl/SDLPixelFormat.h b/engines/hpl1/engine/impl/SDLPixelFormat.h
index 96bf8d5d1f3..27a8b027e75 100644
--- a/engines/hpl1/engine/impl/SDLPixelFormat.h
+++ b/engines/hpl1/engine/impl/SDLPixelFormat.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SDL_PIXELFORMAT_H
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index 4b144236075..a53398bf30c 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/SDLTexture.h"
diff --git a/engines/hpl1/engine/impl/SDLTexture.h b/engines/hpl1/engine/impl/SDLTexture.h
index 603ab2f7441..1b772f8cf67 100644
--- a/engines/hpl1/engine/impl/SDLTexture.h
+++ b/engines/hpl1/engine/impl/SDLTexture.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SDL_TEXTURE_H
diff --git a/engines/hpl1/engine/impl/SqScript.cpp b/engines/hpl1/engine/impl/SqScript.cpp
index 4eece8f59f4..2981437645c 100644
--- a/engines/hpl1/engine/impl/SqScript.cpp
+++ b/engines/hpl1/engine/impl/SqScript.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/SqScript.h"
diff --git a/engines/hpl1/engine/impl/SqScript.h b/engines/hpl1/engine/impl/SqScript.h
index 36b00eda49c..3d80a8b01ff 100644
--- a/engines/hpl1/engine/impl/SqScript.h
+++ b/engines/hpl1/engine/impl/SqScript.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SQ_SCRIPT_H
diff --git a/engines/hpl1/engine/impl/VertexBufferOGL.cpp b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
index e02638e5d98..84fad7c6d13 100644
--- a/engines/hpl1/engine/impl/VertexBufferOGL.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/VertexBufferOGL.h"
diff --git a/engines/hpl1/engine/impl/VertexBufferOGL.h b/engines/hpl1/engine/impl/VertexBufferOGL.h
index 92126a04761..3470fabbb36 100644
--- a/engines/hpl1/engine/impl/VertexBufferOGL.h
+++ b/engines/hpl1/engine/impl/VertexBufferOGL.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_VERTEXBUFFER_OGL_H
diff --git a/engines/hpl1/engine/impl/VertexBufferVBO.cpp b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
index 7bfe18ff5ee..6b754f369b8 100644
--- a/engines/hpl1/engine/impl/VertexBufferVBO.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/impl/VertexBufferVBO.h"
diff --git a/engines/hpl1/engine/impl/VertexBufferVBO.h b/engines/hpl1/engine/impl/VertexBufferVBO.h
index 6bb43928443..2842a7b877a 100644
--- a/engines/hpl1/engine/impl/VertexBufferVBO.h
+++ b/engines/hpl1/engine/impl/VertexBufferVBO.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_VERTEXBUFFER_VBO_H
diff --git a/engines/hpl1/engine/impl/VideoStreamTheora.cpp b/engines/hpl1/engine/impl/VideoStreamTheora.cpp
index b999cc79f20..641417b42c6 100644
--- a/engines/hpl1/engine/impl/VideoStreamTheora.cpp
+++ b/engines/hpl1/engine/impl/VideoStreamTheora.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#if 0
diff --git a/engines/hpl1/engine/impl/VideoStreamTheora.h b/engines/hpl1/engine/impl/VideoStreamTheora.h
index 0d7e3991de4..ea554808824 100644
--- a/engines/hpl1/engine/impl/VideoStreamTheora.h
+++ b/engines/hpl1/engine/impl/VideoStreamTheora.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#if 0 // ndef HPL_VIDEO_STREAM_THEORA_H
diff --git a/engines/hpl1/engine/input/Action.cpp b/engines/hpl1/engine/input/Action.cpp
index 438246bb93c..7a2eef8c926 100644
--- a/engines/hpl1/engine/input/Action.cpp
+++ b/engines/hpl1/engine/input/Action.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/input/Action.h"
diff --git a/engines/hpl1/engine/input/Action.h b/engines/hpl1/engine/input/Action.h
index 7e3ae351f62..877b5c5936f 100644
--- a/engines/hpl1/engine/input/Action.h
+++ b/engines/hpl1/engine/input/Action.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_ACTION_H
diff --git a/engines/hpl1/engine/input/ActionHaptic.cpp b/engines/hpl1/engine/input/ActionHaptic.cpp
index 1399c7b3d5c..695e3987ae9 100644
--- a/engines/hpl1/engine/input/ActionHaptic.cpp
+++ b/engines/hpl1/engine/input/ActionHaptic.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/input/ActionHaptic.h"
diff --git a/engines/hpl1/engine/input/ActionHaptic.h b/engines/hpl1/engine/input/ActionHaptic.h
index 2678cafdcba..7c5931586c0 100644
--- a/engines/hpl1/engine/input/ActionHaptic.h
+++ b/engines/hpl1/engine/input/ActionHaptic.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_ACTION_HAPTIC_H
diff --git a/engines/hpl1/engine/input/ActionKeyboard.cpp b/engines/hpl1/engine/input/ActionKeyboard.cpp
index 64ddf127b75..30d92661ac5 100644
--- a/engines/hpl1/engine/input/ActionKeyboard.cpp
+++ b/engines/hpl1/engine/input/ActionKeyboard.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/input/ActionKeyboard.h"
diff --git a/engines/hpl1/engine/input/ActionKeyboard.h b/engines/hpl1/engine/input/ActionKeyboard.h
index c62ef2834df..1b81be9b8f2 100644
--- a/engines/hpl1/engine/input/ActionKeyboard.h
+++ b/engines/hpl1/engine/input/ActionKeyboard.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_ACTIONKEYBOARD_H
diff --git a/engines/hpl1/engine/input/ActionMouseButton.cpp b/engines/hpl1/engine/input/ActionMouseButton.cpp
index c6439b68792..9386514acf0 100644
--- a/engines/hpl1/engine/input/ActionMouseButton.cpp
+++ b/engines/hpl1/engine/input/ActionMouseButton.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/input/ActionMouseButton.h"
diff --git a/engines/hpl1/engine/input/ActionMouseButton.h b/engines/hpl1/engine/input/ActionMouseButton.h
index 8861836daf6..34706bda324 100644
--- a/engines/hpl1/engine/input/ActionMouseButton.h
+++ b/engines/hpl1/engine/input/ActionMouseButton.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_ACTIONMOUSEBUTTON_H
diff --git a/engines/hpl1/engine/input/Input.cpp b/engines/hpl1/engine/input/Input.cpp
index 508ec1d3675..74553831cb6 100644
--- a/engines/hpl1/engine/input/Input.cpp
+++ b/engines/hpl1/engine/input/Input.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/input/Input.h"
diff --git a/engines/hpl1/engine/input/Input.h b/engines/hpl1/engine/input/Input.h
index c53d4f10d7d..ed24c4b1c6c 100644
--- a/engines/hpl1/engine/input/Input.h
+++ b/engines/hpl1/engine/input/Input.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_INPUT_H
diff --git a/engines/hpl1/engine/input/InputDevice.cpp b/engines/hpl1/engine/input/InputDevice.cpp
index 93acc374d45..160668aa76b 100644
--- a/engines/hpl1/engine/input/InputDevice.cpp
+++ b/engines/hpl1/engine/input/InputDevice.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/input/InputDevice.h"
diff --git a/engines/hpl1/engine/input/InputDevice.h b/engines/hpl1/engine/input/InputDevice.h
index 08ca7102acc..50b0b07ed35 100644
--- a/engines/hpl1/engine/input/InputDevice.h
+++ b/engines/hpl1/engine/input/InputDevice.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_INPUTDEVICE_H
diff --git a/engines/hpl1/engine/input/InputTypes.h b/engines/hpl1/engine/input/InputTypes.h
index 0ff0eb88dc9..3eb40f1d1e2 100644
--- a/engines/hpl1/engine/input/InputTypes.h
+++ b/engines/hpl1/engine/input/InputTypes.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_INPUT_TYPES_H
diff --git a/engines/hpl1/engine/input/Keyboard.cpp b/engines/hpl1/engine/input/Keyboard.cpp
index 7b94f8e713c..ea9e37751ab 100644
--- a/engines/hpl1/engine/input/Keyboard.cpp
+++ b/engines/hpl1/engine/input/Keyboard.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/input/Keyboard.h"
diff --git a/engines/hpl1/engine/input/Keyboard.h b/engines/hpl1/engine/input/Keyboard.h
index bec258f766e..4535d581c95 100644
--- a/engines/hpl1/engine/input/Keyboard.h
+++ b/engines/hpl1/engine/input/Keyboard.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_KEYBOARD_H
diff --git a/engines/hpl1/engine/input/LowLevelInput.h b/engines/hpl1/engine/input/LowLevelInput.h
index 55314288b8c..9b592f05ba0 100644
--- a/engines/hpl1/engine/input/LowLevelInput.h
+++ b/engines/hpl1/engine/input/LowLevelInput.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOWLEVELINPUT_H
diff --git a/engines/hpl1/engine/input/Mouse.cpp b/engines/hpl1/engine/input/Mouse.cpp
index 043e76f6275..c97723a4ab7 100644
--- a/engines/hpl1/engine/input/Mouse.cpp
+++ b/engines/hpl1/engine/input/Mouse.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/input/Mouse.h"
diff --git a/engines/hpl1/engine/input/Mouse.h b/engines/hpl1/engine/input/Mouse.h
index ff9f78efe11..7d98a4a72ac 100644
--- a/engines/hpl1/engine/input/Mouse.h
+++ b/engines/hpl1/engine/input/Mouse.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MOUSE_H
diff --git a/engines/hpl1/engine/math/BoundingVolume.cpp b/engines/hpl1/engine/math/BoundingVolume.cpp
index cfaa9c2840b..e9efbe7999b 100644
--- a/engines/hpl1/engine/math/BoundingVolume.cpp
+++ b/engines/hpl1/engine/math/BoundingVolume.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/math/BoundingVolume.h"
diff --git a/engines/hpl1/engine/math/BoundingVolume.h b/engines/hpl1/engine/math/BoundingVolume.h
index 1637b8b749f..e5c55f0bd5f 100644
--- a/engines/hpl1/engine/math/BoundingVolume.h
+++ b/engines/hpl1/engine/math/BoundingVolume.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_BOUNDING_VOLUME_H
diff --git a/engines/hpl1/engine/math/CRC.cpp b/engines/hpl1/engine/math/CRC.cpp
index 2a0bbb628fd..78aab5b374f 100644
--- a/engines/hpl1/engine/math/CRC.cpp
+++ b/engines/hpl1/engine/math/CRC.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/math/CRC.h"
diff --git a/engines/hpl1/engine/math/CRC.h b/engines/hpl1/engine/math/CRC.h
index 89a46d5d980..aa50ba1316e 100644
--- a/engines/hpl1/engine/math/CRC.h
+++ b/engines/hpl1/engine/math/CRC.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_CRC_H
diff --git a/engines/hpl1/engine/math/Frustum.cpp b/engines/hpl1/engine/math/Frustum.cpp
index a8c8d7129b6..46aa0af0a0b 100644
--- a/engines/hpl1/engine/math/Frustum.cpp
+++ b/engines/hpl1/engine/math/Frustum.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/math/Frustum.h"
diff --git a/engines/hpl1/engine/math/Frustum.h b/engines/hpl1/engine/math/Frustum.h
index 9fc44b7fc1c..4680c5c3552 100644
--- a/engines/hpl1/engine/math/Frustum.h
+++ b/engines/hpl1/engine/math/Frustum.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_FRUSTUM_H
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index 27152278a2f..d115ec135ad 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
diff --git a/engines/hpl1/engine/math/Math.h b/engines/hpl1/engine/math/Math.h
index ec9449fbe89..ca13ec56cba 100644
--- a/engines/hpl1/engine/math/Math.h
+++ b/engines/hpl1/engine/math/Math.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATH_H
diff --git a/engines/hpl1/engine/math/MathTypes.cpp b/engines/hpl1/engine/math/MathTypes.cpp
index d968016ee5f..dd2b281de52 100644
--- a/engines/hpl1/engine/math/MathTypes.cpp
+++ b/engines/hpl1/engine/math/MathTypes.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/math/MathTypes.h"
diff --git a/engines/hpl1/engine/math/MathTypes.h b/engines/hpl1/engine/math/MathTypes.h
index 69a5c23871c..496b0cd99a0 100644
--- a/engines/hpl1/engine/math/MathTypes.h
+++ b/engines/hpl1/engine/math/MathTypes.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATHTYPES_H
diff --git a/engines/hpl1/engine/math/Matrix.h b/engines/hpl1/engine/math/Matrix.h
index c9b36effac2..b28ce41d1af 100644
--- a/engines/hpl1/engine/math/Matrix.h
+++ b/engines/hpl1/engine/math/Matrix.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATRIX_H
diff --git a/engines/hpl1/engine/math/MeshTypes.cpp b/engines/hpl1/engine/math/MeshTypes.cpp
index 34a0af5c0bd..f67818ef7f1 100644
--- a/engines/hpl1/engine/math/MeshTypes.cpp
+++ b/engines/hpl1/engine/math/MeshTypes.cpp
@@ -23,17 +23,4 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
diff --git a/engines/hpl1/engine/math/MeshTypes.h b/engines/hpl1/engine/math/MeshTypes.h
index 8cfb4b4add4..bdbd4f5973f 100644
--- a/engines/hpl1/engine/math/MeshTypes.h
+++ b/engines/hpl1/engine/math/MeshTypes.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MESH_TYPES_H
diff --git a/engines/hpl1/engine/math/PidController.h b/engines/hpl1/engine/math/PidController.h
index f7e9248827a..674d261f711 100644
--- a/engines/hpl1/engine/math/PidController.h
+++ b/engines/hpl1/engine/math/PidController.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PID_CONTROLLER_H
diff --git a/engines/hpl1/engine/math/Quaternion.cpp b/engines/hpl1/engine/math/Quaternion.cpp
index cb75e92b07b..5ee1eed940e 100644
--- a/engines/hpl1/engine/math/Quaternion.cpp
+++ b/engines/hpl1/engine/math/Quaternion.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/math/Quaternion.h"
diff --git a/engines/hpl1/engine/math/Quaternion.h b/engines/hpl1/engine/math/Quaternion.h
index 68341ecf1d8..dd73b941650 100644
--- a/engines/hpl1/engine/math/Quaternion.h
+++ b/engines/hpl1/engine/math/Quaternion.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_QUATERNION_H
diff --git a/engines/hpl1/engine/math/Spring.cpp b/engines/hpl1/engine/math/Spring.cpp
index a8a0a15049e..697a8c912a6 100644
--- a/engines/hpl1/engine/math/Spring.cpp
+++ b/engines/hpl1/engine/math/Spring.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/math/Spring.h"
diff --git a/engines/hpl1/engine/math/Spring.h b/engines/hpl1/engine/math/Spring.h
index 5e284b29bc7..b911fd36f76 100644
--- a/engines/hpl1/engine/math/Spring.h
+++ b/engines/hpl1/engine/math/Spring.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SPRING_H
diff --git a/engines/hpl1/engine/math/Vector2.h b/engines/hpl1/engine/math/Vector2.h
index 3a87944867d..a9d785b83b8 100644
--- a/engines/hpl1/engine/math/Vector2.h
+++ b/engines/hpl1/engine/math/Vector2.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_VECTOR2_H
diff --git a/engines/hpl1/engine/math/Vector3.h b/engines/hpl1/engine/math/Vector3.h
index faa95e1be65..f652ea861c4 100644
--- a/engines/hpl1/engine/math/Vector3.h
+++ b/engines/hpl1/engine/math/Vector3.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_VECTOR3_H
diff --git a/engines/hpl1/engine/physics/Body2D.cpp b/engines/hpl1/engine/physics/Body2D.cpp
index 44b678c141b..cf4e76210f2 100644
--- a/engines/hpl1/engine/physics/Body2D.cpp
+++ b/engines/hpl1/engine/physics/Body2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/Body2D.h"
diff --git a/engines/hpl1/engine/physics/Body2D.h b/engines/hpl1/engine/physics/Body2D.h
index bc79e92fcd6..0b49b0007a4 100644
--- a/engines/hpl1/engine/physics/Body2D.h
+++ b/engines/hpl1/engine/physics/Body2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_BODY_H
diff --git a/engines/hpl1/engine/physics/CharacterBody.cpp b/engines/hpl1/engine/physics/CharacterBody.cpp
index c80b28c379a..9b80f3e1145 100644
--- a/engines/hpl1/engine/physics/CharacterBody.cpp
+++ b/engines/hpl1/engine/physics/CharacterBody.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/CharacterBody.h"
diff --git a/engines/hpl1/engine/physics/CharacterBody.h b/engines/hpl1/engine/physics/CharacterBody.h
index 8fbafb5d216..1d9589805bf 100644
--- a/engines/hpl1/engine/physics/CharacterBody.h
+++ b/engines/hpl1/engine/physics/CharacterBody.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_CHARACTER_BODY_H
diff --git a/engines/hpl1/engine/physics/CollideData.h b/engines/hpl1/engine/physics/CollideData.h
index 4e09a15ae6b..dd17ef3a670 100644
--- a/engines/hpl1/engine/physics/CollideData.h
+++ b/engines/hpl1/engine/physics/CollideData.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_COLLIDE_DATA_H
diff --git a/engines/hpl1/engine/physics/CollideData2D.h b/engines/hpl1/engine/physics/CollideData2D.h
index bfcb45c5e52..0d56d651ee8 100644
--- a/engines/hpl1/engine/physics/CollideData2D.h
+++ b/engines/hpl1/engine/physics/CollideData2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_COLLIDE_DATA_2D_H
diff --git a/engines/hpl1/engine/physics/CollideShape.h b/engines/hpl1/engine/physics/CollideShape.h
index 4fe25a68385..35c0abb6a2a 100644
--- a/engines/hpl1/engine/physics/CollideShape.h
+++ b/engines/hpl1/engine/physics/CollideShape.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_COLLIDE_SHAPE_H
diff --git a/engines/hpl1/engine/physics/Collider2D.cpp b/engines/hpl1/engine/physics/Collider2D.cpp
index b4b6eeb07f5..dd9bb21898b 100644
--- a/engines/hpl1/engine/physics/Collider2D.cpp
+++ b/engines/hpl1/engine/physics/Collider2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/Collider2D.h"
diff --git a/engines/hpl1/engine/physics/Collider2D.h b/engines/hpl1/engine/physics/Collider2D.h
index 94f39393375..e7d93e28c8f 100644
--- a/engines/hpl1/engine/physics/Collider2D.h
+++ b/engines/hpl1/engine/physics/Collider2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_COLLIDER2D_H
diff --git a/engines/hpl1/engine/physics/LowLevelPhysics.h b/engines/hpl1/engine/physics/LowLevelPhysics.h
index d9fb92196d0..b784e629b1f 100644
--- a/engines/hpl1/engine/physics/LowLevelPhysics.h
+++ b/engines/hpl1/engine/physics/LowLevelPhysics.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOWLEVELPHYSICS_H
diff --git a/engines/hpl1/engine/physics/Physics.cpp b/engines/hpl1/engine/physics/Physics.cpp
index b7e7eaa628d..5bd09dfd801 100644
--- a/engines/hpl1/engine/physics/Physics.cpp
+++ b/engines/hpl1/engine/physics/Physics.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/Physics.h"
diff --git a/engines/hpl1/engine/physics/Physics.h b/engines/hpl1/engine/physics/Physics.h
index c4e60deaa8f..0230baa0a80 100644
--- a/engines/hpl1/engine/physics/Physics.h
+++ b/engines/hpl1/engine/physics/Physics.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_Physics_H
diff --git a/engines/hpl1/engine/physics/PhysicsBody.cpp b/engines/hpl1/engine/physics/PhysicsBody.cpp
index aec81f811b2..79dfb0b4d94 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.cpp
+++ b/engines/hpl1/engine/physics/PhysicsBody.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/PhysicsBody.h"
diff --git a/engines/hpl1/engine/physics/PhysicsBody.h b/engines/hpl1/engine/physics/PhysicsBody.h
index 6a8c2f1ed5f..8468f697109 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.h
+++ b/engines/hpl1/engine/physics/PhysicsBody.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_BODY_H
diff --git a/engines/hpl1/engine/physics/PhysicsController.cpp b/engines/hpl1/engine/physics/PhysicsController.cpp
index 3f22eb8b2de..678d7ded877 100644
--- a/engines/hpl1/engine/physics/PhysicsController.cpp
+++ b/engines/hpl1/engine/physics/PhysicsController.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/PhysicsController.h"
diff --git a/engines/hpl1/engine/physics/PhysicsController.h b/engines/hpl1/engine/physics/PhysicsController.h
index 580088faa0d..48634fa822d 100644
--- a/engines/hpl1/engine/physics/PhysicsController.h
+++ b/engines/hpl1/engine/physics/PhysicsController.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_CONTROLLER_H
diff --git a/engines/hpl1/engine/physics/PhysicsJoint.cpp b/engines/hpl1/engine/physics/PhysicsJoint.cpp
index cf0b0dddfb4..932dc4a2d90 100644
--- a/engines/hpl1/engine/physics/PhysicsJoint.cpp
+++ b/engines/hpl1/engine/physics/PhysicsJoint.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/PhysicsJoint.h"
diff --git a/engines/hpl1/engine/physics/PhysicsJoint.h b/engines/hpl1/engine/physics/PhysicsJoint.h
index 27167c0c1d2..5818bf48d15 100644
--- a/engines/hpl1/engine/physics/PhysicsJoint.h
+++ b/engines/hpl1/engine/physics/PhysicsJoint.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_JOINT_H
diff --git a/engines/hpl1/engine/physics/PhysicsJointBall.cpp b/engines/hpl1/engine/physics/PhysicsJointBall.cpp
index 0605a97b5b7..37c6538cc29 100644
--- a/engines/hpl1/engine/physics/PhysicsJointBall.cpp
+++ b/engines/hpl1/engine/physics/PhysicsJointBall.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/PhysicsJointBall.h"
diff --git a/engines/hpl1/engine/physics/PhysicsJointBall.h b/engines/hpl1/engine/physics/PhysicsJointBall.h
index a78fcc8ef92..730e6f35dfc 100644
--- a/engines/hpl1/engine/physics/PhysicsJointBall.h
+++ b/engines/hpl1/engine/physics/PhysicsJointBall.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_JOINT_BALL_H
diff --git a/engines/hpl1/engine/physics/PhysicsJointHinge.cpp b/engines/hpl1/engine/physics/PhysicsJointHinge.cpp
index aa0a6d3935b..ddf15fced8e 100644
--- a/engines/hpl1/engine/physics/PhysicsJointHinge.cpp
+++ b/engines/hpl1/engine/physics/PhysicsJointHinge.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/PhysicsJointHinge.h"
diff --git a/engines/hpl1/engine/physics/PhysicsJointHinge.h b/engines/hpl1/engine/physics/PhysicsJointHinge.h
index 3d445eab0b0..b459880a892 100644
--- a/engines/hpl1/engine/physics/PhysicsJointHinge.h
+++ b/engines/hpl1/engine/physics/PhysicsJointHinge.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_JOINT_HINGE_H
diff --git a/engines/hpl1/engine/physics/PhysicsJointScrew.cpp b/engines/hpl1/engine/physics/PhysicsJointScrew.cpp
index a745462b299..a7b8cec5c09 100644
--- a/engines/hpl1/engine/physics/PhysicsJointScrew.cpp
+++ b/engines/hpl1/engine/physics/PhysicsJointScrew.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/PhysicsJointScrew.h"
diff --git a/engines/hpl1/engine/physics/PhysicsJointScrew.h b/engines/hpl1/engine/physics/PhysicsJointScrew.h
index a99254cbcc6..c74e3a5d54a 100644
--- a/engines/hpl1/engine/physics/PhysicsJointScrew.h
+++ b/engines/hpl1/engine/physics/PhysicsJointScrew.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_JOINT_SCREW_H
diff --git a/engines/hpl1/engine/physics/PhysicsJointSlider.cpp b/engines/hpl1/engine/physics/PhysicsJointSlider.cpp
index 7e2424ac71b..4f3b46cce86 100644
--- a/engines/hpl1/engine/physics/PhysicsJointSlider.cpp
+++ b/engines/hpl1/engine/physics/PhysicsJointSlider.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/PhysicsJointSlider.h"
diff --git a/engines/hpl1/engine/physics/PhysicsJointSlider.h b/engines/hpl1/engine/physics/PhysicsJointSlider.h
index 1691d020669..006bcb1ff96 100644
--- a/engines/hpl1/engine/physics/PhysicsJointSlider.h
+++ b/engines/hpl1/engine/physics/PhysicsJointSlider.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_JOINT_SLIDER_H
diff --git a/engines/hpl1/engine/physics/PhysicsMaterial.h b/engines/hpl1/engine/physics/PhysicsMaterial.h
index e0bfc80887e..448ab073c80 100644
--- a/engines/hpl1/engine/physics/PhysicsMaterial.h
+++ b/engines/hpl1/engine/physics/PhysicsMaterial.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_MATERIAL_H
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.cpp b/engines/hpl1/engine/physics/PhysicsWorld.cpp
index e7cf5a014bd..5f8356cfe8f 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.cpp
+++ b/engines/hpl1/engine/physics/PhysicsWorld.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/PhysicsWorld.h"
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.h b/engines/hpl1/engine/physics/PhysicsWorld.h
index 591815b5e20..dad546d8841 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.h
+++ b/engines/hpl1/engine/physics/PhysicsWorld.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PHYSICS_WORLD_H
diff --git a/engines/hpl1/engine/physics/SurfaceData.cpp b/engines/hpl1/engine/physics/SurfaceData.cpp
index 81dcedfe29b..069b79e5803 100644
--- a/engines/hpl1/engine/physics/SurfaceData.cpp
+++ b/engines/hpl1/engine/physics/SurfaceData.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/physics/SurfaceData.h"
diff --git a/engines/hpl1/engine/physics/SurfaceData.h b/engines/hpl1/engine/physics/SurfaceData.h
index 00d8237550b..36b417ef107 100644
--- a/engines/hpl1/engine/physics/SurfaceData.h
+++ b/engines/hpl1/engine/physics/SurfaceData.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SURFACE_DATA_H
diff --git a/engines/hpl1/engine/resources/AnimationManager.cpp b/engines/hpl1/engine/resources/AnimationManager.cpp
index ada2777456d..ceb6b07c200 100644
--- a/engines/hpl1/engine/resources/AnimationManager.cpp
+++ b/engines/hpl1/engine/resources/AnimationManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/AnimationManager.h"
diff --git a/engines/hpl1/engine/resources/AnimationManager.h b/engines/hpl1/engine/resources/AnimationManager.h
index 14c997bcc01..810ca7898d3 100644
--- a/engines/hpl1/engine/resources/AnimationManager.h
+++ b/engines/hpl1/engine/resources/AnimationManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_ANIMATION_MANAGER_H
diff --git a/engines/hpl1/engine/resources/ConfigFile.cpp b/engines/hpl1/engine/resources/ConfigFile.cpp
index cd5059c0dd0..cd48deac290 100644
--- a/engines/hpl1/engine/resources/ConfigFile.cpp
+++ b/engines/hpl1/engine/resources/ConfigFile.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/ConfigFile.h"
diff --git a/engines/hpl1/engine/resources/ConfigFile.h b/engines/hpl1/engine/resources/ConfigFile.h
index 04c14288239..63e4461b62c 100644
--- a/engines/hpl1/engine/resources/ConfigFile.h
+++ b/engines/hpl1/engine/resources/ConfigFile.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_CONFIGFILE_H
diff --git a/engines/hpl1/engine/resources/EntityLoader_Object.cpp b/engines/hpl1/engine/resources/EntityLoader_Object.cpp
index 328f8524e3d..3c8b8dd4f53 100644
--- a/engines/hpl1/engine/resources/EntityLoader_Object.cpp
+++ b/engines/hpl1/engine/resources/EntityLoader_Object.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/EntityLoader_Object.h"
diff --git a/engines/hpl1/engine/resources/EntityLoader_Object.h b/engines/hpl1/engine/resources/EntityLoader_Object.h
index 032d2bde5f3..2ffe1bbdcfd 100644
--- a/engines/hpl1/engine/resources/EntityLoader_Object.h
+++ b/engines/hpl1/engine/resources/EntityLoader_Object.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_ENTITY_LOADER_OBJECT_H
diff --git a/engines/hpl1/engine/resources/FileSearcher.cpp b/engines/hpl1/engine/resources/FileSearcher.cpp
index 5508379c395..cd17b23b84a 100644
--- a/engines/hpl1/engine/resources/FileSearcher.cpp
+++ b/engines/hpl1/engine/resources/FileSearcher.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/FileSearcher.h"
diff --git a/engines/hpl1/engine/resources/FileSearcher.h b/engines/hpl1/engine/resources/FileSearcher.h
index 00cc869c536..0b1ce17ce46 100644
--- a/engines/hpl1/engine/resources/FileSearcher.h
+++ b/engines/hpl1/engine/resources/FileSearcher.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_FILESEARCHER_H
diff --git a/engines/hpl1/engine/resources/FontManager.cpp b/engines/hpl1/engine/resources/FontManager.cpp
index 88215688818..c80f6089f39 100644
--- a/engines/hpl1/engine/resources/FontManager.cpp
+++ b/engines/hpl1/engine/resources/FontManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/FontManager.h"
diff --git a/engines/hpl1/engine/resources/FontManager.h b/engines/hpl1/engine/resources/FontManager.h
index 6021079e708..d26fa657c4e 100644
--- a/engines/hpl1/engine/resources/FontManager.h
+++ b/engines/hpl1/engine/resources/FontManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_FONT_MANAGER_H
diff --git a/engines/hpl1/engine/resources/FrameBase.h b/engines/hpl1/engine/resources/FrameBase.h
index 93cfaccdba7..6996b506ddd 100644
--- a/engines/hpl1/engine/resources/FrameBase.h
+++ b/engines/hpl1/engine/resources/FrameBase.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_FRAMEBASE_H
diff --git a/engines/hpl1/engine/resources/FrameBitmap.cpp b/engines/hpl1/engine/resources/FrameBitmap.cpp
index 71f35829117..c49830dbbaa 100644
--- a/engines/hpl1/engine/resources/FrameBitmap.cpp
+++ b/engines/hpl1/engine/resources/FrameBitmap.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/FrameBitmap.h"
diff --git a/engines/hpl1/engine/resources/FrameBitmap.h b/engines/hpl1/engine/resources/FrameBitmap.h
index 67dbe9b685c..b5f5f711242 100644
--- a/engines/hpl1/engine/resources/FrameBitmap.h
+++ b/engines/hpl1/engine/resources/FrameBitmap.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_FRAMEBITMAP_H
diff --git a/engines/hpl1/engine/resources/FrameTexture.cpp b/engines/hpl1/engine/resources/FrameTexture.cpp
index 37d616c2fc0..4e96bdc8e7b 100644
--- a/engines/hpl1/engine/resources/FrameTexture.cpp
+++ b/engines/hpl1/engine/resources/FrameTexture.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/FrameTexture.h"
diff --git a/engines/hpl1/engine/resources/FrameTexture.h b/engines/hpl1/engine/resources/FrameTexture.h
index dcf79b6aca9..286c9a930cf 100644
--- a/engines/hpl1/engine/resources/FrameTexture.h
+++ b/engines/hpl1/engine/resources/FrameTexture.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_FRAMETEXTURE_H
diff --git a/engines/hpl1/engine/resources/GpuProgramManager.cpp b/engines/hpl1/engine/resources/GpuProgramManager.cpp
index d696df5d268..b09368422b8 100644
--- a/engines/hpl1/engine/resources/GpuProgramManager.cpp
+++ b/engines/hpl1/engine/resources/GpuProgramManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/GpuProgramManager.h"
diff --git a/engines/hpl1/engine/resources/GpuProgramManager.h b/engines/hpl1/engine/resources/GpuProgramManager.h
index e46ec9d9bcd..7247e7b0d43 100644
--- a/engines/hpl1/engine/resources/GpuProgramManager.h
+++ b/engines/hpl1/engine/resources/GpuProgramManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GPU_PROGRAM_MANAGER_H
diff --git a/engines/hpl1/engine/resources/ImageEntityManager.cpp b/engines/hpl1/engine/resources/ImageEntityManager.cpp
index d9c4402681b..ae61825cea0 100644
--- a/engines/hpl1/engine/resources/ImageEntityManager.cpp
+++ b/engines/hpl1/engine/resources/ImageEntityManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/ImageEntityManager.h"
diff --git a/engines/hpl1/engine/resources/ImageEntityManager.h b/engines/hpl1/engine/resources/ImageEntityManager.h
index 3eafd09692b..597f83761dc 100644
--- a/engines/hpl1/engine/resources/ImageEntityManager.h
+++ b/engines/hpl1/engine/resources/ImageEntityManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_IMAGE_ENTITY_MANAGER_H
diff --git a/engines/hpl1/engine/resources/ImageManager.cpp b/engines/hpl1/engine/resources/ImageManager.cpp
index 7edc846b802..0313f39db2f 100644
--- a/engines/hpl1/engine/resources/ImageManager.cpp
+++ b/engines/hpl1/engine/resources/ImageManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/ImageManager.h"
diff --git a/engines/hpl1/engine/resources/ImageManager.h b/engines/hpl1/engine/resources/ImageManager.h
index 3bb88083d73..e2cd84289b4 100644
--- a/engines/hpl1/engine/resources/ImageManager.h
+++ b/engines/hpl1/engine/resources/ImageManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_IMAGEMANAGER_H
diff --git a/engines/hpl1/engine/resources/LanguageFile.cpp b/engines/hpl1/engine/resources/LanguageFile.cpp
index a1a91fc1db2..d84166752c4 100644
--- a/engines/hpl1/engine/resources/LanguageFile.cpp
+++ b/engines/hpl1/engine/resources/LanguageFile.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/LanguageFile.h"
diff --git a/engines/hpl1/engine/resources/LanguageFile.h b/engines/hpl1/engine/resources/LanguageFile.h
index 4859c5bae4c..62df9b9e21f 100644
--- a/engines/hpl1/engine/resources/LanguageFile.h
+++ b/engines/hpl1/engine/resources/LanguageFile.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LANGUAGE_FILE_H
diff --git a/engines/hpl1/engine/resources/LowLevelResources.h b/engines/hpl1/engine/resources/LowLevelResources.h
index 5ae6fe8ec0e..efc1c22fc79 100644
--- a/engines/hpl1/engine/resources/LowLevelResources.h
+++ b/engines/hpl1/engine/resources/LowLevelResources.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LOWLEVELRESOURCES_H
diff --git a/engines/hpl1/engine/resources/MaterialManager.cpp b/engines/hpl1/engine/resources/MaterialManager.cpp
index a731ab12c44..d0b70bb9ef1 100644
--- a/engines/hpl1/engine/resources/MaterialManager.cpp
+++ b/engines/hpl1/engine/resources/MaterialManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/MaterialManager.h"
diff --git a/engines/hpl1/engine/resources/MaterialManager.h b/engines/hpl1/engine/resources/MaterialManager.h
index ee710137214..ac61726afeb 100644
--- a/engines/hpl1/engine/resources/MaterialManager.h
+++ b/engines/hpl1/engine/resources/MaterialManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MATERIAL_MANAGER_H
diff --git a/engines/hpl1/engine/resources/MeshLoader.h b/engines/hpl1/engine/resources/MeshLoader.h
index 6abdadcc75e..dafbfe367fa 100644
--- a/engines/hpl1/engine/resources/MeshLoader.h
+++ b/engines/hpl1/engine/resources/MeshLoader.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MESH_LOADER_H
diff --git a/engines/hpl1/engine/resources/MeshLoaderHandler.cpp b/engines/hpl1/engine/resources/MeshLoaderHandler.cpp
index c44d3c9722f..db10723a532 100644
--- a/engines/hpl1/engine/resources/MeshLoaderHandler.cpp
+++ b/engines/hpl1/engine/resources/MeshLoaderHandler.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/MeshLoaderHandler.h"
diff --git a/engines/hpl1/engine/resources/MeshLoaderHandler.h b/engines/hpl1/engine/resources/MeshLoaderHandler.h
index 26509572bd4..f5437e10feb 100644
--- a/engines/hpl1/engine/resources/MeshLoaderHandler.h
+++ b/engines/hpl1/engine/resources/MeshLoaderHandler.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MESH_LOADER_HANDLER_H
diff --git a/engines/hpl1/engine/resources/MeshManager.cpp b/engines/hpl1/engine/resources/MeshManager.cpp
index 37ca74c4e76..8730a71f899 100644
--- a/engines/hpl1/engine/resources/MeshManager.cpp
+++ b/engines/hpl1/engine/resources/MeshManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/MeshManager.h"
diff --git a/engines/hpl1/engine/resources/MeshManager.h b/engines/hpl1/engine/resources/MeshManager.h
index 8adef0be0de..bd6ec987540 100644
--- a/engines/hpl1/engine/resources/MeshManager.h
+++ b/engines/hpl1/engine/resources/MeshManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_MESH_MANAGER_H
diff --git a/engines/hpl1/engine/resources/ParticleManager.cpp b/engines/hpl1/engine/resources/ParticleManager.cpp
index d013650a10f..49deb89891d 100644
--- a/engines/hpl1/engine/resources/ParticleManager.cpp
+++ b/engines/hpl1/engine/resources/ParticleManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/ParticleManager.h"
diff --git a/engines/hpl1/engine/resources/ParticleManager.h b/engines/hpl1/engine/resources/ParticleManager.h
index 701ea8da366..f901092c877 100644
--- a/engines/hpl1/engine/resources/ParticleManager.h
+++ b/engines/hpl1/engine/resources/ParticleManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_PARTICLE_SYSTEM_MANAGER_H
diff --git a/engines/hpl1/engine/resources/ResourceBase.cpp b/engines/hpl1/engine/resources/ResourceBase.cpp
index 03603bdb972..76aaedf0c71 100644
--- a/engines/hpl1/engine/resources/ResourceBase.cpp
+++ b/engines/hpl1/engine/resources/ResourceBase.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/ResourceBase.h"
diff --git a/engines/hpl1/engine/resources/ResourceBase.h b/engines/hpl1/engine/resources/ResourceBase.h
index c9da770cd18..a6fdd943ab7 100644
--- a/engines/hpl1/engine/resources/ResourceBase.h
+++ b/engines/hpl1/engine/resources/ResourceBase.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_RESOURCEBASE_H
diff --git a/engines/hpl1/engine/resources/ResourceImage.cpp b/engines/hpl1/engine/resources/ResourceImage.cpp
index 74a5c1f8634..ae9bc6fa03d 100644
--- a/engines/hpl1/engine/resources/ResourceImage.cpp
+++ b/engines/hpl1/engine/resources/ResourceImage.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/ResourceImage.h"
diff --git a/engines/hpl1/engine/resources/ResourceImage.h b/engines/hpl1/engine/resources/ResourceImage.h
index 3802f08635f..da330c924e5 100644
--- a/engines/hpl1/engine/resources/ResourceImage.h
+++ b/engines/hpl1/engine/resources/ResourceImage.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_RESOURCE_IMAGE_H
diff --git a/engines/hpl1/engine/resources/ResourceManager.cpp b/engines/hpl1/engine/resources/ResourceManager.cpp
index 513d2a587ab..acb216674cf 100644
--- a/engines/hpl1/engine/resources/ResourceManager.cpp
+++ b/engines/hpl1/engine/resources/ResourceManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/ResourceManager.h"
diff --git a/engines/hpl1/engine/resources/ResourceManager.h b/engines/hpl1/engine/resources/ResourceManager.h
index a831800614d..f1ddd3006fc 100644
--- a/engines/hpl1/engine/resources/ResourceManager.h
+++ b/engines/hpl1/engine/resources/ResourceManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_RESOURCEMANAGER_H
diff --git a/engines/hpl1/engine/resources/Resources.cpp b/engines/hpl1/engine/resources/Resources.cpp
index 764acb9b4ea..cc6e00c3007 100644
--- a/engines/hpl1/engine/resources/Resources.cpp
+++ b/engines/hpl1/engine/resources/Resources.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/Resources.h"
diff --git a/engines/hpl1/engine/resources/Resources.h b/engines/hpl1/engine/resources/Resources.h
index 1daca3f53e6..a7a35a4e41e 100644
--- a/engines/hpl1/engine/resources/Resources.h
+++ b/engines/hpl1/engine/resources/Resources.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_RESOURCES_H
diff --git a/engines/hpl1/engine/resources/ResourcesTypes.h b/engines/hpl1/engine/resources/ResourcesTypes.h
index 24dd2bc4b1a..9b2528a735c 100644
--- a/engines/hpl1/engine/resources/ResourcesTypes.h
+++ b/engines/hpl1/engine/resources/ResourcesTypes.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_RESOURCES_TYPES_H
diff --git a/engines/hpl1/engine/resources/ScriptManager.cpp b/engines/hpl1/engine/resources/ScriptManager.cpp
index c26a366a9ea..58950c1cca0 100644
--- a/engines/hpl1/engine/resources/ScriptManager.cpp
+++ b/engines/hpl1/engine/resources/ScriptManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/ScriptManager.h"
diff --git a/engines/hpl1/engine/resources/ScriptManager.h b/engines/hpl1/engine/resources/ScriptManager.h
index 5ab47034516..c091ddef60a 100644
--- a/engines/hpl1/engine/resources/ScriptManager.h
+++ b/engines/hpl1/engine/resources/ScriptManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SCRIPT_MANAGER_H
diff --git a/engines/hpl1/engine/resources/SoundEntityManager.cpp b/engines/hpl1/engine/resources/SoundEntityManager.cpp
index e5bfa2949b2..8bc9e2ab28c 100644
--- a/engines/hpl1/engine/resources/SoundEntityManager.cpp
+++ b/engines/hpl1/engine/resources/SoundEntityManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/SoundEntityManager.h"
diff --git a/engines/hpl1/engine/resources/SoundEntityManager.h b/engines/hpl1/engine/resources/SoundEntityManager.h
index d7359f0d0e4..34bdeb1dbe5 100644
--- a/engines/hpl1/engine/resources/SoundEntityManager.h
+++ b/engines/hpl1/engine/resources/SoundEntityManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SOUND_ENTITY_MANAGER_H
diff --git a/engines/hpl1/engine/resources/SoundManager.cpp b/engines/hpl1/engine/resources/SoundManager.cpp
index 9505c7cee4c..d4d42ae0532 100644
--- a/engines/hpl1/engine/resources/SoundManager.cpp
+++ b/engines/hpl1/engine/resources/SoundManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/SoundManager.h"
diff --git a/engines/hpl1/engine/resources/SoundManager.h b/engines/hpl1/engine/resources/SoundManager.h
index 4ddbb663aab..18b521519f6 100644
--- a/engines/hpl1/engine/resources/SoundManager.h
+++ b/engines/hpl1/engine/resources/SoundManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_SOUND_MANAGER_H
diff --git a/engines/hpl1/engine/resources/TextureManager.cpp b/engines/hpl1/engine/resources/TextureManager.cpp
index 06d27f590cf..9d82950fab3 100644
--- a/engines/hpl1/engine/resources/TextureManager.cpp
+++ b/engines/hpl1/engine/resources/TextureManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/TextureManager.h"
diff --git a/engines/hpl1/engine/resources/TextureManager.h b/engines/hpl1/engine/resources/TextureManager.h
index 1cbde8cfcbb..c43fd7c0a49 100644
--- a/engines/hpl1/engine/resources/TextureManager.h
+++ b/engines/hpl1/engine/resources/TextureManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_TEXTURE_MANAGER_H
diff --git a/engines/hpl1/engine/resources/TileSetManager.cpp b/engines/hpl1/engine/resources/TileSetManager.cpp
index bceb78311ac..6623b71d692 100644
--- a/engines/hpl1/engine/resources/TileSetManager.cpp
+++ b/engines/hpl1/engine/resources/TileSetManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/TileSetManager.h"
diff --git a/engines/hpl1/engine/resources/TileSetManager.h b/engines/hpl1/engine/resources/TileSetManager.h
index 57d9b49787e..0ba33e712a7 100644
--- a/engines/hpl1/engine/resources/TileSetManager.h
+++ b/engines/hpl1/engine/resources/TileSetManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_TILESET_MANAGER_H
diff --git a/engines/hpl1/engine/resources/VideoManager.cpp b/engines/hpl1/engine/resources/VideoManager.cpp
index a54a4a111b0..ffb653d8bce 100644
--- a/engines/hpl1/engine/resources/VideoManager.cpp
+++ b/engines/hpl1/engine/resources/VideoManager.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/resources/VideoManager.h"
diff --git a/engines/hpl1/engine/resources/VideoManager.h b/engines/hpl1/engine/resources/VideoManager.h
index 4b85a7facac..b176335472d 100644
--- a/engines/hpl1/engine/resources/VideoManager.h
+++ b/engines/hpl1/engine/resources/VideoManager.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_VIDEO_MANAGER_H
diff --git a/engines/hpl1/engine/scene/AnimationState.cpp b/engines/hpl1/engine/scene/AnimationState.cpp
index 62ff01e4769..15302a6d9ea 100644
--- a/engines/hpl1/engine/scene/AnimationState.cpp
+++ b/engines/hpl1/engine/scene/AnimationState.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/AnimationState.h"
diff --git a/engines/hpl1/engine/scene/AnimationState.h b/engines/hpl1/engine/scene/AnimationState.h
index e7cbc7216fa..3981ea28a93 100644
--- a/engines/hpl1/engine/scene/AnimationState.h
+++ b/engines/hpl1/engine/scene/AnimationState.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_ANIMATION_STATE_H
diff --git a/engines/hpl1/engine/scene/Area2D.cpp b/engines/hpl1/engine/scene/Area2D.cpp
index bc284387922..643b9de6ae1 100644
--- a/engines/hpl1/engine/scene/Area2D.cpp
+++ b/engines/hpl1/engine/scene/Area2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/Area2D.h"
diff --git a/engines/hpl1/engine/scene/Area2D.h b/engines/hpl1/engine/scene/Area2D.h
index 3375584fa80..deb5b4b7ccf 100644
--- a/engines/hpl1/engine/scene/Area2D.h
+++ b/engines/hpl1/engine/scene/Area2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_AREA2D_H
diff --git a/engines/hpl1/engine/scene/Camera.h b/engines/hpl1/engine/scene/Camera.h
index 1a96f9c6e5a..a4a799b3b49 100644
--- a/engines/hpl1/engine/scene/Camera.h
+++ b/engines/hpl1/engine/scene/Camera.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_CAMERA_H
diff --git a/engines/hpl1/engine/scene/Camera2D.cpp b/engines/hpl1/engine/scene/Camera2D.cpp
index af92d88874b..3e4082d32df 100644
--- a/engines/hpl1/engine/scene/Camera2D.cpp
+++ b/engines/hpl1/engine/scene/Camera2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/Camera2D.h"
diff --git a/engines/hpl1/engine/scene/Camera2D.h b/engines/hpl1/engine/scene/Camera2D.h
index a9c3d30d19f..ddedf0aff68 100644
--- a/engines/hpl1/engine/scene/Camera2D.h
+++ b/engines/hpl1/engine/scene/Camera2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_CAMERA2D_H
diff --git a/engines/hpl1/engine/scene/Camera3D.cpp b/engines/hpl1/engine/scene/Camera3D.cpp
index 3d0c3493db7..f4d61b9f8bf 100644
--- a/engines/hpl1/engine/scene/Camera3D.cpp
+++ b/engines/hpl1/engine/scene/Camera3D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/Camera3D.h"
diff --git a/engines/hpl1/engine/scene/Camera3D.h b/engines/hpl1/engine/scene/Camera3D.h
index cc8f1dab499..90deff94c3e 100644
--- a/engines/hpl1/engine/scene/Camera3D.h
+++ b/engines/hpl1/engine/scene/Camera3D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_CAMERA3D_H
diff --git a/engines/hpl1/engine/scene/ColliderEntity.cpp b/engines/hpl1/engine/scene/ColliderEntity.cpp
index 1e779e9a8e8..f986cb91490 100644
--- a/engines/hpl1/engine/scene/ColliderEntity.cpp
+++ b/engines/hpl1/engine/scene/ColliderEntity.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/ColliderEntity.h"
diff --git a/engines/hpl1/engine/scene/ColliderEntity.h b/engines/hpl1/engine/scene/ColliderEntity.h
index f3f1fdd2b34..a1c19035015 100644
--- a/engines/hpl1/engine/scene/ColliderEntity.h
+++ b/engines/hpl1/engine/scene/ColliderEntity.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_COLLIDER_ENTITY_H
diff --git a/engines/hpl1/engine/scene/Entity.cpp b/engines/hpl1/engine/scene/Entity.cpp
index b66b93ec2c5..566e961db1b 100644
--- a/engines/hpl1/engine/scene/Entity.cpp
+++ b/engines/hpl1/engine/scene/Entity.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/Entity.h"
diff --git a/engines/hpl1/engine/scene/Entity.h b/engines/hpl1/engine/scene/Entity.h
index e9c405dd91c..4b5f5a8a904 100644
--- a/engines/hpl1/engine/scene/Entity.h
+++ b/engines/hpl1/engine/scene/Entity.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_ENTITY_H
diff --git a/engines/hpl1/engine/scene/Entity2D.cpp b/engines/hpl1/engine/scene/Entity2D.cpp
index fd66cf06689..8f2c908df40 100644
--- a/engines/hpl1/engine/scene/Entity2D.cpp
+++ b/engines/hpl1/engine/scene/Entity2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/Entity2D.h"
diff --git a/engines/hpl1/engine/scene/Entity2D.h b/engines/hpl1/engine/scene/Entity2D.h
index d2026cb436c..a0034332b44 100644
--- a/engines/hpl1/engine/scene/Entity2D.h
+++ b/engines/hpl1/engine/scene/Entity2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_ENTITY2D_H
diff --git a/engines/hpl1/engine/scene/Entity3D.cpp b/engines/hpl1/engine/scene/Entity3D.cpp
index 37534231832..b3335854376 100644
--- a/engines/hpl1/engine/scene/Entity3D.cpp
+++ b/engines/hpl1/engine/scene/Entity3D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/Entity3D.h"
diff --git a/engines/hpl1/engine/scene/Entity3D.h b/engines/hpl1/engine/scene/Entity3D.h
index 7ec3008abe0..2b79055c6d3 100644
--- a/engines/hpl1/engine/scene/Entity3D.h
+++ b/engines/hpl1/engine/scene/Entity3D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_ENTITY3D_H
diff --git a/engines/hpl1/engine/scene/GridMap2D.cpp b/engines/hpl1/engine/scene/GridMap2D.cpp
index 6f2669908d8..718e80199f7 100644
--- a/engines/hpl1/engine/scene/GridMap2D.cpp
+++ b/engines/hpl1/engine/scene/GridMap2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/GridMap2D.h"
diff --git a/engines/hpl1/engine/scene/GridMap2D.h b/engines/hpl1/engine/scene/GridMap2D.h
index 8e2fb0ae970..25924b00220 100644
--- a/engines/hpl1/engine/scene/GridMap2D.h
+++ b/engines/hpl1/engine/scene/GridMap2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_GRIDMAP2D_H
diff --git a/engines/hpl1/engine/scene/ImageEntity.cpp b/engines/hpl1/engine/scene/ImageEntity.cpp
index 077cb04a447..3102c25755e 100644
--- a/engines/hpl1/engine/scene/ImageEntity.cpp
+++ b/engines/hpl1/engine/scene/ImageEntity.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/ImageEntity.h"
diff --git a/engines/hpl1/engine/scene/ImageEntity.h b/engines/hpl1/engine/scene/ImageEntity.h
index 28433c1b6f4..aadf9e38155 100644
--- a/engines/hpl1/engine/scene/ImageEntity.h
+++ b/engines/hpl1/engine/scene/ImageEntity.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_IMAGE_ENTITY_H
diff --git a/engines/hpl1/engine/scene/Light.cpp b/engines/hpl1/engine/scene/Light.cpp
index b89c16caf89..daf939f14da 100644
--- a/engines/hpl1/engine/scene/Light.cpp
+++ b/engines/hpl1/engine/scene/Light.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/Light.h"
diff --git a/engines/hpl1/engine/scene/Light.h b/engines/hpl1/engine/scene/Light.h
index c3bdc255209..b495b2431bc 100644
--- a/engines/hpl1/engine/scene/Light.h
+++ b/engines/hpl1/engine/scene/Light.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LIGHT_H
diff --git a/engines/hpl1/engine/scene/Light2D.cpp b/engines/hpl1/engine/scene/Light2D.cpp
index 8ddfa59153a..21ba96fa3c6 100644
--- a/engines/hpl1/engine/scene/Light2D.cpp
+++ b/engines/hpl1/engine/scene/Light2D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/Light2D.h"
diff --git a/engines/hpl1/engine/scene/Light2D.h b/engines/hpl1/engine/scene/Light2D.h
index 255ba1f8724..ff8f2912534 100644
--- a/engines/hpl1/engine/scene/Light2D.h
+++ b/engines/hpl1/engine/scene/Light2D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LIGHT2D_H
diff --git a/engines/hpl1/engine/scene/Light2DPoint.cpp b/engines/hpl1/engine/scene/Light2DPoint.cpp
index 2c81c433f8a..db748546927 100644
--- a/engines/hpl1/engine/scene/Light2DPoint.cpp
+++ b/engines/hpl1/engine/scene/Light2DPoint.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/Light2DPoint.h"
diff --git a/engines/hpl1/engine/scene/Light2DPoint.h b/engines/hpl1/engine/scene/Light2DPoint.h
index 134c61acef7..5bbaf568d83 100644
--- a/engines/hpl1/engine/scene/Light2DPoint.h
+++ b/engines/hpl1/engine/scene/Light2DPoint.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LIGHTPOINT2D_H
diff --git a/engines/hpl1/engine/scene/Light3D.cpp b/engines/hpl1/engine/scene/Light3D.cpp
index 5f97e69a2aa..4c0777c481c 100644
--- a/engines/hpl1/engine/scene/Light3D.cpp
+++ b/engines/hpl1/engine/scene/Light3D.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/Light3D.h"
diff --git a/engines/hpl1/engine/scene/Light3D.h b/engines/hpl1/engine/scene/Light3D.h
index 70c157261af..360760c5d0f 100644
--- a/engines/hpl1/engine/scene/Light3D.h
+++ b/engines/hpl1/engine/scene/Light3D.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LIGHT3D_H
diff --git a/engines/hpl1/engine/scene/Light3DPoint.cpp b/engines/hpl1/engine/scene/Light3DPoint.cpp
index e78eadde8aa..6fb50631187 100644
--- a/engines/hpl1/engine/scene/Light3DPoint.cpp
+++ b/engines/hpl1/engine/scene/Light3DPoint.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/Light3DPoint.h"
diff --git a/engines/hpl1/engine/scene/Light3DPoint.h b/engines/hpl1/engine/scene/Light3DPoint.h
index 6703879d360..cd54b395a8f 100644
--- a/engines/hpl1/engine/scene/Light3DPoint.h
+++ b/engines/hpl1/engine/scene/Light3DPoint.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LIGHT3D_POINT_H
diff --git a/engines/hpl1/engine/scene/Light3DSpot.cpp b/engines/hpl1/engine/scene/Light3DSpot.cpp
index 1a84744e0aa..da790c3f715 100644
--- a/engines/hpl1/engine/scene/Light3DSpot.cpp
+++ b/engines/hpl1/engine/scene/Light3DSpot.cpp
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hpl1/engine/scene/Light3DSpot.h"
diff --git a/engines/hpl1/engine/scene/Light3DSpot.h b/engines/hpl1/engine/scene/Light3DSpot.h
index 7a6728e85eb..2b21788c438 100644
--- a/engines/hpl1/engine/scene/Light3DSpot.h
+++ b/engines/hpl1/engine/scene/Light3DSpot.h
@@ -23,19 +23,6 @@
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
- *
- * HPL1 Engine is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HPL1 Engine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_LIGHT3D_SPOT_H
diff --git a/engines/hpl1/engine/scene/MeshEntity.cpp b/engines/hpl1/engine/scene/MeshEntity.cpp
Commit: ef1a30651055c678d9b416b089513e1a71b2c84e
https://github.com/scummvm/scummvm/commit/ef1a30651055c678d9b416b089513e1a71b2c84e
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:26+01:00
Commit Message:
HPL1: replace file I/O and string type in tinyxml
Changed paths:
engines/hpl1/detection.cpp
engines/hpl1/detection.h
engines/hpl1/engine/ai/AINodeContainer.cpp
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
engines/hpl1/engine/impl/Platform.h
engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
engines/hpl1/engine/impl/tinyXML/tinyxml.h
engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/resources/ConfigFile.cpp
engines/hpl1/engine/resources/ResourceBase.cpp
engines/hpl1/engine/resources/ResourceBase.h
engines/hpl1/engine/resources/ResourceManager.cpp
engines/hpl1/engine/resources/ResourcesTypes.h
engines/hpl1/engine/system/SerializeClass.cpp
diff --git a/engines/hpl1/detection.cpp b/engines/hpl1/detection.cpp
index 53a48e97706..78f58a1c92b 100644
--- a/engines/hpl1/detection.cpp
+++ b/engines/hpl1/detection.cpp
@@ -31,10 +31,8 @@
const DebugChannelDef Hpl1MetaEngineDetection::debugFlagList[] = {
{ Hpl1::kDebugGraphics, "Graphics", "Graphics debug level" },
- { Hpl1::kDebugPath, "Path", "Pathfinding debug level" },
- { Hpl1::kDebugFilePath, "FilePath", "File path debug level" },
- { Hpl1::kDebugScan, "Scan", "Scan for unrecognised games" },
- { Hpl1::kDebugScript, "Script", "Enable debug script dump" },
+ { Hpl1::kDebugResourceLoading, "ResourceLoading", "Resource loading debug level" },
+ { Hpl1::kDebugFilePath, "FilePath", "File path debug level" },
DEBUG_CHANNEL_END
};
diff --git a/engines/hpl1/detection.h b/engines/hpl1/detection.h
index 561e1021d25..d7a01f94a2b 100644
--- a/engines/hpl1/detection.h
+++ b/engines/hpl1/detection.h
@@ -28,10 +28,8 @@ namespace Hpl1 {
enum Hpl1DebugChannels {
kDebugGraphics = 1 << 0,
- kDebugPath = 1 << 1,
- kDebugScan = 1 << 2,
- kDebugFilePath = 1 << 3,
- kDebugScript = 1 << 4
+ kDebugResourceLoading = 1 << 1,
+ kDebugFilePath = 1 << 2
};
extern const PlainGameDescriptor GAME_NAMES[];
diff --git a/engines/hpl1/engine/ai/AINodeContainer.cpp b/engines/hpl1/engine/ai/AINodeContainer.cpp
index fc31fcaffa7..3cf90a703ac 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.cpp
+++ b/engines/hpl1/engine/ai/AINodeContainer.cpp
@@ -36,7 +36,7 @@
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
-#include <algorithm>
+//#include <algorithm>
namespace hpl {
@@ -359,8 +359,9 @@ void cAINodeContainer::Compile() {
///////////////////////////////////////
// Sort nodes and remove unwanted ones.
+ #if 0
std::sort(pNode->mvEdges.begin(), pNode->mvEdges.end(), cSortEndNodes());
-
+ #endif
// Resize if to too large
if (mlMaxNodeEnds > 0 && (int)pNode->mvEdges.size() > mlMaxNodeEnds) {
pNode->mvEdges.resize(mlMaxNodeEnds);
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index 1eda414dbc2..e4d710dff42 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -29,7 +29,7 @@
#include <math.h>
#include <stdlib.h>
-#include <time.h>
+//#include <time.h>
#include "hpl1/engine/game/Game.h"
#include "hpl1/engine/graphics/Beam.h"
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
index 278c2206a86..70eb23d2151 100644
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
@@ -48,7 +48,7 @@
#include <stdlib.h>
#include <string>
#include <sys/stat.h>
-#include <time.h>
+//#include <time.h>
#include "hpl1/engine/impl/LowLevelSystemSDL.h"
#include "hpl1/engine/impl/SqScript.h"
@@ -57,7 +57,6 @@
#include "hpl1/engine/impl/scriptstring.h"
#include "hpl1/engine/impl/stdstring.h"
-
#include "hpl1/engine/system/String.h"
#include <clocale>
@@ -71,7 +70,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLin
{
return hplMain(lpCmdLine);
}
-#else
+
int main(int argc, char *argv[]) {
if (!std::setlocale(LC_CTYPE, "")) {
fprintf(stderr, "Can't set the specified locale! Check LANG, LC_CTYPE, LC_ALL.\n");
@@ -108,11 +107,14 @@ cLogWriter::cLogWriter(const tWString &asFileName) {
}
cLogWriter::~cLogWriter() {
+#if 0
if (mpFile)
fclose(mpFile);
+#endif
}
void cLogWriter::Write(const tString &asMessage) {
+#if 0
if (!mpFile)
ReopenFile();
@@ -120,12 +122,15 @@ void cLogWriter::Write(const tString &asMessage) {
fprintf(mpFile, asMessage.c_str());
fflush(mpFile);
}
+#endif
}
void cLogWriter::Clear() {
+#if 0
ReopenFile();
if (mpFile)
fflush(mpFile);
+#endif
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
index ce505696b1a..cdd2ba5ece8 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
@@ -32,7 +32,7 @@
#include "hpl1/engine/physics/SurfaceData.h"
#include "hpl1/engine/system/LowLevelSystem.h"
-#include <algorithm>
+//#include <algorithm>
namespace hpl {
diff --git a/engines/hpl1/engine/impl/Platform.h b/engines/hpl1/engine/impl/Platform.h
index 9186050b14a..bd249a6f4fe 100644
--- a/engines/hpl1/engine/impl/Platform.h
+++ b/engines/hpl1/engine/impl/Platform.h
@@ -28,7 +28,6 @@
#ifndef PLATFORM_H_
#define PLATFORM_H_
#include "hpl1/engine/system/String.h"
-#include <stdio.h>
namespace hpl {
class Platform {
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp b/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
index 75c25a4a92e..aa2b6ac8a2e 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
@@ -22,24 +22,20 @@ must not be misrepresented as being the original software.
distribution.
*/
-#include <ctype.h>
-
-#ifdef TIXML_USE_STL
-#include <iostream>
-#include <sstream>
-#endif
-
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
+#include "common/file.h"
+#include "common/debug.h"
+#include "hpl1/detection.h"
bool TiXmlBase::condenseWhiteSpace = true;
void TiXmlBase::PutString(const TIXML_STRING &str, TIXML_STRING *outString) {
int i = 0;
- while (i < (int)str.length()) {
+ while (i < (int)str.size()) {
unsigned char c = (unsigned char)str[i];
- if (c == '&' && i < ((int)str.length() - 2) && str[i + 1] == '#' && str[i + 2] == 'x') {
+ if (c == '&' && i < ((int)str.size() - 2) && str[i + 1] == '#' && str[i + 2] == 'x') {
// Hexadecimal character reference.
// Pass through unchanged.
// © -- copyright symbol, for example.
@@ -50,46 +46,34 @@ void TiXmlBase::PutString(const TIXML_STRING &str, TIXML_STRING *outString) {
// while fails (error case) and break (semicolon found).
// However, there is no mechanism (currently) for
// this function to return an error.
- while (i < (int)str.length() - 1) {
- outString->append(str.c_str() + i, 1);
+ while (i < (int)str.size() - 1) {
+ (*outString) += Common::String(str.c_str() + i, 1);
++i;
if (str[i] == ';')
break;
}
} else if (c == '&') {
- outString->append(entity[0].str, entity[0].strLength);
+ (*outString) += Common::String(entity[0].str, entity[0].strLength);
++i;
} else if (c == '<') {
- outString->append(entity[1].str, entity[1].strLength);
+ (*outString) += Common::String(entity[1].str, entity[1].strLength);
++i;
} else if (c == '>') {
- outString->append(entity[2].str, entity[2].strLength);
+ (*outString) += Common::String(entity[2].str, entity[2].strLength);
++i;
} else if (c == '\"') {
- outString->append(entity[3].str, entity[3].strLength);
+ (*outString) += Common::String(entity[3].str, entity[3].strLength);
++i;
} else if (c == '\'') {
- outString->append(entity[4].str, entity[4].strLength);
+ (*outString) += Common::String(entity[4].str, entity[4].strLength);
++i;
} else if (c < 32) {
// Easy pass at non-alpha/numeric/symbol
// Below 32 is symbolic.
- char buf[32];
-
-#if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF(buf, sizeof(buf), "&#x%02X;", (unsigned)(c & 0xff));
-#else
- sprintf(buf, "&#x%02X;", (unsigned)(c & 0xff));
-#endif
-
- //*ME: warning C4267: convert 'size_t' to 'int'
- //*ME: Int-Cast to make compiler happy ...
- outString->append(buf, (int)strlen(buf));
+ (*outString) += Common::String::format("&#x%02X;", (unsigned)(c & 0xff));
++i;
} else {
- // char realc = (char) c;
- // outString->append( &realc, 1 );
- *outString += (char)c; // somewhat more efficient function call.
+ (*outString) += (char)c;
++i;
}
}
@@ -607,19 +591,18 @@ void TiXmlElement::SetAttribute(const std::string &name, const std::string &_val
}
#endif
-void TiXmlElement::Print(FILE *cfile, int depth) const {
+void TiXmlElement::Print(Common::DumpFile &file, int depth) const {
int i;
- assert(cfile);
for (i = 0; i < depth; i++) {
- fprintf(cfile, " ");
+ file.writeString(" ");
}
- fprintf(cfile, "<%s", value.c_str());
+ file.writeString("<" + value);
const TiXmlAttribute *attrib;
for (attrib = attributeSet.First(); attrib; attrib = attrib->Next()) {
- fprintf(cfile, " ");
- attrib->Print(cfile, depth);
+ file.writeString(" ");
+ attrib->Print(file, depth);
}
// There are 3 different formatting approaches:
@@ -628,25 +611,25 @@ void TiXmlElement::Print(FILE *cfile, int depth) const {
// 3) An element with children is printed on multiple lines.
TiXmlNode *node;
if (!firstChild) {
- fprintf(cfile, " />");
+ file.writeString(" />");
} else if (firstChild == lastChild && firstChild->ToText()) {
- fprintf(cfile, ">");
- firstChild->Print(cfile, depth + 1);
- fprintf(cfile, "</%s>", value.c_str());
+ file.writeString(">");
+ firstChild->Print(file, depth + 1);
+ file.writeString("</" + value + ">");
} else {
- fprintf(cfile, ">");
+ file.writeString(">");
for (node = firstChild; node; node = node->NextSibling()) {
if (!node->ToText()) {
- fprintf(cfile, "\n");
+ file.writeString("\n");
}
- node->Print(cfile, depth + 1);
+ node->Print(file, depth + 1);
}
- fprintf(cfile, "\n");
+ file.writeString("\n");
for (i = 0; i < depth; ++i) {
- fprintf(cfile, " ");
+ file.writeString(" ");
}
- fprintf(cfile, "</%s>", value.c_str());
+ file.writeString("</" + value + ">");
}
}
@@ -748,7 +731,7 @@ bool TiXmlDocument::SaveFile() const {
return SaveFile(Value());
}
-bool TiXmlDocument::LoadFile(const char *_filename, TiXmlEncoding encoding) {
+bool TiXmlDocument::LoadFile(const char *filename, TiXmlEncoding encoding) {
// There was a really terrifying little bug here. The code:
// value = filename
// in the STL case, cause the assignment method of the std::string to
@@ -756,24 +739,25 @@ bool TiXmlDocument::LoadFile(const char *_filename, TiXmlEncoding encoding) {
// address as it's c_str() method, and so bad things happen. Looks
// like a bug in the Microsoft STL implementation.
// Add an extra string to avoid the crash.
- TIXML_STRING filename(_filename);
value = filename;
// reading in binary mode so that tinyxml can normalize the EOL
- FILE *file = fopen(value.c_str(), "rb");
-
- if (file) {
+ Common::File file;
+ file.open(value);
+
+ if (file.isOpen()) {
bool result = LoadFile(file, encoding);
- fclose(file);
return result;
} else {
+ debugC(Hpl1::kDebugFilePath, "file %s not found", value.c_str());
SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN);
return false;
}
}
-bool TiXmlDocument::LoadFile(FILE *file, TiXmlEncoding encoding) {
- if (!file) {
+bool TiXmlDocument::LoadFile(Common::File &file, TiXmlEncoding encoding) {
+ if (file.err()) {
+ debugC(Hpl1::kDebugResourceLoading, "file %s could not be read", file.getName());
SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN);
return false;
}
@@ -783,10 +767,7 @@ bool TiXmlDocument::LoadFile(FILE *file, TiXmlEncoding encoding) {
location.Clear();
// Get the file size, so we can pre-allocate the string. HUGE speed impact.
- long length = 0;
- fseek(file, 0, SEEK_END);
- length = ftell(file);
- fseek(file, 0, SEEK_SET);
+ long length = file.size();
// Strange case, but good to handle up front.
if (length == 0) {
@@ -797,7 +778,6 @@ bool TiXmlDocument::LoadFile(FILE *file, TiXmlEncoding encoding) {
// If we have a file, assume it is all one big XML file, and read it in.
// The document parser may decide the document ends sooner than the entire file, however.
TIXML_STRING data;
- data.reserve(length);
// Subtle bug here. TinyXml did use fgets. But from the XML spec:
// 2.11 End-of-Line Handling
@@ -823,7 +803,9 @@ bool TiXmlDocument::LoadFile(FILE *file, TiXmlEncoding encoding) {
char *buf = new char[length + 1];
buf[0] = 0;
- if (fread(buf, length, 1, file) != 1) {
+ file.read(buf, length);
+ if (file.err()) {
+ debugC(Hpl1::kDebugResourceLoading, "file read for %s failed", file.getName());
delete[] buf;
SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN);
return false;
@@ -838,7 +820,7 @@ bool TiXmlDocument::LoadFile(FILE *file, TiXmlEncoding encoding) {
if (*p == 0xa) {
// Newline character. No special rules for this. Append all the characters
// since the last string, and include the newline.
- data.append(lastPos, (p - lastPos + 1)); // append, include the newline
+ data += Common::String(lastPos, (p - lastPos + 1)); // append, include the newline
++p; // move past the newline
lastPos = p; // and point to the new buffer (may be 0)
assert(p <= (buf + length));
@@ -846,7 +828,7 @@ bool TiXmlDocument::LoadFile(FILE *file, TiXmlEncoding encoding) {
// Carriage return. Append what we have so far, then
// handle moving forward in the buffer.
if ((p - lastPos) > 0) {
- data.append(lastPos, p - lastPos); // do not add the CR
+ data += Common::String(lastPos, p - lastPos); // do not add the CR
}
data += (char)0xa; // a proper newline
@@ -867,7 +849,7 @@ bool TiXmlDocument::LoadFile(FILE *file, TiXmlEncoding encoding) {
}
// Handle any left over characters.
if (p - lastPos) {
- data.append(lastPos, p - lastPos);
+ data += Common::String(lastPos, p - lastPos);
}
delete[] buf;
buf = 0;
@@ -882,27 +864,27 @@ bool TiXmlDocument::LoadFile(FILE *file, TiXmlEncoding encoding) {
bool TiXmlDocument::SaveFile(const char *filename) const {
// The old c stuff lives on...
- FILE *fp = fopen(filename, "w");
- if (fp) {
- bool result = SaveFile(fp);
- fclose(fp);
+ Common::DumpFile df;
+ df.open(filename);
+ if (df.isOpen()) {
+ bool result = SaveFile(df);
return result;
}
+ debugC(Hpl1::kDebugFilePath, "file %s not found", value.c_str());
return false;
}
-bool TiXmlDocument::SaveFile(FILE *fp) const {
+bool TiXmlDocument::SaveFile(Common::DumpFile &fp) const {
if (useMicrosoftBOM) {
const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
-
- fputc(TIXML_UTF_LEAD_0, fp);
- fputc(TIXML_UTF_LEAD_1, fp);
- fputc(TIXML_UTF_LEAD_2, fp);
+ fp.writeByte(TIXML_UTF_LEAD_0);
+ fp.writeByte(TIXML_UTF_LEAD_1);
+ fp.writeByte(TIXML_UTF_LEAD_2);
}
Print(fp, 0);
- return (ferror(fp) == 0);
+ return fp.err();
}
void TiXmlDocument::CopyTo(TiXmlDocument *target) const {
@@ -926,11 +908,10 @@ TiXmlNode *TiXmlDocument::Clone() const {
return clone;
}
-void TiXmlDocument::Print(FILE *cfile, int depth) const {
- assert(cfile);
+void TiXmlDocument::Print(Common::DumpFile &cfile, int depth) const {
for (const TiXmlNode *node = FirstChild(); node; node = node->NextSibling()) {
node->Print(cfile, depth);
- fprintf(cfile, "\n");
+ cfile.writeString("\n");
}
}
@@ -982,7 +963,7 @@ TiXmlAttribute* TiXmlAttribute::Previous()
}
*/
-void TiXmlAttribute::Print(FILE *cfile, int /*depth*/, TIXML_STRING *str) const {
+void TiXmlAttribute::Print(Common::DumpFile *cfile, int /*depth*/, TIXML_STRING *str) const {
TIXML_STRING n, v;
PutString(name, &n);
@@ -990,7 +971,7 @@ void TiXmlAttribute::Print(FILE *cfile, int /*depth*/, TIXML_STRING *str) const
if (value.find('\"') == TIXML_STRING::npos) {
if (cfile) {
- fprintf(cfile, "%s=\"%s\"", n.c_str(), v.c_str());
+ cfile->writeString(n + "=\"" + v + "\"");
}
if (str) {
(*str) += n;
@@ -1000,7 +981,7 @@ void TiXmlAttribute::Print(FILE *cfile, int /*depth*/, TIXML_STRING *str) const
}
} else {
if (cfile) {
- fprintf(cfile, "%s='%s'", n.c_str(), v.c_str());
+ cfile->writeString(n + "='" + v + "'");
}
if (str) {
(*str) += n;
@@ -1060,12 +1041,11 @@ void TiXmlComment::operator=(const TiXmlComment &base) {
base.CopyTo(this);
}
-void TiXmlComment::Print(FILE *cfile, int depth) const {
- assert(cfile);
+void TiXmlComment::Print(Common::DumpFile &cfile, int depth) const {
for (int i = 0; i < depth; i++) {
- fprintf(cfile, " ");
+ cfile.writeString(" ");
}
- fprintf(cfile, "<!--%s-->", value.c_str());
+ cfile.writeString("<!--" + value + "-->");
}
void TiXmlComment::CopyTo(TiXmlComment *target) const {
@@ -1086,19 +1066,18 @@ TiXmlNode *TiXmlComment::Clone() const {
return clone;
}
-void TiXmlText::Print(FILE *cfile, int depth) const {
- assert(cfile);
+void TiXmlText::Print(Common::DumpFile &cfile, int depth) const {
if (cdata) {
int i;
- fprintf(cfile, "\n");
+ cfile.writeString("\n");
for (i = 0; i < depth; i++) {
- fprintf(cfile, " ");
+ cfile.writeString(" ");
}
- fprintf(cfile, "<![CDATA[%s]]>\n", value.c_str()); // unformatted output
+ cfile.writeString("<![CDATA[" + value + "]]>\n"); // unformatted output
} else {
TIXML_STRING buffer;
PutString(value, &buffer);
- fprintf(cfile, "%s", buffer.c_str());
+ cfile.writeString(buffer);
}
}
@@ -1152,15 +1131,15 @@ void TiXmlDeclaration::operator=(const TiXmlDeclaration ©) {
copy.CopyTo(this);
}
-void TiXmlDeclaration::Print(FILE *cfile, int /*depth*/, TIXML_STRING *str) const {
+void TiXmlDeclaration::Print(Common::DumpFile *cfile, int /*depth*/, TIXML_STRING *str) const {
if (cfile)
- fprintf(cfile, "<?xml ");
+ cfile->writeString("<?xml ");
if (str)
(*str) += "<?xml ";
if (!version.empty()) {
if (cfile)
- fprintf(cfile, "version=\"%s\" ", version.c_str());
+ cfile->writeString("version=\"" + version + "\" ");
if (str) {
(*str) += "version=\"";
(*str) += version;
@@ -1169,7 +1148,7 @@ void TiXmlDeclaration::Print(FILE *cfile, int /*depth*/, TIXML_STRING *str) cons
}
if (!encoding.empty()) {
if (cfile)
- fprintf(cfile, "encoding=\"%s\" ", encoding.c_str());
+ cfile->writeString("encoding=\"" + encoding + "\" ");
if (str) {
(*str) += "encoding=\"";
(*str) += encoding;
@@ -1178,7 +1157,7 @@ void TiXmlDeclaration::Print(FILE *cfile, int /*depth*/, TIXML_STRING *str) cons
}
if (!standalone.empty()) {
if (cfile)
- fprintf(cfile, "standalone=\"%s\" ", standalone.c_str());
+ cfile->writeString("standalone=\"" + standalone + "\" ");
if (str) {
(*str) += "standalone=\"";
(*str) += standalone;
@@ -1186,7 +1165,7 @@ void TiXmlDeclaration::Print(FILE *cfile, int /*depth*/, TIXML_STRING *str) cons
}
}
if (cfile)
- fprintf(cfile, "?>");
+ cfile->writeString("?>");
if (str)
(*str) += "?>";
}
@@ -1213,10 +1192,10 @@ TiXmlNode *TiXmlDeclaration::Clone() const {
return clone;
}
-void TiXmlUnknown::Print(FILE *cfile, int depth) const {
+void TiXmlUnknown::Print(Common::DumpFile &cfile, int depth) const {
for (int i = 0; i < depth; i++)
- fprintf(cfile, " ");
- fprintf(cfile, "<%s>", value.c_str());
+ cfile.writeString(" ");
+ cfile.writeString("<" + value + ">");
}
void TiXmlUnknown::CopyTo(TiXmlUnknown *target) const {
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxml.h b/engines/hpl1/engine/impl/tinyXML/tinyxml.h
index b71b4baf04f..2bd0ffd50a9 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxml.h
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxml.h
@@ -32,25 +32,16 @@ distribution.
#endif
#include <assert.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "common/file.h"
+#include "common/str.h"
+#include "common/util.h"
// Help out windows:
#if defined(_DEBUG) && !defined(DEBUG)
#define DEBUG
#endif
-#ifdef TIXML_USE_STL
-#include <string>
-#include <iostream>
-#include <sstream>
-#define TIXML_STRING std::string
-#else
-#include "tinystr.h"
-#define TIXML_STRING TiXmlString
-#endif
+#define TIXML_STRING Common::String
// Deprecated library function hell. Compilers want to use the
// new safe versions. This probably doesn't fully address the problem,
@@ -198,7 +189,7 @@ public:
(For an unformatted stream, use the << operator.)
*/
- virtual void Print(FILE *cfile, int depth) const = 0;
+ virtual void Print(Common::DumpFile &file, int depth) const = 0;
/** The world does not agree on whether white space should be kept or
not. In order to make everyone happy, these global, static functions
@@ -269,7 +260,7 @@ public:
protected:
static const char *SkipWhiteSpace(const char *, TiXmlEncoding encoding);
inline static bool IsWhiteSpace(char c) {
- return (isspace((unsigned char)c) || c == '\n' || c == '\r');
+ return (Common::isSpace((unsigned char)c) || c == '\n' || c == '\r');
}
inline static bool IsWhiteSpace(int c) {
if (c < 256)
@@ -825,10 +816,10 @@ public:
virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
// Prints this Attribute to a FILE stream.
- virtual void Print(FILE *cfile, int depth) const {
- Print(cfile, depth, 0);
+ virtual void Print(Common::DumpFile &file, int depth) const {
+ Print(&file, depth, 0);
}
- void Print(FILE *cfile, int depth, TIXML_STRING *str) const;
+ void Print(Common::DumpFile *cfile, int depth, TIXML_STRING *str) const;
// [internal use]
// Set the document pointer so the attribute can report errors.
@@ -1049,7 +1040,7 @@ public:
/// Creates a new Element and returns it - the returned element is a copy.
virtual TiXmlNode *Clone() const;
// Print the Element to a FILE stream.
- virtual void Print(FILE *cfile, int depth) const;
+ virtual void Print(Common::DumpFile &cfile, int depth) const;
/* Attribtue parsing starts: next char past '<'
returns: next char past '>'
@@ -1099,7 +1090,7 @@ public:
/// Returns a copy of this Comment.
virtual TiXmlNode *Clone() const;
// Write this Comment to a FILE stream.
- virtual void Print(FILE *cfile, int depth) const;
+ virtual void Print(Common::DumpFile &cfile, int depth) const;
/* Attribtue parsing starts: at the ! of the !--
returns: next char past '>'
@@ -1156,7 +1147,7 @@ public:
void operator=(const TiXmlText &base) { base.CopyTo(this); }
// Write this text object to a FILE stream.
- virtual void Print(FILE *cfile, int depth) const;
+ virtual void Print(Common::DumpFile &cfile, int depth) const;
/// Queries whether this represents text using a CDATA section.
bool CDATA() const { return cdata; }
@@ -1232,9 +1223,9 @@ public:
/// Creates a copy of this Declaration and returns it.
virtual TiXmlNode *Clone() const;
// Print this declaration to a FILE stream.
- virtual void Print(FILE *cfile, int depth, TIXML_STRING *str) const;
- virtual void Print(FILE *cfile, int depth) const {
- Print(cfile, depth, 0);
+ virtual void Print(Common::DumpFile *cfile, int depth, TIXML_STRING *str) const;
+ virtual void Print(Common::DumpFile &cfile, int depth) const {
+ Print(&cfile, depth, 0);
}
virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
@@ -1277,7 +1268,7 @@ public:
/// Creates a copy of this Unknown and returns it.
virtual TiXmlNode *Clone() const;
// Print this Unknown to a FILE stream.
- virtual void Print(FILE *cfile, int depth) const;
+ virtual void Print(Common::DumpFile &cfile, int depth) const;
virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
@@ -1335,9 +1326,9 @@ public:
will be interpreted as an XML file. TinyXML doesn't stream in XML from the current
file location. Streaming may be added in the future.
*/
- bool LoadFile(FILE *, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
+ bool LoadFile(Common::File &file, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
/// Save a file using the given FILE*. Returns true if successful.
- bool SaveFile(FILE *) const;
+ bool SaveFile(Common::DumpFile &) const;
#ifdef TIXML_USE_STL
bool LoadFile(const std::string &filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING) ///< STL std::string version.
@@ -1432,7 +1423,7 @@ public:
}
/** Write the document to standard out using formatted printing ("pretty print"). */
- void Print() const { Print(stdout, 0); }
+ //void Print() const { Print(stdout, 0); }
/* Write the document to a string using formatted printing ("pretty print"). This
will allocate a character array (new char[]) and return it as a pointer. The
@@ -1440,8 +1431,8 @@ public:
*/
// char* PrintToMemory() const;
- /// Print this Document to a FILE stream.
- virtual void Print(FILE *cfile, int depth = 0) const;
+ /// Print this Document to file
+ virtual void Print(Common::DumpFile &file, int depth = 0) const;
// [internal use]
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding);
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp b/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
index b693502a366..c1ef773fc05 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
@@ -22,10 +22,8 @@ must not be misrepresented as being the original software.
distribution.
*/
-#include <ctype.h>
-#include <stddef.h>
-
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
+#include "common/util.h"
//#define DEBUG_PARSER
#if defined(DEBUG_PARSER)
@@ -132,7 +130,7 @@ void TiXmlBase::ConvertUTF32ToUTF8(unsigned long input, char *output, int *lengt
// if ( encoding == TIXML_ENCODING_UTF8 )
// {
if (anyByte < 127)
- return isalpha(anyByte);
+ return Common::isAlpha(anyByte);
else
return 1; // What else to do? The unicode set is huge...get the english ones right.
// }
@@ -151,7 +149,7 @@ void TiXmlBase::ConvertUTF32ToUTF8(unsigned long input, char *output, int *lengt
// if ( encoding == TIXML_ENCODING_UTF8 )
// {
if (anyByte < 127)
- return isalnum(anyByte);
+ return Common::isAlnum(anyByte);
else
return 1; // What else to do? The unicode set is huge...get the english ones right.
// }
@@ -381,7 +379,7 @@ const char *TiXmlBase::ReadName(const char *p, TIXML_STRING *name, TiXmlEncoding
++p;
}
if (p - start > 0) {
- name->assign(start, p - start);
+ (*name) += Common::String(start, p - start);
}
return p;
}
@@ -523,7 +521,7 @@ const char *TiXmlBase::ReadText(const char *p,
int len;
char cArr[4] = {0, 0, 0, 0};
p = GetChar(p, cArr, &len, encoding);
- text->append(cArr, len);
+ (*text) += Common::String(cArr, len);
}
} else {
bool whitespace = false;
@@ -550,7 +548,7 @@ const char *TiXmlBase::ReadText(const char *p,
if (len == 1)
(*text) += cArr[0]; // more efficient
else
- text->append(cArr, len);
+ (*text) += Common::String(cArr, len);
}
}
}
@@ -974,7 +972,7 @@ const char *TiXmlElement::Parse(const char *p, TiXmlParsingData *data, TiXmlEnco
// We should find the end tag now
if (StringEqual(p, endTag.c_str(), false, encoding)) {
- p += endTag.length();
+ p += endTag.size();
return p;
} else {
if (document)
@@ -1379,7 +1377,7 @@ const char *TiXmlDeclaration::Parse(const char *p, TiXmlParsingData *data, TiXml
}
bool TiXmlText::Blank() const {
- for (unsigned i = 0; i < value.length(); i++)
+ for (unsigned i = 0; i < value.size(); i++)
if (!IsWhiteSpace(value[i]))
return false;
return true;
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index d115ec135ad..7db42189727 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -32,7 +32,7 @@
#include <map>
#include <math.h>
#include <stdlib.h>
-#include <time.h>
+//#include <time.h>
namespace hpl {
@@ -83,11 +83,13 @@ cColor cMath::RandRectColor(const cColor &aMin, const cColor &aMax) {
//-----------------------------------------------------------------------
void cMath::Randomize(int alSeed) {
+#if 0
if (alSeed == -1) {
srand((unsigned)time(NULL));
} else {
srand(alSeed);
}
+#endif
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/resources/ConfigFile.cpp b/engines/hpl1/engine/resources/ConfigFile.cpp
index cd48deac290..b54347a62bd 100644
--- a/engines/hpl1/engine/resources/ConfigFile.cpp
+++ b/engines/hpl1/engine/resources/ConfigFile.cpp
@@ -60,6 +60,7 @@ cConfigFile::~cConfigFile() {
//-----------------------------------------------------------------------
bool cConfigFile::Load() {
+#if 0
#ifdef WIN32
FILE *pFile = _wfopen(msFile.c_str(), _W("rb"));
#else
@@ -72,11 +73,14 @@ bool cConfigFile::Load() {
fclose(pFile);
return bRet;
+#endif
+ return false;
}
//-----------------------------------------------------------------------
bool cConfigFile::Save() {
+#if 0
#ifdef WIN32
FILE *pFile = _wfopen(msFile.c_str(), _W("w+"));
#else
@@ -89,6 +93,8 @@ bool cConfigFile::Save() {
fclose(pFile);
return bRet;
+#endif
+ return false;
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/resources/ResourceBase.cpp b/engines/hpl1/engine/resources/ResourceBase.cpp
index 76aaedf0c71..008a4b010f6 100644
--- a/engines/hpl1/engine/resources/ResourceBase.cpp
+++ b/engines/hpl1/engine/resources/ResourceBase.cpp
@@ -39,7 +39,7 @@ bool iResourceBase::mbLogCreateAndDelete = false;
//-----------------------------------------------------------------------
iResourceBase::iResourceBase(tString asName, unsigned long alPrio) {
- mlTime = (unsigned long)time(NULL);
+ mlTime = 0; //(unsigned long)time(NULL);
mlPrio = alPrio;
mlHandle = 0;
mlUserCount = 0;
@@ -55,7 +55,7 @@ iResourceBase::~iResourceBase() {
void iResourceBase::IncUserCount() {
mlUserCount++;
- mlTime = (unsigned long)time(NULL);
+ mlTime = 0; //(unsigned long)time(NULL);
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/resources/ResourceBase.h b/engines/hpl1/engine/resources/ResourceBase.h
index a6fdd943ab7..6d1b38005ef 100644
--- a/engines/hpl1/engine/resources/ResourceBase.h
+++ b/engines/hpl1/engine/resources/ResourceBase.h
@@ -30,7 +30,7 @@
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <time.h>
+//#include <time.h>
namespace hpl {
diff --git a/engines/hpl1/engine/resources/ResourceManager.cpp b/engines/hpl1/engine/resources/ResourceManager.cpp
index acb216674cf..14498140d18 100644
--- a/engines/hpl1/engine/resources/ResourceManager.cpp
+++ b/engines/hpl1/engine/resources/ResourceManager.cpp
@@ -34,7 +34,7 @@
#include "hpl1/engine/system/LowLevelSystem.h"
-#include <algorithm>
+//#include <algorithm>
namespace hpl {
@@ -133,8 +133,9 @@ void iResourceManager::DestroyUnused(int alMaxToKeep) {
}
// Sort the sounds according to num of users and then time.
+ #if 0
std::sort(vResources.begin(), vResources.end(), cSortResources());
-
+ #endif
// Log("-------------Num: %d-----------------\n",vResources.size());
for (size_t i = alMaxToKeep; i < vResources.size(); ++i) {
iResourceBase *pRes = vResources[i];
diff --git a/engines/hpl1/engine/resources/ResourcesTypes.h b/engines/hpl1/engine/resources/ResourcesTypes.h
index 9b2528a735c..a00df275ce9 100644
--- a/engines/hpl1/engine/resources/ResourcesTypes.h
+++ b/engines/hpl1/engine/resources/ResourcesTypes.h
@@ -33,7 +33,7 @@
namespace hpl {
// change to own file type?
-typedef FILE tFile;
+//typedef FILE tFile;
}; // namespace hpl
#endif // HPL_RESOURCES_TYPES_H
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index c0918568206..7ccc1689017 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -190,6 +190,7 @@ void cSerializeClass::PrintMembers(iSerializable *apData) {
//-----------------------------------------------------------------------
bool cSerializeClass::SaveToFile(iSerializable *apData, const tWString &asFile, const tString &asRoot) {
+#if 0
SetUpData();
glTabs = 0;
@@ -218,6 +219,8 @@ bool cSerializeClass::SaveToFile(iSerializable *apData, const tWString &asFile,
hplDelete(pXmlDoc);
return bRet;
+#endif
+ return false;
}
//-----------------------------------------------------------------------
@@ -278,6 +281,7 @@ void cSerializeClass::SaveToElement(iSerializable *apData, const tString &asName
//-----------------------------------------------------------------------
bool cSerializeClass::LoadFromFile(iSerializable *apData, const tWString &asFile) {
+#if 0
SetUpData();
glTabs = 0;
@@ -312,6 +316,8 @@ bool cSerializeClass::LoadFromFile(iSerializable *apData, const tWString &asFile
hplDelete(pXmlDoc);
return true;
+#endif
+ return false;
}
//-----------------------------------------------------------------------
Commit: 0d954919d13d565a419cbb34584f3fa37a63ed0b
https://github.com/scummvm/scummvm/commit/0d954919d13d565a419cbb34584f3fa37a63ed0b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:26+01:00
Commit Message:
HPL1: replace sprintf usage in tinyxml
Changed paths:
engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
engines/hpl1/engine/impl/tinyXML/tinyxml.h
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp b/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
index aa2b6ac8a2e..cb30094c8d6 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
@@ -520,13 +520,8 @@ int TiXmlElement::QueryDoubleAttribute(const std::string &name, double *dval) co
#endif
void TiXmlElement::SetAttribute(const char *name, int val) {
- char buf[64];
-#if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF(buf, sizeof(buf), "%d", val);
-#else
- sprintf(buf, "%d", val);
-#endif
- SetAttribute(name, buf);
+ Common::String sval = Common::String::format("%d", val);
+ SetAttribute(name, sval.c_str());
}
#ifdef TIXML_USE_STL
@@ -538,13 +533,8 @@ void TiXmlElement::SetAttribute(const std::string &name, int val) {
#endif
void TiXmlElement::SetDoubleAttribute(const char *name, double val) {
- char buf[256];
-#if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF(buf, sizeof(buf), "%f", val);
-#else
- sprintf(buf, "%f", val);
-#endif
- SetAttribute(name, buf);
+ Common::String sval = Common::String::format("%f", val);
+ SetAttribute(name, sval.c_str());
}
void TiXmlElement::SetAttribute(const char *cname, const char *cvalue) {
@@ -1005,23 +995,13 @@ int TiXmlAttribute::QueryDoubleValue(double *dval) const {
}
void TiXmlAttribute::SetIntValue(int _value) {
- char buf[64];
-#if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value);
-#else
- sprintf(buf, "%d", _value);
-#endif
- SetValue(buf);
+ Common::String sval = Common::String::format("%d", _value);
+ SetValue(sval.c_str());
}
void TiXmlAttribute::SetDoubleValue(double _value) {
- char buf[256];
-#if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF(buf, sizeof(buf), "%lf", _value);
-#else
- sprintf(buf, "%lf", _value);
-#endif
- SetValue(buf);
+ Common::String sval = Common::String::format("%f", _value);
+ SetValue(sval.c_str());
}
int TiXmlAttribute::IntValue() const {
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxml.h b/engines/hpl1/engine/impl/tinyXML/tinyxml.h
index 2bd0ffd50a9..f6fcfcde324 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxml.h
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxml.h
@@ -43,30 +43,6 @@ distribution.
#define TIXML_STRING Common::String
-// Deprecated library function hell. Compilers want to use the
-// new safe versions. This probably doesn't fully address the problem,
-// but it gets closer. There are too many compilers for me to fully
-// test. If you get compilation troubles, undefine TIXML_SAFE
-#define TIXML_SAFE
-
-#ifdef TIXML_SAFE
-#if defined(_MSC_VER) && (_MSC_VER >= 1400)
-// Microsoft visual studio, version 2005 and higher.
-#define TIXML_SNPRINTF _snprintf_s
-#define TIXML_SNSCANF _snscanf_s
-#elif defined(_MSC_VER) && (_MSC_VER >= 1200)
-// Microsoft visual studio, version 6 and higher.
-//#pragma message( "Using _sn* functions." )
-#define TIXML_SNPRINTF _snprintf
-#define TIXML_SNSCANF _snscanf
-#elif defined(__GNUC__) && (__GNUC__ >= 3)
-// GCC version 3 and higher.s
-//#warning( "Using sn* functions." )
-#define TIXML_SNPRINTF snprintf
-#define TIXML_SNSCANF snscanf
-#endif
-#endif
-
class TiXmlDocument;
class TiXmlElement;
class TiXmlComment;
Commit: c5e44bdeb77321106011ccef916de4332538f507
https://github.com/scummvm/scummvm/commit/c5e44bdeb77321106011ccef916de4332538f507
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:27+01:00
Commit Message:
HPL1: fix platform in detection tables
Changed paths:
engines/hpl1/detection_tables.h
diff --git a/engines/hpl1/detection_tables.h b/engines/hpl1/detection_tables.h
index 5560467cc30..ed4fca1dec0 100644
--- a/engines/hpl1/detection_tables.h
+++ b/engines/hpl1/detection_tables.h
@@ -30,7 +30,7 @@ const ADGameDescription GAME_DESCRIPTIONS[] = {
nullptr,
AD_ENTRY1s("Penumbra.exe", nullptr, -1),
Common::Language::EN_ANY,
- Common::Platform::kPlatformDOS,
+ Common::Platform::kPlatformWindows,
ADGF_UNSTABLE,
GUIO1(GUIO_NONE)},
Commit: ed75b134859be531d8cbcec9e78c06a9c465317f
https://github.com/scummvm/scummvm/commit/ed75b134859be531d8cbcec9e78c06a9c465317f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:27+01:00
Commit Message:
HPL1: move debug channels to dedicated header
Changed paths:
A engines/hpl1/debug.h
engines/hpl1/detection.cpp
engines/hpl1/detection.h
engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
diff --git a/engines/hpl1/debug.h b/engines/hpl1/debug.h
new file mode 100644
index 00000000000..cf34e622fcd
--- /dev/null
+++ b/engines/hpl1/debug.h
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_DEBUG_H
+#define HPL1_DEBUG_H
+
+#include "common/debug.h"
+
+namespace Hpl1 {
+
+enum DebugChannels {
+ kDebugGraphics = 1 << 0,
+ kDebugResourceLoading = 1 << 1,
+ kDebugFilePath = 1 << 2
+};
+
+}
+
+#endif
\ No newline at end of file
diff --git a/engines/hpl1/detection.cpp b/engines/hpl1/detection.cpp
index 78f58a1c92b..f56ccceae2e 100644
--- a/engines/hpl1/detection.cpp
+++ b/engines/hpl1/detection.cpp
@@ -28,6 +28,7 @@
#include "common/util.h"
#include "hpl1/detection.h"
#include "hpl1/detection_tables.h"
+#include "hpl1/debug.h"
const DebugChannelDef Hpl1MetaEngineDetection::debugFlagList[] = {
{ Hpl1::kDebugGraphics, "Graphics", "Graphics debug level" },
diff --git a/engines/hpl1/detection.h b/engines/hpl1/detection.h
index d7a01f94a2b..e1c089073a9 100644
--- a/engines/hpl1/detection.h
+++ b/engines/hpl1/detection.h
@@ -26,12 +26,6 @@
namespace Hpl1 {
-enum Hpl1DebugChannels {
- kDebugGraphics = 1 << 0,
- kDebugResourceLoading = 1 << 1,
- kDebugFilePath = 1 << 2
-};
-
extern const PlainGameDescriptor GAME_NAMES[];
extern const ADGameDescription GAME_DESCRIPTIONS[];
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp b/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
index cb30094c8d6..52e4a875b74 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
@@ -24,8 +24,7 @@ distribution.
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "common/file.h"
-#include "common/debug.h"
-#include "hpl1/detection.h"
+#include "hpl1/debug.h"
bool TiXmlBase::condenseWhiteSpace = true;
Commit: 3d09e8dfe4338c05487c9a7f6f21ba8248b310fe
https://github.com/scummvm/scummvm/commit/3d09e8dfe4338c05487c9a7f6f21ba8248b310fe
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:27+01:00
Commit Message:
HPL1: fix formatting and add debug levels
Changed paths:
engines/hpl1/debug.h
diff --git a/engines/hpl1/debug.h b/engines/hpl1/debug.h
index cf34e622fcd..f267a9a9338 100644
--- a/engines/hpl1/debug.h
+++ b/engines/hpl1/debug.h
@@ -32,6 +32,12 @@ enum DebugChannels {
kDebugFilePath = 1 << 2
};
+enum DebugLevels {
+ kDebugLevelError = 1,
+ kDebugLevelWarning = 2,
+ kDebugLevelLog = 3
+};
+
}
-#endif
\ No newline at end of file
+#endif
Commit: 5034b2588c7b5abad7d07d7df6e6b40b8f1f4230
https://github.com/scummvm/scummvm/commit/5034b2588c7b5abad7d07d7df6e6b40b8f1f4230
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:27+01:00
Commit Message:
HPL1: replace implementation of logging functions
Changed paths:
engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
index 70eb23d2151..415275e0962 100644
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
@@ -52,6 +52,7 @@
#include "hpl1/engine/impl/LowLevelSystemSDL.h"
#include "hpl1/engine/impl/SqScript.h"
+#include "hpl1/debug.h"
//#include "SDL/SDL.h"
@@ -210,67 +211,31 @@ void SetLogFile(const tWString &asFile) {
//-----------------------------------------------------------------------
void FatalError(const char *fmt, ...) {
-#if 0
- char text[2048];
- va_list ap;
- if (fmt == NULL)
- return;
- va_start(ap, fmt);
- vsprintf(text, fmt, ap);
- va_end(ap);
-
- tString sMess = "FATAL ERROR: ";
- sMess += text;
- gLogWriter.Write(sMess);
-
-#ifdef WIN32
- MessageBox( NULL, cString::To16Char(text).c_str(), _W("FATAL ERROR"), MB_ICONERROR);
-#endif
-
- exit(1);
-#endif
+ va_list vl;
+ va_start(vl, fmt);
+ error(fmt, vl);
+ va_end(vl);
}
void Error(const char *fmt, ...) {
- char text[2048];
- va_list ap;
- if (fmt == NULL)
- return;
- va_start(ap, fmt);
- vsprintf(text, fmt, ap);
- va_end(ap);
-
- tString sMess = "ERROR: ";
- sMess += text;
- gLogWriter.Write(sMess);
+ va_list vl;
+ va_start(vl, fmt);
+ debugN(Hpl1::kDebugLevelError, fmt, vl);
+ va_end(vl);
}
void Warning(const char *fmt, ...) {
- char text[2048];
- va_list ap;
- if (fmt == NULL)
- return;
- va_start(ap, fmt);
- vsprintf(text, fmt, ap);
- va_end(ap);
-
- tString sMess = "WARNING: ";
- sMess += text;
- gLogWriter.Write(sMess);
+ va_list vl;
+ va_start(vl, fmt);
+ debugN(Hpl1::kDebugLevelWarning, fmt, vl);
+ va_end(vl);
}
void Log(const char *fmt, ...) {
- char text[2048];
- va_list ap;
- if (fmt == NULL)
- return;
- va_start(ap, fmt);
- vsprintf(text, fmt, ap);
- va_end(ap);
-
- tString sMess = "";
- sMess += text;
- gLogWriter.Write(sMess);
+ va_list vl;
+ va_start(vl, fmt);
+ debugN(Hpl1::kDebugLevelLog, fmt, vl);
+ va_end(vl);
}
//-----------------------------------------------------------------------
Commit: 5ccf079d0205ee16eccbe6b6aa41294bd5a4a75f
https://github.com/scummvm/scummvm/commit/5ccf079d0205ee16eccbe6b6aa41294bd5a4a75f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:27+01:00
Commit Message:
HPL1: remove log writer class
Changed paths:
engines/hpl1/engine/game/Game.cpp
engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
engines/hpl1/engine/impl/LowLevelSystemSDL.h
engines/hpl1/engine/system/LowLevelSystem.h
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index c543a49bff7..03fe6149644 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -373,10 +373,6 @@ void cGame::Run() {
mbIsUpdated = true;
glClearUpdateCheck++;
- if (glClearUpdateCheck % 500 == 0) {
- if (mpUpdater->GetCurrentContainerName() == "Default")
- ClearUpdateLogFile();
- }
mfGameTime += GetStepSize();
}
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
index 415275e0962..2bff600b698 100644
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
@@ -92,74 +92,6 @@ int main(int argc, char *argv[]) {
namespace hpl {
-//////////////////////////////////////////////////////////////////////////
-// LOG WRITER
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-static cLogWriter gLogWriter(_W("hpl.log"));
-static cLogWriter gUpdateLogWriter(_W("hpl_update.log"));
-
-//-----------------------------------------------------------------------
-
-cLogWriter::cLogWriter(const tWString &asFileName) {
- msFileName = asFileName;
-}
-
-cLogWriter::~cLogWriter() {
-#if 0
- if (mpFile)
- fclose(mpFile);
-#endif
-}
-
-void cLogWriter::Write(const tString &asMessage) {
-#if 0
- if (!mpFile)
- ReopenFile();
-
- if (mpFile) {
- fprintf(mpFile, asMessage.c_str());
- fflush(mpFile);
- }
-#endif
-}
-
-void cLogWriter::Clear() {
-#if 0
- ReopenFile();
- if (mpFile)
- fflush(mpFile);
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-void cLogWriter::SetFileName(const tWString &asFile) {
- if (msFileName == asFile)
- return;
-
- msFileName = asFile;
- ReopenFile();
-}
-
-//-----------------------------------------------------------------------
-
-void cLogWriter::ReopenFile() {
-#if 0
- if(mpFile) fclose(mpFile);
-
-#ifdef WIN32
- mpFile = _wfopen(msFileName.c_str(),_W("w"));
-#else
- mpFile = fopen(cString::To8Char(msFileName).c_str(),"w");
-#endif
-#endif
-}
-
-//-----------------------------------------------------------------------
-
//////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
//////////////////////////////////////////////////////////////////////////
@@ -204,12 +136,6 @@ cLowLevelSystemSDL::~cLowLevelSystemSDL() {
//-----------------------------------------------------------------------
-void SetLogFile(const tWString &asFile) {
- gLogWriter.SetFileName(asFile);
-}
-
-//-----------------------------------------------------------------------
-
void FatalError(const char *fmt, ...) {
va_list vl;
va_start(vl, fmt);
@@ -241,22 +167,12 @@ void Log(const char *fmt, ...) {
//-----------------------------------------------------------------------
static bool gbUpdateLogIsActive;
-void SetUpdateLogFile(const tWString &asFile) {
- gUpdateLogWriter.SetFileName(asFile);
-}
-
-void ClearUpdateLogFile() {
- if (!gbUpdateLogIsActive)
- return;
-
- gUpdateLogWriter.Clear();
-}
-
void SetUpdateLogActive(bool abX) {
gbUpdateLogIsActive = abX;
}
void LogUpdate(const char *fmt, ...) {
+#if 0
if (!gbUpdateLogIsActive)
return;
@@ -271,6 +187,7 @@ void LogUpdate(const char *fmt, ...) {
tString sMess = "";
sMess += text;
gUpdateLogWriter.Write(sMess);
+#endif
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.h b/engines/hpl1/engine/impl/LowLevelSystemSDL.h
index 4c4c07efbe4..202ff856e4f 100644
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelSystemSDL.h
@@ -35,23 +35,6 @@ namespace hpl {
//------------------------------------------------------
-class cLogWriter {
-public:
- cLogWriter(const tWString &asDefaultFile);
- ~cLogWriter();
-
- void Write(const tString &asMessage);
- void Clear();
-
- void SetFileName(const tWString &asFile);
-
-private:
- void ReopenFile();
- tWString msFileName;
-};
-
-//------------------------------------------------------
-
class cScriptOutput // : public asIOutputStream
{
public:
diff --git a/engines/hpl1/engine/system/LowLevelSystem.h b/engines/hpl1/engine/system/LowLevelSystem.h
index bedfdba06e6..accf7f7f736 100644
--- a/engines/hpl1/engine/system/LowLevelSystem.h
+++ b/engines/hpl1/engine/system/LowLevelSystem.h
@@ -61,8 +61,6 @@ extern void Error(const char *fmt, ...);
extern void Warning(const char *fmt, ...);
extern void Log(const char *fmt, ...);
-extern void SetUpdateLogFile(const tWString &asFile);
-extern void ClearUpdateLogFile();
extern void SetUpdateLogActive(bool abX);
extern void LogUpdate(const char *fmt, ...);
Commit: f7f0937818b254a55fb5d6b8d0b6a0d7e53fc688
https://github.com/scummvm/scummvm/commit/f7f0937818b254a55fb5d6b8d0b6a0d7e53fc688
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:27+01:00
Commit Message:
HPL1: modify config file load and save functions
Changed paths:
engines/hpl1/engine/resources/ConfigFile.cpp
diff --git a/engines/hpl1/engine/resources/ConfigFile.cpp b/engines/hpl1/engine/resources/ConfigFile.cpp
index b54347a62bd..3d7755282ec 100644
--- a/engines/hpl1/engine/resources/ConfigFile.cpp
+++ b/engines/hpl1/engine/resources/ConfigFile.cpp
@@ -30,8 +30,7 @@
#include "hpl1/engine/resources/FileSearcher.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/system/String.h"
-
-#include <stdio.h>
+#include "common/file.h"
namespace hpl {
@@ -60,41 +59,19 @@ cConfigFile::~cConfigFile() {
//-----------------------------------------------------------------------
bool cConfigFile::Load() {
-#if 0
-#ifdef WIN32
- FILE *pFile = _wfopen(msFile.c_str(), _W("rb"));
-#else
- FILE *pFile = fopen(cString::To8Char(msFile).c_str(), "rb");
-#endif
-
- bool bRet = mpXmlDoc->LoadFile(pFile);
-
- if (pFile)
- fclose(pFile);
-
- return bRet;
-#endif
- return false;
+ Common::File cf;
+ //FIXME: use proper string types
+ cf.open(cString::To8Char(msFile).c_str());
+ return mpXmlDoc->LoadFile(cf);;
}
//-----------------------------------------------------------------------
bool cConfigFile::Save() {
-#if 0
-#ifdef WIN32
- FILE *pFile = _wfopen(msFile.c_str(), _W("w+"));
-#else
- FILE *pFile = fopen(cString::To8Char(msFile).c_str(), "w+");
-#endif
-
- bool bRet = mpXmlDoc->SaveFile(pFile);
-
- if (pFile)
- fclose(pFile);
-
- return bRet;
-#endif
- return false;
+ Common::DumpFile cf;
+ //FIXME: use proper string types
+ cf.open(cString::To8Char(msFile).c_str());
+ return mpXmlDoc->SaveFile(cf);
}
//-----------------------------------------------------------------------
Commit: fd70cae8dd9ee98fd823dd77b23f900e307d0df1
https://github.com/scummvm/scummvm/commit/fd70cae8dd9ee98fd823dd77b23f900e307d0df1
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:27+01:00
Commit Message:
HPL1: replace script loading implementation
Changed paths:
engines/hpl1/engine/impl/SqScript.cpp
diff --git a/engines/hpl1/engine/impl/SqScript.cpp b/engines/hpl1/engine/impl/SqScript.cpp
index 2981437645c..da863cb36bf 100644
--- a/engines/hpl1/engine/impl/SqScript.cpp
+++ b/engines/hpl1/engine/impl/SqScript.cpp
@@ -30,7 +30,8 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/system/String.h"
-#include <stdio.h>
+#include "common/file.h"
+#include "hpl1/debug.h"
namespace hpl {
@@ -155,19 +156,23 @@ bool cSqScript::Run(int alHandle) {
//-----------------------------------------------------------------------
char *cSqScript::LoadCharBuffer(const tString &asFileName, int &alLength) {
- FILE *pFile = fopen(asFileName.c_str(), "rb");
- if (pFile == NULL) {
- return NULL;
+ Common::File file;
+ //FIXME: use proper string types
+ file.open(asFileName.c_str());
+ if(!file.isOpen()) {
+ debugCN(Hpl1::kDebugLevelError, Hpl1::kDebugFilePath,
+ "script file at %s could not be opened", asFileName.c_str());
+ return nullptr;
+ }
+
+ alLength = file.size();
+ char *pBuffer = hplNewArray(char, alLength);
+ file.read(pBuffer, alLength);
+ if(file.err()) {
+ debugCN(Hpl1::kDebugLevelError, Hpl1::kDebugResourceLoading,
+ "error in reading script file %s", asFileName.c_str());
+ return nullptr;
}
-
- int lLength = (int)Platform::FileLength(pFile);
- alLength = lLength;
-
- char *pBuffer = hplNewArray(char, lLength);
- fread(pBuffer, lLength, 1, pFile);
-
- fclose(pFile);
-
return pBuffer;
}
Commit: 700f99561d194267f4016094005eed1e83cedb46
https://github.com/scummvm/scummvm/commit/700f99561d194267f4016094005eed1e83cedb46
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:27+01:00
Commit Message:
HPL1: replace file finding functions
Changed paths:
engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
engines/hpl1/engine/impl/LowLevelResourcesSDL.h
engines/hpl1/engine/resources/FileSearcher.cpp
engines/hpl1/engine/resources/LowLevelResources.h
diff --git a/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp b/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
index 1a063c37272..3938f4e86f5 100644
--- a/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
@@ -39,6 +39,8 @@
//#include "SDL/SDL_image.h"
#include "hpl1/engine/resources/MeshLoaderHandler.h"
#include "hpl1/engine/resources/VideoManager.h"
+#include "common/fs.h"
+#include "hpl1/debug.h"
namespace hpl {
@@ -153,9 +155,16 @@ void cLowLevelResourcesSDL::AddVideoLoaders(cVideoManager *apManager) {
//-----------------------------------------------------------------------
-// This is a windows implementation of this...I think.
-void cLowLevelResourcesSDL::FindFilesInDir(tWStringList &alstStrings, tWString asDir, tWString asMask) {
- Platform::FindFileInDir(alstStrings, asDir, asMask);
+
+void cLowLevelResourcesSDL::FindFilesInDir(tStringList &alstStrings, tString asDir, tString asMask) {
+ //FIXME: use consistent string types
+ Common::String pattern = Common::String(asDir.c_str()) + '/' + Common::String(asMask.c_str());
+ Common::ArchiveMemberList ls;
+ if (SearchMan.listMatchingMembers(ls, pattern) == 0)
+ debugCN(Hpl1::kDebugLevelWarning, Hpl1::kDebugFilePath, "no files matching pattern %s were found", pattern.c_str());
+
+ for (auto f : ls)
+ alstStrings.push_back(f->getName().c_str());
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/LowLevelResourcesSDL.h b/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
index 4300d2c7032..44acba8e43e 100644
--- a/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
@@ -39,7 +39,7 @@ public:
cLowLevelResourcesSDL(cLowLevelGraphicsSDL *apLowLevelGraphics);
~cLowLevelResourcesSDL();
- void FindFilesInDir(tWStringList &alstStrings, tWString asDir, tWString asMask);
+ void FindFilesInDir(tStringList &alstStrings, tString asDir, tString asMask);
void GetSupportedImageFormats(tStringList &alstFormats);
iBitmap2D *LoadBitmap2D(tString asFilePath, tString asType = "");
diff --git a/engines/hpl1/engine/resources/FileSearcher.cpp b/engines/hpl1/engine/resources/FileSearcher.cpp
index cd17b23b84a..f389a1f6113 100644
--- a/engines/hpl1/engine/resources/FileSearcher.cpp
+++ b/engines/hpl1/engine/resources/FileSearcher.cpp
@@ -29,6 +29,7 @@
#include "hpl1/engine/resources/LowLevelResources.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/system/String.h"
+#include "hpl1/hpl1.h"
namespace hpl {
@@ -56,7 +57,8 @@ cFileSearcher::~cFileSearcher() {
//-----------------------------------------------------------------------
void cFileSearcher::AddDirectory(tString asPath, tString asMask) {
- tWStringList lstFileNames;
+
+ tStringList lstFileNames;
// Make the path with only "/" and lower case.
asPath = cString::ToLowerCase(cString::ReplaceCharTo(asPath, "\\", "/"));
@@ -65,14 +67,11 @@ void cFileSearcher::AddDirectory(tString asPath, tString asMask) {
if (it == m_setLoadedDirs.end()) {
m_setLoadedDirs.insert(asPath);
- mpLowLevelResources->FindFilesInDir(lstFileNames, cString::To16Char(asPath),
- cString::To16Char(asMask));
-
- for (tWStringListIt it = lstFileNames.begin(); it != lstFileNames.end(); it++) {
- tString sFile = cString::To8Char(*it);
+ mpLowLevelResources->FindFilesInDir(lstFileNames, asPath, asMask);
+ for (const auto &f : lstFileNames) {
m_mapFiles.insert(tFilePathMap::value_type(
- cString::ToLowerCase(sFile),
- cString::SetFilePath(sFile, asPath)));
+ cString::ToLowerCase(f),
+ cString::SetFilePath(f, asPath)));
}
}
}
diff --git a/engines/hpl1/engine/resources/LowLevelResources.h b/engines/hpl1/engine/resources/LowLevelResources.h
index efc1c22fc79..fed871b08d2 100644
--- a/engines/hpl1/engine/resources/LowLevelResources.h
+++ b/engines/hpl1/engine/resources/LowLevelResources.h
@@ -46,7 +46,7 @@ public:
* \param asDir Directory
* \param asMask Mask to be used, for example "*.*" to search for all kinds of files.
*/
- virtual void FindFilesInDir(tWStringList &alstStrings, tWString asDir, tWString asMask) = 0;
+ virtual void FindFilesInDir(tStringList &alstStrings, tString asDir, tString asMask) = 0;
virtual void GetSupportedImageFormats(tStringList &alstFormats) = 0;
virtual iBitmap2D *LoadBitmap2D(tString asFilePath, tString asType = "") = 0;
Commit: fb53fd403896087147f6af414264949d95852b08
https://github.com/scummvm/scummvm/commit/fb53fd403896087147f6af414264949d95852b08
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:28+01:00
Commit Message:
HPL1: add header including all engine components
Changed paths:
A engines/hpl1/engine/engine.h
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
new file mode 100644
index 00000000000..f4bfd2ce8ca
--- /dev/null
+++ b/engines/hpl1/engine/engine.h
@@ -0,0 +1,297 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_ENGINE_H
+#define HPL1_ENGINE_H
+
+#include "hpl1/engine/ai/AI.h"
+#include "hpl1/engine/ai/AINodeContainer.h"
+#include "hpl1/engine/ai/AINodeGenerator.h"
+#include "hpl1/engine/ai/AStar.h"
+#include "hpl1/engine/ai/StateMachine.h"
+#include "hpl1/engine/game/Game.h"
+#include "hpl1/engine/game/GameTypes.h"
+#include "hpl1/engine/game/LowLevelGameSetup.h"
+#include "hpl1/engine/game/SaveGame.h"
+#include "hpl1/engine/game/ScriptFuncs.h"
+#include "hpl1/engine/game/Updateable.h"
+#include "hpl1/engine/game/Updater.h"
+#include "hpl1/engine/graphics/Animation.h"
+#include "hpl1/engine/graphics/AnimationTrack.h"
+#include "hpl1/engine/graphics/BackgroundImage.h"
+#include "hpl1/engine/graphics/Beam.h"
+#include "hpl1/engine/graphics/BillBoard.h"
+#include "hpl1/engine/graphics/Bitmap2D.h"
+#include "hpl1/engine/graphics/Bone.h"
+#include "hpl1/engine/graphics/BoneState.h"
+#include "hpl1/engine/graphics/Color.h"
+#include "hpl1/engine/graphics/FontData.h"
+#include "hpl1/engine/graphics/GPUProgram.h"
+#include "hpl1/engine/graphics/GfxObject.h"
+#include "hpl1/engine/graphics/Graphics.h"
+#include "hpl1/engine/graphics/GraphicsDrawer.h"
+#include "hpl1/engine/graphics/GraphicsTypes.h"
+#include "hpl1/engine/graphics/ImageEntityData.h"
+#include "hpl1/engine/graphics/LowLevelGraphics.h"
+#include "hpl1/engine/graphics/LowLevelPicture.h"
+#include "hpl1/engine/graphics/Material.h"
+#include "hpl1/engine/graphics/MaterialHandler.h"
+#include "hpl1/engine/graphics/Material_Additive.h"
+#include "hpl1/engine/graphics/Material_Alpha.h"
+#include "hpl1/engine/graphics/Material_BaseLight.h"
+#include "hpl1/engine/graphics/Material_Bump.h"
+#include "hpl1/engine/graphics/Material_BumpColorSpec.h"
+#include "hpl1/engine/graphics/Material_BumpSpec.h"
+#include "hpl1/engine/graphics/Material_BumpSpec2D.h"
+#include "hpl1/engine/graphics/Material_Diffuse.h"
+#include "hpl1/engine/graphics/Material_Diffuse2D.h"
+#include "hpl1/engine/graphics/Material_DiffuseAdditive2D.h"
+#include "hpl1/engine/graphics/Material_DiffuseAlpha2D.h"
+#include "hpl1/engine/graphics/Material_DiffuseSpec.h"
+#include "hpl1/engine/graphics/Material_EnvMap_Reflect.h"
+#include "hpl1/engine/graphics/Material_Fallback01_BaseLight.h"
+#include "hpl1/engine/graphics/Material_Fallback02_BaseLight.h"
+#include "hpl1/engine/graphics/Material_Flat.h"
+#include "hpl1/engine/graphics/Material_FontNormal.h"
+#include "hpl1/engine/graphics/Material_Modulative.h"
+#include "hpl1/engine/graphics/Material_ModulativeX2.h"
+#include "hpl1/engine/graphics/Material_Smoke2D.h"
+#include "hpl1/engine/graphics/Material_Water.h"
+#include "hpl1/engine/graphics/Mesh.h"
+#include "hpl1/engine/graphics/Mesh2d.h"
+#include "hpl1/engine/graphics/MeshCreator.h"
+#include "hpl1/engine/graphics/OcclusionQuery.h"
+#include "hpl1/engine/graphics/ParticleEmitter.h"
+#include "hpl1/engine/graphics/ParticleEmitter2D.h"
+#include "hpl1/engine/graphics/ParticleEmitter3D.h"
+#include "hpl1/engine/graphics/ParticleEmitter3D_UserData.h"
+#include "hpl1/engine/graphics/ParticleSystem3D.h"
+#include "hpl1/engine/graphics/PixelFormat.h"
+#include "hpl1/engine/graphics/RenderList.h"
+#include "hpl1/engine/graphics/RenderObject2D.h"
+#include "hpl1/engine/graphics/RenderState.h"
+#include "hpl1/engine/graphics/Renderable.h"
+#include "hpl1/engine/graphics/Renderer2D.h"
+#include "hpl1/engine/graphics/Renderer3D.h"
+#include "hpl1/engine/graphics/RendererPostEffects.h"
+#include "hpl1/engine/graphics/Skeleton.h"
+#include "hpl1/engine/graphics/SubMesh.h"
+#include "hpl1/engine/graphics/Texture.h"
+#include "hpl1/engine/graphics/VertexBuffer.h"
+#include "hpl1/engine/graphics/VideoStream.h"
+#include "hpl1/engine/gui/Gui.h"
+#include "hpl1/engine/gui/GuiGfxElement.h"
+#include "hpl1/engine/gui/GuiMaterial.h"
+#include "hpl1/engine/gui/GuiMaterialBasicTypes.h"
+#include "hpl1/engine/gui/GuiPopUp.h"
+#include "hpl1/engine/gui/GuiPopUpMessageBox.h"
+#include "hpl1/engine/gui/GuiSet.h"
+#include "hpl1/engine/gui/GuiSkin.h"
+#include "hpl1/engine/gui/GuiTypes.h"
+#include "hpl1/engine/gui/Widget.h"
+#include "hpl1/engine/gui/WidgetBaseClasses.h"
+#include "hpl1/engine/gui/WidgetButton.h"
+#include "hpl1/engine/gui/WidgetCheckBox.h"
+#include "hpl1/engine/gui/WidgetComboBox.h"
+#include "hpl1/engine/gui/WidgetFrame.h"
+#include "hpl1/engine/gui/WidgetImage.h"
+#include "hpl1/engine/gui/WidgetLabel.h"
+#include "hpl1/engine/gui/WidgetListBox.h"
+#include "hpl1/engine/gui/WidgetSlider.h"
+#include "hpl1/engine/gui/WidgetTextBox.h"
+#include "hpl1/engine/gui/WidgetWindow.h"
+#include "hpl1/engine/haptic/Haptic.h"
+#include "hpl1/engine/haptic/HapticForce.h"
+#include "hpl1/engine/haptic/HapticShape.h"
+#include "hpl1/engine/haptic/HapticSurface.h"
+#include "hpl1/engine/haptic/HapticTypes.h"
+#include "hpl1/engine/haptic/LowLevelHaptic.h"
+#include "hpl1/engine/impl/CGProgram.h"
+#include "hpl1/engine/impl/CharacterBodyNewton.h"
+#include "hpl1/engine/impl/CollideShapeNewton.h"
+#include "hpl1/engine/impl/KeyboardSDL.h"
+#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
+#include "hpl1/engine/impl/LowLevelInputSDL.h"
+#include "hpl1/engine/impl/LowLevelPhysicsNewton.h"
+#include "hpl1/engine/impl/LowLevelResourcesSDL.h"
+#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
+#include "hpl1/engine/impl/LowLevelSystemSDL.h"
+#include "hpl1/engine/impl/MeshLoaderCollada.h"
+#include "hpl1/engine/impl/MeshLoaderMSH.h"
+#include "hpl1/engine/impl/MouseSDL.h"
+#include "hpl1/engine/impl/OcclusionQueryOGL.h"
+#include "hpl1/engine/impl/OpenALSoundChannel.h"
+#include "hpl1/engine/impl/OpenALSoundData.h"
+#include "hpl1/engine/impl/OpenALSoundEnvironment.h"
+#include "hpl1/engine/impl/PBuffer.h"
+#include "hpl1/engine/impl/PhysicsBodyNewton.h"
+#include "hpl1/engine/impl/PhysicsControllerNewton.h"
+#include "hpl1/engine/impl/PhysicsJointBallNewton.h"
+#include "hpl1/engine/impl/PhysicsJointHingeNewton.h"
+#include "hpl1/engine/impl/PhysicsJointNewton.h"
+#include "hpl1/engine/impl/PhysicsJointScrewNewton.h"
+#include "hpl1/engine/impl/PhysicsJointSliderNewton.h"
+#include "hpl1/engine/impl/PhysicsMaterialNewton.h"
+#include "hpl1/engine/impl/PhysicsWorldNewton.h"
+#include "hpl1/engine/impl/Platform.h"
+#include "hpl1/engine/impl/SDLBitmap2D.h"
+#include "hpl1/engine/impl/SDLFontData.h"
+#include "hpl1/engine/impl/SDLGameSetup.h"
+#include "hpl1/engine/impl/SDLPixelFormat.h"
+#include "hpl1/engine/impl/SDLTexture.h"
+#include "hpl1/engine/impl/SqScript.h"
+#include "hpl1/engine/impl/VertexBufferOGL.h"
+#include "hpl1/engine/impl/VertexBufferVBO.h"
+#include "hpl1/engine/impl/VideoStreamTheora.h"
+#include "hpl1/engine/impl/scriptstring.h"
+#include "hpl1/engine/impl/stdstring.h"
+#include "hpl1/engine/impl/temp-types.h"
+#include "hpl1/engine/impl/tinyXML/tinystr.h"
+#include "hpl1/engine/impl/tinyXML/tinyxml.h"
+#include "hpl1/engine/input/Action.h"
+#include "hpl1/engine/input/ActionHaptic.h"
+#include "hpl1/engine/input/ActionKeyboard.h"
+#include "hpl1/engine/input/ActionMouseButton.h"
+#include "hpl1/engine/input/Input.h"
+#include "hpl1/engine/input/InputDevice.h"
+#include "hpl1/engine/input/InputTypes.h"
+#include "hpl1/engine/input/Keyboard.h"
+#include "hpl1/engine/input/LowLevelInput.h"
+#include "hpl1/engine/input/Mouse.h"
+#include "hpl1/engine/math/BoundingVolume.h"
+#include "hpl1/engine/math/CRC.h"
+#include "hpl1/engine/math/Frustum.h"
+#include "hpl1/engine/math/Math.h"
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/math/Matrix.h"
+#include "hpl1/engine/math/MeshTypes.h"
+#include "hpl1/engine/math/PidController.h"
+#include "hpl1/engine/math/Quaternion.h"
+#include "hpl1/engine/math/Spring.h"
+#include "hpl1/engine/math/Vector2.h"
+#include "hpl1/engine/math/Vector3.h"
+#include "hpl1/engine/physics/Body2D.h"
+#include "hpl1/engine/physics/CharacterBody.h"
+#include "hpl1/engine/physics/CollideData.h"
+#include "hpl1/engine/physics/CollideData2D.h"
+#include "hpl1/engine/physics/CollideShape.h"
+#include "hpl1/engine/physics/Collider2D.h"
+#include "hpl1/engine/physics/LowLevelPhysics.h"
+#include "hpl1/engine/physics/Physics.h"
+#include "hpl1/engine/physics/PhysicsBody.h"
+#include "hpl1/engine/physics/PhysicsController.h"
+#include "hpl1/engine/physics/PhysicsJoint.h"
+#include "hpl1/engine/physics/PhysicsJointBall.h"
+#include "hpl1/engine/physics/PhysicsJointHinge.h"
+#include "hpl1/engine/physics/PhysicsJointScrew.h"
+#include "hpl1/engine/physics/PhysicsJointSlider.h"
+#include "hpl1/engine/physics/PhysicsMaterial.h"
+#include "hpl1/engine/physics/PhysicsWorld.h"
+#include "hpl1/engine/physics/SurfaceData.h"
+#include "hpl1/engine/resources/AnimationManager.h"
+#include "hpl1/engine/resources/ConfigFile.h"
+#include "hpl1/engine/resources/EntityLoader_Object.h"
+#include "hpl1/engine/resources/FileSearcher.h"
+#include "hpl1/engine/resources/FontManager.h"
+#include "hpl1/engine/resources/FrameBase.h"
+#include "hpl1/engine/resources/FrameBitmap.h"
+#include "hpl1/engine/resources/FrameTexture.h"
+#include "hpl1/engine/resources/GpuProgramManager.h"
+#include "hpl1/engine/resources/ImageEntityManager.h"
+#include "hpl1/engine/resources/ImageManager.h"
+#include "hpl1/engine/resources/LanguageFile.h"
+#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/MaterialManager.h"
+#include "hpl1/engine/resources/MeshLoader.h"
+#include "hpl1/engine/resources/MeshLoaderHandler.h"
+#include "hpl1/engine/resources/MeshManager.h"
+#include "hpl1/engine/resources/ParticleManager.h"
+#include "hpl1/engine/resources/ResourceBase.h"
+#include "hpl1/engine/resources/ResourceImage.h"
+#include "hpl1/engine/resources/ResourceManager.h"
+#include "hpl1/engine/resources/Resources.h"
+#include "hpl1/engine/resources/ResourcesTypes.h"
+#include "hpl1/engine/resources/ScriptManager.h"
+#include "hpl1/engine/resources/SoundEntityManager.h"
+#include "hpl1/engine/resources/SoundManager.h"
+#include "hpl1/engine/resources/TextureManager.h"
+#include "hpl1/engine/resources/TileSetManager.h"
+#include "hpl1/engine/resources/VideoManager.h"
+#include "hpl1/engine/scene/AnimationState.h"
+#include "hpl1/engine/scene/Area2D.h"
+#include "hpl1/engine/scene/Camera.h"
+#include "hpl1/engine/scene/Camera2D.h"
+#include "hpl1/engine/scene/Camera3D.h"
+#include "hpl1/engine/scene/ColliderEntity.h"
+#include "hpl1/engine/scene/Entity.h"
+#include "hpl1/engine/scene/Entity2D.h"
+#include "hpl1/engine/scene/Entity3D.h"
+#include "hpl1/engine/scene/GridMap2D.h"
+#include "hpl1/engine/scene/ImageEntity.h"
+#include "hpl1/engine/scene/Light.h"
+#include "hpl1/engine/scene/Light2D.h"
+#include "hpl1/engine/scene/Light2DPoint.h"
+#include "hpl1/engine/scene/Light3D.h"
+#include "hpl1/engine/scene/Light3DPoint.h"
+#include "hpl1/engine/scene/Light3DSpot.h"
+#include "hpl1/engine/scene/MeshEntity.h"
+#include "hpl1/engine/scene/MultiImageEntity.h"
+#include "hpl1/engine/scene/Node.h"
+#include "hpl1/engine/scene/Node2D.h"
+#include "hpl1/engine/scene/Node3D.h"
+#include "hpl1/engine/scene/NodeState.h"
+#include "hpl1/engine/scene/PortalContainer.h"
+#include "hpl1/engine/scene/RenderableContainer.h"
+#include "hpl1/engine/scene/Scene.h"
+#include "hpl1/engine/scene/SectorVisibility.h"
+#include "hpl1/engine/scene/SoundEntity.h"
+#include "hpl1/engine/scene/SoundSource.h"
+#include "hpl1/engine/scene/SubMeshEntity.h"
+#include "hpl1/engine/scene/Tile.h"
+#include "hpl1/engine/scene/TileData.h"
+#include "hpl1/engine/scene/TileLayer.h"
+#include "hpl1/engine/scene/TileMap.h"
+#include "hpl1/engine/scene/TileMapIt.h"
+#include "hpl1/engine/scene/TileMapLineIt.h"
+#include "hpl1/engine/scene/TileMapRectIt.h"
+#include "hpl1/engine/scene/TileSet.h"
+#include "hpl1/engine/scene/World2D.h"
+#include "hpl1/engine/scene/World3D.h"
+#include "hpl1/engine/sound/LowLevelSound.h"
+#include "hpl1/engine/sound/MusicHandler.h"
+#include "hpl1/engine/sound/Sound.h"
+#include "hpl1/engine/sound/SoundChannel.h"
+#include "hpl1/engine/sound/SoundData.h"
+#include "hpl1/engine/sound/SoundEntityData.h"
+#include "hpl1/engine/sound/SoundEnvironment.h"
+#include "hpl1/engine/sound/SoundHandler.h"
+#include "hpl1/engine/system/BinTree.h"
+#include "hpl1/engine/system/Container.h"
+#include "hpl1/engine/system/LogicTimer.h"
+#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/MemoryManager.h"
+#include "hpl1/engine/system/Script.h"
+#include "hpl1/engine/system/SerializeClass.h"
+#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/system/System.h"
+#include "hpl1/engine/system/SystemTypes.h"
+
+#endif
\ No newline at end of file
Commit: 65b7a4740feb0fd909b2022f0d5524cc908d0060
https://github.com/scummvm/scummvm/commit/65b7a4740feb0fd909b2022f0d5524cc908d0060
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:28+01:00
Commit Message:
HPL1: add game code
Changed paths:
A engines/hpl1/penumbra-overture/AttackHandler.cpp
A engines/hpl1/penumbra-overture/AttackHandler.h
A engines/hpl1/penumbra-overture/ButtonHandler.cpp
A engines/hpl1/penumbra-overture/ButtonHandler.h
A engines/hpl1/penumbra-overture/CharacterMove.cpp
A engines/hpl1/penumbra-overture/CharacterMove.h
A engines/hpl1/penumbra-overture/Credits.cpp
A engines/hpl1/penumbra-overture/Credits.h
A engines/hpl1/penumbra-overture/DeathMenu.cpp
A engines/hpl1/penumbra-overture/DeathMenu.h
A engines/hpl1/penumbra-overture/DemoEndText.cpp
A engines/hpl1/penumbra-overture/DemoEndText.h
A engines/hpl1/penumbra-overture/EffectHandler.cpp
A engines/hpl1/penumbra-overture/EffectHandler.h
A engines/hpl1/penumbra-overture/FadeHandler.cpp
A engines/hpl1/penumbra-overture/FadeHandler.h
A engines/hpl1/penumbra-overture/GameArea.cpp
A engines/hpl1/penumbra-overture/GameArea.h
A engines/hpl1/penumbra-overture/GameDamageArea.cpp
A engines/hpl1/penumbra-overture/GameDamageArea.h
A engines/hpl1/penumbra-overture/GameEnemy.cpp
A engines/hpl1/penumbra-overture/GameEnemy.h
A engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
A engines/hpl1/penumbra-overture/GameEnemy_Dog.h
A engines/hpl1/penumbra-overture/GameEnemy_Spider.cpp
A engines/hpl1/penumbra-overture/GameEnemy_Spider.h
A engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
A engines/hpl1/penumbra-overture/GameEnemy_Worm.h
A engines/hpl1/penumbra-overture/GameEntity.cpp
A engines/hpl1/penumbra-overture/GameEntity.h
A engines/hpl1/penumbra-overture/GameForceArea.cpp
A engines/hpl1/penumbra-overture/GameForceArea.h
A engines/hpl1/penumbra-overture/GameItem.cpp
A engines/hpl1/penumbra-overture/GameItem.h
A engines/hpl1/penumbra-overture/GameItemType.cpp
A engines/hpl1/penumbra-overture/GameItemType.h
A engines/hpl1/penumbra-overture/GameLadder.cpp
A engines/hpl1/penumbra-overture/GameLadder.h
A engines/hpl1/penumbra-overture/GameLamp.cpp
A engines/hpl1/penumbra-overture/GameLamp.h
A engines/hpl1/penumbra-overture/GameLink.cpp
A engines/hpl1/penumbra-overture/GameLink.h
A engines/hpl1/penumbra-overture/GameLiquidArea.cpp
A engines/hpl1/penumbra-overture/GameLiquidArea.h
A engines/hpl1/penumbra-overture/GameMessageHandler.cpp
A engines/hpl1/penumbra-overture/GameMessageHandler.h
A engines/hpl1/penumbra-overture/GameMusicHandler.cpp
A engines/hpl1/penumbra-overture/GameMusicHandler.h
A engines/hpl1/penumbra-overture/GameObject.cpp
A engines/hpl1/penumbra-overture/GameObject.h
A engines/hpl1/penumbra-overture/GameSaveArea.cpp
A engines/hpl1/penumbra-overture/GameSaveArea.h
A engines/hpl1/penumbra-overture/GameScripts.cpp
A engines/hpl1/penumbra-overture/GameScripts.h
A engines/hpl1/penumbra-overture/GameStickArea.cpp
A engines/hpl1/penumbra-overture/GameStickArea.h
A engines/hpl1/penumbra-overture/GameSwingDoor.cpp
A engines/hpl1/penumbra-overture/GameSwingDoor.h
A engines/hpl1/penumbra-overture/GameTypes.cpp
A engines/hpl1/penumbra-overture/GameTypes.h
A engines/hpl1/penumbra-overture/GlobalInit.h
A engines/hpl1/penumbra-overture/GraphicsHelper.cpp
A engines/hpl1/penumbra-overture/GraphicsHelper.h
A engines/hpl1/penumbra-overture/HapticGameCamera.cpp
A engines/hpl1/penumbra-overture/HapticGameCamera.h
A engines/hpl1/penumbra-overture/HudModel_Throw.cpp
A engines/hpl1/penumbra-overture/HudModel_Throw.h
A engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
A engines/hpl1/penumbra-overture/HudModel_Weapon.h
A engines/hpl1/penumbra-overture/Init.cpp
A engines/hpl1/penumbra-overture/Init.h
A engines/hpl1/penumbra-overture/IntroStory.cpp
A engines/hpl1/penumbra-overture/IntroStory.h
A engines/hpl1/penumbra-overture/Inventory.cpp
A engines/hpl1/penumbra-overture/Inventory.h
A engines/hpl1/penumbra-overture/Main.cpp
A engines/hpl1/penumbra-overture/MainMenu.cpp
A engines/hpl1/penumbra-overture/MainMenu.h
A engines/hpl1/penumbra-overture/MapHandler.cpp
A engines/hpl1/penumbra-overture/MapHandler.h
A engines/hpl1/penumbra-overture/MapLoadText.cpp
A engines/hpl1/penumbra-overture/MapLoadText.h
A engines/hpl1/penumbra-overture/Notebook.cpp
A engines/hpl1/penumbra-overture/Notebook.h
A engines/hpl1/penumbra-overture/NumericalPanel.cpp
A engines/hpl1/penumbra-overture/NumericalPanel.h
A engines/hpl1/penumbra-overture/Player.cpp
A engines/hpl1/penumbra-overture/Player.h
A engines/hpl1/penumbra-overture/PlayerHands.cpp
A engines/hpl1/penumbra-overture/PlayerHands.h
A engines/hpl1/penumbra-overture/PlayerHelper.cpp
A engines/hpl1/penumbra-overture/PlayerHelper.h
A engines/hpl1/penumbra-overture/PlayerMoveStates.h
A engines/hpl1/penumbra-overture/PlayerState.h
A engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
A engines/hpl1/penumbra-overture/PlayerState_Interact.h
A engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
A engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.h
A engines/hpl1/penumbra-overture/PlayerState_Misc.cpp
A engines/hpl1/penumbra-overture/PlayerState_Misc.h
A engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.cpp
A engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.h
A engines/hpl1/penumbra-overture/PlayerState_Weapon.cpp
A engines/hpl1/penumbra-overture/PlayerState_Weapon.h
A engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
A engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.h
A engines/hpl1/penumbra-overture/PreMenu.cpp
A engines/hpl1/penumbra-overture/PreMenu.h
A engines/hpl1/penumbra-overture/RadioHandler.cpp
A engines/hpl1/penumbra-overture/RadioHandler.h
A engines/hpl1/penumbra-overture/SaveHandler.cpp
A engines/hpl1/penumbra-overture/SaveHandler.h
A engines/hpl1/penumbra-overture/SaveTypes.cpp
A engines/hpl1/penumbra-overture/SaveTypes.h
A engines/hpl1/penumbra-overture/TriggerHandler.cpp
A engines/hpl1/penumbra-overture/TriggerHandler.h
A engines/hpl1/penumbra-overture/Triggers.cpp
A engines/hpl1/penumbra-overture/Triggers.h
A engines/hpl1/penumbra-overture/Version.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 19c180db9c1..3f2795f0f38 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -1,9 +1,8 @@
MODULE := engines/hpl1
MODULE_OBJS := \
- hpl1.o \
console.o \
- metaengine.o \
+ detection.o \
engine/ai/AI.o \
engine/ai/AINodeContainer.o \
engine/ai/AINodeGenerator.o \
@@ -165,6 +164,8 @@ MODULE_OBJS := \
engine/resources/ConfigFile.o \
engine/resources/EntityLoader_Object.o \
engine/resources/FileSearcher.o \
+ engine/resources/FontManager.o \
+ engine/resources/FrameBitmap.o \
engine/resources/FrameTexture.o \
engine/resources/GpuProgramManager.o \
engine/resources/ImageEntityManager.o \
@@ -232,6 +233,65 @@ MODULE_OBJS := \
engine/system/SerializeClass.o \
engine/system/String.o \
engine/system/System.o \
+ hpl1.o \
+ metaengine.o \
+ penumbra-overture/AttackHandler.o \
+ penumbra-overture/ButtonHandler.o \
+ penumbra-overture/CharacterMove.o \
+ penumbra-overture/Credits.o \
+ penumbra-overture/DeathMenu.o \
+ penumbra-overture/DemoEndText.o \
+ penumbra-overture/EffectHandler.o \
+ penumbra-overture/FadeHandler.o \
+ penumbra-overture/GameArea.o \
+ penumbra-overture/GameDamageArea.o \
+ penumbra-overture/GameEnemy.o \
+ penumbra-overture/GameEnemy_Dog.o \
+ penumbra-overture/GameEnemy_Spider.o \
+ penumbra-overture/GameEnemy_Worm.o \
+ penumbra-overture/GameEntity.o \
+ penumbra-overture/GameForceArea.o \
+ penumbra-overture/GameItem.o \
+ penumbra-overture/GameItemType.o \
+ penumbra-overture/GameLadder.o \
+ penumbra-overture/GameLamp.o \
+ penumbra-overture/GameLink.o \
+ penumbra-overture/GameLiquidArea.o \
+ penumbra-overture/GameMessageHandler.o \
+ penumbra-overture/GameMusicHandler.o \
+ penumbra-overture/GameObject.o \
+ penumbra-overture/GameSaveArea.o \
+ penumbra-overture/GameScripts.o \
+ penumbra-overture/GameStickArea.o \
+ penumbra-overture/GameSwingDoor.o \
+ penumbra-overture/GameTypes.o \
+ penumbra-overture/GraphicsHelper.o \
+ penumbra-overture/HudModel_Weapon.o \
+ penumbra-overture/Init.o \
+ penumbra-overture/IntroStory.o \
+ penumbra-overture/Inventory.o \
+ penumbra-overture/Main.o \
+ penumbra-overture/MainMenu.o \
+ penumbra-overture/MapHandler.o \
+ penumbra-overture/MapLoadText.o \
+ penumbra-overture/Notebook.o \
+ penumbra-overture/NumericalPanel.o \
+ penumbra-overture/Player.o \
+ penumbra-overture/PlayerHands.o \
+ penumbra-overture/PlayerHelper.o \
+ penumbra-overture/PlayerState_Interact.o \
+ penumbra-overture/PlayerState_InteractHaptX.o \
+ penumbra-overture/PlayerState_Misc.o \
+ penumbra-overture/PlayerState_MiscHaptX.o \
+ penumbra-overture/PlayerState_Weapon.o \
+ penumbra-overture/PlayerState_WeaponHaptX.o \
+ penumbra-overture/PreMenu.o \
+ penumbra-overture/RadioHandler.o \
+ penumbra-overture/SaveHandler.o \
+ penumbra-overture/SaveTypes.o \
+ penumbra-overture/StdAfx.o \
+ penumbra-overture/TriggerHandler.o \
+ penumbra-overture/Triggers.o
# This module can be built as a plugin
ifeq ($(ENABLE_HPL1), DYNAMIC_PLUGIN)
diff --git a/engines/hpl1/penumbra-overture/AttackHandler.cpp b/engines/hpl1/penumbra-overture/AttackHandler.cpp
new file mode 100644
index 00000000000..4f496f7ab34
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/AttackHandler.cpp
@@ -0,0 +1,545 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#include "hpl1/penumbra-overture/AttackHandler.h"
+
+#include "hpl1/penumbra-overture/GameEnemy.h"
+#include "hpl1/penumbra-overture/GameObject.h"
+#include "hpl1/penumbra-overture/GameSwingDoor.h"
+#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/penumbra-overture/MapHandler.h"
+#include "hpl1/penumbra-overture/Player.h"
+
+//////////////////////////////////////////////////////////////////////////
+// RAY CALLBACK
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cAttackRayCallback::cAttackRayCallback() {
+ mbSkipCharacter = false;
+}
+
+//-----------------------------------------------------------------------
+
+void cAttackRayCallback::Reset() {
+ mpClosestBody = NULL;
+ mbSkipCharacter = false;
+}
+
+//-----------------------------------------------------------------------
+
+bool cAttackRayCallback::OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
+ if (pBody->GetCollide() == false)
+ return true;
+ if (pBody == mpSkipBody)
+ return true;
+ if (mbSkipCharacter && pBody->IsCharacter())
+ return true;
+
+ if (apParams->mfDist < mfShortestDist || mpClosestBody == NULL) {
+ mpClosestBody = pBody;
+ mfShortestDist = apParams->mfDist;
+ mvPosition = apParams->mvPoint;
+ }
+
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// SPLASH DAMAGE BLOCK CHECK
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cSplashDamageBlockCheck::cSplashDamageBlockCheck(cInit *apInit) {
+ mpInit = apInit;
+ mbIntersected = false;
+}
+
+//-----------------------------------------------------------------------
+
+bool cSplashDamageBlockCheck::CheckBlock(const cVector3f &avStart, const cVector3f &avEnd) {
+ mbIntersected = false;
+ iPhysicsWorld *pWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+
+ pWorld->CastRay(this, avStart, avEnd, false, false, false, true);
+
+ return mbIntersected;
+}
+
+//-----------------------------------------------------------------------
+
+bool cSplashDamageBlockCheck::BeforeIntersect(iPhysicsBody *pBody) {
+ if (pBody->IsCharacter() || pBody->GetMass() != 0 || pBody->GetBlocksSound() == false) {
+ return false;
+ }
+
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+bool cSplashDamageBlockCheck::OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
+ mbIntersected = true;
+ return false;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cAttackHandler::cAttackHandler(cInit *apInit) : iUpdateable("AttackHandler") {
+ mpInit = apInit;
+
+ mpSplashBlockCheck = hplNew(cSplashDamageBlockCheck, (apInit));
+}
+
+//-----------------------------------------------------------------------
+
+cAttackHandler::~cAttackHandler(void) {
+ hplDelete(mpSplashBlockCheck);
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+bool cAttackHandler::CreateLineAttack(const cVector3f &avStart, const cVector3f &avEnd, float afDamage,
+ eAttackTargetFlag aTarget, iPhysicsBody *apSkipBody,
+ iPhysicsBody **apPickedBody) {
+ iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+
+ mRayCallback.mTarget = aTarget;
+ mRayCallback.mpSkipBody = apSkipBody;
+
+ if (apPickedBody)
+ *apPickedBody = NULL;
+
+ mRayCallback.Reset();
+ pPhysicsWorld->CastRay(&mRayCallback, avStart, avEnd, true, false, true);
+
+ if (mRayCallback.mpClosestBody == NULL)
+ return false;
+
+ if (apPickedBody)
+ *apPickedBody = mRayCallback.mpClosestBody;
+
+ if (aTarget & eAttackTargetFlag_Player) {
+ if (mpInit->mpPlayer->GetCharacterBody()->GetBody() == mRayCallback.mpClosestBody) {
+ if (afDamage > 0)
+ mpInit->mpPlayer->Damage(afDamage, ePlayerDamageType_BloodSplash);
+ return true;
+ }
+ }
+
+ if (aTarget & eAttackTargetFlag_Enemy) {
+ }
+
+ return false;
+}
+
+//-----------------------------------------------------------------------
+
+bool cAttackHandler::CreateShapeAttack(iCollideShape *apShape, const cMatrixf &a_mtxOffset,
+ const cVector3f &avOrigin, float afDamage,
+ float afMinMass, float afMaxMass, float afMinImpulse, float afMaxImpulse,
+ int alStrength,
+ eAttackTargetFlag aTarget, iPhysicsBody *apSkipBody) {
+ bool bHit = false;
+
+ tPhysicsBodyList lstBodies;
+
+ mpLastSwingDoor = NULL;
+
+ ///////////////////////////////
+ // Set up boudning box
+ cBoundingVolume tempBV = apShape->GetBoundingVolume();
+ tempBV.SetTransform(a_mtxOffset);
+
+ ///////////////////////////////
+ // Iterate bodies
+ cCollideData collideData;
+ collideData.SetMaxSize(1);
+
+ cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
+ iPhysicsWorld *pPhysicsWorld = pWorld->GetPhysicsWorld();
+
+ // Get bodies and add to list, this incase the portal contaniner gets changed.
+ std::list<iPhysicsBody *> lstTempBodies;
+ cPhysicsBodyIterator bodyIt = pPhysicsWorld->GetBodyIterator();
+ while (bodyIt.HasNext()) {
+ iPhysicsBody *pBody = static_cast<iPhysicsBody *>(bodyIt.Next());
+ lstTempBodies.push_back(pBody);
+ }
+
+ std::list<iPhysicsBody *>::iterator it = lstTempBodies.begin();
+ for (; it != lstTempBodies.end(); ++it) {
+ iPhysicsBody *pBody = *it;
+ float fMass = pBody->GetMass();
+
+ if (pBody->IsActive() == false)
+ continue;
+ if (pBody->GetCollide() == false)
+ continue;
+
+ if (cMath::CheckCollisionBV(tempBV, *pBody->GetBV())) {
+ iGameEntity *pEntity = (iGameEntity *)pBody->GetUserData();
+
+ ///////////////////////////////
+ // Check for collision
+ if (pPhysicsWorld->CheckShapeCollision(pBody->GetShape(), pBody->GetLocalMatrix(),
+ apShape, a_mtxOffset, collideData, 1) == false) {
+ continue;
+ }
+
+ ///////////////////////////
+ // Player
+ if (aTarget & eAttackTargetFlag_Player) {
+ if (mpInit->mpPlayer->GetCharacterBody()->GetBody() == pBody) {
+ // Check with line if there is a free path, if not skip damage.
+ cVector3f vEnd = pBody->GetWorldPosition();
+
+ mRayCallback.Reset();
+ mRayCallback.mbSkipCharacter = true;
+ pPhysicsWorld->CastRay(&mRayCallback, avOrigin, vEnd, true, false, false);
+ mRayCallback.mbSkipCharacter = false;
+
+ // Damage
+ if (mRayCallback.mpClosestBody == NULL) {
+ if (afDamage > 0) {
+ mpInit->mpPlayer->Damage(afDamage, ePlayerDamageType_BloodSplash);
+ }
+ }
+
+ // Impulse
+ float fMass = mpInit->mpPlayer->GetCharacterBody()->GetMass();
+ float fForceSize = 0;
+ if (fMass > afMaxMass * 10)
+ fForceSize = 0;
+ else if (fMass <= afMinMass * 10)
+ fForceSize = afMaxImpulse * 10;
+ else {
+ float fT = (fMass - afMinMass * 10) / (afMaxMass * 10 - afMinMass * 10);
+ fForceSize = afMinImpulse * 10 * fT + afMaxImpulse * 10 * (1 - fT);
+ }
+
+ cVector3f vForceDir = mpInit->mpPlayer->GetCharacterBody()->GetPosition() - avOrigin;
+ vForceDir.Normalise();
+ vForceDir += cVector3f(0, 0.1f, 0);
+
+ mpInit->mpPlayer->GetCharacterBody()->AddForce(vForceDir * fForceSize * 300);
+
+ bHit = true;
+ continue;
+ }
+ }
+
+ ///////////////////////////
+ // Enemy
+ if (aTarget & eAttackTargetFlag_Enemy) {
+ }
+
+ ///////////////////////////
+ // Bodies
+ if (aTarget & eAttackTargetFlag_Bodies) {
+ if (pBody->IsCharacter() == false) {
+ lstBodies.push_back(pBody);
+
+ if (pEntity) {
+ pEntity->Damage(afDamage, alStrength);
+
+ if (pEntity->GetType() == eGameEntityType_SwingDoor) {
+ mpLastSwingDoor = static_cast<cGameSwingDoor *>(pEntity);
+ }
+ }
+
+ bHit = true;
+ }
+ }
+ }
+ }
+
+ ////////////////////////////////
+ // Iterate bodies hit, this to
+ // spread out the impulse.
+ float fAmount = (float)lstBodies.size();
+ for (tPhysicsBodyListIt it = lstBodies.begin(); it != lstBodies.end(); ++it) {
+ iPhysicsBody *pBody = *it;
+
+ // Calculate force
+ float fMass = pBody->GetMass();
+ float fForceSize = 0;
+ if (fMass > afMaxMass)
+ fForceSize = 0;
+ else if (fMass <= afMinMass)
+ fForceSize = afMaxImpulse;
+ else {
+ float fT = (fMass - afMinMass) / (afMaxMass - afMinMass);
+ fForceSize = afMinImpulse * fT + afMaxImpulse * (1 - fT);
+ }
+
+ fForceSize /= fAmount;
+
+ if (fMass > 0 && fForceSize > 0) {
+ cVector3f vDir = pBody->GetWorldPosition() - avOrigin;
+ vDir.Normalise();
+
+ pBody->AddImpulse(vDir * fForceSize);
+ }
+ }
+
+ return bHit;
+}
+
+//-----------------------------------------------------------------------
+
+bool cAttackHandler::CreateLineDestroyBody(const cVector3f &avStart, const cVector3f &avEnd,
+ float afStrength, float afForce, iPhysicsBody *apSkipBody,
+ iPhysicsBody **apPickedBody) {
+ iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+
+ mRayCallback.mpSkipBody = apSkipBody;
+
+ if (apPickedBody)
+ *apPickedBody = NULL;
+
+ mRayCallback.Reset();
+ pPhysicsWorld->CastRay(&mRayCallback, avStart, avEnd, true, false, true);
+
+ if (mRayCallback.mpClosestBody == NULL)
+ return false;
+
+ if (apPickedBody)
+ *apPickedBody = mRayCallback.mpClosestBody;
+ iPhysicsBody *pBody = mRayCallback.mpClosestBody;
+
+ if (pBody->IsCharacter() == false && pBody->GetMass() > 0 && pBody->GetUserData()) {
+ iGameEntity *pEntity = (iGameEntity *)pBody->GetUserData();
+ if (pEntity->GetType() != eGameEntityType_Object)
+ return false;
+
+ cGameObject *pObject = static_cast<cGameObject *>(pEntity);
+
+ cVector3f vForward = avEnd - avStart;
+ vForward.Normalise();
+
+ pBody->AddForce(vForward * afForce);
+
+ // Destroy object if possible.
+ if (pObject->IsDestroyable() && pObject->GetDestroyStrength() <= afStrength) {
+ for (int i = 0; i < pBody->GetJointNum(); ++i) {
+ iPhysicsJoint *pJoint = pBody->GetJoint(i);
+ pJoint->Break();
+ }
+
+ if (pObject->GetInteractMode() == eObjectInteractMode_Move)
+ pObject->SetInteractMode(eObjectInteractMode_Grab);
+
+ if (pObject->GetDestroySound() != "") {
+ cSoundEntity *pSound = mpInit->mpGame->GetScene()->GetWorld3D()->CreateSoundEntity(
+ "Destroy", pObject->GetDestroySound(),
+ true);
+ if (pSound)
+ pSound->SetPosition(pBody->GetWorldPosition());
+ }
+ }
+ }
+
+ return false;
+}
+
+//----------------------------------------------------------------------
+
+static float CalcSize(float afDist, float afMaxDist, float afMinVal, float afMaxVal) {
+ float fMul = 1 - (afDist / afMaxDist);
+ if (fMul < 0)
+ return 0;
+
+ return afMinVal + (afMaxVal - afMinVal) * fMul;
+}
+
+//----------------------------------------------------------------------
+
+void cAttackHandler::CreateSplashDamage(const cVector3f &avCenter, float afRadius, float afMinDamage,
+ float afMaxDamge, float afMinForce, float afMaxForce,
+ float afMaxImpulse,
+ unsigned int aTarget, float afMinMass,
+ int alStrength) {
+ cBoundingVolume tempBV;
+ tempBV.SetSize(afRadius * 2);
+ tempBV.SetPosition(avCenter);
+
+ if (aTarget & eAttackTargetFlag_Player) {
+ cBoundingVolume *pCharBV = mpInit->mpPlayer->GetCharacterBody()->GetBody()->GetBV();
+ if (cMath::CheckCollisionBV(tempBV, *pCharBV) &&
+ mpSplashBlockCheck->CheckBlock(pCharBV->GetWorldCenter(), avCenter) == false) {
+ float fDist = cMath::Vector3Dist(pCharBV->GetPosition(), avCenter);
+ mpInit->mpPlayer->Damage(CalcSize(fDist, afRadius, afMinDamage, afMaxDamge), ePlayerDamageType_BloodSplash);
+
+ float fForceSize = CalcSize(fDist, afRadius, afMinForce, afMaxForce);
+ cVector3f vForceDir = mpInit->mpPlayer->GetCharacterBody()->GetPosition() - avCenter;
+ vForceDir.Normalise();
+
+ mpInit->mpPlayer->GetCharacterBody()->AddForce(vForceDir * fForceSize * 10);
+ }
+ }
+ // Enemies now have the user data added to the body, this is not needed.
+ /*if(aTarget & eAttackTargetFlag_Enemy)
+ {
+ tGameEnemyIterator it = mpMapHandler->GetGameEnemyIterator();
+ while(it.HasNext())
+ {
+ iGameEnemy *pEnemy = it.Next();
+
+ cBoundingVolume* pCharBV = pEnemy->GetMover()->GetCharBody()->GetBody()->GetBV();
+ if(cMath::CheckCollisionBV(tempBV, *pCharBV))
+ {
+ float fDist = cMath::Vector3Dist(pCharBV->GetPosition(),avCenter);
+
+ pEnemy->Damage(CalcSize(fDist,afRadius,afMinDamage,afMaxDamge),-1);
+ }
+ }
+ }*/
+ if (aTarget & eAttackTargetFlag_Bodies) {
+ iPhysicsWorld *pWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+
+ std::list<iPhysicsBody *> lstBodies;
+ cPhysicsBodyIterator bodyIt = pWorld->GetBodyIterator();
+ while (bodyIt.HasNext()) {
+ lstBodies.push_back(bodyIt.Next());
+ }
+
+ //////////////////////////
+ // Damage Iteration
+ std::list<iPhysicsBody *>::iterator it = lstBodies.begin();
+ for (; it != lstBodies.end(); ++it) {
+ iPhysicsBody *pBody = *it;
+
+ // if(pBody->IsCharacter() || pBody->GetMass()==0) continue;
+ // if(pBody->IsCharacter()) continue;
+ if (pBody->IsActive() == false)
+ continue;
+ // if(pBody->GetMass() <= afMinMass) continue;
+
+ iGameEntity *pEntity = (iGameEntity *)pBody->GetUserData();
+
+ if (pEntity && pEntity->IsActive() && cMath::CheckCollisionBV(tempBV, *pBody->GetBV()) && mpSplashBlockCheck->CheckBlock(pBody->GetWorldPosition(), avCenter) == false) {
+ // If enemies are not to be target, skip.
+ if (!(aTarget & eAttackTargetFlag_Enemy) && pEntity->GetType() == eGameEntityType_Enemy) {
+ continue;
+ }
+
+ float fDist = cMath::Vector3Dist(avCenter, pBody->GetLocalPosition());
+ /*float fForceSize = CalcSize(fDist,afRadius,afMinForce,afMaxForce);
+ cVector3f vForceDir = pBody->GetLocalPosition() - avCenter;
+ vForceDir.Normalise();
+
+ if(fForceSize / pBody->GetMass() > afMaxImpulse)
+ {
+ fForceSize = afMaxImpulse * pBody->GetMass();
+ }
+
+ pBody->AddForce(vForceDir * fForceSize);*/
+
+ if (pEntity) {
+ float fDamage = CalcSize(fDist, afRadius, afMinDamage, afMaxDamge);
+ pEntity->Damage(fDamage, alStrength);
+ }
+ }
+ }
+
+ // Update map handler so all stuff that should be broken is.
+ // mpInit->mpMapHandler->Update(1.0f/60.0f);
+
+ //////////////////////////
+ // Force Iteration
+ it = lstBodies.begin();
+ for (; it != lstBodies.end(); ++it) {
+ iPhysicsBody *pBody = *it;
+
+ if (pBody->IsCharacter() || pBody->GetMass() == 0)
+ continue;
+ if (pBody->IsActive() == false)
+ continue;
+ if (pBody->GetMass() <= afMinMass)
+ continue;
+
+ iGameEntity *pEntity = (iGameEntity *)pBody->GetUserData();
+
+ if (cMath::CheckCollisionBV(tempBV, *pBody->GetBV())) {
+ cVector3f vBodyPos = pBody->GetLocalPosition() +
+ cMath::MatrixMul(pBody->GetLocalMatrix().GetRotation(),
+ pBody->GetMassCentre());
+
+ float fDist = cMath::Vector3Dist(avCenter, vBodyPos);
+ float fForceSize = CalcSize(fDist, afRadius, afMinForce, afMaxForce);
+ cVector3f vForceDir = vBodyPos - avCenter;
+ vForceDir.Normalise();
+
+ if (fForceSize / pBody->GetMass() > afMaxImpulse) {
+ fForceSize = afMaxImpulse * pBody->GetMass();
+ }
+ pBody->AddForce(vForceDir * fForceSize);
+
+ if (pEntity) {
+ float fImpulse = (fForceSize / pBody->GetMass()) * 1.0f / 60.0f;
+ if (fImpulse > 15)
+ fImpulse = 15;
+
+ pEntity->SetLastImpulse(vForceDir * fImpulse);
+ }
+ }
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cAttackHandler::OnStart() {
+ mpMapHandler = mpInit->mpMapHandler;
+}
+
+//-----------------------------------------------------------------------
+
+void cAttackHandler::Update(float afTimeStep) {
+}
+
+//-----------------------------------------------------------------------
+
+void cAttackHandler::Reset() {
+}
diff --git a/engines/hpl1/penumbra-overture/AttackHandler.h b/engines/hpl1/penumbra-overture/AttackHandler.h
new file mode 100644
index 00000000000..8c45b33f532
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/AttackHandler.h
@@ -0,0 +1,125 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#ifndef GAME_ATTACK_HANDLER_H
+#define GAME_ATTACK_HANDLER_H
+
+#include "hpl1/engine/engine.h"
+
+#include "hpl1/penumbra-overture/GameTypes.h"
+
+using namespace hpl;
+
+class cInit;
+class cMapHandler;
+class cGameSwingDoor;
+
+//---------------------------
+
+#define eAttackTargetFlag_None 0
+#define eAttackTargetFlag_Player (1 << 0)
+#define eAttackTargetFlag_Enemy (1 << 1)
+#define eAttackTargetFlag_Bodies (1 << 2)
+
+typedef tFlag eAttackTargetFlag;
+
+//---------------------------
+
+class cAttackRayCallback : public iPhysicsRayCallback {
+public:
+ cAttackRayCallback();
+
+ void Reset();
+ bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
+
+ eAttackTargetFlag mTarget;
+ iPhysicsBody *mpSkipBody;
+ iPhysicsBody *mpClosestBody;
+ float mfShortestDist;
+ cVector3f mvPosition;
+ bool mbSkipCharacter;
+};
+
+//---------------------------
+
+class cSplashDamageBlockCheck : public iPhysicsRayCallback {
+public:
+ cSplashDamageBlockCheck(cInit *apInit);
+
+ bool CheckBlock(const cVector3f &avStart, const cVector3f &avEnd);
+
+ bool BeforeIntersect(iPhysicsBody *pBody);
+ bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
+
+private:
+ cInit *mpInit;
+ bool mbIntersected;
+};
+
+//---------------------------
+
+class cAttackHandler : public iUpdateable {
+public:
+ cAttackHandler(cInit *apInit);
+ ~cAttackHandler();
+
+ bool CreateLineAttack(const cVector3f &avStart, const cVector3f &avEnd, float afDamage,
+ eAttackTargetFlag aTarget, iPhysicsBody *apSkipBody,
+ iPhysicsBody **apPickedBody = NULL);
+
+ bool CreateShapeAttack(iCollideShape *apShape, const cMatrixf &a_mtxOffset,
+ const cVector3f &avOrigin, float afDamage,
+ float afMinMass, float afMaxMass, float afMinImpulse, float afMaxImpulse,
+ int alStrength,
+ eAttackTargetFlag aTarget, iPhysicsBody *apSkipBody);
+
+ bool CreateLineDestroyBody(const cVector3f &avStart, const cVector3f &avEnd, float afStrength,
+ float afForce, iPhysicsBody *apSkipBody, iPhysicsBody **apPickedBody = NULL);
+
+ void CreateSplashDamage(const cVector3f &avCenter, float afRadius, float afMinDamage,
+ float afMaxDamge, float afMinForce, float afMaxForce,
+ float afMaxImpulse,
+ unsigned int aTarget, float afMinMass,
+ int alStrength);
+
+ cGameSwingDoor *GetLastSwingDoor() { return mpLastSwingDoor; }
+
+ void OnStart();
+ void Update(float afTimeStep);
+ void Reset();
+
+private:
+ cInit *mpInit;
+ cMapHandler *mpMapHandler;
+
+ cGameSwingDoor *mpLastSwingDoor;
+
+ cAttackRayCallback mRayCallback;
+ cSplashDamageBlockCheck *mpSplashBlockCheck;
+};
+
+#endif // GAME_ATTACK_HANDLER_H
diff --git a/engines/hpl1/penumbra-overture/ButtonHandler.cpp b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
new file mode 100644
index 00000000000..5da84cf9f74
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
@@ -0,0 +1,799 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#include "hpl1/penumbra-overture/ButtonHandler.h"
+
+#include "hpl1/penumbra-overture/Credits.h"
+#include "hpl1/penumbra-overture/DeathMenu.h"
+#include "hpl1/penumbra-overture/DemoEndText.h"
+#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/penumbra-overture/IntroStory.h"
+#include "hpl1/penumbra-overture/Inventory.h"
+#include "hpl1/penumbra-overture/MapHandler.h"
+#include "hpl1/penumbra-overture/MapLoadText.h"
+#include "hpl1/penumbra-overture/Notebook.h"
+#include "hpl1/penumbra-overture/NumericalPanel.h"
+#include "hpl1/penumbra-overture/Player.h"
+#include "hpl1/penumbra-overture/PreMenu.h"
+#include "hpl1/penumbra-overture/SaveHandler.h"
+
+#include "hpl1/penumbra-overture/MainMenu.h"
+
+struct cButtonHandlerAction {
+ tString msName;
+ tString msType;
+ int mlVal;
+ bool mbConfig;
+};
+
+static tString gsLastPlayerAction = "GlowStick";
+static cButtonHandlerAction gvDefaultActions[] = {
+ {"Forward", "Keyboard", eKey_w, true},
+ {"Backward", "Keyboard", eKey_s, true},
+ {"Left", "Keyboard", eKey_a, true},
+ {"Right", "Keyboard", eKey_d, true},
+
+ {"LeanLeft", "Keyboard", eKey_q, true},
+ {"LeanRight", "Keyboard", eKey_e, true},
+
+ {"Run", "Keyboard", eKey_LSHIFT, true},
+ {"Jump", "Keyboard", eKey_SPACE, true},
+ {"Crouch", "Keyboard", eKey_LCTRL, true},
+
+ {"InteractMode", "Keyboard", eKey_r, true},
+ {"LookMode", "MouseButton", eMButton_Middle, true},
+
+ {"Holster", "Keyboard", eKey_x, true},
+
+ {"Examine", "MouseButton", eMButton_Right, true},
+ {"Interact", "MouseButton", eMButton_Left, true},
+
+ {"Inventory", "Keyboard", eKey_TAB, true},
+ {"NoteBook", "Keyboard", eKey_n, true},
+ {"PersonalNotes", "Keyboard", eKey_p, true},
+
+ {"WheelUp", "MouseButton", eMButton_WheelUp, true},
+ {"WheelDown", "MouseButton", eMButton_WheelDown, true},
+
+ {"Flashlight", "Keyboard", eKey_f, true},
+ {"GlowStick", "Keyboard", eKey_g, true},
+
+ {"Escape", "Keyboard", eKey_ESCAPE, false},
+ {"Enter", "Keyboard", eKey_RETURN, false},
+ {"MouseClick", "MouseButton", eMButton_Left, false},
+ {"MouseClickRight", "MouseButton", eMButton_Right, false},
+
+ {"RightClick", "MouseButton", eMButton_Right, false},
+ {"LeftClick", "MouseButton", eMButton_Left, false},
+
+ {"One", "Keyboard", eKey_1, false},
+ {"Two", "Keyboard", eKey_2, false},
+ {"Three", "Keyboard", eKey_3, false},
+ {"Four", "Keyboard", eKey_4, false},
+ {"Five", "Keyboard", eKey_5, false},
+ {"Six", "Keyboard", eKey_6, false},
+ {"Seven", "Keyboard", eKey_7, false},
+ {"Eight", "Keyboard", eKey_8, false},
+ {"Nine", "Keyboard", eKey_9, false},
+
+ // Debug:
+ {"ResetGame", "Keyboard", eKey_F1, false},
+ {"SaveGame", "Keyboard", eKey_F4, false},
+ {"LoadGame", "Keyboard", eKey_F5, false},
+#ifdef __APPLE__
+ {"QuitGame", "Keyboard", eKeyModifier_META | eKey_q, false},
+#endif
+ //{"LockInput","Keyboard",eKey_k,false},
+ {"Screenshot", "Keyboard", eKey_F12, false},
+
+ //{"Hit","Keyboard",eKey_h,false},
+ //{"Log","Keyboard",eKey_l,false},
+ //{"Taunt","Keyboard",eKey_t,false},
+ {"PrintLog", "Keyboard", eKey_l, false},
+
+ {"", "", 0}};
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cButtonHandler::cButtonHandler(cInit *apInit) : iUpdateable("ButtonHandler") {
+ mpInit = apInit;
+
+ mpInput = mpInit->mpGame->GetInput();
+ mpLowLevelGraphics = mpInit->mpGame->GetGraphics()->GetLowLevel();
+ if (mpInit->mbHasHaptics)
+ mpLowLevelHaptic = mpInit->mpGame->GetHaptic()->GetLowLevel();
+ else
+ mpLowLevelHaptic = NULL;
+
+ mState = eButtonHandlerState_Game;
+
+ mlNumOfActions = 0;
+
+ // INIT ALL ACTIONS USED
+ cButtonHandlerAction *pBHAction = &gvDefaultActions[0];
+ while (pBHAction->msName != "") {
+ tString sName = pBHAction->msName;
+ tString sType = mpInit->mpConfig->GetString("Keys", sName + "_Type", pBHAction->msType);
+ tString sVal = mpInit->mpConfig->GetString("Keys", sName + "_Val", cString::ToString(pBHAction->mlVal));
+
+ iAction *pAction = ActionFromTypeAndVal(sName, sType, sVal);
+ if (pAction) {
+ mpInput->AddAction(pAction);
+ } else {
+ Warning("Couldn't create action from '%s' and %d\n", pBHAction->msType.c_str(),
+ pBHAction->mlVal);
+ }
+
+ ++pBHAction;
+ ++mlNumOfActions;
+ }
+
+ // LOAD SETTINGS
+ mfMouseSensitivity = mpInit->mpConfig->GetFloat("Controls", "MouseSensitivity", 1.0f);
+ mbInvertMouseY = mpInit->mpConfig->GetBool("Controls", "InvertMouseY", false);
+ mbToggleCrouch = mpInit->mpConfig->GetBool("Controls", "ToggleCrouch", true);
+}
+
+//-----------------------------------------------------------------------
+
+cButtonHandler::~cButtonHandler(void) {
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cButtonHandler::ChangeState(eButtonHandlerState aState) {
+ mState = aState;
+}
+
+//-----------------------------------------------------------------------
+
+void cButtonHandler::OnStart() {
+ mpPlayer = mpInit->mpPlayer;
+}
+
+//-----------------------------------------------------------------------
+
+void cButtonHandler::OnPostSceneDraw() {
+ if (mpInit->mpGame->GetGraphics()->GetRenderer3D()->GetDebugFlags() & eRendererDebugFlag_LogRendering) {
+ Log("-------------- STOP RENDERING LOG ------------------------\n");
+ mpInit->mpGame->GetGraphics()->GetRenderer3D()->SetDebugFlags(0);
+ }
+}
+
+void cButtonHandler::Update(float afTimeStep) {
+ static bool bLockState = true;
+ ///////////////////////////////////
+ // GLOBAL Key Strokes
+ ///////////////////////////////////
+ if (mpInput->BecameTriggerd("QuitGame")) {
+ mpInit->mpGame->Exit();
+ }
+ if (mpInput->BecameTriggerd("Screenshot")) {
+ int lCount = 1;
+ tString sFileName = "screenshot000.bmp";
+ while (FileExists(cString::To16Char(sFileName))) {
+ sFileName = "screenshot";
+ if (lCount < 10)
+ sFileName += "00";
+ else if (lCount < 100)
+ sFileName += "0";
+ sFileName += cString::ToString(lCount);
+ sFileName += ".bmp";
+ ++lCount;
+ }
+
+ mpInit->mpGame->GetGraphics()->GetLowLevel()->SaveScreenToBMP(sFileName);
+ }
+ if (mpInput->BecameTriggerd("LockInput")) {
+#ifndef WIN32
+ bLockState = !bLockState;
+ mpInit->mpGame->GetInput()->GetLowLevel()->LockInput(bLockState);
+#endif
+ }
+ ///////////////////////////////////
+ // DEMO END TEXT
+ ///////////////////////////////////
+ if (mState == eButtonHandlerState_DemoEndText) {
+ if (mpInput->BecameTriggerd("Escape"))
+ mpInit->mpDemoEndText->OnButtonDown();
+ if (mpInput->BecameTriggerd("LeftClick"))
+ mpInit->mpDemoEndText->OnMouseDown(eMButton_Left);
+ if (mpInput->BecameTriggerd("RightClick"))
+ mpInit->mpDemoEndText->OnMouseDown(eMButton_Right);
+ }
+ ///////////////////////////////////
+ // CREDITS STATE
+ ///////////////////////////////////
+ else if (mState == eButtonHandlerState_Credits) {
+ if (mpInput->BecameTriggerd("Escape"))
+ mpInit->mpCredits->OnButtonDown();
+ if (mpInput->BecameTriggerd("LeftClick"))
+ mpInit->mpCredits->OnMouseDown(eMButton_Left);
+ if (mpInput->BecameTriggerd("RightClick"))
+ mpInit->mpCredits->OnMouseDown(eMButton_Right);
+ }
+ ///////////////////////////////////
+ // PRE MENU STATE
+ ///////////////////////////////////
+ else if (mState == eButtonHandlerState_PreMenu) {
+ if (mpInput->BecameTriggerd("Escape"))
+ mpInit->mpPreMenu->OnButtonDown();
+ if (mpInput->BecameTriggerd("LeftClick"))
+ mpInit->mpPreMenu->OnMouseDown(eMButton_Left);
+ if (mpInput->BecameTriggerd("RightClick"))
+ mpInit->mpPreMenu->OnMouseDown(eMButton_Right);
+ }
+ ///////////////////////////////////
+ // MAP LOAD TEXT STATE
+ ///////////////////////////////////
+ else if (mState == eButtonHandlerState_MapLoadText) {
+ if (mpInput->BecameTriggerd("Escape") ||
+ mpInput->BecameTriggerd("RightClick") ||
+ mpInput->BecameTriggerd("LeftClick")) {
+ mpInit->mpMapLoadText->SetActive(false);
+ }
+ }
+ ///////////////////////////////////
+ // MAIN MENU BUTTON STATE
+ ///////////////////////////////////
+ else if (mState == eButtonHandlerState_MainMenu) {
+ if (mpInput->BecameTriggerd("Escape")) {
+ mpInit->mpMainMenu->Exit();
+ }
+
+ if (mpInput->BecameTriggerd("RightClick") ||
+ (mpInit->mbHasHaptics && mpInput->BecameTriggerd("MouseClickRight"))) {
+ mpInit->mpMainMenu->OnMouseDown(eMButton_Right);
+ mpInput->BecameTriggerd("Examine");
+ }
+ if (mpInput->WasTriggerd("RightClick")) {
+ mpInit->mpMainMenu->OnMouseUp(eMButton_Right);
+ }
+ if (mpInput->DoubleTriggerd("RightClick", 0.15f)) {
+ mpInit->mpMainMenu->OnMouseDoubleClick(eMButton_Right);
+ }
+
+ if (mpInput->BecameTriggerd("LeftClick") ||
+ (mpInit->mbHasHaptics && mpInput->BecameTriggerd("MouseClick"))) {
+ mpInit->mpMainMenu->OnMouseDown(eMButton_Left);
+ mpInput->BecameTriggerd("Interact");
+ }
+ if (mpInput->WasTriggerd("LeftClick")) {
+ mpInit->mpMainMenu->OnMouseUp(eMButton_Left);
+ }
+ if (mpInput->DoubleTriggerd("LeftClick", 0.15f)) {
+ mpInit->mpMainMenu->OnMouseDoubleClick(eMButton_Left);
+ }
+
+ if (mpInit->mbHasHaptics) {
+ mpInit->mpMainMenu->AddMousePos(mpLowLevelHaptic->GetRelativeVirtualMousePos() * mfMouseSensitivity);
+
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ mpInit->mpMainMenu->AddMousePos(vRel * mfMouseSensitivity);
+ } else {
+ /// Mouse Movement
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ mpInit->mpMainMenu->AddMousePos(vRel * mfMouseSensitivity);
+ }
+
+ }
+ ///////////////////////////////////
+ // INTRO BUTTON STATE
+ ///////////////////////////////////
+ else if (mState == eButtonHandlerState_Intro) {
+ if (mpInput->BecameTriggerd("Escape")) {
+ mpInit->mpIntroStory->Exit();
+ }
+ }
+ ///////////////////////////////////
+ // GAME BUTTON STATE
+ ///////////////////////////////////
+ else if (mState == eButtonHandlerState_Game) {
+ ///////////////////////////////////////
+ // Global ////////////////////
+ /*if(mpInput->BecameTriggerd("ResetGame"))
+ {
+ mpInit->ResetGame(true);
+ mpInit->mpMapHandler->Load( mpInit->msStartMap,mpInit->msStartLink);
+ }*/
+ if (mpInit->mbAllowQuickSave) {
+ if (mpInput->BecameTriggerd("SaveGame")) {
+ mpInit->mpSaveHandler->AutoSave(_W("auto"), 5);
+ }
+ if (mpInput->BecameTriggerd("LoadGame")) {
+ mpInit->mpSaveHandler->AutoLoad(_W("auto"));
+ }
+ }
+ if (mpInput->BecameTriggerd("PrintLog")) {
+ Log("-------------- START RENDERING LOG ------------------------\n");
+ mpInit->mpGame->GetGraphics()->GetRenderer3D()->SetDebugFlags(eRendererDebugFlag_LogRendering);
+ }
+ // Check if no jump is pressed always.
+ bool bPlayerStateIsActive = false;
+ ///////////////////////////////////////
+ // Death menu ////////////////////
+ if (mpInit->mpDeathMenu->IsActive()) {
+ if (mpInput->BecameTriggerd("Escape")) {
+ mpInit->mpGame->GetUpdater()->Reset();
+ mpInit->mpMainMenu->SetActive(true);
+ }
+
+ if (mpInput->BecameTriggerd("RightClick")) {
+ mpInit->mpDeathMenu->OnMouseDown(eMButton_Right);
+ mpInput->BecameTriggerd("Examine");
+ }
+
+ if (mpInput->BecameTriggerd("LeftClick")) {
+ mpInit->mpDeathMenu->OnMouseDown(eMButton_Left);
+ mpInput->BecameTriggerd("Interact");
+ }
+ if (mpInput->WasTriggerd("LeftClick")) {
+ mpInit->mpDeathMenu->OnMouseUp(eMButton_Left);
+ }
+
+ if (mpInit->mbHasHaptics) {
+ mpInit->mpDeathMenu->AddMousePos(mpLowLevelHaptic->GetRelativeVirtualMousePos() * mfMouseSensitivity);
+ } else {
+ /// Mouse Movement
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ mpInit->mpDeathMenu->AddMousePos(vRel * mfMouseSensitivity);
+ }
+ }
+ ///////////////////////////////////////
+ // Death ////////////////////
+ else if (mpPlayer->IsDead()) {
+ if (mpInput->BecameTriggerd("Escape")) {
+ mpInit->mpMainMenu->SetActive(true);
+ }
+ }
+ ///////////////////////////////////////
+ // Numerical panel ////////////////////
+ else if (mpInit->mpNumericalPanel->IsActive()) {
+ if (mpInput->BecameTriggerd("Inventory") || mpInput->BecameTriggerd("Escape")) {
+ mpInit->mpNumericalPanel->OnExit();
+ }
+ if (mpInput->BecameTriggerd("RightClick")) {
+ mpInit->mpNumericalPanel->OnExit();
+ }
+
+ if (mpInput->BecameTriggerd("LeftClick")) {
+ mpInit->mpNumericalPanel->OnMouseDown(eMButton_Left);
+ mpInput->BecameTriggerd("Interact");
+ }
+ if (mpInput->WasTriggerd("LeftClick")) {
+ mpInit->mpNumericalPanel->OnMouseUp(eMButton_Left);
+ }
+
+ if (mpInit->mbHasHaptics) {
+ mpInit->mpNumericalPanel->AddMousePos(mpLowLevelHaptic->GetRelativeVirtualMousePos() * mfMouseSensitivity);
+ } else {
+ /// Mouse Movement
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ mpInit->mpNumericalPanel->AddMousePos(vRel * mfMouseSensitivity);
+ }
+ }
+ ///////////////////////////////////////
+ // Notebook ////////////////////
+ else if (mpInit->mpNotebook->IsActive()) {
+ if (mpInput->BecameTriggerd("Inventory") || mpInput->BecameTriggerd("Escape")) {
+ mpInit->mpNotebook->OnExit();
+ }
+
+ if (mpInput->BecameTriggerd("LeftClick")) {
+ mpInit->mpNotebook->OnMouseDown(eMButton_Left);
+
+ mpInput->BecameTriggerd("Interact");
+ }
+
+ if (mpInput->BecameTriggerd("NoteBook")) {
+ mpInit->mpNotebook->OnExit();
+ }
+ if (mpInput->BecameTriggerd("PersonalNotes")) {
+ cStateMachine *pStateMachine = mpInit->mpNotebook->GetStateMachine();
+ if (pStateMachine->CurrentState()->GetId() == eNotebookState_TaskList) {
+ pStateMachine->ChangeState(eNotebookState_Front);
+ mpInit->mpNotebook->OnExit();
+ } else {
+ pStateMachine->ChangeState(eNotebookState_TaskList);
+ }
+ }
+
+ if (mpInit->mbHasHaptics) {
+ mpInit->mpNotebook->AddMousePos(mpLowLevelHaptic->GetRelativeVirtualMousePos() * mfMouseSensitivity);
+ } else {
+ /// Mouse Movement
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ mpInit->mpNotebook->AddMousePos(vRel * mfMouseSensitivity);
+ }
+ }
+ ///////////////////////////////////////
+ // Inventory ////////////////////
+ else if (mpInit->mpInventory->IsActive()) {
+ ////////////////////////////
+ // Normal Input
+ if (mpInput->BecameTriggerd("Inventory") || mpInput->BecameTriggerd("Escape")) {
+ mpInit->mpInventory->OnInventoryDown();
+ }
+
+ if (mpInput->BecameTriggerd("LeftClick")) {
+ mpInit->mpInventory->OnMouseDown(eMButton_Left);
+
+ mpInput->BecameTriggerd("Interact");
+ }
+
+ if (mpInput->DoubleTriggerd("LeftClick", 0.2f)) {
+ mpInit->mpInventory->OnDoubleClick(eMButton_Left);
+ }
+ if (mpInput->WasTriggerd("LeftClick")) {
+ mpInit->mpInventory->OnMouseUp(eMButton_Left);
+ }
+
+ if (mpInput->BecameTriggerd("RightClick")) {
+ mpInit->mpInventory->OnMouseDown(eMButton_Right);
+
+ mpInput->BecameTriggerd("Examine");
+ }
+ if (mpInput->WasTriggerd("RightClick")) {
+ mpInit->mpInventory->OnMouseUp(eMButton_Right);
+ }
+
+ //////////////////////////////
+ // Short cut keys
+ if (mpInput->BecameTriggerd("One"))
+ mpInit->mpInventory->OnShortcutDown(0);
+ if (mpInput->BecameTriggerd("Two"))
+ mpInit->mpInventory->OnShortcutDown(1);
+ if (mpInput->BecameTriggerd("Three"))
+ mpInit->mpInventory->OnShortcutDown(2);
+ if (mpInput->BecameTriggerd("Four"))
+ mpInit->mpInventory->OnShortcutDown(3);
+ if (mpInput->BecameTriggerd("Five"))
+ mpInit->mpInventory->OnShortcutDown(4);
+ if (mpInput->BecameTriggerd("Six"))
+ mpInit->mpInventory->OnShortcutDown(5);
+ if (mpInput->BecameTriggerd("Seven"))
+ mpInit->mpInventory->OnShortcutDown(6);
+ if (mpInput->BecameTriggerd("Eight"))
+ mpInit->mpInventory->OnShortcutDown(7);
+ if (mpInput->BecameTriggerd("Nine"))
+ mpInit->mpInventory->OnShortcutDown(8);
+
+ if (mpInit->mbHasHaptics) {
+ cVector2f vRel = mpLowLevelHaptic->GetRelativeVirtualMousePos();
+ mpInit->mpInventory->AddMousePos(vRel * mfMouseSensitivity);
+ } else {
+ /// Mouse Movement
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ mpInit->mpInventory->AddMousePos(vRel * mfMouseSensitivity);
+ }
+ } else {
+ bPlayerStateIsActive = true;
+
+ if (mpInput->BecameTriggerd("Escape")) {
+ mpInit->mpMainMenu->SetActive(true);
+ }
+ if (mpInput->BecameTriggerd("Hit")) {
+ mpInit->mpPlayer->Damage(20, ePlayerDamageType_BloodSplash);
+ }
+ /*if(mpInput->BecameTriggerd("Log"))
+ {
+ mpInit->mpGame->GetPhysics()->SetDebugLog(!mpInit->mpGame->GetPhysics()->GetDebugLog());
+ }*/
+ if (mpInput->BecameTriggerd("Taunt")) {
+ for (int i = 0; i < 10; ++i)
+ mpInit->mpGame->GetSound()->GetSoundHandler()->PlayGui("gui_notebook_add_note1",
+ false, 0.01f);
+ /*cVector3f vPos = mpInit->mpPlayer->GetCharacterBody()->GetPosition();
+ cSoundEntity *pSound = mpInit->mpGame->GetScene()->GetWorld3D()->CreateSoundEntity("Taunt","interact_homer",true);
+ if(pSound)
+ {
+ pSound->SetPosition(vPos);
+ }*/
+ }
+
+ if (mpPlayer->IsActive() || mpPlayer->GetState() == ePlayerState_Message) {
+ if (mpPlayer->IsActive()) {
+ if (mpInput->BecameTriggerd("Inventory")) {
+ mpPlayer->StartInventory();
+ }
+
+ if (mpInput->BecameTriggerd("NoteBook")) {
+ mpInit->mpNotebook->SetActive(true);
+ }
+ if (mpInput->BecameTriggerd("PersonalNotes")) {
+ mpInit->mpNotebook->SetActive(true);
+ mpInit->mpNotebook->GetStateMachine()->ChangeState(eNotebookState_TaskList);
+ }
+
+ if (mpInput->BecameTriggerd("Flashlight")) {
+ mpPlayer->StartFlashLightButton();
+ }
+
+ if (mpInput->BecameTriggerd("GlowStick")) {
+ mpPlayer->StartGlowStickButton();
+ }
+
+ ///////////////////////////////////////
+ // Player Movement ////////////////////
+ if (mpInput->IsTriggerd("Forward")) {
+ mpPlayer->MoveForwards(1, afTimeStep);
+ } else if (mpInput->IsTriggerd("Backward")) {
+ mpPlayer->MoveForwards(-1, afTimeStep);
+ } else {
+ mpPlayer->MoveForwards(0, afTimeStep);
+ }
+
+ if (mpInput->IsTriggerd("Left")) {
+ mpPlayer->MoveSideways(-1, afTimeStep);
+ } else if (mpInput->IsTriggerd("Right")) {
+ mpPlayer->MoveSideways(1, afTimeStep);
+ } else {
+ mpPlayer->MoveSideways(0, afTimeStep);
+ }
+
+ if (mpInput->IsTriggerd("LeanLeft")) {
+ mpPlayer->Lean(-1, afTimeStep);
+ } else if (mpInput->IsTriggerd("LeanRight")) {
+ mpPlayer->Lean(1, afTimeStep);
+ }
+
+ if (mpInput->BecameTriggerd("Jump")) {
+ mpPlayer->Jump();
+ }
+ if (mpInput->IsTriggerd("Jump")) {
+ mpPlayer->SetJumpButtonDown(true);
+ }
+
+ if (mpInput->BecameTriggerd("Run")) {
+ mpPlayer->StartRun();
+ }
+ if (mpInput->WasTriggerd("Run")) {
+ mpPlayer->StopRun();
+ }
+
+ if (mpInput->BecameTriggerd("Crouch")) {
+ mpPlayer->StartCrouch();
+ }
+ if (GetToggleCrouch()) {
+ if (mpInput->WasTriggerd("Crouch"))
+ mpPlayer->StopCrouch();
+ } else {
+ if (mpInput->IsTriggerd("Crouch") == false)
+ mpPlayer->StopCrouch();
+ }
+
+ if (mpInput->BecameTriggerd("InteractMode")) {
+ if (mpInit->mbHasHaptics == false) {
+ mpPlayer->StartInteractMode();
+ } else {
+ // DO nothing for the time being.
+ }
+ }
+
+ // Get the mouse pos and convert it to 0 - 1
+ if (mpInit->mbHasHaptics == false) {
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ vRel /= mpLowLevelGraphics->GetVirtualSize();
+
+ mpPlayer->AddYaw(vRel.x * mfMouseSensitivity);
+ mpPlayer->AddPitch(vRel.y * mfMouseSensitivity);
+ }
+ }
+
+ ///////////////////////////////////////
+ // Player Interaction /////////////////
+ if (mpInput->BecameTriggerd("Interact")) {
+ mpPlayer->StartInteract();
+ mpInput->BecameTriggerd("LeftClick");
+ }
+ if (mpInput->WasTriggerd("Interact")) {
+ mpPlayer->StopInteract();
+ }
+ if (mpInput->BecameTriggerd("Examine")) {
+ mpPlayer->StartExamine();
+ }
+ if (mpInput->WasTriggerd("Examine")) {
+ mpPlayer->StopExamine();
+ }
+ if (mpInput->BecameTriggerd("Holster")) {
+ mpPlayer->StartHolster();
+ }
+
+ if (mpPlayer->IsActive()) {
+ if (mpInput->BecameTriggerd("One"))
+ mpPlayer->StartInventoryShortCut(0);
+ if (mpInput->BecameTriggerd("Two"))
+ mpPlayer->StartInventoryShortCut(1);
+ if (mpInput->BecameTriggerd("Three"))
+ mpPlayer->StartInventoryShortCut(2);
+ if (mpInput->BecameTriggerd("Four"))
+ mpPlayer->StartInventoryShortCut(3);
+ if (mpInput->BecameTriggerd("Five"))
+ mpPlayer->StartInventoryShortCut(4);
+ if (mpInput->BecameTriggerd("Six"))
+ mpPlayer->StartInventoryShortCut(5);
+ if (mpInput->BecameTriggerd("Seven"))
+ mpPlayer->StartInventoryShortCut(6);
+ if (mpInput->BecameTriggerd("Eight"))
+ mpPlayer->StartInventoryShortCut(7);
+ if (mpInput->BecameTriggerd("Nine"))
+ mpPlayer->StartInventoryShortCut(8);
+ }
+ }
+ }
+ if (mpInput->IsTriggerd("Jump") == false || bPlayerStateIsActive == false) {
+ mpPlayer->SetJumpButtonDown(false);
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cButtonHandler::Reset() {
+}
+
+//-----------------------------------------------------------------------
+
+void cButtonHandler::OnExit() {
+ // SAVE SETTINGS
+ Log(" Saving to config\n");
+ mpInit->mpConfig->SetFloat("Controls", "MouseSensitivity", mfMouseSensitivity);
+ mpInit->mpConfig->SetBool("Controls", "InvertMouseY", mbInvertMouseY);
+ mpInit->mpConfig->SetBool("Controls", "ToggleCrouch", mbToggleCrouch);
+
+ // SAVE KEYS
+ Log(" Saving keys\n");
+ for (int i = 0; i < mlNumOfActions; ++i) {
+ // Log(" Action %s\n",gvDefaultActions[i].msName.c_str());
+
+ iAction *pAction = mpInput->GetAction(gvDefaultActions[i].msName);
+ tString sType = "", sVal = "";
+ TypeAndValFromAction(pAction, &sType, &sVal);
+
+ // Log(" type %s val: %s\n",sType.c_str(),sVal.c_str());
+
+ mpInit->mpConfig->SetString("Keys", gvDefaultActions[i].msName + "_Type", sType);
+ mpInit->mpConfig->SetString("Keys", gvDefaultActions[i].msName + "_Val", sVal);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cButtonHandler::SetDefaultKeys() {
+ cButtonHandlerAction *pBHAction = &gvDefaultActions[0];
+ while (pBHAction->msName != "") {
+ tString sName = pBHAction->msName;
+ tString sType = pBHAction->msType;
+ tString sVal = cString::ToString(pBHAction->mlVal);
+
+ iAction *pAction = ActionFromTypeAndVal(sName, sType, sVal);
+
+ if (pAction) {
+ mpInput->DestroyAction(sName);
+ mpInput->AddAction(pAction);
+ } else {
+ Warning("Couldn't create action from '%s' and %d\n", pBHAction->msType.c_str(),
+ pBHAction->mlVal);
+ }
+
+ ++pBHAction;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+tString cButtonHandler::GetActionName(const tString &asInputName, const tString &asSkipAction) {
+ cButtonHandlerAction *pBHAction = &gvDefaultActions[0];
+ while (pBHAction->msName != "") {
+ tString sName = pBHAction->msName;
+ tString sType = pBHAction->msType;
+ tString sVal = cString::ToString(pBHAction->mlVal);
+
+ iAction *pAction = mpInput->GetAction(sName);
+
+ if (asSkipAction != sName && pAction && pAction->GetInputName() == asInputName)
+ return sName;
+
+ // If at last player action, skip the rest.
+ if (sName == gsLastPlayerAction)
+ return "";
+
+ ++pBHAction;
+ }
+
+ return "";
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+iAction *cButtonHandler::ActionFromTypeAndVal(const tString &asName, const tString &asType, const tString &asVal) {
+ // Log("Action %s from %s\n",asName.c_str(),asType.c_str());
+
+ if (asType == "Keyboard") {
+ return hplNew(cActionKeyboard, (asName, mpInit->mpGame->GetInput(), (eKey)cString::ToInt(asVal.c_str(), 0)));
+ } else if (asType == "MouseButton" || asType == "HapticDeviceButton") {
+ if (mpInit->mbHasHaptics && asName != "MouseClick") {
+ int lNum = cString::ToInt(asVal.c_str(), 0);
+ if (lNum == 2)
+ lNum = 2;
+ else if (lNum == 1)
+ lNum = 1;
+ return hplNew(cActionHaptic, (asName, mpInit->mpGame->GetHaptic(), lNum));
+ } else {
+ return hplNew(cActionMouseButton, (asName, mpInit->mpGame->GetInput(), (eMButton)cString::ToInt(asVal.c_str(), 0)));
+ }
+ }
+
+ return NULL;
+}
+
+//-----------------------------------------------------------------------
+
+void cButtonHandler::TypeAndValFromAction(iAction *apAction, tString *apType, tString *apVal) {
+ if (apAction) {
+ *apType = apAction->GetInputType();
+
+ if (apAction->GetInputType() == "Keyboard") {
+ cActionKeyboard *pKeyAction = static_cast<cActionKeyboard *>(apAction);
+ *apVal = cString::ToString((int)pKeyAction->GetKey() | (int)pKeyAction->GetModifier());
+ } else if (apAction->GetInputType() == "MouseButton" ||
+ apAction->GetInputType() == "HapticDeviceButton") {
+ if (mpInit->mbHasHaptics && apAction->GetName() != "MouseClick") {
+ cActionHaptic *pHapticAction = static_cast<cActionHaptic *>(apAction);
+ *apVal = cString::ToString(pHapticAction->GetButton());
+ if (*apVal == "2")
+ *apVal = "2";
+ else if (*apVal == "1")
+ *apVal = "1";
+ } else {
+ cActionMouseButton *pMouseAction = static_cast<cActionMouseButton *>(apAction);
+ *apVal = cString::ToString((int)pMouseAction->GetButton());
+ }
+ }
+ } else {
+ *apVal = "";
+ *apType = "";
+ }
+}
+
+//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/ButtonHandler.h b/engines/hpl1/penumbra-overture/ButtonHandler.h
new file mode 100644
index 00000000000..a026f7ed509
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/ButtonHandler.h
@@ -0,0 +1,83 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#ifndef GAME_BUTTON_HANDLER_H
+#define GAME_BUTTON_HANDLER_H
+
+#include "hpl1/engine/engine.h"
+
+#include "hpl1/penumbra-overture/GameTypes.h"
+
+using namespace hpl;
+
+class cInit;
+class cPlayer;
+
+class cButtonHandler : public iUpdateable {
+public:
+ cButtonHandler(cInit *apInit);
+ ~cButtonHandler();
+
+ void OnStart();
+ void Update(float afTimeStep);
+ void Reset();
+ void OnExit();
+ void OnPostSceneDraw();
+
+ void SetDefaultKeys();
+
+ tString GetActionName(const tString &asInputName, const tString &asSkipAction);
+
+ void ChangeState(eButtonHandlerState aState);
+ eButtonHandlerState GetState() { return mState; }
+
+ bool GetInvertMouseY() { return mbInvertMouseY; }
+ bool GetToggleCrouch() { return mbToggleCrouch; }
+
+ // Settings
+ float mfMouseSensitivity;
+ bool mbInvertMouseY;
+ bool mbToggleCrouch;
+
+private:
+ iAction *ActionFromTypeAndVal(const tString &asName, const tString &asType, const tString &asVal);
+ void TypeAndValFromAction(iAction *apAction, tString *apType, tString *apVal);
+
+ int mlNumOfActions;
+
+ cInit *mpInit;
+
+ cInput *mpInput;
+ iLowLevelGraphics *mpLowLevelGraphics;
+ iLowLevelHaptic *mpLowLevelHaptic;
+
+ cPlayer *mpPlayer;
+
+ eButtonHandlerState mState;
+};
+
+#endif // GAME_BUTTON_HANDLER_H
diff --git a/engines/hpl1/penumbra-overture/CharacterMove.cpp b/engines/hpl1/penumbra-overture/CharacterMove.cpp
new file mode 100644
index 00000000000..3f671583687
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/CharacterMove.cpp
@@ -0,0 +1,633 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#include "hpl1/penumbra-overture/CharacterMove.h"
+#include "hpl1/engine/engine.h"
+
+#include "hpl1/penumbra-overture/EffectHandler.h"
+#include "hpl1/penumbra-overture/GameEntity.h"
+
+//////////////////////////////////////////////////////////////////////////
+// A STAR CALLBHCK
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cCharacterAStarCallback::cCharacterAStarCallback(cCharacterMove *apMove) {
+ mbCheckDynamic = false;
+
+ mpMove = apMove;
+}
+
+//-----------------------------------------------------------------------
+
+bool cCharacterAStarCallback::CanAddNode(cAINode *apParentNode, cAINode *apChildNode) {
+ if (mbCheckDynamic == false && mpMove->GetMaxDoorToughness() == -1)
+ return true;
+
+ bool bRet = mpMove->GetNodeContainer()->FreePath(apParentNode->GetPosition(), apChildNode->GetPosition(),
+ 1, 0, this);
+ // Log("Checking %s -> %s, ret: %d \n",apParentNode->GetName().c_str(),
+ // apChildNode->GetName().c_str(),bRet?1:0);
+
+ return bRet;
+}
+
+//-----------------------------------------------------------------------
+
+bool cCharacterAStarCallback::Intersects(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
+ // if(pBody->GetCollide()==false) return false;
+
+ if (pBody->IsCharacter())
+ return false;
+ if (pBody->GetCollideCharacter() == false)
+ return false;
+
+ if (pBody->GetMass() == 0)
+ return false;
+
+ iGameEntity *pEntity = static_cast<iGameEntity *>(pBody->GetUserData());
+
+ if (pEntity && pEntity->GetType() == eGameEntityType_SwingDoor) {
+ if (pEntity->GetToughness() >= mpMove->GetMaxDoorToughness() && mpMove->GetMaxDoorToughness() >= 0) {
+ // Log("Door was too strong!\n T: %d Max: %d\n",pEntity->GetToughness(),mpMove->GetMaxDoorToughness());
+ return true;
+ }
+
+ return false;
+ } else {
+ if (pBody->GetMass() < mpMove->mfMaxPushMass)
+ return false;
+ }
+
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// RAY CALLBHCK
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cMoverRayCallback::Reset() {
+ mbIntersection = false;
+}
+
+bool cMoverRayCallback::BeforeIntersect(iPhysicsBody *pBody) {
+ if (pBody->IsCharacter() || pBody->GetCollide() == false || pBody->GetCollideCharacter() == false ||
+ pBody->GetMass() > 0) {
+ return false;
+ }
+
+ return true;
+}
+
+bool cMoverRayCallback::OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
+ if (pBody->IsCharacter() || pBody->GetCollide() == false || pBody->GetCollideCharacter() == false ||
+ pBody->GetMass() > 0) {
+ return true;
+ }
+
+ mbIntersection = true;
+
+ return false;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cCharacterMove::cCharacterMove(cInit *apInit) {
+ mpAStar = NULL;
+ mpCharBody = NULL;
+ mpContainer = NULL;
+
+ mpInit = apInit;
+
+ mfMaxTurnSpeed = 9999.0f; // The maximum speed the enemy will turn in.
+ mfAngleDistTurnMul = 1.0f; // Multiplied with angle distance to determine turn speed.
+
+ mfMinBreakAngle = cMath::ToRad(20.0f); // Minimum angle distance at which break start.
+ mfBreakAngleMul = 1.0f; // Multiplied with angle distance to determine break force.
+
+ mbMoving = false;
+ mbTurning = false;
+
+ mfTurnSpeed = 0;
+
+ mfStuckLimit = 0.3f;
+ mfStuckCounter = 0;
+
+ mfMaxPushMass = 5;
+
+ mbMoveToNewNode = false;
+
+ mpAStarCallback = hplNew(cCharacterAStarCallback, (this));
+
+ mvTempStart = 0;
+ mvTempEnd = 0;
+
+ mlMaxDoorToughness = -1;
+
+ mlMaxNodeDistances = 150;
+ mfNodeDistAvg = 0;
+}
+
+//-----------------------------------------------------------------------
+
+cCharacterMove::~cCharacterMove() {
+ if (mpAStarCallback)
+ hplDelete(mpAStarCallback);
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cCharacterMove::Update(float afTimeStep) {
+ if (mpCharBody->IsActive() == false)
+ return;
+
+ ////////////////////////////////////
+ // Update Movement
+ if (mbMoving) {
+ cAINode *pCurrentNode = NULL;
+ cVector3f vGoal;
+ cVector3f vPos = mpCharBody->GetPosition();
+
+ /////////////////////////////////////////
+ // Get the postion to move towards and current node if there is any.
+ if (mlstNodes.empty()) {
+ vGoal = mvGoalPos;
+ } else {
+ pCurrentNode = mlstNodes.back();
+ vGoal = pCurrentNode->GetPosition();
+ }
+
+ /////////////////////////////////////////
+ // Check if the newer node is reachable
+ if (mbMoveToNewNode) {
+ mbMoveToNewNode = false;
+
+ // if(mpContainer->FreePath(mpCharBody->GetFeetPosition()+cVector3f(0,0.1f,0),
+ // vGoal,1,0,mpAStarCallback)==false)
+ /*if(mpContainer->FreePath(mpCharBody->GetFeetPosition()+cVector3f(0,0.1f,0),
+ vGoal,-1,0,mpAStarCallback)==false)
+ {
+ //Do nothing here right now, might wanna remove the path from the two connected
+ //Nodes, but that might turn out pretty hard, leave for now, this takes too much cpu.
+ //------------------------
+ //mpInit->mpEffectHandler->GetSubTitle()->Add("Path was blocked!\n",2.0f,true);
+ mbMoving = false;
+ mlstNodes.clear();
+
+ //Log("-- Begin Dynamic path find !\n");
+ mpAStarCallback->mbCheckDynamic = true;
+ MoveToPos(mvGoalPos);
+ mpAStarCallback->mbCheckDynamic = false;
+ //Log("-- End Dynamic path find !\n");
+
+ }*/
+ }
+
+ float fGoalAngle = -cMath::GetAngleFromPoints2D(cVector2f(vPos.x, vPos.z), cVector2f(vGoal.x, vGoal.z));
+ TurnToAngle(fGoalAngle);
+ mpCharBody->SetPitch(0);
+
+ mpCharBody->Move(eCharDir_Forward, 1.0f, afTimeStep);
+
+ ////////////////////////////////
+ // Update bounding volume
+ mBoundingVolume.SetPosition(vPos);
+ mBoundingVolume.UpdateSize();
+
+ bool bStuckAtNode = false;
+ float fNodeDist = cMath::Vector3DistSqr(vGoal, mpCharBody->GetFeetPosition());
+ mlstNodeDistances.push_back(fNodeDist);
+ if ((int)mlstNodeDistances.size() > mlMaxNodeDistances) {
+ mlstNodeDistances.pop_front();
+ mfNodeDistAvg = 0;
+
+ std::list<float>::iterator it = mlstNodeDistances.begin();
+ float fPreviousDistance = *it;
+ ++it;
+ for (; it != mlstNodeDistances.end(); ++it) {
+ float fChange = *it - fPreviousDistance;
+ mfNodeDistAvg += fChange;
+ }
+
+ if (mfNodeDistAvg > 0 &&
+ fNodeDist < mpCharBody->GetSize().x * 1.5f) {
+ bStuckAtNode = true;
+ }
+ }
+
+ ////////////////////////////////
+ // Check if node is reached:
+ if (bStuckAtNode || cMath::PointBVCollision(vGoal, mBoundingVolume)) {
+ if (mlstNodes.empty()) {
+ mbMoving = false;
+ } else {
+ mlstNodes.pop_back(); // Go to next node next update.
+ }
+ mbMoveToNewNode = true;
+ mlstNodeDistances.clear();
+ }
+ }
+
+ ////////////////////////////////////
+ // Update turning
+ if (mbTurning) {
+ float fAngleDist = cMath::GetAngleDistanceRad(mpCharBody->GetYaw(), mfGoalAngle);
+
+ /////////////////
+ // Rotate the body
+ if (std::abs(fAngleDist) < 0.001f) {
+ mbTurning = false;
+ mfTurnSpeed = 0;
+ }
+ if (mbTurning) {
+ mfTurnSpeed = cMath::Min(mfAngleDistTurnMul * std::abs(fAngleDist), mfMaxTurnSpeed);
+
+ if (fAngleDist < 0)
+ mpCharBody->AddYaw(-mfTurnSpeed * afTimeStep);
+ else
+ mpCharBody->AddYaw(mfTurnSpeed * afTimeStep);
+
+ //////////////////////
+ // Break when making short turns
+ if (std::abs(fAngleDist) >= mfMinBreakAngle && mpCharBody->GetMoveSpeed(eCharDir_Forward) > 0.15f) {
+ float fBreakAcc = -mfBreakAngleMul * std::abs(fAngleDist);
+ mpCharBody->Move(eCharDir_Forward, fBreakAcc, afTimeStep);
+
+ mfCurrentBreak = fBreakAcc;
+ } else {
+ mfCurrentBreak = 0;
+ }
+ }
+ }
+
+ //////////////////////////////////////
+ /// Update stuck counter
+ float fWantedSpeed = mpCharBody->GetMoveSpeed(eCharDir_Forward);
+ float fRealSpeed = cMath::Vector3Dist(mpCharBody->GetPosition(), mpCharBody->GetLastPosition());
+ fRealSpeed = fRealSpeed / afTimeStep;
+
+ cVector3f vWantedDir = mpCharBody->GetForward();
+ cVector3f vRealDir = mpCharBody->GetPosition() - mpCharBody->GetLastPosition();
+ vRealDir.Normalise();
+
+ float fCos = cMath::Vector3Dot(vWantedDir, vRealDir);
+
+ if (fRealSpeed / fWantedSpeed < mfStuckLimit ||
+ (std::abs(fCos) < 0.3f && fWantedSpeed > 0.001f)) {
+ mfStuckCounter += afTimeStep;
+ // mpInit->mpEffectHandler->GetSubTitle()->Add(_W("ADD!\n"),1.0f/60.0f,false);
+ } else {
+ // mpInit->mpEffectHandler->GetSubTitle()->Add(_W("NEG!\n"),1.0f/60.0f,false);
+ mfStuckCounter -= afTimeStep;
+ if (mfStuckCounter < 0)
+ mfStuckCounter = 0;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+bool cCharacterMove::MoveToPos(const cVector3f &avPos) {
+ if (mpAStar == NULL)
+ return false;
+
+ // Log(" Moving to %s\n",avPos.ToString().c_str());
+
+ // mpInit->mpEffectHandler->GetSubTitle()->Add("Get newer path!\n",2.0f,true);
+
+ // Get the start and goal position
+ cVector3f vStartPos = mpCharBody->GetPosition();
+ cVector3f vGoalPos = avPos;
+ if (mpContainer->GetNodeIsAtCenter() == false) {
+ vStartPos -= cVector3f(0, mpCharBody->GetSize().y / 2.0f, 0);
+ }
+
+ // Get the nodes to be following
+ mlstNodes.clear();
+ // Log(" Getting path!\n");
+ bool bRet = mpAStar->GetPath(vStartPos, vGoalPos, &mlstNodes);
+
+ if (bRet == false) {
+ // Log("Did NOT find path\n");
+ // mpInit->mpEffectHandler->GetSubTitle()->Add(_W("Did not find path!\n"),2,false);
+ }
+
+ mvGoalPos = vGoalPos;
+
+ mbMoving = true;
+ mlstNodeDistances.clear();
+
+ return bRet;
+}
+
+//-----------------------------------------------------------------------
+
+void cCharacterMove::MoveDirectToPos(const cVector3f &avFeetPos, float afTimeStep) {
+ TurnToPos(avFeetPos);
+ GetCharBody()->Move(eCharDir_Forward, 1.0f, afTimeStep);
+}
+
+//-----------------------------------------------------------------------
+
+void cCharacterMove::TurnToAngle(float afAngle) {
+ mbTurning = true;
+
+ mfGoalAngle = afAngle;
+}
+
+void cCharacterMove::TurnToPos(const cVector3f &avPos) {
+ cVector3f vStartPos = mpCharBody->GetPosition();
+
+ float fGoalAngle = -cMath::GetAngleFromPoints2D(cVector2f(vStartPos.x, vStartPos.z),
+ cVector2f(avPos.x, avPos.z));
+ TurnToAngle(fGoalAngle);
+}
+
+//-----------------------------------------------------------------------
+
+void cCharacterMove::Stop() {
+ mbMoving = false;
+ mlstNodes.clear();
+ mlstNodeDistances.clear();
+}
+
+//-----------------------------------------------------------------------
+
+bool cCharacterMove::FreeDirectPathToChar(iCharacterBody *apBody) {
+ float fHeight = fabs(GetCharBody()->GetFeetPosition().y - apBody->GetFeetPosition().y);
+
+ if (fHeight > 0.8f)
+ return false;
+
+ return mpContainer->FreePath(GetCharBody()->GetFeetPosition() + cVector3f(0, 0.05f, 0),
+ apBody->GetFeetPosition() + cVector3f(0, 0.05f, 0),
+ -1, eAIFreePathFlag_SkipDynamic);
+}
+
+//-----------------------------------------------------------------------
+
+float cCharacterMove::DistanceToChar(iCharacterBody *apBody) {
+ return cMath::Vector3Dist(mpCharBody->GetFeetPosition(), apBody->GetFeetPosition());
+}
+
+float cCharacterMove::DistanceToChar2D(iCharacterBody *apBody) {
+ cVector3f vStart = mpCharBody->GetFeetPosition();
+ cVector3f vEnd = apBody->GetFeetPosition();
+ vStart.y = 0;
+ vEnd.y = 0;
+
+ return cMath::Vector3Dist(vStart, vEnd);
+}
+
+//-----------------------------------------------------------------------
+
+cAINode *cCharacterMove::GetAINodeInRange(float afMinDistance, float afMaxDistance) {
+ float fMaxDistSqr = afMaxDistance * afMaxDistance;
+ float fMinDistSqr = afMinDistance * afMinDistance;
+
+ int i = cMath::RandRectl(0, mpContainer->GetNodeNum() - 1);
+ int lCount = 0;
+
+ // Log("StartNode i: %d\n",i);
+
+ while (lCount < mpContainer->GetNodeNum()) {
+ cAINode *pNode = mpContainer->GetNode(i);
+ // Log("Testing node: %d '%s'\n",i,pNode->GetName().c_str());
+
+ float fDistSqr = cMath::Vector3DistSqr(pNode->GetPosition(), mpCharBody->GetFeetPosition());
+ if (fDistSqr <= fMaxDistSqr && fDistSqr >= fMinDistSqr) {
+ return pNode;
+ }
+
+ ++lCount;
+ ++i;
+ if (i >= mpContainer->GetNodeNum())
+ i = 0;
+ }
+
+ return NULL;
+
+ /*for(int i=0; i<mpContainer->GetNodeNum(); ++i)
+ {
+ cAINode* pNode = mpContainer->GetNode(i);
+
+ MoveToPos(pNode->GetPosition());
+ }
+ return NULL;*/
+}
+
+//-----------------------------------------------------------------------
+
+cAINode *cCharacterMove::GetAINodeAtPosInRange(const cVector3f &avPos, float afMinDistance, float afMaxDistance,
+ bool abRayCheck, float afEndOffset) {
+ float fMaxDistSqr = afMaxDistance * afMaxDistance;
+ float fMinDistSqr = afMinDistance * afMinDistance;
+
+ int i = cMath::RandRectl(0, mpContainer->GetNodeNum() - 1);
+ int lCount = 0;
+
+ iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+
+ while (lCount < mpContainer->GetNodeNum()) {
+ cAINode *pNode = mpContainer->GetNode(i);
+
+ float fDistSqr = cMath::Vector3DistSqr(pNode->GetPosition(), avPos);
+ if (fDistSqr <= fMaxDistSqr && fDistSqr >= fMinDistSqr) {
+ if (abRayCheck) {
+ mRayCallback.Reset();
+
+ cVector3f vStart = pNode->GetPosition();
+
+ // Calculate a postion offset closer to the node.
+ float fDist = cMath::Vector3Dist(vStart, avPos);
+ fDist = fDist - afEndOffset;
+ if (fDist < 0)
+ fDist = 0;
+ cVector3f vDir = cMath::Vector3Normalize(avPos - vStart);
+
+ cVector3f vEnd = vStart + vDir * fDist;
+
+ pPhysicsWorld->CastRay(&mRayCallback, vStart, vEnd, false, false, false);
+
+ if (mRayCallback.mbIntersection == false) {
+ mvTempStart = vStart;
+ mvTempEnd = vEnd;
+
+ return pNode;
+ }
+ } else {
+ return pNode;
+ }
+ }
+
+ ++lCount;
+ ++i;
+ if (i >= mpContainer->GetNodeNum())
+ i = 0;
+ }
+
+ return NULL;
+}
+
+//-----------------------------------------------------------------------
+
+void cCharacterMove::SetCharBody(iCharacterBody *apCharBody) {
+ mpCharBody = apCharBody;
+
+ cVector3f vSize = mpCharBody->GetSize();
+ vSize.y *= 2.5f;
+ mBoundingVolume.SetSize(vSize);
+}
+
+void cCharacterMove::SetNodeContainer(cAINodeContainer *apContainer) {
+ mpContainer = apContainer;
+}
+
+void cCharacterMove::SetAStar(cAStarHandler *apAStar) {
+ mpAStar = apAStar;
+ mpAStar->SetCallback(mpAStarCallback);
+}
+
+//-----------------------------------------------------------------------
+
+void cCharacterMove::OnDraw(cInit *apInit) {
+ // return;
+
+ // apInit->mpDefaultFont->Draw(cVector3f(5,64,100),14,cColor(1,1,1,1),eFontAlign_Left,
+ // "StuckCount %f",mfStuckCounter);
+
+ /*apInit->mpDefaultFont->Draw(cVector3f(5,64,100),14,cColor(1,1,1,1),eFontAlign_Left,
+ "Speed: %f",mpCharBody->GetMoveSpeed(eCharDir_Forward));
+ apInit->mpDefaultFont->Draw(cVector3f(5,79,100),14,cColor(1,1,1,1),eFontAlign_Left,
+ "Break: %f",mfCurrentBreak);*/
+
+ if (mbMoving)
+ apInit->mpDefaultFont->Draw(cVector3f(5, 79, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
+ _W("NodeDistAvg: %f"), mfNodeDistAvg);
+
+ /*apInit->mpDefaultFont->Draw(cVector3f(5,64,100),14,cColor(1,1,1,1),eFontAlign_Left,
+ "Yaw: %f Pitch %f",cMath::ToDeg(mpCharBody->GetYaw()), cMath::ToDeg(mpCharBody->GetPitch()));
+
+ apInit->mpDefaultFont->Draw(cVector3f(5,79,100),14,cColor(1,1,1,1),eFontAlign_Left,
+ "Speed: %f",mpCharBody->GetMoveSpeed(eCharDir_Forward));
+
+ apInit->mpDefaultFont->Draw(cVector3f(5,94,100),14,cColor(1,1,1,1),eFontAlign_Left,
+ "Fwd: %s",mpCharBody->GetForward().ToString().c_str());
+
+ apInit->mpDefaultFont->Draw(cVector3f(5,110,100),14,cColor(1,1,1,1),eFontAlign_Left,
+ "Moving: %d",mbMoving?1:0);*/
+}
+
+//-----------------------------------------------------------------------
+
+void cCharacterMove::OnPostSceneDraw(iLowLevelGraphics *apLowLevelGfx) {
+ apLowLevelGfx->SetDepthTestActive(true);
+
+ for (int i = 0; i < mpContainer->GetNodeNum(); ++i) {
+ cAINode *pNode = mpContainer->GetNode(i);
+
+ apLowLevelGfx->DrawSphere(pNode->GetPosition(), 0.15f, cColor(0.6f, 0.6f, 0.6f, 1));
+
+ for (int j = 0; j < pNode->GetEdgeNum(); ++j) {
+ cAINodeEdge *pEdge = pNode->GetEdge(j);
+
+ apLowLevelGfx->DrawLine(pNode->GetPosition(), pEdge->mpNode->GetPosition(), cColor(0.4f, 0.4f, 0.4f, 1));
+ }
+ }
+
+ mpCharBody->GetBody()->RenderDebugGeometry(apLowLevelGfx, cColor(1, 1, 1, 1));
+
+ // return;
+ if (mbMoving == false)
+ return;
+
+ //////////////////////////////
+ // GoalPos
+ cVector3f vGoalPos = mvGoalPos;
+ if (mpContainer->GetNodeIsAtCenter() == false) {
+ vGoalPos += cVector3f(0, mpContainer->GetCollideSize().y / 2, 0);
+ }
+
+ apLowLevelGfx->DrawSphere(vGoalPos, 0.2f, cColor(1, 0, 1));
+ cVector3f vLastVec = vGoalPos;
+
+ //////////////////////////////
+ // Nodes
+ tAINodeListIt it = mlstNodes.begin();
+ for (; it != mlstNodes.end(); ++it) {
+ cAINode *pNode = *it;
+
+ cVector3f vNodePos = pNode->GetPosition();
+ if (mpContainer->GetNodeIsAtCenter() == false) {
+ vNodePos += cVector3f(0, mpContainer->GetCollideSize().y / 2, 0);
+ }
+
+ apLowLevelGfx->DrawSphere(vNodePos, 0.2f, cColor(1, 0, 1));
+ apLowLevelGfx->DrawLine(vLastVec, vNodePos, cColor(1, 0, 1));
+
+ vLastVec = vNodePos;
+ }
+
+ //////////////////////////////
+ // Start pos
+ cVector3f vStartPos = mpCharBody->GetPosition();
+ // if(mpContainer->GetNodeIsAtCenter()==false){
+ // vStartPos += cVector3f(0,mpContainer->GetCollideSize().y/2, 0);
+ //}
+ apLowLevelGfx->DrawSphere(vStartPos, 0.2f, cColor(1, 0, 1));
+ apLowLevelGfx->DrawLine(vLastVec, vStartPos, cColor(1, 0, 1));
+
+ apLowLevelGfx->DrawSphere(mvTempStart, 0.2f, cColor(0, 1, 1));
+ apLowLevelGfx->DrawSphere(mvTempEnd, 0.2f, cColor(0, 1, 1));
+ apLowLevelGfx->DrawLine(mvTempStart, mvTempEnd, cColor(0, 1, 1));
+}
+
+//-----------------------------------------------------------------------
+
+///////////////////////////////////////////////////////////////////////////
+// SAVE OBJECT STUFF
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/CharacterMove.h b/engines/hpl1/penumbra-overture/CharacterMove.h
new file mode 100644
index 00000000000..e2fc1d06e72
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/CharacterMove.h
@@ -0,0 +1,191 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#ifndef GAME_CHARACTER_MOVE_H
+#define GAME_CHARACTER_MOVE_H
+
+#include "hpl1/engine/engine.h"
+
+using namespace hpl;
+
+class iGameEnemy;
+
+#include "hpl1/penumbra-overture/Init.h"
+
+//------------------------------------------
+
+class cCharacterMove;
+
+class cCharacterAStarCallback : public iAStarCallback, public iAIFreePathCallback {
+public:
+ cCharacterAStarCallback(cCharacterMove *apMove);
+
+ bool CanAddNode(cAINode *apParentNode, cAINode *apChildNode);
+
+ bool Intersects(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
+
+ bool mbCheckDynamic;
+
+ cCharacterMove *mpMove;
+};
+
+//------------------------------------------
+
+class cMoverRayCallback : public iPhysicsRayCallback {
+public:
+ void Reset();
+ bool BeforeIntersect(iPhysicsBody *pBody);
+ bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
+
+ bool mbIntersection;
+};
+
+//------------------------------------------
+
+class cCharacterMove {
+ friend class cCharacterAStarCallback;
+
+public:
+ cCharacterMove(cInit *apInit);
+ ~cCharacterMove();
+
+ void Update(float afTimeStep);
+
+ void OnDraw(cInit *apInit);
+ void OnPostSceneDraw(iLowLevelGraphics *apLowLevelGfx);
+
+ ///////////////////////////////////
+ // Actions
+ /**
+ * returns false if no path could be found.
+ */
+ bool MoveToPos(const cVector3f &avPos);
+ void MoveDirectToPos(const cVector3f &avFeetPos, float afTimeStep);
+
+ void TurnToAngle(float afAngle);
+ void TurnToPos(const cVector3f &avPos);
+
+ void Stop();
+
+ ///////////////////////////////////
+ // Helpers
+
+ bool FreeDirectPathToChar(iCharacterBody *apBody);
+
+ float DistanceToChar(iCharacterBody *apBody);
+ float DistanceToChar2D(iCharacterBody *apBody);
+
+ cAINode *GetAINodeInRange(float afMinDistance, float afMaxDistance);
+ cAINode *GetAINodeAtPosInRange(const cVector3f &avPos, float afMinDistance, float afMaxDistance,
+ bool abRayCheck, float afEndOffset);
+
+ //////////////////////////////////////////
+ // Properties
+ bool IsMoving() { return mbMoving; }
+
+ bool IsTurning() { return mbTurning; }
+
+ void SetCharBody(iCharacterBody *apCharBody);
+ iCharacterBody *GetCharBody() { return mpCharBody; }
+
+ void SetNodeContainer(cAINodeContainer *apContainer);
+ cAINodeContainer *GetNodeContainer() { return mpContainer; }
+
+ void SetAStar(cAStarHandler *apAStar);
+ cAStarHandler *GetAStar() { return mpAStar; }
+
+ void SetMaxTurnSpeed(float afX) { mfMaxTurnSpeed = afX; }
+ void SetAngleDistTurnMul(float afX) { mfAngleDistTurnMul = afX; };
+
+ void SetMinBreakAngle(float afX) { mfMinBreakAngle = afX; }
+ void SetBreakAngleMul(float afX) { mfBreakAngleMul = afX; }
+
+ void SetMaxPushMass(float afX) { mfMaxPushMass = afX; }
+
+ float GetTurnSpeed() { return mfTurnSpeed; }
+
+ const cVector3f &GetGoalPos() { return mvGoalPos; }
+
+ float GetStuckCounter() { return mfStuckCounter; }
+ void ResetStuckCounter() { mfStuckCounter = 0; }
+
+ void SetMaxDoorToughness(int alX) { mlMaxDoorToughness = alX; }
+ int GetMaxDoorToughness() { return mlMaxDoorToughness; }
+
+private:
+ cInit *mpInit;
+
+ iCharacterBody *mpCharBody;
+
+ cAINodeContainer *mpContainer;
+ cAStarHandler *mpAStar;
+ cBoundingVolume mBoundingVolume;
+
+ tAINodeList mlstNodes;
+
+ bool mbMoving;
+ bool mbTurning;
+
+ float mfTurnSpeed;
+
+ cVector3f mvGoalPos;
+
+ float mfGoalAngle;
+
+ float mfStuckCounter;
+ float mfStuckLimit;
+
+ std::list<float> mlstNodeDistances;
+ int mlMaxNodeDistances;
+ float mfNodeDistAvg;
+
+ // Properties
+ float mfMaxTurnSpeed;
+ float mfAngleDistTurnMul;
+
+ float mfMinBreakAngle;
+ float mfBreakAngleMul;
+
+ float mfMaxPushMass;
+
+ cMoverRayCallback mRayCallback;
+
+ int mlMaxDoorToughness;
+
+ // Debug:
+ float mfCurrentBreak;
+ cVector3f mvTempStart;
+ cVector3f mvTempEnd;
+
+ bool mbMoveToNewNode;
+
+ cCharacterAStarCallback *mpAStarCallback;
+};
+
+//--------------------------------------
+
+#endif // GAME_CHARACTER_MOVE_H
diff --git a/engines/hpl1/penumbra-overture/Credits.cpp b/engines/hpl1/penumbra-overture/Credits.cpp
new file mode 100644
index 00000000000..33e6662b1a3
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/Credits.cpp
@@ -0,0 +1,210 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#include "hpl1/penumbra-overture/Credits.h"
+
+#include "hpl1/penumbra-overture/ButtonHandler.h"
+#include "hpl1/penumbra-overture/GameMessageHandler.h"
+#include "hpl1/penumbra-overture/GameMusicHandler.h"
+#include "hpl1/penumbra-overture/GraphicsHelper.h"
+#include "hpl1/penumbra-overture/HapticGameCamera.h"
+#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/penumbra-overture/MainMenu.h"
+#include "hpl1/penumbra-overture/MapHandler.h"
+#include "hpl1/penumbra-overture/Player.h"
+#include "hpl1/penumbra-overture/PlayerHands.h"
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cCredits::cCredits(cInit *apInit) : iUpdateable("Credits") {
+ mpInit = apInit;
+ mpDrawer = mpInit->mpGame->GetGraphics()->GetDrawer();
+
+ // Load fonts
+ mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
+
+ // Load config file
+
+ // Load text
+ tWString sText = kTranslate("MainMenu", "CreditsText");
+ mpFont->GetWordWrapRows(750, 19, 17, sText, &mvTextRows);
+
+ Reset();
+}
+
+//-----------------------------------------------------------------------
+
+cCredits::~cCredits(void) {
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cCredits::Reset() {
+ mbActive = false;
+
+ mfYPos = 600;
+}
+
+//-----------------------------------------------------------------------
+
+void cCredits::OnPostSceneDraw() {
+ mpInit->mpGraphicsHelper->ClearScreen(cColor(0, 0));
+}
+
+//-----------------------------------------------------------------------
+
+void cCredits::OnDraw() {
+ float fSize[2] = {17, 19};
+ float fY = mfYPos;
+ for (size_t i = 0; i < mvTextRows.size(); ++i) {
+ int lSize = 0;
+ if (mvTextRows[i][0] == _W('*')) {
+ lSize = 1;
+ }
+ if (mvTextRows[i].size() <= 1) {
+ fY += fSize[lSize];
+ }
+
+ if (fY >= -fSize[lSize]) {
+ if (fY > 600)
+ continue;
+
+ float fAlpha = fY / 300;
+ if (fAlpha > 1)
+ fAlpha = (2 - fAlpha);
+
+ if (lSize == 0)
+ mpFont->Draw(cVector3f(400, fY, 10), fSize[lSize], cColor(1, fAlpha), eFontAlign_Center,
+ mvTextRows[i].c_str());
+ else
+ mpFont->Draw(cVector3f(400, fY, 10), fSize[lSize], cColor(0.8f, fAlpha), eFontAlign_Center,
+ mvTextRows[i].substr(1).c_str());
+ }
+ fY += fSize[lSize];
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cCredits::Update(float afTimeStep) {
+ // Make sure haptics is off
+ if (mpInit->mbHasHaptics) {
+ mpInit->mpGame->GetHaptic()->GetLowLevel()->StopAllForces();
+ }
+
+ mfYPos -= afTimeStep * 30;
+ cMusicHandler *pMusicHandler = mpInit->mpGame->GetSound()->GetMusicHandler();
+
+ // Check if the credits are over.
+ float fSize[2] = {17, 19};
+ float fY = mfYPos;
+ for (size_t i = 0; i < mvTextRows.size(); ++i) {
+ int lSize = 0;
+ if (mvTextRows[i][0] == _W('*'))
+ lSize = 1;
+ if (mvTextRows[i].size() <= 1)
+ fY += fSize[lSize];
+ fY += fSize[lSize];
+ }
+ if (fY < -120 && pMusicHandler->GetCurrentSong() != NULL) {
+ SetActive(false);
+ pMusicHandler->Stop(0.1f);
+ }
+ if (fY < -340) {
+ SetActive(false);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cCredits::OnMouseDown(eMButton aButton) {
+ OnButtonDown();
+}
+
+//-----------------------------------------------------------------------
+
+void cCredits::OnButtonDown() {
+ SetActive(false);
+}
+
+//-----------------------------------------------------------------------
+
+void cCredits::SetActive(bool abX) {
+ if (mbActive == abX)
+ return;
+
+ mbActive = abX;
+
+ if (mbActive) {
+ mpInit->mpGame->GetScene()->GetWorld3D()->DestroyAllSoundEntities();
+
+ mpInit->mpGame->GetUpdater()->SetContainer("Credits");
+ mpInit->mpGame->GetScene()->SetDrawScene(false);
+ mpInit->mpGame->GetScene()->SetUpdateMap(false);
+ if (mpInit->mbHasHaptics) {
+ mpInit->mpGame->GetHaptic()->GetLowLevel()->SetUpdateShapes(false);
+ mpInit->mpGame->GetHaptic()->GetLowLevel()->StopAllForces();
+ mpInit->mpPlayer->GetHapticCamera()->SetActive(false);
+ }
+ mpInit->mpButtonHandler->ChangeState(eButtonHandlerState_Credits);
+
+ mpInit->mpGame->GetSound()->GetMusicHandler()->Play("penumbra_music_E1_E", 1, 0.3f, false);
+
+ Log("Set Active!\n");
+ } else {
+ mpInit->mpGame->GetSound()->GetMusicHandler()->Stop(0.5f);
+
+ mpInit->ResetGame(true);
+ mpInit->mpMainMenu->SetActive(true);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cCredits::OnExit() {
+ SetActive(false);
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/Credits.h b/engines/hpl1/penumbra-overture/Credits.h
new file mode 100644
index 00000000000..79094bb9a0c
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/Credits.h
@@ -0,0 +1,78 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#ifndef GAME_CREDITS_H
+#define GAME_CREDITS_H
+
+#include "hpl1/engine/engine.h"
+
+#include "hpl1/penumbra-overture/GameTypes.h"
+
+using namespace hpl;
+
+class cInit;
+
+//-------------------------------------------------
+
+class cCredits : public iUpdateable {
+public:
+ cCredits(cInit *apInit);
+ ~cCredits();
+
+ void Reset();
+
+ void OnPostSceneDraw();
+
+ void OnDraw();
+
+ void Update(float afTimeStep);
+
+ void OnMouseDown(eMButton aButton);
+ void OnButtonDown();
+
+ void SetActive(bool abX);
+ bool IsActive() { return mbActive; }
+
+ void OnExit();
+
+private:
+ void LoadConfig();
+
+ cInit *mpInit;
+ cGraphicsDrawer *mpDrawer;
+
+ iFontData *mpFont;
+
+ tWStringVec mvTextRows;
+ float mfYPos;
+
+ bool mbActive;
+};
+
+//---------------------------------------------
+
+#endif // GAME_CREDITS_H
diff --git a/engines/hpl1/penumbra-overture/DeathMenu.cpp b/engines/hpl1/penumbra-overture/DeathMenu.cpp
new file mode 100644
index 00000000000..e2af6962b0a
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/DeathMenu.cpp
@@ -0,0 +1,346 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#include "hpl1/penumbra-overture/DeathMenu.h"
+
+#include "hpl1/penumbra-overture/GraphicsHelper.h"
+#include "hpl1/penumbra-overture/HapticGameCamera.h"
+#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/penumbra-overture/MainMenu.h"
+#include "hpl1/penumbra-overture/MapHandler.h"
+#include "hpl1/penumbra-overture/Player.h"
+#include "hpl1/penumbra-overture/SaveHandler.h"
+
+//////////////////////////////////////////////////////////////////////////
+// BUTTON
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cDeathMenuButton::cDeathMenuButton(cInit *apInit, cVector2f avPos, const tWString &asText) {
+ mpInit = apInit;
+ mpDrawer = mpInit->mpGame->GetGraphics()->GetDrawer();
+
+ mvPositon = cVector3f(avPos.x, avPos.y, 40);
+
+ mvFontSize = cVector2f(21, 21);
+ msText = asText;
+
+ mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
+
+ mRect.w = mpFont->GetLength(mvFontSize, msText.c_str());
+ mRect.h = mvFontSize.y + 3;
+ mRect.x = avPos.x - mRect.w / 2;
+ mRect.y = avPos.y + 3;
+
+ mfAlpha = 0;
+ mbOver = false;
+}
+
+cDeathMenuButton::~cDeathMenuButton() {
+ mpInit->mpGame->GetResources()->GetFontManager()->Destroy(mpFont);
+}
+
+//-----------------------------------------------------------------------
+
+void cDeathMenuButton::OnUpdate(float afTimeStep) {
+ if (mbOver) {
+ mfAlpha += 0.8f * afTimeStep;
+ if (mfAlpha > 1)
+ mfAlpha = 1;
+ } else {
+ mfAlpha -= 1.6f * afTimeStep;
+ if (mfAlpha < 0)
+ mfAlpha = 0;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cDeathMenuButton::OnDraw() {
+ float fAlpha = mpInit->mpDeathMenu->mfAlpha;
+
+ mpFont->Draw(mvPositon, mvFontSize, cColor(0.8f, 0.7f, 0.7f, fAlpha), eFontAlign_Center, msText.c_str());
+
+ mpFont->Draw(mvPositon + cVector3f(0, 0, 1), mvFontSize, cColor(1, 0, 0, fAlpha * mfAlpha), eFontAlign_Center, msText.c_str());
+}
+
+//-----------------------------------------------------------------------
+
+void cDeathMenuButton::OnMouseOver(bool abOver) {
+ mbOver = abOver;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// CONTINUE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cDeathMenuButton_Continue::OnMouseDown() {
+ tWString sAuto = _W("save/auto/") + mpInit->mpSaveHandler->GetLatest(_W("save/auto/"), _W("*.sav"));
+ tWString sSpot = _W("save/spot/") + mpInit->mpSaveHandler->GetLatest(_W("save/spot/"), _W("*.sav"));
+
+ tWString sFile = _W("");
+
+ if (sAuto == _W("save/auto/")) {
+ sFile = sSpot;
+ } else if (sSpot == _W("save/spot/")) {
+ sFile = sAuto;
+ } else {
+ tWString sSaveDir = mpInit->mpSaveHandler->GetSaveDir();
+ cDate dateAuto = FileModifiedDate(sSaveDir + sAuto);
+ cDate dateSpot = FileModifiedDate(sSaveDir + sSpot);
+
+ if (dateAuto > dateSpot)
+ sFile = sAuto;
+ else
+ sFile = sSpot;
+ }
+
+ if (sFile != _W(""))
+ mpInit->mpSaveHandler->LoadGameFromFile(sFile);
+}
+
+//-----------------------------------------------------------------------
+
+void cDeathMenuButton_Continue::OnMouseUp() {
+}
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// BACK TO MAIN
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cDeathMenuButton_BackToMain::OnMouseDown() {
+ mpInit->ResetGame(true);
+ mpInit->mpMainMenu->SetActive(true);
+}
+
+//-----------------------------------------------------------------------
+
+void cDeathMenuButton_BackToMain::OnMouseUp() {
+}
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cDeathMenu::cDeathMenu(cInit *apInit) : iUpdateable("NumericalPanel") {
+ mpInit = apInit;
+ mpDrawer = mpInit->mpGame->GetGraphics()->GetDrawer();
+
+ // Load graphics (use notebook background for now).
+ mpGfxBackground = mpDrawer->CreateGfxObject("notebook_background.bmp", "diffalpha2d");
+
+ mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
+
+ Reset();
+}
+
+//-----------------------------------------------------------------------
+
+cDeathMenu::~cDeathMenu(void) {
+ STLDeleteAll(mlstButtons);
+
+ mpDrawer->DestroyGfxObject(mpGfxBackground);
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cDeathMenu::Reset() {
+ mbActive = false;
+ mfAlpha = 0;
+ mbMouseIsDown = false;
+}
+
+//-----------------------------------------------------------------------
+
+void cDeathMenu::OnDraw() {
+ if (mfAlpha == 0)
+ return;
+
+ mpDrawer->DrawGfxObject(mpGfxBackground, cVector3f(0, 0, 0), cVector2f(800, 600), cColor(1, mfAlpha));
+
+ mpFont->DrawWordWrap(cVector3f(400, 210, 40), 500, 25, 24, cColor(0.7f, 0.3f, 0.3f), eFontAlign_Center,
+ kTranslate("DeathMenu", "YouAreDead").c_str());
+
+ ////////////////////////////////
+ // Update buttons
+ tDeathMenuButtonListIt it = mlstButtons.begin();
+ for (; it != mlstButtons.end(); ++it) {
+ cDeathMenuButton *pButton = *it;
+
+ pButton->OnDraw();
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cDeathMenu::Update(float afTimeStep) {
+ ////////////////////////////////
+ // Check active and fade
+ if (mbActive == false) {
+ mfAlpha -= 2.5f * afTimeStep;
+ if (mfAlpha < 0)
+ mfAlpha = 0;
+ return;
+ } else {
+ // Bad hack fix... owell
+ mpInit->mpPlayer->SetCrossHairState(eCrossHairState_Pointer);
+
+ mfAlpha += 2.3f * afTimeStep;
+ if (mfAlpha > 1)
+ mfAlpha = 1;
+ }
+
+ ////////////////////////////////
+ // Update buttons
+ tDeathMenuButtonListIt it = mlstButtons.begin();
+ for (; it != mlstButtons.end(); ++it) {
+ cDeathMenuButton *pButton = *it;
+
+ pButton->OnUpdate(afTimeStep);
+
+ if (cMath::PointBoxCollision(mvMousePos, pButton->GetRect())) {
+ pButton->OnMouseOver(true);
+ } else {
+ pButton->OnMouseOver(false);
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cDeathMenu::SetMousePos(const cVector2f &avPos) {
+ mvMousePos = avPos;
+ mpInit->mpPlayer->SetCrossHairPos(mvMousePos);
+}
+void cDeathMenu::AddMousePos(const cVector2f &avRel) {
+ mvMousePos += avRel;
+
+ if (mvMousePos.x < 0)
+ mvMousePos.x = 0;
+ if (mvMousePos.x >= 800)
+ mvMousePos.x = 800;
+ if (mvMousePos.y < 0)
+ mvMousePos.y = 0;
+ if (mvMousePos.y >= 600)
+ mvMousePos.y = 600;
+
+ mpInit->mpPlayer->SetCrossHairPos(mvMousePos);
+}
+
+//-----------------------------------------------------------------------
+
+void cDeathMenu::OnMouseDown(eMButton aButton) {
+ ////////////////////////////////
+ // Update buttons
+ tDeathMenuButtonListIt it = mlstButtons.begin();
+ for (; it != mlstButtons.end(); ++it) {
+ cDeathMenuButton *pButton = *it;
+
+ if (cMath::PointBoxCollision(mvMousePos, pButton->GetRect())) {
+ pButton->OnMouseDown();
+ }
+ }
+
+ mbMouseIsDown = true;
+}
+
+void cDeathMenu::OnMouseUp(eMButton aButton) {
+ ////////////////////////////////
+ // Update buttons
+ tDeathMenuButtonListIt it = mlstButtons.begin();
+ for (; it != mlstButtons.end(); ++it) {
+ cDeathMenuButton *pButton = *it;
+
+ if (cMath::PointBoxCollision(mvMousePos, pButton->GetRect())) {
+ pButton->OnMouseUp();
+ }
+ }
+
+ mbMouseIsDown = false;
+}
+
+//-----------------------------------------------------------------------
+
+void cDeathMenu::SetActive(bool abX) {
+ if (mbActive == abX)
+ return;
+
+ mbActive = abX;
+
+ if (mbActive) {
+ if (mpInit->mbHasHaptics)
+ mpInit->mpPlayer->GetHapticCamera()->SetActive(false);
+
+ mLastCrossHairState = mpInit->mpPlayer->GetCrossHairState();
+
+ mpInit->mpPlayer->SetCrossHairPos(mvMousePos);
+ mpInit->mpPlayer->SetCrossHairState(eCrossHairState_Pointer);
+
+ STLDeleteAll(mlstButtons);
+
+ // Continue
+ tWString sAuto = mpInit->mpSaveHandler->GetLatest(_W("save/auto/"), _W("*.sav"));
+ tWString sSpot = mpInit->mpSaveHandler->GetLatest(_W("save/spot/"), _W("*.sav"));
+ if (sAuto != _W("") || sSpot != _W("")) {
+ mlstButtons.push_back(hplNew(cDeathMenuButton_Continue, (mpInit, cVector2f(400, 290), kTranslate("DeathMenu", "Continue"))));
+ }
+
+ // Back to Main
+ mlstButtons.push_back(hplNew(cDeathMenuButton_BackToMain, (mpInit, cVector2f(400, 350), kTranslate("DeathMenu", "BackToMainMenu"))));
+ } else {
+ if (mpInit->mbHasHaptics)
+ mpInit->mpPlayer->GetHapticCamera()->SetActive(true);
+
+ mpInit->mpPlayer->SetCrossHairState(mLastCrossHairState);
+ mpInit->mpPlayer->SetCrossHairPos(cVector2f(400, 300));
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cDeathMenu::OnExit() {
+ SetActive(false);
+}
+
+//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/DeathMenu.h b/engines/hpl1/penumbra-overture/DeathMenu.h
new file mode 100644
index 00000000000..005b4d13eb1
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/DeathMenu.h
@@ -0,0 +1,147 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#ifndef GAME_DEATH_MENU_H
+#define GAME_DEATH_MENU_H
+
+#include "hpl1/engine/engine.h"
+
+#include "hpl1/penumbra-overture/GameTypes.h"
+
+using namespace hpl;
+
+class cInit;
+
+//---------------------------
+class cDeathMenuButton {
+public:
+ cDeathMenuButton(cInit *apInit, cVector2f avPos, const tWString &asText);
+ virtual ~cDeathMenuButton();
+
+ void OnUpdate(float afTimeStep);
+
+ void OnDraw();
+
+ virtual void OnMouseDown() = 0;
+ virtual void OnMouseUp() = 0;
+
+ void OnMouseOver(bool abOver);
+
+ const cRect2f &GetRect() { return mRect; }
+
+protected:
+ float mfAlpha;
+
+ cInit *mpInit;
+ cGraphicsDrawer *mpDrawer;
+
+ cVector3f mvPositon;
+ cRect2f mRect;
+
+ iFontData *mpFont;
+
+ cVector2f mvFontSize;
+ tWString msText;
+
+ bool mbOver;
+};
+
+//---------------------------------------------
+
+class cDeathMenuButton_Continue : public cDeathMenuButton {
+public:
+ cDeathMenuButton_Continue(cInit *apInit, cVector2f avPos, const tWString &asText) : cDeathMenuButton(apInit, avPos, asText) {}
+
+ void OnMouseDown();
+ void OnMouseUp();
+};
+
+//---------------------------------------------
+
+class cDeathMenuButton_BackToMain : public cDeathMenuButton {
+public:
+ cDeathMenuButton_BackToMain(cInit *apInit, cVector2f avPos, const tWString &asText) : cDeathMenuButton(apInit, avPos, asText) {}
+
+ void OnMouseDown();
+ void OnMouseUp();
+};
+
+//---------------------------------------------
+
+typedef std::list<cDeathMenuButton *> tDeathMenuButtonList;
+typedef tDeathMenuButtonList::iterator tDeathMenuButtonListIt;
+
+//---------------------------------------------
+
+class cDeathMenu : public iUpdateable {
+ friend class cDeathMenuButton;
+
+public:
+ cDeathMenu(cInit *apInit);
+ ~cDeathMenu();
+
+ void Reset();
+
+ void OnDraw();
+
+ void Update(float afTimeStep);
+
+ void SetMousePos(const cVector2f &avPos);
+ void AddMousePos(const cVector2f &avRel);
+ cVector2f GetMousePos() { return mvMousePos; }
+
+ void OnMouseDown(eMButton aButton);
+ void OnMouseUp(eMButton aButton);
+
+ void SetActive(bool abX);
+ bool IsActive() { return mbActive; }
+
+ void OnExit();
+
+private:
+ cInit *mpInit;
+ cGraphicsDrawer *mpDrawer;
+
+ cGfxObject *mpGfxBackground;
+
+ bool mbMouseIsDown;
+
+ bool mbActive;
+ float mfAlpha;
+
+ iFontData *mpFont;
+
+ cVector2f mvMousePos;
+
+ eCrossHairState mLastCrossHairState;
+
+ tDeathMenuButtonList mlstButtons;
+};
+
+//---------------------------------------------
+
+#endif // GAME_DEATH_MENU_H
diff --git a/engines/hpl1/penumbra-overture/DemoEndText.cpp b/engines/hpl1/penumbra-overture/DemoEndText.cpp
new file mode 100644
index 00000000000..12607ab2296
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/DemoEndText.cpp
@@ -0,0 +1,178 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#include "hpl1/penumbra-overture/DemoEndText.h"
+
+#include "hpl1/penumbra-overture/ButtonHandler.h"
+#include "hpl1/penumbra-overture/GraphicsHelper.h"
+#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/penumbra-overture/MainMenu.h"
+#include "hpl1/penumbra-overture/MapHandler.h"
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cDemoEndText::cDemoEndText(cInit *apInit) : iUpdateable("PreMenu") {
+ mpInit = apInit;
+ mpDrawer = mpInit->mpGame->GetGraphics()->GetDrawer();
+
+ // Load fonts
+ // mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
+
+ Reset();
+}
+
+//-----------------------------------------------------------------------
+
+cDemoEndText::~cDemoEndText(void) {
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cDemoEndText::Reset() {
+ mbActive = false;
+
+ mfAlpha = 0;
+ mfAlphaAdd = 0.6f;
+
+ mlCurrentImage = 0;
+}
+
+//-----------------------------------------------------------------------
+
+void cDemoEndText::OnPostSceneDraw() {
+ if (mbActive == false)
+ return;
+ if (mvTextures.empty())
+ return;
+
+ mpInit->mpGraphicsHelper->ClearScreen(cColor(0, 0));
+
+ mpInit->mpGraphicsHelper->DrawTexture(mvTextures[mlCurrentImage], 0,
+ cVector2f(800, 600), cColor(mfAlpha, 1));
+}
+
+//-----------------------------------------------------------------------
+
+void cDemoEndText::OnDraw() {
+}
+
+//-----------------------------------------------------------------------
+
+void cDemoEndText::Update(float afTimeStep) {
+ mfAlpha += mfAlphaAdd * afTimeStep;
+
+ if (mfAlphaAdd > 0) {
+ if (mfAlpha > 1)
+ mfAlpha = 1;
+ } else {
+ if (mfAlpha < 0) {
+ mfAlpha = 0;
+ mfAlphaAdd = -mfAlphaAdd;
+ if (mlCurrentImage >= (int)mvTextures.size() - 1) {
+ SetActive(false);
+ } else {
+ mlCurrentImage++;
+ }
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cDemoEndText::OnMouseDown(eMButton aButton) {
+ OnButtonDown();
+}
+
+//-----------------------------------------------------------------------
+
+void cDemoEndText::OnButtonDown() {
+ if (mfAlphaAdd > 0 && mfAlpha == 1) {
+ mfAlphaAdd = -mfAlphaAdd;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cDemoEndText::SetActive(bool abX) {
+ if (mbActive == abX)
+ return;
+
+ mbActive = abX;
+
+ if (mbActive) {
+ mpInit->mpGame->GetScene()->GetWorld3D()->DestroyAllSoundEntities();
+
+ mpInit->mpGame->GetUpdater()->SetContainer("DemoEndText");
+ mpInit->mpGame->GetScene()->SetDrawScene(false);
+ mpInit->mpGame->GetScene()->SetUpdateMap(false);
+ if (mpInit->mbHasHaptics)
+ mpInit->mpGame->GetHaptic()->GetLowLevel()->SetUpdateShapes(false);
+ mpInit->mpButtonHandler->ChangeState(eButtonHandlerState_DemoEndText);
+
+ for (int i = 0; i < 3; ++i) {
+ iTexture *pTex = mpInit->mpGame->GetResources()->GetTextureManager()->Create2D(
+ "demo_end0" + cString::ToString(i) + ".jpg", false);
+ if (pTex)
+ mvTextures.push_back(pTex);
+ }
+
+ mfAlpha = 0;
+ } else {
+ for (size_t i = 0; i < mvTextures.size(); ++i) {
+ mpInit->mpGame->GetResources()->GetTextureManager()->Destroy(mvTextures[i]);
+ }
+ mvTextures.clear();
+
+ mpInit->mpGame->Exit();
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cDemoEndText::OnExit() {
+ // SetActive(false);
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/DemoEndText.h b/engines/hpl1/penumbra-overture/DemoEndText.h
new file mode 100644
index 00000000000..8657d643540
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/DemoEndText.h
@@ -0,0 +1,78 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#ifndef GAME_DEMO_END_TEXT_H
+#define GAME_DEMO_END_TEXT_H
+
+#include "hpl1/engine/engine.h"
+
+#include "hpl1/penumbra-overture/GameTypes.h"
+
+using namespace hpl;
+
+class cInit;
+//-------------------------------------------------
+
+class cDemoEndText : public iUpdateable {
+public:
+ cDemoEndText(cInit *apInit);
+ ~cDemoEndText();
+
+ void Reset();
+
+ void OnPostSceneDraw();
+ void OnDraw();
+
+ void Update(float afTimeStep);
+
+ void OnMouseDown(eMButton aButton);
+ void OnButtonDown();
+
+ void SetActive(bool abX);
+ bool IsActive() { return mbActive; }
+
+ void OnExit();
+
+private:
+ cInit *mpInit;
+ cGraphicsDrawer *mpDrawer;
+
+ iFontData *mpFont;
+
+ bool mbActive;
+
+ float mfAlpha;
+ float mfAlphaAdd;
+
+ int mlCurrentImage;
+
+ std::vector<iTexture *> mvTextures;
+};
+
+//---------------------------------------------
+
+#endif // GAME_DEMO_END_TEXT_H
diff --git a/engines/hpl1/penumbra-overture/EffectHandler.cpp b/engines/hpl1/penumbra-overture/EffectHandler.cpp
new file mode 100644
index 00000000000..7ab1f95d651
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/EffectHandler.cpp
@@ -0,0 +1,845 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#include "hpl1/penumbra-overture/EffectHandler.h"
+
+#include "hpl1/penumbra-overture/GameMessageHandler.h"
+#include "hpl1/penumbra-overture/GameSaveArea.h"
+#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/penumbra-overture/Inventory.h"
+#include "hpl1/penumbra-overture/Player.h"
+#include "hpl1/penumbra-overture/PlayerHelper.h"
+#include "hpl1/penumbra-overture/RadioHandler.h"
+#include "hpl1/penumbra-overture/SaveHandler.h"
+
+//////////////////////////////////////////////////////////////////////////
+// UNDERWATER
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cEffect_Underwater::cEffect_Underwater(cInit *apInit, cGraphicsDrawer *apDrawer) {
+ mpInit = apInit;
+ mpDrawer = apDrawer;
+
+ mpWhiteGfx = mpDrawer->CreateGfxObject("effect_white.jpg", "smoke2d");
+
+ Reset();
+}
+//-----------------------------------------------------------------------
+
+cEffect_Underwater::~cEffect_Underwater() {
+}
+
+//-----------------------------------------------------------------------
+
+void cEffect_Underwater::SetActive(bool abX) {
+ if (mbActive == abX)
+ return;
+
+ mbActive = abX;
+}
+
+//-----------------------------------------------------------------------
+
+void cEffect_Underwater::Update(float afTimeStep) {
+}
+//-----------------------------------------------------------------------
+
+void cEffect_Underwater::OnDraw() {
+ if (mbActive == false)
+ return;
+
+ cColor invColor(1 - mColor.r, 1 - mColor.g, 1 - mColor.b, 0);
+ mpDrawer->DrawGfxObject(mpWhiteGfx, 0, cVector2f(800, 600), invColor);
+}
+//-----------------------------------------------------------------------
+
+void cEffect_Underwater::Reset() {
+ mbActive = false;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// SHAKE SCREEN
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cEffect_ShakeScreen::cEffect_ShakeScreen(cInit *apInit) {
+ mpInit = apInit;
+
+ if (mpInit->mbHasHaptics) {
+ mpForce = mpInit->mpGame->GetHaptic()->GetLowLevel()->CreateSinusWaveForce(
+ cVector3f(0, 1, 0), 0.1f, 5);
+ } else {
+ mpForce = NULL;
+ }
+}
+
+cEffect_ShakeScreen::~cEffect_ShakeScreen() {
+}
+
+void cEffect_ShakeScreen::Start(float afAmount, float afTime, float afFadeInTime, float afFadeOutTime) {
+ cEffect_ShakeScreen_Shake shake;
+ shake.mfSize = afAmount;
+ shake.mfMaxSize = afAmount;
+ shake.mfTime = afTime;
+ shake.mfFadeInTime = afFadeInTime;
+ shake.mfMaxFadeInTime = afFadeInTime;
+ shake.mfFadeOutTime = afFadeOutTime;
+ shake.mfMaxFadeOutTime = afFadeOutTime;
+
+ mlstShakes.push_back(shake);
+}
+
+void cEffect_ShakeScreen::Update(float afTimeStep) {
+ float fLargest = 0;
+
+ std::list<cEffect_ShakeScreen_Shake>::iterator it = mlstShakes.begin();
+ for (; it != mlstShakes.end();) {
+ cEffect_ShakeScreen_Shake &shake = *it;
+
+ if (shake.mfFadeInTime > 0) {
+ shake.mfFadeInTime -= afTimeStep;
+ if (shake.mfFadeInTime < 0)
+ shake.mfFadeInTime = 0;
+ float fT = shake.mfFadeInTime / shake.mfMaxFadeInTime;
+ shake.mfSize = (1 - fT) * shake.mfMaxSize;
+ } else if (shake.mfTime > 0) {
+ shake.mfTime -= afTimeStep;
+ if (shake.mfTime < 0)
+ shake.mfTime = 0;
+ shake.mfSize = shake.mfMaxSize;
+ } else {
+ shake.mfFadeOutTime -= afTimeStep;
+ if (shake.mfFadeOutTime < 0)
+ shake.mfFadeOutTime = 0;
+ float fT = shake.mfFadeOutTime / shake.mfMaxFadeOutTime;
+ shake.mfSize = fT * shake.mfMaxSize;
+ }
+
+ // Log("%f, %f, %f size: %f\n",shake.mfFadeInTime,shake.mfTime,shake.mfFadeOutTime,shake.mfSize);
+
+ if (fLargest < shake.mfSize)
+ fLargest = shake.mfSize;
+
+ if (shake.mfTime <= 0 && shake.mfFadeOutTime <= 0 && shake.mfFadeInTime <= 0) {
+ it = mlstShakes.erase(it);
+ } else {
+ ++it;
+ }
+ }
+
+ mvAdd.x = cMath::RandRectf(-fLargest, fLargest);
+ mvAdd.y = cMath::RandRectf(-fLargest, fLargest);
+ mvAdd.z = cMath::RandRectf(-fLargest, fLargest);
+
+ if (mpForce) {
+ if (mlstShakes.empty() == false) {
+ mpForce->SetActive(true);
+ mpForce->SetAmp(fLargest * 12);
+ } else {
+ mpForce->SetActive(false);
+ }
+ }
+}
+
+void cEffect_ShakeScreen::Reset() {
+ mlstShakes.clear();
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// SAVE EFFECT
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cEffect_SaveEffect::cEffect_SaveEffect(cInit *apInit, cGraphicsDrawer *apDrawer) {
+ mpInit = apInit;
+ mpDrawer = apDrawer;
+
+ mpFlashGfx = mpDrawer->CreateGfxObject("effect_white.jpg", "diffalpha2d");
+
+ Reset();
+}
+cEffect_SaveEffect::~cEffect_SaveEffect() {
+}
+
+void cEffect_SaveEffect::NormalSave(const cVector3f &avPos, cGameSaveArea *apSaveArea) {
+ mpSaveArea = apSaveArea;
+
+ msMessage = _W("");
+ if (apSaveArea->GetMessageCat() != "") {
+ msMessage = kTranslate(apSaveArea->GetMessageCat(), apSaveArea->GetMessageEntry());
+ if (apSaveArea->GetHasBeenUsed())
+ mpInit->mpGame->GetSound()->GetSoundHandler()->PlayGui("horror_save", false, 1);
+ else
+ mpInit->mpGame->GetSound()->GetSoundHandler()->PlayGui("horror_flashback1", false, 1);
+ } else {
+ mpInit->mpGame->GetSound()->GetSoundHandler()->PlayGui("horror_save", false, 1);
+ }
+
+ mvPosition = avPos;
+ mbActive = true;
+ mfTime = 0;
+
+ mfStartFov = mpInit->mpPlayer->GetCamera()->GetFOV();
+ mfFov = mpInit->mpPlayer->GetCamera()->GetFOV();
+
+ mpInit->mpPlayer->SetActive(false);
+ mpInit->mpPlayer->GetLookAt()->SetActive(true);
+ mpInit->mpPlayer->GetLookAt()->SetTarget(avPos, 2.1f, 4);
+
+ mpInit->mpGame->GetGraphics()->GetRendererPostEffects()->SetImageTrailActive(true);
+ mpInit->mpGame->GetGraphics()->GetRendererPostEffects()->SetImageTrailAmount(0.8f);
+
+ mfFlashAlpha = 0;
+ mFlashColor = cColor(216.0f / 255.0f,
+ 85.0f / 255.0f,
+ 5.0f / 255.0f, 0);
+
+ mlState = 0;
+
+ mbAutoSave = false;
+}
+
+void cEffect_SaveEffect::AutoSave() {
+ mbActive = true;
+ mfTime = 0;
+
+ // mpInit->mpPlayer->SetActive(false);
+
+ mfFlashAlpha = 0;
+ mFlashColor = cColor(216.0f / 255.0f,
+ 85.0f / 255.0f,
+ 5.0f / 255.0f, 0);
+
+ mlState = 0;
+
+ mbAutoSave = true;
+}
+
+void cEffect_SaveEffect::Update(float afTimeStep) {
+ if (mbActive == false)
+ return;
+
+ mfTime += afTimeStep;
+
+ if (mbAutoSave) {
+ AutoSaveUpdate(afTimeStep);
+ } else {
+ NormalSaveUpdate(afTimeStep);
+ }
+}
+
+void cEffect_SaveEffect::OnDraw() {
+ if (mbActive == false)
+ return;
+
+ mpDrawer->DrawGfxObject(mpFlashGfx, 0, cVector2f(800, 600),
+ cColor(1, 1) * mfFlashAlpha +
+ mFlashColor * (1 - mfFlashAlpha));
+}
+
+void cEffect_SaveEffect::Reset() {
+ mbActive = false;
+}
+
+//-----------------------------------------------------------------------
+
+void cEffect_SaveEffect::NormalSaveUpdate(float afTimeStep) {
+ switch (mlState) {
+ ///////////////////////
+ // State 0
+ case 0: {
+ // Flash
+ mfFlashAlpha += 0.5f * afTimeStep;
+ if (mfFlashAlpha > 1.0f)
+ mfFlashAlpha = 1.0f;
+
+ // Fov
+ mfFov -= (mfFov - 0.2f) * afTimeStep * 1.3f;
+ mpInit->mpPlayer->GetCamera()->SetFOV(mfFov);
+
+ if (mfTime > 3.0f) {
+ mlState++;
+ mpInit->mpPlayer->GetCamera()->SetFOV(mfStartFov);
+
+ mpInit->mpSaveHandler->AutoSave(_W("spot"), 10);
+ }
+ break;
+ }
+ ///////////////////////
+ // State 1
+ case 1: {
+ if (msMessage != _W("") && mpSaveArea->GetHasBeenUsed() == false) {
+ mpInit->mpGameMessageHandler->SetBlackText(true);
+ mpInit->mpGameMessageHandler->Add(msMessage);
+ }
+ mlState++;
+ break;
+ }
+ ///////////////////////
+ // State 2
+ case 2: {
+ if (mpInit->mpGameMessageHandler->HasMessage() == false) {
+ mlState++;
+ }
+ break;
+ }
+ ///////////////////////
+ // State3
+ case 3: {
+ // Flash
+ mfFlashAlpha -= 0.6f * afTimeStep;
+ if (mfFlashAlpha < 0.0f) {
+ mfFlashAlpha = 0.0f;
+ mlState++;
+ }
+
+ break;
+ }
+ ///////////////////////
+ // State4
+ case 4: {
+ /////////////
+ // Reset all
+ mbActive = false;
+ mpInit->mpPlayer->SetActive(true);
+ mpInit->mpPlayer->GetLookAt()->SetActive(false);
+ mpInit->mpGame->GetGraphics()->GetRendererPostEffects()->SetImageTrailActive(false);
+
+ /////////////
+ // Display message
+ int lLevel = 0;
+ int lMaxRand = 3;
+ if (mpInit->mpPlayer->mlStat_NumOfSaves > 0)
+ lLevel = 1;
+ if (mpInit->mpPlayer->mlStat_NumOfSaves > 5)
+ lLevel = 2;
+ else if (mpInit->mpPlayer->mlStat_NumOfSaves > 20)
+ lLevel = 3;
+
+ if (lLevel == 0)
+ lMaxRand = 1;
+
+ tString sEntry = "AfterSave_Default";
+ if (mpSaveArea->GetHasBeenUsed() == false) {
+ mpInit->mpPlayer->mlStat_NumOfSaves++;
+ int lNum = mpInit->mpPlayer->mlStat_NumOfSaves;
+ if (lNum > 10)
+ lNum = 10;
+ if (lNum < 10)
+ sEntry = "AfterSave_0" + cString::ToString(lNum);
+ else
+ sEntry = "AfterSave_" + cString::ToString(lNum);
+
+ mpSaveArea->SetHasBeenUsed(true);
+ }
+
+ mpInit->mpGameMessageHandler->SetBlackText(false);
+ mpInit->mpGameMessageHandler->Add(kTranslate("Save", sEntry));
+
+ break;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cEffect_SaveEffect::AutoSaveUpdate(float afTimeStep) {
+ switch (mlState) {
+ ///////////////////////
+ // State 0
+ case 0: {
+ // Flash
+ mfFlashAlpha += 1.2f * afTimeStep;
+ if (mfFlashAlpha > 0.75f) {
+ mfFlashAlpha = 0.75f;
+ mlState++;
+ mpInit->mpSaveHandler->AutoSave(_W("auto"), 5);
+ mpInit->mpPlayer->SetActive(true);
+ }
+ break;
+ }
+ ///////////////////////
+ // State 1
+ case 1: {
+ // Flash
+ mfFlashAlpha -= 0.8f * afTimeStep;
+ if (mfFlashAlpha < 0.0f) {
+ mfFlashAlpha = 0.0f;
+ mlState++;
+ }
+
+ break;
+ }
+ ///////////////////////
+ // State2
+ case 2: {
+ /////////////
+ // Reset all
+ mbActive = false;
+ break;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// DEPTH OF FIELD
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cEffect_DepthOfField::cEffect_DepthOfField(cInit *apInit) {
+ mbDisabled = false;
+ mpInit = apInit;
+ mpPostEffects = apInit->mpGame->GetGraphics()->GetRendererPostEffects();
+
+ Reset();
+}
+
+cEffect_DepthOfField::~cEffect_DepthOfField() {
+}
+
+void cEffect_DepthOfField::Reset() {
+ mbActive = false;
+ mfMaxBlur = 0;
+ mpFocusBody = NULL;
+}
+
+void cEffect_DepthOfField::SetDisabled(bool abX) {
+ mbDisabled = abX;
+
+ if (mbDisabled) {
+ mpPostEffects->SetDepthOfFieldActive(false);
+ } else if (mbActive) {
+ mpPostEffects->SetDepthOfFieldActive(true);
+ }
+}
+
+void cEffect_DepthOfField::SetActive(bool abX, float afFadeTime) {
+ mbActive = abX;
+ if (mbDisabled)
+ return;
+
+ if (mbActive)
+ mpPostEffects->SetDepthOfFieldActive(true);
+
+ if (afFadeTime > 0)
+ mfFadeSpeed = 1 / afFadeTime;
+ else
+ mfFadeSpeed = 100000.0f;
+
+ Update(1.0f / 60.0f);
+}
+
+void cEffect_DepthOfField::SetUp(float afNearPlane, float afFocalPlane, float afFarPlane) {
+ mpPostEffects->SetDepthOfFieldNearPlane(afNearPlane);
+ mpPostEffects->SetDepthOfFieldFocalPlane(afFocalPlane);
+ mpPostEffects->SetDepthOfFieldFarPlane(afFarPlane);
+}
+
+void cEffect_DepthOfField::Update(float afTimeStep) {
+ /////////////////////////////////
+ // Update focus to body
+ if (mpFocusBody && mfMaxBlur > 0) {
+ FocusOnBody(mpFocusBody);
+ }
+
+ ///////////////////////////
+ // Update max blur
+ if (mbActive) {
+ mfMaxBlur += afTimeStep * mfFadeSpeed;
+ if (mfMaxBlur > 1)
+ mfMaxBlur = 1;
+ } else if (mfMaxBlur > 0) {
+ mfMaxBlur -= afTimeStep * mfFadeSpeed;
+ if (mfMaxBlur < 0) {
+ mfMaxBlur = 0;
+ mpPostEffects->SetDepthOfFieldActive(false);
+ }
+ }
+
+ mpPostEffects->SetDepthOfFieldMaxBlur(mfMaxBlur);
+}
+
+//-----------------------------------------------------------------------
+
+void cEffect_DepthOfField::FocusOnBody(iPhysicsBody *apBody) {
+ cBoundingVolume *pBV = apBody->GetBV();
+ cVector3f vCamPos = mpInit->mpPlayer->GetCamera()->GetPosition();
+
+ // Focal plane
+ float fFocalPlane = cMath::Vector3Dist(pBV->GetWorldCenter(), vCamPos);
+
+ // Near plane
+ float fNearPlane = fFocalPlane - (pBV->GetRadius() + 0.3f);
+ if (fNearPlane < 0)
+ fNearPlane = 0;
+
+ // Far plane
+ float fFarPlane = fFocalPlane + (pBV->GetRadius() + 0.3f);
+
+ // float fDist = cMath::Vector3Dist(vCamPos,apBody->GetWorldPosition());
+ // Log("Body: %s Dist: %f PickedDist: %f\n",apBody->GetName().c_str(), fDist,mpInit->mpPlayer->GetPickedDist());
+ // Log("Setup near %f focal %f far %f Radii %f\n",fNearPlane,fFocalPlane,fFarPlane,pBV->GetRadius());
+
+ SetUp(fNearPlane, fFocalPlane, fFarPlane);
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// FLASH
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cEffect_Flash::cEffect_Flash(cInit *apInit, cGraphicsDrawer *apDrawer) {
+ mpInit = apInit;
+ mpDrawer = apDrawer;
+
+ mpWhiteGfx = mpDrawer->CreateGfxObject("effect_white.jpg", "diffadditive2d");
+
+ Reset();
+}
+cEffect_Flash::~cEffect_Flash() {
+ mpDrawer->DestroyGfxObject(mpWhiteGfx);
+}
+
+//-----------------------------------------------------------------------
+
+void cEffect_Flash::Start(float afFadeIn, float afWhite, float afFadeOut) {
+ mbActive = true;
+
+ mlStep = 0;
+
+ mfFadeInSpeed = 1 / afFadeIn;
+ mfWhiteSpeed = 1 / afWhite;
+ mfFadeOutSpeed = 1 / afFadeOut;
+}
+
+//-----------------------------------------------------------------------
+
+void cEffect_Flash::Update(float afTimeStep) {
+ if (mbActive == false)
+ return;
+
+ if (mlStep == 0) {
+ mfAlpha += mfFadeInSpeed * afTimeStep;
+ if (mfAlpha >= 1.0f) {
+ mfAlpha = 1.0f;
+ mlStep = 1;
+ mfCount = 1;
+ }
+ } else if (mlStep == 1) {
+ mfCount -= mfWhiteSpeed * afTimeStep;
+ if (mfCount <= 0) {
+ mlStep = 2;
+ }
+ } else if (mlStep == 2) {
+ mfAlpha -= mfFadeOutSpeed * afTimeStep;
+ if (mfAlpha <= 0.0f) {
+ mbActive = false;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cEffect_Flash::OnDraw() {
+ if (mbActive == false)
+ return;
+
+ mpDrawer->DrawGfxObject(mpWhiteGfx, 0, cVector2f(800, 600), cColor(1, mfAlpha));
+}
+
+//-----------------------------------------------------------------------
+
+void cEffect_Flash::Reset() {
+ mbActive = false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// SUB TITLE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+cEffect_SubTitle::cEffect_SubTitle(cInit *apInit, cGraphicsDrawer *apDrawer) {
+ mpInit = apInit;
+ mpDrawer = apDrawer;
+
+ mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
+}
+cEffect_SubTitle::~cEffect_SubTitle() {
+}
+
+void cEffect_SubTitle::Add(const tWString &asMessage, float afTime, bool abRemovePrevious) {
+ if (abRemovePrevious) {
+ tSubTitleListIt it = mlstSubTitles.begin();
+ for (; it != mlstSubTitles.end();) {
+ cSubTitle &subTitle = *it;
+
+ if (subTitle.mbActive) {
+ subTitle.mfCount = 0;
+ ++it;
+ } else {
+ it = mlstSubTitles.erase(it);
+ }
+ }
+ }
+
+ cSubTitle subTitle;
+ subTitle.mfAlpha = 0.0f;
+ subTitle.mfCount = afTime;
+ subTitle.msMessage = asMessage;
+ subTitle.mbActive = false;
+
+ mlstSubTitles.push_back(subTitle);
+}
+
+void cEffect_SubTitle::Update(float afTimeStep) {
+ bool bFoundFirst = false;
+
+ tSubTitleListIt it = mlstSubTitles.begin();
+ for (; it != mlstSubTitles.end();) {
+ cSubTitle &subTitle = *it;
+
+ if (subTitle.mbActive) {
+ if (subTitle.mfCount > 0) {
+ bFoundFirst = true;
+
+ subTitle.mfCount -= afTimeStep;
+
+ subTitle.mfAlpha += afTimeStep * 0.9f;
+ if (subTitle.mfAlpha > 1)
+ subTitle.mfAlpha = 1;
+ } else {
+ subTitle.mfAlpha -= afTimeStep * 0.9f;
+ if (subTitle.mfAlpha <= 0) {
+ it = mlstSubTitles.erase(it);
+ continue;
+ }
+ }
+ } else if (bFoundFirst == false) {
+ subTitle.mbActive = true;
+ bFoundFirst = true;
+ }
+
+ ++it;
+ }
+}
+void cEffect_SubTitle::OnDraw() {
+ if (mpInit->mpRadioHandler->IsActive() || mpInit->mbSubtitles == false)
+ return;
+
+ tSubTitleListIt it = mlstSubTitles.begin();
+ for (; it != mlstSubTitles.end(); ++it) {
+ cSubTitle &subTitle = *it;
+
+ float fAlpha = subTitle.mfAlpha * (1 - mpInit->mpInventory->GetAlpha());
+
+ if (subTitle.mbActive) {
+ mpFont->DrawWordWrap(cVector3f(25, 500, 47), 750, 16, 15, cColor(1, fAlpha),
+ eFontAlign_Left, subTitle.msMessage);
+ mpFont->DrawWordWrap(cVector3f(25, 500, 46) + cVector3f(1, 1, 0), 750, 16, 15, cColor(0, fAlpha),
+ eFontAlign_Left, subTitle.msMessage);
+ mpFont->DrawWordWrap(cVector3f(25, 500, 46) + cVector3f(-1, -1, 0), 750, 16, 15, cColor(0, fAlpha),
+ eFontAlign_Left, subTitle.msMessage);
+ }
+ }
+}
+void cEffect_SubTitle::Reset() {
+ mlstSubTitles.clear();
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// WAVE GRAVITY
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cEffect_WaveGravity::cEffect_WaveGravity(cInit *apInit) {
+ mpInit = apInit;
+
+ Reset();
+}
+cEffect_WaveGravity::~cEffect_WaveGravity() {
+}
+
+//-----------------------------------------------------------------------
+
+void cEffect_WaveGravity::SetActive(bool abX) {
+ mbActive = abX;
+}
+
+void cEffect_WaveGravity::Setup(float afMaxAngle, float afSwingLength, float afGravitySize, int alDir) {
+ mfMaxAngle = afMaxAngle;
+ mfSwingLength = afSwingLength;
+ mfSize = afGravitySize;
+ mlDir = alDir;
+}
+
+void cEffect_WaveGravity::Update(float afTimeStep) {
+ if (mbActive == false)
+ return;
+
+ iPhysicsWorld *pWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+
+ //////////////////////////////////
+ // Set all bodies to not active
+
+ cPhysicsBodyIterator it = pWorld->GetBodyIterator();
+ while (it.HasNext()) {
+ iPhysicsBody *pBody = it.Next();
+
+ // quick fix for oscillation
+ if (pBody->GetJointNum() > 0 && pBody->GetJoint(0)->GetLimitAutoSleep())
+ continue;
+
+ if (pBody->GetMass() != 0) {
+ pBody->SetEnabled(true);
+ }
+ }
+
+ /////////////////////////////////
+ // Update gravity
+ mfTime += (k2Pif / mfSwingLength) * afTimeStep;
+
+ float afAngle = mfMaxAngle * sin(mfTime);
+
+ cVector3f vDir(0, 0, 0);
+ vDir.y = -cos(afAngle);
+ if (mlDir == 0)
+ vDir.x = sin(afAngle);
+ else
+ vDir.z = sin(afAngle);
+
+ vDir = vDir * mfSize;
+
+ pWorld->SetGravity(vDir);
+}
+
+void cEffect_WaveGravity::Reset() {
+ mbActive = false;
+
+ mfMaxAngle = 0;
+ mfSwingLength = 1;
+ mfSize = 9.8f;
+
+ mfTime = 0;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cEffectHandler::cEffectHandler(cInit *apInit) : iUpdateable("EffectHandler") {
+ mpInit = apInit;
+ mpDrawer = mpInit->mpGame->GetGraphics()->GetDrawer();
+
+ mpFlash = hplNew(cEffect_Flash, (mpInit, mpDrawer));
+ mpWaveGravity = hplNew(cEffect_WaveGravity, (mpInit));
+ mpSubTitle = hplNew(cEffect_SubTitle, (mpInit, mpDrawer));
+ mpDepthOfField = hplNew(cEffect_DepthOfField, (mpInit));
+ mpSaveEffect = hplNew(cEffect_SaveEffect, (mpInit, mpDrawer));
+ mpShakeScreen = hplNew(cEffect_ShakeScreen, (mpInit));
+ mpUnderwater = hplNew(cEffect_Underwater, (mpInit, mpDrawer));
+
+ Reset();
+}
+
+//-----------------------------------------------------------------------
+
+cEffectHandler::~cEffectHandler(void) {
+ hplDelete(mpFlash);
+ hplDelete(mpWaveGravity);
+ hplDelete(mpSubTitle);
+ hplDelete(mpDepthOfField);
+ hplDelete(mpSaveEffect);
+ hplDelete(mpShakeScreen);
+ hplDelete(mpUnderwater);
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cEffectHandler::OnStart() {
+}
+
+//-----------------------------------------------------------------------
+
+void cEffectHandler::Update(float afTimeStep) {
+ mpFlash->Update(afTimeStep);
+ mpWaveGravity->Update(afTimeStep);
+ mpSubTitle->Update(afTimeStep);
+ mpDepthOfField->Update(afTimeStep);
+ mpSaveEffect->Update(afTimeStep);
+ mpShakeScreen->Update(afTimeStep);
+ mpUnderwater->Update(afTimeStep);
+}
+
+//-----------------------------------------------------------------------
+
+void cEffectHandler::Reset() {
+ mpFlash->Reset();
+ mpWaveGravity->Reset();
+ mpSubTitle->Reset();
+ mpDepthOfField->Reset();
+ mpSaveEffect->Reset();
+ mpShakeScreen->Reset();
+ mpUnderwater->Reset();
+}
+
+//-----------------------------------------------------------------------
+
+void cEffectHandler::OnDraw() {
+ mpFlash->OnDraw();
+ mpSubTitle->OnDraw();
+ mpSaveEffect->OnDraw();
+ mpUnderwater->OnDraw();
+}
+
+//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/EffectHandler.h b/engines/hpl1/penumbra-overture/EffectHandler.h
new file mode 100644
index 00000000000..62c64772fc0
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/EffectHandler.h
@@ -0,0 +1,300 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#ifndef GAME_EFFECT_HANDLER_H
+#define GAME_EFFECT_HANDLER_H
+
+#include "hpl1/engine/engine.h"
+
+using namespace hpl;
+
+class cInit;
+
+//-----------------------------------------
+
+class cEffect_Underwater {
+public:
+ cEffect_Underwater(cInit *apInit, cGraphicsDrawer *apDrawer);
+ ~cEffect_Underwater();
+
+ void Update(float afTimeStep);
+ void OnDraw();
+ void Reset();
+
+ void SetActive(bool abX);
+ bool IsActive() { return mbActive; }
+
+ void SetColor(const cColor &aColor) { mColor = aColor; }
+
+private:
+ cInit *mpInit;
+ cGraphicsDrawer *mpDrawer;
+
+ cGfxObject *mpWhiteGfx;
+
+ bool mbActive;
+
+ cColor mColor;
+};
+
+//-----------------------------------------
+
+class cEffect_ShakeScreen_Shake {
+public:
+ float mfMaxSize;
+ float mfSize;
+ float mfTime;
+ float mfFadeInTime;
+ float mfMaxFadeInTime;
+ float mfFadeOutTime;
+ float mfMaxFadeOutTime;
+};
+
+class cEffect_ShakeScreen {
+public:
+ cEffect_ShakeScreen(cInit *apInit);
+ ~cEffect_ShakeScreen();
+
+ void Start(float afAmount, float afTime, float afFadeInTime, float afFadeOutTime);
+
+ void Update(float afTimeStep);
+ void Reset();
+
+ cVector3f GetScreenAdd() { return mvAdd; }
+
+private:
+ cInit *mpInit;
+
+ cVector3f mvAdd;
+
+ iHapticForce *mpForce;
+
+ std::list<cEffect_ShakeScreen_Shake> mlstShakes;
+};
+
+//-----------------------------------------
+class cGameSaveArea;
+class cEffect_SaveEffect {
+public:
+ cEffect_SaveEffect(cInit *apInit, cGraphicsDrawer *apDrawer);
+ ~cEffect_SaveEffect();
+
+ void NormalSave(const cVector3f &avPos, cGameSaveArea *apSaveArea);
+ void AutoSave();
+
+ void Update(float afTimeStep);
+ void OnDraw();
+ void Reset();
+
+private:
+ void NormalSaveUpdate(float afTimeStep);
+ void AutoSaveUpdate(float afTimeStep);
+
+ cInit *mpInit;
+ cGraphicsDrawer *mpDrawer;
+
+ cGfxObject *mpFlashGfx;
+
+ cGameSaveArea *mpSaveArea;
+
+ tWString msMessage;
+
+ bool mbActive;
+ int mlState;
+ bool mbAutoSave;
+
+ cVector3f mvPosition;
+
+ float mfFlashAlpha;
+ cColor mFlashColor;
+
+ float mfTime;
+
+ float mfStartFov;
+ float mfFov;
+};
+
+//-----------------------------------------
+
+class cEffect_DepthOfField {
+public:
+ cEffect_DepthOfField(cInit *apInit);
+ ~cEffect_DepthOfField();
+
+ void SetDisabled(bool abX);
+ bool IsDisabled() { return mbDisabled; }
+
+ void SetActive(bool abX, float afFadeTime);
+ bool IsActive() { return mbActive; }
+
+ void SetUp(float afNearPlane, float afFocalPlane, float afFarPlane);
+
+ void SetFocusBody(iPhysicsBody *apBody) { mpFocusBody = apBody; }
+ void FocusOnBody(iPhysicsBody *apBody);
+
+ void Update(float afTimeStep);
+
+ void Reset();
+
+private:
+ cInit *mpInit;
+ cRendererPostEffects *mpPostEffects;
+
+ iPhysicsBody *mpFocusBody;
+
+ bool mbActive;
+ bool mbDisabled;
+
+ float mfFadeSpeed;
+
+ float mfMaxBlur;
+};
+//-----------------------------------------
+
+class cEffect_Flash {
+public:
+ cEffect_Flash(cInit *apInit, cGraphicsDrawer *apDrawer);
+ ~cEffect_Flash();
+
+ void Start(float afFadeIn, float afWhite, float afFadeOut);
+
+ void Update(float afTimeStep);
+ void OnDraw();
+ void Reset();
+
+private:
+ cInit *mpInit;
+ cGraphicsDrawer *mpDrawer;
+
+ cGfxObject *mpWhiteGfx;
+
+ bool mbActive;
+ float mfAlpha;
+
+ int mlStep;
+
+ float mfCount;
+
+ float mfFadeInSpeed;
+ float mfWhiteSpeed;
+ float mfFadeOutSpeed;
+};
+
+//-----------------------------------------
+
+class cSubTitle {
+public:
+ tWString msMessage;
+ float mfCount;
+ float mfAlpha;
+ bool mbActive;
+};
+
+typedef std::list<cSubTitle> tSubTitleList;
+typedef tSubTitleList::iterator tSubTitleListIt;
+
+class cEffect_SubTitle {
+public:
+ cEffect_SubTitle(cInit *apInit, cGraphicsDrawer *apDrawer);
+ ~cEffect_SubTitle();
+
+ void Add(const tWString &asMessage, float afTime, bool abRemovePrevious);
+
+ void Update(float afTimeStep);
+ void OnDraw();
+ void Reset();
+
+private:
+ cInit *mpInit;
+ cGraphicsDrawer *mpDrawer;
+
+ iFontData *mpFont;
+
+ tSubTitleList mlstSubTitles;
+};
+
+//-----------------------------------------
+
+class cEffect_WaveGravity {
+public:
+ cEffect_WaveGravity(cInit *apInit);
+ ~cEffect_WaveGravity();
+
+ void SetActive(bool abX);
+ // alDir: 0=Xaxis 1=Zaxis
+ void Setup(float afMaxAngle, float afSwingLength, float afGravitySize, int alDir);
+
+ void Update(float afTimeStep);
+ void Reset();
+
+private:
+ cInit *mpInit;
+
+ bool mbActive;
+
+ float mfMaxAngle;
+ float mfSwingLength;
+ float mfSize;
+ int mlDir;
+
+ float mfTime;
+};
+
+//-----------------------------------------
+
+class cEffectHandler : public iUpdateable {
+public:
+ cEffectHandler(cInit *apInit);
+ ~cEffectHandler();
+
+ void OnStart();
+ void Update(float afTimeStep);
+ void Reset();
+ void OnDraw();
+
+ cEffect_Flash *GetFlash() { return mpFlash; }
+ cEffect_WaveGravity *GetWaveGravity() { return mpWaveGravity; }
+ cEffect_SubTitle *GetSubTitle() { return mpSubTitle; }
+ cEffect_DepthOfField *GetDepthOfField() { return mpDepthOfField; }
+ cEffect_SaveEffect *GetSaveEffect() { return mpSaveEffect; }
+ cEffect_ShakeScreen *GetShakeScreen() { return mpShakeScreen; }
+ cEffect_Underwater *GetUnderwater() { return mpUnderwater; }
+
+private:
+ cInit *mpInit;
+ cGraphicsDrawer *mpDrawer;
+
+ cEffect_Flash *mpFlash;
+ cEffect_WaveGravity *mpWaveGravity;
+ cEffect_SubTitle *mpSubTitle;
+ cEffect_DepthOfField *mpDepthOfField;
+ cEffect_SaveEffect *mpSaveEffect;
+ cEffect_ShakeScreen *mpShakeScreen;
+ cEffect_Underwater *mpUnderwater;
+};
+
+#endif // GAME_EFFECT_HANDLER_H
diff --git a/engines/hpl1/penumbra-overture/FadeHandler.cpp b/engines/hpl1/penumbra-overture/FadeHandler.cpp
new file mode 100644
index 00000000000..94040efbb71
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/FadeHandler.cpp
@@ -0,0 +1,161 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#include "hpl1/penumbra-overture/FadeHandler.h"
+
+#include "hpl1/penumbra-overture/GameEntity.h"
+#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/penumbra-overture/Inventory.h"
+#include "hpl1/penumbra-overture/Player.h"
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cFadeHandler::cFadeHandler(cInit *apInit) : iUpdateable("FadeHandler") {
+ mpInit = apInit;
+
+ mpDrawer = mpInit->mpGame->GetGraphics()->GetDrawer();
+
+ mpBlackGfx = mpDrawer->CreateGfxObject("effect_black.bmp", "diffalpha2d");
+
+ Reset();
+}
+
+//-----------------------------------------------------------------------
+
+cFadeHandler::~cFadeHandler(void) {
+ mpDrawer->DestroyGfxObject(mpBlackGfx);
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cFadeHandler::FadeOut(float afTime) {
+ if (afTime <= 0)
+ mfAlphaAdd = 1000000.0f;
+ else
+ mfAlphaAdd = (1.0f / afTime);
+
+ mbActive = true;
+
+ Update(1.0f / 60.0f);
+}
+
+//-----------------------------------------------------------------------
+
+void cFadeHandler::FadeIn(float afTime) {
+ if (afTime <= 0)
+ mfAlphaAdd = -100000.0f;
+ else
+ mfAlphaAdd = -(1.0f / afTime);
+
+ mbActive = true;
+
+ Update(1.0f / 60.0f);
+}
+
+//-----------------------------------------------------------------------
+
+bool cFadeHandler::IsActive() {
+ return mbActive;
+}
+
+//-----------------------------------------------------------------------
+
+void cFadeHandler::OnStart() {
+}
+
+//-----------------------------------------------------------------------
+
+void cFadeHandler::SetWideScreenActive(bool abX) {
+ mbWideScreenActive = abX;
+}
+
+//-----------------------------------------------------------------------
+
+void cFadeHandler::Update(float afTimeStep) {
+ if (mbActive) {
+ mfAlpha += mfAlphaAdd * afTimeStep;
+
+ if (mfAlphaAdd < 0) {
+ if (mfAlpha < 0) {
+ mbActive = false;
+ mfAlpha = 0;
+ }
+ } else {
+ if (mfAlpha > 1) {
+ mbActive = false;
+ mfAlpha = 1;
+ }
+ }
+ }
+
+ //////////////////////////////////
+ // Wide Screen
+ if (mbWideScreenActive) {
+ mfWideScreenAlpha += 0.8f * afTimeStep;
+ if (mfWideScreenAlpha > 1)
+ mfWideScreenAlpha = 1;
+ } else {
+ mfWideScreenAlpha -= 0.7f * afTimeStep;
+ if (mfWideScreenAlpha < 0)
+ mfWideScreenAlpha = 0;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cFadeHandler::Reset() {
+ mfWideScreenAlpha = 0;
+ mbWideScreenActive = false;
+
+ mfAlpha = 0;
+ mfAlphaAdd = 0;
+ mbActive = false;
+}
+
+//-----------------------------------------------------------------------
+
+void cFadeHandler::OnDraw() {
+ if (mfAlpha != 0)
+ mpDrawer->DrawGfxObject(mpBlackGfx, cVector3f(0, 0, 150), cVector2f(800, 600), cColor(1, mfAlpha));
+
+ if (mfWideScreenAlpha != 0) {
+ mpDrawer->DrawGfxObject(mpBlackGfx, cVector3f(0, 0, 40), cVector2f(800, 75), cColor(1, mfWideScreenAlpha));
+ mpDrawer->DrawGfxObject(mpBlackGfx, cVector3f(0, 525, 40), cVector2f(800, 75), cColor(1, mfWideScreenAlpha));
+ }
+}
+
+//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/FadeHandler.h b/engines/hpl1/penumbra-overture/FadeHandler.h
new file mode 100644
index 00000000000..371f350c325
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/FadeHandler.h
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#ifndef GAME_FADE_HANDLER_H
+#define GAME_FADE_HANDLER_H
+
+#include "hpl1/engine/engine.h"
+
+using namespace hpl;
+
+class cInit;
+
+class cFadeHandler : public iUpdateable {
+public:
+ cFadeHandler(cInit *apInit);
+ ~cFadeHandler();
+
+ void FadeOut(float afTime);
+ void FadeIn(float afTime);
+ bool IsActive();
+
+ void SetWideScreenActive(bool abX);
+
+ void OnStart();
+ void Update(float afTimeStep);
+ void Reset();
+ void OnDraw();
+
+private:
+ cInit *mpInit;
+ cGraphicsDrawer *mpDrawer;
+
+ cGfxObject *mpBlackGfx;
+
+ bool mbActive;
+ float mfAlpha;
+ float mfAlphaAdd;
+
+ bool mbWideScreenActive;
+ float mfWideScreenAlpha;
+};
+
+#endif // GAME_FADE_HANDLER_H
diff --git a/engines/hpl1/penumbra-overture/GameArea.cpp b/engines/hpl1/penumbra-overture/GameArea.cpp
new file mode 100644
index 00000000000..4fccdda5a7a
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/GameArea.cpp
@@ -0,0 +1,175 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#include "hpl1/penumbra-overture/GameArea.h"
+#include "hpl1/engine/engine.h"
+
+#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/penumbra-overture/MapHandler.h"
+#include "hpl1/penumbra-overture/Player.h"
+
+#include "hpl1/penumbra-overture/GlobalInit.h"
+
+//////////////////////////////////////////////////////////////////////////
+// LOADER
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cAreaLoader_GameArea::cAreaLoader_GameArea(const tString &asName, cInit *apInit)
+ : iArea3DLoader(asName) {
+ mpInit = apInit;
+}
+
+cAreaLoader_GameArea::~cAreaLoader_GameArea() {
+}
+
+//-----------------------------------------------------------------------
+
+iEntity3D *cAreaLoader_GameArea::Load(const tString &asName, const cVector3f &avSize,
+ const cMatrixf &a_mtxTransform, cWorld3D *apWorld) {
+ cGameArea *pArea = hplNew(cGameArea, (mpInit, asName));
+
+ pArea->m_mtxOnLoadTransform = a_mtxTransform;
+
+ // Create physics data
+ iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
+ iCollideShape *pShape = pPhysicsWorld->CreateBoxShape(avSize, NULL);
+ std::vector<iPhysicsBody *> vBodies;
+ vBodies.push_back(pPhysicsWorld->CreateBody(asName, pShape));
+
+ vBodies[0]->SetCollide(false);
+ vBodies[0]->SetCollideCharacter(false);
+ vBodies[0]->SetMatrix(a_mtxTransform);
+
+ vBodies[0]->SetUserData(pArea);
+ pArea->SetBodies(vBodies);
+
+ mpInit->mpMapHandler->AddGameEntity(pArea);
+
+ // Log("Loaded area %s\n",asName.c_str());
+
+ // Return something else later perhaps.
+ return NULL;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cGameArea::cGameArea(cInit *apInit, const tString &asName) : iGameEntity(apInit, asName) {
+ mType = eGameEntityType_Area;
+
+ mbUseCustomIcon = false;
+}
+
+//-----------------------------------------------------------------------
+
+cGameArea::~cGameArea(void) {
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameArea::OnPlayerPick() {
+ if (mbUseCustomIcon && mpInit->mpPlayer->GetPickedDist() <= mfMaxInteractDist) {
+ mpInit->mpPlayer->SetCrossHairState(mCustomIcon);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cGameArea::SetCustomIcon(eCrossHairState aIcon) {
+ mbUseCustomIcon = true;
+ mCustomIcon = aIcon;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// SAVE OBJECT STUFF
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+kBeginSerialize(cGameArea_SaveData, iGameEntity_SaveData)
+ kSerializeVar(mbUseCustomIcon, eSerializeType_Bool)
+ kSerializeVar(mCustomIcon, eSerializeType_Int32)
+ kSerializeVar(mvSize, eSerializeType_Vector3f)
+ kEndSerialize()
+
+ //-----------------------------------------------------------------------
+
+ iGameEntity *cGameArea_SaveData::CreateEntity() {
+ return NULL;
+}
+
+//-----------------------------------------------------------------------
+
+iGameEntity_SaveData *cGameArea::CreateSaveData() {
+ return hplNew(cGameArea_SaveData, ());
+}
+
+//-----------------------------------------------------------------------
+
+void cGameArea::SaveToSaveData(iGameEntity_SaveData *apSaveData) {
+ super::SaveToSaveData(apSaveData);
+ cGameArea_SaveData *pData = static_cast<cGameArea_SaveData *>(apSaveData);
+
+ kCopyToVar(pData, mbUseCustomIcon);
+ kCopyToVar(pData, mCustomIcon);
+
+ pData->mvSize = mvBodies[0]->GetShape()->GetSize();
+}
+
+//-----------------------------------------------------------------------
+
+void cGameArea::LoadFromSaveData(iGameEntity_SaveData *apSaveData) {
+ super::LoadFromSaveData(apSaveData);
+ cGameArea_SaveData *pData = static_cast<cGameArea_SaveData *>(apSaveData);
+
+ kCopyFromVar(pData, mbUseCustomIcon);
+ kCopyFromVar(pData, mCustomIcon);
+}
+//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameArea.h b/engines/hpl1/penumbra-overture/GameArea.h
new file mode 100644
index 00000000000..875e03f8c3d
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/GameArea.h
@@ -0,0 +1,91 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#ifndef GAME_GAME_AREA_H
+#define GAME_GAME_AREA_H
+
+#include "hpl1/engine/engine.h"
+#include "hpl1/penumbra-overture/GameEntity.h"
+
+using namespace hpl;
+
+//-----------------------------------------
+
+class cGameArea_SaveData : public iGameEntity_SaveData {
+ kSerializableClassInit(cGameArea_SaveData);
+
+public:
+ cVector3f mvSize;
+
+ bool mbUseCustomIcon;
+ eCrossHairState mCustomIcon;
+
+ iGameEntity *CreateEntity();
+};
+
+//------------------------------------------
+
+class cGameArea : public iGameEntity {
+ typedef iGameEntity super;
+
+ friend class cAreaLoader_GameArea;
+
+public:
+ cGameArea(cInit *apInit, const tString &asName);
+ ~cGameArea(void);
+
+ void OnPlayerPick();
+
+ void SetCustomIcon(eCrossHairState aIcon);
+ eCrossHairState GetCustomIcon() { return mCustomIcon; }
+ bool GetUsesCustomIcon() { return mbUseCustomIcon; }
+
+ // SaveObject implementation
+ iGameEntity_SaveData *CreateSaveData();
+ void SaveToSaveData(iGameEntity_SaveData *apSaveData);
+ void LoadFromSaveData(iGameEntity_SaveData *apSaveData);
+
+private:
+ bool mbUseCustomIcon;
+ eCrossHairState mCustomIcon;
+};
+
+//------------------------------------------
+
+class cAreaLoader_GameArea : public iArea3DLoader {
+
+public:
+ cAreaLoader_GameArea(const tString &asName, cInit *apInit);
+ ~cAreaLoader_GameArea();
+
+ iEntity3D *Load(const tString &asName, const cVector3f &avSize, const cMatrixf &a_mtxTransform, cWorld3D *apWorld);
+
+private:
+ cInit *mpInit;
+};
+
+#endif // GAME_GAME_AREA_H
diff --git a/engines/hpl1/penumbra-overture/GameDamageArea.cpp b/engines/hpl1/penumbra-overture/GameDamageArea.cpp
new file mode 100644
index 00000000000..5424a5971f7
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/GameDamageArea.cpp
@@ -0,0 +1,260 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#include "hpl1/penumbra-overture/GameDamageArea.h"
+#include "hpl1/engine/engine.h"
+
+#include "hpl1/penumbra-overture/GameEnemy.h"
+#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/penumbra-overture/MapHandler.h"
+#include "hpl1/penumbra-overture/Player.h"
+#include "hpl1/penumbra-overture/PlayerState.h"
+
+#include "hpl1/penumbra-overture/GlobalInit.h"
+
+//////////////////////////////////////////////////////////////////////////
+// LOADER
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cAreaLoader_GameDamageArea::cAreaLoader_GameDamageArea(const tString &asName, cInit *apInit)
+ : iArea3DLoader(asName) {
+ mpInit = apInit;
+}
+
+cAreaLoader_GameDamageArea::~cAreaLoader_GameDamageArea() {
+}
+
+//-----------------------------------------------------------------------
+
+iEntity3D *cAreaLoader_GameDamageArea::Load(const tString &asName, const cVector3f &avSize,
+ const cMatrixf &a_mtxTransform, cWorld3D *apWorld) {
+ cGameDamageArea *pArea = hplNew(cGameDamageArea, (mpInit, asName));
+
+ pArea->m_mtxOnLoadTransform = a_mtxTransform;
+
+ // Create physics data
+ iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
+ iCollideShape *pShape = pPhysicsWorld->CreateBoxShape(avSize, NULL);
+ std::vector<iPhysicsBody *> vBodies;
+ vBodies.push_back(pPhysicsWorld->CreateBody(asName, pShape));
+
+ vBodies[0]->SetCollide(false);
+ vBodies[0]->SetCollideCharacter(false);
+ vBodies[0]->SetMatrix(a_mtxTransform);
+
+ vBodies[0]->SetUserData(pArea);
+ pArea->SetBodies(vBodies);
+
+ mpInit->mpMapHandler->AddGameEntity(pArea);
+
+ // Return something else later perhaps.
+ return NULL;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+cGameDamageArea::cGameDamageArea(cInit *apInit, const tString &asName) : iGameEntity(apInit, asName) {
+ mType = eGameEntityType_DamageArea;
+
+ mfDamage = 1;
+ mfUpdatesPerSec = 1;
+ mlStrength = 1;
+ mbDisableObjects = false;
+ mbDisableEnemies = false;
+
+ mbHasInteraction = false;
+
+ mfUpdateCount = 0;
+}
+
+//-----------------------------------------------------------------------
+
+cGameDamageArea::~cGameDamageArea(void) {
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameDamageArea::OnPlayerPick() {
+}
+
+//-----------------------------------------------------------------------
+
+void cGameDamageArea::Update(float afTimeStep) {
+ if (mfUpdateCount <= 0) {
+ mfUpdateCount = 1 / mfUpdatesPerSec;
+
+ iPhysicsBody *pAreaBody = mvBodies[0];
+ cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
+ iPhysicsWorld *pPhysicsWorld = pWorld->GetPhysicsWorld();
+
+ cCollideData collideData;
+ collideData.SetMaxSize(1);
+
+ // Get bodies and add to list, this incase the portal contaniner gets changed.
+ std::list<iPhysicsBody *> lstBodies;
+ cPortalContainerEntityIterator bodyIt = pWorld->GetPortalContainer()->GetEntityIterator(
+ pAreaBody->GetBoundingVolume());
+ while (bodyIt.HasNext()) {
+ iPhysicsBody *pBody = static_cast<iPhysicsBody *>(bodyIt.Next());
+ lstBodies.push_back(pBody);
+ }
+
+ ////////////////////////////////////////////////////////
+ // Iterate all bodies in world and check for intersection
+ std::list<iPhysicsBody *>::iterator it = lstBodies.begin();
+ for (; it != lstBodies.end(); ++it) {
+ iPhysicsBody *pBody = *it;
+ iGameEntity *pEntity = (iGameEntity *)pBody->GetUserData();
+
+ if (pBody->GetCollide() && pBody->IsActive()) {
+ if (pEntity) {
+ if (pEntity->GetHealth() <= 0 || pEntity->IsActive() == false)
+ continue;
+ } else if (mpInit->mpPlayer->GetCharacterBody()->GetBody() != pBody) {
+ continue;
+ }
+
+ /////////////////////////
+ // Bounding volume check
+ if (cMath::CheckCollisionBV(*pBody->GetBV(), *pAreaBody->GetBV()) == false)
+ continue;
+
+ ///////////////////////////////
+ // Check for collision
+ if (pPhysicsWorld->CheckShapeCollision(pBody->GetShape(), pBody->GetLocalMatrix(),
+ pAreaBody->GetShape(), pAreaBody->GetLocalMatrix(), collideData, 1) == false) {
+ continue;
+ }
+
+ ////////////////////
+ // Player
+ if (mpInit->mpPlayer->GetCharacterBody()->GetBody() == pBody) {
+ mpInit->mpPlayer->Damage(mfDamage, ePlayerDamageType_BloodSplash);
+ } else if (pEntity) {
+ if ((pEntity->GetType() == eGameEntityType_Object && mbDisableObjects) ||
+ (pEntity->GetType() == eGameEntityType_Enemy && mbDisableEnemies)) {
+ if (pEntity->GetType() == eGameEntityType_Enemy &&
+ pEntity->GetSubType() == "Worm") {
+ return;
+ }
+
+ pEntity->SetActive(false);
+ } else {
+ pEntity->Damage(mfDamage, mlStrength);
+ }
+ }
+ }
+ }
+ } else {
+ mfUpdateCount -= afTimeStep;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// SAVE OBJECT STUFF
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+kBeginSerialize(cGameDamageArea_SaveData, iGameEntity_SaveData)
+ kSerializeVar(mvSize, eSerializeType_Vector3f)
+ kSerializeVar(mfDamage, eSerializeType_Float32)
+ kSerializeVar(mfUpdatesPerSec, eSerializeType_Float32)
+ kSerializeVar(mlStrength, eSerializeType_Int32)
+ kSerializeVar(mbDisableObjects, eSerializeType_Bool)
+ kSerializeVar(mbDisableEnemies, eSerializeType_Bool)
+ kEndSerialize()
+
+ //-----------------------------------------------------------------------
+
+ iGameEntity *cGameDamageArea_SaveData::CreateEntity() {
+ return NULL;
+}
+
+//-----------------------------------------------------------------------
+
+iGameEntity_SaveData *cGameDamageArea::CreateSaveData() {
+ return hplNew(cGameDamageArea_SaveData, ());
+}
+
+//-----------------------------------------------------------------------
+
+void cGameDamageArea::SaveToSaveData(iGameEntity_SaveData *apSaveData) {
+ super::SaveToSaveData(apSaveData);
+ cGameDamageArea_SaveData *pData = static_cast<cGameDamageArea_SaveData *>(apSaveData);
+
+ kCopyToVar(pData, mfDamage);
+ kCopyToVar(pData, mfUpdatesPerSec);
+ kCopyToVar(pData, mlStrength);
+ kCopyToVar(pData, mbDisableObjects);
+ kCopyToVar(pData, mbDisableEnemies);
+
+ pData->mvSize = mvBodies[0]->GetShape()->GetSize();
+}
+
+//-----------------------------------------------------------------------
+
+void cGameDamageArea::LoadFromSaveData(iGameEntity_SaveData *apSaveData) {
+ super::LoadFromSaveData(apSaveData);
+ cGameDamageArea_SaveData *pData = static_cast<cGameDamageArea_SaveData *>(apSaveData);
+
+ kCopyFromVar(pData, mfDamage);
+ kCopyFromVar(pData, mfUpdatesPerSec);
+ kCopyFromVar(pData, mlStrength);
+ kCopyFromVar(pData, mbDisableObjects);
+ kCopyFromVar(pData, mbDisableEnemies);
+}
+
+//-----------------------------------------------------------------------
+
+void cGameDamageArea::SetupSaveData(iGameEntity_SaveData *apSaveData) {
+ super::SetupSaveData(apSaveData);
+ cGameDamageArea_SaveData *pData = static_cast<cGameDamageArea_SaveData *>(apSaveData);
+}
+//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameDamageArea.h b/engines/hpl1/penumbra-overture/GameDamageArea.h
new file mode 100644
index 00000000000..8c62cb389da
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/GameDamageArea.h
@@ -0,0 +1,103 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#ifndef GAME_GAME_DAMAGE_AREA_H
+#define GAME_GAME_DAMAGE_AREA_H
+
+#include "hpl1/engine/engine.h"
+#include "hpl1/penumbra-overture/GameEntity.h"
+
+using namespace hpl;
+
+//------------------------------------------
+
+class cGameDamageArea_SaveData : public iGameEntity_SaveData {
+ kSerializableClassInit(cGameDamageArea_SaveData);
+
+public:
+ cVector3f mvSize;
+
+ float mfDamage;
+ float mfUpdatesPerSec;
+ int mlStrength;
+ bool mbDisableObjects;
+ bool mbDisableEnemies;
+
+ iGameEntity *CreateEntity();
+};
+
+//------------------------------------------
+
+class cGameDamageArea : public iGameEntity {
+ typedef iGameEntity super;
+ friend class cAreaLoader_GameDamageArea;
+
+public:
+ cGameDamageArea(cInit *apInit, const tString &asName);
+ ~cGameDamageArea(void);
+
+ void OnPlayerPick();
+
+ void Update(float afTimeStep);
+
+ void SetDamage(float afX) { mfDamage = afX; }
+ void SetUpdatesPerSec(float afX) { mfUpdatesPerSec = afX; }
+ void SetStrength(int alX) { mlStrength = alX; }
+ void SetDisableObjects(bool abX) { mbDisableObjects = abX; }
+ void SetDisableEnemies(bool abX) { mbDisableEnemies = abX; }
+
+ // SaveObject implementation
+ iGameEntity_SaveData *CreateSaveData();
+ void SaveToSaveData(iGameEntity_SaveData *apSaveData);
+ void LoadFromSaveData(iGameEntity_SaveData *apSaveData);
+ void SetupSaveData(iGameEntity_SaveData *apSaveData);
+
+private:
+ float mfDamage;
+ float mfUpdatesPerSec;
+ int mlStrength;
+ bool mbDisableObjects;
+ bool mbDisableEnemies;
+
+ float mfUpdateCount;
+};
+
+//------------------------------------------
+
+class cAreaLoader_GameDamageArea : public iArea3DLoader {
+
+public:
+ cAreaLoader_GameDamageArea(const tString &asName, cInit *apInit);
+ ~cAreaLoader_GameDamageArea();
+
+ iEntity3D *Load(const tString &asName, const cVector3f &avSize, const cMatrixf &a_mtxTransform, cWorld3D *apWorld);
+
+private:
+ cInit *mpInit;
+};
+
+#endif // GAME_GAME_DAMAGE_AREA_H
diff --git a/engines/hpl1/penumbra-overture/GameEnemy.cpp b/engines/hpl1/penumbra-overture/GameEnemy.cpp
new file mode 100644
index 00000000000..67496cefc45
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/GameEnemy.cpp
@@ -0,0 +1,1676 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#include "hpl1/penumbra-overture/GameEnemy.h"
+#include "hpl1/engine/engine.h"
+
+#include "hpl1/penumbra-overture/GameEnemy_Dog.h"
+#include "hpl1/penumbra-overture/GameEnemy_Spider.h"
+#include "hpl1/penumbra-overture/GameEnemy_Worm.h"
+
+#include "hpl1/penumbra-overture/AttackHandler.h"
+#include "hpl1/penumbra-overture/EffectHandler.h"
+#include "hpl1/penumbra-overture/GameMusicHandler.h"
+#include "hpl1/penumbra-overture/GameObject.h"
+#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/penumbra-overture/MapHandler.h"
+#include "hpl1/penumbra-overture/Player.h"
+#include "hpl1/penumbra-overture/PlayerHelper.h"
+#include "hpl1/penumbra-overture/Triggers.h"
+
+#include "hpl1/penumbra-overture/CharacterMove.h"
+
+#include "hpl1/penumbra-overture/GlobalInit.h"
+
+tString gvStateName[STATE_NUM] = {
+ "IDLE",
+ "HUNT",
+ "ATTACK",
+ "FLEE",
+ "KNOCKDOWN",
+ "DEAD",
+ "PATROL",
+ "INVESTIGATE",
+ "BREAKDOOR",
+ "CALLBACKUP",
+ "MOVETO",
+ "EAT",
+ "ATTENTION",
+};
+
+//////////////////////////////////////////////////////////////////////////
+// GAME ENEMY STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+iGameEnemyState::iGameEnemyState(int alId, cInit *apInit, iGameEnemy *apEnemy) {
+ mlId = alId;
+ mpInit = apInit;
+ mpPlayer = mpInit->mpPlayer;
+ mpEnemy = apEnemy;
+ mpMover = mpEnemy->GetMover();
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// RAY INTERSECT
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cLineOfSightRayCallback::Reset() {
+ mbIntersected = false;
+
+ if (gpInit->mpPlayer->GetState() == ePlayerState_Grab)
+ mpGrabBody = gpInit->mpPlayer->GetPushBody();
+ else
+ mpGrabBody = NULL;
+}
+
+//-----------------------------------------------------------------------
+
+bool cLineOfSightRayCallback::Intersected() {
+ return mbIntersected;
+}
+
+//-----------------------------------------------------------------------
+
+static bool BodyIsTransperant(iPhysicsBody *apBody) {
+ iGameEntity *pEntity = (iGameEntity *)apBody->GetUserData();
+ if (pEntity && pEntity->GetMeshEntity()) {
+ cMeshEntity *pMeshEntity = pEntity->GetMeshEntity();
+
+ bool bFoundSolid = false;
+ for (int i = 0; i < pMeshEntity->GetSubMeshEntityNum(); ++i) {
+ iMaterial *pMaterial = pMeshEntity->GetSubMeshEntity(i)->GetMaterial();
+ if (pMaterial &&
+ (pMaterial->IsTransperant() == false && pMaterial->HasAlpha() == false)) {
+ bFoundSolid = true;
+ break;
+ }
+ }
+ if (bFoundSolid == false)
+ return true;
+ }
+
+ return false;
+}
+
+bool cLineOfSightRayCallback::OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
+ if (pBody->GetCollide() == false)
+ return true;
+ if (pBody->IsCharacter())
+ return true;
+ if (mpGrabBody == pBody)
+ return true;
+
+ if (BodyIsTransperant(pBody))
+ return true;
+
+ mbIntersected = true;
+ return false;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// GROUND FINDER
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+bool cEnemyFindGround::GetGround(const cVector3f &avStartPos, const cVector3f &avDir,
+ cVector3f *apDestPosition, cVector3f *apDestNormal,
+ float afMaxDistance) {
+ mbIntersected = false;
+ mfMinDist = afMaxDistance;
+ mfMaxDistance = afMaxDistance;
+
+ iPhysicsWorld *pPhysicsWorld = gpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+
+ pPhysicsWorld->CastRay(this, avStartPos, avStartPos + avDir * mfMaxDistance, true, true, true);
+
+ if (mbIntersected) {
+ if (apDestPosition)
+ *apDestPosition = mvPos;
+ if (apDestNormal)
+ *apDestNormal = mvNormal;
+ return true;
+ }
+
+ return false;
+}
+
+bool cEnemyFindGround::OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
+ if (apParams->mfT < 0)
+ return true;
+ if (pBody->GetCollideCharacter() == false || pBody->IsCharacter())
+ return true;
+
+ if (mbIntersected == false || mfMinDist > apParams->mfDist) {
+ mbIntersected = true;
+ mfMinDist = apParams->mfDist;
+ mvPos = apParams->mvPoint;
+ mvNormal = apParams->mvNormal;
+ }
+
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// DOOR CHECKER
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+bool cEnemyCheckForDoor::CheckDoor(const cVector3f &avStart, const cVector3f &avEnd) {
+ mbIntersected = false;
+
+ iPhysicsWorld *pPhysicsWorld = gpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+
+ pPhysicsWorld->CastRay(this, avStart, avEnd, false, false, false);
+
+ return mbIntersected;
+}
+
+static bool BodyCanBeBroken(iPhysicsBody *pBody) {
+ if (pBody->GetUserData() == NULL)
+ return false;
+
+ iGameEntity *pEntity = (iGameEntity *)pBody->GetUserData();
+ if (pEntity->GetType() == eGameEntityType_SwingDoor) {
+ return true;
+ }
+ if (pEntity->GetType() == eGameEntityType_Object) {
+ cGameObject *pObject = static_cast<cGameObject *>(pEntity);
+ if (pObject->IsBreakable())
+ return true;
+ }
+ return false;
+}
+
+bool cEnemyCheckForDoor::BeforeIntersect(iPhysicsBody *pBody) {
+ if (BodyCanBeBroken(pBody))
+ return true;
+
+ return false;
+}
+
+bool cEnemyCheckForDoor::OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
+ if (apParams->mfT < 0 || apParams->mfT > 1)
+ return true;
+
+ if (BodyCanBeBroken(pBody)) {
+ mbIntersected = true;
+ return false;
+ }
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+iGameEnemy::iGameEnemy(cInit *apInit, const tString &asName, TiXmlElement *apGameElem) : iGameEntity(apInit, asName) {
+ mType = eGameEntityType_Enemy;
+
+ mTriggerTypes = eGameTriggerType_Sound;
+
+ mpMover = hplNew(cCharacterMove, (mpInit));
+
+ mlCurrentState = -1;
+
+ mbHasBeenActivated = false;
+
+ mbSetFeetAtGroundOnStart = true;
+ mbAttachMeshToBody = true;
+ mbRemoveAttackerOnDisable = true;
+
+ // States
+ mvStates.resize(100);
+ for (size_t i = 0; i < mvStates.size(); ++i)
+ mvStates[i] = NULL;
+
+ // Player find init
+ mvLastPlayerPos = cVector3f(0, 0, 0);
+ mbCanSeePlayer = false;
+ mfCanSeePlayerCount = 0;
+ mlPlayerInLOSCount = 0;
+ mlMaxPlayerInLOSCount = 3;
+
+ mfCheckForPlayerRate = 0.55f;
+ mfCheckForPlayerCount = cMath::RandRectf(0, mfCheckForPlayerRate);
+
+ mfDamageSoundTimer = 0;
+
+ msOnDeathCallback = "";
+ msOnAttackCallback = "";
+
+ m_mtxStartPose = cMatrixf::Identity;
+ m_mtxGoalPose = cMatrixf::Identity;
+ mfPoseCount = 0;
+
+ // TODO: Should not be here
+ mpAStarAir = NULL;
+ mpAStarGround = NULL;
+ mpNodeContainerAir = NULL;
+ mpNodeContainerGround = NULL;
+
+ // Patroling
+ mlCurrentPatrolNode = 0;
+ mfWaitTime = 0;
+ mfWaitTimeCount = 0;
+
+ mfDoorBreakCount = 0;
+
+ // Default body settings
+ mfDisappearTime = 0;
+ mbDisappearActive = false;
+ mbHasDisappeared = false;
+
+ msCloseMusic = "";
+ mlCloseMusicPrio = 0;
+
+ msAttackMusic = "";
+ mlAttackMusicPrio = 0;
+
+ mbShowDebug = false;
+
+ msGroundNodeType = "ground";
+
+ mvBodySize = cVector3f(0.5f, 1.4f, 0.5f);
+ mfBodyMass = 10;
+
+ mfMaxForwardSpeed = 1.0f;
+ mfMaxBackwardSpeed = 1.0f;
+ mfAcceleration = 1;
+ mfDeacceleration = 1;
+
+ mfMaxTurnSpeed = 8.5f;
+ mfAngleDistTurnMul = 2.3f;
+
+ mfMinBreakAngle = cMath::ToRad(16);
+ mfBreakAngleMul = 1.5f;
+
+ mfSpeedMoveAnimMul = 4.7f;
+ mfTurnSpeedMoveAnimMul = 4.0f;
+
+ mfMaxPushMass = 10.0f;
+ mfPushForce = 19.0f;
+
+ mfMaxSeeDist = 10.0f;
+
+ mfMinAttackDist = 1.6f;
+
+ mfStoppedToWalkSpeed = 0.05f;
+ mfWalkToStoppedSpeed = 0.02f;
+ mfWalkToRunSpeed = 1.2f;
+ mfRunToWalkSpeed = 1.0f;
+ mfMoveAnimSpeedMul = 1.0f;
+ msBackwardAnim = "Backward";
+ msStoppedAnim = "Idle";
+ msWalkAnim = "Walk";
+ msRunAnim = "Run";
+
+ m_mtxModelOffset = cMatrixf::Identity;
+ mvModelOffsetAngles = 0;
+
+ mfFOV = cMath::ToRad(90.0f);
+ mfFOVXMul = 0.7f;
+
+ // trigger init
+ mfTriggerUpdateCount = 0;
+ mfTriggerUpdateRate = 1.0f / 60.0f;
+
+ mfSkipSoundTriggerCount = 0;
+
+ mpCurrentAnimation = NULL;
+
+ mbAnimationIsSpeedDependant = false;
+ mfAnimationSpeedMul = 1.0f;
+
+ msHitPS = "";
+
+ mbOverideMoveState = false;
+ mMoveState = eEnemyMoveState_LastEnum;
+
+ mbLoading = false;
+
+ mbIsAttracted = false;
+
+ mbUsesTriggers = true;
+
+ mfCalcPlayerHiddenPosCount = 0;
+}
+
+//-----------------------------------------------------------------------
+
+iGameEnemy::~iGameEnemy(void) {
+ hplDelete(mpMover);
+
+ for (size_t i = 0; i < mvStates.size(); ++i) {
+ if (mvStates[i])
+ hplDelete(mvStates[i]);
+ }
+
+ mvStates.clear();
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+void iGameEnemy::LoadBaseProperties(TiXmlElement *apGameElem) {
+ ////////////////////////////////////////
+ // Load settings from XML
+ mbShowDebug = cString::ToBool(apGameElem->Attribute("ShowDebug"), false);
+
+ mbDisappear = cString::ToBool(apGameElem->Attribute("Disappear"), false);
+ mfDisappearMinTime = cString::ToFloat(apGameElem->Attribute("DisappearMinTime"), 0);
+ mfDisappearMaxTime = cString::ToFloat(apGameElem->Attribute("DisappearMaxTime"), 0);
+ mfDisappearMinDistance = cString::ToFloat(apGameElem->Attribute("DisappearMinDistance"), 0);
+ msDisappearPS = cString::ToString(apGameElem->Attribute("DisappearPS"), "");
+ msDisappearSound = cString::ToString(apGameElem->Attribute("DisappearSound"), "");
+ mbDisappearFreezesRagdoll = cString::ToBool(apGameElem->Attribute("DisappearFreezesRagdoll"), false);
+
+ msCloseMusic = cString::ToString(apGameElem->Attribute("CloseMusic"), "");
+ mlCloseMusicPrio = cString::ToInt(apGameElem->Attribute("CloseMusicPrio"), 0);
+ mfCloseMusicStartDist = cString::ToFloat(apGameElem->Attribute("CloseMusicStartDist"), 0);
+ mfCloseMusicStopDist = cString::ToFloat(apGameElem->Attribute("CloseMusicStopDist"), 0);
+
+ msAttackMusic = cString::ToString(apGameElem->Attribute("AttackMusic"), "");
+ mlAttackMusicPrio = cString::ToInt(apGameElem->Attribute("AttackMusicPrio"), 0);
+
+ mfFOV = cMath::ToRad(90);
+
+ mfMaxPushMass = cString::ToFloat(apGameElem->Attribute("MaxPushMass"), 0);
+ mfPushForce = cString::ToFloat(apGameElem->Attribute("PushForce"), 0);
+
+ mfMaxHealth = cString::ToFloat(apGameElem->Attribute("MaxHealth"), 0);
+ mfHealth = mfMaxHealth;
+
+ mfMaxSeeDist = cString::ToFloat(apGameElem->Attribute("MaxSeeDist"), 0);
+
+ mfMaxForwardSpeed = cString::ToFloat(apGameElem->Attribute("MaxForwardSpeed"), 0);
+ mfAcceleration = cString::ToFloat(apGameElem->Attribute("Acceleration"), 0);
+ mfDeacceleration = cString::ToFloat(apGameElem->Attribute("Deacceleration"), 0);
+
+ mfMaxTurnSpeed = cString::ToFloat(apGameElem->Attribute("MaxTurnSpeed"), mfMaxTurnSpeed);
+ mfAngleDistTurnMul = cString::ToFloat(apGameElem->Attribute("AngleDistTurnMul"), mfAngleDistTurnMul);
+
+ mfMinBreakAngle = cMath::ToRad(cString::ToFloat(apGameElem->Attribute("MinBreakAngle"), mfMinBreakAngle));
+ mfBreakAngleMul = cString::ToFloat(apGameElem->Attribute("BreakAngleMul"), mfBreakAngleMul);
+
+ mfStoppedToWalkSpeed = cString::ToFloat(apGameElem->Attribute("StoppedToWalkSpeed"), 0);
+ mfWalkToStoppedSpeed = cString::ToFloat(apGameElem->Attribute("WalkToStoppedSpeed"), 0);
+ mfWalkToRunSpeed = cString::ToFloat(apGameElem->Attribute("WalkToRunSpeed"), 0);
+ mfRunToWalkSpeed = cString::ToFloat(apGameElem->Attribute("RunToWalkSpeed"), 0);
+ mfMoveAnimSpeedMul = cString::ToFloat(apGameElem->Attribute("MoveAnimSpeedMul"), 0);
+
+ mvBodySize = cString::ToVector3f(apGameElem->Attribute("BodySize"), 0);
+ mfBodyMass = cString::ToFloat(apGameElem->Attribute("BodyMass"), 10);
+
+ cVector3f vRot = cString::ToVector3f(apGameElem->Attribute("ModelOffset_Rot"), 0);
+ vRot = cVector3f(cMath::ToRad(vRot.x), cMath::ToRad(vRot.y), cMath::ToRad(vRot.z));
+ cVector3f vPos = cString::ToVector3f(apGameElem->Attribute("ModelOffset_Pos"), 0);
+
+ mvModelOffsetAngles = vRot;
+ m_mtxModelOffset = cMath::MatrixRotate(vRot, eEulerRotationOrder_XYZ);
+ m_mtxModelOffset.SetTranslation(vPos);
+
+ mbAlignToGroundNormal = cString::ToBool(apGameElem->Attribute("AlignToGroundNormal"), false);
+
+ msHitPS = cString::ToString(apGameElem->Attribute("HitPS"), "");
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::OnPlayerInteract() {
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::OnPlayerPick() {
+ // SKIp this for now since this means that enemies in ragdoll can take damage.
+ /*mpInit->mpPlayer->mbPickAtPoint = false;
+ mpInit->mpPlayer->mbRotateWithPlayer = true;
+ mpInit->mpPlayer->mbUseNormalMass = false;
+ mpInit->mpPlayer->mfGrabMassMul = (float)mvBodies.size();
+
+ mpInit->mpPlayer->SetPushBody(mpInit->mpPlayer->GetPickedBody());
+ mpInit->mpPlayer->ChangeState(ePlayerState_Grab);*/
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::Setup(cWorld3D *apWorld) {
+ /////////////////////////////////////////////
+ // Create body
+ iCharacterBody *pBody = apWorld->GetPhysicsWorld()->CreateCharacterBody("Enemy",
+ mvBodySize);
+
+ pBody->SetEntityOffset(m_mtxModelOffset);
+ pBody->SetMass(mfBodyMass);
+ pBody->SetMaxStepSize(0.35f);
+ pBody->SetStepClimbSpeed(3.35f);
+ pBody->SetCustomGravity(cVector3f(0, -13.0f, 0));
+ pBody->SetEntitySmoothPosNum(10);
+ pBody->SetGroundFriction(10);
+
+ mpMover->SetCharBody(pBody);
+
+ SetCharBody(pBody);
+
+ SetupBody();
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::OnWorldLoad() {
+ //////////////////////////////////
+ // Setup EnemyMove
+ cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
+
+ mpNodeContainerGround = pWorld->CreateAINodeContainer(msEnemyType, msGroundNodeType,
+ mvBodySize,
+ false, 2, 6, 5.0f, 0.41f);
+
+ if (mpNodeContainerGround)
+ mpAStarGround = pWorld->CreateAStarHandler(mpNodeContainerGround);
+ else
+ mpAStarGround = NULL;
+
+ //////////////////////////////////
+ // Set up the body
+ if (mbAttachMeshToBody && mfHealth > 0)
+ mpMover->GetCharBody()->SetEntity(mpMeshEntity);
+
+ mpMover->GetCharBody()->GetBody()->SetUserData(this);
+
+ mpMover->GetCharBody()->Update(0.001f);
+
+ mpMover->SetAStar(mpAStarGround);
+ mpMover->SetNodeContainer(mpNodeContainerGround);
+
+ //////////////////////////////////
+ // Stop all animations
+ mpMeshEntity->Stop();
+ mpMeshEntity->UpdateLogic(0.005f);
+
+ //////////////////////////////////
+ // Preload data
+
+ // Sounds
+ for (size_t i = 0; i < mvPreloadSounds.size(); ++i) {
+ mpInit->PreloadSoundEntityData(mvPreloadSounds[i]);
+ }
+
+ // Particle system
+ mpInit->PreloadParticleSystem(msHitPS);
+
+ //////////////////////////////////
+ // Implemented load
+ OnLoad();
+
+ //////////////////////////////////
+ // Check if dead
+ mbLoading = true;
+ if (mfHealth <= 0) {
+ ChangeState(STATE_DEAD);
+ mpMeshEntity->SetSkeletonPhysicsCanSleep(false);
+ mpMeshEntity->UpdateLogic(1.0f / 60.0f);
+ mpMeshEntity->SetSkeletonPhysicsCanSleep(true);
+ }
+ mbLoading = false;
+
+ mpMeshEntity->ResetGraphicsUpdated();
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::OnPostLoadScripts() {
+ // Randomize start pos
+ if (IsActive() && mvPatrolNodes.size() > 0 && mbHasBeenActivated) {
+ int lStartNode = cMath::RandRectl(0, (int)mvPatrolNodes.size() - 1);
+ tString sNode = mvPatrolNodes[lStartNode].msNodeName;
+ cAINode *pNode = mpMover->GetNodeContainer()->GetNodeFromName(sNode);
+
+ mpMover->GetCharBody()->SetFeetPosition(pNode->GetPosition());
+ } else {
+ mbHasBeenActivated = true;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::OnWorldExit() {
+ if (mfHealth <= 0) {
+ SetActive(false);
+ }
+
+ mpInit->mpMusicHandler->RemoveAttacker(this);
+}
+
+//-----------------------------------------------------------------------
+
+float gfAngle = 0;
+float gfCurrentViewDist = 0;
+float gfCurrentMaxViewDist = 0;
+
+void iGameEnemy::OnDraw() {
+ return;
+ if (mbActive == false)
+ return;
+ if (mbCanSeePlayer) {
+ mpInit->mpDefaultFont->Draw(cVector3f(5, 15, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
+ _W("Player is seen!"));
+ } else {
+ mpInit->mpDefaultFont->Draw(cVector3f(5, 15, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
+ _W("Can NOT see player..."));
+ }
+ // mpInit->mpDefaultFont->Draw(cVector3f(5,29,100),14,cColor(1,1,1,1),eFontAlign_Left,
+ // "State: %s",mStateMachine.CurrentState()->GetName().c_str());
+
+ tWString sStateName = _W("NONE");
+ if (mlCurrentState >= 0)
+ sStateName = cString::To16Char(gvStateName[mlCurrentState]);
+ mpInit->mpDefaultFont->Draw(cVector3f(5, 48, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
+ _W("Health: %f State: %ls Moving: %d Stuck: %f MaxViewDist: %f"), mfHealth,
+ sStateName.c_str(),
+ mpMover->IsMoving(),
+ mpMover->GetStuckCounter(),
+ gfCurrentMaxViewDist);
+ mpInit->mpDefaultFont->Draw(cVector3f(5, 64, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
+ _W("Speed: %f"), mpMover->GetCharBody()->GetMoveSpeed(eCharDir_Forward));
+
+ mpMover->OnDraw(mpInit);
+
+ mvStates[mlCurrentState]->OnDraw();
+
+ /*mpInit->mpDefaultFont->Draw(cVector3f(5,15,100),14,cColor(1,1,1,1),eFontAlign_Left,
+ "Active: %d",mbActive);
+ mpInit->mpDefaultFont->Draw(cVector3f(5,30,100),14,cColor(1,1,1,1),eFontAlign_Left,
+ "Yaw: %f",cMath::ToDeg(mpMover->GetCharBody()->GetYaw()));
+ mpInit->mpDefaultFont->Draw(cVector3f(5,45,100),14,cColor(1,1,1,1),eFontAlign_Left,
+ "Pos: %s",mpMover->GetCharBody()->GetPosition().ToString().c_str());*/
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::OnPostSceneDraw() {
+ if (IsActive() == false)
+ return;
+ if (mbShowDebug == false)
+ return;
+
+ iLowLevelGraphics *pLowLevelGfx = mpInit->mpGame->GetGraphics()->GetLowLevel();
+ mpMover->OnPostSceneDraw(pLowLevelGfx);
+
+ ExtraPostSceneDraw();
+
+ /////////////////////////////////////
+ // Begin debug pos
+
+ /*pLowLevelGfx->SetDepthTestActive(false);
+ pLowLevelGfx->SetDepthWriteActive(false);
+
+ cVector3f vNormal(0,1,0);
+ cVector3f vUp(0,1,0);
+ cVector3f vStartPos = mpMover->GetCharBody()->GetFeetPosition() + cVector3f(0,0.05f,0);
+ cVector3f vPosition = vStartPos;
+
+ mFindGround.GetGround(vStartPos,cVector3f(0,-1,0),NULL,&vNormal);
+
+ vNormal.Normalise();
+ float fAngle = cMath::Vector3Angle(vUp,vNormal);
+ cVector3f vRotateAxis = cMath::Vector3Cross(vUp,vNormal);
+ //cVector3f vRotateAxis2 = cMath::Vector3Cross(vUp,vRotateAxis);
+
+ vRotateAxis.Normalise();
+ cQuaternion qRotation = cQuaternion(fAngle, vRotateAxis);
+ cMatrixf mtxPoseRotation = cMath::MatrixQuaternion(qRotation);
+
+ cMatrixf mtxFinalOffset = cMath::MatrixMul(mtxPoseRotation,m_mtxModelOffset);
+
+ cVector3f vCenter = mpMover->GetCharBody()->GetPosition();
+
+ cVector3f vRot = cMath::MatrixMul(mtxPoseRotation,cVector3f(0,1,0));
+
+ pLowLevelGfx->DrawLine(vStartPos, vStartPos + vNormal,cColor(1,0,1,1));
+ pLowLevelGfx->DrawLine(vCenter, vCenter + vRotateAxis,cColor(1,0.5,0.5,1));
+// pLowLevelGfx->DrawLine(vCenter, vCenter + vRotateAxis2,cColor(1,0.5,0.5,1));
+ pLowLevelGfx->DrawLine(vCenter, vCenter + vRot,cColor(0,1,1,1));
+
+ gfAngle =cMath::ToDeg(fAngle);
+
+ pLowLevelGfx->SetDepthTestActive(true);
+ pLowLevelGfx->SetDepthWriteActive(true);*/
+
+ // End debug pose
+ //////////////////////////////
+
+ /*pLowLevelGfx->SetDepthTestActive(false);
+ pLowLevelGfx->SetDepthWriteActive(false);
+
+ pLowLevelGfx->DrawSphere(mpMover->GetCharBody()->GetPosition(),0.1f,cColor(1,0.5,0));
+ pLowLevelGfx->DrawSphere(GetMeshEntity()->GetWorldPosition(),0.1f,cColor(0,0.5,1));
+
+ pLowLevelGfx->SetDepthTestActive(true);
+ pLowLevelGfx->SetDepthWriteActive(true);*/
+
+ /*for(size_t i=0; i< mvRayStartPoses.size(); ++i)
+ {
+ pLowLevelGfx->DrawLine(mvRayStartPoses[i], mvRayEndPoses[i],cColor(1,0,1,1));
+ pLowLevelGfx->DrawSphere(mvRayStartPoses[i],0.2f,cColor(0,1,1,1));
+ pLowLevelGfx->DrawSphere(mvRayEndPoses[i],0.2f,cColor(0,1,1,1));
+ }*/
+
+ // mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld()->RenderDebugGeometry(pLowLevelGfx,cColor(1,1));
+
+ mvStates[mlCurrentState]->OnPostSceneDraw();
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::Update(float afTimeStep) {
+ if (mbActive == false)
+ return;
+
+ START_TIMING_EX(GetName().c_str(), enemy);
+
+ if (mpMeshEntity->GetSkeletonPhysicsActive() && mpCharBody->IsActive() == false &&
+ mfHealth <= 0) {
+ mbHasInteraction = true;
+ } else {
+ mbHasInteraction = false;
+ }
+
+ START_TIMING_TAB(pose);
+ UpdateEnemyPose(afTimeStep);
+ STOP_TIMING_TAB(pose);
+
+ START_TIMING_TAB(checkforplayer);
+ UpdateCheckForPlayer(afTimeStep);
+ STOP_TIMING_TAB(checkforplayer);
+
+ START_TIMING_TAB(MoverUpdate);
+ mpMover->Update(afTimeStep);
+ STOP_TIMING_TAB(MoverUpdate);
+
+ START_TIMING_TAB(Animations);
+ UpdateAnimations(afTimeStep);
+ STOP_TIMING_TAB(Animations);
+
+ OnUpdate(afTimeStep);
+
+#ifdef UPDATE_TIMING_ENABLED
+ LogUpdate("\tState: %d\n", mlCurrentState);
+#endif
+ START_TIMING_TAB(State);
+ mvStates[mlCurrentState]->OnUpdate(afTimeStep);
+ STOP_TIMING_TAB(State);
+
+ if (mfDamageSoundTimer > 0)
+ mfDamageSoundTimer -= afTimeStep;
+
+ if (mfSkipSoundTriggerCount > 0)
+ mfSkipSoundTriggerCount -= afTimeStep;
+
+ if (mfDoorBreakCount > 0)
+ mfDoorBreakCount -= afTimeStep;
+
+ //////////////////////////////////////////////
+ // Disappear
+ if (mbDisappear && GetHealth() <= 0 && mbHasDisappeared == false) {
+ if (mbDisappearActive) {
+ if (mfDisappearTime <= 0) {
+ mbHasDisappeared = true;
+
+ cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
+ cVector3f vPostion = mpMeshEntity->GetBoundingVolume()->GetWorldCenter();
+
+ if (msDisappearSound != "") {
+ cSoundEntity *pSound = pWorld->CreateSoundEntity("Disappear", msDisappearSound, true);
+ if (pSound)
+ pSound->SetPosition(vPostion);
+ }
+ if (msDisappearPS != "") {
+ pWorld->CreateParticleSystem("Disappear", msDisappearPS, cVector3f(1, 1, 1),
+ cMath::MatrixTranslate(vPostion));
+ }
+
+ if (mbDisappearFreezesRagdoll) {
+ mpMeshEntity->ResetGraphicsUpdated();
+
+ for (int i = 0; i < mpMeshEntity->GetBoneStateNum(); ++i) {
+ cBoneState *pBone = mpMeshEntity->GetBoneState(i);
+ iPhysicsBody *pBody = pBone->GetBody();
+
+ if (pBody) {
+ pBody->SetMass(0);
+ }
+ }
+ } else {
+ SetActive(false);
+ }
+ } else {
+ mfDisappearTime -= afTimeStep;
+ }
+ } else {
+ mbDisappearActive = true;
+ mfDisappearTime = cMath::RandRectf(mfDisappearMinTime, mfDisappearMaxTime);
+ }
+ }
+
+ //////////////////////////////////////////////
+ // Outside of map
+ iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+ cBoundingVolume worldBV;
+ worldBV.SetLocalMinMax(pPhysicsWorld->GetWorldSizeMin(), pPhysicsWorld->GetWorldSizeMax());
+
+ if (cMath::CheckCollisionBV(worldBV, *mpMover->GetCharBody()->GetBody()->GetBV()) == false) {
+ SetHealth(0);
+ SetActive(false);
+ }
+
+ STOP_TIMING(enemy);
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::AddState(iGameEnemyState *apState) {
+ mvStates[apState->GetId()] = apState;
+}
+
+void iGameEnemy::ChangeState(int alId) {
+ if (mlCurrentState == alId)
+ return;
+
+ /*char sStr[512];
+ tString sStateName1 = "NONE";
+ if(mlCurrentState >=0) sStateName1 = gvStateName[mlCurrentState];
+ tString sStateName2 = "NONE";
+ if(mlCurrentState >=0) sStateName2 = gvStateName[alId];
+
+ sprintf(sStr,"%s State %s -> %s",msName.c_str(),sStateName1.c_str(),sStateName2.c_str());
+ //mpInit->mpEffectHandler->GetSubTitle()->Add(cString::To16Char(sStr),1.2f,false);
+ Log("%s\n",sStr);*/
+
+ // Log("Leave old...");
+ if (mlCurrentState >= 0)
+ mvStates[mlCurrentState]->OnLeaveState(mvStates[alId]);
+
+ int lPrevState = mlCurrentState;
+ iGameEnemyState *pPrevState = NULL;
+ if (mlCurrentState >= 0)
+ pPrevState = mvStates[mlCurrentState];
+
+ mlCurrentState = alId;
+ mbCanSeePlayer = false;
+
+ // Log("enter newer\n");
+ mvStates[mlCurrentState]->SetPreviousState(lPrevState);
+ mvStates[mlCurrentState]->OnEnterState(pPrevState);
+}
+
+iGameEnemyState *iGameEnemy::GetState(int alId) {
+ return mvStates[mlCurrentState];
+}
+
+//-----------------------------------------------------------------------
+
+bool iGameEnemy::HandleTrigger(cGameTrigger *apTrigger) {
+ switch (apTrigger->GetType()) {
+ case eGameTriggerType_Sound:
+ return HandleSoundTrigger(apTrigger);
+ }
+
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+bool iGameEnemy::HandleSoundTrigger(cGameTrigger *apTrigger) {
+ if (mfSkipSoundTriggerCount > 0)
+ return false;
+
+ cGameTrigger_Sound *pSoundTrigger = static_cast<cGameTrigger_Sound *>(apTrigger);
+
+ //////////////////////////////////////
+ // Calculate volume of sound
+ float fDistance = cMath::Vector3Dist(GetPosition(), pSoundTrigger->GetWorldPosition());
+ float fMin = pSoundTrigger->mpSound->GetMinDistance();
+ float fMax = pSoundTrigger->mpSound->GetMaxDistance();
+
+ float fHearVolume = 1.0f - cMath::Clamp((fDistance - fMin) / (fMax - fMin), 0.0f, 1.0f);
+
+ fHearVolume *= pSoundTrigger->mpSound->GetVolume();
+
+ // If not audible return
+ if (fHearVolume <= 0)
+ return false;
+
+ return mvStates[mlCurrentState]->OnHearNoise(pSoundTrigger->GetWorldPosition(), fHearVolume);
+
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+cVector3f iGameEnemy::GetPosition() {
+ return mpMover->GetCharBody()->GetPosition();
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::PlayAnim(const tString &asName, bool abLoop, float afFadeTime,
+ bool abDependsOnSpeed, float afSpeedMul,
+ bool abSyncWithPrevFrame,
+ bool abOverideMoveState) {
+ // Check if the animation is already playing.
+ if (mpCurrentAnimation != NULL &&
+ mpCurrentAnimation->GetName() == asName &&
+ mpCurrentAnimation->IsActive() &&
+ mpCurrentAnimation->IsOver() == false) {
+ return;
+ }
+
+ cAnimationState *pNewAnim = mpMeshEntity->GetAnimationStateFromName(asName);
+ if (pNewAnim == NULL) {
+ // Warning("Animation '%s' does not exist!\n",asName.c_str());
+ return;
+ }
+
+ pNewAnim->SetActive(true);
+ if (mpCurrentAnimation && mpCurrentAnimation != pNewAnim) {
+ mpCurrentAnimation->FadeOut(afFadeTime);
+
+ if (pNewAnim->IsFading() == false)
+ pNewAnim->SetWeight(0);
+ pNewAnim->FadeIn(afFadeTime);
+ } else {
+ pNewAnim->SetWeight(1.0f);
+ }
+ pNewAnim->SetLoop(abLoop);
+
+ /////////////////////////////////////////
+ // Check if this animation should start at the same place as the previous
+ if (abSyncWithPrevFrame && mpCurrentAnimation) {
+ pNewAnim->SetRelativeTimePosition(mpCurrentAnimation->GetRelativeTimePosition());
+ } else {
+ pNewAnim->SetTimePosition(0);
+ }
+
+ mpCurrentAnimation = pNewAnim;
+
+ mbAnimationIsSpeedDependant = abDependsOnSpeed;
+ mfAnimationSpeedMul = afSpeedMul;
+
+ mbOverideMoveState = abOverideMoveState;
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::UseMoveStateAnimations() {
+ if (mbOverideMoveState) {
+ mbOverideMoveState = false;
+ mMoveState = eEnemyMoveState_LastEnum;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::PlaySound(const tString &asName) {
+ if (asName == "")
+ return;
+
+ cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
+
+ cSoundEntity *pSound = pWorld->CreateSoundEntity("Enemy", asName, true);
+ if (pSound) {
+ pSound->SetPosition(mpMover->GetCharBody()->GetPosition());
+ // TODO: Attach instead...
+ } else {
+ Warning("Couldn't play sound '%s'\n", asName.c_str());
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::AddPatrolNode(const tString &asNode, float afTime, const tString &asAnimation) {
+ mvPatrolNodes.push_back(cEnemyPatrolNode(asNode, afTime, asAnimation));
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::ClearPatrolNodes() {
+ mvPatrolNodes.clear();
+ mlCurrentPatrolNode = 0;
+
+ if (mbActive && mfHealth > 0)
+ ChangeState(STATE_IDLE);
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::OnDeath(float afX) {
+ // PlaySound("temp_roach_death");
+
+ if (msOnDeathCallback != "") {
+ tString sCommand = msOnDeathCallback + "(\"" + msName + "\")";
+ msOnDeathCallback = "";
+
+ mpInit->RunScriptCommand(sCommand);
+ }
+
+ mvStates[mlCurrentState]->OnDeath(afX);
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::OnDamage(float afX) {
+ if (mfDamageSoundTimer <= 0) {
+ // PlaySound("temp_roach_damage");
+
+ mfDamageSoundTimer = 0.8f;
+ }
+
+ mvStates[mlCurrentState]->OnTakeHit(afX);
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::OnFlashlight(const cVector3f &avPos) {
+ mvStates[mlCurrentState]->OnFlashlight(avPos);
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::OnSetActive(bool abX) {
+ // This will do for now:
+ for (size_t i = 0; i < mvBodies.size(); ++i) {
+ mvBodies[i]->SetActive(false);
+ }
+
+ // Make sure it is on the ground
+ if (mfHealth > 0 && mbSetFeetAtGroundOnStart) {
+ cVector3f vGroundPosition = mpMover->GetCharBody()->GetFeetPosition();
+ mFindGround.GetGround(mpMover->GetCharBody()->GetPosition(), cVector3f(0, -1, 0),
+ &vGroundPosition, NULL);
+ mpMover->GetCharBody()->SetFeetPosition(vGroundPosition);
+ }
+
+ if (mbActive == false) {
+ if (mbRemoveAttackerOnDisable)
+ mpInit->mpMusicHandler->RemoveAttacker(this);
+
+ if (mfHealth > 0)
+ ChangeState(STATE_IDLE);
+ } else {
+ mbHasBeenActivated = true;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+bool iGameEnemy::CanSeePlayer() {
+ if (mpInit->mpMapHandler->IsPreUpdating() || mpInit->mpPlayer->IsDead())
+ return false;
+
+ return mbCanSeePlayer;
+}
+
+//-----------------------------------------------------------------------
+
+bool iGameEnemy::CheckForDoor() {
+ iCharacterBody *pBody = mpMover->GetCharBody();
+ float fRadius = pBody->GetSize().x / 2.0f - 0.1f;
+ cVector3f vStart = pBody->GetPosition() + pBody->GetForward() * fRadius;
+ cVector3f vEnd = vStart + pBody->GetForward() * 0.4f;
+
+ bool bRet = mDoorCheck.CheckDoor(vStart, vEnd);
+ Log("CheckDoor: %d\n", bRet);
+
+ return bRet;
+}
+
+bool iGameEnemy::CheckForTeamMate(float afMaxDist, bool abCheckIfFighting) {
+ cVector3f vPosition = mpMover->GetCharBody()->GetFeetPosition();
+ tGameEnemyIterator it = mpInit->mpMapHandler->GetGameEnemyIterator();
+ while (it.HasNext()) {
+ iGameEnemy *pEnemy = it.Next();
+ if (GetEnemyType() != pEnemy->GetEnemyType())
+ continue;
+ if (pEnemy == this || pEnemy->IsActive() == false || pEnemy->GetHealth() <= 0)
+ continue;
+
+ if (abCheckIfFighting && pEnemy->IsFighting() == false)
+ continue;
+
+ float fDist = cMath::Vector3Dist(pEnemy->GetMover()->GetCharBody()->GetPosition(),
+ vPosition);
+
+ if (fDist <= afMaxDist) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PROTECTED METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::UpdateEnemyPose(float afTimeStep) {
+ if (mbAlignToGroundNormal == false)
+ return;
+
+ if (mfPoseCount == 0) {
+ m_mtxStartPose = m_mtxGoalPose;
+
+ cVector3f vNormal(0, 1, 0);
+
+ cVector3f vStartPos = mpMover->GetCharBody()->GetFeetPosition() + cVector3f(0, 0.05f, 0);
+ cVector3f vPosition = vStartPos;
+
+ mFindGround.GetGround(vStartPos, cVector3f(0, -1, 0), &vPosition, &vNormal);
+
+ cVector3f vUp(0, 1, 0);
+
+ float fDist = vStartPos.y - vPosition.y;
+
+ vNormal.Normalise();
+ float fAngle = cMath::Vector3Angle(vUp, vNormal);
+
+ cVector3f vRotateAxis = cMath::Vector3Cross(vUp, vNormal);
+ // cVector3f vRotateAxis = cMath::Vector3Cross(vUp,mpMover->GetCharBody()->GetForward());
+
+ // cVector3f vRotateAxis2 = cMath::Vector3Cross(vUp,vRotateAxis);
+
+ vRotateAxis.Normalise();
+ cQuaternion qRotation = cQuaternion(fAngle, vRotateAxis);
+ cMatrixf mtxPoseRotation = cMath::MatrixQuaternion(qRotation);
+
+ // cVector3f vDelta = vPosition - mpMover->GetCharBody()->GetFeetPosition();
+
+ // mtxPoseRotation.SetTranslation(cVector3f(0,-fabs(vDelta.y),0));
+ // mtxPoseRotation.SetTranslation(vNormal * -fabs(vDelta.y));
+
+ if (vNormal != cVector3f(0, 1, 0)) {
+ mFindGround.GetGround(mpMover->GetCharBody()->GetPosition(), vNormal * -1.0f, &vPosition, NULL);
+ fDist = cMath::Vector3Dist(mpMover->GetCharBody()->GetPosition(), vPosition);
+
+ // So there is no warp to the ground.
+ float fLimit = mpMover->GetCharBody()->GetSize().y * 0.82f;
+ if (fDist > fLimit)
+ vNormal = cVector3f(0, 1, 0);
+ }
+
+ ///////////////////////////
+ // Get the offest
+ if (vNormal != cVector3f(0, 1, 0)) {
+ fDist -= mpMover->GetCharBody()->GetSize().y / 2.0f;
+
+ mtxPoseRotation.SetTranslation(vNormal * -fDist);
+ } else {
+ mtxPoseRotation.SetTranslation(0);
+ }
+
+ m_mtxGoalPose = mtxPoseRotation;
+ } else {
+ cMatrixf mtxPoseRotation = cMath::MatrixSlerp(mfPoseCount, m_mtxStartPose, m_mtxGoalPose, true);
+
+ mpMover->GetCharBody()->SetEntityPostOffset(mtxPoseRotation);
+ }
+
+ mfPoseCount += 6.5f * afTimeStep;
+ if (mfPoseCount > 1.0f)
+ mfPoseCount = 0;
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::UpdateCheckForPlayer(float afTimeStep) {
+
+ // Do not check for player at pre update.
+ if (mpInit->mpMapHandler->IsPreUpdating() ||
+ mpInit->mpPlayer->IsDead() ||
+ mbUsesTriggers == false ||
+ mfHealth <= 0) {
+ mbCanSeePlayer = false;
+ return;
+ }
+
+ /*if(mfCanSeePlayerCount>0)
+ {
+ mfCanSeePlayerCount -= afTimeStep;
+ if(mfCanSeePlayerCount<=0) mbCanSeePlayer = false;
+ }*/
+
+ if (mfCalcPlayerHiddenPosCount > 0)
+ mfCalcPlayerHiddenPosCount -= afTimeStep;
+
+ // Check if it is time to check for player.
+ if (mfCheckForPlayerCount < mfCheckForPlayerRate) {
+ mfCheckForPlayerCount += afTimeStep;
+ return;
+ }
+
+ mfCheckForPlayerCount = 0;
+
+ iCharacterBody *pPlayerBody = mpInit->mpPlayer->GetCharacterBody();
+
+ float fDist = cMath::Vector3Dist(mpMover->GetCharBody()->GetPosition(), pPlayerBody->GetPosition());
+ float fMinLength = mpMover->GetCharBody()->GetBody()->GetBV()->GetRadius() +
+ pPlayerBody->GetBody()->GetBV()->GetRadius();
+
+ // Lower some stuff if player is hidden
+ float fStartFOV = mfFOV;
+ float fStartMaxSeeDist = mfMaxSeeDist;
+ if (mbCanSeePlayer == false && fDist > 1.3f) // 1.3 = really close, remove all handicap.
+ {
+ if (mpInit->mDifficulty == eGameDifficulty_Easy) {
+ mfFOV *= 0.6f;
+ mfMaxSeeDist *= 0.6f;
+ }
+
+ if (mpInit->mpPlayer->GetHidden()->IsHidden()) {
+ mfFOV *= 0.36f;
+ mfMaxSeeDist *= 0.25f;
+ } else if (mpInit->mpPlayer->GetHidden()->InShadows()) {
+ if (mpInit->mpPlayer->GetMoveState() == ePlayerMoveState_Crouch) {
+ mfFOV *= 0.6f;
+ mfMaxSeeDist *= 0.65f;
+ } else {
+ mfFOV *= 0.8f;
+ mfMaxSeeDist *= 0.85f;
+ }
+ }
+ }
+
+ gfCurrentViewDist = fDist;
+ gfCurrentMaxViewDist = mfMaxSeeDist;
+
+ if ((fDist <= mfMaxSeeDist && LineOfSight(pPlayerBody->GetPosition(), pPlayerBody->GetSize())) ||
+ fDist <= fMinLength) {
+ // Increase LOS counter,
+ mlPlayerInLOSCount++;
+
+ // Player must have been in LOS mlMaxPlayerInLOSCount times before it is considered seen.
+ if (mlPlayerInLOSCount >= mlMaxPlayerInLOSCount) {
+ mlPlayerInLOSCount = mlMaxPlayerInLOSCount;
+
+ float fChance = 0;
+
+ if (fDist > mfMaxSeeDist)
+ fChance = 0;
+ else
+ fChance = 1 - (fDist / mfMaxSeeDist);
+
+ if (mbCanSeePlayer == false) {
+ mvStates[mlCurrentState]->OnSeePlayer(pPlayerBody->GetPosition(), fChance);
+ mpInit->mpPlayer->GetHidden()->UnHide();
+ }
+
+ mvLastPlayerPos = pPlayerBody->GetFeetPosition();
+
+ mbCanSeePlayer = true;
+ mfCanSeePlayerCount = 1.0f / 3.0f;
+ mfCalcPlayerHiddenPosCount = 1.5f;
+ }
+ } else {
+ // Reset LOS counter,
+ mlPlayerInLOSCount--;
+ if (mlPlayerInLOSCount < 0)
+ mlPlayerInLOSCount = 0;
+
+ // this is so that the enemy get a little better last pos
+ // and thus improving path finding.
+ if (mfCalcPlayerHiddenPosCount > 0) {
+ mvLastPlayerPos = pPlayerBody->GetFeetPosition();
+ }
+
+ mbCanSeePlayer = false;
+ }
+
+ mfFOV = fStartFOV;
+ mfMaxSeeDist = fStartMaxSeeDist;
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::UpdateAnimations(float afTimeStep) {
+ iCharacterBody *pBody = mpMover->GetCharBody();
+
+ float fMoveSpeed = pBody->GetMoveSpeed(eCharDir_Forward);
+
+ float fSpeed = pBody->GetVelocity(afTimeStep).Length();
+ if (fMoveSpeed < 0)
+ fSpeed = -fSpeed;
+
+ float fTurnSpeed = mpMover->GetTurnSpeed();
+
+ ////////////////////////////////
+ // Override animation
+ if (mbOverideMoveState && mpCurrentAnimation != NULL) {
+ if (mpCurrentAnimation->IsOver()) {
+ mvStates[mlCurrentState]->OnAnimationOver(mpCurrentAnimation->GetName());
+ }
+
+ if (mbAnimationIsSpeedDependant) {
+ if (std::abs(fSpeed) > 0.05f)
+ mpCurrentAnimation->SetSpeed(std::abs(fSpeed) * mfAnimationSpeedMul);
+ else
+ mpCurrentAnimation->SetSpeed(std::abs(fTurnSpeed) * mfAnimationSpeedMul * 2);
+ }
+ }
+ ////////////////////////////////
+ // Move state animation
+ else {
+ eEnemyMoveState prevMoveState = mMoveState;
+
+ switch (mMoveState) {
+ // Backward
+ case eEnemyMoveState_Backward:
+ if (fSpeed >= 0)
+ mMoveState = eEnemyMoveState_Stopped;
+
+ break;
+
+ // Stopped State
+ case eEnemyMoveState_Stopped:
+ if (fSpeed < -0.05f)
+ mMoveState = eEnemyMoveState_Backward;
+ else if (fSpeed >= mfStoppedToWalkSpeed)
+ mMoveState = eEnemyMoveState_Walking;
+ else if (std::abs(fTurnSpeed) > 0.07f)
+ mMoveState = eEnemyMoveState_Walking;
+
+ break;
+
+ // Walking State
+ case eEnemyMoveState_Walking:
+ if (fSpeed >= mfWalkToRunSpeed)
+ mMoveState = eEnemyMoveState_Running;
+ else if (fSpeed <= mfWalkToStoppedSpeed) {
+ if (std::abs(fTurnSpeed) < 0.03f)
+ mMoveState = eEnemyMoveState_Stopped;
+ }
+
+ break;
+
+ // Running State
+ case eEnemyMoveState_Running:
+ if (fSpeed <= mfRunToWalkSpeed)
+ mMoveState = eEnemyMoveState_Walking;
+
+ break;
+
+ // NULL
+ case eEnemyMoveState_LastEnum:
+ mMoveState = eEnemyMoveState_Stopped;
+ break;
+ }
+
+ //////////////////////////////////////////////
+ // If move state has changed, change animation
+ if (prevMoveState != mMoveState) {
+ // Backward
+ if (mMoveState == eEnemyMoveState_Backward) {
+ PlayAnim(msBackwardAnim, true, 0.4f, true, mfMoveAnimSpeedMul, false, false);
+ }
+ // Stopped
+ else if (mMoveState == eEnemyMoveState_Stopped) {
+ PlayAnim(msStoppedAnim, true, 0.7f, false, 1.0f, false, false);
+ }
+ // Walking
+ else if (mMoveState == eEnemyMoveState_Walking) {
+ bool bSync = prevMoveState == eEnemyMoveState_Running ? true : false;
+
+ PlayAnim(msWalkAnim, true, 0.2f, true, mfMoveAnimSpeedMul, bSync, false);
+ }
+ // Running
+ else if (mMoveState == eEnemyMoveState_Running) {
+ bool bSync = prevMoveState == eEnemyMoveState_Walking ? true : false;
+
+ PlayAnim(msRunAnim, true, 0.2f, true, mfMoveAnimSpeedMul, bSync, false);
+ }
+ }
+
+ /////////////////////////////////
+ // Update animation speed
+ if (mbAnimationIsSpeedDependant) {
+ if (std::abs(fSpeed) > 0.05f)
+ mpCurrentAnimation->SetSpeed(std::abs(fSpeed) * mfMoveAnimSpeedMul);
+ else
+ mpCurrentAnimation->SetSpeed(std::abs(fTurnSpeed) * mfMoveAnimSpeedMul * 2);
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::SetupBody() {
+ mpMover->GetCharBody()->SetMaxPositiveMoveSpeed(eCharDir_Forward, mfMaxForwardSpeed);
+ mpMover->GetCharBody()->SetMaxNegativeMoveSpeed(eCharDir_Forward, -mfMaxBackwardSpeed);
+ mpMover->GetCharBody()->SetMoveAcc(eCharDir_Forward, mfAcceleration);
+
+ mpMover->GetCharBody()->SetMaxPushMass(mfMaxPushMass);
+ mpMover->GetCharBody()->SetPushForce(mfPushForce);
+
+ mpMover->SetMaxTurnSpeed(mfMaxTurnSpeed);
+ mpMover->SetAngleDistTurnMul(mfAngleDistTurnMul);
+
+ mpMover->SetMinBreakAngle(mfMinBreakAngle);
+ mpMover->SetBreakAngleMul(mfBreakAngleMul);
+
+ mpMover->SetMaxPushMass(mfMaxPushMass);
+}
+
+//-----------------------------------------------------------------------
+
+static const cVector2f gvPosAdds[] = {cVector2f(0, 0),
+ cVector2f(1, 0),
+ cVector2f(-1, 0),
+ cVector2f(0, 1),
+ cVector2f(0, -1)};
+
+bool iGameEnemy::LineOfSight(const cVector3f &avPos, const cVector3f &avSize) {
+ // Setup debug
+ // if(mvRayStartPoses.size()<5) mvRayStartPoses.resize(5);
+ // if(mvRayEndPoses.size()<5) mvRayEndPoses.resize(5);
+
+ iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+
+ cVector3f vStartCenter = mpMover->GetCharBody()->GetPosition();
+ cVector3f vEndCenter = avPos;
+
+ /////////////////////////////
+ // Calculate the right vector
+ const cVector3f vForward = cMath::Vector3Normalize(vEndCenter - vStartCenter);
+ const cVector3f vUp = cVector3f(0, 1.0f, 0);
+ const cVector3f vRight = cMath::Vector3Cross(vForward, vUp);
+
+ ////////////////////////////////////
+ // Check if the pos is within FOV
+ if (mfFOV < k2Pif) {
+ cVector3f vEnemyForward = mpMover->GetCharBody()->GetForward();
+
+ // float fAngle = cMath::Vector3Angle(vEnemyForward, vForward);
+ // if(fAngle > mfFOV*0.5f) return false;
+
+ cVector3f vToPlayerAngle = cMath::GetAngleFromPoints3D(0, vForward);
+ cVector3f vEnemyAngle = cMath::GetAngleFromPoints3D(0, vEnemyForward);
+
+ float fAngleX = cMath::Abs(cMath::GetAngleDistanceRad(vToPlayerAngle.x, vEnemyAngle.x));
+ float fAngleY = cMath::Abs(cMath::GetAngleDistanceRad(vToPlayerAngle.y, vEnemyAngle.y));
+
+ // Log("X:%f Y:%f\n",cMath::ToDeg(fAngleX), cMath::ToDeg(fAngleY));
+
+ if (fAngleY > mfFOV * 0.5f)
+ return false;
+ if (fAngleX > mfFOV * mfFOVXMul * 0.5f)
+ return false;
+ }
+
+ // Get the half with and height. Make them a little smaller so that player can slide over funk on floor.
+ const float fHalfWidth = avSize.x * 0.4f;
+ const float fHalfHeight = avSize.y * 0.4f;
+
+ // Count of 2 is need for a line of sight sucess.
+ int lCount = 0;
+ // Iterate through all the rays.
+ for (int i = 0; i < 5; ++i) {
+ cVector3f vAdd = vRight * (gvPosAdds[i].x * fHalfWidth) + vUp * (gvPosAdds[i].y * fHalfHeight);
+ cVector3f vStart = vStartCenter + vAdd;
+ cVector3f vEnd = vEndCenter + vAdd;
+
+ // mvRayStartPoses[i] = vStart;
+ // mvRayEndPoses[i] =vEnd;
+
+ mRayCallback.Reset();
+ pPhysicsWorld->CastRay(&mRayCallback, vStart, vEnd, false, false, false);
+ if (mRayCallback.Intersected() == false)
+ lCount++;
+
+ if (lCount == 2)
+ return true;
+ }
+
+ return false;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// LOADER
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cEntityLoader_GameEnemy::cEntityLoader_GameEnemy(const tString &asName, cInit *apInit)
+ : cEntityLoader_Object(asName) {
+ mpInit = apInit;
+}
+
+cEntityLoader_GameEnemy::~cEntityLoader_GameEnemy() {
+}
+
+//-----------------------------------------------------------------------
+
+void cEntityLoader_GameEnemy::BeforeLoad(TiXmlElement *apRootElem, const cMatrixf &a_mtxTransform,
+ cWorld3D *apWorld) {
+}
+
+//-----------------------------------------------------------------------
+
+void cEntityLoader_GameEnemy::AfterLoad(TiXmlElement *apRootElem, const cMatrixf &a_mtxTransform,
+ cWorld3D *apWorld) {
+ iGameEnemy *pEnemy = NULL;
+
+ tString sSubtype = "";
+ tString sName = "";
+
+ ///////////////////////////////////
+ // Load game properties
+ TiXmlElement *pMainElem = apRootElem->FirstChildElement("MAIN");
+ if (pMainElem) {
+ sSubtype = cString::ToString(pMainElem->Attribute("Subtype"), "");
+ sName = cString::ToString(pMainElem->Attribute("Name"), "");
+ } else {
+ Error("Couldn't find main element for entity '%s'\n", mpEntity->GetName().c_str());
+ }
+
+ ///////////////////////////////////
+ // Load the enemy type
+
+ TiXmlElement *pGameElem = apRootElem->FirstChildElement("GAME");
+
+ if (sSubtype == "Dog") {
+ pEnemy = hplNew(cGameEnemy_Dog, (mpInit, mpEntity->GetName(), pGameElem));
+ }
+#ifndef DEMO_VERSION
+ else if (sSubtype == "Spider") {
+ pEnemy = hplNew(cGameEnemy_Spider, (mpInit, mpEntity->GetName(), pGameElem));
+ } else if (sSubtype == "Worm") {
+ pEnemy = hplNew(cGameEnemy_Worm, (mpInit, mpEntity->GetName(), pGameElem));
+ }
+#endif
+
+ pEnemy->msSubType = sSubtype;
+ pEnemy->msEnemyType = msName;
+ pEnemy->msFileName = msFileName;
+ pEnemy->m_mtxOnLoadTransform = a_mtxTransform;
+
+ // Do stuff that is not done when loading from savegame.
+ pEnemy->SetMeshEntity(mpEntity);
+ pEnemy->SetBodies(mvBodies);
+ pEnemy->Setup(apWorld);
+
+ /////////////////////////////////
+ // Add to map handler
+ mpInit->mpMapHandler->AddGameEntity(pEnemy);
+ mpInit->mpMapHandler->AddGameEnemy(pEnemy);
+
+ iCharacterBody *pBody = pEnemy->mpMover->GetCharBody();
+ pBody->SetPosition(mpEntity->GetWorldPosition() + cVector3f(0, pBody->GetSize().y / 2, 0));
+
+ // Set the correct heading
+ cMatrixf mtxInv = cMath::MatrixInverse(mpEntity->GetWorldMatrix());
+ cVector3f vBodyRotation = cMath::GetAngleFromPoints3D(cVector3f(0, 0, 0), mtxInv.GetForward() * -1);
+
+ pBody->SetYaw(vBodyRotation.y);
+
+ // Log("Loaded enemy!\n");
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// SAVE OBJECT STUFF
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+kBeginSerializeBase(cEnemyPatrolNode)
+ kSerializeVar(msNodeName, eSerializeType_String)
+ kSerializeVar(mfWaitTime, eSerializeType_Float32)
+ kSerializeVar(msAnimation, eSerializeType_String)
+ kEndSerialize()
+
+ kBeginSerialize(iGameEnemy_SaveData, iGameEntity_SaveData)
+ kSerializeVar(mbHasBeenActivated, eSerializeType_Bool)
+ kSerializeVar(mvCharBodyPosition, eSerializeType_Vector3f)
+ kSerializeVar(mvCharBodyRotation, eSerializeType_Vector3f)
+ kSerializeVar(mlCurrentPatrolNode, eSerializeType_Int32)
+
+ kSerializeVar(mfDisappearTime, eSerializeType_Float32)
+ kSerializeVar(mbDisappearActive, eSerializeType_Bool)
+ kSerializeVar(mbHasDisappeared, eSerializeType_Bool)
+
+ kSerializeVar(mbUsesTriggers, eSerializeType_Bool)
+
+ kSerializeVar(mvLastPlayerPos, eSerializeType_Vector3f)
+ kSerializeVar(msOnDeathCallback, eSerializeType_String)
+ kSerializeVar(msOnAttackCallback, eSerializeType_String)
+ kSerializeClassContainer(mvPatrolNodes, cEnemyPatrolNode, eSerializeType_Class)
+ kEndSerialize()
+
+ //-----------------------------------------------------------------------
+
+ iGameEntity *iGameEnemy_SaveData::CreateEntity() {
+ return NULL;
+}
+
+//-----------------------------------------------------------------------
+
+iGameEntity_SaveData *iGameEnemy::CreateSaveData() {
+ return hplNew(iGameEnemy_SaveData, ());
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::SaveToSaveData(iGameEntity_SaveData *apSaveData) {
+ super::SaveToSaveData(apSaveData);
+ iGameEnemy_SaveData *pData = static_cast<iGameEnemy_SaveData *>(apSaveData);
+
+ kCopyToVar(pData, mbHasBeenActivated);
+
+ pData->mvCharBodyPosition = mpMover->GetCharBody()->GetPosition();
+
+ pData->mvCharBodyRotation.x = mpMover->GetCharBody()->GetPitch();
+ pData->mvCharBodyRotation.y = mpMover->GetCharBody()->GetYaw();
+
+ kCopyToVar(pData, mlCurrentPatrolNode);
+ kCopyToVar(pData, mvLastPlayerPos);
+ kCopyToVar(pData, msOnDeathCallback);
+ kCopyToVar(pData, msOnAttackCallback);
+
+ kCopyToVar(pData, mfDisappearTime);
+ kCopyToVar(pData, mbDisappearActive);
+ kCopyToVar(pData, mbHasDisappeared);
+
+ kCopyToVar(pData, mbUsesTriggers);
+
+ pData->mvPatrolNodes.Resize(mvPatrolNodes.size());
+ for (size_t i = 0; i < mvPatrolNodes.size(); ++i) {
+ pData->mvPatrolNodes[i].msNodeName = mvPatrolNodes[i].msNodeName;
+ pData->mvPatrolNodes[i].mfWaitTime = mvPatrolNodes[i].mfWaitTime;
+ pData->mvPatrolNodes[i].msAnimation = mvPatrolNodes[i].msAnimation;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemy::LoadFromSaveData(iGameEntity_SaveData *apSaveData) {
+ super::LoadFromSaveData(apSaveData);
+ iGameEnemy_SaveData *pData = static_cast<iGameEnemy_SaveData *>(apSaveData);
+
+ kCopyFromVar(pData, mbHasBeenActivated);
+
+ mpMover->GetCharBody()->SetPosition(pData->mvCharBodyPosition);
+
+ mpMover->GetCharBody()->SetPitch(pData->mvCharBodyRotation.x);
+ mpMover->GetCharBody()->SetYaw(pData->mvCharBodyRotation.y);
+ mpMover->GetCharBody()->UpdateMoveMarix();
+
+ kCopyFromVar(pData, mlCurrentPatrolNode);
+ kCopyFromVar(pData, mvLastPlayerPos);
+ kCopyFromVar(pData, msOnDeathCallback);
+ kCopyFromVar(pData, msOnAttackCallback);
+
+ kCopyFromVar(pData, mfDisappearTime);
+ kCopyFromVar(pData, mbDisappearActive);
+ kCopyFromVar(pData, mbHasDisappeared);
+
+ kCopyFromVar(pData, mbUsesTriggers);
+
+ mvPatrolNodes.resize(pData->mvPatrolNodes.Size());
+ for (size_t i = 0; i < mvPatrolNodes.size(); ++i) {
+ mvPatrolNodes[i].msNodeName = pData->mvPatrolNodes[i].msNodeName;
+ mvPatrolNodes[i].mfWaitTime = pData->mvPatrolNodes[i].mfWaitTime;
+ mvPatrolNodes[i].msAnimation = pData->mvPatrolNodes[i].msAnimation;
+ }
+
+ // Log("Load Save Data!\n");
+}
+//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameEnemy.h b/engines/hpl1/penumbra-overture/GameEnemy.h
new file mode 100644
index 00000000000..daf243622a8
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/GameEnemy.h
@@ -0,0 +1,531 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#ifndef GAME_GAME_ENEMY_H
+#define GAME_GAME_ENEMY_H
+
+#include "hpl1/engine/engine.h"
+#include "hpl1/penumbra-overture/GameEntity.h"
+
+#include "hpl1/penumbra-overture/CharacterMove.h"
+
+using namespace hpl;
+
+class cGameTrigger;
+class cCharacterMove;
+class iGameEntity;
+
+//-----------------------------------------
+
+#define STATE_IDLE 0
+#define STATE_HUNT 1
+#define STATE_ATTACK 2
+#define STATE_FLEE 3
+#define STATE_KNOCKDOWN 4
+#define STATE_DEAD 5
+#define STATE_PATROL 6
+#define STATE_INVESTIGATE 7
+#define STATE_BREAKDOOR 8
+#define STATE_CALLBACKUP 9
+#define STATE_MOVETO 10
+#define STATE_EAT 11
+#define STATE_ATTENTION 12
+#define STATE_NUM 13
+
+//-----------------------------------------
+
+enum eEnemyMoveState {
+ eEnemyMoveState_Backward,
+ eEnemyMoveState_Stopped,
+ eEnemyMoveState_Walking,
+ eEnemyMoveState_Running,
+ eEnemyMoveState_LastEnum
+};
+
+//-----------------------------------------
+
+class cEnemyPatrolNode : public iSerializable {
+ kSerializableClassInit(cEnemyPatrolNode) public : cEnemyPatrolNode() {}
+ cEnemyPatrolNode(const tString &asNode, float afTime, const tString &asAnim) : msNodeName(asNode), mfWaitTime(afTime), msAnimation(asAnim) {}
+
+ tString msNodeName;
+ float mfWaitTime;
+ tString msAnimation;
+};
+
+//-----------------------------------------
+
+class cLineOfSightRayCallback : public iPhysicsRayCallback {
+public:
+ void Reset();
+ bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
+ bool Intersected();
+
+private:
+ bool mbIntersected;
+ iPhysicsBody *mpGrabBody;
+};
+
+//------------------------------------------
+
+class cEnemyFindGround : public iPhysicsRayCallback {
+public:
+ bool GetGround(const cVector3f &avStartPos, const cVector3f &avDir,
+ cVector3f *apDestPosition, cVector3f *apDestNormal,
+ float afMaxDistance = 10);
+
+ bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
+
+private:
+ bool mbIntersected;
+ float mfMinDist;
+ cVector3f mvPos;
+ cVector3f mvNormal;
+ float mfMaxDistance;
+};
+
+//------------------------------------------
+
+class cEnemyCheckForDoor : public iPhysicsRayCallback {
+public:
+ bool CheckDoor(const cVector3f &avStart, const cVector3f &avEnd);
+
+ bool BeforeIntersect(iPhysicsBody *pBody);
+ bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
+
+private:
+ bool mbIntersected;
+};
+
+//------------------------------------------
+
+class iGameEnemy_SaveData : public iGameEntity_SaveData {
+ kSerializableClassInit(iGameEnemy_SaveData);
+
+public:
+ bool mbHasBeenActivated;
+
+ cVector3f mvCharBodyPosition;
+ cVector3f mvCharBodyRotation;
+ int mlCurrentPatrolNode;
+
+ float mfDisappearTime;
+ bool mbDisappearActive;
+ bool mbHasDisappeared;
+
+ bool mbUsesTriggers;
+
+ cVector3f mvLastPlayerPos;
+ tString msOnDeathCallback;
+ tString msOnAttackCallback;
+ cContainerVec<cEnemyPatrolNode> mvPatrolNodes;
+
+ iGameEntity *CreateEntity();
+};
+
+//-----------------------------------------
+
+class iGameEnemyState {
+public:
+ iGameEnemyState(int alId, cInit *apInit, iGameEnemy *apEnemy);
+
+ virtual void OnEnterState(iGameEnemyState *apPrevState) = 0;
+ virtual void OnLeaveState(iGameEnemyState *apNextState) = 0;
+
+ virtual void OnUpdate(float afTimeStep) = 0;
+
+ virtual void OnDraw() = 0;
+ virtual void OnPostSceneDraw() = 0;
+
+ virtual void OnSeePlayer(const cVector3f &avPosition, float afChance) = 0;
+ virtual bool OnHearNoise(const cVector3f &avPosition, float afVolume) = 0;
+ virtual void OnTakeHit(float afDamage) = 0;
+ virtual void OnDeath(float afDamage) = 0;
+ virtual void OnAnimationOver(const tString &asAnimName) = 0;
+ virtual void OnFlashlight(const cVector3f &avPosition) = 0;
+
+ void SetPreviousState(int alX) { mlPreviousState = alX; }
+ int GetPreviousState() { return mlPreviousState; }
+
+ int GetId() { return mlId; }
+
+protected:
+ int mlId;
+ cInit *mpInit;
+ cPlayer *mpPlayer;
+ iGameEnemy *mpEnemy;
+ cCharacterMove *mpMover;
+
+ int mlPreviousState;
+};
+
+//-----------------------------------------
+
+class iGameEnemy : public iGameEntity {
+ typedef iGameEntity super;
+ friend class cEntityLoader_GameEnemy;
+
+public:
+ iGameEnemy(cInit *apInit, const tString &asName, TiXmlElement *apGameElem);
+ virtual ~iGameEnemy(void);
+
+ // Special
+ void LoadBaseProperties(TiXmlElement *apGameElem);
+
+ // Actions
+ void OnPlayerInteract();
+ void OnPlayerPick();
+
+ void Setup(cWorld3D *apWorld);
+
+ void OnWorldLoad();
+ void OnPostLoadScripts();
+ void OnWorldExit();
+ void OnDraw();
+ void OnPostSceneDraw();
+ virtual void ExtraPostSceneDraw() {}
+
+ void Update(float afTimeStep);
+
+ bool IsLoading() { return mbLoading; }
+
+ void OnDamage(float afX);
+ void OnDeath(float afX);
+
+ void OnFlashlight(const cVector3f &avPos);
+
+ virtual void OnSetActive(bool abX);
+
+ virtual bool MoveToPos(const cVector3f &avFeetPos) = 0;
+
+ virtual void ShowPlayer(const cVector3f &avPlayerFeetPos) {}
+
+ virtual bool IsFighting() { return false; }
+
+ // Physics
+ void SetupBody();
+
+ // Properties
+ cVector3f GetPosition();
+ void SetFOV(float afAngle) { mfFOV = afAngle; }
+
+ const tString &GetHitPS() { return msHitPS; }
+ const tString &GetEnemyType() { return msEnemyType; }
+
+ const tString &GetCloseMusic() { return msCloseMusic; }
+ int GetCloseMusicPrio() { return mlCloseMusicPrio; }
+ float GetCloseMusicStartDist() { return mfCloseMusicStartDist; }
+ float GetCloseMusicStopDist() { return mfCloseMusicStopDist; }
+
+ const tString &GetAttackMusic() { return msAttackMusic; }
+ int GetAttackMusicPrio() { return mlAttackMusicPrio; }
+
+ // States
+ void AddState(iGameEnemyState *apState);
+ void ChangeState(int alId);
+ iGameEnemyState *GetState(int alId);
+ int GetCurrentStateId() { return mlCurrentState; }
+
+ // Triggers
+ bool HandleTrigger(cGameTrigger *apTrigger);
+
+ eGameTriggerType GetTriggerTypes() { return mTriggerTypes; }
+
+ float GetTriggerUpdateCount() { return mfTriggerUpdateCount; }
+ void SetTriggerUpdateCount(float afX) { mfTriggerUpdateCount = afX; }
+ float GetTriggerUpdateRate() { return mfTriggerUpdateRate; }
+
+ void SetSkipSoundTriggerCount(float afX) { mfSkipSoundTriggerCount = afX; }
+
+ // Content control
+ void PlayAnim(const tString &asName, bool abLoop, float afFadeTime,
+ bool abDependsOnSpeed = false, float afSpeedMul = 1.0f,
+ bool abSyncWithPrevFrame = false,
+ bool abOverideMoveState = true);
+ void UseMoveStateAnimations();
+
+ cAnimationState *GetCurrentAnimation() { return mpCurrentAnimation; }
+
+ void PlaySound(const tString &asName);
+
+ // Callabcks
+ void SetOnDeathCallback(const tString &asFunc) { msOnDeathCallback = asFunc; }
+ void SetOnAttackCallback(const tString &asFunc) { msOnAttackCallback = asFunc; }
+ tString GetOnAttackCallback() { return msOnAttackCallback; }
+
+ // AI
+ bool CanSeePlayer();
+ cCharacterMove *GetMover() { return mpMover; }
+ cVector3f GetLastPlayerPos() { return mvLastPlayerPos; }
+ void SetLastPlayerPos(const cVector3f &avPos) { mvLastPlayerPos = avPos; }
+
+ void SetTempPosition(const cVector3f &avPos) { mvTempPosition = avPos; }
+ cVector3f GetTempPosition() { return mvTempPosition; }
+
+ void SetTempFloat(float afX) { mfTempFloat = afX; }
+ float GetTempFloat() { return mfTempFloat; }
+
+ cEnemyFindGround *GetGroundFinder() { return &mFindGround; }
+
+ cEnemyCheckForDoor *GetDoorChecker() { return &mDoorCheck; }
+ bool CheckForDoor();
+
+ bool CheckForTeamMate(float afMaxDist, bool abCheckIfFighting);
+
+ bool IsAttracted() { return mbIsAttracted; }
+ void SetAttracted(bool abX) { mbIsAttracted = abX; }
+
+ bool GetUsesTriggers() { return mbUsesTriggers; }
+ void SetUsesTriggers(bool abX) { mbUsesTriggers = abX; }
+
+ // Patrolling
+ void AddPatrolNode(const tString &asNode, float afTime, const tString &asAnimation);
+ cEnemyPatrolNode *GetPatrolNode(int alIdx) { return &mvPatrolNodes[alIdx]; }
+ int GetPatrolNodeNum() { return (int)mvPatrolNodes.size(); }
+ cEnemyPatrolNode *CurrentPatrolNode() { return &mvPatrolNodes[mlCurrentPatrolNode]; }
+
+ void ClearPatrolNodes();
+
+ int GetCurrentPatrolNode() { return mlCurrentPatrolNode; }
+ float GetWaitTime() { return mfWaitTime; }
+ float GetWaitTimeCount() { return mfWaitTimeCount; }
+
+ void SetCurrentPatrolNode(int alX) { mlCurrentPatrolNode = alX; }
+ void IncCurrentPatrolNode() {
+ mlCurrentPatrolNode++;
+ if (mlCurrentPatrolNode >= (int)mvPatrolNodes.size())
+ mlCurrentPatrolNode = 0;
+ }
+ void SetWaitTime(float afX) { mfWaitTime = afX; }
+ void SetWaitTimeCount(float afX) { mfWaitTimeCount = afX; }
+ void AddWaitTimeCount(float afX) { mfWaitTimeCount += afX; }
+
+ float GetDoorBreakCount() { return mfDoorBreakCount; }
+ void SetDoorBreakCount(float afX) { mfDoorBreakCount = afX; }
+ void AddDoorBreakCount(float afX) { mfDoorBreakCount += afX; }
+
+ const cVector3f &GetModelOffsetAngles() { return mvModelOffsetAngles; }
+
+ // Virtual
+ virtual void OnUpdate(float afTimeStep) = 0;
+ virtual void OnLoad() = 0;
+
+ // SaveObject implementation
+ iGameEntity_SaveData *CreateSaveData();
+ void SaveToSaveData(iGameEntity_SaveData *apSaveData);
+ void LoadFromSaveData(iGameEntity_SaveData *apSaveData);
+
+protected:
+ void UpdateEnemyPose(float afTimeStep);
+
+ void UpdateAnimations(float afTimeStep);
+ void UpdateCheckForPlayer(float afTimeStep);
+
+ bool HandleSoundTrigger(cGameTrigger *apTrigger);
+
+ bool LineOfSight(const cVector3f &avPos, const cVector3f &avSize);
+
+ bool mbSetFeetAtGroundOnStart;
+ bool mbAttachMeshToBody;
+ bool mbRemoveAttackerOnDisable;
+
+ tVector3fVec mvRayStartPoses;
+ tVector3fVec mvRayEndPoses;
+
+ cEnemyFindGround mFindGround;
+
+ eGameTriggerType mTriggerTypes;
+
+ cCharacterMove *mpMover;
+
+ tString msEnemyType;
+
+ float mfTriggerUpdateCount;
+ float mfTriggerUpdateRate;
+
+ float mfSkipSoundTriggerCount;
+
+ cAStarHandler *mpAStarAir;
+ cAStarHandler *mpAStarGround;
+ cAINodeContainer *mpNodeContainerAir;
+ cAINodeContainer *mpNodeContainerGround;
+
+ cLineOfSightRayCallback mRayCallback;
+
+ std::vector<iGameEnemyState *> mvStates;
+ int mlCurrentState;
+
+ cEnemyCheckForDoor mDoorCheck;
+
+ cAnimationState *mpCurrentAnimation;
+ bool mbAnimationIsSpeedDependant;
+ float mfAnimationSpeedMul;
+
+ bool mbOverideMoveState;
+ eEnemyMoveState mMoveState;
+
+ cVector3f mvTempPosition;
+ float mfTempFloat;
+
+ tStringVec mvPreloadSounds;
+
+ bool mbLoading;
+
+ bool mbAlignToGroundNormal;
+ cMatrixf m_mtxStartPose;
+ cMatrixf m_mtxGoalPose;
+ float mfPoseCount;
+
+ bool mbHasBeenActivated;
+
+ bool mbUsesTriggers;
+
+ ///////////////////////////////
+ // Variable Properties
+ cVector3f mvLastPlayerPos;
+ float mfCanSeePlayerCount;
+ float mfCheckForPlayerCount;
+ float mfCheckForPlayerRate;
+ bool mbCanSeePlayer;
+ int mlPlayerInLOSCount;
+ int mlMaxPlayerInLOSCount;
+
+ float mfCalcPlayerHiddenPosCount;
+
+ float mfDamageSoundTimer;
+
+ tString msOnDeathCallback;
+ tString msOnAttackCallback;
+
+ std::vector<cEnemyPatrolNode> mvPatrolNodes;
+
+ int mlCurrentPatrolNode;
+ float mfWaitTime;
+ float mfWaitTimeCount;
+
+ float mfDoorBreakCount;
+
+ bool mbIsAttracted;
+
+ /////////////////////////////////
+ // Properties to be implemented
+ bool mbDisappear;
+ float mfDisappearMinTime;
+ float mfDisappearMaxTime;
+ float mfDisappearMinDistance;
+ tString msDisappearPS;
+ tString msDisappearSound;
+ bool mbDisappearFreezesRagdoll;
+
+ float mfDisappearTime;
+ bool mbDisappearActive;
+ bool mbHasDisappeared;
+
+ tString msCloseMusic;
+ int mlCloseMusicPrio;
+ float mfCloseMusicStartDist;
+ float mfCloseMusicStopDist;
+
+ tString msAttackMusic;
+ int mlAttackMusicPrio;
+
+ bool mbShowDebug;
+
+ tString msGroundNodeType;
+
+ cVector3f mvBodySize;
+ float mfBodyMass;
+
+ float mfMaxForwardSpeed;
+ float mfMaxBackwardSpeed;
+
+ float mfAcceleration;
+ float mfDeacceleration;
+
+ float mfMaxTurnSpeed;
+ float mfAngleDistTurnMul;
+
+ float mfMinBreakAngle;
+ float mfBreakAngleMul;
+
+ float mfSpeedMoveAnimMul;
+ float mfTurnSpeedMoveAnimMul;
+
+ cMatrixf m_mtxModelOffset;
+ cVector3f mvModelOffsetAngles;
+
+ float mfIdleToMoveLimit;
+ float mfMoveToLideLimit;
+
+ float mfMaxPushMass;
+ float mfPushForce;
+
+ float mfMaxSeeDist;
+
+ float mfMinAttackDist;
+
+ float mfFOV;
+ float mfFOVXMul;
+
+ float mfMaxHealth;
+
+ float mfStoppedToWalkSpeed;
+ float mfWalkToStoppedSpeed;
+ float mfWalkToRunSpeed;
+ float mfRunToWalkSpeed;
+ float mfMoveAnimSpeedMul;
+ tString msBackwardAnim;
+ tString msStoppedAnim;
+ tString msWalkAnim;
+ tString msRunAnim;
+
+ float mfMinStunSpeed;
+ float mfMinStunImpulse;
+ float mfObjectCollideStun;
+ float mfStunDamageMul;
+
+ tString msHitPS;
+};
+
+//--------------------------------------
+
+class cEntityLoader_GameEnemy : public cEntityLoader_Object {
+
+public:
+ cEntityLoader_GameEnemy(const tString &asName, cInit *apInit);
+ ~cEntityLoader_GameEnemy();
+
+private:
+ void BeforeLoad(TiXmlElement *apRootElem, const cMatrixf &a_mtxTransform, cWorld3D *apWorld);
+ void AfterLoad(TiXmlElement *apRootElem, const cMatrixf &a_mtxTransform, cWorld3D *apWorld);
+
+ cInit *mpInit;
+};
+
+//--------------------------------------
+
+#endif // GAME_GAME_ENEMY_H
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp b/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
new file mode 100644
index 00000000000..1e5cb43e811
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
@@ -0,0 +1,1807 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#include "hpl1/penumbra-overture/GameEnemy_Dog.h"
+
+#include "hpl1/penumbra-overture/AttackHandler.h"
+#include "hpl1/penumbra-overture/EffectHandler.h"
+#include "hpl1/penumbra-overture/GameMusicHandler.h"
+#include "hpl1/penumbra-overture/GameSwingDoor.h"
+#include "hpl1/penumbra-overture/MapHandler.h"
+#include "hpl1/penumbra-overture/Player.h"
+
+//////////////////////////////////////////////////////////////////////////
+// BASE STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+iGameEnemyState_Dog_Base::iGameEnemyState_Dog_Base(int alId, cInit *apInit, iGameEnemy *apEnemy)
+ : iGameEnemyState(alId, apInit, apEnemy) {
+ mpEnemyDog = static_cast<cGameEnemy_Dog *>(mpEnemy);
+}
+
+//-----------------------------------------------------------------------
+
+void iGameEnemyState_Dog_Base::OnSeePlayer(const cVector3f &avPosition, float afChance) {
+ // return;
+ if (mpPlayer->GetHealth() <= 0)
+ return;
+
+ if (afChance >= mpEnemyDog->mfIdleMinSeeChance) {
+ /*if( (mlId == STATE_IDLE || mlId == STATE_INVESTIGATE || mlId == STATE_PATROL) &&
+ cMath::RandRectf(0,1) < mpEnemyDog->mfIdleCallBackupChance &&
+ mpEnemy->CheckForTeamMate(8,true)==false)
+ {
+ mpEnemy->ChangeState(STATE_CALLBACKUP);
+ }
+ else
+ {
+ //mpEnemy->ChangeState(STATE_HUNT);
+ //mpEnemyDog->PlaySound(mpEnemyDog->msIdleFoundPlayerSound);
+ }*/
+
+ float fDist = cMath::Vector3Dist(mpMover->GetCharBody()->GetFeetPosition(),
+ mpPlayer->GetCharacterBody()->GetFeetPosition());
+ if (fDist >= mpEnemyDog->mfAttentionMinDist) {
+ mpEnemy->ChangeState(STATE_ATTENTION);
+ } else {
+ mpEnemy->ChangeState(STATE_HUNT);
+ mpEnemyDog->PlaySound(mpEnemyDog->msIdleFoundPlayerSound);
+ }
+ }
+}
+
+bool iGameEnemyState_Dog_Base::OnHearNoise(const cVector3f &avPosition, float afVolume) {
+ // return false;
+ float afDistance = (mpMover->GetCharBody()->GetPosition() - avPosition).Length();
+
+ if (afVolume >= mpEnemyDog->mfIdleMinHearVolume && afDistance > 0.4f) {
+ mpEnemy->SetTempPosition(avPosition);
+ mpEnemy->ChangeState(STATE_INVESTIGATE);
+ return true;
+ }
+
+ return false;
+}
+
+void iGameEnemyState_Dog_Base::OnTakeHit(float afDamage) {
+ if (afDamage >= mpEnemyDog->mfMinKnockDamage) {
+ if (mpInit->mbWeaponAttacking) {
+ float fChance = afDamage / mpEnemyDog->mfCertainKnockDamage; //(mpEnemyDog->mfCertainKnockDamage*4);
+ if (fChance > cMath::RandRectf(0, 1)) {
+ mpEnemy->ChangeState(STATE_KNOCKDOWN);
+ }
+ } else {
+ if (afDamage >= mpEnemyDog->mfCertainKnockDamage) {
+ mpEnemy->ChangeState(STATE_KNOCKDOWN);
+ } else {
+ float fChance = afDamage / mpEnemyDog->mfCertainKnockDamage;
+ if (fChance > cMath::RandRectf(0, 1)) {
+ mpEnemy->ChangeState(STATE_KNOCKDOWN);
+ }
+ }
+ }
+ }
+}
+
+void iGameEnemyState_Dog_Base::OnFlashlight(const cVector3f &avPosition) {
+ // mpInit->mpEffectHandler->GetSubTitle()->Add("Flashlight!",0.5f,true);
+ // OnSeePlayer(mpPlayer->GetCharacterBody()->GetFeetPosition(),1.0f);
+
+ // mpEnemy->SetLastPlayerPos(mpPlayer->GetCharacterBody()->GetFeetPosition());
+ // mpEnemy->ChangeState(STATE_HUNT);
+
+ mpEnemy->SetTempPosition(avPosition);
+ mpEnemy->ChangeState(STATE_INVESTIGATE);
+}
+
+void iGameEnemyState_Dog_Base::OnDeath(float afDamage) {
+ mpEnemy->ChangeState(STATE_DEAD);
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// IDLE STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Idle::OnEnterState(iGameEnemyState *apPrevState) {
+ // Animation
+ mpEnemy->UseMoveStateAnimations();
+
+ // Setup body
+ mpEnemy->SetupBody();
+
+ // Setup enemy
+ mpEnemy->SetFOV(mpEnemyDog->mfIdleFOV);
+
+ mpInit->mpMusicHandler->RemoveAttacker(mpEnemy);
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Idle::OnLeaveState(iGameEnemyState *apNextState) {
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Idle::OnUpdate(float afTimeStep) {
+ if (mpEnemy->GetPatrolNodeNum() > 0) {
+ mpEnemy->ChangeState(STATE_PATROL);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PATROL STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Patrol::OnEnterState(iGameEnemyState *apPrevState) {
+ // Animation
+ mpEnemy->UseMoveStateAnimations();
+
+ // Setup body
+ mpEnemy->SetupBody();
+
+ // Setup enemy
+ mpEnemy->SetFOV(mpEnemyDog->mfIdleFOV);
+
+ // Setup patrol
+ cEnemyPatrolNode *pPatrolNode = mpEnemy->CurrentPatrolNode();
+ cAINode *pNode = mpMover->GetNodeContainer()->GetNodeFromName(pPatrolNode->msNodeName);
+
+ if (mpEnemy->GetDoorBreakCount() > 3.0f) {
+ mpEnemy->SetDoorBreakCount(0);
+ mpMover->SetMaxDoorToughness(0);
+ }
+
+ mbWaiting = false;
+ mbAnimation = false;
+ mlStuckAtMaxCount = 0;
+
+ mfIdleSoundTime = cMath::RandRectf(mpEnemyDog->mfIdleSoundMinInteraval,
+ mpEnemyDog->mfIdleSoundMaxInteraval);
+
+ mpMover->SetMaxDoorToughness(-1);
+
+ if (mpMover->MoveToPos(pNode->GetPosition()) == false) {
+ // tString sStr = "Could not get to path node "+pPatrolNode->msNodeName;
+ // mpInit->mpEffectHandler->GetSubTitle()->Add(sStr,3,true);
+
+ mpEnemy->IncCurrentPatrolNode();
+ mbWaiting = true;
+ mpEnemy->SetWaitTime(1.0f);
+ } else {
+ // tString sStr = "Moving to path node "+pPatrolNode->msNodeName;
+ // mpInit->mpEffectHandler->GetSubTitle()->Add(sStr,3,true);
+ }
+
+ mpInit->mpMusicHandler->RemoveAttacker(mpEnemy);
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Patrol::OnLeaveState(iGameEnemyState *apNextState) {
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Patrol::OnUpdate(float afTimeStep) {
+ /////////////////////////////////
+ // Waiting for timer or animation to end
+ if (mbWaiting) {
+ //////////////////////////////
+ // Play idle sound
+ if (mfIdleSoundTime <= 0) {
+ mfIdleSoundTime = cMath::RandRectf(mpEnemyDog->mfIdleSoundMinInteraval,
+ mpEnemyDog->mfIdleSoundMaxInteraval);
+
+ mpEnemy->PlaySound(mpEnemyDog->msIdleSound);
+ } else {
+ mfIdleSoundTime -= afTimeStep;
+ }
+
+ //////////////////////////////
+ // Timer is up
+ if (mpEnemy->GetWaitTimeCount() >= mpEnemy->GetWaitTime()) {
+ if (mbAnimation == false) {
+ mpEnemy->SetWaitTimeCount(0);
+ cEnemyPatrolNode *pPatrolNode = mpEnemy->CurrentPatrolNode();
+ cAINode *pNode = mpMover->GetNodeContainer()->GetNodeFromName(pPatrolNode->msNodeName);
+
+ mpEnemy->UseMoveStateAnimations();
+ mbWaiting = false;
+
+ if (mpMover->MoveToPos(pNode->GetPosition()) == false) {
+ // tString sStr = "Could not get to path node "+pPatrolNode->msNodeName;
+ // mpInit->mpEffectHandler->GetSubTitle()->Add(sStr,3,false);
+ mpEnemy->IncCurrentPatrolNode();
+ mbWaiting = true;
+ mpEnemy->SetWaitTime(1.0f);
+ } else {
+ // tString sStr = "Moving to path node "+pPatrolNode->msNodeName;
+ // mpInit->mpEffectHandler->GetSubTitle()->Add(sStr,3,false);
+ }
+
+ } else {
+ mpEnemy->GetCurrentAnimation()->SetLoop(false);
+ }
+ } else {
+ mpEnemy->AddWaitTimeCount(afTimeStep);
+ }
+ }
+ /////////////////////////////////
+ // Check if path is over
+ else {
+ //////////////////////////////
+ // Play idle sound
+ if (mfIdleSoundTime <= 0) {
+ mfIdleSoundTime = cMath::RandRectf(mpEnemyDog->mfIdleSoundMinInteraval,
+ mpEnemyDog->mfIdleSoundMaxInteraval);
+
+ mpEnemy->PlaySound(mpEnemyDog->msIdleSound);
+ } else {
+ mfIdleSoundTime -= afTimeStep;
+ }
+
+ //////////////////////////////
+ // Stuck counter
+ if (mpMover->GetStuckCounter() > 1.7f) {
+ if (mpEnemy->CheckForDoor()) {
+ mpEnemy->ChangeState(STATE_BREAKDOOR);
+ } else {
+ mlStuckAtMaxCount++;
+ if (mlStuckAtMaxCount >= 6) {
+ mpEnemy->ChangeState(STATE_IDLE);
+ mpEnemy->SetWaitTime(1.0f);
+ mpEnemy->IncCurrentPatrolNode();
+ }
+ }
+ mpMover->ResetStuckCounter();
+ }
+
+ //////////////////////////////
+ // Got to ned of path
+ if (mpMover->IsMoving() == false) {
+ cEnemyPatrolNode *pPatrolNode = mpEnemy->CurrentPatrolNode();
+
+ mpEnemy->SetWaitTime(pPatrolNode->mfWaitTime);
+ mpEnemy->IncCurrentPatrolNode();
+
+ if (pPatrolNode->msAnimation != "") {
+ mpEnemy->PlayAnim(pPatrolNode->msAnimation, true, 0.2f);
+ mbAnimation = true;
+ }
+
+ mbWaiting = true;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Patrol::OnAnimationOver(const tString &asName) {
+ mbAnimation = false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// ATTENTION STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Attention::OnEnterState(iGameEnemyState *apPrevState) {
+ // Animation
+ mpEnemy->PlayAnim("Angry", true, 0.2f);
+
+ // Setup body
+ mpEnemy->SetupBody();
+
+ // Setup enemy
+ mpEnemy->SetFOV(mpEnemyDog->mfIdleFOV);
+
+ mpMover->Stop();
+ mpMover->TurnToPos(mpPlayer->GetCharacterBody()->GetFeetPosition());
+
+ mpEnemy->PlaySound(mpEnemyDog->msAttentionSound);
+ mfTime = mpEnemyDog->mfAttentionTime;
+
+#ifndef DEMO_VERSION
+ if (mpInit->mDifficulty == eGameDifficulty_Easy)
+ mfTime *= 1.7f;
+ if (mpInit->mbHasHaptics)
+ mfTime *= 1.3f;
+
+#endif
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Attention::OnLeaveState(iGameEnemyState *apNextState) {
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Attention::OnUpdate(float afTimeStep) {
+ mpMover->TurnToPos(mpPlayer->GetCharacterBody()->GetFeetPosition());
+ mfTime -= afTimeStep;
+
+ if (mfTime <= 0) {
+ if (mpEnemy->CanSeePlayer()) {
+ mpEnemy->ChangeState(STATE_HUNT);
+ mpEnemy->PlaySound(mpEnemyDog->msIdleFoundPlayerSound);
+ } else {
+ if (mlPreviousState == STATE_ATTENTION)
+ mpEnemy->ChangeState(STATE_IDLE);
+ else
+ mpEnemy->ChangeState(mlPreviousState);
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Attention::OnSeePlayer(const cVector3f &avPosition, float afChance) {
+}
+bool cGameEnemyState_Dog_Attention::OnHearNoise(const cVector3f &avPosition, float afVolume) {
+ return false;
+}
+void cGameEnemyState_Dog_Attention::OnFlashlight(const cVector3f &avPosition) {
+ mpEnemy->ChangeState(STATE_HUNT);
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Attention::OnDraw() {
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// EAT STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Eat::OnEnterState(iGameEnemyState *apPrevState) {
+ // Animation
+ mpEnemy->PlayAnim("Eating", true, 0.2f);
+
+ // Setup body
+ mpEnemy->SetupBody();
+
+ // Setup enemy
+ mpEnemy->SetFOV(mpEnemyDog->mfEatFOV);
+
+ mfTime = mpEnemy->GetTempFloat();
+
+ mpMover->GetCharBody()->SetMoveSpeed(eCharDir_Forward, 0);
+ mpMover->Stop();
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Eat::OnLeaveState(iGameEnemyState *apNextState) {
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Eat::OnUpdate(float afTimeStep) {
+ mfTime -= afTimeStep;
+ if (mfTime <= 0) {
+ mpEnemy->ChangeState(mlPreviousState); // STATE_IDLE);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+bool cGameEnemyState_Dog_Eat::OnHearNoise(const cVector3f &avPosition, float afVolume) {
+ // return false;
+ if (afVolume >= mpEnemyDog->mfEatMinHearVolume) {
+ mpEnemy->SetTempPosition(avPosition);
+ mpEnemy->ChangeState(STATE_INVESTIGATE);
+ return true;
+ }
+
+ return false;
+}
+
+void cGameEnemyState_Dog_Eat::OnSeePlayer(const cVector3f &avPosition, float afChance) {
+ // return;
+ if (mpPlayer->GetHealth() <= 0)
+ return;
+
+ if (afChance >= mpEnemyDog->mfEatMinSeeChance) {
+ mpEnemy->ChangeState(STATE_HUNT);
+ mpEnemyDog->PlaySound(mpEnemyDog->msIdleFoundPlayerSound);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// INVESTIGATE STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Investigate::OnEnterState(iGameEnemyState *apPrevState) {
+ // Animation
+ mpEnemy->UseMoveStateAnimations();
+
+ // Setup body
+ mpEnemy->SetupBody();
+
+ // Setup enemy
+ mpEnemy->SetFOV(mpEnemyDog->mfIdleFOV);
+
+ // Play sound
+ mpEnemy->PlaySound(mpEnemyDog->msInvestigateSound);
+
+ cAINode *pNode = mpMover->GetAINodeAtPosInRange(mpEnemy->GetTempPosition(), 0.0f, 5.0f, true, 0.1f);
+
+ if (mpEnemy->GetDoorBreakCount() > 6.0f) {
+ mpEnemy->SetDoorBreakCount(0);
+ mpMover->SetMaxDoorToughness(0);
+ }
+
+ if (pNode) {
+ if (mpMover->MoveToPos(pNode->GetPosition()) == false) {
+ mpEnemy->ChangeState(STATE_IDLE);
+ }
+ } else {
+ mpEnemy->ChangeState(STATE_IDLE);
+ }
+
+ mpMover->SetMaxDoorToughness(-1);
+
+ mpInit->mpMusicHandler->RemoveAttacker(mpEnemy);
+
+ mfIdleSoundTime = cMath::RandRectf(mpEnemyDog->mfIdleSoundMinInteraval,
+ mpEnemyDog->mfIdleSoundMaxInteraval);
+
+ if (apPrevState->GetId() != STATE_INVESTIGATE) {
+ mfHighestVolume = 0.0f;
+ }
+
+ mfHearSoundCount = 5.0f;
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Investigate::OnLeaveState(iGameEnemyState *apNextState) {
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Investigate::OnUpdate(float afTimeStep) {
+ if (mfHearSoundCount > 0) {
+ mfHearSoundCount -= afTimeStep;
+ if (mfHearSoundCount <= 0)
+ mfHearSoundCount = 0;
+ }
+
+ ////////////////////////////////
+ // Play idle sound
+ if (mfIdleSoundTime <= 0) {
+ mfIdleSoundTime = cMath::RandRectf(mpEnemyDog->mfIdleSoundMinInteraval,
+ mpEnemyDog->mfIdleSoundMaxInteraval);
+
+ mpEnemy->PlaySound(mpEnemyDog->msIdleSound);
+ } else {
+ mfIdleSoundTime -= afTimeStep;
+ }
+
+ ////////////////////////////////
+ // Stuck counter
+ if (mpMover->GetStuckCounter() > 1.5f) {
+ if (mlKnockCount == 1) {
+ mpEnemy->ChangeState(STATE_IDLE);
+ mlKnockCount = 0;
+ } else {
+ if (mpEnemy->CheckForDoor()) {
+ mpEnemy->ChangeState(STATE_BREAKDOOR);
+ }
+ mpMover->ResetStuckCounter();
+ mlKnockCount++;
+ }
+ }
+
+ if (mpMover->IsMoving() == false) {
+ mlKnockCount = 0;
+ mpEnemy->ChangeState(STATE_IDLE);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+bool cGameEnemyState_Dog_Investigate::OnHearNoise(const cVector3f &avPosition, float afVolume) {
+ if (mfHearSoundCount <= 0 && mfHighestVolume < afVolume &&
+ afVolume >= mpEnemyDog->mfIdleMinHearVolume) {
+ mfHighestVolume = afVolume;
+ mpEnemy->SetTempPosition(avPosition);
+ OnEnterState(this);
+
+ return true;
+ }
+
+ return false;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// MOVE TO STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_MoveTo::OnEnterState(iGameEnemyState *apPrevState) {
+ // Animation
+ mpEnemy->UseMoveStateAnimations();
+
+ // Setup body
+ mpEnemy->SetupBody();
+
+ // Setup enemy
+ mpEnemy->SetFOV(mpEnemyDog->mfIdleFOV);
+
+ // Play sound
+ mpEnemy->PlaySound(mpEnemyDog->msInvestigateSound);
+
+ if (mpMover->MoveToPos(mpEnemy->GetTempPosition()) == false) {
+ // mpInit->mpEffectHandler->GetSubTitle()->Add("Could not move to pos!\n",3,true);
+ mpEnemy->ChangeState(apPrevState->GetId());
+ return;
+ } else {
+ // mpInit->mpEffectHandler->GetSubTitle()->Add("Moving to pos!\n",3,true);
+ }
+
+ mpInit->mpMusicHandler->RemoveAttacker(mpEnemy);
+
+ mfIdleSoundTime = cMath::RandRectf(mpEnemyDog->mfIdleSoundMinInteraval,
+ mpEnemyDog->mfIdleSoundMaxInteraval);
+
+ mlBreakCount = 0;
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_MoveTo::OnLeaveState(iGameEnemyState *apNextState) {
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_MoveTo::OnUpdate(float afTimeStep) {
+ ////////////////////////////////
+ // Play idle sound
+ if (mfIdleSoundTime <= 0) {
+ mfIdleSoundTime = cMath::RandRectf(mpEnemyDog->mfIdleSoundMinInteraval,
+ mpEnemyDog->mfIdleSoundMaxInteraval);
+
+ mpEnemy->PlaySound(mpEnemyDog->msIdleSound);
+ } else {
+ mfIdleSoundTime -= afTimeStep;
+ }
+
+ ////////////////////////////////
+ // Stuck counter
+ if (mpMover->GetStuckCounter() > 1.5f) {
+ if (mlBreakCount == 1) {
+ mpEnemy->ChangeState(STATE_IDLE);
+ } else {
+ if (mpEnemy->CheckForDoor()) {
+ mpEnemy->ChangeState(STATE_BREAKDOOR);
+ }
+ mpMover->ResetStuckCounter();
+ mlBreakCount++;
+ }
+ }
+
+ if (mpMover->IsMoving() == false) {
+ mpEnemy->ChangeState(STATE_IDLE);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// HUNT STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Hunt::OnEnterState(iGameEnemyState *apPrevState) {
+ // Animation
+ mpEnemy->UseMoveStateAnimations();
+
+ // Setup body
+ mpEnemy->SetupBody();
+
+#ifndef DEMO_VERSION
+ float fMul = 1.0f;
+ if (mpInit->mbHasHaptics)
+ fMul = 0.6f;
+
+ if (mpInit->mDifficulty == eGameDifficulty_Easy)
+ mpMover->GetCharBody()->SetMaxPositiveMoveSpeed(eCharDir_Forward, mpEnemyDog->mfHuntSpeed * 0.7f * fMul);
+ else if (mpInit->mDifficulty == eGameDifficulty_Normal)
+ mpMover->GetCharBody()->SetMaxPositiveMoveSpeed(eCharDir_Forward, mpEnemyDog->mfHuntSpeed * fMul);
+ else
+ mpMover->GetCharBody()->SetMaxPositiveMoveSpeed(eCharDir_Forward, mpEnemyDog->mfHuntSpeed * 1.25f * fMul);
+#else
+ mpMover->GetCharBody()->SetMaxPositiveMoveSpeed(eCharDir_Forward, mpEnemyDog->mfHuntSpeed);
+#endif
+
+ // Setup enemy
+ mpEnemy->SetFOV(mpEnemyDog->mfHuntFOV);
+
+ mfUpdatePathCount = 0;
+ mfUpdateFreq = 1.0f;
+ mbFreePlayerPath = false;
+
+ if (mbBreakingDoor && mpEnemy->CanSeePlayer() == false) {
+ mlBreakDoorCount++;
+ if (mlBreakDoorCount >= 3) {
+ mpEnemy->ChangeState(STATE_IDLE);
+ return;
+ }
+ } else {
+ mlBreakDoorCount = 0;
+ }
+
+ mbBreakingDoor = false;
+ mbFoundNoPath = false;
+ mbLostPlayer = false;
+ mfLostPlayerCount = 0;
+ mfMaxLostPlayerCount = mpEnemyDog->mfHuntForLostPlayerTime;
+
+ mlStuckAtMaxCount = 0;
+
+ mpInit->mpMusicHandler->AddAttacker(mpEnemy);
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Hunt::OnLeaveState(iGameEnemyState *apNextState) {
+ mpMover->SetMaxDoorToughness(-1);
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Hunt::OnUpdate(float afTimeStep) {
+ if (mpPlayer->GetHealth() <= 0) {
+ mpEnemy->ChangeState(STATE_IDLE);
+ return;
+ }
+
+ if (mpMover->GetStuckCounter() > 1.1f) {
+ if (mpEnemy->CheckForDoor()) {
+ mbBreakingDoor = true;
+ mpEnemy->ChangeState(STATE_BREAKDOOR);
+ } else {
+ mlStuckAtMaxCount++;
+ if (mlStuckAtMaxCount >= 6) {
+ mpEnemy->ChangeState(STATE_IDLE);
+ }
+ }
+ mpMover->ResetStuckCounter();
+ }
+
+ if (mfUpdatePathCount <= 0) {
+ mbFoundNoPath = false;
+ // mpInit->mpEffectHandler->GetSubTitle()->Add("Update Path!",1.0f,true);
+ mfUpdatePathCount = mfUpdateFreq;
+
+ cAINodeContainer *pNodeCont = mpEnemy->GetMover()->GetNodeContainer();
+
+ // Log("%s: Checking free path\n",mpEnemy->GetName().c_str());
+
+ // Check if there is a free path to the player
+ if (mbLostPlayer == false && mpMover->FreeDirectPathToChar(mpPlayer->GetCharacterBody())) {
+ mbFreePlayerPath = true;
+ mpMover->Stop();
+ mpMover->SetMaxDoorToughness(-1);
+ } else {
+ mbFreePlayerPath = false;
+ }
+
+ // Get path to player
+ if (mbFreePlayerPath == false && mbLostPlayer == false) {
+ if (mpEnemy->GetDoorBreakCount() > 6.0f) {
+ mpMover->SetMaxDoorToughness(0);
+ }
+
+ // Log("%s: Move to pos\n",mpEnemy->GetName().c_str());
+
+ if (mpMover->MoveToPos(mpEnemy->GetLastPlayerPos()) == false) {
+ bool bFoundAnotherWay = false;
+ /*float fHeight = mpMover->GetCharBody()->GetPosition().y -
+ mpPlayer->GetCharacterBody()->GetPosition().y;
+ if(cMath::Abs(fHeight) > mpMover->GetNodeContainer()->GetMaxHeight())
+ {
+ cVector3f vPos = mpEnemy->GetLastPlayerPos();
+ vPos.y = mpMover->GetCharBody()->GetFeetPosition().y+0.1f;
+
+ if(mpMover->MoveToPos(vPos))
+ {
+ bFoundAnotherWay = true;
+ }
+ }*/
+
+ if (bFoundAnotherWay == false) {
+ mfUpdatePathCount = mfUpdateFreq * 5.0f;
+ mpMover->Stop();
+ // Set this so the enemey at least runs toward the player.
+ mbFoundNoPath = true;
+ }
+ }
+
+ // Log("%s: Done with that.\n",mpEnemy->GetName().c_str());
+ }
+ } else {
+ mfUpdatePathCount -= afTimeStep;
+ }
+
+ ////////////////////////////////
+ // Go directly towards the player
+ if (mbFreePlayerPath || (mbFoundNoPath && mpMover->IsMoving() == false)) {
+ // Go towards player
+ mpMover->MoveDirectToPos(mpPlayer->GetCharacterBody()->GetFeetPosition(), afTimeStep);
+
+ // Check if he should attack.
+ if (mpMover->DistanceToChar2D(mpPlayer->GetCharacterBody()) < mpEnemyDog->mfAttackDistance) {
+ float fHeight = mpMover->GetCharBody()->GetPosition().y -
+ mpPlayer->GetCharacterBody()->GetPosition().y;
+
+ // Player is above
+ if (fHeight < 0) {
+ fHeight += mpMover->GetCharBody()->GetSize().y / 2.0f;
+ float fMax = mpEnemyDog->mvAttackDamageSize.y; /// 2.0f;
+ if (fHeight > -fMax) {
+ mpEnemy->ChangeState(STATE_ATTACK);
+ } else {
+ // random attack if player is not too far up.
+ if (cMath::RandRectf(0, 1) < 0.2f) // fHeight*2 > -fMax &&
+ mpEnemy->ChangeState(STATE_ATTACK);
+ else
+ mpEnemy->ChangeState(STATE_FLEE);
+ }
+ } else {
+ mpEnemy->ChangeState(STATE_ATTACK);
+ }
+ }
+ }
+ ////////////////////////////////
+ // Update path search
+ else if (mbFreePlayerPath == false) {
+ if (mbLostPlayer == false && mpMover->IsMoving() == false && mpEnemy->CanSeePlayer() == false) {
+ mbLostPlayer = true;
+ mfLostPlayerCount = mfMaxLostPlayerCount;
+ }
+
+ if (mbLostPlayer) {
+ mpMover->GetCharBody()->Move(eCharDir_Forward, 1.0f, afTimeStep);
+
+ mfLostPlayerCount -= afTimeStep;
+ if (mfLostPlayerCount <= 0 || mpMover->GetStuckCounter() > 0.5f) {
+ mpEnemy->ChangeState(STATE_IDLE);
+ }
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Hunt::OnSeePlayer(const cVector3f &avPosition, float afChance) {
+ if (mbLostPlayer && afChance >= mpEnemyDog->mfHuntMinSeeChance) {
+ mbLostPlayer = false;
+ mfUpdatePathCount = 0;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+bool cGameEnemyState_Dog_Hunt::OnHearNoise(const cVector3f &avPosition, float afVolume) {
+ //////////////////////////////////
+ // If player is lost the sound might be of help
+ if (mbLostPlayer) {
+ // Check if sound can be heard
+ if (afVolume >= mpEnemyDog->mfHuntMinHearVolume) {
+ // Check if a node is found near the sound.
+ cAINode *pNode = mpMover->GetAINodeAtPosInRange(avPosition, 0.0f, 5.0f, true, 0.1f);
+ if (pNode) {
+ // Update last player postion.
+ mbLostPlayer = false;
+ mfUpdatePathCount = 0;
+ mpEnemy->SetLastPlayerPos(pNode->GetPosition());
+
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Hunt::OnDraw() {
+ float fWantedSpeed = mpMover->GetCharBody()->GetMoveSpeed(eCharDir_Forward);
+ float fRealSpeed = cMath::Vector3Dist(mpMover->GetCharBody()->GetPosition(),
+ mpMover->GetCharBody()->GetLastPosition());
+ fRealSpeed = fRealSpeed / (1.0f / 60.0f);
+
+ float fDist = mpMover->DistanceToChar2D(mpPlayer->GetCharacterBody());
+
+ mpInit->mpDefaultFont->Draw(cVector3f(0, 110, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
+ _W("LostPlayerCount: %f FreePath: %d NoPath: %d MaxStuck: %d Dist: %f / %f"),
+ mfLostPlayerCount, mbFreePlayerPath,
+ mbFoundNoPath,
+ mlStuckAtMaxCount,
+ fDist,
+ mpEnemyDog->mfAttackDistance);
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// ATTACK STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Attack::OnEnterState(iGameEnemyState *apPrevState) {
+ ///////////////
+ // Setup body
+ mpEnemy->SetupBody();
+ if (mpEnemyDog->mfAttackSpeed > 0) {
+ mpMover->GetCharBody()->SetMaxPositiveMoveSpeed(eCharDir_Forward, mpEnemyDog->mfAttackSpeed);
+ mpMover->SetMaxTurnSpeed(10000.0f);
+
+ // mpMover->SetMinBreakAngle(cMath::ToRad(140));
+ }
+
+ ///////////////
+ // Animation
+ float fHeight = mpPlayer->GetCharacterBody()->GetPosition().y -
+ mpMover->GetCharBody()->GetPosition().y;
+
+ // Player is above
+ if (fHeight > 0.1f)
+ mpEnemy->PlayAnim("Attack", false, 0.2f);
+ else
+ mpEnemy->PlayAnim("AttackLow", false, 0.2f);
+
+ ///////////////
+ // Other
+ mpEnemyDog->PlaySound(mpEnemyDog->msAttackStartSound);
+
+ mfDamageTimer = mpEnemyDog->mfAttackDamageTime;
+ mfJumpTimer = mpEnemyDog->mfAttackJumpTime;
+ mbAttacked = false;
+
+ if (mpEnemy->GetOnAttackCallback() != "") {
+ tString sCommand = mpEnemy->GetOnAttackCallback() + "(\"" + mpEnemy->GetName() + "\")";
+ mpInit->RunScriptCommand(sCommand);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Attack::OnLeaveState(iGameEnemyState *apNextState) {
+ mpEnemyDog->SetSkipSoundTriggerCount(2.0f);
+ mpMover->ResetStuckCounter();
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Attack::OnUpdate(float afTimeStep) {
+ // Move forward
+ if (mpEnemyDog->mfAttackSpeed > 0) {
+ if (mfJumpTimer <= 0) {
+ mpMover->MoveDirectToPos(mpPlayer->GetCharacterBody()->GetFeetPosition(), afTimeStep);
+ } else {
+ mpMover->TurnToPos(mpPlayer->GetCharacterBody()->GetFeetPosition());
+ mfJumpTimer -= afTimeStep;
+ }
+ }
+
+ if (mbAttacked)
+ return;
+
+ //////////////////////////////////////
+ // Get the 2D distance to the player
+ cVector3f vStart = mpPlayer->GetCharacterBody()->GetPosition();
+ vStart.y = 0;
+ cVector3f vEnd = mpMover->GetCharBody()->GetPosition();
+ vEnd.y = 0;
+ float fDist2D = cMath::Vector3DistSqr(vStart, vEnd);
+ float fMinRange = mpEnemyDog->mfAttackDamageRange;
+
+ ////////////////////////////////////////
+ // Check if dog is in range of player
+ if (fDist2D <= fMinRange * fMinRange && mfDamageTimer <= 0) {
+ if (mbAttacked == false) {
+ cVector3f vPos = mpMover->GetCharBody()->GetPosition() +
+ mpMover->GetCharBody()->GetForward() *
+ mpEnemyDog->mfAttackDamageRange;
+
+ cVector3f vRot = cVector3f(0, mpMover->GetCharBody()->GetYaw(), 0);
+ cMatrixf mtxOffset = cMath::MatrixRotate(vRot, eEulerRotationOrder_XYZ);
+ mtxOffset.SetTranslation(vPos);
+
+ eAttackTargetFlag target = eAttackTargetFlag_Player | eAttackTargetFlag_Bodies;
+
+ mpInit->mpPlayer->mbDamageFromPos = true;
+ mpInit->mpPlayer->mvDamagePos = mpMover->GetCharBody()->GetPosition();
+ if (mpInit->mpAttackHandler->CreateShapeAttack(mpEnemyDog->GetAttackShape(),
+ mtxOffset,
+ mpMover->GetCharBody()->GetPosition(),
+ cMath::RandRectf(mpEnemyDog->mfAttackMinDamage,
+ mpEnemyDog->mfAttackMaxDamage),
+
+ mpEnemyDog->mfAttackMinMass, mpEnemyDog->mfAttackMaxMass,
+ mpEnemyDog->mfAttackMinImpulse, mpEnemyDog->mfAttackMaxImpulse,
+
+ mpEnemyDog->mlAttackStrength,
+
+ target, NULL)) {
+ mpEnemyDog->PlaySound(mpEnemyDog->msAttackHitSound);
+ }
+ mpInit->mpPlayer->mbDamageFromPos = false;
+ mbAttacked = true;
+ }
+ } else {
+ mfDamageTimer -= afTimeStep;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Attack::OnAnimationOver(const tString &asName) {
+ if (mpPlayer->GetHealth() <= 0) {
+ float fDist = mpMover->DistanceToChar2D(mpInit->mpPlayer->GetCharacterBody());
+ if (fDist < 2.3f) {
+ mpEnemy->SetTempFloat(60.0f);
+ mpEnemy->ChangeState(STATE_EAT);
+ } else {
+ mpEnemy->ChangeState(STATE_FLEE);
+ }
+ } else {
+ mpEnemy->ChangeState(STATE_FLEE);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Attack::OnPostSceneDraw() {
+ cCamera3D *pCamera = static_cast<cCamera3D *>(mpInit->mpGame->GetScene()->GetCamera());
+
+ cVector3f vPos = mpMover->GetCharBody()->GetPosition() +
+ mpMover->GetCharBody()->GetForward() *
+ mpEnemyDog->mfAttackDamageRange;
+
+ cVector3f vRot = cVector3f(0, mpMover->GetCharBody()->GetYaw(), 0);
+ cMatrixf mtxOffset = cMath::MatrixRotate(vRot, eEulerRotationOrder_XYZ);
+ mtxOffset.SetTranslation(vPos);
+
+ cMatrixf mtxCollider = cMath::MatrixMul(pCamera->GetViewMatrix(), mtxOffset);
+
+ mpInit->mpGame->GetGraphics()->GetLowLevel()->SetMatrix(eMatrix_ModelView, mtxCollider);
+
+ cVector3f vSize = mpEnemyDog->GetAttackShape()->GetSize();
+ mpInit->mpGame->GetGraphics()->GetLowLevel()->DrawBoxMaxMin(vSize * 0.5f, vSize * -0.5f,
+ cColor(1, 0, 1, 1));
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// FLEE STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Flee::OnEnterState(iGameEnemyState *apPrevState) {
+ // Animation
+ mpEnemy->UseMoveStateAnimations();
+
+ // Setup body
+ mpEnemy->SetupBody();
+ mpMover->GetCharBody()->SetMaxPositiveMoveSpeed(eCharDir_Forward, mpEnemyDog->mfHuntSpeed);
+ mpMover->GetCharBody()->SetMaxNegativeMoveSpeed(eCharDir_Forward, -mpEnemyDog->mfFleeBackSpeed);
+
+ float fPosMul = 1;
+ if (apPrevState->GetId() == STATE_KNOCKDOWN)
+ fPosMul = 4.0f;
+
+ mbBackingFromBreakDoor = false;
+ if (apPrevState->GetId() == STATE_BREAKDOOR)
+ mbBackingFromBreakDoor = true;
+
+ ///////////////////////////////////////
+ // The dog has just broken a door
+ if (mbBackingFromBreakDoor) {
+ mfBackAngle = mpMover->GetCharBody()->GetYaw();
+ mbBackwards = true;
+
+ mfTimer = mpEnemyDog->mfFleeBackTime;
+ mfCheckBehindTime = 1.0f / 10.0f;
+ }
+ ///////////////////////////////////////
+ // Normal flee
+ else {
+ if ((apPrevState->GetId() == STATE_KNOCKDOWN || apPrevState->GetId() == STATE_HUNT ||
+ cMath::RandRectf(0, 1) < 0) // mpEnemyDog->mfFleePositionChance)
+ ) {
+ cAINode *pNode = mpMover->GetAINodeInRange(mpEnemyDog->mfFleePositionMinDistance * fPosMul,
+ mpEnemyDog->mfFleePositionMaxDistance * fPosMul);
+ if (pNode) {
+ mpMover->MoveToPos(pNode->GetPosition());
+ } else {
+ mpEnemy->ChangeState(STATE_HUNT);
+ }
+ mfTimer = mpEnemyDog->mfFleePositionMaxTime;
+ mbBackwards = false;
+ } else if (cMath::RandRectf(0, 1) < mpEnemyDog->mfFleeBackChance) {
+ mfBackAngle = mpMover->GetCharBody()->GetYaw();
+ mbBackwards = true;
+
+ mfTimer = mpEnemyDog->mfFleeBackTime;
+ mfCheckBehindTime = 1.0f / 10.0f;
+ } else {
+ mpEnemy->ChangeState(STATE_HUNT);
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Flee::OnLeaveState(iGameEnemyState *apNextState) {
+ mpMover->ResetStuckCounter();
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Flee::OnUpdate(float afTimeStep) {
+ mfTimer -= afTimeStep;
+
+ if (mbBackwards) {
+ if (mfCheckBehindTime <= 0) {
+ mfCheckBehindTime = 1.0f / 20.0f;
+
+ bool bHit = mpEnemy->GetGroundFinder()->GetGround(mpMover->GetCharBody()->GetPosition(),
+ mpMover->GetCharBody()->GetForward() * -1,
+ NULL, NULL, 1.9f);
+ if (bHit) {
+ if (mbBackingFromBreakDoor) {
+ if (mlPreviousState == STATE_FLEE)
+ mpEnemy->ChangeState(STATE_HUNT);
+ else
+ mpEnemy->ChangeState(mlPreviousState);
+ } else {
+ mpEnemy->ChangeState(STATE_HUNT);
+ }
+ }
+ } else {
+ mfCheckBehindTime -= afTimeStep;
+ }
+
+ if (mfTimer <= 0) {
+ if (mbBackingFromBreakDoor)
+ mpEnemy->ChangeState(mlPreviousState);
+ else
+ mpEnemy->ChangeState(STATE_HUNT);
+ }
+ mpMover->GetCharBody()->Move(eCharDir_Forward, -1.0f, afTimeStep);
+ mpMover->TurnToPos(mpInit->mpPlayer->GetCharacterBody()->GetFeetPosition());
+ } else {
+ // Move forward
+ if (mpMover->IsMoving() == false || mpMover->GetStuckCounter() > 0.3f || mfTimer <= 0) {
+ // Check if there is any enemies nearaby and if anyone is allready fighting
+ if (mpEnemy->CheckForTeamMate(mpEnemyDog->mfCallBackupRange * 1.5f, false) &&
+ mpEnemy->CheckForTeamMate(8, true) == false) {
+ float fPlayerDist = mpMover->DistanceToChar(mpInit->mpPlayer->GetCharacterBody());
+ // Log("Dist: %f\n",fPlayerDist);
+ if (fPlayerDist > 8) {
+ mpEnemy->ChangeState(STATE_CALLBACKUP);
+ } else {
+ mpEnemy->ChangeState(STATE_HUNT);
+ }
+ // Log("Back from flee!!\n");
+ } else {
+ // if(mpInit->mpMusicHandler->AttackerExist(mpEnemy))
+ {
+ mpEnemy->ChangeState(STATE_HUNT);
+ }
+ // else
+ //{
+ // mpEnemy->ChangeState(STATE_IDLE);
+ // }
+ }
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// CALL BACKUP STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_CallBackup::OnEnterState(iGameEnemyState *apPrevState) {
+ // Animation
+ mpEnemy->PlayAnim(mpEnemyDog->msCallBackupAnimation, false, 0.2f);
+
+ // Sound
+ mpEnemyDog->PlaySound(mpEnemyDog->msCallBackupSound);
+
+ // Iterate enemies and show them the player
+ cVector3f vPostion = mpMover->GetCharBody()->GetFeetPosition();
+
+ tGameEnemyIterator it = mpInit->mpMapHandler->GetGameEnemyIterator();
+ while (it.HasNext()) {
+ iGameEnemy *pEnemy = it.Next();
+ if (pEnemy->GetEnemyType() != mpEnemy->GetEnemyType())
+ continue;
+ if (pEnemy == mpEnemy || pEnemy->IsActive() == false || pEnemy->GetHealth() <= 0)
+ continue;
+
+ cGameEnemy_Dog *pDog = static_cast<cGameEnemy_Dog *>(pEnemy);
+
+ float fDist = cMath::Vector3Dist(pDog->GetMover()->GetCharBody()->GetPosition(),
+ vPostion);
+
+ if (fDist <= mpEnemyDog->mfCallBackupRange) {
+ pDog->ShowPlayer(mpEnemyDog->GetLastPlayerPos());
+ break; // Call only for one dog backup!
+ }
+ }
+
+ mpMover->Stop();
+ mpMover->GetCharBody()->SetMoveSpeed(eCharDir_Forward, 0);
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_CallBackup::OnLeaveState(iGameEnemyState *apNextState) {
+ mpMover->ResetStuckCounter();
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_CallBackup::OnUpdate(float afTimeStep) {
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_CallBackup::OnAnimationOver(const tString &asName) {
+ mpEnemy->ChangeState(STATE_HUNT);
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// BREAK DOOR STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_BreakDoor::OnEnterState(iGameEnemyState *apPrevState) {
+ // Setup body
+ mpEnemy->SetupBody();
+ if (mpEnemyDog->mfBreakDoorSpeed > 0)
+ mpMover->GetCharBody()->SetMaxPositiveMoveSpeed(eCharDir_Forward, mpEnemyDog->mfBreakDoorSpeed);
+
+ // Animation
+ mpEnemy->PlayAnim(mpEnemyDog->msBreakDoorAnimation, false, 0.2f);
+
+ mpEnemyDog->PlaySound(mpEnemyDog->msBreakDoorStartSound);
+
+ mfDamageTimer = mpEnemyDog->mfBreakDoorDamageTime;
+ mfStopMoveTimer = mpEnemyDog->mfBreakDoorDamageTime + 1.1f;
+ mbAttacked = false;
+ mbStopped = false;
+
+ mlCount = 0;
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_BreakDoor::OnLeaveState(iGameEnemyState *apNextState) {
+ mpEnemyDog->SetSkipSoundTriggerCount(2.0f);
+ mpMover->ResetStuckCounter();
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_BreakDoor::OnUpdate(float afTimeStep) {
+ // Move forward
+ if (mpEnemyDog->mfBreakDoorSpeed > 0 && mlCount == 0 && mbAttacked == false) {
+ // Skip this for now
+ // mpMover->GetCharBody()->Move(eCharDir_Forward,1.0f,afTimeStep);
+ }
+
+ if (mfDamageTimer <= 0) {
+ if (!mbStopped) {
+ mpMover->Stop();
+ mbStopped = true;
+ }
+ } else {
+ mfDamageTimer -= afTimeStep;
+ }
+
+ if (mfDamageTimer <= 0) {
+ if (mbAttacked == false) {
+ cVector3f vPos = mpMover->GetCharBody()->GetPosition() +
+ mpMover->GetCharBody()->GetForward() *
+ mpEnemyDog->mfBreakDoorDamageRange;
+
+ cVector3f vRot = cVector3f(0, mpMover->GetCharBody()->GetYaw(), 0);
+ cMatrixf mtxOffset = cMath::MatrixRotate(vRot, eEulerRotationOrder_XYZ);
+ mtxOffset.SetTranslation(vPos);
+
+ eAttackTargetFlag target = eAttackTargetFlag_Player | eAttackTargetFlag_Bodies;
+
+ if (mpInit->mpAttackHandler->CreateShapeAttack(mpEnemyDog->GetBreakDoorShape(),
+ mtxOffset,
+ mpMover->GetCharBody()->GetPosition(),
+ cMath::RandRectf(mpEnemyDog->mfBreakDoorMinDamage,
+ mpEnemyDog->mfBreakDoorMaxDamage),
+
+ mpEnemyDog->mfBreakDoorMinMass, mpEnemyDog->mfBreakDoorMaxMass,
+ mpEnemyDog->mfBreakDoorMinImpulse, mpEnemyDog->mfBreakDoorMaxImpulse,
+
+ mpEnemyDog->mlBreakDoorStrength,
+
+ target, NULL)) {
+ mpEnemyDog->PlaySound(mpEnemyDog->msBreakDoorHitSound);
+
+ cGameSwingDoor *pDoor = mpInit->mpAttackHandler->GetLastSwingDoor();
+ if (pDoor) {
+ /////////////////////////////
+ // The door is unbreakable
+ if (pDoor->GetToughness() - mpEnemyDog->mlBreakDoorStrength >= 4) {
+ cMatrixf mtxDoor = pDoor->GetBody(0)->GetWorldMatrix();
+ cMatrixf mtxInvDoor = cMath::MatrixInverse(mtxDoor);
+
+ cVector3f vDoorForward = mtxInvDoor.GetForward();
+ cVector3f vEnemyForward = mpMover->GetCharBody()->GetForward();
+
+ if (cMath::Vector3Dot(vDoorForward, vEnemyForward) < 0) {
+ mpEnemy->AddDoorBreakCount(2); // 8);
+ // mpInit->mpEffectHandler->GetSubTitle()->Add("Cannot break this door! On BAD side",4);
+ } else {
+ mpEnemy->AddDoorBreakCount(2);
+ // Just continue hitting it since it is just barricaded.
+ // mpInit->mpEffectHandler->GetSubTitle()->Add("Cannot break this door! On GOOD side",4);
+ }
+ }
+ /////////////////////////////
+ // The door is breakable
+ else {
+ mpEnemy->AddDoorBreakCount(2);
+ }
+ }
+ }
+ mbAttacked = true;
+ }
+ } else {
+ mfDamageTimer -= afTimeStep;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_BreakDoor::OnAnimationOver(const tString &asName) {
+ if (mlCount == 0) {
+ if (mpEnemyDog->mbBreakDoorRiseAtEnd) {
+ mpEnemy->PlayAnim("RiseRight", false, 0.2f);
+ mlCount++;
+ } else {
+ // mpEnemy->ChangeState(mlPreviousState);
+ mpEnemy->ChangeState(STATE_FLEE);
+ mpEnemy->GetState(STATE_FLEE)->SetPreviousState(mlPreviousState);
+ }
+ } else {
+ // mpEnemy->ChangeState(mlPreviousState);
+ mpEnemy->ChangeState(STATE_FLEE);
+ mpEnemy->GetState(STATE_FLEE)->SetPreviousState(mlPreviousState);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_BreakDoor::OnPostSceneDraw() {
+ cCamera3D *pCamera = static_cast<cCamera3D *>(mpInit->mpGame->GetScene()->GetCamera());
+
+ cVector3f vPos = mpMover->GetCharBody()->GetPosition() +
+ mpMover->GetCharBody()->GetForward() *
+ mpEnemyDog->mfBreakDoorDamageRange;
+
+ cVector3f vRot = cVector3f(0, mpMover->GetCharBody()->GetYaw(), 0);
+ cMatrixf mtxOffset = cMath::MatrixRotate(vRot, eEulerRotationOrder_XYZ);
+ mtxOffset.SetTranslation(vPos);
+
+ cMatrixf mtxCollider = cMath::MatrixMul(pCamera->GetViewMatrix(), mtxOffset);
+
+ mpInit->mpGame->GetGraphics()->GetLowLevel()->SetMatrix(eMatrix_ModelView, mtxCollider);
+
+ cVector3f vSize = mpEnemyDog->GetBreakDoorShape()->GetSize();
+ mpInit->mpGame->GetGraphics()->GetLowLevel()->DrawBoxMaxMin(vSize * 0.5f, vSize * -0.5f,
+ cColor(1, 0, 1, 1));
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// KNOCK DOWN STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_KnockDown::OnEnterState(iGameEnemyState *apPrevState) {
+ // Animation
+ mpEnemy->PlayAnim("Idle", true, 0.7f);
+
+ // Sound
+ mpEnemy->PlaySound(mpEnemyDog->msKnockDownSound);
+
+ // Setup body
+ mpEnemy->SetupBody();
+
+ // Go to rag doll
+ mpEnemy->GetMeshEntity()->AlignBodiesToSkeleton(false);
+ mpEnemy->GetMeshEntity()->SetSkeletonPhysicsActive(true);
+ mpEnemy->GetMeshEntity()->Stop();
+
+ mpEnemy->GetMover()->GetCharBody()->SetEntity(NULL);
+ mpEnemy->GetMover()->GetCharBody()->SetActive(false);
+
+ mpEnemy->GetMover()->Stop();
+
+ mfTimer = 2.0f;
+ mbCheckAnim = false;
+
+ mlPrevToughness = mpEnemy->GetToughness();
+ mpEnemy->SetToughness(12);
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_KnockDown::OnLeaveState(iGameEnemyState *apNextState) {
+ mpEnemy->SetToughness(mlPrevToughness);
+
+ mpEnemy->GetMover()->GetCharBody()->SetEntity(mpEnemy->GetMeshEntity());
+ mpEnemy->GetMover()->GetCharBody()->SetActive(true);
+ mpMover->ResetStuckCounter();
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_KnockDown::OnUpdate(float afTimeStep) {
+ if (mbCheckAnim) {
+ iCharacterBody *pCharBody = mpEnemy->GetMover()->GetCharBody();
+ cBoundingVolume *pBV = pCharBody->GetBody()->GetBoundingVolume();
+
+ ////////////////////////////////////////////////
+ // Add a force to all objects around dog.
+ iPhysicsWorld *pWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+
+ std::list<iPhysicsBody *> lstBodies;
+ cPhysicsBodyIterator bodyIt = pWorld->GetBodyIterator();
+ while (bodyIt.HasNext()) {
+ lstBodies.push_back(bodyIt.Next());
+ }
+
+ //////////////////////////
+ // Force Iteration
+ std::list<iPhysicsBody *>::iterator it = lstBodies.begin();
+ for (; it != lstBodies.end(); ++it) {
+ iPhysicsBody *pBody = *it;
+
+ if (pBody->GetCollideCharacter() == false)
+ continue;
+ if (pBody->IsActive() == false)
+ continue;
+ if (pBody == pCharBody->GetBody())
+ continue;
+
+ if (cMath::CheckCollisionBV(*pBody->GetBoundingVolume(), *pBV)) {
+ cVector3f vDir = pBody->GetWorldPosition() - pCharBody->GetPosition();
+ float fLength = vDir.Length();
+ // vDir.y *= 0.1f;
+ // if(vDir.x ==0 && vDir.z ==0) vDir.x = 0.3f;
+ vDir.Normalise();
+
+ if (fLength == 0)
+ fLength = 0.001f;
+ float fForce = (1 / fLength) * 2;
+ if (fForce > 300)
+ fForce = 300;
+ if (mpInit->mpPlayer->GetState() == ePlayerState_Grab &&
+ mpInit->mpPlayer->GetPushBody() == pBody) {
+ fForce *= 40;
+ }
+
+ if (pBody->IsCharacter()) {
+ pBody->GetCharacterBody()->AddForce(vDir * fForce * 10 *
+ pBody->GetCharacterBody()->GetMass());
+ } else {
+ pBody->AddForce(vDir * fForce * pBody->GetMass());
+ }
+ }
+ }
+ } else {
+ mfTimer -= afTimeStep;
+
+ if (mfTimer <= 0) {
+ // Get the forward vector from root bone (the right vector)
+ cNodeIterator StateIt = mpEnemy->GetMeshEntity()->GetRootNode()->GetChildIterator();
+ cBoneState *pBoneState = static_cast<cBoneState *>(StateIt.Next());
+
+ cVector3f vRight = cMath::MatrixInverse(pBoneState->GetWorldMatrix()).GetForward();
+
+ // Play animation and fade physics
+ float fFadeTime = 1.0f;
+ mbCheckAnim = true;
+
+ mpEnemy->GetMeshEntity()->Stop();
+ if (cMath::Vector3Dot(vRight, cVector3f(0, 1, 0)) < 0)
+ mpEnemy->PlayAnim("RiseRight", false, fFadeTime);
+ else
+ mpEnemy->PlayAnim("RiseLeft", false, fFadeTime);
+
+ mpEnemy->GetMeshEntity()->FadeSkeletonPhysicsWeight(fFadeTime);
+
+ // Calculate values
+ cVector3f vPosition;
+ cVector3f vAngles;
+ cMatrixf mtxTransform = mpEnemy->GetMeshEntity()->CalculateTransformFromSkeleton(&vPosition, &vAngles);
+
+ // Seems to work better...
+ vPosition = mpEnemy->GetMeshEntity()->GetBoundingVolume()->GetWorldCenter();
+ cVector3f vGroundPos = vPosition;
+
+ bool bFoundGround = mpEnemy->GetGroundFinder()->GetGround(vPosition, cVector3f(0, -1, 0), &vGroundPos, NULL);
+
+ // Log("Found ground: %d | %s -> %s\n",bFoundGround,vPosition.ToString().c_str(),
+ // vGroundPos.ToString().c_str());
+
+ // Set body
+ iCharacterBody *pCharBody = mpEnemy->GetMover()->GetCharBody();
+
+ // vGroundPos -= pCharBody->GetEntityOffset().GetTranslation();
+ float fYAngle = vAngles.y - mpEnemy->GetModelOffsetAngles().y;
+ // cVector3f vAdd = cVector3f(0,0,pCharBody->GetEntityOffset().GetTranslation().z);
+ // vAdd = cMath::MatrixMul(cMath::MatrixRotateY(fYAngle),vAdd);
+ // vGroundPos += vAdd;
+ pCharBody->SetFeetPosition(vGroundPos);
+ pCharBody->SetYaw(fYAngle);
+ pCharBody->SetEntity(mpEnemy->GetMeshEntity());
+ pCharBody->SetActive(true);
+ // pCharBody->Update(1.0f / 60.0f);
+ // pCharBody->SetActive(false);
+
+ for (int i = 0; i < 3; ++i) {
+ pCharBody->Update(1.0f / 60.0f);
+
+ mpEnemy->GetMeshEntity()->UpdateLogic(1.0f / 60.0f);
+ mpEnemy->GetMeshEntity()->UpdateGraphics(NULL, 1.0f / 60.0f, NULL);
+ }
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_KnockDown::OnAnimationOver(const tString &asName) {
+ iCharacterBody *pCharBody = mpEnemy->GetMover()->GetCharBody();
+
+ if (mpEnemy->CheckForTeamMate(mpEnemyDog->mfCallBackupRange * 1.5f, false) &&
+ mpEnemy->CheckForTeamMate(14, true) == false) {
+ pCharBody->SetActive(true);
+ mpEnemy->ChangeState(STATE_FLEE);
+ } else {
+ pCharBody->SetActive(true);
+ // mpEnemy->ChangeState(STATE_HUNT);
+ mpEnemy->ChangeState(STATE_FLEE);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// DEAD STATE
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Dead::OnEnterState(iGameEnemyState *apPrevState) {
+ // Animation
+ mpEnemy->PlayAnim("Idle", true, 0.7f);
+
+ // Sound
+ if (mpEnemy->IsLoading() == false)
+ mpEnemy->PlaySound(mpEnemyDog->msDeathSound);
+
+ // Setup body
+ mpEnemy->SetupBody();
+
+ // Go to ragdoll
+ if (mpEnemy->IsLoading() == false)
+ mpEnemy->GetMeshEntity()->AlignBodiesToSkeleton(false);
+
+ mpEnemy->GetMeshEntity()->SetSkeletonPhysicsActive(true);
+ mpEnemy->GetMeshEntity()->Stop();
+
+ mpEnemy->GetMover()->GetCharBody()->SetEntity(NULL);
+ mpEnemy->GetMover()->GetCharBody()->SetActive(false);
+
+ mpEnemy->GetMover()->Stop();
+
+ mpInit->mpMusicHandler->RemoveAttacker(mpEnemy);
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Dead::OnLeaveState(iGameEnemyState *apNextState) {
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemyState_Dog_Dead::OnUpdate(float afTimeStep) {
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+cGameEnemy_Dog::cGameEnemy_Dog(cInit *apInit, const tString &asName, TiXmlElement *apGameElem) : iGameEnemy(apInit, asName, apGameElem) {
+ LoadBaseProperties(apGameElem);
+
+ //////////////////////////////
+ // Special properties
+
+ mfLengthBodyToAss = cString::ToFloat(apGameElem->Attribute("LengthBodyToAss"), 1.5f);
+
+ mfMinKnockDamage = cString::ToFloat(apGameElem->Attribute("MinKnockDamage"), 0);
+ mfCertainKnockDamage = cString::ToFloat(apGameElem->Attribute("CertainKnockDamage"), 0);
+
+ //////////////////////////////
+ // State properties
+ mfIdleFOV = cMath::ToRad(cString::ToFloat(apGameElem->Attribute("IdleFOV"), 0));
+ msIdleFoundPlayerSound = cString::ToString(apGameElem->Attribute("IdleFoundPlayerSound"), "");
+ mfIdleMinSeeChance = cString::ToFloat(apGameElem->Attribute("IdleMinSeeChance"), 0);
+ mfIdleMinHearVolume = cString::ToFloat(apGameElem->Attribute("IdleMinHearVolume"), 0);
+ msIdleSound = cString::ToString(apGameElem->Attribute("IdleSound"), "");
+ mfIdleSoundMinInteraval = cString::ToFloat(apGameElem->Attribute("IdleSoundMinInteraval"), 0);
+ mfIdleSoundMaxInteraval = cString::ToFloat(apGameElem->Attribute("IdleSoundMaxInteraval"), 0);
+ mfIdleCallBackupChance = cString::ToFloat(apGameElem->Attribute("IdleCallBackupChance"), 0);
+ mvPreloadSounds.push_back(msIdleSound);
+
+ msInvestigateSound = cString::ToString(apGameElem->Attribute("InvestigateSound"), "");
+ mvPreloadSounds.push_back(msInvestigateSound);
+
+ msAttentionSound = cString::ToString(apGameElem->Attribute("AttentionSound"), "");
+ mfAttentionTime = cString::ToFloat(apGameElem->Attribute("AttentionTime"), 0);
+ mfAttentionMinDist = cString::ToFloat(apGameElem->Attribute("AttentionMinDist"), 0);
+ mvPreloadSounds.push_back(msAttentionSound);
+
+ mfHuntFOV = cMath::ToRad(cString::ToFloat(apGameElem->Attribute("HuntFOV"), 0));
+ mfHuntSpeed = cString::ToFloat(apGameElem->Attribute("HuntSpeed"), 0);
+ mfHuntForLostPlayerTime = cString::ToFloat(apGameElem->Attribute("HuntForLostPlayerTime"), 0);
+ mfHuntMinSeeChance = cString::ToFloat(apGameElem->Attribute("IdleMinSeeChance"), 0);
+ mfHuntMinHearVolume = cString::ToFloat(apGameElem->Attribute("IdleMinHearVolume"), 0);
+
+ mfAttackDistance = cString::ToFloat(apGameElem->Attribute("AttackDistance"), 0);
+ mfAttackSpeed = cString::ToFloat(apGameElem->Attribute("AttackSpeed"), 0);
+ mfAttackJumpTime = cString::ToFloat(apGameElem->Attribute("AttackJumpTime"), 0);
+ mfAttackDamageTime = cString::ToFloat(apGameElem->Attribute("AttackDamageTime"), 0);
+ mvAttackDamageSize = cString::ToVector3f(apGameElem->Attribute("AttackDamageSize"), 0);
+ mfAttackDamageRange = cString::ToFloat(apGameElem->Attribute("AttackDamageRange"), 0);
+ mfAttackMinDamage = cString::ToFloat(apGameElem->Attribute("AttackMinDamage"), 0);
+ mfAttackMaxDamage = cString::ToFloat(apGameElem->Attribute("AttackMaxDamage"), 0);
+ msAttackStartSound = cString::ToString(apGameElem->Attribute("AttackStartSound"), "");
+ msAttackHitSound = cString::ToString(apGameElem->Attribute("AttackHitSound"), "");
+ mfAttackMinMass = cString::ToFloat(apGameElem->Attribute("AttackMinMass"), 0);
+ mfAttackMaxMass = cString::ToFloat(apGameElem->Attribute("AttackMaxMass"), 0);
+ mfAttackMinImpulse = cString::ToFloat(apGameElem->Attribute("AttackMinImpulse"), 0);
+ mfAttackMaxImpulse = cString::ToFloat(apGameElem->Attribute("AttackMaxImpulse"), 0);
+ mlAttackStrength = cString::ToInt(apGameElem->Attribute("AttackStrength"), 0);
+ mvPreloadSounds.push_back(msAttackStartSound);
+ mvPreloadSounds.push_back(msAttackHitSound);
+
+ msBreakDoorAnimation = cString::ToString(apGameElem->Attribute("BreakDoorAnimation"), "");
+ mfBreakDoorSpeed = cString::ToFloat(apGameElem->Attribute("BreakDoorSpeed"), 0);
+ mfBreakDoorDamageTime = cString::ToFloat(apGameElem->Attribute("BreakDoorDamageTime"), 0);
+ mvBreakDoorDamageSize = cString::ToVector3f(apGameElem->Attribute("BreakDoorDamageSize"), 0);
+ mfBreakDoorDamageRange = cString::ToFloat(apGameElem->Attribute("BreakDoorDamageRange"), 0);
+ mfBreakDoorMinDamage = cString::ToFloat(apGameElem->Attribute("BreakDoorMinDamage"), 0);
+ mfBreakDoorMaxDamage = cString::ToFloat(apGameElem->Attribute("BreakDoorMaxDamage"), 0);
+ msBreakDoorStartSound = cString::ToString(apGameElem->Attribute("BreakDoorStartSound"), "");
+ msBreakDoorHitSound = cString::ToString(apGameElem->Attribute("BreakDoorHitSound"), "");
+ mfBreakDoorMinMass = cString::ToFloat(apGameElem->Attribute("BreakDoorMinMass"), 0);
+ mfBreakDoorMaxMass = cString::ToFloat(apGameElem->Attribute("BreakDoorMaxMass"), 0);
+ mfBreakDoorMinImpulse = cString::ToFloat(apGameElem->Attribute("BreakDoorMinImpulse"), 0);
+ mfBreakDoorMaxImpulse = cString::ToFloat(apGameElem->Attribute("BreakDoorMaxImpulse"), 0);
+ mlBreakDoorStrength = cString::ToInt(apGameElem->Attribute("BreakDoorStrength"), 0);
+ mbBreakDoorRiseAtEnd = cString::ToBool(apGameElem->Attribute("BreakDoorRiseAtEnd"), false);
+ mvPreloadSounds.push_back(msBreakDoorStartSound);
+ mvPreloadSounds.push_back(msBreakDoorHitSound);
+
+ msKnockDownSound = cString::ToString(apGameElem->Attribute("KnockDownSound"), "");
+ mvPreloadSounds.push_back(msKnockDownSound);
+
+ msDeathSound = cString::ToString(apGameElem->Attribute("DeathSound"), "");
+ mvPreloadSounds.push_back(msDeathSound);
+
+ mfFleePositionChance = cString::ToFloat(apGameElem->Attribute("FleePositionChance"), 0);
+ mfFleePositionMaxTime = cString::ToFloat(apGameElem->Attribute("FleePositionMaxTime"), 0);
+ mfFleePositionMinDistance = cString::ToFloat(apGameElem->Attribute("FleePositionMinDistance"), 0);
+ mfFleePositionMaxDistance = cString::ToFloat(apGameElem->Attribute("FleePositionMaxDistance"), 0);
+ mfFleeBackChance = cString::ToFloat(apGameElem->Attribute("FleeBackChance"), 0);
+ mfFleeBackTime = cString::ToFloat(apGameElem->Attribute("FleeBackTime"), 0);
+ mfFleeBackSpeed = cString::ToFloat(apGameElem->Attribute("FleeBackSpeed"), 0);
+
+ msCallBackupAnimation = cString::ToString(apGameElem->Attribute("CallBackupAnimation"), "");
+ msCallBackupSound = cString::ToString(apGameElem->Attribute("CallBackupSound"), "");
+ mfCallBackupRange = cString::ToFloat(apGameElem->Attribute("CallBackupRange"), 0);
+ mvPreloadSounds.push_back(msCallBackupSound);
+
+ mfEatFOV = cMath::ToRad(cString::ToFloat(apGameElem->Attribute("EatFOV"), 0));
+ mfEatMinSeeChance = cString::ToFloat(apGameElem->Attribute("EatMinSeeChance"), 0);
+ mfEatMinHearVolume = cString::ToFloat(apGameElem->Attribute("EatMinHearVolume"), 0);
+
+ //////////////////////////////
+ // Set up states
+ AddState(hplNew(cGameEnemyState_Dog_Idle, (STATE_IDLE, mpInit, this)));
+ AddState(hplNew(cGameEnemyState_Dog_Hunt, (STATE_HUNT, mpInit, this)));
+ AddState(hplNew(cGameEnemyState_Dog_Attack, (STATE_ATTACK, mpInit, this)));
+ AddState(hplNew(cGameEnemyState_Dog_Flee, (STATE_FLEE, mpInit, this)));
+ AddState(hplNew(cGameEnemyState_Dog_KnockDown, (STATE_KNOCKDOWN, mpInit, this)));
+ AddState(hplNew(cGameEnemyState_Dog_Dead, (STATE_DEAD, mpInit, this)));
+ AddState(hplNew(cGameEnemyState_Dog_Patrol, (STATE_PATROL, mpInit, this)));
+ AddState(hplNew(cGameEnemyState_Dog_Investigate, (STATE_INVESTIGATE, mpInit, this)));
+ AddState(hplNew(cGameEnemyState_Dog_BreakDoor, (STATE_BREAKDOOR, mpInit, this)));
+ AddState(hplNew(cGameEnemyState_Dog_CallBackup, (STATE_CALLBACKUP, mpInit, this)));
+ AddState(hplNew(cGameEnemyState_Dog_MoveTo, (STATE_MOVETO, mpInit, this)));
+ AddState(hplNew(cGameEnemyState_Dog_Eat, (STATE_EAT, mpInit, this)));
+ AddState(hplNew(cGameEnemyState_Dog_Attention, (STATE_ATTENTION, mpInit, this)));
+}
+
+//-----------------------------------------------------------------------
+
+cGameEnemy_Dog::~cGameEnemy_Dog() {
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void cGameEnemy_Dog::OnLoad() {
+ // Create attack shape
+ iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+ mpAttackShape = pPhysicsWorld->CreateBoxShape(mvAttackDamageSize, NULL);
+ mpBreakDoorShape = pPhysicsWorld->CreateBoxShape(mvBreakDoorDamageSize, NULL);
+
+ // Set up shape
+ ChangeState(STATE_IDLE);
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemy_Dog::OnUpdate(float afTimeStep) {
+ if (IsActive() == false)
+ return;
+
+ ///////////////////////////////////
+ // Regenerate health:
+ if (mfHealth > 0) {
+ if (mpInit->mDifficulty != eGameDifficulty_Easy &&
+ mfHealth <= mfMaxHealth * 0.5f) {
+ mfHealth += afTimeStep * (10.0f / 60.0f); // 10 heal units / min
+ }
+ }
+
+ ///////////////////////////////////
+ // Check for ass in wall
+ if (mfHealth > 0 && mpMover->GetCharBody()->IsActive()) {
+ float fMaxMove = afTimeStep * 2;
+ static int lAssCount = 0;
+ lAssCount++;
+ if (lAssCount % 2 == 0) {
+ iCharacterBody *pCharBody = mpMover->GetCharBody();
+
+ cVector3f vPos, vNormal;
+ mFindGround.GetGround(pCharBody->GetPosition(), pCharBody->GetForward() * -1,
+ &vPos, &vNormal, mfLengthBodyToAss);
+ float fDist = cMath::Vector3Dist(pCharBody->GetPosition(), vPos);
+ if (fDist < mfLengthBodyToAss) {
+ float fAdd = mfLengthBodyToAss - fDist;
+ if (fAdd > fMaxMove)
+ fAdd = fMaxMove;
+
+ cVector3f vAdd = pCharBody->GetForward() * fAdd;
+ pCharBody->SetPosition(pCharBody->GetPosition() + vAdd);
+ }
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void cGameEnemy_Dog::ShowPlayer(const cVector3f &avPlayerFeetPos) {
+ if (mlCurrentState == STATE_IDLE || mlCurrentState == STATE_PATROL ||
+ mlCurrentState == STATE_INVESTIGATE) {
+ mvLastPlayerPos = avPlayerFeetPos;
+ ChangeState(STATE_HUNT);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+bool cGameEnemy_Dog::MoveToPos(const cVector3f &avFeetPos) {
+ if (mlCurrentState == STATE_IDLE || mlCurrentState == STATE_PATROL) {
+ SetTempPosition(avFeetPos);
+ ChangeState(STATE_MOVETO);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+//-----------------------------------------------------------------------
+
+bool cGameEnemy_Dog::IsFighting() {
+ if (mfHealth <= 0 || IsActive() == false)
+ return false;
+ if (mlCurrentState == STATE_IDLE || mlCurrentState == STATE_PATROL ||
+ mlCurrentState == STATE_INVESTIGATE)
+ return false;
+
+ return true;
+}
+
+//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Dog.h b/engines/hpl1/penumbra-overture/GameEnemy_Dog.h
new file mode 100644
index 00000000000..2b622501dc7
--- /dev/null
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Dog.h
@@ -0,0 +1,462 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of Penumbra Overture.
+ */
+
+#ifndef GAME_GAME_ENEMY_DOG_H
+#define GAME_GAME_ENEMY_DOG_H
+
+#include "hpl1/engine/engine.h"
+#include "hpl1/penumbra-overture/GameEnemy.h"
+
+using namespace hpl;
+
+//-----------------------------------------
+
+class cGameEnemy_Dog;
+
+// BASE STATE
+class iGameEnemyState_Dog_Base : public iGameEnemyState {
+public:
+ iGameEnemyState_Dog_Base(int alId, cInit *apInit, iGameEnemy *apEnemy);
+
+ virtual void OnSeePlayer(const cVector3f &avPosition, float afChance);
+ virtual bool OnHearNoise(const cVector3f &avPosition, float afVolume);
+ virtual void OnTakeHit(float afDamage);
+ virtual void OnDeath(float afDamage);
+ virtual void OnFlashlight(const cVector3f &avPosition);
+
+ virtual void OnAnimationOver(const tString &asAnimName) {}
+
+ virtual void OnDraw() {}
+ virtual void OnPostSceneDraw() {}
+
+protected:
+ cGameEnemy_Dog *mpEnemyDog;
+};
+
+//-----------------------------------------
+
+// IDLE STATE
+class cGameEnemyState_Dog_Idle : public iGameEnemyState_Dog_Base {
+public:
+ cGameEnemyState_Dog_Idle(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Dog_Base(alId, apInit, apEnemy) {}
+
+ void OnEnterState(iGameEnemyState *apPrevState);
+ void OnLeaveState(iGameEnemyState *apNextState);
+
+ void OnUpdate(float afTimeStep);
+};
+
+//-----------------------------------------
+
+// ATTENTION STATE
+class cGameEnemyState_Dog_Attention : public iGameEnemyState_Dog_Base {
+public:
+ cGameEnemyState_Dog_Attention(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Dog_Base(alId, apInit, apEnemy) {}
+
+ void OnEnterState(iGameEnemyState *apPrevState);
+ void OnLeaveState(iGameEnemyState *apNextState);
+
+ void OnUpdate(float afTimeStep);
+
+ void OnSeePlayer(const cVector3f &avPosition, float afChance);
+ bool OnHearNoise(const cVector3f &avPosition, float afVolume);
+ void OnFlashlight(const cVector3f &avPosition);
+
+ void OnDraw();
+
+private:
+ float mfTime;
+};
+
+//-----------------------------------------
+
+// HUNT STATE
+class cGameEnemyState_Dog_Hunt : public iGameEnemyState_Dog_Base {
+public:
+ cGameEnemyState_Dog_Hunt(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Dog_Base(alId, apInit, apEnemy) {
+ mbBreakingDoor = false;
+ }
+
+ void OnEnterState(iGameEnemyState *apPrevState);
+ void OnLeaveState(iGameEnemyState *apNextState);
+
+ void OnUpdate(float afTimeStep);
+
+ void OnSeePlayer(const cVector3f &avPosition, float afChance);
+ bool OnHearNoise(const cVector3f &avPosition, float afVolume);
+ void OnFlashlight(const cVector3f &avPosition) {}
+
+ void OnDraw();
+
+private:
+ float mfUpdatePathCount;
+ float mfUpdateFreq;
+ bool mbFreePlayerPath;
+ bool mbLostPlayer;
+ float mfLostPlayerCount;
+ float mfMaxLostPlayerCount;
+ bool mbFoundNoPath;
+
+ int mlStuckAtMaxCount;
+
+ int mlBreakDoorCount;
+ bool mbBreakingDoor;
+};
+
+//-----------------------------------------
+
+// ATTACK STATE
+class cGameEnemyState_Dog_Attack : public iGameEnemyState_Dog_Base {
+public:
+ cGameEnemyState_Dog_Attack(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Dog_Base(alId, apInit, apEnemy) {}
+
+ void OnEnterState(iGameEnemyState *apPrevState);
+ void OnLeaveState(iGameEnemyState *apNextState);
+
+ void OnUpdate(float afTimeStep);
+
+ void OnAnimationOver(const tString &asName);
+
+ void OnPostSceneDraw();
+
+ void OnSeePlayer(const cVector3f &avPosition, float afChance) {}
+ bool OnHearNoise(const cVector3f &avPosition, float afVolume) { return false; }
+ void OnFlashlight(const cVector3f &avPosition) {}
+
+private:
+ float mfDamageTimer;
+ float mfJumpTimer;
+ bool mbAttacked;
+};
+
+//-----------------------------------------
+
+// BREAK DOOR STATE
+class cGameEnemyState_Dog_BreakDoor : public iGameEnemyState_Dog_Base {
+public:
+ cGameEnemyState_Dog_BreakDoor(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Dog_Base(alId, apInit, apEnemy) {}
+
+ void OnEnterState(iGameEnemyState *apPrevState);
+ void OnLeaveState(iGameEnemyState *apNextState);
+
+ void OnUpdate(float afTimeStep);
+
+ void OnAnimationOver(const tString &asName);
+
+ void OnPostSceneDraw();
+
+ void OnSeePlayer(const cVector3f &avPosition, float afChance) {}
+ bool OnHearNoise(const cVector3f &avPosition, float afVolume) { return false; }
+ void OnFlashlight(const cVector3f &avPosition) {}
+
+private:
+ float mfDamageTimer;
+ float mfStopMoveTimer;
+ bool mbAttacked;
+ bool mbStopped;
+ int mlCount;
+};
+
+//-----------------------------------------
+
+// FLEE STATE
+class cGameEnemyState_Dog_Flee : public iGameEnemyState_Dog_Base {
+public:
+ cGameEnemyState_Dog_Flee(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Dog_Base(alId, apInit, apEnemy) {}
+
+ void OnEnterState(iGameEnemyState *apPrevState);
+ void OnLeaveState(iGameEnemyState *apNextState);
+
+ void OnUpdate(float afTimeStep);
+
+ bool OnHearNoise(const cVector3f &avPosition, float afVolume) { return false; }
+ void OnSeePlayer(const cVector3f &avPosition, float afChance) {}
+ void OnFlashlight(const cVector3f &avPosition) {}
+
+private:
+ float mfTimer;
+ float mfBackAngle;
+ bool mbBackwards;
+ float mfCheckBehindTime;
+ bool mbBackingFromBreakDoor;
+};
+
+//-----------------------------------------
+
+// CALL BACKUP STATE
+class cGameEnemyState_Dog_CallBackup : public iGameEnemyState_Dog_Base {
+public:
+ cGameEnemyState_Dog_CallBackup(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Dog_Base(alId, apInit, apEnemy) {}
+
+ void OnEnterState(iGameEnemyState *apPrevState);
+ void OnLeaveState(iGameEnemyState *apNextState);
+
+ void OnUpdate(float afTimeStep);
+
+ void OnSeePlayer(const cVector3f &avPosition, float afChance) {}
+ bool OnHearNoise(const cVector3f &avPosition, float afVolume) { return false; }
+ // void OnTakeHit(float afDamage){}
+ void OnFlashlight(const cVector3f &avPosition) {}
+
+ void OnAnimationOver(const tString &asName);
+
+private:
+ bool mbCheckAnim;
+};
+
+//-----------------------------------------
+
+// KNOCKDOWN STATE
+class cGameEnemyState_Dog_KnockDown : public iGameEnemyState_Dog_Base {
+public:
+ cGameEnemyState_Dog_KnockDown(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Dog_Base(alId, apInit, apEnemy) {}
+
+ void OnEnterState(iGameEnemyState *apPrevState);
+ void OnLeaveState(iGameEnemyState *apNextState);
+
+ void OnUpdate(float afTimeStep);
+
+ void OnSeePlayer(const cVector3f &avPosition, float afChance) {}
+ bool OnHearNoise(const cVector3f &avPosition, float afVolume) { return false; }
+ void OnTakeHit(float afDamage) {}
+ void OnFlashlight(const cVector3f &avPosition) {}
+
+ void OnAnimationOver(const tString &asName);
+
+private:
+ float mfTimer;
+ bool mbCheckAnim;
+ int mlPrevToughness;
+
+ int mlStuckAtMaxCount;
+};
+
+//-----------------------------------------
+
+// DEAD STATE
+class cGameEnemyState_Dog_Dead : public iGameEnemyState_Dog_Base {
+public:
+ cGameEnemyState_Dog_Dead(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Dog_Base(alId, apInit, apEnemy) {}
+
+ void OnEnterState(iGameEnemyState *apPrevState);
+ void OnLeaveState(iGameEnemyState *apNextState);
+
+ void OnUpdate(float afTimeStep);
+
+ void OnSeePlayer(const cVector3f &avPosition, float afChance) {}
+ bool OnHearNoise(const cVector3f &avPosition, float afVolume) { return false; }
+ void OnTakeHit(float afDamage) {}
+ void OnFlashlight(const cVector3f &avPosition) {}
+};
+
+//-----------------------------------------
+
+// PATROL STATE
+class cGameEnemyState_Dog_Patrol : public iGameEnemyState_Dog_Base {
+public:
+ cGameEnemyState_Dog_Patrol(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Dog_Base(alId, apInit, apEnemy) {}
+
+ void OnEnterState(iGameEnemyState *apPrevState);
+ void OnLeaveState(iGameEnemyState *apNextState);
+
+ void OnUpdate(float afTimeStep);
+
+ void OnAnimationOver(const tString &asName);
+
+private:
+ bool mbWaiting;
+ bool mbAnimation;
+
+ float mfIdleSoundTime;
+
+ int mlStuckAtMaxCount;
+};
+
+//-----------------------------------------
+
+// INVESTIGATE STATE
+class cGameEnemyState_Dog_Investigate : public iGameEnemyState_Dog_Base {
+public:
+ cGameEnemyState_Dog_Investigate(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Dog_Base(alId, apInit, apEnemy) {
+ mlKnockCount = 0;
+ }
+
+ void OnEnterState(iGameEnemyState *apPrevState);
+ void OnLeaveState(iGameEnemyState *apNextState);
+
+ void OnUpdate(float afTimeStep);
+
+ bool OnHearNoise(const cVector3f &avPosition, float afVolume);
+
+ float mfIdleSoundTime;
+ float mfHearSoundCount;
+ float mfHighestVolume;
+
+ int mlKnockCount;
+};
+
+//-----------------------------------------
+
+// MOVETO STATE
+class cGameEnemyState_Dog_MoveTo : public iGameEnemyState_Dog_Base {
+public:
+ cGameEnemyState_Dog_MoveTo(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Dog_Base(alId, apInit, apEnemy) {}
+
+ void OnEnterState(iGameEnemyState *apPrevState);
+ void OnLeaveState(iGameEnemyState *apNextState);
+
+ void OnUpdate(float afTimeStep);
+
+ float mfIdleSoundTime;
+ int mlBreakCount;
+};
+
Commit: ebb6ad1a254ac94153fc8f5f7961bb068fe451e7
https://github.com/scummvm/scummvm/commit/ebb6ad1a254ac94153fc8f5f7961bb068fe451e7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:28+01:00
Commit Message:
HPL1: fix module.mk
Changed paths:
engines/hpl1/module.mk
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 3f2795f0f38..8634348e968 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -266,6 +266,8 @@ MODULE_OBJS := \
penumbra-overture/GameSwingDoor.o \
penumbra-overture/GameTypes.o \
penumbra-overture/GraphicsHelper.o \
+ penumbra-overture/HapticGameCamera.o \
+ penumbra-overture/HudModel_Throw.o \
penumbra-overture/HudModel_Weapon.o \
penumbra-overture/Init.o \
penumbra-overture/IntroStory.o \
@@ -289,7 +291,6 @@ MODULE_OBJS := \
penumbra-overture/RadioHandler.o \
penumbra-overture/SaveHandler.o \
penumbra-overture/SaveTypes.o \
- penumbra-overture/StdAfx.o \
penumbra-overture/TriggerHandler.o \
penumbra-overture/Triggers.o
Commit: 76a777aa99d9284b078e2dd3d77976e48227db9b
https://github.com/scummvm/scummvm/commit/76a777aa99d9284b078e2dd3d77976e48227db9b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:28+01:00
Commit Message:
HPL1: add check after opening the config file
Changed paths:
engines/hpl1/engine/resources/ConfigFile.cpp
diff --git a/engines/hpl1/engine/resources/ConfigFile.cpp b/engines/hpl1/engine/resources/ConfigFile.cpp
index 3d7755282ec..80b6f9087ae 100644
--- a/engines/hpl1/engine/resources/ConfigFile.cpp
+++ b/engines/hpl1/engine/resources/ConfigFile.cpp
@@ -31,6 +31,7 @@
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/system/String.h"
#include "common/file.h"
+#include "hpl1/debug.h"
namespace hpl {
@@ -61,8 +62,11 @@ cConfigFile::~cConfigFile() {
bool cConfigFile::Load() {
Common::File cf;
//FIXME: use proper string types
- cf.open(cString::To8Char(msFile).c_str());
- return mpXmlDoc->LoadFile(cf);;
+ if (!cf.open(cString::To8Char(msFile).c_str())) {
+ debugCN(Hpl1::kDebugLevelWarning, Hpl1::kDebugFilePath, "file %s could not be opened", cString::To8Char(msFile).c_str());
+ return false;
+ }
+ return mpXmlDoc->LoadFile(cf);
}
//-----------------------------------------------------------------------
Commit: 47004e102d249c6e10aa8c488eeebaf732a727f2
https://github.com/scummvm/scummvm/commit/47004e102d249c6e10aa8c488eeebaf732a727f2
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:28+01:00
Commit Message:
HPL1: remove tinyxml string implementation
Changed paths:
R engines/hpl1/engine/impl/tinyXML/tinystr.cpp
R engines/hpl1/engine/impl/tinyXML/tinystr.h
engines/hpl1/engine/engine.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index f4bfd2ce8ca..5216b220cfc 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -164,7 +164,6 @@
#include "hpl1/engine/impl/scriptstring.h"
#include "hpl1/engine/impl/stdstring.h"
#include "hpl1/engine/impl/temp-types.h"
-#include "hpl1/engine/impl/tinyXML/tinystr.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/input/Action.h"
#include "hpl1/engine/input/ActionHaptic.h"
@@ -294,4 +293,4 @@
#include "hpl1/engine/system/System.h"
#include "hpl1/engine/system/SystemTypes.h"
-#endif
\ No newline at end of file
+#endif
diff --git a/engines/hpl1/engine/impl/tinyXML/tinystr.cpp b/engines/hpl1/engine/impl/tinyXML/tinystr.cpp
deleted file mode 100644
index 2cd6b5bcd19..00000000000
--- a/engines/hpl1/engine/impl/tinyXML/tinystr.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-www.sourceforge.net/projects/tinyxml
-Original file by Yves Berquin.
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must
-not claim that you wrote the original software. If you use this
-software in a product, an acknowledgment in the product documentation
-would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-*/
-
-/*
- * THIS FILE WAS ALTERED BY Tyge L�vset, 7. April 2005.
- */
-
-#ifndef TIXML_USE_STL
-
-#include "hpl1/engine/impl/tinyXML/tinystr.h"
-
-// Error value for find primitive
-const TiXmlString::size_type TiXmlString::npos = static_cast<TiXmlString::size_type>(-1);
-
-// Null rep.
-TiXmlString::Rep TiXmlString::nullrep_ = {0, 0, '\0'};
-
-void TiXmlString::reserve(size_type cap) {
- if (cap > capacity()) {
- TiXmlString tmp;
- tmp.init(length(), cap);
- memcpy(tmp.start(), data(), length());
- swap(tmp);
- }
-}
-
-TiXmlString &TiXmlString::assign(const char *str, size_type len) {
- size_type cap = capacity();
- if (len > cap || cap > 3 * (len + 8)) {
- TiXmlString tmp;
- tmp.init(len);
- memcpy(tmp.start(), str, len);
- swap(tmp);
- } else {
- memmove(start(), str, len);
- set_size(len);
- }
- return *this;
-}
-
-TiXmlString &TiXmlString::append(const char *str, size_type len) {
- size_type newsize = length() + len;
- if (newsize > capacity()) {
- reserve(newsize + capacity());
- }
- memmove(finish(), str, len);
- set_size(newsize);
- return *this;
-}
-
-TiXmlString operator+(const TiXmlString &a, const TiXmlString &b) {
- TiXmlString tmp;
- tmp.reserve(a.length() + b.length());
- tmp += a;
- tmp += b;
- return tmp;
-}
-
-TiXmlString operator+(const TiXmlString &a, const char *b) {
- TiXmlString tmp;
- TiXmlString::size_type b_len = static_cast<TiXmlString::size_type>(strlen(b));
- tmp.reserve(a.length() + b_len);
- tmp += a;
- tmp.append(b, b_len);
- return tmp;
-}
-
-TiXmlString operator+(const char *a, const TiXmlString &b) {
- TiXmlString tmp;
- TiXmlString::size_type a_len = static_cast<TiXmlString::size_type>(strlen(a));
- tmp.reserve(a_len + b.length());
- tmp.append(a, a_len);
- tmp += b;
- return tmp;
-}
-
-#endif // TIXML_USE_STL
diff --git a/engines/hpl1/engine/impl/tinyXML/tinystr.h b/engines/hpl1/engine/impl/tinyXML/tinystr.h
deleted file mode 100644
index 80f38800bb0..00000000000
--- a/engines/hpl1/engine/impl/tinyXML/tinystr.h
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
-www.sourceforge.net/projects/tinyxml
-Original file by Yves Berquin.
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must
-not claim that you wrote the original software. If you use this
-software in a product, an acknowledgment in the product documentation
-would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-*/
-
-/*
- * THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005.
- *
- * - completely rewritten. compact, clean, and fast implementation.
- * - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems)
- * - fixed reserve() to work as per specification.
- * - fixed buggy compares operator==(), operator<(), and operator>()
- * - fixed operator+=() to take a const ref argument, following spec.
- * - added "copy" constructor with length, and most compare operators.
- * - added swap(), clear(), size(), capacity(), operator+().
- */
-
-#ifndef TIXML_USE_STL
-
-#ifndef TIXML_STRING_INCLUDED
-#define TIXML_STRING_INCLUDED
-
-#include <assert.h>
-#include <string.h>
-
-/* The support for explicit isn't that universal, and it isn't really
- required - it is used to check that the TiXmlString class isn't incorrectly
- used. Be nice to old compilers and macro it here:
-*/
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-// Microsoft visual studio, version 6 and higher.
-#define TIXML_EXPLICIT explicit
-#elif defined(__GNUC__) && (__GNUC__ >= 3)
-// GCC version 3 and higher.s
-#define TIXML_EXPLICIT explicit
-#else
-#define TIXML_EXPLICIT
-#endif
-
-/*
- TiXmlString is an emulation of a subset of the std::string template.
- Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
- Only the member functions relevant to the TinyXML project have been implemented.
- The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
- a string and there's no more room, we allocate a buffer twice as big as we need.
-*/
-class TiXmlString {
-public:
- // The size type used
- typedef size_t size_type;
-
- // Error value for find primitive
- static const size_type npos; // = -1;
-
- // TiXmlString empty constructor
- TiXmlString() : rep_(&nullrep_) {
- }
-
- // TiXmlString copy constructor
- TiXmlString(const TiXmlString ©) : rep_(0) {
- init(copy.length());
- memcpy(start(), copy.data(), length());
- }
-
- // TiXmlString constructor, based on a string
- TIXML_EXPLICIT TiXmlString(const char *copy) : rep_(0) {
- init(static_cast<size_type>(strlen(copy)));
- memcpy(start(), copy, length());
- }
-
- // TiXmlString constructor, based on a string
- TIXML_EXPLICIT TiXmlString(const char *str, size_type len) : rep_(0) {
- init(len);
- memcpy(start(), str, len);
- }
-
- // TiXmlString destructor
- ~TiXmlString() {
- quit();
- }
-
- // = operator
- TiXmlString &operator=(const char *copy) {
- return assign(copy, (size_type)strlen(copy));
- }
-
- // = operator
- TiXmlString &operator=(const TiXmlString ©) {
- return assign(copy.start(), copy.length());
- }
-
- // += operator. Maps to append
- TiXmlString &operator+=(const char *suffix) {
- return append(suffix, static_cast<size_type>(strlen(suffix)));
- }
-
- // += operator. Maps to append
- TiXmlString &operator+=(char single) {
- return append(&single, 1);
- }
-
- // += operator. Maps to append
- TiXmlString &operator+=(const TiXmlString &suffix) {
- return append(suffix.data(), suffix.length());
- }
-
- // Convert a TiXmlString into a null-terminated char *
- const char *c_str() const { return rep_->str; }
-
- // Convert a TiXmlString into a char * (need not be null terminated).
- const char *data() const { return rep_->str; }
-
- // Return the length of a TiXmlString
- size_type length() const { return rep_->size; }
-
- // Alias for length()
- size_type size() const { return rep_->size; }
-
- // Checks if a TiXmlString is empty
- bool empty() const { return rep_->size == 0; }
-
- // Return capacity of string
- size_type capacity() const { return rep_->capacity; }
-
- // single char extraction
- const char &at(size_type index) const {
- assert(index < length());
- return rep_->str[index];
- }
-
- // [] operator
- char &operator[](size_type index) const {
- assert(index < length());
- return rep_->str[index];
- }
-
- // find a char in a string. Return TiXmlString::npos if not found
- size_type find(char lookup) const {
- return find(lookup, 0);
- }
-
- // find a char in a string from an offset. Return TiXmlString::npos if not found
- size_type find(char tofind, size_type offset) const {
- if (offset >= length())
- return npos;
-
- for (const char *p = c_str() + offset; *p != '\0'; ++p) {
- if (*p == tofind)
- return static_cast<size_type>(p - c_str());
- }
- return npos;
- }
-
- void clear() {
- // Lee:
- // The original was just too strange, though correct:
- // TiXmlString().swap(*this);
- // Instead use the quit & re-init:
- quit();
- init(0, 0);
- }
-
- /* Function to reserve a big amount of data when we know we'll need it. Be aware that this
- function DOES NOT clear the content of the TiXmlString if any exists.
- */
- void reserve(size_type cap);
-
- TiXmlString &assign(const char *str, size_type len);
-
- TiXmlString &append(const char *str, size_type len);
-
- void swap(TiXmlString &other) {
- Rep *r = rep_;
- rep_ = other.rep_;
- other.rep_ = r;
- }
-
-private:
- void init(size_type sz) { init(sz, sz); }
- void set_size(size_type sz) { rep_->str[rep_->size = sz] = '\0'; }
- char *start() const { return rep_->str; }
- char *finish() const { return rep_->str + rep_->size; }
-
- struct Rep {
- size_type size, capacity;
- char str[1];
- };
-
- void init(size_type sz, size_type cap) {
- if (cap) {
- // Lee: the original form:
- // rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap));
- // doesn't work in some cases of new being overloaded. Switching
- // to the normal allocation, although use an 'int' for systems
- // that are overly picky about structure alignment.
- const size_type bytesNeeded = sizeof(Rep) + cap;
- const size_type intsNeeded = (bytesNeeded + sizeof(int) - 1) / sizeof(int);
- rep_ = reinterpret_cast<Rep *>(new int[intsNeeded]);
-
- rep_->str[rep_->size = sz] = '\0';
- rep_->capacity = cap;
- } else {
- rep_ = &nullrep_;
- }
- }
-
- void quit() {
- if (rep_ != &nullrep_) {
- // The rep_ is really an array of ints. (see the allocator, above).
- // Cast it back before delete, so the compiler won't incorrectly call destructors.
- delete[](reinterpret_cast<int *>(rep_));
- }
- }
-
- Rep *rep_;
- static Rep nullrep_;
-};
-
-inline bool operator==(const TiXmlString &a, const TiXmlString &b) {
- return (a.length() == b.length()) // optimization on some platforms
- && (strcmp(a.c_str(), b.c_str()) == 0); // actual compare
-}
-inline bool operator<(const TiXmlString &a, const TiXmlString &b) {
- return strcmp(a.c_str(), b.c_str()) < 0;
-}
-
-inline bool operator!=(const TiXmlString &a, const TiXmlString &b) { return !(a == b); }
-inline bool operator>(const TiXmlString &a, const TiXmlString &b) { return b < a; }
-inline bool operator<=(const TiXmlString &a, const TiXmlString &b) { return !(b < a); }
-inline bool operator>=(const TiXmlString &a, const TiXmlString &b) { return !(a < b); }
-
-inline bool operator==(const TiXmlString &a, const char *b) { return strcmp(a.c_str(), b) == 0; }
-inline bool operator==(const char *a, const TiXmlString &b) { return b == a; }
-inline bool operator!=(const TiXmlString &a, const char *b) { return !(a == b); }
-inline bool operator!=(const char *a, const TiXmlString &b) { return !(b == a); }
-
-TiXmlString operator+(const TiXmlString &a, const TiXmlString &b);
-TiXmlString operator+(const TiXmlString &a, const char *b);
-TiXmlString operator+(const char *a, const TiXmlString &b);
-
-/*
- TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
- Only the operators that we need for TinyXML have been developped.
-*/
-class TiXmlOutStream : public TiXmlString {
-public:
- // TiXmlOutStream << operator.
- TiXmlOutStream &operator<<(const TiXmlString &in) {
- *this += in;
- return *this;
- }
-
- // TiXmlOutStream << operator.
- TiXmlOutStream &operator<<(const char *in) {
- *this += in;
- return *this;
- }
-};
-
-#endif // TIXML_STRING_INCLUDED
-#endif // TIXML_USE_STL
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 8634348e968..70bac6db22a 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -127,7 +127,6 @@ MODULE_OBJS := \
engine/impl/VideoStreamTheora.o \
engine/impl/scriptstring.o \
engine/impl/stdstring.o \
- engine/impl/tinyXML/tinystr.o \
engine/impl/tinyXML/tinyxml.o \
engine/impl/tinyXML/tinyxmlerror.o \
engine/impl/tinyXML/tinyxmlparser.o \
Commit: c0ddf435e5474449ec22635a2e94a72feac4bc37
https://github.com/scummvm/scummvm/commit/c0ddf435e5474449ec22635a2e94a72feac4bc37
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:28+01:00
Commit Message:
HPL1: remove unused message box functions
Changed paths:
engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
engines/hpl1/engine/system/LowLevelSystem.h
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
index 2bff600b698..e99fd7eb313 100644
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
@@ -236,59 +236,6 @@ tWString LoadTextFromClipboard() {
//-----------------------------------------------------------------------
-void CreateMessageBox(eMsgBoxType eType, const char *asCaption, const char *fmt, ...) {
- /*char text[2048];
- va_list ap;
- if (fmt == NULL)
- return;
- va_start(ap, fmt);
- vsprintf(text, fmt, ap);
- va_end(ap);
-
- tString sMess = "";
- sMess += text;
-
-
- #ifdef WIN32
-
- UINT lType = MB_OK;
-
- switch (eType)
- {
- case eMsgBoxType_Info:
- lType += MB_ICONINFORMATION;
- break;
- case eMsgBoxType_Error:
- lType += MB_ICONERROR;
- break;
- case eMsgBoxType_Warning:
- lType += MB_ICONWARNING;
- break;
- default:
- break;
- }
-
-
- MessageBox( NULL, sMess.c_str(), asCaption, lType );
-
- #endif*/
-}
-
-void CreateMessageBox(const char *asCaption, const char *fmt, ...) {
- /*char text[2048];
- va_list ap;
- if (fmt == NULL)
- return;
- va_start(ap, fmt);
- vsprintf(text, fmt, ap);
- va_end(ap);
-
- tString sMess = "";
- sMess += text;
-
- CreateMessageBox( eMsgBoxType_Default, asCaption, sMess.c_str() );*/
-}
-
void CreateMessageBoxW(eMsgBoxType eType, const wchar_t *asCaption, const wchar_t *fmt, va_list ap) {
#if 0
wchar_t text[2048];
diff --git a/engines/hpl1/engine/system/LowLevelSystem.h b/engines/hpl1/engine/system/LowLevelSystem.h
index accf7f7f736..07fb3bbc64f 100644
--- a/engines/hpl1/engine/system/LowLevelSystem.h
+++ b/engines/hpl1/engine/system/LowLevelSystem.h
@@ -64,9 +64,6 @@ extern void Log(const char *fmt, ...);
extern void SetUpdateLogActive(bool abX);
extern void LogUpdate(const char *fmt, ...);
-// extern void CreateMessageBox ( const char* asCaption, const char *fmt, ...);
-// extern void CreateMessageBox ( eMsgBoxType eType, const char* asCaption, const char *fmt, ...);
-
extern void CreateMessageBoxW(const wchar_t *asCaption, const wchar_t *fmt, ...);
extern void CreateMessageBoxW(eMsgBoxType eType, const wchar_t *asCaption, const wchar_t *fmt, ...);
Commit: 5f351698c8b19862a39010cd2ffdf4d5dafa698a
https://github.com/scummvm/scummvm/commit/5f351698c8b19862a39010cd2ffdf4d5dafa698a
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:28+01:00
Commit Message:
HPL1: remove unused Platform class
Changed paths:
R engines/hpl1/engine/impl/Platform.cpp
R engines/hpl1/engine/impl/Platform.h
engines/hpl1/engine/engine.h
engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
engines/hpl1/engine/impl/SqScript.cpp
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index 5216b220cfc..da60dfdbf17 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -151,7 +151,6 @@
#include "hpl1/engine/impl/PhysicsJointSliderNewton.h"
#include "hpl1/engine/impl/PhysicsMaterialNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
-#include "hpl1/engine/impl/Platform.h"
#include "hpl1/engine/impl/SDLBitmap2D.h"
#include "hpl1/engine/impl/SDLFontData.h"
#include "hpl1/engine/impl/SDLGameSetup.h"
diff --git a/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp b/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
index 3938f4e86f5..1370f412cf1 100644
--- a/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
@@ -32,7 +32,6 @@
#ifdef INCLUDE_THEORA
#include "hpl1/engine/impl/VideoStreamTheora.h"
#endif
-#include "hpl1/engine/impl/Platform.h"
#include "hpl1/engine/system/String.h"
//#include "SDL/SDL.h"
diff --git a/engines/hpl1/engine/impl/Platform.cpp b/engines/hpl1/engine/impl/Platform.cpp
deleted file mode 100644
index da7c28176a6..00000000000
--- a/engines/hpl1/engine/impl/Platform.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "hpl1/engine/impl/Platform.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
-
-namespace hpl {
-
-long Platform::FileLength(const tWString &asFileName) {
- return 0;
-}
-
-long Platform::FileLength(FILE *pFile) {
- return 0;
-}
-
-void Platform::FindFileInDir(tWStringList &alstStrings, tWString asDir, tWString asMask) {
-}
-} // namespace hpl
diff --git a/engines/hpl1/engine/impl/Platform.h b/engines/hpl1/engine/impl/Platform.h
deleted file mode 100644
index bd249a6f4fe..00000000000
--- a/engines/hpl1/engine/impl/Platform.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef PLATFORM_H_
-#define PLATFORM_H_
-#include "hpl1/engine/system/String.h"
-
-namespace hpl {
-class Platform {
-public:
- static long FileLength(const tWString &asFileName);
- static long FileLength(FILE *pFile);
- static void FindFileInDir(tWStringList &alstStrings, tWString asDir, tWString asMask);
-};
-} // namespace hpl
-
-#endif /*PLATFORM_H_*/
diff --git a/engines/hpl1/engine/impl/SqScript.cpp b/engines/hpl1/engine/impl/SqScript.cpp
index da863cb36bf..04cca17219d 100644
--- a/engines/hpl1/engine/impl/SqScript.cpp
+++ b/engines/hpl1/engine/impl/SqScript.cpp
@@ -26,7 +26,6 @@
*/
#include "hpl1/engine/impl/SqScript.h"
-#include "hpl1/engine/impl/Platform.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/system/String.h"
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 70bac6db22a..a7f40021e07 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -116,7 +116,6 @@ MODULE_OBJS := \
engine/impl/PhysicsJointSliderNewton.o \
engine/impl/PhysicsMaterialNewton.o \
engine/impl/PhysicsWorldNewton.o \
- engine/impl/Platform.o \
engine/impl/SDLBitmap2D.o \
engine/impl/SDLFontData.o \
engine/impl/SDLGameSetup.o \
Commit: 45278f70106203f4d24c98808bea225d124a5bb4
https://github.com/scummvm/scummvm/commit/45278f70106203f4d24c98808bea225d124a5bb4
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:28+01:00
Commit Message:
HPL1: replace pixel format classes
Changed paths:
R engines/hpl1/engine/graphics/PixelFormat.h
R engines/hpl1/engine/impl/SDLPixelFormat.h
engines/hpl1/engine/engine.h
engines/hpl1/engine/graphics/Bitmap2D.h
engines/hpl1/engine/graphics/LowLevelGraphics.h
engines/hpl1/engine/graphics/Texture.h
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
engines/hpl1/engine/impl/SDLBitmap2D.cpp
engines/hpl1/engine/impl/SDLBitmap2D.h
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/SDLTexture.h
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index da60dfdbf17..48a12d0f49e 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -84,7 +84,6 @@
#include "hpl1/engine/graphics/ParticleEmitter3D.h"
#include "hpl1/engine/graphics/ParticleEmitter3D_UserData.h"
#include "hpl1/engine/graphics/ParticleSystem3D.h"
-#include "hpl1/engine/graphics/PixelFormat.h"
#include "hpl1/engine/graphics/RenderList.h"
#include "hpl1/engine/graphics/RenderObject2D.h"
#include "hpl1/engine/graphics/RenderState.h"
@@ -154,7 +153,6 @@
#include "hpl1/engine/impl/SDLBitmap2D.h"
#include "hpl1/engine/impl/SDLFontData.h"
#include "hpl1/engine/impl/SDLGameSetup.h"
-#include "hpl1/engine/impl/SDLPixelFormat.h"
#include "hpl1/engine/impl/SDLTexture.h"
#include "hpl1/engine/impl/SqScript.h"
#include "hpl1/engine/impl/VertexBufferOGL.h"
diff --git a/engines/hpl1/engine/graphics/Bitmap2D.h b/engines/hpl1/engine/graphics/Bitmap2D.h
index 5ae83f43178..68443020e1f 100644
--- a/engines/hpl1/engine/graphics/Bitmap2D.h
+++ b/engines/hpl1/engine/graphics/Bitmap2D.h
@@ -31,14 +31,13 @@
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/LowLevelPicture.h"
#include "hpl1/engine/math/MathTypes.h"
+#include "graphics/pixelformat.h"
namespace hpl {
-class iPixelFormat;
-
class iBitmap2D : public iLowLevelPicture {
public:
- iBitmap2D(tString asType, iPixelFormat *apPxlFmt) : iLowLevelPicture(asType) {}
+ iBitmap2D(tString asType, Graphics::PixelFormat *apPxlFmt) : iLowLevelPicture(asType) {}
virtual ~iBitmap2D() {}
/**
diff --git a/engines/hpl1/engine/graphics/LowLevelGraphics.h b/engines/hpl1/engine/graphics/LowLevelGraphics.h
index d3a1fc5ca93..2d2d8a9729e 100644
--- a/engines/hpl1/engine/graphics/LowLevelGraphics.h
+++ b/engines/hpl1/engine/graphics/LowLevelGraphics.h
@@ -262,7 +262,7 @@ public:
virtual iTexture *CreateTexture(const cVector2l &avSize, int alBpp, cColor aFillCol,
bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) = 0;
- virtual iPixelFormat *GetPixelFormat() = 0;
+ virtual Graphics::PixelFormat *GetPixelFormat() = 0;
virtual iGpuProgram *CreateGpuProgram(const tString &asName, eGpuProgramType aType) = 0;
diff --git a/engines/hpl1/engine/graphics/PixelFormat.h b/engines/hpl1/engine/graphics/PixelFormat.h
deleted file mode 100644
index 27076dea287..00000000000
--- a/engines/hpl1/engine/graphics/PixelFormat.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_PIXELFORMAT_H
-#define HPL_PIXELFORMAT_H
-
-#include "hpl1/engine/system/SystemTypes.h"
-
-namespace hpl {
-
-class iPixelFormat {
-public:
- iPixelFormat(tString asType) : msType(asType) {}
- ~iPixelFormat() {}
-
-private:
- tString msType;
-};
-
-}; // namespace hpl
-#endif // HPL_PIXELFORMAT_H
diff --git a/engines/hpl1/engine/graphics/Texture.h b/engines/hpl1/engine/graphics/Texture.h
index 2d482e4c842..c3fa8a4e604 100644
--- a/engines/hpl1/engine/graphics/Texture.h
+++ b/engines/hpl1/engine/graphics/Texture.h
@@ -31,8 +31,8 @@
#include "hpl1/engine/graphics/Bitmap2D.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/LowLevelPicture.h"
-#include "hpl1/engine/graphics/PixelFormat.h"
#include "hpl1/engine/resources/ResourceBase.h"
+#include "graphics/pixelformat.h"
#include <vector>
namespace hpl {
@@ -87,7 +87,7 @@ class iLowLevelGraphics;
class iTexture : public iLowLevelPicture, public iResourceBase {
public:
- iTexture(tString asName, tString asType, iPixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
+ iTexture(tString asName, tString asType, Graphics::PixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
eTextureType aType, bool abUseMipMaps, eTextureTarget aTarget,
bool abCompress = false)
: iLowLevelPicture(asType), iResourceBase(asName, 0),
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 26827d759d4..6a6688032cd 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -647,7 +647,7 @@ iGpuProgram *cLowLevelGraphicsSDL::CreateGpuProgram(const tString &asName, eGpuP
//-----------------------------------------------------------------------
-iPixelFormat *cLowLevelGraphicsSDL::GetPixelFormat() {
+Graphics::PixelFormat *cLowLevelGraphicsSDL::GetPixelFormat() {
return mpPixelFormat;
}
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
index c301224ed01..ece71380acc 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
@@ -43,7 +43,7 @@
//--scummvm-temporary--
#include "hpl1/engine/graphics/LowLevelGraphics.h"
-#include "hpl1/engine/impl/SDLPixelFormat.h"
+#include "graphics/pixelformat.h"
#include "hpl1/engine/math/MathTypes.h"
namespace hpl {
@@ -94,7 +94,7 @@ public:
iTexture *CreateTexture(const cVector2l &avSize, int alBpp, cColor aFillCol,
bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
- iPixelFormat *GetPixelFormat();
+ Graphics::PixelFormat *GetPixelFormat();
iGpuProgram *CreateGpuProgram(const tString &asName, eGpuProgramType aType);
@@ -271,7 +271,7 @@ private:
// SDL Variables
SDL_Surface *mpScreen;
- cSDLPixelFormat *mpPixelFormat;
+ Graphics::PixelFormat *mpPixelFormat;
// Vertex Array variables
// The vertex arrays used:
diff --git a/engines/hpl1/engine/impl/SDLBitmap2D.cpp b/engines/hpl1/engine/impl/SDLBitmap2D.cpp
index 78201cc8b39..448a5f1d227 100644
--- a/engines/hpl1/engine/impl/SDLBitmap2D.cpp
+++ b/engines/hpl1/engine/impl/SDLBitmap2D.cpp
@@ -35,16 +35,16 @@ namespace hpl {
//-----------------------------------------------------------------------
-cSDLBitmap2D::cSDLBitmap2D(iPixelFormat *apPxlFmt) : iBitmap2D("SDL", apPxlFmt) {
+cSDLBitmap2D::cSDLBitmap2D(Graphics::PixelFormat *apPxlFmt) : iBitmap2D("SDL", apPxlFmt) {
mpSurface = NULL;
mlHeight = 0;
mlWidth = 0;
- cSDLPixelFormat *pFmt = static_cast<cSDLPixelFormat *>(apPxlFmt);
- mpSDLPixelFmt32 = pFmt->GetSDLPixelFormat32();
+// cSDLPixelFormat *pFmt = static_cast<cSDLPixelFormat *>(apPxlFmt);
+// mpSDLPixelFmt32 = pFmt->GetSDLPixelFormat32();
}
-cSDLBitmap2D::cSDLBitmap2D(SDL_Surface *apSurface, iPixelFormat *apPxlFmt, const tString &asType) : iBitmap2D("SDL", apPxlFmt) {
+cSDLBitmap2D::cSDLBitmap2D(SDL_Surface *apSurface, Graphics::PixelFormat *apPxlFmt, const tString &asType) : iBitmap2D("SDL", apPxlFmt) {
#if 0
mpSurface = apSurface;
mlHeight = mpSurface->h;
diff --git a/engines/hpl1/engine/impl/SDLBitmap2D.h b/engines/hpl1/engine/impl/SDLBitmap2D.h
index f5a6142d35d..7dbe5ccb5e2 100644
--- a/engines/hpl1/engine/impl/SDLBitmap2D.h
+++ b/engines/hpl1/engine/impl/SDLBitmap2D.h
@@ -29,7 +29,7 @@
#define HPL_SDL_BITMAP2D_H
#include "hpl1/engine/graphics/Bitmap2D.h"
-#include "hpl1/engine/impl/SDLPixelFormat.h"
+#include "graphics/pixelformat.h"
//#include "SDL/SDL.h"
#include "temp-types.h"
@@ -38,8 +38,8 @@ namespace hpl {
class cSDLBitmap2D : public iBitmap2D {
public:
- cSDLBitmap2D(iPixelFormat *apPxlFmt);
- cSDLBitmap2D(SDL_Surface *apSurface, iPixelFormat *apPxlFmt, const tString &asType);
+ cSDLBitmap2D(Graphics::PixelFormat *apPxlFmt);
+ cSDLBitmap2D(SDL_Surface *apSurface, Graphics::PixelFormat *apPxlFmt, const tString &asType);
~cSDLBitmap2D();
bool SaveToFile(const tString &asFile);
diff --git a/engines/hpl1/engine/impl/SDLPixelFormat.h b/engines/hpl1/engine/impl/SDLPixelFormat.h
deleted file mode 100644
index 27a8b027e75..00000000000
--- a/engines/hpl1/engine/impl/SDLPixelFormat.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_SDL_PIXELFORMAT_H
-#define HPL_SDL_PIXELFORMAT_H
-
-#include "hpl1/engine/graphics/PixelFormat.h"
-//#include "SDL/SDL.h"
-#include "temp-types.h"
-
-namespace hpl {
-
-class cSDLPixelFormat : public iPixelFormat {
-public:
- cSDLPixelFormat() : iPixelFormat("SDL") {
-#if 0
- ////// BEGIN - PIXEL FORMAT 32 bit RGBA ////////
- mSDLPixelFmt32.palette = 0;
- mSDLPixelFmt32.BitsPerPixel = 32;
- mSDLPixelFmt32.BytesPerPixel = 4;
-
- if(SDL_BYTEORDER == SDL_BIG_ENDIAN){
- mSDLPixelFmt32.Rmask = 0xff000000;
- mSDLPixelFmt32.Gmask = 0x00ff0000;
- mSDLPixelFmt32.Bmask = 0x0000ff00;
- mSDLPixelFmt32.Amask = 0x000000ff;
-
- mSDLPixelFmt32.Rshift = 24;
- mSDLPixelFmt32.Gshift = 16;
- mSDLPixelFmt32.Bshift = 8;
- mSDLPixelFmt32.Ashift = 0;
-
- }
- else
- {
- mSDLPixelFmt32.Rmask = 0x000000ff;
- mSDLPixelFmt32.Gmask = 0x0000ff00;
- mSDLPixelFmt32.Bmask = 0x00ff0000;
- mSDLPixelFmt32.Amask = 0xff000000;
-
- mSDLPixelFmt32.Rshift = 0;
- mSDLPixelFmt32.Gshift = 8;
- mSDLPixelFmt32.Bshift = 16;
- mSDLPixelFmt32.Ashift = 24;
- }
-
- mSDLPixelFmt32.Rloss=0;
- mSDLPixelFmt32.Gloss=0;
- mSDLPixelFmt32.Bloss=0;
- mSDLPixelFmt32.Aloss=0;
-
- mSDLPixelFmt32.colorkey =0;
- mSDLPixelFmt32.alpha = 255;
- ////// END - PIXEL FORMAT 32 bit RGBA ////////
-
-#endif
- }
-
- SDL_PixelFormat *GetSDLPixelFormat32() {
- return &mSDLPixelFmt32;
- }
-
-private:
- SDL_PixelFormat mSDLPixelFmt32;
-};
-
-}; // namespace hpl
-#endif // HPL_SDL_PIXELFORMAT_H
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index a53398bf30c..178f904626a 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -39,7 +39,7 @@ namespace hpl {
//-----------------------------------------------------------------------
-cSDLTexture::cSDLTexture(const tString &asName, iPixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
+cSDLTexture::cSDLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
eTextureType aType, bool abUseMipMaps, eTextureTarget aTarget,
bool abCompress)
: iTexture(asName, "OGL", apPxlFmt, apLowLevelGraphics, aType, abUseMipMaps, aTarget, abCompress) {
diff --git a/engines/hpl1/engine/impl/SDLTexture.h b/engines/hpl1/engine/impl/SDLTexture.h
index 1b772f8cf67..86a20ff8d62 100644
--- a/engines/hpl1/engine/impl/SDLTexture.h
+++ b/engines/hpl1/engine/impl/SDLTexture.h
@@ -46,7 +46,7 @@ namespace hpl {
class cSDLTexture : public iTexture {
public:
- cSDLTexture(const tString &asName, iPixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
+ cSDLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
eTextureType aType, bool abUseMipMaps, eTextureTarget aTarget,
bool abCompress = false);
~cSDLTexture();
Commit: f831725d0c6ae9cdca1dfa119cd5d04f19323bff
https://github.com/scummvm/scummvm/commit/f831725d0c6ae9cdca1dfa119cd5d04f19323bff
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:29+01:00
Commit Message:
HPL1: replace bitmap implementation
Changed paths:
A engines/hpl1/engine/graphics/bitmap2D.cpp
R engines/hpl1/engine/impl/SDLBitmap2D.cpp
R engines/hpl1/engine/impl/SDLBitmap2D.h
engines/hpl1/engine/engine.h
engines/hpl1/engine/graphics/Bitmap2D.h
engines/hpl1/engine/graphics/FontData.cpp
engines/hpl1/engine/graphics/FontData.h
engines/hpl1/engine/graphics/GraphicsDrawer.cpp
engines/hpl1/engine/graphics/GraphicsDrawer.h
engines/hpl1/engine/graphics/LowLevelGraphics.h
engines/hpl1/engine/graphics/Texture.h
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
engines/hpl1/engine/impl/LowLevelResourcesSDL.h
engines/hpl1/engine/impl/SDLFontData.cpp
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/SDLTexture.h
engines/hpl1/engine/resources/FrameBitmap.cpp
engines/hpl1/engine/resources/FrameBitmap.h
engines/hpl1/engine/resources/ImageManager.cpp
engines/hpl1/engine/resources/ImageManager.h
engines/hpl1/engine/resources/LowLevelResources.h
engines/hpl1/engine/resources/TextureManager.cpp
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index 48a12d0f49e..5c01b9636a6 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -39,7 +39,7 @@
#include "hpl1/engine/graphics/BackgroundImage.h"
#include "hpl1/engine/graphics/Beam.h"
#include "hpl1/engine/graphics/BillBoard.h"
-#include "hpl1/engine/graphics/Bitmap2D.h"
+#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/engine/graphics/Bone.h"
#include "hpl1/engine/graphics/BoneState.h"
#include "hpl1/engine/graphics/Color.h"
@@ -150,7 +150,6 @@
#include "hpl1/engine/impl/PhysicsJointSliderNewton.h"
#include "hpl1/engine/impl/PhysicsMaterialNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
-#include "hpl1/engine/impl/SDLBitmap2D.h"
#include "hpl1/engine/impl/SDLFontData.h"
#include "hpl1/engine/impl/SDLGameSetup.h"
#include "hpl1/engine/impl/SDLTexture.h"
diff --git a/engines/hpl1/engine/graphics/Bitmap2D.h b/engines/hpl1/engine/graphics/Bitmap2D.h
index 68443020e1f..bdef78b119d 100644
--- a/engines/hpl1/engine/graphics/Bitmap2D.h
+++ b/engines/hpl1/engine/graphics/Bitmap2D.h
@@ -32,56 +32,39 @@
#include "hpl1/engine/graphics/LowLevelPicture.h"
#include "hpl1/engine/math/MathTypes.h"
#include "graphics/pixelformat.h"
+#include "common/ptr.h"
+#include "graphics/surface.h"
namespace hpl {
-class iBitmap2D : public iLowLevelPicture {
+class Bitmap2D : public iLowLevelPicture {
public:
- iBitmap2D(tString asType, Graphics::PixelFormat *apPxlFmt) : iLowLevelPicture(asType) {}
- virtual ~iBitmap2D() {}
+ Bitmap2D(const tString &type) : iLowLevelPicture(type) {}
+ Bitmap2D(const Graphics::Surface &surface, const tString &type) :
+ iLowLevelPicture(type), _surface(surface) {
+ }
+
+ ~Bitmap2D();
- /**
- * Save the bitmap to file
- * \param asFile
- * \return
- */
- virtual bool SaveToFile(const tString &asFile) = 0;
- /**
- * Draw the bitmap onto another
- * \param *apBmp Destination
- * \param &avPos Position on new map
- */
- virtual void DrawToBitmap(iBitmap2D *apBmp, const cVector2l &avPos) = 0;
- /**
- * Creates a new size for the bitmap. (all previous content is erased
- * \param avSize
- * \param alBpp
- * \return
- */
- virtual bool Create(cVector2l avSize, unsigned int alBpp) = 0;
+ void drawToBitmap(Bitmap2D &dest, const cVector2l &pos);
- /**
- * Draws a solid rect onto the bitmap. IF h and w is than w and how of the bitmap is used.
- * \param &aRect
- * \param &aColor
- */
- virtual void FillRect(const cRect2l &aRect, const cColor &aColor) = 0;
+ bool create(const cVector2l &size, const Graphics::PixelFormat &format);
- /**
- * Get a pointer to the raw pixel data.
- */
- virtual void *GetRawData() = 0;
+ void fillRect(const cRect2l &rect, const cColor &color);
- /**
- * Get the number of color channels in the image.
- * \return
- */
- virtual int GetNumChannels() = 0;
+ void *getRawData();
+
+ int getNumChannels();
+
+ bool HasAlpha() override;
+
+private:
+ Graphics::Surface _surface;
};
-typedef std::vector<iBitmap2D *> tBitmap2DVec;
-typedef std::vector<iBitmap2D *>::iterator tBitmap2DVecIt;
+typedef std::vector<Bitmap2D *> tBitmap2DVec;
+typedef std::vector<Bitmap2D *>::iterator tBitmap2DVecIt;
}; // namespace hpl
#endif // HPL_BITMAP2D_H
diff --git a/engines/hpl1/engine/graphics/FontData.cpp b/engines/hpl1/engine/graphics/FontData.cpp
index 093aa4d3d11..2b923971503 100644
--- a/engines/hpl1/engine/graphics/FontData.cpp
+++ b/engines/hpl1/engine/graphics/FontData.cpp
@@ -305,7 +305,7 @@ float iFontData::GetLengthFmt(const cVector2f &avSize, const wchar_t *fmt, ...)
//-----------------------------------------------------------------------
-cGlyph *iFontData::CreateGlyph(iBitmap2D *apBmp, const cVector2l &avOffset, const cVector2l &avSize,
+cGlyph *iFontData::CreateGlyph(Bitmap2D *apBmp, const cVector2l &avOffset, const cVector2l &avSize,
const cVector2l &avFontSize, int alAdvance) {
// Here the bitmap should be saved to diskk for faster loading.
diff --git a/engines/hpl1/engine/graphics/FontData.h b/engines/hpl1/engine/graphics/FontData.h
index f989ecbdeb3..f5173b0655c 100644
--- a/engines/hpl1/engine/graphics/FontData.h
+++ b/engines/hpl1/engine/graphics/FontData.h
@@ -41,7 +41,7 @@ class ImageManager;
class iLowLevelGraphics;
class cGraphicsDrawer;
class cGfxObject;
-class iBitmap2D;
+class Bitmap2D;
class cGuiGfxElement;
class cGui;
@@ -163,7 +163,7 @@ protected:
cVector2f mvSizeRatio;
- cGlyph *CreateGlyph(iBitmap2D *apBmp, const cVector2l &avOffset, const cVector2l &avSize,
+ cGlyph *CreateGlyph(Bitmap2D *apBmp, const cVector2l &avOffset, const cVector2l &avSize,
const cVector2l &avFontSize, int alAdvance);
void AddGlyph(cGlyph *apGlyph);
};
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.cpp b/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
index 79cd4763819..5aaa0873d1f 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
@@ -294,7 +294,7 @@ cGfxObject *cGraphicsDrawer::CreateGfxObject(const tString &asFileName, const tS
//-----------------------------------------------------------------------
-cGfxObject *cGraphicsDrawer::CreateGfxObject(iBitmap2D *apBmp, const tString &asMaterialName,
+cGfxObject *cGraphicsDrawer::CreateGfxObject(Bitmap2D *apBmp, const tString &asMaterialName,
bool abAddToList) {
cResourceImage *pImage = mpResources->GetImageManager()->CreateFromBitmap("", apBmp);
if (pImage == NULL) {
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.h b/engines/hpl1/engine/graphics/GraphicsDrawer.h
index e70cc539985..f384ac9d4c9 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.h
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.h
@@ -119,7 +119,7 @@ public:
* \param abAddToList if the engine should delete object at exit, this means DestroyGfxObject must be used. Should almost always be true.
* \return
*/
- cGfxObject *CreateGfxObject(iBitmap2D *apBmp, const tString &asMaterialName,
+ cGfxObject *CreateGfxObject(Bitmap2D *apBmp, const tString &asMaterialName,
bool abAddToList = true);
cGfxObject *CreateGfxObjectFromTexture(const tString &asFileName, const tString &asMaterialName,
diff --git a/engines/hpl1/engine/graphics/LowLevelGraphics.h b/engines/hpl1/engine/graphics/LowLevelGraphics.h
index 2d2d8a9729e..3ee9a0757ef 100644
--- a/engines/hpl1/engine/graphics/LowLevelGraphics.h
+++ b/engines/hpl1/engine/graphics/LowLevelGraphics.h
@@ -28,7 +28,7 @@
#ifndef HPL_LOWLEVELGRAPHICS_H
#define HPL_LOWLEVELGRAPHICS_H
-#include "hpl1/engine/graphics/Bitmap2D.h"
+#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/Texture.h"
@@ -252,12 +252,12 @@ public:
virtual cPlanef GetClipPlane(int alIdx, const cPlanef &aPlane) = 0;
virtual void SetClipPlaneActive(int alIdx, bool abX) = 0;
- virtual iBitmap2D *CreateBitmap2D(const cVector2l &avSize, unsigned int alBpp) = 0;
+ virtual Bitmap2D *CreateBitmap2D(const cVector2l &avSize, unsigned int alBpp) = 0;
virtual iFontData *CreateFontData(const tString &asName) = 0;
virtual iTexture *CreateTexture(bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) = 0;
virtual iTexture *CreateTexture(const tString &asName, bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) = 0;
- virtual iTexture *CreateTexture(iBitmap2D *apBmp, bool abUseMipMaps, eTextureType aType,
+ virtual iTexture *CreateTexture(Bitmap2D *apBmp, bool abUseMipMaps, eTextureType aType,
eTextureTarget aTarget) = 0;
virtual iTexture *CreateTexture(const cVector2l &avSize, int alBpp, cColor aFillCol,
bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) = 0;
diff --git a/engines/hpl1/engine/graphics/Texture.h b/engines/hpl1/engine/graphics/Texture.h
index c3fa8a4e604..b466d5f4613 100644
--- a/engines/hpl1/engine/graphics/Texture.h
+++ b/engines/hpl1/engine/graphics/Texture.h
@@ -28,7 +28,7 @@
#ifndef HPL_TEXTURE_H
#define HPL_TEXTURE_H
-#include "hpl1/engine/graphics/Bitmap2D.h"
+#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/LowLevelPicture.h"
#include "hpl1/engine/resources/ResourceBase.h"
@@ -112,7 +112,7 @@ public:
* \param pBmp
* \return
*/
- virtual bool CreateFromBitmap(iBitmap2D *pBmp) = 0;
+ virtual bool CreateFromBitmap(Bitmap2D *pBmp) = 0;
/**
* Create a cube map texture from a vector of bitmaps. Doesn't work with render targets.
* All bitmaps most be square, a power of 2 and the same same. The order must be: posX, negX, posY, negY, posZ and negZ.
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
new file mode 100644
index 00000000000..d865a0b800f
--- /dev/null
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -0,0 +1,78 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "hpl1/engine/graphics/bitmap2D.h"
+#include "hpl1/debug.h"
+#include "common/rect.h"
+
+namespace hpl {
+
+static uint32 quantizeColor(const cColor &col, const Graphics::PixelFormat &format) {
+ uint8 r = static_cast<uint8>(col.r * 255);
+ uint8 g = static_cast<uint8>(col.g * 255);
+ uint8 b = static_cast<uint8>(col.b * 255);
+ uint8 a = static_cast<uint8>(col.a * 255);
+ return format.ARGBToColor(a, r, g, b);
+}
+
+void Bitmap2D::drawToBitmap(Bitmap2D &dest, const cVector2l &pos) {
+ if (_surface.format != dest._surface.format)
+ error("call to Bitmap2D::drawToBitmap with different pixel formats");
+ if (_surface.w + pos.x > dest._surface.w || _surface.h + pos.y > dest._surface.h)
+ error("call to Bitmap2D::drawToBitmap would go out of bounds");
+
+ dest._surface.copyRectToSurface(_surface, pos.x, pos.y, Common::Rect(0, 0, _surface.w, _surface.h));
+}
+
+bool Bitmap2D::create(const cVector2l &size, const Graphics::PixelFormat &format) {
+ _surface.create(size.x, size.y, format);
+ return true;
+}
+
+void Bitmap2D::fillRect(const cRect2l &rect, const cColor &color) {
+ const uint32 qcol = quantizeColor(color, _surface.format);
+ const Common::Rect surfaceRect(
+ rect.x,
+ rect.y,
+ rect.w <= 0 ? rect.x + _surface.w : rect.x + rect.w,
+ rect.h <= 0 ? rect.y + _surface.w : rect.y + rect.h
+ );
+ _surface.fillRect(surfaceRect, qcol);
+}
+
+void *Bitmap2D::getRawData() {
+ return _surface.getPixels();
+}
+
+int Bitmap2D::getNumChannels() {
+ return _surface.format.bpp() / _surface.format.bytesPerPixel;
+}
+
+bool Bitmap2D::HasAlpha() {
+ return _surface.format.aBits() > 0;
+}
+
+Bitmap2D::~Bitmap2D() {
+ _surface.free();
+}
+
+
+} // namespace hpl
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 6a6688032cd..4eafe079394 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -42,7 +42,7 @@
//#include "graphics/opengl/glad.h"
#include "hpl1/engine/impl/CGProgram.h"
-#include "hpl1/engine/impl/SDLBitmap2D.h"
+#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/engine/impl/SDLFontData.h"
#include "hpl1/engine/impl/SDLTexture.h"
#include "hpl1/engine/impl/VertexBufferOGL.h"
@@ -581,7 +581,7 @@ void cLowLevelGraphicsSDL::SaveScreenToBMP(const tString &asFile) {
#if 0
glFinish();
- cSDLBitmap2D *pBmp = hplNew( cSDLBitmap2D, (mpPixelFormat) );
+ Bitmap2D *pBmp = hplNew( Bitmap2D, (mpPixelFormat) );
pBmp->Create(cVector2l(mvScreenSize.x,mvScreenSize.y),32);
unsigned char *pDestPixels = (unsigned char*)pBmp->GetSurface()->pixels;
@@ -616,12 +616,15 @@ void cLowLevelGraphicsSDL::SaveScreenToBMP(const tString &asFile) {
//-----------------------------------------------------------------------
-iBitmap2D *cLowLevelGraphicsSDL::CreateBitmap2D(const cVector2l &avSize, unsigned int alBpp) {
- cSDLBitmap2D *pBmp = hplNew(cSDLBitmap2D, (mpPixelFormat));
- pBmp->Create(avSize, alBpp);
+Bitmap2D *cLowLevelGraphicsSDL::CreateBitmap2D(const cVector2l &avSize, unsigned int alBpp) {
+#if 0
+ Bitmap2D *pBmp = hplNew(Bitmap2D, (mpPixelFormat));
+ pBmp->create(avSize, alBpp);
return pBmp;
-}
+#endif
+ return nullptr;
+ }
//-----------------------------------------------------------------------
@@ -631,12 +634,15 @@ iFontData *cLowLevelGraphicsSDL::CreateFontData(const tString &asName) {
//-----------------------------------------------------------------------
-iBitmap2D *cLowLevelGraphicsSDL::CreateBitmap2DFromSurface(SDL_Surface *apSurface, const tString &asType) {
- cSDLBitmap2D *pBmp = hplNew(cSDLBitmap2D, (apSurface, mpPixelFormat, asType));
+Bitmap2D *cLowLevelGraphicsSDL::CreateBitmap2DFromSurface(SDL_Surface *apSurface, const tString &asType) {
+#if 0
+ Bitmap2D *pBmp = hplNew(Bitmap2D, (apSurface, mpPixelFormat, asType));
pBmp->msType = asType;
return pBmp;
+#endif
+ return nullptr;
}
//-----------------------------------------------------------------------
@@ -665,7 +671,7 @@ iTexture *cLowLevelGraphicsSDL::CreateTexture(const tString &asName, bool abUseM
//-----------------------------------------------------------------------
-iTexture *cLowLevelGraphicsSDL::CreateTexture(iBitmap2D *apBmp, bool abUseMipMaps, eTextureType aType,
+iTexture *cLowLevelGraphicsSDL::CreateTexture(Bitmap2D *apBmp, bool abUseMipMaps, eTextureType aType,
eTextureTarget aTarget) {
cSDLTexture *pTex = hplNew(cSDLTexture, ("", mpPixelFormat, this, aType, abUseMipMaps, aTarget));
pTex->CreateFromBitmap(apBmp);
@@ -683,8 +689,8 @@ iTexture *cLowLevelGraphicsSDL::CreateTexture(const cVector2l &avSize, int alBpp
pTex = hplNew(cSDLTexture, ("", mpPixelFormat, this, aType, abUseMipMaps, aTarget));
pTex->Create(avSize.x, avSize.y, aFillCol);
} else {
- iBitmap2D *pBmp = CreateBitmap2D(avSize, alBpp);
- pBmp->FillRect(cRect2l(0, 0, 0, 0), aFillCol);
+ Bitmap2D *pBmp = CreateBitmap2D(avSize, alBpp);
+ pBmp->fillRect(cRect2l(0, 0, 0, 0), aFillCol);
pTex = hplNew(cSDLTexture, ("", mpPixelFormat, this, aType, abUseMipMaps, aTarget));
bool bRet = pTex->CreateFromBitmap(pBmp);
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
index ece71380acc..ae4241ae29d 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
@@ -45,6 +45,8 @@
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "graphics/pixelformat.h"
#include "hpl1/engine/math/MathTypes.h"
+#include "graphics/surface.h"
+#include "common/ptr.h"
namespace hpl {
@@ -85,12 +87,12 @@ public:
cVector2f GetVirtualSize();
void SetVirtualSize(cVector2f avSize);
- iBitmap2D *CreateBitmap2D(const cVector2l &avSize, unsigned int alBpp);
+ Bitmap2D *CreateBitmap2D(const cVector2l &avSize, unsigned int alBpp);
iFontData *CreateFontData(const tString &asName);
iTexture *CreateTexture(bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
iTexture *CreateTexture(const tString &asName, bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
- iTexture *CreateTexture(iBitmap2D *apBmp, bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
+ iTexture *CreateTexture(Bitmap2D *apBmp, bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
iTexture *CreateTexture(const cVector2l &avSize, int alBpp, cColor aFillCol,
bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
@@ -235,7 +237,7 @@ public:
///// SDL Specific ////////////////////////////
- iBitmap2D *CreateBitmap2DFromSurface(SDL_Surface *apSurface, const tString &asType);
+ Bitmap2D *CreateBitmap2DFromSurface(SDL_Surface *apSurface, const tString &asType);
CGcontext GetGC_Context() { return mCG_Context; }
diff --git a/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp b/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
index 1370f412cf1..c6ac4bc913d 100644
--- a/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/impl/LowLevelResourcesSDL.h"
#include "hpl1/engine/impl/MeshLoaderCollada.h"
#include "hpl1/engine/impl/MeshLoaderMSH.h"
-#include "hpl1/engine/impl/SDLBitmap2D.h"
+#include "hpl1/engine/graphics/bitmap2D.h"
#ifdef INCLUDE_THEORA
#include "hpl1/engine/impl/VideoStreamTheora.h"
#endif
@@ -78,7 +78,7 @@ cLowLevelResourcesSDL::~cLowLevelResourcesSDL() {
//-----------------------------------------------------------------------
-iBitmap2D *cLowLevelResourcesSDL::LoadBitmap2D(tString asFilePath, tString asType) {
+Bitmap2D *cLowLevelResourcesSDL::LoadBitmap2D(tString asFilePath, tString asType) {
#if 0
tString tType;
if(asType != "")
diff --git a/engines/hpl1/engine/impl/LowLevelResourcesSDL.h b/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
index 44acba8e43e..a5122932db0 100644
--- a/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
@@ -42,7 +42,7 @@ public:
void FindFilesInDir(tStringList &alstStrings, tString asDir, tString asMask);
void GetSupportedImageFormats(tStringList &alstFormats);
- iBitmap2D *LoadBitmap2D(tString asFilePath, tString asType = "");
+ Bitmap2D *LoadBitmap2D(tString asFilePath, tString asType = "");
void AddMeshLoaders(cMeshLoaderHandler *apHandler);
void AddVideoLoaders(cVideoManager *apManager);
diff --git a/engines/hpl1/engine/impl/SDLBitmap2D.cpp b/engines/hpl1/engine/impl/SDLBitmap2D.cpp
deleted file mode 100644
index 448a5f1d227..00000000000
--- a/engines/hpl1/engine/impl/SDLBitmap2D.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#include "hpl1/engine/impl/SDLBitmap2D.h"
-
-namespace hpl {
-
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cSDLBitmap2D::cSDLBitmap2D(Graphics::PixelFormat *apPxlFmt) : iBitmap2D("SDL", apPxlFmt) {
- mpSurface = NULL;
- mlHeight = 0;
- mlWidth = 0;
-
-// cSDLPixelFormat *pFmt = static_cast<cSDLPixelFormat *>(apPxlFmt);
-// mpSDLPixelFmt32 = pFmt->GetSDLPixelFormat32();
-}
-
-cSDLBitmap2D::cSDLBitmap2D(SDL_Surface *apSurface, Graphics::PixelFormat *apPxlFmt, const tString &asType) : iBitmap2D("SDL", apPxlFmt) {
-#if 0
- mpSurface = apSurface;
- mlHeight = mpSurface->h;
- mlWidth = mpSurface->w;
-
- msType = asType;
-
- cSDLPixelFormat *pFmt = static_cast<cSDLPixelFormat*>(apPxlFmt);
- mpSDLPixelFmt32 = pFmt->GetSDLPixelFormat32();
-#endif
-}
-cSDLBitmap2D::~cSDLBitmap2D() {
-#if 0
- SDL_FreeSurface(mpSurface);
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-bool cSDLBitmap2D::SaveToFile(const tString &asFile) {
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-void cSDLBitmap2D::DrawToBitmap(iBitmap2D *apDest, const cVector2l &avDestPos) {
-#if 0
- cSDLBitmap2D* pBmp = static_cast<cSDLBitmap2D*>(apDest);
-
- SDL_Rect rect;
- rect.x = avDestPos.x;
- rect.y = avDestPos.y;
-
- int lDestSize = pBmp->GetSurface()->format->BytesPerPixel;
- int lSrcSize = mpSurface->format->BytesPerPixel;
-
- unsigned char* destBuffer = (unsigned char*)pBmp->GetSurface()->pixels;
- unsigned char* srcBuffer = (unsigned char*)mpSurface->pixels;
-
- SDL_BlitSurface(mpSurface, NULL, pBmp->GetSurface(),&rect);
-
- //do this little hack to set the alpha to a correct value.
- //stupid SDL always sets it to 255..
- if(lDestSize!=4 || lSrcSize!=4)return;
-
- for(unsigned int y=0;y<mlHeight;y++)
- for(unsigned int x=0;x<mlWidth;x++)
- {
- unsigned char* destPix = &destBuffer[((y + avDestPos.y)*pBmp->GetWidth() +
- (x + avDestPos.x)) * lDestSize];
-
- unsigned char* srcPix = &srcBuffer[(y*mlWidth + x) * lSrcSize];
-
- destPix[3] = srcPix[3];
- }
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-void cSDLBitmap2D::FillRect(const cRect2l &aRect, const cColor &aColor) {
-#if 0
- SDL_Rect rect;
- rect.x = aRect.x;
- rect.y = aRect.y;
- rect.w = aRect.w<=0?mlWidth:aRect.w;
- rect.h = aRect.h<=0?mlHeight:aRect.h;
-
- unsigned int col = SDL_MapRGBA(mpSDLPixelFmt32,(int)(aColor.r*255.0f),(int)(aColor.g*255.0f),
- (int)(aColor.b*255.0f),(int)(aColor.a*255.0f));
-
- SDL_FillRect(mpSurface, &rect,col);
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-bool cSDLBitmap2D::HasAlpha() {
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cSDLBitmap2D::Create(cVector2l avSize, unsigned int alBpp) {
-#if 0
- mpSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, avSize.x, avSize.y, 32,
- mpSDLPixelFmt32->Rmask, mpSDLPixelFmt32->Gmask,
- mpSDLPixelFmt32->Bmask, mpSDLPixelFmt32->Amask);
-
- if(mpSurface==NULL) return false;
-
- mlHeight = mpSurface->h;
- mlWidth = mpSurface->w;
-
- return true;
-#endif
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-SDL_Surface *cSDLBitmap2D::GetSurface() {
- return mpSurface;
-}
-
-//-----------------------------------------------------------------------
-
-void *cSDLBitmap2D::GetRawData() {
-#if 0
- return mpSurface->pixels;
-#endif
- return 0;
-}
-
-int cSDLBitmap2D::GetNumChannels() {
-#if 0
- return mpSurface->format->BytesPerPixel;
-#endif
- return 0;
-}
-
-//-----------------------------------------------------------------------
-
-} // namespace hpl
diff --git a/engines/hpl1/engine/impl/SDLBitmap2D.h b/engines/hpl1/engine/impl/SDLBitmap2D.h
deleted file mode 100644
index 7dbe5ccb5e2..00000000000
--- a/engines/hpl1/engine/impl/SDLBitmap2D.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_SDL_BITMAP2D_H
-#define HPL_SDL_BITMAP2D_H
-
-#include "hpl1/engine/graphics/Bitmap2D.h"
-#include "graphics/pixelformat.h"
-
-//#include "SDL/SDL.h"
-#include "temp-types.h"
-
-namespace hpl {
-
-class cSDLBitmap2D : public iBitmap2D {
-public:
- cSDLBitmap2D(Graphics::PixelFormat *apPxlFmt);
- cSDLBitmap2D(SDL_Surface *apSurface, Graphics::PixelFormat *apPxlFmt, const tString &asType);
- ~cSDLBitmap2D();
-
- bool SaveToFile(const tString &asFile);
-
- void DrawToBitmap(iBitmap2D *apBmp, const cVector2l &avDestPos);
- bool HasAlpha();
- /**
- * \todo Support 16 bit format aswell.
- * \param avSize
- * \param alBpp
- * \return
- */
- bool Create(cVector2l avSize, unsigned int alBpp);
-
- void FillRect(const cRect2l &aRect, const cColor &aColor);
-
- void *GetRawData();
- int GetNumChannels();
-
- // SDL Specific
- SDL_Surface *GetSurface();
- SDL_PixelFormat *GetPixelFmt32() { return mpSDLPixelFmt32; }
-
- tString msType;
-
-private:
- SDL_Surface *mpSurface;
- SDL_PixelFormat *mpSDLPixelFmt32;
-};
-}; // namespace hpl
-#endif // HPL_SDL_BITMAP2D_H
diff --git a/engines/hpl1/engine/impl/SDLFontData.cpp b/engines/hpl1/engine/impl/SDLFontData.cpp
index 094da30a65b..67df891eaf1 100644
--- a/engines/hpl1/engine/impl/SDLFontData.cpp
+++ b/engines/hpl1/engine/impl/SDLFontData.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/impl/SDLFontData.h"
#include "hpl1/engine/graphics/GraphicsDrawer.h"
-#include "hpl1/engine/impl/SDLBitmap2D.h"
+#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/system/LowLevelSystem.h"
@@ -87,7 +87,7 @@ bool cSDLFontData::CreateFromBitmapFile(const tString &asFileName) {
////////////////////////////////////////////
// Load bitmaps
- std::vector<cSDLBitmap2D *> vBitmaps;
+ std::vector<Bitmap2D *> vBitmaps;
TiXmlElement *pPagesRootElem = pRootElem->FirstChildElement("pages");
@@ -97,7 +97,7 @@ bool cSDLFontData::CreateFromBitmapFile(const tString &asFileName) {
tString sFileName = pPageElem->Attribute("file");
tString sFilePath = cString::SetFilePath(sFileName,sPath);
- cSDLBitmap2D *pBitmap = static_cast<cSDLBitmap2D*>(mpLowLevelResources->LoadBitmap2D(sFilePath));
+ Bitmap2D *pBitmap = static_cast<Bitmap2D*>(mpLowLevelResources->LoadBitmap2D(sFilePath));
if(pBitmap==NULL)
{
Error("Couldn't load bitmap %s for FNT file '%s'\n",sFilePath.c_str(),asFileName.c_str());
@@ -131,11 +131,11 @@ bool cSDLFontData::CreateFromBitmapFile(const tString &asFileName) {
int lPage = cString::ToInt(pCharElem->Attribute("page"),0);
//Get the bitmap where the character graphics is
- cSDLBitmap2D *pSourceBitmap = vBitmaps[lPage];
+ Bitmap2D *pSourceBitmap = vBitmaps[lPage];
//Create a bitmap for the character.
cVector2l vSize(lW, lH);
- cSDLBitmap2D *pBmp = static_cast<cSDLBitmap2D*>(mpLowLevelGraphics->CreateBitmap2D(vSize,32));
+ Bitmap2D *pBmp = static_cast<Bitmap2D*>(mpLowLevelGraphics->CreateBitmap2D(vSize,32));
//Copy from source to character bitmap
SDL_Rect srcRect;
@@ -237,7 +237,7 @@ cGlyph *cSDLFontData::RenderGlyph(TTF_Font *apFont, unsigned short aChar, int al
//Create the bitmap we want to draw upon
cVector2l vSize = vMax - vMin;
- cSDLBitmap2D *pBmp = static_cast<cSDLBitmap2D*>(mpLowLevelGraphics->CreateBitmap2D(vSize,32));
+ Bitmap2D *pBmp = static_cast<Bitmap2D*>(mpLowLevelGraphics->CreateBitmap2D(vSize,32));
pBmp->FillRect(cRect2l(),cColor(0,1));
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index 178f904626a..d4f18e836d0 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -26,7 +26,7 @@
*/
#include "hpl1/engine/impl/SDLTexture.h"
-#include "hpl1/engine/impl/SDLBitmap2D.h"
+#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/LowLevelSystem.h"
@@ -86,7 +86,7 @@ cSDLTexture::~cSDLTexture() {
//-----------------------------------------------------------------------
-bool cSDLTexture::CreateFromBitmap(iBitmap2D *pBmp) {
+bool cSDLTexture::CreateFromBitmap(Bitmap2D *pBmp) {
#if 0
//Generate handles
if(mvTextureHandles.empty())
@@ -157,7 +157,7 @@ bool cSDLTexture::CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps) {
//Create the cube map sides
for(int i=0; i< 6; i++)
{
- cSDLBitmap2D *pSrc = static_cast<cSDLBitmap2D*>((*avBitmaps)[i]);
+ Bitmap2D *pSrc = static_cast<Bitmap2D*>((*avBitmaps)[i]);
GLenum target = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + i;
@@ -550,7 +550,7 @@ unsigned int cSDLTexture::GetTextureHandle() {
//-----------------------------------------------------------------------
-bool cSDLTexture::CreateFromBitmapToHandle(iBitmap2D *pBmp, int alHandleIdx) {
+bool cSDLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
#if 0
if(mType == eTextureType_RenderTarget)
{
@@ -567,7 +567,7 @@ bool cSDLTexture::CreateFromBitmapToHandle(iBitmap2D *pBmp, int alHandleIdx) {
GLenum GLTarget =InitCreation(alHandleIdx);
- cSDLBitmap2D *pBitmapSrc = static_cast<cSDLBitmap2D*>(pBmp);
+ Bitmap2D *pBitmapSrc = static_cast<Bitmap2D*>(pBmp);
mlWidth = pBitmapSrc->GetWidth();
mlHeight = pBitmapSrc->GetHeight();
@@ -714,7 +714,7 @@ void cSDLTexture::PostCreation(GLenum aGLTarget) {
//-----------------------------------------------------------------------
-void cSDLTexture::GetSettings(cSDLBitmap2D *apSrc, int &alChannels, GLenum &aFormat) {
+void cSDLTexture::GetSettings(Bitmap2D *apSrc, int &alChannels, GLenum &aFormat) {
#if 0
SDL_Surface *pSurface = apSrc->GetSurface();
alChannels = pSurface->format->BytesPerPixel;
diff --git a/engines/hpl1/engine/impl/SDLTexture.h b/engines/hpl1/engine/impl/SDLTexture.h
index 86a20ff8d62..8f06e4216ac 100644
--- a/engines/hpl1/engine/impl/SDLTexture.h
+++ b/engines/hpl1/engine/impl/SDLTexture.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/graphics/Texture.h"
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
#include "hpl1/engine/impl/PBuffer.h"
-#include "hpl1/engine/impl/SDLBitmap2D.h"
+#include "hpl1/engine/graphics/bitmap2D.h"
//#include <GL/GLee.h>
//#if defined(__APPLE__)&&defined(__MACH__)
@@ -51,7 +51,7 @@ public:
bool abCompress = false);
~cSDLTexture();
- bool CreateFromBitmap(iBitmap2D *pBmp);
+ bool CreateFromBitmap(Bitmap2D *pBmp);
bool CreateAnimFromBitmapVec(tBitmap2DVec *avBitmaps);
@@ -90,14 +90,14 @@ public:
cPBuffer *GetPBuffer() { return mpPBuffer; }
private:
- bool CreateFromBitmapToHandle(iBitmap2D *pBmp, int alHandleIdx);
+ bool CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx);
GLenum InitCreation(int alHandleIdx);
void PostCreation(GLenum aGLTarget);
GLenum GetGLWrap(eTextureWrap aMode);
- void GetSettings(cSDLBitmap2D *apSrc, int &alChannels, GLenum &aFormat);
+ void GetSettings(Bitmap2D *apSrc, int &alChannels, GLenum &aFormat);
tUIntVec mvTextureHandles;
bool mbContainsData;
diff --git a/engines/hpl1/engine/resources/FrameBitmap.cpp b/engines/hpl1/engine/resources/FrameBitmap.cpp
index c49830dbbaa..b64fb992d43 100644
--- a/engines/hpl1/engine/resources/FrameBitmap.cpp
+++ b/engines/hpl1/engine/resources/FrameBitmap.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/resources/FrameTexture.h"
#include "hpl1/engine/resources/ResourceImage.h"
-#include "hpl1/engine/graphics/Bitmap2D.h"
+#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/engine/graphics/Texture.h"
@@ -42,11 +42,11 @@ namespace hpl {
//-----------------------------------------------------------------------
- cFrameBitmap::cFrameBitmap(iBitmap2D *apBitmap, cFrameTexture *apFrmTex, int alHandle) : iFrameBase()
+ cFrameBitmap::cFrameBitmap(Bitmap2D *apBitmap, cFrameTexture *apFrmTex, int alHandle) : iFrameBase()
{
mpBitmap = apBitmap;
mpFrameTexture = apFrmTex;
- mpBitmap->FillRect(cRect2l(0,0,0,0), cColor(1,1));
+ mpBitmap->fillRect(cRect2l(0,0,0,0), cColor(1,1));
mlMinHole = 6;
mlHandle = alHandle;
mbIsFull = false;
@@ -72,9 +72,10 @@ namespace hpl {
#define DEBUG_BTREE (false)
- cResourceImage *cFrameBitmap::AddBitmap(iBitmap2D *apSrc)
+ cResourceImage *cFrameBitmap::AddBitmap(Bitmap2D *apSrc)
{
- cResourceImage *pImage=NULL;
+#if 0
+ cResourceImage *pImage=NULL;
//source size
//+2 because we are gonna have a border to get rid if some antialiasing problems
int lSW = apSrc->GetWidth()+2;
@@ -159,15 +160,15 @@ namespace hpl {
//Draw 4 times so we get a nice extra border
for(int i=0;i<2;i++)for(int j=0;j<2;j++){
- apSrc->DrawToBitmap(mpBitmap,cVector2l(NewRect.x+i*2,NewRect.y+j*2));
+ apSrc->drawToBitmap(mpBitmap,cVector2l(NewRect.x+i*2,NewRect.y+j*2));
}
//Fix the border a little more:
for(int i=-1;i<2;i++)for(int j=-1;j<2;j++)
if((i==0 || j==0) && (i!=j)){
- apSrc->DrawToBitmap(mpBitmap,cVector2l(NewRect.x+1+i,NewRect.y+1+j));
+ apSrc->drawToBitmap(mpBitmap,cVector2l(NewRect.x+1+i,NewRect.y+1+j));
}
//Draw the final
- apSrc->DrawToBitmap(mpBitmap,cVector2l(NewRect.x+1,NewRect.y+1));
+ apSrc->drawToBitmap(mpBitmap,cVector2l(NewRect.x+1,NewRect.y+1));
mlPicCount++;
@@ -175,6 +176,7 @@ namespace hpl {
break;
}
}
+
}
if(bFoundNode)
@@ -228,6 +230,8 @@ namespace hpl {
return pImage;
+#endif
+ return nullptr;
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/resources/FrameBitmap.h b/engines/hpl1/engine/resources/FrameBitmap.h
index b5f5f711242..b2dc0f70d4e 100644
--- a/engines/hpl1/engine/resources/FrameBitmap.h
+++ b/engines/hpl1/engine/resources/FrameBitmap.h
@@ -36,7 +36,7 @@ namespace hpl {
class cFrameTexture;
class cResourceImage;
-class iBitmap2D;
+class Bitmap2D;
// The frames bitmap + rect class
class cFBitmapRect {
@@ -58,10 +58,10 @@ typedef tRectTreeNodeList::iterator tRectTreeNodeListIt;
class cFrameBitmap : public iFrameBase {
public:
- cFrameBitmap(iBitmap2D *apBitmap, cFrameTexture *apFrmTex, int alHandle);
+ cFrameBitmap(Bitmap2D *apBitmap, cFrameTexture *apFrmTex, int alHandle);
~cFrameBitmap();
- cResourceImage *AddBitmap(iBitmap2D *apSrc);
+ cResourceImage *AddBitmap(Bitmap2D *apSrc);
bool MinimumFit(cRect2l aSrc, cRect2l aDest);
bool IsFull();
bool IsUpdated();
@@ -76,7 +76,7 @@ public:
int GetHandle() const { return mlHandle; }
private:
- iBitmap2D *mpBitmap;
+ Bitmap2D *mpBitmap;
cFrameTexture *mpFrameTexture;
tRectTree mRects;
int mlMinHole;
diff --git a/engines/hpl1/engine/resources/ImageManager.cpp b/engines/hpl1/engine/resources/ImageManager.cpp
index 0313f39db2f..fd66246bf06 100644
--- a/engines/hpl1/engine/resources/ImageManager.cpp
+++ b/engines/hpl1/engine/resources/ImageManager.cpp
@@ -82,7 +82,7 @@ iResourceBase *cImageManager::CreateInFrame(const tString &asName, int alFrameHa
pImage = FindImage(asName, sPath);
if (!pImage) {
if (sPath != "") {
- iBitmap2D *pBmp;
+ Bitmap2D *pBmp;
pBmp = mpLowLevelResources->LoadBitmap2D(sPath);
if (pBmp == NULL) {
Error("Imagemanager Couldn't load bitmap '%s'\n", sPath.c_str());
@@ -128,7 +128,7 @@ cResourceImage *cImageManager::CreateImage(const tString &asName, int alFrameHan
//-----------------------------------------------------------------------
-cResourceImage *cImageManager::CreateFromBitmap(const tString &asName, iBitmap2D *apBmp, int alFrameHandle) {
+cResourceImage *cImageManager::CreateFromBitmap(const tString &asName, Bitmap2D *apBmp, int alFrameHandle) {
if (apBmp == NULL)
return NULL;
@@ -283,7 +283,7 @@ cResourceImage *cImageManager::FindImage(const tString &asName, tString &asFileP
//-----------------------------------------------------------------------
-cResourceImage *cImageManager::AddToFrame(iBitmap2D *apBmp, int alFrameHandle) {
+cResourceImage *cImageManager::AddToFrame(Bitmap2D *apBmp, int alFrameHandle) {
bool bFound = false;
cResourceImage *pImage = NULL;
@@ -339,7 +339,7 @@ cResourceImage *cImageManager::AddToFrame(iBitmap2D *apBmp, int alFrameHandle) {
cFrameBitmap *cImageManager::CreateBitmapFrame(cVector2l avSize) {
iTexture *pTex = mpLowLevelGraphics->CreateTexture(false, eTextureType_Normal, eTextureTarget_2D);
cFrameTexture *pTFrame = hplNew(cFrameTexture, (pTex, mlFrameHandle));
- iBitmap2D *pBmp = mpLowLevelGraphics->CreateBitmap2D(avSize, 32);
+ Bitmap2D *pBmp = mpLowLevelGraphics->CreateBitmap2D(avSize, 32);
cFrameBitmap *pBFrame = hplNew(cFrameBitmap, (pBmp, pTFrame, mlFrameHandle));
mlstBitmapFrames.push_back(pBFrame);
diff --git a/engines/hpl1/engine/resources/ImageManager.h b/engines/hpl1/engine/resources/ImageManager.h
index e2cd84289b4..7297dd235be 100644
--- a/engines/hpl1/engine/resources/ImageManager.h
+++ b/engines/hpl1/engine/resources/ImageManager.h
@@ -37,7 +37,7 @@ class cResourceImage;
class cFrameTexture;
class cFrameBitmap;
class iLowLevelGraphics;
-class iBitmap2D;
+class Bitmap2D;
typedef std::list<cFrameBitmap *> tFrameBitmapList;
typedef tFrameBitmapList::iterator tFrameBitmapListIt;
@@ -68,7 +68,7 @@ public:
int FlushAll();
void DeleteAllBitmapFrames();
- cResourceImage *CreateFromBitmap(const tString &asName, iBitmap2D *apBmp, int alFrameHandle = -1);
+ cResourceImage *CreateFromBitmap(const tString &asName, Bitmap2D *apBmp, int alFrameHandle = -1);
int CreateFrame(cVector2l avSize);
void SetFrameLocked(int alHandle, bool abLocked);
@@ -84,7 +84,7 @@ private:
int mlFrameHandle;
cResourceImage *FindImage(const tString &asName, tString &asFilePath);
- cResourceImage *AddToFrame(iBitmap2D *apBmp, int alFrameHandle);
+ cResourceImage *AddToFrame(Bitmap2D *apBmp, int alFrameHandle);
cFrameBitmap *CreateBitmapFrame(cVector2l avSize);
};
diff --git a/engines/hpl1/engine/resources/LowLevelResources.h b/engines/hpl1/engine/resources/LowLevelResources.h
index fed871b08d2..940c41b31f4 100644
--- a/engines/hpl1/engine/resources/LowLevelResources.h
+++ b/engines/hpl1/engine/resources/LowLevelResources.h
@@ -32,7 +32,7 @@
namespace hpl {
-class iBitmap2D;
+class Bitmap2D;
class cMeshLoaderHandler;
class cVideoManager;
@@ -49,7 +49,7 @@ public:
virtual void FindFilesInDir(tStringList &alstStrings, tString asDir, tString asMask) = 0;
virtual void GetSupportedImageFormats(tStringList &alstFormats) = 0;
- virtual iBitmap2D *LoadBitmap2D(tString asFilePath, tString asType = "") = 0;
+ virtual Bitmap2D *LoadBitmap2D(tString asFilePath, tString asType = "") = 0;
virtual void AddMeshLoaders(cMeshLoaderHandler *apHandler) = 0;
virtual void AddVideoLoaders(cVideoManager *apManager) = 0;
diff --git a/engines/hpl1/engine/resources/TextureManager.cpp b/engines/hpl1/engine/resources/TextureManager.cpp
index 9d82950fab3..60e50672f72 100644
--- a/engines/hpl1/engine/resources/TextureManager.cpp
+++ b/engines/hpl1/engine/resources/TextureManager.cpp
@@ -26,7 +26,7 @@
*/
#include "hpl1/engine/resources/TextureManager.h"
-#include "hpl1/engine/graphics/Bitmap2D.h"
+#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/engine/graphics/Graphics.h"
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/graphics/Texture.h"
@@ -129,7 +129,7 @@ iTexture *cTextureManager::CreateAnim2D(const tString &asName, bool abUseMipMaps
tBitmap2DVec vBitmaps;
for (size_t i = 0; i < vPaths.size(); ++i) {
- iBitmap2D *pBmp = mpResources->GetLowLevel()->LoadBitmap2D(vPaths[i]);
+ Bitmap2D *pBmp = mpResources->GetLowLevel()->LoadBitmap2D(vPaths[i]);
if (pBmp == NULL) {
Error("Couldn't load bitmap '%s'!\n", vPaths[i].c_str());
@@ -210,7 +210,7 @@ iTexture *cTextureManager::CreateCubeMap(const tString &asPathName, bool abUseMi
// Load bitmaps for all faces
tBitmap2DVec vBitmaps;
for (int i = 0; i < 6; i++) {
- iBitmap2D *pBmp = mpResources->GetLowLevel()->LoadBitmap2D(vPaths[i]);
+ Bitmap2D *pBmp = mpResources->GetLowLevel()->LoadBitmap2D(vPaths[i]);
if (pBmp == NULL) {
Error("Couldn't load bitmap '%s'!\n", vPaths[i].c_str());
for (int j = 0; j < (int)vBitmaps.size(); j++)
@@ -314,15 +314,15 @@ iTexture *cTextureManager::CreateAttenuation(const tString &asFallOffName) {
return NULL;
}
- iBitmap2D *pBmp = mpResources->GetLowLevel()->LoadBitmap2D(sPath);
+ Bitmap2D *pBmp = mpResources->GetLowLevel()->LoadBitmap2D(sPath);
if (pBmp == NULL) {
Log("Couldn't load bitmap '%s'\n", asFallOffName.c_str());
return NULL;
}
- int lBmpChannels = pBmp->GetNumChannels();
+ int lBmpChannels = pBmp->getNumChannels();
int lWidth = pBmp->GetWidth();
- unsigned char *pPixels = (unsigned char *)pBmp->GetRawData();
+ unsigned char *pPixels = (unsigned char *)pBmp->getRawData();
iTexture *pTexture = mpGraphics->GetLowLevel()->CreateTexture("Attenuation", false, eTextureType_Normal, eTextureTarget_3D);
int lSize = 16;
@@ -389,7 +389,7 @@ iTexture *cTextureManager::CreateFlatTexture(const tString &asName, bool abUseMi
if (pTexture == NULL && sPath != "") {
// Load the bitmap
- iBitmap2D *pBmp;
+ Bitmap2D *pBmp;
pBmp = mpLowLevelResources->LoadBitmap2D(sPath);
if (pBmp == NULL) {
Error("Texturemanager Couldn't load bitmap '%s'\n", sPath.c_str());
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index a7f40021e07..5d911fa04c0 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -116,7 +116,7 @@ MODULE_OBJS := \
engine/impl/PhysicsJointSliderNewton.o \
engine/impl/PhysicsMaterialNewton.o \
engine/impl/PhysicsWorldNewton.o \
- engine/impl/SDLBitmap2D.o \
+ engine/graphics/bitmap2D.o \
engine/impl/SDLFontData.o \
engine/impl/SDLGameSetup.o \
engine/impl/SDLTexture.o \
Commit: 3a690a2a90fc4391c61440fdfafa096d2400dd5c
https://github.com/scummvm/scummvm/commit/3a690a2a90fc4391c61440fdfafa096d2400dd5c
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:29+01:00
Commit Message:
HPL1: move implementation of LowLevelResourcesSDL
Changed paths:
A engines/hpl1/engine/resources/low_level_resources.cpp
A engines/hpl1/engine/resources/low_level_resources.h
R engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
R engines/hpl1/engine/impl/LowLevelResourcesSDL.h
R engines/hpl1/engine/resources/LowLevelResources.h
engines/hpl1/engine/engine.h
engines/hpl1/engine/graphics/FontData.h
engines/hpl1/engine/graphics/Graphics.cpp
engines/hpl1/engine/graphics/Graphics.h
engines/hpl1/engine/graphics/Renderer2D.cpp
engines/hpl1/engine/graphics/Renderer2D.h
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/engine/graphics/Renderer3D.h
engines/hpl1/engine/graphics/RendererPostEffects.cpp
engines/hpl1/engine/graphics/RendererPostEffects.h
engines/hpl1/engine/impl/SDLGameSetup.cpp
engines/hpl1/engine/impl/SDLGameSetup.h
engines/hpl1/engine/resources/FileSearcher.cpp
engines/hpl1/engine/resources/FileSearcher.h
engines/hpl1/engine/resources/GpuProgramManager.cpp
engines/hpl1/engine/resources/GpuProgramManager.h
engines/hpl1/engine/resources/ImageManager.cpp
engines/hpl1/engine/resources/ImageManager.h
engines/hpl1/engine/resources/ResourceManager.cpp
engines/hpl1/engine/resources/ResourceManager.h
engines/hpl1/engine/resources/Resources.cpp
engines/hpl1/engine/resources/Resources.h
engines/hpl1/engine/resources/TextureManager.cpp
engines/hpl1/module.mk
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/SaveHandler.cpp
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index 5c01b9636a6..334f849577c 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -130,7 +130,6 @@
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
#include "hpl1/engine/impl/LowLevelInputSDL.h"
#include "hpl1/engine/impl/LowLevelPhysicsNewton.h"
-#include "hpl1/engine/impl/LowLevelResourcesSDL.h"
#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
#include "hpl1/engine/impl/LowLevelSystemSDL.h"
#include "hpl1/engine/impl/MeshLoaderCollada.h"
@@ -213,7 +212,7 @@
#include "hpl1/engine/resources/ImageEntityManager.h"
#include "hpl1/engine/resources/ImageManager.h"
#include "hpl1/engine/resources/LanguageFile.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/MaterialManager.h"
#include "hpl1/engine/resources/MeshLoader.h"
#include "hpl1/engine/resources/MeshLoaderHandler.h"
diff --git a/engines/hpl1/engine/graphics/FontData.h b/engines/hpl1/engine/graphics/FontData.h
index f5173b0655c..133be71ffe7 100644
--- a/engines/hpl1/engine/graphics/FontData.h
+++ b/engines/hpl1/engine/graphics/FontData.h
@@ -30,7 +30,7 @@
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/ResourceBase.h"
#include "hpl1/engine/system/SystemTypes.h"
#include <vector>
@@ -80,7 +80,7 @@ public:
/**
* Used internally
*/
- void SetUp(cGraphicsDrawer *apGraphicsDrawer, iLowLevelResources *apLowLevelResources,
+ void SetUp(cGraphicsDrawer *apGraphicsDrawer, LowLevelResources *apLowLevelResources,
cGui *apGui) {
mpGraphicsDrawer = apGraphicsDrawer;
mpLowLevelResources = apLowLevelResources;
@@ -151,7 +151,7 @@ public:
protected:
iLowLevelGraphics *mpLowLevelGraphics;
- iLowLevelResources *mpLowLevelResources;
+ LowLevelResources *mpLowLevelResources;
cGraphicsDrawer *mpGraphicsDrawer;
cGui *mpGui;
diff --git a/engines/hpl1/engine/graphics/Graphics.cpp b/engines/hpl1/engine/graphics/Graphics.cpp
index eeb4a613341..b861b7eaa1b 100644
--- a/engines/hpl1/engine/graphics/Graphics.cpp
+++ b/engines/hpl1/engine/graphics/Graphics.cpp
@@ -36,7 +36,7 @@
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/graphics/Renderer3D.h"
#include "hpl1/engine/graphics/RendererPostEffects.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/system/LowLevelSystem.h"
@@ -70,7 +70,7 @@ namespace hpl {
//-----------------------------------------------------------------------
-cGraphics::cGraphics(iLowLevelGraphics *apLowLevelGraphics, iLowLevelResources *apLowLevelResources) {
+cGraphics::cGraphics(iLowLevelGraphics *apLowLevelGraphics, LowLevelResources *apLowLevelResources) {
mpLowLevelGraphics = apLowLevelGraphics;
mpLowLevelResources = apLowLevelResources;
diff --git a/engines/hpl1/engine/graphics/Graphics.h b/engines/hpl1/engine/graphics/Graphics.h
index 89f5c82f59c..0e3213972f8 100644
--- a/engines/hpl1/engine/graphics/Graphics.h
+++ b/engines/hpl1/engine/graphics/Graphics.h
@@ -38,14 +38,14 @@ class cRenderer3D;
class cRendererPostEffects;
class cRenderList;
class cGraphicsDrawer;
-class iLowLevelResources;
+class LowLevelResources;
class iLowLevelGraphics;
class cMeshCreator;
class cMaterialHandler;
class cGraphics {
public:
- cGraphics(iLowLevelGraphics *apLowLevelGraphics, iLowLevelResources *apLowLevelResources);
+ cGraphics(iLowLevelGraphics *apLowLevelGraphics, LowLevelResources *apLowLevelResources);
~cGraphics();
bool Init(int alWidth, int alHeight, int alBpp, int abFullscreen, int alMultisampling,
@@ -71,7 +71,7 @@ public:
private:
iLowLevelGraphics *mpLowLevelGraphics;
- iLowLevelResources *mpLowLevelResources;
+ LowLevelResources *mpLowLevelResources;
cGraphicsDrawer *mpDrawer;
cMeshCreator *mpMeshCreator;
cMaterialHandler *mpMaterialHandler;
diff --git a/engines/hpl1/engine/graphics/Renderer2D.cpp b/engines/hpl1/engine/graphics/Renderer2D.cpp
index 203513af953..37adda6ac2f 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer2D.cpp
@@ -32,7 +32,7 @@
#include "hpl1/engine/graphics/RenderObject2D.h"
#include "hpl1/engine/graphics/Texture.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/resources/TextureManager.h"
#include "hpl1/engine/scene/Camera2D.h"
diff --git a/engines/hpl1/engine/graphics/Renderer2D.h b/engines/hpl1/engine/graphics/Renderer2D.h
index 4170b8c2687..2beb8a1b6a6 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.h
+++ b/engines/hpl1/engine/graphics/Renderer2D.h
@@ -46,7 +46,7 @@ namespace hpl {
class cScene;
class cResources;
class iLowLevelGraphics;
-class iLowLevelResources;
+class LowLevelResources;
class cRenderObject2D;
class cGraphicsDrawer;
class cCamera2D;
@@ -99,7 +99,7 @@ public:
private:
iLowLevelGraphics *mpLowLevelGraphics;
- iLowLevelResources *mpLowLevelResources;
+ LowLevelResources *mpLowLevelResources;
cResources *mpResources;
cGraphicsDrawer *mpGraphicsDrawer;
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index 47efbc7b07f..1b8320371ea 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -38,7 +38,7 @@
#include "hpl1/engine/math/BoundingVolume.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/resources/GpuProgramManager.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/resources/TextureManager.h"
#include "hpl1/engine/scene/Camera3D.h"
diff --git a/engines/hpl1/engine/graphics/Renderer3D.h b/engines/hpl1/engine/graphics/Renderer3D.h
index e1f462bd8bf..ceb33857803 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.h
+++ b/engines/hpl1/engine/graphics/Renderer3D.h
@@ -48,7 +48,7 @@ typedef tFlag tRendererDebugFlag;
class cResources;
class iLowLevelGraphics;
-class iLowLevelResources;
+class LowLevelResources;
class iTexture;
class cCamera3D;
class cWorld3D;
@@ -218,7 +218,7 @@ private:
eMaterialRenderType aRenderType, iLight3D *apLight);
iLowLevelGraphics *mpLowLevelGraphics;
- iLowLevelResources *mpLowLevelResources;
+ LowLevelResources *mpLowLevelResources;
cRendererPostEffects *mpPostEffects;
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.cpp b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
index 9dbddb44ca8..37381115f5e 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.cpp
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
@@ -33,7 +33,7 @@
#include "hpl1/engine/graphics/Texture.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/resources/GpuProgramManager.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/scene/Scene.h"
#include "hpl1/engine/system/LowLevelSystem.h"
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.h b/engines/hpl1/engine/graphics/RendererPostEffects.h
index 7df7c8f72e2..579ee178175 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.h
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.h
@@ -40,7 +40,7 @@ namespace hpl {
#define kFilterProgramNum (1)
class iLowLevelGraphics;
-class iLowLevelResources;
+class LowLevelResources;
class iGpuProgram;
class cResources;
class iTexture;
@@ -136,7 +136,7 @@ private:
void RenderDepthOfField();
iLowLevelGraphics *mpLowLevelGraphics;
- iLowLevelResources *mpLowLevelResources;
+ LowLevelResources *mpLowLevelResources;
cResources *mpResources;
cGpuProgramManager *mpGpuManager;
cRenderer3D *mpRenderer3D;
diff --git a/engines/hpl1/engine/impl/LowLevelResourcesSDL.h b/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
deleted file mode 100644
index a5122932db0..00000000000
--- a/engines/hpl1/engine/impl/LowLevelResourcesSDL.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_LOWLEVELRESOURCES_SDL_H
-#define HPL_LOWLEVELRESOURCES_SDL_H
-
-#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
-#include "hpl1/engine/system/SystemTypes.h"
-
-namespace hpl {
-
-class cLowLevelResourcesSDL : public iLowLevelResources {
-public:
- cLowLevelResourcesSDL(cLowLevelGraphicsSDL *apLowLevelGraphics);
- ~cLowLevelResourcesSDL();
-
- void FindFilesInDir(tStringList &alstStrings, tString asDir, tString asMask);
-
- void GetSupportedImageFormats(tStringList &alstFormats);
- Bitmap2D *LoadBitmap2D(tString asFilePath, tString asType = "");
-
- void AddMeshLoaders(cMeshLoaderHandler *apHandler);
- void AddVideoLoaders(cVideoManager *apManager);
-
-private:
- tString mvImageFormats[30];
- cLowLevelGraphicsSDL *mpLowLevelGraphics;
-};
-}; // namespace hpl
-#endif // HPL_LOWLEVELRESOURCES_SDL_H
diff --git a/engines/hpl1/engine/impl/SDLGameSetup.cpp b/engines/hpl1/engine/impl/SDLGameSetup.cpp
index de6172cb984..9b6ae87e8d1 100644
--- a/engines/hpl1/engine/impl/SDLGameSetup.cpp
+++ b/engines/hpl1/engine/impl/SDLGameSetup.cpp
@@ -35,7 +35,7 @@
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
#include "hpl1/engine/impl/LowLevelInputSDL.h"
#include "hpl1/engine/impl/LowLevelPhysicsNewton.h"
-#include "hpl1/engine/impl/LowLevelResourcesSDL.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
#include "hpl1/engine/impl/LowLevelSystemSDL.h"
#include "hpl1/engine/impl/MouseSDL.h"
diff --git a/engines/hpl1/engine/impl/SDLGameSetup.h b/engines/hpl1/engine/impl/SDLGameSetup.h
index 45d3f493fcd..21535b5999c 100644
--- a/engines/hpl1/engine/impl/SDLGameSetup.h
+++ b/engines/hpl1/engine/impl/SDLGameSetup.h
@@ -33,7 +33,7 @@
#include "hpl1/engine/haptic/LowLevelHaptic.h"
#include "hpl1/engine/input/LowLevelInput.h"
#include "hpl1/engine/physics/LowLevelPhysics.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/sound/LowLevelSound.h"
#include "hpl1/engine/system/LowLevelSystem.h"
@@ -59,7 +59,7 @@ private:
iLowLevelSystem *mpLowLevelSystem;
iLowLevelGraphics *mpLowLevelGraphics;
iLowLevelInput *mpLowLevelInput;
- iLowLevelResources *mpLowLevelResources;
+ LowLevelResources *mpLowLevelResources;
// #ifdef WIN32
// iLowLevelSound* mpLowLevelSound;
// #else
diff --git a/engines/hpl1/engine/resources/FileSearcher.cpp b/engines/hpl1/engine/resources/FileSearcher.cpp
index f389a1f6113..ed0bb568e76 100644
--- a/engines/hpl1/engine/resources/FileSearcher.cpp
+++ b/engines/hpl1/engine/resources/FileSearcher.cpp
@@ -26,7 +26,7 @@
*/
#include "hpl1/engine/resources/FileSearcher.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/hpl1.h"
@@ -39,7 +39,7 @@ namespace hpl {
//-----------------------------------------------------------------------
-cFileSearcher::cFileSearcher(iLowLevelResources *apLowLevelResources) {
+cFileSearcher::cFileSearcher(LowLevelResources *apLowLevelResources) {
mpLowLevelResources = apLowLevelResources;
}
diff --git a/engines/hpl1/engine/resources/FileSearcher.h b/engines/hpl1/engine/resources/FileSearcher.h
index 0b1ce17ce46..5573c1e1476 100644
--- a/engines/hpl1/engine/resources/FileSearcher.h
+++ b/engines/hpl1/engine/resources/FileSearcher.h
@@ -34,14 +34,14 @@
namespace hpl {
-class iLowLevelResources;
+class LowLevelResources;
typedef std::multimap<tString, tString> tFilePathMap;
typedef tFilePathMap::iterator tFilePathMapIt;
class cFileSearcher {
public:
- cFileSearcher(iLowLevelResources *apLowLevelResources);
+ cFileSearcher(LowLevelResources *apLowLevelResources);
~cFileSearcher();
/**
@@ -67,7 +67,7 @@ private:
tFilePathMap m_mapFiles;
tStringSet m_setLoadedDirs;
- iLowLevelResources *mpLowLevelResources;
+ LowLevelResources *mpLowLevelResources;
};
}; // namespace hpl
diff --git a/engines/hpl1/engine/resources/GpuProgramManager.cpp b/engines/hpl1/engine/resources/GpuProgramManager.cpp
index b09368422b8..feffb37807e 100644
--- a/engines/hpl1/engine/resources/GpuProgramManager.cpp
+++ b/engines/hpl1/engine/resources/GpuProgramManager.cpp
@@ -40,7 +40,7 @@ namespace hpl {
//-----------------------------------------------------------------------
cGpuProgramManager::cGpuProgramManager(cFileSearcher *apFileSearcher, iLowLevelGraphics *apLowLevelGraphics,
- iLowLevelResources *apLowLevelResources, iLowLevelSystem *apLowLevelSystem)
+ LowLevelResources *apLowLevelResources, iLowLevelSystem *apLowLevelSystem)
: iResourceManager(apFileSearcher, apLowLevelResources, apLowLevelSystem) {
mpLowLevelGraphics = apLowLevelGraphics;
}
diff --git a/engines/hpl1/engine/resources/GpuProgramManager.h b/engines/hpl1/engine/resources/GpuProgramManager.h
index 7247e7b0d43..bb47921a3f2 100644
--- a/engines/hpl1/engine/resources/GpuProgramManager.h
+++ b/engines/hpl1/engine/resources/GpuProgramManager.h
@@ -39,7 +39,7 @@ class iLowLevelGraphics;
class cGpuProgramManager : public iResourceManager {
public:
cGpuProgramManager(cFileSearcher *apFileSearcher, iLowLevelGraphics *apLowLevelGraphics,
- iLowLevelResources *apLowLevelResources, iLowLevelSystem *apLowLevelSystem);
+ LowLevelResources *apLowLevelResources, iLowLevelSystem *apLowLevelSystem);
~cGpuProgramManager();
iResourceBase *Create(const tString &asName);
diff --git a/engines/hpl1/engine/resources/ImageManager.cpp b/engines/hpl1/engine/resources/ImageManager.cpp
index fd66246bf06..f0ecf8158a7 100644
--- a/engines/hpl1/engine/resources/ImageManager.cpp
+++ b/engines/hpl1/engine/resources/ImageManager.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/resources/FrameBitmap.h"
#include "hpl1/engine/resources/FrameTexture.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/ResourceImage.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/system/String.h"
@@ -43,7 +43,7 @@ namespace hpl {
//-----------------------------------------------------------------------
cImageManager::cImageManager(cFileSearcher *apFileSearcher, iLowLevelGraphics *apLowLevelGraphics,
- iLowLevelResources *apLowLevelResources, iLowLevelSystem *apLowLevelSystem)
+ LowLevelResources *apLowLevelResources, iLowLevelSystem *apLowLevelSystem)
: iResourceManager(apFileSearcher, apLowLevelResources, apLowLevelSystem) {
mpLowLevelGraphics = apLowLevelGraphics;
diff --git a/engines/hpl1/engine/resources/ImageManager.h b/engines/hpl1/engine/resources/ImageManager.h
index 7297dd235be..b83d5d16a5d 100644
--- a/engines/hpl1/engine/resources/ImageManager.h
+++ b/engines/hpl1/engine/resources/ImageManager.h
@@ -48,7 +48,7 @@ typedef tFrameTextureMap::iterator tFrameTextureMapIt;
class cImageManager : public iResourceManager {
public:
cImageManager(cFileSearcher *apFileSearcher, iLowLevelGraphics *apLowLevelGraphics,
- iLowLevelResources *apLowLevelResources, iLowLevelSystem *apLowLevelSystem);
+ LowLevelResources *apLowLevelResources, iLowLevelSystem *apLowLevelSystem);
~cImageManager();
iResourceBase *Create(const tString &asName);
diff --git a/engines/hpl1/engine/resources/ResourceManager.cpp b/engines/hpl1/engine/resources/ResourceManager.cpp
index 14498140d18..edd6df9fbde 100644
--- a/engines/hpl1/engine/resources/ResourceManager.cpp
+++ b/engines/hpl1/engine/resources/ResourceManager.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/resources/FileSearcher.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/ResourceBase.h"
#include "hpl1/engine/system/LowLevelSystem.h"
@@ -47,7 +47,7 @@ int iResourceManager::mlTabCount = 0;
//-----------------------------------------------------------------------
iResourceManager::iResourceManager(cFileSearcher *apFileSearcher,
- iLowLevelResources *apLowLevelResources,
+ LowLevelResources *apLowLevelResources,
iLowLevelSystem *apLowLevelSystem) {
mpFileSearcher = apFileSearcher;
mpLowLevelResources = apLowLevelResources;
diff --git a/engines/hpl1/engine/resources/ResourceManager.h b/engines/hpl1/engine/resources/ResourceManager.h
index f1ddd3006fc..de5eb0c8730 100644
--- a/engines/hpl1/engine/resources/ResourceManager.h
+++ b/engines/hpl1/engine/resources/ResourceManager.h
@@ -33,7 +33,7 @@
namespace hpl {
-class iLowLevelResources;
+class LowLevelResources;
class iLowLevelSystem;
class cFileSearcher;
class iResourceBase;
@@ -51,7 +51,7 @@ typedef cSTLMapIterator<iResourceBase *, tResourceNameMap, tResourceNameMapIt> c
class iResourceManager {
public:
- iResourceManager(cFileSearcher *apFileSearcher, iLowLevelResources *apLowLevelResources,
+ iResourceManager(cFileSearcher *apFileSearcher, LowLevelResources *apLowLevelResources,
iLowLevelSystem *apLowLevelSystem);
virtual ~iResourceManager() {}
@@ -77,7 +77,7 @@ protected:
tResourceHandleMap m_mapHandleResources;
cFileSearcher *mpFileSearcher;
- iLowLevelResources *mpLowLevelResources;
+ LowLevelResources *mpLowLevelResources;
iLowLevelSystem *mpLowLevelSystem;
void BeginLoad(const tString &asFile);
diff --git a/engines/hpl1/engine/resources/Resources.cpp b/engines/hpl1/engine/resources/Resources.cpp
index cc6e00c3007..7265f49d8c0 100644
--- a/engines/hpl1/engine/resources/Resources.cpp
+++ b/engines/hpl1/engine/resources/Resources.cpp
@@ -35,7 +35,7 @@
#include "hpl1/engine/resources/ImageEntityManager.h"
#include "hpl1/engine/resources/ImageManager.h"
#include "hpl1/engine/resources/LanguageFile.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/MaterialManager.h"
#include "hpl1/engine/resources/MeshLoaderHandler.h"
#include "hpl1/engine/resources/MeshManager.h"
@@ -61,7 +61,7 @@ namespace hpl {
//-----------------------------------------------------------------------
-cResources::cResources(iLowLevelResources *apLowLevelResources, iLowLevelGraphics *apLowLevelGraphics)
+cResources::cResources(LowLevelResources *apLowLevelResources, iLowLevelGraphics *apLowLevelGraphics)
: iUpdateable("Resources") {
mpLowLevelResources = apLowLevelResources;
mpLowLevelGraphics = apLowLevelGraphics;
@@ -347,7 +347,7 @@ bool cResources::LoadResourceDirsFile(const tString &asFile) {
//-----------------------------------------------------------------------
-iLowLevelResources *cResources::GetLowLevel() {
+LowLevelResources *cResources::GetLowLevel() {
return mpLowLevelResources;
}
diff --git a/engines/hpl1/engine/resources/Resources.h b/engines/hpl1/engine/resources/Resources.h
index a7a35a4e41e..2130ad57270 100644
--- a/engines/hpl1/engine/resources/Resources.h
+++ b/engines/hpl1/engine/resources/Resources.h
@@ -41,7 +41,7 @@ namespace hpl {
class cImageEntity;
-class iLowLevelResources;
+class LowLevelResources;
class iLowLevelGraphics;
class iLowLevelSystem;
class cSystem;
@@ -159,14 +159,14 @@ typedef tResourceManagerList::iterator tResourceManagerListIt;
class cResources : public iUpdateable {
public:
- cResources(iLowLevelResources *apLowLevelResources, iLowLevelGraphics *apLowLevelGraphics);
+ cResources(LowLevelResources *apLowLevelResources, iLowLevelGraphics *apLowLevelGraphics);
~cResources();
void Init(cGraphics *apGraphics, cSystem *apSystem, cSound *apSound, cScene *apScene, cGui *apGui);
void Update(float afTimeStep);
- iLowLevelResources *GetLowLevel();
+ LowLevelResources *GetLowLevel();
cFileSearcher *GetFileSearcher();
bool AddResourceDir(const tString &asDir, const tString &asMask = "*.*");
@@ -208,7 +208,7 @@ public:
iLowLevelSystem *GetLowLevelSystem() { return mpLowLevelSystem; }
private:
- iLowLevelResources *mpLowLevelResources;
+ LowLevelResources *mpLowLevelResources;
iLowLevelGraphics *mpLowLevelGraphics;
iLowLevelSystem *mpLowLevelSystem;
cFileSearcher *mpFileSearcher;
diff --git a/engines/hpl1/engine/resources/TextureManager.cpp b/engines/hpl1/engine/resources/TextureManager.cpp
index 60e50672f72..99506ae1503 100644
--- a/engines/hpl1/engine/resources/TextureManager.cpp
+++ b/engines/hpl1/engine/resources/TextureManager.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/graphics/Texture.h"
#include "hpl1/engine/resources/FileSearcher.h"
-#include "hpl1/engine/resources/LowLevelResources.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/system/LowLevelSystem.h"
#include "hpl1/engine/system/String.h"
diff --git a/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp b/engines/hpl1/engine/resources/low_level_resources.cpp
similarity index 52%
rename from engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
rename to engines/hpl1/engine/resources/low_level_resources.cpp
index c6ac4bc913d..01acb227def 100644
--- a/engines/hpl1/engine/impl/LowLevelResourcesSDL.cpp
+++ b/engines/hpl1/engine/resources/low_level_resources.cpp
@@ -19,23 +19,8 @@
*
*/
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#include "hpl1/engine/impl/LowLevelResourcesSDL.h"
-#include "hpl1/engine/impl/MeshLoaderCollada.h"
-#include "hpl1/engine/impl/MeshLoaderMSH.h"
-#include "hpl1/engine/graphics/bitmap2D.h"
-#ifdef INCLUDE_THEORA
-#include "hpl1/engine/impl/VideoStreamTheora.h"
-#endif
-#include "hpl1/engine/system/String.h"
-
-//#include "SDL/SDL.h"
-//#include "SDL/SDL_image.h"
+#include "hpl1/engine/resources/low_level_resources.h"
+#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/resources/MeshLoaderHandler.h"
#include "hpl1/engine/resources/VideoManager.h"
#include "common/fs.h"
@@ -43,42 +28,7 @@
namespace hpl {
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cLowLevelResourcesSDL::cLowLevelResourcesSDL(cLowLevelGraphicsSDL *apLowLevelGraphics) {
- mvImageFormats[0] = "BMP";
- mvImageFormats[1] = "LBM";
- mvImageFormats[2] = "PCX";
- mvImageFormats[3] = "GIF";
- mvImageFormats[4] = "JPEG";
- mvImageFormats[5] = "PNG";
- mvImageFormats[6] = "JPG";
- mvImageFormats[7] = "TGA";
- mvImageFormats[8] = "TIFF";
- mvImageFormats[9] = "TIF";
- mvImageFormats[10] = "";
-
- mpLowLevelGraphics = apLowLevelGraphics;
-}
-
-//-----------------------------------------------------------------------
-
-cLowLevelResourcesSDL::~cLowLevelResourcesSDL() {
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHOD
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-Bitmap2D *cLowLevelResourcesSDL::LoadBitmap2D(tString asFilePath, tString asType) {
+Bitmap2D *LowLevelResources::LoadBitmap2D(tString filepath, tString type) {
#if 0
tString tType;
if(asType != "")
@@ -126,36 +76,25 @@ Bitmap2D *cLowLevelResourcesSDL::LoadBitmap2D(tString asFilePath, tString asType
return nullptr;
}
-//-----------------------------------------------------------------------
-
-void cLowLevelResourcesSDL::GetSupportedImageFormats(tStringList &alstFormats) {
- int lPos = 0;
-
- while (mvImageFormats[lPos] != "") {
- alstFormats.push_back(mvImageFormats[lPos]);
- lPos++;
- }
+void LowLevelResources::GetSupportedImageFormats(tStringList &formats) {
+ formats.insert(formats.end(), {
+ "BMP","LBM","PCX","GIF","JPEG","PNG","JPG","TGA","TIFF","TIF"});
}
-//-----------------------------------------------------------------------
-void cLowLevelResourcesSDL::AddMeshLoaders(cMeshLoaderHandler *apHandler) {
- // apHandler->AddLoader(hplNew( cMeshLoaderFBX,(mpLowLevelGraphics)));
- apHandler->AddLoader(hplNew(cMeshLoaderMSH, (mpLowLevelGraphics)));
- apHandler->AddLoader(hplNew(cMeshLoaderCollada, (mpLowLevelGraphics)));
+void LowLevelResources::AddMeshLoaders(cMeshLoaderHandler *ml) {
+#if 0
+ ml->AddLoader(hplNew(cMeshLoaderMSH, (mpLowLevelGraphics)));
+ ml->AddLoader(hplNew(cMeshLoaderCollada, (mpLowLevelGraphics)));
+#endif
}
-//-----------------------------------------------------------------------
-
-void cLowLevelResourcesSDL::AddVideoLoaders(cVideoManager *apManager) {
+void LowLevelResources::AddVideoLoaders(cVideoManager *vm) {
#ifdef INCLUDE_THORA
apManager->AddVideoLoader(hplNew(cVideoStreamTheora_Loader, ()));
#endif
}
-//-----------------------------------------------------------------------
-
-
-void cLowLevelResourcesSDL::FindFilesInDir(tStringList &alstStrings, tString asDir, tString asMask) {
+void LowLevelResources::FindFilesInDir(tStringList &alstStrings, tString asDir, tString asMask) {
//FIXME: use consistent string types
Common::String pattern = Common::String(asDir.c_str()) + '/' + Common::String(asMask.c_str());
Common::ArchiveMemberList ls;
@@ -166,6 +105,5 @@ void cLowLevelResourcesSDL::FindFilesInDir(tStringList &alstStrings, tString asD
alstStrings.push_back(f->getName().c_str());
}
-//-----------------------------------------------------------------------
-
} // namespace hpl
+
diff --git a/engines/hpl1/engine/resources/LowLevelResources.h b/engines/hpl1/engine/resources/low_level_resources.h
similarity index 65%
rename from engines/hpl1/engine/resources/LowLevelResources.h
rename to engines/hpl1/engine/resources/low_level_resources.h
index 940c41b31f4..7f404f4d927 100644
--- a/engines/hpl1/engine/resources/LowLevelResources.h
+++ b/engines/hpl1/engine/resources/low_level_resources.h
@@ -35,24 +35,23 @@ namespace hpl {
class Bitmap2D;
class cMeshLoaderHandler;
class cVideoManager;
+class cLowLevelGraphics;
-class iLowLevelResources {
+class LowLevelResources {
public:
- virtual ~iLowLevelResources() {}
+ LowLevelResources(cLowLevelGraphics *lowLevelGraphics) : _lowLevelGraphics(lowLevelGraphics) {
+ }
- /**
- * Returns a list of files in a dir
- * \param &alstStrings list where the files are saved
- * \param asDir Directory
- * \param asMask Mask to be used, for example "*.*" to search for all kinds of files.
- */
- virtual void FindFilesInDir(tStringList &alstStrings, tString asDir, tString asMask) = 0;
+ //Returns a list of files in a directory matching a pattern
+ virtual void FindFilesInDir(tStringList &fileList, tString dir, tString pattern);
- virtual void GetSupportedImageFormats(tStringList &alstFormats) = 0;
- virtual Bitmap2D *LoadBitmap2D(tString asFilePath, tString asType = "") = 0;
+ virtual void GetSupportedImageFormats(tStringList &formats);
+ virtual Bitmap2D *LoadBitmap2D(tString filepath, tString type = "");
- virtual void AddMeshLoaders(cMeshLoaderHandler *apHandler) = 0;
- virtual void AddVideoLoaders(cVideoManager *apManager) = 0;
+ virtual void AddMeshLoaders(cMeshLoaderHandler *ml);
+ virtual void AddVideoLoaders(cVideoManager *vm);
+private:
+ cLowLevelGraphics *_lowLevelGraphics;
};
}; // namespace hpl
#endif // HPL_LOWLEVELRESOURCES_H
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 5d911fa04c0..6097ab09390 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -95,7 +95,7 @@ MODULE_OBJS := \
engine/impl/LowLevelGraphicsSDL.o \
engine/impl/LowLevelInputSDL.o \
engine/impl/LowLevelPhysicsNewton.o \
- engine/impl/LowLevelResourcesSDL.o \
+ engine/resources/low_level_resources.o \
engine/impl/LowLevelSoundOpenAL.o \
engine/impl/LowLevelSystemSDL.o \
engine/impl/MeshLoaderCollada.o \
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 08cb1dddc22..0b471d9b7b6 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -2609,7 +2609,7 @@ void cMainMenu::CreateWidgets() {
mpInit, vPos, cVector2f(355, 170), 15, sDir, (int)i));
AddWidgetToState(state, gpSaveGameList[i]);
- iLowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
+ LowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
iLowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
tStringList lstFiles;
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index 75382619897..dccbcf9457b 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -668,7 +668,7 @@ void cSaveHandler::OnExit() {
//-----------------------------------------------------------------------
void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMask, int alMaxFiles) {
- iLowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
+ LowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
iLowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
tWString sPath = msSaveDir + asDir;
@@ -697,7 +697,7 @@ void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMa
//-----------------------------------------------------------------------
tWString cSaveHandler::GetLatest(const tWString &asDir, const tWString &asMask) {
- iLowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
+ LowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
iLowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
tWString sPath = msSaveDir + asDir;
Commit: 1424428d8d6bb4965abab29fd9c9adbb72271430
https://github.com/scummvm/scummvm/commit/1424428d8d6bb4965abab29fd9c9adbb72271430
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:29+01:00
Commit Message:
HPL1: fix module.mk and rename Bitmap2D.h
Changed paths:
A engines/hpl1/engine/graphics/bitmap2D.h
R engines/hpl1/engine/graphics/Bitmap2D.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/graphics/Bitmap2D.h b/engines/hpl1/engine/graphics/bitmap2D.h
similarity index 100%
rename from engines/hpl1/engine/graphics/Bitmap2D.h
rename to engines/hpl1/engine/graphics/bitmap2D.h
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 6097ab09390..da262adec92 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -67,6 +67,7 @@ MODULE_OBJS := \
engine/graphics/RendererPostEffects.o \
engine/graphics/Skeleton.o \
engine/graphics/SubMesh.o \
+ engine/graphics/bitmap2D.o \
engine/gui/Gui.o \
engine/gui/GuiGfxElement.o \
engine/gui/GuiMaterialBasicTypes.o \
@@ -95,7 +96,6 @@ MODULE_OBJS := \
engine/impl/LowLevelGraphicsSDL.o \
engine/impl/LowLevelInputSDL.o \
engine/impl/LowLevelPhysicsNewton.o \
- engine/resources/low_level_resources.o \
engine/impl/LowLevelSoundOpenAL.o \
engine/impl/LowLevelSystemSDL.o \
engine/impl/MeshLoaderCollada.o \
@@ -116,7 +116,6 @@ MODULE_OBJS := \
engine/impl/PhysicsJointSliderNewton.o \
engine/impl/PhysicsMaterialNewton.o \
engine/impl/PhysicsWorldNewton.o \
- engine/graphics/bitmap2D.o \
engine/impl/SDLFontData.o \
engine/impl/SDLGameSetup.o \
engine/impl/SDLTexture.o \
@@ -183,6 +182,7 @@ MODULE_OBJS := \
engine/resources/TextureManager.o \
engine/resources/TileSetManager.o \
engine/resources/VideoManager.o \
+ engine/resources/low_level_resources.o \
engine/scene/AnimationState.o \
engine/scene/Area2D.o \
engine/scene/Camera2D.o \
@@ -223,8 +223,6 @@ MODULE_OBJS := \
engine/sound/LowLevelSound.o \
engine/sound/MusicHandler.o \
engine/sound/Sound.o \
- engine/sound/SoundEntityData.o \
- engine/sound/SoundHandler.o \
engine/system/Container.o \
engine/system/LogicTimer.o \
engine/system/MemoryManager.o \
Commit: 627648565757cc7dc50fa0bb9b821aa58214b919
https://github.com/scummvm/scummvm/commit/627648565757cc7dc50fa0bb9b821aa58214b919
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:29+01:00
Commit Message:
HPL1: replace implementation of OpenBrowserWindow
Changed paths:
engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
index e99fd7eb313..548b4e8ae3a 100644
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
@@ -59,6 +59,7 @@
#include "hpl1/engine/impl/scriptstring.h"
#include "hpl1/engine/impl/stdstring.h"
#include "hpl1/engine/system/String.h"
+#include "common/system.h"
#include <clocale>
//#include <ObjectArray.h>
@@ -315,15 +316,8 @@ static cDate DateFromGMTIme(struct tm *apClock) {
//-----------------------------------------------------------------------
void OpenBrowserWindow(const tWString &asURL) {
-#if 0 // def WIN32
- ShellExecute ( NULL, _W("open"), asURL.c_str(), NULL, NULL, SW_SHOWNORMAL );
-#elif defined(__linux__)
- tString asTemp = "./openurl.sh " + cString::To8Char(asURL);
- system(asTemp.c_str());
-#elif defined(__APPLE__)
- tString asTemp = "open " + cString::To8Char(asURL);
- system(asTemp.c_str());
-#endif
+ // FIXME: use proper string types
+ g_system->openUrl(cString::To8Char(asURL).c_str());
}
//-----------------------------------------------------------------------
Commit: c4ce14c383c4dbc14735e2c7ce0a90e18bde1f3b
https://github.com/scummvm/scummvm/commit/c4ce14c383c4dbc14735e2c7ce0a90e18bde1f3b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:29+01:00
Commit Message:
HPL1: remove system dependent include
Changed paths:
engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
diff --git a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
index 0530c58bda6..fd0ef4c51c7 100644
--- a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
+++ b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
@@ -29,9 +29,6 @@
#define HPL_LOWLEVELPHYSICS_NEWTON_H
#include "hpl1/engine/physics/LowLevelPhysics.h"
-#if defined(__linux__) || defined(__APPLE__)
-#include <unistd.h>
-#endif
#include "hpl1/engine/libraries/newton/Newton.h"
namespace hpl {
Commit: c5e11ac7382df6d4672498a5bd59fe40984f1c35
https://github.com/scummvm/scummvm/commit/c5e11ac7382df6d4672498a5bd59fe40984f1c35
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:29+01:00
Commit Message:
HPL1: remove system dependent includes
Changed paths:
engines/hpl1/engine/impl/CollideShapeNewton.h
engines/hpl1/engine/impl/PhysicsBodyNewton.h
engines/hpl1/engine/impl/PhysicsJointNewton.h
engines/hpl1/engine/impl/PhysicsMaterialNewton.h
engines/hpl1/engine/impl/PhysicsWorldNewton.h
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.h b/engines/hpl1/engine/impl/CollideShapeNewton.h
index 47a6ded009b..e5467a1dafb 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.h
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.h
@@ -28,9 +28,6 @@
#ifndef HPL_COLLIDE_SHAPE_NEWTON_H
#define HPL_COLLIDE_SHAPE_NEWTON_H
-#if defined(__linux__) || defined(__APPLE__)
-#include <unistd.h>
-#endif
#include "hpl1/engine/libraries/newton/Newton.h"
#include "hpl1/engine/physics/CollideShape.h"
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.h b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
index 38a2c026604..002e47c1e2b 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
@@ -28,9 +28,6 @@
#ifndef HPL_PHYSICS_BODY_NEWTON_H
#define HPL_PHYSICS_BODY_NEWTON_H
-#if defined(__linux__) || defined(__APPLE__)
-#include <unistd.h>
-#endif
#include "hpl1/engine/libraries/newton/Newton.h"
#include "hpl1/engine/physics/PhysicsBody.h"
diff --git a/engines/hpl1/engine/impl/PhysicsJointNewton.h b/engines/hpl1/engine/impl/PhysicsJointNewton.h
index 511fa0be35f..175d7fe801f 100644
--- a/engines/hpl1/engine/impl/PhysicsJointNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointNewton.h
@@ -28,9 +28,6 @@
#ifndef HPL_PHYSICS_JOINT_NEWTON_H
#define HPL_PHYSICS_JOINT_NEWTON_H
-#if defined(__linux__) || defined(__APPLE__)
-#include <unistd.h>
-#endif
#include "hpl1/engine/impl/PhysicsBodyNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
#include "hpl1/engine/libraries/newton/Newton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.h b/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
index 8939e8cb79c..16457e92dbd 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
@@ -28,9 +28,6 @@
#ifndef HPL_PHYSICS_MATERIAL_NEWTON_H
#define HPL_PHYSICS_MATERIAL_NEWTON_H
-#if defined(__linux__) || defined(__APPLE__)
-#include <unistd.h>
-#endif
#include "hpl1/engine/libraries/newton/Newton.h"
#include "hpl1/engine/physics/PhysicsMaterial.h"
diff --git a/engines/hpl1/engine/impl/PhysicsWorldNewton.h b/engines/hpl1/engine/impl/PhysicsWorldNewton.h
index 89110efbd1f..153473e017a 100644
--- a/engines/hpl1/engine/impl/PhysicsWorldNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsWorldNewton.h
@@ -30,9 +30,6 @@
#include "hpl1/engine/physics/PhysicsWorld.h"
-#if defined(__linux__) || defined(__APPLE__)
-#include <unistd.h>
-#endif
#include "hpl1/engine/libraries/newton/Newton.h"
namespace hpl {
Commit: 2844bc52bd0b53db5d7d7514ca9b88269b780942
https://github.com/scummvm/scummvm/commit/2844bc52bd0b53db5d7d7514ca9b88269b780942
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:29+01:00
Commit Message:
HPL1: Fix warnings
Changed paths:
engines/hpl1/engine/ai/AINodeGenerator.cpp
engines/hpl1/engine/ai/AINodeGenerator.h
engines/hpl1/engine/game/Updateable.h
engines/hpl1/engine/graphics/Renderable.h
engines/hpl1/engine/physics/PhysicsBody.h
engines/hpl1/engine/physics/PhysicsWorld.h
engines/hpl1/engine/resources/Resources.h
engines/hpl1/engine/system/Container.h
engines/hpl1/engine/system/SerializeClass.h
engines/hpl1/penumbra-overture/GameEntity.cpp
engines/hpl1/penumbra-overture/GameEntity.h
engines/hpl1/penumbra-overture/SaveHandler.h
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.cpp b/engines/hpl1/engine/ai/AINodeGenerator.cpp
index 007e0e1bf8d..2ab944376ff 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.cpp
+++ b/engines/hpl1/engine/ai/AINodeGenerator.cpp
@@ -67,6 +67,7 @@ cAINodeGeneratorParams::cAINodeGeneratorParams() {
class cCollideRayCallback : public iPhysicsRayCallback {
public:
+ virtual ~cCollideRayCallback() {}
bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
if (pBody->GetMass() != 0)
return true;
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.h b/engines/hpl1/engine/ai/AINodeGenerator.h
index d963b651c71..b122f3f674f 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.h
+++ b/engines/hpl1/engine/ai/AINodeGenerator.h
@@ -60,7 +60,7 @@ public:
class cAINodeGenerator : public iPhysicsRayCallback {
public:
cAINodeGenerator();
- ~cAINodeGenerator();
+ virtual ~cAINodeGenerator();
void Generate(cWorld3D *apWorld, cAINodeGeneratorParams *apParams);
diff --git a/engines/hpl1/engine/game/Updateable.h b/engines/hpl1/engine/game/Updateable.h
index 5f741dbdbd6..f7535b29748 100644
--- a/engines/hpl1/engine/game/Updateable.h
+++ b/engines/hpl1/engine/game/Updateable.h
@@ -35,6 +35,7 @@ namespace hpl {
class iUpdateable {
public:
iUpdateable(const tString &asName) : msName(asName) {}
+ virtual ~iUpdateable() {}
virtual void OnDraw() {}
diff --git a/engines/hpl1/engine/graphics/Renderable.h b/engines/hpl1/engine/graphics/Renderable.h
index 81ab541736d..1ecaac7d213 100644
--- a/engines/hpl1/engine/graphics/Renderable.h
+++ b/engines/hpl1/engine/graphics/Renderable.h
@@ -60,7 +60,7 @@ enum eRenderableType {
//------------------------------------------
kSaveData_ChildClass(iEntity3D, iRenderable) {
- kSerializableClassInit(iRenderable) public : bool mbStatic;
+ kSerializableClassInit(cSaveData_iRenderable) public : bool mbStatic;
bool mbRendered;
float mfZ;
};
diff --git a/engines/hpl1/engine/physics/PhysicsBody.h b/engines/hpl1/engine/physics/PhysicsBody.h
index 8468f697109..67b7c70419e 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.h
+++ b/engines/hpl1/engine/physics/PhysicsBody.h
@@ -49,6 +49,7 @@ class iHapticShape;
class iPhysicsBody;
class iPhysicsBodyCallback {
public:
+ virtual ~iPhysicsBodyCallback() {}
virtual bool OnBeginCollision(iPhysicsBody *apBody, iPhysicsBody *apCollideBody) = 0;
virtual void OnCollide(iPhysicsBody *apBody, iPhysicsBody *apCollideBody,
cPhysicsContactData *apContactData) = 0;
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.h b/engines/hpl1/engine/physics/PhysicsWorld.h
index dad546d8841..349cccc36c9 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.h
+++ b/engines/hpl1/engine/physics/PhysicsWorld.h
@@ -99,12 +99,14 @@ public:
class iPhysicsRayCallback {
public:
+ virtual ~iPhysicsRayCallback() = default;
virtual bool BeforeIntersect(iPhysicsBody *pBody) { return true; }
virtual bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) = 0;
};
class iPhysicsWorldCollisionCallback {
public:
+ virtual ~iPhysicsWorldCollisionCallback() = default;
virtual void OnCollision(iPhysicsBody *apBody, cCollideData *apCollideData) = 0;
};
diff --git a/engines/hpl1/engine/resources/Resources.h b/engines/hpl1/engine/resources/Resources.h
index 2130ad57270..77698126a4d 100644
--- a/engines/hpl1/engine/resources/Resources.h
+++ b/engines/hpl1/engine/resources/Resources.h
@@ -160,7 +160,7 @@ typedef tResourceManagerList::iterator tResourceManagerListIt;
class cResources : public iUpdateable {
public:
cResources(LowLevelResources *apLowLevelResources, iLowLevelGraphics *apLowLevelGraphics);
- ~cResources();
+ virtual ~cResources();
void Init(cGraphics *apGraphics, cSystem *apSystem, cSound *apSound, cScene *apScene, cGui *apGui);
diff --git a/engines/hpl1/engine/system/Container.h b/engines/hpl1/engine/system/Container.h
index 8901bfd509c..c269ab255a4 100644
--- a/engines/hpl1/engine/system/Container.h
+++ b/engines/hpl1/engine/system/Container.h
@@ -41,6 +41,9 @@ namespace hpl {
class iContainerIterator {
friend class cSerializeClass;
+public:
+ virtual ~iContainerIterator() {}
+
protected:
virtual bool HasNext() = 0;
@@ -183,6 +186,8 @@ public:
mIt = apVec->begin();
}
+ virtual ~cContainerListIterator() {}
+
bool HasNext() {
return mIt != mpVec->end();
}
@@ -224,6 +229,7 @@ private:
public:
cContainerList() {}
+ virtual ~cContainerList() {}
//////////////////////
size_t Size() {
diff --git a/engines/hpl1/engine/system/SerializeClass.h b/engines/hpl1/engine/system/SerializeClass.h
index c9137ec4ca8..3d8916f98a7 100644
--- a/engines/hpl1/engine/system/SerializeClass.h
+++ b/engines/hpl1/engine/system/SerializeClass.h
@@ -108,6 +108,14 @@ public: \
const static tString msSerialize_Name; \
const static tString msSerialize_ParentName; \
const static cSerializeMemberField *mpSerialize_MemberFields; \
+ virtual ~aClass() = default; \
+ virtual tString Serialize_GetTopClass() { return #aClass; }
+
+#define kSerializableClassInit_nodestructor(aClass) \
+public: \
+ const static tString msSerialize_Name; \
+ const static tString msSerialize_ParentName; \
+ const static cSerializeMemberField *mpSerialize_MemberFields; \
virtual tString Serialize_GetTopClass() { return #aClass; }
/**
@@ -245,6 +253,7 @@ public:
class iSerializable {
public:
+ virtual ~iSerializable() = default;
virtual tString Serialize_GetTopClass() { return ""; }
};
@@ -252,6 +261,7 @@ public:
class iSerializableType {
public:
+ virtual ~iSerializableType() = default;
virtual char *ValueToString(void *apVal) = 0;
virtual void ValueFromString(char *apString, void *apVal) = 0;
};
diff --git a/engines/hpl1/penumbra-overture/GameEntity.cpp b/engines/hpl1/penumbra-overture/GameEntity.cpp
index aaa2cdc0b3c..132273234d1 100644
--- a/engines/hpl1/penumbra-overture/GameEntity.cpp
+++ b/engines/hpl1/penumbra-overture/GameEntity.cpp
@@ -781,12 +781,6 @@ void iGameEntity::PreloadModel(const tString &asFile) {
//-----------------------------------------------------------------------
-iGameEntity_SaveData::~iGameEntity_SaveData() {
- // Log("Deleting save data %d\n",this);
-}
-
-//-----------------------------------------------------------------------
-
cEnginePS_SaveData *iGameEntity_SaveData::GetParticleSystem(cParticleSystem3D *apPS) {
for (size_t i = 0; i < mvPS.Size(); ++i) {
if (mvPS[i].msName == apPS->GetName())
diff --git a/engines/hpl1/penumbra-overture/GameEntity.h b/engines/hpl1/penumbra-overture/GameEntity.h
index 4cc525d008a..5d028e85994 100644
--- a/engines/hpl1/penumbra-overture/GameEntity.h
+++ b/engines/hpl1/penumbra-overture/GameEntity.h
@@ -74,9 +74,7 @@ class cGameEntityAnimation_SaveData : public iSerializable {
//------------------------------------------
class iGameEntity_SaveData : public iSerializable {
- kSerializableClassInit(iGameEntity_SaveData) public : virtual ~iGameEntity_SaveData();
-
- bool mbActive;
+ kSerializableClassInit(iGameEntity_SaveData) public : bool mbActive;
tString msFileName;
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.h b/engines/hpl1/penumbra-overture/SaveHandler.h
index cb4ef58bf05..415136a5a6b 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.h
+++ b/engines/hpl1/penumbra-overture/SaveHandler.h
@@ -237,7 +237,7 @@ public:
//---------------------------------------------
class cSavedWorld : public iSerializable {
- kSerializableClassInit(cSavedWorld) public : ~cSavedWorld();
+ kSerializableClassInit_nodestructor(cSavedWorld) public : ~cSavedWorld();
void Reset();
@@ -293,7 +293,7 @@ class cSavedWorld : public iSerializable {
//----------------------------
class cSavedGame : public iSerializable {
- kSerializableClassInit(cSavedGame) public : ~cSavedGame();
+ kSerializableClassInit_nodestructor(cSavedGame) public : ~cSavedGame();
void Reset();
void ResetWorlds();
Commit: 93630a54a84381d1a0292bec3fe68581871dba68
https://github.com/scummvm/scummvm/commit/93630a54a84381d1a0292bec3fe68581871dba68
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:30+01:00
Commit Message:
HPL1: Fix more warnings
Changed paths:
engines/hpl1/engine/ai/AINodeContainer.h
engines/hpl1/engine/game/SaveGame.h
engines/hpl1/engine/graphics/Material.h
engines/hpl1/engine/gui/GuiTypes.h
engines/hpl1/engine/gui/WidgetBaseClasses.h
engines/hpl1/engine/impl/MeshLoaderCollada.h
engines/hpl1/engine/physics/CharacterBody.h
engines/hpl1/engine/resources/MeshLoader.h
engines/hpl1/engine/resources/low_level_resources.h
engines/hpl1/engine/scene/Camera.h
engines/hpl1/engine/scene/Camera3D.h
engines/hpl1/engine/scene/Entity3D.h
engines/hpl1/engine/scene/GridMap2D.h
engines/hpl1/engine/scene/Light.h
engines/hpl1/engine/scene/PortalContainer.h
engines/hpl1/engine/scene/RenderableContainer.h
engines/hpl1/engine/scene/SoundEntity.h
engines/hpl1/engine/sound/SoundChannel.h
engines/hpl1/engine/system/Container.h
engines/hpl1/penumbra-overture/Player.h
engines/hpl1/penumbra-overture/PlayerHands.h
engines/hpl1/penumbra-overture/PlayerHelper.h
diff --git a/engines/hpl1/engine/ai/AINodeContainer.h b/engines/hpl1/engine/ai/AINodeContainer.h
index 638005ec4b9..531dd8075d8 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.h
+++ b/engines/hpl1/engine/ai/AINodeContainer.h
@@ -97,6 +97,7 @@ typedef tAINodeMap::iterator tAINodeMapIt;
class iAIFreePathCallback {
public:
+ virtual ~iAIFreePathCallback() = default;
virtual bool Intersects(iPhysicsBody *pBody, cPhysicsRayParams *apParams) = 0;
};
diff --git a/engines/hpl1/engine/game/SaveGame.h b/engines/hpl1/engine/game/SaveGame.h
index b71b8fc1550..14aa75f22db 100644
--- a/engines/hpl1/engine/game/SaveGame.h
+++ b/engines/hpl1/engine/game/SaveGame.h
@@ -130,7 +130,7 @@ class iSaveObject {
public:
iSaveObject();
- ~iSaveObject();
+ virtual ~iSaveObject();
/**
* Get a unique id for this object.
diff --git a/engines/hpl1/engine/graphics/Material.h b/engines/hpl1/engine/graphics/Material.h
index 694fa81ab54..4fa6516af44 100644
--- a/engines/hpl1/engine/graphics/Material.h
+++ b/engines/hpl1/engine/graphics/Material.h
@@ -179,6 +179,7 @@ protected:
class iMaterialProgramSetup {
public:
+ virtual ~iMaterialProgramSetup() = default;
virtual void Setup(iGpuProgram *apProgram, cRenderSettings *apRenderSettings) = 0;
virtual void SetupMatrix(cMatrixf *apModelMatrix, cRenderSettings *apRenderSettings) {}
};
@@ -385,6 +386,7 @@ typedef tMaterialVec::iterator tMaterialVecIt;
class iMaterialType {
public:
+ virtual ~iMaterialType() = default;
virtual bool IsCorrect(tString asName) = 0;
virtual iMaterial *Create(const tString &asName, iLowLevelGraphics *apLowLevelGraphics,
cImageManager *apImageManager, cTextureManager *apTextureManager,
diff --git a/engines/hpl1/engine/gui/GuiTypes.h b/engines/hpl1/engine/gui/GuiTypes.h
index bb7aa52a94e..c874b8b52b7 100644
--- a/engines/hpl1/engine/gui/GuiTypes.h
+++ b/engines/hpl1/engine/gui/GuiTypes.h
@@ -295,7 +295,7 @@ class iWidget;
typedef bool (*tGuiCallbackFunc)(void *, iWidget *, cGuiMessageData &);
#define kGuiCalllbackDeclarationEnd(FuncName) \
- static bool FuncName##_static_gui(void *apObject, iWidget *apWidget, cGuiMessageData &aData);
+ static bool FuncName##_static_gui(void *apObject, iWidget *apWidget, cGuiMessageData &aData)
#define kGuiCalllbackDeclaredFuncEnd(ThisClass, FuncName) \
bool ThisClass::FuncName##_static_gui(void *apObject, iWidget *apWidget, cGuiMessageData &aData) { \
diff --git a/engines/hpl1/engine/gui/WidgetBaseClasses.h b/engines/hpl1/engine/gui/WidgetBaseClasses.h
index 7db8dcace57..d3d6e433f3b 100644
--- a/engines/hpl1/engine/gui/WidgetBaseClasses.h
+++ b/engines/hpl1/engine/gui/WidgetBaseClasses.h
@@ -36,6 +36,7 @@ namespace hpl {
class iWidgetItemContainer {
public:
+ virtual ~iWidgetItemContainer() = default;
void AddItem(const tWString &asItem);
void RemoveItem(int alX);
void RemoveItem(const tWString &asItem);
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.h b/engines/hpl1/engine/impl/MeshLoaderCollada.h
index f1ea32e2b01..59a8a60648e 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.h
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.h
@@ -420,7 +420,7 @@ public:
class cMeshLoaderCollada : public iMeshLoader {
public:
cMeshLoaderCollada(iLowLevelGraphics *apLowLevelGraphics);
- ~cMeshLoaderCollada();
+ virtual ~cMeshLoaderCollada();
cMesh *LoadMesh(const tString &asFile, tMeshLoadFlag aFlags);
bool SaveMesh(cMesh *apMesh, const tString &asFile) { return false; }
diff --git a/engines/hpl1/engine/physics/CharacterBody.h b/engines/hpl1/engine/physics/CharacterBody.h
index 1d9589805bf..feefb3b6363 100644
--- a/engines/hpl1/engine/physics/CharacterBody.h
+++ b/engines/hpl1/engine/physics/CharacterBody.h
@@ -48,6 +48,7 @@ enum eCharDir {
class iCharacterBodyCallback {
public:
+ virtual ~iCharacterBodyCallback() = default;
virtual void OnHitGround(iCharacterBody *apCharBody, const cVector3f &avVel) = 0;
virtual void OnGravityCollide(iCharacterBody *apCharBody, iPhysicsBody *apCollideBody,
cCollideData *apCollideData) = 0;
diff --git a/engines/hpl1/engine/resources/MeshLoader.h b/engines/hpl1/engine/resources/MeshLoader.h
index dafbfe367fa..a43359e77e8 100644
--- a/engines/hpl1/engine/resources/MeshLoader.h
+++ b/engines/hpl1/engine/resources/MeshLoader.h
@@ -63,6 +63,7 @@ class iMeshLoader {
public:
iMeshLoader(iLowLevelGraphics *apLowLevelGraphics)
: mpLowLevelGraphics(apLowLevelGraphics) {}
+ virtual ~iMeshLoader() = default;
virtual cMesh *LoadMesh(const tString &asFile, tMeshLoadFlag aFlags) = 0;
virtual bool SaveMesh(cMesh *apMesh, const tString &asFile) = 0;
diff --git a/engines/hpl1/engine/resources/low_level_resources.h b/engines/hpl1/engine/resources/low_level_resources.h
index 7f404f4d927..940bffc2005 100644
--- a/engines/hpl1/engine/resources/low_level_resources.h
+++ b/engines/hpl1/engine/resources/low_level_resources.h
@@ -41,6 +41,7 @@ class LowLevelResources {
public:
LowLevelResources(cLowLevelGraphics *lowLevelGraphics) : _lowLevelGraphics(lowLevelGraphics) {
}
+ virtual ~LowLevelResources() = default;
//Returns a list of files in a directory matching a pattern
virtual void FindFilesInDir(tStringList &fileList, tString dir, tString pattern);
diff --git a/engines/hpl1/engine/scene/Camera.h b/engines/hpl1/engine/scene/Camera.h
index a4a799b3b49..36c897681d7 100644
--- a/engines/hpl1/engine/scene/Camera.h
+++ b/engines/hpl1/engine/scene/Camera.h
@@ -42,6 +42,7 @@ enum eCameraType {
class iCamera {
public:
+ virtual ~iCamera() = default;
virtual void SetModelViewMatrix(iLowLevelGraphics *apLowLevel) = 0;
virtual void SetProjectionMatrix(iLowLevelGraphics *apLowLevel) = 0;
virtual cVector3f GetEyePosition() = 0;
diff --git a/engines/hpl1/engine/scene/Camera3D.h b/engines/hpl1/engine/scene/Camera3D.h
index 90deff94c3e..8dcea7db762 100644
--- a/engines/hpl1/engine/scene/Camera3D.h
+++ b/engines/hpl1/engine/scene/Camera3D.h
@@ -53,7 +53,7 @@ class iEntity3D;
class cCamera3D : public iCamera {
public:
cCamera3D();
- ~cCamera3D();
+ virtual ~cCamera3D();
const cVector3f &GetPosition() const { return mvPosition; }
void SetPosition(const cVector3f &avPos);
diff --git a/engines/hpl1/engine/scene/Entity3D.h b/engines/hpl1/engine/scene/Entity3D.h
index 2b79055c6d3..5ab1bab8166 100644
--- a/engines/hpl1/engine/scene/Entity3D.h
+++ b/engines/hpl1/engine/scene/Entity3D.h
@@ -43,6 +43,7 @@ class cSector;
class iEntityCallback {
public:
+ virtual ~iEntityCallback() = default;
virtual void OnTransformUpdate(iEntity3D *apEntity) = 0;
};
diff --git a/engines/hpl1/engine/scene/GridMap2D.h b/engines/hpl1/engine/scene/GridMap2D.h
index 25924b00220..acf65ed1b87 100644
--- a/engines/hpl1/engine/scene/GridMap2D.h
+++ b/engines/hpl1/engine/scene/GridMap2D.h
@@ -114,6 +114,7 @@ public:
class cGridMap2DRectIt : public iGridMap2DIt {
public:
cGridMap2DRectIt(cGridMap2D *apGridMap, cVector2l avPos, cVector2l avSize);
+ virtual ~cGridMap2DRectIt() = default;
bool HasNext();
iEntity2D *Next();
diff --git a/engines/hpl1/engine/scene/Light.h b/engines/hpl1/engine/scene/Light.h
index b495b2431bc..ad8c7b018cb 100644
--- a/engines/hpl1/engine/scene/Light.h
+++ b/engines/hpl1/engine/scene/Light.h
@@ -38,6 +38,7 @@ class cWorld3D;
class iLight {
public:
iLight();
+ virtual ~iLight() = default;
//////////////////////////
// Fading
diff --git a/engines/hpl1/engine/scene/PortalContainer.h b/engines/hpl1/engine/scene/PortalContainer.h
index 84adec26e43..29865d2fed6 100644
--- a/engines/hpl1/engine/scene/PortalContainer.h
+++ b/engines/hpl1/engine/scene/PortalContainer.h
@@ -233,7 +233,7 @@ class cPortalContainer : public iRenderableContainer {
public:
cPortalContainer();
- ~cPortalContainer();
+ virtual ~cPortalContainer();
bool AddEntity(iEntity3D *pEntity);
bool RemoveEntity(iEntity3D *pEntity);
diff --git a/engines/hpl1/engine/scene/RenderableContainer.h b/engines/hpl1/engine/scene/RenderableContainer.h
index d8a32c831d9..3ed1514b133 100644
--- a/engines/hpl1/engine/scene/RenderableContainer.h
+++ b/engines/hpl1/engine/scene/RenderableContainer.h
@@ -40,6 +40,7 @@ class cRenderList;
class iRenderableContainer {
public:
+ virtual ~iRenderableContainer() = default;
/**
* Add a new object to the container.
* \param *apRenderable the object
diff --git a/engines/hpl1/engine/scene/SoundEntity.h b/engines/hpl1/engine/scene/SoundEntity.h
index 703e1df3ca6..48a6c5ba0e7 100644
--- a/engines/hpl1/engine/scene/SoundEntity.h
+++ b/engines/hpl1/engine/scene/SoundEntity.h
@@ -50,6 +50,7 @@ class cSoundEntity;
class cSoundEntityChannelCallback : public iSoundChannelCallback {
public:
+ virtual ~cSoundEntityChannelCallback() = default;
void OnPriorityRelease();
cSoundEntity *mpEntity;
@@ -73,6 +74,7 @@ kSaveData_ChildClass(iEntity3D, cSoundEntity) {
class iSoundEntityGlobalCallback {
public:
+ virtual ~iSoundEntityGlobalCallback() = default;
virtual void OnStart(cSoundEntity *apSoundEntity) = 0;
};
diff --git a/engines/hpl1/engine/sound/SoundChannel.h b/engines/hpl1/engine/sound/SoundChannel.h
index 4282675e501..29797b033f3 100644
--- a/engines/hpl1/engine/sound/SoundChannel.h
+++ b/engines/hpl1/engine/sound/SoundChannel.h
@@ -37,6 +37,7 @@ class cSoundManager;
class iSoundChannelCallback {
public:
+ virtual ~iSoundChannelCallback() = default;
virtual void OnPriorityRelease() = 0;
};
diff --git a/engines/hpl1/engine/system/Container.h b/engines/hpl1/engine/system/Container.h
index c269ab255a4..10e258b0c49 100644
--- a/engines/hpl1/engine/system/Container.h
+++ b/engines/hpl1/engine/system/Container.h
@@ -56,6 +56,7 @@ class iContainer {
friend class cSerializeClass;
public:
+ virtual ~iContainer() = default;
virtual size_t Size() = 0;
virtual void Clear() = 0;
@@ -70,6 +71,7 @@ protected:
class iContainerKeyPair {
public:
+ virtual ~iContainerKeyPair() = default;
virtual size_t Size() = 0;
virtual void AddVoidPtr(void *apKey, void **apClass) = 0;
diff --git a/engines/hpl1/penumbra-overture/Player.h b/engines/hpl1/penumbra-overture/Player.h
index 94cbb6b7c83..b2b3642e942 100644
--- a/engines/hpl1/penumbra-overture/Player.h
+++ b/engines/hpl1/penumbra-overture/Player.h
@@ -89,6 +89,7 @@ kSaveData_BaseClass(cPlayer) {
class iPlayerMoveState {
public:
iPlayerMoveState(cPlayer *apPlayer, cInit *apInit);
+ virtual ~iPlayerMoveState() = default;
void SetupBody();
diff --git a/engines/hpl1/penumbra-overture/PlayerHands.h b/engines/hpl1/penumbra-overture/PlayerHands.h
index 8a5a493bfe2..9fc53644a99 100644
--- a/engines/hpl1/penumbra-overture/PlayerHands.h
+++ b/engines/hpl1/penumbra-overture/PlayerHands.h
@@ -76,6 +76,7 @@ class iHudModel {
public:
iHudModel(ePlayerHandType aType);
+ virtual ~iHudModel() = default;
cMeshEntity *GetEntity() { return mpEntity; }
@@ -141,6 +142,7 @@ class cHudModel_Normal : iHudModel {
public:
cHudModel_Normal() : iHudModel(ePlayerHandType_Normal) {}
+ virtual ~cHudModel_Normal() = default;
void LoadData(TiXmlElement *apRootElem) {}
diff --git a/engines/hpl1/penumbra-overture/PlayerHelper.h b/engines/hpl1/penumbra-overture/PlayerHelper.h
index c95d9f45345..759588e68c1 100644
--- a/engines/hpl1/penumbra-overture/PlayerHelper.h
+++ b/engines/hpl1/penumbra-overture/PlayerHelper.h
@@ -41,6 +41,7 @@ class cPlayer;
class iPlayerWeaponCallback {
public:
+ virtual ~iPlayerWeaponCallback() = default;
virtual tString GetModelFile() = 0;
virtual cMatrixf GetOffsetMatrix() = 0;
@@ -571,6 +572,7 @@ private:
class cPlayerBodyCallback : public iCharacterBodyCallback {
public:
cPlayerBodyCallback(cPlayer *apPlayer);
+ virtual ~cPlayerBodyCallback() = default;
void OnHitGround(iCharacterBody *apCharBody, const cVector3f &avVel);
void OnGravityCollide(iCharacterBody *apCharBody, iPhysicsBody *apCollideBody,
Commit: e2ba61965a32c3c792dbcd577b8c05541f72a767
https://github.com/scummvm/scummvm/commit/e2ba61965a32c3c792dbcd577b8c05541f72a767
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:30+01:00
Commit Message:
HPL1: Fix more virtual classes warnings
Changed paths:
engines/hpl1/engine/graphics/RenderObject2D.h
engines/hpl1/engine/scene/GridMap2D.h
engines/hpl1/penumbra-overture/GameEnemy.h
diff --git a/engines/hpl1/engine/graphics/RenderObject2D.h b/engines/hpl1/engine/graphics/RenderObject2D.h
index 21cf2507f9f..e12a3983245 100644
--- a/engines/hpl1/engine/graphics/RenderObject2D.h
+++ b/engines/hpl1/engine/graphics/RenderObject2D.h
@@ -36,6 +36,7 @@ namespace hpl {
class iRenderObject2DRenderer {
public:
+ virtual ~iRenderObject2DRenderer() = default;
virtual void RenderToBatch(eMaterialRenderType aRenderType,
unsigned int &aIdxAdd) = 0;
};
diff --git a/engines/hpl1/engine/scene/GridMap2D.h b/engines/hpl1/engine/scene/GridMap2D.h
index acf65ed1b87..2f618ae7766 100644
--- a/engines/hpl1/engine/scene/GridMap2D.h
+++ b/engines/hpl1/engine/scene/GridMap2D.h
@@ -107,6 +107,7 @@ class cGridMap2D;
class iGridMap2DIt {
public:
+ virtual ~iGridMap2DIt() = default;
virtual bool HasNext() = 0;
virtual iEntity2D *Next() = 0;
};
diff --git a/engines/hpl1/penumbra-overture/GameEnemy.h b/engines/hpl1/penumbra-overture/GameEnemy.h
index daf243622a8..f40258e096e 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy.h
+++ b/engines/hpl1/penumbra-overture/GameEnemy.h
@@ -152,6 +152,7 @@ public:
class iGameEnemyState {
public:
iGameEnemyState(int alId, cInit *apInit, iGameEnemy *apEnemy);
+ virtual ~iGameEnemyState() = default;
virtual void OnEnterState(iGameEnemyState *apPrevState) = 0;
virtual void OnLeaveState(iGameEnemyState *apNextState) = 0;
Commit: e9713c5698e850d6b47fa830702032a6bfb3b958
https://github.com/scummvm/scummvm/commit/e9713c5698e850d6b47fa830702032a6bfb3b958
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:30+01:00
Commit Message:
HPL1: fix missing virtual destructor warnings
Changed paths:
engines/hpl1/engine/scene/Light3DPoint.h
engines/hpl1/engine/scene/MeshEntity.h
engines/hpl1/engine/scene/SoundEntity.h
engines/hpl1/engine/scene/SubMeshEntity.h
diff --git a/engines/hpl1/engine/scene/Light3DPoint.h b/engines/hpl1/engine/scene/Light3DPoint.h
index cd54b395a8f..896699e039a 100644
--- a/engines/hpl1/engine/scene/Light3DPoint.h
+++ b/engines/hpl1/engine/scene/Light3DPoint.h
@@ -48,6 +48,7 @@ class cLight3DPoint : public iLight3D {
public:
cLight3DPoint(tString asName, cResources *apResources);
+ virtual ~cLight3DPoint() = default;
// SaveObject implementation
virtual iSaveData *CreateSaveData();
diff --git a/engines/hpl1/engine/scene/MeshEntity.h b/engines/hpl1/engine/scene/MeshEntity.h
index 861901eff16..b7e7601ab97 100644
--- a/engines/hpl1/engine/scene/MeshEntity.h
+++ b/engines/hpl1/engine/scene/MeshEntity.h
@@ -71,6 +71,7 @@ public:
class cMeshEntityCallback {
public:
+ virtual ~cMeshEntityCallback();
virtual void AfterAnimationUpdate(cMeshEntity *apMeshEntity, float afTimeStep) = 0;
};
diff --git a/engines/hpl1/engine/scene/SoundEntity.h b/engines/hpl1/engine/scene/SoundEntity.h
index 48a6c5ba0e7..46f50175045 100644
--- a/engines/hpl1/engine/scene/SoundEntity.h
+++ b/engines/hpl1/engine/scene/SoundEntity.h
@@ -92,7 +92,7 @@ public:
cSoundEntityManager *apSoundEntityManager,
cWorld3D *apWorld,
cSoundHandler *apSoundHandler, bool abRemoveWhenOver);
- ~cSoundEntity();
+ virtual ~cSoundEntity();
void Play(bool abPlayStart = true);
void Stop(bool abPlayEnd = true);
diff --git a/engines/hpl1/engine/scene/SubMeshEntity.h b/engines/hpl1/engine/scene/SubMeshEntity.h
index 794781eb691..a88ac8fef77 100644
--- a/engines/hpl1/engine/scene/SubMeshEntity.h
+++ b/engines/hpl1/engine/scene/SubMeshEntity.h
@@ -98,7 +98,7 @@ class cSubMeshEntity : public iRenderable {
public:
cSubMeshEntity(const tString &asName, cMeshEntity *apMeshEntity, cSubMesh *apSubMesh, cMaterialManager *apMaterialManager);
- ~cSubMeshEntity();
+ virtual ~cSubMeshEntity();
iMaterial *GetMaterial();
Commit: e41c214d40fd35b7900f2b59780717c189d0da6a
https://github.com/scummvm/scummvm/commit/e41c214d40fd35b7900f2b59780717c189d0da6a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:30+01:00
Commit Message:
HPL1: Fix more warnings
Changed paths:
engines/hpl1/detection.cpp
engines/hpl1/detection.h
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/graphics/Mesh.cpp
engines/hpl1/engine/graphics/Mesh2d.cpp
engines/hpl1/engine/graphics/RenderList.cpp
engines/hpl1/engine/graphics/RenderState.cpp
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/engine/gui/GuiSet.cpp
engines/hpl1/engine/gui/Widget.cpp
engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
engines/hpl1/engine/resources/EntityLoader_Object.cpp
engines/hpl1/engine/resources/MaterialManager.cpp
engines/hpl1/engine/system/SerializeClass.h
engines/hpl1/hpl1.h
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/MapHandler.cpp
engines/hpl1/penumbra-overture/PlayerHands.cpp
engines/hpl1/penumbra-overture/SaveTypes.cpp
diff --git a/engines/hpl1/detection.cpp b/engines/hpl1/detection.cpp
index f56ccceae2e..84328a8e8e2 100644
--- a/engines/hpl1/detection.cpp
+++ b/engines/hpl1/detection.cpp
@@ -54,7 +54,7 @@ PlainGameList Hpl1MetaEngineDetection::getSupportedGames() const {
return PlainGameList(Hpl1::GAME_NAMES);
}
-PlainGameDescriptor findGame(const char *gameid) {
+PlainGameDescriptor Hpl1MetaEngineDetection::findGame(const char *gameid) const {
return Hpl1::GAME_NAMES[0];
}
diff --git a/engines/hpl1/detection.h b/engines/hpl1/detection.h
index e1c089073a9..fcdc8aa50ff 100644
--- a/engines/hpl1/detection.h
+++ b/engines/hpl1/detection.h
@@ -59,7 +59,7 @@ public:
PlainGameList getSupportedGames() const override;
- PlainGameDescriptor findGame(const char *gameid);
+ PlainGameDescriptor findGame(const char *gameid) const override;
};
#endif
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index e4d710dff42..82d4b4c8012 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -116,41 +116,41 @@ static cGame *gpGame = NULL;
//-----------------------------------------------------------------------
-static void __stdcall Print(std::string asText) {
+static void Print(std::string asText) {
Log(asText.c_str());
}
SCRIPT_DEFINE_FUNC_1(void, Print, string)
-static std::string __stdcall FloatToString(float afX) {
+static std::string FloatToString(float afX) {
char sTemp[30];
sprintf(sTemp, "%f", afX);
return (std::string)sTemp;
}
SCRIPT_DEFINE_FUNC_1(string, FloatToString, float)
-static std::string __stdcall IntToString(int alX) {
+static std::string IntToString(int alX) {
char sTemp[30];
sprintf(sTemp, "%d", alX);
return (std::string)sTemp;
}
SCRIPT_DEFINE_FUNC_1(string, IntToString, int)
-static float __stdcall RandFloat(float afMin, float afMax) {
+static float RandFloat(float afMin, float afMax) {
return cMath::RandRectf(afMin, afMax);
}
SCRIPT_DEFINE_FUNC_2(float, RandFloat, float, float)
-static int __stdcall RandInt(int alMin, int alMax) {
+static int RandInt(int alMin, int alMax) {
return cMath::RandRectl(alMin, alMax);
}
SCRIPT_DEFINE_FUNC_2(int, RandInt, int, int)
-static bool __stdcall StringContains(std::string asString, std::string asSubString) {
+static bool StringContains(std::string asString, std::string asSubString) {
return cString::GetLastStringPos(asString, asSubString) >= 0;
}
SCRIPT_DEFINE_FUNC_2(bool, StringContains, string, string)
-static void __stdcall ResetLogicTimer() {
+static void ResetLogicTimer() {
gpGame->ResetLogicTimer();
}
SCRIPT_DEFINE_FUNC(void, ResetLogicTimer)
@@ -164,7 +164,7 @@ SCRIPT_DEFINE_FUNC(void, ResetLogicTimer)
/**
* Sets ambient light color-
**/
-static void __stdcall SetAmbientColor(float afR, float afG, float afB) {
+static void SetAmbientColor(float afR, float afG, float afB) {
gpGraphics->GetRenderer3D()->SetAmbientColor(cColor(afR, afG, afB, 1.0f));
}
SCRIPT_DEFINE_FUNC_3(void, SetAmbientColor, float, float, float)
@@ -174,7 +174,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetAmbientColor, float, float, float)
/**
* Sets if the skybox should be active
**/
-static void __stdcall SetSkyboxActive(bool abX) {
+static void SetSkyboxActive(bool abX) {
gpGraphics->GetRenderer3D()->SetSkyBoxActive(abX);
}
SCRIPT_DEFINE_FUNC_1(void, SetSkyboxActive, bool)
@@ -184,7 +184,7 @@ SCRIPT_DEFINE_FUNC_1(void, SetSkyboxActive, bool)
/**
* Sets the skybox color.
**/
-static void __stdcall SetSkyboxColor(float afR, float afG, float afB, float afA) {
+static void SetSkyboxColor(float afR, float afG, float afB, float afA) {
gpGraphics->GetRenderer3D()->SetSkyBoxColor(cColor(afR, afG, afB, afA));
}
SCRIPT_DEFINE_FUNC_4(void, SetSkyboxColor, float, float, float, float)
@@ -195,7 +195,7 @@ SCRIPT_DEFINE_FUNC_4(void, SetSkyboxColor, float, float, float, float)
* Sets the skybox
* \param asTexture Name of the cube map texture to use
**/
-static void __stdcall SetSkybox(std::string asTexture) {
+static void SetSkybox(std::string asTexture) {
if (asTexture != "") {
iTexture *pTex = gpResources->GetTextureManager()->CreateCubeMap(asTexture, false);
gpGraphics->GetRenderer3D()->SetSkyBox(pTex, true);
@@ -212,7 +212,7 @@ SCRIPT_DEFINE_FUNC_1(void, SetSkybox, string)
* \param asName Name of particle system
* \param asType The type of particle system (file)
**/
-static void __stdcall CreateParticleSystemOnCamera(std::string asName, std::string asType) {
+static void CreateParticleSystemOnCamera(std::string asName, std::string asType) {
cParticleSystem3D *pPS = gpScene->GetWorld3D()->CreateParticleSystem(asName, asType,
1, cMatrixf::Identity);
if (pPS) {
@@ -228,7 +228,7 @@ SCRIPT_DEFINE_FUNC_2(void, CreateParticleSystemOnCamera, string, string)
* Sets if fog should be active
* \param abX If the fog is active or not.
**/
-static void __stdcall SetFogActive(bool abX) {
+static void SetFogActive(bool abX) {
gpGraphics->GetRenderer3D()->SetFogActive(abX);
}
SCRIPT_DEFINE_FUNC_1(void, SetFogActive, bool)
@@ -237,7 +237,7 @@ SCRIPT_DEFINE_FUNC_1(void, SetFogActive, bool)
* Sets if the fog should be used to cull non-visible objects
* \param abX If the culling is active or not.
**/
-static void __stdcall SetFogCulling(bool abX) {
+static void SetFogCulling(bool abX) {
gpGraphics->GetRenderer3D()->SetFogCulling(abX);
}
SCRIPT_DEFINE_FUNC_1(void, SetFogCulling, bool)
@@ -248,7 +248,7 @@ SCRIPT_DEFINE_FUNC_1(void, SetFogCulling, bool)
* \param afStart End of fog fade. After this limit all geometry is full fog color.
* \param afR, afG, afB Color of Fog.
**/
-static void __stdcall SetFogProperties(float afStart, float afEnd, float afR, float afG, float afB) {
+static void SetFogProperties(float afStart, float afEnd, float afR, float afG, float afB) {
gpGraphics->GetRenderer3D()->SetFogStart(afStart);
gpGraphics->GetRenderer3D()->SetFogEnd(afEnd);
gpGraphics->GetRenderer3D()->SetFogColor(cColor(afR, afG, afB, 1.0f));
@@ -257,7 +257,7 @@ SCRIPT_DEFINE_FUNC_5(void, SetFogProperties, float, float, float, float, float)
//-----------------------------------------------------------------------
-static void __stdcall SetSectorProperties(std::string asSector, float afAmbR, float afAmbG, float afAmbB) {
+static void SetSectorProperties(std::string asSector, float afAmbR, float afAmbG, float afAmbB) {
cPortalContainer *pContainer = gpScene->GetWorld3D()->GetPortalContainer();
cSector *pSector = pContainer->GetSector(asSector);
@@ -272,7 +272,7 @@ SCRIPT_DEFINE_FUNC_4(void, SetSectorProperties, string, float, float, float)
//-----------------------------------------------------------------------
-static void __stdcall SetSectorPortalActive(std::string asSector, int alPortal, bool abActive) {
+static void SetSectorPortalActive(std::string asSector, int alPortal, bool abActive) {
cPortalContainer *pContainer = gpScene->GetWorld3D()->GetPortalContainer();
cSector *pSector = pContainer->GetSector(asSector);
@@ -301,7 +301,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetSectorPortalActive, string, int, bool)
* \param asCat The translation category
* \param asName The name of the category entry.
**/
-static std::string __stdcall Translate(std::string asCat, std::string asName) {
+static std::string Translate(std::string asCat, std::string asName) {
tWString wsText = gpResources->Translate(asCat, asName);
return cString::To8Char(wsText);
}
@@ -313,7 +313,7 @@ SCRIPT_DEFINE_FUNC_2(string, Translate, string, string)
* Preloads the data for a sound.
* \param asFile This can be a wav, ogg, mp3 or snt file.
**/
-static void __stdcall PreloadSound(std::string asFile) {
+static void PreloadSound(std::string asFile) {
tString sExt = cString::ToLowerCase(cString::GetFileExt(asFile));
if (sExt == "snt") {
cSoundEntityData *pData = gpResources->GetSoundEntityManager()->CreateSoundEntity(asFile);
@@ -351,7 +351,7 @@ SCRIPT_DEFINE_FUNC_1(void, PreloadSound, string)
//-----------------------------------------------------------------------
-static void __stdcall SetMeshActive(std::string asName, bool abActive) {
+static void SetMeshActive(std::string asName, bool abActive) {
cMeshEntity *pEnt = gpScene->GetWorld3D()->GetMeshEntity(asName);
if (pEnt == NULL) {
Warning("Didn't find mesh entity '%s'\n", asName.c_str());
@@ -376,7 +376,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetMeshActive, string, bool)
* \param asName The name of the particle system.
* \param abActive If it should be active or not.
**/
-static void __stdcall SetParticleSystemActive(std::string asName, bool abActive) {
+static void SetParticleSystemActive(std::string asName, bool abActive) {
cParticleSystem3D *pPS = gpScene->GetWorld3D()->GetParticleSystem(asName);
if (pPS == NULL) {
Warning("Didn't find particle system '%s'\n", asName.c_str());
@@ -397,7 +397,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetParticleSystemActive, string, bool)
* \param asArea The name of the area
* \param X Y and Z the variables of the particle system.
**/
-static void __stdcall CreateParticleSystem(std::string asName, std::string asType, std::string asArea,
+static void CreateParticleSystem(std::string asName, std::string asType, std::string asArea,
float afX, float afY, float afZ) {
cAreaEntity *pArea = gpScene->GetWorld3D()->GetAreaEntity(asArea);
if (pArea == NULL) {
@@ -420,7 +420,7 @@ SCRIPT_DEFINE_FUNC_6(void, CreateParticleSystem, string, string, string, float,
* Kill a particle system
* \param asName The name of the particle system.
**/
-static void __stdcall KillParticleSystem(std::string asName) {
+static void KillParticleSystem(std::string asName) {
/*cParticleSystem3D *pPS = gpScene->GetWorld3D()->GetParticleSystem(asName);
if(pPS==NULL){
Warning("Didn't find particle system '%s'\n",asName.c_str());
@@ -459,7 +459,7 @@ SCRIPT_DEFINE_FUNC_1(void, KillParticleSystem, string)
* \param asStartArea
* \param asEndArea
*/
-static void __stdcall CreateBeam(std::string asName, std::string asFile,
+static void CreateBeam(std::string asName, std::string asFile,
std::string asStartArea, std::string asEndArea) {
cAreaEntity *pStartArea = gpScene->GetWorld3D()->GetAreaEntity(asStartArea);
if (pStartArea == NULL) {
@@ -492,7 +492,7 @@ SCRIPT_DEFINE_FUNC_4(void, CreateBeam, string, string, string, string)
* Destroys a beam
* \param asName
*/
-static void __stdcall DestroyBeam(std::string asName) {
+static void DestroyBeam(std::string asName) {
cBeam *pBeam = gpScene->GetWorld3D()->GetBeam(asName);
if (pBeam == NULL) {
Warning("Couldn't find beam '%s'\n", asName.c_str());
@@ -521,7 +521,7 @@ SCRIPT_DEFINE_FUNC_1(void, DestroyBeam, string)
* \param afRadius The radius to fade to.
* \param afTime The amount of seconds the fade should last.
**/
-static void __stdcall FadeLight3D(std::string asName, float afR, float afG, float afB, float afA,
+static void FadeLight3D(std::string asName, float afR, float afG, float afB, float afA,
float afRadius, float afTime) {
iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
if (pLight == NULL) {
@@ -543,7 +543,7 @@ SCRIPT_DEFINE_FUNC_7(void, FadeLight3D, string, float, float, float, float, floa
* \param asLightName The light name
* \param abX True if it should be attached, false if you want to remove.
**/
-static void __stdcall AttachBillboardToLight3D(std::string asBillboardName, std::string asLightName, bool abX) {
+static void AttachBillboardToLight3D(std::string asBillboardName, std::string asLightName, bool abX) {
iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asLightName);
if (pLight == NULL) {
Warning("Couldn't find light '%s'\n", asLightName.c_str());
@@ -570,7 +570,7 @@ SCRIPT_DEFINE_FUNC_3(void, AttachBillboardToLight3D, string, string, bool)
* \param asName The light name
* \param abX if the light should be on or off.
**/
-static void __stdcall SetLight3DVisible(std::string asName, bool abX) {
+static void SetLight3DVisible(std::string asName, bool abX) {
iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
if (pLight == NULL) {
Warning("Couldn't find light '%s'\n", asName.c_str());
@@ -588,7 +588,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetLight3DVisible, string, bool)
* \param asName The light name
* \param abX if the light should only affects objects in same sector or not.
**/
-static void __stdcall SetLight3DOnlyAffectInSector(std::string asName, bool abX) {
+static void SetLight3DOnlyAffectInSector(std::string asName, bool abX) {
iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
if (pLight == NULL) {
Warning("Couldn't find light '%s'\n", asName.c_str());
@@ -606,7 +606,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetLight3DOnlyAffectInSector, string, bool)
* \param asName The light name
* \param abX if the light flicker should be on or off.
**/
-static void __stdcall SetLight3DFlickerActive(std::string asName, bool abX) {
+static void SetLight3DFlickerActive(std::string asName, bool abX) {
iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
if (pLight == NULL) {
Warning("Couldn't find light '%s'\n", asName.c_str());
@@ -636,7 +636,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetLight3DFlickerActive, string, bool)
* \param afOnFadeLength Fade length from off to on.
* \param afOffFadeLength Fade length from on to off.
**/
-static void __stdcall SetLight3DFlicker(std::string asName,
+static void SetLight3DFlicker(std::string asName,
float afR, float afG, float afB, float afA,
float afRadius,
@@ -677,7 +677,7 @@ SCRIPT_DEFINE_FUNC_17(void, SetLight3DFlicker, string,
* \param asFile The snt file to load.
* \param asArea The area to create at.
*/
-static void __stdcall CreateSoundEntity(std::string asName, std::string asFile,
+static void CreateSoundEntity(std::string asName, std::string asFile,
std::string asArea) {
cAreaEntity *pArea = gpScene->GetWorld3D()->GetAreaEntity(asArea);
if (pArea == NULL) {
@@ -701,7 +701,7 @@ SCRIPT_DEFINE_FUNC_3(void, CreateSoundEntity, string, string, string)
* \param asName The entity name
* \param abPlayStart If the start sound should be played.
**/
-static void __stdcall PlaySoundEntity(std::string asName, bool abPlayStart) {
+static void PlaySoundEntity(std::string asName, bool abPlayStart) {
cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
if (pSound == NULL) {
Warning("Couldn't find sound entity '%s'\n", asName.c_str());
@@ -717,7 +717,7 @@ SCRIPT_DEFINE_FUNC_2(void, PlaySoundEntity, string, bool)
* \param asName The entity name
* \param abPlayEnd If the end sound should be played.
**/
-static void __stdcall StopSoundEntity(std::string asName, bool abPlayEnd) {
+static void StopSoundEntity(std::string asName, bool abPlayEnd) {
cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
if (pSound == NULL) {
Warning("Couldn't find sound entity '%s'\n", asName.c_str());
@@ -735,7 +735,7 @@ SCRIPT_DEFINE_FUNC_2(void, StopSoundEntity, string, bool)
* \param asName The entity name
* \param afSpeed Volume increase per second.
**/
-static void __stdcall FadeInSoundEntity(std::string asName, float afSpeed) {
+static void FadeInSoundEntity(std::string asName, float afSpeed) {
cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
if (pSound == NULL) {
Warning("Couldn't find sound entity '%s'\n", asName.c_str());
@@ -751,7 +751,7 @@ SCRIPT_DEFINE_FUNC_2(void, FadeInSoundEntity, string, float)
* \param asName The entity name
* \param afSpeed Volume decrease per second.
**/
-static void __stdcall FadeOutSoundEntity(std::string asName, float afSpeed) {
+static void FadeOutSoundEntity(std::string asName, float afSpeed) {
cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
if (pSound == NULL) {
Warning("Couldn't find sound entity '%s'\n", asName.c_str());
@@ -764,14 +764,14 @@ SCRIPT_DEFINE_FUNC_2(void, FadeOutSoundEntity, string, float)
//-----------------------------------------------------------------------
-static void __stdcall PlayMusic(std::string asName, float afVol, float afStepSize, bool abLoop) {
+static void PlayMusic(std::string asName, float afVol, float afStepSize, bool abLoop) {
gpSound->GetMusicHandler()->Play(asName, afVol, afStepSize, abLoop);
}
SCRIPT_DEFINE_FUNC_4(void, PlayMusic, string, float, float, bool)
//-----------------------------------------------------------------------
-static void __stdcall StopMusic(float afStepSize) {
+static void StopMusic(float afStepSize) {
gpSound->GetMusicHandler()->Stop(afStepSize);
}
SCRIPT_DEFINE_FUNC_1(void, StopMusic, float)
@@ -783,7 +783,7 @@ SCRIPT_DEFINE_FUNC_1(void, StopMusic, float)
* \param asName The sound name
* \param afVol Volume of the sound
**/
-static void __stdcall PlayGuiSound(std::string asName, float afVol) {
+static void PlayGuiSound(std::string asName, float afVol) {
gpSound->GetSoundHandler()->PlayGui(asName, false, afVol);
}
SCRIPT_DEFINE_FUNC_2(void, PlayGuiSound, string, float)
@@ -801,7 +801,7 @@ SCRIPT_DEFINE_FUNC_2(void, PlayGuiSound, string, float)
* \param asType The type, can be: "OnMax" or "OnMin".
* \param asFunc The script function to be called. Must be in the current script file. "" = disabled.
**/
-static void __stdcall SetJointCallback(std::string asJointName, std::string asType,
+static void SetJointCallback(std::string asJointName, std::string asType,
std::string asFunc) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
@@ -840,7 +840,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetJointCallback, string, string, string)
* Breaks a joint.
* \param asJointName The joint name
**/
-static void __stdcall BreakJoint(std::string asJointName) {
+static void BreakJoint(std::string asJointName) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
Warning("Couldn't find joint '%s'\n", asJointName.c_str());
@@ -859,7 +859,7 @@ SCRIPT_DEFINE_FUNC_1(void, BreakJoint, string)
* \param asCtrlName The controller name
* \param abActive If the controller is to be active or not.
**/
-static void __stdcall SetJointControllerActive(std::string asJointName, std::string asCtrlName, bool abActive) {
+static void SetJointControllerActive(std::string asJointName, std::string asCtrlName, bool abActive) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
Warning("Couldn't find joint '%s'\n", asJointName.c_str());
@@ -883,7 +883,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetJointControllerActive, string, string, bool)
* \param asJointName The joint name
* \param asCtrlName The controller name
**/
-static void __stdcall ChangeJointController(std::string asJointName, std::string asCtrlName) {
+static void ChangeJointController(std::string asJointName, std::string asCtrlName) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
Warning("Couldn't find joint '%s'\n", asJointName.c_str());
@@ -906,7 +906,7 @@ SCRIPT_DEFINE_FUNC_2(void, ChangeJointController, string, string)
* \param asProperty Property to change, can be "DestValue"
* \param afValue Value to set it to.
**/
-static void __stdcall SetJointControllerPropertyFloat(std::string asJointName, std::string asCtrlName,
+static void SetJointControllerPropertyFloat(std::string asJointName, std::string asCtrlName,
std::string asProperty, float afValue) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
@@ -941,7 +941,7 @@ SCRIPT_DEFINE_FUNC_4(void, SetJointControllerPropertyFloat, string, string, stri
* \param asJointName The joint name
* \param asProp The property to get
**/
-static float __stdcall GetJointProperty(std::string asJointName, std::string asProp) {
+static float GetJointProperty(std::string asJointName, std::string asProp) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
Warning("Couldn't find joint '%s'\n", asJointName.c_str());
@@ -1014,7 +1014,7 @@ SCRIPT_DEFINE_FUNC_2(float, GetJointProperty, string, string)
* \param asBodyName The body name
* \param asProp The property to get
**/
-static float __stdcall GetBodyProperty(std::string asBodyName, std::string asProp) {
+static float GetBodyProperty(std::string asBodyName, std::string asProp) {
iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
if (pBody == NULL) {
Warning("Couldn't find Body '%s'\n", asBodyName.c_str());
@@ -1047,7 +1047,7 @@ SCRIPT_DEFINE_FUNC_2(float, GetBodyProperty, string, string)
* \param asProp The property to get
* \param afVal The new value of the property
**/
-static void __stdcall SetBodyProperty(std::string asBodyName, std::string asProp, float afVal) {
+static void SetBodyProperty(std::string asBodyName, std::string asProp, float afVal) {
iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
if (pBody == NULL) {
Warning("Couldn't find Body '%s'\n", asBodyName.c_str());
@@ -1080,7 +1080,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetBodyProperty, string, string, float)
//-----------------------------------------------------------------------
-static void __stdcall AttachBodiesWithJoint(std::string asParentName, std::string asChildName, std::string asJointName) {
+static void AttachBodiesWithJoint(std::string asParentName, std::string asChildName, std::string asJointName) {
iPhysicsBody *pParent = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asParentName);
if (pParent == NULL) {
Warning("Couldn't find Body '%s'\n", asParentName.c_str());
@@ -1116,7 +1116,7 @@ SCRIPT_DEFINE_FUNC_3(void, AttachBodiesWithJoint, string, string, string)
* \param asProp The property to get
* \param afVal The new value of the property
**/
-static void __stdcall SetJointProperty(std::string asJointName, std::string asProp, float afVal) {
+static void SetJointProperty(std::string asJointName, std::string asProp, float afVal) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
Warning("Couldn't find joint '%s'\n", asJointName.c_str());
@@ -1188,7 +1188,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetJointProperty, string, string, float)
* \param afY force in the y direction. (in newton, kg*m/s^2)
* \param afZ force in the z direction. (in newton, kg*m/s^2)
**/
-static void __stdcall AddBodyForce(std::string asBodyName, std::string asCoordType,
+static void AddBodyForce(std::string asBodyName, std::string asCoordType,
float afX, float afY, float afZ) {
iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
if (pBody == NULL) {
@@ -1229,7 +1229,7 @@ SCRIPT_DEFINE_FUNC_5(void, AddBodyForce, string, string, float, float, float)
* \param afY velocity in the y direction. (in m/s)
* \param afZ velocity in the z direction. (in m/s)
**/
-static void __stdcall AddBodyImpulse(std::string asBodyName, std::string asCoordType,
+static void AddBodyImpulse(std::string asBodyName, std::string asCoordType,
float afX, float afY, float afZ) {
iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
if (pBody == NULL) {
@@ -1266,7 +1266,7 @@ SCRIPT_DEFINE_FUNC_5(void, AddBodyImpulse, string, string, float, float, float)
/////// LOCAL VARS //////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
-static void __stdcall CreateLocalVar(std::string asName, int alVal) {
+static void CreateLocalVar(std::string asName, int alVal) {
if (gpScene->GetLocalVar(asName) == NULL) {
cScriptVar *pVar = gpScene->CreateLocalVar(asName);
pVar->mlVal = alVal;
@@ -1274,19 +1274,19 @@ static void __stdcall CreateLocalVar(std::string asName, int alVal) {
}
SCRIPT_DEFINE_FUNC_2(void, CreateLocalVar, string, int)
-static void __stdcall SetLocalVar(std::string asName, int alVal) {
+static void SetLocalVar(std::string asName, int alVal) {
cScriptVar *pVar = gpScene->CreateLocalVar(asName);
pVar->mlVal = alVal;
}
SCRIPT_DEFINE_FUNC_2(void, SetLocalVar, string, int)
-static void __stdcall AddLocalVar(std::string asName, int alVal) {
+static void AddLocalVar(std::string asName, int alVal) {
cScriptVar *pVar = gpScene->CreateLocalVar(asName);
pVar->mlVal += alVal;
}
SCRIPT_DEFINE_FUNC_2(void, AddLocalVar, string, int)
-static int __stdcall GetLocalVar(std::string asName) {
+static int GetLocalVar(std::string asName) {
cScriptVar *pVar = gpScene->GetLocalVar(asName);
if (pVar == NULL) {
Error("Couldn't find local var '%s'\n", asName.c_str());
@@ -1301,7 +1301,7 @@ SCRIPT_DEFINE_FUNC_1(int, GetLocalVar, string)
/////// GLOBAL VARS //////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
-static void __stdcall CreateGlobalVar(std::string asName, int alVal) {
+static void CreateGlobalVar(std::string asName, int alVal) {
if (gpScene->GetGlobalVar(asName) == NULL) {
cScriptVar *pVar = gpScene->CreateGlobalVar(asName);
pVar->mlVal = alVal;
@@ -1309,19 +1309,19 @@ static void __stdcall CreateGlobalVar(std::string asName, int alVal) {
}
SCRIPT_DEFINE_FUNC_2(void, CreateGlobalVar, string, int)
-static void __stdcall SetGlobalVar(std::string asName, int alVal) {
+static void SetGlobalVar(std::string asName, int alVal) {
cScriptVar *pVar = gpScene->CreateGlobalVar(asName);
pVar->mlVal = alVal;
}
SCRIPT_DEFINE_FUNC_2(void, SetGlobalVar, string, int)
-static void __stdcall AddGlobalVar(std::string asName, int alVal) {
+static void AddGlobalVar(std::string asName, int alVal) {
cScriptVar *pVar = gpScene->CreateGlobalVar(asName);
pVar->mlVal += alVal;
}
SCRIPT_DEFINE_FUNC_2(void, AddGlobalVar, string, int)
-static int __stdcall GetGlobalVar(std::string asName) {
+static int GetGlobalVar(std::string asName) {
cScriptVar *pVar = gpScene->GetGlobalVar(asName);
if (pVar == NULL) {
Error("Couldn't find global var '%s'\n", asName.c_str());
diff --git a/engines/hpl1/engine/graphics/Mesh.cpp b/engines/hpl1/engine/graphics/Mesh.cpp
index 6025ee10096..e20350174e5 100644
--- a/engines/hpl1/engine/graphics/Mesh.cpp
+++ b/engines/hpl1/engine/graphics/Mesh.cpp
@@ -464,7 +464,7 @@ void cMesh::CreateJointsAndBodies(std::vector<iPhysicsBody *> *apBodyVec, cMeshE
// Create body
if (vShapes.size() > 0) {
// Create the compound shape if needed.
- iCollideShape *pShape;
+ iCollideShape *pShape = nullptr;
if (vShapes.size() > 1) {
pShape = apPhysicsWorld->CreateCompundShape(vShapes);
} else if (vShapes.size() == 1) {
@@ -702,9 +702,9 @@ iCollideShape *cMesh::CreateCollideShapeFromCollider(cMeshCollider *pCollider, i
return apWorld->CreateCylinderShape(pCollider->mvSize.x, pCollider->mvSize.y, &pCollider->m_mtxOffset);
case eCollideShapeType_Capsule:
return apWorld->CreateCapsuleShape(pCollider->mvSize.x, pCollider->mvSize.y, &pCollider->m_mtxOffset);
+ default:
+ return NULL;
}
-
- return NULL;
}
iCollideShape *cMesh::CreateCollideShape(iPhysicsWorld *apWorld) {
diff --git a/engines/hpl1/engine/graphics/Mesh2d.cpp b/engines/hpl1/engine/graphics/Mesh2d.cpp
index 21572a9d9d6..ef1a01a39e4 100644
--- a/engines/hpl1/engine/graphics/Mesh2d.cpp
+++ b/engines/hpl1/engine/graphics/Mesh2d.cpp
@@ -167,6 +167,8 @@ tVertexVec *cMesh2D::GetVertexVec(const cRect2f &aImageRect, cVector2f avSize, e
case eTileRotation_270:
mvVtx[aRotation][j].norm = cVector3f(0, -1, 3);
break;
+ default:
+ break;
}
}
diff --git a/engines/hpl1/engine/graphics/RenderList.cpp b/engines/hpl1/engine/graphics/RenderList.cpp
index eb76ce79cd9..148b5b09b32 100644
--- a/engines/hpl1/engine/graphics/RenderList.cpp
+++ b/engines/hpl1/engine/graphics/RenderList.cpp
@@ -390,10 +390,13 @@ bool cRenderList::Add(iRenderable *apObject) {
break;
}
// Add a light to a special container
- case eRenderableType_Light:
- iLight3D *pLight = static_cast<iLight3D *>(apObject);
+ case eRenderableType_Light: {
+ iLight3D *pLight = static_cast<iLight3D *>(apObject);
- m_setLights.insert(pLight);
+ m_setLights.insert(pLight);
+ }
+ break;
+ default:
break;
}
diff --git a/engines/hpl1/engine/graphics/RenderState.cpp b/engines/hpl1/engine/graphics/RenderState.cpp
index 88ab3ac1de1..3c5b5c688bd 100644
--- a/engines/hpl1/engine/graphics/RenderState.cpp
+++ b/engines/hpl1/engine/graphics/RenderState.cpp
@@ -80,6 +80,8 @@ int iRenderState::Compare(const iRenderState *apState) const {
return CompareMatrix(apState);
case eRenderStateType_Render:
return CompareRender(apState);
+ default:
+ break;
}
return 0;
@@ -125,6 +127,8 @@ void iRenderState::SetMode(cRenderSettings *apSettings) {
case eRenderStateType_Render:
SetRenderMode(apSettings);
break;
+ default:
+ break;
}
}
@@ -186,6 +190,8 @@ void iRenderState::Set(const iRenderState *apState) {
case eRenderStateType_Render:
mpObject = apState->mpObject;
break;
+ default:
+ break;
}
}
@@ -309,6 +315,8 @@ void iRenderState::SetBlendMode(cRenderSettings *apSettings) {
if (apSettings->mbLog)
Log("DestAlphaAdd");
break;
+ default:
+ break;
}
}
@@ -342,6 +350,8 @@ void iRenderState::SetBlendMode(cRenderSettings *apSettings) {
if (apSettings->mbLog)
Log("Z");
break;
+ default:
+ break;
}
if (apSettings->mbLog)
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index 1b8320371ea..80e0505fb23 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -1319,6 +1319,8 @@ void cRenderer3D::RenderTrans(cCamera3D *apCamera) {
if (bLog)
Log(" Set blend mode destalpha-one!\n");
break;
+ default:
+ break;
}
}
}
diff --git a/engines/hpl1/engine/gui/GuiSet.cpp b/engines/hpl1/engine/gui/GuiSet.cpp
index 16892af11f0..107ca11cd6a 100644
--- a/engines/hpl1/engine/gui/GuiSet.cpp
+++ b/engines/hpl1/engine/gui/GuiSet.cpp
@@ -261,6 +261,8 @@ bool cGuiSet::SendMessage(eGuiMessage aMessage, cGuiMessageData &aData) {
case eGuiMessage_KeyPress:
return OnKeyPress(aData);
+ default:
+ break;
}
return false;
diff --git a/engines/hpl1/engine/gui/Widget.cpp b/engines/hpl1/engine/gui/Widget.cpp
index bd58dc752bc..3b29e15f2b6 100644
--- a/engines/hpl1/engine/gui/Widget.cpp
+++ b/engines/hpl1/engine/gui/Widget.cpp
@@ -190,6 +190,8 @@ bool iWidget::ProcessMessage(eGuiMessage aMessage, cGuiMessageData &aData) {
case eGuiMessage_LostFocus:
bRet = OnLostFocus(aData);
break;
+ default:
+ break;
}
}
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
index cdd2ba5ece8..3dac1ed1cb3 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
@@ -195,6 +195,8 @@ float cPhysicsMaterialNewton::Combine(ePhysicsMaterialCombMode aMode, float afX,
return std::max(afX, afY);
case ePhysicsMaterialCombMode_Multiply:
return afX * afY;
+ default:
+ break;
}
return (afX + afY) / 2;
diff --git a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
index 66ecb9088b9..0ae76825c74 100644
--- a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
@@ -185,6 +185,8 @@ void cPhysicsWorldNewton::SetAccuracyLevel(ePhysicsAccuracy aAccuracy) {
NewtonSetSolverModel(mpNewtonWorld, 0);
NewtonSetFrictionModel(mpNewtonWorld, 0);
break;
+ default:
+ break;
}
}
diff --git a/engines/hpl1/engine/resources/EntityLoader_Object.cpp b/engines/hpl1/engine/resources/EntityLoader_Object.cpp
index 3c8b8dd4f53..a5ecec437e4 100644
--- a/engines/hpl1/engine/resources/EntityLoader_Object.cpp
+++ b/engines/hpl1/engine/resources/EntityLoader_Object.cpp
@@ -741,6 +741,8 @@ void cEntityLoader_Object::SetJointProperties(iPhysicsJoint *pJoint, TiXmlElemen
pSliderJoint->SetMaxDistance(fMaxValue / 100);
break;
}
+ default:
+ break;
}
}
diff --git a/engines/hpl1/engine/resources/MaterialManager.cpp b/engines/hpl1/engine/resources/MaterialManager.cpp
index d0b70bb9ef1..1cff0a5378b 100644
--- a/engines/hpl1/engine/resources/MaterialManager.cpp
+++ b/engines/hpl1/engine/resources/MaterialManager.cpp
@@ -385,6 +385,8 @@ tString cMaterialManager::GetTextureString(eMaterialTexture aType) {
return "CubeMap";
case eMaterialTexture_Refraction:
return "Refraction";
+ default:
+ break;
}
return "";
diff --git a/engines/hpl1/engine/system/SerializeClass.h b/engines/hpl1/engine/system/SerializeClass.h
index 3d8916f98a7..fda268d35b3 100644
--- a/engines/hpl1/engine/system/SerializeClass.h
+++ b/engines/hpl1/engine/system/SerializeClass.h
@@ -105,16 +105,16 @@ typedef unsigned int eSerializeMainType;
*/
#define kSerializableClassInit(aClass) \
public: \
- const static tString msSerialize_Name; \
- const static tString msSerialize_ParentName; \
+ const static char *msSerialize_Name; \
+ const static char *msSerialize_ParentName; \
const static cSerializeMemberField *mpSerialize_MemberFields; \
virtual ~aClass() = default; \
virtual tString Serialize_GetTopClass() { return #aClass; }
#define kSerializableClassInit_nodestructor(aClass) \
public: \
- const static tString msSerialize_Name; \
- const static tString msSerialize_ParentName; \
+ const static char *msSerialize_Name; \
+ const static char *msSerialize_ParentName; \
const static cSerializeMemberField *mpSerialize_MemberFields; \
virtual tString Serialize_GetTopClass() { return #aClass; }
@@ -127,8 +127,8 @@ public: \
} \
static iSerializable *_Create_##aClass() { return hplNew(aClass, ()); } \
static cSerializeClass gSerializedClass_##aClass(#aClass, #aParent, SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), _Create_##aClass); \
- const tString aClass::msSerialize_Name = #aClass; \
- const tString aClass::msSerialize_ParentName = #aParent; \
+ const char *aClass::msSerialize_Name = #aClass; \
+ const char *aClass::msSerialize_ParentName = #aParent; \
const cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
namespace SerializeNamespace_##aClass { \
typedef aClass tVarClass; \
@@ -140,8 +140,8 @@ public: \
} \
static iSerializable *_Create_##aClass() { return hplNew(aClass, ()); } \
static cSerializeClass gSerializedClass_##aClass(#aClass, "", SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), _Create_##aClass); \
- const tString aClass::msSerialize_Name = #aClass; \
- const tString aClass::msSerialize_ParentName = ""; \
+ const char *aClass::msSerialize_Name = #aClass; \
+ const char *aClass::msSerialize_ParentName = ""; \
const cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
namespace SerializeNamespace_##aClass { \
typedef aClass tVarClass; \
@@ -152,8 +152,8 @@ public: \
extern cSerializeMemberField mvTempMemberFields[]; \
} \
static cSerializeClass gSerializedClass_##aClass(#aClass, #aParent, SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), NULL); \
- const tString aClass::msSerialize_Name = #aClass; \
- const tString aClass::msSerialize_ParentName = #aParent; \
+ const char *aClass::msSerialize_Name = #aClass; \
+ const char *aClass::msSerialize_ParentName = #aParent; \
const cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
namespace SerializeNamespace_##aClass { \
typedef aClass tVarClass; \
@@ -164,8 +164,8 @@ public: \
extern cSerializeMemberField mvTempMemberFields[]; \
} \
static cSerializeClass gSerializedClass_##aClass(#aClass, "", SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), NULL); \
- const tString aClass::msSerialize_Name = #aClass; \
- const tString aClass::msSerialize_ParentName = ""; \
+ const char *aClass::msSerialize_Name = #aClass; \
+ const char *aClass::msSerialize_ParentName = ""; \
const cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
namespace SerializeNamespace_##aClass { \
typedef aClass tVarClass; \
diff --git a/engines/hpl1/hpl1.h b/engines/hpl1/hpl1.h
index 64a3b540f7e..6ba0c3f15e3 100644
--- a/engines/hpl1/hpl1.h
+++ b/engines/hpl1/hpl1.h
@@ -89,11 +89,11 @@ public:
*/
Common::Error syncGame(Common::Serializer &s);
- Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) {
+ Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
Common::Serializer s(nullptr, stream);
return syncGame(s);
}
- Common::Error loadGameStream(Common::SeekableReadStream *stream) {
+ Common::Error loadGameStream(Common::SeekableReadStream *stream) override {
Common::Serializer s(stream, nullptr);
return syncGame(s);
}
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 0b471d9b7b6..37a4414cf7e 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -587,6 +587,8 @@ cMainMenuWidget_NewGame::cMainMenuWidget_NewGame(cInit *apInit, const cVector3f
case eGameDifficulty_Hard:
msTip = kTranslate("MainMenu", "TipDifficultyHard");
break;
+ default:
+ break;
}
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/MapHandler.cpp b/engines/hpl1/penumbra-overture/MapHandler.cpp
index 090ef7247f5..772f5daf7a6 100644
--- a/engines/hpl1/penumbra-overture/MapHandler.cpp
+++ b/engines/hpl1/penumbra-overture/MapHandler.cpp
@@ -931,6 +931,8 @@ void cMapHandler::LoadSaveData(cSavedWorld *apSavedWorld) {
vSize = static_cast<cGameLiquidArea_SaveData *>(pSaveEntity)->mvSize;
sType = "liquid";
break;
+ default:
+ break;
}
// Load entity
diff --git a/engines/hpl1/penumbra-overture/PlayerHands.cpp b/engines/hpl1/penumbra-overture/PlayerHands.cpp
index 0dfe0cea852..de5781904c4 100644
--- a/engines/hpl1/penumbra-overture/PlayerHands.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerHands.cpp
@@ -446,6 +446,8 @@ bool cPlayerHands::AddModelFromFile(const tString &asFile) {
case ePlayerHandType_Throw:
pHudModel = hplNew(cHudModel_Throw, ());
break;
+ default:
+ break;
}
pHudModel->msName = cString::ToString(pMainElem->Attribute("Name"), "");
diff --git a/engines/hpl1/penumbra-overture/SaveTypes.cpp b/engines/hpl1/penumbra-overture/SaveTypes.cpp
index dfa90d26b48..f221909d465 100644
--- a/engines/hpl1/penumbra-overture/SaveTypes.cpp
+++ b/engines/hpl1/penumbra-overture/SaveTypes.cpp
@@ -129,6 +129,8 @@ kBeginSerializeBase(cEngineBody_SaveData)
mfMaxLimit = pSliderJoint->GetMaxDistance();
break;
}
+ default:
+ break;
}
}
@@ -186,6 +188,8 @@ void cEngineJoint_SaveData::ToJoint(iPhysicsJoint *apJoint) {
pSliderJoint->SetMaxDistance(mfMaxLimit);
break;
}
+ default:
+ break;
}
}
Commit: 056a7f702ecea6905738075b4bf56053e4e7b6c5
https://github.com/scummvm/scummvm/commit/056a7f702ecea6905738075b4bf56053e4e7b6c5
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:30+01:00
Commit Message:
HPL1: replace image loading
Changed paths:
engines/hpl1/engine/graphics/bitmap2D.cpp
engines/hpl1/engine/graphics/bitmap2D.h
engines/hpl1/engine/resources/low_level_resources.cpp
engines/hpl1/engine/resources/low_level_resources.h
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
index d865a0b800f..b7263b3fd52 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.cpp
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -22,32 +22,83 @@
#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/debug.h"
#include "common/rect.h"
+#include "image/png.h"
+#include "image/jpeg.h"
+#include "image/tga.h"
+#include "image/bmp.h"
+#include "image/gif.h"
+#include "common/file.h"
namespace hpl {
-static uint32 quantizeColor(const cColor &col, const Graphics::PixelFormat &format) {
- uint8 r = static_cast<uint8>(col.r * 255);
- uint8 g = static_cast<uint8>(col.g * 255);
- uint8 b = static_cast<uint8>(col.b * 255);
- uint8 a = static_cast<uint8>(col.a * 255);
- return format.ARGBToColor(a, r, g, b);
+template<typename Loader>
+static Loader *loadImage(const tString &filepath) {
+ //FIXME: string types
+ Common::File imgFile;
+ if (!imgFile.open(filepath.c_str())) {
+ error("Could not open file: %s", filepath.c_str());
+ return nullptr;
+ }
+ Loader *imgLoader = new Loader();
+ if (!imgLoader->loadStream(imgFile)) {
+ error("Could not load image at %s", filepath.c_str());
+ }
+ return imgLoader;
}
+Bitmap2D::Bitmap2D(const tString &filepath, const tString &type)
+ : iLowLevelPicture(type), isSurfaceActive(false) {
+ if (type == "png")
+ _decoder.reset(loadImage<Image::PNGDecoder>(filepath));
+ if (type == "bmp")
+ _decoder.reset(loadImage<Image::BitmapDecoder>(filepath));
+ if (type == "tga")
+ _decoder.reset(loadImage<Image::TGADecoder>(filepath));
+ if (type == "jpg" || type == "jpeg")
+ _decoder.reset(loadImage<Image::JPEGDecoder>(filepath));
+ if (type == "gif")
+ _decoder.reset(loadImage<Image::GIFDecoder>(filepath));
+
+ error("trying to load unsupported image format %s", type.c_str());
+}
+
+Bitmap2D::Bitmap2D(const tString &type, const cVector2l &size, const Graphics::PixelFormat &format)
+: iLowLevelPicture(type), isSurfaceActive(true) {
+ create(size, format);
+}
+
+
void Bitmap2D::drawToBitmap(Bitmap2D &dest, const cVector2l &pos) {
- if (_surface.format != dest._surface.format)
+ if(!dest.isSurfaceActive)
+ dest.copyDecoder();
+
+ if (activeSurface().format != dest._surface.format)
error("call to Bitmap2D::drawToBitmap with different pixel formats");
- if (_surface.w + pos.x > dest._surface.w || _surface.h + pos.y > dest._surface.h)
+ if (activeSurface().w + pos.x > dest._surface.w || activeSurface().h + pos.y > dest._surface.h)
error("call to Bitmap2D::drawToBitmap would go out of bounds");
- dest._surface.copyRectToSurface(_surface, pos.x, pos.y, Common::Rect(0, 0, _surface.w, _surface.h));
+ dest._surface.copyRectToSurface(activeSurface(), pos.x, pos.y, Common::Rect(0, 0, activeSurface().w, activeSurface().h));
}
bool Bitmap2D::create(const cVector2l &size, const Graphics::PixelFormat &format) {
_surface.create(size.x, size.y, format);
+ isSurfaceActive = true;
+ _decoder.release();
return true;
}
+static uint32 quantizeColor(const cColor &col, const Graphics::PixelFormat &format) {
+ uint8 r = static_cast<uint8>(col.r * 255);
+ uint8 g = static_cast<uint8>(col.g * 255);
+ uint8 b = static_cast<uint8>(col.b * 255);
+ uint8 a = static_cast<uint8>(col.a * 255);
+ return format.ARGBToColor(a, r, g, b);
+}
+
void Bitmap2D::fillRect(const cRect2l &rect, const cColor &color) {
+ if(!isSurfaceActive)
+ copyDecoder();
+
const uint32 qcol = quantizeColor(color, _surface.format);
const Common::Rect surfaceRect(
rect.x,
@@ -58,21 +109,34 @@ void Bitmap2D::fillRect(const cRect2l &rect, const cColor &color) {
_surface.fillRect(surfaceRect, qcol);
}
-void *Bitmap2D::getRawData() {
- return _surface.getPixels();
+const void *Bitmap2D::getRawData() const {
+ return activeSurface().getPixels();
}
int Bitmap2D::getNumChannels() {
- return _surface.format.bpp() / _surface.format.bytesPerPixel;
+ return activeSurface().format.bpp() / _surface.format.bytesPerPixel;
}
bool Bitmap2D::HasAlpha() {
- return _surface.format.aBits() > 0;
+ return activeSurface().format.aBits() > 0;
+}
+
+void Bitmap2D::copyDecoder() {
+ _surface.copyFrom(*( _decoder->getSurface()));
+ isSurfaceActive = true;
+ _decoder.release();
+}
+
+const Graphics::Surface &Bitmap2D::activeSurface() const {
+ if(isSurfaceActive)
+ return _surface;
+ return *(_decoder->getSurface());
}
Bitmap2D::~Bitmap2D() {
- _surface.free();
+ if(isSurfaceActive)
+ _surface.free();
}
-} // namespace hpl
\ No newline at end of file
+} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/bitmap2D.h b/engines/hpl1/engine/graphics/bitmap2D.h
index bdef78b119d..de624ef27b1 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.h
+++ b/engines/hpl1/engine/graphics/bitmap2D.h
@@ -34,18 +34,16 @@
#include "graphics/pixelformat.h"
#include "common/ptr.h"
#include "graphics/surface.h"
+#include "image/image_decoder.h"
namespace hpl {
class Bitmap2D : public iLowLevelPicture {
public:
- Bitmap2D(const tString &type) : iLowLevelPicture(type) {}
- Bitmap2D(const Graphics::Surface &surface, const tString &type) :
- iLowLevelPicture(type), _surface(surface) {
- }
-
- ~Bitmap2D();
+ Bitmap2D(const tString &type, const cVector2l &size, const Graphics::PixelFormat &format);
+ Bitmap2D(const tString &filename, const tString &type);
+ ~Bitmap2D();
void drawToBitmap(Bitmap2D &dest, const cVector2l &pos);
@@ -53,14 +51,19 @@ public:
void fillRect(const cRect2l &rect, const cColor &color);
- void *getRawData();
+ const void *getRawData() const;
int getNumChannels();
bool HasAlpha() override;
private:
+ void copyDecoder();
+ const Graphics::Surface &activeSurface() const;
+
Graphics::Surface _surface;
+ Common::ScopedPtr<Image::ImageDecoder> _decoder;
+ bool isSurfaceActive;
};
typedef std::vector<Bitmap2D *> tBitmap2DVec;
diff --git a/engines/hpl1/engine/resources/low_level_resources.cpp b/engines/hpl1/engine/resources/low_level_resources.cpp
index 01acb227def..8f5f97b3b45 100644
--- a/engines/hpl1/engine/resources/low_level_resources.cpp
+++ b/engines/hpl1/engine/resources/low_level_resources.cpp
@@ -25,60 +25,27 @@
#include "hpl1/engine/resources/VideoManager.h"
#include "common/fs.h"
#include "hpl1/debug.h"
+#include "common/file.h"
namespace hpl {
-Bitmap2D *LowLevelResources::LoadBitmap2D(tString filepath, tString type) {
-#if 0
- tString tType;
- if(asType != "")
- asFilePath = cString::SetFileExt(asFilePath,asType);
-
- tType = cString::GetFileExt(asFilePath);
- SDL_Surface* pSurface = NULL;
-
- if (tType=="bmp") {
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- SDL_PixelFormat RGBAFormat;
- RGBAFormat.palette = 0; RGBAFormat.colorkey = 0; RGBAFormat.alpha = 0;
- RGBAFormat.BitsPerPixel = 32; RGBAFormat.BytesPerPixel = 4;
-
- RGBAFormat.Rmask = 0xFF000000; RGBAFormat.Rshift = 0; RGBAFormat.Rloss = 0;
- RGBAFormat.Gmask = 0x00FF0000; RGBAFormat.Gshift = 8; RGBAFormat.Gloss = 0;
- RGBAFormat.Bmask = 0x0000FF00; RGBAFormat.Bshift = 16; RGBAFormat.Bloss = 0;
- RGBAFormat.Amask = 0x000000FF; RGBAFormat.Ashift = 24; RGBAFormat.Aloss = 0;
-
- SDL_Surface* orig = NULL;
- orig = IMG_Load(asFilePath.c_str());
-
- if(orig==NULL){
- //Error handling stuff?
- return NULL;
- }
- pSurface = SDL_ConvertSurface(orig, &RGBAFormat, SDL_SWSURFACE);
- SDL_FreeSurface(orig);
-#else
- pSurface = IMG_Load(asFilePath.c_str());
-#endif
- } else {
- pSurface= IMG_Load(asFilePath.c_str());
- }
- if(pSurface==NULL){
- //Error handling stuff?
- return NULL;
- }
+static tString getImageType(const tString &filepath) {
+ //FIXME: use proper string types
+ Common::String str(filepath.c_str());
+ str.toLowercase();
+ size_t pos = str.findLastOf(".");
+ if (pos != Common::String::npos)
+ return str.substr(pos + 1).c_str();
+ return "";
+}
- iBitmap2D* pBmp = mpLowLevelGraphics->CreateBitmap2DFromSurface(pSurface,
- cString::GetFileExt(asFilePath));
- pBmp->SetPath(asFilePath);
- return pBmp;
-#endif
- return nullptr;
+Bitmap2D *LowLevelResources::LoadBitmap2D(const tString &filepath) {
+ return new Bitmap2D(filepath, getImageType(filepath));
}
void LowLevelResources::GetSupportedImageFormats(tStringList &formats) {
formats.insert(formats.end(), {
- "BMP","LBM","PCX","GIF","JPEG","PNG","JPG","TGA","TIFF","TIF"});
+ "BMP","GIF","JPEG","PNG","JPG","TGA"});
}
void LowLevelResources::AddMeshLoaders(cMeshLoaderHandler *ml) {
diff --git a/engines/hpl1/engine/resources/low_level_resources.h b/engines/hpl1/engine/resources/low_level_resources.h
index 940bffc2005..ade67cc1cd4 100644
--- a/engines/hpl1/engine/resources/low_level_resources.h
+++ b/engines/hpl1/engine/resources/low_level_resources.h
@@ -47,7 +47,7 @@ public:
virtual void FindFilesInDir(tStringList &fileList, tString dir, tString pattern);
virtual void GetSupportedImageFormats(tStringList &formats);
- virtual Bitmap2D *LoadBitmap2D(tString filepath, tString type = "");
+ virtual Bitmap2D *LoadBitmap2D(const tString &filepath);
virtual void AddMeshLoaders(cMeshLoaderHandler *ml);
virtual void AddVideoLoaders(cVideoManager *vm);
Commit: 3c0dfdf49f7fe00c751a1e52f6a2b5c7e53942aa
https://github.com/scummvm/scummvm/commit/3c0dfdf49f7fe00c751a1e52f6a2b5c7e53942aa
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:30+01:00
Commit Message:
COMMON: fix move assignment operator in ScopedPtr
Changed paths:
common/ptr.h
diff --git a/common/ptr.h b/common/ptr.h
index 4f61dd9cd01..639c9493ce6 100644
--- a/common/ptr.h
+++ b/common/ptr.h
@@ -570,6 +570,8 @@ struct ArrayDeleter {
template<typename T, class DL = DefaultDeleter<T> >
class ScopedPtr : private NonCopyable, public SafeBool<ScopedPtr<T, DL> > {
+ template<class T2, class DL2>
+ friend class ScopedPtr;
public:
typedef T ValueType;
typedef T *PointerType;
Commit: 68b3663916cce6fd2b164e42a8a4da3aeb21b87c
https://github.com/scummvm/scummvm/commit/68b3663916cce6fd2b164e42a8a4da3aeb21b87c
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:30+01:00
Commit Message:
HPL1: fix formatting
Changed paths:
engines/hpl1/engine/graphics/bitmap2D.cpp
engines/hpl1/engine/graphics/bitmap2D.h
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
index b7263b3fd52..eb1ed3b4cfe 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.cpp
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -33,23 +33,23 @@ namespace hpl {
template<typename Loader>
static Loader *loadImage(const tString &filepath) {
- //FIXME: string types
- Common::File imgFile;
+ //FIXME: string types
+ Common::File imgFile;
if (!imgFile.open(filepath.c_str())) {
error("Could not open file: %s", filepath.c_str());
- return nullptr;
+ return nullptr;
}
- Loader *imgLoader = new Loader();
+ Loader *imgLoader = new Loader();
if (!imgLoader->loadStream(imgFile)) {
error("Could not load image at %s", filepath.c_str());
}
- return imgLoader;
+ return imgLoader;
}
-Bitmap2D::Bitmap2D(const tString &filepath, const tString &type)
- : iLowLevelPicture(type), isSurfaceActive(false) {
+Bitmap2D::Bitmap2D(const tString &filepath, const tString &type)
+ : iLowLevelPicture(type), _isSurfaceActive(false) {
if (type == "png")
- _decoder.reset(loadImage<Image::PNGDecoder>(filepath));
+ _decoder.reset(loadImage<Image::PNGDecoder>(filepath));
if (type == "bmp")
_decoder.reset(loadImage<Image::BitmapDecoder>(filepath));
if (type == "tga")
@@ -62,18 +62,18 @@ Bitmap2D::Bitmap2D(const tString &filepath, const tString &type)
error("trying to load unsupported image format %s", type.c_str());
}
-Bitmap2D::Bitmap2D(const tString &type, const cVector2l &size, const Graphics::PixelFormat &format)
-: iLowLevelPicture(type), isSurfaceActive(true) {
+Bitmap2D::Bitmap2D(const tString &type, const cVector2l &size, const Graphics::PixelFormat &format)
+: iLowLevelPicture(type), _isSurfaceActive(true) {
create(size, format);
}
void Bitmap2D::drawToBitmap(Bitmap2D &dest, const cVector2l &pos) {
- if(!dest.isSurfaceActive)
+ if(!dest._isSurfaceActive)
dest.copyDecoder();
-
+
if (activeSurface().format != dest._surface.format)
- error("call to Bitmap2D::drawToBitmap with different pixel formats");
+ error("call to Bitmap2D::drawToBitmap with different pixel formats");
if (activeSurface().w + pos.x > dest._surface.w || activeSurface().h + pos.y > dest._surface.h)
error("call to Bitmap2D::drawToBitmap would go out of bounds");
@@ -82,8 +82,8 @@ void Bitmap2D::drawToBitmap(Bitmap2D &dest, const cVector2l &pos) {
bool Bitmap2D::create(const cVector2l &size, const Graphics::PixelFormat &format) {
_surface.create(size.x, size.y, format);
- isSurfaceActive = true;
- _decoder.release();
+ _isSurfaceActive = true;
+ _decoder.release();
return true;
}
@@ -96,16 +96,16 @@ static uint32 quantizeColor(const cColor &col, const Graphics::PixelFormat &form
}
void Bitmap2D::fillRect(const cRect2l &rect, const cColor &color) {
- if(!isSurfaceActive)
+ if(!_isSurfaceActive)
copyDecoder();
-
+
const uint32 qcol = quantizeColor(color, _surface.format);
const Common::Rect surfaceRect(
- rect.x,
+ rect.x,
rect.y,
- rect.w <= 0 ? rect.x + _surface.w : rect.x + rect.w,
+ rect.w <= 0 ? rect.x + _surface.w : rect.x + rect.w,
rect.h <= 0 ? rect.y + _surface.w : rect.y + rect.h
- );
+ );
_surface.fillRect(surfaceRect, qcol);
}
@@ -118,23 +118,23 @@ int Bitmap2D::getNumChannels() {
}
bool Bitmap2D::HasAlpha() {
- return activeSurface().format.aBits() > 0;
+ return activeSurface().format.aBits() > 0;
}
void Bitmap2D::copyDecoder() {
- _surface.copyFrom(*( _decoder->getSurface()));
- isSurfaceActive = true;
- _decoder.release();
+ _surface.copyFrom(*( _decoder->getSurface()));
+ _isSurfaceActive = true;
+ _decoder.release();
}
const Graphics::Surface &Bitmap2D::activeSurface() const {
- if(isSurfaceActive)
+ if(_isSurfaceActive)
return _surface;
return *(_decoder->getSurface());
}
Bitmap2D::~Bitmap2D() {
- if(isSurfaceActive)
+ if(_isSurfaceActive)
_surface.free();
}
diff --git a/engines/hpl1/engine/graphics/bitmap2D.h b/engines/hpl1/engine/graphics/bitmap2D.h
index de624ef27b1..14a590a3d88 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.h
+++ b/engines/hpl1/engine/graphics/bitmap2D.h
@@ -40,10 +40,10 @@ namespace hpl {
class Bitmap2D : public iLowLevelPicture {
public:
- Bitmap2D(const tString &type, const cVector2l &size, const Graphics::PixelFormat &format);
- Bitmap2D(const tString &filename, const tString &type);
+ Bitmap2D(const tString &type, const cVector2l &size, const Graphics::PixelFormat &format);
+ Bitmap2D(const tString &filename, const tString &type);
- ~Bitmap2D();
+ ~Bitmap2D();
void drawToBitmap(Bitmap2D &dest, const cVector2l &pos);
@@ -57,13 +57,13 @@ public:
bool HasAlpha() override;
-private:
- void copyDecoder();
+private:
+ void copyDecoder();
const Graphics::Surface &activeSurface() const;
- Graphics::Surface _surface;
+ Graphics::Surface _surface;
Common::ScopedPtr<Image::ImageDecoder> _decoder;
- bool isSurfaceActive;
+ bool _isSurfaceActive;
};
typedef std::vector<Bitmap2D *> tBitmap2DVec;
Commit: 9665183e0f63c99ebe2a129ca99d7315711d80cc
https://github.com/scummvm/scummvm/commit/9665183e0f63c99ebe2a129ca99d7315711d80cc
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:30+01:00
Commit Message:
HPL1: add game entry point and fix linking errors
Changed paths:
engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
engines/hpl1/engine/scene/MeshEntity.h
engines/hpl1/hpl1.cpp
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
index 548b4e8ae3a..1b2ddcd3637 100644
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
@@ -100,6 +100,7 @@ namespace hpl {
//-----------------------------------------------------------------------
cLowLevelSystemSDL::cLowLevelSystemSDL() {
+#if 0
mpScriptEngine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
mpScriptOutput = hplNew(cScriptOutput, ());
@@ -114,6 +115,7 @@ cLowLevelSystemSDL::cLowLevelSystemSDL() {
mlHandleCount = 0;
Log("-------- THE HPL ENGINE LOG ------------\n\n");
+#endif
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/scene/MeshEntity.h b/engines/hpl1/engine/scene/MeshEntity.h
index b7e7601ab97..0e827c0e3d0 100644
--- a/engines/hpl1/engine/scene/MeshEntity.h
+++ b/engines/hpl1/engine/scene/MeshEntity.h
@@ -71,7 +71,7 @@ public:
class cMeshEntityCallback {
public:
- virtual ~cMeshEntityCallback();
+ virtual ~cMeshEntityCallback() = default;
virtual void AfterAnimationUpdate(cMeshEntity *apMeshEntity, float afTimeStep) = 0;
};
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index f70138e5736..84c95b8c7b5 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "engine/engine.h"
#include "hpl1/hpl1.h"
#include "common/config-manager.h"
#include "common/debug-channels.h"
@@ -30,6 +31,8 @@
#include "hpl1/console.h"
#include "hpl1/detection.h"
+extern int hplMain(const hpl::tString &asCommandLine);
+
namespace Hpl1 {
Hpl1Engine *g_engine;
@@ -52,6 +55,7 @@ Common::String Hpl1Engine::getGameId() const {
}
Common::Error Hpl1Engine::run() {
+ hplMain("");
// Initialize 320x200 paletted graphics mode
initGraphics(320, 200);
_screen = new Graphics::Screen();
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index da262adec92..fba3deb0700 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -223,6 +223,8 @@ MODULE_OBJS := \
engine/sound/LowLevelSound.o \
engine/sound/MusicHandler.o \
engine/sound/Sound.o \
+ engine/sound/SoundEntityData.o \
+ engine/sound/SoundHandler.o \
engine/system/Container.o \
engine/system/LogicTimer.o \
engine/system/MemoryManager.o \
Commit: 8157f39c5584f19aaa55a0dace5eeecddef75286
https://github.com/scummvm/scummvm/commit/8157f39c5584f19aaa55a0dace5eeecddef75286
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:30+01:00
Commit Message:
HPL1: fix formatting
Changed paths:
engines/hpl1/engine/resources/FileSearcher.cpp
engines/hpl1/engine/resources/ImageManager.cpp
engines/hpl1/engine/resources/Resources.cpp
engines/hpl1/engine/resources/TextureManager.cpp
engines/hpl1/engine/resources/low_level_resources.cpp
engines/hpl1/engine/resources/low_level_resources.h
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/SaveHandler.cpp
diff --git a/engines/hpl1/engine/resources/FileSearcher.cpp b/engines/hpl1/engine/resources/FileSearcher.cpp
index ed0bb568e76..8d0c44823a4 100644
--- a/engines/hpl1/engine/resources/FileSearcher.cpp
+++ b/engines/hpl1/engine/resources/FileSearcher.cpp
@@ -67,7 +67,7 @@ void cFileSearcher::AddDirectory(tString asPath, tString asMask) {
if (it == m_setLoadedDirs.end()) {
m_setLoadedDirs.insert(asPath);
- mpLowLevelResources->FindFilesInDir(lstFileNames, asPath, asMask);
+ mpLowLevelResources->findFilesInDir(lstFileNames, asPath, asMask);
for (const auto &f : lstFileNames) {
m_mapFiles.insert(tFilePathMap::value_type(
cString::ToLowerCase(f),
diff --git a/engines/hpl1/engine/resources/ImageManager.cpp b/engines/hpl1/engine/resources/ImageManager.cpp
index f0ecf8158a7..905efc92b23 100644
--- a/engines/hpl1/engine/resources/ImageManager.cpp
+++ b/engines/hpl1/engine/resources/ImageManager.cpp
@@ -47,7 +47,7 @@ cImageManager::cImageManager(cFileSearcher *apFileSearcher, iLowLevelGraphics *a
: iResourceManager(apFileSearcher, apLowLevelResources, apLowLevelSystem) {
mpLowLevelGraphics = apLowLevelGraphics;
- mpLowLevelResources->GetSupportedImageFormats(mlstFileFormats);
+ mpLowLevelResources->getSupportedImageFormats(mlstFileFormats);
mvFrameSize = cVector2l(512, 512);
mlFrameHandle = 0;
@@ -83,7 +83,7 @@ iResourceBase *cImageManager::CreateInFrame(const tString &asName, int alFrameHa
if (!pImage) {
if (sPath != "") {
Bitmap2D *pBmp;
- pBmp = mpLowLevelResources->LoadBitmap2D(sPath);
+ pBmp = mpLowLevelResources->loadBitmap2D(sPath);
if (pBmp == NULL) {
Error("Imagemanager Couldn't load bitmap '%s'\n", sPath.c_str());
EndLoad();
diff --git a/engines/hpl1/engine/resources/Resources.cpp b/engines/hpl1/engine/resources/Resources.cpp
index 7265f49d8c0..45e4d9a8771 100644
--- a/engines/hpl1/engine/resources/Resources.cpp
+++ b/engines/hpl1/engine/resources/Resources.cpp
@@ -162,8 +162,8 @@ void cResources::Init(cGraphics *apGraphics, cSystem *apSystem, cSound *apSound,
mpMeshLoaderHandler = hplNew(cMeshLoaderHandler, (this, apScene));
- mpLowLevelResources->AddMeshLoaders(mpMeshLoaderHandler);
- mpLowLevelResources->AddVideoLoaders(mpVideoManager);
+ mpLowLevelResources->addMeshLoaders(mpMeshLoaderHandler);
+ mpLowLevelResources->addVideoLoaders(mpVideoManager);
Log("--------------------------------------------------------\n\n");
}
diff --git a/engines/hpl1/engine/resources/TextureManager.cpp b/engines/hpl1/engine/resources/TextureManager.cpp
index 99506ae1503..340e3144ef1 100644
--- a/engines/hpl1/engine/resources/TextureManager.cpp
+++ b/engines/hpl1/engine/resources/TextureManager.cpp
@@ -50,7 +50,7 @@ cTextureManager::cTextureManager(cGraphics *apGraphics, cResources *apResources)
mpGraphics = apGraphics;
mpResources = apResources;
- mpLowLevelResources->GetSupportedImageFormats(mlstFileFormats);
+ mpLowLevelResources->getSupportedImageFormats(mlstFileFormats);
mvCubeSideSuffixes.push_back("_pos_x");
mvCubeSideSuffixes.push_back("_neg_x");
@@ -129,7 +129,7 @@ iTexture *cTextureManager::CreateAnim2D(const tString &asName, bool abUseMipMaps
tBitmap2DVec vBitmaps;
for (size_t i = 0; i < vPaths.size(); ++i) {
- Bitmap2D *pBmp = mpResources->GetLowLevel()->LoadBitmap2D(vPaths[i]);
+ Bitmap2D *pBmp = mpResources->GetLowLevel()->loadBitmap2D(vPaths[i]);
if (pBmp == NULL) {
Error("Couldn't load bitmap '%s'!\n", vPaths[i].c_str());
@@ -210,7 +210,7 @@ iTexture *cTextureManager::CreateCubeMap(const tString &asPathName, bool abUseMi
// Load bitmaps for all faces
tBitmap2DVec vBitmaps;
for (int i = 0; i < 6; i++) {
- Bitmap2D *pBmp = mpResources->GetLowLevel()->LoadBitmap2D(vPaths[i]);
+ Bitmap2D *pBmp = mpResources->GetLowLevel()->loadBitmap2D(vPaths[i]);
if (pBmp == NULL) {
Error("Couldn't load bitmap '%s'!\n", vPaths[i].c_str());
for (int j = 0; j < (int)vBitmaps.size(); j++)
@@ -314,7 +314,7 @@ iTexture *cTextureManager::CreateAttenuation(const tString &asFallOffName) {
return NULL;
}
- Bitmap2D *pBmp = mpResources->GetLowLevel()->LoadBitmap2D(sPath);
+ Bitmap2D *pBmp = mpResources->GetLowLevel()->loadBitmap2D(sPath);
if (pBmp == NULL) {
Log("Couldn't load bitmap '%s'\n", asFallOffName.c_str());
return NULL;
@@ -390,7 +390,7 @@ iTexture *cTextureManager::CreateFlatTexture(const tString &asName, bool abUseMi
if (pTexture == NULL && sPath != "") {
// Load the bitmap
Bitmap2D *pBmp;
- pBmp = mpLowLevelResources->LoadBitmap2D(sPath);
+ pBmp = mpLowLevelResources->loadBitmap2D(sPath);
if (pBmp == NULL) {
Error("Texturemanager Couldn't load bitmap '%s'\n", sPath.c_str());
EndLoad();
diff --git a/engines/hpl1/engine/resources/low_level_resources.cpp b/engines/hpl1/engine/resources/low_level_resources.cpp
index 8f5f97b3b45..0479aa1b8aa 100644
--- a/engines/hpl1/engine/resources/low_level_resources.cpp
+++ b/engines/hpl1/engine/resources/low_level_resources.cpp
@@ -39,29 +39,29 @@ static tString getImageType(const tString &filepath) {
return "";
}
-Bitmap2D *LowLevelResources::LoadBitmap2D(const tString &filepath) {
+Bitmap2D *LowLevelResources::loadBitmap2D(const tString &filepath) {
return new Bitmap2D(filepath, getImageType(filepath));
}
-void LowLevelResources::GetSupportedImageFormats(tStringList &formats) {
+void LowLevelResources::getSupportedImageFormats(tStringList &formats) {
formats.insert(formats.end(), {
"BMP","GIF","JPEG","PNG","JPG","TGA"});
}
-void LowLevelResources::AddMeshLoaders(cMeshLoaderHandler *ml) {
+void LowLevelResources::addMeshLoaders(cMeshLoaderHandler *ml) {
#if 0
ml->AddLoader(hplNew(cMeshLoaderMSH, (mpLowLevelGraphics)));
ml->AddLoader(hplNew(cMeshLoaderCollada, (mpLowLevelGraphics)));
#endif
}
-void LowLevelResources::AddVideoLoaders(cVideoManager *vm) {
+void LowLevelResources::addVideoLoaders(cVideoManager *vm) {
#ifdef INCLUDE_THORA
apManager->AddVideoLoader(hplNew(cVideoStreamTheora_Loader, ()));
#endif
}
-void LowLevelResources::FindFilesInDir(tStringList &alstStrings, tString asDir, tString asMask) {
+void LowLevelResources::findFilesInDir(tStringList &alstStrings, tString asDir, tString asMask) {
//FIXME: use consistent string types
Common::String pattern = Common::String(asDir.c_str()) + '/' + Common::String(asMask.c_str());
Common::ArchiveMemberList ls;
diff --git a/engines/hpl1/engine/resources/low_level_resources.h b/engines/hpl1/engine/resources/low_level_resources.h
index ade67cc1cd4..b95326d759e 100644
--- a/engines/hpl1/engine/resources/low_level_resources.h
+++ b/engines/hpl1/engine/resources/low_level_resources.h
@@ -35,24 +35,23 @@ namespace hpl {
class Bitmap2D;
class cMeshLoaderHandler;
class cVideoManager;
-class cLowLevelGraphics;
+class iLowLevelGraphics;
class LowLevelResources {
public:
- LowLevelResources(cLowLevelGraphics *lowLevelGraphics) : _lowLevelGraphics(lowLevelGraphics) {
+ LowLevelResources(iLowLevelGraphics *lowLevelGraphics) : _lowLevelGraphics(lowLevelGraphics) {
}
- virtual ~LowLevelResources() = default;
//Returns a list of files in a directory matching a pattern
- virtual void FindFilesInDir(tStringList &fileList, tString dir, tString pattern);
+ void findFilesInDir(tStringList &fileList, tString dir, tString pattern);
- virtual void GetSupportedImageFormats(tStringList &formats);
- virtual Bitmap2D *LoadBitmap2D(const tString &filepath);
+ void getSupportedImageFormats(tStringList &formats);
+ Bitmap2D *loadBitmap2D(const tString &filepath);
- virtual void AddMeshLoaders(cMeshLoaderHandler *ml);
- virtual void AddVideoLoaders(cVideoManager *vm);
-private:
- cLowLevelGraphics *_lowLevelGraphics;
+ void addMeshLoaders(cMeshLoaderHandler *ml);
+ void addVideoLoaders(cVideoManager *vm);
+private:
+ iLowLevelGraphics *_lowLevelGraphics;
};
}; // namespace hpl
#endif // HPL_LOWLEVELRESOURCES_H
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 37a4414cf7e..b90445a1698 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -1206,7 +1206,7 @@ public:
cMainMenuWidget_Language(cInit *apInit, const cVector3f &avPos, const tWString &asText, cVector2f avFontSize, eFontAlign aAlignment)
: cMainMenuWidget_Button(apInit, avPos, asText, eMainMenuState_LastEnum, avFontSize, aAlignment) {
tStringList lstStrings;
- apInit->mpGame->GetResources()->GetLowLevel()->FindFilesInDir(lstStrings, "config/", "*.lang");
+ apInit->mpGame->GetResources()->GetLowLevel()->findFilesInDir(lstStrings, "config/", "*.lang");
mlCurrentFile = 0;
int lIdx = 0;
@@ -2618,7 +2618,7 @@ void cMainMenu::CreateWidgets() {
tTempFileAndDataSet setTempFiles;
tWString sFullPath = mpInit->mpSaveHandler->GetSaveDir() + sDir;
- pLowLevelResources->FindFilesInDir(lstFiles, cString::To8Char(sFullPath), "*.sav");
+ pLowLevelResources->findFilesInDir(lstFiles, cString::To8Char(sFullPath), "*.sav");
tStringListIt fileIt = lstFiles.begin();
for (; fileIt != lstFiles.end(); ++fileIt) {
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index dccbcf9457b..7a6cf002f34 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -674,7 +674,7 @@ void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMa
tWString sPath = msSaveDir + asDir;
tStringList lstFiles;
- pLowLevelResources->FindFilesInDir(lstFiles, cString::To8Char(sPath), cString::To8Char(asMask));
+ pLowLevelResources->findFilesInDir(lstFiles, cString::To8Char(sPath), cString::To8Char(asMask));
// If there are too many files, remove oldest.
if ((int)lstFiles.size() >= alMaxFiles) {
@@ -703,7 +703,7 @@ tWString cSaveHandler::GetLatest(const tWString &asDir, const tWString &asMask)
tWString sPath = msSaveDir + asDir;
tStringList lstFiles;
- pLowLevelResources->FindFilesInDir(lstFiles, cString::To8Char(sPath), cString::To8Char(asMask));
+ pLowLevelResources->findFilesInDir(lstFiles, cString::To8Char(sPath), cString::To8Char(asMask));
tWString sNewest = _W("");
cDate newestDate;
Commit: fd7fff7e41d70bc317cab504855b87698c9933a8
https://github.com/scummvm/scummvm/commit/fd7fff7e41d70bc317cab504855b87698c9933a8
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:31+01:00
Commit Message:
HPL1: move game setup class
Changed paths:
A engines/hpl1/engine/game/low_level_game_setup.cpp
A engines/hpl1/engine/game/low_level_game_setup.h
R engines/hpl1/engine/game/LowLevelGameSetup.h
R engines/hpl1/engine/impl/SDLGameSetup.cpp
R engines/hpl1/engine/impl/SDLGameSetup.h
engines/hpl1/engine/engine.h
engines/hpl1/engine/game/Game.cpp
engines/hpl1/engine/game/Game.h
engines/hpl1/module.mk
engines/hpl1/penumbra-overture/Init.cpp
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index 334f849577c..9407bb6643e 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -29,7 +29,7 @@
#include "hpl1/engine/ai/StateMachine.h"
#include "hpl1/engine/game/Game.h"
#include "hpl1/engine/game/GameTypes.h"
-#include "hpl1/engine/game/LowLevelGameSetup.h"
+#include "hpl1/engine/game/low_level_game_setup.h"
#include "hpl1/engine/game/SaveGame.h"
#include "hpl1/engine/game/ScriptFuncs.h"
#include "hpl1/engine/game/Updateable.h"
@@ -150,7 +150,6 @@
#include "hpl1/engine/impl/PhysicsMaterialNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
#include "hpl1/engine/impl/SDLFontData.h"
-#include "hpl1/engine/impl/SDLGameSetup.h"
#include "hpl1/engine/impl/SDLTexture.h"
#include "hpl1/engine/impl/SqScript.h"
#include "hpl1/engine/impl/VertexBufferOGL.h"
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index 03fe6149644..653c4e7c2f3 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -41,7 +41,7 @@
#include "hpl1/engine/gui/Gui.h"
-#include "hpl1/engine/game/LowLevelGameSetup.h"
+#include "hpl1/engine/game/low_level_game_setup.h"
#include "hpl1/engine/system/LowLevelSystem.h"
namespace hpl {
@@ -144,13 +144,13 @@ bool cSetupVarContainer::GetBool(const tString &asName, bool abDefault) {
//-----------------------------------------------------------------------
-cGame::cGame(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars) {
+cGame::cGame(LowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars) {
GameInit(apGameSetup, aVars);
}
//-----------------------------------------------------------------------
-cGame::cGame(iLowLevelGameSetup *apGameSetup, int alWidth, int alHeight, int alBpp, bool abFullscreen,
+cGame::cGame(LowLevelGameSetup *apGameSetup, int alWidth, int alHeight, int alBpp, bool abFullscreen,
unsigned int alUpdateRate, int alMultisampling) {
cSetupVarContainer Vars;
Vars.AddInt("ScreenWidth", alWidth);
@@ -164,7 +164,7 @@ cGame::cGame(iLowLevelGameSetup *apGameSetup, int alWidth, int alHeight, int alB
//-----------------------------------------------------------------------
-void cGame::GameInit(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars) {
+void cGame::GameInit(LowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars) {
mpGameSetup = apGameSetup;
Log("Creating Engine Modules\n");
@@ -172,25 +172,25 @@ void cGame::GameInit(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars)
// Create the modules that game connects to and init them!
Log(" Creating graphics module\n");
- mpGraphics = mpGameSetup->CreateGraphics();
+ mpGraphics = mpGameSetup->createGraphics();
Log(" Creating system module\n");
- mpSystem = mpGameSetup->CreateSystem();
+ mpSystem = mpGameSetup->createSystem();
Log(" Creating resource module\n");
- mpResources = mpGameSetup->CreateResources(mpGraphics);
+ mpResources = mpGameSetup->createResources(mpGraphics);
Log(" Creating input module\n");
- mpInput = mpGameSetup->CreateInput(mpGraphics);
+ mpInput = mpGameSetup->createInput(mpGraphics);
Log(" Creating sound module\n");
- mpSound = mpGameSetup->CreateSound();
+ mpSound = mpGameSetup->createSound();
Log(" Creating physics module\n");
- mpPhysics = mpGameSetup->CreatePhysics();
+ mpPhysics = mpGameSetup->createPhysics();
Log(" Creating ai module\n");
- mpAI = mpGameSetup->CreateAI();
+ mpAI = mpGameSetup->createAi();
Log(" Creating gui module\n");
mpGui = hplNew(cGui, ());
@@ -203,7 +203,7 @@ void cGame::GameInit(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars)
#endif
Log(" Creating scene module\n");
- mpScene = mpGameSetup->CreateScene(mpGraphics, mpResources, mpSound, mpPhysics, mpSystem, mpAI, mpHaptic);
+ mpScene = mpGameSetup->createScene(mpGraphics, mpResources, mpSound, mpPhysics, mpSystem, mpAI, mpHaptic);
Log("--------------------------------------------------------\n\n");
diff --git a/engines/hpl1/engine/game/Game.h b/engines/hpl1/engine/game/Game.h
index 2e668448e5c..162c70c90bd 100644
--- a/engines/hpl1/engine/game/Game.h
+++ b/engines/hpl1/engine/game/Game.h
@@ -33,7 +33,7 @@
namespace hpl {
class cUpdater;
-class iLowLevelGameSetup;
+class LowLevelGameSetup;
class iLowLevelSystem;
class cLogicTimer;
@@ -91,13 +91,13 @@ private:
class cGame {
public:
- cGame(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars);
- cGame(iLowLevelGameSetup *apGameSetup, int alWidth, int alHeight, int alBpp, bool abFullscreen,
+ cGame(LowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars);
+ cGame(LowLevelGameSetup *apGameSetup, int alWidth, int alHeight, int alBpp, bool abFullscreen,
unsigned int alUpdateRate = 60, int alMultisampling = 0);
~cGame();
private:
- void GameInit(iLowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars);
+ void GameInit(LowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars);
public:
/**
@@ -207,7 +207,7 @@ private:
double mfGameTime;
- iLowLevelGameSetup *mpGameSetup;
+ LowLevelGameSetup *mpGameSetup;
cUpdater *mpUpdater;
cLogicTimer *mpLogicTimer;
diff --git a/engines/hpl1/engine/game/low_level_game_setup.cpp b/engines/hpl1/engine/game/low_level_game_setup.cpp
new file mode 100644
index 00000000000..fcae5d53149
--- /dev/null
+++ b/engines/hpl1/engine/game/low_level_game_setup.cpp
@@ -0,0 +1,105 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "hpl1/engine/game/low_level_game_setup.h"
+#include "hpl1/engine/impl/KeyboardSDL.h"
+#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
+#include "hpl1/engine/impl/LowLevelInputSDL.h"
+#include "hpl1/engine/impl/LowLevelPhysicsNewton.h"
+#include "hpl1/engine/resources/low_level_resources.h"
+#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
+#include "hpl1/engine/impl/LowLevelSystemSDL.h"
+#include "hpl1/engine/impl/MouseSDL.h"
+
+namespace hpl {
+
+LowLevelGameSetup::LowLevelGameSetup() {
+#if 0
+ _lowLevelSystem = hplNew( cLowLevelSystemSDL, () );
+ _lowLevelGraphics = hplNew( cLowLevelGraphicsSDL,() );
+ _lowLevelInput = hplNew( cLowLevelInputSDL,(_lowLevelGraphics) );
+ _lowLevelResources = hplNew( LowLevelResources,(_lowLevelGraphics) );
+ _lowLevelSound = hplNew( cLowLevelSoundOpenAL,() );
+ _lowLevelPhysics = hplNew( cLowLevelPhysicsNewton,() );
+ _lowLevelHaptic = nullptr;
+#endif
+}
+
+LowLevelGameSetup::~LowLevelGameSetup() {
+#if 0
+ Log("- Deleting lowlevel stuff.\n");
+
+ Log(" Physics\n");
+ hplDelete(mpLowLevelPhysics);
+ Log(" Sound\n");
+ hplDelete(mpLowLevelSound);
+ Log(" Input\n");
+ hplDelete(mpLowLevelInput);
+ Log(" Resources\n");
+ hplDelete(mpLowLevelResources);
+ Log(" System\n");
+ hplDelete(mpLowLevelSystem);
+ Log(" Graphics\n");
+ hplDelete(mpLowLevelGraphics);
+ Log(" Haptic\n");
+ if(mpLowLevelHaptic) hplDelete(mpLowLevelHaptic);
+#endif
+}
+
+cScene *LowLevelGameSetup::createScene(cGraphics *graphics, cResources *resources, cSound *sound,
+ cPhysics *physics, cSystem *system, cAI *ai, cHaptic *haptic) {
+ return hplNew(cScene, (graphics, resources, sound, physics, system, ai, haptic));
+}
+
+cResources *LowLevelGameSetup::createResources(cGraphics *graphics) {
+ return hplNew(cResources, (_lowLevelResources, _lowLevelGraphics));
+}
+
+
+cInput *LowLevelGameSetup::createInput(cGraphics *graphics) {
+ return hplNew(cInput, (_lowLevelInput));
+}
+
+cSystem *LowLevelGameSetup::createSystem() {
+ return hplNew(cSystem, (_lowLevelSystem));
+}
+
+cGraphics *LowLevelGameSetup::createGraphics() {
+ return hplNew(cGraphics, (_lowLevelGraphics, _lowLevelResources));
+}
+
+cSound *LowLevelGameSetup::createSound() {
+ return hplNew(cSound, (_lowLevelSound));
+}
+
+cPhysics *LowLevelGameSetup::createPhysics() {
+ return hplNew(cPhysics, (_lowLevelPhysics));
+}
+
+cAI *LowLevelGameSetup::createAi() {
+ return hplNew(cAI, ());
+}
+
+cHaptic *LowLevelGameSetup::createHaptic() {
+ return hplNew(cHaptic, (_lowLevelHaptic));
+}
+
+} // namespace hpl
diff --git a/engines/hpl1/engine/game/LowLevelGameSetup.h b/engines/hpl1/engine/game/low_level_game_setup.h
similarity index 66%
rename from engines/hpl1/engine/game/LowLevelGameSetup.h
rename to engines/hpl1/engine/game/low_level_game_setup.h
index 678a224c645..c6cdd8c9164 100644
--- a/engines/hpl1/engine/game/LowLevelGameSetup.h
+++ b/engines/hpl1/engine/game/low_level_game_setup.h
@@ -40,20 +40,29 @@
namespace hpl {
-class iLowLevelGameSetup {
+class LowLevelGameSetup {
public:
- virtual ~iLowLevelGameSetup() {}
+ LowLevelGameSetup();
+ ~LowLevelGameSetup();
- virtual cInput *CreateInput(cGraphics *apGraphics) = 0;
- virtual cSystem *CreateSystem() = 0;
- virtual cGraphics *CreateGraphics() = 0;
- virtual cResources *CreateResources(cGraphics *apGraphics) = 0;
- virtual cScene *CreateScene(cGraphics *apGraphics, cResources *apResources, cSound *apSound,
- cPhysics *apPhysics, cSystem *apSystem, cAI *apAI, cHaptic *apHaptic) = 0;
- virtual cSound *CreateSound() = 0;
- virtual cPhysics *CreatePhysics() = 0;
- virtual cAI *CreateAI() = 0;
- virtual cHaptic *CreateHaptic() = 0;
+ cInput *createInput(cGraphics *graphics);
+ cSystem *createSystem();
+ cGraphics *createGraphics();
+ cResources *createResources(cGraphics *graphics);
+ cScene *createScene(cGraphics *graphics, cResources *resources, cSound *sound,
+ cPhysics *physics, cSystem *system, cAI *ai, cHaptic *haptic);
+ cSound *createSound();
+ cPhysics *createPhysics();
+ cAI *createAi();
+ cHaptic *createHaptic();
+private:
+ iLowLevelSystem *_lowLevelSystem;
+ iLowLevelGraphics *_lowLevelGraphics;
+ iLowLevelInput *_lowLevelInput;
+ LowLevelResources *_lowLevelResources;
+ iLowLevelSound *_lowLevelSound;
+ iLowLevelPhysics *_lowLevelPhysics;
+ iLowLevelHaptic *_lowLevelHaptic;
};
}; // namespace hpl
#endif // HPL_LOWLEVELGAMESETUP_H
diff --git a/engines/hpl1/engine/impl/SDLGameSetup.cpp b/engines/hpl1/engine/impl/SDLGameSetup.cpp
deleted file mode 100644
index 9b6ae87e8d1..00000000000
--- a/engines/hpl1/engine/impl/SDLGameSetup.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#if 0 // def WIN32
-#pragma comment(lib, "SDL.lib")
-#pragma comment(lib, "SDLmain.lib")
-#endif
-
-#include "hpl1/engine/impl/SDLGameSetup.h"
-#include "hpl1/engine/impl/KeyboardSDL.h"
-#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
-#include "hpl1/engine/impl/LowLevelInputSDL.h"
-#include "hpl1/engine/impl/LowLevelPhysicsNewton.h"
-#include "hpl1/engine/resources/low_level_resources.h"
-#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
-#include "hpl1/engine/impl/LowLevelSystemSDL.h"
-#include "hpl1/engine/impl/MouseSDL.h"
-#ifdef INCLUDE_HAPTIC
-#include "hpl1/engine/impl/LowLevelHapticHaptX.h"
-#endif
-#include "hpl1/engine/haptic/Haptic.h"
-
-//#include "SDL/SDL.h"
-
-namespace hpl {
-
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cSDLGameSetup::cSDLGameSetup() {
-#if 0
- if (SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER ) < 0) {
- FatalError("Error Initializing Display: %s",SDL_GetError());
- exit(1);
- }
-
- mpLowLevelSystem = hplNew( cLowLevelSystemSDL, () );
- mpLowLevelGraphics = hplNew( cLowLevelGraphicsSDL,() );
- mpLowLevelInput = hplNew( cLowLevelInputSDL,(mpLowLevelGraphics) );
- mpLowLevelResources = hplNew( cLowLevelResourcesSDL,((cLowLevelGraphicsSDL *)mpLowLevelGraphics) );
-// #ifdef WIN32
-// mpLowLevelSound = hplNew( cLowLevelSoundFmod, () );
-// #else
- mpLowLevelSound = hplNew( cLowLevelSoundOpenAL,() );
-// #endif
- mpLowLevelPhysics = hplNew( cLowLevelPhysicsNewton,() );
-
-#ifdef INCLUDE_HAPTIC
- mpLowLevelHaptic = hplNew( cLowLevelHapticHaptX,() );
-#else
- mpLowLevelHaptic = NULL;
-#endif
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-cSDLGameSetup::~cSDLGameSetup() {
-#if 0
- Log("- Deleting lowlevel stuff.\n");
-
- Log(" Physics\n");
- hplDelete(mpLowLevelPhysics);
- Log(" Sound\n");
- hplDelete(mpLowLevelSound);
- Log(" Input\n");
- hplDelete(mpLowLevelInput);
- Log(" Resources\n");
- hplDelete(mpLowLevelResources);
- Log(" System\n");
- hplDelete(mpLowLevelSystem);
- Log(" Graphics\n");
- hplDelete(mpLowLevelGraphics);
- Log(" Haptic\n");
- if(mpLowLevelHaptic) hplDelete(mpLowLevelHaptic);
-
- SDL_Quit();
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cScene *cSDLGameSetup::CreateScene(cGraphics *apGraphics, cResources *apResources, cSound *apSound,
- cPhysics *apPhysics, cSystem *apSystem, cAI *apAI,
- cHaptic *apHaptic) {
- cScene *pScene = hplNew(cScene, (apGraphics, apResources, apSound, apPhysics, apSystem, apAI, apHaptic));
- return pScene;
-}
-
-//-----------------------------------------------------------------------
-
-/**
- * \todo Lowlevelresource and resource both use lowlevel graphics. Can this be fixed??
- * \param apGraphics
- * \return
- */
-cResources *cSDLGameSetup::CreateResources(cGraphics *apGraphics) {
- cResources *pResources = hplNew(cResources, (mpLowLevelResources, mpLowLevelGraphics));
- return pResources;
-}
-
-//-----------------------------------------------------------------------
-
-cInput *cSDLGameSetup::CreateInput(cGraphics *apGraphics) {
- cInput *pInput = hplNew(cInput, (mpLowLevelInput));
- return pInput;
-}
-
-//-----------------------------------------------------------------------
-
-cSystem *cSDLGameSetup::CreateSystem() {
- cSystem *pSystem = hplNew(cSystem, (mpLowLevelSystem));
- return pSystem;
-}
-
-//-----------------------------------------------------------------------
-
-cGraphics *cSDLGameSetup::CreateGraphics() {
- cGraphics *pGraphics = hplNew(cGraphics, (mpLowLevelGraphics, mpLowLevelResources));
- return pGraphics;
-}
-//-----------------------------------------------------------------------
-
-cSound *cSDLGameSetup::CreateSound() {
- cSound *pSound = hplNew(cSound, (mpLowLevelSound));
- return pSound;
-}
-
-//-----------------------------------------------------------------------
-
-cPhysics *cSDLGameSetup::CreatePhysics() {
- cPhysics *pPhysics = hplNew(cPhysics, (mpLowLevelPhysics));
- return pPhysics;
-}
-
-//-----------------------------------------------------------------------
-
-cAI *cSDLGameSetup::CreateAI() {
- cAI *pAI = hplNew(cAI, ());
- return pAI;
-}
-
-//-----------------------------------------------------------------------
-
-cHaptic *cSDLGameSetup::CreateHaptic() {
- cHaptic *pHaptic = hplNew(cHaptic, (mpLowLevelHaptic));
- return pHaptic;
-}
-
-//-----------------------------------------------------------------------
-
-} // namespace hpl
diff --git a/engines/hpl1/engine/impl/SDLGameSetup.h b/engines/hpl1/engine/impl/SDLGameSetup.h
deleted file mode 100644
index 21535b5999c..00000000000
--- a/engines/hpl1/engine/impl/SDLGameSetup.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_SDL_GAMESETUP_H
-#define HPL_SDL_GAMESETUP_H
-
-#include "hpl1/engine/game/LowLevelGameSetup.h"
-#include "hpl1/engine/graphics/LowLevelGraphics.h"
-#include "hpl1/engine/haptic/LowLevelHaptic.h"
-#include "hpl1/engine/input/LowLevelInput.h"
-#include "hpl1/engine/physics/LowLevelPhysics.h"
-#include "hpl1/engine/resources/low_level_resources.h"
-#include "hpl1/engine/sound/LowLevelSound.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
-
-namespace hpl {
-
-class cSDLGameSetup : public iLowLevelGameSetup {
-public:
- cSDLGameSetup();
- ~cSDLGameSetup();
-
- cInput *CreateInput(cGraphics *apGraphics);
- cSystem *CreateSystem();
- cGraphics *CreateGraphics();
- cResources *CreateResources(cGraphics *apGraphics);
- cScene *CreateScene(cGraphics *apGraphics, cResources *apResources, cSound *apSound,
- cPhysics *apPhysics, cSystem *apSystem, cAI *apAI, cHaptic *apHaptic);
- cSound *CreateSound();
- cPhysics *CreatePhysics();
- cAI *CreateAI();
- cHaptic *CreateHaptic();
-
-private:
- iLowLevelSystem *mpLowLevelSystem;
- iLowLevelGraphics *mpLowLevelGraphics;
- iLowLevelInput *mpLowLevelInput;
- LowLevelResources *mpLowLevelResources;
- // #ifdef WIN32
- // iLowLevelSound* mpLowLevelSound;
- // #else
- iLowLevelSound *mpLowLevelSound;
- // #endif
- iLowLevelPhysics *mpLowLevelPhysics;
- iLowLevelHaptic *mpLowLevelHaptic;
-};
-}; // namespace hpl
-#endif // HPL_LOWLEVELGAMESETUP_SDL_H
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index fba3deb0700..290ffdeda90 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -13,6 +13,7 @@ MODULE_OBJS := \
engine/game/SaveGame.o \
engine/game/ScriptFuncs.o \
engine/game/Updater.o \
+ engine/game/low_level_game_setup.o \
engine/graphics/Animation.o \
engine/graphics/AnimationTrack.o \
engine/graphics/BackgroundImage.o \
@@ -117,7 +118,6 @@ MODULE_OBJS := \
engine/impl/PhysicsMaterialNewton.o \
engine/impl/PhysicsWorldNewton.o \
engine/impl/SDLFontData.o \
- engine/impl/SDLGameSetup.o \
engine/impl/SDLTexture.o \
engine/impl/SqScript.o \
engine/impl/VertexBufferOGL.o \
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 07af9e7b1bb..55d155fa356 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -397,9 +397,9 @@ bool cInit::Init(tString asCommandLine) {
cCGProgram::SetFProfile(mpConfig->GetString("Graphics", "ForceFP", "AUTO"));
cCGProgram::SetVProfile(mpConfig->GetString("Graphics", "ForceVP", "AUTO"));
- iLowLevelGameSetup *pSetUp = NULL;
+ LowLevelGameSetup *pSetUp = NULL;
- pSetUp = hplNew(cSDLGameSetup, ());
+ pSetUp = hplNew(LowLevelGameSetup, ());
mpGame = hplNew(cGame, (pSetUp, Vars));
#ifdef TIMELIMIT
Commit: 7d46984d84ddd2138c9232cd33a02f80d030743b
https://github.com/scummvm/scummvm/commit/7d46984d84ddd2138c9232cd33a02f80d030743b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:31+01:00
Commit Message:
HPL1: move LowLevelSystem implementation
Changed paths:
A engines/hpl1/engine/system/low_level_system.cpp
A engines/hpl1/engine/system/low_level_system.h
R engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
R engines/hpl1/engine/impl/LowLevelSystemSDL.h
R engines/hpl1/engine/system/LowLevelSystem.h
engines/hpl1/engine/ai/AI.cpp
engines/hpl1/engine/ai/AINodeContainer.cpp
engines/hpl1/engine/ai/AINodeGenerator.cpp
engines/hpl1/engine/ai/AStar.cpp
engines/hpl1/engine/ai/StateMachine.cpp
engines/hpl1/engine/engine.h
engines/hpl1/engine/game/Game.cpp
engines/hpl1/engine/game/Game.h
engines/hpl1/engine/game/GameTypes.cpp
engines/hpl1/engine/game/SaveGame.cpp
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/game/Updater.cpp
engines/hpl1/engine/game/Updater.h
engines/hpl1/engine/game/low_level_game_setup.cpp
engines/hpl1/engine/game/low_level_game_setup.h
engines/hpl1/engine/graphics/AnimationTrack.cpp
engines/hpl1/engine/graphics/Bone.cpp
engines/hpl1/engine/graphics/BoneState.cpp
engines/hpl1/engine/graphics/FontData.cpp
engines/hpl1/engine/graphics/Graphics.cpp
engines/hpl1/engine/graphics/GraphicsDrawer.cpp
engines/hpl1/engine/graphics/ImageEntityData.cpp
engines/hpl1/engine/graphics/Material.cpp
engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Flat.cpp
engines/hpl1/engine/graphics/MeshCreator.cpp
engines/hpl1/engine/graphics/ParticleEmitter.cpp
engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
engines/hpl1/engine/graphics/Renderable.cpp
engines/hpl1/engine/graphics/Renderer2D.cpp
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/engine/graphics/RendererPostEffects.cpp
engines/hpl1/engine/graphics/Skeleton.cpp
engines/hpl1/engine/gui/GuiGfxElement.cpp
engines/hpl1/engine/gui/GuiPopUp.cpp
engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
engines/hpl1/engine/gui/GuiSet.cpp
engines/hpl1/engine/gui/GuiSkin.cpp
engines/hpl1/engine/gui/Widget.cpp
engines/hpl1/engine/gui/Widget.h
engines/hpl1/engine/gui/WidgetBaseClasses.cpp
engines/hpl1/engine/gui/WidgetButton.cpp
engines/hpl1/engine/gui/WidgetCheckBox.cpp
engines/hpl1/engine/gui/WidgetComboBox.cpp
engines/hpl1/engine/gui/WidgetFrame.cpp
engines/hpl1/engine/gui/WidgetImage.cpp
engines/hpl1/engine/gui/WidgetLabel.cpp
engines/hpl1/engine/gui/WidgetListBox.cpp
engines/hpl1/engine/gui/WidgetSlider.cpp
engines/hpl1/engine/gui/WidgetTextBox.cpp
engines/hpl1/engine/gui/WidgetWindow.cpp
engines/hpl1/engine/haptic/Haptic.cpp
engines/hpl1/engine/haptic/LowLevelHaptic.cpp
engines/hpl1/engine/impl/CGProgram.cpp
engines/hpl1/engine/impl/CharacterBodyNewton.cpp
engines/hpl1/engine/impl/CollideShapeNewton.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelInputSDL.cpp
engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
engines/hpl1/engine/impl/MeshLoaderCollada.cpp
engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
engines/hpl1/engine/impl/MeshLoaderMSH.cpp
engines/hpl1/engine/impl/OpenALSoundData.cpp
engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
engines/hpl1/engine/impl/PhysicsJointNewton.h
engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
engines/hpl1/engine/impl/SDLFontData.cpp
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/SqScript.cpp
engines/hpl1/engine/impl/SqScript.h
engines/hpl1/engine/impl/VertexBufferOGL.cpp
engines/hpl1/engine/impl/VertexBufferVBO.cpp
engines/hpl1/engine/input/Action.cpp
engines/hpl1/engine/input/ActionKeyboard.cpp
engines/hpl1/engine/input/Input.cpp
engines/hpl1/engine/math/Frustum.cpp
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/math/Quaternion.cpp
engines/hpl1/engine/physics/CharacterBody.cpp
engines/hpl1/engine/physics/Collider2D.cpp
engines/hpl1/engine/physics/Physics.cpp
engines/hpl1/engine/physics/PhysicsBody.cpp
engines/hpl1/engine/physics/PhysicsController.cpp
engines/hpl1/engine/physics/PhysicsJoint.cpp
engines/hpl1/engine/physics/PhysicsJointBall.cpp
engines/hpl1/engine/physics/PhysicsWorld.cpp
engines/hpl1/engine/physics/SurfaceData.cpp
engines/hpl1/engine/resources/AnimationManager.cpp
engines/hpl1/engine/resources/ConfigFile.cpp
engines/hpl1/engine/resources/EntityLoader_Object.cpp
engines/hpl1/engine/resources/FileSearcher.cpp
engines/hpl1/engine/resources/FontManager.cpp
engines/hpl1/engine/resources/FrameBitmap.cpp
engines/hpl1/engine/resources/GpuProgramManager.cpp
engines/hpl1/engine/resources/GpuProgramManager.h
engines/hpl1/engine/resources/ImageEntityManager.cpp
engines/hpl1/engine/resources/ImageManager.cpp
engines/hpl1/engine/resources/ImageManager.h
engines/hpl1/engine/resources/LanguageFile.cpp
engines/hpl1/engine/resources/MaterialManager.cpp
engines/hpl1/engine/resources/MeshLoaderHandler.cpp
engines/hpl1/engine/resources/MeshManager.cpp
engines/hpl1/engine/resources/ParticleManager.cpp
engines/hpl1/engine/resources/ResourceBase.cpp
engines/hpl1/engine/resources/ResourceBase.h
engines/hpl1/engine/resources/ResourceManager.cpp
engines/hpl1/engine/resources/ResourceManager.h
engines/hpl1/engine/resources/Resources.cpp
engines/hpl1/engine/resources/Resources.h
engines/hpl1/engine/resources/ScriptManager.cpp
engines/hpl1/engine/resources/SoundEntityManager.cpp
engines/hpl1/engine/resources/SoundManager.cpp
engines/hpl1/engine/resources/TextureManager.cpp
engines/hpl1/engine/resources/TileSetManager.cpp
engines/hpl1/engine/resources/VideoManager.cpp
engines/hpl1/engine/scene/AnimationState.cpp
engines/hpl1/engine/scene/Entity.cpp
engines/hpl1/engine/scene/Entity3D.cpp
engines/hpl1/engine/scene/ImageEntity.cpp
engines/hpl1/engine/scene/Light.cpp
engines/hpl1/engine/scene/Light3D.cpp
engines/hpl1/engine/scene/MultiImageEntity.cpp
engines/hpl1/engine/scene/Node.cpp
engines/hpl1/engine/scene/Node2D.cpp
engines/hpl1/engine/scene/Node3D.cpp
engines/hpl1/engine/scene/PortalContainer.cpp
engines/hpl1/engine/scene/Scene.cpp
engines/hpl1/engine/scene/SectorVisibility.cpp
engines/hpl1/engine/scene/TileLayer.cpp
engines/hpl1/engine/scene/TileMap.cpp
engines/hpl1/engine/scene/TileMapLineIt.cpp
engines/hpl1/engine/scene/TileSet.cpp
engines/hpl1/engine/scene/World2D.cpp
engines/hpl1/engine/scene/World3D.cpp
engines/hpl1/engine/sound/LowLevelSound.h
engines/hpl1/engine/sound/MusicHandler.cpp
engines/hpl1/engine/sound/Sound.cpp
engines/hpl1/engine/sound/SoundEntityData.cpp
engines/hpl1/engine/sound/SoundHandler.cpp
engines/hpl1/engine/system/LogicTimer.cpp
engines/hpl1/engine/system/LogicTimer.h
engines/hpl1/engine/system/MemoryManager.cpp
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/engine/system/String.cpp
engines/hpl1/engine/system/System.cpp
engines/hpl1/engine/system/System.h
engines/hpl1/module.mk
engines/hpl1/penumbra-overture/GameScripts.cpp
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/MapHandler.cpp
engines/hpl1/penumbra-overture/Player.cpp
engines/hpl1/penumbra-overture/SaveHandler.cpp
diff --git a/engines/hpl1/engine/ai/AI.cpp b/engines/hpl1/engine/ai/AI.cpp
index b71997c8456..25c54c059e5 100644
--- a/engines/hpl1/engine/ai/AI.cpp
+++ b/engines/hpl1/engine/ai/AI.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/ai/AI.h"
#include "hpl1/engine/ai/AINodeGenerator.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/MemoryManager.h"
namespace hpl {
diff --git a/engines/hpl1/engine/ai/AINodeContainer.cpp b/engines/hpl1/engine/ai/AINodeContainer.cpp
index 3cf90a703ac..1a7b13bfbf5 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.cpp
+++ b/engines/hpl1/engine/ai/AINodeContainer.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/physics/PhysicsBody.h"
#include "hpl1/engine/scene/World3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.cpp b/engines/hpl1/engine/ai/AINodeGenerator.cpp
index 2ab944376ff..fa680b2f8aa 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.cpp
+++ b/engines/hpl1/engine/ai/AINodeGenerator.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/scene/World3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/system/System.h"
diff --git a/engines/hpl1/engine/ai/AStar.cpp b/engines/hpl1/engine/ai/AStar.cpp
index 29ad084e648..1f33f9f41ad 100644
--- a/engines/hpl1/engine/ai/AStar.cpp
+++ b/engines/hpl1/engine/ai/AStar.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/ai/StateMachine.cpp b/engines/hpl1/engine/ai/StateMachine.cpp
index 40dde878a84..e5a3508f4ec 100644
--- a/engines/hpl1/engine/ai/StateMachine.cpp
+++ b/engines/hpl1/engine/ai/StateMachine.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/ai/StateMachine.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index 9407bb6643e..0fbc6009880 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -131,7 +131,6 @@
#include "hpl1/engine/impl/LowLevelInputSDL.h"
#include "hpl1/engine/impl/LowLevelPhysicsNewton.h"
#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
-#include "hpl1/engine/impl/LowLevelSystemSDL.h"
#include "hpl1/engine/impl/MeshLoaderCollada.h"
#include "hpl1/engine/impl/MeshLoaderMSH.h"
#include "hpl1/engine/impl/MouseSDL.h"
@@ -279,7 +278,7 @@
#include "hpl1/engine/system/BinTree.h"
#include "hpl1/engine/system/Container.h"
#include "hpl1/engine/system/LogicTimer.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/MemoryManager.h"
#include "hpl1/engine/system/Script.h"
#include "hpl1/engine/system/SerializeClass.h"
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index 653c4e7c2f3..2ed2256bbd8 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -42,7 +42,7 @@
#include "hpl1/engine/gui/Gui.h"
#include "hpl1/engine/game/low_level_game_setup.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
@@ -50,7 +50,7 @@ namespace hpl {
// FPS COUNTER
//////////////////////////////////////////////////////////////////////////
-cFPSCounter::cFPSCounter(iLowLevelSystem *apLowLevelSystem) {
+cFPSCounter::cFPSCounter(LowLevelSystem *apLowLevelSystem) {
mfFPS = 60;
mlFramecounter = 0;
diff --git a/engines/hpl1/engine/game/Game.h b/engines/hpl1/engine/game/Game.h
index 162c70c90bd..da83065fc1c 100644
--- a/engines/hpl1/engine/game/Game.h
+++ b/engines/hpl1/engine/game/Game.h
@@ -34,7 +34,7 @@ namespace hpl {
class cUpdater;
class LowLevelGameSetup;
-class iLowLevelSystem;
+class LowLevelSystem;
class cLogicTimer;
class cSystem;
@@ -50,7 +50,7 @@ class cGui;
class cFPSCounter {
public:
- cFPSCounter(iLowLevelSystem *apLowLevelSystem);
+ cFPSCounter(LowLevelSystem *apLowLevelSystem);
void AddFrame();
@@ -58,7 +58,7 @@ public:
float mfUpdateRate;
private:
- iLowLevelSystem *mpLowLevelSystem;
+ LowLevelSystem *mpLowLevelSystem;
int mlFramecounter;
float mfFrametimestart;
float mfFrametime;
diff --git a/engines/hpl1/engine/game/GameTypes.cpp b/engines/hpl1/engine/game/GameTypes.cpp
index 783453daa29..a65e9eb34dd 100644
--- a/engines/hpl1/engine/game/GameTypes.cpp
+++ b/engines/hpl1/engine/game/GameTypes.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/game/GameTypes.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/game/SaveGame.cpp b/engines/hpl1/engine/game/SaveGame.cpp
index 5a74a7976fa..557c0f57f91 100644
--- a/engines/hpl1/engine/game/SaveGame.cpp
+++ b/engines/hpl1/engine/game/SaveGame.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/game/SaveGame.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index 82d4b4c8012..54b91a03998 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -62,7 +62,7 @@
#include "hpl1/engine/sound/SoundData.h"
#include "hpl1/engine/sound/SoundEntityData.h"
#include "hpl1/engine/sound/SoundHandler.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/Script.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/system/System.h"
@@ -1349,92 +1349,92 @@ void cScriptFuncs::Init(cGraphics *apGraphics,
gpGame = apGame;
// General
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(Print));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FloatToString));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(IntToString));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(RandFloat));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(RandInt));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(StringContains));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(Print));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(FloatToString));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(IntToString));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(RandFloat));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(RandInt));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(StringContains));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(ResetLogicTimer));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(ResetLogicTimer));
// Renderer
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetAmbientColor));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetAmbientColor));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSkybox));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSkyboxActive));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSkyboxColor));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetSkybox));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetSkyboxActive));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetSkyboxColor));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateParticleSystemOnCamera));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFogActive));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFogCulling));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFogProperties));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(CreateParticleSystemOnCamera));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetFogActive));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetFogCulling));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetFogProperties));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSectorProperties));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetSectorPortalActive));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetSectorProperties));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetSectorPortalActive));
// Resources
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PreloadSound));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(Translate));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(PreloadSound));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(Translate));
// Mesh Entity
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetMeshActive));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetMeshActive));
// Beams
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateBeam));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(DestroyBeam));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(CreateBeam));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(DestroyBeam));
// Particle systems
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetParticleSystemActive));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateParticleSystem));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(KillParticleSystem));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetParticleSystemActive));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(CreateParticleSystem));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(KillParticleSystem));
// Light
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeLight3D));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AttachBillboardToLight3D));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(FadeLight3D));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(AttachBillboardToLight3D));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DVisible));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DFlickerActive));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DFlicker));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DOnlyAffectInSector));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DVisible));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DFlickerActive));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DFlicker));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetLight3DOnlyAffectInSector));
// Sound
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlayMusic));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(StopMusic));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlaySoundEntity));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(StopSoundEntity));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeInSoundEntity));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeOutSoundEntity));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlayGuiSound));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateSoundEntity));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(PlayMusic));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(StopMusic));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(PlaySoundEntity));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(StopSoundEntity));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(FadeInSoundEntity));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(FadeOutSoundEntity));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(PlayGuiSound));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(CreateSoundEntity));
// Physics
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointCallback));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(BreakJoint));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetJointProperty));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetBodyProperty));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetBodyProperty));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointProperty));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AttachBodiesWithJoint));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetJointCallback));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(BreakJoint));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(GetJointProperty));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(GetBodyProperty));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetBodyProperty));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetJointProperty));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(AttachBodiesWithJoint));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointControllerActive));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(ChangeJointController));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetJointControllerPropertyFloat));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetJointControllerActive));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(ChangeJointController));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetJointControllerPropertyFloat));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddBodyForce));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddBodyImpulse));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(AddBodyForce));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(AddBodyImpulse));
// Local vars
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateLocalVar));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLocalVar));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddLocalVar));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetLocalVar));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(CreateLocalVar));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetLocalVar));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(AddLocalVar));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(GetLocalVar));
// Global vars
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateGlobalVar));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetGlobalVar));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddGlobalVar));
- gpSystem->GetLowLevel()->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetGlobalVar));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(CreateGlobalVar));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(SetGlobalVar));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(AddGlobalVar));
+ gpSystem->GetLowLevel()->addScriptFunc(SCRIPT_REGISTER_FUNC(GetGlobalVar));
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/game/Updater.cpp b/engines/hpl1/engine/game/Updater.cpp
index 67c91cb22db..972e7295f6c 100644
--- a/engines/hpl1/engine/game/Updater.cpp
+++ b/engines/hpl1/engine/game/Updater.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/game/Updater.h"
#include "hpl1/engine/game/Updateable.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
@@ -38,7 +38,7 @@ namespace hpl {
//-----------------------------------------------------------------------
-cUpdater::cUpdater(iLowLevelSystem *apLowLevelSystem) {
+cUpdater::cUpdater(LowLevelSystem *apLowLevelSystem) {
mpCurrentUpdates = NULL;
mpLowLevelSystem = apLowLevelSystem;
diff --git a/engines/hpl1/engine/game/Updater.h b/engines/hpl1/engine/game/Updater.h
index cf28daa9095..90e07ea821b 100644
--- a/engines/hpl1/engine/game/Updater.h
+++ b/engines/hpl1/engine/game/Updater.h
@@ -36,7 +36,7 @@
namespace hpl {
class iUpdateable;
-class iLowLevelSystem;
+class LowLevelSystem;
typedef std::list<iUpdateable *> tUpdateableList;
typedef tUpdateableList::iterator tUpdateableListIt;
@@ -46,7 +46,7 @@ typedef tUpdateContainerMap::iterator tUpdateContainerMapIt;
class cUpdater {
public:
- cUpdater(iLowLevelSystem *apLowLevelSystem);
+ cUpdater(LowLevelSystem *apLowLevelSystem);
~cUpdater();
void Reset();
@@ -100,7 +100,7 @@ private:
tUpdateContainerMap m_mapUpdateContainer;
- iLowLevelSystem *mpLowLevelSystem;
+ LowLevelSystem *mpLowLevelSystem;
tUpdateableList *mpCurrentUpdates;
tUpdateableList mlstGlobalUpdateableList;
diff --git a/engines/hpl1/engine/game/low_level_game_setup.cpp b/engines/hpl1/engine/game/low_level_game_setup.cpp
index fcae5d53149..fba412f759a 100644
--- a/engines/hpl1/engine/game/low_level_game_setup.cpp
+++ b/engines/hpl1/engine/game/low_level_game_setup.cpp
@@ -20,27 +20,25 @@
*/
#include "hpl1/engine/game/low_level_game_setup.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/impl/KeyboardSDL.h"
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
#include "hpl1/engine/impl/LowLevelInputSDL.h"
#include "hpl1/engine/impl/LowLevelPhysicsNewton.h"
#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
-#include "hpl1/engine/impl/LowLevelSystemSDL.h"
#include "hpl1/engine/impl/MouseSDL.h"
namespace hpl {
LowLevelGameSetup::LowLevelGameSetup() {
-#if 0
- _lowLevelSystem = hplNew( cLowLevelSystemSDL, () );
- _lowLevelGraphics = hplNew( cLowLevelGraphicsSDL,() );
- _lowLevelInput = hplNew( cLowLevelInputSDL,(_lowLevelGraphics) );
- _lowLevelResources = hplNew( LowLevelResources,(_lowLevelGraphics) );
- _lowLevelSound = hplNew( cLowLevelSoundOpenAL,() );
- _lowLevelPhysics = hplNew( cLowLevelPhysicsNewton,() );
- _lowLevelHaptic = nullptr;
-#endif
+ _lowLevelSystem = hplNew( LowLevelSystem, () );
+ _lowLevelGraphics = hplNew( cLowLevelGraphicsSDL,() );
+ //_lowLevelInput = hplNew( cLowLevelInputSDL,(_lowLevelGraphics) );
+ _lowLevelResources = hplNew( LowLevelResources,(_lowLevelGraphics) );
+ //_lowLevelSound = hplNew( cLowLevelSoundOpenAL,() );
+ //_lowLevelPhysics = hplNew( cLowLevelPhysicsNewton,() );
+ _lowLevelHaptic = nullptr;
}
LowLevelGameSetup::~LowLevelGameSetup() {
diff --git a/engines/hpl1/engine/game/low_level_game_setup.h b/engines/hpl1/engine/game/low_level_game_setup.h
index c6cdd8c9164..a0837fbb708 100644
--- a/engines/hpl1/engine/game/low_level_game_setup.h
+++ b/engines/hpl1/engine/game/low_level_game_setup.h
@@ -56,7 +56,7 @@ public:
cAI *createAi();
cHaptic *createHaptic();
private:
- iLowLevelSystem *_lowLevelSystem;
+ LowLevelSystem *_lowLevelSystem;
iLowLevelGraphics *_lowLevelGraphics;
iLowLevelInput *_lowLevelInput;
LowLevelResources *_lowLevelResources;
diff --git a/engines/hpl1/engine/graphics/AnimationTrack.cpp b/engines/hpl1/engine/graphics/AnimationTrack.cpp
index 540f6444c86..38d25528e1e 100644
--- a/engines/hpl1/engine/graphics/AnimationTrack.cpp
+++ b/engines/hpl1/engine/graphics/AnimationTrack.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/graphics/Animation.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/scene/Node3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Bone.cpp b/engines/hpl1/engine/graphics/Bone.cpp
index 134109b866f..67443617052 100644
--- a/engines/hpl1/engine/graphics/Bone.cpp
+++ b/engines/hpl1/engine/graphics/Bone.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/graphics/Skeleton.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/BoneState.cpp b/engines/hpl1/engine/graphics/BoneState.cpp
index 5633862698b..1ad2da47da8 100644
--- a/engines/hpl1/engine/graphics/BoneState.cpp
+++ b/engines/hpl1/engine/graphics/BoneState.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/FontData.cpp b/engines/hpl1/engine/graphics/FontData.cpp
index 2b923971503..66ef952ab4c 100644
--- a/engines/hpl1/engine/graphics/FontData.cpp
+++ b/engines/hpl1/engine/graphics/FontData.cpp
@@ -29,7 +29,7 @@
#include <stdarg.h>
#include <stdlib.h>
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/graphics/GfxObject.h"
#include "hpl1/engine/graphics/GraphicsDrawer.h"
diff --git a/engines/hpl1/engine/graphics/Graphics.cpp b/engines/hpl1/engine/graphics/Graphics.cpp
index b861b7eaa1b..d34a4d25612 100644
--- a/engines/hpl1/engine/graphics/Graphics.cpp
+++ b/engines/hpl1/engine/graphics/Graphics.cpp
@@ -38,7 +38,7 @@
#include "hpl1/engine/graphics/RendererPostEffects.h"
#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
// 2D Materials
#include "hpl1/engine/graphics/Material_BumpSpec2D.h"
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.cpp b/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
index 5aaa0873d1f..370aea82bd8 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
@@ -34,7 +34,7 @@
#include "hpl1/engine/resources/FrameBitmap.h"
#include "hpl1/engine/resources/ResourceImage.h"
#include "hpl1/engine/resources/TextureManager.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.cpp b/engines/hpl1/engine/graphics/ImageEntityData.cpp
index 788aece4557..38f6156e78e 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.cpp
+++ b/engines/hpl1/engine/graphics/ImageEntityData.cpp
@@ -35,7 +35,7 @@
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/scene/ImageEntity.h"
#include "hpl1/engine/scene/TileSet.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Material.cpp b/engines/hpl1/engine/graphics/Material.cpp
index d9d41a2a769..8d032374251 100644
--- a/engines/hpl1/engine/graphics/Material.cpp
+++ b/engines/hpl1/engine/graphics/Material.cpp
@@ -33,7 +33,7 @@
#include "hpl1/engine/resources/ImageManager.h"
#include "hpl1/engine/resources/TextureManager.h"
#include "hpl1/engine/scene/Camera.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
index d3d049dc23e..d12144940ea 100644
--- a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
+++ b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
@@ -35,7 +35,7 @@
#include "hpl1/engine/scene/Camera.h"
#include "hpl1/engine/scene/Camera3D.h"
#include "hpl1/engine/scene/Light.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
index b09dde36b18..35ead2d6978 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
@@ -34,7 +34,7 @@
#include "hpl1/engine/scene/Camera.h"
#include "hpl1/engine/scene/Light.h"
#include "hpl1/engine/scene/Light3DSpot.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
//#include <GL/GLee.h>
diff --git a/engines/hpl1/engine/graphics/Material_Flat.cpp b/engines/hpl1/engine/graphics/Material_Flat.cpp
index 14c2fd52a05..c950609fb72 100644
--- a/engines/hpl1/engine/graphics/Material_Flat.cpp
+++ b/engines/hpl1/engine/graphics/Material_Flat.cpp
@@ -33,7 +33,7 @@
#include "hpl1/engine/resources/TextureManager.h"
#include "hpl1/engine/scene/Camera.h"
#include "hpl1/engine/scene/Light.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/MeshCreator.cpp b/engines/hpl1/engine/graphics/MeshCreator.cpp
index aa0601c8484..c54b6d98f20 100644
--- a/engines/hpl1/engine/graphics/MeshCreator.cpp
+++ b/engines/hpl1/engine/graphics/MeshCreator.cpp
@@ -34,7 +34,7 @@
#include "hpl1/engine/resources/AnimationManager.h"
#include "hpl1/engine/resources/MaterialManager.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter.cpp b/engines/hpl1/engine/graphics/ParticleEmitter.cpp
index 0f5176d07a6..c2310d52355 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/resources/ImageManager.h"
#include "hpl1/engine/resources/MaterialManager.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp b/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
index 4d65e675417..096fe6cdc42 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/scene/Camera3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/game/Game.h"
#include "hpl1/engine/scene/Scene.h"
diff --git a/engines/hpl1/engine/graphics/Renderable.cpp b/engines/hpl1/engine/graphics/Renderable.cpp
index 52889d7180a..83fd257b5e1 100644
--- a/engines/hpl1/engine/graphics/Renderable.cpp
+++ b/engines/hpl1/engine/graphics/Renderable.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/graphics/RenderList.h"
#include "hpl1/engine/math/Frustum.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Renderer2D.cpp b/engines/hpl1/engine/graphics/Renderer2D.cpp
index 37adda6ac2f..48caa667db8 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer2D.cpp
@@ -42,7 +42,7 @@
#include "hpl1/engine/scene/TileData.h"
#include "hpl1/engine/scene/TileMap.h"
#include "hpl1/engine/scene/World2D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index 80e0505fb23..e9a1ca52a67 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -46,7 +46,7 @@
#include "hpl1/engine/scene/Light3D.h"
#include "hpl1/engine/scene/RenderableContainer.h"
#include "hpl1/engine/scene/World3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.cpp b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
index 37381115f5e..fec0335c033 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.cpp
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
@@ -36,7 +36,7 @@
#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/scene/Scene.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Skeleton.cpp b/engines/hpl1/engine/graphics/Skeleton.cpp
index 9a6f43d78b6..982cf4ea8d6 100644
--- a/engines/hpl1/engine/graphics/Skeleton.cpp
+++ b/engines/hpl1/engine/graphics/Skeleton.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/graphics/Skeleton.h"
#include "hpl1/engine/graphics/Bone.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/MemoryManager.h"
namespace hpl {
diff --git a/engines/hpl1/engine/gui/GuiGfxElement.cpp b/engines/hpl1/engine/gui/GuiGfxElement.cpp
index 5d1e85b1628..2e197d324f1 100644
--- a/engines/hpl1/engine/gui/GuiGfxElement.cpp
+++ b/engines/hpl1/engine/gui/GuiGfxElement.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/GuiGfxElement.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/GuiPopUp.cpp b/engines/hpl1/engine/gui/GuiPopUp.cpp
index ff81388f01f..9af8986484b 100644
--- a/engines/hpl1/engine/gui/GuiPopUp.cpp
+++ b/engines/hpl1/engine/gui/GuiPopUp.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/GuiPopUp.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp b/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
index 50cbbd4f814..7e00c63a6b5 100644
--- a/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
+++ b/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/GuiPopUpMessageBox.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/GuiSet.cpp b/engines/hpl1/engine/gui/GuiSet.cpp
index 107ca11cd6a..fbcbc78805c 100644
--- a/engines/hpl1/engine/gui/GuiSet.cpp
+++ b/engines/hpl1/engine/gui/GuiSet.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/gui/GuiSet.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/graphics/FontData.h"
#include "hpl1/engine/graphics/Graphics.h"
diff --git a/engines/hpl1/engine/gui/GuiSkin.cpp b/engines/hpl1/engine/gui/GuiSkin.cpp
index f1845f11df1..d8220dcf481 100644
--- a/engines/hpl1/engine/gui/GuiSkin.cpp
+++ b/engines/hpl1/engine/gui/GuiSkin.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/GuiSkin.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
diff --git a/engines/hpl1/engine/gui/Widget.cpp b/engines/hpl1/engine/gui/Widget.cpp
index 3b29e15f2b6..8bc399d2e1f 100644
--- a/engines/hpl1/engine/gui/Widget.cpp
+++ b/engines/hpl1/engine/gui/Widget.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/Widget.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/gui/GuiGfxElement.h"
#include "hpl1/engine/gui/GuiSet.h"
diff --git a/engines/hpl1/engine/gui/Widget.h b/engines/hpl1/engine/gui/Widget.h
index 3edccbf4eeb..a9486201af7 100644
--- a/engines/hpl1/engine/gui/Widget.h
+++ b/engines/hpl1/engine/gui/Widget.h
@@ -29,7 +29,7 @@
#define HPL_WIDGET_H
#include "hpl1/engine/gui/GuiTypes.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include <list>
#include <vector>
diff --git a/engines/hpl1/engine/gui/WidgetBaseClasses.cpp b/engines/hpl1/engine/gui/WidgetBaseClasses.cpp
index add76219504..74476801d6d 100644
--- a/engines/hpl1/engine/gui/WidgetBaseClasses.cpp
+++ b/engines/hpl1/engine/gui/WidgetBaseClasses.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/WidgetBaseClasses.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/WidgetButton.cpp b/engines/hpl1/engine/gui/WidgetButton.cpp
index bf8ff994929..f1a87858332 100644
--- a/engines/hpl1/engine/gui/WidgetButton.cpp
+++ b/engines/hpl1/engine/gui/WidgetButton.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/WidgetButton.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/WidgetCheckBox.cpp b/engines/hpl1/engine/gui/WidgetCheckBox.cpp
index eb4c9ba7ca0..b4f410e6577 100644
--- a/engines/hpl1/engine/gui/WidgetCheckBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetCheckBox.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/WidgetCheckBox.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/WidgetComboBox.cpp b/engines/hpl1/engine/gui/WidgetComboBox.cpp
index 8f4b404391e..0d1bb115958 100644
--- a/engines/hpl1/engine/gui/WidgetComboBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetComboBox.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/WidgetComboBox.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/WidgetFrame.cpp b/engines/hpl1/engine/gui/WidgetFrame.cpp
index 5720667ab89..10dfb4b9ffc 100644
--- a/engines/hpl1/engine/gui/WidgetFrame.cpp
+++ b/engines/hpl1/engine/gui/WidgetFrame.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/WidgetFrame.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/WidgetImage.cpp b/engines/hpl1/engine/gui/WidgetImage.cpp
index 972fd77736a..75957071b27 100644
--- a/engines/hpl1/engine/gui/WidgetImage.cpp
+++ b/engines/hpl1/engine/gui/WidgetImage.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/WidgetImage.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/WidgetLabel.cpp b/engines/hpl1/engine/gui/WidgetLabel.cpp
index 581059eea97..f140e1716fa 100644
--- a/engines/hpl1/engine/gui/WidgetLabel.cpp
+++ b/engines/hpl1/engine/gui/WidgetLabel.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/WidgetLabel.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/graphics/FontData.h"
diff --git a/engines/hpl1/engine/gui/WidgetListBox.cpp b/engines/hpl1/engine/gui/WidgetListBox.cpp
index 8d2a1ef6075..cee02f60376 100644
--- a/engines/hpl1/engine/gui/WidgetListBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetListBox.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/WidgetListBox.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/WidgetSlider.cpp b/engines/hpl1/engine/gui/WidgetSlider.cpp
index 588eb681a40..2265bdaad40 100644
--- a/engines/hpl1/engine/gui/WidgetSlider.cpp
+++ b/engines/hpl1/engine/gui/WidgetSlider.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/WidgetSlider.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/WidgetTextBox.cpp b/engines/hpl1/engine/gui/WidgetTextBox.cpp
index a1863c5722f..ca81cf61bdb 100644
--- a/engines/hpl1/engine/gui/WidgetTextBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetTextBox.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/WidgetTextBox.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/gui/WidgetWindow.cpp b/engines/hpl1/engine/gui/WidgetWindow.cpp
index b314243a696..0f22cc1ab50 100644
--- a/engines/hpl1/engine/gui/WidgetWindow.cpp
+++ b/engines/hpl1/engine/gui/WidgetWindow.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/gui/WidgetWindow.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/haptic/Haptic.cpp b/engines/hpl1/engine/haptic/Haptic.cpp
index 95bfe416e32..826a1e8d593 100644
--- a/engines/hpl1/engine/haptic/Haptic.cpp
+++ b/engines/hpl1/engine/haptic/Haptic.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/haptic/Haptic.h"
#include "hpl1/engine/haptic/LowLevelHaptic.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/haptic/LowLevelHaptic.cpp b/engines/hpl1/engine/haptic/LowLevelHaptic.cpp
index e750364a448..f6ee4a887e2 100644
--- a/engines/hpl1/engine/haptic/LowLevelHaptic.cpp
+++ b/engines/hpl1/engine/haptic/LowLevelHaptic.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/haptic/HapticShape.h"
#include "hpl1/engine/haptic/HapticSurface.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/math/Math.h"
diff --git a/engines/hpl1/engine/impl/CGProgram.cpp b/engines/hpl1/engine/impl/CGProgram.cpp
index 917c6c41c35..742a157841f 100644
--- a/engines/hpl1/engine/impl/CGProgram.cpp
+++ b/engines/hpl1/engine/impl/CGProgram.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/impl/CGProgram.h"
#include "hpl1/engine/impl/SDLTexture.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
diff --git a/engines/hpl1/engine/impl/CharacterBodyNewton.cpp b/engines/hpl1/engine/impl/CharacterBodyNewton.cpp
index c32ec28d43c..41a4a294085 100644
--- a/engines/hpl1/engine/impl/CharacterBodyNewton.cpp
+++ b/engines/hpl1/engine/impl/CharacterBodyNewton.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/physics/CollideShape.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.cpp b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
index 8e53b58751c..8bd4e7c8752 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.cpp
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/impl/CollideShapeNewton.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 4eafe079394..127a802bfa5 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -47,7 +47,7 @@
#include "hpl1/engine/impl/SDLTexture.h"
#include "hpl1/engine/impl/VertexBufferOGL.h"
#include "hpl1/engine/impl/VertexBufferVBO.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/impl/OcclusionQueryOGL.h"
diff --git a/engines/hpl1/engine/impl/LowLevelInputSDL.cpp b/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
index 6f16a303166..0e43dd5e288 100644
--- a/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/impl/KeyboardSDL.h"
#include "hpl1/engine/impl/MouseSDL.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
index f1943f02370..e966972b9cc 100644
--- a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
+++ b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/impl/LowLevelPhysicsNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
index eba39ac58fe..9a1f4ffd587 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
@@ -32,7 +32,7 @@
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
//#include "OALWrapper/OAL_Funcs.h"
//#include "OALWrapper/OAL_Effect_Reverb.h"
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp b/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
deleted file mode 100644
index 1b2ddcd3637..00000000000
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.cpp
+++ /dev/null
@@ -1,654 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-//#include <vld.h>
-// Use this to check for memory leaks!
-
-#if 0 // def WIN32
-#pragma comment(lib, "angelscript.lib")
-#define UNICODE
-#include <shlobj.h>
-#include <windows.h>
-#endif
-
-#if 0 // ndef WIN32
-// Include FLTK
-#include "FL/fl_ask.H"
-#endif
-
-#define _UNICODE
-
-#include <fstream>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string>
-#include <sys/stat.h>
-//#include <time.h>
-
-#include "hpl1/engine/impl/LowLevelSystemSDL.h"
-#include "hpl1/engine/impl/SqScript.h"
-#include "hpl1/debug.h"
-
-//#include "SDL/SDL.h"
-
-#include "hpl1/engine/impl/scriptstring.h"
-#include "hpl1/engine/impl/stdstring.h"
-#include "hpl1/engine/system/String.h"
-#include "common/system.h"
-
-#include <clocale>
-//#include <ObjectArray.h>
-
-extern int hplMain(const hpl::tString &asCommandLine);
-
-#if 0 // def WIN32
-#include <windows.h>
-int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
-{
- return hplMain(lpCmdLine);
-}
-
-int main(int argc, char *argv[]) {
- if (!std::setlocale(LC_CTYPE, "")) {
- fprintf(stderr, "Can't set the specified locale! Check LANG, LC_CTYPE, LC_ALL.\n");
- return 1;
- }
-
- hpl::tString cmdline = "";
- for (int i = 1; i < argc; i++) {
- if (cmdline.length() > 0) {
- cmdline.append(" ").append(argv[i]);
- } else {
- cmdline.append(argv[i]);
- }
- }
- return hplMain(cmdline);
-}
-#endif
-
-namespace hpl {
-
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cLowLevelSystemSDL::cLowLevelSystemSDL() {
-#if 0
- mpScriptEngine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
-
- mpScriptOutput = hplNew(cScriptOutput, ());
- mpScriptEngine->SetMessageCallback(asMETHOD(cScriptOutput, AddMessage), mpScriptOutput, asCALL_THISCALL);
-
-#ifdef AS_MAX_PORTABILITY
- RegisterScriptString(mpScriptEngine);
-#else
- RegisterStdString(mpScriptEngine);
-#endif
-
- mlHandleCount = 0;
-
- Log("-------- THE HPL ENGINE LOG ------------\n\n");
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-cLowLevelSystemSDL::~cLowLevelSystemSDL() {
- /*Release all runnings contexts */
-
- mpScriptEngine->Release();
- hplDelete(mpScriptOutput);
-
- // perhaps not the best thing to skip :)
- // if(gpLogWriter) hplDelete(gpLogWriter);
- // gpLogWriter = NULL;
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-void FatalError(const char *fmt, ...) {
- va_list vl;
- va_start(vl, fmt);
- error(fmt, vl);
- va_end(vl);
-}
-
-void Error(const char *fmt, ...) {
- va_list vl;
- va_start(vl, fmt);
- debugN(Hpl1::kDebugLevelError, fmt, vl);
- va_end(vl);
-}
-
-void Warning(const char *fmt, ...) {
- va_list vl;
- va_start(vl, fmt);
- debugN(Hpl1::kDebugLevelWarning, fmt, vl);
- va_end(vl);
-}
-
-void Log(const char *fmt, ...) {
- va_list vl;
- va_start(vl, fmt);
- debugN(Hpl1::kDebugLevelLog, fmt, vl);
- va_end(vl);
-}
-
-//-----------------------------------------------------------------------
-
-static bool gbUpdateLogIsActive;
-void SetUpdateLogActive(bool abX) {
- gbUpdateLogIsActive = abX;
-}
-
-void LogUpdate(const char *fmt, ...) {
-#if 0
- if (!gbUpdateLogIsActive)
- return;
-
- char text[2048];
- va_list ap;
- if (fmt == NULL)
- return;
- va_start(ap, fmt);
- vsprintf(text, fmt, ap);
- va_end(ap);
-
- tString sMess = "";
- sMess += text;
- gUpdateLogWriter.Write(sMess);
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-void CopyTextToClipboard(const tWString &asText) {
-#if 0 // def WIN32
- OpenClipboard(NULL);
- EmptyClipboard();
-
- HGLOBAL clipbuffer;
- wchar_t * pBuffer;
- EmptyClipboard();
- clipbuffer = GlobalAlloc(GMEM_DDESHARE, (asText.size()+1) *sizeof(wchar_t));
- pBuffer = (wchar_t*)GlobalLock(clipbuffer);
- wcscpy(pBuffer, asText.c_str());
- //GlobalUnlock(clipbuffer);
-
- SetClipboardData(CF_UNICODETEXT, clipbuffer);
-
- GlobalUnlock(clipbuffer);
-
- CloseClipboard();
-#endif
-}
-
-tWString LoadTextFromClipboard() {
-#if 0 // def WIN32
- tWString sText=_W("");
- OpenClipboard(NULL);
-
- HGLOBAL clipbuffer = GetClipboardData(CF_UNICODETEXT);
-
- wchar_t *pBuffer = (wchar_t*)GlobalLock(clipbuffer);
-
- if(pBuffer != NULL) sText = pBuffer;
-
- GlobalUnlock(clipbuffer);
-
- CloseClipboard();
-
- return sText;
-#else
- return _W("");
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-void CreateMessageBoxW(eMsgBoxType eType, const wchar_t *asCaption, const wchar_t *fmt, va_list ap) {
-#if 0
- wchar_t text[2048];
-
- if (fmt == NULL)
- return;
- vswprintf(text, 2047, fmt, ap);
-
- tWString sMess = _W("");
-
-#ifdef WIN32
- sMess += text;
-
- UINT lType = MB_OK;
-
- switch (eType)
- {
- case eMsgBoxType_Info:
- lType += MB_ICONINFORMATION;
- break;
- case eMsgBoxType_Error:
- lType += MB_ICONERROR;
- break;
- case eMsgBoxType_Warning:
- lType += MB_ICONWARNING;
- break;
- default:
- break;
- }
-
- MessageBox( NULL, sMess.c_str(), asCaption, lType );
-#else
- sMess += asCaption;
- sMess +=_W("\n\n");
- sMess += text;
- fl_alert("%ls\n\n%ls",asCaption,text);
-#endif
-#endif
-}
-
-void CreateMessageBoxW(eMsgBoxType eType, const wchar_t *asCaption, const wchar_t *fmt, ...) {
- va_list ap;
-
- if (fmt == NULL)
- return;
- va_start(ap, fmt);
- CreateMessageBoxW(eType, asCaption, fmt, ap);
- va_end(ap);
-}
-
-void CreateMessageBoxW(const wchar_t *asCaption, const wchar_t *fmt, ...) {
- va_list ap;
- if (fmt == NULL)
- return;
- va_start(ap, fmt);
- CreateMessageBoxW(eMsgBoxType_Default, asCaption, fmt, ap);
- va_end(ap);
-}
-
-//-----------------------------------------------------------------------
-
-static cDate DateFromGMTIme(struct tm *apClock) {
- cDate date;
-
- date.seconds = apClock->tm_sec;
- date.minutes = apClock->tm_min;
- date.hours = apClock->tm_hour;
- date.month_day = apClock->tm_mday;
- date.month = apClock->tm_mon;
- date.year = 1900 + apClock->tm_year;
- date.week_day = apClock->tm_wday;
- date.year_day = apClock->tm_yday;
-
- return date;
-}
-
-//-----------------------------------------------------------------------
-
-void OpenBrowserWindow(const tWString &asURL) {
- // FIXME: use proper string types
- g_system->openUrl(cString::To8Char(asURL).c_str());
-}
-
-//-----------------------------------------------------------------------
-
-tWString GetSystemSpecialPath(eSystemPath aPathType) {
-#if 0
-#if defined(WIN32)
- int type;
- switch(aPathType)
- {
- case eSystemPath_Personal: type = CSIDL_PERSONAL;
- break;
- default: return _W("");
- }
-
- TCHAR sPath[1024];
- if(SUCCEEDED(SHGetFolderPath(NULL,
- type | CSIDL_FLAG_CREATE,
- NULL,0,sPath)))
- {
- return tWString(sPath);
- }
- else
- {
- return _W("");
- }
-#else
- switch (aPathType)
- {
- case eSystemPath_Personal: {
- const char *home = getenv("HOME");
- return cString::To16Char(tString(home));
- }
- default:
- return _W("");
- }
-#endif
-#endif
- return _W("");
-}
-
-//-----------------------------------------------------------------------
-
-bool FileExists(const tWString &asFileName) {
-#if 0
-#ifdef WIN32
- FILE *f = _wfopen(asFileName.c_str(),_W("r"));
-#else
- FILE *f = fopen(cString::To8Char(asFileName).c_str(),"r");
-#endif
- if(f==NULL)
- {
- return false;
- }
-
- fclose(f);
- return true;
-#endif
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-void RemoveFile(const tWString &asFilePath) {
-#if 0
-#ifdef WIN32
- _wremove(asFilePath.c_str());
-#else
- remove(cString::To8Char(asFilePath).c_str());
-#endif
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-bool CloneFile(const tWString &asSrcFileName, const tWString &asDestFileName,
- bool abFailIfExists) {
-#if 0
-#ifdef WIN32
- return CopyFile(asSrcFileName.c_str(),asDestFileName.c_str(),abFailIfExists)==TRUE;
-#else
- if (abFailIfExists && FileExists(asDestFileName)) {
- return true;
- }
- std::ifstream IN (cString::To8Char(asSrcFileName).c_str(), std::ios::binary);
- std::ofstream OUT (cString::To8Char(asDestFileName).c_str(), std::ios::binary);
- OUT << IN.rdbuf();
- OUT.flush();
- return true;
-#endif
-#endif
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-bool CreateFolder(const tWString &asPath) {
-#if 0
-#ifdef WIN32
- return CreateDirectory(asPath.c_str(),NULL)==TRUE;
-#else
- return mkdir(cString::To8Char(asPath).c_str(),0755)==0;
-#endif
-#endif
- return false;
-}
-
-bool FolderExists(const tWString &asPath) {
-#if 0
-#ifdef WIN32
- return GetFileAttributes(asPath.c_str())==FILE_ATTRIBUTE_DIRECTORY;
-#else
- struct stat statbuf;
- return (stat(cString::To8Char(asPath).c_str(), &statbuf) != -1);
-#endif
-#endif
- return false;
-}
-
-bool IsFileLink(const tWString &asPath) {
-#if 0
- // Symbolic Links Not Supported under Windows
-#ifndef WIN32
- struct stat statbuf;
- if (lstat(cString::To8Char(asPath).c_str(), &statbuf) == 0) {
- return statbuf.st_mode == S_IFLNK;
- } else {
- return false;
- }
-#else
- return false;
-#endif
-#endif
- return false;
-}
-
-bool LinkFile(const tWString &asPointsTo, const tWString &asLink) {
-#if 0
- // Symbolic Links Not Supported under Windows
-#ifndef WIN32
- return (symlink(cString::To8Char(asPointsTo).c_str(), cString::To8Char(asLink).c_str()) == 0);
-#else
- return false;
-#endif
-#endif
- return false;
-}
-
-bool RenameFile(const tWString &asFrom, const tWString &asTo) {
-#if 0
-#ifdef WIN32
- return false;
-#else
- return (rename(cString::To8Char(asFrom).c_str(), cString::To8Char(asTo).c_str()) == 0);
-#endif
-#endif
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-cDate FileModifiedDate(const tWString &asFilePath) {
-#if 0
- struct tm* pClock;
-#ifdef WIN32
- struct _stat attrib;
- _wstat(asFilePath.c_str(), &attrib);
-#else
- struct stat attrib;
- stat(cString::To8Char(asFilePath).c_str(), &attrib);
-#endif
-
- pClock = gmtime(&(attrib.st_mtime)); // Get the last modified time and put it into the time structure
-
- cDate date = DateFromGMTIme(pClock);
-
- return date;
-#endif
- return {};
-}
-
-//-----------------------------------------------------------------------
-
-cDate FileCreationDate(const tWString &asFilePath) {
-#if 0
- struct tm* pClock;
-#ifdef WIN32
- struct _stat attrib;
- _wstat(asFilePath.c_str(), &attrib);
-#else
- struct stat attrib;
- stat(cString::To8Char(asFilePath).c_str(), &attrib);
-#endif
-
- pClock = gmtime(&(attrib.st_ctime)); // Get the last modified time and put it into the time structure
-
- cDate date = DateFromGMTIme(pClock);
-
- return date;
-#endif
-
- return {};
-}
-
-//-----------------------------------------------------------------------
-
-void SetWindowCaption(const tString &asName) {
-#if 0
- SDL_WM_SetCaption(asName.c_str(),"");
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-bool HasWindowFocus(const tWString &asWindowCaption) {
-#if 0
-#ifdef WIN32
- HWND pWindowHandle = FindWindow(NULL, asWindowCaption.c_str());
- return (pWindowHandle == GetFocus());
-#endif
-#endif
-
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-unsigned long GetApplicationTime() {
-#if 0
- return SDL_GetTicks();
-#endif
- return 0;
-}
-
-//-----------------------------------------------------------------------
-
-void cScriptOutput::AddMessage(const asSMessageInfo *msg) {
- char sMess[1024];
-
- tString type = "ERR ";
- if (msg->type == asMSGTYPE_WARNING)
- type = "WARN";
- else if (msg->type == asMSGTYPE_INFORMATION)
- type = "INFO";
-
- sprintf(sMess, "%s (%d, %d) : %s : %s\n", msg->section, msg->row, msg->col, type.c_str(), msg->message);
-
- msMessage += sMess;
-}
-void cScriptOutput::Display() {
- if (msMessage.size() > 500) {
- while (msMessage.size() > 500) {
- tString sSub = msMessage.substr(0, 500);
- msMessage = msMessage.substr(500);
- Log(sSub.c_str());
- }
- Log(msMessage.c_str());
- } else {
- Log(msMessage.c_str());
- }
-}
-void cScriptOutput::Clear() {
- msMessage = "";
-}
-
-//-----------------------------------------------------------------------
-
-unsigned long cLowLevelSystemSDL::GetTime() {
-#if 0
- return SDL_GetTicks();
-#endif
- return 0;
-}
-
-//-----------------------------------------------------------------------
-
-cDate cLowLevelSystemSDL::GetDate() {
- return {};
-}
-
-//-----------------------------------------------------------------------
-
-iScript *cLowLevelSystemSDL::CreateScript(const tString &asName) {
- return hplNew(cSqScript, (asName, mpScriptEngine, mpScriptOutput, mlHandleCount++));
-}
-
-//-----------------------------------------------------------------------
-
-bool cLowLevelSystemSDL::AddScriptFunc(const tString &asFuncDecl, void *pFunc, int callConv) {
- if (mpScriptEngine->RegisterGlobalFunction(asFuncDecl.c_str(),
- asFUNCTION(pFunc), callConv) < 0) {
- Error("Couldn't add func '%s'\n", asFuncDecl.c_str());
- return false;
- }
-
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cLowLevelSystemSDL::AddScriptVar(const tString &asVarDecl, void *pVar) {
- if (mpScriptEngine->RegisterGlobalProperty(asVarDecl.c_str(), pVar) < 0) {
- Error("Couldn't add var '%s'\n", asVarDecl.c_str());
- return false;
- }
-
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-void cLowLevelSystemSDL::Sleep(const unsigned int alMillisecs) {
-}
-
-//-----------------------------------------------------------------------
-//////////////////////////////////////////////////////////////////////////
-// PRIVATE METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// STATIC PRIVATE METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-//-----------------------------------------------------------------------
-
-} // namespace hpl
diff --git a/engines/hpl1/engine/impl/LowLevelSystemSDL.h b/engines/hpl1/engine/impl/LowLevelSystemSDL.h
deleted file mode 100644
index 202ff856e4f..00000000000
--- a/engines/hpl1/engine/impl/LowLevelSystemSDL.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_LOWLEVELSYSTEM_SDL_H
-#define HPL_LOWLEVELSYSTEM_SDL_H
-
-#include "hpl1/engine/libraries/angelscript/angelscript.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
-
-namespace hpl {
-
-//------------------------------------------------------
-
-class cScriptOutput // : public asIOutputStream
-{
-public:
- cScriptOutput() : msMessage("") {}
- ~cScriptOutput() {}
-
- void AddMessage(const asSMessageInfo *msg);
- void Display();
- void Clear();
-
-private:
- tString msMessage;
-};
-
-//------------------------------------------------------
-
-class cLowLevelSystemSDL : public iLowLevelSystem {
-public:
- cLowLevelSystemSDL();
- ~cLowLevelSystemSDL();
-
- void SetWindowCaption(const tString &asName);
-
- unsigned long GetTime();
- cDate GetDate();
-
- iScript *CreateScript(const tString &asName);
-
- bool AddScriptFunc(const tString &asFuncDecl, void *pFunc, int callConv);
- bool AddScriptVar(const tString &asVarDecl, void *pVar);
-
- void Sleep(const unsigned int alMillisecs);
-
-private:
- asIScriptEngine *mpScriptEngine;
- cScriptOutput *mpScriptOutput;
- int mlHandleCount;
-};
-
-//------------------------------------------------------
-
-}; // namespace hpl
-#endif // HPL_LOWLEVELSYSTEM_SDL_H
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
index b0a684ca7d1..88f58034154 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/graphics/VertexBuffer.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/system/System.h"
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
index ce29ed2b0c6..aab029c6efe 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/graphics/VertexBuffer.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/graphics/Material.h"
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
index 8258667f554..77e6d89e172 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/graphics/VertexBuffer.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/system/System.h"
diff --git a/engines/hpl1/engine/impl/MeshLoaderMSH.cpp b/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
index ba29278cb74..19fdd9025b4 100644
--- a/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/graphics/VertexBuffer.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/graphics/Material.h"
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.cpp b/engines/hpl1/engine/impl/OpenALSoundData.cpp
index ce5c10e5b66..a375fd56133 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundData.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/impl/OpenALSoundData.h"
#include "hpl1/engine/impl/OpenALSoundChannel.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
index 981ed7fe3ab..e91edce77d9 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
@@ -33,7 +33,7 @@
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/scene/Node3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/impl/PhysicsControllerNewton.cpp b/engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
index 50ee3988aa4..bd940975cdd 100644
--- a/engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsControllerNewton.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/physics/PhysicsBody.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
index 0bd42693f31..b05ccbcf69c 100644
--- a/engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointHingeNewton.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/impl/PhysicsJointHingeNewton.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/impl/PhysicsBodyNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
diff --git a/engines/hpl1/engine/impl/PhysicsJointNewton.h b/engines/hpl1/engine/impl/PhysicsJointNewton.h
index 175d7fe801f..e8d1ccee1b1 100644
--- a/engines/hpl1/engine/impl/PhysicsJointNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointNewton.h
@@ -32,7 +32,7 @@
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
#include "hpl1/engine/libraries/newton/Newton.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
index 30c91bf175f..e966f6041bf 100644
--- a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/impl/PhysicsBodyNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
index 3dac1ed1cb3..f9bcf47a1e4 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
#include "hpl1/engine/physics/SurfaceData.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
//#include <algorithm>
namespace hpl {
diff --git a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
index 0ae76825c74..ec5ab775abd 100644
--- a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
@@ -45,7 +45,7 @@
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/graphics/VertexBuffer.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/impl/SDLFontData.cpp b/engines/hpl1/engine/impl/SDLFontData.cpp
index 67df891eaf1..9f2255372cd 100644
--- a/engines/hpl1/engine/impl/SDLFontData.cpp
+++ b/engines/hpl1/engine/impl/SDLFontData.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/graphics/GraphicsDrawer.h"
#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index d4f18e836d0..9c76a98c02a 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/impl/SqScript.cpp b/engines/hpl1/engine/impl/SqScript.cpp
index 04cca17219d..17d4f2a3168 100644
--- a/engines/hpl1/engine/impl/SqScript.cpp
+++ b/engines/hpl1/engine/impl/SqScript.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/impl/SqScript.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "common/file.h"
#include "hpl1/debug.h"
@@ -185,4 +185,35 @@ char *cSqScript::LoadCharBuffer(const tString &asFileName, int &alLength) {
//-----------------------------------------------------------------------
+void cScriptOutput::AddMessage(const asSMessageInfo *msg) {
+ char sMess[1024];
+
+ tString type = "ERR ";
+ if (msg->type == asMSGTYPE_WARNING)
+ type = "WARN";
+ else if (msg->type == asMSGTYPE_INFORMATION)
+ type = "INFO";
+
+ sprintf(sMess, "%s (%d, %d) : %s : %s\n", msg->section, msg->row, msg->col, type.c_str(), msg->message);
+
+ msMessage += sMess;
+}
+
+void cScriptOutput::Display() {
+ if (msMessage.size() > 500) {
+ while (msMessage.size() > 500) {
+ tString sSub = msMessage.substr(0, 500);
+ msMessage = msMessage.substr(500);
+ Log(sSub.c_str());
+ }
+ Log(msMessage.c_str());
+ } else {
+ Log(msMessage.c_str());
+ }
+}
+
+void cScriptOutput::Clear() {
+ msMessage = "";
+}
+
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/SqScript.h b/engines/hpl1/engine/impl/SqScript.h
index 3d80a8b01ff..d1fe703e517 100644
--- a/engines/hpl1/engine/impl/SqScript.h
+++ b/engines/hpl1/engine/impl/SqScript.h
@@ -28,12 +28,25 @@
#ifndef HPL_SQ_SCRIPT_H
#define HPL_SQ_SCRIPT_H
-#include "hpl1/engine/impl/LowLevelSystemSDL.h"
#include "hpl1/engine/libraries/angelscript/angelscript.h"
#include "hpl1/engine/system/Script.h"
namespace hpl {
+class cScriptOutput // : public asIOutputStream
+{
+public:
+ cScriptOutput() : msMessage("") {}
+ ~cScriptOutput() {}
+
+ void AddMessage(const asSMessageInfo *msg);
+ void Display();
+ void Clear();
+
+private:
+ tString msMessage;
+};
+
class cSqScript : public iScript {
public:
cSqScript(const tString &asName, asIScriptEngine *apScriptEngine,
diff --git a/engines/hpl1/engine/impl/VertexBufferOGL.cpp b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
index 84fad7c6d13..24d8aa45f21 100644
--- a/engines/hpl1/engine/impl/VertexBufferOGL.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/impl/VertexBufferOGL.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
//#include <GL/GLee.h>
diff --git a/engines/hpl1/engine/impl/VertexBufferVBO.cpp b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
index 6b754f369b8..51dcc4904fe 100644
--- a/engines/hpl1/engine/impl/VertexBufferVBO.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/impl/VertexBufferVBO.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include <memory.h>
diff --git a/engines/hpl1/engine/input/Action.cpp b/engines/hpl1/engine/input/Action.cpp
index 7a2eef8c926..4787f13a8bc 100644
--- a/engines/hpl1/engine/input/Action.cpp
+++ b/engines/hpl1/engine/input/Action.cpp
@@ -26,7 +26,7 @@
*/
#include "hpl1/engine/input/Action.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/input/ActionKeyboard.cpp b/engines/hpl1/engine/input/ActionKeyboard.cpp
index 30d92661ac5..b2fb891ceb5 100644
--- a/engines/hpl1/engine/input/ActionKeyboard.cpp
+++ b/engines/hpl1/engine/input/ActionKeyboard.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/input/Input.h"
#include "hpl1/engine/input/Keyboard.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
//////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
diff --git a/engines/hpl1/engine/input/Input.cpp b/engines/hpl1/engine/input/Input.cpp
index 74553831cb6..d5b5a8065b1 100644
--- a/engines/hpl1/engine/input/Input.cpp
+++ b/engines/hpl1/engine/input/Input.cpp
@@ -32,7 +32,7 @@
#include "hpl1/engine/input/Keyboard.h"
#include "hpl1/engine/input/LowLevelInput.h"
#include "hpl1/engine/input/Mouse.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/hpl1/engine/math/Frustum.cpp b/engines/hpl1/engine/math/Frustum.cpp
index 46aa0af0a0b..8388eb592cc 100644
--- a/engines/hpl1/engine/math/Frustum.cpp
+++ b/engines/hpl1/engine/math/Frustum.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index 7db42189727..a3d2b671ecb 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -28,7 +28,7 @@
#include <stdlib.h>
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include <map>
#include <math.h>
#include <stdlib.h>
diff --git a/engines/hpl1/engine/math/Quaternion.cpp b/engines/hpl1/engine/math/Quaternion.cpp
index 5ee1eed940e..8fc46d1b4cb 100644
--- a/engines/hpl1/engine/math/Quaternion.cpp
+++ b/engines/hpl1/engine/math/Quaternion.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/math/Quaternion.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/physics/CharacterBody.cpp b/engines/hpl1/engine/physics/CharacterBody.cpp
index 9b80f3e1145..4b488762b50 100644
--- a/engines/hpl1/engine/physics/CharacterBody.cpp
+++ b/engines/hpl1/engine/physics/CharacterBody.cpp
@@ -32,7 +32,7 @@
#include "hpl1/engine/physics/PhysicsBody.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
#include "hpl1/engine/scene/Camera3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/game/Game.h"
#include "hpl1/engine/scene/PortalContainer.h"
diff --git a/engines/hpl1/engine/physics/Collider2D.cpp b/engines/hpl1/engine/physics/Collider2D.cpp
index dd9bb21898b..7e5db85abfe 100644
--- a/engines/hpl1/engine/physics/Collider2D.cpp
+++ b/engines/hpl1/engine/physics/Collider2D.cpp
@@ -34,7 +34,7 @@
#include "hpl1/engine/scene/GridMap2D.h"
#include "hpl1/engine/scene/TileMap.h"
#include "hpl1/engine/scene/World2D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/physics/Physics.cpp b/engines/hpl1/engine/physics/Physics.cpp
index 5bd09dfd801..4cb82d24ad6 100644
--- a/engines/hpl1/engine/physics/Physics.cpp
+++ b/engines/hpl1/engine/physics/Physics.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/physics/PhysicsWorld.h"
#include "hpl1/engine/physics/SurfaceData.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/haptic/Haptic.h"
diff --git a/engines/hpl1/engine/physics/PhysicsBody.cpp b/engines/hpl1/engine/physics/PhysicsBody.cpp
index 79dfb0b4d94..594b4dfd62a 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.cpp
+++ b/engines/hpl1/engine/physics/PhysicsBody.cpp
@@ -32,7 +32,7 @@
#include "hpl1/engine/physics/PhysicsMaterial.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
#include "hpl1/engine/physics/SurfaceData.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/game/Game.h"
#include "hpl1/engine/scene/Scene.h"
diff --git a/engines/hpl1/engine/physics/PhysicsController.cpp b/engines/hpl1/engine/physics/PhysicsController.cpp
index 678d7ded877..eb7d1c89a46 100644
--- a/engines/hpl1/engine/physics/PhysicsController.cpp
+++ b/engines/hpl1/engine/physics/PhysicsController.cpp
@@ -33,7 +33,7 @@
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/physics/PhysicsJoint.cpp b/engines/hpl1/engine/physics/PhysicsJoint.cpp
index 932dc4a2d90..9dc9b174e55 100644
--- a/engines/hpl1/engine/physics/PhysicsJoint.cpp
+++ b/engines/hpl1/engine/physics/PhysicsJoint.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/physics/PhysicsBody.h"
#include "hpl1/engine/physics/PhysicsController.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/scene/SoundEntity.h"
#include "hpl1/engine/sound/Sound.h"
diff --git a/engines/hpl1/engine/physics/PhysicsJointBall.cpp b/engines/hpl1/engine/physics/PhysicsJointBall.cpp
index 37c6538cc29..338b9aa32b8 100644
--- a/engines/hpl1/engine/physics/PhysicsJointBall.cpp
+++ b/engines/hpl1/engine/physics/PhysicsJointBall.cpp
@@ -34,7 +34,7 @@
#include "hpl1/engine/physics/PhysicsBody.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.cpp b/engines/hpl1/engine/physics/PhysicsWorld.cpp
index 5f8356cfe8f..e5b4fc2ed7e 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.cpp
+++ b/engines/hpl1/engine/physics/PhysicsWorld.cpp
@@ -38,7 +38,7 @@
#include "hpl1/engine/physics/SurfaceData.h"
#include "hpl1/engine/scene/PortalContainer.h"
#include "hpl1/engine/scene/World3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/System.h"
namespace hpl {
diff --git a/engines/hpl1/engine/physics/SurfaceData.cpp b/engines/hpl1/engine/physics/SurfaceData.cpp
index 069b79e5803..c15d2b22da2 100644
--- a/engines/hpl1/engine/physics/SurfaceData.cpp
+++ b/engines/hpl1/engine/physics/SurfaceData.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/physics/Physics.h"
#include "hpl1/engine/physics/PhysicsBody.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/scene/SoundEntity.h"
#include "hpl1/engine/scene/World3D.h"
diff --git a/engines/hpl1/engine/resources/AnimationManager.cpp b/engines/hpl1/engine/resources/AnimationManager.cpp
index ceb6b07c200..2acb0e5a915 100644
--- a/engines/hpl1/engine/resources/AnimationManager.cpp
+++ b/engines/hpl1/engine/resources/AnimationManager.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/resources/FileSearcher.h"
#include "hpl1/engine/resources/MeshLoaderHandler.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/system/System.h"
diff --git a/engines/hpl1/engine/resources/ConfigFile.cpp b/engines/hpl1/engine/resources/ConfigFile.cpp
index 80b6f9087ae..cf9b58babe1 100644
--- a/engines/hpl1/engine/resources/ConfigFile.cpp
+++ b/engines/hpl1/engine/resources/ConfigFile.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/resources/ConfigFile.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/resources/FileSearcher.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "common/file.h"
#include "hpl1/debug.h"
diff --git a/engines/hpl1/engine/resources/EntityLoader_Object.cpp b/engines/hpl1/engine/resources/EntityLoader_Object.cpp
index a5ecec437e4..d75f2c256d7 100644
--- a/engines/hpl1/engine/resources/EntityLoader_Object.cpp
+++ b/engines/hpl1/engine/resources/EntityLoader_Object.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/scene/World3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/physics/CollideShape.h"
diff --git a/engines/hpl1/engine/resources/FileSearcher.cpp b/engines/hpl1/engine/resources/FileSearcher.cpp
index 8d0c44823a4..4176ef5818e 100644
--- a/engines/hpl1/engine/resources/FileSearcher.cpp
+++ b/engines/hpl1/engine/resources/FileSearcher.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/resources/FileSearcher.h"
#include "hpl1/engine/resources/low_level_resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/hpl1.h"
diff --git a/engines/hpl1/engine/resources/FontManager.cpp b/engines/hpl1/engine/resources/FontManager.cpp
index c80f6089f39..f5851965176 100644
--- a/engines/hpl1/engine/resources/FontManager.cpp
+++ b/engines/hpl1/engine/resources/FontManager.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/resources/FontManager.h"
#include "hpl1/engine/system/String.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/graphics/Graphics.h"
#include "hpl1/engine/graphics/LowLevelGraphics.h"
diff --git a/engines/hpl1/engine/resources/FrameBitmap.cpp b/engines/hpl1/engine/resources/FrameBitmap.cpp
index b64fb992d43..4197f15ebf0 100644
--- a/engines/hpl1/engine/resources/FrameBitmap.cpp
+++ b/engines/hpl1/engine/resources/FrameBitmap.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/resources/FrameBitmap.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/resources/FrameTexture.h"
#include "hpl1/engine/resources/ResourceImage.h"
#include "hpl1/engine/graphics/bitmap2D.h"
diff --git a/engines/hpl1/engine/resources/GpuProgramManager.cpp b/engines/hpl1/engine/resources/GpuProgramManager.cpp
index feffb37807e..9cc6b7a1f43 100644
--- a/engines/hpl1/engine/resources/GpuProgramManager.cpp
+++ b/engines/hpl1/engine/resources/GpuProgramManager.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/resources/GpuProgramManager.h"
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/LowLevelGraphics.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
@@ -40,7 +40,7 @@ namespace hpl {
//-----------------------------------------------------------------------
cGpuProgramManager::cGpuProgramManager(cFileSearcher *apFileSearcher, iLowLevelGraphics *apLowLevelGraphics,
- LowLevelResources *apLowLevelResources, iLowLevelSystem *apLowLevelSystem)
+ LowLevelResources *apLowLevelResources, LowLevelSystem *apLowLevelSystem)
: iResourceManager(apFileSearcher, apLowLevelResources, apLowLevelSystem) {
mpLowLevelGraphics = apLowLevelGraphics;
}
diff --git a/engines/hpl1/engine/resources/GpuProgramManager.h b/engines/hpl1/engine/resources/GpuProgramManager.h
index bb47921a3f2..6407fc1adf5 100644
--- a/engines/hpl1/engine/resources/GpuProgramManager.h
+++ b/engines/hpl1/engine/resources/GpuProgramManager.h
@@ -39,7 +39,7 @@ class iLowLevelGraphics;
class cGpuProgramManager : public iResourceManager {
public:
cGpuProgramManager(cFileSearcher *apFileSearcher, iLowLevelGraphics *apLowLevelGraphics,
- LowLevelResources *apLowLevelResources, iLowLevelSystem *apLowLevelSystem);
+ LowLevelResources *apLowLevelResources, LowLevelSystem *apLowLevelSystem);
~cGpuProgramManager();
iResourceBase *Create(const tString &asName);
diff --git a/engines/hpl1/engine/resources/ImageEntityManager.cpp b/engines/hpl1/engine/resources/ImageEntityManager.cpp
index ae61825cea0..a80e5b0a99e 100644
--- a/engines/hpl1/engine/resources/ImageEntityManager.cpp
+++ b/engines/hpl1/engine/resources/ImageEntityManager.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/graphics/ImageEntityData.h"
#include "hpl1/engine/graphics/Material.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
diff --git a/engines/hpl1/engine/resources/ImageManager.cpp b/engines/hpl1/engine/resources/ImageManager.cpp
index 905efc92b23..72abce6f16a 100644
--- a/engines/hpl1/engine/resources/ImageManager.cpp
+++ b/engines/hpl1/engine/resources/ImageManager.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/resources/FrameTexture.h"
#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/ResourceImage.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
@@ -43,7 +43,7 @@ namespace hpl {
//-----------------------------------------------------------------------
cImageManager::cImageManager(cFileSearcher *apFileSearcher, iLowLevelGraphics *apLowLevelGraphics,
- LowLevelResources *apLowLevelResources, iLowLevelSystem *apLowLevelSystem)
+ LowLevelResources *apLowLevelResources, LowLevelSystem *apLowLevelSystem)
: iResourceManager(apFileSearcher, apLowLevelResources, apLowLevelSystem) {
mpLowLevelGraphics = apLowLevelGraphics;
diff --git a/engines/hpl1/engine/resources/ImageManager.h b/engines/hpl1/engine/resources/ImageManager.h
index b83d5d16a5d..39d78f220ec 100644
--- a/engines/hpl1/engine/resources/ImageManager.h
+++ b/engines/hpl1/engine/resources/ImageManager.h
@@ -48,7 +48,7 @@ typedef tFrameTextureMap::iterator tFrameTextureMapIt;
class cImageManager : public iResourceManager {
public:
cImageManager(cFileSearcher *apFileSearcher, iLowLevelGraphics *apLowLevelGraphics,
- LowLevelResources *apLowLevelResources, iLowLevelSystem *apLowLevelSystem);
+ LowLevelResources *apLowLevelResources, LowLevelSystem *apLowLevelSystem);
~cImageManager();
iResourceBase *Create(const tString &asName);
diff --git a/engines/hpl1/engine/resources/LanguageFile.cpp b/engines/hpl1/engine/resources/LanguageFile.cpp
index d84166752c4..8f124548945 100644
--- a/engines/hpl1/engine/resources/LanguageFile.cpp
+++ b/engines/hpl1/engine/resources/LanguageFile.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/resources/LanguageFile.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/resources/FileSearcher.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/resources/FileSearcher.h"
diff --git a/engines/hpl1/engine/resources/MaterialManager.cpp b/engines/hpl1/engine/resources/MaterialManager.cpp
index 1cff0a5378b..1101ab7fae6 100644
--- a/engines/hpl1/engine/resources/MaterialManager.cpp
+++ b/engines/hpl1/engine/resources/MaterialManager.cpp
@@ -32,7 +32,7 @@
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/resources/TextureManager.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/system/System.h"
diff --git a/engines/hpl1/engine/resources/MeshLoaderHandler.cpp b/engines/hpl1/engine/resources/MeshLoaderHandler.cpp
index db10723a532..34f1c70f821 100644
--- a/engines/hpl1/engine/resources/MeshLoaderHandler.cpp
+++ b/engines/hpl1/engine/resources/MeshLoaderHandler.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/resources/MeshLoader.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/scene/Scene.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
diff --git a/engines/hpl1/engine/resources/MeshManager.cpp b/engines/hpl1/engine/resources/MeshManager.cpp
index 8730a71f899..0e2ce916096 100644
--- a/engines/hpl1/engine/resources/MeshManager.cpp
+++ b/engines/hpl1/engine/resources/MeshManager.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/resources/FileSearcher.h"
#include "hpl1/engine/resources/MeshLoaderHandler.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/system/System.h"
diff --git a/engines/hpl1/engine/resources/ParticleManager.cpp b/engines/hpl1/engine/resources/ParticleManager.cpp
index 49deb89891d..6127e5df509 100644
--- a/engines/hpl1/engine/resources/ParticleManager.cpp
+++ b/engines/hpl1/engine/resources/ParticleManager.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/graphics/ParticleSystem3D.h"
#include "hpl1/engine/resources/FileSearcher.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/resources/ResourceBase.cpp b/engines/hpl1/engine/resources/ResourceBase.cpp
index 008a4b010f6..bb1ea3b4807 100644
--- a/engines/hpl1/engine/resources/ResourceBase.cpp
+++ b/engines/hpl1/engine/resources/ResourceBase.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/resources/ResourceBase.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/resources/ResourceBase.h b/engines/hpl1/engine/resources/ResourceBase.h
index 6d1b38005ef..038144c8431 100644
--- a/engines/hpl1/engine/resources/ResourceBase.h
+++ b/engines/hpl1/engine/resources/ResourceBase.h
@@ -28,7 +28,7 @@
#ifndef HPL_RESOURCEBASE_H
#define HPL_RESOURCEBASE_H
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/SystemTypes.h"
//#include <time.h>
diff --git a/engines/hpl1/engine/resources/ResourceManager.cpp b/engines/hpl1/engine/resources/ResourceManager.cpp
index edd6df9fbde..bd59ac65166 100644
--- a/engines/hpl1/engine/resources/ResourceManager.cpp
+++ b/engines/hpl1/engine/resources/ResourceManager.cpp
@@ -32,7 +32,7 @@
#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/ResourceBase.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
//#include <algorithm>
@@ -48,7 +48,7 @@ int iResourceManager::mlTabCount = 0;
iResourceManager::iResourceManager(cFileSearcher *apFileSearcher,
LowLevelResources *apLowLevelResources,
- iLowLevelSystem *apLowLevelSystem) {
+ LowLevelSystem *apLowLevelSystem) {
mpFileSearcher = apFileSearcher;
mpLowLevelResources = apLowLevelResources;
mpLowLevelSystem = apLowLevelSystem;
diff --git a/engines/hpl1/engine/resources/ResourceManager.h b/engines/hpl1/engine/resources/ResourceManager.h
index de5eb0c8730..8a0d56214e8 100644
--- a/engines/hpl1/engine/resources/ResourceManager.h
+++ b/engines/hpl1/engine/resources/ResourceManager.h
@@ -34,7 +34,7 @@
namespace hpl {
class LowLevelResources;
-class iLowLevelSystem;
+class LowLevelSystem;
class cFileSearcher;
class iResourceBase;
@@ -52,7 +52,7 @@ typedef cSTLMapIterator<iResourceBase *, tResourceNameMap, tResourceNameMapIt> c
class iResourceManager {
public:
iResourceManager(cFileSearcher *apFileSearcher, LowLevelResources *apLowLevelResources,
- iLowLevelSystem *apLowLevelSystem);
+ LowLevelSystem *apLowLevelSystem);
virtual ~iResourceManager() {}
virtual iResourceBase *Create(const tString &asName) = 0;
@@ -78,7 +78,7 @@ protected:
cFileSearcher *mpFileSearcher;
LowLevelResources *mpLowLevelResources;
- iLowLevelSystem *mpLowLevelSystem;
+ LowLevelSystem *mpLowLevelSystem;
void BeginLoad(const tString &asFile);
void EndLoad();
diff --git a/engines/hpl1/engine/resources/Resources.cpp b/engines/hpl1/engine/resources/Resources.cpp
index 45e4d9a8771..51c2e650c25 100644
--- a/engines/hpl1/engine/resources/Resources.cpp
+++ b/engines/hpl1/engine/resources/Resources.cpp
@@ -49,7 +49,7 @@
#include "hpl1/engine/scene/Area2D.h"
#include "hpl1/engine/system/System.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
diff --git a/engines/hpl1/engine/resources/Resources.h b/engines/hpl1/engine/resources/Resources.h
index 77698126a4d..33e3d59283b 100644
--- a/engines/hpl1/engine/resources/Resources.h
+++ b/engines/hpl1/engine/resources/Resources.h
@@ -43,7 +43,7 @@ class cImageEntity;
class LowLevelResources;
class iLowLevelGraphics;
-class iLowLevelSystem;
+class LowLevelSystem;
class cSystem;
class iResourceManager;
class cFileSearcher;
@@ -205,12 +205,12 @@ public:
cAnimationManager *GetAnimationManager() { return mpAnimationManager; }
cVideoManager *GetVideoManager() { return mpVideoManager; }
- iLowLevelSystem *GetLowLevelSystem() { return mpLowLevelSystem; }
+ LowLevelSystem *GetLowLevelSystem() { return mpLowLevelSystem; }
private:
LowLevelResources *mpLowLevelResources;
iLowLevelGraphics *mpLowLevelGraphics;
- iLowLevelSystem *mpLowLevelSystem;
+ LowLevelSystem *mpLowLevelSystem;
cFileSearcher *mpFileSearcher;
tResourceManagerList mlstManagers;
diff --git a/engines/hpl1/engine/resources/ScriptManager.cpp b/engines/hpl1/engine/resources/ScriptManager.cpp
index 58950c1cca0..0c8081e9376 100644
--- a/engines/hpl1/engine/resources/ScriptManager.cpp
+++ b/engines/hpl1/engine/resources/ScriptManager.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/resources/ScriptManager.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/Script.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/system/System.h"
@@ -72,7 +72,7 @@ iScript *cScriptManager::CreateScript(const tString &asName) {
pScript = static_cast<iScript *>(this->FindLoadedResource(asNewName, sPath));
if (pScript == NULL && sPath != "") {
- pScript = mpSystem->GetLowLevel()->CreateScript(asNewName);
+ pScript = mpSystem->GetLowLevel()->createScript(asNewName);
if (pScript->CreateFromFile(sPath) == false) {
hplDelete(pScript);
diff --git a/engines/hpl1/engine/resources/SoundEntityManager.cpp b/engines/hpl1/engine/resources/SoundEntityManager.cpp
index 8bc9e2ab28c..4ed5ee76100 100644
--- a/engines/hpl1/engine/resources/SoundEntityManager.cpp
+++ b/engines/hpl1/engine/resources/SoundEntityManager.cpp
@@ -32,7 +32,7 @@
#include "hpl1/engine/sound/SoundChannel.h"
#include "hpl1/engine/sound/SoundEntityData.h"
#include "hpl1/engine/sound/SoundHandler.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
diff --git a/engines/hpl1/engine/resources/SoundManager.cpp b/engines/hpl1/engine/resources/SoundManager.cpp
index d4d42ae0532..21d43ce7edc 100644
--- a/engines/hpl1/engine/resources/SoundManager.cpp
+++ b/engines/hpl1/engine/resources/SoundManager.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/sound/LowLevelSound.h"
#include "hpl1/engine/sound/Sound.h"
#include "hpl1/engine/sound/SoundData.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
diff --git a/engines/hpl1/engine/resources/TextureManager.cpp b/engines/hpl1/engine/resources/TextureManager.cpp
index 340e3144ef1..bbcb9d15c37 100644
--- a/engines/hpl1/engine/resources/TextureManager.cpp
+++ b/engines/hpl1/engine/resources/TextureManager.cpp
@@ -33,7 +33,7 @@
#include "hpl1/engine/resources/FileSearcher.h"
#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
diff --git a/engines/hpl1/engine/resources/TileSetManager.cpp b/engines/hpl1/engine/resources/TileSetManager.cpp
index 6623b71d692..5cbc359b907 100644
--- a/engines/hpl1/engine/resources/TileSetManager.cpp
+++ b/engines/hpl1/engine/resources/TileSetManager.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/graphics/Graphics.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/scene/TileSet.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
diff --git a/engines/hpl1/engine/resources/VideoManager.cpp b/engines/hpl1/engine/resources/VideoManager.cpp
index ffb653d8bce..b41c55b0ba4 100644
--- a/engines/hpl1/engine/resources/VideoManager.cpp
+++ b/engines/hpl1/engine/resources/VideoManager.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/graphics/VideoStream.h"
#include "hpl1/engine/resources/FileSearcher.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/AnimationState.cpp b/engines/hpl1/engine/scene/AnimationState.cpp
index 15302a6d9ea..467063cc76c 100644
--- a/engines/hpl1/engine/scene/AnimationState.cpp
+++ b/engines/hpl1/engine/scene/AnimationState.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/resources/AnimationManager.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/Entity.cpp b/engines/hpl1/engine/scene/Entity.cpp
index 566e961db1b..7ca1f82a606 100644
--- a/engines/hpl1/engine/scene/Entity.cpp
+++ b/engines/hpl1/engine/scene/Entity.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/scene/Entity.h"
#include "hpl1/engine/scene/Node.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/Entity3D.cpp b/engines/hpl1/engine/scene/Entity3D.cpp
index b3335854376..9cb4bebd30d 100644
--- a/engines/hpl1/engine/scene/Entity3D.cpp
+++ b/engines/hpl1/engine/scene/Entity3D.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/scene/Node3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/scene/PortalContainer.h"
diff --git a/engines/hpl1/engine/scene/ImageEntity.cpp b/engines/hpl1/engine/scene/ImageEntity.cpp
index 3102c25755e..e11f011710e 100644
--- a/engines/hpl1/engine/scene/ImageEntity.cpp
+++ b/engines/hpl1/engine/scene/ImageEntity.cpp
@@ -35,7 +35,7 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/resources/ImageEntityManager.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/Light.cpp b/engines/hpl1/engine/scene/Light.cpp
index daf939f14da..f2181fc0dae 100644
--- a/engines/hpl1/engine/scene/Light.cpp
+++ b/engines/hpl1/engine/scene/Light.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/scene/Light.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/scene/SoundEntity.h"
#include "hpl1/engine/scene/World3D.h"
diff --git a/engines/hpl1/engine/scene/Light3D.cpp b/engines/hpl1/engine/scene/Light3D.cpp
index 4c0777c481c..396979ef672 100644
--- a/engines/hpl1/engine/scene/Light3D.cpp
+++ b/engines/hpl1/engine/scene/Light3D.cpp
@@ -44,7 +44,7 @@
#include "hpl1/engine/scene/PortalContainer.h"
#include "hpl1/engine/scene/SectorVisibility.h"
#include "hpl1/engine/scene/World3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/MultiImageEntity.cpp b/engines/hpl1/engine/scene/MultiImageEntity.cpp
index 1e0a41abd31..d6d7a60fe51 100644
--- a/engines/hpl1/engine/scene/MultiImageEntity.cpp
+++ b/engines/hpl1/engine/scene/MultiImageEntity.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/scene/Node2D.h"
#include "hpl1/engine/scene/Scene.h"
#include "hpl1/engine/scene/World2D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/Node.cpp b/engines/hpl1/engine/scene/Node.cpp
index ce0af260ab5..2b8030f41ee 100644
--- a/engines/hpl1/engine/scene/Node.cpp
+++ b/engines/hpl1/engine/scene/Node.cpp
@@ -26,7 +26,7 @@
*/
#include "hpl1/engine/scene/Node.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/Node2D.cpp b/engines/hpl1/engine/scene/Node2D.cpp
index c3bf9acd10a..41f4b51d992 100644
--- a/engines/hpl1/engine/scene/Node2D.cpp
+++ b/engines/hpl1/engine/scene/Node2D.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/scene/Node2D.h"
#include "hpl1/engine/scene/Entity2D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/Node3D.cpp b/engines/hpl1/engine/scene/Node3D.cpp
index 2dd747b0b4e..0f20a1b69a6 100644
--- a/engines/hpl1/engine/scene/Node3D.cpp
+++ b/engines/hpl1/engine/scene/Node3D.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/scene/Node3D.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/scene/Entity3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/PortalContainer.cpp b/engines/hpl1/engine/scene/PortalContainer.cpp
index 8e88b5c0a76..5d7a752aae9 100644
--- a/engines/hpl1/engine/scene/PortalContainer.cpp
+++ b/engines/hpl1/engine/scene/PortalContainer.cpp
@@ -32,7 +32,7 @@
#include "hpl1/engine/math/Frustum.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/scene/Light3D.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/scene/SectorVisibility.h"
diff --git a/engines/hpl1/engine/scene/Scene.cpp b/engines/hpl1/engine/scene/Scene.cpp
index f1f594d1ff6..f968e43182b 100644
--- a/engines/hpl1/engine/scene/Scene.cpp
+++ b/engines/hpl1/engine/scene/Scene.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/scene/Scene.h"
#include "hpl1/engine/game/Updater.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/graphics/Graphics.h"
#include "hpl1/engine/graphics/GraphicsDrawer.h"
diff --git a/engines/hpl1/engine/scene/SectorVisibility.cpp b/engines/hpl1/engine/scene/SectorVisibility.cpp
index 7e028e5f93e..dbd6cf7117d 100644
--- a/engines/hpl1/engine/scene/SectorVisibility.cpp
+++ b/engines/hpl1/engine/scene/SectorVisibility.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/scene/PortalContainer.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/TileLayer.cpp b/engines/hpl1/engine/scene/TileLayer.cpp
index 5ac4edc0955..c59f03d7e30 100644
--- a/engines/hpl1/engine/scene/TileLayer.cpp
+++ b/engines/hpl1/engine/scene/TileLayer.cpp
@@ -26,7 +26,7 @@
*/
#include "hpl1/engine/scene/TileLayer.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/TileMap.cpp b/engines/hpl1/engine/scene/TileMap.cpp
index a81400f9c4f..4766bd34f50 100644
--- a/engines/hpl1/engine/scene/TileMap.cpp
+++ b/engines/hpl1/engine/scene/TileMap.cpp
@@ -35,7 +35,7 @@
#include "hpl1/engine/resources/TileSetManager.h"
#include "hpl1/engine/scene/TileMapLineIt.h"
#include "hpl1/engine/scene/TileMapRectIt.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/TileMapLineIt.cpp b/engines/hpl1/engine/scene/TileMapLineIt.cpp
index 89124ec3549..b60d583fe97 100644
--- a/engines/hpl1/engine/scene/TileMapLineIt.cpp
+++ b/engines/hpl1/engine/scene/TileMapLineIt.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/scene/TileMapLineIt.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/TileSet.cpp b/engines/hpl1/engine/scene/TileSet.cpp
index f1e8c453cff..8e5ac8fe40f 100644
--- a/engines/hpl1/engine/scene/TileSet.cpp
+++ b/engines/hpl1/engine/scene/TileSet.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/graphics/MeshCreator.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include <assert.h>
namespace hpl {
diff --git a/engines/hpl1/engine/scene/World2D.cpp b/engines/hpl1/engine/scene/World2D.cpp
index c77229c30e6..4fde1c8547d 100644
--- a/engines/hpl1/engine/scene/World2D.cpp
+++ b/engines/hpl1/engine/scene/World2D.cpp
@@ -48,7 +48,7 @@
#include "hpl1/engine/scene/Node2D.h"
#include "hpl1/engine/scene/SoundSource.h"
#include "hpl1/engine/scene/TileMap.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/MemoryManager.h"
#include "hpl1/engine/system/Script.h"
#include "hpl1/engine/system/String.h"
diff --git a/engines/hpl1/engine/scene/World3D.cpp b/engines/hpl1/engine/scene/World3D.cpp
index 0d123a8688d..bec12115857 100644
--- a/engines/hpl1/engine/scene/World3D.cpp
+++ b/engines/hpl1/engine/scene/World3D.cpp
@@ -29,7 +29,7 @@
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/Script.h"
#include "hpl1/engine/system/String.h"
diff --git a/engines/hpl1/engine/sound/LowLevelSound.h b/engines/hpl1/engine/sound/LowLevelSound.h
index d3337dae424..33540b93b6e 100644
--- a/engines/hpl1/engine/sound/LowLevelSound.h
+++ b/engines/hpl1/engine/sound/LowLevelSound.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/sound/MusicHandler.cpp b/engines/hpl1/engine/sound/MusicHandler.cpp
index 693283b6bab..c296163a9b5 100644
--- a/engines/hpl1/engine/sound/MusicHandler.cpp
+++ b/engines/hpl1/engine/sound/MusicHandler.cpp
@@ -32,7 +32,7 @@
#include "hpl1/engine/sound/LowLevelSound.h"
#include "hpl1/engine/sound/SoundChannel.h"
#include "hpl1/engine/sound/SoundData.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
diff --git a/engines/hpl1/engine/sound/Sound.cpp b/engines/hpl1/engine/sound/Sound.cpp
index cd9f032bb57..59416315e4c 100644
--- a/engines/hpl1/engine/sound/Sound.cpp
+++ b/engines/hpl1/engine/sound/Sound.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/sound/LowLevelSound.h"
#include "hpl1/engine/sound/MusicHandler.h"
#include "hpl1/engine/sound/SoundHandler.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/sound/SoundEntityData.cpp b/engines/hpl1/engine/sound/SoundEntityData.cpp
index 6304930f0f7..1c66eab45e3 100644
--- a/engines/hpl1/engine/sound/SoundEntityData.cpp
+++ b/engines/hpl1/engine/sound/SoundEntityData.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/sound/SoundEntityData.h"
#include "hpl1/engine/resources/Resources.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
diff --git a/engines/hpl1/engine/sound/SoundHandler.cpp b/engines/hpl1/engine/sound/SoundHandler.cpp
index bace99dbfad..e32af5be330 100644
--- a/engines/hpl1/engine/sound/SoundHandler.cpp
+++ b/engines/hpl1/engine/sound/SoundHandler.cpp
@@ -32,7 +32,7 @@
#include "hpl1/engine/sound/LowLevelSound.h"
#include "hpl1/engine/sound/SoundChannel.h"
#include "hpl1/engine/sound/SoundData.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/physics/PhysicsBody.h"
diff --git a/engines/hpl1/engine/system/LogicTimer.cpp b/engines/hpl1/engine/system/LogicTimer.cpp
index 0bb7b18a621..49ace879c9f 100644
--- a/engines/hpl1/engine/system/LogicTimer.cpp
+++ b/engines/hpl1/engine/system/LogicTimer.cpp
@@ -26,7 +26,7 @@
*/
#include "hpl1/engine/system/LogicTimer.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
@@ -36,7 +36,7 @@ namespace hpl {
//-----------------------------------------------------------------------
-cLogicTimer::cLogicTimer(int alUpdatesPerSec, iLowLevelSystem *apLowLevelSystem) {
+cLogicTimer::cLogicTimer(int alUpdatesPerSec, LowLevelSystem *apLowLevelSystem) {
mlMaxUpdates = alUpdatesPerSec;
mlUpdateCount = 0;
diff --git a/engines/hpl1/engine/system/LogicTimer.h b/engines/hpl1/engine/system/LogicTimer.h
index bb41ea7c66f..751eb27ec29 100644
--- a/engines/hpl1/engine/system/LogicTimer.h
+++ b/engines/hpl1/engine/system/LogicTimer.h
@@ -30,7 +30,7 @@
namespace hpl {
-class iLowLevelSystem;
+class LowLevelSystem;
class cLogicTimer {
public:
@@ -40,7 +40,7 @@ public:
* \param *apLowLevelSystem
* \return
*/
- cLogicTimer(int alUpdatesPerSec, iLowLevelSystem *apLowLevelSystem);
+ cLogicTimer(int alUpdatesPerSec, LowLevelSystem *apLowLevelSystem);
~cLogicTimer();
/**
@@ -88,7 +88,7 @@ private:
int mlMaxUpdates;
int mlUpdateCount;
- iLowLevelSystem *mpLowLevelSystem;
+ LowLevelSystem *mpLowLevelSystem;
};
}; // namespace hpl
diff --git a/engines/hpl1/engine/system/MemoryManager.cpp b/engines/hpl1/engine/system/MemoryManager.cpp
index 7c6f4f6c070..b5abe5bac77 100644
--- a/engines/hpl1/engine/system/MemoryManager.cpp
+++ b/engines/hpl1/engine/system/MemoryManager.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/system/MemoryManager.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index 7ccc1689017..c480ecd9af6 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/system/SerializeClass.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
diff --git a/engines/hpl1/engine/system/String.cpp b/engines/hpl1/engine/system/String.cpp
index 6279c846fdd..1528c2843b2 100644
--- a/engines/hpl1/engine/system/String.cpp
+++ b/engines/hpl1/engine/system/String.cpp
@@ -28,7 +28,7 @@
#include "hpl1/engine/system/String.h"
#include <stdlib.h>
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
diff --git a/engines/hpl1/engine/system/System.cpp b/engines/hpl1/engine/system/System.cpp
index 601488658b6..e47b8966d5a 100644
--- a/engines/hpl1/engine/system/System.cpp
+++ b/engines/hpl1/engine/system/System.cpp
@@ -27,7 +27,7 @@
#include "hpl1/engine/system/System.h"
#include "hpl1/engine/system/LogicTimer.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
namespace hpl {
@@ -38,7 +38,7 @@ namespace hpl {
//-----------------------------------------------------------------------
-cSystem::cSystem(iLowLevelSystem *apLowLevelSystem) {
+cSystem::cSystem(LowLevelSystem *apLowLevelSystem) {
mpLowLevelSystem = apLowLevelSystem;
}
@@ -64,7 +64,7 @@ cLogicTimer *cSystem::CreateLogicTimer(unsigned int alUpdatesPerSec) {
//-----------------------------------------------------------------------
-iLowLevelSystem *cSystem::GetLowLevel() {
+LowLevelSystem *cSystem::GetLowLevel() {
return mpLowLevelSystem;
}
diff --git a/engines/hpl1/engine/system/System.h b/engines/hpl1/engine/system/System.h
index 2db8f6c6d1a..513b73088a1 100644
--- a/engines/hpl1/engine/system/System.h
+++ b/engines/hpl1/engine/system/System.h
@@ -30,15 +30,15 @@
namespace hpl {
-class iLowLevelSystem;
+class LowLevelSystem;
class cLogicTimer;
class cSystem {
public:
- cSystem(iLowLevelSystem *apLowLevelSystem);
+ cSystem(LowLevelSystem *apLowLevelSystem);
~cSystem();
- iLowLevelSystem *GetLowLevel();
+ LowLevelSystem *GetLowLevel();
/**
* Creates a logic timer.
@@ -48,7 +48,7 @@ public:
cLogicTimer *CreateLogicTimer(unsigned int alUpdatesPerSec);
private:
- iLowLevelSystem *mpLowLevelSystem;
+ LowLevelSystem *mpLowLevelSystem;
};
}; // namespace hpl
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
new file mode 100644
index 00000000000..adc08d120f6
--- /dev/null
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -0,0 +1,410 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <stdarg.h>
+
+#include "hpl1/engine/libraries/angelscript/angelscript.h"
+#include "hpl1/engine/impl/SqScript.h"
+#include "hpl1/engine/impl/scriptstring.h"
+#include "hpl1/engine/impl/stdstring.h"
+#include "hpl1/engine/system/String.h"
+
+#include "hpl1/debug.h"
+#include "hpl1/hpl1.h"
+
+#include "common/system.h"
+
+namespace hpl {
+
+LowLevelSystem::LowLevelSystem() {
+#if 0
+ mpScriptEngine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
+#endif
+ _scriptOutput = hplNew(cScriptOutput, ());
+ _scriptEngine->SetMessageCallback(asMETHOD(cScriptOutput, AddMessage), _scriptOutput, asCALL_THISCALL);
+#if 0
+#ifdef AS_MAX_PORTABILITY
+ RegisterScriptString(mpScriptEngine);
+#else
+ RegisterStdString(mpScriptEngine);
+#endif
+#endif
+ _handleCount = 0;
+}
+
+LowLevelSystem::~LowLevelSystem() {
+ /*Release all runnings contexts */
+
+ _scriptEngine->Release();
+ hplDelete(_scriptOutput);
+
+ // perhaps not the best thing to skip :)
+ // if(gpLogWriter) hplDelete(gpLogWriter);
+ // gpLogWriter = NULL;
+}
+
+void FatalError(const char *fmt, ...) {
+ va_list vl;
+ va_start(vl, fmt);
+ error(fmt, vl);
+ va_end(vl);
+}
+
+void Error(const char *fmt, ...) {
+ va_list vl;
+ va_start(vl, fmt);
+ debugN(Hpl1::kDebugLevelError, fmt, vl);
+ va_end(vl);
+}
+
+void Warning(const char *fmt, ...) {
+ va_list vl;
+ va_start(vl, fmt);
+ debugN(Hpl1::kDebugLevelWarning, fmt, vl);
+ va_end(vl);
+}
+
+void Log(const char *fmt, ...) {
+ va_list vl;
+ va_start(vl, fmt);
+ debugN(Hpl1::kDebugLevelLog, fmt, vl);
+ va_end(vl);
+}
+
+static bool gbUpdateLogIsActive;
+void SetUpdateLogActive(bool abX) {
+ gbUpdateLogIsActive = abX;
+}
+
+void LogUpdate(const char *fmt, ...) {
+#if 0
+ if (!gbUpdateLogIsActive)
+ return;
+
+ char text[2048];
+ va_list ap;
+ if (fmt == NULL)
+ return;
+ va_start(ap, fmt);
+ vsprintf(text, fmt, ap);
+ va_end(ap);
+
+ tString sMess = "";
+ sMess += text;
+ gUpdateLogWriter.Write(sMess);
+#endif
+}
+
+//-----------------------------------------------------------------------
+
+void CopyTextToClipboard(const tWString &text) {
+ //FIXME: string types
+ g_system->setTextInClipboard(Common::String(cString::To8Char(text.c_str()).c_str()));
+}
+
+tWString LoadTextFromClipboard() {
+ //FIXME: string types
+ Common::U32String text = g_system->getTextFromClipboard();
+ return cString::To16Char(Common::String(text).c_str());
+}
+
+//-----------------------------------------------------------------------
+
+void CreateMessageBoxW(eMsgBoxType eType, const wchar_t *caption, const wchar_t *fmt, va_list ap) {
+}
+
+void CreateMessageBoxW(eMsgBoxType eType, const wchar_t *caption, const wchar_t *fmt, ...) {
+}
+
+void CreateMessageBoxW(const wchar_t *caption, const wchar_t *fmt, ...) {
+}
+
+//-----------------------------------------------------------------------
+
+static cDate DateFromGMTIme(struct tm *apClock) {
+ cDate date;
+
+ date.seconds = apClock->tm_sec;
+ date.minutes = apClock->tm_min;
+ date.hours = apClock->tm_hour;
+ date.month_day = apClock->tm_mday;
+ date.month = apClock->tm_mon;
+ date.year = 1900 + apClock->tm_year;
+ date.week_day = apClock->tm_wday;
+ date.year_day = apClock->tm_yday;
+
+ return date;
+}
+
+//-----------------------------------------------------------------------
+
+void OpenBrowserWindow(const tWString &URL) {
+ // FIXME: use proper string types
+ g_system->openUrl(cString::To8Char(URL).c_str());
+}
+
+//-----------------------------------------------------------------------
+
+tWString GetSystemSpecialPath(eSystemPath aPathType) {
+#if 0
+#if defined(WIN32)
+ int type;
+ switch(aPathType)
+ {
+ case eSystemPath_Personal: type = CSIDL_PERSONAL;
+ break;
+ default: return _W("");
+ }
+
+ TCHAR sPath[1024];
+ if(SUCCEEDED(SHGetFolderPath(NULL,
+ type | CSIDL_FLAG_CREATE,
+ NULL,0,sPath)))
+ {
+ return tWString(sPath);
+ }
+ else
+ {
+ return _W("");
+ }
+#else
+ switch (aPathType)
+ {
+ case eSystemPath_Personal: {
+ const char *home = getenv("HOME");
+ return cString::To16Char(tString(home));
+ }
+ default:
+ return _W("");
+ }
+#endif
+#endif
+ return _W("");
+}
+
+//-----------------------------------------------------------------------
+
+bool FileExists(const tWString &fileName) {
+#if 0
+#ifdef WIN32
+ FILE *f = _wfopen(fileName.c_str(),_W("r"));
+#else
+ FILE *f = fopen(cString::To8Char(fileName).c_str(),"r");
+#endif
+ if(f==NULL)
+ {
+ return false;
+ }
+
+ fclose(f);
+ return true;
+#endif
+ return false;
+}
+
+//-----------------------------------------------------------------------
+
+void RemoveFile(const tWString &filePath) {
+#if 0
+#ifdef WIN32
+ _wremove(filePath.c_str());
+#else
+ remove(cString::To8Char(filePath).c_str());
+#endif
+#endif
+}
+
+//-----------------------------------------------------------------------
+
+bool CloneFile(const tWString &srcFileName, const tWString &destFileName,
+ bool abFailIfExists) {
+#if 0
+#ifdef WIN32
+ return CopyFile(srcFileName.c_str(),destFileName.c_str(),abFailIfExists)==TRUE;
+#else
+ if (abFailIfExists && FileExists(destFileName)) {
+ return true;
+ }
+ std::ifstream IN (cString::To8Char(srcFileName).c_str(), std::ios::binary);
+ std::ofstream OUT (cString::To8Char(destFileName).c_str(), std::ios::binary);
+ OUT << IN.rdbuf();
+ OUT.flush();
+ return true;
+#endif
+#endif
+ return false;
+}
+
+//-----------------------------------------------------------------------
+
+bool CreateFolder(const tWString &path) {
+#if 0
+#ifdef WIN32
+ return CreateDirectory(path.c_str(),NULL)==TRUE;
+#else
+ return mkdir(cString::To8Char(path).c_str(),0755)==0;
+#endif
+#endif
+ return false;
+}
+
+bool FolderExists(const tWString &path) {
+#if 0
+#ifdef WIN32
+ return GetFileAttributes(path.c_str())==FILE_ATTRIBUTE_DIRECTORY;
+#else
+ struct stat statbuf;
+ return (stat(cString::To8Char(path).c_str(), &statbuf) != -1);
+#endif
+#endif
+ return false;
+}
+
+bool IsFileLink(const tWString &path) {
+#if 0
+ // Symbolic Links Not Supported under Windows
+#ifndef WIN32
+ struct stat statbuf;
+ if (lstat(cString::To8Char(path).c_str(), &statbuf) == 0) {
+ return statbuf.st_mode == S_IFLNK;
+ } else {
+ return false;
+ }
+#else
+ return false;
+#endif
+#endif
+ return false;
+}
+
+bool LinkFile(const tWString &pointsTo, const tWString &link) {
+#if 0
+ // Symbolic Links Not Supported under Windows
+#ifndef WIN32
+ return (symlink(cString::To8Char(pointsTo).c_str(), cString::To8Char(link).c_str()) == 0);
+#else
+ return false;
+#endif
+#endif
+ return false;
+}
+
+bool RenameFile(const tWString &from, const tWString &to) {
+#if 0
+#ifdef WIN32
+ return false;
+#else
+ return (rename(cString::To8Char(from).c_str(), cString::To8Char(to).c_str()) == 0);
+#endif
+#endif
+ return false;
+}
+
+//-----------------------------------------------------------------------
+
+cDate FileModifiedDate(const tWString &filePath) {
+#if 0
+ struct tm* pClock;
+#ifdef WIN32
+ struct _stat attrib;
+ _wstat(filePath.c_str(), &attrib);
+#else
+ struct stat attrib;
+ stat(cString::To8Char(filePath).c_str(), &attrib);
+#endif
+
+ pClock = gmtime(&(attrib.st_mtime)); // Get the last modified time and put it into the time structure
+
+ cDate date = DateFromGMTIme(pClock);
+
+ return date;
+#endif
+ return {};
+}
+
+//-----------------------------------------------------------------------
+
+cDate FileCreationDate(const tWString &filePath) {
+#if 0
+ struct tm* pClock;
+#ifdef WIN32
+ struct _stat attrib;
+ _wstat(filePath.c_str(), &attrib);
+#else
+ struct stat attrib;
+ stat(cString::To8Char(filePath).c_str(), &attrib);
+#endif
+
+ pClock = gmtime(&(attrib.st_ctime)); // Get the last modified time and put it into the time structure
+
+ cDate date = DateFromGMTIme(pClock);
+
+ return date;
+#endif
+
+ return {};
+}
+
+//-----------------------------------------------------------------------
+
+void SetWindowCaption(const tString &name) {
+ g_system->setWindowCaption(Common::U32String(name.c_str()));
+}
+
+unsigned long GetApplicationTime() {
+ return g_engine->getTotalPlayTime();
+}
+
+unsigned long LowLevelSystem::getTime() {
+ return g_engine->getTotalPlayTime();
+}
+
+cDate LowLevelSystem::getDate() {
+ return {};
+}
+
+iScript *LowLevelSystem::createScript(const tString &name) {
+ return hplNew(cSqScript, (name, _scriptEngine, _scriptOutput, _handleCount++));
+}
+
+bool LowLevelSystem::addScriptFunc(const tString &funcDecl, void *pFunc, int callConv) {
+ if (_scriptEngine->RegisterGlobalFunction(funcDecl.c_str(),
+ asFUNCTION(pFunc), callConv) < 0) {
+ Error("Couldn't add func '%s'\n", funcDecl.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+bool LowLevelSystem::addScriptVar(const tString &varDecl, void *pVar) {
+ if (_scriptEngine->RegisterGlobalProperty(varDecl.c_str(), pVar) < 0) {
+ Error("Couldn't add var '%s'\n", varDecl.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+void LowLevelSystem::sleep(const unsigned int alMillisecs) {
+}
+
+} // namespace hpl
diff --git a/engines/hpl1/engine/system/LowLevelSystem.h b/engines/hpl1/engine/system/low_level_system.h
similarity index 66%
rename from engines/hpl1/engine/system/LowLevelSystem.h
rename to engines/hpl1/engine/system/low_level_system.h
index 07fb3bbc64f..28673034853 100644
--- a/engines/hpl1/engine/system/LowLevelSystem.h
+++ b/engines/hpl1/engine/system/low_level_system.h
@@ -31,6 +31,8 @@
#include "hpl1/engine/system/MemoryManager.h"
#include "hpl1/engine/system/SystemTypes.h"
+class asIScriptEngine;
+
namespace hpl {
#ifdef UPDATE_TIMING_ENABLED
@@ -55,7 +57,7 @@ namespace hpl {
class iScript;
-extern void SetLogFile(const tWString &asFile);
+extern void SetLogFile(const tWString &File);
extern void FatalError(const char *fmt, ...);
extern void Error(const char *fmt, ...);
extern void Warning(const char *fmt, ...);
@@ -64,76 +66,81 @@ extern void Log(const char *fmt, ...);
extern void SetUpdateLogActive(bool abX);
extern void LogUpdate(const char *fmt, ...);
-extern void CreateMessageBoxW(const wchar_t *asCaption, const wchar_t *fmt, ...);
-extern void CreateMessageBoxW(eMsgBoxType eType, const wchar_t *asCaption, const wchar_t *fmt, ...);
+extern void CreateMessageBoxW(const wchar_t *caption, const wchar_t *fmt, ...);
+extern void CreateMessageBoxW(eMsgBoxType eType, const wchar_t *caption, const wchar_t *fmt, ...);
-extern void OpenBrowserWindow(const tWString &asURL);
+extern void OpenBrowserWindow(const tWString &URL);
-extern void CopyTextToClipboard(const tWString &asText);
+extern void CopyTextToClipboard(const tWString &text);
extern tWString LoadTextFromClipboard();
-extern tWString GetSystemSpecialPath(eSystemPath aPathType);
-
-extern bool FileExists(const tWString &asFileName);
-extern void RemoveFile(const tWString &asFileName);
-extern bool CloneFile(const tWString &asSrcFileName, const tWString &asDestFileName,
- bool abFailIfExists);
-extern bool CreateFolder(const tWString &asPath);
-extern bool FolderExists(const tWString &asPath);
-extern bool IsFileLink(const tWString &asPath);
-extern bool LinkFile(const tWString &asPointsTo, const tWString &asLink);
-extern bool RenameFile(const tWString &asFrom, const tWString &asTo);
-extern cDate FileModifiedDate(const tWString &asFilePath);
-extern cDate FileCreationDate(const tWString &asFilePath);
+extern tWString GetSystemSpecialPath(eSystemPath pathType);
-extern void SetWindowCaption(const tString &asName);
+extern bool FileExists(const tWString &fileName);
+extern void RemoveFile(const tWString &fileName);
+extern bool CloneFile(const tWString &srcFileName, const tWString &destFileName,
+ bool failIfExists);
+extern bool CreateFolder(const tWString &path);
+extern bool FolderExists(const tWString &path);
+extern bool IsFileLink(const tWString &path);
+extern bool LinkFile(const tWString &pointsTo, const tWString &link);
+extern bool RenameFile(const tWString &from, const tWString &to);
+extern cDate FileModifiedDate(const tWString &filePath);
+extern cDate FileCreationDate(const tWString &filePath);
-extern bool HasWindowFocus(const tWString &asWindowCaption);
+extern void SetWindowCaption(const tString &name);
extern unsigned long GetApplicationTime();
-class iLowLevelSystem {
+class cScriptOutput;
+
+class LowLevelSystem {
public:
- virtual ~iLowLevelSystem() {}
+ LowLevelSystem();
+ ~LowLevelSystem();
/**
* Remark: Usually not finer then 10ms accuracy.
* \return Number of millisecs since start of app.
*/
- virtual unsigned long GetTime() = 0;
+ unsigned long getTime();
/**
* Gets the current date.
*/
- virtual cDate GetDate() = 0;
+ cDate getDate();
/**
* Creates a ne script
- * \param asName name of the script.
+ * \param name name of the script.
* \return
*/
- virtual iScript *CreateScript(const tString &asName) = 0;
+ iScript *createScript(const tString &name);
/**
* Add a function to the script vm. Example: "void test(float x)"
- * \param asFuncDecl the declaration.
+ * \param funcDecl the declaration.
* \return
*/
- virtual bool AddScriptFunc(const tString &asFuncDecl, void *pFunc, int callConv) = 0;
+ bool addScriptFunc(const tString &funcDecl, void *func, int callConv);
/**
* Add a variable to the script vm. Example: "int MyVar"
- * \param asVarDecl the declartion
+ * \param varDecl the declartion
* \param *pVar the variable
* \return
*/
- virtual bool AddScriptVar(const tString &asVarDecl, void *pVar) = 0;
+ bool addScriptVar(const tString &varDecl, void *var);
/**
* Sets the main thread to rest for a number of milliseconds.
* \param alMillisecs
*/
- virtual void Sleep(const unsigned int alMillisecs) = 0;
+ void sleep(const unsigned int millisecs);
+private:
+ asIScriptEngine *_scriptEngine;
+ cScriptOutput *_scriptOutput;
+ int _handleCount;
};
}; // namespace hpl
#endif // HPL_LOWLEVELSYSTEM_H
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 290ffdeda90..66532ec68d4 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -98,7 +98,6 @@ MODULE_OBJS := \
engine/impl/LowLevelInputSDL.o \
engine/impl/LowLevelPhysicsNewton.o \
engine/impl/LowLevelSoundOpenAL.o \
- engine/impl/LowLevelSystemSDL.o \
engine/impl/MeshLoaderCollada.o \
engine/impl/MeshLoaderColladaHelpers.o \
engine/impl/MeshLoaderColladaLoader.o \
@@ -227,6 +226,7 @@ MODULE_OBJS := \
engine/sound/SoundHandler.o \
engine/system/Container.o \
engine/system/LogicTimer.o \
+ engine/system/low_level_system.cpp \
engine/system/MemoryManager.o \
engine/system/SerializeClass.o \
engine/system/String.o \
diff --git a/engines/hpl1/penumbra-overture/GameScripts.cpp b/engines/hpl1/penumbra-overture/GameScripts.cpp
index 290d191ec63..a5a8dec708a 100644
--- a/engines/hpl1/penumbra-overture/GameScripts.cpp
+++ b/engines/hpl1/penumbra-overture/GameScripts.cpp
@@ -1570,177 +1570,177 @@ SCRIPT_DEFINE_FUNC_4(void, CreateSoundEntityAt, string, string, string, string)
//-----------------------------------------------------------------------
void cGameScripts::Init() {
- iLowLevelSystem *pLowLevelSystem = gpInit->mpGame->GetSystem()->GetLowLevel();
+ LowLevelSystem *pLowLevelSystem = gpInit->mpGame->GetSystem()->GetLowLevel();
// Game helper
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddToTempString));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddToTempStringTrans));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddToTempStringAction));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddToTempString));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddToTempStringTrans));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddToTempStringAction));
// Game general
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(ResetGame));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(StartCredits));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(StartDemoEndText));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(ClearSavedMaps));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetActionKeyString));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(ResetGame));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(StartCredits));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(StartDemoEndText));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(ClearSavedMaps));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(GetActionKeyString));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddMessageTrans));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddMessage));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddMessageTempString));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddMessageTrans));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddMessage));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddMessageTempString));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddSubTitleTrans));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddSubTitle));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddSubTitleTempString));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddSubTitleTrans));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddSubTitle));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddSubTitleTempString));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddRadioMessage));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetRadioOnEndCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddRadioMessage));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetRadioOnEndCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetMessagesOverCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetMessagesOverCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(ChangeMap));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(ChangeMap));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetMapGameName));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetMapGameNameTrans));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetMapGameName));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetMapGameNameTrans));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddNotebookTaskText));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddNotebookTask));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(RemoveNotebookTask));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddNotebookTaskText));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddNotebookTask));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(RemoveNotebookTask));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddNotebookNote));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(StartNumericalPanel));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetInventoryActive));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeIn));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(FadeOut));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(IsFading));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetWideScreenActive));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddNotebookNote));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(StartNumericalPanel));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetInventoryActive));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(FadeIn));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(FadeOut));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(IsFading));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetWideScreenActive));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AutoSave));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AutoSave));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(StartFlash));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(StartFlash));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetWaveGravityActive));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetupWaveGravity));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetWaveGravityActive));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetupWaveGravity));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetDepthOfFieldActive));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetupDepthOfField));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(FocusOnEntity));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetConstantFocusOnEntity));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetDepthOfFieldActive));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetupDepthOfField));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(FocusOnEntity));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetConstantFocusOnEntity));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(PlayGameMusic));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(StopGameMusic));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(PlayGameMusic));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(StopGameMusic));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(StartScreenShake));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(StartScreenShake));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateLightFlashAtArea));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(CreateLightFlashAtArea));
// Attack
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateSplashDamage));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(CreateSplashDamage));
// Game timer
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateTimer));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(DestroyTimer));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetTimerPaused));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetTimerTime));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddTimerTime));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetTimerTime));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(CreateTimer));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(DestroyTimer));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetTimerPaused));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetTimerTime));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddTimerTime));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(GetTimerTime));
// Player
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(GivePlayerDamage));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetPlayerHealth));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetPlayerHealth));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetPlayerPose));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetPlayerActive));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(StartPlayerLookAt));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(StopPlayerLookAt));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(StartPlayerFearFilter));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(StopPlayerFearFilter));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetFlashlightDisabled));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(GivePlayerDamage));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetPlayerHealth));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(GetPlayerHealth));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetPlayerPose));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetPlayerActive));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(StartPlayerLookAt));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(StopPlayerLookAt));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(StartPlayerFearFilter));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(StopPlayerFearFilter));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetFlashlightDisabled));
// Inventory
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddPickupCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddUseCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddCombineCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddPickupCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddUseCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddCombineCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(RemovePickupCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(RemoveUseCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(RemoveCombineCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(RemovePickupCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(RemoveUseCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(RemoveCombineCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(HasItem));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(RemoveItem));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(GiveItem));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(HasItem));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(RemoveItem));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(GiveItem));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetInventoryMessage));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetInventoryMessageTrans));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetInventoryMessage));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetInventoryMessageTrans));
// Game entity properties
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(ReplaceEntity));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(ReplaceEntity));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityActive));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetGameEntityActive));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityActive));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(GetGameEntityActive));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityMaxExamineDist));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityMaxInteractDist));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityMaxExamineDist));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityMaxInteractDist));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateGameEntityVar));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityVar));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddGameEntityVar));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetGameEntityVar));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(CreateGameEntityVar));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityVar));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddGameEntityVar));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(GetGameEntityVar));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityDescriptionTrans));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityDescriptionOnceTrans));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityDescription));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityDescriptionTrans));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityDescriptionOnceTrans));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityDescription));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityGameNameTrans));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetGameEntityGameNameTrans));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(ChangeEntityAnimation));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(ChangeEntityAnimation));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetEntityHealth));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(DamageEntity));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetEntityHealth));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(DamageEntity));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetDoorState));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetDoorState));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetObjectInteractMode));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetObjectInteractMode));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetupLink));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetupLinkLoadText));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetupLink));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetupLinkLoadText));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetAreaCustomIcon));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetAreaCustomIcon));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddEnemyPatrolNode));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(ClearEnemyPatrolNodes));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetEnemyDeathCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetEnemyAttackCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(GetEnemyHealth));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetEnemyUseTriggers));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(ShowEnemyPlayer));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddEnemyPatrolNode));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(ClearEnemyPatrolNodes));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetEnemyDeathCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetEnemyAttackCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(GetEnemyHealth));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetEnemyUseTriggers));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(ShowEnemyPlayer));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetDoorLocked));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetDoorLocked));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetupStickArea));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AllowAttachment));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetupStickArea));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AllowAttachment));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLampLit));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLampLitChangeCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetLampFlicker));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetLampLit));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetLampLitChangeCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetLampFlicker));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetupLadder));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetupLadder));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetupDamageArea));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetupForceArea));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetupDamageArea));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetupForceArea));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetupLiquidArea));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetupLiquidArea));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(SetupSaveArea));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(SetupSaveArea));
// Game entity callbacks
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddEntityCollideCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(RemoveEntityCollideCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddEntityCollideCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(RemoveEntityCollideCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(AddEntityCallback));
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(RemoveEntityCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddEntityCallback));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(RemoveEntityCallback));
// Game sound
- pLowLevelSystem->AddScriptFunc(SCRIPT_REGISTER_FUNC(CreateSoundEntityAt));
+ pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(CreateSoundEntityAt));
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index b90445a1698..39c88909141 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -2612,7 +2612,7 @@ void cMainMenu::CreateWidgets() {
AddWidgetToState(state, gpSaveGameList[i]);
LowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
- iLowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
+ LowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
tStringList lstFiles;
tTempFileAndDataSet setTempFiles;
diff --git a/engines/hpl1/penumbra-overture/MapHandler.cpp b/engines/hpl1/penumbra-overture/MapHandler.cpp
index 772f5daf7a6..76df9d98f43 100644
--- a/engines/hpl1/penumbra-overture/MapHandler.cpp
+++ b/engines/hpl1/penumbra-overture/MapHandler.cpp
@@ -325,7 +325,7 @@ bool cMapHandler::Load(const tString &asFile, const tString &asStartPos) {
}
#endif
- unsigned long lStartTime = mpInit->mpGame->GetSystem()->GetLowLevel()->GetTime();
+ unsigned long lStartTime = mpInit->mpGame->GetSystem()->GetLowLevel()->getTime();
if (sMapName != msCurrentMap) {
////////////////////////////////////////
@@ -499,7 +499,7 @@ bool cMapHandler::Load(const tString &asFile, const tString &asStartPos) {
// Log("After load and before preupdate:\n");
- unsigned long lTime = mpInit->mpGame->GetSystem()->GetLowLevel()->GetTime() - lStartTime;
+ unsigned long lTime = mpInit->mpGame->GetSystem()->GetLowLevel()->getTime() - lStartTime;
Log("Loading map '%s' took: %d ms\n", pWorld->GetFileName().c_str(), lTime);
PreUpdate(fTimeSinceVisit);
@@ -1644,7 +1644,7 @@ void cMapHandler::PreUpdate(double afTimeSinceVisit) {
mbPreUpdating = true;
- unsigned long lStart = mpInit->mpGame->GetSystem()->GetLowLevel()->GetTime();
+ unsigned long lStart = mpInit->mpGame->GetSystem()->GetLowLevel()->getTime();
// Enable all physic bodies
cPhysicsBodyIterator bodyIt = pPhysicsWorld->GetBodyIterator();
@@ -1682,7 +1682,7 @@ void cMapHandler::PreUpdate(double afTimeSinceVisit) {
mpInit->mpGame->GetSound()->GetSoundHandler()->SetSilent(false);
}
- unsigned long lTime = mpInit->mpGame->GetSystem()->GetLowLevel()->GetTime() - lStart;
+ unsigned long lTime = mpInit->mpGame->GetSystem()->GetLowLevel()->getTime() - lStart;
// Log("PREUPDATE time: %d\n",lTime);
diff --git a/engines/hpl1/penumbra-overture/Player.cpp b/engines/hpl1/penumbra-overture/Player.cpp
index cb9ffcc7150..cb85d15ca04 100644
--- a/engines/hpl1/penumbra-overture/Player.cpp
+++ b/engines/hpl1/penumbra-overture/Player.cpp
@@ -974,7 +974,7 @@ cTempCheckProxy gTempCheckProxy;
void cPlayer::Update(float afTimeStep) {
cSystem *pSystem = mpInit->mpGame->GetSystem();
- unsigned int lTime = pSystem->GetLowLevel()->GetTime();
+ unsigned int lTime = pSystem->GetLowLevel()->getTime();
iPhysicsWorld *pPhysicsWorld = mpScene->GetWorld3D()->GetPhysicsWorld();
/////////////////////////////////////
@@ -1012,7 +1012,7 @@ void cPlayer::Update(float afTimeStep) {
}
//LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);*/
- lTime = pSystem->GetLowLevel()->GetTime();
+ lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" misc\n");
//////////////////////
// Reset roll
@@ -1033,28 +1033,28 @@ void cPlayer::Update(float afTimeStep) {
/////////////////////////////////////////////////
// Flashlight
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->GetTime();
+ lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" flashlight");
mpFlashLight->Update(afTimeStep);
/////////////////////////////////////////////////
// Glowstick
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->GetTime();
+ lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" glowstick\n");
mpGlowStick->Update(afTimeStep);
/////////////////////////////////////////////////
// Flare
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->GetTime();
+ lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" flare\n");
mpFlare->Update(afTimeStep);
/////////////////////////////////////////////////
// Lean
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->GetTime();
+ lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" more misc\n");
mpLean->Update(afTimeStep);
@@ -1081,12 +1081,12 @@ void cPlayer::Update(float afTimeStep) {
////////////////////////////////////////
// Hidden
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->GetTime();
+ lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" hidden\n");
mpHidden->Update(afTimeStep);
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->GetTime();
+ lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" collide scripts\n");
/////////////////////////////////////////////////
// Collide script
@@ -1187,7 +1187,7 @@ void cPlayer::Update(float afTimeStep) {
mlGroundCount--;
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->GetTime();
+ lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" Check For ground\n");
//////////////////////////////
// Cast ray and check for ground.
@@ -1203,7 +1203,7 @@ void cPlayer::Update(float afTimeStep) {
//////////////////////////////
// Update movement
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->GetTime();
+ lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" Movement\n");
if (mbMoving == false)
@@ -1217,7 +1217,7 @@ void cPlayer::Update(float afTimeStep) {
//////////////////////////////
// Update camera pos add
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->GetTime();
+ lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" Camera pos\n");
if (mpCharBody) {
float fYAdd = mfCameraHeightAdd + mpHeadMove->GetPos() + mfHeightAdd + mpDeath->GetHeighAdd() +
@@ -1243,7 +1243,7 @@ void cPlayer::Update(float afTimeStep) {
SetPickedBody(NULL);
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->GetTime();
+ lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" state %d\n",mState);
if (mpInit->mpInventory->IsActive() == false &&
mpInit->mpNotebook->IsActive() == false) {
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index 7a6cf002f34..906548529c9 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -218,7 +218,7 @@ cSaveHandler::cSaveHandler(cInit *apInit) : iUpdateable("SaveHandler") {
//////////////////////////////////////////////
// Create directories
msSaveDir = _W("");
- iLowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
+ LowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
tWString sPeronalDir = GetSystemSpecialPath(eSystemPath_Personal);
@@ -604,7 +604,7 @@ void cSaveHandler::AutoSave(const tWString &asDir, int alMaxSaves) {
tWString sMapName = mpInit->mpMapHandler->GetMapGameName();
sMapName = cString::ReplaceCharToW(sMapName, _W("\n"), _W(" "));
sMapName = cString::ReplaceCharToW(sMapName, _W(":"), _W(" "));
- cDate date = mpInit->mpGame->GetSystem()->GetLowLevel()->GetDate();
+ cDate date = mpInit->mpGame->GetSystem()->GetLowLevel()->getDate();
wchar_t sTemp[512];
swprintf(sTemp, 512, _W("save/%ls/%ls %d-%02d-%02d_%02d.%02d.%02d_%02d.sav"),
asDir.c_str(),
@@ -669,7 +669,7 @@ void cSaveHandler::OnExit() {
void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMask, int alMaxFiles) {
LowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
- iLowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
+ LowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
tWString sPath = msSaveDir + asDir;
@@ -698,7 +698,7 @@ void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMa
tWString cSaveHandler::GetLatest(const tWString &asDir, const tWString &asMask) {
LowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
- iLowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
+ LowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
tWString sPath = msSaveDir + asDir;
Commit: 81a930c78adbb6625dd1f9f7ad7f932b83c2687c
https://github.com/scummvm/scummvm/commit/81a930c78adbb6625dd1f9f7ad7f932b83c2687c
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:31+01:00
Commit Message:
HPL1: fix module.mk
Changed paths:
engines/hpl1/module.mk
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 66532ec68d4..6ecc6fbd7aa 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -226,7 +226,7 @@ MODULE_OBJS := \
engine/sound/SoundHandler.o \
engine/system/Container.o \
engine/system/LogicTimer.o \
- engine/system/low_level_system.cpp \
+ engine/system/low_level_system.o \
engine/system/MemoryManager.o \
engine/system/SerializeClass.o \
engine/system/String.o \
Commit: dded0c3ca56f9b5e830db5787a2a3d4c6c4cf0b1
https://github.com/scummvm/scummvm/commit/dded0c3ca56f9b5e830db5787a2a3d4c6c4cf0b1
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:31+01:00
Commit Message:
HPL1: add string helper functions
Changed paths:
A engines/hpl1/string.cpp
A engines/hpl1/string.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 6ecc6fbd7aa..faddef872ed 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/hpl1
MODULE_OBJS := \
console.o \
detection.o \
+ string.o \
engine/ai/AI.o \
engine/ai/AINodeContainer.o \
engine/ai/AINodeGenerator.o \
diff --git a/engines/hpl1/string.cpp b/engines/hpl1/string.cpp
new file mode 100644
index 00000000000..75250269169
--- /dev/null
+++ b/engines/hpl1/string.cpp
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <stdlib.h>
+#include "hpl1/string.h"
+
+namespace Hpl1 {
+
+int stoi(const char *str, int emptyResult) {
+ if (str == nullptr)
+ return emptyResult;
+ return atoi(str);
+}
+
+Common::String fileDir(const Common::String &path) {
+ size_t last = path.findLastOf("/");
+ if (last == Common::String::npos)
+ return "";
+ return path.substr(0, last+1);
+}
+
+}
\ No newline at end of file
diff --git a/engines/hpl1/string.h b/engines/hpl1/string.h
new file mode 100644
index 00000000000..4ad65ac932b
--- /dev/null
+++ b/engines/hpl1/string.h
@@ -0,0 +1,35 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_STRING_H
+#define HPL1_STRING_H
+
+#include "common/str.h"
+
+namespace Hpl1 {
+
+int stoi(const char *str, int emptyResult = 0);
+
+Common::String fileDir(const Common::String &path);
+
+}
+
+#endif
\ No newline at end of file
Commit: e134735bbd1997542e4a1fb80a4b94c7f7edbe86
https://github.com/scummvm/scummvm/commit/e134735bbd1997542e4a1fb80a4b94c7f7edbe86
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:31+01:00
Commit Message:
HPL1: modify API for bitmap2D
Changed paths:
engines/hpl1/engine/graphics/bitmap2D.cpp
engines/hpl1/engine/graphics/bitmap2D.h
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
index eb1ed3b4cfe..dc05ea4e4b2 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.cpp
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -62,22 +62,24 @@ Bitmap2D::Bitmap2D(const tString &filepath, const tString &type)
error("trying to load unsupported image format %s", type.c_str());
}
-Bitmap2D::Bitmap2D(const tString &type, const cVector2l &size, const Graphics::PixelFormat &format)
-: iLowLevelPicture(type), _isSurfaceActive(true) {
+Bitmap2D::Bitmap2D(const cVector2l &size, const Graphics::PixelFormat &format)
+: iLowLevelPicture("none"), _isSurfaceActive(true) {
create(size, format);
}
-void Bitmap2D::drawToBitmap(Bitmap2D &dest, const cVector2l &pos) {
+void Bitmap2D::drawToBitmap(Bitmap2D &dest, const cVector2l &at, Common::Rect srcSubrect) {
if(!dest._isSurfaceActive)
dest.copyDecoder();
+ if(srcSubrect.right == 0 && srcSubrect.bottom == 0)
+ srcSubrect = Common::Rect(activeSurface().w, activeSurface().h);
if (activeSurface().format != dest._surface.format)
error("call to Bitmap2D::drawToBitmap with different pixel formats");
- if (activeSurface().w + pos.x > dest._surface.w || activeSurface().h + pos.y > dest._surface.h)
+ if (srcSubrect.width() > dest._surface.w || srcSubrect.height() > dest._surface.h)
error("call to Bitmap2D::drawToBitmap would go out of bounds");
- dest._surface.copyRectToSurface(activeSurface(), pos.x, pos.y, Common::Rect(0, 0, activeSurface().w, activeSurface().h));
+ dest._surface.copyRectToSurface(activeSurface(), at.x, at.y, srcSubrect);
}
bool Bitmap2D::create(const cVector2l &size, const Graphics::PixelFormat &format) {
@@ -117,6 +119,10 @@ int Bitmap2D::getNumChannels() {
return activeSurface().format.bpp() / _surface.format.bytesPerPixel;
}
+const Graphics::PixelFormat &Bitmap2D::format() const {
+ return activeSurface().format;
+}
+
bool Bitmap2D::HasAlpha() {
return activeSurface().format.aBits() > 0;
}
diff --git a/engines/hpl1/engine/graphics/bitmap2D.h b/engines/hpl1/engine/graphics/bitmap2D.h
index 14a590a3d88..654658dcd5e 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.h
+++ b/engines/hpl1/engine/graphics/bitmap2D.h
@@ -33,6 +33,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "graphics/pixelformat.h"
#include "common/ptr.h"
+#include "common/rect.h"
#include "graphics/surface.h"
#include "image/image_decoder.h"
@@ -40,12 +41,12 @@ namespace hpl {
class Bitmap2D : public iLowLevelPicture {
public:
- Bitmap2D(const tString &type, const cVector2l &size, const Graphics::PixelFormat &format);
+ Bitmap2D(const cVector2l &size, const Graphics::PixelFormat &format);
Bitmap2D(const tString &filename, const tString &type);
~Bitmap2D();
- void drawToBitmap(Bitmap2D &dest, const cVector2l &pos);
+ void drawToBitmap(Bitmap2D &dest, const cVector2l &at, Common::Rect srcSubrect = {});
bool create(const cVector2l &size, const Graphics::PixelFormat &format);
@@ -55,6 +56,8 @@ public:
int getNumChannels();
+ const Graphics::PixelFormat &format() const;
+
bool HasAlpha() override;
private:
Commit: dfa544ae098998c7a6565051535cdf972c208f62
https://github.com/scummvm/scummvm/commit/dfa544ae098998c7a6565051535cdf972c208f62
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:31+01:00
Commit Message:
HPL1: replace font loading implementation
HPL1: remove missing header
Changed paths:
A engines/hpl1/engine/graphics/font_data.cpp
A engines/hpl1/engine/graphics/font_data.h
R engines/hpl1/engine/graphics/FontData.cpp
R engines/hpl1/engine/graphics/FontData.h
R engines/hpl1/engine/impl/SDLFontData.cpp
R engines/hpl1/engine/impl/SDLFontData.h
engines/hpl1/engine/engine.h
engines/hpl1/engine/graphics/Animation.h
engines/hpl1/engine/graphics/ImageEntityData.h
engines/hpl1/engine/graphics/LowLevelGraphics.h
engines/hpl1/engine/graphics/Material.h
engines/hpl1/engine/graphics/Mesh.h
engines/hpl1/engine/graphics/ParticleSystem3D.h
engines/hpl1/engine/graphics/Texture.h
engines/hpl1/engine/graphics/VideoStream.h
engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
engines/hpl1/engine/gui/GuiSet.cpp
engines/hpl1/engine/gui/GuiSet.h
engines/hpl1/engine/gui/GuiSkin.h
engines/hpl1/engine/gui/Widget.h
engines/hpl1/engine/gui/WidgetButton.cpp
engines/hpl1/engine/gui/WidgetLabel.cpp
engines/hpl1/engine/gui/WidgetSlider.cpp
engines/hpl1/engine/gui/WidgetTextBox.cpp
engines/hpl1/engine/impl/CGProgram.cpp
engines/hpl1/engine/impl/CGProgram.h
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
engines/hpl1/engine/resources/FontManager.cpp
engines/hpl1/engine/resources/FontManager.h
engines/hpl1/engine/resources/ResourceBase.h
engines/hpl1/engine/resources/ResourceImage.cpp
engines/hpl1/engine/resources/ResourceImage.h
engines/hpl1/engine/scene/TileSet.h
engines/hpl1/engine/sound/SoundData.h
engines/hpl1/engine/sound/SoundEntityData.h
engines/hpl1/engine/system/Script.h
engines/hpl1/module.mk
engines/hpl1/penumbra-overture/CharacterMove.cpp
engines/hpl1/penumbra-overture/Credits.cpp
engines/hpl1/penumbra-overture/Credits.h
engines/hpl1/penumbra-overture/DeathMenu.cpp
engines/hpl1/penumbra-overture/DeathMenu.h
engines/hpl1/penumbra-overture/DemoEndText.h
engines/hpl1/penumbra-overture/EffectHandler.cpp
engines/hpl1/penumbra-overture/EffectHandler.h
engines/hpl1/penumbra-overture/GameEnemy.cpp
engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
engines/hpl1/penumbra-overture/GameMessageHandler.cpp
engines/hpl1/penumbra-overture/GameMessageHandler.h
engines/hpl1/penumbra-overture/GraphicsHelper.cpp
engines/hpl1/penumbra-overture/GraphicsHelper.h
engines/hpl1/penumbra-overture/Init.h
engines/hpl1/penumbra-overture/IntroStory.cpp
engines/hpl1/penumbra-overture/IntroStory.h
engines/hpl1/penumbra-overture/Inventory.cpp
engines/hpl1/penumbra-overture/Inventory.h
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/MainMenu.h
engines/hpl1/penumbra-overture/MapLoadText.cpp
engines/hpl1/penumbra-overture/MapLoadText.h
engines/hpl1/penumbra-overture/Notebook.cpp
engines/hpl1/penumbra-overture/Notebook.h
engines/hpl1/penumbra-overture/NumericalPanel.cpp
engines/hpl1/penumbra-overture/Player.cpp
engines/hpl1/penumbra-overture/Player.h
engines/hpl1/penumbra-overture/PlayerHelper.h
engines/hpl1/penumbra-overture/PlayerState_Interact.h
engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.h
engines/hpl1/penumbra-overture/PreMenu.cpp
engines/hpl1/penumbra-overture/PreMenu.h
engines/hpl1/penumbra-overture/RadioHandler.cpp
engines/hpl1/penumbra-overture/RadioHandler.h
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index 0fbc6009880..2708209e061 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -43,7 +43,7 @@
#include "hpl1/engine/graphics/Bone.h"
#include "hpl1/engine/graphics/BoneState.h"
#include "hpl1/engine/graphics/Color.h"
-#include "hpl1/engine/graphics/FontData.h"
+#include "hpl1/engine/graphics/font_data.h"
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/GfxObject.h"
#include "hpl1/engine/graphics/Graphics.h"
@@ -148,7 +148,6 @@
#include "hpl1/engine/impl/PhysicsJointSliderNewton.h"
#include "hpl1/engine/impl/PhysicsMaterialNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
-#include "hpl1/engine/impl/SDLFontData.h"
#include "hpl1/engine/impl/SDLTexture.h"
#include "hpl1/engine/impl/SqScript.h"
#include "hpl1/engine/impl/VertexBufferOGL.h"
diff --git a/engines/hpl1/engine/graphics/Animation.h b/engines/hpl1/engine/graphics/Animation.h
index 43c86d10b99..d617bbd5fa9 100644
--- a/engines/hpl1/engine/graphics/Animation.h
+++ b/engines/hpl1/engine/graphics/Animation.h
@@ -60,9 +60,9 @@ public:
tString &GetFileName() { return msFileName; }
// Resources implementation
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
private:
tString msAnimName;
diff --git a/engines/hpl1/engine/graphics/FontData.cpp b/engines/hpl1/engine/graphics/FontData.cpp
deleted file mode 100644
index 66ef952ab4c..00000000000
--- a/engines/hpl1/engine/graphics/FontData.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#include "hpl1/engine/graphics/FontData.h"
-#include <stdarg.h>
-#include <stdlib.h>
-
-#include "hpl1/engine/system/low_level_system.h"
-
-#include "hpl1/engine/graphics/GfxObject.h"
-#include "hpl1/engine/graphics/GraphicsDrawer.h"
-
-#include "hpl1/engine/resources/ResourceImage.h"
-
-#include "hpl1/engine/gui/Gui.h"
-#include "hpl1/engine/gui/GuiGfxElement.h"
-
-namespace hpl {
-
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cGlyph::cGlyph(cGfxObject *apObject, cGuiGfxElement *apGuiGfx, const cVector2f &avOffset,
- const cVector2f &avSize, float afAdvance) {
- mpGfxObject = apObject;
- mpGuiGfx = apGuiGfx;
- mvOffset = avOffset;
- mvSize = avSize;
- mfAdvance = afAdvance;
-}
-
-cGlyph::~cGlyph() {
- if (mpGfxObject)
- hplDelete(mpGfxObject);
- if (mpGuiGfx)
- hplDelete(mpGuiGfx);
-}
-
-//-----------------------------------------------------------------------
-
-iFontData::iFontData(const tString &asName, iLowLevelGraphics *apLowLevelGraphics)
- : iResourceBase(asName, 0) {
- mpLowLevelGraphics = apLowLevelGraphics;
-}
-
-//-----------------------------------------------------------------------
-
-iFontData::~iFontData() {
- for (int i = 0; i < (int)mvGlyphs.size(); i++) {
- if (mvGlyphs[i])
- hplDelete(mvGlyphs[i]);
- }
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-void iFontData::Draw(const cVector3f &avPos, const cVector2f &avSize, const cColor &aCol,
- eFontAlign aAlign, const wchar_t *fmt, ...) {
- wchar_t sText[256];
- va_list ap;
- if (fmt == NULL)
- return;
- va_start(ap, fmt);
- vswprintf(sText, 255, fmt, ap);
- va_end(ap);
-
- int lCount = 0;
- float lXAdd = 0;
- cVector3f vPos = avPos;
-
- if (aAlign == eFontAlign_Center) {
- vPos.x -= GetLength(avSize, sText) / 2;
- } else if (aAlign == eFontAlign_Right) {
- vPos.x -= GetLength(avSize, sText);
- }
-
- while (sText[lCount] != 0) {
- wchar_t lGlyphNum = ((wchar_t)sText[lCount]);
- if (lGlyphNum < mlFirstChar || lGlyphNum > mlLastChar) {
- lCount++;
- continue;
- }
- lGlyphNum -= mlFirstChar;
-
- cGlyph *pGlyph = mvGlyphs[lGlyphNum];
- if (pGlyph) {
- cVector2f vOffset(pGlyph->mvOffset * avSize);
- cVector2f vSize(pGlyph->mvSize * avSize);
-
- mpGraphicsDrawer->DrawGfxObject(pGlyph->mpGfxObject, vPos + vOffset, vSize, aCol);
-
- vPos.x += pGlyph->mfAdvance * avSize.x;
- }
- lCount++;
- }
-}
-
-//-----------------------------------------------------------------------
-
-int iFontData::DrawWordWrap(cVector3f avPos, float afLength, float afFontHeight, cVector2f avSize, const cColor &aCol,
- eFontAlign aAlign, const tWString &asString) {
- int rows = 0;
-
- unsigned int pos;
- unsigned int first_letter = 0;
- unsigned int last_space = 0;
-
- tUIntList RowLengthList;
-
- float fTextLength;
-
- for (pos = 0; pos < asString.size(); pos++) {
- if (asString[pos] == _W(' ') || asString[pos] == _W('\n')) {
- tWString temp = asString.substr(first_letter, pos - first_letter);
- fTextLength = GetLength(avSize, temp.c_str());
-
- bool nothing = true;
- if (fTextLength > afLength) {
- rows++;
- RowLengthList.push_back(last_space);
- first_letter = last_space + 1;
- last_space = pos;
- nothing = false;
- }
- if (asString[pos] == _W('\n')) {
- last_space = pos;
- first_letter = last_space + 1;
- RowLengthList.push_back(last_space - 1);
- rows++;
- nothing = false;
- }
- if (nothing) {
- last_space = pos;
- }
- }
- }
- tWString temp = asString.substr(first_letter, pos - first_letter);
- fTextLength = GetLength(avSize, temp.c_str());
- if (fTextLength > afLength) {
- rows++;
- RowLengthList.push_back(last_space);
- }
-
- if (rows == 0) {
- Draw(avPos, avSize, aCol, aAlign, _W("%ls"), asString.c_str());
- } else {
- first_letter = 0;
- unsigned int i = 0;
-
- for (tUIntListIt it = RowLengthList.begin(); it != RowLengthList.end(); ++it) {
- Draw(cVector3f(avPos.x, avPos.y + i * afFontHeight, avPos.z), avSize, aCol, aAlign,
- _W("%ls"), asString.substr(first_letter, *it - first_letter).c_str());
- i++;
- first_letter = *it + 1;
- }
- Draw(cVector3f(avPos.x, avPos.y + i * afFontHeight, avPos.z), avSize, aCol, aAlign,
- _W("%ls"), asString.substr(first_letter).c_str());
- }
-
- return rows;
-}
-
-//-----------------------------------------------------------------------
-
-void iFontData::GetWordWrapRows(float afLength, float afFontHeight, cVector2f avSize,
- const tWString &asString, tWStringVec *apRowVec) {
- int rows = 0;
-
- unsigned int pos;
- unsigned int first_letter = 0;
- unsigned int last_space = 0;
-
- tUIntList RowLengthList;
-
- float fTextLength;
-
- for (pos = 0; pos < asString.size(); pos++) {
- // Log("char: %d\n",(char)asString[pos]);
- if (asString[pos] == _W(' ') || asString[pos] == _W('\n')) {
- tWString temp = asString.substr(first_letter, pos - first_letter);
- fTextLength = GetLength(avSize, temp.c_str());
-
- // Log("r:%d p:%d f:%d l:%d Temp:'%s'\n",rows,pos,first_letter,last_space,
- // temp.c_str());
- bool nothing = true;
- if (fTextLength > afLength) {
- rows++;
- RowLengthList.push_back(last_space);
- first_letter = last_space + 1;
- last_space = pos;
- nothing = false;
- }
- if (asString[pos] == _W('\n')) {
- last_space = pos;
- first_letter = last_space + 1;
- RowLengthList.push_back(last_space);
- rows++;
- nothing = false;
- }
- if (nothing) {
- last_space = pos;
- }
- }
- }
- tWString temp = asString.substr(first_letter, pos - first_letter);
- fTextLength = GetLength(avSize, temp.c_str());
- if (fTextLength > afLength) {
- rows++;
- RowLengthList.push_back(last_space);
- }
-
- if (rows == 0) {
- apRowVec->push_back(asString.c_str());
- } else {
- first_letter = 0;
- unsigned int i = 0;
-
- for (tUIntListIt it = RowLengthList.begin(); it != RowLengthList.end(); ++it) {
- apRowVec->push_back(asString.substr(first_letter, *it - first_letter).c_str());
- i++;
- first_letter = *it + 1;
- }
- apRowVec->push_back(asString.substr(first_letter).c_str());
- }
-}
-
-//-----------------------------------------------------------------------
-
-float iFontData::GetLength(const cVector2f &avSize, const wchar_t *sText) {
- int lCount = 0;
- float lXAdd = 0;
- float fLength = 0;
- while (sText[lCount] != 0) {
- unsigned short lGlyphNum = ((wchar_t)sText[lCount]);
- if (lGlyphNum < mlFirstChar || lGlyphNum > mlLastChar) {
- lCount++;
- continue;
- }
- lGlyphNum -= mlFirstChar;
-
- cGlyph *pGlyph = mvGlyphs[lGlyphNum];
- if (pGlyph) {
- cVector2f vOffset(pGlyph->mvOffset * avSize);
- cVector2f vSize(pGlyph->mvSize * avSize);
-
- fLength += pGlyph->mfAdvance * avSize.x;
- }
- lCount++;
- }
-
- return fLength;
-}
-
-//-----------------------------------------------------------------------
-
-float iFontData::GetLengthFmt(const cVector2f &avSize, const wchar_t *fmt, ...) {
- wchar_t sText[256];
- va_list ap;
- if (fmt == NULL)
- return 0;
- va_start(ap, fmt);
- vswprintf(sText, 255, fmt, ap);
- va_end(ap);
-
- return GetLength(avSize, sText);
-}
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PRIVATE METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cGlyph *iFontData::CreateGlyph(Bitmap2D *apBmp, const cVector2l &avOffset, const cVector2l &avSize,
- const cVector2l &avFontSize, int alAdvance) {
- // Here the bitmap should be saved to diskk for faster loading.
-
- //////////////////////////
- // Gfx object
- cGfxObject *pObject = mpGraphicsDrawer->CreateGfxObject(apBmp, "fontnormal", false);
-
- //////////////////////////
- // Gui gfx
- cGuiGfxElement *pGuiGfx = mpGui->CreateGfxFilledRect(cColor(1, 1), eGuiMaterial_FontNormal, false);
- cResourceImage *pImage = pObject->GetMaterial()->GetImage(eMaterialTexture_Diffuse);
- pImage->IncUserCount();
- pGuiGfx->AddImage(pImage);
-
- //////////////////////////
- // Sizes
- cVector2f vSize;
- vSize.x = ((float)avSize.x) / ((float)avFontSize.x) * mvSizeRatio.x;
- vSize.y = ((float)avSize.y) / ((float)avFontSize.y) * mvSizeRatio.y;
-
- cVector2f vOffset;
- vOffset.x = ((float)avOffset.x) / ((float)avFontSize.x);
- vOffset.y = ((float)avOffset.y) / ((float)avFontSize.y);
-
- float fAdvance = ((float)alAdvance) / ((float)avFontSize.x) * mvSizeRatio.x;
-
- cGlyph *pGlyph = hplNew(cGlyph, (pObject, pGuiGfx, vOffset, vSize, fAdvance));
-
- return pGlyph;
-}
-
-//-----------------------------------------------------------------------
-
-void iFontData::AddGlyph(cGlyph *apGlyph) {
- mvGlyphs.push_back(apGlyph);
-}
-
-//-----------------------------------------------------------------------
-
-} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.h b/engines/hpl1/engine/graphics/ImageEntityData.h
index b67701bfaf4..ba237413fa0 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.h
+++ b/engines/hpl1/engine/graphics/ImageEntityData.h
@@ -73,9 +73,9 @@ public:
~cImageEntityData();
// resource stuff:
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
bool CreateFromFile(const tString &asFile, tUIntVec &avImageHandle);
diff --git a/engines/hpl1/engine/graphics/LowLevelGraphics.h b/engines/hpl1/engine/graphics/LowLevelGraphics.h
index 3ee9a0757ef..b5603cefd7e 100644
--- a/engines/hpl1/engine/graphics/LowLevelGraphics.h
+++ b/engines/hpl1/engine/graphics/LowLevelGraphics.h
@@ -194,7 +194,7 @@ typedef tFlag tVtxBatchFlag;
#define kMaxClipPlanes (6)
-class iFontData;
+class FontData;
class iOcclusionQuery;
class iLowLevelGraphics {
@@ -253,7 +253,7 @@ public:
virtual void SetClipPlaneActive(int alIdx, bool abX) = 0;
virtual Bitmap2D *CreateBitmap2D(const cVector2l &avSize, unsigned int alBpp) = 0;
- virtual iFontData *CreateFontData(const tString &asName) = 0;
+ virtual FontData *CreateFontData(const tString &asName) = 0;
virtual iTexture *CreateTexture(bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) = 0;
virtual iTexture *CreateTexture(const tString &asName, bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) = 0;
diff --git a/engines/hpl1/engine/graphics/Material.h b/engines/hpl1/engine/graphics/Material.h
index 4fa6516af44..38168517abc 100644
--- a/engines/hpl1/engine/graphics/Material.h
+++ b/engines/hpl1/engine/graphics/Material.h
@@ -163,9 +163,9 @@ public:
eGpuProgramType GetType() { return mProgramType; }
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
protected:
iLowLevelGraphics *mpLowGfx;
@@ -208,9 +208,9 @@ public:
virtual ~iMaterial();
// resources stuff.
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
virtual void Compile() = 0;
diff --git a/engines/hpl1/engine/graphics/Mesh.h b/engines/hpl1/engine/graphics/Mesh.h
index 3445e279301..6d083ae32ca 100644
--- a/engines/hpl1/engine/graphics/Mesh.h
+++ b/engines/hpl1/engine/graphics/Mesh.h
@@ -319,9 +319,9 @@ public:
cNode3D *GetNode(int alIdx);
// Resources implementation
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
private:
cMaterialManager *mpMaterialManager;
diff --git a/engines/hpl1/engine/graphics/ParticleSystem3D.h b/engines/hpl1/engine/graphics/ParticleSystem3D.h
index 687c7382c07..caf95e3e950 100644
--- a/engines/hpl1/engine/graphics/ParticleSystem3D.h
+++ b/engines/hpl1/engine/graphics/ParticleSystem3D.h
@@ -53,9 +53,9 @@ public:
void AddEmitterData(iParticleEmitterData *apData);
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
iParticleEmitterData *GetEmitterData(int alIdx) const { return mvEmitterData[alIdx]; }
diff --git a/engines/hpl1/engine/graphics/Texture.h b/engines/hpl1/engine/graphics/Texture.h
index b466d5f4613..b207a83251b 100644
--- a/engines/hpl1/engine/graphics/Texture.h
+++ b/engines/hpl1/engine/graphics/Texture.h
@@ -103,9 +103,9 @@ public:
void SetSizeLevel(unsigned int alLevel) { mlSizeLevel = alLevel; }
void SetMinLevelSize(const cVector2l &avSize) { mvMinLevelSize = avSize; }
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
/**
* Create a texture from a bitmap, work only for 1D, 2D and Rect targets. Doesn't work with render targets.
diff --git a/engines/hpl1/engine/graphics/VideoStream.h b/engines/hpl1/engine/graphics/VideoStream.h
index a86390b4a37..55cce5504f3 100644
--- a/engines/hpl1/engine/graphics/VideoStream.h
+++ b/engines/hpl1/engine/graphics/VideoStream.h
@@ -80,9 +80,9 @@ public:
//////////////////////////////////
// ResourceBase implementation
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
protected:
tString msFilePath;
diff --git a/engines/hpl1/engine/graphics/font_data.cpp b/engines/hpl1/engine/graphics/font_data.cpp
new file mode 100644
index 00000000000..de96b7cb8e6
--- /dev/null
+++ b/engines/hpl1/engine/graphics/font_data.cpp
@@ -0,0 +1,407 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2010 - Frictional Games
+ *
+ * This file is part of HPL1 Engine.
+ */
+
+#include "hpl1/engine/graphics/font_data.h"
+#include <stdarg.h>
+#include <stdlib.h>
+
+#include "hpl1/engine/system/low_level_system.h"
+
+#include "hpl1/engine/graphics/GfxObject.h"
+#include "hpl1/engine/graphics/GraphicsDrawer.h"
+
+#include "hpl1/engine/resources/ResourceImage.h"
+#include "hpl1/engine/impl/tinyXML/tinyxml.h"
+
+#include "hpl1/engine/gui/Gui.h"
+#include "hpl1/engine/gui/GuiGfxElement.h"
+#include "hpl1/debug.h"
+#include "hpl1/string.h"
+#include "common/ptr.h"
+#include "common/array.h"
+#include "common/rect.h"
+
+
+namespace hpl {
+
+using BitmapArray = Common::Array<Common::SharedPtr<Bitmap2D>>;
+
+Glyph::Glyph(cGfxObject *apObject, cGuiGfxElement *apGuiGfx, const cVector2f &avOffset,
+ const cVector2f &avSize, float afAdvance) {
+ _gfxObject = apObject;
+ _guiGfx = apGuiGfx;
+ _offset = avOffset;
+ _size = avSize;
+ _advance = afAdvance;
+}
+
+Glyph::~Glyph() {
+ if (_gfxObject)
+ hplDelete(_gfxObject);
+ if (_guiGfx)
+ hplDelete(_guiGfx);
+}
+
+FontData::FontData(const tString &asName, iLowLevelGraphics *apLowLevelGraphics)
+ : iResourceBase(asName, 0) {
+ _lowLevelGraphics = apLowLevelGraphics;
+}
+
+FontData::~FontData() {
+ for (int i = 0; i < (int)_glyphs.size(); i++) {
+ if (_glyphs[i])
+ hplDelete(_glyphs[i]);
+ }
+}
+
+static Common::ScopedPtr<TiXmlDocument> loadFontXML(const Common::String &filepath) {
+ Common::ScopedPtr<TiXmlDocument> doc(new TiXmlDocument(filepath.c_str()));
+ if (!doc->LoadFile(filepath.c_str())) {
+ debugCN(Hpl1::kDebugLevelError, Hpl1::kDebugResourceLoading,
+ "Couldn't load font file at: %s", filepath.c_str());
+ return nullptr;
+ }
+ return doc;
+}
+
+cVector2l loadXMLCommon(const TiXmlElement *commonElement, uint16 &firstChar, uint16 &lastchar, float &height, cVector2f &sizeRatio) {
+ int lineHeight = Hpl1::stoi(commonElement->Attribute("lineHeight"));
+ int base = Hpl1::stoi(commonElement->Attribute("base"));
+ firstChar = 0;
+ lastchar = 3000; //engine max
+ height = static_cast<float>(lineHeight);
+ sizeRatio.x = static_cast<float>(base) / height;
+ sizeRatio.y = 1;
+ return {base, lineHeight};
+}
+
+bool loadNextBitmap(BitmapArray &bitmaps, const Common::String &file, const Common::String &fontDir, LowLevelResources *resources) {
+ Common::String bitmapPath = fontDir + file;
+ Common::SharedPtr<Bitmap2D> bitmap(resources->loadBitmap2D(bitmapPath.c_str()));
+ if (bitmap == nullptr) {
+ debugCN(Hpl1::kDebugLevelError, Hpl1::kDebugResourceLoading,
+ "Couldn't load bitmap %s", file.c_str());
+ return false;
+ }
+ bitmaps.push_back(bitmap);
+}
+
+bool loadBitmaps(BitmapArray &bitmaps, const TiXmlElement *pagesRoot, const Common::String &fontDir, LowLevelResources *resources) {
+ bitmaps.reserve(3000); //engine max
+ const TiXmlElement *pageIt = pagesRoot->FirstChildElement("page");
+ for(; pageIt != nullptr; pageIt = pageIt->NextSiblingElement("page")) {
+ if (!loadNextBitmap(bitmaps, pageIt->Attribute("file"), fontDir, resources))
+ return false;
+ }
+}
+
+void FontData::loadNextGlyph(const TiXmlElement *charIt, BitmapArray &bitmaps, const cVector2l &fontSize) {
+ int id = Hpl1::stoi(charIt->Attribute("id"));
+ int x = Hpl1::stoi(charIt->Attribute("x"));
+ int y = Hpl1::stoi(charIt->Attribute("y"));
+ int w = Hpl1::stoi(charIt->Attribute("width"));
+ int h = Hpl1::stoi(charIt->Attribute("height"));
+ int xOffset = Hpl1::stoi(charIt->Attribute("xoffset"));
+ int yOffset = Hpl1::stoi(charIt->Attribute("yoffset"));
+ int advance = Hpl1::stoi(charIt->Attribute("xadvance"));
+ int page = Hpl1::stoi(charIt->Attribute("page"));
+
+ cVector2l size(w, h);
+ Bitmap2D &src = *bitmaps[page];
+ Bitmap2D charBmp(size, src.format());
+ src.drawToBitmap(charBmp, {0,0}, Common::Rect(x, y, x + w, y + h));
+
+ _glyphs[id] = createGlyph(&charBmp, {xOffset, yOffset}, {w, h}, fontSize, advance);
+}
+
+void FontData::loadGlyphs(const TiXmlElement *charsRoot, BitmapArray &bitmaps, const cVector2l &fontSize) {
+ const TiXmlElement *charIt = charsRoot->FirstChildElement("char");
+ _glyphs.resize(3000, nullptr);
+ for(; charIt != nullptr; charIt = charIt->NextSiblingElement("char"))
+ loadNextGlyph(charIt, bitmaps, fontSize);
+}
+
+bool FontData::createFromBitmapFile(const tString &file) {
+ //FIXME: string types
+ Common::String filename = file.c_str();
+ Common::ScopedPtr<TiXmlDocument> xmlDoc = loadFontXML(filename);
+ if (!xmlDoc)
+ return false;
+ TiXmlElement *xmlRoot = xmlDoc->RootElement();
+ const cVector2l fontsize = loadXMLCommon(xmlRoot->FirstChildElement("common"), _firstChar, _lastChar, _height, _sizeRatio);
+ BitmapArray bitmaps;
+ if (!loadBitmaps(bitmaps, xmlRoot->FirstChildElement("pages"), Hpl1::fileDir(filename), _lowLevelResources))
+ return false;
+ loadGlyphs(xmlRoot->FirstChildElement("chars"), bitmaps, fontsize);
+ return true;
+}
+
+bool FontData::createFromFontFile(const tString &asFileName, int alSize, unsigned short alFirstChar,
+ unsigned short alLastChar) {
+ error("call to unimplemented function FontData::CreateFromFontFile");
+}
+
+void FontData::draw(const cVector3f &avPos, const cVector2f &avSize, const cColor &aCol,
+ eFontAlign aAlign, const wchar_t *fmt, ...) {
+ wchar_t sText[256];
+ va_list ap;
+ if (fmt == NULL)
+ return;
+ va_start(ap, fmt);
+ vswprintf(sText, 255, fmt, ap);
+ va_end(ap);
+
+ int lCount = 0;
+ float lXAdd = 0;
+ cVector3f vPos = avPos;
+
+ if (aAlign == eFontAlign_Center) {
+ vPos.x -= getLength(avSize, sText) / 2;
+ } else if (aAlign == eFontAlign_Right) {
+ vPos.x -= getLength(avSize, sText);
+ }
+
+ while (sText[lCount] != 0) {
+ wchar_t lGlyphNum = ((wchar_t)sText[lCount]);
+ if (lGlyphNum < _firstChar || lGlyphNum > _lastChar) {
+ lCount++;
+ continue;
+ }
+ lGlyphNum -= _firstChar;
+
+ Glyph *pGlyph = _glyphs[lGlyphNum];
+ if (pGlyph) {
+ cVector2f vOffset(pGlyph->_offset * avSize);
+ cVector2f vSize(pGlyph->_size * avSize);
+
+ _graphicsDrawer->DrawGfxObject(pGlyph->_gfxObject, vPos + vOffset, vSize, aCol);
+
+ vPos.x += pGlyph->_advance * avSize.x;
+ }
+ lCount++;
+ }
+}
+
+int FontData::drawWordWrap(cVector3f avPos, float afLength, float afFontHeight, cVector2f avSize, const cColor &aCol,
+ eFontAlign aAlign, const tWString &asString) {
+ int rows = 0;
+
+ unsigned int pos;
+ unsigned int first_letter = 0;
+ unsigned int last_space = 0;
+
+ tUIntList RowLengthList;
+
+ float fTextLength;
+
+ for (pos = 0; pos < asString.size(); pos++) {
+ if (asString[pos] == _W(' ') || asString[pos] == _W('\n')) {
+ tWString temp = asString.substr(first_letter, pos - first_letter);
+ fTextLength = getLength(avSize, temp.c_str());
+
+ bool nothing = true;
+ if (fTextLength > afLength) {
+ rows++;
+ RowLengthList.push_back(last_space);
+ first_letter = last_space + 1;
+ last_space = pos;
+ nothing = false;
+ }
+ if (asString[pos] == _W('\n')) {
+ last_space = pos;
+ first_letter = last_space + 1;
+ RowLengthList.push_back(last_space - 1);
+ rows++;
+ nothing = false;
+ }
+ if (nothing) {
+ last_space = pos;
+ }
+ }
+ }
+ tWString temp = asString.substr(first_letter, pos - first_letter);
+ fTextLength = getLength(avSize, temp.c_str());
+ if (fTextLength > afLength) {
+ rows++;
+ RowLengthList.push_back(last_space);
+ }
+
+ if (rows == 0) {
+ draw(avPos, avSize, aCol, aAlign, _W("%ls"), asString.c_str());
+ } else {
+ first_letter = 0;
+ unsigned int i = 0;
+
+ for (tUIntListIt it = RowLengthList.begin(); it != RowLengthList.end(); ++it) {
+ draw(cVector3f(avPos.x, avPos.y + i * afFontHeight, avPos.z), avSize, aCol, aAlign,
+ _W("%ls"), asString.substr(first_letter, *it - first_letter).c_str());
+ i++;
+ first_letter = *it + 1;
+ }
+ draw(cVector3f(avPos.x, avPos.y + i * afFontHeight, avPos.z), avSize, aCol, aAlign,
+ _W("%ls"), asString.substr(first_letter).c_str());
+ }
+
+ return rows;
+}
+
+void FontData::getWordWrapRows(float afLength, float afFontHeight, cVector2f avSize,
+ const tWString &asString, tWStringVec *apRowVec) {
+ int rows = 0;
+
+ unsigned int pos;
+ unsigned int first_letter = 0;
+ unsigned int last_space = 0;
+
+ tUIntList RowLengthList;
+
+ float fTextLength;
+
+ for (pos = 0; pos < asString.size(); pos++) {
+ // Log("char: %d\n",(char)asString[pos]);
+ if (asString[pos] == _W(' ') || asString[pos] == _W('\n')) {
+ tWString temp = asString.substr(first_letter, pos - first_letter);
+ fTextLength = getLength(avSize, temp.c_str());
+
+ // Log("r:%d p:%d f:%d l:%d Temp:'%s'\n",rows,pos,first_letter,last_space,
+ // temp.c_str());
+ bool nothing = true;
+ if (fTextLength > afLength) {
+ rows++;
+ RowLengthList.push_back(last_space);
+ first_letter = last_space + 1;
+ last_space = pos;
+ nothing = false;
+ }
+ if (asString[pos] == _W('\n')) {
+ last_space = pos;
+ first_letter = last_space + 1;
+ RowLengthList.push_back(last_space);
+ rows++;
+ nothing = false;
+ }
+ if (nothing) {
+ last_space = pos;
+ }
+ }
+ }
+ tWString temp = asString.substr(first_letter, pos - first_letter);
+ fTextLength = getLength(avSize, temp.c_str());
+ if (fTextLength > afLength) {
+ rows++;
+ RowLengthList.push_back(last_space);
+ }
+
+ if (rows == 0) {
+ apRowVec->push_back(asString.c_str());
+ } else {
+ first_letter = 0;
+ unsigned int i = 0;
+
+ for (tUIntListIt it = RowLengthList.begin(); it != RowLengthList.end(); ++it) {
+ apRowVec->push_back(asString.substr(first_letter, *it - first_letter).c_str());
+ i++;
+ first_letter = *it + 1;
+ }
+ apRowVec->push_back(asString.substr(first_letter).c_str());
+ }
+}
+
+float FontData::getLength(const cVector2f &avSize, const wchar_t *sText) {
+ int lCount = 0;
+ float lXAdd = 0;
+ float fLength = 0;
+ while (sText[lCount] != 0) {
+ unsigned short lGlyphNum = ((wchar_t)sText[lCount]);
+ if (lGlyphNum < _firstChar || lGlyphNum > _lastChar) {
+ lCount++;
+ continue;
+ }
+ lGlyphNum -= _firstChar;
+
+ Glyph *pGlyph = _glyphs[lGlyphNum];
+ if (pGlyph) {
+ cVector2f vOffset(pGlyph->_offset * avSize);
+ cVector2f vSize(pGlyph->_size * avSize);
+
+ fLength += pGlyph->_advance * avSize.x;
+ }
+ lCount++;
+ }
+
+ return fLength;
+}
+
+float FontData::getLengthFmt(const cVector2f &avSize, const wchar_t *fmt, ...) {
+ wchar_t sText[256];
+ va_list ap;
+ if (fmt == NULL)
+ return 0;
+ va_start(ap, fmt);
+ vswprintf(sText, 255, fmt, ap);
+ va_end(ap);
+
+ return getLength(avSize, sText);
+}
+
+Glyph *FontData::createGlyph(Bitmap2D *apBmp, const cVector2l &avOffset, const cVector2l &avSize,
+ const cVector2l &avFontSize, int alAdvance) {
+ // Here the bitmap should be saved to diskk for faster loading.
+
+ //////////////////////////
+ // Gfx object
+ cGfxObject *pObject = _graphicsDrawer->CreateGfxObject(apBmp, "fontnormal", false);
+
+ //////////////////////////
+ // Gui gfx
+ cGuiGfxElement *pGuiGfx = _gui->CreateGfxFilledRect(cColor(1, 1), eGuiMaterial_FontNormal, false);
+ cResourceImage *pImage = pObject->GetMaterial()->GetImage(eMaterialTexture_Diffuse);
+ pImage->IncUserCount();
+ pGuiGfx->AddImage(pImage);
+
+ //////////////////////////
+ // Sizes
+ cVector2f vSize;
+ vSize.x = ((float)avSize.x) / ((float)avFontSize.x) * _sizeRatio.x;
+ vSize.y = ((float)avSize.y) / ((float)avFontSize.y) * _sizeRatio.y;
+
+ cVector2f vOffset;
+ vOffset.x = ((float)avOffset.x) / ((float)avFontSize.x);
+ vOffset.y = ((float)avOffset.y) / ((float)avFontSize.y);
+
+ float fAdvance = ((float)alAdvance) / ((float)avFontSize.x) * _sizeRatio.x;
+
+ Glyph *pGlyph = hplNew(Glyph, (pObject, pGuiGfx, vOffset, vSize, fAdvance));
+
+ return pGlyph;
+}
+
+void FontData::addGlyph(Glyph *apGlyph) {
+ _glyphs.push_back(apGlyph);
+}
+
+} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/FontData.h b/engines/hpl1/engine/graphics/font_data.h
similarity index 55%
rename from engines/hpl1/engine/graphics/FontData.h
rename to engines/hpl1/engine/graphics/font_data.h
index 133be71ffe7..182c3944299 100644
--- a/engines/hpl1/engine/graphics/FontData.h
+++ b/engines/hpl1/engine/graphics/font_data.h
@@ -33,8 +33,12 @@
#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/ResourceBase.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "common/array.h"
+#include "common/ptr.h"
#include <vector>
+class TiXmlElement;
+
namespace hpl {
class ImageManager;
@@ -45,46 +49,44 @@ class Bitmap2D;
class cGuiGfxElement;
class cGui;
-//------------------------------------------------
-
-class cGlyph {
+class Glyph {
public:
- cGlyph(cGfxObject *apObject, cGuiGfxElement *apGuiGfx, const cVector2f &avOffset,
+ Glyph(cGfxObject *apObject, cGuiGfxElement *apGuiGfx, const cVector2f &avOffset,
const cVector2f &avSize, float afAdvance);
- ~cGlyph();
+ ~Glyph();
- cGfxObject *mpGfxObject;
- cGuiGfxElement *mpGuiGfx;
- cVector2f mvOffset;
- cVector2f mvSize;
- float mfAdvance;
+ cGfxObject *_gfxObject;
+ cGuiGfxElement *_guiGfx;
+ cVector2f _offset;
+ cVector2f _size;
+ float _advance;
};
-typedef std::vector<cGlyph *> tGlyphVec;
+typedef std::vector<Glyph *> tGlyphVec;
typedef tGlyphVec::iterator tGlyphVecIt;
-class iFontData : public iResourceBase {
+class FontData : public iResourceBase {
public:
- iFontData(const tString &asName, iLowLevelGraphics *apLowLevelGraphics);
- ~iFontData();
+ FontData(const tString &asName, iLowLevelGraphics *apLowLevelGraphics);
+ ~FontData();
- virtual bool CreateFromFontFile(const tString &asFileName, int alSize, unsigned short alFirstChar,
- unsigned short alLastChar) = 0;
+ bool createFromFontFile(const tString &asFileName, int alSize, unsigned short alFirstChar,
+ unsigned short alLastChar);
- virtual bool CreateFromBitmapFile(const tString &asFileName) = 0;
+ bool createFromBitmapFile(const tString &asFileName);
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
/**
* Used internally
*/
- void SetUp(cGraphicsDrawer *apGraphicsDrawer, LowLevelResources *apLowLevelResources,
+ void setUp(cGraphicsDrawer *apGraphicsDrawer, LowLevelResources *apLowLevelResources,
cGui *apGui) {
- mpGraphicsDrawer = apGraphicsDrawer;
- mpLowLevelResources = apLowLevelResources;
- mpGui = apGui;
+ _graphicsDrawer = apGraphicsDrawer;
+ _lowLevelResources = apLowLevelResources;
+ _gui = apGui;
}
/**
@@ -92,12 +94,12 @@ public:
* \param alNum
* \return
*/
- inline cGlyph *GetGlyph(int alNum) const { return mvGlyphs[alNum]; }
+ inline Glyph *getGlyph(int alNum) const { return _glyphs[alNum]; }
- inline unsigned short GetFirstChar() { return mlFirstChar; }
- inline unsigned short GetLastChar() { return mlLastChar; }
+ inline unsigned short getFirstChar() { return _firstChar; }
+ inline unsigned short getLastChar() { return _lastChar; }
- inline const cVector2f &GetSizeRatio() const { return mvSizeRatio; }
+ inline const cVector2f &getSizeRatio() const { return _sizeRatio; }
/**
* Draw a string.
@@ -108,7 +110,7 @@ public:
* \param fmt
* \param ...
*/
- void Draw(const cVector3f &avPos, const cVector2f &avSize, const cColor &aCol, eFontAlign mAlign,
+ void draw(const cVector3f &avPos, const cVector2f &avSize, const cColor &aCol, eFontAlign mAlign,
const wchar_t *fmt, ...);
/**
* Draw a string with word wrap.
@@ -121,51 +123,53 @@ public:
* \param asString
* \return Extra number of rows generated.
*/
- int DrawWordWrap(cVector3f avPos, float afLength, float afFontHeight, cVector2f avSize, const cColor &aCol,
+ int drawWordWrap(cVector3f avPos, float afLength, float afFontHeight, cVector2f avSize, const cColor &aCol,
eFontAlign aAlign, const tWString &asString);
- void GetWordWrapRows(float afLength, float afFontHeight, cVector2f avSize, const tWString &asString,
+ void getWordWrapRows(float afLength, float afFontHeight, cVector2f avSize, const tWString &asString,
tWStringVec *apRowVec);
/**
* Get height of the font.
* \return
*/
- inline float GetHeight() const { return mfHeight; }
+ inline float getHeight() const { return _height; }
/**
- * Get the length in virtual screen size "pixels" of a formated string
+ * Get the length in screen size "pixels" of a formated string
* \param avSize size of the characters
* \param fmt
* \param ...
* \return
*/
- float GetLengthFmt(const cVector2f &avSize, const wchar_t *fmt, ...);
+ float getLengthFmt(const cVector2f &avSize, const wchar_t *fmt, ...);
/**
- * Get the length in virtual screen size "pixels" of a string
+ * Get the length in screen size "pixels" of a string
* \param avSize size of the characters
* \param sText
* \return
*/
- float GetLength(const cVector2f &avSize, const wchar_t *sText);
+ float getLength(const cVector2f &avSize, const wchar_t *sText);
-protected:
- iLowLevelGraphics *mpLowLevelGraphics;
- LowLevelResources *mpLowLevelResources;
- cGraphicsDrawer *mpGraphicsDrawer;
- cGui *mpGui;
+private:
+ iLowLevelGraphics *_lowLevelGraphics;
+ LowLevelResources *_lowLevelResources;
+ cGraphicsDrawer *_graphicsDrawer;
+ cGui *_gui;
- tGlyphVec mvGlyphs;
+ tGlyphVec _glyphs;
- float mfHeight;
- unsigned short mlFirstChar;
- unsigned short mlLastChar;
+ float _height;
+ unsigned short _firstChar;
+ unsigned short _lastChar;
- cVector2f mvSizeRatio;
+ cVector2f _sizeRatio;
- cGlyph *CreateGlyph(Bitmap2D *apBmp, const cVector2l &avOffset, const cVector2l &avSize,
+ Glyph *createGlyph(Bitmap2D *apBmp, const cVector2l &avOffset, const cVector2l &avSize,
const cVector2l &avFontSize, int alAdvance);
- void AddGlyph(cGlyph *apGlyph);
+ void addGlyph(Glyph *apGlyph);
+ void loadGlyphs(const TiXmlElement *charsRoot, Common::Array<Common::SharedPtr<Bitmap2D>> &bitmaps, const cVector2l &fontSize);
+ void loadNextGlyph(const TiXmlElement *charIt, Common::Array<Common::SharedPtr<Bitmap2D>> &bitmaps, const cVector2l &fontSize);
};
}; // namespace hpl
diff --git a/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp b/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
index 7e00c63a6b5..f20ab984ca5 100644
--- a/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
+++ b/engines/hpl1/engine/gui/GuiPopUpMessageBox.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/graphics/FontData.h"
+#include "hpl1/engine/graphics/font_data.h"
#include "hpl1/engine/gui/Gui.h"
#include "hpl1/engine/gui/GuiSet.h"
@@ -61,8 +61,8 @@ cGuiPopUpMessageBox::cGuiPopUpMessageBox(cGuiSet *apSet,
cGuiSkinFont *pFont = mpSkin->GetFont(eGuiSkinFont_Default);
- float fWindowMinLength = pFont->mpFont->GetLength(pFont->mvSize, asLabel.c_str());
- float fTextLength = pFont->mpFont->GetLength(pFont->mvSize, asText.c_str());
+ float fWindowMinLength = pFont->mpFont->getLength(pFont->mvSize, asLabel.c_str());
+ float fTextLength = pFont->mpFont->getLength(pFont->mvSize, asText.c_str());
if (fTextLength > fWindowMinLength)
fWindowMinLength = fTextLength;
diff --git a/engines/hpl1/engine/gui/GuiSet.cpp b/engines/hpl1/engine/gui/GuiSet.cpp
index fbcbc78805c..6904c0fba3d 100644
--- a/engines/hpl1/engine/gui/GuiSet.cpp
+++ b/engines/hpl1/engine/gui/GuiSet.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
-#include "hpl1/engine/graphics/FontData.h"
+#include "hpl1/engine/graphics/font_data.h"
#include "hpl1/engine/graphics/Graphics.h"
#include "hpl1/engine/graphics/LowLevelGraphics.h"
@@ -373,7 +373,7 @@ void cGuiSet::DrawGfx(cGuiGfxElement *apGfx, const cVector3f &avPos, const cVect
//-----------------------------------------------------------------------
void cGuiSet::DrawFont(const tWString &asText,
- iFontData *apFont, const cVector3f &avPos,
+ FontData *apFont, const cVector3f &avPos,
const cVector2f &avSize, const cColor &aColor,
eFontAlign aAlign, eGuiMaterial aMaterial) {
int lCount = 0;
@@ -381,28 +381,28 @@ void cGuiSet::DrawFont(const tWString &asText,
cVector3f vPos = avPos;
if (aAlign == eFontAlign_Center) {
- vPos.x -= apFont->GetLength(avSize, asText.c_str()) / 2;
+ vPos.x -= apFont->getLength(avSize, asText.c_str()) / 2;
} else if (aAlign == eFontAlign_Right) {
- vPos.x -= apFont->GetLength(avSize, asText.c_str());
+ vPos.x -= apFont->getLength(avSize, asText.c_str());
}
while (asText[lCount] != 0) {
wchar_t lGlyphNum = ((wchar_t)asText[lCount]);
- if (lGlyphNum < apFont->GetFirstChar() ||
- lGlyphNum > apFont->GetLastChar()) {
+ if (lGlyphNum < apFont->getFirstChar() ||
+ lGlyphNum > apFont->getLastChar()) {
lCount++;
continue;
}
- lGlyphNum -= apFont->GetFirstChar();
+ lGlyphNum -= apFont->getFirstChar();
- cGlyph *pGlyph = apFont->GetGlyph(lGlyphNum);
+ Glyph *pGlyph = apFont->getGlyph(lGlyphNum);
if (pGlyph) {
- cVector2f vOffset(pGlyph->mvOffset * avSize);
- cVector2f vSize(pGlyph->mvSize * avSize); // *apFont->GetSizeRatio());
+ cVector2f vOffset(pGlyph->_offset * avSize);
+ cVector2f vSize(pGlyph->_size * avSize); // *apFont->GetSizeRatio());
- DrawGfx(pGlyph->mpGuiGfx, vPos + vOffset, vSize, aColor, aMaterial);
+ DrawGfx(pGlyph->_guiGfx, vPos + vOffset, vSize, aColor, aMaterial);
- vPos.x += pGlyph->mfAdvance * avSize.x;
+ vPos.x += pGlyph->_advance * avSize.x;
}
lCount++;
}
diff --git a/engines/hpl1/engine/gui/GuiSet.h b/engines/hpl1/engine/gui/GuiSet.h
index f9dd18e9753..8bc36050e62 100644
--- a/engines/hpl1/engine/gui/GuiSet.h
+++ b/engines/hpl1/engine/gui/GuiSet.h
@@ -41,7 +41,7 @@ class cGraphics;
class cSound;
class cScene;
-class iFontData;
+class FontData;
class cGui;
class cGuiSkin;
@@ -136,7 +136,7 @@ public:
const cColor &aColor = cColor(1, 1),
eGuiMaterial aMaterial = eGuiMaterial_LastEnum);
void DrawFont(const tWString &asText,
- iFontData *apFont, const cVector3f &avPos,
+ FontData *apFont, const cVector3f &avPos,
const cVector2f &avSize, const cColor &aColor,
eFontAlign aAlign = eFontAlign_Left,
eGuiMaterial aMaterial = eGuiMaterial_FontNormal);
diff --git a/engines/hpl1/engine/gui/GuiSkin.h b/engines/hpl1/engine/gui/GuiSkin.h
index b288aaf2b7d..99489d58e95 100644
--- a/engines/hpl1/engine/gui/GuiSkin.h
+++ b/engines/hpl1/engine/gui/GuiSkin.h
@@ -36,7 +36,7 @@ namespace hpl {
class cGui;
class cGuiGfxElement;
-class iFontData;
+class FontData;
class iGuiMaterial;
//-------------------------------------
@@ -46,7 +46,7 @@ public:
cGuiSkinFont(cGui *apGui);
~cGuiSkinFont();
- iFontData *mpFont;
+ FontData *mpFont;
cVector2f mvSize;
cColor mColor;
iGuiMaterial *mpMaterial;
diff --git a/engines/hpl1/engine/gui/Widget.h b/engines/hpl1/engine/gui/Widget.h
index a9486201af7..c663c9f7961 100644
--- a/engines/hpl1/engine/gui/Widget.h
+++ b/engines/hpl1/engine/gui/Widget.h
@@ -43,7 +43,7 @@ class cGuiSkinFont;
class cGuiGfxElement;
class cGuiClipRegion;
-class iFontData;
+class FontData;
//--------------------------------
@@ -111,8 +111,8 @@ public:
void SetText(const tWString &asText);
const tWString &GetText() { return msText; }
- iFontData *GetDefaultFontType() { return mpDefaultFontType; }
- void SetDefaultFontType(iFontData *apFont) { mpDefaultFontType = apFont; }
+ FontData *GetDefaultFontType() { return mpDefaultFontType; }
+ void SetDefaultFontType(FontData *apFont) { mpDefaultFontType = apFont; }
const cColor &GetDefaultFontColor() { return mDefaultFontColor; }
void SetDefaultFontColor(const cColor &aColor) { mDefaultFontColor = aColor; }
@@ -210,7 +210,7 @@ protected:
int mlPositionCount;
cGuiSkinFont *mpDefaultFont;
- iFontData *mpDefaultFontType;
+ FontData *mpDefaultFontType;
cColor mDefaultFontColor;
cVector2f mvDefaultFontSize;
diff --git a/engines/hpl1/engine/gui/WidgetButton.cpp b/engines/hpl1/engine/gui/WidgetButton.cpp
index f1a87858332..f29d1f292c8 100644
--- a/engines/hpl1/engine/gui/WidgetButton.cpp
+++ b/engines/hpl1/engine/gui/WidgetButton.cpp
@@ -38,7 +38,7 @@
#include "hpl1/engine/gui/GuiSet.h"
#include "hpl1/engine/gui/GuiSkin.h"
-#include "hpl1/engine/graphics/FontData.h"
+#include "hpl1/engine/graphics/font_data.h"
namespace hpl {
diff --git a/engines/hpl1/engine/gui/WidgetLabel.cpp b/engines/hpl1/engine/gui/WidgetLabel.cpp
index f140e1716fa..6a0f0ca940c 100644
--- a/engines/hpl1/engine/gui/WidgetLabel.cpp
+++ b/engines/hpl1/engine/gui/WidgetLabel.cpp
@@ -30,7 +30,7 @@
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
-#include "hpl1/engine/graphics/FontData.h"
+#include "hpl1/engine/graphics/font_data.h"
#include "hpl1/engine/math/Math.h"
@@ -103,7 +103,7 @@ void cWidgetLabel::OnDraw(float afTimeStep, cGuiClipRegion *apClipRegion) {
bool bEnabled = IsEnabled();
float fHeight = mvDefaultFontSize.y + 2;
tWStringVec vRows;
- mpDefaultFontType->GetWordWrapRows(mvSize.x, fHeight,
+ mpDefaultFontType->getWordWrapRows(mvSize.x, fHeight,
mvDefaultFontSize, msText,
&vRows);
diff --git a/engines/hpl1/engine/gui/WidgetSlider.cpp b/engines/hpl1/engine/gui/WidgetSlider.cpp
index 2265bdaad40..22b96efe097 100644
--- a/engines/hpl1/engine/gui/WidgetSlider.cpp
+++ b/engines/hpl1/engine/gui/WidgetSlider.cpp
@@ -40,7 +40,7 @@
#include "hpl1/engine/gui/WidgetButton.h"
-#include "hpl1/engine/graphics/FontData.h"
+#include "hpl1/engine/graphics/font_data.h"
namespace hpl {
diff --git a/engines/hpl1/engine/gui/WidgetTextBox.cpp b/engines/hpl1/engine/gui/WidgetTextBox.cpp
index ca81cf61bdb..c30ba364a19 100644
--- a/engines/hpl1/engine/gui/WidgetTextBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetTextBox.cpp
@@ -31,7 +31,7 @@
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/graphics/FontData.h"
+#include "hpl1/engine/graphics/font_data.h"
#include "hpl1/engine/system/String.h"
@@ -141,17 +141,17 @@ void cWidgetTextBox::SetCanEdit(bool abX) {
int cWidgetTextBox::GetLastCharInSize(int alStartPos, float afMaxSize, float afLengthAdd) {
int lCharPos = (int)msText.size();
float fLength = 0;
- int lFirst = mpDefaultFontType->GetFirstChar();
- int lLast = mpDefaultFontType->GetLastChar();
+ int lFirst = mpDefaultFontType->getFirstChar();
+ int lLast = mpDefaultFontType->getLastChar();
for (int i = alStartPos; i < (int)msText.size(); ++i) {
if (i < lFirst || i > lLast)
continue;
- cGlyph *pGlyph = mpDefaultFontType->GetGlyph(msText[i] - lFirst);
+ Glyph *pGlyph = mpDefaultFontType->getGlyph(msText[i] - lFirst);
if (pGlyph == NULL)
continue;
- fLength += pGlyph->mfAdvance * mvDefaultFontSize.x;
+ fLength += pGlyph->_advance * mvDefaultFontSize.x;
if (fLength + afLengthAdd >= afMaxSize) {
lCharPos = i;
break;
@@ -166,17 +166,17 @@ int cWidgetTextBox::GetLastCharInSize(int alStartPos, float afMaxSize, float afL
int cWidgetTextBox::GetFirstCharInSize(int alStartPos, float afMaxSize, float afLengthAdd) {
int lCharPos = 0;
float fLength = 0;
- int lFirst = mpDefaultFontType->GetFirstChar();
- int lLast = mpDefaultFontType->GetLastChar();
+ int lFirst = mpDefaultFontType->getFirstChar();
+ int lLast = mpDefaultFontType->getLastChar();
for (int i = alStartPos; i >= 0; --i) {
if (i < lFirst || i > lLast)
continue;
- cGlyph *pGlyph = mpDefaultFontType->GetGlyph(msText[i] - lFirst);
+ Glyph *pGlyph = mpDefaultFontType->getGlyph(msText[i] - lFirst);
if (pGlyph == NULL)
continue;
- fLength += pGlyph->mfAdvance * mvDefaultFontSize.x;
+ fLength += pGlyph->_advance * mvDefaultFontSize.x;
if (fLength + afLengthAdd >= afMaxSize) {
lCharPos = i;
break;
@@ -207,7 +207,7 @@ int cWidgetTextBox::WorldToCharPos(const cVector2f &avWorldPos) {
float cWidgetTextBox::CharToLocalPos(int alChar) {
float fMarkerPos = -2;
if (alChar > 0 && alChar - mlFirstVisibleChar > 0) {
- fMarkerPos = mpDefaultFontType->GetLength(mvDefaultFontSize,
+ fMarkerPos = mpDefaultFontType->getLength(mvDefaultFontSize,
cString::SubW(msText, mlFirstVisibleChar, alChar - mlFirstVisibleChar).c_str());
}
return fMarkerPos;
@@ -569,13 +569,13 @@ bool cWidgetTextBox::OnKeyPress(cGuiMessageData &aData) {
//////////////////////////////////
// Character
else {
- int lFirstFontChar = mpDefaultFontType->GetFirstChar();
- int lLastFontChar = mpDefaultFontType->GetLastChar();
+ int lFirstFontChar = mpDefaultFontType->getFirstChar();
+ int lLastFontChar = mpDefaultFontType->getLastChar();
wchar_t unicode = aData.mKeyPress.mlUnicode;
// Check so press is valid
if (unicode >= lFirstFontChar && unicode <= lLastFontChar &&
- mpDefaultFontType->GetGlyph(unicode - lFirstFontChar)) {
+ mpDefaultFontType->getGlyph(unicode - lFirstFontChar)) {
if (mlSelectedTextEnd < 0) {
if (mlMaxCharacters == -1 || (int)msText.size() < mlMaxCharacters) {
SetText(cString::SubW(msText, 0, mlMarkerCharPos) + unicode +
diff --git a/engines/hpl1/engine/impl/CGProgram.cpp b/engines/hpl1/engine/impl/CGProgram.cpp
index 742a157841f..769ddab24e4 100644
--- a/engines/hpl1/engine/impl/CGProgram.cpp
+++ b/engines/hpl1/engine/impl/CGProgram.cpp
@@ -111,18 +111,18 @@ cCGProgram::~cCGProgram() {
//-----------------------------------------------------------------------
-bool cCGProgram::Reload() {
+bool cCGProgram::reload() {
return false;
}
//-----------------------------------------------------------------------
-void cCGProgram::Unload() {
+void cCGProgram::unload() {
}
//-----------------------------------------------------------------------
-void cCGProgram::Destroy() {
+void cCGProgram::destroy() {
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/CGProgram.h b/engines/hpl1/engine/impl/CGProgram.h
index 495895a09b2..5c90465dd6f 100644
--- a/engines/hpl1/engine/impl/CGProgram.h
+++ b/engines/hpl1/engine/impl/CGProgram.h
@@ -48,9 +48,9 @@ public:
cCGProgram(tString asName, CGcontext aContext, eGpuProgramType aType);
~cCGProgram();
- bool Reload();
- void Unload();
- void Destroy();
+ bool reload();
+ void unload();
+ void destroy();
tString GetProgramName() { return msName; }
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 127a802bfa5..36b66fac0bb 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -37,13 +37,13 @@
#include <assert.h>
#include <stdlib.h>
-#include "hpl1/engine/graphics/FontData.h"
+#include "hpl1/engine/graphics/font_data.h"
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
//#include "graphics/opengl/glad.h"
#include "hpl1/engine/impl/CGProgram.h"
#include "hpl1/engine/graphics/bitmap2D.h"
-#include "hpl1/engine/impl/SDLFontData.h"
+#include "hpl1/engine/graphics/font_data.h"
#include "hpl1/engine/impl/SDLTexture.h"
#include "hpl1/engine/impl/VertexBufferOGL.h"
#include "hpl1/engine/impl/VertexBufferVBO.h"
@@ -628,8 +628,8 @@ Bitmap2D *cLowLevelGraphicsSDL::CreateBitmap2D(const cVector2l &avSize, unsigned
//-----------------------------------------------------------------------
-iFontData *cLowLevelGraphicsSDL::CreateFontData(const tString &asName) {
- return hplNew(cSDLFontData, (asName, this));
+FontData *cLowLevelGraphicsSDL::CreateFontData(const tString &asName) {
+ return hplNew(FontData, (asName, this));
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
index ae4241ae29d..cb1997a144b 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
@@ -88,7 +88,7 @@ public:
void SetVirtualSize(cVector2f avSize);
Bitmap2D *CreateBitmap2D(const cVector2l &avSize, unsigned int alBpp);
- iFontData *CreateFontData(const tString &asName);
+ FontData *CreateFontData(const tString &asName);
iTexture *CreateTexture(bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
iTexture *CreateTexture(const tString &asName, bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
diff --git a/engines/hpl1/engine/impl/SDLFontData.cpp b/engines/hpl1/engine/impl/SDLFontData.cpp
deleted file mode 100644
index 9f2255372cd..00000000000
--- a/engines/hpl1/engine/impl/SDLFontData.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#include "hpl1/engine/impl/SDLFontData.h"
-#include "hpl1/engine/graphics/GraphicsDrawer.h"
-#include "hpl1/engine/graphics/bitmap2D.h"
-#include "hpl1/engine/impl/tinyXML/tinyxml.h"
-#include "hpl1/engine/system/low_level_system.h"
-
-namespace hpl {
-
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cSDLFontData::cSDLFontData(const tString &asName, iLowLevelGraphics *apLowLevelGraphics)
- : iFontData(asName, apLowLevelGraphics) {
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-bool cSDLFontData::CreateFromBitmapFile(const tString &asFileName) {
-#if 0
- tString sPath = cString::GetFilePath(asFileName);
-
- ////////////////////////////////////////////
- // Load xml file
- TiXmlDocument *pXmlDoc = hplNew( TiXmlDocument,(asFileName.c_str()) );
-
- if(pXmlDoc->LoadFile()==false)
- {
- Error("Couldn't load angle code font file '%s'\n",asFileName.c_str());
- hplDelete(pXmlDoc);
- return false;
- }
-
- TiXmlElement *pRootElem = pXmlDoc->RootElement();
-
- ////////////////////////////////////////////
- // Load Common info
- TiXmlElement *pCommonElem = pRootElem->FirstChildElement("common");
-
- int lLineHeight = cString::ToInt(pCommonElem->Attribute("lineHeight"),0);
- int lBase = cString::ToInt(pCommonElem->Attribute("base"),0);
-
- mlFirstChar =0;
- mlLastChar = 3000; //Get this num from something.
-
- mfHeight = (float)lLineHeight;
-
- mvGlyphs.resize(3000, NULL);
-
- mvSizeRatio.x = (float)lBase / (float)lLineHeight;
- mvSizeRatio.y = 1;
-
- ////////////////////////////////////////////
- // Load bitmaps
- std::vector<Bitmap2D *> vBitmaps;
-
- TiXmlElement *pPagesRootElem = pRootElem->FirstChildElement("pages");
-
- TiXmlElement *pPageElem = pPagesRootElem->FirstChildElement("page");
- for(; pPageElem != NULL; pPageElem = pPageElem->NextSiblingElement("page"))
- {
- tString sFileName = pPageElem->Attribute("file");
- tString sFilePath = cString::SetFilePath(sFileName,sPath);
-
- Bitmap2D *pBitmap = static_cast<Bitmap2D*>(mpLowLevelResources->LoadBitmap2D(sFilePath));
- if(pBitmap==NULL)
- {
- Error("Couldn't load bitmap %s for FNT file '%s'\n",sFilePath.c_str(),asFileName.c_str());
- hplDelete(pXmlDoc);
- return false;
- }
-
- vBitmaps.push_back(pBitmap);
- }
-
- ////////////////////////////////////////////
- // Load glyphs
- TiXmlElement *pCharsRootElem = pRootElem->FirstChildElement("chars");
-
- TiXmlElement *pCharElem = pCharsRootElem->FirstChildElement("char");
- for(; pCharElem != NULL; pCharElem = pCharElem->NextSiblingElement("char"))
- {
- //Get the info on the character
- int lId = cString::ToInt(pCharElem->Attribute("id"),0);
- int lX = cString::ToInt(pCharElem->Attribute("x"),0);
- int lY = cString::ToInt(pCharElem->Attribute("y"),0);
-
- int lW = cString::ToInt(pCharElem->Attribute("width"),0);
- int lH = cString::ToInt(pCharElem->Attribute("height"),0);
-
- int lXOffset = cString::ToInt(pCharElem->Attribute("xoffset"),0);
- int lYOffset = cString::ToInt(pCharElem->Attribute("yoffset"),0);
-
- int lAdvance = cString::ToInt(pCharElem->Attribute("xadvance"),0);
-
- int lPage = cString::ToInt(pCharElem->Attribute("page"),0);
-
- //Get the bitmap where the character graphics is
- Bitmap2D *pSourceBitmap = vBitmaps[lPage];
-
- //Create a bitmap for the character.
- cVector2l vSize(lW, lH);
- Bitmap2D *pBmp = static_cast<Bitmap2D*>(mpLowLevelGraphics->CreateBitmap2D(vSize,32));
-
- //Copy from source to character bitmap
- SDL_Rect srcRect;
- srcRect.x = lX; srcRect.y = lY;
- srcRect.w = lW; srcRect.h = lH;
- SDL_BlitSurface(pSourceBitmap->GetSurface(),&srcRect, pBmp->GetSurface(), NULL);
-
- int lBmpSize = pBmp->GetSurface()->format->BytesPerPixel;
- unsigned char* PixBuffer = (unsigned char*)pBmp->GetSurface()->pixels;
-
- //Set proper alpha (dunno if this is needed)
- for(unsigned int y=0;y<pBmp->GetHeight();y++)
- for(unsigned int x=0;x<pBmp->GetWidth();x++) {
- unsigned char* Pix = &PixBuffer[y*pBmp->GetWidth()*lBmpSize + x*lBmpSize];
- Pix[3] = Pix[0];
- }
-
- //Create glyph and place it correctly.
- cGlyph *pGlyph = CreateGlyph(pBmp,cVector2l(lXOffset,lYOffset),cVector2l(lW,lH),
- cVector2l(lBase,lLineHeight),lAdvance);
-
- mvGlyphs[lId] = pGlyph;
-
- hplDelete(pBmp);
- }
-
-
-
- //Destroy bitmaps
- STLDeleteAll(vBitmaps);
-
- //Destroy XML
- hplDelete(pXmlDoc);
- return true;
-#endif
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-bool cSDLFontData::CreateFromFontFile(const tString &asFileName, int alSize, unsigned short alFirstChar,
- unsigned short alLastChar) {
-#if 0
- cGlyph* pGlyph=NULL;
-
- mlFirstChar = alFirstChar;
- mlLastChar = alLastChar;
-
- TTF_Font* pFont = TTF_OpenFont(asFileName.c_str(), alSize);
- if(pFont==NULL){
- Error("Error when opening '%s': %s\n",asFileName.c_str(),TTF_GetError());
- return false;
- }
-
- //Create bitmaps from all of the characters and create
- //Images from those.
- for(int i=alFirstChar; i<=alLastChar;i++)
- {
- unsigned short lUniCode = i;
- /*char c = (char)i;
-
- if(c == '�')lUniCode = 'o';
- else if(c == '�')lUniCode = 'O';*/
-
- pGlyph = RenderGlyph(pFont, lUniCode, alSize);
- AddGlyph(pGlyph);
- }
-
- //Get the properties
- mfHeight = (float)TTF_FontHeight(pFont);
-
- mvSizeRatio = 1;
-
- //Cleanup
- TTF_CloseFont(pFont);
-
- return true;
-#endif
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PRIVATE METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cGlyph *cSDLFontData::RenderGlyph(TTF_Font *apFont, unsigned short aChar, int alFontSize) {
-#if 0
- //If the font is saved to disk, then load the bitmap from disk instead.
-
- cVector2l vMin;
- cVector2l vMax;
- int lAdvance=0;
-
- TTF_GlyphMetrics(apFont, aChar, &vMin.x, &vMax.x, &vMin.y, &vMax.y, &lAdvance);
-
- //Create the bitmap we want to draw upon
- cVector2l vSize = vMax - vMin;
- Bitmap2D *pBmp = static_cast<Bitmap2D*>(mpLowLevelGraphics->CreateBitmap2D(vSize,32));
-
- pBmp->FillRect(cRect2l(),cColor(0,1));
-
- //create a surface with the glyph
- SDL_Color Col;Col.r=255;Col.g=255;Col.b=255;
- SDL_Surface* pGlyphSurface = TTF_RenderGlyph_Blended(apFont,aChar,Col);
-
- //Blit the surface using blending. This way it should create a nice
- //b&w image where the font is white.
- SDL_SetAlpha(pBmp->GetSurface(),0,0);
- SDL_SetAlpha(pGlyphSurface,SDL_SRCALPHA,0);
- SDL_BlitSurface(pGlyphSurface, NULL, pBmp->GetSurface(),NULL);
- SDL_SetAlpha(pBmp->GetSurface(),0,0);
-
- //Set the alpha of the bitmap to the average color.
- //So we get some alpha bledning.
- int lBmpSize = pBmp->GetSurface()->format->BytesPerPixel;
- unsigned char* PixBuffer = (unsigned char*)pBmp->GetSurface()->pixels;
-
- for(unsigned int y=0;y<pBmp->GetHeight();y++)
- for(unsigned int x=0;x<pBmp->GetWidth();x++)
- {
- unsigned char* Pix = &PixBuffer[y*pBmp->GetWidth()*lBmpSize +
- x*lBmpSize];
-
- Pix[3] = Pix[0];
- }
-
- //Create the Glyph
- int lHeight = TTF_FontHeight(apFont);
- cVector2l vOffset = cVector2l(vMin.x, alFontSize - vMax.y);//(lHeight - vSize.y) - vMin.y);
-
- cGlyph* pGlyph = CreateGlyph(pBmp,vOffset,vSize,alFontSize,lAdvance);
-
- hplDelete(pBmp);
- SDL_FreeSurface(pGlyphSurface);
-
- return pGlyph;
-#endif
- return {};
-}
-
-//-----------------------------------------------------------------------
-
-} // namespace hpl
diff --git a/engines/hpl1/engine/impl/SDLFontData.h b/engines/hpl1/engine/impl/SDLFontData.h
deleted file mode 100644
index bb275bf40d2..00000000000
--- a/engines/hpl1/engine/impl/SDLFontData.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_SDL_FONTDATA_H
-#define HPL_SDL_FONTDATA_H
-
-#include "hpl1/engine/graphics/FontData.h"
-
-//#include <SDL/SDL.h>
-//#include <SDL/SDL_ttf.h>
-#include "temp-types.h"
-
-namespace hpl {
-
-class cSDLFontData : public iFontData {
-public:
- cSDLFontData(const tString &asName, iLowLevelGraphics *apLowLevelGraphics);
- cSDLFontData();
-
- bool CreateFromFontFile(const tString &asFileName, int alSize, unsigned short alFirstChar,
- unsigned short alLastChar);
- bool CreateFromBitmapFile(const tString &asFileName);
-
-private:
- cGlyph *RenderGlyph(TTF_Font *apFont, unsigned short aChar, int alFontSize);
-};
-
-}; // namespace hpl
-#endif // HPL_FONTDATA_H
diff --git a/engines/hpl1/engine/resources/FontManager.cpp b/engines/hpl1/engine/resources/FontManager.cpp
index f5851965176..b2c17aa607e 100644
--- a/engines/hpl1/engine/resources/FontManager.cpp
+++ b/engines/hpl1/engine/resources/FontManager.cpp
@@ -33,7 +33,7 @@
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/resources/ImageManager.h"
-#include "hpl1/engine/graphics/FontData.h"
+#include "hpl1/engine/graphics/font_data.h"
namespace hpl {
@@ -67,30 +67,30 @@ namespace hpl {
//-----------------------------------------------------------------------
- iFontData* cFontManager::CreateFontData(const tString& asName, int alSize,unsigned short alFirstChar,
+ FontData* cFontManager::CreateFontData(const tString& asName, int alSize,unsigned short alFirstChar,
unsigned short alLastChar)
{
tString sPath;
- iFontData* pFont;
+ FontData* pFont;
tString asNewName = cString::ToLowerCase(asName);
BeginLoad(asName);
//asNewName = cString::SetFileExt(asName,"ttf");
- pFont = static_cast<iFontData*>(this->FindLoadedResource(asNewName,sPath));
+ pFont = static_cast<FontData*>(this->FindLoadedResource(asNewName,sPath));
if(pFont==NULL && sPath!="")
{
pFont = mpGraphics->GetLowLevel()->CreateFontData(asNewName);
- pFont->SetUp(mpGraphics->GetDrawer(),mpLowLevelResources,mpGui);
+ pFont->setUp(mpGraphics->GetDrawer(),mpLowLevelResources,mpGui);
tString sExt = cString::ToLowerCase(cString::GetFileExt(asName));
//True Type Font
if(sExt == "ttf")
{
- if(pFont->CreateFromFontFile(sPath,alSize,alFirstChar,alLastChar)==false){
+ if(pFont->createFromFontFile(sPath,alSize,alFirstChar,alLastChar)==false){
hplDelete(pFont);
EndLoad();
return NULL;
@@ -99,7 +99,7 @@ namespace hpl {
//Angel code font type
else if(sExt == "fnt")
{
- if(pFont->CreateFromBitmapFile(sPath)==false){
+ if(pFont->createFromBitmapFile(sPath)==false){
hplDelete(pFont);
EndLoad();
return NULL;
diff --git a/engines/hpl1/engine/resources/FontManager.h b/engines/hpl1/engine/resources/FontManager.h
index d26fa657c4e..e6c36b916b5 100644
--- a/engines/hpl1/engine/resources/FontManager.h
+++ b/engines/hpl1/engine/resources/FontManager.h
@@ -35,7 +35,7 @@ namespace hpl {
class cGraphics;
class cResources;
class cGui;
-class iFontData;
+class FontData;
class cFontManager : public iResourceManager {
public:
@@ -51,7 +51,7 @@ public:
* \param alLastChar last ASCII character to be rendered
* \return
*/
- iFontData *CreateFontData(const tString &asName, int alSize = 16, unsigned short alFirstChar = 32,
+ FontData *CreateFontData(const tString &asName, int alSize = 16, unsigned short alFirstChar = 32,
unsigned short alLastChar = 255);
void Destroy(iResourceBase *apResource);
diff --git a/engines/hpl1/engine/resources/ResourceBase.h b/engines/hpl1/engine/resources/ResourceBase.h
index 038144c8431..9ab5b23f7b3 100644
--- a/engines/hpl1/engine/resources/ResourceBase.h
+++ b/engines/hpl1/engine/resources/ResourceBase.h
@@ -44,17 +44,17 @@ public:
* virtual bool Reload()=0;
* \return true is reload was succesful, else false.
*/
- virtual bool Reload() = 0;
+ virtual bool reload() = 0;
/**
* Free most the memory, save info to get started again.
*/
- virtual void Unload() = 0;
+ virtual void unload() = 0;
/**
* Free all memory.
*/
- virtual void Destroy() = 0;
+ virtual void destroy() = 0;
tString GetName() { return msName; }
unsigned long GetHandle() { return mlHandle; }
diff --git a/engines/hpl1/engine/resources/ResourceImage.cpp b/engines/hpl1/engine/resources/ResourceImage.cpp
index ae9bc6fa03d..cd75c11f429 100644
--- a/engines/hpl1/engine/resources/ResourceImage.cpp
+++ b/engines/hpl1/engine/resources/ResourceImage.cpp
@@ -113,18 +113,18 @@ tVertexVec cResourceImage::GetVertexVecCopy(const cVector2f &avPos, const cVecto
//-----------------------------------------------------------------------
-bool cResourceImage::Reload() {
+bool cResourceImage::reload() {
return false;
}
//-----------------------------------------------------------------------
-void cResourceImage::Unload() {
+void cResourceImage::unload() {
}
//-----------------------------------------------------------------------
-void cResourceImage::Destroy() {
+void cResourceImage::destroy() {
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/resources/ResourceImage.h b/engines/hpl1/engine/resources/ResourceImage.h
index da330c924e5..4e32122341d 100644
--- a/engines/hpl1/engine/resources/ResourceImage.h
+++ b/engines/hpl1/engine/resources/ResourceImage.h
@@ -50,9 +50,9 @@ public:
cRect2l aRect,
cVector2l avSrcSize, int alHandle);
- bool Reload();
- void Unload();
- void Destroy();
+ bool reload();
+ void unload();
+ void destroy();
// Image specific
int GetHeight() const { return mRect.h; }
diff --git a/engines/hpl1/engine/scene/TileSet.h b/engines/hpl1/engine/scene/TileSet.h
index d82134e69dd..867b04b5467 100644
--- a/engines/hpl1/engine/scene/TileSet.h
+++ b/engines/hpl1/engine/scene/TileSet.h
@@ -51,9 +51,9 @@ public:
~cTileSet();
// resource stuff:
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
void Add(iTileData *apData);
iTileData *Get(int alNum);
diff --git a/engines/hpl1/engine/sound/SoundData.h b/engines/hpl1/engine/sound/SoundData.h
index 409958923b7..a16f3712607 100644
--- a/engines/hpl1/engine/sound/SoundData.h
+++ b/engines/hpl1/engine/sound/SoundData.h
@@ -53,9 +53,9 @@ public:
void SetLoopStream(bool abX) { mbLoopStream = abX; }
bool GetLoopStream() { return mbLoopStream; }
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
void SetSoundManager(cSoundManager *apSoundManager) {
mpSoundManger = apSoundManager;
diff --git a/engines/hpl1/engine/sound/SoundEntityData.h b/engines/hpl1/engine/sound/SoundEntityData.h
index 0acd0de6794..3d6838920b6 100644
--- a/engines/hpl1/engine/sound/SoundEntityData.h
+++ b/engines/hpl1/engine/sound/SoundEntityData.h
@@ -82,9 +82,9 @@ public:
int GetPriority() { return mlPriority; }
// Resource implementation
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
protected:
tString msMainSound;
diff --git a/engines/hpl1/engine/system/Script.h b/engines/hpl1/engine/system/Script.h
index 4e86e224857..7cf0c6a30d9 100644
--- a/engines/hpl1/engine/system/Script.h
+++ b/engines/hpl1/engine/system/Script.h
@@ -232,9 +232,9 @@ public:
iScript(const tString &asName) : iResourceBase(asName, 0) {}
virtual ~iScript() {}
- bool Reload() { return false; }
- void Unload() {}
- void Destroy() {}
+ bool reload() { return false; }
+ void unload() {}
+ void destroy() {}
virtual bool CreateFromFile(const tString &asFile) = 0;
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index faddef872ed..277b0f78e35 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -23,7 +23,7 @@ MODULE_OBJS := \
engine/graphics/Bone.o \
engine/graphics/BoneState.o \
engine/graphics/Color.o \
- engine/graphics/FontData.o \
+ engine/graphics/font_data.o \
engine/graphics/GPUProgram.o \
engine/graphics/GfxObject.o \
engine/graphics/Graphics.o \
@@ -117,7 +117,6 @@ MODULE_OBJS := \
engine/impl/PhysicsJointSliderNewton.o \
engine/impl/PhysicsMaterialNewton.o \
engine/impl/PhysicsWorldNewton.o \
- engine/impl/SDLFontData.o \
engine/impl/SDLTexture.o \
engine/impl/SqScript.o \
engine/impl/VertexBufferOGL.o \
diff --git a/engines/hpl1/penumbra-overture/CharacterMove.cpp b/engines/hpl1/penumbra-overture/CharacterMove.cpp
index 3f671583687..cf027c6dcf9 100644
--- a/engines/hpl1/penumbra-overture/CharacterMove.cpp
+++ b/engines/hpl1/penumbra-overture/CharacterMove.cpp
@@ -542,7 +542,7 @@ void cCharacterMove::OnDraw(cInit *apInit) {
"Break: %f",mfCurrentBreak);*/
if (mbMoving)
- apInit->mpDefaultFont->Draw(cVector3f(5, 79, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
+ apInit->mpDefaultFont->draw(cVector3f(5, 79, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
_W("NodeDistAvg: %f"), mfNodeDistAvg);
/*apInit->mpDefaultFont->Draw(cVector3f(5,64,100),14,cColor(1,1,1,1),eFontAlign_Left,
diff --git a/engines/hpl1/penumbra-overture/Credits.cpp b/engines/hpl1/penumbra-overture/Credits.cpp
index 33e6662b1a3..7c548996563 100644
--- a/engines/hpl1/penumbra-overture/Credits.cpp
+++ b/engines/hpl1/penumbra-overture/Credits.cpp
@@ -55,7 +55,7 @@ cCredits::cCredits(cInit *apInit) : iUpdateable("Credits") {
// Load text
tWString sText = kTranslate("MainMenu", "CreditsText");
- mpFont->GetWordWrapRows(750, 19, 17, sText, &mvTextRows);
+ mpFont->getWordWrapRows(750, 19, 17, sText, &mvTextRows);
Reset();
}
@@ -108,10 +108,10 @@ void cCredits::OnDraw() {
fAlpha = (2 - fAlpha);
if (lSize == 0)
- mpFont->Draw(cVector3f(400, fY, 10), fSize[lSize], cColor(1, fAlpha), eFontAlign_Center,
+ mpFont->draw(cVector3f(400, fY, 10), fSize[lSize], cColor(1, fAlpha), eFontAlign_Center,
mvTextRows[i].c_str());
else
- mpFont->Draw(cVector3f(400, fY, 10), fSize[lSize], cColor(0.8f, fAlpha), eFontAlign_Center,
+ mpFont->draw(cVector3f(400, fY, 10), fSize[lSize], cColor(0.8f, fAlpha), eFontAlign_Center,
mvTextRows[i].substr(1).c_str());
}
fY += fSize[lSize];
diff --git a/engines/hpl1/penumbra-overture/Credits.h b/engines/hpl1/penumbra-overture/Credits.h
index 79094bb9a0c..9733b7ab55a 100644
--- a/engines/hpl1/penumbra-overture/Credits.h
+++ b/engines/hpl1/penumbra-overture/Credits.h
@@ -65,7 +65,7 @@ private:
cInit *mpInit;
cGraphicsDrawer *mpDrawer;
- iFontData *mpFont;
+ FontData *mpFont;
tWStringVec mvTextRows;
float mfYPos;
diff --git a/engines/hpl1/penumbra-overture/DeathMenu.cpp b/engines/hpl1/penumbra-overture/DeathMenu.cpp
index e2af6962b0a..be3384e4568 100644
--- a/engines/hpl1/penumbra-overture/DeathMenu.cpp
+++ b/engines/hpl1/penumbra-overture/DeathMenu.cpp
@@ -52,7 +52,7 @@ cDeathMenuButton::cDeathMenuButton(cInit *apInit, cVector2f avPos, const tWStrin
mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
- mRect.w = mpFont->GetLength(mvFontSize, msText.c_str());
+ mRect.w = mpFont->getLength(mvFontSize, msText.c_str());
mRect.h = mvFontSize.y + 3;
mRect.x = avPos.x - mRect.w / 2;
mRect.y = avPos.y + 3;
@@ -84,9 +84,9 @@ void cDeathMenuButton::OnUpdate(float afTimeStep) {
void cDeathMenuButton::OnDraw() {
float fAlpha = mpInit->mpDeathMenu->mfAlpha;
- mpFont->Draw(mvPositon, mvFontSize, cColor(0.8f, 0.7f, 0.7f, fAlpha), eFontAlign_Center, msText.c_str());
+ mpFont->draw(mvPositon, mvFontSize, cColor(0.8f, 0.7f, 0.7f, fAlpha), eFontAlign_Center, msText.c_str());
- mpFont->Draw(mvPositon + cVector3f(0, 0, 1), mvFontSize, cColor(1, 0, 0, fAlpha * mfAlpha), eFontAlign_Center, msText.c_str());
+ mpFont->draw(mvPositon + cVector3f(0, 0, 1), mvFontSize, cColor(1, 0, 0, fAlpha * mfAlpha), eFontAlign_Center, msText.c_str());
}
//-----------------------------------------------------------------------
@@ -199,7 +199,7 @@ void cDeathMenu::OnDraw() {
mpDrawer->DrawGfxObject(mpGfxBackground, cVector3f(0, 0, 0), cVector2f(800, 600), cColor(1, mfAlpha));
- mpFont->DrawWordWrap(cVector3f(400, 210, 40), 500, 25, 24, cColor(0.7f, 0.3f, 0.3f), eFontAlign_Center,
+ mpFont->drawWordWrap(cVector3f(400, 210, 40), 500, 25, 24, cColor(0.7f, 0.3f, 0.3f), eFontAlign_Center,
kTranslate("DeathMenu", "YouAreDead").c_str());
////////////////////////////////
diff --git a/engines/hpl1/penumbra-overture/DeathMenu.h b/engines/hpl1/penumbra-overture/DeathMenu.h
index 005b4d13eb1..3df38c5be40 100644
--- a/engines/hpl1/penumbra-overture/DeathMenu.h
+++ b/engines/hpl1/penumbra-overture/DeathMenu.h
@@ -62,7 +62,7 @@ protected:
cVector3f mvPositon;
cRect2f mRect;
- iFontData *mpFont;
+ FontData *mpFont;
cVector2f mvFontSize;
tWString msText;
@@ -133,7 +133,7 @@ private:
bool mbActive;
float mfAlpha;
- iFontData *mpFont;
+ FontData *mpFont;
cVector2f mvMousePos;
diff --git a/engines/hpl1/penumbra-overture/DemoEndText.h b/engines/hpl1/penumbra-overture/DemoEndText.h
index 8657d643540..6873b6b1366 100644
--- a/engines/hpl1/penumbra-overture/DemoEndText.h
+++ b/engines/hpl1/penumbra-overture/DemoEndText.h
@@ -61,7 +61,7 @@ private:
cInit *mpInit;
cGraphicsDrawer *mpDrawer;
- iFontData *mpFont;
+ FontData *mpFont;
bool mbActive;
diff --git a/engines/hpl1/penumbra-overture/EffectHandler.cpp b/engines/hpl1/penumbra-overture/EffectHandler.cpp
index 7ab1f95d651..64e92669a9a 100644
--- a/engines/hpl1/penumbra-overture/EffectHandler.cpp
+++ b/engines/hpl1/penumbra-overture/EffectHandler.cpp
@@ -671,11 +671,11 @@ void cEffect_SubTitle::OnDraw() {
float fAlpha = subTitle.mfAlpha * (1 - mpInit->mpInventory->GetAlpha());
if (subTitle.mbActive) {
- mpFont->DrawWordWrap(cVector3f(25, 500, 47), 750, 16, 15, cColor(1, fAlpha),
+ mpFont->drawWordWrap(cVector3f(25, 500, 47), 750, 16, 15, cColor(1, fAlpha),
eFontAlign_Left, subTitle.msMessage);
- mpFont->DrawWordWrap(cVector3f(25, 500, 46) + cVector3f(1, 1, 0), 750, 16, 15, cColor(0, fAlpha),
+ mpFont->drawWordWrap(cVector3f(25, 500, 46) + cVector3f(1, 1, 0), 750, 16, 15, cColor(0, fAlpha),
eFontAlign_Left, subTitle.msMessage);
- mpFont->DrawWordWrap(cVector3f(25, 500, 46) + cVector3f(-1, -1, 0), 750, 16, 15, cColor(0, fAlpha),
+ mpFont->drawWordWrap(cVector3f(25, 500, 46) + cVector3f(-1, -1, 0), 750, 16, 15, cColor(0, fAlpha),
eFontAlign_Left, subTitle.msMessage);
}
}
diff --git a/engines/hpl1/penumbra-overture/EffectHandler.h b/engines/hpl1/penumbra-overture/EffectHandler.h
index 62c64772fc0..944d5632827 100644
--- a/engines/hpl1/penumbra-overture/EffectHandler.h
+++ b/engines/hpl1/penumbra-overture/EffectHandler.h
@@ -232,7 +232,7 @@ private:
cInit *mpInit;
cGraphicsDrawer *mpDrawer;
- iFontData *mpFont;
+ FontData *mpFont;
tSubTitleList mlstSubTitles;
};
diff --git a/engines/hpl1/penumbra-overture/GameEnemy.cpp b/engines/hpl1/penumbra-overture/GameEnemy.cpp
index 67496cefc45..489e5428e89 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy.cpp
@@ -596,10 +596,10 @@ void iGameEnemy::OnDraw() {
if (mbActive == false)
return;
if (mbCanSeePlayer) {
- mpInit->mpDefaultFont->Draw(cVector3f(5, 15, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
+ mpInit->mpDefaultFont->draw(cVector3f(5, 15, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
_W("Player is seen!"));
} else {
- mpInit->mpDefaultFont->Draw(cVector3f(5, 15, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
+ mpInit->mpDefaultFont->draw(cVector3f(5, 15, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
_W("Can NOT see player..."));
}
// mpInit->mpDefaultFont->Draw(cVector3f(5,29,100),14,cColor(1,1,1,1),eFontAlign_Left,
@@ -608,13 +608,13 @@ void iGameEnemy::OnDraw() {
tWString sStateName = _W("NONE");
if (mlCurrentState >= 0)
sStateName = cString::To16Char(gvStateName[mlCurrentState]);
- mpInit->mpDefaultFont->Draw(cVector3f(5, 48, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
+ mpInit->mpDefaultFont->draw(cVector3f(5, 48, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
_W("Health: %f State: %ls Moving: %d Stuck: %f MaxViewDist: %f"), mfHealth,
sStateName.c_str(),
mpMover->IsMoving(),
mpMover->GetStuckCounter(),
gfCurrentMaxViewDist);
- mpInit->mpDefaultFont->Draw(cVector3f(5, 64, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
+ mpInit->mpDefaultFont->draw(cVector3f(5, 64, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
_W("Speed: %f"), mpMover->GetCharBody()->GetMoveSpeed(eCharDir_Forward));
mpMover->OnDraw(mpInit);
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp b/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
index 1e5cb43e811..36268e06a48 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
@@ -864,7 +864,7 @@ void cGameEnemyState_Dog_Hunt::OnDraw() {
float fDist = mpMover->DistanceToChar2D(mpPlayer->GetCharacterBody());
- mpInit->mpDefaultFont->Draw(cVector3f(0, 110, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
+ mpInit->mpDefaultFont->draw(cVector3f(0, 110, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
_W("LostPlayerCount: %f FreePath: %d NoPath: %d MaxStuck: %d Dist: %f / %f"),
mfLostPlayerCount, mbFreePlayerPath,
mbFoundNoPath,
diff --git a/engines/hpl1/penumbra-overture/GameMessageHandler.cpp b/engines/hpl1/penumbra-overture/GameMessageHandler.cpp
index b7122f8b3ea..b73148f76f5 100644
--- a/engines/hpl1/penumbra-overture/GameMessageHandler.cpp
+++ b/engines/hpl1/penumbra-overture/GameMessageHandler.cpp
@@ -95,24 +95,24 @@ void cGameMessage::Update(float afTimeStep) {
//-----------------------------------------------------------------------
-void cGameMessage::Draw(iFontData *apFont) {
+void cGameMessage::Draw(FontData *apFont) {
if (mbActive == false)
return;
float fSide = 30;
if (mpMessHandler->mbBlackText) {
- apFont->DrawWordWrap(cVector3f(fSide, 300, 152), 800 - fSide * 2, 16, 14, cColor(0, mfFade),
+ apFont->drawWordWrap(cVector3f(fSide, 300, 152), 800 - fSide * 2, 16, 14, cColor(0, mfFade),
eFontAlign_Left, msText);
} else {
- apFont->DrawWordWrap(cVector3f(fSide, 300, 152), 800 - fSide * 2, 16, 14, cColor(1, 1, 1, mfFade),
+ apFont->drawWordWrap(cVector3f(fSide, 300, 152), 800 - fSide * 2, 16, 14, cColor(1, 1, 1, mfFade),
eFontAlign_Left, msText);
- apFont->DrawWordWrap(cVector3f(fSide, 300, 151) + cVector3f(1, 1, -1), 800 - fSide * 2, 16, 14, cColor(0, 0, 0, mfFade),
+ apFont->drawWordWrap(cVector3f(fSide, 300, 151) + cVector3f(1, 1, -1), 800 - fSide * 2, 16, 14, cColor(0, 0, 0, mfFade),
eFontAlign_Left, msText);
- apFont->DrawWordWrap(cVector3f(fSide, 300, 151) + cVector3f(-1, -1, -1), 800 - fSide * 2, 16, 14, cColor(0, 0, 0, mfFade),
+ apFont->drawWordWrap(cVector3f(fSide, 300, 151) + cVector3f(-1, -1, -1), 800 - fSide * 2, 16, 14, cColor(0, 0, 0, mfFade),
eFontAlign_Left, msText);
- apFont->DrawWordWrap(cVector3f(fSide, 300, 151) + cVector3f(1, -1, -1), 800 - fSide * 2, 16, 14, cColor(0, 0, 0, mfFade),
+ apFont->drawWordWrap(cVector3f(fSide, 300, 151) + cVector3f(1, -1, -1), 800 - fSide * 2, 16, 14, cColor(0, 0, 0, mfFade),
eFontAlign_Left, msText);
- apFont->DrawWordWrap(cVector3f(fSide, 300, 151) + cVector3f(-1, 1, -1), 800 - fSide * 2, 16, 14, cColor(0, 0, 0, mfFade),
+ apFont->drawWordWrap(cVector3f(fSide, 300, 151) + cVector3f(-1, 1, -1), 800 - fSide * 2, 16, 14, cColor(0, 0, 0, mfFade),
eFontAlign_Left, msText);
}
}
diff --git a/engines/hpl1/penumbra-overture/GameMessageHandler.h b/engines/hpl1/penumbra-overture/GameMessageHandler.h
index 6eb847f4455..161341b232c 100644
--- a/engines/hpl1/penumbra-overture/GameMessageHandler.h
+++ b/engines/hpl1/penumbra-overture/GameMessageHandler.h
@@ -42,7 +42,7 @@ public:
cGameMessage(const tWString &asText, cGameMessageHandler *apMessHandler);
void Update(float afTimeStep);
- void Draw(iFontData *apFont);
+ void Draw(FontData *apFont);
bool mbActive;
@@ -86,7 +86,7 @@ public:
private:
cInit *mpInit;
- iFontData *mpFont;
+ FontData *mpFont;
ePlayerState mLastState;
tString msOverCallback;
diff --git a/engines/hpl1/penumbra-overture/GraphicsHelper.cpp b/engines/hpl1/penumbra-overture/GraphicsHelper.cpp
index e1881d67ad9..5bf60bdfab5 100644
--- a/engines/hpl1/penumbra-overture/GraphicsHelper.cpp
+++ b/engines/hpl1/penumbra-overture/GraphicsHelper.cpp
@@ -108,7 +108,7 @@ void cGraphicsHelper::DrawLoadingScreen(const tString &asFile) {
if (pTex)
DrawTexture(pTex, cVector3f(0, 0, 0), cVector2f(800, 600), cColor(1, 1));
- mpFont->Draw(cVector3f(400, 300, 50), 22, cColor(1, 1), eFontAlign_Center,
+ mpFont->draw(cVector3f(400, 300, 50), 22, cColor(1, 1), eFontAlign_Center,
_W("%ls"), kTranslate("LoadTexts", "Loading").c_str());
mpDrawer->DrawAll();
diff --git a/engines/hpl1/penumbra-overture/GraphicsHelper.h b/engines/hpl1/penumbra-overture/GraphicsHelper.h
index 3ce7f48368b..658d77bba32 100644
--- a/engines/hpl1/penumbra-overture/GraphicsHelper.h
+++ b/engines/hpl1/penumbra-overture/GraphicsHelper.h
@@ -58,7 +58,7 @@ private:
cGraphicsDrawer *mpDrawer;
- iFontData *mpFont;
+ FontData *mpFont;
};
//---------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/Init.h b/engines/hpl1/penumbra-overture/Init.h
index 01d8de7b4ba..62a17f1190d 100644
--- a/engines/hpl1/penumbra-overture/Init.h
+++ b/engines/hpl1/penumbra-overture/Init.h
@@ -115,7 +115,7 @@ public:
cGame *mpGame;
iScript *mpGlobalScript;
- iFontData *mpDefaultFont;
+ FontData *mpDefaultFont;
// Main properties
cVector2l mvScreenSize;
diff --git a/engines/hpl1/penumbra-overture/IntroStory.cpp b/engines/hpl1/penumbra-overture/IntroStory.cpp
index dbf43edc93b..c7e1bd8e2fe 100644
--- a/engines/hpl1/penumbra-overture/IntroStory.cpp
+++ b/engines/hpl1/penumbra-overture/IntroStory.cpp
@@ -437,15 +437,15 @@ void cIntroStory::OnDraw() {
if (msCentreText != _W("")) {
float fAlpha = mvImages[5].mfBrightness;
- mpFont->Draw(cVector3f(400, 300, 2), 18, cColor(1, 1, 1, fAlpha),
+ mpFont->draw(cVector3f(400, 300, 2), 18, cColor(1, 1, 1, fAlpha),
eFontAlign_Center, msCentreText.c_str());
- mpFont->Draw(cVector3f(400 + 1, 300 + 1, 1), 18, cColor(0, fAlpha),
+ mpFont->draw(cVector3f(400 + 1, 300 + 1, 1), 18, cColor(0, fAlpha),
eFontAlign_Center, msCentreText.c_str());
- mpFont->Draw(cVector3f(400 - 1, 300 - 1, 1), 18, cColor(0, fAlpha),
+ mpFont->draw(cVector3f(400 - 1, 300 - 1, 1), 18, cColor(0, fAlpha),
eFontAlign_Center, msCentreText.c_str());
- mpFont->Draw(cVector3f(400 - 1, 300 + 1, 1), 18, cColor(0, fAlpha),
+ mpFont->draw(cVector3f(400 - 1, 300 + 1, 1), 18, cColor(0, fAlpha),
eFontAlign_Center, msCentreText.c_str());
- mpFont->Draw(cVector3f(400 + 1, 300 - 1, 1), 18, cColor(0, fAlpha),
+ mpFont->draw(cVector3f(400 + 1, 300 - 1, 1), 18, cColor(0, fAlpha),
eFontAlign_Center, msCentreText.c_str());
}
@@ -453,7 +453,7 @@ void cIntroStory::OnDraw() {
// mpFont->DrawWordWrap(vPos + cVector3f(-2,-2,-1),760,21,vSize,cColor(1,0),eFontAlign_Left,msMessage);
if (mpInit->mbSubtitles) {
- mpFont->DrawWordWrap(vPos, 760, 18, vSize, cColor(1, 1, 1, 1), eFontAlign_Left, msMessage);
+ mpFont->drawWordWrap(vPos, 760, 18, vSize, cColor(1, 1, 1, 1), eFontAlign_Left, msMessage);
}
}
diff --git a/engines/hpl1/penumbra-overture/IntroStory.h b/engines/hpl1/penumbra-overture/IntroStory.h
index 7b6606cac31..38eb4237e52 100644
--- a/engines/hpl1/penumbra-overture/IntroStory.h
+++ b/engines/hpl1/penumbra-overture/IntroStory.h
@@ -129,7 +129,7 @@ private:
float mfVoiceVol;
- iFontData *mpFont;
+ FontData *mpFont;
bool mbActive;
diff --git a/engines/hpl1/penumbra-overture/Inventory.cpp b/engines/hpl1/penumbra-overture/Inventory.cpp
index 46674201853..6e035b4088c 100644
--- a/engines/hpl1/penumbra-overture/Inventory.cpp
+++ b/engines/hpl1/penumbra-overture/Inventory.cpp
@@ -210,10 +210,10 @@ void cInventorySlot::OnDraw() {
if (pType && pType->GetString(mpItem) != _W("")) {
tWString sString = pType->GetString(mpItem);
- mpFont->Draw(vPos + cVector3f(0, 0, 1), 12, cColor(1, mpInit->mpInventory->GetAlpha()), eFontAlign_Left,
+ mpFont->draw(vPos + cVector3f(0, 0, 1), 12, cColor(1, mpInit->mpInventory->GetAlpha()), eFontAlign_Left,
sString.c_str());
} else if (mpItem->HasCount()) {
- mpFont->Draw(vPos + cVector3f(0, 0, 1), 12, cColor(1, mpInit->mpInventory->GetAlpha()), eFontAlign_Left,
+ mpFont->draw(vPos + cVector3f(0, 0, 1), 12, cColor(1, mpInit->mpInventory->GetAlpha()), eFontAlign_Left,
_W("%d"), mpItem->GetCount());
}
}
@@ -1010,9 +1010,9 @@ void cInventory::OnDraw() {
mpDrawer->DrawGfxObject(mpMessageBackground, cVector3f(0, vMessPos.y - 8, vMessPos.z - 2),
cVector2f(800, 17 * 4 + 8 * 2), cColor(1, 1, 1, fMessAlpha * 0.92f));
- mpFont->DrawWordWrap(vMessPos + cVector3f(0, 0, 0), 720, 16, 17, cColor(1, 1, 1, fMessAlpha), eFontAlign_Left,
+ mpFont->drawWordWrap(vMessPos + cVector3f(0, 0, 0), 720, 16, 17, cColor(1, 1, 1, fMessAlpha), eFontAlign_Left,
msMessage.c_str());
- mpFont->DrawWordWrap(vMessPos + cVector3f(0, 1, -1), 720, 16, 17, cColor(0, 0, 0, fMessAlpha), eFontAlign_Left,
+ mpFont->drawWordWrap(vMessPos + cVector3f(0, 1, -1), 720, 16, 17, cColor(0, 0, 0, fMessAlpha), eFontAlign_Left,
msMessage.c_str());
}
@@ -1020,14 +1020,14 @@ void cInventory::OnDraw() {
// Draw text
if (mpInit->mpRadioHandler->IsActive() == false || mpInit->mbSubtitles == false) {
float fTextAlpha = mfAlpha * mfTextAlpha * (1 - mfMessageAlpha);
- mpFont->Draw(cVector3f(400, 460, 10), 19, cColor(1, 1, 1, fTextAlpha), eFontAlign_Center,
+ mpFont->draw(cVector3f(400, 460, 10), 19, cColor(1, 1, 1, fTextAlpha), eFontAlign_Center,
_W("%ls"), msItemName.c_str());
- mpFont->Draw(cVector3f(400 + 1, 460 + 1, 9), 19, cColor(0, 0, 0, fTextAlpha), eFontAlign_Center,
+ mpFont->draw(cVector3f(400 + 1, 460 + 1, 9), 19, cColor(0, 0, 0, fTextAlpha), eFontAlign_Center,
_W("%ls"), msItemName.c_str());
- mpFont->DrawWordWrap(cVector3f(80, 480, 10), 640, 16, 17, cColor(1, 1, 1, fTextAlpha), eFontAlign_Left,
+ mpFont->drawWordWrap(cVector3f(80, 480, 10), 640, 16, 17, cColor(1, 1, 1, fTextAlpha), eFontAlign_Left,
msItemDesc.c_str());
- mpFont->DrawWordWrap(cVector3f(80 + 1, 480 + 1, 9), 640, 16, 17, cColor(0, 0, 0, fTextAlpha), eFontAlign_Left,
+ mpFont->drawWordWrap(cVector3f(80 + 1, 480 + 1, 9), 640, 16, 17, cColor(0, 0, 0, fTextAlpha), eFontAlign_Left,
msItemDesc.c_str());
}
}
diff --git a/engines/hpl1/penumbra-overture/Inventory.h b/engines/hpl1/penumbra-overture/Inventory.h
index abe86791e58..deee0a59beb 100644
--- a/engines/hpl1/penumbra-overture/Inventory.h
+++ b/engines/hpl1/penumbra-overture/Inventory.h
@@ -111,7 +111,7 @@ private:
cGfxObject *mpGfxBack;
- iFontData *mpFont;
+ FontData *mpFont;
};
typedef std::list<cInventorySlot *> tInventorySlotList;
@@ -242,7 +242,7 @@ public:
private:
cInit *mpInit;
cGraphicsDrawer *mpDrawer;
- iFontData *mpFont;
+ FontData *mpFont;
cGfxObject *mpGfxBack;
cGfxObject *mpGfxCorner11;
@@ -411,7 +411,7 @@ private:
bool mbNoteBookIsActive;
- iFontData *mpFont;
+ FontData *mpFont;
cVector2f mvMousePos;
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 39c88909141..e62ae1f1630 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -111,7 +111,7 @@ cMainMenuWidget_MainButton::cMainMenuWidget_MainButton(cInit *apInit, const cVec
mfOverTimer = 0;
mfAlpha = 0;
- mRect.w = mpFont->GetLength(mvFontSize, msText.c_str());
+ mRect.w = mpFont->getLength(mvFontSize, msText.c_str());
mRect.h = mvFontSize.y + 8;
mRect.x = avPos.x - mRect.w / 2;
mRect.y = avPos.y + 3;
@@ -158,13 +158,13 @@ void cMainMenuWidget_MainButton::OnMouseDown(eMButton aButton) {
//-----------------------------------------------------------------------
void cMainMenuWidget_MainButton::OnDraw() {
- mpFont->Draw(mvPositon, mvFontSize, cColor(0.62f + mfAlpha * 0.3f, 1), eFontAlign_Center, msText.c_str());
+ mpFont->draw(mvPositon, mvFontSize, cColor(0.62f + mfAlpha * 0.3f, 1), eFontAlign_Center, msText.c_str());
float fAdd = sin(mfOverTimer) * 16.0f;
if (mfAlpha > 0) {
- mpFont->Draw(mvPositon + cVector3f(fAdd, 0, -1), mvFontSize, cColor(0.56f, 0.35f * mfAlpha), eFontAlign_Center, msText.c_str());
- mpFont->Draw(mvPositon + cVector3f(-fAdd, 0, -1), mvFontSize, cColor(0.56f, 0.35f * mfAlpha), eFontAlign_Center, msText.c_str());
+ mpFont->draw(mvPositon + cVector3f(fAdd, 0, -1), mvFontSize, cColor(0.56f, 0.35f * mfAlpha), eFontAlign_Center, msText.c_str());
+ mpFont->draw(mvPositon + cVector3f(-fAdd, 0, -1), mvFontSize, cColor(0.56f, 0.35f * mfAlpha), eFontAlign_Center, msText.c_str());
}
}
@@ -191,7 +191,7 @@ cMainMenuWidget_Button::cMainMenuWidget_Button(cInit *apInit, const cVector3f &a
mfAlpha = 0;
mfOverTimer = 0;
- mRect.w = mpFont->GetLength(mvFontSize, msText.c_str());
+ mRect.w = mpFont->getLength(mvFontSize, msText.c_str());
mRect.h = mvFontSize.y + 3;
mRect.y = avPos.y + 3;
@@ -243,16 +243,16 @@ void cMainMenuWidget_Button::OnMouseDown(eMButton aButton) {
//-----------------------------------------------------------------------
void cMainMenuWidget_Button::OnDraw() {
- mpFont->Draw(mvPositon, mvFontSize, cColor(0.62f, 1), mAlignment, msText.c_str());
+ mpFont->draw(mvPositon, mvFontSize, cColor(0.62f, 1), mAlignment, msText.c_str());
if (mfAlpha > 0) {
float fX = 0.8f + sin(mfOverTimer) * 0.2f;
- mpFont->Draw(mvPositon + cVector3f(0, 0, 1), mvFontSize, cColor(0.9f, 0.95f, 1.0f, mfAlpha * fX), mAlignment, msText.c_str());
- mpFont->Draw(mvPositon + cVector3f(2, 2, -1), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * fX), mAlignment, msText.c_str());
- mpFont->Draw(mvPositon + cVector3f(-2, -2, -1), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * fX), mAlignment, msText.c_str());
- mpFont->Draw(mvPositon + cVector3f(3, 3, -2), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * 0.5f * fX), mAlignment, msText.c_str());
- mpFont->Draw(mvPositon + cVector3f(-3, -3, -2), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * 0.5f * fX), mAlignment, msText.c_str());
+ mpFont->draw(mvPositon + cVector3f(0, 0, 1), mvFontSize, cColor(0.9f, 0.95f, 1.0f, mfAlpha * fX), mAlignment, msText.c_str());
+ mpFont->draw(mvPositon + cVector3f(2, 2, -1), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * fX), mAlignment, msText.c_str());
+ mpFont->draw(mvPositon + cVector3f(-2, -2, -1), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * fX), mAlignment, msText.c_str());
+ mpFont->draw(mvPositon + cVector3f(3, 3, -2), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * 0.5f * fX), mAlignment, msText.c_str());
+ mpFont->draw(mvPositon + cVector3f(-3, -3, -2), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * 0.5f * fX), mAlignment, msText.c_str());
}
}
@@ -277,7 +277,7 @@ cMainMenuWidget_Text::cMainMenuWidget_Text(cInit *apInit, const cVector3f &avPos
mAlignment = aAlignment;
- mRect.w = mpFont->GetLength(mvFontSize, msText.c_str());
+ mRect.w = mpFont->getLength(mvFontSize, msText.c_str());
mRect.h = mvFontSize.y + 3;
mRect.y = avPos.y + 3;
@@ -300,14 +300,14 @@ cMainMenuWidget_Text::~cMainMenuWidget_Text() {
//-----------------------------------------------------------------------
void cMainMenuWidget_Text::UpdateSize() {
- mRect.w = mpFont->GetLength(mvFontSize, msText.c_str());
+ mRect.w = mpFont->getLength(mvFontSize, msText.c_str());
}
void cMainMenuWidget_Text::OnDraw() {
if (mfMaxWidth <= 0)
- mpFont->Draw(mvPositon, mvFontSize, cColor(0.9f, 1), mAlignment, _W("%ls"), msText.c_str());
+ mpFont->draw(mvPositon, mvFontSize, cColor(0.9f, 1), mAlignment, _W("%ls"), msText.c_str());
else
- mpFont->DrawWordWrap(mvPositon, mfMaxWidth, mvFontSize.y + 1,
+ mpFont->drawWordWrap(mvPositon, mfMaxWidth, mvFontSize.y + 1,
mvFontSize, cColor(0.9f, 1), mAlignment, msText.c_str());
}
@@ -499,12 +499,12 @@ void cMainMenuWidget_List::OnDraw() {
break;
if (mlSelected == i) {
- mpFont->Draw(vPos, mvFontSize, cColor(0.95f, 1), eFontAlign_Left, mvEntries[i].c_str());
+ mpFont->draw(vPos, mvFontSize, cColor(0.95f, 1), eFontAlign_Left, mvEntries[i].c_str());
mpDrawer->DrawGfxObject(mpBackGfx, vPos + cVector3f(0, 2, -1),
cVector2f(mvSize.x - 5, mvFontSize.y),
cColor(0.0f, 0.0f, 0.73f, 1));
} else
- mpFont->Draw(vPos, mvFontSize, cColor(0.7f, 1), eFontAlign_Left, mvEntries[i].c_str());
+ mpFont->draw(vPos, mvFontSize, cColor(0.7f, 1), eFontAlign_Left, mvEntries[i].c_str());
vPos.y += mvFontSize.y + 2;
}
@@ -1912,7 +1912,7 @@ void cMainMenu::OnDraw() {
////////////////////////////
// Draw tip
if (msButtonTip != _W("")) {
- mpTipFont->DrawWordWrap(cVector3f(10, 570, 150), 780, 13, 12, cColor(1, 1),
+ mpTipFont->drawWordWrap(cVector3f(10, 570, 150), 780, 13, 12, cColor(1, 1),
eFontAlign_Left, msButtonTip.c_str());
}
diff --git a/engines/hpl1/penumbra-overture/MainMenu.h b/engines/hpl1/penumbra-overture/MainMenu.h
index 2fbf86f4077..5736e745a94 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.h
+++ b/engines/hpl1/penumbra-overture/MainMenu.h
@@ -137,7 +137,7 @@ public:
protected:
tWString msText;
tWString msTip;
- iFontData *mpFont;
+ FontData *mpFont;
bool mbOver;
cVector2f mvFontSize;
eMainMenuState mNextState;
@@ -169,7 +169,7 @@ public:
tWString msText;
protected:
- iFontData *mpFont;
+ FontData *mpFont;
cVector2f mvFontSize;
eMainMenuState mNextState;
@@ -201,7 +201,7 @@ public:
tWString msText;
protected:
- iFontData *mpFont;
+ FontData *mpFont;
eFontAlign mAlignment;
@@ -254,7 +254,7 @@ public:
protected:
cGraphicsDrawer *mpDrawer;
- iFontData *mpFont;
+ FontData *mpFont;
cGfxObject *mpBackGfx;
cGfxObject *mpDownGfx;
@@ -416,7 +416,7 @@ private:
cMainMenuWidget_Text *mpCurrentActionText;
tWString msButtonTip;
- iFontData *mpTipFont;
+ FontData *mpTipFont;
std::vector<cMainMenuParticle> mvRainDrops;
float mfRainDropCount;
@@ -437,7 +437,7 @@ private:
eMainMenuState mLastState;
- iFontData *mpFont;
+ FontData *mpFont;
cVector2f mvMousePos;
diff --git a/engines/hpl1/penumbra-overture/MapLoadText.cpp b/engines/hpl1/penumbra-overture/MapLoadText.cpp
index 7577298587d..7280b7b003c 100644
--- a/engines/hpl1/penumbra-overture/MapLoadText.cpp
+++ b/engines/hpl1/penumbra-overture/MapLoadText.cpp
@@ -92,24 +92,24 @@ void cMapLoadText::DrawText(bool abLoading) {
cVector3f vStart(25, 250.0f - 17.0f * (float)mvRows.size() / 2.0f, 15);
for (size_t i = 0; i < mvRows.size(); ++i) {
- mpTextFont->Draw(vStart + cVector3f(0, 17.0f * (float)i, 0), 15, cColor(1, 1), // cColor(0.75f, 1, 0.75f, 1),
+ mpTextFont->draw(vStart + cVector3f(0, 17.0f * (float)i, 0), 15, cColor(1, 1), // cColor(0.75f, 1, 0.75f, 1),
eFontAlign_Left, mvRows[i].c_str());
}
if (abLoading) {
- mpTextFont->Draw(cVector3f(400, 550, 25), 17, cColor(0.75f, 0.75f, 0.75f, 1),
+ mpTextFont->draw(cVector3f(400, 550, 25), 17, cColor(0.75f, 0.75f, 0.75f, 1),
eFontAlign_Center, kTranslate("LoadTexts", "Loading").c_str());
} else {
tWString wsText = kTranslate("LoadTexts", "ClickToContinue");
- mpTextFont->Draw(cVector3f(400, 550, 25),
+ mpTextFont->draw(cVector3f(400, 550, 25),
17, cColor(0.75f * mfAlpha, 1, 0.75f * mfAlpha, 1),
eFontAlign_Center, wsText.c_str());
- mpTextFont->Draw(cVector3f(401 + 10 * sin(mfAlpha * kPi2f), 551, 23),
+ mpTextFont->draw(cVector3f(401 + 10 * sin(mfAlpha * kPi2f), 551, 23),
17, cColor(0.1f, 0.1f, 0.1f, 0.7f),
eFontAlign_Center, wsText.c_str());
- mpTextFont->Draw(cVector3f(399 + -10 * sin(mfAlpha * kPi2f), 549, 23),
+ mpTextFont->draw(cVector3f(399 + -10 * sin(mfAlpha * kPi2f), 549, 23),
17, cColor(0.1f, 0.1f, 0.1f, 0.7f),
eFontAlign_Center, wsText.c_str());
}
@@ -152,7 +152,7 @@ void cMapLoadText::SetActive(bool abX) {
if (mbActive) {
mvRows.clear();
- mpTextFont->GetWordWrapRows(750, 17, 15, kTranslate(msTextCat, msTextEntry), &mvRows);
+ mpTextFont->getWordWrapRows(750, 17, 15, kTranslate(msTextCat, msTextEntry), &mvRows);
mpInit->mpGame->GetUpdater()->SetContainer("MapLoadText");
mpInit->mpGame->GetScene()->SetDrawScene(false);
diff --git a/engines/hpl1/penumbra-overture/MapLoadText.h b/engines/hpl1/penumbra-overture/MapLoadText.h
index c903c8ef275..4abefda370d 100644
--- a/engines/hpl1/penumbra-overture/MapLoadText.h
+++ b/engines/hpl1/penumbra-overture/MapLoadText.h
@@ -70,8 +70,8 @@ private:
cInit *mpInit;
cGraphicsDrawer *mpDrawer;
- iFontData *mpFont;
- iFontData *mpTextFont;
+ FontData *mpFont;
+ FontData *mpTextFont;
tWStringVec mvRows;
diff --git a/engines/hpl1/penumbra-overture/Notebook.cpp b/engines/hpl1/penumbra-overture/Notebook.cpp
index 2ef667adf8b..11a0230e908 100644
--- a/engines/hpl1/penumbra-overture/Notebook.cpp
+++ b/engines/hpl1/penumbra-overture/Notebook.cpp
@@ -60,7 +60,7 @@ cNotebookState_Front::cNotebookState_Front(cInit *apInit, cNotebook *apNotebook)
for (size_t i = 0; i < mvOptions.size(); ++i) {
cRect2f optionRect;
- optionRect.w = mpFrontFont->GetLength(mvFontSize, mvOptions[i].msText.c_str());
+ optionRect.w = mpFrontFont->getLength(mvFontSize, mvOptions[i].msText.c_str());
optionRect.h = mvFontSize.y + 8;
optionRect.x = mvOptions[i].mvPos.x - optionRect.w / 2;
optionRect.y = mvOptions[i].mvPos.y;
@@ -114,7 +114,7 @@ void cNotebookState_Front::OnUpdate(float afTime) {
void cNotebookState_Front::OnDraw() {
for (size_t i = 0; i < mvOptions.size(); ++i) {
if (mvOptions[i].mfAlpha > 0) {
- mpFrontFont->Draw(mvOptions[i].mvPos + cVector3f(0, 0, 1), mvFontSize,
+ mpFrontFont->draw(mvOptions[i].mvPos + cVector3f(0, 0, 1), mvFontSize,
cColor(0.9f, 0.9f, 0.9f, 1.0f * mpNotebook->GetAlpha() * mvOptions[i].mfAlpha),
eFontAlign_Center, mvOptions[i].msText.c_str());
@@ -122,9 +122,9 @@ void cNotebookState_Front::OnDraw() {
cVector2f(320, mvFontSize.y + 15), cColor(1, mvOptions[i].mfAlpha * 0.7f));
}
- mpFrontFont->Draw(mvOptions[i].mvPos, mvFontSize, cColor(0.7f, 0.7f, 0.7f, 0.8f * mpNotebook->GetAlpha()),
+ mpFrontFont->draw(mvOptions[i].mvPos, mvFontSize, cColor(0.7f, 0.7f, 0.7f, 0.8f * mpNotebook->GetAlpha()),
eFontAlign_Center, mvOptions[i].msText.c_str());
- mpFrontFont->Draw(mvOptions[i].mvPos + cVector3f(1, 1, -1), mvFontSize, cColor(0.0f, 0.0f, 0.0f, 0.8f * mpNotebook->GetAlpha()),
+ mpFrontFont->draw(mvOptions[i].mvPos + cVector3f(1, 1, -1), mvFontSize, cColor(0.0f, 0.0f, 0.0f, 0.8f * mpNotebook->GetAlpha()),
eFontAlign_Center, mvOptions[i].msText.c_str());
}
}
@@ -210,7 +210,7 @@ void cNotebookState_TaskList::OnEnterState(int alLastState) {
while (it.HasNext()) {
cNotebook_BookTask *pTask = it.Next();
- mpTextFont->GetWordWrapRows(308, mfFontSize, mfFontSize - 1, _W("- ") + pTask->msText, &vTempStrings);
+ mpTextFont->getWordWrapRows(308, mfFontSize, mfFontSize - 1, _W("- ") + pTask->msText, &vTempStrings);
fYPos += ((float)vTempStrings.size()) * mfFontSize;
@@ -297,9 +297,9 @@ void cNotebookState_TaskList::OnDraw() {
continue;
}
- mpTextFont->Draw(vPos + cVector3f(-12, 0, 0), 14, cColor(0.0f, 0.0f, 0.0f, 0.9f), eFontAlign_Left,
+ mpTextFont->draw(vPos + cVector3f(-12, 0, 0), 14, cColor(0.0f, 0.0f, 0.0f, 0.9f), eFontAlign_Left,
_W("-"));
- int lRows = mpTextFont->DrawWordWrap(vPos, 308, 15, 14, cColor(0.0f, 0.0f, 0.0f, 0.9f), eFontAlign_Left, pTask->msText.c_str());
+ int lRows = mpTextFont->drawWordWrap(vPos, 308, 15, 14, cColor(0.0f, 0.0f, 0.0f, 0.9f), eFontAlign_Left, pTask->msText.c_str());
vPos.y += 30.0f + (float)lRows * 15.0f;
@@ -308,7 +308,7 @@ void cNotebookState_TaskList::OnDraw() {
//////////////////////////////////
// Page number
- mpTextFont->Draw(cVector3f(400, 490, 16), 15, cColor(0.05f, mpNotebook->GetAlpha()), eFontAlign_Center,
+ mpTextFont->draw(cVector3f(400, 490, 16), 15, cColor(0.05f, mpNotebook->GetAlpha()), eFontAlign_Center,
_W("%d"), mlCurrentPage + 1);
//////////////////////////////////
@@ -524,19 +524,19 @@ void cNotebookState_NoteList::OnDraw() {
if (pNote->mfAlpha < 1) {
float fAlpha = 0.9f * mpNotebook->GetAlpha() * (1 - pNote->mfAlpha);
- mpTextFont->Draw(vTextPos, mvSize, cColor(0, fAlpha), eFontAlign_Left, pNote->msName.c_str());
+ mpTextFont->draw(vTextPos, mvSize, cColor(0, fAlpha), eFontAlign_Left, pNote->msName.c_str());
}
if (pNote->mfAlpha > 0) {
float fAlpha = pNote->mfAlpha * mpNotebook->GetAlpha();
- float fShadowWidth = mpTextFont->GetLength(mvSize, pNote->msName.c_str());
+ float fShadowWidth = mpTextFont->getLength(mvSize, pNote->msName.c_str());
cVector3f vPos(pNote->mRect.x - 10, pNote->mRect.y, 69);
cVector2f vSize(fShadowWidth + 20, pNote->mRect.h - 2);
mpDrawer->DrawGfxObject(mpTextBack, vPos, vSize, cColor(1, fAlpha * 0.7f));
- mpTextFont->Draw(vTextPos, mvSize, cColor(0.85f, fAlpha), eFontAlign_Left, pNote->msName.c_str());
+ mpTextFont->draw(vTextPos, mvSize, cColor(0.85f, fAlpha), eFontAlign_Left, pNote->msName.c_str());
}
lCount++;
@@ -544,7 +544,7 @@ void cNotebookState_NoteList::OnDraw() {
//////////////////////////////////
// Page number
- mpTextFont->Draw(cVector3f(400, 490, 16), 17, cColor(0.05f, mpNotebook->GetAlpha()), eFontAlign_Center,
+ mpTextFont->draw(cVector3f(400, 490, 16), 17, cColor(0.05f, mpNotebook->GetAlpha()), eFontAlign_Center,
_W("%d"), (mlFirstNote / 11) + 1);
//////////////////////////////////
@@ -654,7 +654,7 @@ void cNotebookState_Note::OnEnterState(int alLastState) {
mvRows.clear();
mvPages.clear();
- mpTextFont->GetWordWrapRows(320, mvSize.y + 5, mvSize, pNote->msText, &mvRows);
+ mpTextFont->getWordWrapRows(320, mvSize.y + 5, mvSize, pNote->msText, &mvRows);
int lStartRow = 0;
int lRowCount = 0;
@@ -740,7 +740,7 @@ void cNotebookState_Note::OnDraw() {
// Draw page text
cVector3f vPos(235, 107, 70);
for (int i = mvPages[mlCurrentPage].mlStart; i < mvPages[mlCurrentPage].mlEnd; ++i) {
- mpTextFont->Draw(vPos, mvSize, cColor(0, 1.0f * mpNotebook->GetAlpha()),
+ mpTextFont->draw(vPos, mvSize, cColor(0, 1.0f * mpNotebook->GetAlpha()),
eFontAlign_Left, mvRows[i].c_str());
vPos.y += mvSize.y + 2;
@@ -748,7 +748,7 @@ void cNotebookState_Note::OnDraw() {
//////////////////////////////////
// Page number
- mpTextFont->Draw(cVector3f(400, 490, 16), 15, cColor(0.05f, mpNotebook->GetAlpha()), eFontAlign_Center,
+ mpTextFont->draw(cVector3f(400, 490, 16), 15, cColor(0.05f, mpNotebook->GetAlpha()), eFontAlign_Center,
_W("%d"), mlCurrentPage + 1);
//////////////////////////////////
diff --git a/engines/hpl1/penumbra-overture/Notebook.h b/engines/hpl1/penumbra-overture/Notebook.h
index b2d22e4d937..a374377311a 100644
--- a/engines/hpl1/penumbra-overture/Notebook.h
+++ b/engines/hpl1/penumbra-overture/Notebook.h
@@ -124,7 +124,7 @@ public:
cGraphicsDrawer *mpDrawer;
cGfxObject *mpTextBack;
- iFontData *mpFrontFont;
+ FontData *mpFrontFont;
std::vector<cNoteBook_Option> mvOptions;
int mlSelected;
cVector2f mvFontSize;
@@ -155,7 +155,7 @@ public:
void OnExit();
- iFontData *mpTextFont;
+ FontData *mpTextFont;
float mfFontSize;
@@ -191,7 +191,7 @@ public:
int mlSelected;
- iFontData *mpTextFont;
+ FontData *mpTextFont;
tWString msUnread;
cVector2f mvSize;
cNotebook_Note *mpSelectedNote;
@@ -220,8 +220,8 @@ public:
void OnMouseDown(eMButton aButton);
void OnExit();
- iFontData *mpTextFont;
- iFontData *mpNavigateFont;
+ FontData *mpTextFont;
+ FontData *mpNavigateFont;
tWStringVec mvRows;
std::vector<cNotePage> mvPages;
diff --git a/engines/hpl1/penumbra-overture/NumericalPanel.cpp b/engines/hpl1/penumbra-overture/NumericalPanel.cpp
index 0abded3eaf3..766d70a33fc 100644
--- a/engines/hpl1/penumbra-overture/NumericalPanel.cpp
+++ b/engines/hpl1/penumbra-overture/NumericalPanel.cpp
@@ -95,10 +95,10 @@ void cNumericalButton::OnDraw() {
sChar = cString::To16Char(cString::ToString(mlNum));
if (mbOver && mpPanel->mbMouseIsDown) {
- mpInit->mpDefaultFont->Draw(vFontPos + cVector3f(1, 1, 0), 17, cColor(0, 0, 0, 0.9f * mpPanel->mfAlpha), eFontAlign_Center,
+ mpInit->mpDefaultFont->draw(vFontPos + cVector3f(1, 1, 0), 17, cColor(0, 0, 0, 0.9f * mpPanel->mfAlpha), eFontAlign_Center,
sChar.c_str());
} else {
- mpInit->mpDefaultFont->Draw(vFontPos, 17, cColor(0, 0, 0, 0.9f * mpPanel->mfAlpha), eFontAlign_Center,
+ mpInit->mpDefaultFont->draw(vFontPos, 17, cColor(0, 0, 0, 0.9f * mpPanel->mfAlpha), eFontAlign_Center,
sChar.c_str());
}
}
diff --git a/engines/hpl1/penumbra-overture/Player.cpp b/engines/hpl1/penumbra-overture/Player.cpp
index cb85d15ca04..f884fbbac16 100644
--- a/engines/hpl1/penumbra-overture/Player.cpp
+++ b/engines/hpl1/penumbra-overture/Player.cpp
@@ -1493,7 +1493,7 @@ void cPlayer::OnDraw() {
// DEBUG: health
if (mbShowHealth) {
- mpFont->Draw(cVector3f(5, 5, 0), 12, cColor(1, 1, 1, 1), eFontAlign_Left, _W("Health: %.0f"),
+ mpFont->draw(cVector3f(5, 5, 0), 12, cColor(1, 1, 1, 1), eFontAlign_Left, _W("Health: %.0f"),
mfHealth);
}
@@ -1532,7 +1532,7 @@ void cPlayer::OnDraw() {
vEntries.push_back(&(*it));
}
- mpFont->Draw(cVector3f(5, 18, 0), 10, cColor(1, 1, 1, 1), eFontAlign_Left, _W("Num of sounds: %d"), vSoundNames.size() - 1);
+ mpFont->draw(cVector3f(5, 18, 0), 10, cColor(1, 1, 1, 1), eFontAlign_Left, _W("Num of sounds: %d"), vSoundNames.size() - 1);
int lRow = 0, lCol = 0;
for (int i = 0; i < (int)vSoundNames.size(); i++) {
@@ -1542,7 +1542,7 @@ void cPlayer::OnDraw() {
lCol = 0;
continue;
}
- mpFont->Draw(cVector3f((float)lCol * 250, 26 + (float)lRow * 11, 0), 10, cColor(1, 1, 1, 1), eFontAlign_Left,
+ mpFont->draw(cVector3f((float)lCol * 250, 26 + (float)lRow * 11, 0), 10, cColor(1, 1, 1, 1), eFontAlign_Left,
_W("%ls(%.2f (%.2f %.2f)->%.2f"), cString::To16Char(vSoundNames[i]).c_str(),
//_W("%ls(%.2f (%.2f %.2f)->%.2f %d %.2f/%.2f)"),cString::To16Char(vSoundNames[i]).c_str(),
pEntry->mpSound->GetVolume(),
@@ -1569,7 +1569,7 @@ void cPlayer::OnDraw() {
cMusicEntry *pMusic = mpInit->mpGame->GetSound()->GetMusicHandler()->GetCurrentSong();
if (pMusic) {
iSoundChannel *pChannel = pMusic->mpStream;
- mpFont->Draw(cVector3f(5, 18 + 70, 0), 10, cColor(1, 1, 1, 1), eFontAlign_Left,
+ mpFont->draw(cVector3f(5, 18 + 70, 0), 10, cColor(1, 1, 1, 1), eFontAlign_Left,
_W("Music: '%ls' vol: %.2f playing: %d prio: %d elapsed: %.2f total time: %.2f"),
cString::To16Char(pChannel->GetData()->GetName()).c_str(),
pChannel->GetVolume(),
diff --git a/engines/hpl1/penumbra-overture/Player.h b/engines/hpl1/penumbra-overture/Player.h
index b2b3642e942..cc285377d9f 100644
--- a/engines/hpl1/penumbra-overture/Player.h
+++ b/engines/hpl1/penumbra-overture/Player.h
@@ -385,7 +385,7 @@ private:
cGraphicsDrawer *mpGfxDrawer;
iLowLevelHaptic *mpLowLevelHaptic;
- iFontData *mpFont;
+ FontData *mpFont;
cNode3D mFeetNode;
diff --git a/engines/hpl1/penumbra-overture/PlayerHelper.h b/engines/hpl1/penumbra-overture/PlayerHelper.h
index 759588e68c1..6d0d44e58ff 100644
--- a/engines/hpl1/penumbra-overture/PlayerHelper.h
+++ b/engines/hpl1/penumbra-overture/PlayerHelper.h
@@ -564,7 +564,7 @@ private:
bool mbIntersected;
- iFontData *mpFont;
+ FontData *mpFont;
};
//---------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/PlayerState_Interact.h b/engines/hpl1/penumbra-overture/PlayerState_Interact.h
index ae397e55648..55f0d111f9b 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_Interact.h
+++ b/engines/hpl1/penumbra-overture/PlayerState_Interact.h
@@ -122,7 +122,7 @@ private:
float mfMinThrowImpulse;
float mfMaxThrowImpulse;
- iFontData *mpFont;
+ FontData *mpFont;
};
//-----------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.h b/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.h
index 410b556c41c..a9d73f4a9e9 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.h
+++ b/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.h
@@ -132,7 +132,7 @@ private:
float mfHapticTorqueMul;
- iFontData *mpFont;
+ FontData *mpFont;
};
//-----------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/PreMenu.cpp b/engines/hpl1/penumbra-overture/PreMenu.cpp
index 57b6ebb3c96..4411e5718c2 100644
--- a/engines/hpl1/penumbra-overture/PreMenu.cpp
+++ b/engines/hpl1/penumbra-overture/PreMenu.cpp
@@ -52,7 +52,7 @@ cPreMenu::cPreMenu(cInit *apInit) : iUpdateable("PreMenu") {
// Load text
tWString sText = kTranslate("MainMenu", "PreMenuText");
- mpTextFont->GetWordWrapRows(750, 19, 17, sText, &mvTextRows);
+ mpTextFont->getWordWrapRows(750, 19, 17, sText, &mvTextRows);
mlMaxChars = 0;
for (size_t i = 0; i < mvTextRows.size(); ++i)
@@ -219,18 +219,18 @@ void cPreMenu::OnDraw() {
lCharCount += (int)mvTextRows[i].length();
if (lCharCount >= mlCurrentTextChar) {
tWString sText = mvTextRows[i].substr(0, mlCurrentTextChar - lPrevStart);
- mpTextFont->Draw(cVector3f(25, 90 + 19 * (float)i, 10) + mvecLastTextPos, 17 + mfLastTextSize, cColor(mfLastTextColor, mfFontColor, mfFontColor, 1), // cColor(0.7f,1,0.7f,1),
+ mpTextFont->draw(cVector3f(25, 90 + 19 * (float)i, 10) + mvecLastTextPos, 17 + mfLastTextSize, cColor(mfLastTextColor, mfFontColor, mfFontColor, 1), // cColor(0.7f,1,0.7f,1),
eFontAlign_Left, sText.c_str());
if (mlState == 5) {
// First pair of shadow texts
- mpTextFont->Draw(cVector3f(25 + mfLastTextSpeed1, 90 + 19 * (float)i, 0) + mvecLastTextPos, 17 + (mfLastTextSize), cColor(mfLastTextColor + 0.5f, 0, 0, 0.25f), // cColor(0.7f,1,0.7f,1),
+ mpTextFont->draw(cVector3f(25 + mfLastTextSpeed1, 90 + 19 * (float)i, 0) + mvecLastTextPos, 17 + (mfLastTextSize), cColor(mfLastTextColor + 0.5f, 0, 0, 0.25f), // cColor(0.7f,1,0.7f,1),
eFontAlign_Left, sText.c_str());
- mpTextFont->Draw(cVector3f(25 + 1.5f * mfLastTextSpeed1, 90 + 19 * (float)i, 0) + mvecLastTextPos, 17 + (mfLastTextSize), cColor(mfLastTextColor + 0.5f, 0, 0, 0.20f), // cColor(0.7f,1,0.7f,1),
+ mpTextFont->draw(cVector3f(25 + 1.5f * mfLastTextSpeed1, 90 + 19 * (float)i, 0) + mvecLastTextPos, 17 + (mfLastTextSize), cColor(mfLastTextColor + 0.5f, 0, 0, 0.20f), // cColor(0.7f,1,0.7f,1),
eFontAlign_Left, sText.c_str());
// Second pair
- mpTextFont->Draw(cVector3f(25 + 3 * mfLastTextSpeed1, 90 + 19 * (float)i, 0) + mvecLastTextPos, 17 + (mfLastTextSize), cColor(mfLastTextColor + 0.25f, 0, 0, 0.15f), // cColor(0.7f,1,0.7f,1),
+ mpTextFont->draw(cVector3f(25 + 3 * mfLastTextSpeed1, 90 + 19 * (float)i, 0) + mvecLastTextPos, 17 + (mfLastTextSize), cColor(mfLastTextColor + 0.25f, 0, 0, 0.15f), // cColor(0.7f,1,0.7f,1),
eFontAlign_Left, sText.c_str());
- mpTextFont->Draw(cVector3f(25 + 5 * mfLastTextSpeed1, 90 + 19 * (float)i, 0) + mvecLastTextPos, 17 + (mfLastTextSize), cColor(mfLastTextColor + 0.25f, 0, 0, 0.1f), // cColor(0.7f,1,0.7f,1),
+ mpTextFont->draw(cVector3f(25 + 5 * mfLastTextSpeed1, 90 + 19 * (float)i, 0) + mvecLastTextPos, 17 + (mfLastTextSize), cColor(mfLastTextColor + 0.25f, 0, 0, 0.1f), // cColor(0.7f,1,0.7f,1),
eFontAlign_Left, sText.c_str());
// mpTextFont->Draw(cVector3f(25-mfLastTextPos,90+19*(float)i-mfLastTextPos,0),cVector2f(17,17+(mfLastTextSize)),cColor(mfLastTextColor,mfFontColor,mfFontColor,0.25f),//cColor(0.7f,1,0.7f,1),
@@ -239,7 +239,7 @@ void cPreMenu::OnDraw() {
break;
} else {
- mpTextFont->Draw(cVector3f(25, 90 + 19 * (float)i, 10), 17, cColor(mfFontColor, mfFontColor), // cColor(0.7f,1,0.7f,1),
+ mpTextFont->draw(cVector3f(25, 90 + 19 * (float)i, 10), 17, cColor(mfFontColor, mfFontColor), // cColor(0.7f,1,0.7f,1),
eFontAlign_Left, mvTextRows[i].c_str());
}
}
diff --git a/engines/hpl1/penumbra-overture/PreMenu.h b/engines/hpl1/penumbra-overture/PreMenu.h
index 3f17d5d63ff..503e89db4c4 100644
--- a/engines/hpl1/penumbra-overture/PreMenu.h
+++ b/engines/hpl1/penumbra-overture/PreMenu.h
@@ -81,8 +81,8 @@ private:
iTexture *mpLogoTexture;
iTexture *mpEpTexture;
- iFontData *mpFont;
- iFontData *mpTextFont;
+ FontData *mpFont;
+ FontData *mpTextFont;
bool mbShowText;
tWStringVec mvTextRows;
diff --git a/engines/hpl1/penumbra-overture/RadioHandler.cpp b/engines/hpl1/penumbra-overture/RadioHandler.cpp
index d4a8038c776..0e4e41aeafc 100644
--- a/engines/hpl1/penumbra-overture/RadioHandler.cpp
+++ b/engines/hpl1/penumbra-overture/RadioHandler.cpp
@@ -146,16 +146,16 @@ void cRadioHandler::OnDraw() {
if (mpInit->mbSubtitles) {
if (msCurrentText != _W("")) {
- mpFont->DrawWordWrap(cVector3f(25, 500, 47), 750, 16, 15, cColor(1, fAlpha),
+ mpFont->drawWordWrap(cVector3f(25, 500, 47), 750, 16, 15, cColor(1, fAlpha),
eFontAlign_Left, msCurrentText);
- mpFont->DrawWordWrap(cVector3f(25, 500, 46) + cVector3f(2, 2, 0), 750, 16, 15, cColor(0, fAlpha),
+ mpFont->drawWordWrap(cVector3f(25, 500, 46) + cVector3f(2, 2, 0), 750, 16, 15, cColor(0, fAlpha),
eFontAlign_Left, msCurrentText);
}
if (msPrevText != _W("") && msPrevText != msCurrentText && mfAlpha < 1) {
- mpFont->DrawWordWrap(cVector3f(25, 500, 47), 750, 16, 15, cColor(1, 1 - fAlpha),
+ mpFont->drawWordWrap(cVector3f(25, 500, 47), 750, 16, 15, cColor(1, 1 - fAlpha),
eFontAlign_Left, msPrevText);
- mpFont->DrawWordWrap(cVector3f(25, 500, 46) + cVector3f(2, 2, 0), 750, 16, 15, cColor(0, 1 - fAlpha),
+ mpFont->drawWordWrap(cVector3f(25, 500, 46) + cVector3f(2, 2, 0), 750, 16, 15, cColor(0, 1 - fAlpha),
eFontAlign_Left, msPrevText);
}
}
diff --git a/engines/hpl1/penumbra-overture/RadioHandler.h b/engines/hpl1/penumbra-overture/RadioHandler.h
index 77dcdc2ba8e..c859c70b456 100644
--- a/engines/hpl1/penumbra-overture/RadioHandler.h
+++ b/engines/hpl1/penumbra-overture/RadioHandler.h
@@ -72,7 +72,7 @@ public:
private:
cInit *mpInit;
cSoundHandler *mpSoundHandler;
- iFontData *mpFont;
+ FontData *mpFont;
cRadioMessage *mpCurrentMessage;
Commit: 794bb8d4577825238657238a70b5130453614f13
https://github.com/scummvm/scummvm/commit/794bb8d4577825238657238a70b5130453614f13
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:31+01:00
Commit Message:
HPL1: add feature check for arbitrary resolutions
Changed paths:
engines/hpl1/hpl1.h
diff --git a/engines/hpl1/hpl1.h b/engines/hpl1/hpl1.h
index 6ba0c3f15e3..5fbaf15e7bf 100644
--- a/engines/hpl1/hpl1.h
+++ b/engines/hpl1/hpl1.h
@@ -73,7 +73,8 @@ public:
bool hasFeature(EngineFeature f) const override {
return (f == kSupportsLoadingDuringRuntime) ||
(f == kSupportsSavingDuringRuntime) ||
- (f == kSupportsReturnToLauncher);
+ (f == kSupportsReturnToLauncher) ||
+ (f == kSupportsArbitraryResolutions);
};
bool canLoadGameStateCurrently() override {
Commit: 60b069c791885ee9e16a9f6fe130ba641958702b
https://github.com/scummvm/scummvm/commit/60b069c791885ee9e16a9f6fe130ba641958702b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:32+01:00
Commit Message:
HPL1: fix image loading
Changed paths:
engines/hpl1/engine/graphics/bitmap2D.cpp
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
index dc05ea4e4b2..777e3bb1c57 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.cpp
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -50,16 +50,16 @@ Bitmap2D::Bitmap2D(const tString &filepath, const tString &type)
: iLowLevelPicture(type), _isSurfaceActive(false) {
if (type == "png")
_decoder.reset(loadImage<Image::PNGDecoder>(filepath));
- if (type == "bmp")
+ else if (type == "bmp")
_decoder.reset(loadImage<Image::BitmapDecoder>(filepath));
- if (type == "tga")
+ else if (type == "tga")
_decoder.reset(loadImage<Image::TGADecoder>(filepath));
- if (type == "jpg" || type == "jpeg")
+ else if (type == "jpg" || type == "jpeg")
_decoder.reset(loadImage<Image::JPEGDecoder>(filepath));
- if (type == "gif")
+ else if (type == "gif")
_decoder.reset(loadImage<Image::GIFDecoder>(filepath));
-
- error("trying to load unsupported image format %s", type.c_str());
+ else
+ error("trying to load unsupported image format %s", type.c_str());
}
Bitmap2D::Bitmap2D(const cVector2l &size, const Graphics::PixelFormat &format)
Commit: 8ed2780112dae404d8ab5f3374b668783b63cfb6
https://github.com/scummvm/scummvm/commit/8ed2780112dae404d8ab5f3374b668783b63cfb6
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:32+01:00
Commit Message:
HPL1: add opengl debug channel
Changed paths:
engines/hpl1/debug.h
diff --git a/engines/hpl1/debug.h b/engines/hpl1/debug.h
index f267a9a9338..52880a80b54 100644
--- a/engines/hpl1/debug.h
+++ b/engines/hpl1/debug.h
@@ -28,15 +28,16 @@ namespace Hpl1 {
enum DebugChannels {
kDebugGraphics = 1 << 0,
- kDebugResourceLoading = 1 << 1,
- kDebugFilePath = 1 << 2
+ kDebugResourceLoading = 1 << 1,
+ kDebugFilePath = 1 << 2,
+ kDebugOpenGL = 1 << 3
};
enum DebugLevels {
- kDebugLevelError = 1,
- kDebugLevelWarning = 2,
+ kDebugLevelError = 1,
+ kDebugLevelWarning = 2,
kDebugLevelLog = 3
-};
+};
}
Commit: d1420cb5465520ba6a3042e5b7d04e58c04e1cc7
https://github.com/scummvm/scummvm/commit/d1420cb5465520ba6a3042e5b7d04e58c04e1cc7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:32+01:00
Commit Message:
HPL1: Fix more warnings
Changed paths:
engines/hpl1/penumbra-overture/GameScripts.cpp
diff --git a/engines/hpl1/penumbra-overture/GameScripts.cpp b/engines/hpl1/penumbra-overture/GameScripts.cpp
index a5a8dec708a..865a76b7970 100644
--- a/engines/hpl1/penumbra-overture/GameScripts.cpp
+++ b/engines/hpl1/penumbra-overture/GameScripts.cpp
@@ -86,18 +86,18 @@ tWString gsTempString = _W("");
//-----------------------------------------------------------------------
-static void __stdcall AddToTempString(std::string asString) {
+static void AddToTempString(std::string asString) {
gsTempString += cString::To16Char(asString);
}
SCRIPT_DEFINE_FUNC_1(void, AddToTempString, string)
-static void __stdcall AddToTempStringTrans(std::string asCat, std::string asEntry) {
+static void AddToTempStringTrans(std::string asCat, std::string asEntry) {
cInit *mpInit = gpInit;
gsTempString += kTranslate(asCat, asEntry);
}
SCRIPT_DEFINE_FUNC_2(void, AddToTempStringTrans, string, string)
-static void __stdcall AddToTempStringAction(std::string asAction) {
+static void AddToTempStringAction(std::string asAction) {
cInit *mpInit = gpInit;
iAction *pAction = gpInit->mpGame->GetInput()->GetAction(asAction);
if (pAction) {
@@ -116,7 +116,7 @@ SCRIPT_DEFINE_FUNC_1(void, AddToTempStringAction, string)
///////// GENERAL GAME ////////////////////////////////////
-static void __stdcall ResetGame() {
+static void ResetGame() {
gpInit->mpGame->ResetLogicTimer();
gpInit->mpMapHandler->SetCurrentMapName("");
@@ -126,26 +126,26 @@ SCRIPT_DEFINE_FUNC(void, ResetGame)
//-----------------------------------------------------------------------
-static void __stdcall StartCredits() {
+static void StartCredits() {
gpInit->mpCredits->SetActive(true);
}
SCRIPT_DEFINE_FUNC(void, StartCredits)
-static void __stdcall StartDemoEndText() {
+static void StartDemoEndText() {
gpInit->mpDemoEndText->SetActive(true);
}
SCRIPT_DEFINE_FUNC(void, StartDemoEndText)
//-----------------------------------------------------------------------
-static void __stdcall ClearSavedMaps() {
+static void ClearSavedMaps() {
gpInit->mpSaveHandler->ClearSavedMaps();
}
SCRIPT_DEFINE_FUNC(void, ClearSavedMaps)
//-----------------------------------------------------------------------
-static std::string __stdcall GetActionKeyString(std::string asAction) {
+static std::string GetActionKeyString(std::string asAction) {
iAction *pAction = gpInit->mpGame->GetInput()->GetAction(asAction);
if (pAction) {
return pAction->GetInputName();
@@ -157,7 +157,7 @@ SCRIPT_DEFINE_FUNC_1(string, GetActionKeyString, string)
//-----------------------------------------------------------------------
-static void __stdcall AddMessageTrans(std::string asTransCat,
+static void AddMessageTrans(std::string asTransCat,
std::string asTransName) {
cInit *mpInit = gpInit;
gpInit->mpGameMessageHandler->Add(kTranslate(asTransCat, asTransName));
@@ -166,14 +166,14 @@ SCRIPT_DEFINE_FUNC_2(void, AddMessageTrans, string, string)
//-----------------------------------------------------------------------
-static void __stdcall AddMessage(std::string asMessage) {
+static void AddMessage(std::string asMessage) {
gpInit->mpGameMessageHandler->Add(cString::To16Char(asMessage));
}
SCRIPT_DEFINE_FUNC_1(void, AddMessage, string)
//-----------------------------------------------------------------------
-static void __stdcall AddMessageTempString() {
+static void AddMessageTempString() {
gpInit->mpGameMessageHandler->Add(gsTempString);
gsTempString = _W("");
}
@@ -181,7 +181,7 @@ SCRIPT_DEFINE_FUNC(void, AddMessageTempString)
//-----------------------------------------------------------------------
-static void __stdcall AddSubTitleTrans(std::string asTransCat,
+static void AddSubTitleTrans(std::string asTransCat,
std::string asTransName, float afTime) {
cInit *mpInit = gpInit;
gpInit->mpEffectHandler->GetSubTitle()->Add(kTranslate(asTransCat, asTransName), afTime, false);
@@ -190,14 +190,14 @@ SCRIPT_DEFINE_FUNC_3(void, AddSubTitleTrans, string, string, float)
//-----------------------------------------------------------------------
-static void __stdcall AddSubTitle(std::string asMessage, float afTime) {
+static void AddSubTitle(std::string asMessage, float afTime) {
gpInit->mpEffectHandler->GetSubTitle()->Add(cString::To16Char(asMessage), afTime, false);
}
SCRIPT_DEFINE_FUNC_2(void, AddSubTitle, string, float)
//-----------------------------------------------------------------------
-static void __stdcall AddSubTitleTempString(float afTime) {
+static void AddSubTitleTempString(float afTime) {
gpInit->mpEffectHandler->GetSubTitle()->Add(gsTempString, afTime, false);
gsTempString = _W("");
}
@@ -205,7 +205,7 @@ SCRIPT_DEFINE_FUNC_1(void, AddSubTitleTempString, float)
//-----------------------------------------------------------------------
-static void __stdcall AddRadioMessage(std::string asTransCat, std::string asTransName,
+static void AddRadioMessage(std::string asTransCat, std::string asTransName,
std::string asSound) {
cInit *mpInit = gpInit;
gpInit->mpRadioHandler->Add(kTranslate(asTransCat, asTransName), asSound);
@@ -214,19 +214,19 @@ SCRIPT_DEFINE_FUNC_3(void, AddRadioMessage, string, string, string)
//-----------------------------------------------------------------------
-static void __stdcall SetRadioOnEndCallback(std::string asFunc) {
+static void SetRadioOnEndCallback(std::string asFunc) {
gpInit->mpRadioHandler->SetOnEndCallback(asFunc);
}
SCRIPT_DEFINE_FUNC_1(void, SetRadioOnEndCallback, string)
//-----------------------------------------------------------------------
-static void __stdcall SetInventoryMessage(std::string asMessage) {
+static void SetInventoryMessage(std::string asMessage) {
gpInit->mpInventory->SetMessage(cString::To16Char(asMessage));
}
SCRIPT_DEFINE_FUNC_1(void, SetInventoryMessage, string)
-static void __stdcall SetInventoryMessageTrans(std::string asTransCat,
+static void SetInventoryMessageTrans(std::string asTransCat,
std::string asTransName) {
cInit *mpInit = gpInit;
gpInit->mpInventory->SetMessage(kTranslate(asTransCat, asTransName));
@@ -235,14 +235,14 @@ SCRIPT_DEFINE_FUNC_2(void, SetInventoryMessageTrans, string, string)
//-----------------------------------------------------------------------
-static void __stdcall SetMessagesOverCallback(std::string asFunction) {
+static void SetMessagesOverCallback(std::string asFunction) {
gpInit->mpGameMessageHandler->SetOnMessagesOverCallback(asFunction);
}
SCRIPT_DEFINE_FUNC_1(void, SetMessagesOverCallback, string)
//-----------------------------------------------------------------------
-static void __stdcall ChangeMap(std::string asMapFile, std::string asMapPos,
+static void ChangeMap(std::string asMapFile, std::string asMapPos,
std::string asStartSound, std::string asStopSound,
float afFadeOutTime, float afFadeInTime,
std::string asLoadTextCat, std::string asLoadTextEntry) {
@@ -256,12 +256,12 @@ SCRIPT_DEFINE_FUNC_8(void, ChangeMap, string, string, string, string, float, flo
//-----------------------------------------------------------------------
-static void __stdcall SetMapGameName(std::string asName) {
+static void SetMapGameName(std::string asName) {
gpInit->mpMapHandler->SetMapGameName(cString::To16Char(asName));
}
SCRIPT_DEFINE_FUNC_1(void, SetMapGameName, string)
-static void __stdcall SetMapGameNameTrans(std::string asTransCat, std::string asTransEntry) {
+static void SetMapGameNameTrans(std::string asTransCat, std::string asTransEntry) {
cInit *mpInit = gpInit;
gpInit->mpMapHandler->SetMapGameName(kTranslate(asTransCat, asTransEntry));
}
@@ -269,14 +269,14 @@ SCRIPT_DEFINE_FUNC_2(void, SetMapGameNameTrans, string, string)
//-----------------------------------------------------------------------
-static void __stdcall AddNotebookTaskText(std::string asName, std::string asText) {
+static void AddNotebookTaskText(std::string asName, std::string asText) {
gpInit->mpNotebook->AddTask(asName, cString::To16Char(asText));
}
SCRIPT_DEFINE_FUNC_2(void, AddNotebookTaskText, string, string)
//-----------------------------------------------------------------------
-static void __stdcall AddNotebookTask(std::string asName, std::string asTransCat,
+static void AddNotebookTask(std::string asName, std::string asTransCat,
std::string asTransEntry) {
cInit *mpInit = gpInit;
gpInit->mpNotebook->AddTask(asName, kTranslate(asTransCat, asTransEntry));
@@ -285,14 +285,14 @@ SCRIPT_DEFINE_FUNC_3(void, AddNotebookTask, string, string, string)
//-----------------------------------------------------------------------
-static void __stdcall RemoveNotebookTask(std::string asName) {
+static void RemoveNotebookTask(std::string asName) {
gpInit->mpNotebook->RemoveTask(asName);
}
SCRIPT_DEFINE_FUNC_1(void, RemoveNotebookTask, string)
//-----------------------------------------------------------------------
-static void __stdcall AddNotebookNote(std::string asNameCat, std::string asNameEntry,
+static void AddNotebookNote(std::string asNameCat, std::string asNameEntry,
std::string asTextCat, std::string asTextEntry) {
cInit *mpInit = gpInit;
gpInit->mpNotebook->AddNote(kTranslate(asNameCat, asNameEntry), asTextCat, asTextEntry);
@@ -301,7 +301,7 @@ SCRIPT_DEFINE_FUNC_4(void, AddNotebookNote, string, string, string, string)
//-----------------------------------------------------------------------
-static void __stdcall StartNumericalPanel(std::string asName, int alCode1, int alCode2, int alCode3, int alCode4,
+static void StartNumericalPanel(std::string asName, int alCode1, int alCode2, int alCode3, int alCode4,
float afDifficulty, std::string asCallback) {
gpInit->mpNumericalPanel->SetActive(true);
tIntVec vCode;
@@ -318,38 +318,38 @@ SCRIPT_DEFINE_FUNC_7(void, StartNumericalPanel, string, int, int, int, int, floa
//-----------------------------------------------------------------------
-static void __stdcall SetInventoryActive(bool abX) {
+static void SetInventoryActive(bool abX) {
gpInit->mpInventory->SetActive(abX);
}
SCRIPT_DEFINE_FUNC_1(void, SetInventoryActive, bool)
//-----------------------------------------------------------------------
-static void __stdcall FadeIn(float afTime) {
+static void FadeIn(float afTime) {
gpInit->mpFadeHandler->FadeIn(afTime);
}
SCRIPT_DEFINE_FUNC_1(void, FadeIn, float)
-static void __stdcall FadeOut(float afTime) {
+static void FadeOut(float afTime) {
gpInit->mpFadeHandler->FadeOut(afTime);
}
SCRIPT_DEFINE_FUNC_1(void, FadeOut, float)
-static bool __stdcall IsFading() {
+static bool IsFading() {
return gpInit->mpFadeHandler->IsActive();
}
SCRIPT_DEFINE_FUNC(bool, IsFading)
//-----------------------------------------------------------------------
-static void __stdcall SetWideScreenActive(bool abActive) {
+static void SetWideScreenActive(bool abActive) {
gpInit->mpFadeHandler->SetWideScreenActive(abActive);
}
SCRIPT_DEFINE_FUNC_1(void, SetWideScreenActive, bool)
//-----------------------------------------------------------------------
-static void __stdcall AutoSave() {
+static void AutoSave() {
if (gpInit->mpPlayer->GetHealth() <= 0)
return;
@@ -363,19 +363,19 @@ SCRIPT_DEFINE_FUNC(void, AutoSave)
//-----------------------------------------------------------------------
-static void __stdcall StartFlash(float afFadeIn, float afWhite, float afFadeOut) {
+static void StartFlash(float afFadeIn, float afWhite, float afFadeOut) {
gpInit->mpEffectHandler->GetFlash()->Start(afFadeIn, afWhite, afFadeOut);
}
SCRIPT_DEFINE_FUNC_3(void, StartFlash, float, float, float)
//-----------------------------------------------------------------------
-static void __stdcall SetWaveGravityActive(bool abX) {
+static void SetWaveGravityActive(bool abX) {
gpInit->mpEffectHandler->GetWaveGravity()->SetActive(abX);
}
SCRIPT_DEFINE_FUNC_1(void, SetWaveGravityActive, bool)
-static void __stdcall SetupWaveGravity(float afMaxAngle, float afSwingLength,
+static void SetupWaveGravity(float afMaxAngle, float afSwingLength,
float afGravitySize, std::string asAxis) {
int lDir = cString::ToLowerCase(asAxis) == "x" ? 0 : 1;
@@ -385,14 +385,14 @@ SCRIPT_DEFINE_FUNC_4(void, SetupWaveGravity, float, float, float, string)
//-----------------------------------------------------------------------
-static void __stdcall SetDepthOfFieldActive(bool abX, float afFadeTime) {
+static void SetDepthOfFieldActive(bool abX, float afFadeTime) {
gpInit->mpEffectHandler->GetDepthOfField()->SetActive(abX, afFadeTime);
}
SCRIPT_DEFINE_FUNC_2(void, SetDepthOfFieldActive, bool, float)
//-----------------------------------------------------------------------
-static void __stdcall SetupDepthOfField(float afNearPlane, float afFocalPlane, float afFarPlane) {
+static void SetupDepthOfField(float afNearPlane, float afFocalPlane, float afFarPlane) {
gpInit->mpEffectHandler->GetDepthOfField()->SetUp(afNearPlane, afFocalPlane, afFarPlane);
gpInit->mpEffectHandler->GetDepthOfField()->SetFocusBody(NULL);
}
@@ -400,7 +400,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetupDepthOfField, float, float, float)
//-----------------------------------------------------------------------
-static void __stdcall FocusOnEntity(std::string asEntity) {
+static void FocusOnEntity(std::string asEntity) {
GAME_ENTITY_BEGIN(asEntity);
if (pEntity->GetBodyNum() == 0) {
@@ -415,7 +415,7 @@ SCRIPT_DEFINE_FUNC_1(void, FocusOnEntity, string)
//-----------------------------------------------------------------------
-static void __stdcall SetConstantFocusOnEntity(std::string asEntity) {
+static void SetConstantFocusOnEntity(std::string asEntity) {
if (asEntity == "") {
gpInit->mpEffectHandler->GetDepthOfField()->SetFocusBody(NULL);
return;
@@ -434,7 +434,7 @@ SCRIPT_DEFINE_FUNC_1(void, SetConstantFocusOnEntity, string)
//-----------------------------------------------------------------------
-static void __stdcall PlayGameMusic(std::string asFile, float afVolume, float afFadeStep,
+static void PlayGameMusic(std::string asFile, float afVolume, float afFadeStep,
bool abLoop, int alPrio) {
gpInit->mpMusicHandler->Play(asFile, abLoop, afVolume, afFadeStep, alPrio);
}
@@ -442,21 +442,21 @@ SCRIPT_DEFINE_FUNC_5(void, PlayGameMusic, string, float, float, bool, int)
//-----------------------------------------------------------------------
-static void __stdcall StopGameMusic(float afFadeStep, int alPrio) {
+static void StopGameMusic(float afFadeStep, int alPrio) {
gpInit->mpMusicHandler->Stop(afFadeStep, alPrio);
}
SCRIPT_DEFINE_FUNC_2(void, StopGameMusic, float, int)
//-----------------------------------------------------------------------
-static void __stdcall StartScreenShake(float afAmount, float afTime, float afFadeInTime, float afFadeOutTime) {
+static void StartScreenShake(float afAmount, float afTime, float afFadeInTime, float afFadeOutTime) {
gpInit->mpEffectHandler->GetShakeScreen()->Start(afAmount, afTime, afFadeInTime, afFadeOutTime);
}
SCRIPT_DEFINE_FUNC_4(void, StartScreenShake, float, float, float, float)
//-----------------------------------------------------------------------
-static void __stdcall CreateLightFlashAtArea(std::string asArea, float afRadius,
+static void CreateLightFlashAtArea(std::string asArea, float afRadius,
float afR, float afG, float afB, float afA,
float afAddTime, float afNegTime) {
cAreaEntity *pArea = gpInit->mpGame->GetScene()->GetWorld3D()->GetAreaEntity(asArea);
@@ -476,7 +476,7 @@ SCRIPT_DEFINE_FUNC_8(void, CreateLightFlashAtArea, string, float, float, float,
//-----------------------------------------------------------------------
-static void __stdcall CreateSplashDamage(std::string asAreaName, float afRadius,
+static void CreateSplashDamage(std::string asAreaName, float afRadius,
float afMinDamage, float afMaxDamge,
float afMinForce, float afMaxForce,
float afMaxImpulse, int alStrength) {
@@ -504,12 +504,12 @@ SCRIPT_DEFINE_FUNC_8(void, CreateSplashDamage, string, float, float, float, floa
//-----------------------------------------------------------------------
-static void __stdcall CreateTimer(std::string asName, float afTime, std::string asCallback, bool abGlobal) {
+static void CreateTimer(std::string asName, float afTime, std::string asCallback, bool abGlobal) {
gpInit->mpMapHandler->CreateTimer(asName, afTime, asCallback, abGlobal);
}
SCRIPT_DEFINE_FUNC_4(void, CreateTimer, string, float, string, bool)
-static void __stdcall DestroyTimer(std::string asName) {
+static void DestroyTimer(std::string asName) {
cGameTimer *pTimer = gpInit->mpMapHandler->GetTimer(asName);
if (pTimer == NULL) {
Warning("Couldn't find timer '%s'\n", asName.c_str());
@@ -520,7 +520,7 @@ static void __stdcall DestroyTimer(std::string asName) {
}
SCRIPT_DEFINE_FUNC_1(void, DestroyTimer, string)
-static void __stdcall SetTimerPaused(std::string asName, bool abPaused) {
+static void SetTimerPaused(std::string asName, bool abPaused) {
cGameTimer *pTimer = gpInit->mpMapHandler->GetTimer(asName);
if (pTimer == NULL) {
Warning("Couldn't find timer '%s'\n", asName.c_str());
@@ -531,7 +531,7 @@ static void __stdcall SetTimerPaused(std::string asName, bool abPaused) {
}
SCRIPT_DEFINE_FUNC_2(void, SetTimerPaused, string, bool)
-static void __stdcall SetTimerTime(std::string asName, float afTime) {
+static void SetTimerTime(std::string asName, float afTime) {
cGameTimer *pTimer = gpInit->mpMapHandler->GetTimer(asName);
if (pTimer == NULL) {
Warning("Couldn't find timer '%s'\n", asName.c_str());
@@ -542,7 +542,7 @@ static void __stdcall SetTimerTime(std::string asName, float afTime) {
}
SCRIPT_DEFINE_FUNC_2(void, SetTimerTime, string, float)
-static void __stdcall AddTimerTime(std::string asName, float afTime) {
+static void AddTimerTime(std::string asName, float afTime) {
cGameTimer *pTimer = gpInit->mpMapHandler->GetTimer(asName);
if (pTimer == NULL) {
Warning("Couldn't find timer '%s'\n", asName.c_str());
@@ -553,7 +553,7 @@ static void __stdcall AddTimerTime(std::string asName, float afTime) {
}
SCRIPT_DEFINE_FUNC_2(void, AddTimerTime, string, float)
-static float __stdcall GetTimerTime(std::string asName) {
+static float GetTimerTime(std::string asName) {
cGameTimer *pTimer = gpInit->mpMapHandler->GetTimer(asName);
if (pTimer == NULL) {
Warning("Couldn't find timer '%s'\n", asName.c_str());
@@ -570,7 +570,7 @@ SCRIPT_DEFINE_FUNC_1(float, GetTimerTime, string)
//-----------------------------------------------------------------------
-static void __stdcall GivePlayerDamage(float afAmount, std::string asType) {
+static void GivePlayerDamage(float afAmount, std::string asType) {
ePlayerDamageType type = ePlayerDamageType_BloodSplash;
tString sLowType = cString::ToLowerCase(asType);
@@ -587,19 +587,19 @@ SCRIPT_DEFINE_FUNC_2(void, GivePlayerDamage, float, string)
//-----------------------------------------------------------------------
-static void __stdcall SetPlayerHealth(float afHealth) {
+static void SetPlayerHealth(float afHealth) {
gpInit->mpPlayer->SetHealth(afHealth);
}
SCRIPT_DEFINE_FUNC_1(void, SetPlayerHealth, float)
-static float __stdcall GetPlayerHealth() {
+static float GetPlayerHealth() {
return gpInit->mpPlayer->GetHealth();
}
SCRIPT_DEFINE_FUNC(float, GetPlayerHealth)
//-----------------------------------------------------------------------
-static void __stdcall SetPlayerPose(std::string asPose, bool abChangeDirectly) {
+static void SetPlayerPose(std::string asPose, bool abChangeDirectly) {
tString sPose = cString::ToLowerCase(asPose);
if (sPose == "stand") {
@@ -612,14 +612,14 @@ static void __stdcall SetPlayerPose(std::string asPose, bool abChangeDirectly) {
}
SCRIPT_DEFINE_FUNC_2(void, SetPlayerPose, string, bool)
-static void __stdcall SetPlayerActive(bool abActive) {
+static void SetPlayerActive(bool abActive) {
gpInit->mpPlayer->SetActive(abActive);
}
SCRIPT_DEFINE_FUNC_1(void, SetPlayerActive, bool)
//-----------------------------------------------------------------------
-static void __stdcall StartPlayerLookAt(std::string asEntityName, float afSpeedMul, float afMaxSpeed) {
+static void StartPlayerLookAt(std::string asEntityName, float afSpeedMul, float afMaxSpeed) {
///////////////////
// Get entity
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEntityName);
@@ -637,26 +637,26 @@ static void __stdcall StartPlayerLookAt(std::string asEntityName, float afSpeedM
}
SCRIPT_DEFINE_FUNC_3(void, StartPlayerLookAt, string, float, float)
-static void __stdcall StopPlayerLookAt() {
+static void StopPlayerLookAt() {
gpInit->mpPlayer->GetLookAt()->SetActive(false);
}
SCRIPT_DEFINE_FUNC(void, StopPlayerLookAt)
//-----------------------------------------------------------------------
-static void __stdcall StartPlayerFearFilter(float afStrength) {
+static void StartPlayerFearFilter(float afStrength) {
gpInit->mpPlayer->GetFearFilter()->SetActive(true);
}
SCRIPT_DEFINE_FUNC_1(void, StartPlayerFearFilter, float)
-static void __stdcall StopPlayerFearFilter() {
+static void StopPlayerFearFilter() {
gpInit->mpPlayer->GetFearFilter()->SetActive(false);
}
SCRIPT_DEFINE_FUNC(void, StopPlayerFearFilter)
//-----------------------------------------------------------------------
-static void __stdcall SetFlashlightDisabled(bool abDisabled) {
+static void SetFlashlightDisabled(bool abDisabled) {
gpInit->mpPlayer->GetFlashLight()->SetDisabled(abDisabled);
}
SCRIPT_DEFINE_FUNC_1(void, SetFlashlightDisabled, bool)
@@ -667,48 +667,48 @@ SCRIPT_DEFINE_FUNC_1(void, SetFlashlightDisabled, bool)
//-----------------------------------------------------------------------
-static void __stdcall AddPickupCallback(std::string asItem, std::string asFunction) {
+static void AddPickupCallback(std::string asItem, std::string asFunction) {
gpInit->mpInventory->AddPickupCallback(asItem, asFunction);
}
SCRIPT_DEFINE_FUNC_2(void, AddPickupCallback, string, string)
-static void __stdcall AddUseCallback(std::string asItem, std::string asEntity, std::string asFunction) {
+static void AddUseCallback(std::string asItem, std::string asEntity, std::string asFunction) {
gpInit->mpInventory->AddUseCallback(asItem, asEntity, asFunction);
}
SCRIPT_DEFINE_FUNC_3(void, AddUseCallback, string, string, string)
-static void __stdcall AddCombineCallback(std::string asItem1, std::string asItem2, std::string asFunction) {
+static void AddCombineCallback(std::string asItem1, std::string asItem2, std::string asFunction) {
gpInit->mpInventory->AddCombineCallback(asItem1, asItem2, asFunction);
}
SCRIPT_DEFINE_FUNC_3(void, AddCombineCallback, string, string, string)
//-----------------------------------------------------------------------
-static void __stdcall RemovePickupCallback(std::string asFunction) {
+static void RemovePickupCallback(std::string asFunction) {
gpInit->mpInventory->RemovePickupCallback(asFunction);
}
SCRIPT_DEFINE_FUNC_1(void, RemovePickupCallback, string)
-static void __stdcall RemoveUseCallback(std::string asFunction) {
+static void RemoveUseCallback(std::string asFunction) {
gpInit->mpInventory->RemoveUseCallback(asFunction);
}
SCRIPT_DEFINE_FUNC_1(void, RemoveUseCallback, string)
-static void __stdcall RemoveCombineCallback(std::string asFunction) {
+static void RemoveCombineCallback(std::string asFunction) {
gpInit->mpInventory->RemoveCombineCallback(asFunction);
}
SCRIPT_DEFINE_FUNC_1(void, RemoveCombineCallback, string)
//-----------------------------------------------------------------------
-static bool __stdcall HasItem(std::string asName) {
+static bool HasItem(std::string asName) {
// if(cString::ToLowerCase(asName)=="notebook") return gpInit->mpInventory->GetNoteBookActive();
return gpInit->mpInventory->GetItem(asName) != NULL;
}
SCRIPT_DEFINE_FUNC_1(bool, HasItem, string)
-static void __stdcall RemoveItem(std::string asName) {
+static void RemoveItem(std::string asName) {
cInventoryItem *pItem = gpInit->mpInventory->GetItem(asName);
if (pItem) {
gpInit->mpInventory->RemoveItem(pItem);
@@ -718,7 +718,7 @@ static void __stdcall RemoveItem(std::string asName) {
}
SCRIPT_DEFINE_FUNC_1(void, RemoveItem, string)
-static void __stdcall GiveItem(std::string asName, std::string asEntityFile, int alSlotIndex) {
+static void GiveItem(std::string asName, std::string asEntityFile, int alSlotIndex) {
gpInit->mpInventory->AddItemFromFile(asName, asEntityFile, alSlotIndex);
}
SCRIPT_DEFINE_FUNC_3(void, GiveItem, string, string, int)
@@ -729,7 +729,7 @@ SCRIPT_DEFINE_FUNC_3(void, GiveItem, string, string, int)
//-----------------------------------------------------------------------
-static void __stdcall ReplaceEntity(std::string asName, std::string asBodyName,
+static void ReplaceEntity(std::string asName, std::string asBodyName,
std::string asNewName, std::string asNewFile) {
GAME_ENTITY_BEGIN(asName)
@@ -768,14 +768,14 @@ SCRIPT_DEFINE_FUNC_4(void, ReplaceEntity, string, string, string, string)
//-----------------------------------------------------------------------
-static void __stdcall SetGameEntityActive(std::string asName, bool abX) {
+static void SetGameEntityActive(std::string asName, bool abX) {
GAME_ENTITY_BEGIN(asName)
pEntity->SetActive(abX);
}
SCRIPT_DEFINE_FUNC_2(void, SetGameEntityActive, string, bool)
-static bool __stdcall GetGameEntityActive(std::string asName) {
+static bool GetGameEntityActive(std::string asName) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL) {
Warning("Couldn't find game entity '%s'\n", asName.c_str());
@@ -788,28 +788,28 @@ SCRIPT_DEFINE_FUNC_1(bool, GetGameEntityActive, string)
//-----------------------------------------------------------------------
-static void __stdcall CreateGameEntityVar(std::string asEntName, std::string asVarName, int alVal) {
+static void CreateGameEntityVar(std::string asEntName, std::string asVarName, int alVal) {
GAME_ENTITY_BEGIN(asEntName);
pEntity->CreateVar(asVarName, alVal);
}
SCRIPT_DEFINE_FUNC_3(void, CreateGameEntityVar, string, string, int)
-static void __stdcall SetGameEntityVar(std::string asEntName, std::string asVarName, int alVal) {
+static void SetGameEntityVar(std::string asEntName, std::string asVarName, int alVal) {
GAME_ENTITY_BEGIN(asEntName);
pEntity->SetVar(asVarName, alVal);
}
SCRIPT_DEFINE_FUNC_3(void, SetGameEntityVar, string, string, int)
-static void __stdcall AddGameEntityVar(std::string asEntName, std::string asVarName, int alVal) {
+static void AddGameEntityVar(std::string asEntName, std::string asVarName, int alVal) {
GAME_ENTITY_BEGIN(asEntName);
pEntity->AddVar(asVarName, alVal);
}
SCRIPT_DEFINE_FUNC_3(void, AddGameEntityVar, string, string, int)
-static int __stdcall GetGameEntityVar(std::string asEntName, std::string asVarName) {
+static int GetGameEntityVar(std::string asEntName, std::string asVarName) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEntName);
if (pEntity == NULL) {
Warning("Couldn't find game entity '%s'\n", asEntName.c_str());
@@ -822,14 +822,14 @@ SCRIPT_DEFINE_FUNC_2(int, GetGameEntityVar, string, string)
//-----------------------------------------------------------------------
-static void __stdcall SetGameEntityMaxExamineDist(std::string asName, float afDist) {
+static void SetGameEntityMaxExamineDist(std::string asName, float afDist) {
GAME_ENTITY_BEGIN(asName)
pEntity->SetMaxExamineDist(afDist);
}
SCRIPT_DEFINE_FUNC_2(void, SetGameEntityMaxExamineDist, string, float)
-static void __stdcall SetGameEntityMaxInteractDist(std::string asName, float afDist) {
+static void SetGameEntityMaxInteractDist(std::string asName, float afDist) {
GAME_ENTITY_BEGIN(asName)
pEntity->SetMaxInteractDist(afDist);
@@ -838,7 +838,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetGameEntityMaxInteractDist, string, float)
//-----------------------------------------------------------------------
-static void __stdcall SetGameEntityDescriptionTrans(std::string asName,
+static void SetGameEntityDescriptionTrans(std::string asName,
std::string asTransCat,
std::string asTransName) {
cInit *mpInit = gpInit;
@@ -851,7 +851,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetGameEntityDescriptionTrans, string, string, string
//-----------------------------------------------------------------------
-static void __stdcall SetGameEntityDescriptionOnceTrans(std::string asName,
+static void SetGameEntityDescriptionOnceTrans(std::string asName,
std::string asTransCat,
std::string asTransName) {
cInit *mpInit = gpInit;
@@ -864,7 +864,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetGameEntityDescriptionOnceTrans, string, string, st
//-----------------------------------------------------------------------
-static void __stdcall SetGameEntityDescription(std::string asName, std::string asMessage) {
+static void SetGameEntityDescription(std::string asName, std::string asMessage) {
GAME_ENTITY_BEGIN(asName)
pEntity->SetDescription(cString::To16Char(asMessage));
@@ -872,7 +872,7 @@ static void __stdcall SetGameEntityDescription(std::string asName, std::string a
}
SCRIPT_DEFINE_FUNC_2(void, SetGameEntityDescription, string, string)
-static void __stdcall SetGameEntityGameNameTrans(std::string asName,
+static void SetGameEntityGameNameTrans(std::string asName,
std::string asTransCat,
std::string asTransName) {
cInit *mpInit = gpInit;
@@ -884,7 +884,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetGameEntityGameNameTrans, string, string, string)
//-----------------------------------------------------------------------
-static void __stdcall ChangeEntityAnimation(std::string asName,
+static void ChangeEntityAnimation(std::string asName,
std::string asAnimation,
bool abLoop) {
GAME_ENTITY_BEGIN(asName)
@@ -895,14 +895,14 @@ SCRIPT_DEFINE_FUNC_3(void, ChangeEntityAnimation, string, string, bool)
//-----------------------------------------------------------------------
-static void __stdcall SetEntityHealth(std::string asName, float afHealth) {
+static void SetEntityHealth(std::string asName, float afHealth) {
GAME_ENTITY_BEGIN(asName)
pEntity->SetHealth(afHealth);
}
SCRIPT_DEFINE_FUNC_2(void, SetEntityHealth, string, float)
-static void __stdcall DamageEntity(std::string asName, float afDamage, int alStrength) {
+static void DamageEntity(std::string asName, float afDamage, int alStrength) {
GAME_ENTITY_BEGIN(asName)
pEntity->Damage(afDamage, alStrength);
@@ -911,7 +911,7 @@ SCRIPT_DEFINE_FUNC_3(void, DamageEntity, string, float, int)
//-----------------------------------------------------------------------
-static void __stdcall SetDoorState(std::string asName,
+static void SetDoorState(std::string asName,
std::string asState) {
/*iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if(pEntity==NULL || pEntity->GetType() != eGameEntityType_Door)
@@ -940,7 +940,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetDoorState, string, string)
//-----------------------------------------------------------------------
-static void __stdcall SetObjectInteractMode(std::string asName, std::string asMode) {
+static void SetObjectInteractMode(std::string asName, std::string asMode) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Object) {
Warning("Couldn't find object entity '%s'\n", asName.c_str());
@@ -955,7 +955,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetObjectInteractMode, string, string)
//-----------------------------------------------------------------------
-static void __stdcall SetupLink(std::string asName,
+static void SetupLink(std::string asName,
std::string asMapFile, std::string asMapPos,
std::string asStartSound, std::string asStopSound,
float afFadeOutTime, float afFadeInTime) {
@@ -980,7 +980,7 @@ SCRIPT_DEFINE_FUNC_7(void, SetupLink, string, string, string, string, string, fl
//-----------------------------------------------------------------------
-static void __stdcall SetupLinkLoadText(std::string asName,
+static void SetupLinkLoadText(std::string asName,
std::string asMapFile, std::string asMapPos,
std::string asStartSound, std::string asStopSound,
float afFadeOutTime, float afFadeInTime,
@@ -1006,7 +1006,7 @@ SCRIPT_DEFINE_FUNC_9(void, SetupLinkLoadText, string, string, string, string, st
//-----------------------------------------------------------------------
-static void __stdcall SetAreaCustomIcon(std::string asName, std::string asIcon) {
+static void SetAreaCustomIcon(std::string asName, std::string asIcon) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Area) {
Warning("Couldn't find area entity '%s'\n", asName.c_str());
@@ -1047,7 +1047,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetAreaCustomIcon, string, string)
//-----------------------------------------------------------------------
-static void __stdcall AddEnemyPatrolNode(std::string asEnemy, std::string asNode, float afTime,
+static void AddEnemyPatrolNode(std::string asEnemy, std::string asNode, float afTime,
std::string asAnimation) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
@@ -1064,7 +1064,7 @@ SCRIPT_DEFINE_FUNC_4(void, AddEnemyPatrolNode, string, string, float, string)
* Clears all the patrol nodes for the enemy
* \param asEnemy The Name of the enemy.
*/
-static void __stdcall ClearEnemyPatrolNodes(std::string asEnemy) {
+static void ClearEnemyPatrolNodes(std::string asEnemy) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1078,7 +1078,7 @@ SCRIPT_DEFINE_FUNC_1(void, ClearEnemyPatrolNodes, string)
//-----------------------------------------------------------------------
-static void __stdcall SetEnemyDeathCallback(std::string asEnemy, std::string asFunction) {
+static void SetEnemyDeathCallback(std::string asEnemy, std::string asFunction) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1092,7 +1092,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetEnemyDeathCallback, string, string)
//-----------------------------------------------------------------------
-static void __stdcall SetEnemyAttackCallback(std::string asEnemy, std::string asFunction) {
+static void SetEnemyAttackCallback(std::string asEnemy, std::string asFunction) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1106,7 +1106,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetEnemyAttackCallback, string, string)
//-----------------------------------------------------------------------
-static float __stdcall GetEnemyHealth(std::string asEnemy) {
+static float GetEnemyHealth(std::string asEnemy) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1120,7 +1120,7 @@ SCRIPT_DEFINE_FUNC_1(float, GetEnemyHealth, string)
//-----------------------------------------------------------------------
-static void __stdcall SetEnemyUseTriggers(std::string asEnemy, bool abUseTriggers) {
+static void SetEnemyUseTriggers(std::string asEnemy, bool abUseTriggers) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1134,7 +1134,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetEnemyUseTriggers, string, bool)
//-----------------------------------------------------------------------
-static void __stdcall ShowEnemyPlayer(std::string asEnemy) {
+static void ShowEnemyPlayer(std::string asEnemy) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1150,7 +1150,7 @@ SCRIPT_DEFINE_FUNC_1(void, ShowEnemyPlayer, string)
//-----------------------------------------------------------------------
-static void __stdcall SetDoorLocked(std::string asDoor, bool abLocked) {
+static void SetDoorLocked(std::string asDoor, bool abLocked) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asDoor);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_SwingDoor) {
Warning("Couldn't find swing door entity '%s'\n", asDoor.c_str());
@@ -1164,7 +1164,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetDoorLocked, string, bool)
//-----------------------------------------------------------------------
-static void __stdcall SetupStickArea(std::string asArea, bool abCanDeatch,
+static void SetupStickArea(std::string asArea, bool abCanDeatch,
bool abMoveBody, bool abRotateBody,
bool abCheckCenterInArea, float afPoseTime,
std::string asAttachSound, std::string asDetachSound,
@@ -1200,14 +1200,14 @@ SCRIPT_DEFINE_FUNC_12(void, SetupStickArea, string, bool, bool, bool, bool, floa
//-----------------------------------------------------------------------
-static void __stdcall AllowAttachment() {
+static void AllowAttachment() {
cGameStickArea::mbAllowAttachment = true;
}
SCRIPT_DEFINE_FUNC(void, AllowAttachment)
//-----------------------------------------------------------------------
-static void __stdcall SetLampLit(std::string asName, bool abLit, bool abFade) {
+static void SetLampLit(std::string asName, bool abLit, bool abFade) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Lamp) {
Warning("Couldn't find lamp '%s'\n", asName.c_str());
@@ -1221,7 +1221,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetLampLit, string, bool, bool)
//-----------------------------------------------------------------------
-static void __stdcall SetLampFlicker(std::string asName, bool abFlicker) {
+static void SetLampFlicker(std::string asName, bool abFlicker) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Lamp) {
Warning("Couldn't find lamp '%s'\n", asName.c_str());
@@ -1235,7 +1235,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetLampFlicker, string, bool)
//-----------------------------------------------------------------------
-static void __stdcall SetLampLitChangeCallback(std::string asName, std::string asCallback) {
+static void SetLampLitChangeCallback(std::string asName, std::string asCallback) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Lamp) {
Warning("Couldn't find lamp '%s'\n", asName.c_str());
@@ -1249,7 +1249,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetLampLitChangeCallback, string, string)
//-----------------------------------------------------------------------
-static void __stdcall SetupLadder(std::string asName,
+static void SetupLadder(std::string asName,
std::string asAttachSound,
std::string asClimbUpSound,
std::string asClimbDownSound) {
@@ -1268,7 +1268,7 @@ SCRIPT_DEFINE_FUNC_4(void, SetupLadder, string, string, string, string)
//-----------------------------------------------------------------------
-static void __stdcall SetupDamageArea(std::string asName, float afDamage,
+static void SetupDamageArea(std::string asName, float afDamage,
float afUpdatesPerSec, int alStrength,
bool abDisableObjects, bool abDisableEnemies) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
@@ -1288,7 +1288,7 @@ SCRIPT_DEFINE_FUNC_6(void, SetupDamageArea, string, float, float, int, bool, boo
//-----------------------------------------------------------------------
-static void __stdcall SetupForceArea(std::string asName,
+static void SetupForceArea(std::string asName,
float afMaxForce, float afConstant,
float afDestSpeed, float afMaxMass,
bool abMulWithMass, bool abForceAtPoint,
@@ -1313,7 +1313,7 @@ SCRIPT_DEFINE_FUNC_9(void, SetupForceArea, string, float, float, float, float, b
//-----------------------------------------------------------------------
-static void __stdcall SetupLiquidArea(std::string asName,
+static void SetupLiquidArea(std::string asName,
float afDensity, float afLinearViscosity,
float afAngularViscosity,
std::string asPhysicsMaterial,
@@ -1340,7 +1340,7 @@ SCRIPT_DEFINE_FUNC_9(void, SetupLiquidArea, string, float, float, float, string,
//-----------------------------------------------------------------------
-static void __stdcall SetupSaveArea(std::string asName,
+static void SetupSaveArea(std::string asName,
std::string asMessageCat, std::string asMessageEntry,
std::string asSound) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
@@ -1379,7 +1379,7 @@ static eGameCollideScriptType GetGameCollideScriptType(const tString &asType) {
//////////////////////////////
-static void __stdcall AddEntityCollideCallback(std::string asType,
+static void AddEntityCollideCallback(std::string asType,
std::string asDestName,
std::string asEntityName,
std::string asFuncName) {
@@ -1405,7 +1405,7 @@ SCRIPT_DEFINE_FUNC_4(void, AddEntityCollideCallback, string, string, string, str
//////////////////////////////
-static void __stdcall RemoveEntityCollideCallback(std::string asType,
+static void RemoveEntityCollideCallback(std::string asType,
std::string asDestName,
std::string asEntityName) {
if (cString::ToLowerCase(asDestName) == "player") {
@@ -1452,7 +1452,7 @@ static eGameEntityScriptType GetGameScriptType(const tString &asType) {
/////////////////////
-static void __stdcall AddEntityCallback(std::string asType,
+static void AddEntityCallback(std::string asType,
std::string asDestName,
std::string asFuncName) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asDestName);
@@ -1471,7 +1471,7 @@ SCRIPT_DEFINE_FUNC_3(void, AddEntityCallback, string, string, string)
/////////////////////
-static void __stdcall RemoveEntityCallback(std::string asType,
+static void RemoveEntityCallback(std::string asType,
std::string asDestName) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asDestName);
if (pEntity == NULL) {
@@ -1493,7 +1493,7 @@ SCRIPT_DEFINE_FUNC_2(void, RemoveEntityCallback, string, string)
//-----------------------------------------------------------------------
-static void __stdcall CreateSoundEntityAt(std::string asType, std::string asDestName,
+static void CreateSoundEntityAt(std::string asType, std::string asDestName,
std::string asSoundName, std::string asSoundFile) {
cWorld3D *pWorld = gpInit->mpGame->GetScene()->GetWorld3D();
iPhysicsWorld *pPhysicsWorld = gpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
Commit: 25972424dd903a232e41225df9f3249eb7666db3
https://github.com/scummvm/scummvm/commit/25972424dd903a232e41225df9f3249eb7666db3
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:32+01:00
Commit Message:
HPL1: add logging functions
Changed paths:
A engines/hpl1/debug.cpp
engines/hpl1/debug.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/debug.cpp b/engines/hpl1/debug.cpp
new file mode 100644
index 00000000000..e5ea21af5b4
--- /dev/null
+++ b/engines/hpl1/debug.cpp
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "hpl1/debug.h"
+
+namespace Hpl1 {
+
+void logError(int channel, const char *fmt, ...) {
+ va_list vl;
+ va_start(vl, fmt);
+ debugCN(Hpl1::kDebugLevelError, channel, fmt, vl);
+ va_end(vl);
+}
+
+void logWarning(int channel, const char *fmt, ...) {
+ va_list vl;
+ va_start(vl, fmt);
+ debugCN(Hpl1::kDebugLevelWarning, channel, fmt, vl);
+ va_end(vl);
+}
+
+void logInfo(int channel, const char *fmt, ...) {
+ va_list vl;
+ va_start(vl, fmt);
+ debugCN(Hpl1::kDebugLevelLog, channel, fmt, vl);
+ va_end(vl);
+}
+
+}
\ No newline at end of file
diff --git a/engines/hpl1/debug.h b/engines/hpl1/debug.h
index 52880a80b54..609504bb1cb 100644
--- a/engines/hpl1/debug.h
+++ b/engines/hpl1/debug.h
@@ -39,6 +39,12 @@ enum DebugLevels {
kDebugLevelLog = 3
};
+void logError(int channel, const char *fmt, ...);
+
+void logWarning(int channel, const char *fmt, ...);
+
+void logInfo(int channel, const char *fmt, ...);
+
}
#endif
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 277b0f78e35..c9978dd420e 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS := \
console.o \
detection.o \
string.o \
+ debug.o \
engine/ai/AI.o \
engine/ai/AINodeContainer.o \
engine/ai/AINodeGenerator.o \
Commit: 0e7414cfdb5dff48443b0c65d351f4a43eb1b9dd
https://github.com/scummvm/scummvm/commit/0e7414cfdb5dff48443b0c65d351f4a43eb1b9dd
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:32+01:00
Commit Message:
HPL1: add opengl header and debug utilities
Changed paths:
A engines/hpl1/opengl.cpp
A engines/hpl1/opengl.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index c9978dd420e..29036b0f210 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS := \
detection.o \
string.o \
debug.o \
+ opengl.o \
engine/ai/AI.o \
engine/ai/AINodeContainer.o \
engine/ai/AINodeGenerator.o \
diff --git a/engines/hpl1/opengl.cpp b/engines/hpl1/opengl.cpp
new file mode 100644
index 00000000000..cbbf211e6ac
--- /dev/null
+++ b/engines/hpl1/opengl.cpp
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "hpl1/opengl.h"
+#include "hpl1/debug.h"
+
+namespace Hpl1 {
+ static const char* getErrorString(const GLenum code) {
+ switch (code) {
+ case GL_INVALID_ENUM:
+ return "invalid enum";
+ case GL_INVALID_VALUE:
+ return "invalid value";
+ case GL_INVALID_OPERATION:
+ return "invalid operation";
+ }
+ return "unrecognized error";
+ }
+
+ void checkOGLErrors(const char *function, const int line) {
+ GLenum code;
+ while((code = glGetError()) != GL_NO_ERROR)
+ logError(kDebugOpenGL, "Opengl error: \'%s\' in function %s - %d", getErrorString(code), function, line);
+ }
+}
\ No newline at end of file
diff --git a/engines/hpl1/opengl.h b/engines/hpl1/opengl.h
new file mode 100644
index 00000000000..6aacf293370
--- /dev/null
+++ b/engines/hpl1/opengl.h
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_OPENGL_H
+#define HPL1_OPENGL_H
+
+#define USE_OPENGL
+#define USE_GLAD
+#include "graphics/opengl/system_headers.h"
+#include "graphics/opengl/context.h"
+
+namespace Hpl1 {
+ void checkOGLErrors(const char *function, int line);
+}
+
+#define GL_CHECK(x) {::Hpl1::checkOGLErrors(__func__, __LINE__); x;}
+#define GL_CHECK_FN() GL_CHECK()
+
+#endif
\ No newline at end of file
Commit: db0488d5351cc9c4f048f8457785464b68f2be55
https://github.com/scummvm/scummvm/commit/db0488d5351cc9c4f048f8457785464b68f2be55
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:32+01:00
Commit Message:
HPL1: implement LowLevelGraphicsSDL
Changed paths:
engines/hpl1/engine/graphics/LowLevelGraphics.h
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
engines/hpl1/engine/impl/temp-types.h
engines/hpl1/engine/resources/ImageManager.cpp
diff --git a/engines/hpl1/engine/graphics/LowLevelGraphics.h b/engines/hpl1/engine/graphics/LowLevelGraphics.h
index b5603cefd7e..e9109684a27 100644
--- a/engines/hpl1/engine/graphics/LowLevelGraphics.h
+++ b/engines/hpl1/engine/graphics/LowLevelGraphics.h
@@ -179,6 +179,8 @@ enum eGraphicCaps {
eGraphicCaps_GL_NVRegisterCombiners,
eGraphicCaps_GL_NVRegisterCombiners_MaxStages,
eGraphicCaps_GL_ATIFragmentShader,
+ eGraphicCaps_GL_BlendFunctionSeparate,
+ eGraphicCaps_GL_MultiTexture,
eGraphicCaps_LastEnum
};
@@ -217,7 +219,7 @@ public:
* \param aType
* \return
*/
- virtual int GetCaps(eGraphicCaps aType) = 0;
+ virtual int GetCaps(eGraphicCaps aType) const = 0;
/**
* Show the cursor or not. Default is false
* \param aX
@@ -252,7 +254,7 @@ public:
virtual cPlanef GetClipPlane(int alIdx, const cPlanef &aPlane) = 0;
virtual void SetClipPlaneActive(int alIdx, bool abX) = 0;
- virtual Bitmap2D *CreateBitmap2D(const cVector2l &avSize, unsigned int alBpp) = 0;
+ virtual Bitmap2D *CreateBitmap2D(const cVector2l &avSize) = 0;
virtual FontData *CreateFontData(const tString &asName) = 0;
virtual iTexture *CreateTexture(bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) = 0;
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 36b66fac0bb..19130a61739 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -25,22 +25,11 @@
* This file is part of HPL1 Engine.
*/
-#if 0 // def WIN32
-#pragma comment(lib, "OpenGL32.lib")
-#pragma comment(lib, "GLu32.lib")
-#pragma comment(lib, "GLaux.lib")
-#pragma comment(lib, "Cg.lib")
-#pragma comment(lib, "CgGL.lib")
-#pragma comment(lib, "SDL_ttf.lib")
-#endif
-
#include <assert.h>
-#include <stdlib.h>
#include "hpl1/engine/graphics/font_data.h"
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
-//#include "graphics/opengl/glad.h"
#include "hpl1/engine/impl/CGProgram.h"
#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/engine/graphics/font_data.h"
@@ -50,72 +39,57 @@
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/impl/OcclusionQueryOGL.h"
+#include "common/algorithm.h"
+#include "engines/util.h"
+#include "common/system.h"
+#include "hpl1/debug.h"
+#include "hpl1/opengl.h"
namespace hpl {
-//////////////////////////////////////////////////////////////////////////
-// GLOBAL FUNCTIONS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-GLenum ColorFormatToGL(eColorDataFormat aFormat) {
-#if 0
- switch(aFormat)
- {
- case eColorDataFormat_RGB: return GL_RGB;
- case eColorDataFormat_RGBA: return GL_RGBA;
- case eColorDataFormat_ALPHA: return GL_ALPHA;
- case eColorDataFormat_BGR: return GL_BGR_EXT;
- case eColorDataFormat_BGRA: return GL_BGRA_EXT;
- };
-
-#endif
- return 0;
-}
-
-//-------------------------------------------------
-
-GLenum TextureTargetToGL(eTextureTarget aTarget) {
-#if 0
- switch(aTarget)
- {
- case eTextureTarget_1D: return GL_TEXTURE_1D;
- case eTextureTarget_2D: return GL_TEXTURE_2D;
- case eTextureTarget_Rect: return GL_TEXTURE_RECTANGLE_NV;
- case eTextureTarget_CubeMap: return GL_TEXTURE_CUBE_MAP_ARB;
- case eTextureTarget_3D: return GL_TEXTURE_3D;
- }
-#endif
- return 0;
+GLenum ColorFormatToGL(eColorDataFormat format) {
+ switch (format) {
+ case eColorDataFormat_RGB:
+ return GL_RGB;
+ case eColorDataFormat_RGBA:
+ return GL_RGBA;
+ case eColorDataFormat_ALPHA:
+ return GL_ALPHA;
+ case eColorDataFormat_BGR:
+ return GL_BGR;
+ case eColorDataFormat_BGRA:
+ return GL_BGRA;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid color format (%d)", format);
+}
+
+GLenum TextureTargetToGL(eTextureTarget target) {
+ switch (target) {
+ case eTextureTarget_1D:
+ return GL_TEXTURE_1D;
+ case eTextureTarget_2D:
+ return GL_TEXTURE_2D;
+ case eTextureTarget_Rect:
+ return GL_TEXTURE_RECTANGLE;
+ case eTextureTarget_CubeMap:
+ return GL_TEXTURE_CUBE_MAP;
+ case eTextureTarget_3D:
+ return GL_TEXTURE_3D;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture target (%d)", target);
}
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
cLowLevelGraphicsSDL::cLowLevelGraphicsSDL() {
-#if 0
mlBatchArraySize = 20000;
mlVertexCount = 0;
mlIndexCount =0;
mlMultisampling =0;
-
mvVirtualSize.x = 800;
mvVirtualSize.y = 600;
+ mfGammaCorrection = 1.0;
+ mpRenderTarget = nullptr;
-#ifdef WIN32
- mhKeyTrapper = NULL;
-#endif
-
- mpPixelFormat = hplNew(cSDLPixelFormat, () );
-
- mpRenderTarget=NULL;
-
- for(int i=0;i<MAX_TEXTUREUNITS;i++)
- mpCurrentTexture[i] = NULL;
+ Common::fill(mpCurrentTexture, mpCurrentTexture + MAX_TEXTUREUNITS, nullptr);
mbClearColor = true;
mbClearDepth = true;
@@ -133,150 +107,30 @@ cLowLevelGraphicsSDL::cLowLevelGraphicsSDL() {
mbTexCoordArrayActive[i] = false;
mlTexCoordArrayCount[i]=0;
}
-
- //Init extra stuff
- InitCG();
-
- TTF_Init();
-#endif
}
-//-----------------------------------------------------------------------
-
cLowLevelGraphicsSDL::~cLowLevelGraphicsSDL() {
-#if 0
- //#ifdef WIN32
- // if(mhKeyTrapper) FreeLibrary(mhKeyTrapper);
- //#endif
-
-
- SDL_SetGammaRamp(mvStartGammaArray[0],mvStartGammaArray[1],mvStartGammaArray[2]);
-
- hplFree(mpVertexArray);
- hplFree(mpIndexArray);
- for(int i=0;i<MAX_TEXTUREUNITS;i++) hplFree(mpTexCoordArray[i]);
-
- hplDelete(mpPixelFormat);
+ //SDL_SetGammaRamp(mvStartGammaArray[0],mvStartGammaArray[1],mvStartGammaArray[2]);
- //Exit extra stuff
- ExitCG();
- TTF_Quit();
-#endif
+ hplFree(mpVertexArray);
+ hplFree(mpIndexArray);
+ for(int i=0;i<MAX_TEXTUREUNITS;i++)
+ hplFree(mpTexCoordArray[i]);
}
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
bool cLowLevelGraphicsSDL::Init(int alWidth, int alHeight, int alBpp, int abFullscreen,
int alMultisampling, const tString &asWindowCaption) {
-#if 0
- mvScreenSize.x = alWidth;
- mvScreenSize.y = alHeight;
- mlBpp = alBpp;
-
- mlMultisampling = alMultisampling;
-
- //Set some GL Attributes
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
-
- SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
-
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
-
- // Multisampling
- if(mlMultisampling > 0)
- {
- if(SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1)==-1)
- {
- Error("Multisample buffers not supported!\n");
- }
- else
- {
- if(SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, mlMultisampling)==-1)
- {
- Error("Couldn't set multisampling samples to %d\n",mlMultisampling);
- }
- }
- }
-
- unsigned int mlFlags = SDL_OPENGL;
-
- if(abFullscreen) mlFlags |= SDL_FULLSCREEN;
-
- Log(" Setting video mode: %d x %d - %d bpp\n",alWidth, alHeight, alBpp);
- mpScreen = SDL_SetVideoMode( alWidth, alHeight, alBpp, mlFlags);
- if(mpScreen==NULL){
- Error("Could not set display mode setting a lower one!\n");
- mvScreenSize = cVector2l(640,480);
- mpScreen = SDL_SetVideoMode( mvScreenSize.x, mvScreenSize.y, alBpp, mlFlags);
- if(mpScreen==NULL)
- {
- FatalError("Unable to initialize display!\n");
- return false;
- }
- else
- {
- SetWindowCaption(asWindowCaption);
- CreateMessageBoxW(_W("Warning!"),
- _W("Could not set displaymode and 640x480 is used instead!\n"));
- }
- }
- else
- {
- SetWindowCaption(asWindowCaption);
- }
-
- Log(" Init Glee...");
- if(GLeeInit())
- {
- Log("OK\n");
- }
- else
- {
- Log("ERROR!\n");
- Error(" Couldn't init glee!\n");
- }
-
- ///Setup up windows specifc context:
-#if defined(WIN32)
- mGLContext = wglGetCurrentContext();
- mDeviceContext = wglGetCurrentDC();
-#elif defined(__linux__)
- /*gDpy = XOpenDisplay(NULL);
- glCtx = gPBuffer = 0;*/
-#endif
-
- //Check Multisample properties
- CheckMultisampleCaps();
-
- //Turn off cursor as default
- ShowCursor(false);
-
- //Gamma
- mfGammaCorrection = 1.0f;
- SDL_GetGammaRamp(mvStartGammaArray[0],mvStartGammaArray[1],mvStartGammaArray[2]);
-
- SDL_SetGamma(mfGammaCorrection,mfGammaCorrection,mfGammaCorrection);
-
- //GL
- Log(" Setting up OpenGL\n");
- SetupGL();
-
- //Set the clear color
- SDL_GL_SwapBuffers();
-
- return true;
-#endif
- return false;
+ mvScreenSize.x = alWidth;
+ mvScreenSize.y = alHeight;
+ mlBpp = alBpp;
+
+ mlMultisampling = alMultisampling;
+ initGraphics3d(alWidth, alHeight);
+ SetupGL();
+ ShowCursor(false);
+ //CheckMultisampleCaps();
+ g_system->updateScreen();
+ return true;
}
//-----------------------------------------------------------------------
@@ -286,265 +140,157 @@ void cLowLevelGraphicsSDL::CheckMultisampleCaps() {
//-----------------------------------------------------------------------
-void cLowLevelGraphicsSDL::SetupGL() {
-#if 0
- //Inits GL stuff
- //Set Shade model and clear color.
- glShadeModel(GL_SMOOTH);
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-
- //Depth Test setup
- glClearDepth(1.0f);//VAlues buffer is cleared with
- glEnable(GL_DEPTH_TEST); //enable depth testing
- glDepthFunc(GL_LEQUAL); //function to do depth test with
- glDisable(GL_ALPHA_TEST);
-
- //Set best perspective correction
- glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
-
- //int lStencilBits=-1;
- //glGetIntegerv(GL_STENCIL_BITS,&lStencilBits);
- //Log(" Stencil bits: %d\n",lStencilBits);
-
- //Stencil setup
- glClearStencil(0);
-
- //Clear the screen
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
+static void logOGLInfo(const cLowLevelGraphicsSDL &graphics) {
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Max texture image units: %d",
+ graphics.GetCaps(eGraphicCaps_MaxTextureImageUnits));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Max texture coord units: %d",
+ graphics.GetCaps(eGraphicCaps_MaxTextureCoordUnits));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL,"Two sided stencil: %d",
+ graphics.GetCaps(eGraphicCaps_TwoSideStencil));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Vertex Buffer Object: %d",
+ graphics.GetCaps(eGraphicCaps_VertexBufferObject));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Anisotropic filtering: %d",
+ graphics.GetCaps(eGraphicCaps_AnisotropicFiltering));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Max Anisotropic degree: %d",
+ graphics.GetCaps(eGraphicCaps_MaxAnisotropicFiltering));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Multisampling: %d\n",
+ graphics.GetCaps(eGraphicCaps_Multisampling));
+}
- //glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
+void cLowLevelGraphicsSDL::SetupGL() {
+ //Inits GL stuff
+ //Set Shade model and clear color.
+ GL_CHECK(glShadeModel(GL_SMOOTH));
+ GL_CHECK(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
- ///// BEGIN BATCH ARRAY STUFF ///////////////
+ //Depth Test setup
+ GL_CHECK(glClearDepth(1.0f));//VAlues buffer is cleared with
+ GL_CHECK(glEnable(GL_DEPTH_TEST)); //enable depth testing
+ GL_CHECK(glDepthFunc(GL_LEQUAL)); //function to do depth test with
+ GL_CHECK(glDisable(GL_ALPHA_TEST));
- //Enable all the vertex arrays that are used:
- glEnableClientState(GL_VERTEX_ARRAY ); //The positions
- glEnableClientState(GL_COLOR_ARRAY ); //The color
- glEnableClientState(GL_TEXTURE_COORD_ARRAY); //Tex coords
- glDisableClientState(GL_NORMAL_ARRAY);
- //Disable the once not used.
- glDisableClientState(GL_INDEX_ARRAY); //color index
- glDisableClientState(GL_EDGE_FLAG_ARRAY);
+ //Set best perspective correction
+ GL_CHECK(glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST));
- ///// END BATCH ARRAY STUFF ///////////////
+ //Stencil setup
+ GL_CHECK(glClearStencil(0));
- //Show some info
- Log(" Max texture image units: %d\n",GetCaps(eGraphicCaps_MaxTextureImageUnits));
- Log(" Max texture coord units: %d\n",GetCaps(eGraphicCaps_MaxTextureCoordUnits));
- Log(" Two sided stencil: %d\n",GetCaps(eGraphicCaps_TwoSideStencil));
- Log(" Vertex Buffer Object: %d\n",GetCaps(eGraphicCaps_VertexBufferObject));
+ //Clear the screen
+ GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));
- Log(" Anisotropic filtering: %d\n",GetCaps(eGraphicCaps_AnisotropicFiltering));
- if(GetCaps(eGraphicCaps_AnisotropicFiltering))
- Log(" Max Anisotropic degree: %d\n",GetCaps(eGraphicCaps_MaxAnisotropicFiltering));
+ GL_CHECK(glMatrixMode(GL_MODELVIEW));
+ GL_CHECK(glLoadIdentity());
+ GL_CHECK(glMatrixMode(GL_PROJECTION));
+ GL_CHECK(glLoadIdentity());
- Log(" Multisampling: %d\n",GetCaps(eGraphicCaps_Multisampling));
+ ///// BEGIN BATCH ARRAY STUFF ///////////////
- Log(" Vertex Program: %d\n",GetCaps(eGraphicCaps_GL_VertexProgram));
- Log(" Fragment Program: %d\n",GetCaps(eGraphicCaps_GL_FragmentProgram));
+ //Enable all the vertex arrays that are used:
+ GL_CHECK(glEnableClientState(GL_VERTEX_ARRAY)); //The positions
+ GL_CHECK(glEnableClientState(GL_COLOR_ARRAY)); //The color
+ GL_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); //Tex coords
+ GL_CHECK(glDisableClientState(GL_NORMAL_ARRAY));
+ //Disable the once not used.
+ GL_CHECK(glDisableClientState(GL_INDEX_ARRAY)); //color index
+ GL_CHECK(glDisableClientState(GL_EDGE_FLAG_ARRAY));
- Log(" NV Register Combiners: %d\n",GetCaps(eGraphicCaps_GL_NVRegisterCombiners));
- Log(" NV Register Combiners Stages: %d\n",GetCaps(eGraphicCaps_GL_NVRegisterCombiners_MaxStages));
+ ///// END BATCH ARRAY STUFF ///////////////
- Log(" ATI Fragment Shader: %d\n",GetCaps(eGraphicCaps_GL_ATIFragmentShader));
-#endif
+ logOGLInfo(*this);
}
//-----------------------------------------------------------------------
-int cLowLevelGraphicsSDL::GetCaps(eGraphicCaps aType) {
-#if 0
- switch(aType)
- {
- //Texture Rectangle
- case eGraphicCaps_TextureTargetRectangle:
- {
- return 1;//GLEE_ARB_texture_rectangle?1:0;
- }
-
-
- //Vertex Buffer Object
- case eGraphicCaps_VertexBufferObject:
- {
- return GLEE_ARB_vertex_buffer_object?1:0;
- }
-
- //Two Sided Stencil
- case eGraphicCaps_TwoSideStencil:
- {
- //DEBUG:
- //return 0;
-
- if(GLEE_EXT_stencil_two_side) return 1;
- else if(GLEE_ATI_separate_stencil) return 1;
- else return 0;
- }
-
- //Max Texture Image Units
- case eGraphicCaps_MaxTextureImageUnits:
- {
- //DEBUG:
- //return 2;
-
- int lUnits;
- glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB,(GLint *)&lUnits);
- return lUnits;
- }
-
- //Max Texture Coord Units
- case eGraphicCaps_MaxTextureCoordUnits:
- {
- int lUnits;
- glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB,(GLint *)&lUnits);
- return lUnits;
- }
- //Texture Anisotropy
- case eGraphicCaps_AnisotropicFiltering:
- {
- if(GLEE_EXT_texture_filter_anisotropic) return 1;
- else return 0;
- }
-
- //Texture Anisotropy
- case eGraphicCaps_MaxAnisotropicFiltering:
- {
- if(!GLEE_EXT_texture_filter_anisotropic) return 0;
+int cLowLevelGraphicsSDL::GetCaps(eGraphicCaps type) const {
+ switch(type) {
- float fMax;
- glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,&fMax);
- return (int)fMax;
- }
+ //Texture Rectangle
+ case eGraphicCaps_TextureTargetRectangle:
+ return 1;
- //Multisampling
- case eGraphicCaps_Multisampling:
- {
- if(GLEE_ARB_multisample) return 1;
- return 0;
- }
+ //Vertex Buffer Object
+ case eGraphicCaps_VertexBufferObject:
+ return 1; //gl 2.0
+ //Two Sided Stencil
+ case eGraphicCaps_TwoSideStencil:
+ return 1; //gl 2.0
- //GL Vertex program
- case eGraphicCaps_GL_VertexProgram:
- {
- //Debbug:
- //return 0;
+ //Max Texture Image Units
+ case eGraphicCaps_MaxTextureImageUnits: {
+ int lUnits;
+ GL_CHECK(glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint *)&lUnits));
+ return lUnits;
+ }
+ //Max Texture Coord Units
+ case eGraphicCaps_MaxTextureCoordUnits: {
+ int lUnits = 0;
+ GL_CHECK(glGetIntegerv(GL_MAX_TEXTURE_COORDS, (GLint *)&lUnits));
+ return lUnits;
+ }
+ //Texture Anisotropy
+ case eGraphicCaps_AnisotropicFiltering:
+ return 0; //gl 4.6
- if(GLEE_ARB_vertex_program) return 1;
- else return 0;
- }
+ //Texture Anisotropy
+ case eGraphicCaps_MaxAnisotropicFiltering:
+ return 0; //gl 4.6
- //GL Fragment program
- case eGraphicCaps_GL_FragmentProgram:
- {
- //Debbug:
- //return 0;
+ //Multisampling
+ case eGraphicCaps_Multisampling:
+ return 1; //gl 1.3
- if(GLEE_ARB_fragment_program) return 1;
- else return 0;
- }
+ //GL Vertex program
+ case eGraphicCaps_GL_VertexProgram:
+ return 1; //gl 2.0
- //GL NV register combiners
- case eGraphicCaps_GL_NVRegisterCombiners:
- {
- if(GLEE_NV_register_combiners) return 1;
- else return 0;
- }
+ //GL Fragment program
+ case eGraphicCaps_GL_FragmentProgram:
+ return 1; //gl 2.0
- //GL NV register combiners Max stages
- case eGraphicCaps_GL_NVRegisterCombiners_MaxStages:
- {
- int lStages;
- glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV,(GLint *)&lStages);
- return lStages;
- }
+ case eGraphicCaps_GL_ATIFragmentShader:
+ return 1;
- //GL ATI Fragment Shader
- case eGraphicCaps_GL_ATIFragmentShader:
- {
- if(GLEE_ATI_fragment_shader) return 1;
- else return 0;
- }
- }
+ //GL ATI Fragment Shader
+ case eGraphicCaps_GL_BlendFunctionSeparate:
+ return 1; //gl 1.4
-#endif
+ case eGraphicCaps_GL_MultiTexture:
+ return GLAD_GL_ARB_multitexture; //gl 1.4
+ }
+ Hpl1::logWarning(Hpl1::kDebugGraphics, "graphic options %d is not supported", type);
return 0;
}
//-----------------------------------------------------------------------
-void cLowLevelGraphicsSDL::ShowCursor(bool abX) {
-#if 0
- if(abX)
- SDL_ShowCursor(SDL_ENABLE);
- else
- SDL_ShowCursor(SDL_DISABLE);
-#endif
+void cLowLevelGraphicsSDL::ShowCursor(bool toggle) {
+ g_system->showMouse(toggle);
}
//-----------------------------------------------------------------------
-void cLowLevelGraphicsSDL::SetVsyncActive(bool abX) {
-#if 0
-#if defined(WIN32)
- if(GLEE_WGL_EXT_swap_control)
- {
- wglSwapIntervalEXT(abX ? 1 : 0);
- }
-#elif defined(__linux__)
- if (GLEE_GLX_SGI_swap_control)
- {
- glXSwapIntervalSGI(abX ? 1 : 0);
- }
-#endif
-#endif
+void cLowLevelGraphicsSDL::SetVsyncActive(bool toggle) {
+ if (g_system->hasFeature(OSystem::kFeatureVSync))
+ g_system->setFeatureState(OSystem::kFeatureVSync, toggle);
}
//-----------------------------------------------------------------------
-void cLowLevelGraphicsSDL::SetMultisamplingActive(bool abX) {
-#if 0
- if(!GLEE_ARB_multisample || mlMultisampling<=0) return;
+void cLowLevelGraphicsSDL::SetMultisamplingActive(bool toggle) {
+ if(!GetCaps(eGraphicCaps_Multisampling) || mlMultisampling<=0)
+ return;
- if(abX)
- glEnable(GL_MULTISAMPLE_ARB);
- else
- glDisable(GL_MULTISAMPLE_ARB);
-#endif
+ if(toggle)
+ glEnable(GL_MULTISAMPLE);
+ else
+ glDisable(GL_MULTISAMPLE);
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetGammaCorrection(float afX) {
-#if 0
- //if(mfGammaCorrection == afX) return;
-
- mfGammaCorrection = afX;
-
- SDL_SetGamma(mfGammaCorrection,mfGammaCorrection,mfGammaCorrection);
-
- /*Uint16 GammaArray[3][256];
-
- for (int iIndex = 0; iIndex < 256; iIndex++)
- {
- Uint16 iArrayValue = iIndex * ((int)(afX*127.0f) + 128);
-
- if (iArrayValue > 65535)
- iArrayValue = 65535;
-
- GammaArray[0][iIndex] =
- GammaArray[1][iIndex] =
- GammaArray[2][iIndex] = iArrayValue;
-
- }
-
- //Set the GammaArray values into the display device context.
- int bReturn = SDL_SetGammaRamp(GammaArray[0],GammaArray[1],GammaArray[2]);*/
- /*if(bReturn!=-1) Log("Setting gamma worked!\n");
- else Log("Setting gamma FAILED!\n");*/
-#endif
+ mfGammaCorrection = afX;
}
float cLowLevelGraphicsSDL::GetGammaCorrection() {
@@ -554,77 +300,41 @@ float cLowLevelGraphicsSDL::GetGammaCorrection() {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetClipPlane(int alIdx, const cPlanef &aPlane) {
-#if 0
- mvClipPlanes[alIdx] = aPlane;
-
- double vPlane[4];
- vPlane[0] = aPlane.a;
- vPlane[1] = aPlane.b;
- vPlane[2] = aPlane.c;
- vPlane[3] = aPlane.d;
- glClipPlane(GL_CLIP_PLANE0 + alIdx,vPlane);
-#endif
+ mvClipPlanes[alIdx] = aPlane;
+
+ double vPlane[4];
+ vPlane[0] = aPlane.a;
+ vPlane[1] = aPlane.b;
+ vPlane[2] = aPlane.c;
+ vPlane[3] = aPlane.d;
+ GL_CHECK(glClipPlane(GL_CLIP_PLANE0 + alIdx,vPlane));
}
+
+
cPlanef cLowLevelGraphicsSDL::GetClipPlane(int alIdx, const cPlanef &aPlane) {
return mvClipPlanes[alIdx];
}
-void cLowLevelGraphicsSDL::SetClipPlaneActive(int alIdx, bool abX) {
-#if 0
- if(abX) glEnable(GL_CLIP_PLANE0 + alIdx);
- else glDisable(GL_CLIP_PLANE0 + alIdx);
-#endif
+
+void cLowLevelGraphicsSDL::SetClipPlaneActive(int alIdx, bool toggle) {
+ if(toggle)
+ glEnable(GL_CLIP_PLANE0 + alIdx);
+ else
+ glDisable(GL_CLIP_PLANE0 + alIdx);
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SaveScreenToBMP(const tString &asFile) {
-#if 0
- glFinish();
-
- Bitmap2D *pBmp = hplNew( Bitmap2D, (mpPixelFormat) );
- pBmp->Create(cVector2l(mvScreenSize.x,mvScreenSize.y),32);
-
- unsigned char *pDestPixels = (unsigned char*)pBmp->GetSurface()->pixels;
- unsigned char *pSrcPixels = (unsigned char*)hplMalloc(mvScreenSize.x * mvScreenSize.y * 4);
-
- SDL_LockSurface(pBmp->GetSurface());
- glReadBuffer(GL_BACK);
- glReadPixels(0,0,mvScreenSize.x,mvScreenSize.y,GL_RGBA,GL_UNSIGNED_BYTE,pSrcPixels);
-
- for(int y=0; y<mvScreenSize.y; ++y)
- {
- for(int x=0; x<mvScreenSize.x; ++x)
- {
- unsigned char* pDestPix = &pDestPixels[((mvScreenSize.x * y) + x) * 4];
- unsigned char* pSrcPix = &pSrcPixels[((mvScreenSize.x * ((mvScreenSize.y-1) - y))
- + x) * 4];
-
- pDestPix[0] = pSrcPix[0];
- pDestPix[1] = pSrcPix[1];
- pDestPix[2] = pSrcPix[2];
- pDestPix[3] = 255;
- }
- }
-
- SDL_UnlockSurface(pBmp->GetSurface());
- SDL_SaveBMP(pBmp->GetSurface(),asFile.c_str());
-
- hplFree(pSrcPixels);
- hplDelete(pBmp);
-#endif
+ GL_CHECK(glFinish());
+ g_system->saveScreenshot();
}
//-----------------------------------------------------------------------
-Bitmap2D *cLowLevelGraphicsSDL::CreateBitmap2D(const cVector2l &avSize, unsigned int alBpp) {
-#if 0
- Bitmap2D *pBmp = hplNew(Bitmap2D, (mpPixelFormat));
- pBmp->create(avSize, alBpp);
-
- return pBmp;
-#endif
- return nullptr;
- }
+Bitmap2D *cLowLevelGraphicsSDL::CreateBitmap2D(const cVector2l &size) {
+ return hplNew(Bitmap2D, (size, *mpPixelFormat));
+}
//-----------------------------------------------------------------------
@@ -634,21 +344,9 @@ FontData *cLowLevelGraphicsSDL::CreateFontData(const tString &asName) {
//-----------------------------------------------------------------------
-Bitmap2D *cLowLevelGraphicsSDL::CreateBitmap2DFromSurface(SDL_Surface *apSurface, const tString &asType) {
-#if 0
- Bitmap2D *pBmp = hplNew(Bitmap2D, (apSurface, mpPixelFormat, asType));
-
- pBmp->msType = asType;
-
- return pBmp;
-#endif
- return nullptr;
-}
-
-//-----------------------------------------------------------------------
-
iGpuProgram *cLowLevelGraphicsSDL::CreateGpuProgram(const tString &asName, eGpuProgramType aType) {
- return hplNew(cCGProgram, (asName, mCG_Context, aType));
+ //return hplNew(cCGProgram, (asName, mCG_Context, aType));
+ return nullptr;
}
//-----------------------------------------------------------------------
@@ -689,7 +387,7 @@ iTexture *cLowLevelGraphicsSDL::CreateTexture(const cVector2l &avSize, int alBpp
pTex = hplNew(cSDLTexture, ("", mpPixelFormat, this, aType, abUseMipMaps, aTarget));
pTex->Create(avSize.x, avSize.y, aFillCol);
} else {
- Bitmap2D *pBmp = CreateBitmap2D(avSize, alBpp);
+ Bitmap2D *pBmp = CreateBitmap2D(avSize);
pBmp->fillRect(cRect2l(0, 0, 0, 0), aFillCol);
pTex = hplNew(cSDLTexture, ("", mpPixelFormat, this, aType, abUseMipMaps, aTarget));
@@ -708,46 +406,36 @@ iTexture *cLowLevelGraphicsSDL::CreateTexture(const cVector2l &avSize, int alBpp
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::PushMatrix(eMatrix aMtxType) {
-#if 0
- SetMatrixMode(aMtxType);
- glPushMatrix();
-#endif
+ GL_CHECK(SetMatrixMode(aMtxType));
+ GL_CHECK(glPushMatrix());
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::PopMatrix(eMatrix aMtxType) {
-#if 0
- SetMatrixMode(aMtxType);
- glPopMatrix();
-#endif
+ GL_CHECK(SetMatrixMode(aMtxType));
+ GL_CHECK(glPopMatrix());
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetMatrix(eMatrix aMtxType, const cMatrixf &a_mtxA) {
-#if 0
- SetMatrixMode(aMtxType);
- cMatrixf mtxTranpose = a_mtxA.GetTranspose();
- glLoadMatrixf(mtxTranpose.v);
-#endif
+ SetMatrixMode(aMtxType);
+ cMatrixf mtxTranpose = a_mtxA.GetTranspose();
+ GL_CHECK(glLoadMatrixf(mtxTranpose.v));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetIdentityMatrix(eMatrix aMtxType) {
-#if 0
- SetMatrixMode(aMtxType);
- glLoadIdentity();
-#endif
+ GL_CHECK(SetMatrixMode(aMtxType));
+ GL_CHECK(glLoadIdentity());
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::TranslateMatrix(eMatrix aMtxType, const cVector3f &avPos) {
-#if 0
- SetMatrixMode(aMtxType);
- glTranslatef(avPos.x,avPos.y,avPos.z);
-#endif
+ GL_CHECK(SetMatrixMode(aMtxType));
+ GL_CHECK(glTranslatef(avPos.x,avPos.y,avPos.z));
}
//-----------------------------------------------------------------------
@@ -758,260 +446,239 @@ void cLowLevelGraphicsSDL::TranslateMatrix(eMatrix aMtxType, const cVector3f &av
* \param &avRot
*/
void cLowLevelGraphicsSDL::RotateMatrix(eMatrix aMtxType, const cVector3f &avRot) {
-#if 0
- SetMatrixMode(aMtxType);
- glRotatef(1,avRot.x,avRot.y,avRot.z);
-#endif
+ SetMatrixMode(aMtxType);
+ GL_CHECK(glRotatef(1,avRot.x,avRot.y,avRot.z));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::ScaleMatrix(eMatrix aMtxType, const cVector3f &avScale) {
-#if 0
- SetMatrixMode(aMtxType);
- glScalef(avScale.x,avScale.y,avScale.z);
-#endif
+ SetMatrixMode(aMtxType);
+ GL_CHECK(glScalef(avScale.x,avScale.y,avScale.z));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetOrthoProjection(const cVector2f &avSize, float afMin, float afMax) {
-#if 0
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0,avSize.x,avSize.y,0,afMin,afMax);
-#endif
+ GL_CHECK(glMatrixMode(GL_PROJECTION));
+ GL_CHECK(glLoadIdentity());
+ GL_CHECK(glOrtho(0,avSize.x,avSize.y,0,afMin,afMax));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetTexture(unsigned int alUnit, iTexture *apTex) {
-#if 0
- if(apTex == mpCurrentTexture[alUnit]) return;
-
- GLenum NewTarget=0;
- if(apTex)
- NewTarget = GetGLTextureTargetEnum(apTex->GetTarget());
- GLenum LastTarget=0;
- if(mpCurrentTexture[alUnit])
- LastTarget = GetGLTextureTargetEnum(mpCurrentTexture[alUnit]->GetTarget());
-
- //Check if multi texturing is supported.
- if(GLEE_ARB_multitexture){
- glActiveTextureARB(GL_TEXTURE0_ARB + alUnit);
- }
+ if(apTex == mpCurrentTexture[alUnit]) return;
+
+ GLenum NewTarget=0;
+ if(apTex)
+ NewTarget = GetGLTextureTargetEnum(apTex->GetTarget());
+ GLenum LastTarget=0;
+ if(mpCurrentTexture[alUnit])
+ LastTarget = GetGLTextureTargetEnum(mpCurrentTexture[alUnit]->GetTarget());
+
+ //Check if multi texturing is supported.
+ if (GetCaps(eGraphicCaps_GL_MultiTexture)) {
+ GL_CHECK(glActiveTexture(GL_TEXTURE0 + alUnit));
+ }
- //If the current texture in this unit is a render target, unbind it.
- if(mpCurrentTexture[alUnit]){
- if(mpCurrentTexture[alUnit]->GetTextureType() == eTextureType_RenderTarget)
- {
- cSDLTexture *pSDLTex = static_cast<cSDLTexture *> (mpCurrentTexture[alUnit]);
+ //If the current texture in this unit is a render target, unbind it.
+ if(mpCurrentTexture[alUnit]){
+ if(mpCurrentTexture[alUnit]->GetTextureType() == eTextureType_RenderTarget)
+ {
+ error("render target not supported");
+#if 0
+ cSDLTexture *pSDLTex = static_cast<cSDLTexture *> (mpCurrentTexture[alUnit]);
- glBindTexture(LastTarget, pSDLTex->GetTextureHandle());
- cPBuffer* pBuffer = pSDLTex->GetPBuffer();
- pBuffer->UnBind();
- }
+ glBindTexture(LastTarget, pSDLTex->GetTextureHandle());
+ cPBuffer* pBuffer = pSDLTex->GetPBuffer();
+ pBuffer->UnBind();
+#endif
}
+ }
- //Disable this unit if NULL
- if(apTex == NULL)
- {
- glDisable(LastTarget);
- //glBindTexture(LastTarget,0);
- }
- //Enable the unit, set the texture handle and bind the pbuffer
- else
- {
- if(NewTarget != LastTarget) glDisable(LastTarget);
+ //Disable this unit if NULL
+ if(apTex == NULL)
+ {
+ glDisable(LastTarget);
+ //glBindTexture(LastTarget,0);
+ }
+ //Enable the unit, set the texture handle and bind the pbuffer
+ else
+ {
+ if(NewTarget != LastTarget) glDisable(LastTarget);
- cSDLTexture *pSDLTex = static_cast<cSDLTexture*> (apTex);
+ cSDLTexture *pSDLTex = static_cast<cSDLTexture*> (apTex);
- glBindTexture(NewTarget, pSDLTex->GetTextureHandle());
- glEnable(NewTarget);
+ glBindTexture(NewTarget, pSDLTex->GetTextureHandle());
+ glEnable(NewTarget);
- //if it is a render target we need to do some more binding.
- if(pSDLTex->GetTextureType() == eTextureType_RenderTarget)
- {
- cPBuffer* pBuffer = pSDLTex->GetPBuffer();
- pBuffer->Bind();
- }
+ //if it is a render target we need to do some more binding.
+ if(pSDLTex->GetTextureType() == eTextureType_RenderTarget)
+ {
+ error("render target not supported");
+#if 0
+ cPBuffer* pBuffer = pSDLTex->GetPBuffer();
+ pBuffer->Bind();
+#endif
}
+ }
- mpCurrentTexture[alUnit] = apTex;
-#endif
+ mpCurrentTexture[alUnit] = apTex;
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetActiveTextureUnit(unsigned int alUnit) {
-#if 0
- glActiveTextureARB(GL_TEXTURE0_ARB + alUnit);
-#endif
+ GL_CHECK(glActiveTexture(GL_TEXTURE0 + alUnit));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetTextureEnv(eTextureParam aParam, int alVal) {
-#if 0
- GLenum lParam = GetGLTextureParamEnum(aParam);
+ GLenum lParam = GetGLTextureParamEnum(aParam);
- glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_ARB);
+ GL_CHECK(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE));
- if(aParam==eTextureParam_ColorFunc || aParam==eTextureParam_AlphaFunc){
- glTexEnvi(GL_TEXTURE_ENV,lParam,GetGLTextureFuncEnum((eTextureFunc)alVal));
- }
- else if(aParam>=eTextureParam_ColorSource0 && aParam<=eTextureParam_AlphaSource2){
- glTexEnvi(GL_TEXTURE_ENV,lParam,GetGLTextureSourceEnum((eTextureSource)alVal));
- }
- else if(aParam>=eTextureParam_ColorOp0 && aParam<=eTextureParam_AlphaOp2){
- glTexEnvi(GL_TEXTURE_ENV,lParam,GetGLTextureOpEnum((eTextureOp)alVal));
- }
- else {
- glTexEnvi(GL_TEXTURE_ENV,lParam,alVal);
- }
-#endif
+ if(aParam == eTextureParam_ColorFunc || aParam == eTextureParam_AlphaFunc) {
+ glTexEnvi(GL_TEXTURE_ENV, lParam, GetGLTextureFuncEnum((eTextureFunc)alVal));
+ }
+ else if(aParam >= eTextureParam_ColorSource0 && aParam <= eTextureParam_AlphaSource2) {
+ glTexEnvi(GL_TEXTURE_ENV, lParam, GetGLTextureSourceEnum((eTextureSource)alVal));
+ }
+ else if(aParam >= eTextureParam_ColorOp0 && aParam <= eTextureParam_AlphaOp2) {
+ glTexEnvi(GL_TEXTURE_ENV, lParam, GetGLTextureOpEnum((eTextureOp)alVal));
+ }
+ else {
+ glTexEnvi(GL_TEXTURE_ENV, lParam, alVal);
+ }
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
-void cLowLevelGraphicsSDL::SetTextureConstantColor(const cColor &aColor) {
-#if 0
- float vColor[4] = { aColor.r, aColor.g, aColor.b, aColor.a };
+void cLowLevelGraphicsSDL::SetTextureConstantColor(const cColor &color) {
+ float vColor[] = { color.r, color.g, color.b, color.a };
- glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &vColor[0]);
-#endif
+ GL_CHECK(glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &vColor[0]));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetColor(const cColor &aColor) {
-#if 0
- glColor4f(aColor.r, aColor.g, aColor.b, aColor.a);
-#endif
+ GL_CHECK(glColor4f(aColor.r, aColor.g, aColor.b, aColor.a));
}
//-----------------------------------------------------------------------
iVertexBuffer *cLowLevelGraphicsSDL::CreateVertexBuffer(tVertexFlag aFlags,
- eVertexBufferDrawType aDrawType,
- eVertexBufferUsageType aUsageType,
- int alReserveVtxSize, int alReserveIdxSize) {
- // return hplNew( cVertexBufferVBO,(this, aFlags,aDrawType,aUsageType,alReserveVtxSize,alReserveIdxSize) );
- // return hplNew( cVertexBufferOGL, (this, aFlags,aDrawType,aUsageType,alReserveVtxSize,alReserveIdxSize) );
+ eVertexBufferDrawType aDrawType, eVertexBufferUsageType aUsageType, int alReserveVtxSize, int alReserveIdxSize) {
- if (GetCaps(eGraphicCaps_VertexBufferObject)) {
+ if (GetCaps(eGraphicCaps_VertexBufferObject))
return hplNew(cVertexBufferVBO, (this, aFlags, aDrawType, aUsageType, alReserveVtxSize, alReserveIdxSize));
- } else {
- // Error("VBO is not supported, using Vertex array!\n");
- return hplNew(cVertexBufferOGL, (this, aFlags, aDrawType, aUsageType, alReserveVtxSize, alReserveIdxSize));
- }
+ return hplNew(cVertexBufferOGL, (this, aFlags, aDrawType, aUsageType, alReserveVtxSize, alReserveIdxSize));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawRect(const cVector2f &avPos, const cVector2f &avSize, float afZ) {
-#if 0
- glColor4f(1,1,1,1);
- glBegin(GL_QUADS);
- {
- glTexCoord2f(0.0, 0.0); glVertex3f(avPos.x, avPos.y,afZ);
- glTexCoord2f(1.0, 0.0); glVertex3f(avPos.x+avSize.x, avPos.y,afZ);
- glTexCoord2f(1.0, 1.0); glVertex3f(avPos.x+avSize.x, avPos.y+avSize.y,afZ);
- glTexCoord2f(0.0, 1.0); glVertex3f(avPos.x, avPos.y+avSize.y,afZ);
- }
- glEnd();
-#endif
+ glColor4f(1,1,1,1);
+ glBegin(GL_QUADS);
+ {
+ glTexCoord2f(0.0, 0.0);
+ glVertex3f(avPos.x, avPos.y,afZ);
+ glTexCoord2f(1.0, 0.0);
+ glVertex3f(avPos.x+avSize.x, avPos.y,afZ);
+ glTexCoord2f(1.0, 1.0);
+ glVertex3f(avPos.x+avSize.x, avPos.y+avSize.y,afZ);
+ glTexCoord2f(0.0, 1.0);
+ glVertex3f(avPos.x, avPos.y+avSize.y,afZ);
+ }
+ glEnd();
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::FlushRendering() {
-#if 0
- glFlush();
-#endif
+ GL_CHECK(glFlush());
}
void cLowLevelGraphicsSDL::SwapBuffers() {
-#if 0
- glFlush();
- SDL_GL_SwapBuffers();
-#endif
+ GL_CHECK(glFlush());
+ g_system->updateScreen();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawTri(const tVertexVec &avVtx) {
-#if 0
- assert(avVtx.size()==3);
+ assert(avVtx.size()==3);
- glBegin(GL_TRIANGLES);
- {
- for(int i=0;i<3;i++){
- glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
- glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
- }
+ glBegin(GL_TRIANGLES);
+ {
+ for(int i=0;i<3;i++){
+ glTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, avVtx[i].tex.z);
+ glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
+ glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
}
- glEnd();
-#endif
+ }
+ glEnd();
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawTri(const cVertex *avVtx) {
-#if 0
- glBegin(GL_TRIANGLES);
- {
- for(int i=0;i<3;i++){
- glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
- glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
- }
+ glBegin(GL_TRIANGLES);
+ {
+ for(int i=0;i<3;i++) {
+ glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
+ glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
+ glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
}
- glEnd();
-#endif
+ }
+ glEnd();
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawQuad(const tVertexVec &avVtx) {
-#if 0
- assert(avVtx.size()==4);
+ assert(avVtx.size()==4);
- glBegin(GL_QUADS);
- {
- for(int i=0;i<4;i++){
- glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
- glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
- }
+ glBegin(GL_QUADS);
+ {
+ for(int i=0;i<4;i++){
+ glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
+ glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
+ glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
}
- glEnd();
-#endif
+ }
+ glEnd();
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawQuadMultiTex(const tVertexVec &avVtx, const tVector3fVec &avExtraUvs) {
-#if 0
- int lExtraUnits = (int)avExtraUvs.size()/4;
- glBegin(GL_QUADS);
+ int lExtraUnits = (int)avExtraUvs.size()/4;
+ glBegin(GL_QUADS);
+ {
+ for(int i=0;i<4;i++)
{
- for(int i=0;i<4;i++)
- {
- glMultiTexCoord3fARB(GL_TEXTURE0_ARB,avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
+ glMultiTexCoord3fARB(GL_TEXTURE0_ARB,avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
- for(int unit=0; unit<lExtraUnits; ++unit)
- {
- glMultiTexCoord3fARB(GL_TEXTURE0_ARB + unit + 1,
- avExtraUvs[unit*4 + i].x, avExtraUvs[unit*4 + i].y, avExtraUvs[unit*4 + i].z);
- }
-
- glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
+ for(int unit=0; unit<lExtraUnits; ++unit)
+ {
+ glMultiTexCoord3fARB(GL_TEXTURE0_ARB + unit + 1,
+ avExtraUvs[unit*4 + i].x, avExtraUvs[unit*4 + i].y, avExtraUvs[unit*4 + i].z);
}
+
+ glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
+ glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
}
- glEnd();
-#endif
+ }
+ glEnd();
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
@@ -1030,33 +697,28 @@ void cLowLevelGraphicsSDL::DestroyOcclusionQuery(iOcclusionQuery *apQuery) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::ClearScreen() {
-#if 0
- GLbitfield bitmask=0;
+ GLbitfield bitmask=0;
- if(mbClearColor)bitmask |= GL_COLOR_BUFFER_BIT;
- if(mbClearDepth)bitmask |= GL_DEPTH_BUFFER_BIT;
- if(mbClearStencil)bitmask |= GL_STENCIL_BUFFER_BIT;
+ if(mbClearColor)
+ bitmask |= GL_COLOR_BUFFER_BIT;
+ if(mbClearDepth)
+ bitmask |= GL_DEPTH_BUFFER_BIT;
+ if(mbClearStencil)
+ bitmask |= GL_STENCIL_BUFFER_BIT;
- glClear(bitmask);
-#endif
+ GL_CHECK(glClear(bitmask));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetClearColor(const cColor &aCol) {
-#if 0
- glClearColor(aCol.r, aCol.g, aCol.b, aCol.a);
-#endif
+ GL_CHECK(glClearColor(aCol.r, aCol.g, aCol.b, aCol.a));
}
void cLowLevelGraphicsSDL::SetClearDepth(float afDepth) {
-#if 0
- glClearDepth(afDepth);
-#endif
+ GL_CHECK(glClearDepth(afDepth));
}
void cLowLevelGraphicsSDL::SetClearStencil(int alVal) {
-#if 0
- glClearStencil(alVal);
-#endif
+ GL_CHECK(glClearStencil(alVal));
}
//-----------------------------------------------------------------------
@@ -1074,60 +736,55 @@ void cLowLevelGraphicsSDL::SetClearStencilActive(bool abX) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetColorWriteActive(bool abR, bool abG, bool abB, bool abA) {
-#if 0
- glColorMask(abR,abG,abB,abA);
-#endif
+ glColorMask(abR,abG,abB,abA);
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetDepthWriteActive(bool abX) {
-#if 0
- glDepthMask(abX);
-#endif
+ glDepthMask(abX);
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetDepthTestActive(bool abX) {
-#if 0
- if(abX) glEnable(GL_DEPTH_TEST);
- else glDisable(GL_DEPTH_TEST);
-#endif
+ if(abX)
+ glEnable(GL_DEPTH_TEST);
+ else
+ glDisable(GL_DEPTH_TEST);
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetDepthTestFunc(eDepthTestFunc aFunc) {
-#if 0
- glDepthFunc(GetGLDepthTestFuncEnum(aFunc));
-#endif
+ GL_CHECK(glDepthFunc(GetGLDepthTestFuncEnum(aFunc)));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetAlphaTestActive(bool abX) {
-#if 0
- if(abX) glEnable(GL_ALPHA_TEST);
- else glDisable(GL_ALPHA_TEST);
-#endif
+ if(abX)
+ glEnable(GL_ALPHA_TEST);
+ else
+ glDisable(GL_ALPHA_TEST);
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetAlphaTestFunc(eAlphaTestFunc aFunc, float afRef) {
-#if 0
- glAlphaFunc(GetGLAlphaTestFuncEnum(aFunc),afRef);
-#endif
+ GL_CHECK(glAlphaFunc(GetGLAlphaTestFuncEnum(aFunc),afRef));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetStencilActive(bool abX) {
-#if 0
- if(abX) glEnable(GL_STENCIL_TEST);
- else glDisable(GL_STENCIL_TEST);
-#endif
+ if(abX)
+ glEnable(GL_STENCIL_TEST);
+ else
+ glDisable(GL_STENCIL_TEST);
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
@@ -1171,204 +828,156 @@ void cLowLevelGraphicsSDL::SetStencilOp(eStencilOp aFailOp,eStencilOp aZFailOp,e
void cLowLevelGraphicsSDL::SetStencil(eStencilFunc aFunc, int alRef, unsigned int aMask,
eStencilOp aFailOp, eStencilOp aZFailOp, eStencilOp aZPassOp) {
#if 0
- if(GLEE_EXT_stencil_two_side)
- {
- //glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);//shouldn't be needed..
- glActiveStencilFaceEXT(GL_FRONT);
- }
- glStencilFunc(GetGLStencilFuncEnum(aFunc), alRef, aMask);
-
- glStencilOp(GetGLStencilOpEnum(aFailOp), GetGLStencilOpEnum(aZFailOp),
- GetGLStencilOpEnum(aZPassOp));
+ if (GetCaps(eGraphicCaps_TwoSideStencil)) {
+ //glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);//shouldn't be needed..
+ //glActiveStencilFace(GL_FRONT);
+ }
#endif
+ GL_CHECK(glStencilFunc(GetGLStencilFuncEnum(aFunc), alRef, aMask));
+
+ GL_CHECK(glStencilOp(GetGLStencilOpEnum(aFailOp), GetGLStencilOpEnum(aZFailOp),
+ GetGLStencilOpEnum(aZPassOp)));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetStencilTwoSide(eStencilFunc aFrontFunc, eStencilFunc aBackFunc,
- int alRef, unsigned int aMask,
- eStencilOp aFrontFailOp, eStencilOp aFrontZFailOp, eStencilOp aFrontZPassOp,
- eStencilOp aBackFailOp, eStencilOp aBackZFailOp, eStencilOp aBackZPassOp) {
-#if 0
- //Nvidia implementation
- if(GLEE_EXT_stencil_two_side)
- {
- glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
-
- //Front
- glActiveStencilFaceEXT(GL_FRONT);
- glStencilFunc(GetGLStencilFuncEnum(aFrontFunc), alRef, aMask);
-
- glStencilOp(GetGLStencilOpEnum(aFrontFailOp), GetGLStencilOpEnum(aFrontZFailOp),
- GetGLStencilOpEnum(aFrontZPassOp));
- //Back
- glActiveStencilFaceEXT(GL_BACK);
- glStencilFunc(GetGLStencilFuncEnum(aBackFunc), alRef, aMask);
-
- glStencilOp(GetGLStencilOpEnum(aBackFailOp), GetGLStencilOpEnum(aBackZFailOp),
- GetGLStencilOpEnum(aBackZPassOp));
- }
- //Ati implementation
- else if(GLEE_ATI_separate_stencil)
- {
- //Front
- glStencilOpSeparateATI( GL_FRONT, GetGLStencilOpEnum(aFrontFailOp),
- GetGLStencilOpEnum(aFrontZFailOp),
- GetGLStencilOpEnum(aFrontZPassOp));
- //Back
- glStencilOpSeparateATI( GL_BACK, GetGLStencilOpEnum(aBackFailOp),
- GetGLStencilOpEnum(aBackZFailOp),
- GetGLStencilOpEnum(aBackZPassOp));
-
- //Front and Back function
- glStencilFuncSeparateATI(GetGLStencilFuncEnum(aFrontFunc),
- GetGLStencilFuncEnum(aBackFunc),
- alRef, aMask);
+ int alRef, unsigned int aMask,eStencilOp aFrontFailOp, eStencilOp aFrontZFailOp, eStencilOp aFrontZPassOp,
+ eStencilOp aBackFailOp, eStencilOp aBackZFailOp, eStencilOp aBackZPassOp) {
+ if (GetCaps(eGraphicCaps_TwoSideStencil)) {
+ GL_CHECK(glStencilFuncSeparate(GL_FRONT, GetGLStencilFuncEnum(aFrontFunc), alRef, aMask));
+ GL_CHECK(glStencilOpSeparate(GL_FRONT, GetGLStencilOpEnum(aFrontFailOp), GetGLStencilOpEnum(aFrontZFailOp),
+ GetGLStencilOpEnum(aFrontZPassOp)))
+ GL_CHECK(glStencilFuncSeparate(GL_BACK, GetGLStencilFuncEnum(aBackFunc), alRef, aMask));
+ GL_CHECK(glStencilOpSeparate(GL_BACK, GetGLStencilOpEnum(aBackFailOp), GetGLStencilOpEnum(aBackZFailOp),
+ GetGLStencilOpEnum(aBackZPassOp)));
}
else
- {
- FatalError("Only single sided stencil supported!\n");
- }
-#endif
+ error("Only single sided stencil supported");
}
void cLowLevelGraphicsSDL::SetStencilTwoSide(bool abX) {
-#if 0
- if(GLEE_EXT_stencil_two_side)
- {
- glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
- }
-#endif
+ if (GetCaps(eGraphicCaps_TwoSideStencil))
+ Hpl1::logError(Hpl1::kDebugOpenGL, "call to setStencilTwoSide with two side stencil enabled");
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetCullActive(bool abX) {
-#if 0
- if(abX) glEnable(GL_CULL_FACE);
- else glDisable(GL_CULL_FACE);
- glCullFace(GL_BACK);
-#endif
+ if(abX)
+ glEnable(GL_CULL_FACE);
+ else
+ glDisable(GL_CULL_FACE);
+ GL_CHECK_FN();
+ GL_CHECK(glCullFace(GL_BACK));
}
void cLowLevelGraphicsSDL::SetCullMode(eCullMode aMode) {
-#if 0
- glCullFace(GL_BACK);
- if(aMode == eCullMode_Clockwise) glFrontFace(GL_CCW);
- else
+ GL_CHECK(glCullFace(GL_BACK));
+ if(aMode == eCullMode_Clockwise)
+ glFrontFace(GL_CCW);
+ else
glFrontFace(GL_CW);
-#endif
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
-void cLowLevelGraphicsSDL::SetScissorActive(bool abX) {
-#if 0
- if(abX) glEnable(GL_SCISSOR_TEST);
- else glDisable(GL_SCISSOR_TEST);
-#endif
+void cLowLevelGraphicsSDL::SetScissorActive(bool toggle) {
+ if(toggle)
+ glEnable(GL_SCISSOR_TEST);
+ else
+ glDisable(GL_SCISSOR_TEST);
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetScissorRect(const cRect2l &aRect) {
-#if 0
- glScissor(aRect.x, (mvScreenSize.y - aRect.y - 1)-aRect.h, aRect.w, aRect.h);
-#endif
+ glScissor(aRect.x, (mvScreenSize.y - aRect.y - 1)-aRect.h, aRect.w, aRect.h);
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetBlendActive(bool abX) {
-#if 0
- if(abX)
- glEnable(GL_BLEND);
- else
- glDisable(GL_BLEND);
-#endif
+ if(abX)
+ glEnable(GL_BLEND);
+ else
+ glDisable(GL_BLEND);
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetBlendFunc(eBlendFunc aSrcFactor, eBlendFunc aDestFactor) {
-#if 0
- glBlendFunc(GetGLBlendEnum(aSrcFactor),GetGLBlendEnum(aDestFactor));
-#endif
+ GL_CHECK(glBlendFunc(GetGLBlendEnum(aSrcFactor), GetGLBlendEnum(aDestFactor)));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetBlendFuncSeparate(eBlendFunc aSrcFactorColor, eBlendFunc aDestFactorColor,
- eBlendFunc aSrcFactorAlpha, eBlendFunc aDestFactorAlpha) {
-#if 0
- if(GLEE_EXT_blend_func_separate)
- {
- glBlendFuncSeparateEXT(GetGLBlendEnum(aSrcFactorColor),
- GetGLBlendEnum(aDestFactorColor),
- GetGLBlendEnum(aSrcFactorAlpha),
- GetGLBlendEnum(aDestFactorAlpha));
- }
- else
- {
- glBlendFunc(GetGLBlendEnum(aSrcFactorColor),GetGLBlendEnum(aDestFactorColor));
- }
-#endif
+ eBlendFunc aSrcFactorAlpha, eBlendFunc aDestFactorAlpha) {
+ if (GetCaps(eGraphicCaps_GL_BlendFunctionSeparate)) {
+
+ glBlendFuncSeparate(GetGLBlendEnum(aSrcFactorColor),
+ GetGLBlendEnum(aDestFactorColor),
+ GetGLBlendEnum(aSrcFactorAlpha),
+ GetGLBlendEnum(aDestFactorAlpha));
+ } else {
+ glBlendFunc(GetGLBlendEnum(aSrcFactorColor), GetGLBlendEnum(aDestFactorColor));
+ }
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawQuad(const tVertexVec &avVtx, const cColor aCol) {
-#if 0
- assert(avVtx.size()==4);
+ assert(avVtx.size()==4);
- glBegin(GL_QUADS);
- {
- //Make all this inline??
- for(int i=0;i<4;i++){
- glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
- }
+ glBegin(GL_QUADS);
+ {
+ //Make all this inline??
+ for(int i=0;i<4;i++){
+ glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
+ glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
}
- glEnd();
-#endif
+ }
+ glEnd();
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawQuad(const tVertexVec &avVtx, const float afZ) {
-#if 0
- assert(avVtx.size()==4);
+ assert(avVtx.size()==4);
- glBegin(GL_QUADS);
- {
- //Make all this inline??
- for(int i=0;i<4;i++){
- glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,afZ);
- glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
- }
+ glBegin(GL_QUADS);
+ {
+ //Make all this inline??
+ for(int i=0;i<4;i++){
+ glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,afZ);
+ glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
+ glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
}
- glEnd();
-#endif
+ }
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawQuad(const tVertexVec &avVtx, const float afZ, const cColor &aCol) {
-#if 0
- assert(avVtx.size()==4);
+ assert(avVtx.size()==4);
- glBegin(GL_QUADS);
- {
- //Make all this inline??
- for(int i=0;i<4;i++){
- glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,afZ);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
- }
+ glBegin(GL_QUADS);
+ {
+ //Make all this inline??
+ for(int i=0;i<4;i++){
+ glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,afZ);
+ glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
}
- glEnd();
-#endif
+ }
+ glEnd();
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
@@ -1517,53 +1126,40 @@ void cLowLevelGraphicsSDL::AddTexCoordToBatch(unsigned int alUnit, const cVector
//-----------------------------------------------------------------------
-void cLowLevelGraphicsSDL::SetBatchTextureUnitActive(unsigned int alUnit, bool abActive) {
-#if 0
- glClientActiveTextureARB(GL_TEXTURE0_ARB+alUnit);
+void cLowLevelGraphicsSDL::SetBatchTextureUnitActive(unsigned int alUnit, bool active) {
+ GL_CHECK(glClientActiveTextureARB(GL_TEXTURE0_ARB+alUnit));
- if(abActive==false){
- glTexCoordPointer(3,GL_FLOAT,sizeof(float)*mlBatchStride, &mpVertexArray[7]);
- }
- else {
- glTexCoordPointer(3,GL_FLOAT,0, &mpTexCoordArray[alUnit][0]);
- }
-#endif
+ if (active)
+ glTexCoordPointer(3,GL_FLOAT,0, &mpTexCoordArray[alUnit][0]);
+ else
+ glTexCoordPointer(3,GL_FLOAT,sizeof(float)*mlBatchStride, &mpVertexArray[7]);
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
-void cLowLevelGraphicsSDL::FlushTriBatch(tVtxBatchFlag aTypeFlags, bool abAutoClear) {
-#if 0
- SetVtxBatchStates(aTypeFlags);
- SetUpBatchArrays();
-
- glDrawElements(GL_TRIANGLES,mlIndexCount,GL_UNSIGNED_INT, mpIndexArray);
+static void flushAutoClear(unsigned &indexCount, unsigned &vertexCount, unsigned *texCoordArray) {
+ indexCount = 0;
+ vertexCount = 0;
+ Common::fill(texCoordArray, texCoordArray + MAX_TEXTUREUNITS, 0);
+}
- if(abAutoClear){
- mlIndexCount = 0;
- mlVertexCount = 0;
- for(int i=0;i<MAX_TEXTUREUNITS;i++)
- mlTexCoordArrayCount[i]=0;
- }
-#endif
+void cLowLevelGraphicsSDL::FlushTriBatch(tVtxBatchFlag aTypeFlags, bool abAutoClear) {
+ SetVtxBatchStates(aTypeFlags);
+ SetUpBatchArrays();
+ GL_CHECK(glDrawElements(GL_TRIANGLES, mlIndexCount, GL_UNSIGNED_INT, mpIndexArray));
+ if (abAutoClear)
+ flushAutoClear(mlIndexCount, mlVertexCount, mlTexCoordArrayCount);
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::FlushQuadBatch(tVtxBatchFlag aTypeFlags, bool abAutoClear) {
-#if 0
- SetVtxBatchStates(aTypeFlags);
- SetUpBatchArrays();
-
- glDrawElements(GL_QUADS,mlIndexCount,GL_UNSIGNED_INT, mpIndexArray);
-
- if(abAutoClear){
- mlIndexCount = 0;
- mlVertexCount = 0;
- for(int i=0;i<MAX_TEXTUREUNITS;i++)
- mlTexCoordArrayCount[i]=0;
- }
-#endif
+ SetVtxBatchStates(aTypeFlags);
+ SetUpBatchArrays();
+ GL_CHECK(glDrawElements(GL_QUADS,mlIndexCount,GL_UNSIGNED_INT, mpIndexArray));
+ if (abAutoClear)
+ flushAutoClear(mlIndexCount, mlVertexCount, mlTexCoordArrayCount);
}
//-----------------------------------------------------------------------
@@ -1576,178 +1172,165 @@ void cLowLevelGraphicsSDL::ClearBatch() {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawLine(const cVector3f &avBegin, const cVector3f &avEnd, cColor aCol) {
-#if 0
- SetTexture(0,NULL);
- //SetBlendActive(false);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
- glBegin(GL_LINES);
- {
- glVertex3f(avBegin.x,avBegin.y,avBegin.z);
- glVertex3f(avEnd.x,avEnd.y,avEnd.z);
- }
- glEnd();
-#endif
+ SetTexture(0, nullptr);
+ //SetBlendActive(false);
+ glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ glBegin(GL_LINES);
+ {
+ glVertex3f(avBegin.x,avBegin.y,avBegin.z);
+ glVertex3f(avEnd.x,avEnd.y,avEnd.z);
+ }
+ glEnd();
+ GL_CHECK_FN();
}
void cLowLevelGraphicsSDL::DrawBoxMaxMin(const cVector3f &avMax, const cVector3f &avMin, cColor aCol) {
-#if 0
- SetTexture(0,NULL);
- SetBlendActive(false);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ SetTexture(0,NULL);
+ SetBlendActive(false);
+ glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
- glBegin(GL_LINES);
- {
- //Pos Z Quad
- glVertex3f(avMax.x,avMax.y,avMax.z);
- glVertex3f(avMin.x,avMax.y,avMax.z);
+ glBegin(GL_LINES);
+ {
+ //Pos Z Quad
+ glVertex3f(avMax.x,avMax.y,avMax.z);
+ glVertex3f(avMin.x,avMax.y,avMax.z);
- glVertex3f(avMax.x,avMax.y,avMax.z);
- glVertex3f(avMax.x,avMin.y,avMax.z);
+ glVertex3f(avMax.x,avMax.y,avMax.z);
+ glVertex3f(avMax.x,avMin.y,avMax.z);
- glVertex3f(avMin.x,avMax.y,avMax.z);
- glVertex3f(avMin.x,avMin.y,avMax.z);
+ glVertex3f(avMin.x,avMax.y,avMax.z);
+ glVertex3f(avMin.x,avMin.y,avMax.z);
- glVertex3f(avMin.x,avMin.y,avMax.z);
- glVertex3f(avMax.x,avMin.y,avMax.z);
+ glVertex3f(avMin.x,avMin.y,avMax.z);
+ glVertex3f(avMax.x,avMin.y,avMax.z);
- //Neg Z Quad
- glVertex3f(avMax.x,avMax.y,avMin.z);
- glVertex3f(avMin.x,avMax.y,avMin.z);
+ //Neg Z Quad
+ glVertex3f(avMax.x,avMax.y,avMin.z);
+ glVertex3f(avMin.x,avMax.y,avMin.z);
- glVertex3f(avMax.x,avMax.y,avMin.z);
- glVertex3f(avMax.x,avMin.y,avMin.z);
+ glVertex3f(avMax.x,avMax.y,avMin.z);
+ glVertex3f(avMax.x,avMin.y,avMin.z);
- glVertex3f(avMin.x,avMax.y,avMin.z);
- glVertex3f(avMin.x,avMin.y,avMin.z);
+ glVertex3f(avMin.x,avMax.y,avMin.z);
+ glVertex3f(avMin.x,avMin.y,avMin.z);
- glVertex3f(avMin.x,avMin.y,avMin.z);
- glVertex3f(avMax.x,avMin.y,avMin.z);
+ glVertex3f(avMin.x,avMin.y,avMin.z);
+ glVertex3f(avMax.x,avMin.y,avMin.z);
- //Lines between
- glVertex3f(avMax.x,avMax.y,avMax.z);
- glVertex3f(avMax.x,avMax.y,avMin.z);
+ //Lines between
+ glVertex3f(avMax.x,avMax.y,avMax.z);
+ glVertex3f(avMax.x,avMax.y,avMin.z);
- glVertex3f(avMin.x,avMax.y,avMax.z);
- glVertex3f(avMin.x,avMax.y,avMin.z);
+ glVertex3f(avMin.x,avMax.y,avMax.z);
+ glVertex3f(avMin.x,avMax.y,avMin.z);
- glVertex3f(avMin.x,avMin.y,avMax.z);
- glVertex3f(avMin.x,avMin.y,avMin.z);
+ glVertex3f(avMin.x,avMin.y,avMax.z);
+ glVertex3f(avMin.x,avMin.y,avMin.z);
- glVertex3f(avMax.x,avMin.y,avMax.z);
- glVertex3f(avMax.x,avMin.y,avMin.z);
- }
- glEnd();
-#endif
+ glVertex3f(avMax.x,avMin.y,avMax.z);
+ glVertex3f(avMax.x,avMin.y,avMin.z);
+ }
+ glEnd();
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawSphere(const cVector3f &avPos, float afRadius, cColor aCol) {
-#if 0
- int alSegments = 32;
- float afAngleStep = k2Pif /(float)alSegments;
+ int alSegments = 32;
+ float afAngleStep = k2Pif /(float)alSegments;
- SetTexture(0,NULL);
- SetBlendActive(false);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
- glBegin(GL_LINES);
+ SetTexture(0,nullptr);
+ SetBlendActive(false);
+ glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ glBegin(GL_LINES);
+ {
+ //X Circle:
+ for(float a=0; a< k2Pif; a+= afAngleStep)
{
- //X Circle:
- for(float a=0; a< k2Pif; a+= afAngleStep)
- {
- glVertex3f(avPos.x, avPos.y + sin(a)*afRadius,
- avPos.z + cos(a)*afRadius);
-
- glVertex3f(avPos.x, avPos.y + sin(a+afAngleStep)*afRadius,
- avPos.z + cos(a+afAngleStep)*afRadius);
- }
+ glVertex3f(avPos.x, avPos.y + sin(a)*afRadius,
+ avPos.z + cos(a)*afRadius);
- //Y Circle:
- for(float a=0; a< k2Pif; a+= afAngleStep)
- {
- glVertex3f(avPos.x + cos(a)*afRadius, avPos.y,
- avPos.z + sin(a)*afRadius);
+ glVertex3f(avPos.x, avPos.y + sin(a+afAngleStep)*afRadius,
+ avPos.z + cos(a+afAngleStep)*afRadius);
+ }
- glVertex3f(avPos.x + cos(a+afAngleStep)*afRadius, avPos.y ,
- avPos.z+ sin(a+afAngleStep)*afRadius);
- }
+ //Y Circle:
+ for(float a=0; a< k2Pif; a+= afAngleStep)
+ {
+ glVertex3f(avPos.x + cos(a)*afRadius, avPos.y,
+ avPos.z + sin(a)*afRadius);
- //Z Circle:
- for(float a=0; a< k2Pif; a+= afAngleStep)
- {
- glVertex3f(avPos.x + cos(a)*afRadius, avPos.y + sin(a)*afRadius, avPos.z);
+ glVertex3f(avPos.x + cos(a+afAngleStep)*afRadius, avPos.y ,
+ avPos.z+ sin(a+afAngleStep)*afRadius);
+ }
- glVertex3f(avPos.x + cos(a+afAngleStep)*afRadius,
- avPos.y + sin(a+afAngleStep)*afRadius,
- avPos.z);
- }
+ //Z Circle:
+ for(float a=0; a< k2Pif; a+= afAngleStep)
+ {
+ glVertex3f(avPos.x + cos(a)*afRadius, avPos.y + sin(a)*afRadius, avPos.z);
+ glVertex3f(avPos.x + cos(a+afAngleStep)*afRadius,
+ avPos.y + sin(a+afAngleStep)*afRadius,
+ avPos.z);
}
- glEnd();
-#endif
+
+ }
+ glEnd();
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawLine2D(const cVector2f &avBegin, const cVector2f &avEnd, float afZ, cColor aCol) {
-#if 0
- SetTexture(0,NULL);
- SetBlendActive(false);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
- glBegin(GL_LINES);
- {
- glVertex3f(avBegin.x,avBegin.y,afZ);
- glVertex3f(avEnd.x,avEnd.y,afZ);
- }
- glEnd();
-#endif
+ SetTexture(0,NULL);
+ SetBlendActive(false);
+ glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ glBegin(GL_LINES);
+ {
+ glVertex3f(avBegin.x,avBegin.y,afZ);
+ glVertex3f(avEnd.x,avEnd.y,afZ);
+ }
+ glEnd();
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawLineRect2D(const cRect2f &aRect, float afZ, cColor aCol) {
-#if 0
- SetTexture(0, NULL);
- SetBlendActive(false);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
- glBegin(GL_LINE_STRIP);
- {
- glVertex3f(aRect.x,aRect.y,afZ);
- glVertex3f(aRect.x+aRect.w,aRect.y,afZ);
- glVertex3f(aRect.x+aRect.w,aRect.y+aRect.h,afZ);
- glVertex3f(aRect.x,aRect.y+aRect.h,afZ);
- glVertex3f(aRect.x,aRect.y,afZ);
- }
- glEnd();
-#endif
+ SetTexture(0, nullptr);
+ SetBlendActive(false);
+ glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ glBegin(GL_LINE_STRIP);
+ {
+ glVertex3f(aRect.x,aRect.y,afZ);
+ glVertex3f(aRect.x+aRect.w,aRect.y,afZ);
+ glVertex3f(aRect.x+aRect.w,aRect.y+aRect.h,afZ);
+ glVertex3f(aRect.x,aRect.y+aRect.h,afZ);
+ glVertex3f(aRect.x,aRect.y,afZ);
+ }
+ glEnd();
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawFilledRect2D(const cRect2f &aRect, float afZ, cColor aCol) {
-#if 0
- SetTexture(0, NULL);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
- glBegin(GL_QUADS);
- {
- glVertex3f(aRect.x,aRect.y,afZ);
- glVertex3f(aRect.x+aRect.w,aRect.y,afZ);
- glVertex3f(aRect.x+aRect.w,aRect.y+aRect.h,afZ);
- glVertex3f(aRect.x,aRect.y+aRect.h,afZ);
- }
- glEnd();
-#endif
+ SetTexture(0, NULL);
+ glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ glBegin(GL_QUADS);
+ {
+ glVertex3f(aRect.x,aRect.y,afZ);
+ glVertex3f(aRect.x+aRect.w,aRect.y,afZ);
+ glVertex3f(aRect.x+aRect.w,aRect.y+aRect.h,afZ);
+ glVertex3f(aRect.x,aRect.y+aRect.h,afZ);
+ }
+ glEnd();
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
-/**
- * \todo Implement this.
- * \param avCenter
- * \param afRadius
- * \param afZ
- * \param aCol
- */
void cLowLevelGraphicsSDL::DrawLineCircle2D(const cVector2f &avCenter, float afRadius, float afZ, cColor aCol) {
// Implement later
}
@@ -1755,9 +1338,9 @@ void cLowLevelGraphicsSDL::DrawLineCircle2D(const cVector2f &avCenter, float afR
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::CopyContextToTexure(iTexture *apTex, const cVector2l &avPos,
- const cVector2l &avSize, const cVector2l &avTexOffset) {
-#if 0
- if(apTex==NULL)return;
+ const cVector2l &avSize, const cVector2l &avTexOffset) {
+ if(apTex == nullptr)
+ return;
int lScreenY = (mvScreenSize.y - avSize.y) - avPos.y;
int lTexY = (apTex->GetHeight() - avSize.y) - avTexOffset.y;
@@ -1767,10 +1350,8 @@ void cLowLevelGraphicsSDL::CopyContextToTexure(iTexture *apTex, const cVector2l
// avSize.y,avPos.y);
SetTexture(0, apTex);
- glCopyTexSubImage2D(GetGLTextureTargetEnum(apTex->GetTarget()),0,
- avTexOffset.x, lTexY,
- avPos.x, lScreenY, avSize.x, avSize.y);
-#endif
+ GL_CHECK(glCopyTexSubImage2D(GetGLTextureTargetEnum(apTex->GetTarget()),0,
+ avTexOffset.x, lTexY, avPos.x, lScreenY, avSize.x, avSize.y));
}
//-----------------------------------------------------------------------
@@ -1868,283 +1449,330 @@ void cLowLevelGraphicsSDL::SetVirtualSize(cVector2f avSize) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetUpBatchArrays() {
-#if 0
- //Set the arrays
- glVertexPointer(3,GL_FLOAT, sizeof(float)*mlBatchStride, mpVertexArray);
- glColorPointer(4,GL_FLOAT,sizeof(float)*mlBatchStride, &mpVertexArray[3]);
- glNormalPointer(GL_FLOAT,sizeof(float)*mlBatchStride, &mpVertexArray[10]);
+ //Set the arrays
+ glVertexPointer(3,GL_FLOAT, sizeof(float)*mlBatchStride, mpVertexArray);
+ glColorPointer(4,GL_FLOAT, sizeof(float)*mlBatchStride, &mpVertexArray[3]);
+ glNormalPointer(GL_FLOAT, sizeof(float)*mlBatchStride, &mpVertexArray[10]);
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- glTexCoordPointer(3,GL_FLOAT,sizeof(float)*mlBatchStride, &mpVertexArray[7]);
- glClientActiveTextureARB(GL_TEXTURE1_ARB);
- glTexCoordPointer(3,GL_FLOAT,sizeof(float)*mlBatchStride, &mpVertexArray[7]);
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glTexCoordPointer(3,GL_FLOAT,sizeof(float)*mlBatchStride, &mpVertexArray[7]);
-#endif
+ glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ glTexCoordPointer(3,GL_FLOAT, sizeof(float)*mlBatchStride, &mpVertexArray[7]);
+ glClientActiveTextureARB(GL_TEXTURE1_ARB);
+ glTexCoordPointer(3,GL_FLOAT, sizeof(float)*mlBatchStride, &mpVertexArray[7]);
+ glClientActiveTextureARB(GL_TEXTURE2_ARB);
+ glTexCoordPointer(3,GL_FLOAT, sizeof(float)*mlBatchStride, &mpVertexArray[7]);
+ GL_CHECK_FN();
}
//-----------------------------------------------------------------------
-void cLowLevelGraphicsSDL::SetVtxBatchStates(tVtxBatchFlag aFlags) {
-#if 0
- if(aFlags & eVtxBatchFlag_Position) glEnableClientState(GL_VERTEX_ARRAY );
- else glDisableClientState(GL_VERTEX_ARRAY );
-
- if(aFlags & eVtxBatchFlag_Color0) glEnableClientState(GL_COLOR_ARRAY );
- else glDisableClientState(GL_COLOR_ARRAY );
-
- if(aFlags & eVtxBatchFlag_Normal) glEnableClientState(GL_NORMAL_ARRAY );
- else glDisableClientState(GL_NORMAL_ARRAY );
+void cLowLevelGraphicsSDL::SetVtxBatchStates(tVtxBatchFlag flags) {
+ if (flags & eVtxBatchFlag_Position) {
+ GL_CHECK(glEnableClientState(GL_VERTEX_ARRAY));
+ } else {
+ GL_CHECK(glDisableClientState(GL_VERTEX_ARRAY));
+ }
+ if (flags & eVtxBatchFlag_Color0) {
+ GL_CHECK(glEnableClientState(GL_COLOR_ARRAY));
+ } else {
+ GL_CHECK(glDisableClientState(GL_COLOR_ARRAY));
+ }
- if(aFlags & eVtxBatchFlag_Texture0){
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY );
- }
- else {
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY );
- }
+ if (flags & eVtxBatchFlag_Normal) {
+ GL_CHECK(glEnableClientState(GL_NORMAL_ARRAY));
+ } else {
+ GL_CHECK(glDisableClientState(GL_NORMAL_ARRAY));
+ }
- if(aFlags & eVtxBatchFlag_Texture1){
- glClientActiveTextureARB(GL_TEXTURE1_ARB);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY );
- }
- else {
- glClientActiveTextureARB(GL_TEXTURE1_ARB);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY );
- }
+ if (flags & eVtxBatchFlag_Texture0) {
+ GL_CHECK(glClientActiveTextureARB(GL_TEXTURE0_ARB));
+ GL_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
+ } else {
+ GL_CHECK(glClientActiveTextureARB(GL_TEXTURE0_ARB));
+ GL_CHECK(glDisableClientState(GL_TEXTURE_COORD_ARRAY));
+ }
- if(aFlags & eVtxBatchFlag_Texture2){
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY );
- }
- else {
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY );
- }
+ if (flags & eVtxBatchFlag_Texture1) {
+ GL_CHECK(glClientActiveTextureARB(GL_TEXTURE1_ARB));
+ GL_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
+ } else {
+ GL_CHECK(glClientActiveTextureARB(GL_TEXTURE1_ARB));
+ GL_CHECK(glDisableClientState(GL_TEXTURE_COORD_ARRAY));
+ }
-#endif
+ if (flags & eVtxBatchFlag_Texture2) {
+ GL_CHECK(glClientActiveTextureARB(GL_TEXTURE2_ARB));
+ GL_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
+ } else {
+ GL_CHECK(glClientActiveTextureARB(GL_TEXTURE2_ARB));
+ GL_CHECK(glDisableClientState(GL_TEXTURE_COORD_ARRAY));
+ }
}
//-----------------------------------------------------------------------
-GLenum cLowLevelGraphicsSDL::GetGLBlendEnum(eBlendFunc aType) {
-#if 0
- switch(aType)
- {
- case eBlendFunc_Zero: return GL_ZERO;
- case eBlendFunc_One: return GL_ONE;
- case eBlendFunc_SrcColor: return GL_SRC_COLOR;
- case eBlendFunc_OneMinusSrcColor: return GL_ONE_MINUS_SRC_COLOR;
- case eBlendFunc_DestColor: return GL_DST_COLOR;
- case eBlendFunc_OneMinusDestColor: return GL_ONE_MINUS_DST_COLOR;
- case eBlendFunc_SrcAlpha: return GL_SRC_ALPHA;
- case eBlendFunc_OneMinusSrcAlpha: return GL_ONE_MINUS_SRC_ALPHA;
- case eBlendFunc_DestAlpha: return GL_DST_ALPHA;
- case eBlendFunc_OneMinusDestAlpha: return GL_ONE_MINUS_DST_ALPHA;
- case eBlendFunc_SrcAlphaSaturate: return GL_SRC_ALPHA_SATURATE;
- }
-#endif
+GLenum cLowLevelGraphicsSDL::GetGLBlendEnum(eBlendFunc type) {
+ switch (type) {
+ case eBlendFunc_Zero:
+ return GL_ZERO;
+ case eBlendFunc_One:
+ return GL_ONE;
+ case eBlendFunc_SrcColor:
+ return GL_SRC_COLOR;
+ case eBlendFunc_OneMinusSrcColor:
+ return GL_ONE_MINUS_SRC_COLOR;
+ case eBlendFunc_DestColor:
+ return GL_DST_COLOR;
+ case eBlendFunc_OneMinusDestColor:
+ return GL_ONE_MINUS_DST_COLOR;
+ case eBlendFunc_SrcAlpha:
+ return GL_SRC_ALPHA;
+ case eBlendFunc_OneMinusSrcAlpha:
+ return GL_ONE_MINUS_SRC_ALPHA;
+ case eBlendFunc_DestAlpha:
+ return GL_DST_ALPHA;
+ case eBlendFunc_OneMinusDestAlpha:
+ return GL_ONE_MINUS_DST_ALPHA;
+ case eBlendFunc_SrcAlphaSaturate:
+ return GL_SRC_ALPHA_SATURATE;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid blend op (%d)", type);
return 0;
}
//-----------------------------------------------------------------------
-GLenum cLowLevelGraphicsSDL::GetGLTextureParamEnum(eTextureParam aType) {
-#if 0
- switch(aType)
- {
- case eTextureParam_ColorFunc: return GL_COMBINE_RGB_ARB;
- case eTextureParam_AlphaFunc: return GL_COMBINE_ALPHA_ARB;
- case eTextureParam_ColorSource0: return GL_SOURCE0_RGB_ARB;
- case eTextureParam_ColorSource1: return GL_SOURCE1_RGB_ARB;
- case eTextureParam_ColorSource2: return GL_SOURCE2_RGB_ARB;
- case eTextureParam_AlphaSource0: return GL_SOURCE0_ALPHA_ARB;
- case eTextureParam_AlphaSource1: return GL_SOURCE1_ALPHA_ARB;
- case eTextureParam_AlphaSource2: return GL_SOURCE2_ALPHA_ARB;
- case eTextureParam_ColorOp0: return GL_OPERAND0_RGB_ARB;
- case eTextureParam_ColorOp1: return GL_OPERAND1_RGB_ARB;
- case eTextureParam_ColorOp2: return GL_OPERAND2_RGB_ARB;
- case eTextureParam_AlphaOp0: return GL_OPERAND0_ALPHA_ARB;
- case eTextureParam_AlphaOp1: return GL_OPERAND1_ALPHA_ARB;
- case eTextureParam_AlphaOp2: return GL_OPERAND2_ALPHA_ARB;
- case eTextureParam_ColorScale: return GL_RGB_SCALE_ARB;
- case eTextureParam_AlphaScale: return GL_ALPHA_SCALE;
- }
-#endif
+GLenum cLowLevelGraphicsSDL::GetGLTextureParamEnum(eTextureParam type) {
+ switch (type) {
+ case eTextureParam_ColorFunc:
+ return GL_COMBINE_RGB;
+ case eTextureParam_AlphaFunc:
+ return GL_COMBINE_ALPHA;
+ case eTextureParam_ColorSource0:
+ return GL_SOURCE0_RGB;
+ case eTextureParam_ColorSource1:
+ return GL_SOURCE1_RGB;
+ case eTextureParam_ColorSource2:
+ return GL_SOURCE2_RGB;
+ case eTextureParam_AlphaSource0:
+ return GL_SOURCE0_ALPHA;
+ case eTextureParam_AlphaSource1:
+ return GL_SOURCE1_ALPHA;
+ case eTextureParam_AlphaSource2:
+ return GL_SOURCE2_ALPHA;
+ case eTextureParam_ColorOp0:
+ return GL_OPERAND0_RGB;
+ case eTextureParam_ColorOp1:
+ return GL_OPERAND1_RGB;
+ case eTextureParam_ColorOp2:
+ return GL_OPERAND2_RGB;
+ case eTextureParam_AlphaOp0:
+ return GL_OPERAND0_ALPHA;
+ case eTextureParam_AlphaOp1:
+ return GL_OPERAND1_ALPHA;
+ case eTextureParam_AlphaOp2:
+ return GL_OPERAND2_ALPHA;
+ case eTextureParam_ColorScale:
+ return GL_RGB_SCALE;
+ case eTextureParam_AlphaScale:
+ return GL_ALPHA_SCALE;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture parameter (%d)", type);
return 0;
}
//-----------------------------------------------------------------------
-GLenum cLowLevelGraphicsSDL::GetGLTextureOpEnum(eTextureOp aType) {
-#if 0
- switch(aType)
- {
- case eTextureOp_Color: return GL_SRC_COLOR;
- case eTextureOp_OneMinusColor: return GL_ONE_MINUS_SRC_COLOR;
- case eTextureOp_Alpha: return GL_SRC_ALPHA;
- case eTextureOp_OneMinusAlpha: return GL_ONE_MINUS_SRC_ALPHA;
+GLenum cLowLevelGraphicsSDL::GetGLTextureOpEnum(eTextureOp type) {
+ switch (type) {
+ case eTextureOp_Color:
+ return GL_SRC_COLOR;
+ case eTextureOp_OneMinusColor:
+ return GL_ONE_MINUS_SRC_COLOR;
+ case eTextureOp_Alpha:
+ return GL_SRC_ALPHA;
+ case eTextureOp_OneMinusAlpha:
+ return GL_ONE_MINUS_SRC_ALPHA;
}
-#endif
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture op (%d)", type);
return 0;
}
//-----------------------------------------------------------------------
-GLenum cLowLevelGraphicsSDL::GetGLTextureSourceEnum(eTextureSource aType) {
-#if 0
- switch(aType)
- {
- case eTextureSource_Texture: return GL_TEXTURE;
- case eTextureSource_Constant: return GL_CONSTANT_ARB;
- case eTextureSource_Primary: return GL_PRIMARY_COLOR_ARB;
- case eTextureSource_Previous: return GL_PREVIOUS_ARB;
- }
-#endif
+GLenum cLowLevelGraphicsSDL::GetGLTextureSourceEnum(eTextureSource type) {
+ switch (type) {
+ case eTextureSource_Texture:
+ return GL_TEXTURE;
+ case eTextureSource_Constant:
+ return GL_CONSTANT;
+ case eTextureSource_Primary:
+ return GL_PRIMARY_COLOR;
+ case eTextureSource_Previous:
+ return GL_PREVIOUS;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture source (%d)", type);
return 0;
}
//-----------------------------------------------------------------------
-GLenum cLowLevelGraphicsSDL::GetGLTextureTargetEnum(eTextureTarget aType) {
-#if 0
- switch(aType)
- {
- case eTextureTarget_1D: return GL_TEXTURE_1D;
- case eTextureTarget_2D: return GL_TEXTURE_2D;
- case eTextureTarget_Rect:
- {
- return GL_TEXTURE_RECTANGLE_NV;
- }
- case eTextureTarget_CubeMap: return GL_TEXTURE_CUBE_MAP_ARB;
- case eTextureTarget_3D: return GL_TEXTURE_3D;
- }
-#endif
+GLenum cLowLevelGraphicsSDL::GetGLTextureTargetEnum(eTextureTarget type) {
+ switch (type) {
+ case eTextureTarget_1D:
+ return GL_TEXTURE_1D;
+ case eTextureTarget_2D:
+ return GL_TEXTURE_2D;
+ case eTextureTarget_Rect:
+ return GL_TEXTURE_RECTANGLE;
+ case eTextureTarget_CubeMap:
+ return GL_TEXTURE_CUBE_MAP;
+ case eTextureTarget_3D:
+ return GL_TEXTURE_3D;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture target (%d)", type);
return 0;
}
//-----------------------------------------------------------------------
-GLenum cLowLevelGraphicsSDL::GetGLTextureFuncEnum(eTextureFunc aType) {
-#if 0
- switch(aType)
- {
- case eTextureFunc_Modulate: return GL_MODULATE;
- case eTextureFunc_Replace: return GL_REPLACE;
- case eTextureFunc_Add: return GL_ADD;
- case eTextureFunc_Substract: return GL_SUBTRACT_ARB;
- case eTextureFunc_AddSigned: return GL_ADD_SIGNED_ARB;
- case eTextureFunc_Interpolate: return GL_INTERPOLATE_ARB;
- case eTextureFunc_Dot3RGB: return GL_DOT3_RGB_ARB;
- case eTextureFunc_Dot3RGBA: return GL_DOT3_RGBA_ARB;
- }
-#endif
+GLenum cLowLevelGraphicsSDL::GetGLTextureFuncEnum(eTextureFunc type) {
+ switch (type) {
+ case eTextureFunc_Modulate:
+ return GL_MODULATE;
+ case eTextureFunc_Replace:
+ return GL_REPLACE;
+ case eTextureFunc_Add:
+ return GL_ADD;
+ case eTextureFunc_Substract:
+ return GL_SUBTRACT;
+ case eTextureFunc_AddSigned:
+ return GL_ADD_SIGNED;
+ case eTextureFunc_Interpolate:
+ return GL_INTERPOLATE;
+ case eTextureFunc_Dot3RGB:
+ return GL_DOT3_RGB;
+ case eTextureFunc_Dot3RGBA:
+ return GL_DOT3_RGBA;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture function (%d)", type);
return 0;
}
//-----------------------------------------------------------------------
-GLenum cLowLevelGraphicsSDL::GetGLDepthTestFuncEnum(eDepthTestFunc aType) {
-#if 0
- switch(aType)
- {
- case eDepthTestFunc_Never: return GL_NEVER;
- case eDepthTestFunc_Less: return GL_LESS;
- case eDepthTestFunc_LessOrEqual: return GL_LEQUAL;
- case eDepthTestFunc_Greater: return GL_GREATER;
- case eDepthTestFunc_GreaterOrEqual: return GL_GEQUAL;
- case eDepthTestFunc_Equal: return GL_EQUAL;
- case eDepthTestFunc_NotEqual: return GL_NOTEQUAL;
- case eDepthTestFunc_Always: return GL_ALWAYS;
- }
-#endif
+GLenum cLowLevelGraphicsSDL::GetGLDepthTestFuncEnum(eDepthTestFunc type) {
+ switch (type) {
+ case eDepthTestFunc_Never:
+ return GL_NEVER;
+ case eDepthTestFunc_Less:
+ return GL_LESS;
+ case eDepthTestFunc_LessOrEqual:
+ return GL_LEQUAL;
+ case eDepthTestFunc_Greater:
+ return GL_GREATER;
+ case eDepthTestFunc_GreaterOrEqual:
+ return GL_GEQUAL;
+ case eDepthTestFunc_Equal:
+ return GL_EQUAL;
+ case eDepthTestFunc_NotEqual:
+ return GL_NOTEQUAL;
+ case eDepthTestFunc_Always:
+ return GL_ALWAYS;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid depth test function (%d)", type);
return 0;
}
//-----------------------------------------------------------------------
-GLenum cLowLevelGraphicsSDL::GetGLAlphaTestFuncEnum(eAlphaTestFunc aType) {
-#if 0
- switch(aType)
- {
- case eAlphaTestFunc_Never: return GL_NEVER;
- case eAlphaTestFunc_Less: return GL_LESS;
- case eAlphaTestFunc_LessOrEqual: return GL_LEQUAL;
- case eAlphaTestFunc_Greater: return GL_GREATER;
- case eAlphaTestFunc_GreaterOrEqual: return GL_GEQUAL;
- case eAlphaTestFunc_Equal: return GL_EQUAL;
- case eAlphaTestFunc_NotEqual: return GL_NOTEQUAL;
- case eAlphaTestFunc_Always: return GL_ALWAYS;
- }
-#endif
+GLenum cLowLevelGraphicsSDL::GetGLAlphaTestFuncEnum(eAlphaTestFunc type) {
+ switch (type) {
+ case eAlphaTestFunc_Never:
+ return GL_NEVER;
+ case eAlphaTestFunc_Less:
+ return GL_LESS;
+ case eAlphaTestFunc_LessOrEqual:
+ return GL_LEQUAL;
+ case eAlphaTestFunc_Greater:
+ return GL_GREATER;
+ case eAlphaTestFunc_GreaterOrEqual:
+ return GL_GEQUAL;
+ case eAlphaTestFunc_Equal:
+ return GL_EQUAL;
+ case eAlphaTestFunc_NotEqual:
+ return GL_NOTEQUAL;
+ case eAlphaTestFunc_Always:
+ return GL_ALWAYS;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL ,"invalid alpha test function (%d)", type);
return 0;
}
//-----------------------------------------------------------------------
-GLenum cLowLevelGraphicsSDL::GetGLStencilFuncEnum(eStencilFunc aType) {
-#if 0
- switch(aType)
- {
- case eStencilFunc_Never: return GL_NEVER;
- case eStencilFunc_Less: return GL_LESS;
- case eStencilFunc_LessOrEqual: return GL_LEQUAL;
- case eStencilFunc_Greater: return GL_GREATER;
- case eStencilFunc_GreaterOrEqual: return GL_GEQUAL;
- case eStencilFunc_Equal: return GL_EQUAL;
- case eStencilFunc_NotEqual: return GL_NOTEQUAL;
- case eStencilFunc_Always: return GL_ALWAYS;
- }
-#endif
+GLenum cLowLevelGraphicsSDL::GetGLStencilFuncEnum(eStencilFunc type) {
+ switch (type) {
+ case eStencilFunc_Never:
+ return GL_NEVER;
+ case eStencilFunc_Less:
+ return GL_LESS;
+ case eStencilFunc_LessOrEqual:
+ return GL_LEQUAL;
+ case eStencilFunc_Greater:
+ return GL_GREATER;
+ case eStencilFunc_GreaterOrEqual:
+ return GL_GEQUAL;
+ case eStencilFunc_Equal:
+ return GL_EQUAL;
+ case eStencilFunc_NotEqual:
+ return GL_NOTEQUAL;
+ case eStencilFunc_Always:
+ return GL_ALWAYS;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid stencil function (%d)", type);
return 0;
}
//-----------------------------------------------------------------------
-GLenum cLowLevelGraphicsSDL::GetGLStencilOpEnum(eStencilOp aType) {
-#if 0
- switch(aType)
- {
- case eStencilOp_Keep: return GL_KEEP;
- case eStencilOp_Zero: return GL_ZERO;
- case eStencilOp_Replace: return GL_REPLACE;
- case eStencilOp_Increment: return GL_INCR;
- case eStencilOp_Decrement: return GL_DECR;
- case eStencilOp_Invert: return GL_INVERT;
- case eStencilOp_IncrementWrap: return GL_INCR_WRAP_EXT;
- case eStencilOp_DecrementWrap: return GL_DECR_WRAP_EXT;
- }
-#endif
+GLenum cLowLevelGraphicsSDL::GetGLStencilOpEnum(eStencilOp type) {
+ switch (type) {
+ case eStencilOp_Keep:
+ return GL_KEEP;
+ case eStencilOp_Zero:
+ return GL_ZERO;
+ case eStencilOp_Replace:
+ return GL_REPLACE;
+ case eStencilOp_Increment:
+ return GL_INCR;
+ case eStencilOp_Decrement:
+ return GL_DECR;
+ case eStencilOp_Invert:
+ return GL_INVERT;
+ case eStencilOp_IncrementWrap:
+ return GL_INCR_WRAP;
+ case eStencilOp_DecrementWrap:
+ return GL_DECR_WRAP;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid stencil op (%d)", type);
return 0;
}
//-----------------------------------------------------------------------
-void cLowLevelGraphicsSDL::InitCG() {
-#if 0
- mCG_Context = cgCreateContext();
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-void cLowLevelGraphicsSDL::ExitCG() {
-#if 0
- cgDestroyContext(mCG_Context);
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-void cLowLevelGraphicsSDL::SetMatrixMode(eMatrix mType) {
-#if 0
- switch(mType)
- {
- case eMatrix_ModelView: glMatrixMode(GL_MODELVIEW);break;
- case eMatrix_Projection: glMatrixMode(GL_PROJECTION); break;
- case eMatrix_Texture: glMatrixMode(GL_TEXTURE); break;
- }
-#endif
+void cLowLevelGraphicsSDL::SetMatrixMode(eMatrix type) {
+ switch (type) {
+ case eMatrix_ModelView:
+ GL_CHECK(glMatrixMode(GL_MODELVIEW));
+ break;
+ case eMatrix_Projection:
+ GL_CHECK(glMatrixMode(GL_PROJECTION));
+ break;
+ case eMatrix_Texture:
+ GL_CHECK(glMatrixMode(GL_TEXTURE));
+ break;
+ default:
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid matrix mode (%d)", type);
+ }
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
index cb1997a144b..abb96b28263 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
@@ -38,23 +38,20 @@
// Unix's X11 Defines DestoryAll which collides with methods
#undef DestroyAll
-//--scummvm-temporary--
-#include "temp-types.h"
-//--scummvm-temporary--
-
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "graphics/pixelformat.h"
#include "hpl1/engine/math/MathTypes.h"
#include "graphics/surface.h"
#include "common/ptr.h"
+#include "hpl1/opengl.h"
namespace hpl {
//-------------------------------------------------
-GLenum ColorFormatToGL(eColorDataFormat aFormat);
+GLenum ColorFormatToGL(eColorDataFormat format);
-GLenum TextureTargetToGL(eTextureTarget aTarget);
+GLenum TextureTargetToGL(eTextureTarget target);
//-------------------------------------------------
@@ -66,7 +63,7 @@ public:
bool Init(int alWidth, int alHeight, int alBpp, int abFullscreen, int alMultisampling,
const tString &asWindowCaption);
- int GetCaps(eGraphicCaps aType);
+ int GetCaps(eGraphicCaps aType) const;
void ShowCursor(bool abX);
@@ -87,7 +84,7 @@ public:
cVector2f GetVirtualSize();
void SetVirtualSize(cVector2f avSize);
- Bitmap2D *CreateBitmap2D(const cVector2l &avSize, unsigned int alBpp);
+ Bitmap2D *CreateBitmap2D(const cVector2l &avSize);
FontData *CreateFontData(const tString &asName);
iTexture *CreateTexture(bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
@@ -175,7 +172,7 @@ public:
void SetTexture(unsigned int alUnit, iTexture *apTex);
void SetActiveTextureUnit(unsigned int alUnit);
void SetTextureEnv(eTextureParam aParam, int alVal);
- void SetTextureConstantColor(const cColor &aColor);
+ void SetTextureConstantColor(const cColor &color);
void SetColor(const cColor &aColor);
@@ -237,10 +234,6 @@ public:
///// SDL Specific ////////////////////////////
- Bitmap2D *CreateBitmap2DFromSurface(SDL_Surface *apSurface, const tString &asType);
-
- CGcontext GetGC_Context() { return mCG_Context; }
-
void SetupGL();
GLenum GetGLTextureTargetEnum(eTextureTarget aType);
@@ -251,28 +244,15 @@ private:
int mlMultisampling;
int mlBpp;
- // Windows stuff
-#if 0
-#if defined(WIN32)
- HGLRC mGLContext;
- HDC mDeviceContext;
- HINSTANCE mhKeyTrapper;
-#elif defined(__linux__)
- Display *gDpy;
- GLXContext glCtx;
- GLXPbuffer gPBuffer;
-#endif
-#endif
-
// Gamma
- Uint16 mvStartGammaArray[3][256];
+ uint16 mvStartGammaArray[3][256];
float mfGammaCorrection;
// Clipping
cPlanef mvClipPlanes[kMaxClipPlanes];
// SDL Variables
- SDL_Surface *mpScreen;
+ //SDL_Surface *mpScreen;
Graphics::PixelFormat *mpPixelFormat;
// Vertex Array variables
@@ -302,15 +282,11 @@ private:
iTexture *mpCurrentTexture[MAX_TEXTUREUNITS];
// CG Compiler Variables
- CGcontext mCG_Context;
+ //CGcontext mCG_Context;
// Multisample
void CheckMultisampleCaps();
- // CG Helper
- void InitCG();
- void ExitCG();
-
// Batch helper
void SetUpBatchArrays();
@@ -337,7 +313,7 @@ private:
GLenum GetGLBlendEnum(eBlendFunc aType);
// Vtx helper
- void SetVtxBatchStates(tVtxBatchFlag aFlags);
+ void SetVtxBatchStates(tVtxBatchFlag flags);
};
}; // namespace hpl
#endif // HPL_LOWLEVELGRAPHICS_SDL_H
diff --git a/engines/hpl1/engine/impl/temp-types.h b/engines/hpl1/engine/impl/temp-types.h
index 5415be0a89d..e23581bf25b 100644
--- a/engines/hpl1/engine/impl/temp-types.h
+++ b/engines/hpl1/engine/impl/temp-types.h
@@ -6,15 +6,12 @@ using CGprogram = int;
using CGprofile = int;
using CGparameter = int;
using CGtype = int;
-using GLenum = int;
using Uint16 = int;
using CGcontext = int;
-using SDL_Surface = int;
using SDL_Event = int;
using cOAL_Sample = int;
using cOAL_Stream = int;
using NewtonContact = int;
-using SDL_PixelFormat = int;
using TTF_Font = int;
using cPBuffer = int;
diff --git a/engines/hpl1/engine/resources/ImageManager.cpp b/engines/hpl1/engine/resources/ImageManager.cpp
index 72abce6f16a..337733ecd79 100644
--- a/engines/hpl1/engine/resources/ImageManager.cpp
+++ b/engines/hpl1/engine/resources/ImageManager.cpp
@@ -339,7 +339,7 @@ cResourceImage *cImageManager::AddToFrame(Bitmap2D *apBmp, int alFrameHandle) {
cFrameBitmap *cImageManager::CreateBitmapFrame(cVector2l avSize) {
iTexture *pTex = mpLowLevelGraphics->CreateTexture(false, eTextureType_Normal, eTextureTarget_2D);
cFrameTexture *pTFrame = hplNew(cFrameTexture, (pTex, mlFrameHandle));
- Bitmap2D *pBmp = mpLowLevelGraphics->CreateBitmap2D(avSize, 32);
+ Bitmap2D *pBmp = mpLowLevelGraphics->CreateBitmap2D(avSize);
cFrameBitmap *pBFrame = hplNew(cFrameBitmap, (pBmp, pTFrame, mlFrameHandle));
mlstBitmapFrames.push_back(pBFrame);
Commit: 4d2a7b4a5b7a42bdeefebe330eaf1de1d7611774
https://github.com/scummvm/scummvm/commit/4d2a7b4a5b7a42bdeefebe330eaf1de1d7611774
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:32+01:00
Commit Message:
HPL1: add implementation for SDLTexture
Changed paths:
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/SDLTexture.h
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index 9c76a98c02a..a444bd58bb6 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -28,8 +28,10 @@
#include "hpl1/engine/impl/SDLTexture.h"
#include "hpl1/engine/graphics/bitmap2D.h"
+#include "hpl1/debug.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
+#include "hpl1/opengl.h"
namespace hpl {
@@ -43,39 +45,36 @@ cSDLTexture::cSDLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt,
eTextureType aType, bool abUseMipMaps, eTextureTarget aTarget,
bool abCompress)
: iTexture(asName, "OGL", apPxlFmt, apLowLevelGraphics, aType, abUseMipMaps, aTarget, abCompress) {
-#if 0
- mbContainsData = false;
+ mbContainsData = false;
- mpPBuffer = NULL;
+ mpPBuffer = NULL;
- if(aType==eTextureType_RenderTarget)
- {
- mpPBuffer = hplNew( cPBuffer, (mpLowLevelGraphics,true) );
- }
+ if (aType == eTextureType_RenderTarget) {
+ Hpl1::logError(Hpl1::kDebugGraphics, "use of render target");
+ // mpPBuffer = hplNew( cPBuffer, (mpLowLevelGraphics,true) );
+ }
- //Cubemap does not like mipmaps
- if(aTarget == eTextureTarget_CubeMap) mbUseMipMaps = false;
+ // Cubemap does not like mipmaps
+ if (aTarget == eTextureTarget_CubeMap)
+ mbUseMipMaps = false;
- mpGfxSDL = static_cast<cLowLevelGraphicsSDL*>(mpLowLevelGraphics);
+ mpGfxSDL = static_cast<cLowLevelGraphicsSDL *>(mpLowLevelGraphics);
- mlTextureIndex = 0;
- mfTimeCount =0;
+ mlTextureIndex = 0;
+ mfTimeCount = 0;
- mfTimeDir = 1;
+ mfTimeDir = 1;
- mlBpp = 0;
-#endif
+ mlBpp = 0;
}
cSDLTexture::~cSDLTexture() {
-#if 0
- if(mpPBuffer)hplDelete(mpPBuffer);
+ if (mpPBuffer)
+ hplDelete(mpPBuffer);
- for(size_t i=0; i<mvTextureHandles.size(); ++i)
- {
- glDeleteTextures(1,(GLuint *)&mvTextureHandles[i]);
- }
-#endif
+ for (unsigned int &mvTextureHandle : mvTextureHandles) {
+ GL_CHECK(glDeleteTextures(1, (GLuint *)&mvTextureHandle));
+ }
}
//-----------------------------------------------------------------------
@@ -87,240 +86,171 @@ cSDLTexture::~cSDLTexture() {
//-----------------------------------------------------------------------
bool cSDLTexture::CreateFromBitmap(Bitmap2D *pBmp) {
-#if 0
- //Generate handles
- if(mvTextureHandles.empty())
- {
- mvTextureHandles.resize(1);
- glGenTextures(1,(GLuint *)&mvTextureHandles[0]);
- }
- else
- {
- //Log("Delete + Generate!\n");
- //glDeleteTextures(1,(GLuint *)&mvTextureHandles[0]);
- //glGenTextures(1,(GLuint *)&mvTextureHandles[0]);
- }
+ // Generate handles
+ if (mvTextureHandles.empty()) {
+ mvTextureHandles.resize(1);
+ GL_CHECK(glGenTextures(1, &mvTextureHandles[0]));
+ } else {
+ // Log("Delete + Generate!\n");
+ // glDeleteTextures(1,(GLuint *)&mvTextureHandles[0]);
+ // glGenTextures(1,(GLuint *)&mvTextureHandles[0]);
+ }
- return CreateFromBitmapToHandle(pBmp,0);
-#endif
- return false;
+ return CreateFromBitmapToHandle(pBmp, 0);
}
//-----------------------------------------------------------------------
bool cSDLTexture::CreateAnimFromBitmapVec(tBitmap2DVec *avBitmaps) {
-#if 0
- mvTextureHandles.resize(avBitmaps->size());
-
- for(size_t i=0; i< mvTextureHandles.size(); ++i)
- {
- glGenTextures(1,(GLuint *)&mvTextureHandles[i]);
- if(CreateFromBitmapToHandle((*avBitmaps)[i],(int)i)==false)
- {
- return false;
- }
+ mvTextureHandles.resize(avBitmaps->size());
+
+ for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
+ glGenTextures(1, (GLuint *)&mvTextureHandles[i]);
+ if (CreateFromBitmapToHandle((*avBitmaps)[i], (int)i) == false) {
+ return false;
}
+ }
- return true;
-#endif
- return false;
+ return true;
}
//-----------------------------------------------------------------------
bool cSDLTexture::CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps) {
-#if 0
- if(mType == eTextureType_RenderTarget || mTarget != eTextureTarget_CubeMap)
- {
- return false;
- }
+ // gl 1.3
+ if (mType == eTextureType_RenderTarget || mTarget != eTextureTarget_CubeMap) {
+ return false;
+ }
- if(avBitmaps->size()<6){
- Error("Only %d bitmaps supplied for creation of cube map, 6 needed.",avBitmaps->size());
- return false;
- }
+ if (avBitmaps->size() < 6) {
+ Hpl1::logError(Hpl1::kDebugOpenGL, "Only %d bitmaps supplied for creation of cube map, 6 needed.", avBitmaps->size());
+ return false;
+ }
- //Generate handles
- if(mvTextureHandles.empty())
- {
- mvTextureHandles.resize(1);
- glGenTextures(1,(GLuint *)&mvTextureHandles[0]);
- }
- else
- {
- glDeleteTextures(1,(GLuint *)&mvTextureHandles[0]);
- glGenTextures(1,(GLuint *)&mvTextureHandles[0]);
- }
+ // Generate handles
+ if (mvTextureHandles.empty()) {
+ mvTextureHandles.resize(1);
+ GL_CHECK(glGenTextures(1, &mvTextureHandles[0]));
+ } else {
+ GL_CHECK(glDeleteTextures(1, &mvTextureHandles[0]));
+ GL_CHECK(glGenTextures(1, &mvTextureHandles[0]));
+ }
- GLenum GLTarget = InitCreation(0);
+ GLenum GLTarget = InitCreation(0);
- //Create the cube map sides
- for(int i=0; i< 6; i++)
- {
- Bitmap2D *pSrc = static_cast<Bitmap2D*>((*avBitmaps)[i]);
+ // Create the cube map sides
+ for (int i = 0; i < 6; i++) {
+ Bitmap2D *pSrc = static_cast<Bitmap2D *>((*avBitmaps)[i]);
- GLenum target = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + i;
+ GLenum target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i;
- int lChannels;
- GLenum format;
- GetSettings(pSrc, lChannels,format);
+ int lChannels;
+ GLenum format;
+ GetSettings(pSrc, lChannels, format);
- glTexImage2D(target, 0, lChannels, pSrc->GetWidth(), pSrc->GetHeight(),
- 0, format, GL_UNSIGNED_BYTE, pSrc->GetSurface()->pixels);
+ glTexImage2D(target, 0, lChannels, pSrc->GetWidth(), pSrc->GetHeight(),
+ 0, format, GL_UNSIGNED_BYTE, pSrc->getRawData());
- //No mip maps for cubemap
- //if(mbUseMipMaps)
- //{
- // int x = gluBuild2DMipmaps(target,4,pSrc->GetWidth(), pSrc->GetHeight(),
- // GL_RGBA, GL_UNSIGNED_BYTE, pSrc->GetSurface()->pixels);
- //}
+ // No mip maps for cubemap
+ // if(mbUseMipMaps)
+ //{
+ // int x = gluBuild2DMipmaps(target,4,pSrc->GetWidth(), pSrc->GetHeight(),
+ // GL_RGBA, GL_UNSIGNED_BYTE, pSrc->GetSurface()->pixels);
+ // }
- mlWidth = pSrc->GetWidth();
- mlHeight = pSrc->GetHeight();
- mlBpp = lChannels * 8;
+ mlWidth = pSrc->GetWidth();
+ mlHeight = pSrc->GetHeight();
+ mlBpp = lChannels * 8;
- if(!cMath::IsPow2(mlHeight) || !cMath::IsPow2(mlWidth))
- {
- Warning("Texture '%s' does not have a pow2 size!\n",msName.c_str());
- }
+ if (!cMath::IsPow2(mlHeight) || !cMath::IsPow2(mlWidth)) {
+ Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
}
+ }
- PostCreation(GLTarget);
+ PostCreation(GLTarget);
- return true;
-#endif
- return false;
+ return true;
}
//-----------------------------------------------------------------------
bool cSDLTexture::Create(unsigned int alWidth, unsigned int alHeight, cColor aCol) {
-#if 0
- //Generate handles
- mvTextureHandles.resize(1);
- glGenTextures(1,(GLuint *)&mvTextureHandles[0]);
-
-
- if(mType == eTextureType_RenderTarget)
- {
- if(!mpPBuffer->Init(alWidth,alHeight,aCol)){
- return false;
- }
-
- mlWidth = alWidth;
- mlHeight = alHeight;
-
- if((!cMath::IsPow2(mlHeight) || !cMath::IsPow2(mlWidth)) && mTarget != eTextureTarget_Rect)
- {
- Warning("Texture '%s' does not have a pow2 size!\n",msName.c_str());
- }
-
- GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
-
- glEnable(GLTarget);
- glBindTexture(GLTarget, mvTextureHandles[0]);
- if(mbUseMipMaps && mTarget != eTextureTarget_Rect){
- if(mFilter == eTextureFilter_Bilinear)
- glTexParameteri(GLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
- else
- glTexParameteri(GLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- }
- else{
- glTexParameteri(GLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- }
- glTexParameteri(GLTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GLTarget,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
- glTexParameteri(GLTarget,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
-
- glDisable(GLTarget);
-
- mbContainsData = true;
- }
- else
- {
- return false;
- }
-
- return true;
-#endif
- return false;
+ error("call to unimplemented function SDLTexture::Create");
}
//-----------------------------------------------------------------------
-bool cSDLTexture::CreateFromArray(unsigned char *apPixelData, int alChannels, const cVector3l &avSize) {
-#if 0
- if(mvTextureHandles.empty())
- {
- mvTextureHandles.resize(1);
- glGenTextures(1,(GLuint *)&mvTextureHandles[0]);
- }
+static void generateMipmaps(eTextureTarget target) {
+ // gl 1.4
+ if (target == eTextureTarget_1D) {
+ GL_CHECK(glGenerateMipmap(GL_TEXTURE_1D))
+ } else {
+ GL_CHECK(glGenerateMipmap(GL_TEXTURE_2D))
+ }
+}
- GLenum GLTarget = InitCreation(0);
+bool cSDLTexture::CreateFromArray(unsigned char *apPixelData, int alChannels, const cVector3l &avSize) {
+ if (mvTextureHandles.empty()) {
+ mvTextureHandles.resize(1);
+ GL_CHECK(glGenTextures(1, (GLuint *)&mvTextureHandles[0]));
+ }
- int lChannels = alChannels;
- GLenum format =0;
- switch(lChannels)
- {
- case 1: format = GL_LUMINANCE; break;
- case 2: format = GL_LUMINANCE_ALPHA; break;
- case 3: format = GL_RGB; break;
- case 4: format = GL_RGBA; break;
- }
+ GLenum GLTarget = InitCreation(0);
+
+ int lChannels = alChannels;
+ GLenum format = 0;
+ switch (lChannels) {
+ case 1:
+ format = GL_LUMINANCE;
+ break;
+ case 2:
+ format = GL_LUMINANCE_ALPHA;
+ break;
+ case 3:
+ format = GL_RGB;
+ break;
+ case 4:
+ format = GL_RGBA;
+ break;
+ }
- mlWidth = avSize.x;
- mlHeight = avSize.y;
- mlDepth = avSize.z;
- mlBpp = lChannels * 8;
+ mlWidth = avSize.x;
+ mlHeight = avSize.y;
+ mlDepth = avSize.z;
+ mlBpp = lChannels * 8;
- if(!cMath::IsPow2(mlHeight) || !cMath::IsPow2(mlWidth) || !cMath::IsPow2(mlDepth))
- {
- Warning("Texture '%s' does not have a pow2 size!\n",msName.c_str());
- }
+ if (!cMath::IsPow2(mlHeight) || !cMath::IsPow2(mlWidth) || !cMath::IsPow2(mlDepth)) {
+ Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
+ }
- if(mTarget == eTextureTarget_1D)
- {
- glTexImage1D(GLTarget, 0, lChannels, mlWidth,0,format,
- GL_UNSIGNED_BYTE, apPixelData);
- }
- else if(mTarget == eTextureTarget_2D)
- {
- glTexImage2D(GLTarget, 0, lChannels, mlWidth, mlHeight,
- 0, format, GL_UNSIGNED_BYTE, apPixelData);
- }
- else if(mTarget == eTextureTarget_3D)
- {
- glTexImage3D(GLTarget, 0, lChannels, avSize.x, avSize.y,avSize.z,
- 0, format, GL_UNSIGNED_BYTE, apPixelData);
- }
+ if (mTarget == eTextureTarget_1D) {
+ GL_CHECK(glTexImage1D(GLTarget, 0, lChannels, mlWidth, 0, format,
+ GL_UNSIGNED_BYTE, apPixelData));
+ } else if (mTarget == eTextureTarget_2D) {
+ GL_CHECK(glTexImage2D(GLTarget, 0, lChannels, mlWidth, mlHeight,
+ 0, format, GL_UNSIGNED_BYTE, apPixelData));
+ } else if (mTarget == eTextureTarget_3D) {
+ GL_CHECK(glTexImage3D(GLTarget, 0, lChannels, avSize.x, avSize.y, avSize.z,
+ 0, format, GL_UNSIGNED_BYTE, apPixelData));
+ }
- if(mbUseMipMaps && mTarget != eTextureTarget_Rect && mTarget != eTextureTarget_3D)
- {
- if(mTarget == eTextureTarget_1D)
- gluBuild1DMipmaps(GLTarget,lChannels,mlWidth,
- format, GL_UNSIGNED_BYTE, apPixelData);
- else
- gluBuild2DMipmaps(GLTarget,lChannels,mlWidth, mlHeight,
- format, GL_UNSIGNED_BYTE, apPixelData);
- }
+ if (mbUseMipMaps && mTarget != eTextureTarget_Rect && mTarget != eTextureTarget_3D)
+ generateMipmaps(mTarget);
- PostCreation(GLTarget);
+ PostCreation(GLTarget);
- return true;
-#endif
- return false;
+ return true;
}
//-----------------------------------------------------------------------
void cSDLTexture::SetPixels2D(int alLevel, const cVector2l &avOffset, const cVector2l &avSize,
eColorDataFormat aDataFormat, void *apPixelData) {
-#if 0
- if(mTarget != eTextureTarget_2D && mTarget != eTextureTarget_Rect) return;
+ if (mTarget != eTextureTarget_2D && mTarget != eTextureTarget_Rect)
+ return;
- glTexSubImage2D(TextureTargetToGL(mTarget),alLevel,avOffset.x,avOffset.y, avSize.x,avSize.y,
- ColorFormatToGL(aDataFormat),GL_UNSIGNED_BYTE,apPixelData);
-#endif
+ GL_CHECK(glTexSubImage2D(TextureTargetToGL(mTarget), alLevel, avOffset.x, avOffset.y, avSize.x, avSize.y,
+ ColorFormatToGL(aDataFormat), GL_UNSIGNED_BYTE, apPixelData));
}
//-----------------------------------------------------------------------
@@ -413,122 +343,108 @@ int cSDLTexture::GetCurrentLowlevelHandle() {
//-----------------------------------------------------------------------
void cSDLTexture::SetFilter(eTextureFilter aFilter) {
-#if 0
- if(mFilter == aFilter) return;
-
- mFilter = aFilter;
- if(mbContainsData)
- {
- GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
-
- glEnable(GLTarget);
- for(size_t i=0; i < mvTextureHandles.size(); ++i)
- {
- glBindTexture(GLTarget, mvTextureHandles[i]);
-
- if(mbUseMipMaps && mTarget != eTextureTarget_Rect){
- if(mFilter == eTextureFilter_Bilinear)
- glTexParameteri(GLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
- else
- glTexParameteri(GLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- }
- else{
- glTexParameteri(GLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- }
- }
+ if (mFilter == aFilter)
+ return;
+
+ mFilter = aFilter;
+ if (mbContainsData) {
+ GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
+
+ GL_CHECK(glEnable(GLTarget));
+ for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
+ glBindTexture(GLTarget, mvTextureHandles[i]);
- glDisable(GLTarget);
+ if (mbUseMipMaps && mTarget != eTextureTarget_Rect) {
+ if (mFilter == eTextureFilter_Bilinear)
+ glTexParameteri(GLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
+ else
+ glTexParameteri(GLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ } else {
+ glTexParameteri(GLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ }
}
-#endif
+ GL_CHECK_FN();
+ GL_CHECK(glDisable(GLTarget));
+ }
}
//-----------------------------------------------------------------------
void cSDLTexture::SetAnisotropyDegree(float afX) {
+//gl 4.6
#if 0
- if(!mpLowLevelGraphics->GetCaps(eGraphicCaps_AnisotropicFiltering)) return;
- if(afX < 1.0f) return;
- if(afX > (float) mpLowLevelGraphics->GetCaps(eGraphicCaps_MaxAnisotropicFiltering)) return;
+ if(!mpLowLevelGraphics->GetCaps(eGraphicCaps_AnisotropicFiltering)) return;
+ if(afX < 1.0f) return;
+ if(afX > (float) mpLowLevelGraphics->GetCaps(eGraphicCaps_MaxAnisotropicFiltering)) return;
- if(mfAnisotropyDegree == afX) return;
+ if(mfAnisotropyDegree == afX) return;
- mfAnisotropyDegree = afX;
+ mfAnisotropyDegree = afX;
- GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
+ GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
- glEnable(GLTarget);
- for(size_t i=0; i < mvTextureHandles.size(); ++i)
- {
- glBindTexture(GLTarget, mvTextureHandles[i]);
+ glEnable(GLTarget);
+ for(size_t i=0; i < mvTextureHandles.size(); ++i)
+ {
+ glBindTexture(GLTarget, mvTextureHandles[i]);
- glTexParameterf(GLTarget,GL_TEXTURE_MAX_ANISOTROPY_EXT ,mfAnisotropyDegree);
- }
+ glTexParameterf(GLTarget, GL_TEXTURE_MAX_ANISOTROPY ,mfAnisotropyDegree);
+ }
- glDisable(GLTarget);
+ glDisable(GLTarget);
#endif
}
//-----------------------------------------------------------------------
void cSDLTexture::SetWrapS(eTextureWrap aMode) {
-#if 0
- if(mbContainsData)
- {
- GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
-
- glEnable(GLTarget);
- for(size_t i=0; i < mvTextureHandles.size(); ++i)
- {
- glBindTexture(GLTarget, mvTextureHandles[i]);
+ if (mbContainsData) {
+ GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
- glTexParameteri(GLTarget,GL_TEXTURE_WRAP_S,GetGLWrap(aMode));
- }
+ GL_CHECK(glEnable(GLTarget));
+ for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
+ glBindTexture(GLTarget, mvTextureHandles[i]);
- glDisable(GLTarget);
+ glTexParameteri(GLTarget, GL_TEXTURE_WRAP_S, GetGLWrap(aMode));
}
-#endif
+ GL_CHECK_FN();
+ GL_CHECK(glDisable(GLTarget));
+ }
}
//-----------------------------------------------------------------------
void cSDLTexture::SetWrapT(eTextureWrap aMode) {
-#if 0
- if(mbContainsData)
- {
- GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
-
- glEnable(GLTarget);
- for(size_t i=0; i < mvTextureHandles.size(); ++i)
- {
- glBindTexture(GLTarget, mvTextureHandles[i]);
+ if (mbContainsData) {
+ GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
- glTexParameteri(GLTarget,GL_TEXTURE_WRAP_T,GetGLWrap(aMode));
- }
+ GL_CHECK(glEnable(GLTarget));
+ for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
+ glBindTexture(GLTarget, mvTextureHandles[i]);
- glDisable(GLTarget);
+ glTexParameteri(GLTarget, GL_TEXTURE_WRAP_T, GetGLWrap(aMode));
}
-#endif
+ GL_CHECK(glDisable(GLTarget));
+ }
}
//-----------------------------------------------------------------------
void cSDLTexture::SetWrapR(eTextureWrap aMode) {
-#if 0
- if(mbContainsData)
- {
- GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
-
- glEnable(GLTarget);
- for(size_t i=0; i < mvTextureHandles.size(); ++i)
- {
- glBindTexture(GLTarget, mvTextureHandles[i]);
+ if (mbContainsData) {
+ GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
- glTexParameteri(GLTarget,GL_TEXTURE_WRAP_R,GetGLWrap(aMode));
- }
+ GL_CHECK(glEnable(GLTarget));
+ glEnable(GLTarget);
+ for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
+ glBindTexture(GLTarget, mvTextureHandles[i]);
- glDisable(GLTarget);
+ glTexParameteri(GLTarget, GL_TEXTURE_WRAP_R, GetGLWrap(aMode));
}
-#endif
+ GL_CHECK(glDisable(GLTarget));
+
+ glDisable(GLTarget);
+ }
}
//-----------------------------------------------------------------------
@@ -551,222 +467,182 @@ unsigned int cSDLTexture::GetTextureHandle() {
//-----------------------------------------------------------------------
bool cSDLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
-#if 0
- if(mType == eTextureType_RenderTarget)
- {
- Error("Rendertarget cannot be created from bitmap\n");
- return false;
- }
+ if (mType == eTextureType_RenderTarget)
+ error("trying to create a rendertarget in SDLTexture::CreateBitmapToHandle");
- //For some reason checking for ARB texture is not working on radeon cards.
- /*if(mTarget == eTextureTarget_Rect && !GLEE_ARB_texture_rectangle)
- {
- Error("Rectangle texture target not supported\n");
- return false;
- }*/
+ // For some reason checking for ARB texture is not working on radeon cards.
+ /*if(mTarget == eTextureTarget_Rect && !GLEE_ARB_texture_rectangle)
+ {
+ Error("Rectangle texture target not supported\n");
+ return false;
+ }*/
- GLenum GLTarget =InitCreation(alHandleIdx);
+ GLenum GLTarget = InitCreation(alHandleIdx);
- Bitmap2D *pBitmapSrc = static_cast<Bitmap2D*>(pBmp);
+ Bitmap2D *pBitmapSrc = pBmp;
- mlWidth = pBitmapSrc->GetWidth();
- mlHeight = pBitmapSrc->GetHeight();
+ mlWidth = pBitmapSrc->GetWidth();
+ mlHeight = pBitmapSrc->GetHeight();
- if((!cMath::IsPow2(mlHeight) || !cMath::IsPow2(mlWidth)) && mTarget != eTextureTarget_Rect)
- {
- Warning("Texture '%s' does not have a pow2 size!\n",msName.c_str());
- }
+ if ((!cMath::IsPow2(mlHeight) || !cMath::IsPow2(mlWidth)) && mTarget != eTextureTarget_Rect)
+ Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
- int lChannels =0;
- GLenum format =0;
- GetSettings(pBitmapSrc,lChannels,format);
+ int lChannels = 0;
+ GLenum format = 0;
+ GetSettings(pBitmapSrc, lChannels, format);
- mlBpp = lChannels * 8;
+ mlBpp = lChannels * 8;
- unsigned char *pPixelSrc = (unsigned char*)pBitmapSrc->GetSurface()->pixels;
+ const unsigned char *pPixelSrc = (const unsigned char *)pBitmapSrc->getRawData();
- unsigned char *pNewSrc = NULL;
- if(mlSizeLevel>0 && (int)mlWidth > mvMinLevelSize.x*2)
- {
- //Log("OldSize: %d x %d ",mlWidth,mlHeight);
+ unsigned char *pNewSrc = nullptr;
+ if (mlSizeLevel > 0 && (int)mlWidth > mvMinLevelSize.x * 2) {
+ // Log("OldSize: %d x %d ",mlWidth,mlHeight);
- int lOldW = mlWidth;
- int lOldH = mlHeight;
+ int lOldW = mlWidth;
+ int lOldH = mlHeight;
- int lSizeDiv = (int)pow((float)2,(int)mlSizeLevel);
+ int lSizeDiv = (int)pow((float)2, (int)mlSizeLevel);
- mlWidth /= lSizeDiv;
- mlHeight /= lSizeDiv;
+ mlWidth /= lSizeDiv;
+ mlHeight /= lSizeDiv;
- while(mlWidth < (unsigned int)mvMinLevelSize.x)
- {
- mlWidth*=2;
- mlHeight*=2;
- lSizeDiv/=2;
- }
+ while (mlWidth < (unsigned int)mvMinLevelSize.x) {
+ mlWidth *= 2;
+ mlHeight *= 2;
+ lSizeDiv /= 2;
+ }
- //Log("NewSize: %d x %d SizeDiv: %d\n",mlWidth,mlHeight,lSizeDiv);
+ // Log("NewSize: %d x %d SizeDiv: %d\n",mlWidth,mlHeight,lSizeDiv);
- pNewSrc = hplNewArray( unsigned char, lChannels * mlWidth * mlHeight);
+ pNewSrc = hplNewArray(unsigned char, lChannels *mlWidth *mlHeight);
- int lWidthCount = mlWidth;
- int lHeightCount = mlHeight;
- int lOldAdd = lChannels*lSizeDiv;
- int lOldHeightAdd = lChannels*lOldW*(lSizeDiv-1);
+ int lWidthCount = mlWidth;
+ int lHeightCount = mlHeight;
+ int lOldAdd = lChannels * lSizeDiv;
+ int lOldHeightAdd = lChannels * lOldW * (lSizeDiv - 1);
- unsigned char *pOldPixel = pPixelSrc;
- unsigned char *pNewPixel = pNewSrc;
+ const unsigned char *pOldPixel = pPixelSrc;
+ unsigned char *pNewPixel = pNewSrc;
- while(lHeightCount)
- {
- memcpy(pNewPixel, pOldPixel,lChannels);
+ while (lHeightCount) {
+ memcpy(pNewPixel, pOldPixel, lChannels);
- pOldPixel += lOldAdd;
- pNewPixel += lChannels;
+ pOldPixel += lOldAdd;
+ pNewPixel += lChannels;
- lWidthCount--;
- if(!lWidthCount)
- {
- lWidthCount = mlWidth;
- lHeightCount--;
- pOldPixel += lOldHeightAdd;
- }
+ lWidthCount--;
+ if (!lWidthCount) {
+ lWidthCount = mlWidth;
+ lHeightCount--;
+ pOldPixel += lOldHeightAdd;
}
-
- pPixelSrc = pNewSrc;
}
- //Log("Loading %s %d x %d\n",msName.c_str(), pSrc->GetWidth(), pSrc->GetHeight());
- //Log("Channels: %d Format: %x\n",lChannels, format);
+ pPixelSrc = pNewSrc;
+ }
- //Clear error flags
- while(glGetError()!=GL_NO_ERROR);
+ // Log("Loading %s %d x %d\n",msName.c_str(), pSrc->GetWidth(), pSrc->GetHeight());
+ // Log("Channels: %d Format: %x\n",lChannels, format);
- if(mTarget == eTextureTarget_1D)
- glTexImage1D(GLTarget, 0, lChannels, mlWidth,0,format,
- GL_UNSIGNED_BYTE, pPixelSrc);
- else
- glTexImage2D(GLTarget, 0, lChannels, mlWidth, mlHeight,
- 0, format, GL_UNSIGNED_BYTE, pPixelSrc);
-
- if(glGetError()!=GL_NO_ERROR) return false;
-
- if(mbUseMipMaps && mTarget != eTextureTarget_Rect)
- {
- if(mTarget == eTextureTarget_1D)
- gluBuild1DMipmaps(GLTarget,lChannels,mlWidth,
- format, GL_UNSIGNED_BYTE, pPixelSrc);
- else
- gluBuild2DMipmaps(GLTarget,lChannels,mlWidth, mlHeight,
- format, GL_UNSIGNED_BYTE, pPixelSrc);
- }
+ // Clear error flags
+ GL_CHECK_FN();
- PostCreation(GLTarget);
+ if (mTarget == eTextureTarget_1D)
+ glTexImage1D(GLTarget, 0, lChannels, mlWidth, 0, format,
+ GL_UNSIGNED_BYTE, pPixelSrc);
+ else
+ glTexImage2D(GLTarget, 0, lChannels, mlWidth, mlHeight,
+ 0, format, GL_UNSIGNED_BYTE, pPixelSrc);
- if(mlSizeLevel>0 && pNewSrc)
- {
- hplDeleteArray(pNewSrc);
- }
+ if (glGetError() != GL_NO_ERROR)
+ return false;
- return true;
-#endif
- return false;
+ if (mbUseMipMaps && mTarget != eTextureTarget_Rect)
+ generateMipmaps(mTarget);
+
+ PostCreation(GLTarget);
+ if (mlSizeLevel > 0 && pNewSrc)
+ hplDeleteArray(pNewSrc);
+
+ return true;
}
//-----------------------------------------------------------------------
GLenum cSDLTexture::InitCreation(int alHandleIdx) {
-#if 0
- GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
+ GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
- glEnable(GLTarget);
- glBindTexture(GLTarget, mvTextureHandles[alHandleIdx]);
+ GL_CHECK(glEnable(GLTarget));
+ GL_CHECK(glBindTexture(GLTarget, mvTextureHandles[alHandleIdx]));
- return GLTarget;
-#endif
- return 0;
+ return GLTarget;
}
//-----------------------------------------------------------------------
void cSDLTexture::PostCreation(GLenum aGLTarget) {
-#if 0
- if(mbUseMipMaps && mTarget != eTextureTarget_Rect)
- {
- if(mFilter == eTextureFilter_Bilinear)
- glTexParameteri(aGLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
- else
- glTexParameteri(aGLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- }
- else{
- glTexParameteri(aGLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- }
- glTexParameteri(aGLTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(aGLTarget,GL_TEXTURE_WRAP_S,GL_REPEAT);
- glTexParameteri(aGLTarget,GL_TEXTURE_WRAP_T,GL_REPEAT);
- glTexParameteri(aGLTarget,GL_TEXTURE_WRAP_R,GL_REPEAT);
+ if (mbUseMipMaps && mTarget != eTextureTarget_Rect) {
+ if (mFilter == eTextureFilter_Bilinear)
+ glTexParameteri(aGLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
+ else
+ glTexParameteri(aGLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ } else {
+ glTexParameteri(aGLTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ }
+ GL_CHECK_FN();
+ GL_CHECK(glTexParameteri(aGLTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
+ GL_CHECK(glTexParameteri(aGLTarget, GL_TEXTURE_WRAP_S, GL_REPEAT));
+ GL_CHECK(glTexParameteri(aGLTarget, GL_TEXTURE_WRAP_T, GL_REPEAT));
+ GL_CHECK(glTexParameteri(aGLTarget, GL_TEXTURE_WRAP_R, GL_REPEAT));
- glDisable(aGLTarget);
+ GL_CHECK(glDisable(aGLTarget));
- mbContainsData = true;
-#endif
+ mbContainsData = true;
}
//-----------------------------------------------------------------------
void cSDLTexture::GetSettings(Bitmap2D *apSrc, int &alChannels, GLenum &aFormat) {
-#if 0
- SDL_Surface *pSurface = apSrc->GetSurface();
- alChannels = pSurface->format->BytesPerPixel;
- aFormat = GL_RGBA;
-
- tString sType = cString::ToLowerCase(apSrc->msType);
+ alChannels = apSrc->getNumChannels();
+ aFormat = GL_RGBA;
- if(alChannels==4)
- {
- if(sType == "tga")
- {
- aFormat = GL_BGRA_EXT;
- }
- else
- {
- aFormat = GL_RGBA;
- }
+ tString sType = cString::ToLowerCase(apSrc->GetType());
+ if (alChannels == 4) {
+ if (sType == "tga") {
+ aFormat = GL_BGRA;
+ } else {
+ aFormat = GL_RGBA;
}
- if(alChannels==3)
- {
- if(sType == "tga")
- {
- aFormat = GL_BGR_EXT;
- }
- else
- {
- aFormat = GL_RGB;
- }
- }
- if(alChannels==1)
- {
- aFormat = GL_ALPHA;
+ }
+ if (alChannels == 3) {
+ if (sType == "tga") {
+ aFormat = GL_BGR;
+ } else {
+ aFormat = GL_RGB;
}
-#endif
+ }
+ if (alChannels == 1) {
+ aFormat = GL_ALPHA;
+ }
}
//-----------------------------------------------------------------------
GLenum cSDLTexture::GetGLWrap(eTextureWrap aMode) {
-#if 0
- switch(aMode)
- {
- case eTextureWrap_Clamp: return GL_CLAMP;
- case eTextureWrap_Repeat: return GL_REPEAT;
- case eTextureWrap_ClampToEdge: return GL_CLAMP_TO_EDGE;
- case eTextureWrap_ClampToBorder: return GL_CLAMP_TO_BORDER;
- }
-
+ switch (aMode) {
+ case eTextureWrap_Clamp:
+ return GL_CLAMP;
+ case eTextureWrap_Repeat:
return GL_REPEAT;
-#endif
- return 0;
+ case eTextureWrap_ClampToEdge:
+ return GL_CLAMP_TO_EDGE;
+ case eTextureWrap_ClampToBorder:
+ return GL_CLAMP_TO_BORDER;
+ }
+
+ return GL_REPEAT;
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/SDLTexture.h b/engines/hpl1/engine/impl/SDLTexture.h
index 8f06e4216ac..a43099b5193 100644
--- a/engines/hpl1/engine/impl/SDLTexture.h
+++ b/engines/hpl1/engine/impl/SDLTexture.h
@@ -33,13 +33,6 @@
#include "hpl1/engine/impl/PBuffer.h"
#include "hpl1/engine/graphics/bitmap2D.h"
-//#include <GL/GLee.h>
-//#if defined(__APPLE__)&&defined(__MACH__)
-//#include <OpenGL/glu.h>
-//#else
-//#include <GL/glu.h>
-//#endif
-//#include "SDL/SDL.h"
#include "temp-types.h"
namespace hpl {
@@ -87,7 +80,7 @@ public:
/// SDL / OGL Specific ///////////
unsigned int GetTextureHandle();
- cPBuffer *GetPBuffer() { return mpPBuffer; }
+ //cPBuffer *GetPBuffer() { return mpPBuffer; }
private:
bool CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx);
Commit: f304b0e02903284e8b821370139969190fd88060
https://github.com/scummvm/scummvm/commit/f304b0e02903284e8b821370139969190fd88060
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:32+01:00
Commit Message:
HPL1: fix bitmap2D
Changed paths:
engines/hpl1/engine/graphics/bitmap2D.cpp
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
index 777e3bb1c57..8ca97d87c47 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.cpp
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -60,6 +60,8 @@ Bitmap2D::Bitmap2D(const tString &filepath, const tString &type)
_decoder.reset(loadImage<Image::GIFDecoder>(filepath));
else
error("trying to load unsupported image format %s", type.c_str());
+ mlWidth = _decoder->getSurface()->w;
+ mlHeight = _decoder->getSurface()->h;
}
Bitmap2D::Bitmap2D(const cVector2l &size, const Graphics::PixelFormat &format)
@@ -86,6 +88,9 @@ bool Bitmap2D::create(const cVector2l &size, const Graphics::PixelFormat &format
_surface.create(size.x, size.y, format);
_isSurfaceActive = true;
_decoder.release();
+ mlWidth = size.x;
+ mlHeight = size.y;
+ mlBpp = format.bpp();
return true;
}
@@ -116,7 +121,7 @@ const void *Bitmap2D::getRawData() const {
}
int Bitmap2D::getNumChannels() {
- return activeSurface().format.bpp() / _surface.format.bytesPerPixel;
+ return activeSurface().format.bpp() / activeSurface().format.bytesPerPixel;
}
const Graphics::PixelFormat &Bitmap2D::format() const {
Commit: 8e8a0423a2a997377447171a43a17cd2db9994c0
https://github.com/scummvm/scummvm/commit/8e8a0423a2a997377447171a43a17cd2db9994c0
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:33+01:00
Commit Message:
HPL1: fix opengl call in SDLTexture class
Changed paths:
engines/hpl1/engine/impl/SDLTexture.cpp
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index a444bd58bb6..5e900eef8f6 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -549,11 +549,11 @@ bool cSDLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
GL_CHECK_FN();
if (mTarget == eTextureTarget_1D)
- glTexImage1D(GLTarget, 0, lChannels, mlWidth, 0, format,
+ glTexImage1D(GLTarget, 0, format, mlWidth, 0, format,
GL_UNSIGNED_BYTE, pPixelSrc);
else
- glTexImage2D(GLTarget, 0, lChannels, mlWidth, mlHeight,
- 0, format, GL_UNSIGNED_BYTE, pPixelSrc);
+ glTexImage2D(GLTarget, 0, format, mlWidth, mlHeight,
+ 0, format, GL_UNSIGNED_BYTE, pPixelSrc);
if (glGetError() != GL_NO_ERROR)
return false;
Commit: 76c540b1bf4c18e96d3b4d455cd1c74eaa7ceb5a
https://github.com/scummvm/scummvm/commit/76c540b1bf4c18e96d3b4d455cd1c74eaa7ceb5a
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:33+01:00
Commit Message:
HPL1: refactor LowLevelPicture class
Changed paths:
engines/hpl1/engine/graphics/LowLevelPicture.h
engines/hpl1/engine/graphics/RendererPostEffects.cpp
engines/hpl1/engine/graphics/Texture.h
engines/hpl1/engine/graphics/bitmap2D.cpp
engines/hpl1/engine/graphics/bitmap2D.h
engines/hpl1/engine/gui/GuiGfxElement.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/resources/FrameBitmap.cpp
engines/hpl1/engine/resources/TextureManager.cpp
diff --git a/engines/hpl1/engine/graphics/LowLevelPicture.h b/engines/hpl1/engine/graphics/LowLevelPicture.h
index c5143bf0ce1..1e21ce20e7d 100644
--- a/engines/hpl1/engine/graphics/LowLevelPicture.h
+++ b/engines/hpl1/engine/graphics/LowLevelPicture.h
@@ -30,37 +30,35 @@
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "common/system.h"
namespace hpl {
-class iLowLevelPicture {
+class LowLevelPicture {
public:
- iLowLevelPicture(tString asType) : msType(asType) {}
- virtual ~iLowLevelPicture() {}
+ LowLevelPicture(const tString &type) : _type(type) {}
+ virtual ~LowLevelPicture() = default;
- tString GetType() { return msType; }
+ tString getType() { return _type; }
- unsigned int GetHeight() { return mlHeight; }
- unsigned int GetWidth() { return mlWidth; }
- unsigned int GetDepth() { return mlDepth; }
+ uint32 getHeight() const { return _height; }
+ uint32 getWidth() const { return _width; }
- unsigned int GetBpp() { return mlBpp; }
+ virtual uint32 getBpp() const = 0;
- virtual bool HasAlpha() = 0;
+ virtual bool hasAlpha() = 0;
- void SetPath(tString asPath) { msPath = asPath; }
- tString GetPath() { return msPath; }
- tString GetFileName() { return cString::GetFileName(msPath); }
+ void setPath(const tString &path) { _path = path; }
+ tString getPath() { return _path; }
+ tString getFileName() const { return cString::GetFileName(_path); }
protected:
- unsigned int mlHeight;
- unsigned int mlWidth;
- unsigned int mlDepth;
- unsigned int mlBpp;
+ uint32 _height;
+ uint32 _width;
private:
- tString msType;
- tString msPath;
+ tString _type;
+ tString _path;
};
}; // namespace hpl
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.cpp b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
index fec0335c033..6ff62a5fc6e 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.cpp
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
@@ -300,7 +300,7 @@ void cRendererPostEffects::RenderBlurTexture(iTexture *apDestination, iTexture *
bProgramsLoaded = true;
iLowLevelGraphics *pLowLevel = mpLowLevelGraphics;
- cVector2l vBlurSize = cVector2l(apDestination->GetWidth(), apDestination->GetHeight());
+ cVector2l vBlurSize = cVector2l(apDestination->getWidth(), apDestination->getHeight());
cVector2f vBlurDrawSize;
vBlurDrawSize.x = ((float)vBlurSize.x / mvScreenSize.x) * mpLowLevelGraphics->GetVirtualSize().x;
vBlurDrawSize.y = ((float)vBlurSize.y / mvScreenSize.y) * mpLowLevelGraphics->GetVirtualSize().y;
@@ -554,8 +554,8 @@ void cRendererPostEffects::RenderMotionBlur() {
mpMotionBlurFP->Bind();
mpMotionBlurFP->SetVec2f("halfScreenSize",
- cVector2f((float)pScreenTexture->GetWidth() / 2.0f,
- (float)pScreenTexture->GetHeight() / 2.0f));
+ cVector2f((float)pScreenTexture->getWidth() / 2.0f,
+ (float)pScreenTexture->getHeight() / 2.0f));
mpLowLevelGraphics->SetTexture(0, pScreenTexture);
@@ -646,7 +646,7 @@ void cRendererPostEffects::RenderBloom() {
RenderBlurTexture(mpBloomBlurTexture, pScreenTexture, mfBloomSpread);
// Size of blur texture
- cVector2f vBlurSize = cVector2f((float)mpBloomBlurTexture->GetWidth(), (float)mpBloomBlurTexture->GetHeight());
+ cVector2f vBlurSize = cVector2f((float)mpBloomBlurTexture->getWidth(), (float)mpBloomBlurTexture->getHeight());
// Size of the virtual screen
cVector2f vVirtSize = mpLowLevelGraphics->GetVirtualSize();
diff --git a/engines/hpl1/engine/graphics/Texture.h b/engines/hpl1/engine/graphics/Texture.h
index b207a83251b..5c9b43f049b 100644
--- a/engines/hpl1/engine/graphics/Texture.h
+++ b/engines/hpl1/engine/graphics/Texture.h
@@ -85,18 +85,18 @@ enum eTextureAnimMode {
class iLowLevelGraphics;
-class iTexture : public iLowLevelPicture, public iResourceBase {
+class iTexture : public LowLevelPicture, public iResourceBase {
public:
iTexture(tString asName, tString asType, Graphics::PixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
eTextureType aType, bool abUseMipMaps, eTextureTarget aTarget,
bool abCompress = false)
- : iLowLevelPicture(asType), iResourceBase(asName, 0),
+ : LowLevelPicture(asType), iResourceBase(asName, 0),
mType(aType), mbUseMipMaps(abUseMipMaps),
mpLowLevelGraphics(apLowLevelGraphics), mbCompress(abCompress),
mTarget(aTarget),
mWrapS(eTextureWrap_Repeat), mWrapT(eTextureWrap_Repeat), mWrapR(eTextureWrap_Repeat),
mfFrameTime(1), mAnimMode(eTextureAnimMode_Loop), mlSizeLevel(0), mvMinLevelSize(16, 16),
- mfAnisotropyDegree(1.0f), mFilter(eTextureFilter_Bilinear) {}
+ mfAnisotropyDegree(1.0f), mFilter(eTextureFilter_Bilinear), _bpp(apPxlFmt->bpp()) {}
virtual ~iTexture() {}
@@ -147,7 +147,8 @@ public:
virtual void SetGamma(float afGamma) = 0;
virtual int GetHandle() = 0;
- virtual bool HasAlpha() { return false; }
+ virtual bool hasAlpha() { return false; }
+ uint32 getBpp() const override { return _bpp; }
virtual void SetWrapS(eTextureWrap aMode) = 0;
virtual void SetWrapT(eTextureWrap aMode) = 0;
@@ -191,6 +192,7 @@ protected:
float mfFrameTime;
eTextureAnimMode mAnimMode;
unsigned int mlSizeLevel;
+ uint32 _bpp;
cVector2l mvMinLevelSize;
};
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
index 8ca97d87c47..a5fcdf7c386 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.cpp
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -47,7 +47,7 @@ static Loader *loadImage(const tString &filepath) {
}
Bitmap2D::Bitmap2D(const tString &filepath, const tString &type)
- : iLowLevelPicture(type), _isSurfaceActive(false) {
+ : LowLevelPicture(type), _isSurfaceActive(false) {
if (type == "png")
_decoder.reset(loadImage<Image::PNGDecoder>(filepath));
else if (type == "bmp")
@@ -60,12 +60,12 @@ Bitmap2D::Bitmap2D(const tString &filepath, const tString &type)
_decoder.reset(loadImage<Image::GIFDecoder>(filepath));
else
error("trying to load unsupported image format %s", type.c_str());
- mlWidth = _decoder->getSurface()->w;
- mlHeight = _decoder->getSurface()->h;
+ _width = _decoder->getSurface()->w;
+ _height = _decoder->getSurface()->h;
}
Bitmap2D::Bitmap2D(const cVector2l &size, const Graphics::PixelFormat &format)
-: iLowLevelPicture("none"), _isSurfaceActive(true) {
+: LowLevelPicture("none"), _isSurfaceActive(true) {
create(size, format);
}
@@ -88,9 +88,8 @@ bool Bitmap2D::create(const cVector2l &size, const Graphics::PixelFormat &format
_surface.create(size.x, size.y, format);
_isSurfaceActive = true;
_decoder.release();
- mlWidth = size.x;
- mlHeight = size.y;
- mlBpp = format.bpp();
+ _width = size.x;
+ _height = size.y;
return true;
}
@@ -128,10 +127,14 @@ const Graphics::PixelFormat &Bitmap2D::format() const {
return activeSurface().format;
}
-bool Bitmap2D::HasAlpha() {
+bool Bitmap2D::hasAlpha() {
return activeSurface().format.aBits() > 0;
}
+uint32 Bitmap2D::getBpp() const {
+ return format().bpp();
+}
+
void Bitmap2D::copyDecoder() {
_surface.copyFrom(*( _decoder->getSurface()));
_isSurfaceActive = true;
diff --git a/engines/hpl1/engine/graphics/bitmap2D.h b/engines/hpl1/engine/graphics/bitmap2D.h
index 654658dcd5e..4cc763705c5 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.h
+++ b/engines/hpl1/engine/graphics/bitmap2D.h
@@ -39,7 +39,7 @@
namespace hpl {
-class Bitmap2D : public iLowLevelPicture {
+class Bitmap2D : public LowLevelPicture {
public:
Bitmap2D(const cVector2l &size, const Graphics::PixelFormat &format);
Bitmap2D(const tString &filename, const tString &type);
@@ -58,7 +58,9 @@ public:
const Graphics::PixelFormat &format() const;
- bool HasAlpha() override;
+ bool hasAlpha() override;
+
+ uint32 getBpp() const override;
private:
void copyDecoder();
diff --git a/engines/hpl1/engine/gui/GuiGfxElement.cpp b/engines/hpl1/engine/gui/GuiGfxElement.cpp
index 2e197d324f1..6efd3e8e7f6 100644
--- a/engines/hpl1/engine/gui/GuiGfxElement.cpp
+++ b/engines/hpl1/engine/gui/GuiGfxElement.cpp
@@ -227,8 +227,8 @@ void cGuiGfxElement::AddTexture(iTexture *apTexture) {
mvTextures[mlTextureNum] = apTexture;
if (mlTextureNum == 0) {
- mvImageSize.x = (float)apTexture->GetWidth();
- mvImageSize.y = (float)apTexture->GetHeight();
+ mvImageSize.x = (float)apTexture->getWidth();
+ mvImageSize.y = (float)apTexture->getHeight();
}
mvActiveSize = GetImageSize();
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 19130a61739..07203f5a359 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -1343,7 +1343,7 @@ void cLowLevelGraphicsSDL::CopyContextToTexure(iTexture *apTex, const cVector2l
return;
int lScreenY = (mvScreenSize.y - avSize.y) - avPos.y;
- int lTexY = (apTex->GetHeight() - avSize.y) - avTexOffset.y;
+ int lTexY = (apTex->getHeight() - avSize.y) - avTexOffset.y;
//Log("TExoffset: %d %d\n",avTexOffset.x,lTexY);
//Log("ScreenOffset: %d %d (h: %d s: %d p: %d)\n",avPos.x,lScreenY,mvScreenSize.y,
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index 5e900eef8f6..33799f906e2 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -64,8 +64,6 @@ cSDLTexture::cSDLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt,
mfTimeCount = 0;
mfTimeDir = 1;
-
- mlBpp = 0;
}
cSDLTexture::~cSDLTexture() {
@@ -148,7 +146,7 @@ bool cSDLTexture::CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps) {
GLenum format;
GetSettings(pSrc, lChannels, format);
- glTexImage2D(target, 0, lChannels, pSrc->GetWidth(), pSrc->GetHeight(),
+ glTexImage2D(target, 0, lChannels, pSrc->getWidth(), pSrc->getHeight(),
0, format, GL_UNSIGNED_BYTE, pSrc->getRawData());
// No mip maps for cubemap
@@ -158,11 +156,11 @@ bool cSDLTexture::CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps) {
// GL_RGBA, GL_UNSIGNED_BYTE, pSrc->GetSurface()->pixels);
// }
- mlWidth = pSrc->GetWidth();
- mlHeight = pSrc->GetHeight();
- mlBpp = lChannels * 8;
+ _width = pSrc->getWidth();
+ _height = pSrc->getHeight();
+ _bpp = lChannels * 8;
- if (!cMath::IsPow2(mlHeight) || !cMath::IsPow2(mlWidth)) {
+ if (!cMath::IsPow2(_height) || !cMath::IsPow2(_width)) {
Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
}
}
@@ -214,20 +212,19 @@ bool cSDLTexture::CreateFromArray(unsigned char *apPixelData, int alChannels, co
break;
}
- mlWidth = avSize.x;
- mlHeight = avSize.y;
- mlDepth = avSize.z;
- mlBpp = lChannels * 8;
+ _width = avSize.x;
+ _height = avSize.y;
+ _bpp = lChannels * 8;
- if (!cMath::IsPow2(mlHeight) || !cMath::IsPow2(mlWidth) || !cMath::IsPow2(mlDepth)) {
+ if (!cMath::IsPow2(_height) || !cMath::IsPow2(_width) || !cMath::IsPow2(avSize.z)) {
Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
}
if (mTarget == eTextureTarget_1D) {
- GL_CHECK(glTexImage1D(GLTarget, 0, lChannels, mlWidth, 0, format,
+ GL_CHECK(glTexImage1D(GLTarget, 0, lChannels, _width, 0, format,
GL_UNSIGNED_BYTE, apPixelData));
} else if (mTarget == eTextureTarget_2D) {
- GL_CHECK(glTexImage2D(GLTarget, 0, lChannels, mlWidth, mlHeight,
+ GL_CHECK(glTexImage2D(GLTarget, 0, lChannels, _width, _height,
0, format, GL_UNSIGNED_BYTE, apPixelData));
} else if (mTarget == eTextureTarget_3D) {
GL_CHECK(glTexImage3D(GLTarget, 0, lChannels, avSize.x, avSize.y, avSize.z,
@@ -481,44 +478,44 @@ bool cSDLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
Bitmap2D *pBitmapSrc = pBmp;
- mlWidth = pBitmapSrc->GetWidth();
- mlHeight = pBitmapSrc->GetHeight();
+ _width = pBitmapSrc->getWidth();
+ _height = pBitmapSrc->getHeight();
- if ((!cMath::IsPow2(mlHeight) || !cMath::IsPow2(mlWidth)) && mTarget != eTextureTarget_Rect)
+ if ((!cMath::IsPow2(_height) || !cMath::IsPow2(_width)) && mTarget != eTextureTarget_Rect)
Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
int lChannels = 0;
GLenum format = 0;
GetSettings(pBitmapSrc, lChannels, format);
- mlBpp = lChannels * 8;
+ _bpp = lChannels * 8;
const unsigned char *pPixelSrc = (const unsigned char *)pBitmapSrc->getRawData();
unsigned char *pNewSrc = nullptr;
- if (mlSizeLevel > 0 && (int)mlWidth > mvMinLevelSize.x * 2) {
+ if (mlSizeLevel > 0 && (int)_width > mvMinLevelSize.x * 2) {
// Log("OldSize: %d x %d ",mlWidth,mlHeight);
- int lOldW = mlWidth;
- int lOldH = mlHeight;
+ int lOldW = _width;
+ int lOldH = _height;
int lSizeDiv = (int)pow((float)2, (int)mlSizeLevel);
- mlWidth /= lSizeDiv;
- mlHeight /= lSizeDiv;
+ _width /= lSizeDiv;
+ _height /= lSizeDiv;
- while (mlWidth < (unsigned int)mvMinLevelSize.x) {
- mlWidth *= 2;
- mlHeight *= 2;
+ while (_width < (unsigned int)mvMinLevelSize.x) {
+ _width *= 2;
+ _height *= 2;
lSizeDiv /= 2;
}
// Log("NewSize: %d x %d SizeDiv: %d\n",mlWidth,mlHeight,lSizeDiv);
- pNewSrc = hplNewArray(unsigned char, lChannels *mlWidth *mlHeight);
+ pNewSrc = hplNewArray(unsigned char, lChannels *_width *_height);
- int lWidthCount = mlWidth;
- int lHeightCount = mlHeight;
+ int lWidthCount = _width;
+ int lHeightCount = _height;
int lOldAdd = lChannels * lSizeDiv;
int lOldHeightAdd = lChannels * lOldW * (lSizeDiv - 1);
@@ -533,7 +530,7 @@ bool cSDLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
lWidthCount--;
if (!lWidthCount) {
- lWidthCount = mlWidth;
+ lWidthCount = _width;
lHeightCount--;
pOldPixel += lOldHeightAdd;
}
@@ -549,10 +546,10 @@ bool cSDLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
GL_CHECK_FN();
if (mTarget == eTextureTarget_1D)
- glTexImage1D(GLTarget, 0, format, mlWidth, 0, format,
+ glTexImage1D(GLTarget, 0, format, _width, 0, format,
GL_UNSIGNED_BYTE, pPixelSrc);
else
- glTexImage2D(GLTarget, 0, format, mlWidth, mlHeight,
+ glTexImage2D(GLTarget, 0, format, _width, _height,
0, format, GL_UNSIGNED_BYTE, pPixelSrc);
if (glGetError() != GL_NO_ERROR)
@@ -607,7 +604,7 @@ void cSDLTexture::GetSettings(Bitmap2D *apSrc, int &alChannels, GLenum &aFormat)
alChannels = apSrc->getNumChannels();
aFormat = GL_RGBA;
- tString sType = cString::ToLowerCase(apSrc->GetType());
+ tString sType = cString::ToLowerCase(apSrc->getType());
if (alChannels == 4) {
if (sType == "tga") {
diff --git a/engines/hpl1/engine/resources/FrameBitmap.cpp b/engines/hpl1/engine/resources/FrameBitmap.cpp
index 4197f15ebf0..cd0282024e1 100644
--- a/engines/hpl1/engine/resources/FrameBitmap.cpp
+++ b/engines/hpl1/engine/resources/FrameBitmap.cpp
@@ -53,7 +53,7 @@ namespace hpl {
mbIsLocked = false;
//Root node in rect tree
- mRects.Insert(cFBitmapRect(0,0,mpBitmap->GetWidth(), mpBitmap->GetHeight(),-1));
+ mRects.Insert(cFBitmapRect(0,0,mpBitmap->getWidth(), mpBitmap->getHeight(),-1));
}
cFrameBitmap::~cFrameBitmap()
diff --git a/engines/hpl1/engine/resources/TextureManager.cpp b/engines/hpl1/engine/resources/TextureManager.cpp
index bbcb9d15c37..d8478956a98 100644
--- a/engines/hpl1/engine/resources/TextureManager.cpp
+++ b/engines/hpl1/engine/resources/TextureManager.cpp
@@ -321,7 +321,7 @@ iTexture *cTextureManager::CreateAttenuation(const tString &asFallOffName) {
}
int lBmpChannels = pBmp->getNumChannels();
- int lWidth = pBmp->GetWidth();
+ int lWidth = pBmp->getWidth();
unsigned char *pPixels = (unsigned char *)pBmp->getRawData();
iTexture *pTexture = mpGraphics->GetLowLevel()->CreateTexture("Attenuation", false, eTextureType_Normal, eTextureTarget_3D);
Commit: 7f3967b9ebe36d3620aea7c92ad5bcddc599cc94
https://github.com/scummvm/scummvm/commit/7f3967b9ebe36d3620aea7c92ad5bcddc599cc94
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:33+01:00
Commit Message:
HPL1: initialize parameter in LowLevelGraphicsSDL
Changed paths:
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 07203f5a359..3bfc9b2cc93 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -88,6 +88,7 @@ cLowLevelGraphicsSDL::cLowLevelGraphicsSDL() {
mvVirtualSize.y = 600;
mfGammaCorrection = 1.0;
mpRenderTarget = nullptr;
+ mpPixelFormat = Graphics::createPixelFormat<8888>();
Common::fill(mpCurrentTexture, mpCurrentTexture + MAX_TEXTUREUNITS, nullptr);
@@ -333,7 +334,7 @@ void cLowLevelGraphicsSDL::SaveScreenToBMP(const tString &asFile) {
//-----------------------------------------------------------------------
Bitmap2D *cLowLevelGraphicsSDL::CreateBitmap2D(const cVector2l &size) {
- return hplNew(Bitmap2D, (size, *mpPixelFormat));
+ return hplNew(Bitmap2D, (size, mpPixelFormat));
}
//-----------------------------------------------------------------------
@@ -352,26 +353,26 @@ iGpuProgram *cLowLevelGraphicsSDL::CreateGpuProgram(const tString &asName, eGpuP
//-----------------------------------------------------------------------
Graphics::PixelFormat *cLowLevelGraphicsSDL::GetPixelFormat() {
- return mpPixelFormat;
+ return &mpPixelFormat;
}
//-----------------------------------------------------------------------
iTexture *cLowLevelGraphicsSDL::CreateTexture(bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) {
- return hplNew(cSDLTexture, ("", mpPixelFormat, this, aType, abUseMipMaps, aTarget));
+ return hplNew(cSDLTexture, ("", &mpPixelFormat, this, aType, abUseMipMaps, aTarget));
}
//-----------------------------------------------------------------------
iTexture *cLowLevelGraphicsSDL::CreateTexture(const tString &asName, bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) {
- return hplNew(cSDLTexture, (asName, mpPixelFormat, this, aType, abUseMipMaps, aTarget));
+ return hplNew(cSDLTexture, (asName, &mpPixelFormat, this, aType, abUseMipMaps, aTarget));
}
//-----------------------------------------------------------------------
iTexture *cLowLevelGraphicsSDL::CreateTexture(Bitmap2D *apBmp, bool abUseMipMaps, eTextureType aType,
eTextureTarget aTarget) {
- cSDLTexture *pTex = hplNew(cSDLTexture, ("", mpPixelFormat, this, aType, abUseMipMaps, aTarget));
+ cSDLTexture *pTex = hplNew(cSDLTexture, ("", &mpPixelFormat, this, aType, abUseMipMaps, aTarget));
pTex->CreateFromBitmap(apBmp);
return pTex;
@@ -384,13 +385,13 @@ iTexture *cLowLevelGraphicsSDL::CreateTexture(const cVector2l &avSize, int alBpp
cSDLTexture *pTex = NULL;
if (aType == eTextureType_RenderTarget) {
- pTex = hplNew(cSDLTexture, ("", mpPixelFormat, this, aType, abUseMipMaps, aTarget));
+ pTex = hplNew(cSDLTexture, ("", &mpPixelFormat, this, aType, abUseMipMaps, aTarget));
pTex->Create(avSize.x, avSize.y, aFillCol);
} else {
Bitmap2D *pBmp = CreateBitmap2D(avSize);
pBmp->fillRect(cRect2l(0, 0, 0, 0), aFillCol);
- pTex = hplNew(cSDLTexture, ("", mpPixelFormat, this, aType, abUseMipMaps, aTarget));
+ pTex = hplNew(cSDLTexture, ("", &mpPixelFormat, this, aType, abUseMipMaps, aTarget));
bool bRet = pTex->CreateFromBitmap(pBmp);
hplDelete(pBmp);
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
index abb96b28263..eb069021f19 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
@@ -253,7 +253,7 @@ private:
// SDL Variables
//SDL_Surface *mpScreen;
- Graphics::PixelFormat *mpPixelFormat;
+ Graphics::PixelFormat mpPixelFormat;
// Vertex Array variables
// The vertex arrays used:
Commit: e32922d487d5f79a3869afa16aa8b449f5533f0a
https://github.com/scummvm/scummvm/commit/e32922d487d5f79a3869afa16aa8b449f5533f0a
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:33+01:00
Commit Message:
HPL1: implement VertexBufferVBO class
Changed paths:
engines/hpl1/engine/impl/VertexBufferVBO.cpp
diff --git a/engines/hpl1/engine/impl/VertexBufferVBO.cpp b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
index 51dcc4904fe..46bab4aa0b8 100644
--- a/engines/hpl1/engine/impl/VertexBufferVBO.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
@@ -28,6 +28,7 @@
#include "hpl1/engine/impl/VertexBufferVBO.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
+#include "hpl1/opengl.h"
#include <memory.h>
@@ -71,20 +72,16 @@ cVertexBufferVBO::cVertexBufferVBO(iLowLevelGraphics *apLowLevelGraphics, tVerte
}
cVertexBufferVBO::~cVertexBufferVBO() {
-#if 0
- for(int i=0;i< klNumOfVertexFlags; i++)
- {
- mvVertexArray[i].clear();
- if(mVertexFlags & kvVertexFlags[i])
- {
- glDeleteBuffersARB(1,(GLuint *)&mvArrayHandle[i]);
- }
+ for (int i = 0; i < klNumOfVertexFlags; i++) {
+ mvVertexArray[i].clear();
+ if (mVertexFlags & kvVertexFlags[i]) {
+ glDeleteBuffers(1, (GLuint *)&mvArrayHandle[i]);
}
+ }
+ GL_CHECK_FN();
+ mvIndexArray.clear();
- mvIndexArray.clear();
-
- glDeleteBuffersARB(1,(GLuint *)&mlElementHandle);
-#endif
+ GL_CHECK(glDeleteBuffers(1, (GLuint *)&mlElementHandle));
}
//-----------------------------------------------------------------------
@@ -138,108 +135,102 @@ cBoundingVolume cVertexBufferVBO::CreateBoundingVolume() {
//-----------------------------------------------------------------------
bool cVertexBufferVBO::Compile(tVertexCompileFlag aFlags) {
-#if 0
- if(mbCompiled) return false;
- mbCompiled = true;
+ if (mbCompiled)
+ return false;
+ mbCompiled = true;
- //Create tangents
- if(aFlags & eVertexCompileFlag_CreateTangents)
- {
- mbTangents = true;
+ // Create tangents
+ if (aFlags & eVertexCompileFlag_CreateTangents) {
+ mbTangents = true;
- mVertexFlags |= eVertexFlag_Texture1;
+ mVertexFlags |= eVertexFlag_Texture1;
- int idx = cMath::Log2ToInt((int)eVertexFlag_Texture1);
+ int idx = cMath::Log2ToInt((int)eVertexFlag_Texture1);
- int lSize = GetVertexNum()*4;
- mvVertexArray[idx].resize(lSize);
+ int lSize = GetVertexNum() * 4;
+ mvVertexArray[idx].resize(lSize);
- cMath::CreateTriTangentVectors(&(mvVertexArray[cMath::Log2ToInt((int)eVertexFlag_Texture1)][0]),
- &mvIndexArray[0], GetIndexNum(),
+ cMath::CreateTriTangentVectors(&(mvVertexArray[cMath::Log2ToInt((int)eVertexFlag_Texture1)][0]),
+ &mvIndexArray[0], GetIndexNum(),
- &(mvVertexArray[cMath::Log2ToInt((int)eVertexFlag_Position)][0]),
- kvVertexElements[cMath::Log2ToInt((int)eVertexFlag_Position)],
+ &(mvVertexArray[cMath::Log2ToInt((int)eVertexFlag_Position)][0]),
+ kvVertexElements[cMath::Log2ToInt((int)eVertexFlag_Position)],
- &(mvVertexArray[cMath::Log2ToInt((int)eVertexFlag_Texture0)][0]),
- &(mvVertexArray[cMath::Log2ToInt((int)eVertexFlag_Normal)][0]),
- GetVertexNum()
- );
- }
+ &(mvVertexArray[cMath::Log2ToInt((int)eVertexFlag_Texture0)][0]),
+ &(mvVertexArray[cMath::Log2ToInt((int)eVertexFlag_Normal)][0]),
+ GetVertexNum());
+ }
- GLenum usageType = GL_STATIC_DRAW_ARB;
- if(mUsageType== eVertexBufferUsageType_Dynamic) usageType = GL_DYNAMIC_DRAW_ARB;
- else if(mUsageType== eVertexBufferUsageType_Stream) usageType = GL_STREAM_DRAW_ARB;
+ GLenum usageType = GL_STATIC_DRAW;
+ if (mUsageType == eVertexBufferUsageType_Dynamic)
+ usageType = GL_DYNAMIC_DRAW;
+ else if (mUsageType == eVertexBufferUsageType_Stream)
+ usageType = GL_STREAM_DRAW;
- //Create the VBO vertex arrays
- for(int i=0;i< klNumOfVertexFlags; i++)
- {
- if(mVertexFlags & kvVertexFlags[i])
- {
- glGenBuffersARB(1,(GLuint *)&mvArrayHandle[i]);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, mvArrayHandle[i]);
+ // Create the VBO vertex arrays
+ for (int i = 0; i < klNumOfVertexFlags; i++) {
+ if (mVertexFlags & kvVertexFlags[i]) {
+ glGenBuffers(1, (GLuint *)&mvArrayHandle[i]);
+ glBindBuffer(GL_ARRAY_BUFFER, mvArrayHandle[i]);
- glBufferDataARB(GL_ARRAY_BUFFER_ARB, mvVertexArray[i].size()*sizeof(float),
- &(mvVertexArray[i][0]), usageType);
+ glBufferData(GL_ARRAY_BUFFER, mvVertexArray[i].size() * sizeof(float),
+ &(mvVertexArray[i][0]), usageType);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
- //Log("%d-Handle: %d, size: %d \n",i,mvArrayHandle[i], mvVertexArray);
- }
+ // Log("%d-Handle: %d, size: %d \n",i,mvArrayHandle[i], mvVertexArray);
}
+ }
+ GL_CHECK_FN();
+ // Create the VBO index array
+ GL_CHECK(glGenBuffers(1, (GLuint *)&mlElementHandle));
+ GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mlElementHandle));
+ GL_CHECK(glBufferData(GL_ELEMENT_ARRAY_BUFFER, GetIndexNum() * sizeof(unsigned int),
+ &mvIndexArray[0], usageType));
+ GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
- //Create the VBO index array
- glGenBuffersARB(1,(GLuint *)&mlElementHandle);
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,mlElementHandle);
- glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GetIndexNum()*sizeof(unsigned int),
- &mvIndexArray[0], usageType);
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,0);
-
- //Log("VBO compile done!\n");
+ // Log("VBO compile done!\n");
- return true;
-#endif
- return false;
+ return true;
}
//-----------------------------------------------------------------------
void cVertexBufferVBO::UpdateData(tVertexFlag aTypes, bool abIndices) {
-#if 0
- GLenum usageType = GL_STATIC_DRAW_ARB;
- if(mUsageType== eVertexBufferUsageType_Dynamic) usageType = GL_DYNAMIC_DRAW_ARB;
- else if(mUsageType== eVertexBufferUsageType_Stream) usageType = GL_STREAM_DRAW_ARB;
-
- //Create the VBO vertex arrays
- for(int i=0;i< klNumOfVertexFlags; i++)
- {
- if((mVertexFlags & kvVertexFlags[i]) && (aTypes & kvVertexFlags[i]))
- {
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, mvArrayHandle[i]);
-
- //This was apparently VERY slow.
- glBufferDataARB(GL_ARRAY_BUFFER_ARB, mvVertexArray[i].size()*sizeof(float),
- NULL, usageType);//Clear memory
-
- glBufferDataARB(GL_ARRAY_BUFFER_ARB, mvVertexArray[i].size()*sizeof(float),
- &(mvVertexArray[i][0]), usageType);
- }
+ GLenum usageType = GL_STATIC_DRAW;
+ if (mUsageType == eVertexBufferUsageType_Dynamic)
+ usageType = GL_DYNAMIC_DRAW;
+ else if (mUsageType == eVertexBufferUsageType_Stream)
+ usageType = GL_STREAM_DRAW;
+
+ // Create the VBO vertex arrays
+ for (int i = 0; i < klNumOfVertexFlags; i++) {
+ if ((mVertexFlags & kvVertexFlags[i]) && (aTypes & kvVertexFlags[i])) {
+ glBindBuffer(GL_ARRAY_BUFFER, mvArrayHandle[i]);
+
+ // This was apparently VERY slow.
+ glBufferData(GL_ARRAY_BUFFER, mvVertexArray[i].size() * sizeof(float),
+ NULL, usageType); // Clear memory
+
+ glBufferData(GL_ARRAY_BUFFER, mvVertexArray[i].size() * sizeof(float),
+ &(mvVertexArray[i][0]), usageType);
}
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
+ }
+ GL_CHECK_FN();
+ GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0));
- //Create the VBO index array
- if(abIndices)
- {
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,mlElementHandle);
+ // Create the VBO index array
+ if (abIndices) {
+ GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mlElementHandle));
- //glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,GetIndexNum()*sizeof(unsigned int),
- // NULL, usageType);
+ // glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER,GetIndexNum()*sizeof(unsigned int),
+ // NULL, usageType);
- glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GetIndexNum()*sizeof(unsigned int),
- &mvIndexArray[0], usageType);
+ GL_CHECK(glBufferData(GL_ELEMENT_ARRAY_BUFFER, GetIndexNum() * sizeof(unsigned int),
+ &mvIndexArray[0], usageType));
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,0);
- }
-#endif
+ GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
+ }
}
//-----------------------------------------------------------------------
@@ -328,44 +319,45 @@ void cVertexBufferVBO::Transform(const cMatrixf &a_mtxTransform) {
//-----------------------------------------------------------------------
void cVertexBufferVBO::Draw(eVertexBufferDrawType aDrawType) {
-#if 0
- eVertexBufferDrawType drawType = aDrawType == eVertexBufferDrawType_LastEnum ? mDrawType : aDrawType;
+ eVertexBufferDrawType drawType = aDrawType == eVertexBufferDrawType_LastEnum ? mDrawType : aDrawType;
- ///////////////////////////////
- //Get the draw type
- GLenum mode = GL_TRIANGLES;
- if(drawType==eVertexBufferDrawType_Quad) mode = GL_QUADS;
- else if(drawType==eVertexBufferDrawType_Lines) mode = GL_LINE_STRIP;
+ ///////////////////////////////
+ // Get the draw type
+ GLenum mode = GL_TRIANGLES;
+ if (drawType == eVertexBufferDrawType_Quad)
+ mode = GL_QUADS;
+ else if (drawType == eVertexBufferDrawType_Lines)
+ mode = GL_LINE_STRIP;
- //////////////////////////////////
- //Bind and draw the buffer
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,mlElementHandle);
+ //////////////////////////////////
+ // Bind and draw the buffer
+ GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mlElementHandle));
- int lSize = mlElementNum;
- if(mlElementNum<0) lSize = GetIndexNum();
+ int lSize = mlElementNum;
+ if (mlElementNum < 0)
+ lSize = GetIndexNum();
- glDrawElements(mode,lSize,GL_UNSIGNED_INT, (char*) NULL);
+ GL_CHECK(glDrawElements(mode, lSize, GL_UNSIGNED_INT, (char *)NULL));
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,0);
-#endif
+ GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
}
//-----------------------------------------------------------------------
void cVertexBufferVBO::DrawIndices(unsigned int *apIndices, int alCount, eVertexBufferDrawType aDrawType) {
-#if 0
- eVertexBufferDrawType drawType = aDrawType == eVertexBufferDrawType_LastEnum ? mDrawType : aDrawType;
+ eVertexBufferDrawType drawType = aDrawType == eVertexBufferDrawType_LastEnum ? mDrawType : aDrawType;
- ///////////////////////////////
- //Get the draw type
- GLenum mode = GL_TRIANGLES;
- if(drawType==eVertexBufferDrawType_Quad) mode = GL_QUADS;
- else if(drawType==eVertexBufferDrawType_Lines) mode = GL_LINE_STRIP;
+ ///////////////////////////////
+ // Get the draw type
+ GLenum mode = GL_TRIANGLES;
+ if (drawType == eVertexBufferDrawType_Quad)
+ mode = GL_QUADS;
+ else if (drawType == eVertexBufferDrawType_Lines)
+ mode = GL_LINE_STRIP;
- //////////////////////////////////
- //Bind and draw the buffer
- glDrawElements(mode, alCount, GL_UNSIGNED_INT, apIndices);
-#endif
+ //////////////////////////////////
+ // Bind and draw the buffer
+ GL_CHECK(glDrawElements(mode, alCount, GL_UNSIGNED_INT, apIndices));
}
//-----------------------------------------------------------------------
@@ -377,9 +369,7 @@ void cVertexBufferVBO::Bind() {
//-----------------------------------------------------------------------
void cVertexBufferVBO::UnBind() {
-#if 0
- glBindBufferARB(GL_ARRAY_BUFFER_ARB,0);
-#endif
+ GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0));
}
//-----------------------------------------------------------------------
@@ -509,125 +499,110 @@ int cVertexBufferVBO::GetElementNum(tVertexFlag aFlag) {
//-----------------------------------------------------------------------
void cVertexBufferVBO::SetVertexStates(tVertexFlag aFlags) {
-#if 0
- /// COLOR 0 /////////////////////////
- if(aFlags & eVertexFlag_Color0)
- {
- glEnableClientState(GL_COLOR_ARRAY );
-
- int idx = cMath::Log2ToInt(eVertexFlag_Color0);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB,mvArrayHandle[idx]);
- glColorPointer(kvVertexElements[idx],GL_FLOAT, 0, (char*)NULL);
- }
- else
- {
- glDisableClientState(GL_COLOR_ARRAY );
- }
-
- /// NORMAL /////////////////////////
- if(aFlags & eVertexFlag_Normal)
- {
- glEnableClientState(GL_NORMAL_ARRAY );
-
- int idx = cMath::Log2ToInt(eVertexFlag_Normal);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB,mvArrayHandle[idx]);
- glNormalPointer(GL_FLOAT, 0, (char*)NULL);
- }
- else
- {
- glDisableClientState(GL_NORMAL_ARRAY );
- }
-
- /// TEXTURE 0 /////////////////////////
- if(aFlags & eVertexFlag_Texture0)
- {
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY );
+ /// COLOR 0 /////////////////////////
+ if (aFlags & eVertexFlag_Color0) {
+ GL_CHECK(glEnableClientState(GL_COLOR_ARRAY));
+
+ int idx = cMath::Log2ToInt(eVertexFlag_Color0);
+ GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, mvArrayHandle[idx]));
+ GL_CHECK(glColorPointer(kvVertexElements[idx], GL_FLOAT, 0, (char *)NULL));
+ } else {
+ GL_CHECK(glDisableClientState(GL_COLOR_ARRAY));
+ }
- int idx = cMath::Log2ToInt(eVertexFlag_Texture0);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB,mvArrayHandle[idx]);
- glTexCoordPointer(kvVertexElements[idx],GL_FLOAT,0,(char*)NULL );
- }
- else {
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY );
- }
+ /// NORMAL /////////////////////////
+ if (aFlags & eVertexFlag_Normal) {
+ GL_CHECK(glEnableClientState(GL_NORMAL_ARRAY));
- /// TEXTURE 1 /////////////////////////
- if(aFlags & eVertexFlag_Texture1){
- glClientActiveTextureARB(GL_TEXTURE1_ARB);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY );
+ int idx = cMath::Log2ToInt(eVertexFlag_Normal);
+ GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, mvArrayHandle[idx]));
+ GL_CHECK(glNormalPointer(GL_FLOAT, 0, (char *)NULL));
+ } else {
+ GL_CHECK(glDisableClientState(GL_NORMAL_ARRAY));
+ }
- int idx = cMath::Log2ToInt(eVertexFlag_Texture1);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB,mvArrayHandle[idx]);
+ /// TEXTURE 0 /////////////////////////
+ if (aFlags & eVertexFlag_Texture0) {
+ GL_CHECK(glClientActiveTexture(GL_TEXTURE0));
+ GL_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
+
+ int idx = cMath::Log2ToInt(eVertexFlag_Texture0);
+ GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, mvArrayHandle[idx]));
+ GL_CHECK(glTexCoordPointer(kvVertexElements[idx], GL_FLOAT, 0, (char *)NULL));
+ } else {
+ GL_CHECK(glClientActiveTexture(GL_TEXTURE0));
+ GL_CHECK(glDisableClientState(GL_TEXTURE_COORD_ARRAY));
+ }
- if(mbTangents)
- glTexCoordPointer(4,GL_FLOAT,0,(char*)NULL );
- else
- glTexCoordPointer(kvVertexElements[idx],GL_FLOAT,0,(char*)NULL );
- }
- else {
- glClientActiveTextureARB(GL_TEXTURE1_ARB);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY );
- }
+ /// TEXTURE 1 /////////////////////////
+ if (aFlags & eVertexFlag_Texture1) {
+ GL_CHECK(glClientActiveTexture(GL_TEXTURE1));
+ GL_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
- /// TEXTURE 2 /////////////////////////
- if(aFlags & eVertexFlag_Texture2){
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY );
+ int idx = cMath::Log2ToInt(eVertexFlag_Texture1);
+ GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, mvArrayHandle[idx]));
- int idx = cMath::Log2ToInt(eVertexFlag_Texture2);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB,mvArrayHandle[idx]);
- glTexCoordPointer(kvVertexElements[idx],GL_FLOAT,0,(char*)NULL );
- }
- else {
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY );
+ if (mbTangents) {
+ GL_CHECK(glTexCoordPointer(4, GL_FLOAT, 0, (char *)NULL));
+ } else {
+ GL_CHECK(glTexCoordPointer(kvVertexElements[idx], GL_FLOAT, 0, (char *)NULL));
}
+ } else {
+ GL_CHECK(glClientActiveTexture(GL_TEXTURE1));
+ GL_CHECK(glDisableClientState(GL_TEXTURE_COORD_ARRAY));
+ }
- /// TEXTURE 3 /////////////////////////
- if(aFlags & eVertexFlag_Texture3){
- glClientActiveTextureARB(GL_TEXTURE3_ARB);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY );
-
- int idx = cMath::Log2ToInt(eVertexFlag_Texture3);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB,mvArrayHandle[idx]);
- glTexCoordPointer(kvVertexElements[idx],GL_FLOAT,0,(char*)NULL );
- }
- else {
- glClientActiveTextureARB(GL_TEXTURE3_ARB);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY );
- }
+ /// TEXTURE 2 /////////////////////////
+ if (aFlags & eVertexFlag_Texture2) {
+ GL_CHECK(glClientActiveTexture(GL_TEXTURE2));
+ GL_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
+
+ int idx = cMath::Log2ToInt(eVertexFlag_Texture2);
+ GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, mvArrayHandle[idx]));
+ GL_CHECK(glTexCoordPointer(kvVertexElements[idx], GL_FLOAT, 0, (char *)NULL));
+ } else {
+ GL_CHECK(glClientActiveTexture(GL_TEXTURE2));
+ GL_CHECK(glDisableClientState(GL_TEXTURE_COORD_ARRAY));
+ }
- /// TEXTURE 4 /////////////////////////
- if(aFlags & eVertexFlag_Texture4){
- glClientActiveTextureARB(GL_TEXTURE4_ARB);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY );
+ /// TEXTURE 3 /////////////////////////
+ if (aFlags & eVertexFlag_Texture3) {
+ GL_CHECK(glClientActiveTexture(GL_TEXTURE3));
+ GL_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
+
+ int idx = cMath::Log2ToInt(eVertexFlag_Texture3);
+ GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, mvArrayHandle[idx]));
+ GL_CHECK(glTexCoordPointer(kvVertexElements[idx], GL_FLOAT, 0, (char *)NULL));
+ } else {
+ GL_CHECK(glClientActiveTexture(GL_TEXTURE3));
+ GL_CHECK(glDisableClientState(GL_TEXTURE_COORD_ARRAY));
+ }
- int idx = cMath::Log2ToInt(eVertexFlag_Texture4);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB,mvArrayHandle[idx]);
- glTexCoordPointer(kvVertexElements[idx],GL_FLOAT,0,(char*)NULL );
- }
- else {
- glClientActiveTextureARB(GL_TEXTURE4_ARB);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY );
- }
+ /// TEXTURE 4 /////////////////////////
+ if (aFlags & eVertexFlag_Texture4) {
+ GL_CHECK(glClientActiveTexture(GL_TEXTURE4));
+ GL_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
+
+ int idx = cMath::Log2ToInt(eVertexFlag_Texture4);
+ GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, mvArrayHandle[idx]));
+ GL_CHECK(glTexCoordPointer(kvVertexElements[idx], GL_FLOAT, 0, (char *)NULL));
+ } else {
+ GL_CHECK(glClientActiveTexture(GL_TEXTURE4));
+ GL_CHECK(glDisableClientState(GL_TEXTURE_COORD_ARRAY));
+ }
- /// POSITION /////////////////////////
- if(aFlags & eVertexFlag_Position){
- glEnableClientState(GL_VERTEX_ARRAY );
+ /// POSITION /////////////////////////
+ if (aFlags & eVertexFlag_Position) {
+ GL_CHECK(glEnableClientState(GL_VERTEX_ARRAY));
- int idx = cMath::Log2ToInt(eVertexFlag_Position);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB,mvArrayHandle[idx]);
- glVertexPointer(kvVertexElements[idx],GL_FLOAT, 0, (char*)NULL);
- }
- else
- {
- glDisableClientState(GL_VERTEX_ARRAY );
- }
+ int idx = cMath::Log2ToInt(eVertexFlag_Position);
+ GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, mvArrayHandle[idx]));
+ GL_CHECK(glVertexPointer(kvVertexElements[idx], GL_FLOAT, 0, (char *)NULL));
+ } else {
+ GL_CHECK(glDisableClientState(GL_VERTEX_ARRAY));
+ }
- glBindBufferARB(GL_ARRAY_BUFFER_ARB,0);
-#endif
+ GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0));
}
//-----------------------------------------------------------------------
Commit: db47003e99eed0ec5d820b2e4a38c1db811eabc7
https://github.com/scummvm/scummvm/commit/db47003e99eed0ec5d820b2e4a38c1db811eabc7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:33+01:00
Commit Message:
HPL1: fix bug in opengl debug macro
Changed paths:
engines/hpl1/opengl.h
diff --git a/engines/hpl1/opengl.h b/engines/hpl1/opengl.h
index 6aacf293370..8e6c6444cc4 100644
--- a/engines/hpl1/opengl.h
+++ b/engines/hpl1/opengl.h
@@ -31,7 +31,7 @@ namespace Hpl1 {
void checkOGLErrors(const char *function, int line);
}
-#define GL_CHECK(x) {::Hpl1::checkOGLErrors(__func__, __LINE__); x;}
+#define GL_CHECK(x) {x; ::Hpl1::checkOGLErrors(__func__, __LINE__);}
#define GL_CHECK_FN() GL_CHECK()
#endif
\ No newline at end of file
Commit: 02112a69fb4d7d2b77a946ae4c8808501451503e
https://github.com/scummvm/scummvm/commit/02112a69fb4d7d2b77a946ae4c8808501451503e
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:33+01:00
Commit Message:
HPL1: expand the api of bitmap2D
Changed paths:
engines/hpl1/engine/graphics/bitmap2D.cpp
engines/hpl1/engine/graphics/bitmap2D.h
engines/hpl1/engine/resources/low_level_resources.cpp
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
index a5fcdf7c386..b7cbe1896f3 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.cpp
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -46,7 +46,23 @@ static Loader *loadImage(const tString &filepath) {
return imgLoader;
}
-Bitmap2D::Bitmap2D(const tString &filepath, const tString &type)
+template<>
+static Image::JPEGDecoder *loadImage(const tString &filepath) {
+ // FIXME: string types
+ Common::File imgFile;
+ if (!imgFile.open(filepath.c_str())) {
+ error("Could not open file: %s", filepath.c_str());
+ return nullptr;
+ }
+ Image::JPEGDecoder *imgLoader = new Image::JPEGDecoder();
+ imgLoader->setOutputPixelFormat(g_system->getScreenFormat());
+ if (!imgLoader->loadStream(imgFile)) {
+ error("Could not load image at %s", filepath.c_str());
+ }
+ return imgLoader;
+}
+
+Bitmap2D::Bitmap2D(const tString &filepath, const tString &type, const Graphics::PixelFormat &desiredFormat)
: LowLevelPicture(type), _isSurfaceActive(false) {
if (type == "png")
_decoder.reset(loadImage<Image::PNGDecoder>(filepath));
@@ -62,6 +78,8 @@ Bitmap2D::Bitmap2D(const tString &filepath, const tString &type)
error("trying to load unsupported image format %s", type.c_str());
_width = _decoder->getSurface()->w;
_height = _decoder->getSurface()->h;
+ if (desiredFormat.bytesPerPixel != 0 && desiredFormat != _decoder->getSurface()->format)
+ copyDecoder(desiredFormat);
}
Bitmap2D::Bitmap2D(const cVector2l &size, const Graphics::PixelFormat &format)
@@ -71,8 +89,10 @@ Bitmap2D::Bitmap2D(const cVector2l &size, const Graphics::PixelFormat &format)
void Bitmap2D::drawToBitmap(Bitmap2D &dest, const cVector2l &at, Common::Rect srcSubrect) {
- if(!dest._isSurfaceActive)
+ if (!dest._isSurfaceActive)
dest.copyDecoder();
+ if (dest._surface.w == 0 || dest._surface.h == 0 || activeSurface().w == 0 || activeSurface().h == 0)
+ return; // font loading can use bitmaps with 0 width
if(srcSubrect.right == 0 && srcSubrect.bottom == 0)
srcSubrect = Common::Rect(activeSurface().w, activeSurface().h);
@@ -135,8 +155,10 @@ uint32 Bitmap2D::getBpp() const {
return format().bpp();
}
-void Bitmap2D::copyDecoder() {
+void Bitmap2D::copyDecoder(const Graphics::PixelFormat &format) {
_surface.copyFrom(*( _decoder->getSurface()));
+ if (format.bytesPerPixel != 0)
+ _surface.convertToInPlace(format);
_isSurfaceActive = true;
_decoder.release();
}
diff --git a/engines/hpl1/engine/graphics/bitmap2D.h b/engines/hpl1/engine/graphics/bitmap2D.h
index 4cc763705c5..80bc252ddd2 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.h
+++ b/engines/hpl1/engine/graphics/bitmap2D.h
@@ -42,7 +42,7 @@ namespace hpl {
class Bitmap2D : public LowLevelPicture {
public:
Bitmap2D(const cVector2l &size, const Graphics::PixelFormat &format);
- Bitmap2D(const tString &filename, const tString &type);
+ Bitmap2D(const tString &filename, const tString &type, const Graphics::PixelFormat &desiredFormat = {});
~Bitmap2D();
@@ -63,7 +63,7 @@ public:
uint32 getBpp() const override;
private:
- void copyDecoder();
+ void copyDecoder(const Graphics::PixelFormat &format = {});
const Graphics::Surface &activeSurface() const;
Graphics::Surface _surface;
diff --git a/engines/hpl1/engine/resources/low_level_resources.cpp b/engines/hpl1/engine/resources/low_level_resources.cpp
index 0479aa1b8aa..37b654a0e3b 100644
--- a/engines/hpl1/engine/resources/low_level_resources.cpp
+++ b/engines/hpl1/engine/resources/low_level_resources.cpp
@@ -40,7 +40,7 @@ static tString getImageType(const tString &filepath) {
}
Bitmap2D *LowLevelResources::loadBitmap2D(const tString &filepath) {
- return new Bitmap2D(filepath, getImageType(filepath));
+ return new Bitmap2D(filepath, getImageType(filepath), *_lowLevelGraphics->GetPixelFormat());
}
void LowLevelResources::getSupportedImageFormats(tStringList &formats) {
Commit: a8eed15267faa02a84c0615ef94482b35df6974f
https://github.com/scummvm/scummvm/commit/a8eed15267faa02a84c0615ef94482b35df6974f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:33+01:00
Commit Message:
HPL1: fix font loading
Changed paths:
engines/hpl1/engine/graphics/font_data.cpp
diff --git a/engines/hpl1/engine/graphics/font_data.cpp b/engines/hpl1/engine/graphics/font_data.cpp
index de96b7cb8e6..1491dc04d88 100644
--- a/engines/hpl1/engine/graphics/font_data.cpp
+++ b/engines/hpl1/engine/graphics/font_data.cpp
@@ -108,6 +108,7 @@ bool loadNextBitmap(BitmapArray &bitmaps, const Common::String &file, const Comm
return false;
}
bitmaps.push_back(bitmap);
+ return true;
}
bool loadBitmaps(BitmapArray &bitmaps, const TiXmlElement *pagesRoot, const Common::String &fontDir, LowLevelResources *resources) {
@@ -117,6 +118,7 @@ bool loadBitmaps(BitmapArray &bitmaps, const TiXmlElement *pagesRoot, const Comm
if (!loadNextBitmap(bitmaps, pageIt->Attribute("file"), fontDir, resources))
return false;
}
+ return true;
}
void FontData::loadNextGlyph(const TiXmlElement *charIt, BitmapArray &bitmaps, const cVector2l &fontSize) {
@@ -132,10 +134,10 @@ void FontData::loadNextGlyph(const TiXmlElement *charIt, BitmapArray &bitmaps, c
cVector2l size(w, h);
Bitmap2D &src = *bitmaps[page];
- Bitmap2D charBmp(size, src.format());
- src.drawToBitmap(charBmp, {0,0}, Common::Rect(x, y, x + w, y + h));
+ Common::ScopedPtr<Bitmap2D> charBmp(_lowLevelGraphics->CreateBitmap2D(size));
+ src.drawToBitmap(*charBmp, {0,0}, Common::Rect(x, y, x + w, y + h));
- _glyphs[id] = createGlyph(&charBmp, {xOffset, yOffset}, {w, h}, fontSize, advance);
+ _glyphs[id] = createGlyph(charBmp.get(), {xOffset, yOffset}, {w, h}, fontSize, advance);
}
void FontData::loadGlyphs(const TiXmlElement *charsRoot, BitmapArray &bitmaps, const cVector2l &fontSize) {
Commit: 737f61d4b3216de88a889efeba448b17f7b0cda1
https://github.com/scummvm/scummvm/commit/737f61d4b3216de88a889efeba448b17f7b0cda1
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:33+01:00
Commit Message:
HPL1: get the game to display loading screen
Changed paths:
engines/hpl1/engine/game/Game.cpp
engines/hpl1/engine/game/low_level_game_setup.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
engines/hpl1/engine/impl/SqScript.cpp
engines/hpl1/engine/input/ActionKeyboard.cpp
engines/hpl1/engine/input/ActionMouseButton.cpp
engines/hpl1/engine/input/Input.cpp
engines/hpl1/engine/resources/FrameBitmap.cpp
engines/hpl1/engine/resources/SoundManager.cpp
engines/hpl1/engine/system/low_level_system.cpp
engines/hpl1/penumbra-overture/ButtonHandler.cpp
engines/hpl1/penumbra-overture/Init.cpp
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index 2ed2256bbd8..3dfe423db8e 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -346,7 +346,7 @@ void cGame::Run() {
// reset the mouse, really reset the damn thing :P
for (int i = 0; i < 10; i++)
- mpInput->GetMouse()->Reset();
+ //mpInput->GetMouse()->Reset();
Log("Game Running\n");
Log("--------------------------------------------------------\n");
diff --git a/engines/hpl1/engine/game/low_level_game_setup.cpp b/engines/hpl1/engine/game/low_level_game_setup.cpp
index fba412f759a..ec1c354d506 100644
--- a/engines/hpl1/engine/game/low_level_game_setup.cpp
+++ b/engines/hpl1/engine/game/low_level_game_setup.cpp
@@ -34,9 +34,9 @@ namespace hpl {
LowLevelGameSetup::LowLevelGameSetup() {
_lowLevelSystem = hplNew( LowLevelSystem, () );
_lowLevelGraphics = hplNew( cLowLevelGraphicsSDL,() );
- //_lowLevelInput = hplNew( cLowLevelInputSDL,(_lowLevelGraphics) );
+ _lowLevelInput = hplNew( cLowLevelInputSDL,(_lowLevelGraphics) );
_lowLevelResources = hplNew( LowLevelResources,(_lowLevelGraphics) );
- //_lowLevelSound = hplNew( cLowLevelSoundOpenAL,() );
+ _lowLevelSound = hplNew( cLowLevelSoundOpenAL,() );
//_lowLevelPhysics = hplNew( cLowLevelPhysicsNewton,() );
_lowLevelHaptic = nullptr;
}
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 3bfc9b2cc93..bb460b3508c 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -242,14 +242,14 @@ int cLowLevelGraphicsSDL::GetCaps(eGraphicCaps type) const {
//GL Vertex program
case eGraphicCaps_GL_VertexProgram:
- return 1; //gl 2.0
+ return 0; //gl 2.0
//GL Fragment program
case eGraphicCaps_GL_FragmentProgram:
- return 1; //gl 2.0
+ return 0; //gl 2.0
case eGraphicCaps_GL_ATIFragmentShader:
- return 1;
+ return 0;
//GL ATI Fragment Shader
case eGraphicCaps_GL_BlendFunctionSeparate:
@@ -346,8 +346,7 @@ FontData *cLowLevelGraphicsSDL::CreateFontData(const tString &asName) {
//-----------------------------------------------------------------------
iGpuProgram *cLowLevelGraphicsSDL::CreateGpuProgram(const tString &asName, eGpuProgramType aType) {
- //return hplNew(cCGProgram, (asName, mCG_Context, aType));
- return nullptr;
+ return hplNew(cCGProgram, (asName, 0, aType));
}
//-----------------------------------------------------------------------
@@ -859,7 +858,7 @@ void cLowLevelGraphicsSDL::SetStencilTwoSide(eStencilFunc aFrontFunc, eStencilFu
void cLowLevelGraphicsSDL::SetStencilTwoSide(bool abX) {
if (GetCaps(eGraphicCaps_TwoSideStencil))
- Hpl1::logError(Hpl1::kDebugOpenGL, "call to setStencilTwoSide with two side stencil enabled");
+ Hpl1::logError(Hpl1::kDebugOpenGL, "call to setStencilTwoSide with two side stencil enabled");
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
index 9a1f4ffd587..1e125bbd7b1 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
@@ -73,6 +73,7 @@ cLowLevelSoundOpenAL::~cLowLevelSoundOpenAL() {
iSoundData *cLowLevelSoundOpenAL::LoadSoundData(const tString &asName, const tString &asFilePath,
const tString &asType, bool abStream, bool abLoopStream) {
+#if 0
cOpenALSoundData *pSoundData = hplNew(cOpenALSoundData, (asName, abStream));
pSoundData->SetLoopStream(abLoopStream);
@@ -83,6 +84,8 @@ iSoundData *cLowLevelSoundOpenAL::LoadSoundData(const tString &asName, const tSt
}
return pSoundData;
+#endif
+ return nullptr;
}
//-----------------------------------------------------------------------
@@ -107,6 +110,7 @@ void cLowLevelSoundOpenAL::UpdateSound(float afTimeStep) {
void cLowLevelSoundOpenAL::SetListenerAttributes(const cVector3f &avPos, const cVector3f &avVel,
const cVector3f &avForward, const cVector3f &avUp) {
+#if 0
mvListenerPosition = avPos;
mvListenerVelocity = avVel;
mvListenerForward = avForward;
@@ -128,7 +132,6 @@ void cLowLevelSoundOpenAL::SetListenerAttributes(const cVector3f &avPos, const c
m_mtxListener.SetTranslation(mvListenerPosition);
float fVel[3] = {0, 0, 0};
-#if 0
OAL_Listener_SetAttributes ( avPos.v, avVel.v, (avForward*(-1)).v, avUp.v );
#endif
}
@@ -343,7 +346,8 @@ void cLowLevelSoundOpenAL::SetEnvVolume(float afEnvVolume) {
//-----------------------------------------------------------------------
iSoundEnvironment *cLowLevelSoundOpenAL::LoadSoundEnvironment(const tString &asFilePath) {
- if (!mbEnvAudioEnabled)
+#if 0
+ if (!mbEnvAudioEnabled)
return NULL;
/////////////////////////////////////////////
@@ -368,6 +372,8 @@ iSoundEnvironment *cLowLevelSoundOpenAL::LoadSoundEnvironment(const tString &asF
// Log(" Created %d '%s'\n",pSoundEnv, pSoundEnv->GetName().c_str());
return pSoundEnv;
+#endif
+ return nullptr;
}
//-----------------------------------------------------------------------
@@ -468,7 +474,8 @@ void cLowLevelSoundOpenAL::SetSoundEnvironment(iSoundEnvironment *apSoundEnv) {
//-----------------------------------------------------------------------
void cLowLevelSoundOpenAL::FadeSoundEnvironment(iSoundEnvironment *apSourceSoundEnv, iSoundEnvironment *apDestSoundEnv, float afT) {
- if (!mbEnvAudioEnabled)
+#if 0
+ if (!mbEnvAudioEnabled)
return;
if (afT < 0)
@@ -562,6 +569,8 @@ void cLowLevelSoundOpenAL::FadeSoundEnvironment(iSoundEnvironment *apSourceSound
}
SetSoundEnvironment(&pEnv);
+#endif
+
}
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/SqScript.cpp b/engines/hpl1/engine/impl/SqScript.cpp
index 17d4f2a3168..070bae12e98 100644
--- a/engines/hpl1/engine/impl/SqScript.cpp
+++ b/engines/hpl1/engine/impl/SqScript.cpp
@@ -47,7 +47,7 @@ cSqScript::cSqScript(const tString &asName, asIScriptEngine *apScriptEngine,
mpScriptOutput = apScriptOutput;
mlHandle = alHandle;
- mpContext = mpScriptEngine->CreateContext();
+ //mpContext = mpScriptEngine->CreateContext();
// Create a unique module name
msModuleName = "Module_" + cString::ToString(cMath::RandRectl(0, 1000000)) +
diff --git a/engines/hpl1/engine/input/ActionKeyboard.cpp b/engines/hpl1/engine/input/ActionKeyboard.cpp
index b2fb891ceb5..8fad5a68319 100644
--- a/engines/hpl1/engine/input/ActionKeyboard.cpp
+++ b/engines/hpl1/engine/input/ActionKeyboard.cpp
@@ -53,8 +53,11 @@ cActionKeyboard::cActionKeyboard(tString asName, cInput *apInput, int aKey) : iA
//-----------------------------------------------------------------------
bool cActionKeyboard::IsTriggerd() {
- return mpInput->GetKeyboard()->KeyIsDown(mKey) &&
+#if 0
+ return mpInput->GetKeyboard()->KeyIsDown(mKey) &&
((mpInput->GetKeyboard()->GetModifier() & mMod) > 0 || mMod == eKeyModifier_NONE);
+#endif
+ return false;
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/input/ActionMouseButton.cpp b/engines/hpl1/engine/input/ActionMouseButton.cpp
index 9386514acf0..d118d4894ae 100644
--- a/engines/hpl1/engine/input/ActionMouseButton.cpp
+++ b/engines/hpl1/engine/input/ActionMouseButton.cpp
@@ -50,7 +50,11 @@ cActionMouseButton::cActionMouseButton(tString asName, cInput *apInput, eMButton
//-----------------------------------------------------------------------
bool cActionMouseButton::IsTriggerd() {
- return mpInput->GetMouse()->ButtonIsDown(mButton);
+#if 0
+ return mpInput->GetMouse()->ButtonIsDown(mButton);
+#endif
+ return false;
+
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/input/Input.cpp b/engines/hpl1/engine/input/Input.cpp
index d5b5a8065b1..c6e295d2038 100644
--- a/engines/hpl1/engine/input/Input.cpp
+++ b/engines/hpl1/engine/input/Input.cpp
@@ -76,6 +76,7 @@ cInput::~cInput() {
//-----------------------------------------------------------------------
void cInput::Update(float afTimeStep) {
+#if 0
mpLowLevelInput->BeginInputUpdate();
for (tInputDeviceListIt it = mlstInputDevices.begin(); it != mlstInputDevices.end(); ++it) {
@@ -87,6 +88,7 @@ void cInput::Update(float afTimeStep) {
for (tActionMapIt it = m_mapActions.begin(); it != m_mapActions.end(); ++it) {
it->second->Update(afTimeStep);
}
+#endif
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/resources/FrameBitmap.cpp b/engines/hpl1/engine/resources/FrameBitmap.cpp
index cd0282024e1..15a8d6037c6 100644
--- a/engines/hpl1/engine/resources/FrameBitmap.cpp
+++ b/engines/hpl1/engine/resources/FrameBitmap.cpp
@@ -74,16 +74,15 @@ namespace hpl {
cResourceImage *cFrameBitmap::AddBitmap(Bitmap2D *apSrc)
{
-#if 0
cResourceImage *pImage=NULL;
//source size
//+2 because we are gonna have a border to get rid if some antialiasing problems
- int lSW = apSrc->GetWidth()+2;
- int lSH = apSrc->GetHeight()+2;
+ int lSW = apSrc->getWidth()+2;
+ int lSH = apSrc->getHeight()+2;
//destination size
- int lDW = mpBitmap->GetWidth();
- int lDH = mpBitmap->GetHeight();
+ int lDW = mpBitmap->getWidth();
+ int lDH = mpBitmap->getHeight();
cVector2l vPos;
@@ -160,15 +159,15 @@ namespace hpl {
//Draw 4 times so we get a nice extra border
for(int i=0;i<2;i++)for(int j=0;j<2;j++){
- apSrc->drawToBitmap(mpBitmap,cVector2l(NewRect.x+i*2,NewRect.y+j*2));
+ apSrc->drawToBitmap(*mpBitmap,cVector2l(NewRect.x+i*2,NewRect.y+j*2));
}
//Fix the border a little more:
for(int i=-1;i<2;i++)for(int j=-1;j<2;j++)
if((i==0 || j==0) && (i!=j)){
- apSrc->drawToBitmap(mpBitmap,cVector2l(NewRect.x+1+i,NewRect.y+1+j));
+ apSrc->drawToBitmap(*mpBitmap,cVector2l(NewRect.x+1+i,NewRect.y+1+j));
}
//Draw the final
- apSrc->drawToBitmap(mpBitmap,cVector2l(NewRect.x+1,NewRect.y+1));
+ apSrc->drawToBitmap(*mpBitmap,cVector2l(NewRect.x+1,NewRect.y+1));
mlPicCount++;
@@ -182,9 +181,9 @@ namespace hpl {
if(bFoundNode)
{
//Create the image resource
- pImage = hplNew( cResourceImage, (apSrc->GetFileName(),mpFrameTexture, this,
+ pImage = hplNew( cResourceImage, (apSrc->getFileName(),mpFrameTexture, this,
cRect2l(vPos,cVector2l(lSW-2,lSH-2)),//-2 to get the correct size.
- cVector2l(mpBitmap->GetWidth(),mpBitmap->GetHeight()),
+ cVector2l(mpBitmap->getWidth(),mpBitmap->getHeight()),
mlHandle) );
if(!bFoundEmptyNode)
@@ -230,8 +229,6 @@ namespace hpl {
return pImage;
-#endif
- return nullptr;
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/resources/SoundManager.cpp b/engines/hpl1/engine/resources/SoundManager.cpp
index 21d43ce7edc..d654122aafd 100644
--- a/engines/hpl1/engine/resources/SoundManager.cpp
+++ b/engines/hpl1/engine/resources/SoundManager.cpp
@@ -47,7 +47,7 @@ cSoundManager::cSoundManager(cSound *apSound, cResources *apResources)
mpSound = apSound;
mpResources = apResources;
- mpSound->GetLowLevel()->GetSupportedFormats(mlstFileFormats);
+ //mpSound->GetLowLevel()->GetSupportedFormats(mlstFileFormats);
}
cSoundManager::~cSoundManager() {
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index adc08d120f6..5c85f89bfdd 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -38,8 +38,8 @@ LowLevelSystem::LowLevelSystem() {
#if 0
mpScriptEngine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
#endif
- _scriptOutput = hplNew(cScriptOutput, ());
- _scriptEngine->SetMessageCallback(asMETHOD(cScriptOutput, AddMessage), _scriptOutput, asCALL_THISCALL);
+ //_scriptOutput = hplNew(cScriptOutput, ());
+ //_scriptEngine->SetMessageCallback(asMETHOD(cScriptOutput, AddMessage), _scriptOutput, asCALL_THISCALL);
#if 0
#ifdef AS_MAX_PORTABILITY
RegisterScriptString(mpScriptEngine);
@@ -386,13 +386,16 @@ iScript *LowLevelSystem::createScript(const tString &name) {
}
bool LowLevelSystem::addScriptFunc(const tString &funcDecl, void *pFunc, int callConv) {
- if (_scriptEngine->RegisterGlobalFunction(funcDecl.c_str(),
+#if 0
+ if (_scriptEngine->RegisterGlobalFunction(funcDecl.c_str(),
asFUNCTION(pFunc), callConv) < 0) {
Error("Couldn't add func '%s'\n", funcDecl.c_str());
return false;
}
return true;
+#endif
+ return false;
}
bool LowLevelSystem::addScriptVar(const tString &varDecl, void *pVar) {
diff --git a/engines/hpl1/penumbra-overture/ButtonHandler.cpp b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
index 5da84cf9f74..7d8e8aff7c2 100644
--- a/engines/hpl1/penumbra-overture/ButtonHandler.cpp
+++ b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
@@ -306,7 +306,7 @@ void cButtonHandler::Update(float afTimeStep) {
mpInit->mpMainMenu->AddMousePos(vRel * mfMouseSensitivity);
} else {
/// Mouse Movement
- cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
mpInit->mpMainMenu->AddMousePos(vRel * mfMouseSensitivity);
}
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 55d155fa356..35523c6bb30 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -112,7 +112,7 @@ void CheckTimeLimit() {
bool CheckSupport(cInit *apInit) {
iLowLevelGraphics *pLowLevelGraphics = apInit->mpGame->GetGraphics()->GetLowLevel();
cInit *mpInit = apInit;
-
+ return true;
// Vertex shader support.
if (pLowLevelGraphics->GetCaps(eGraphicCaps_GL_VertexProgram) == 0) {
apInit->msErrorMessage = kTranslate("StartUp", "Error_NoVertexShader") + _W("\n") +
Commit: e7bfaff2f54ea0046e31c121533e6aff062fd429
https://github.com/scummvm/scummvm/commit/e7bfaff2f54ea0046e31c121533e6aff062fd429
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:03:34+01:00
Commit Message:
HPL1: Set fixed pixel format as RGBA
Changed paths:
engines/hpl1/engine/graphics/bitmap2D.cpp
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
index b7cbe1896f3..8a080040c03 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.cpp
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -54,8 +54,13 @@ static Image::JPEGDecoder *loadImage(const tString &filepath) {
error("Could not open file: %s", filepath.c_str());
return nullptr;
}
+#ifdef SCUMM_BIG_ENDIAN
+ Graphics::PixelFormat pixFmt(4, 8, 8, 8, 8, 24, 16, 8, 0);
+#else
+ Graphics::PixelFormat pixFmt(4, 8, 8, 8, 8, 0, 8, 16, 24);
+#endif
Image::JPEGDecoder *imgLoader = new Image::JPEGDecoder();
- imgLoader->setOutputPixelFormat(g_system->getScreenFormat());
+ imgLoader->setOutputPixelFormat(pixFmt);
if (!imgLoader->loadStream(imgFile)) {
error("Could not load image at %s", filepath.c_str());
}
Commit: 90e62871c2e48dae123e0477ffa2a3ec1389e732
https://github.com/scummvm/scummvm/commit/90e62871c2e48dae123e0477ffa2a3ec1389e732
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:03:34+01:00
Commit Message:
IMAGES: W/A to allow pass JPEG with 4 components as RGBA.
Changed paths:
image/jpeg.cpp
diff --git a/image/jpeg.cpp b/image/jpeg.cpp
index 957e72b2fcd..0cd4df41db4 100644
--- a/image/jpeg.cpp
+++ b/image/jpeg.cpp
@@ -271,6 +271,9 @@ bool JPEGDecoder::loadStream(Common::SeekableReadStream &stream) {
break;
}
+ if (cinfo.num_components == 4)
+ cinfo.out_color_space = JCS_CMYK;
+
// Actually start decompressing the image
jpeg_start_decompress(&cinfo);
Commit: c64157c686a31b71c3eb843faf3b01212e2ebcff
https://github.com/scummvm/scummvm/commit/c64157c686a31b71c3eb843faf3b01212e2ebcff
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:34+01:00
Commit Message:
HPL1: cleanup bitmap2D class
Changed paths:
engines/hpl1/engine/graphics/bitmap2D.cpp
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
index 8a080040c03..aa7fd40712a 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.cpp
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -31,54 +31,37 @@
namespace hpl {
-template<typename Loader>
-static Loader *loadImage(const tString &filepath) {
+static Image::ImageDecoder *loadImage(const tString &filepath, Image::ImageDecoder *decoder) {
//FIXME: string types
Common::File imgFile;
- if (!imgFile.open(filepath.c_str())) {
+ if (!imgFile.open(filepath.c_str()))
error("Could not open file: %s", filepath.c_str());
- return nullptr;
- }
- Loader *imgLoader = new Loader();
- if (!imgLoader->loadStream(imgFile)) {
+ if (!decoder->loadStream(imgFile))
error("Could not load image at %s", filepath.c_str());
- }
- return imgLoader;
+ return decoder;
}
-template<>
-static Image::JPEGDecoder *loadImage(const tString &filepath) {
- // FIXME: string types
- Common::File imgFile;
- if (!imgFile.open(filepath.c_str())) {
- error("Could not open file: %s", filepath.c_str());
- return nullptr;
- }
+Image::JPEGDecoder *setupJPEGDecoder(Image::JPEGDecoder *jpeg) {
#ifdef SCUMM_BIG_ENDIAN
- Graphics::PixelFormat pixFmt(4, 8, 8, 8, 8, 24, 16, 8, 0);
+ jpeg->setOutputPixelFormat(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
#else
- Graphics::PixelFormat pixFmt(4, 8, 8, 8, 8, 0, 8, 16, 24);
+ jpeg->setOutputPixelFormat(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24));
#endif
- Image::JPEGDecoder *imgLoader = new Image::JPEGDecoder();
- imgLoader->setOutputPixelFormat(pixFmt);
- if (!imgLoader->loadStream(imgFile)) {
- error("Could not load image at %s", filepath.c_str());
- }
- return imgLoader;
+ return jpeg;
}
Bitmap2D::Bitmap2D(const tString &filepath, const tString &type, const Graphics::PixelFormat &desiredFormat)
: LowLevelPicture(type), _isSurfaceActive(false) {
if (type == "png")
- _decoder.reset(loadImage<Image::PNGDecoder>(filepath));
+ _decoder.reset(loadImage(filepath, new Image::PNGDecoder));
else if (type == "bmp")
- _decoder.reset(loadImage<Image::BitmapDecoder>(filepath));
+ _decoder.reset(loadImage(filepath, new Image::BitmapDecoder));
else if (type == "tga")
- _decoder.reset(loadImage<Image::TGADecoder>(filepath));
+ _decoder.reset(loadImage(filepath, new Image::TGADecoder));
else if (type == "jpg" || type == "jpeg")
- _decoder.reset(loadImage<Image::JPEGDecoder>(filepath));
+ _decoder.reset(loadImage(filepath, setupJPEGDecoder(new Image::JPEGDecoder)));
else if (type == "gif")
- _decoder.reset(loadImage<Image::GIFDecoder>(filepath));
+ _decoder.reset(loadImage(filepath, new Image::GIFDecoder));
else
error("trying to load unsupported image format %s", type.c_str());
_width = _decoder->getSurface()->w;
Commit: 9b6c47de963e49cc8560db21ca8187b6f6dfde55
https://github.com/scummvm/scummvm/commit/9b6c47de963e49cc8560db21ca8187b6f6dfde55
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:34+01:00
Commit Message:
HPL1: fix pixel format set in LowLevelGraphicsSDL
Changed paths:
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index bb460b3508c..86a3e044f10 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -80,34 +80,38 @@ GLenum TextureTargetToGL(eTextureTarget target) {
}
cLowLevelGraphicsSDL::cLowLevelGraphicsSDL() {
- mlBatchArraySize = 20000;
- mlVertexCount = 0;
- mlIndexCount =0;
- mlMultisampling =0;
- mvVirtualSize.x = 800;
- mvVirtualSize.y = 600;
- mfGammaCorrection = 1.0;
- mpRenderTarget = nullptr;
- mpPixelFormat = Graphics::createPixelFormat<8888>();
-
- Common::fill(mpCurrentTexture, mpCurrentTexture + MAX_TEXTUREUNITS, nullptr);
-
- mbClearColor = true;
- mbClearDepth = true;
- mbClearStencil = false;
-
- //Create the batch arrays:
- mlBatchStride = 13;
- //3 Pos floats, 4 color floats, 3 Tex coord floats .
- mpVertexArray = (float*)hplMalloc(sizeof(float) * mlBatchStride * mlBatchArraySize);
- mpIndexArray = (unsigned int*)hplMalloc(sizeof(unsigned int) * mlBatchArraySize); //Index is one int.
-
- for(int i=0;i<MAX_TEXTUREUNITS;i++)
- {
- mpTexCoordArray[i] = (float*)hplMalloc(sizeof(float) * 3 * mlBatchArraySize);
- mbTexCoordArrayActive[i] = false;
- mlTexCoordArrayCount[i]=0;
- }
+ mlBatchArraySize = 20000;
+ mlVertexCount = 0;
+ mlIndexCount =0;
+ mlMultisampling =0;
+ mvVirtualSize.x = 800;
+ mvVirtualSize.y = 600;
+ mfGammaCorrection = 1.0;
+ mpRenderTarget = nullptr;
+#ifdef SCUMM_BIG_ENDIAN
+ mpPixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+#else
+ mpPixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
+#endif
+
+ Common::fill(mpCurrentTexture, mpCurrentTexture + MAX_TEXTUREUNITS, nullptr);
+
+ mbClearColor = true;
+ mbClearDepth = true;
+ mbClearStencil = false;
+
+ //Create the batch arrays:
+ mlBatchStride = 13;
+ //3 Pos floats, 4 color floats, 3 Tex coord floats .
+ mpVertexArray = (float*)hplMalloc(sizeof(float) * mlBatchStride * mlBatchArraySize);
+ mpIndexArray = (unsigned int*)hplMalloc(sizeof(unsigned int) * mlBatchArraySize); //Index is one int.
+
+ for(int i=0;i<MAX_TEXTUREUNITS;i++)
+ {
+ mpTexCoordArray[i] = (float*)hplMalloc(sizeof(float) * 3 * mlBatchArraySize);
+ mbTexCoordArrayActive[i] = false;
+ mlTexCoordArrayCount[i]=0;
+ }
}
cLowLevelGraphicsSDL::~cLowLevelGraphicsSDL() {
Commit: 6c4c5c0cab08e6ce215499c0930bf1c3ce8fcf51
https://github.com/scummvm/scummvm/commit/6c4c5c0cab08e6ce215499c0930bf1c3ce8fcf51
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:34+01:00
Commit Message:
HPL1: Fix more warnings and some formatting fixes
Changed paths:
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/graphics/Texture.h
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/input/ActionKeyboard.cpp
engines/hpl1/engine/input/ActionMouseButton.cpp
engines/hpl1/engine/scene/MeshEntity.cpp
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index 54b91a03998..bdaa56f57b5 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -1149,6 +1149,8 @@ static void SetJointProperty(std::string asJointName, std::string asProp, float
pSliderJoint->SetMinDistance(afVal);
break;
}
+ default:
+ break;
}
}
/////////////////////////////
@@ -1170,6 +1172,8 @@ static void SetJointProperty(std::string asJointName, std::string asProp, float
pSliderJoint->SetMaxDistance(afVal);
break;
}
+ default:
+ break;
}
} else {
diff --git a/engines/hpl1/engine/graphics/Texture.h b/engines/hpl1/engine/graphics/Texture.h
index 5c9b43f049b..c7fb0efaaa7 100644
--- a/engines/hpl1/engine/graphics/Texture.h
+++ b/engines/hpl1/engine/graphics/Texture.h
@@ -103,9 +103,9 @@ public:
void SetSizeLevel(unsigned int alLevel) { mlSizeLevel = alLevel; }
void SetMinLevelSize(const cVector2l &avSize) { mvMinLevelSize = avSize; }
- bool reload() { return false; }
- void unload() {}
- void destroy() {}
+ bool reload() override { return false; }
+ void unload() override {}
+ void destroy() override {}
/**
* Create a texture from a bitmap, work only for 1D, 2D and Rect targets. Doesn't work with render targets.
@@ -147,7 +147,7 @@ public:
virtual void SetGamma(float afGamma) = 0;
virtual int GetHandle() = 0;
- virtual bool hasAlpha() { return false; }
+ virtual bool hasAlpha() override { return false; }
uint32 getBpp() const override { return _bpp; }
virtual void SetWrapS(eTextureWrap aMode) = 0;
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 86a3e044f10..f63d2dbe7bb 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -59,6 +59,8 @@ GLenum ColorFormatToGL(eColorDataFormat format) {
return GL_BGR;
case eColorDataFormat_BGRA:
return GL_BGRA;
+ default:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid color format (%d)", format);
}
@@ -75,6 +77,8 @@ GLenum TextureTargetToGL(eTextureTarget target) {
return GL_TEXTURE_CUBE_MAP;
case eTextureTarget_3D:
return GL_TEXTURE_3D;
+ default:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture target (%d)", target);
}
@@ -106,8 +110,7 @@ cLowLevelGraphicsSDL::cLowLevelGraphicsSDL() {
mpVertexArray = (float*)hplMalloc(sizeof(float) * mlBatchStride * mlBatchArraySize);
mpIndexArray = (unsigned int*)hplMalloc(sizeof(unsigned int) * mlBatchArraySize); //Index is one int.
- for(int i=0;i<MAX_TEXTUREUNITS;i++)
- {
+ for (int i = 0; i < MAX_TEXTUREUNITS; i++) {
mpTexCoordArray[i] = (float*)hplMalloc(sizeof(float) * 3 * mlBatchArraySize);
mbTexCoordArrayActive[i] = false;
mlTexCoordArrayCount[i]=0;
@@ -119,7 +122,7 @@ cLowLevelGraphicsSDL::~cLowLevelGraphicsSDL() {
hplFree(mpVertexArray);
hplFree(mpIndexArray);
- for(int i=0;i<MAX_TEXTUREUNITS;i++)
+ for (int i = 0; i < MAX_TEXTUREUNITS; i++)
hplFree(mpTexCoordArray[i]);
}
@@ -261,6 +264,9 @@ int cLowLevelGraphicsSDL::GetCaps(eGraphicCaps type) const {
case eGraphicCaps_GL_MultiTexture:
return GLAD_GL_ARB_multitexture; //gl 1.4
+
+ default:
+ break;
}
Hpl1::logWarning(Hpl1::kDebugGraphics, "graphic options %d is not supported", type);
return 0;
@@ -282,10 +288,10 @@ void cLowLevelGraphicsSDL::SetVsyncActive(bool toggle) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetMultisamplingActive(bool toggle) {
- if(!GetCaps(eGraphicCaps_Multisampling) || mlMultisampling<=0)
+ if (!GetCaps(eGraphicCaps_Multisampling) || mlMultisampling<=0)
return;
- if(toggle)
+ if (toggle)
glEnable(GL_MULTISAMPLE);
else
glDisable(GL_MULTISAMPLE);
@@ -321,7 +327,7 @@ cPlanef cLowLevelGraphicsSDL::GetClipPlane(int alIdx, const cPlanef &aPlane) {
}
void cLowLevelGraphicsSDL::SetClipPlaneActive(int alIdx, bool toggle) {
- if(toggle)
+ if (toggle)
glEnable(GL_CLIP_PLANE0 + alIdx);
else
glDisable(GL_CLIP_PLANE0 + alIdx);
@@ -475,10 +481,10 @@ void cLowLevelGraphicsSDL::SetTexture(unsigned int alUnit, iTexture *apTex) {
if(apTex == mpCurrentTexture[alUnit]) return;
GLenum NewTarget=0;
- if(apTex)
+ if (apTex)
NewTarget = GetGLTextureTargetEnum(apTex->GetTarget());
GLenum LastTarget=0;
- if(mpCurrentTexture[alUnit])
+ if (mpCurrentTexture[alUnit])
LastTarget = GetGLTextureTargetEnum(mpCurrentTexture[alUnit]->GetTarget());
//Check if multi texturing is supported.
@@ -487,9 +493,8 @@ void cLowLevelGraphicsSDL::SetTexture(unsigned int alUnit, iTexture *apTex) {
}
//If the current texture in this unit is a render target, unbind it.
- if(mpCurrentTexture[alUnit]){
- if(mpCurrentTexture[alUnit]->GetTextureType() == eTextureType_RenderTarget)
- {
+ if (mpCurrentTexture[alUnit]){
+ if(mpCurrentTexture[alUnit]->GetTextureType() == eTextureType_RenderTarget) {
error("render target not supported");
#if 0
cSDLTexture *pSDLTex = static_cast<cSDLTexture *> (mpCurrentTexture[alUnit]);
@@ -502,15 +507,12 @@ void cLowLevelGraphicsSDL::SetTexture(unsigned int alUnit, iTexture *apTex) {
}
//Disable this unit if NULL
- if(apTex == NULL)
- {
+ if (apTex == NULL) {
glDisable(LastTarget);
//glBindTexture(LastTarget,0);
- }
//Enable the unit, set the texture handle and bind the pbuffer
- else
- {
- if(NewTarget != LastTarget) glDisable(LastTarget);
+ } else {
+ if (NewTarget != LastTarget) glDisable(LastTarget);
cSDLTexture *pSDLTex = static_cast<cSDLTexture*> (apTex);
@@ -518,8 +520,7 @@ void cLowLevelGraphicsSDL::SetTexture(unsigned int alUnit, iTexture *apTex) {
glEnable(NewTarget);
//if it is a render target we need to do some more binding.
- if(pSDLTex->GetTextureType() == eTextureType_RenderTarget)
- {
+ if (pSDLTex->GetTextureType() == eTextureType_RenderTarget) {
error("render target not supported");
#if 0
cPBuffer* pBuffer = pSDLTex->GetPBuffer();
@@ -1539,6 +1540,8 @@ GLenum cLowLevelGraphicsSDL::GetGLBlendEnum(eBlendFunc type) {
return GL_ONE_MINUS_DST_ALPHA;
case eBlendFunc_SrcAlphaSaturate:
return GL_SRC_ALPHA_SATURATE;
+ default:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid blend op (%d)", type);
return 0;
@@ -1580,6 +1583,8 @@ GLenum cLowLevelGraphicsSDL::GetGLTextureParamEnum(eTextureParam type) {
return GL_RGB_SCALE;
case eTextureParam_AlphaScale:
return GL_ALPHA_SCALE;
+ default:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture parameter (%d)", type);
return 0;
@@ -1597,6 +1602,8 @@ GLenum cLowLevelGraphicsSDL::GetGLTextureOpEnum(eTextureOp type) {
return GL_SRC_ALPHA;
case eTextureOp_OneMinusAlpha:
return GL_ONE_MINUS_SRC_ALPHA;
+ default:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture op (%d)", type);
return 0;
@@ -1614,6 +1621,8 @@ GLenum cLowLevelGraphicsSDL::GetGLTextureSourceEnum(eTextureSource type) {
return GL_PRIMARY_COLOR;
case eTextureSource_Previous:
return GL_PREVIOUS;
+ default:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture source (%d)", type);
return 0;
@@ -1632,6 +1641,8 @@ GLenum cLowLevelGraphicsSDL::GetGLTextureTargetEnum(eTextureTarget type) {
return GL_TEXTURE_CUBE_MAP;
case eTextureTarget_3D:
return GL_TEXTURE_3D;
+ default:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture target (%d)", type);
return 0;
@@ -1657,6 +1668,8 @@ GLenum cLowLevelGraphicsSDL::GetGLTextureFuncEnum(eTextureFunc type) {
return GL_DOT3_RGB;
case eTextureFunc_Dot3RGBA:
return GL_DOT3_RGBA;
+ default:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture function (%d)", type);
return 0;
@@ -1681,6 +1694,8 @@ GLenum cLowLevelGraphicsSDL::GetGLDepthTestFuncEnum(eDepthTestFunc type) {
return GL_NOTEQUAL;
case eDepthTestFunc_Always:
return GL_ALWAYS;
+ default:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid depth test function (%d)", type);
return 0;
@@ -1706,6 +1721,8 @@ GLenum cLowLevelGraphicsSDL::GetGLAlphaTestFuncEnum(eAlphaTestFunc type) {
return GL_NOTEQUAL;
case eAlphaTestFunc_Always:
return GL_ALWAYS;
+ default:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL ,"invalid alpha test function (%d)", type);
return 0;
@@ -1731,6 +1748,8 @@ GLenum cLowLevelGraphicsSDL::GetGLStencilFuncEnum(eStencilFunc type) {
return GL_NOTEQUAL;
case eStencilFunc_Always:
return GL_ALWAYS;
+ default:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid stencil function (%d)", type);
return 0;
@@ -1756,6 +1775,8 @@ GLenum cLowLevelGraphicsSDL::GetGLStencilOpEnum(eStencilOp type) {
return GL_INCR_WRAP;
case eStencilOp_DecrementWrap:
return GL_DECR_WRAP;
+ default:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid stencil op (%d)", type);
return 0;
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index 33799f906e2..bd22c6cef51 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -637,6 +637,8 @@ GLenum cSDLTexture::GetGLWrap(eTextureWrap aMode) {
return GL_CLAMP_TO_EDGE;
case eTextureWrap_ClampToBorder:
return GL_CLAMP_TO_BORDER;
+ default:
+ break;
}
return GL_REPEAT;
diff --git a/engines/hpl1/engine/input/ActionKeyboard.cpp b/engines/hpl1/engine/input/ActionKeyboard.cpp
index 8fad5a68319..e6dc45aaa52 100644
--- a/engines/hpl1/engine/input/ActionKeyboard.cpp
+++ b/engines/hpl1/engine/input/ActionKeyboard.cpp
@@ -492,6 +492,8 @@ tString cActionKeyboard::GetInputName() {
case eKey_NONE:
tsKey.append("None");
break;
+ default:
+ break;
}
if (tsKey != "") {
return tsKey;
diff --git a/engines/hpl1/engine/input/ActionMouseButton.cpp b/engines/hpl1/engine/input/ActionMouseButton.cpp
index d118d4894ae..a98746a42d4 100644
--- a/engines/hpl1/engine/input/ActionMouseButton.cpp
+++ b/engines/hpl1/engine/input/ActionMouseButton.cpp
@@ -88,6 +88,8 @@ tString cActionMouseButton::GetInputName() {
return "Mouse8";
case eMButton_9:
return "Mouse9";
+ default:
+ break;
}
return "Unknown";
}
diff --git a/engines/hpl1/engine/scene/MeshEntity.cpp b/engines/hpl1/engine/scene/MeshEntity.cpp
index 427a789926d..4ae12c81aac 100644
--- a/engines/hpl1/engine/scene/MeshEntity.cpp
+++ b/engines/hpl1/engine/scene/MeshEntity.cpp
@@ -1285,6 +1285,8 @@ void cMeshEntity::HandleAnimationEvent(cAnimationEvent *apEvent) {
}
break;
}
+ defzult:
+ break;
}
}
Commit: 078199cd69d2a9ac53ac90c383b9e6f91df6f603
https://github.com/scummvm/scummvm/commit/078199cd69d2a9ac53ac90c383b9e6f91df6f603
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:34+01:00
Commit Message:
HPL1: replace FatalError function with error
Changed paths:
engines/hpl1/engine/graphics/GraphicsDrawer.cpp
engines/hpl1/engine/graphics/ImageEntityData.cpp
engines/hpl1/engine/graphics/Renderer2D.cpp
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
engines/hpl1/engine/scene/ImageEntity.cpp
engines/hpl1/engine/scene/MultiImageEntity.cpp
engines/hpl1/engine/scene/Scene.cpp
engines/hpl1/engine/scene/TileSet.cpp
engines/hpl1/engine/scene/World2D.cpp
engines/hpl1/engine/system/low_level_system.cpp
engines/hpl1/engine/system/low_level_system.h
engines/hpl1/penumbra-overture/IntroStory.cpp
engines/hpl1/penumbra-overture/PlayerHelper.cpp
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.cpp b/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
index 370aea82bd8..ab5ecc998ab 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.cpp
@@ -271,13 +271,13 @@ cGfxObject *cGraphicsDrawer::CreateGfxObject(const tString &asFileName, const tS
bool abAddToList) {
cResourceImage *pImage = mpResources->GetImageManager()->CreateImage(asFileName);
if (pImage == NULL) {
- FatalError("Couldn't load image '%s'!\n", asFileName.c_str());
+ error("Couldn't load image '%s'", asFileName.c_str());
return NULL;
}
iMaterial *pMat = mpMaterialHandler->Create(asMaterialName, eMaterialPicture_Image);
if (pMat == NULL) {
- FatalError("Couldn't create material '%s'!\n", asMaterialName.c_str());
+ error("Couldn't create material '%s'", asMaterialName.c_str());
return NULL;
}
// mpResources->GetImageManager()->FlushAll();
@@ -298,13 +298,13 @@ cGfxObject *cGraphicsDrawer::CreateGfxObject(Bitmap2D *apBmp, const tString &asM
bool abAddToList) {
cResourceImage *pImage = mpResources->GetImageManager()->CreateFromBitmap("", apBmp);
if (pImage == NULL) {
- FatalError("Couldn't create image\n");
+ error("Couldn't create image");
return NULL;
}
iMaterial *pMat = mpMaterialHandler->Create(asMaterialName, eMaterialPicture_Image);
if (pMat == NULL) {
- FatalError("Couldn't create material '%s'!\n", asMaterialName.c_str());
+ error("Couldn't create material '%s'", asMaterialName.c_str());
return NULL;
}
// mpResources->GetImageManager()->FlushAll();
@@ -325,13 +325,13 @@ cGfxObject *cGraphicsDrawer::CreateGfxObjectFromTexture(const tString &asFileNam
bool abAddToList) {
iTexture *pTex = mpResources->GetTextureManager()->Create2D(asFileName, false);
if (pTex == NULL) {
- FatalError("Couldn't create texture '%s'!\n", asFileName.c_str());
+ error("Couldn't create texture '%s'", asFileName.c_str());
return NULL;
}
iMaterial *pMat = mpMaterialHandler->Create(asMaterialName, eMaterialPicture_Texture);
if (pMat == NULL) {
- FatalError("Couldn't create material '%s'!\n", asMaterialName.c_str());
+ error("Couldn't create material '%s'", asMaterialName.c_str());
return NULL;
}
// mpResources->GetImageManager()->FlushAll();
@@ -360,13 +360,13 @@ cBackgroundImage *cGraphicsDrawer::AddBackgroundImage(const tString &asFileName,
bool abTile, const cVector2f &avSize, const cVector2f &avPosPercent, const cVector2f &avVel) {
cResourceImage *pImage = mpResources->GetImageManager()->CreateImage(asFileName);
if (pImage == NULL) {
- FatalError("Couldn't load image '%s'!\n", asFileName.c_str());
+ error("Couldn't load image '%s'", asFileName.c_str());
return NULL;
}
iMaterial *pMat = mpMaterialHandler->Create(asMaterialName, eMaterialPicture_Image);
if (pMat == NULL) {
- FatalError("Couldn't create material '%s'!\n", asMaterialName.c_str());
+ error("Couldn't create material '%s'", asMaterialName.c_str());
return NULL;
}
// mpResources->GetImageManager()->FlushAll();
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.cpp b/engines/hpl1/engine/graphics/ImageEntityData.cpp
index 38f6156e78e..2f058e4179c 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.cpp
+++ b/engines/hpl1/engine/graphics/ImageEntityData.cpp
@@ -106,7 +106,7 @@ bool cImageEntityData::CreateFromFile(const tString &asFile, tUIntVec &avImageHa
bool bGotAnim = false;
TiXmlDocument *pDoc = hplNew(TiXmlDocument, (asFile.c_str()));
if (!pDoc->LoadFile()) {
- FatalError("Couldn't load tileset '%s'!\n", asFile.c_str());
+ error("Couldn't load tileset '%s'", asFile.c_str());
return false;
}
@@ -241,7 +241,7 @@ bool cImageEntityData::CreateFromFile(const tString &asFile, tUIntVec &avImageHa
sFile + it->msSuffix,
avImageHandle[it->mType]);
if (pImage == NULL) {
- FatalError("Can't load texture '%s%s'!\n", sFile.c_str(), it->msSuffix.c_str());
+ error("Can't load texture '%s%s'", sFile.c_str(), it->msSuffix.c_str());
return false;
}
diff --git a/engines/hpl1/engine/graphics/Renderer2D.cpp b/engines/hpl1/engine/graphics/Renderer2D.cpp
index 48caa667db8..aec4a97ee6b 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer2D.cpp
@@ -63,7 +63,7 @@ cRenderer2D::cRenderer2D(iLowLevelGraphics *apLowLevelGraphics, cResources *apRe
/// LIGHTING SETUP
mpLightMap[0] = mpResources->GetTextureManager()->Create2D("PointLight2D.bmp", false);
if (mpLightMap[0] == NULL)
- FatalError("Couldn't load PointLight2D");
+ error("Couldn't load PointLight2D");
mpLightMap[0]->SetWrapS(eTextureWrap_ClampToEdge);
mpLightMap[0]->SetWrapT(eTextureWrap_ClampToEdge);
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
index 1e125bbd7b1..e6bafd7089e 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
@@ -251,7 +251,7 @@ void cLowLevelSoundOpenAL::Init(bool abUseHardware, bool abForceGeneric, bool ab
}
if (!mbInitialized)
{
- FatalError("Failed! Check your OpenAL installation\n");
+ error("Failed! Check your OpenAL installation");
return;
}
diff --git a/engines/hpl1/engine/scene/ImageEntity.cpp b/engines/hpl1/engine/scene/ImageEntity.cpp
index e11f011710e..92f6e6d9ca8 100644
--- a/engines/hpl1/engine/scene/ImageEntity.cpp
+++ b/engines/hpl1/engine/scene/ImageEntity.cpp
@@ -328,7 +328,7 @@ bool cImageEntity::LoadEntityData(tString asDataName, int alAnimNum) {
cImageEntityData *pImageData = mpResources->GetImageEntityManager()->CreateData(asDataName);
if (pImageData == NULL) {
- FatalError("Couldn't load Data '%s' for entity '%s'!", asDataName.c_str(), msName.c_str());
+ error("Couldn't load Data '%s' for entity '%s'", asDataName.c_str(), msName.c_str());
return false;
}
diff --git a/engines/hpl1/engine/scene/MultiImageEntity.cpp b/engines/hpl1/engine/scene/MultiImageEntity.cpp
index d6d7a60fe51..7f71be260c4 100644
--- a/engines/hpl1/engine/scene/MultiImageEntity.cpp
+++ b/engines/hpl1/engine/scene/MultiImageEntity.cpp
@@ -32,6 +32,7 @@
#include "hpl1/engine/scene/World2D.h"
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
+#include "hpl1/debug.h"
namespace hpl {
@@ -74,7 +75,7 @@ cMultiImageEntity::~cMultiImageEntity() {
bool cMultiImageEntity::Add(tString asName, tString asFile, cVector3f avLocalPos, tFlag alPartId) {
cImageEntity *pEntity = mpScene->GetWorld2D()->CreateImageEntity(asName, asFile);
if (pEntity == NULL) {
- FatalError("Couldn't load image entity '%s'\n", asFile.c_str());
+ error("Couldn't load image entity '%s'", asFile.c_str());
return false;
}
diff --git a/engines/hpl1/engine/scene/Scene.cpp b/engines/hpl1/engine/scene/Scene.cpp
index f968e43182b..5f6273bdcd8 100644
--- a/engines/hpl1/engine/scene/Scene.cpp
+++ b/engines/hpl1/engine/scene/Scene.cpp
@@ -185,7 +185,7 @@ cScriptVar *cScene::CreateLocalVar(const tString &asName) {
m_mapLocalVars.insert(tScriptVarMap::value_type(cString::ToLowerCase(asName), Var));
pVar = GetLocalVar(asName);
if (pVar == NULL)
- FatalError("Very strange error when creating script var!\n");
+ error("Very strange error when creating script var!");
}
return pVar;
}
@@ -217,7 +217,7 @@ cScriptVar *cScene::CreateGlobalVar(const tString &asName) {
m_mapGlobalVars.insert(tScriptVarMap::value_type(cString::ToLowerCase(asName), Var));
pVar = GetGlobalVar(asName);
if (pVar == NULL)
- FatalError("Very strange error when creating script var!\n");
+ error("Very strange error when creating script var!");
}
return pVar;
}
diff --git a/engines/hpl1/engine/scene/TileSet.cpp b/engines/hpl1/engine/scene/TileSet.cpp
index 8e5ac8fe40f..378fc2a36a8 100644
--- a/engines/hpl1/engine/scene/TileSet.cpp
+++ b/engines/hpl1/engine/scene/TileSet.cpp
@@ -87,7 +87,7 @@ iTileData *cTileSet::Get(int alNum) {
bool cTileSet::CreateFromFile(const tString &asFile) {
TiXmlDocument *pDoc = hplNew(TiXmlDocument, (asFile.c_str()));
if (!pDoc->LoadFile()) {
- FatalError("Couldn't load tileset '%s'!\n", asFile.c_str());
+ error("Couldn't load tileset '%s'", asFile.c_str());
return false;
}
diff --git a/engines/hpl1/engine/scene/World2D.cpp b/engines/hpl1/engine/scene/World2D.cpp
index 4fde1c8547d..9450c54bfef 100644
--- a/engines/hpl1/engine/scene/World2D.cpp
+++ b/engines/hpl1/engine/scene/World2D.cpp
@@ -303,13 +303,13 @@ bool cWorld2D::CreateFromFile(tString asFile) {
tString sPath = mpResources->GetFileSearcher()->GetFilePath(asFile);
if (sPath == "") {
- FatalError("Couldn't find map '%s'!\n", asFile.c_str());
+ error("Couldn't find map '%s'", asFile.c_str());
return false;
}
TiXmlDocument *pDoc = hplNew(TiXmlDocument, (sPath.c_str()));
if (!pDoc->LoadFile()) {
- FatalError("Couldn't load map '%s'!\n", asFile.c_str());
+ error("Couldn't load map '%s'", asFile.c_str());
return false;
}
@@ -317,7 +317,7 @@ bool cWorld2D::CreateFromFile(tString asFile) {
asFile = cString::SetFileExt(asFile, "hps");
mpScript = mpResources->GetScriptManager()->CreateScript(asFile);
if (mpScript == NULL) {
- Error("Couldn't load script '%s'\n", asFile.c_str());
+ Error("Couldn't load script '%s'", asFile.c_str());
}
TiXmlElement *pHplMapElem = pDoc->RootElement();
@@ -411,10 +411,10 @@ bool cWorld2D::CreateFromFile(tString asFile) {
}
} else {
hplDelete(pEntity);
- Error("Couldn't load data for entity '%s'!\n", pEntity->GetName().c_str());
+ Error("Couldn't load data for entity '%s'", pEntity->GetName().c_str());
}
} else {
- FatalError("No other Render mode for entity exist!!");
+ error("No other Render mode for entity exist!!");
}
pEntityElem = pEntityElem->NextSiblingElement();
@@ -547,11 +547,11 @@ bool cWorld2D::CreateFromFile(tString asFile) {
// Log("Layer Children\n");
if (pLayerChildElem->Attribute("Width") == NULL)
- FatalError("Can't Load Width\n");
+ error("Can't Load Width");
int lW = cString::ToInt(pLayerChildElem->Attribute("Width"), 0);
if (pLayerChildElem->Attribute("Height") == NULL)
- FatalError("Can't Load Height\n");
+ error("Can't Load Height");
int lH = cString::ToInt(pLayerChildElem->Attribute("Height"), 0);
bool bCollide = cString::ToBool(pLayerChildElem->Attribute("Collide"), true);
bool bLit = cString::ToBool(pLayerChildElem->Attribute("Lit"), true);
@@ -781,7 +781,7 @@ int cWorld2D::LoadTileData(cTile *apTile, tString *asData, int alStart) {
pSet = mpTileMap->GetTileSet(lSet);
if (pSet == NULL)
- FatalError("Error getting tileset%d\n", lSet);
+ error("Error getting tileset%d", lSet);
pData = static_cast<cTileDataNormal *>(pSet->Get(lNum));
apTile->SetTileData(pData);
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index 5c85f89bfdd..e504de4303b 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -61,13 +61,6 @@ LowLevelSystem::~LowLevelSystem() {
// gpLogWriter = NULL;
}
-void FatalError(const char *fmt, ...) {
- va_list vl;
- va_start(vl, fmt);
- error(fmt, vl);
- va_end(vl);
-}
-
void Error(const char *fmt, ...) {
va_list vl;
va_start(vl, fmt);
diff --git a/engines/hpl1/engine/system/low_level_system.h b/engines/hpl1/engine/system/low_level_system.h
index 28673034853..65442b26ee0 100644
--- a/engines/hpl1/engine/system/low_level_system.h
+++ b/engines/hpl1/engine/system/low_level_system.h
@@ -58,7 +58,6 @@ namespace hpl {
class iScript;
extern void SetLogFile(const tWString &File);
-extern void FatalError(const char *fmt, ...);
extern void Error(const char *fmt, ...);
extern void Warning(const char *fmt, ...);
extern void Log(const char *fmt, ...);
diff --git a/engines/hpl1/penumbra-overture/IntroStory.cpp b/engines/hpl1/penumbra-overture/IntroStory.cpp
index c7e1bd8e2fe..29cc92ea844 100644
--- a/engines/hpl1/penumbra-overture/IntroStory.cpp
+++ b/engines/hpl1/penumbra-overture/IntroStory.cpp
@@ -355,7 +355,7 @@ void cIntroStory::SetActive(bool abX) {
for (int i = 0; i < INTRO_IMAGE_NUM; ++i) {
mvImages[i].mpTexture = mpTexManager->Create2D("intro_image0" + cString::ToString(i + 1), false);
if (mvImages[i].mpTexture == NULL) {
- FatalError("Couldn't load an intro image!\n");
+ error("Couldn't load an intro image");
}
mvImages[i].mbActive = false;
mvImages[i].mlstPrevPos.clear();
diff --git a/engines/hpl1/penumbra-overture/PlayerHelper.cpp b/engines/hpl1/penumbra-overture/PlayerHelper.cpp
index 8227beffb9b..c2277a70025 100644
--- a/engines/hpl1/penumbra-overture/PlayerHelper.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerHelper.cpp
@@ -1694,7 +1694,7 @@ cPlayerNoiseFilter::cPlayerNoiseFilter(cInit *apInit) {
tString sFileName = "effect_noise0" + cString::ToString(i);
cGfxObject *pObject = mpDrawer->CreateGfxObject(sFileName, "smoke2d");
if (pObject == NULL) {
- FatalError("Error loading noise filter!\n");
+ error("Error loading noise filter");
}
mvGfxNoise.push_back(pObject);
Commit: de03b0de95c09f64acb66ab2e694d1c4e51a49ea
https://github.com/scummvm/scummvm/commit/de03b0de95c09f64acb66ab2e694d1c4e51a49ea
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:03:34+01:00
Commit Message:
IMAGES: Added comments describing use case for CMYK color space format
Changed paths:
image/jpeg.cpp
diff --git a/image/jpeg.cpp b/image/jpeg.cpp
index 0cd4df41db4..ffb197ae005 100644
--- a/image/jpeg.cpp
+++ b/image/jpeg.cpp
@@ -271,8 +271,13 @@ bool JPEGDecoder::loadStream(Common::SeekableReadStream &stream) {
break;
}
- if (cinfo.num_components == 4)
+ // Semi-hack:
+ // In case 4 components jpeglib expect CMYK or CYYK color space output.
+ // To avoid any color space conversion, CMYK must be used.
+ // HPL1 engine use it to pass RGBA jpeg bitmaps.
+ if (cinfo.num_components == 4) {
cinfo.out_color_space = JCS_CMYK;
+ }
// Actually start decompressing the image
jpeg_start_decompress(&cinfo);
@@ -297,6 +302,10 @@ bool JPEGDecoder::loadStream(Common::SeekableReadStream &stream) {
default:
break;
}
+ // Size of output pixel must match 4 bytes.
+ if (cinfo.out_color_space == JCS_CMYK) {
+ assert(_surface.format.bytesPerPixel == 4);
+ }
// Allocate buffer for one scanline
JDIMENSION pitch = cinfo.output_width * _surface.format.bytesPerPixel;
Commit: 7a11a02837ee179be5b849ddbc4290304aba5a12
https://github.com/scummvm/scummvm/commit/7a11a02837ee179be5b849ddbc4290304aba5a12
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:34+01:00
Commit Message:
HPL1: Rename target penumbra_overture -> penumbraoverture
Changed paths:
engines/hpl1/detection_tables.h
diff --git a/engines/hpl1/detection_tables.h b/engines/hpl1/detection_tables.h
index ed4fca1dec0..8d7687c44bb 100644
--- a/engines/hpl1/detection_tables.h
+++ b/engines/hpl1/detection_tables.h
@@ -22,11 +22,11 @@
namespace Hpl1 {
const PlainGameDescriptor GAME_NAMES[] = {
- {"penumbra_overture", "Penumbra: Overture"},
+ {"penumbraoverture", "Penumbra: Overture"},
{0, 0}};
const ADGameDescription GAME_DESCRIPTIONS[] = {
- {"penumbra_overture",
+ {"penumbraoverture",
nullptr,
AD_ENTRY1s("Penumbra.exe", nullptr, -1),
Common::Language::EN_ANY,
Commit: f5a58d657bdf6536bc1d224360e3473b6b79699c
https://github.com/scummvm/scummvm/commit/f5a58d657bdf6536bc1d224360e3473b6b79699c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:35+01:00
Commit Message:
HPL1: Added temporarily means to close the game window
Changed paths:
engines/hpl1/engine/game/Game.cpp
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index 3dfe423db8e..d169ba64c8f 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -44,6 +44,8 @@
#include "hpl1/engine/game/low_level_game_setup.h"
#include "hpl1/engine/system/low_level_system.h"
+#include "common/events.h"
+
namespace hpl {
//////////////////////////////////////////////////////////////////////////
@@ -433,6 +435,13 @@ void cGame::Run() {
// cMemoryManager::SetLogCreation(false);
// Log("----\nCreations made: %d\n------\n",cMemoryManager::GetCreationCount());
//}
+
+ // FIXME: TODO: Remove once events are being processed
+ Common::Event event;
+
+ g_system->getEventManager()->pollEvent(event);
+ if (event.type == Common::EVENT_QUIT)
+ break;
}
Log("--------------------------------------------------------\n\n");
Commit: 985d692483a047094fae625afc6b6cd54f8ce92f
https://github.com/scummvm/scummvm/commit/985d692483a047094fae625afc6b6cd54f8ce92f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:35+01:00
Commit Message:
HPL1: Do not be a CPU hog
Changed paths:
engines/hpl1/engine/game/Game.cpp
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index d169ba64c8f..bd2508d029d 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -442,6 +442,8 @@ void cGame::Run() {
g_system->getEventManager()->pollEvent(event);
if (event.type == Common::EVENT_QUIT)
break;
+
+ g_system->delayMillis(10);
}
Log("--------------------------------------------------------\n\n");
Commit: bbe9e1395f5fddb48e69c80268ad078c21948b1a
https://github.com/scummvm/scummvm/commit/bbe9e1395f5fddb48e69c80268ad078c21948b1a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:35+01:00
Commit Message:
HPL1: Remove graphics initialization from engine skeleton
Changed paths:
engines/hpl1/hpl1.cpp
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index 84c95b8c7b5..f352304e343 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -56,8 +56,7 @@ Common::String Hpl1Engine::getGameId() const {
Common::Error Hpl1Engine::run() {
hplMain("");
- // Initialize 320x200 paletted graphics mode
- initGraphics(320, 200);
+
_screen = new Graphics::Screen();
// Set the engine's debugger console
Commit: a9b02db1dfbb192a5e32b2ee4b3a9fcd5a1bd247
https://github.com/scummvm/scummvm/commit/a9b02db1dfbb192a5e32b2ee4b3a9fcd5a1bd247
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:35+01:00
Commit Message:
HPL1: fix bugs in bitmap2D and fix font rendering
Changed paths:
engines/hpl1/engine/graphics/bitmap2D.cpp
engines/hpl1/engine/graphics/bitmap2D.h
engines/hpl1/engine/graphics/font_data.cpp
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
index aa7fd40712a..31c59566474 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.cpp
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -128,7 +128,8 @@ const void *Bitmap2D::getRawData() const {
}
int Bitmap2D::getNumChannels() {
- return activeSurface().format.bpp() / activeSurface().format.bytesPerPixel;
+ const Graphics::PixelFormat &format = activeSurface().format;
+ return (format.rBits() > 0) + (format.gBits() > 0) + (format.bBits() > 0) + (format.aBits() > 0);
}
const Graphics::PixelFormat &Bitmap2D::format() const {
@@ -140,7 +141,25 @@ bool Bitmap2D::hasAlpha() {
}
uint32 Bitmap2D::getBpp() const {
- return format().bpp();
+ return format().bytesPerPixel;
+}
+
+static uint32 alphaToRed(const uint32 pixel, const Graphics::PixelFormat &format) {
+ byte r, g, b;
+ format.colorToRGB(pixel, r, g, b);
+ byte a = r;
+ return format.ARGBToColor(a, r, g, b);
+}
+
+void Bitmap2D::copyRedToAlpha() {
+ if (!_isSurfaceActive)
+ copyDecoder();
+ for (uint y = 0; y < _surface.h; y++) {
+ uint32 *rowPtr = (uint32 *)_surface.getBasePtr(0, y);
+ for (uint x = 0; x < _surface.w; ++x, ++rowPtr) {
+ *rowPtr = alphaToRed(*rowPtr, _surface.format);
+ }
+ }
}
void Bitmap2D::copyDecoder(const Graphics::PixelFormat &format) {
diff --git a/engines/hpl1/engine/graphics/bitmap2D.h b/engines/hpl1/engine/graphics/bitmap2D.h
index 80bc252ddd2..5d65521b514 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.h
+++ b/engines/hpl1/engine/graphics/bitmap2D.h
@@ -62,6 +62,8 @@ public:
uint32 getBpp() const override;
+ void copyRedToAlpha();
+
private:
void copyDecoder(const Graphics::PixelFormat &format = {});
const Graphics::Surface &activeSurface() const;
diff --git a/engines/hpl1/engine/graphics/font_data.cpp b/engines/hpl1/engine/graphics/font_data.cpp
index 1491dc04d88..4f1974c8248 100644
--- a/engines/hpl1/engine/graphics/font_data.cpp
+++ b/engines/hpl1/engine/graphics/font_data.cpp
@@ -137,6 +137,7 @@ void FontData::loadNextGlyph(const TiXmlElement *charIt, BitmapArray &bitmaps, c
Common::ScopedPtr<Bitmap2D> charBmp(_lowLevelGraphics->CreateBitmap2D(size));
src.drawToBitmap(*charBmp, {0,0}, Common::Rect(x, y, x + w, y + h));
+ charBmp->copyRedToAlpha();
_glyphs[id] = createGlyph(charBmp.get(), {xOffset, yOffset}, {w, h}, fontSize, advance);
}
Commit: 45fd4424fadecdb725611604c8768806f7f6750d
https://github.com/scummvm/scummvm/commit/45fd4424fadecdb725611604c8768806f7f6750d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:35+01:00
Commit Message:
HPL1: remove broken logging
Changed paths:
R engines/hpl1/debug.cpp
engines/hpl1/debug.h
engines/hpl1/engine/system/low_level_system.cpp
engines/hpl1/module.mk
diff --git a/engines/hpl1/debug.cpp b/engines/hpl1/debug.cpp
deleted file mode 100644
index e5ea21af5b4..00000000000
--- a/engines/hpl1/debug.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "hpl1/debug.h"
-
-namespace Hpl1 {
-
-void logError(int channel, const char *fmt, ...) {
- va_list vl;
- va_start(vl, fmt);
- debugCN(Hpl1::kDebugLevelError, channel, fmt, vl);
- va_end(vl);
-}
-
-void logWarning(int channel, const char *fmt, ...) {
- va_list vl;
- va_start(vl, fmt);
- debugCN(Hpl1::kDebugLevelWarning, channel, fmt, vl);
- va_end(vl);
-}
-
-void logInfo(int channel, const char *fmt, ...) {
- va_list vl;
- va_start(vl, fmt);
- debugCN(Hpl1::kDebugLevelLog, channel, fmt, vl);
- va_end(vl);
-}
-
-}
\ No newline at end of file
diff --git a/engines/hpl1/debug.h b/engines/hpl1/debug.h
index 609504bb1cb..29fb67452f3 100644
--- a/engines/hpl1/debug.h
+++ b/engines/hpl1/debug.h
@@ -39,11 +39,20 @@ enum DebugLevels {
kDebugLevelLog = 3
};
-void logError(int channel, const char *fmt, ...);
+template<typename... Args>
+void logError(int channel, const char *fmt, Args... args) {
+ debugCN(kDebugLevelError, channel, fmt, args...);
+}
-void logWarning(int channel, const char *fmt, ...);
+template<typename... Args>
+void logWarning(int channel, const char *fmt, Args... args) {
+ debugCN(kDebugLevelWarning, channel, fmt, args...);
+}
-void logInfo(int channel, const char *fmt, ...);
+template<typename... Args>
+void logInfo(int channel, const char *fmt, Args... args) {
+ debugCN(kDebugLevelLog, channel, fmt, args...);
+}
}
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index e504de4303b..70007e28c6d 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -62,24 +62,12 @@ LowLevelSystem::~LowLevelSystem() {
}
void Error(const char *fmt, ...) {
- va_list vl;
- va_start(vl, fmt);
- debugN(Hpl1::kDebugLevelError, fmt, vl);
- va_end(vl);
}
void Warning(const char *fmt, ...) {
- va_list vl;
- va_start(vl, fmt);
- debugN(Hpl1::kDebugLevelWarning, fmt, vl);
- va_end(vl);
}
void Log(const char *fmt, ...) {
- va_list vl;
- va_start(vl, fmt);
- debugN(Hpl1::kDebugLevelLog, fmt, vl);
- va_end(vl);
}
static bool gbUpdateLogIsActive;
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 29036b0f210..0a17ddec4a0 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -4,7 +4,6 @@ MODULE_OBJS := \
console.o \
detection.o \
string.o \
- debug.o \
opengl.o \
engine/ai/AI.o \
engine/ai/AINodeContainer.o \
Commit: aa52aafe8129657644bc8216c1971732d5bf4825
https://github.com/scummvm/scummvm/commit/aa52aafe8129657644bc8216c1971732d5bf4825
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:35+01:00
Commit Message:
IMAGES: force alpha decoding for BMP images
Changed paths:
image/codecs/codec.cpp
diff --git a/image/codecs/codec.cpp b/image/codecs/codec.cpp
index 9d5e541dd26..8a28dd9c2aa 100644
--- a/image/codecs/codec.cpp
+++ b/image/codecs/codec.cpp
@@ -205,7 +205,7 @@ Codec *createBitmapCodec(uint32 tag, uint32 streamTag, int width, int height, in
switch (tag) {
case SWAP_CONSTANT_32(0):
- return new BitmapRawDecoder(width, height, bitsPerPixel, true);
+ return new BitmapRawDecoder(width, height, bitsPerPixel, false);
case SWAP_CONSTANT_32(1):
return new MSRLEDecoder(width, height, bitsPerPixel);
case SWAP_CONSTANT_32(2):
Commit: 99b9a5411071d99e5ce50a469dda9886737d83f4
https://github.com/scummvm/scummvm/commit/99b9a5411071d99e5ce50a469dda9886737d83f4
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:35+01:00
Commit Message:
HPL1: fix debug functions
Changed paths:
engines/hpl1/engine/system/low_level_system.cpp
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index 70007e28c6d..472a80728ec 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -19,8 +19,6 @@
*
*/
-#include <stdarg.h>
-
#include "hpl1/engine/libraries/angelscript/angelscript.h"
#include "hpl1/engine/impl/SqScript.h"
#include "hpl1/engine/impl/scriptstring.h"
@@ -61,13 +59,31 @@ LowLevelSystem::~LowLevelSystem() {
// gpLogWriter = NULL;
}
+static void commonLog(int level, const char* fmt, va_list args) {
+ char buffer[256];
+ vsnprintf(buffer, 256, fmt, args);
+ debugN(level, buffer);
+}
+
void Error(const char *fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+ commonLog(Hpl1::kDebugLevelError, fmt, args);
+ va_end(args);
}
void Warning(const char *fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+ commonLog(Hpl1::kDebugLevelWarning, fmt, args);
+ va_end(args);
}
void Log(const char *fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+ commonLog(Hpl1::kDebugLevelLog, fmt, args);
+ va_end(args);
}
static bool gbUpdateLogIsActive;
Commit: 9eadad06cc19ec77e407d67690221461578c4cad
https://github.com/scummvm/scummvm/commit/9eadad06cc19ec77e407d67690221461578c4cad
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:35+01:00
Commit Message:
HPL1: implement LowLevelInputSDL class
Changed paths:
engines/hpl1/engine/impl/LowLevelInputSDL.cpp
engines/hpl1/engine/impl/LowLevelInputSDL.h
diff --git a/engines/hpl1/engine/impl/LowLevelInputSDL.cpp b/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
index 0e43dd5e288..dc4cdecbdf7 100644
--- a/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
@@ -25,23 +25,19 @@
* This file is part of HPL1 Engine.
*/
-#include "hpl1/engine/impl/LowLevelInputSDL.h"
-
#include "hpl1/engine/impl/KeyboardSDL.h"
+#include "hpl1/engine/impl/LowLevelInputSDL.h"
#include "hpl1/engine/impl/MouseSDL.h"
-
#include "hpl1/engine/system/low_level_system.h"
+#include "common/events.h"
+#include "common/system.h"
namespace hpl {
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
//-----------------------------------------------------------------------
cLowLevelInputSDL::cLowLevelInputSDL(iLowLevelGraphics *apLowLevelGraphics) {
- mpLowLevelGraphics = apLowLevelGraphics;
+ _lowLevelGraphics = apLowLevelGraphics;
LockInput(true);
}
@@ -52,43 +48,29 @@ cLowLevelInputSDL::~cLowLevelInputSDL() {
//-----------------------------------------------------------------------
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHOD
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
void cLowLevelInputSDL::LockInput(bool abX) {
-#if 0
- SDL_WM_GrabInput(abX ? SDL_GRAB_ON : SDL_GRAB_OFF);
-#endif
+ g_system->lockMouse(abX);
}
//-----------------------------------------------------------------------
void cLowLevelInputSDL::BeginInputUpdate() {
-#if 0
- //SDL_PumpEvents();
-
- SDL_Event sdlEvent;
-
- while(SDL_PollEvent(&sdlEvent)!=0)
- {
- mlstEvents.push_back(sdlEvent);
- }
-#endif
+ Common::Event event;
+ while (g_system->getEventManager()->pollEvent(event)) {
+ _events.push_back(event);
+ }
}
//-----------------------------------------------------------------------
void cLowLevelInputSDL::EndInputUpdate() {
- mlstEvents.clear();
+ _events.clear();
}
//-----------------------------------------------------------------------
iMouse *cLowLevelInputSDL::CreateMouse() {
- return hplNew(cMouseSDL, (this, mpLowLevelGraphics));
+ return hplNew(cMouseSDL, (this, _lowLevelGraphics));
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/LowLevelInputSDL.h b/engines/hpl1/engine/impl/LowLevelInputSDL.h
index e655f937273..60c585b13fb 100644
--- a/engines/hpl1/engine/impl/LowLevelInputSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelInputSDL.h
@@ -29,16 +29,18 @@
#define HPL_LOWLEVELINPUT_SDL_H
#include "hpl1/engine/input/LowLevelInput.h"
-#include <list>
-
-//#include "SDL/SDL.h"
-#include "temp-types.h"
+#include "common/events.h"
+#include "common/array.h"
namespace hpl {
class iLowLevelGraphics;
+class iMouse;
+class iKeyboard;
class cLowLevelInputSDL : public iLowLevelInput {
+ friend class cKeyboardSDL;
+ friend class cMouseSDL;
public:
cLowLevelInputSDL(iLowLevelGraphics *apLowLevelGraphics);
~cLowLevelInputSDL();
@@ -51,11 +53,9 @@ public:
iMouse *CreateMouse();
iKeyboard *CreateKeyboard();
-public:
- std::list<SDL_Event> mlstEvents;
-
private:
- iLowLevelGraphics *mpLowLevelGraphics;
+ Common::Array<Common::Event> _events;
+ iLowLevelGraphics *_lowLevelGraphics;
};
}; // namespace hpl
#endif // HPL_LOWLEVELINPUT_SDL_H
Commit: a2d839ea302d54218244a826e2854b3f4aaaed0f
https://github.com/scummvm/scummvm/commit/a2d839ea302d54218244a826e2854b3f4aaaed0f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:35+01:00
Commit Message:
HPL1: implement MouseSDL class
Changed paths:
engines/hpl1/engine/impl/MouseSDL.cpp
engines/hpl1/engine/impl/MouseSDL.h
diff --git a/engines/hpl1/engine/impl/MouseSDL.cpp b/engines/hpl1/engine/impl/MouseSDL.cpp
index 065bdf6335a..4206c841cd5 100644
--- a/engines/hpl1/engine/impl/MouseSDL.cpp
+++ b/engines/hpl1/engine/impl/MouseSDL.cpp
@@ -26,11 +26,11 @@
*/
#include "hpl1/engine/impl/MouseSDL.h"
-
-//#include "SDL/SDL.h"
-
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/impl/LowLevelInputSDL.h"
+#include "hpl1/engine/input/InputTypes.h"
+#include "common/bitarray.h"
+#include "common/events.h"
namespace hpl {
@@ -45,17 +45,13 @@ cMouseSDL::cMouseSDL(cLowLevelInputSDL *apLowLevelInputSDL, iLowLevelGraphics *a
mfMinPercent = 0.1f;
mlBufferSize = 6;
- mvMButtonArray.resize(eMButton_LastEnum);
- mvMButtonArray.assign(mvMButtonArray.size(), false);
-
- mpLowLevelInputSDL = apLowLevelInputSDL;
- mpLowLevelGraphics = apLowLevelGraphics;
+ _buttonState.set_size(eMButton_LastEnum);
- mvMouseRelPos = cVector2f(0, 0);
- mvMouseAbsPos = cVector2f(0, 0);
+ _lowLevelInputSDL = apLowLevelInputSDL;
+ _lowLevelGraphics = apLowLevelGraphics;
- mbWheelUpMoved = false;
- mbWheelDownMoved = false;
+ _relMousePos = cVector2f(0, 0);
+ _absMousePos = cVector2f(0, 0);
}
//-----------------------------------------------------------------------
@@ -66,88 +62,63 @@ cMouseSDL::cMouseSDL(cLowLevelInputSDL *apLowLevelInputSDL, iLowLevelGraphics *a
//-----------------------------------------------------------------------
+static void setMouseState(const int state, Common::BitArray &states) {
+ if (state != Common::EVENT_WHEELDOWN)
+ states.unset(eMButton_WheelDown);
+ if (state != Common::EVENT_WHEELUP)
+ states.unset(eMButton_WheelUp);
+
+ switch (state) {
+ case Common::EVENT_LBUTTONDOWN:
+ return states.set(eMButton_Left);
+ case Common::EVENT_LBUTTONUP:
+ return states.unset(eMButton_Left);
+ case Common::EVENT_RBUTTONDOWN:
+ return states.set(eMButton_Right);
+ case Common::EVENT_RBUTTONUP:
+ return states.unset(eMButton_Right);
+ case Common::EVENT_MBUTTONDOWN:
+ return states.set(eMButton_Middle);
+ case Common::EVENT_MBUTTONUP:
+ return states.unset(eMButton_Middle);
+ case Common::EVENT_WHEELUP:
+ return states.set(eMButton_WheelUp);
+ case Common::EVENT_WHEELDOWN:
+ return states.set(eMButton_WheelDown);
+ }
+}
+
+void cMouseSDL::processEvent(const Common::Event &ev) {
+ if (!Common::isMouseEvent(ev))
+ return;
+ const cVector2f screenSize = _lowLevelGraphics->GetScreenSize();
+ const cVector2f virtualSize = _lowLevelGraphics->GetVirtualSize();
+ if (ev.type == Common::EVENT_MOUSEMOVE) {
+ _absMousePos = cVector2f(ev.mouse.x, ev.mouse.y);
+ //mvMouseAbsPos = (mvMouseAbsPos / screenSize) * virtualSize;
+ } else {
+ setMouseState(ev.type, _buttonState);
+ }
+ _relMousePos = cVector2f(ev.relMouse.x, ev.relMouse.y);
+ //mvMouseRelPos = (mvMouseRelPos / screenSize) * virtualSize;
+}
+
void cMouseSDL::Update() {
-#if 0
- cVector2f vScreenSize = mpLowLevelGraphics->GetScreenSize();
- cVector2f vVirtualSize = mpLowLevelGraphics->GetVirtualSize();
-
- //mvMouseRelPos = cVector2f(0,0);
-
- //Log("Input start\n");
- mbWheelUpMoved = false;
- mbWheelDownMoved = false;
-
- std::list<SDL_Event>::iterator it = mpLowLevelInputSDL->mlstEvents.begin();
- for(; it != mpLowLevelInputSDL->mlstEvents.end(); ++it)
- {
- SDL_Event *pEvent = &(*it);
-
- if( pEvent->type != SDL_MOUSEMOTION &&
- pEvent->type != SDL_MOUSEBUTTONDOWN &&
- pEvent->type != SDL_MOUSEBUTTONUP)
- {
- continue;
- }
-
- if(pEvent->type == SDL_MOUSEMOTION)
- {
- mvMouseAbsPos = cVector2f((float)pEvent->motion.x,(float)pEvent->motion.y);
- mvMouseAbsPos = (mvMouseAbsPos/vScreenSize)*vVirtualSize;
-
- Uint8 buttonState = pEvent->motion.state;
-
- //Set button here as well just to be sure
- /*if(buttonState & SDL_BUTTON(1)) mvMButtonArray[eMButton_Left] = true;
- if(buttonState & SDL_BUTTON(2)) mvMButtonArray[eMButton_Middle] = true;
- if(buttonState & SDL_BUTTON(3)) mvMButtonArray[eMButton_Right] = true;*/
- }
- else
- {
- bool bButtonIsDown = pEvent->type==SDL_MOUSEBUTTONDOWN;
-
- //if(pEvent->button.button == SDL_BUTTON_WHEELUP)Log(" Wheel %d!\n",bButtonIsDown);
-
- switch(pEvent->button.button)
- {
- case SDL_BUTTON_LEFT: mvMButtonArray[eMButton_Left] = bButtonIsDown;break;
- case SDL_BUTTON_MIDDLE: mvMButtonArray[eMButton_Middle] = bButtonIsDown;break;
- case SDL_BUTTON_RIGHT: mvMButtonArray[eMButton_Right] = bButtonIsDown;break;
- case SDL_BUTTON_WHEELUP:
- mvMButtonArray[eMButton_WheelUp] = bButtonIsDown;
- if(bButtonIsDown) mbWheelUpMoved = true;
- break;
- case SDL_BUTTON_WHEELDOWN:
- mvMButtonArray[eMButton_WheelDown] = bButtonIsDown;
- if(bButtonIsDown) mbWheelDownMoved = true;
- break;
- }
- }
- }
-
- if(mbWheelDownMoved) mvMButtonArray[eMButton_WheelDown] = true;
- else mvMButtonArray[eMButton_WheelDown] = false;
- if(mbWheelUpMoved) mvMButtonArray[eMButton_WheelUp] = true;
- else mvMButtonArray[eMButton_WheelUp] = false;
-
- int lX,lY;
- SDL_GetRelativeMouseState(&lX, &lY);
-
- mvMouseRelPos = cVector2f((float)lX,(float)lY);
- mvMouseRelPos = (mvMouseRelPos/vScreenSize)*vVirtualSize;
-#endif
+ for (const Common::Event &ev : _lowLevelInputSDL->_events)
+ processEvent(ev);
}
//-----------------------------------------------------------------------
bool cMouseSDL::ButtonIsDown(eMButton mButton) {
- return mvMButtonArray[mButton];
+ return _buttonState.get(mButton);
}
//-----------------------------------------------------------------------
cVector2f cMouseSDL::GetAbsPosition() {
// Do a transform with the screen-size to the the float coordinates.
- cVector2f vPos = mvMouseAbsPos;
+ cVector2f vPos = _absMousePos;
return vPos;
}
@@ -156,9 +127,9 @@ cVector2f cMouseSDL::GetAbsPosition() {
cVector2f cMouseSDL::GetRelPosition() {
// Do a transform with the screen-size to the the float coordinates.
- cVector2f vPos = mvMouseRelPos;
+ cVector2f vPos = _relMousePos;
// Ok this is?
- mvMouseRelPos = cVector2f(0, 0);
+ _relMousePos = cVector2f(0, 0);
return vPos;
/*cVector2f vNew;
@@ -194,15 +165,7 @@ cVector2f cMouseSDL::GetRelPosition() {
//-----------------------------------------------------------------------
void cMouseSDL::Reset() {
-#if 0
- mlstMouseCoord.clear();
- mvMouseRelPos = cVector2f(0,0);
-
- int lX,lY; //Just to clear the rel pos.
-
- SDL_PumpEvents();
- SDL_GetRelativeMouseState(&lX, &lY);
-#endif
+ error("call to unimplemented function Mouse::Reset");
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/MouseSDL.h b/engines/hpl1/engine/impl/MouseSDL.h
index 85d144fe8ad..2470d249274 100644
--- a/engines/hpl1/engine/impl/MouseSDL.h
+++ b/engines/hpl1/engine/impl/MouseSDL.h
@@ -29,7 +29,11 @@
#define HPL_MOUSE_SDL_H
#include "hpl1/engine/input/Mouse.h"
-#include <vector>
+#include "common/bitarray.h"
+
+namespace Common {
+ class Event;
+}
namespace hpl {
@@ -69,22 +73,15 @@ public:
float afMaxPercent, unsigned int alBufferSize);
private:
- cVector2f mvMouseAbsPos;
- cVector2f mvMouseRelPos;
-
- std::vector<bool> mvMButtonArray;
-
- tVector2fList mlstMouseCoord;
-
+ void processEvent(const Common::Event &ev);
+ cVector2f _absMousePos;
+ cVector2f _relMousePos;
+ Common::BitArray _buttonState;
float mfMaxPercent;
float mfMinPercent;
int mlBufferSize;
-
- cLowLevelInputSDL *mpLowLevelInputSDL;
- iLowLevelGraphics *mpLowLevelGraphics;
-
- bool mbWheelUpMoved;
- bool mbWheelDownMoved;
+ cLowLevelInputSDL *_lowLevelInputSDL;
+ iLowLevelGraphics *_lowLevelGraphics;
};
}; // namespace hpl
Commit: 8bcc9be062b43d6d25192afe69f539f986a0119b
https://github.com/scummvm/scummvm/commit/8bcc9be062b43d6d25192afe69f539f986a0119b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:36+01:00
Commit Message:
HPL1: implement KeyboardSDL class
Changed paths:
engines/hpl1/engine/impl/KeyboardSDL.cpp
engines/hpl1/engine/impl/KeyboardSDL.h
diff --git a/engines/hpl1/engine/impl/KeyboardSDL.cpp b/engines/hpl1/engine/impl/KeyboardSDL.cpp
index 72ee006795f..b8cdb066be5 100644
--- a/engines/hpl1/engine/impl/KeyboardSDL.cpp
+++ b/engines/hpl1/engine/impl/KeyboardSDL.cpp
@@ -27,98 +27,349 @@
#include "hpl1/engine/impl/KeyboardSDL.h"
-//#include "SDL/SDL.h"
-
+#include "common/system.h"
#include "hpl1/engine/impl/LowLevelInputSDL.h"
-#if 0 // def WIN32
-#include <conio.h>
-#endif
-
namespace hpl {
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
//-----------------------------------------------------------------------
cKeyboardSDL::cKeyboardSDL(cLowLevelInputSDL *apLowLevelInputSDL) : iKeyboard("SDL Portable Keyboard") {
-#if 0
- mpLowLevelInputSDL = apLowLevelInputSDL;
-
- mvKeyArray.resize(eKey_LastEnum);
- ClearKeyList();
+ _lowLevelSystem = apLowLevelInputSDL;
- SDL_EnableUNICODE(1);
- SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
-#endif
+ _downKeys.set_size(eKey_LastEnum);
+ _downKeys.clear();
}
//-----------------------------------------------------------------------
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
-
-void cKeyboardSDL::Update() {
-#if 0
- mlstKeysPressed.clear();
- std::list<SDL_Event>::iterator it = mpLowLevelInputSDL->mlstEvents.begin();
- for(; it != mpLowLevelInputSDL->mlstEvents.end(); ++it)
- {
- SDL_Event *pEvent = &(*it);
-
- if(pEvent->type != SDL_KEYDOWN && pEvent->type != SDL_KEYUP)
- {
- continue;
- }
-
- eKey key = SDLToKey(pEvent->key.keysym.sym);
- mvKeyArray[key] = pEvent->type == SDL_KEYDOWN?true:false;
+static eKey convertKey(int alKey) {
+ switch (alKey) {
+ case Common::KEYCODE_BACKSPACE:
+ return eKey_BACKSPACE;
+ case Common::KEYCODE_TAB:
+ return eKey_TAB;
+ case Common::KEYCODE_CLEAR:
+ return eKey_CLEAR;
+ case Common::KEYCODE_RETURN:
+ return eKey_RETURN;
+ case Common::KEYCODE_PAUSE:
+ return eKey_PAUSE;
+ case Common::KEYCODE_ESCAPE:
+ return eKey_ESCAPE;
+ case Common::KEYCODE_SPACE:
+ return eKey_SPACE;
+ case Common::KEYCODE_EXCLAIM:
+ return eKey_EXCLAIM;
+ case Common::KEYCODE_QUOTEDBL:
+ return eKey_QUOTEDBL;
+ case Common::KEYCODE_HASH:
+ return eKey_HASH;
+ case Common::KEYCODE_DOLLAR:
+ return eKey_DOLLAR;
+ case Common::KEYCODE_AMPERSAND:
+ return eKey_AMPERSAND;
+ case Common::KEYCODE_QUOTE:
+ return eKey_QUOTE;
+ case Common::KEYCODE_LEFTPAREN:
+ return eKey_LEFTPAREN;
+ case Common::KEYCODE_RIGHTPAREN:
+ return eKey_RIGHTPAREN;
+ case Common::KEYCODE_ASTERISK:
+ return eKey_ASTERISK;
+ case Common::KEYCODE_PLUS:
+ return eKey_PLUS;
+ case Common::KEYCODE_COMMA:
+ return eKey_COMMA;
+ case Common::KEYCODE_MINUS:
+ return eKey_MINUS;
+ case Common::KEYCODE_PERIOD:
+ return eKey_PERIOD;
+ case Common::KEYCODE_SLASH:
+ return eKey_SLASH;
+ case Common::KEYCODE_0:
+ return eKey_0;
+ case Common::KEYCODE_1:
+ return eKey_1;
+ case Common::KEYCODE_2:
+ return eKey_2;
+ case Common::KEYCODE_3:
+ return eKey_3;
+ case Common::KEYCODE_4:
+ return eKey_4;
+ case Common::KEYCODE_5:
+ return eKey_5;
+ case Common::KEYCODE_6:
+ return eKey_6;
+ case Common::KEYCODE_7:
+ return eKey_7;
+ case Common::KEYCODE_8:
+ return eKey_8;
+ case Common::KEYCODE_9:
+ return eKey_9;
+ case Common::KEYCODE_COLON:
+ return eKey_COLON;
+ case Common::KEYCODE_SEMICOLON:
+ return eKey_SEMICOLON;
+ case Common::KEYCODE_LESS:
+ return eKey_LESS;
+ case Common::KEYCODE_EQUALS:
+ return eKey_EQUALS;
+ case Common::KEYCODE_GREATER:
+ return eKey_GREATER;
+ case Common::KEYCODE_QUESTION:
+ return eKey_QUESTION;
+ case Common::KEYCODE_AT:
+ return eKey_AT;
+ case Common::KEYCODE_LEFTBRACKET:
+ return eKey_LEFTBRACKET;
+ case Common::KEYCODE_BACKSLASH:
+ return eKey_BACKSLASH;
+ case Common::KEYCODE_RIGHTBRACKET:
+ return eKey_RIGHTBRACKET;
+ case Common::KEYCODE_CARET:
+ return eKey_CARET;
+ case Common::KEYCODE_UNDERSCORE:
+ return eKey_UNDERSCORE;
+ case Common::KEYCODE_BACKQUOTE:
+ return eKey_BACKQUOTE;
+ case Common::KEYCODE_a:
+ return eKey_a;
+ case Common::KEYCODE_b:
+ return eKey_b;
+ case Common::KEYCODE_c:
+ return eKey_c;
+ case Common::KEYCODE_d:
+ return eKey_d;
+ case Common::KEYCODE_e:
+ return eKey_e;
+ case Common::KEYCODE_f:
+ return eKey_f;
+ case Common::KEYCODE_g:
+ return eKey_g;
+ case Common::KEYCODE_h:
+ return eKey_h;
+ case Common::KEYCODE_i:
+ return eKey_i;
+ case Common::KEYCODE_j:
+ return eKey_j;
+ case Common::KEYCODE_k:
+ return eKey_k;
+ case Common::KEYCODE_l:
+ return eKey_l;
+ case Common::KEYCODE_m:
+ return eKey_m;
+ case Common::KEYCODE_n:
+ return eKey_n;
+ case Common::KEYCODE_o:
+ return eKey_o;
+ case Common::KEYCODE_p:
+ return eKey_p;
+ case Common::KEYCODE_q:
+ return eKey_q;
+ case Common::KEYCODE_r:
+ return eKey_r;
+ case Common::KEYCODE_s:
+ return eKey_s;
+ case Common::KEYCODE_t:
+ return eKey_t;
+ case Common::KEYCODE_u:
+ return eKey_u;
+ case Common::KEYCODE_v:
+ return eKey_v;
+ case Common::KEYCODE_w:
+ return eKey_w;
+ case Common::KEYCODE_x:
+ return eKey_x;
+ case Common::KEYCODE_y:
+ return eKey_y;
+ case Common::KEYCODE_z:
+ return eKey_z;
+ case Common::KEYCODE_DELETE:
+ return eKey_DELETE;
+ case Common::KEYCODE_KP0:
+ return eKey_KP0;
+ case Common::KEYCODE_KP1:
+ return eKey_KP1;
+ case Common::KEYCODE_KP2:
+ return eKey_KP2;
+ case Common::KEYCODE_KP3:
+ return eKey_KP3;
+ case Common::KEYCODE_KP4:
+ return eKey_KP4;
+ case Common::KEYCODE_KP5:
+ return eKey_KP5;
+ case Common::KEYCODE_KP6:
+ return eKey_KP6;
+ case Common::KEYCODE_KP7:
+ return eKey_KP7;
+ case Common::KEYCODE_KP8:
+ return eKey_KP8;
+ case Common::KEYCODE_KP9:
+ return eKey_KP9;
+ case Common::KEYCODE_KP_PERIOD:
+ return eKey_KP_PERIOD;
+ case Common::KEYCODE_KP_DIVIDE:
+ return eKey_KP_DIVIDE;
+ case Common::KEYCODE_KP_MULTIPLY:
+ return eKey_KP_MULTIPLY;
+ case Common::KEYCODE_KP_MINUS:
+ return eKey_KP_MINUS;
+ case Common::KEYCODE_KP_PLUS:
+ return eKey_KP_PLUS;
+ case Common::KEYCODE_KP_ENTER:
+ return eKey_KP_ENTER;
+ case Common::KEYCODE_KP_EQUALS:
+ return eKey_KP_EQUALS;
+ case Common::KEYCODE_UP:
+ return eKey_UP;
+ case Common::KEYCODE_DOWN:
+ return eKey_DOWN;
+ case Common::KEYCODE_RIGHT:
+ return eKey_RIGHT;
+ case Common::KEYCODE_LEFT:
+ return eKey_LEFT;
+ case Common::KEYCODE_INSERT:
+ return eKey_INSERT;
+ case Common::KEYCODE_HOME:
+ return eKey_HOME;
+ case Common::KEYCODE_END:
+ return eKey_END;
+ case Common::KEYCODE_PAGEUP:
+ return eKey_PAGEUP;
+ case Common::KEYCODE_PAGEDOWN:
+ return eKey_PAGEDOWN;
+ case Common::KEYCODE_F1:
+ return eKey_F1;
+ case Common::KEYCODE_F2:
+ return eKey_F2;
+ case Common::KEYCODE_F3:
+ return eKey_F3;
+ case Common::KEYCODE_F4:
+ return eKey_F4;
+ case Common::KEYCODE_F5:
+ return eKey_F5;
+ case Common::KEYCODE_F6:
+ return eKey_F6;
+ case Common::KEYCODE_F7:
+ return eKey_F7;
+ case Common::KEYCODE_F8:
+ return eKey_F8;
+ case Common::KEYCODE_F9:
+ return eKey_F9;
+ case Common::KEYCODE_F10:
+ return eKey_F10;
+ case Common::KEYCODE_F11:
+ return eKey_F11;
+ case Common::KEYCODE_F12:
+ return eKey_F12;
+ case Common::KEYCODE_F13:
+ return eKey_F13;
+ case Common::KEYCODE_F14:
+ return eKey_F14;
+ case Common::KEYCODE_F15:
+ return eKey_F15;
+ case Common::KEYCODE_NUMLOCK:
+ return eKey_NUMLOCK;
+ case Common::KEYCODE_CAPSLOCK:
+ return eKey_CAPSLOCK;
+ case Common::KEYCODE_SCROLLOCK:
+ return eKey_SCROLLOCK;
+ case Common::KEYCODE_RSHIFT:
+ return eKey_RSHIFT;
+ case Common::KEYCODE_LSHIFT:
+ return eKey_LSHIFT;
+ case Common::KEYCODE_RCTRL:
+ return eKey_RCTRL;
+ case Common::KEYCODE_LCTRL:
+ return eKey_LCTRL;
+ case Common::KEYCODE_RALT:
+ return eKey_RALT;
+ case Common::KEYCODE_LALT:
+ return eKey_LALT;
+ case Common::KEYCODE_RMETA:
+ return eKey_RMETA;
+ case Common::KEYCODE_LMETA:
+ return eKey_LMETA;
+ case Common::KEYCODE_LSUPER:
+ return eKey_LSUPER;
+ case Common::KEYCODE_RSUPER:
+ return eKey_RSUPER;
+ case Common::KEYCODE_MODE:
+ return eKey_MODE;
+ case Common::KEYCODE_HELP:
+ return eKey_HELP;
+ case Common::KEYCODE_PRINT:
+ return eKey_PRINT;
+ case Common::KEYCODE_SYSREQ:
+ return eKey_SYSREQ;
+ case Common::KEYCODE_BREAK:
+ return eKey_BREAK;
+ case Common::KEYCODE_MENU:
+ return eKey_MENU;
+ case Common::KEYCODE_POWER:
+ return eKey_POWER;
+ case Common::KEYCODE_EURO:
+ return eKey_EURO;
+ }
+ return eKey_NONE;
+}
- if(pEvent->type == SDL_KEYDOWN)
- {
- int sdl_mod = pEvent->key.keysym.mod;
- mModifier = eKeyModifier_NONE;
+static eKeyModifier convertModifiers(const int mods) {
+ eKeyModifier out = eKeyModifier_NONE;
+ if (mods & Common::KBD_CTRL)
+ out |= eKeyModifier_CTRL;
+ if (mods & Common::KBD_SHIFT)
+ out |= eKeyModifier_SHIFT;
+ if (mods & Common::KBD_ALT)
+ out |= eKeyModifier_ALT;
+ if (mods & Common::KBD_META)
+ out |= eKeyModifier_META;
+ return out;
+}
- if(sdl_mod & KMOD_CTRL) mModifier |= eKeyModifier_CTRL;
- if(sdl_mod & KMOD_SHIFT) mModifier |= eKeyModifier_SHIFT;
- if(sdl_mod & KMOD_ALT) mModifier |= eKeyModifier_ALT;
- if(sdl_mod & KMOD_META) mModifier |= eKeyModifier_META;
+void cKeyboardSDL::processEvent(const Common::Event &ev) {
+ if (ev.type != Common::EVENT_KEYDOWN && ev.type != Common::EVENT_KEYUP)
+ return;
- mlstKeysPressed.push_back(cKeyPress(key,pEvent->key.keysym.unicode,mModifier));
+ eKey key = convertKey(ev.kbd.keycode);
+ if (ev.type == Common::EVENT_KEYDOWN) {
+ _downKeys.set(key);
+ _modifiers = convertModifiers(ev.kbd.flags);
+ _pressedKeys.push(cKeyPress(key, ev.kbd.ascii, _modifiers));
+ }
+ else
+ _downKeys.unset(key);
+}
- //if(mlstKeysPressed.size()>MAX_KEY_PRESSES) mlstKeysPressed.pop_front();
- }
- }
-#endif
+void cKeyboardSDL::Update() {
+ _pressedKeys.clear();
+ for (const Common::Event &ev : _lowLevelSystem->_events)
+ processEvent(ev);
}
//-----------------------------------------------------------------------
-bool cKeyboardSDL::KeyIsDown(eKey aKey) {
- return mvKeyArray[aKey];
+bool cKeyboardSDL::KeyIsDown(eKey key) {
+ return _downKeys.get(key);
}
//-----------------------------------------------------------------------
cKeyPress cKeyboardSDL::GetKey() {
- cKeyPress key = mlstKeysPressed.front();
- mlstKeysPressed.pop_front();
- return key;
+ return _pressedKeys.pop();
}
//-----------------------------------------------------------------------
bool cKeyboardSDL::KeyIsPressed() {
- return mlstKeysPressed.empty() == false;
+ return _pressedKeys.empty() == false;
}
//-----------------------------------------------------------------------
eKeyModifier cKeyboardSDL::GetModifier() {
- return mModifier;
+ return _modifiers;
}
//-----------------------------------------------------------------------
@@ -135,162 +386,4 @@ eKey cKeyboardSDL::StringToKey(tString) {
//-----------------------------------------------------------------------
-/////////////////////////////////////////////////////////////////////////
-// PRIVATE METHODS
-/////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-eKey cKeyboardSDL::SDLToKey(int alKey) {
-#if 0
- switch(alKey)
- {
- case SDLK_BACKSPACE: return eKey_BACKSPACE;
- case SDLK_TAB:return eKey_TAB;
- case SDLK_CLEAR: return eKey_CLEAR;
- case SDLK_RETURN: return eKey_RETURN;
- case SDLK_PAUSE: return eKey_PAUSE;
- case SDLK_ESCAPE: return eKey_ESCAPE;
- case SDLK_SPACE: return eKey_SPACE;
- case SDLK_EXCLAIM: return eKey_EXCLAIM;
- case SDLK_QUOTEDBL: return eKey_QUOTEDBL;
- case SDLK_HASH: return eKey_HASH;
- case SDLK_DOLLAR: return eKey_DOLLAR;
- case SDLK_AMPERSAND: return eKey_AMPERSAND;
- case SDLK_QUOTE: return eKey_QUOTE;
- case SDLK_LEFTPAREN: return eKey_LEFTPAREN;
- case SDLK_RIGHTPAREN: return eKey_RIGHTPAREN;
- case SDLK_ASTERISK: return eKey_ASTERISK;
- case SDLK_PLUS: return eKey_PLUS;
- case SDLK_COMMA: return eKey_COMMA;
- case SDLK_MINUS: return eKey_MINUS;
- case SDLK_PERIOD: return eKey_PERIOD;
- case SDLK_SLASH: return eKey_SLASH;
- case SDLK_0: return eKey_0;
- case SDLK_1: return eKey_1;
- case SDLK_2: return eKey_2;
- case SDLK_3: return eKey_3;
- case SDLK_4: return eKey_4;
- case SDLK_5: return eKey_5;
- case SDLK_6: return eKey_6;
- case SDLK_7: return eKey_7;
- case SDLK_8: return eKey_8;
- case SDLK_9: return eKey_9;
- case SDLK_COLON: return eKey_COLON;
- case SDLK_SEMICOLON: return eKey_SEMICOLON;
- case SDLK_LESS: return eKey_LESS;
- case SDLK_EQUALS: return eKey_EQUALS;
- case SDLK_GREATER: return eKey_GREATER;
- case SDLK_QUESTION: return eKey_QUESTION;
- case SDLK_AT: return eKey_AT;
- case SDLK_LEFTBRACKET: return eKey_LEFTBRACKET;
- case SDLK_BACKSLASH: return eKey_BACKSLASH;
- case SDLK_RIGHTBRACKET: return eKey_RIGHTBRACKET;
- case SDLK_CARET: return eKey_CARET;
- case SDLK_UNDERSCORE: return eKey_UNDERSCORE;
- case SDLK_BACKQUOTE: return eKey_BACKQUOTE;
- case SDLK_a: return eKey_a;
- case SDLK_b: return eKey_b;
- case SDLK_c: return eKey_c;
- case SDLK_d: return eKey_d;
- case SDLK_e: return eKey_e;
- case SDLK_f: return eKey_f;
- case SDLK_g: return eKey_g;
- case SDLK_h: return eKey_h;
- case SDLK_i: return eKey_i;
- case SDLK_j: return eKey_j;
- case SDLK_k: return eKey_k;
- case SDLK_l: return eKey_l;
- case SDLK_m: return eKey_m;
- case SDLK_n: return eKey_n;
- case SDLK_o: return eKey_o;
- case SDLK_p: return eKey_p;
- case SDLK_q: return eKey_q;
- case SDLK_r: return eKey_r;
- case SDLK_s: return eKey_s;
- case SDLK_t: return eKey_t;
- case SDLK_u: return eKey_u;
- case SDLK_v: return eKey_v;
- case SDLK_w: return eKey_w;
- case SDLK_x: return eKey_x;
- case SDLK_y: return eKey_y;
- case SDLK_z: return eKey_z;
- case SDLK_DELETE: return eKey_DELETE;
- case SDLK_KP0: return eKey_KP0;
- case SDLK_KP1: return eKey_KP1;
- case SDLK_KP2: return eKey_KP2;
- case SDLK_KP3: return eKey_KP3;
- case SDLK_KP4: return eKey_KP4;
- case SDLK_KP5: return eKey_KP5;
- case SDLK_KP6: return eKey_KP6;
- case SDLK_KP7: return eKey_KP7;
- case SDLK_KP8: return eKey_KP8;
- case SDLK_KP9: return eKey_KP9;
- case SDLK_KP_PERIOD: return eKey_KP_PERIOD;
- case SDLK_KP_DIVIDE: return eKey_KP_DIVIDE;
- case SDLK_KP_MULTIPLY: return eKey_KP_MULTIPLY;
- case SDLK_KP_MINUS: return eKey_KP_MINUS;
- case SDLK_KP_PLUS: return eKey_KP_PLUS;
- case SDLK_KP_ENTER: return eKey_KP_ENTER;
- case SDLK_KP_EQUALS: return eKey_KP_EQUALS;
- case SDLK_UP: return eKey_UP;
- case SDLK_DOWN: return eKey_DOWN;
- case SDLK_RIGHT: return eKey_RIGHT;
- case SDLK_LEFT: return eKey_LEFT;
- case SDLK_INSERT: return eKey_INSERT;
- case SDLK_HOME: return eKey_HOME;
- case SDLK_END: return eKey_END;
- case SDLK_PAGEUP: return eKey_PAGEUP;
- case SDLK_PAGEDOWN: return eKey_PAGEDOWN;
- case SDLK_F1: return eKey_F1;
- case SDLK_F2: return eKey_F2;
- case SDLK_F3: return eKey_F3;
- case SDLK_F4: return eKey_F4;
- case SDLK_F5: return eKey_F5;
- case SDLK_F6: return eKey_F6;
- case SDLK_F7: return eKey_F7;
- case SDLK_F8: return eKey_F8;
- case SDLK_F9: return eKey_F9;
- case SDLK_F10: return eKey_F10;
- case SDLK_F11: return eKey_F11;
- case SDLK_F12: return eKey_F12;
- case SDLK_F13: return eKey_F13;
- case SDLK_F14: return eKey_F14;
- case SDLK_F15: return eKey_F15;
- case SDLK_NUMLOCK: return eKey_NUMLOCK;
- case SDLK_CAPSLOCK: return eKey_CAPSLOCK;
- case SDLK_SCROLLOCK: return eKey_SCROLLOCK;
- case SDLK_RSHIFT: return eKey_RSHIFT;
- case SDLK_LSHIFT: return eKey_LSHIFT;
- case SDLK_RCTRL: return eKey_RCTRL;
- case SDLK_LCTRL: return eKey_LCTRL;
- case SDLK_RALT: return eKey_RALT;
- case SDLK_LALT: return eKey_LALT;
- case SDLK_RMETA: return eKey_RMETA;
- case SDLK_LMETA: return eKey_LMETA;
- case SDLK_LSUPER: return eKey_LSUPER;
- case SDLK_RSUPER: return eKey_RSUPER;
- case SDLK_MODE: return eKey_MODE;
- case SDLK_HELP: return eKey_HELP;
- case SDLK_PRINT: return eKey_PRINT;
- case SDLK_SYSREQ: return eKey_SYSREQ;
- case SDLK_BREAK: return eKey_BREAK;
- case SDLK_MENU: return eKey_MENU;
- case SDLK_POWER: return eKey_POWER;
- case SDLK_EURO: return eKey_EURO;
-
- }
-#endif
-
- return eKey_NONE;
-}
-
-//-----------------------------------------------------------------------
-
-void cKeyboardSDL::ClearKeyList() {
- mvKeyArray.assign(mvKeyArray.size(), false);
-}
-
-//-----------------------------------------------------------------------
-
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/KeyboardSDL.h b/engines/hpl1/engine/impl/KeyboardSDL.h
index dc426812fef..e6e34ac733f 100644
--- a/engines/hpl1/engine/impl/KeyboardSDL.h
+++ b/engines/hpl1/engine/impl/KeyboardSDL.h
@@ -30,8 +30,14 @@
#include "hpl1/engine/input/Keyboard.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <list>
-#include <vector>
+#include "common/bitarray.h"
+#include "common/queue.h"
+
+namespace Common {
+
+class Event;
+
+}
namespace hpl {
@@ -54,16 +60,13 @@ public:
eKey StringToKey(tString);
private:
- eKey SDLToKey(int alKey);
- void ClearKeyList();
+ void processEvent(const Common::Event &ev);
eKey AsciiToKey(int alChar);
- eKeyModifier mModifier;
-
- std::vector<bool> mvKeyArray;
-
- std::list<cKeyPress> mlstKeysPressed;
- cLowLevelInputSDL *mpLowLevelInputSDL;
+ eKeyModifier _modifiers;
+ Common::BitArray _downKeys;
+ Common::Queue<cKeyPress> _pressedKeys;
+ cLowLevelInputSDL *_lowLevelSystem;
};
}; // namespace hpl
Commit: 00a968fc8c1c9c9fa1593a5a408f9a1ff7d09345
https://github.com/scummvm/scummvm/commit/00a968fc8c1c9c9fa1593a5a408f9a1ff7d09345
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:36+01:00
Commit Message:
HPL1: get input to work
Changed paths:
engines/hpl1/engine/game/Game.cpp
engines/hpl1/engine/input/ActionKeyboard.cpp
engines/hpl1/engine/input/ActionMouseButton.cpp
engines/hpl1/engine/input/Input.cpp
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index bd2508d029d..e7db07e504e 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -436,13 +436,6 @@ void cGame::Run() {
// Log("----\nCreations made: %d\n------\n",cMemoryManager::GetCreationCount());
//}
- // FIXME: TODO: Remove once events are being processed
- Common::Event event;
-
- g_system->getEventManager()->pollEvent(event);
- if (event.type == Common::EVENT_QUIT)
- break;
-
g_system->delayMillis(10);
}
Log("--------------------------------------------------------\n\n");
diff --git a/engines/hpl1/engine/input/ActionKeyboard.cpp b/engines/hpl1/engine/input/ActionKeyboard.cpp
index e6dc45aaa52..f2927539e10 100644
--- a/engines/hpl1/engine/input/ActionKeyboard.cpp
+++ b/engines/hpl1/engine/input/ActionKeyboard.cpp
@@ -53,11 +53,8 @@ cActionKeyboard::cActionKeyboard(tString asName, cInput *apInput, int aKey) : iA
//-----------------------------------------------------------------------
bool cActionKeyboard::IsTriggerd() {
-#if 0
return mpInput->GetKeyboard()->KeyIsDown(mKey) &&
((mpInput->GetKeyboard()->GetModifier() & mMod) > 0 || mMod == eKeyModifier_NONE);
-#endif
- return false;
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/input/ActionMouseButton.cpp b/engines/hpl1/engine/input/ActionMouseButton.cpp
index a98746a42d4..e70d3f0d189 100644
--- a/engines/hpl1/engine/input/ActionMouseButton.cpp
+++ b/engines/hpl1/engine/input/ActionMouseButton.cpp
@@ -50,11 +50,7 @@ cActionMouseButton::cActionMouseButton(tString asName, cInput *apInput, eMButton
//-----------------------------------------------------------------------
bool cActionMouseButton::IsTriggerd() {
-#if 0
return mpInput->GetMouse()->ButtonIsDown(mButton);
-#endif
- return false;
-
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/input/Input.cpp b/engines/hpl1/engine/input/Input.cpp
index c6e295d2038..d5b5a8065b1 100644
--- a/engines/hpl1/engine/input/Input.cpp
+++ b/engines/hpl1/engine/input/Input.cpp
@@ -76,7 +76,6 @@ cInput::~cInput() {
//-----------------------------------------------------------------------
void cInput::Update(float afTimeStep) {
-#if 0
mpLowLevelInput->BeginInputUpdate();
for (tInputDeviceListIt it = mlstInputDevices.begin(); it != mlstInputDevices.end(); ++it) {
@@ -88,7 +87,6 @@ void cInput::Update(float afTimeStep) {
for (tActionMapIt it = m_mapActions.begin(); it != m_mapActions.end(); ++it) {
it->second->Update(afTimeStep);
}
-#endif
}
//-----------------------------------------------------------------------
Commit: 0c97cf038698978be0c3f9a3d9b15783059687a0
https://github.com/scummvm/scummvm/commit/0c97cf038698978be0c3f9a3d9b15783059687a0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:36+01:00
Commit Message:
HPL1: Fix warnings
Changed paths:
engines/hpl1/engine/impl/KeyboardSDL.h
engines/hpl1/engine/impl/MouseSDL.h
diff --git a/engines/hpl1/engine/impl/KeyboardSDL.h b/engines/hpl1/engine/impl/KeyboardSDL.h
index e6e34ac733f..bc7beb512f2 100644
--- a/engines/hpl1/engine/impl/KeyboardSDL.h
+++ b/engines/hpl1/engine/impl/KeyboardSDL.h
@@ -35,7 +35,7 @@
namespace Common {
-class Event;
+struct Event;
}
diff --git a/engines/hpl1/engine/impl/MouseSDL.h b/engines/hpl1/engine/impl/MouseSDL.h
index 2470d249274..7219c23afb8 100644
--- a/engines/hpl1/engine/impl/MouseSDL.h
+++ b/engines/hpl1/engine/impl/MouseSDL.h
@@ -32,7 +32,7 @@
#include "common/bitarray.h"
namespace Common {
- class Event;
+struct Event;
}
namespace hpl {
Commit: e5d9d4cc69cb9728cc2d4abb30711b1be8395e5e
https://github.com/scummvm/scummvm/commit/e5d9d4cc69cb9728cc2d4abb30711b1be8395e5e
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:36+01:00
Commit Message:
HPL1: add utilities to vector3 class
Changed paths:
engines/hpl1/engine/math/Vector3.h
diff --git a/engines/hpl1/engine/math/Vector3.h b/engines/hpl1/engine/math/Vector3.h
index f652ea861c4..af1fe7a7998 100644
--- a/engines/hpl1/engine/math/Vector3.h
+++ b/engines/hpl1/engine/math/Vector3.h
@@ -31,23 +31,15 @@
#include "Vector2.h"
#include <math.h>
+#define VEC3_CONST_ARRAY(name, vec) const float name[] = {vec.x, vec.y, vec.z}
+
namespace hpl {
template<class T>
class cVector3 {
public:
T x, y, z;
-#if 0
- union{
- struct {
- T x,y,z;
- };
- T v[3];
- };
-#endif
- //////////////////////////////////////////
- // Constructors
- /////////////////////////////////////////
+
cVector3() {
x = 0;
y = 0;
@@ -76,6 +68,10 @@ public:
z = 0;
}
+ static cVector3 fromArray(const float vec[3]) {
+ return cVector3<T>(vec[0], vec[1], vec[2]);
+ }
+
//////////////////////////////////////////
// Copy
/////////////////////////////////////////
Commit: b412b8fbfc1482be47a0d4c8966c59c4bb4c7aaa
https://github.com/scummvm/scummvm/commit/b412b8fbfc1482be47a0d4c8966c59c4bb4c7aaa
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:36+01:00
Commit Message:
HPL1: replace newton library header
Changed paths:
engines/hpl1/engine/libraries/newton/Newton.h
diff --git a/engines/hpl1/engine/libraries/newton/Newton.h b/engines/hpl1/engine/libraries/newton/Newton.h
index ab85cba99b8..9dbef0a37d2 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.h
+++ b/engines/hpl1/engine/libraries/newton/Newton.h
@@ -1,30 +1,30 @@
/* Copyright (c) <2003-2011> <Julio Jerez, Newton Game Dynamics>
-*
-* This software is provided 'as-is', without any express or implied
-* warranty. In no event will the authors be held liable for any damages
-* arising from the use of this software.
-*
-* Permission is granted to anyone to use this software for any purpose,
-* including commercial applications, and to alter it and redistribute it
-* freely, subject to the following restrictions:
-*
-* 1. The origin of this software must not be misrepresented; you must not
-* claim that you wrote the original software. If you use this software
-* in a product, an acknowledgment in the product documentation would be
-* appreciated but is not required.
-*
-* 2. Altered source versions must be plainly marked as such, and must not be
-* misrepresented as being the original software.
-*
-* 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef __NEWTON_H__
-#define __NEWTON_H__
-
-
-#define NEWTON_MAJOR_VERSION 3
-#define NEWTON_MINOR_VERSION 13
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source distribution.
+ */
+
+#ifndef __NEWTON_H_INCLUDED__
+#define __NEWTON_H_INCLUDED__
+
+
+#define NEWTON_MAJOR_VERSION 2
+#define NEWTON_MINOR_VERSION 36
#ifdef _NEWTON_STATIC_LIB
@@ -46,1254 +46,1013 @@
#endif
-#ifdef __GNUC__
-# define NEWTON_DEPRECATED_API __attribute__((deprecated))
-#elif defined(_MSC_VER)
-# define NEWTON_DEPRECATED_API __declspec(deprecated)
+#ifdef __USE_DOUBLE_PRECISION__
+ #define dFloat double
#else
-# warning NEWTON_DEPRECATED_API not implemented for this compiler
-# define NEWTON_DEPRECATED_API
+ #define dFloat float
#endif
+#define dFloat64 double
-#ifndef dLong
- #define dLong long long
-#endif
-#ifndef dFloat
- #ifdef _NEWTON_USE_DOUBLE
- #define dFloat double
- #else
- #define dFloat float
- #endif
+#ifdef __cplusplus
+extern "C" {
#endif
-#ifndef dFloat64
- #define dFloat64 double
-#endif
+#define NEWTON_PROFILER_WORLD_UPDATE 0
+
+#define NEWTON_PROFILER_COLLISION_UPDATE 1
+#define NEWTON_PROFILER_COLLISION_UPDATE_BROAD_PHASE 2
+#define NEWTON_PROFILER_COLLISION_UPDATE_NARROW_PHASE 3
+
+#define NEWTON_PROFILER_DYNAMICS_UPDATE 4
+#define NEWTON_PROFILER_DYNAMICS_CONSTRAINT_GRAPH 5
+#define NEWTON_PROFILER_DYNAMICS_SOLVE_CONSTRAINT_GRAPH 6
+
+#define NEWTON_PROFILER_FORCE_CALLBACK_UPDATE 7
+
+
+typedef struct NewtonMesh{} NewtonMesh;
+typedef struct NewtonBody{} NewtonBody;
+typedef struct NewtonWorld{} NewtonWorld;
+typedef struct NewtonJoint{} NewtonJoint;
+typedef struct NewtonMaterial{} NewtonMaterial;
+typedef struct NewtonCollision{} NewtonCollision;
+typedef struct NewtonSceneProxy{} NewtonSceneProxy;
+typedef struct NewtonbreakableComponentMesh{} NewtonbreakableComponentMesh;
+
+// typedef struct NewtonRagDoll{} NewtonRagDoll;
+// typedef struct NewtonRagDollBone{} NewtonRagDollBone;
+
+#define SERIALIZE_ID_BOX 0
+#define SERIALIZE_ID_CONE 1
+#define SERIALIZE_ID_SPHERE 2
+#define SERIALIZE_ID_CAPSULE 3
+#define SERIALIZE_ID_CYLINDER 4
+#define SERIALIZE_ID_COMPOUND 5
+#define SERIALIZE_ID_CONVEXHULL 6
+#define SERIALIZE_ID_CONVEXMODIFIER 7
+#define SERIALIZE_ID_CHAMFERCYLINDER 8
+#define SERIALIZE_ID_TREE 9
+#define SERIALIZE_ID_NULL 10
+#define SERIALIZE_ID_HEIGHTFIELD 11
+#define SERIALIZE_ID_USERMESH 12
+#define SERIALIZE_ID_SCENE 13
+#define SERIALIZE_ID_COMPOUND_BREAKABLE 14
+
+typedef struct NewtonBoxParam NewtonBoxParam;
+typedef struct NewtonConeParam NewtonConeParam;
+typedef struct NewtonSphereParam NewtonSphereParam;
+typedef struct NewtonCapsuleParam NewtonCapsuleParam;
+typedef struct NewtonCylinderParam NewtonCylinderParam;
+typedef struct NewtonConvexHullParam NewtonConvexHullParam;
+typedef struct NewtonCollisionTreeParam NewtonCollisionTreeParam;
+typedef struct NewtonSceneCollisionParam NewtonSceneCollisionParam;
+typedef struct NewtonChamferCylinderParam NewtonChamferCylinderParam;
+typedef struct NewtonCompoundCollisionParam NewtonCompoundCollisionParam;
+typedef struct NewtonConvexHullModifierParam NewtonConvexHullModifierParam;
+typedef struct NewtonHeightFieldCollisionParam NewtonHeightFieldCollisionParam;
+
+typedef struct NewtonCollisionInfoRecord NewtonCollisionInfoRecord;
+
+struct NewtonBoxParam
+{
+ dFloat m_x;
+ dFloat m_y;
+ dFloat m_z;
+};
+
+struct NewtonSphereParam
+{
+ dFloat m_r0;
+ dFloat m_r1;
+ dFloat m_r2;
+};
+
+struct NewtonCylinderParam
+{
+ dFloat m_r0;
+ dFloat m_r1;
+ dFloat m_height;
+};
+
+struct NewtonCapsuleParam
+{
+ dFloat m_r0;
+ dFloat m_r1;
+ dFloat m_height;
+};
+
+struct NewtonConeParam
+{
+ dFloat m_r;
+ dFloat m_height;
+};
+
+struct NewtonChamferCylinderParam
+{
+ dFloat m_r;
+ dFloat m_height;
+};
+
+struct NewtonConvexHullParam
+{
+ int m_vertexCount;
+ int m_vertexStrideInBytes;
+ int m_faceCount;
+ dFloat* m_vertex;
+};
+
+struct NewtonConvexHullModifierParam
+{
+ NewtonCollision* m_chidren;
+};
+
+
+struct NewtonCompoundCollisionParam
+{
+ int m_chidrenCount;
+ NewtonCollision** m_chidren;
+};
+
+struct NewtonCollisionTreeParam
+{
+ int m_vertexCount;
+ int m_indexCount;
+};
+
+struct NewtonHeightFieldCollisionParam
+{
+ int m_width;
+ int m_height;
+ int m_gridsDiagonals;
+ dFloat m_horizonalScale;
+ dFloat m_verticalScale;
+ unsigned short *m_elevation;
+ char *m_atributes;
+};
+
+struct NewtonSceneCollisionParam
+{
+ int m_childrenProxyCount;
+};
+
+struct NewtonCollisionInfoRecord
+{
+ dFloat m_offsetMatrix[4][4];
+ int m_collisionType; // tag id to identify the collision primitive
+ int m_referenceCount; // the current reference count for this collision
+ int m_collisionUserID;
+
+ union {
+ NewtonBoxParam m_box;
+ NewtonConeParam m_cone;
+ NewtonSphereParam m_sphere;
+ NewtonCapsuleParam m_capsule;
+ NewtonCylinderParam m_cylinder;
+ NewtonChamferCylinderParam m_chamferCylinder;
+ NewtonConvexHullParam m_convexHull;
+ NewtonCompoundCollisionParam m_compoundCollision;
+ NewtonConvexHullModifierParam m_convexHullModifier;
+ NewtonCollisionTreeParam m_collisionTree;
+ NewtonHeightFieldCollisionParam m_heightField;
+ NewtonSceneCollisionParam m_sceneCollision;
+ dFloat m_paramArray[64]; // user define collision can use this to store information
+ };
+};
+
+
+typedef struct NewtonJointRecord NewtonJointRecord;
+typedef struct NewtonHingeSliderUpdateDesc NewtonHingeSliderUpdateDesc;
+typedef struct NewtonUserMeshCollisionRayHitDesc NewtonUserMeshCollisionRayHitDesc;
+typedef struct NewtonUserMeshCollisionCollideDesc NewtonUserMeshCollisionCollideDesc;
+typedef struct NewtonWorldConvexCastReturnInfo NewtonWorldConvexCastReturnInfo;
+
+
+struct NewtonJointRecord
+{
+ dFloat m_attachmenMatrix_0[4][4];
+ dFloat m_attachmenMatrix_1[4][4];
+ dFloat m_minLinearDof[3];
+ dFloat m_maxLinearDof[3];
+ dFloat m_minAngularDof[3];
+ dFloat m_maxAngularDof[3];
+ const NewtonBody* m_attachBody_0;
+ const NewtonBody* m_attachBody_1;
+ dFloat m_extraParameters[16];
+ int m_bodiesCollisionOn;
+ char m_descriptionType[32];
+} ;
+
+
+
+struct NewtonUserMeshCollisionCollideDesc
+{
+ dFloat m_boxP0[4]; // lower bounding box of intersection query in local space
+ dFloat m_boxP1[4]; // upper bounding box of intersection query in local space
+ int m_threadNumber; // current thread executing this query
+ int m_faceCount; // the application should set here how many polygons intersect the query box
+ int m_vertexStrideInBytes; // the application should set here the size of each vertex
+ void* m_userData; // user data passed to the collision geometry at creation time
+ dFloat* m_vertex; // the application should the pointer to the vertex array.
+ int* m_userAttribute; // the application should set here the pointer to the user data, one for each face
+ int* m_faceIndexCount; // the application should set here the pointer to the vertex count of each face.
+ int* m_faceVertexIndex; // the application should set here the pointer index array for each vertex on a face.
+ NewtonBody* m_objBody; // pointer to the colliding body
+ NewtonBody* m_polySoupBody; // pointer to the rigid body owner of this collision tree
+};
+
+struct NewtonWorldConvexCastReturnInfo
+{
+ dFloat m_point[4]; // collision point in global space
+ dFloat m_normal[4]; // surface normal at collision point in global space
+ dFloat m_normalOnHitPoint[4]; // surface normal at the surface of the hit body,
+ // is the same as the normal calculated by a ray cast hitting the body at the hit point
+ dFloat m_penetration; // contact penetration at collision point
+ int m_contactID; // collision ID at contact point
+ const NewtonBody* m_hitBody; // body hit at contact point
+};
+
+struct NewtonUserMeshCollisionRayHitDesc
+{
+ dFloat m_p0[4]; // ray origin in collision local space
+ dFloat m_p1[4]; // ray destination in collision local space
+ dFloat m_normalOut[4]; // copy here the normal at the ray intersection
+ int m_userIdOut; // copy here a user defined id for further feedback
+ void* m_userData; // user data passed to the collision geometry at creation time
+};
+
+struct NewtonHingeSliderUpdateDesc
+{
+ dFloat m_accel;
+ dFloat m_minFriction;
+ dFloat m_maxFriction;
+ dFloat m_timestep;
+} ;
+
+
+// Newton callback functions
+typedef void* (*NewtonAllocMemory) (int sizeInBytes);
+typedef void (*NewtonFreeMemory) (void* const ptr, int sizeInBytes);
+typedef void (*NewtonDestroyWorld) (const NewtonWorld* const newtonWorld);
+
+typedef unsigned (*NewtonGetTicksCountCallback) ();
+
+typedef void (*NewtonSerialize) (void* const serializeHandle, const void* buffer, int size);
+typedef void (*NewtonDeserialize) (void* const serializeHandle, void* buffer, int size);
+
+// user collision callbacks
+typedef void (*NewtonUserMeshCollisionDestroyCallback) (void* const userData);
+typedef void (*NewtonUserMeshCollisionCollideCallback) (NewtonUserMeshCollisionCollideDesc* const collideDescData);
+typedef dFloat (*NewtonUserMeshCollisionRayHitCallback) (NewtonUserMeshCollisionRayHitDesc* const lineDescData);
+typedef void (*NewtonUserMeshCollisionGetCollisionInfo) (void* const userData, NewtonCollisionInfoRecord* const infoRecord);
+typedef int (*NewtonUserMeshCollisionGetFacesInAABB) (void* const userData, const dFloat* const p0, const dFloat* const p1,
+ const dFloat** const vertexArray, int* const vertexCount, int* const vertexStrideInBytes,
+ const int* const indexList, int maxIndexCount, const int* const userDataList);
+
+typedef dFloat (*NewtonCollisionTreeRayCastCallback) (const NewtonBody* const body, const NewtonCollision* const treeCollision, dFloat interception, dFloat* normal, int faceId, void* usedData);
+typedef dFloat (*NewtonHeightFieldRayCastCallback) (const NewtonBody* const body, const NewtonCollision* const heightFieldCollision, dFloat interception, int row, int col, dFloat* normal, int faceId, void* usedData);
+
+
+// collision tree call back (obsoleted no recommended)
+typedef void (*NewtonTreeCollisionCallback) (const NewtonBody* const bodyWithTreeCollision, const NewtonBody* const body, int faceID,
+ int vertexCount, const dFloat* const vertex, int vertexStrideInBytes);
+
+typedef void (*NewtonBodyDestructor) (const NewtonBody* const body);
+typedef void (*NewtonApplyForceAndTorque) (const NewtonBody* const body, dFloat timestep, int threadIndex);
+typedef void (*NewtonSetTransform) (const NewtonBody* const body, const dFloat* const matrix, int threadIndex);
+
+typedef int (*NewtonIslandUpdate) (const NewtonWorld* const newtonWorld, const void* islandHandle, int bodyCount);
+typedef void (*NewtonBodyLeaveWorld) (const NewtonBody* const body, int threadIndex);
+typedef void (*NewtonDestroyBodyByExeciveForce) (const NewtonBody* const body, const NewtonJoint* const contact);
+typedef void (*NewtonCollisionDestructor) (const NewtonWorld* const newtonWorld, const NewtonCollision* const collision);
+
+typedef int (*NewtonCollisionCompoundBreakableCallback) (NewtonMesh* const mesh, void* const userData, dFloat* const planeMatrixOut);
+
+typedef int (*NewtonGetBuoyancyPlane) (const int collisionID, void* const context, const dFloat* const globalSpaceMatrix, dFloat* const globalSpacePlane);
+typedef unsigned (*NewtonWorldRayPrefilterCallback)(const NewtonBody* const body, const NewtonCollision* const collision, void* const userData);
+typedef dFloat (*NewtonWorldRayFilterCallback)(const NewtonBody* const body, const dFloat* const hitNormal, int collisionID, void* const userData, dFloat intersectParam);
+
+
+typedef int (*NewtonOnAABBOverlap) (const NewtonMaterial* const material, const NewtonBody* const body0, const NewtonBody* const body1, int threadIndex);
+typedef void (*NewtonContactsProcess) (const NewtonJoint* const contact, dFloat timestep, int threadIndex);
+
+typedef void (*NewtonBodyIterator) (const NewtonBody* const body, void* const userData);
+typedef void (*NewtonJointIterator) (const NewtonJoint* const joint, void* const userData);
+typedef void (*NewtonCollisionIterator) (void* const userData, int vertexCount, const dFloat* const faceArray, int faceId);
+
+typedef void (*NewtonBallCallBack) (const NewtonJoint* const ball, dFloat timestep);
+typedef unsigned (*NewtonHingeCallBack) (const NewtonJoint* const hinge, NewtonHingeSliderUpdateDesc* const desc);
+typedef unsigned (*NewtonSliderCallBack) (const NewtonJoint* const slider, NewtonHingeSliderUpdateDesc* const desc);
+typedef unsigned (*NewtonUniversalCallBack) (const NewtonJoint* const universal, NewtonHingeSliderUpdateDesc* const desc);
+typedef unsigned (*NewtonCorkscrewCallBack) (const NewtonJoint* const corkscrew, NewtonHingeSliderUpdateDesc* const desc);
+
+typedef void (*NewtonUserBilateralCallBack) (const NewtonJoint* const userJoint, dFloat timestep, int threadIndex);
+typedef void (*NewtonUserBilateralGetInfoCallBack) (const NewtonJoint* const userJoint, NewtonJointRecord* const info);
+
+typedef void (*NewtonConstraintDestructor) (const NewtonJoint*const me);
+
+// typedef void (*NewtonSetRagDollTransform) (const NewtonRagDollBone* const bone);
+// typedef void (*NewtonBodyActivationState) (const NewtonBody* const body, unsigned state);
+// typedef void (*NewtonVehicleTireUpdate) (const NewtonJoint* const vehicle, dFloat timestep);
+
+
+// **********************************************************************************************
+//
+// world control functions
+//
+// **********************************************************************************************
+NEWTON_API int NewtonWorldGetVersion ();
+NEWTON_API int NewtonWorldFloatSize ();
+
+NEWTON_API int NewtonGetMemoryUsed ();
+NEWTON_API void NewtonSetMemorySystem (NewtonAllocMemory malloc, NewtonFreeMemory mfree);
+
+NEWTON_API NewtonWorld* NewtonCreate ();
+NEWTON_API void NewtonDestroy (const NewtonWorld* const newtonWorld);
+NEWTON_API void NewtonDestroyAllBodies (const NewtonWorld* const newtonWorld);
+NEWTON_API void NewtonUpdate (const NewtonWorld* const newtonWorld, dFloat timestep);
+NEWTON_API void NewtonInvalidateCache (const NewtonWorld* const newtonWorld);
+NEWTON_API void NewtonCollisionUpdate (const NewtonWorld* const newtonWorld);
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- #define NEWTON_BROADPHASE_DEFAULT 0
- #define NEWTON_BROADPHASE_PERSINTENT 1
-
- #define NEWTON_DYNAMIC_BODY 0
- #define NEWTON_KINEMATIC_BODY 1
- #define NEWTON_DEFORMABLE_BODY 2
-
- #define SERIALIZE_ID_SPHERE 0
- #define SERIALIZE_ID_CAPSULE 1
- #define SERIALIZE_ID_CHAMFERCYLINDER 2
- #define SERIALIZE_ID_TAPEREDCAPSULE 3
- #define SERIALIZE_ID_CYLINDER 4
- #define SERIALIZE_ID_TAPEREDCYLINDER 5
- #define SERIALIZE_ID_BOX 6
- #define SERIALIZE_ID_CONE 7
- #define SERIALIZE_ID_CONVEXHULL 8
- #define SERIALIZE_ID_NULL 9
- #define SERIALIZE_ID_COMPOUND 10
- #define SERIALIZE_ID_TREE 11
- #define SERIALIZE_ID_HEIGHTFIELD 12
- #define SERIALIZE_ID_CLOTH_PATCH 13
- #define SERIALIZE_ID_DEFORMABLE_SOLID 14
- #define SERIALIZE_ID_USERMESH 15
- #define SERIALIZE_ID_SCENE 16
- #define SERIALIZE_ID_FRACTURED_COMPOUND 17
+NEWTON_API void NewtonSetSolverModel (const NewtonWorld* const newtonWorld, int model);
+NEWTON_API void NewtonSetPlatformArchitecture (const NewtonWorld* const newtonWorld, int mode);
+NEWTON_API int NewtonGetPlatformArchitecture(const NewtonWorld* const newtonWorld, char* description);
+NEWTON_API void NewtonSetMultiThreadSolverOnSingleIsland (const NewtonWorld* const newtonWorld, int mode);
+NEWTON_API int NewtonGetMultiThreadSolverOnSingleIsland (const NewtonWorld* const newtonWorld);
-#ifdef __cplusplus
- class NewtonMesh;
- class NewtonBody;
- class NewtonWorld;
- class NewtonJoint;
- class NewtonMaterial;
- class NewtonCollision;
- class NewtonAcyclicArticulation;
- class NewtonDeformableMeshSegment;
- class NewtonFracturedCompoundMeshPart;
-#else
- typedef struct NewtonMesh{} NewtonMesh;
- typedef struct NewtonBody{} NewtonBody;
- typedef struct NewtonWorld{} NewtonWorld;
- typedef struct NewtonJoint{} NewtonJoint;
- typedef struct NewtonMaterial{} NewtonMaterial;
- typedef struct NewtonCollision{} NewtonCollision;
- typedef struct NewtonAcyclicArticulation{} NewtonAcyclicArticulation;
- typedef struct NewtonDeformableMeshSegment{} NewtonDeformableMeshSegment;
- typedef struct NewtonFracturedCompoundMeshPart{} NewtonFracturedCompoundMeshPart;
-#endif
+NEWTON_API void NewtonSetPerformanceClock (const NewtonWorld* const newtonWorld, NewtonGetTicksCountCallback callback);
+NEWTON_API unsigned NewtonReadPerformanceTicks (const NewtonWorld* const newtonWorld, unsigned performanceEntry);
+NEWTON_API unsigned NewtonReadThreadPerformanceTicks (const NewtonWorld* newtonWorld, unsigned threadIndex);
+
+NEWTON_API void NewtonWorldCriticalSectionLock (const NewtonWorld* const newtonWorld);
+NEWTON_API void NewtonWorldCriticalSectionUnlock (const NewtonWorld* const newtonWorld);
+NEWTON_API void NewtonSetThreadsCount (const NewtonWorld* const newtonWorld, int threads);
+NEWTON_API int NewtonGetThreadsCount(const NewtonWorld* const newtonWorld);
+NEWTON_API int NewtonGetMaxThreadsCount(const NewtonWorld* const newtonWorld);
+NEWTON_API void NewtonSetFrictionModel (const NewtonWorld* const newtonWorld, int model);
+NEWTON_API void NewtonSetMinimumFrameRate (const NewtonWorld* const newtonWorld, dFloat frameRate);
+NEWTON_API void NewtonSetBodyLeaveWorldEvent (const NewtonWorld* const newtonWorld, NewtonBodyLeaveWorld callback);
+NEWTON_API void NewtonSetWorldSize (const NewtonWorld* const newtonWorld, const dFloat* const minPoint, const dFloat* const maxPoint);
+NEWTON_API void NewtonSetIslandUpdateEvent (const NewtonWorld* const newtonWorld, NewtonIslandUpdate islandUpdate);
+NEWTON_API void NewtonSetCollisionDestructor (const NewtonWorld* const newtonWorld, NewtonCollisionDestructor callback);
+NEWTON_API void NewtonSetDestroyBodyByExeciveForce (const NewtonWorld* const newtonWorld, NewtonDestroyBodyByExeciveForce callback);
- typedef struct NewtonBoxParam
- {
- dFloat m_x;
- dFloat m_y;
- dFloat m_z;
- } NewtonBoxParam;
-
- typedef struct NewtonSphereParam
- {
- dFloat m_radio;
- } NewtonSphereParam;
-
- typedef struct NewtonCylinderParam
- {
- dFloat m_radio;
- dFloat m_height;
- } NewtonCylinderParam;
-
- typedef struct NewtonCapsuleParam
- {
- dFloat m_radio;
- dFloat m_height;
- } NewtonCapsuleParam;
-
- typedef struct NewtonConeParam
- {
- dFloat m_radio;
- dFloat m_height;
- } NewtonConeParam;
-
- typedef struct NewtonTaperedCapsuleParam
- {
- dFloat m_radio0;
- dFloat m_radio1;
- dFloat m_height;
- } NewtonTaperedCapsuleParam;
-
-
- typedef struct NewtonTaperedCylinderParam
- {
- dFloat m_radio0;
- dFloat m_radio1;
- dFloat m_height;
- } NewtonTaperedCylinderParam;
-
- typedef struct NewtonChamferCylinderParam
- {
- dFloat m_radio;
- dFloat m_height;
- } NewtonChamferCylinderParam;
-
- typedef struct NewtonConvexHullParam
- {
- int m_vertexCount;
- int m_vertexStrideInBytes;
- int m_faceCount;
- dFloat* m_vertex;
- } NewtonConvexHullParam;
-
- typedef struct NewtonCompoundCollisionParam
- {
- int m_chidrenCount;
- } NewtonCompoundCollisionParam;
-
- typedef struct NewtonCollisionTreeParam
- {
- int m_vertexCount;
- int m_indexCount;
- } NewtonCollisionTreeParam;
-
- typedef struct NewtonDeformableMeshParam
- {
- int m_vertexCount;
- int m_triangleCount;
- int m_vrtexStrideInBytes;
- unsigned short *m_indexList;
- dFloat *m_vertexList;
- } NewtonDeformableMeshParam;
-
- typedef struct NewtonHeightFieldCollisionParam
- {
- int m_width;
- int m_height;
- int m_gridsDiagonals;
- int m_elevationDataType; // 0 = 32 bit floats, 1 = unsigned 16 bit integers
- dFloat m_horizonalScale;
- dFloat m_verticalScale;
- void* m_elevation;
- char* m_atributes;
- } NewtonHeightFieldCollisionParam;
-
- typedef struct NewtonSceneCollisionParam
- {
- int m_childrenProxyCount;
- } NewtonSceneCollisionParam;
-
- typedef struct NewtonCollisionInfoRecord
- {
- dFloat m_offsetMatrix[4][4];
- int m_collisionType; // tag id to identify the collision primitive
- int m_collisionUserID;
-
- union {
- NewtonBoxParam m_box;
- NewtonConeParam m_cone;
- NewtonSphereParam m_sphere;
- NewtonCapsuleParam m_capsule;
- NewtonCylinderParam m_cylinder;
- NewtonTaperedCapsuleParam m_taperedCapsule;
- NewtonTaperedCylinderParam m_taperedCylinder;
- NewtonChamferCylinderParam m_chamferCylinder;
- NewtonConvexHullParam m_convexHull;
- NewtonDeformableMeshParam m_deformableMesh;
- NewtonCompoundCollisionParam m_compoundCollision;
- NewtonCollisionTreeParam m_collisionTree;
- NewtonHeightFieldCollisionParam m_heightField;
- NewtonSceneCollisionParam m_sceneCollision;
- dFloat m_paramArray[64]; // user define collision can use this to store information
- };
- } NewtonCollisionInfoRecord;
-
- typedef struct NewtonJointRecord
- {
- dFloat m_attachmenMatrix_0[4][4];
- dFloat m_attachmenMatrix_1[4][4];
- dFloat m_minLinearDof[3];
- dFloat m_maxLinearDof[3];
- dFloat m_minAngularDof[3];
- dFloat m_maxAngularDof[3];
- const NewtonBody* m_attachBody_0;
- const NewtonBody* m_attachBody_1;
- dFloat m_extraParameters[64];
- int m_bodiesCollisionOn;
- char m_descriptionType[128];
- } NewtonJointRecord;
-
- typedef struct NewtonUserMeshCollisionCollideDesc
- {
- dFloat m_boxP0[4]; // lower bounding box of intersection query in local space
- dFloat m_boxP1[4]; // upper bounding box of intersection query in local space
- dFloat m_boxDistanceTravel[4]; // max distance that box bpxP0 and boxP1 can travel on this timestep, used this for continue collision mode.
- int m_threadNumber; // current thread executing this query
- int m_faceCount; // the application should set here how many polygons intersect the query box
- int m_vertexStrideInBytes; // the application should set here the size of each vertex
- dFloat m_skinThickness; // this is the minimum skin separation specified by the material between these two colliding shapes
- void* m_userData; // user data passed to the collision geometry at creation time
-
- NewtonBody* m_objBody; // pointer to the colliding body
- NewtonBody* m_polySoupBody; // pointer to the rigid body owner of this collision tree
- NewtonCollision* m_objCollision; // collision shape of the colliding body, (no necessarily the collision of m_objBody)
- NewtonCollision* m_polySoupCollision; // collision shape of the collision tree, (no necessarily the collision of m_polySoupBody)
-
- dFloat* m_vertex; // the application should set here the pointer to the global vertex of the mesh.
- int* m_faceIndexCount; // the application should set here the pointer to the vertex count of each face.
- int* m_faceVertexIndex; // the application should set here the pointer index array for each vertex on a face.
- // the format of a face is I0, I1, I2, I3, ..., M, N, E0, E1, E2, ..., A
- // I0, I1, I2, .. are the indices to the vertex, relative to m_vertex pointer
- // M is the index to the material sub shape id
- // N in the index to the vertex normal relative to m_vertex pointer
- // E0, E1, E2, ... are the indices of the the face normal that is shared to that face edge, when the edge does not share a face normal then the edge index is set to index N, which the index to the face normal
- // A is and estimate of the largest diagonal of the face, this used internally as a hint to improve floating point accuracy and algorithm performance.
- } NewtonUserMeshCollisionCollideDesc;
-
- typedef struct NewtonWorldConvexCastReturnInfo
- {
- dFloat m_point[4]; // collision point in global space
- dFloat m_normal[4]; // surface normal at collision point in global space
- //dFloat m_normalOnHitPoint[4]; // surface normal at the surface of the hit body,
- // is the same as the normal calculated by a ray cast hitting the body at the hit point
- dLong m_contactID; // collision ID at contact point
- const NewtonBody* m_hitBody; // body hit at contact point
- dFloat m_penetration; // contact penetration at collision point
- } NewtonWorldConvexCastReturnInfo;
-
- typedef struct NewtonUserMeshCollisionRayHitDesc
- {
- dFloat m_p0[4]; // ray origin in collision local space
- dFloat m_p1[4]; // ray destination in collision local space
- dFloat m_normalOut[4]; // copy here the normal at the ray intersection
- dLong m_userIdOut; // copy here a user defined id for further feedback
- void* m_userData; // user data passed to the collision geometry at creation time
- } NewtonUserMeshCollisionRayHitDesc;
-
- typedef struct NewtonHingeSliderUpdateDesc
- {
- dFloat m_accel;
- dFloat m_minFriction;
- dFloat m_maxFriction;
- dFloat m_timestep;
- } NewtonHingeSliderUpdateDesc;
-
- typedef struct NewtonClothPatchMaterial
- {
- dFloat m_damper;
- dFloat m_stiffness;
- } NewtonClothPatchMaterial;
-
-
- // Newton callback functions
- typedef void* (*NewtonAllocMemory) (int sizeInBytes);
- typedef void (*NewtonFreeMemory) (void* const ptr, int sizeInBytes);
-
-
- typedef void (*NewtonWorldDestructorCallback) (const NewtonWorld* const world);
-
- typedef void (*NewtonWorldListenerBodyDestroyCallback) (const NewtonWorld* const world, void* const listenerUserData, NewtonBody* const body);
- typedef void (*NewtonWorldUpdateListenerCallback) (const NewtonWorld* const world, void* const listenerUserData, dFloat timestep);
- typedef void (*NewtonWorldDestroyListenerCallback) (const NewtonWorld* const world, void* const listenerUserData);
-
- typedef unsigned (*NewtonGetTicksCountCallback) ();
-
- typedef void (*NewtonSerializeCallback) (void* const serializeHandle, const void* const buffer, int size);
- typedef void (*NewtonDeserializeCallback) (void* const serializeHandle, void* const buffer, int size);
-
- typedef void (*NewtonOnBodySerializationCallback) (NewtonBody* const body, void* const userData, NewtonSerializeCallback function, void* const serializeHandle);
- typedef void (*NewtonOnBodyDeserializationCallback) (NewtonBody* const body, void* const userData, NewtonDeserializeCallback function, void* const serializeHandle);
-
- typedef void (*NewtonOnJointSerializationCallback) (const NewtonJoint* const joint, NewtonSerializeCallback function, void* const serializeHandle);
- typedef void (*NewtonOnJointDeserializationCallback) (NewtonBody* const body0, NewtonBody* const body1, NewtonDeserializeCallback function, void* const serializeHandle);
-
- typedef void (*NewtonOnUserCollisionSerializationCallback) (void* const userData, NewtonSerializeCallback function, void* const serializeHandle);
-
- // user collision callbacks
- typedef void (*NewtonUserMeshCollisionDestroyCallback) (void* const userData);
- typedef dFloat (*NewtonUserMeshCollisionRayHitCallback) (NewtonUserMeshCollisionRayHitDesc* const lineDescData);
- typedef void (*NewtonUserMeshCollisionGetCollisionInfo) (void* const userData, NewtonCollisionInfoRecord* const infoRecord);
- typedef int (*NewtonUserMeshCollisionAABBTest) (void* const userData, const dFloat* const boxP0, const dFloat* const boxP1);
- typedef int (*NewtonUserMeshCollisionGetFacesInAABB) (void* const userData, const dFloat* const p0, const dFloat* const p1,
- const dFloat** const vertexArray, int* const vertexCount, int* const vertexStrideInBytes,
- const int* const indexList, int maxIndexCount, const int* const userDataList);
- typedef void (*NewtonUserMeshCollisionCollideCallback) (NewtonUserMeshCollisionCollideDesc* const collideDescData, const void* const continueCollisionHandle);
-
- typedef int (*NewtonTreeCollisionFaceCallback) (void* const context, const dFloat* const polygon, int strideInBytes, const int* const indexArray, int indexCount);
-
- typedef dFloat (*NewtonCollisionTreeRayCastCallback) (const NewtonBody* const body, const NewtonCollision* const treeCollision, dFloat intersection, dFloat* const normal, int faceId, void* const usedData);
- typedef dFloat (*NewtonHeightFieldRayCastCallback) (const NewtonBody* const body, const NewtonCollision* const heightFieldCollision, dFloat intersection, int row, int col, dFloat* const normal, int faceId, void* const usedData);
-
- typedef void (*NewtonCollisionCopyConstructionCallback) (const NewtonWorld* const newtonWorld, NewtonCollision* const collision, const NewtonCollision* const sourceCollision);
- typedef void (*NewtonCollisionDestructorCallback) (const NewtonWorld* const newtonWorld, const NewtonCollision* const collision);
-
- // collision tree call back (obsoleted no recommended)
- typedef void (*NewtonTreeCollisionCallback) (const NewtonBody* const bodyWithTreeCollision, const NewtonBody* const body, int faceID,
- int vertexCount, const dFloat* const vertex, int vertexStrideInBytes);
-
- typedef void (*NewtonBodyDestructor) (const NewtonBody* const body);
- typedef void (*NewtonApplyForceAndTorque) (const NewtonBody* const body, dFloat timestep, int threadIndex);
- typedef void (*NewtonSetTransform) (const NewtonBody* const body, const dFloat* const matrix, int threadIndex);
-
- typedef int (*NewtonIslandUpdate) (const NewtonWorld* const newtonWorld, const void* islandHandle, int bodyCount);
-
- typedef void (*NewtonFractureCompoundCollisionOnEmitCompoundFractured) (NewtonBody* const fracturedBody);
- typedef void (*NewtonFractureCompoundCollisionOnEmitChunk) (NewtonBody* const chunkBody, NewtonFracturedCompoundMeshPart* const fracturexChunkMesh, const NewtonCollision* const fracturedCompountCollision);
- typedef void (*NewtonFractureCompoundCollisionReconstructMainMeshCallBack) (NewtonBody* const body, NewtonFracturedCompoundMeshPart* const mainMesh, const NewtonCollision* const fracturedCompountCollision);
-
- typedef unsigned (*NewtonWorldRayPrefilterCallback)(const NewtonBody* const body, const NewtonCollision* const collision, void* const userData);
- typedef dFloat (*NewtonWorldRayFilterCallback)(const NewtonBody* const body, const NewtonCollision* const shapeHit, const dFloat* const hitContact, const dFloat* const hitNormal, dLong collisionID, void* const userData, dFloat intersectParam);
-
-
- typedef void (*NewtonContactsProcess) (const NewtonJoint* const contact, dFloat timestep, int threadIndex);
- typedef int (*NewtonOnAABBOverlap) (const NewtonMaterial* const material, const NewtonBody* const body0, const NewtonBody* const body1, int threadIndex);
- typedef int (*NewtonOnCompoundSubCollisionAABBOverlap) (const NewtonMaterial* const material, const NewtonBody* const body0, const void* const collsionNode0, const NewtonBody* const body1, const void* const collsionNode1, int threadIndex);
-
- typedef int (*NewtonBodyIterator) (const NewtonBody* const body, void* const userData);
- typedef void (*NewtonJointIterator) (const NewtonJoint* const joint, void* const userData);
- typedef void (*NewtonCollisionIterator) (void* const userData, int vertexCount, const dFloat* const faceArray, int faceId);
-
- typedef void (*NewtonBallCallback) (const NewtonJoint* const ball, dFloat timestep);
- typedef unsigned (*NewtonHingeCallback) (const NewtonJoint* const hinge, NewtonHingeSliderUpdateDesc* const desc);
- typedef unsigned (*NewtonSliderCallback) (const NewtonJoint* const slider, NewtonHingeSliderUpdateDesc* const desc);
- typedef unsigned (*NewtonUniversalCallback) (const NewtonJoint* const universal, NewtonHingeSliderUpdateDesc* const desc);
- typedef unsigned (*NewtonCorkscrewCallback) (const NewtonJoint* const corkscrew, NewtonHingeSliderUpdateDesc* const desc);
-
- typedef void (*NewtonUserBilateralCallback) (const NewtonJoint* const userJoint, dFloat timestep, int threadIndex);
- typedef void (*NewtonUserBilateralGetInfoCallback) (const NewtonJoint* const userJoint, NewtonJointRecord* const info);
-
- typedef void (*NewtonConstraintDestructor) (const NewtonJoint* const me);
-
- typedef void (*NewtonJobTask) (NewtonWorld* const world, void* const userData, int threadIndex);
-
- typedef bool (*NewtonReportProgress) (dFloat normalizedProgressPercent, void* const userData);
+// NEWTON_API void NewtonWorldForEachBodyDo (const NewtonWorld* const newtonWorld, NewtonBodyIterator callback);
+NEWTON_API void NewtonWorldForEachJointDo (const NewtonWorld* const newtonWorld, NewtonJointIterator callback, void* const userData);
+NEWTON_API void NewtonWorldForEachBodyInAABBDo (const NewtonWorld* const newtonWorld, const dFloat* const p0, const dFloat* const p1, NewtonBodyIterator callback, void* const userData);
+
+
+NEWTON_API void NewtonWorldSetUserData (const NewtonWorld* const newtonWorld, void* const userData);
+NEWTON_API void* NewtonWorldGetUserData (const NewtonWorld* const newtonWorld);
+NEWTON_API void NewtonWorldSetDestructorCallBack (const NewtonWorld* const newtonWorld, NewtonDestroyWorld destructor);
+NEWTON_API NewtonDestroyWorld NewtonWorldGetDestructorCallBack (const NewtonWorld* const newtonWorld);
+
+NEWTON_API void NewtonWorldRayCast (const NewtonWorld* const newtonWorld, const dFloat* const p0, const dFloat* const p1, NewtonWorldRayFilterCallback filter, void* const userData,
+ NewtonWorldRayPrefilterCallback prefilter);
+NEWTON_API int NewtonWorldConvexCast (const NewtonWorld* const newtonWorld, const dFloat* const matrix, const dFloat* const target, const NewtonCollision* shape, dFloat* const hitParam, void* const userData,
+ NewtonWorldRayPrefilterCallback prefilter, NewtonWorldConvexCastReturnInfo* info, int maxContactsCount, int threadIndex);
+
+
+// world utility functions
+NEWTON_API int NewtonWorldGetBodyCount(const NewtonWorld* const newtonWorld);
+NEWTON_API int NewtonWorldGetConstraintCount(const NewtonWorld* const newtonWorld);
+
+// NEWTON_API int NewtonGetActiveBodiesCount();
+// NEWTON_API int NewtonGetActiveConstraintsCount();
+// NEWTON_API dFloat NewtonGetGlobalScale (const NewtonWorld* const newtonWorld);
+
+
+
+// **********************************************************************************************
+//
+// Simulation islands
+//
+// **********************************************************************************************
+NEWTON_API NewtonBody* NewtonIslandGetBody (const void* const island, int bodyIndex);
+NEWTON_API void NewtonIslandGetBodyAABB (const void* const island, int bodyIndex, dFloat* const p0, dFloat* const p1);
+
+// **********************************************************************************************
+//
+// Physics Material Section
+//
+// **********************************************************************************************
+NEWTON_API int NewtonMaterialCreateGroupID(const NewtonWorld* const newtonWorld);
+NEWTON_API int NewtonMaterialGetDefaultGroupID(const NewtonWorld* const newtonWorld);
+NEWTON_API void NewtonMaterialDestroyAllGroupID(const NewtonWorld* const newtonWorld);
+
+// material definitions that can not be overwritten in function callback
+NEWTON_API void* NewtonMaterialGetUserData (const NewtonWorld* const newtonWorld, int id0, int id1);
+NEWTON_API void NewtonMaterialSetSurfaceThickness (const NewtonWorld* const newtonWorld, int id0, int id1, dFloat thickness);
+NEWTON_API void NewtonMaterialSetContinuousCollisionMode (const NewtonWorld* const newtonWorld, int id0, int id1, int state);
+NEWTON_API void NewtonMaterialSetCollisionCallback (const NewtonWorld* const newtonWorld, int id0, int id1, void* const userData,
+ NewtonOnAABBOverlap aabbOverlap, NewtonContactsProcess process);
+
+NEWTON_API void NewtonMaterialSetDefaultSoftness (const NewtonWorld* const newtonWorld, int id0, int id1, dFloat value);
+NEWTON_API void NewtonMaterialSetDefaultElasticity (const NewtonWorld* const newtonWorld, int id0, int id1, dFloat elasticCoef);
+NEWTON_API void NewtonMaterialSetDefaultCollidable (const NewtonWorld* const newtonWorld, int id0, int id1, int state);
+NEWTON_API void NewtonMaterialSetDefaultFriction (const NewtonWorld* const newtonWorld, int id0, int id1, dFloat staticFriction, dFloat kineticFriction);
+
+NEWTON_API NewtonMaterial* NewtonWorldGetFirstMaterial (const NewtonWorld* const newtonWorld);
+NEWTON_API NewtonMaterial* NewtonWorldGetNextMaterial (const NewtonWorld* const newtonWorld, const NewtonMaterial* const material);
+
+NEWTON_API NewtonBody* NewtonWorldGetFirstBody (const NewtonWorld* const newtonWorld);
+NEWTON_API NewtonBody* NewtonWorldGetNextBody (const NewtonWorld* const newtonWorld, const NewtonBody* const curBody);
+
+
+// **********************************************************************************************
+//
+// Physics Contact control functions
+//
+// **********************************************************************************************
+NEWTON_API void *NewtonMaterialGetMaterialPairUserData (const NewtonMaterial* const material);
+NEWTON_API unsigned NewtonMaterialGetContactFaceAttribute (const NewtonMaterial* const material);
+NEWTON_API NewtonCollision* NewtonMaterialGetBodyCollidingShape (const NewtonMaterial* const material, const NewtonBody* const body);
+//NEWTON_API unsigned NewtonMaterialGetBodyCollisionID (const NewtonMaterial* const material, const NewtonBody* const body);
+NEWTON_API dFloat NewtonMaterialGetContactNormalSpeed (const NewtonMaterial* const material);
+NEWTON_API void NewtonMaterialGetContactForce (const NewtonMaterial* const material, NewtonBody* const body, dFloat* const force);
+NEWTON_API void NewtonMaterialGetContactPositionAndNormal (const NewtonMaterial* const material, NewtonBody* const body, dFloat* const posit, dFloat* const normal);
+NEWTON_API void NewtonMaterialGetContactTangentDirections (const NewtonMaterial* const material, NewtonBody* const body, dFloat* const dir0, dFloat* const dir1);
+NEWTON_API dFloat NewtonMaterialGetContactTangentSpeed (const NewtonMaterial* const material, int index);
+
+NEWTON_API void NewtonMaterialSetContactSoftness (const NewtonMaterial* const material, dFloat softness);
+NEWTON_API void NewtonMaterialSetContactElasticity (const NewtonMaterial* const material, dFloat restitution);
+NEWTON_API void NewtonMaterialSetContactFrictionState (const NewtonMaterial* const material, int state, int index);
+NEWTON_API void NewtonMaterialSetContactFrictionCoef (const NewtonMaterial* const material, dFloat staticFrictionCoef, dFloat kineticFrictionCoef, int index);
+
+NEWTON_API void NewtonMaterialSetContactNormalAcceleration (const NewtonMaterial* const material, dFloat accel);
+NEWTON_API void NewtonMaterialSetContactNormalDirection (const NewtonMaterial* const material, const dFloat* const directionVector);
+
+NEWTON_API void NewtonMaterialSetContactTangentAcceleration (const NewtonMaterial* const material, dFloat accel, int index);
+NEWTON_API void NewtonMaterialContactRotateTangentDirections (const NewtonMaterial* const material, const dFloat* const directionVector);
+
+
+
+// **********************************************************************************************
+//
+// convex collision primitives creation functions
+//
+// **********************************************************************************************
+NEWTON_API NewtonCollision* NewtonCreateNull (const NewtonWorld* const newtonWorld);
+NEWTON_API NewtonCollision* NewtonCreateSphere (const NewtonWorld* const newtonWorld, dFloat radiusX, dFloat radiusY, dFloat radiusZ, int shapeID, const dFloat* const offsetMatrix);
+NEWTON_API NewtonCollision* NewtonCreateBox (const NewtonWorld* const newtonWorld, dFloat dx, dFloat dy, dFloat dz, int shapeID, const dFloat* const offsetMatrix);
+NEWTON_API NewtonCollision* NewtonCreateCone (const NewtonWorld* const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat* const offsetMatrix);
+NEWTON_API NewtonCollision* NewtonCreateCapsule (const NewtonWorld* const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat* const offsetMatrix);
+NEWTON_API NewtonCollision* NewtonCreateCylinder (const NewtonWorld* const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat* const offsetMatrix);
+NEWTON_API NewtonCollision* NewtonCreateChamferCylinder (const NewtonWorld* const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat* const offsetMatrix);
+NEWTON_API NewtonCollision* NewtonCreateConvexHull (const NewtonWorld* const newtonWorld, int count, const dFloat* const vertexCloud, int strideInBytes, dFloat tolerance, int shapeID, const dFloat* const offsetMatrix);
+NEWTON_API NewtonCollision* NewtonCreateConvexHullFromMesh (const NewtonWorld* const newtonWorld, const NewtonMesh* const mesh, dFloat tolerance, int shapeID);
- // **********************************************************************************************
- //
- // world control functions
- //
- // **********************************************************************************************
- NEWTON_API int NewtonWorldGetVersion ();
- NEWTON_API int NewtonWorldFloatSize ();
+NEWTON_API NewtonCollision* NewtonCreateConvexHullModifier (const NewtonWorld* const newtonWorld, const NewtonCollision* const convexHullCollision, int shapeID);
+NEWTON_API void NewtonConvexHullModifierGetMatrix (const NewtonCollision* const convexHullCollision, dFloat* const matrix);
+NEWTON_API void NewtonConvexHullModifierSetMatrix (const NewtonCollision* const convexHullCollision, const dFloat* const matrix);
+
+NEWTON_API int NewtonCollisionIsTriggerVolume(const NewtonCollision* const convexCollision);
+NEWTON_API void NewtonCollisionSetAsTriggerVolume(const NewtonCollision* convexCollision, int trigger);
+
+NEWTON_API void NewtonCollisionSetMaxBreakImpactImpulse(const NewtonCollision* const convexHullCollision, dFloat maxImpactImpulse);
+NEWTON_API dFloat NewtonCollisionGetMaxBreakImpactImpulse(const NewtonCollision* const convexHullCollision);
- NEWTON_API int NewtonGetMemoryUsed ();
- NEWTON_API void NewtonSetMemorySystem (NewtonAllocMemory malloc, NewtonFreeMemory free);
+NEWTON_API void NewtonCollisionSetUserID (const NewtonCollision* convexCollision, unsigned id);
+NEWTON_API unsigned NewtonCollisionGetUserID (const NewtonCollision* const convexCollision);
+
+NEWTON_API int NewtonConvexHullGetFaceIndices (const NewtonCollision* const convexHullCollision, int face, int* const faceIndices);
+NEWTON_API dFloat NewtonConvexCollisionCalculateVolume (const NewtonCollision* const convexCollision);
+NEWTON_API void NewtonConvexCollisionCalculateInertialMatrix (const NewtonCollision* convexCollision, dFloat* const inertia, dFloat* const origin);
+
+
+NEWTON_API void NewtonCollisionMakeUnique (const NewtonWorld* const newtonWorld, const NewtonCollision* const collision);
+NEWTON_API void NewtonReleaseCollision (const NewtonWorld* const newtonWorld, const NewtonCollision* const collision);
+NEWTON_API int NewtonAddCollisionReference (const NewtonCollision* const collision);
+
+
+// **********************************************************************************************
+//
+// mass/spring/damper collision shape
+//
+// **********************************************************************************************
+// NEWTON_API NewtonCollision* NewtonCreateSoftShape (const NewtonWorld* const newtonWorld);
+// NEWTON_API void NewtonSoftBodySetMassCount (const NewtonCollision* convexCollision, int count);
+// NEWTON_API void NewtonSoftBodySetSpringCount (const NewtonCollision* convexCollision, int count);
+
+// NEWTON_API void NewtonSoftBodySetMass (const NewtonCollision* convexCollision, int index, dFloat mass, dFloat* position);
+// NEWTON_API int NewtonSoftBodySetSpring (const NewtonCollision* convexCollision, int index, int mass0, int mass1, dFloat stiffness, dFloat damper);
+// NEWTON_API int NewtonSoftBodyGetMassArray (const NewtonCollision* convexCollision, dFloat* masses, dFloat** positions);
+
+
+// **********************************************************************************************
+//
+// complex collision primitives creation functions
+//
+// **********************************************************************************************
+NEWTON_API NewtonCollision* NewtonCreateCompoundCollision (const NewtonWorld* const newtonWorld, int count, NewtonCollision* const collisionPrimitiveArray[], int shapeID);
+NEWTON_API NewtonCollision* NewtonCreateCompoundCollisionFromMesh (const NewtonWorld* const newtonWorld, const NewtonMesh* const mesh, dFloat hullTolerance, int shapeID, int subShapeID);
+//NEWTON_API NewtonCollision* NewtonCreateCompoundCollisionFromMesh(const NewtonWorld* const newtonWorld, const NewtonMesh* const mesh, int maxSubShapesCount, int shapeID, int subShapeID);
- NEWTON_API NewtonWorld* NewtonCreate ();
- NEWTON_API void NewtonDestroy (const NewtonWorld* const newtonWorld);
- NEWTON_API void NewtonDestroyAllBodies (const NewtonWorld* const newtonWorld);
+// **********************************************************************************************
+//
+// complex breakable collision primitives interface
+//
+// **********************************************************************************************
+// NEWTON_API NewtonCollision* NewtonCreateCompoundBreakable (const NewtonWorld* const newtonWorld, int meshCount,
+// NewtonMesh* const solids[], NewtonMesh* const splitePlanes[],
+// dFloat* const matrixPallete, int* const shapeIDArray, dFloat* const densities,
+// int shapeID, int debriID, NewtonCollisionCompoundBreakableCallback callback, void* buildUsedData);
- NEWTON_API void* NewtonAlloc (int sizeInBytes);
- NEWTON_API void NewtonFree (void* const ptr);
+NEWTON_API NewtonCollision* NewtonCreateCompoundBreakable (const NewtonWorld* const newtonWorld, int meshCount,
+ const NewtonMesh** const solids, const int* const shapeIDArray,
+ const dFloat* const densities, const int* const internalFaceMaterial,
+ int shapeID, int debriID, dFloat debriSeparationGap);
+
+
+NEWTON_API void NewtonCompoundBreakableResetAnchoredPieces (const NewtonCollision* const compoundBreakable);
+NEWTON_API void NewtonCompoundBreakableSetAnchoredPieces (const NewtonCollision* const compoundBreakable, int fixShapesCount, dFloat* const matrixPallete, NewtonCollision** const fixedShapesArray);
- // NEWTON_API void NewtonSetPlatformArchitecture (const NewtonWorld* const newtonWorld, int mode);
- // NEWTON_API int NewtonGetPlatformArchitecture(const NewtonWorld* const newtonWorld, char* description);
+NEWTON_API int NewtonCompoundBreakableGetVertexCount (const NewtonCollision* const compoundBreakable);
+NEWTON_API void NewtonCompoundBreakableGetVertexStreams (const NewtonCollision* const compoundBreakable, int vertexStrideInByte, dFloat* const vertex,
+ int normalStrideInByte, dFloat* const normal, int uvStrideInByte, dFloat* const uv);
- NEWTON_API int NewtonEnumrateDevices (const NewtonWorld* const newtonWorld);
- NEWTON_API int NewtonGetCurrentDevice (const NewtonWorld* const newtonWorld);
- NEWTON_API void NewtonSetCurrentDevice (const NewtonWorld* const newtonWorld, int deviceIndex);
- NEWTON_API void NewtonGetDeviceString (const NewtonWorld* const newtonWorld, int deviceIndex, char* const vendorString, int maxSize);
-
- NEWTON_API dFloat NewtonGetContactMergeTolerance (const NewtonWorld* const newtonWorld);
- NEWTON_API void NewtonSetContactMergeTolerance (const NewtonWorld* const newtonWorld, dFloat tolerance);
-
- NEWTON_API void NewtonInvalidateCache (const NewtonWorld* const newtonWorld);
- NEWTON_API void NewtonSetSolverModel (const NewtonWorld* const newtonWorld, int model);
-
- NEWTON_API void NewtonSetMultiThreadSolverOnSingleIsland (const NewtonWorld* const newtonWorld, int mode);
- NEWTON_API int NewtonGetMultiThreadSolverOnSingleIsland (const NewtonWorld* const newtonWorld);
- //NEWTON_API void NewtonSetPerformanceClock (const NewtonWorld* const newtonWorld, NewtonGetTicksCountCallback callback);
- //NEWTON_API unsigned NewtonReadPerformanceTicks (const NewtonWorld* const newtonWorld, unsigned performanceEntry);
- //NEWTON_API unsigned NewtonReadThreadPerformanceTicks (const NewtonWorld* newtonWorld, unsigned threadIndex);
-
- NEWTON_API int NewtonGetBroadphaseAlgorithm (const NewtonWorld* const newtonWorld);
- NEWTON_API void NewtonSelectBroadphaseAlgorithm (const NewtonWorld* const newtonWorld, int algorithmType);
-
- NEWTON_API void NewtonUpdate (const NewtonWorld* const newtonWorld, dFloat timestep);
- NEWTON_API void NewtonUpdateAsync (const NewtonWorld* const newtonWorld, dFloat timestep);
- NEWTON_API void NewtonWaitForUpdateToFinish (const NewtonWorld* const newtonWorld);
+NEWTON_API NewtonbreakableComponentMesh* NewtonBreakableGetMainMesh (const NewtonCollision* const compoundBreakable);
+NEWTON_API NewtonbreakableComponentMesh* NewtonBreakableGetFirstComponent (const NewtonCollision* const compoundBreakable);
+NEWTON_API NewtonbreakableComponentMesh* NewtonBreakableGetNextComponent (const NewtonbreakableComponentMesh* const component);
- NEWTON_API void NewtonSerializeToFile (const NewtonWorld* const newtonWorld, const char* const filename, NewtonOnBodySerializationCallback bodyCallback, void* const bodyUserData);
- NEWTON_API void NewtonDeserializeFromFile (const NewtonWorld* const newtonWorld, const char* const filename, NewtonOnBodyDeserializationCallback bodyCallback, void* const bodyUserData);
+NEWTON_API void NewtonBreakableBeginDelete (const NewtonCollision* const compoundBreakable);
+NEWTON_API NewtonBody* NewtonBreakableCreateDebrieBody (const NewtonCollision* const compoundBreakable, const NewtonbreakableComponentMesh* const component);
+NEWTON_API void NewtonBreakableDeleteComponent (const NewtonCollision* const compoundBreakable, const NewtonbreakableComponentMesh* const component);
+NEWTON_API void NewtonBreakableEndDelete (const NewtonCollision* const compoundBreakable);
- NEWTON_API void NewtonSetJointSerializationCallbacks (const NewtonWorld* const newtonWorld, NewtonOnJointSerializationCallback serializeJoint, NewtonOnJointDeserializationCallback deserializeJoint);
- NEWTON_API void NewtonGetJointSerializationCallbacks (const NewtonWorld* const newtonWorld, NewtonOnJointSerializationCallback* const serializeJoint, NewtonOnJointDeserializationCallback* const deserializeJoint);
-
+NEWTON_API int NewtonBreakableGetComponentsInRadius (const NewtonCollision* const compoundBreakable, const dFloat* position, dFloat radius, NewtonbreakableComponentMesh** const segments, int maxCount);
- // multi threading interface
- NEWTON_API void NewtonWorldCriticalSectionLock (const NewtonWorld* const newtonWorld, int threadIndex);
- NEWTON_API void NewtonWorldCriticalSectionUnlock (const NewtonWorld* const newtonWorld);
- NEWTON_API void NewtonSetThreadsCount (const NewtonWorld* const newtonWorld, int threads);
- NEWTON_API int NewtonGetThreadsCount(const NewtonWorld* const newtonWorld);
- NEWTON_API int NewtonGetMaxThreadsCount(const NewtonWorld* const newtonWorld);
- NEWTON_API void NewtonDispachThreadJob(const NewtonWorld* const newtonWorld, NewtonJobTask task, void* const usedData);
- NEWTON_API void NewtonSyncThreadJobs(const NewtonWorld* const newtonWorld);
+NEWTON_API void* NewtonBreakableGetFirstSegment (const NewtonbreakableComponentMesh* const breakableComponent);
+NEWTON_API void* NewtonBreakableGetNextSegment (const void* const segment);
+
+NEWTON_API int NewtonBreakableSegmentGetMaterial (const void* const segment);
+NEWTON_API int NewtonBreakableSegmentGetIndexCount (const void* const segment);
+NEWTON_API int NewtonBreakableSegmentGetIndexStream (const NewtonCollision* const compoundBreakable, const NewtonbreakableComponentMesh* const meshOwner, const void* const segment, int* const index);
+NEWTON_API int NewtonBreakableSegmentGetIndexStreamShort (const NewtonCollision* const compoundBreakable, const NewtonbreakableComponentMesh* const meshOwner, const void* const segment, short int* const index);
+
+
+NEWTON_API NewtonCollision* NewtonCreateUserMeshCollision (const NewtonWorld* const newtonWorld, const dFloat* const minBox,
+ const dFloat* const maxBox, void* const userData, NewtonUserMeshCollisionCollideCallback collideCallback,
+ NewtonUserMeshCollisionRayHitCallback rayHitCallback, NewtonUserMeshCollisionDestroyCallback destroyCallback,
+ NewtonUserMeshCollisionGetCollisionInfo getInfoCallback, NewtonUserMeshCollisionGetFacesInAABB facesInAABBCallback, int shapeID);
- // atomic operations
- NEWTON_API int NewtonAtomicAdd (int* const ptr, int value);
- NEWTON_API int NewtonAtomicSwap (int* const ptr, int value);
- NEWTON_API void NewtonYield ();
-
- NEWTON_API void NewtonSetFrictionModel (const NewtonWorld* const newtonWorld, int model);
- NEWTON_API void NewtonSetMinimumFrameRate (const NewtonWorld* const newtonWorld, dFloat frameRate);
- NEWTON_API void NewtonSetIslandUpdateEvent (const NewtonWorld* const newtonWorld, NewtonIslandUpdate islandUpdate);
-// NEWTON_API void NewtonSetDestroyBodyByExeciveForce (const NewtonWorld* const newtonWorld, NewtonDestroyBodyByExeciveForce callback);
-// NEWTON_API void NewtonWorldForEachBodyDo (const NewtonWorld* const newtonWorld, NewtonBodyIterator callback);
- NEWTON_API void NewtonWorldForEachJointDo (const NewtonWorld* const newtonWorld, NewtonJointIterator callback, void* const userData);
- NEWTON_API void NewtonWorldForEachBodyInAABBDo (const NewtonWorld* const newtonWorld, const dFloat* const p0, const dFloat* const p1, NewtonBodyIterator callback, void* const userData);
-
-
- NEWTON_API void NewtonWorldSetUserData (const NewtonWorld* const newtonWorld, void* const userData);
- NEWTON_API void* NewtonWorldGetUserData (const NewtonWorld* const newtonWorld);
-
-
- NEWTON_API void* NewtonWorldGetListenerUserData (const NewtonWorld* const newtonWorld, void* const listener);
- NEWTON_API NewtonWorldListenerBodyDestroyCallback NewtonWorldListenerGetBodyDestroyCallback (const NewtonWorld* const newtonWorld, void* const listener);
- NEWTON_API void NewtonWorldListenerSetBodyDestroyCallback (const NewtonWorld* const newtonWorld, void* const listener, NewtonWorldListenerBodyDestroyCallback bodyDestroyCallback);
-
- NEWTON_API void* NewtonWorldGetPreListener (const NewtonWorld* const newtonWorld, const char* const nameId);
- NEWTON_API void* NewtonWorldAddPreListener (const NewtonWorld* const newtonWorld, const char* const nameId, void* const listenerUserData, NewtonWorldUpdateListenerCallback update, NewtonWorldDestroyListenerCallback destroy);
-
- NEWTON_API void* NewtonWorldGetPostListener (const NewtonWorld* const newtonWorld, const char* const nameId);
- NEWTON_API void* NewtonWorldAddPostListener (const NewtonWorld* const newtonWorld, const char* const nameId, void* const listenerUserData, NewtonWorldUpdateListenerCallback update, NewtonWorldDestroyListenerCallback destroy);
-
- NEWTON_API void NewtonWorldSetDestructorCallback (const NewtonWorld* const newtonWorld, NewtonWorldDestructorCallback destructor);
- NEWTON_API NewtonWorldDestructorCallback NewtonWorldGetDestructorCallback (const NewtonWorld* const newtonWorld);
-
- NEWTON_API void NewtonWorldSetCollisionConstructorDestructorCallback (const NewtonWorld* const newtonWorld, NewtonCollisionCopyConstructionCallback constructor, NewtonCollisionDestructorCallback destructor);
-
- NEWTON_DEPRECATED_API inline void NewtonWorldSetCollisionConstructorDestuctorCallback (const NewtonWorld* const newtonWorld, NewtonCollisionCopyConstructionCallback constructor, NewtonCollisionDestructorCallback destructor)
- {
- NewtonWorldSetCollisionConstructorDestructorCallback(newtonWorld, constructor, destructor);
- }
-
- NEWTON_API void NewtonWorldRayCast (const NewtonWorld* const newtonWorld, const dFloat* const p0, const dFloat* const p1, NewtonWorldRayFilterCallback filter, void* const userData, NewtonWorldRayPrefilterCallback prefilter, int threadIndex);
- NEWTON_API void NewtonWorldConvexRayCast (const NewtonWorld* const newtonWorld, const NewtonCollision* const shape, const dFloat* const matrix, const dFloat* const p1, NewtonWorldRayFilterCallback filter, void* const userData, NewtonWorldRayPrefilterCallback prefilter, int threadIndex);
-
- NEWTON_API int NewtonWorldCollide (const NewtonWorld* const newtonWorld, const dFloat* const matrix, const NewtonCollision* const shape, void* const userData,
- NewtonWorldRayPrefilterCallback prefilter, NewtonWorldConvexCastReturnInfo* const info, int maxContactsCount, int threadIndex);
- NEWTON_API int NewtonWorldConvexCast (const NewtonWorld* const newtonWorld, const dFloat* const matrix, const dFloat* const target, const NewtonCollision* const shape, dFloat* const hitParam, void* const userData,
- NewtonWorldRayPrefilterCallback prefilter, NewtonWorldConvexCastReturnInfo* const info, int maxContactsCount, int threadIndex);
-
-
- // world utility functions
- NEWTON_API int NewtonWorldGetBodyCount(const NewtonWorld* const newtonWorld);
- NEWTON_API int NewtonWorldGetConstraintCount(const NewtonWorld* const newtonWorld);
-
-
- // **********************************************************************************************
- //
- // Simulation islands
- //
- // **********************************************************************************************
- NEWTON_API NewtonBody* NewtonIslandGetBody (const void* const island, int bodyIndex);
- NEWTON_API void NewtonIslandGetBodyAABB (const void* const island, int bodyIndex, dFloat* const p0, dFloat* const p1);
-
- // **********************************************************************************************
- //
- // Physics Material Section
- //
- // **********************************************************************************************
- NEWTON_API int NewtonMaterialCreateGroupID(const NewtonWorld* const newtonWorld);
- NEWTON_API int NewtonMaterialGetDefaultGroupID(const NewtonWorld* const newtonWorld);
- NEWTON_API void NewtonMaterialDestroyAllGroupID(const NewtonWorld* const newtonWorld);
-
- // material definitions that can not be overwritten in function callback
- NEWTON_API void* NewtonMaterialGetUserData (const NewtonWorld* const newtonWorld, int id0, int id1);
- NEWTON_API void NewtonMaterialSetSurfaceThickness (const NewtonWorld* const newtonWorld, int id0, int id1, dFloat thickness);
-
-// deprecated, not longer continue collision is set on the material
-// NEWTON_API void NewtonMaterialSetContinuousCollisionMode (const NewtonWorld* const newtonWorld, int id0, int id1, int state);
- NEWTON_API void NewtonMaterialSetCollisionCallback (const NewtonWorld* const newtonWorld, int id0, int id1, void* const userData, NewtonOnAABBOverlap aabbOverlap, NewtonContactsProcess process);
- NEWTON_API void NewtonMaterialSetCompoundCollisionCallback(const NewtonWorld* const newtonWorld, int id0, int id1, NewtonOnCompoundSubCollisionAABBOverlap compoundAabbOverlap);
-
- NEWTON_API void NewtonMaterialSetDefaultSoftness (const NewtonWorld* const newtonWorld, int id0, int id1, dFloat value);
- NEWTON_API void NewtonMaterialSetDefaultElasticity (const NewtonWorld* const newtonWorld, int id0, int id1, dFloat elasticCoef);
- NEWTON_API void NewtonMaterialSetDefaultCollidable (const NewtonWorld* const newtonWorld, int id0, int id1, int state);
- NEWTON_API void NewtonMaterialSetDefaultFriction (const NewtonWorld* const newtonWorld, int id0, int id1, dFloat staticFriction, dFloat kineticFriction);
-
- NEWTON_API NewtonMaterial* NewtonWorldGetFirstMaterial (const NewtonWorld* const newtonWorld);
- NEWTON_API NewtonMaterial* NewtonWorldGetNextMaterial (const NewtonWorld* const newtonWorld, const NewtonMaterial* const material);
-
- NEWTON_API NewtonBody* NewtonWorldGetFirstBody (const NewtonWorld* const newtonWorld);
- NEWTON_API NewtonBody* NewtonWorldGetNextBody (const NewtonWorld* const newtonWorld, const NewtonBody* const curBody);
-
-
- // **********************************************************************************************
- //
- // Physics Contact control functions
- //
- // **********************************************************************************************
- NEWTON_API void *NewtonMaterialGetMaterialPairUserData (const NewtonMaterial* const material);
- NEWTON_API unsigned NewtonMaterialGetContactFaceAttribute (const NewtonMaterial* const material);
- NEWTON_API NewtonCollision* NewtonMaterialGetBodyCollidingShape (const NewtonMaterial* const material, const NewtonBody* const body);
- NEWTON_API dFloat NewtonMaterialGetContactNormalSpeed (const NewtonMaterial* const material);
- NEWTON_API void NewtonMaterialGetContactForce (const NewtonMaterial* const material, const NewtonBody* const body, dFloat* const force);
- NEWTON_API void NewtonMaterialGetContactPositionAndNormal (const NewtonMaterial* const material, const NewtonBody* const body, dFloat* const posit, dFloat* const normal);
- NEWTON_API void NewtonMaterialGetContactTangentDirections (const NewtonMaterial* const material, const NewtonBody* const body, dFloat* const dir0, dFloat* const dir1);
- NEWTON_API dFloat NewtonMaterialGetContactTangentSpeed (const NewtonMaterial* const material, int index);
-
- NEWTON_API dFloat NewtonMaterialGetContactMaxNormalImpact (const NewtonMaterial* const material);
- NEWTON_API dFloat NewtonMaterialGetContactMaxTangentImpact (const NewtonMaterial* const material, int index);
-
- NEWTON_API void NewtonMaterialSetContactSoftness (const NewtonMaterial* const material, dFloat softness);
- NEWTON_API void NewtonMaterialSetContactElasticity (const NewtonMaterial* const material, dFloat restitution);
- NEWTON_API void NewtonMaterialSetContactFrictionState (const NewtonMaterial* const material, int state, int index);
- NEWTON_API void NewtonMaterialSetContactFrictionCoef (const NewtonMaterial* const material, dFloat staticFrictionCoef, dFloat kineticFrictionCoef, int index);
-
- NEWTON_API void NewtonMaterialSetContactNormalAcceleration (const NewtonMaterial* const material, dFloat accel);
- NEWTON_API void NewtonMaterialSetContactNormalDirection (const NewtonMaterial* const material, const dFloat* const directionVector);
-
- NEWTON_API void NewtonMaterialSetContactTangentAcceleration (const NewtonMaterial* const material, dFloat accel, int index);
- NEWTON_API void NewtonMaterialContactRotateTangentDirections (const NewtonMaterial* const material, const dFloat* const directionVector);
-
-
-
- // **********************************************************************************************
- //
- // convex collision primitives creation functions
- //
- // **********************************************************************************************
- NEWTON_API NewtonCollision* NewtonCreateNull (const NewtonWorld* const newtonWorld);
- NEWTON_API NewtonCollision* NewtonCreateSphere (const NewtonWorld* const newtonWorld, dFloat radius, int shapeID, const dFloat* const offsetMatrix);
- NEWTON_API NewtonCollision* NewtonCreateBox (const NewtonWorld* const newtonWorld, dFloat dx, dFloat dy, dFloat dz, int shapeID, const dFloat* const offsetMatrix);
- NEWTON_API NewtonCollision* NewtonCreateCone (const NewtonWorld* const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat* const offsetMatrix);
- NEWTON_API NewtonCollision* NewtonCreateCapsule (const NewtonWorld* const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat* const offsetMatrix);
- NEWTON_API NewtonCollision* NewtonCreateCylinder (const NewtonWorld* const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat* const offsetMatrix);
- NEWTON_API NewtonCollision* NewtonCreateTaperedCapsule (const NewtonWorld* const newtonWorld, dFloat radio0, dFloat radio1, dFloat height, int shapeID, const dFloat* const offsetMatrix);
- NEWTON_API NewtonCollision* NewtonCreateTaperedCylinder (const NewtonWorld* const newtonWorld, dFloat radio0, dFloat radio1, dFloat height, int shapeID, const dFloat* const offsetMatrix);
- NEWTON_API NewtonCollision* NewtonCreateChamferCylinder (const NewtonWorld* const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat* const offsetMatrix);
- NEWTON_API NewtonCollision* NewtonCreateConvexHull (const NewtonWorld* const newtonWorld, int count, const dFloat* const vertexCloud, int strideInBytes, dFloat tolerance, int shapeID, const dFloat* const offsetMatrix);
- NEWTON_API NewtonCollision* NewtonCreateConvexHullFromMesh (const NewtonWorld* const newtonWorld, const NewtonMesh* const mesh, dFloat tolerance, int shapeID);
-
- NEWTON_API int NewtonCollisionGetMode(const NewtonCollision* const convexCollision);
- NEWTON_API void NewtonCollisionSetMode (const NewtonCollision* const convexCollision, int mode);
-
-
-
-// NEWTON_API void NewtonCollisionSetMaxBreakImpactImpulse(const NewtonCollision* const convexHullCollision, dFloat maxImpactImpulse);
-// NEWTON_API dFloat NewtonCollisionGetMaxBreakImpactImpulse(const NewtonCollision* const convexHullCollision);
-
- NEWTON_API int NewtonConvexHullGetFaceIndices (const NewtonCollision* const convexHullCollision, int face, int* const faceIndices);
- NEWTON_API int NewtonConvexHullGetVertexData (const NewtonCollision* const convexHullCollision, dFloat** const vertexData, int* strideInBytes);
- NEWTON_DEPRECATED_API inline int NewtonConvexHullGetVetexData (const NewtonCollision* const convexHullCollision, dFloat** const vertexData, int* strideInBytes)
- {
- return NewtonConvexHullGetVertexData(convexHullCollision, vertexData, strideInBytes);
- }
-
- NEWTON_API dFloat NewtonConvexCollisionCalculateVolume (const NewtonCollision* const convexCollision);
- NEWTON_API void NewtonConvexCollisionCalculateInertialMatrix (const NewtonCollision* convexCollision, dFloat* const inertia, dFloat* const origin);
- NEWTON_API void NewtonConvexCollisionCalculateBuoyancyAcceleration (const NewtonCollision* const convexCollision, const dFloat* const matrix, const dFloat* const shapeOrigin, const dFloat* const gravityVector, const dFloat* const fluidPlane, dFloat fluidDensity, dFloat fluidViscosity, dFloat* const accel, dFloat* const alpha);
-
- NEWTON_API const void* NewtonCollisionDataPointer (const NewtonCollision* const convexCollision);
-
- // **********************************************************************************************
- //
- // compound collision primitives creation functions
- //
- // **********************************************************************************************
- NEWTON_API NewtonCollision* NewtonCreateCompoundCollision (const NewtonWorld* const newtonWorld, int shapeID);
- NEWTON_API NewtonCollision* NewtonCreateCompoundCollisionFromMesh (const NewtonWorld* const newtonWorld, const NewtonMesh* const mesh, dFloat hullTolerance, int shapeID, int subShapeID);
-
- NEWTON_API void NewtonCompoundCollisionBeginAddRemove (NewtonCollision* const compoundCollision);
- NEWTON_API void* NewtonCompoundCollisionAddSubCollision (NewtonCollision* const compoundCollision, const NewtonCollision* const convexCollision);
- NEWTON_API void NewtonCompoundCollisionRemoveSubCollision (NewtonCollision* const compoundCollision, const void* const collisionNode);
- NEWTON_API void NewtonCompoundCollisionRemoveSubCollisionByIndex (NewtonCollision* const compoundCollision, int nodeIndex);
- NEWTON_API void NewtonCompoundCollisionSetSubCollisionMatrix (NewtonCollision* const compoundCollision, const void* const collisionNode, const dFloat* const matrix);
- NEWTON_API void NewtonCompoundCollisionEndAddRemove (NewtonCollision* const compoundCollision);
-
- NEWTON_API void* NewtonCompoundCollisionGetFirstNode (NewtonCollision* const compoundCollision);
- NEWTON_API void* NewtonCompoundCollisionGetNextNode (NewtonCollision* const compoundCollision, const void* const collisionNode);
-
- NEWTON_API void* NewtonCompoundCollisionGetNodeByIndex (NewtonCollision* const compoundCollision, int index);
- NEWTON_API int NewtonCompoundCollisionGetNodeIndex (NewtonCollision* const compoundCollision, const void* const collisionNode);
- NEWTON_API NewtonCollision* NewtonCompoundCollisionGetCollisionFromNode (NewtonCollision* const compoundCollision, const void* const collisionNode);
-
-
- // **********************************************************************************************
- //
- // Fractured compound collision primitives interface
- //
- // **********************************************************************************************
- NEWTON_API NewtonCollision* NewtonCreateFracturedCompoundCollision (const NewtonWorld* const newtonWorld, const NewtonMesh* const solidMesh, int shapeID, int fracturePhysicsMaterialID, int pointcloudCount, const dFloat* const vertexCloud, int strideInBytes, int materialID, const dFloat* const textureMatrix,
- NewtonFractureCompoundCollisionReconstructMainMeshCallBack regenerateMainMeshCallback,
- NewtonFractureCompoundCollisionOnEmitCompoundFractured emitFracturedCompound, NewtonFractureCompoundCollisionOnEmitChunk emitFracfuredChunk);
- NEWTON_API NewtonCollision* NewtonFracturedCompoundPlaneClip (const NewtonCollision* const fracturedCompound, const dFloat* const plane);
-
- NEWTON_API void NewtonFracturedCompoundSetCallbacks (const NewtonCollision* const fracturedCompound, NewtonFractureCompoundCollisionReconstructMainMeshCallBack regenerateMainMeshCallback,
- NewtonFractureCompoundCollisionOnEmitCompoundFractured emitFracturedCompound, NewtonFractureCompoundCollisionOnEmitChunk emitFracfuredChunk);
-
-
- NEWTON_API int NewtonFracturedCompoundIsNodeFreeToDetach (const NewtonCollision* const fracturedCompound, void* const collisionNode);
- NEWTON_API int NewtonFracturedCompoundNeighborNodeList (const NewtonCollision* const fracturedCompound, void* const collisionNode, void** const list, int maxCount);
-
-
- NEWTON_API NewtonFracturedCompoundMeshPart* NewtonFracturedCompoundGetMainMesh (const NewtonCollision* const fracturedCompound);
- NEWTON_API NewtonFracturedCompoundMeshPart* NewtonFracturedCompoundGetFirstSubMesh(const NewtonCollision* const fracturedCompound);
- NEWTON_API NewtonFracturedCompoundMeshPart* NewtonFracturedCompoundGetNextSubMesh(const NewtonCollision* const fracturedCompound, NewtonFracturedCompoundMeshPart* const subMesh);
-
- NEWTON_API int NewtonFracturedCompoundCollisionGetVertexCount (const NewtonCollision* const fracturedCompound, const NewtonFracturedCompoundMeshPart* const meshOwner);
- NEWTON_API const dFloat* NewtonFracturedCompoundCollisionGetVertexPositions (const NewtonCollision* const fracturedCompound, const NewtonFracturedCompoundMeshPart* const meshOwner);
- NEWTON_API const dFloat* NewtonFracturedCompoundCollisionGetVertexNormals (const NewtonCollision* const fracturedCompound, const NewtonFracturedCompoundMeshPart* const meshOwner);
- NEWTON_API const dFloat* NewtonFracturedCompoundCollisionGetVertexUVs (const NewtonCollision* const fracturedCompound, const NewtonFracturedCompoundMeshPart* const meshOwner);
- NEWTON_API int NewtonFracturedCompoundMeshPartGetIndexStream (const NewtonCollision* const fracturedCompound, const NewtonFracturedCompoundMeshPart* const meshOwner, const void* const segment, int* const index);
-
- NEWTON_API void* NewtonFracturedCompoundMeshPartGetFirstSegment (const NewtonFracturedCompoundMeshPart* const fractureCompoundMeshPart);
- NEWTON_API void* NewtonFracturedCompoundMeshPartGetNextSegment (const void* const fractureCompoundMeshSegment);
- NEWTON_API int NewtonFracturedCompoundMeshPartGetMaterial (const void* const fractureCompoundMeshSegment);
- NEWTON_API int NewtonFracturedCompoundMeshPartGetIndexCount (const void* const fractureCompoundMeshSegment);
-
-
- // **********************************************************************************************
- //
- // scene collision are static compound collision that can take polygonal static collisions
- //
- // **********************************************************************************************
- NEWTON_API NewtonCollision* NewtonCreateSceneCollision (const NewtonWorld* const newtonWorld, int shapeID);
-
- NEWTON_API void NewtonSceneCollisionBeginAddRemove (NewtonCollision* const sceneCollision);
- NEWTON_API void* NewtonSceneCollisionAddSubCollision (NewtonCollision* const sceneCollision, const NewtonCollision* const collision);
- NEWTON_API void NewtonSceneCollisionRemoveSubCollision (NewtonCollision* const compoundCollision, const void* const collisionNode);
- NEWTON_API void NewtonSceneCollisionRemoveSubCollisionByIndex (NewtonCollision* const sceneCollision, int nodeIndex);
- NEWTON_API void NewtonSceneCollisionSetSubCollisionMatrix (NewtonCollision* const sceneCollision, const void* const collisionNode, const dFloat* const matrix);
- NEWTON_API void NewtonSceneCollisionEndAddRemove (NewtonCollision* const sceneCollision);
-
- NEWTON_API void* NewtonSceneCollisionGetFirstNode (NewtonCollision* const sceneCollision);
- NEWTON_API void* NewtonSceneCollisionGetNextNode (NewtonCollision* const sceneCollision, const void* const collisionNode);
-
- NEWTON_API void* NewtonSceneCollisionGetNodeByIndex (NewtonCollision* const sceneCollision, int index);
- NEWTON_API int NewtonSceneCollisionGetNodeIndex (NewtonCollision* const sceneCollision, const void* const collisionNode);
- NEWTON_API NewtonCollision* NewtonSceneCollisionGetCollisionFromNode (NewtonCollision* const sceneCollision, const void* const collisionNode);
-
-
- // ***********************************************************************************************************
- //
- // User Static mesh collision interface
- //
- // ***********************************************************************************************************
- NEWTON_API NewtonCollision* NewtonCreateUserMeshCollision (const NewtonWorld* const newtonWorld, const dFloat* const minBox,
- const dFloat* const maxBox, void* const userData, NewtonUserMeshCollisionCollideCallback collideCallback,
- NewtonUserMeshCollisionRayHitCallback rayHitCallback, NewtonUserMeshCollisionDestroyCallback destroyCallback,
- NewtonUserMeshCollisionGetCollisionInfo getInfoCallback, NewtonUserMeshCollisionAABBTest getLocalAABBCallback,
- NewtonUserMeshCollisionGetFacesInAABB facesInAABBCallback, NewtonOnUserCollisionSerializationCallback serializeCallback, int shapeID);
-
- NEWTON_API int NewtonUserMeshCollisionContinuousOverlapTest (const NewtonUserMeshCollisionCollideDesc* const collideDescData, const void* const continueCollisionHandle, const dFloat* const minAabb, const dFloat* const maxAabb);
- NEWTON_DEPRECATED_API inline int NewtonUserMeshCollisionContinueOveralapTest (const NewtonUserMeshCollisionCollideDesc* const collideDescData, const void* const continueCollisionHandle, const dFloat* const minAabb, const dFloat* const maxAabb)
- {
- return NewtonUserMeshCollisionContinuousOverlapTest(collideDescData, continueCollisionHandle, minAabb, maxAabb);
- }
-
-
- // ***********************************************************************************************************
- //
- // Collision serialization functions
- //
- // ***********************************************************************************************************
- NEWTON_API NewtonCollision* NewtonCreateCollisionFromSerialization (const NewtonWorld* const newtonWorld, NewtonDeserializeCallback deserializeFunction, void* const serializeHandle);
- NEWTON_API void NewtonCollisionSerialize (const NewtonWorld* const newtonWorld, const NewtonCollision* const collision, NewtonSerializeCallback serializeFunction, void* const serializeHandle);
- NEWTON_API void NewtonCollisionGetInfo (const NewtonCollision* const collision, NewtonCollisionInfoRecord* const collisionInfo);
-
- // **********************************************************************************************
- //
- // Static collision shapes functions
- //
- // **********************************************************************************************
- NEWTON_API NewtonCollision* NewtonCreateHeightFieldCollision (const NewtonWorld* const newtonWorld, int width, int height, int gridsDiagonals, int elevationdatType,
- const void* const elevationMap, const char* const attributeMap, dFloat verticalScale, dFloat horizontalScale, int shapeID);
- NEWTON_API void NewtonHeightFieldSetUserRayCastCallback (const NewtonCollision* const heightfieldCollision, NewtonHeightFieldRayCastCallback rayHitCallback);
-
-
- NEWTON_API NewtonCollision* NewtonCreateTreeCollision (const NewtonWorld* const newtonWorld, int shapeID);
- NEWTON_API NewtonCollision* NewtonCreateTreeCollisionFromMesh (const NewtonWorld* const newtonWorld, const NewtonMesh* const mesh, int shapeID);
-
- NEWTON_API void NewtonTreeCollisionSetUserRayCastCallback (const NewtonCollision* const treeCollision, NewtonCollisionTreeRayCastCallback rayHitCallback);
-
- NEWTON_API void NewtonTreeCollisionBeginBuild (const NewtonCollision* const treeCollision);
- NEWTON_API void NewtonTreeCollisionAddFace (const NewtonCollision* const treeCollision, int vertexCount, const dFloat* const vertexPtr, int strideInBytes, int faceAttribute);
- NEWTON_API void NewtonTreeCollisionEndBuild (const NewtonCollision* const treeCollision, int optimize);
-
- NEWTON_API int NewtonTreeCollisionGetFaceAttribute (const NewtonCollision* const treeCollision, const int* const faceIndexArray, int indexCount);
- NEWTON_API void NewtonTreeCollisionSetFaceAttribute (const NewtonCollision* const treeCollision, const int* const faceIndexArray, int indexCount, int attribute);
-
- NEWTON_DEPRECATED_API inline int NewtonTreeCollisionGetFaceAtribute (const NewtonCollision* const treeCollision, const int* const faceIndexArray, int indexCount)
- {
- return NewtonTreeCollisionGetFaceAttribute(treeCollision, faceIndexArray, indexCount);
- }
- NEWTON_DEPRECATED_API inline void NewtonTreeCollisionSetFaceAtribute (const NewtonCollision* const treeCollision, const int* const faceIndexArray, int indexCount, int attribute)
- {
- NewtonTreeCollisionSetFaceAttribute(treeCollision, faceIndexArray, indexCount, attribute);
- }
-
- NEWTON_API void NewtonTreeCollisionForEachFace (const NewtonCollision* const treeCollision, NewtonTreeCollisionFaceCallback forEachFaceCallback, void* const context);
-
- NEWTON_API int NewtonTreeCollisionGetVertexListTriangleListInAABB (const NewtonCollision* const treeCollision, const dFloat* const p0, const dFloat* const p1, const dFloat** const vertexArray, int* const vertexCount, int* const vertexStrideInBytes, const int* const indexList, int maxIndexCount, const int* const faceAttribute);
-
- NEWTON_API void NewtonStaticCollisionSetDebugCallback (const NewtonCollision* const staticCollision, NewtonTreeCollisionCallback userCallback);
-
- // **********************************************************************************************
- //
- // General purpose collision library functions
- //
- // **********************************************************************************************
-
- NEWTON_API NewtonCollision* NewtonCollisionCreateInstance (const NewtonCollision* const collision);
- NEWTON_API int NewtonCollisionGetType (const NewtonCollision* const collision);
-
- // for the end user
- NEWTON_API void NewtonCollisionSetUserData (const NewtonCollision* const collision, void* const userData);
- NEWTON_API void* NewtonCollisionGetUserData (const NewtonCollision* const collision);
-
- // this is used data is used by the joint library
- NEWTON_API void NewtonCollisionSetUserData1 (const NewtonCollision* const collision, void* const userData);
- NEWTON_API void* NewtonCollisionGetUserData1 (const NewtonCollision* const collision);
-
- NEWTON_API void NewtonCollisionSetUserID (const NewtonCollision* const collision, unsigned id);
- NEWTON_API unsigned NewtonCollisionGetUserID (const NewtonCollision* const collision);
-
- NEWTON_API void* NewtonCollisionGetSubCollisionHandle (const NewtonCollision* const collision);
- NEWTON_API NewtonCollision* NewtonCollisionGetParentInstance (const NewtonCollision* const collision);
-
- NEWTON_API void NewtonCollisionSetMatrix (const NewtonCollision* const collision, const dFloat* const matrix);
- NEWTON_API void NewtonCollisionGetMatrix (const NewtonCollision* const collision, dFloat* const matrix);
-
- NEWTON_API void NewtonCollisionSetScale (const NewtonCollision* const collision, dFloat scaleX, dFloat scaleY, dFloat scaleZ);
- NEWTON_API void NewtonCollisionGetScale (const NewtonCollision* const collision, dFloat* const scaleX, dFloat* const scaleY, dFloat* const scaleZ);
- NEWTON_API void NewtonDestroyCollision (const NewtonCollision* const collision);
-
- NEWTON_API dFloat NewtonCollisionGetSkinThickness (const NewtonCollision* const collision);
-
- NEWTON_API int NewtonCollisionIntersectionTest (const NewtonWorld* const newtonWorld,
- const NewtonCollision* const collisionA, const dFloat* const matrixA,
- const NewtonCollision* const collisionB, const dFloat* const matrixB, int threadIndex);
-
- NEWTON_API int NewtonCollisionPointDistance (const NewtonWorld* const newtonWorld, const dFloat* const point,
- const NewtonCollision* const collision, const dFloat* const matrix, dFloat* const contact, dFloat* const normal, int threadIndex);
-
- NEWTON_API int NewtonCollisionClosestPoint (const NewtonWorld* const newtonWorld,
- const NewtonCollision* const collisionA, const dFloat* const matrixA,
- const NewtonCollision* const collisionB, const dFloat* const matrixB,
- dFloat* const contactA, dFloat* const contactB, dFloat* const normalAB, int threadIndex);
-
- NEWTON_API int NewtonCollisionCollide (const NewtonWorld* const newtonWorld, int maxSize,
- const NewtonCollision* const collisionA, const dFloat* const matrixA,
- const NewtonCollision* const collisionB, const dFloat* const matrixB,
- dFloat* const contacts, dFloat* const normals, dFloat* const penetration,
- dLong* const attributeA, dLong* const attributeB, int threadIndex);
-
- NEWTON_API int NewtonCollisionCollideContinue (const NewtonWorld* const newtonWorld, int maxSize, dFloat timestep,
- const NewtonCollision* const collisionA, const dFloat* const matrixA, const dFloat* const velocA, const dFloat* omegaA,
- const NewtonCollision* const collisionB, const dFloat* const matrixB, const dFloat* const velocB, const dFloat* const omegaB,
- dFloat* const timeOfImpact, dFloat* const contacts, dFloat* const normals, dFloat* const penetration,
- dLong* const attributeA, dLong* const attributeB, int threadIndex);
-
- NEWTON_API void NewtonCollisionSupportVertex (const NewtonCollision* const collision, const dFloat* const dir, dFloat* const vertex);
- NEWTON_API dFloat NewtonCollisionRayCast (const NewtonCollision* const collision, const dFloat* const p0, const dFloat* const p1, dFloat* const normal, dLong* const attribute);
- NEWTON_API void NewtonCollisionCalculateAABB (const NewtonCollision* const collision, const dFloat* const matrix, dFloat* const p0, dFloat* const p1);
- NEWTON_API void NewtonCollisionForEachPolygonDo (const NewtonCollision* const collision, const dFloat* const matrix, NewtonCollisionIterator callback, void* const userData);
-
-
-
- // **********************************************************************************************
- //
- // transforms utility functions
- //
- // **********************************************************************************************
- NEWTON_API void NewtonSetEulerAngle (const dFloat* const eulersAngles, dFloat* const matrix);
- NEWTON_API void NewtonGetEulerAngle (const dFloat* const matrix, dFloat* const eulersAngles0, dFloat* const eulersAngles1);
- NEWTON_API dFloat NewtonCalculateSpringDamperAcceleration (dFloat dt, dFloat ks, dFloat x, dFloat kd, dFloat s);
-
- // **********************************************************************************************
- //
- // body manipulation functions
- //
- // **********************************************************************************************
- NEWTON_API NewtonBody* NewtonCreateDynamicBody (const NewtonWorld* const newtonWorld, const NewtonCollision* const collision, const dFloat* const matrix);
- NEWTON_API NewtonBody* NewtonCreateKinematicBody (const NewtonWorld* const newtonWorld, const NewtonCollision* const collision, const dFloat* const matrix);
- NEWTON_API NewtonBody* NewtonCreateDeformableBody (const NewtonWorld* const newtonWorld, const NewtonCollision* const deformableMesh, const dFloat* const matrix);
-
- NEWTON_API void NewtonDestroyBody(const NewtonBody* const body);
-
- NEWTON_DEPRECATED_API void NewtonBodyEnableSimulation(const NewtonBody* const body);
- NEWTON_DEPRECATED_API void NewtonBodyDisableSimulation(const NewtonBody* const body);
- NEWTON_API int NewtonBodyGetSimulationState(const NewtonBody* const body);
- NEWTON_API void NewtonBodySetSimulationState(const NewtonBody* const bodyPtr, const int state);
-
- NEWTON_API int NewtonBodyGetType (const NewtonBody* const body);
- NEWTON_API int NewtonBodyGetCollidable (const NewtonBody* const body);
- NEWTON_API void NewtonBodySetCollidable (const NewtonBody* const body, int collidableState);
-
- NEWTON_API void NewtonBodyAddForce (const NewtonBody* const body, const dFloat* const force);
- NEWTON_API void NewtonBodyAddTorque (const NewtonBody* const body, const dFloat* const torque);
- NEWTON_API void NewtonBodyCalculateInverseDynamicsForce (const NewtonBody* const body, dFloat timestep, const dFloat* const desiredVeloc, dFloat* const forceOut);
-
- NEWTON_API void NewtonBodySetCentreOfMass (const NewtonBody* const body, const dFloat* const com);
- NEWTON_API void NewtonBodySetMassMatrix (const NewtonBody* const body, dFloat mass, dFloat Ixx, dFloat Iyy, dFloat Izz);
-
- NEWTON_API void NewtonBodySetMassProperties (const NewtonBody* const body, dFloat mass, const NewtonCollision* const collision);
- NEWTON_API void NewtonBodySetMatrix (const NewtonBody* const body, const dFloat* const matrix);
- NEWTON_API void NewtonBodySetMatrixRecursive (const NewtonBody* const body, const dFloat* const matrix);
-
- NEWTON_API void NewtonBodySetMaterialGroupID (const NewtonBody* const body, int id);
- NEWTON_API void NewtonBodySetContinuousCollisionMode (const NewtonBody* const body, unsigned state);
- NEWTON_API void NewtonBodySetJointRecursiveCollision (const NewtonBody* const body, unsigned state);
- NEWTON_API void NewtonBodySetOmega (const NewtonBody* const body, const dFloat* const omega);
- NEWTON_API void NewtonBodySetVelocity (const NewtonBody* const body, const dFloat* const velocity);
- NEWTON_API void NewtonBodySetForce (const NewtonBody* const body, const dFloat* const force);
- NEWTON_API void NewtonBodySetTorque (const NewtonBody* const body, const dFloat* const torque);
-
- NEWTON_API void NewtonBodySetLinearDamping (const NewtonBody* const body, dFloat linearDamp);
- NEWTON_API void NewtonBodySetAngularDamping (const NewtonBody* const body, const dFloat* const angularDamp);
- NEWTON_API void NewtonBodySetCollision (const NewtonBody* const body, const NewtonCollision* const collision);
- NEWTON_API void NewtonBodySetCollisionScale (const NewtonBody* const body, dFloat scaleX, dFloat scaleY, dFloat scaleZ);
-
- NEWTON_API int NewtonBodyGetSleepState (const NewtonBody* const body);
- NEWTON_API void NewtonBodySetSleepState (const NewtonBody* const body, int state);
-
- NEWTON_API int NewtonBodyGetAutoSleep (const NewtonBody* const body);
- NEWTON_API void NewtonBodySetAutoSleep (const NewtonBody* const body, int state);
-
- NEWTON_API int NewtonBodyGetFreezeState(const NewtonBody* const body);
- NEWTON_API void NewtonBodySetFreezeState (const NewtonBody* const body, int state);
-
- NEWTON_API void NewtonBodySetDestructorCallback (const NewtonBody* const body, NewtonBodyDestructor callback);
- NEWTON_API NewtonBodyDestructor NewtonBodyGetDestructorCallback (const NewtonBody* const body);
-
- NEWTON_API void NewtonBodySetTransformCallback (const NewtonBody* const body, NewtonSetTransform callback);
- NEWTON_API NewtonSetTransform NewtonBodyGetTransformCallback (const NewtonBody* const body);
-
- NEWTON_API void NewtonBodySetForceAndTorqueCallback (const NewtonBody* const body, NewtonApplyForceAndTorque callback);
- NEWTON_API NewtonApplyForceAndTorque NewtonBodyGetForceAndTorqueCallback (const NewtonBody* const body);
-
- NEWTON_API int NewtonBodyGetID (const NewtonBody* const body);
-
- NEWTON_API void NewtonBodySetUserData (const NewtonBody* const body, void* const userData);
- NEWTON_API void* NewtonBodyGetUserData (const NewtonBody* const body);
-
- NEWTON_API NewtonWorld* NewtonBodyGetWorld (const NewtonBody* const body);
- NEWTON_API NewtonCollision* NewtonBodyGetCollision (const NewtonBody* const body);
- NEWTON_API int NewtonBodyGetMaterialGroupID (const NewtonBody* const body);
-
- NEWTON_API int NewtonBodyGetContinuousCollisionMode (const NewtonBody* const body);
- NEWTON_API int NewtonBodyGetJointRecursiveCollision (const NewtonBody* const body);
-
- NEWTON_API void NewtonBodyGetPosition(const NewtonBody* const body, dFloat* const pos);
- NEWTON_API void NewtonBodyGetMatrix(const NewtonBody* const body, dFloat* const matrix);
- NEWTON_API void NewtonBodyGetRotation(const NewtonBody* const body, dFloat* const rotation);
- NEWTON_API void NewtonBodyGetMassMatrix (const NewtonBody* const body, dFloat* mass, dFloat* const Ixx, dFloat* const Iyy, dFloat* const Izz);
- NEWTON_API void NewtonBodyGetInvMass(const NewtonBody* const body, dFloat* const invMass, dFloat* const invIxx, dFloat* const invIyy, dFloat* const invIzz);
- NEWTON_API void NewtonBodyGetInertiaMatrix(const NewtonBody* const body, dFloat* const inertiaMatrix);
- NEWTON_API void NewtonBodyGetInvInertiaMatrix(const NewtonBody* const body, dFloat* const invInertiaMatrix);
- NEWTON_API void NewtonBodyGetOmega(const NewtonBody* const body, dFloat* const vector);
- NEWTON_API void NewtonBodyGetVelocity(const NewtonBody* const body, dFloat* const vector);
- NEWTON_API void NewtonBodyGetForce(const NewtonBody* const body, dFloat* const vector);
- NEWTON_API void NewtonBodyGetTorque(const NewtonBody* const body, dFloat* const vector);
- NEWTON_API void NewtonBodyGetForceAcc(const NewtonBody* const body, dFloat* const vector);
- NEWTON_API void NewtonBodyGetTorqueAcc(const NewtonBody* const body, dFloat* const vector);
- NEWTON_API void NewtonBodyGetCentreOfMass (const NewtonBody* const body, dFloat* const com);
-
- NEWTON_API void NewtonBodyGetPointVelocity (const NewtonBody* const body, const dFloat* const point, dFloat* const velocOut);
- NEWTON_API void NewtonBodyAddImpulse (const NewtonBody* const body, const dFloat* const pointDeltaVeloc, const dFloat* const pointPosit);
- NEWTON_API void NewtonBodyApplyImpulseArray (const NewtonBody* const body, int impuleCount, int strideInByte, const dFloat* const impulseArray, const dFloat* const pointArray);
-
- NEWTON_API void NewtonBodyApplyImpulsePair (const NewtonBody* const body, dFloat* const linearImpulse, dFloat* const angularImpulse);
-
- NEWTON_API void NewtonBodyIntegrateVelocity (const NewtonBody* const body, dFloat timestep);
-
- NEWTON_API dFloat NewtonBodyGetLinearDamping (const NewtonBody* const body);
- NEWTON_API void NewtonBodyGetAngularDamping (const NewtonBody* const body, dFloat* const vector);
- NEWTON_API void NewtonBodyGetAABB (const NewtonBody* const body, dFloat* const p0, dFloat* const p1);
-
-
- NEWTON_API NewtonJoint* NewtonBodyGetFirstJoint (const NewtonBody* const body);
- NEWTON_API NewtonJoint* NewtonBodyGetNextJoint (const NewtonBody* const body, const NewtonJoint* const joint);
- NEWTON_API NewtonJoint* NewtonBodyGetFirstContactJoint (const NewtonBody* const body);
- NEWTON_API NewtonJoint* NewtonBodyGetNextContactJoint (const NewtonBody* const body, const NewtonJoint* const contactJoint);
-
-
- // **********************************************************************************************
- //
- // contact joints interface
- //
- // **********************************************************************************************
-
- NEWTON_API void* NewtonContactJointGetFirstContact (const NewtonJoint* const contactJoint);
- NEWTON_API void* NewtonContactJointGetNextContact (const NewtonJoint* const contactJoint, void* const contact);
-
- NEWTON_API int NewtonContactJointGetContactCount(const NewtonJoint* const contactJoint);
- NEWTON_API void NewtonContactJointRemoveContact(const NewtonJoint* const contactJoint, void* const contact);
-
- NEWTON_API dFloat NewtonContactJointGetClosestDistance(const NewtonJoint* const contactJoint);
-
- NEWTON_API NewtonMaterial* NewtonContactGetMaterial (const void* const contact);
-
- NEWTON_API NewtonCollision* NewtonContactGetCollision0 (const void* const contact);
- NEWTON_API NewtonCollision* NewtonContactGetCollision1 (const void* const contact);
-
- NEWTON_API void* NewtonContactGetCollisionID0 (const void* const contact);
- NEWTON_API void* NewtonContactGetCollisionID1 (const void* const contact);
-
-
- // **********************************************************************************************
- //
- // Common joint functions
- //
- // **********************************************************************************************
- NEWTON_API void* NewtonJointGetUserData (const NewtonJoint* const joint);
- NEWTON_API void NewtonJointSetUserData (const NewtonJoint* const joint, void* const userData);
-
- NEWTON_API NewtonBody* NewtonJointGetBody0 (const NewtonJoint* const joint);
- NEWTON_API NewtonBody* NewtonJointGetBody1 (const NewtonJoint* const joint);
-
- NEWTON_API void NewtonJointGetInfo (const NewtonJoint* const joint, NewtonJointRecord* const info);
- NEWTON_API int NewtonJointGetCollisionState (const NewtonJoint* const joint);
- NEWTON_API void NewtonJointSetCollisionState (const NewtonJoint* const joint, int state);
-
- NEWTON_API dFloat NewtonJointGetStiffness (const NewtonJoint* const joint);
- NEWTON_API void NewtonJointSetStiffness (const NewtonJoint* const joint, dFloat state);
-
- NEWTON_API void NewtonDestroyJoint(const NewtonWorld* const newtonWorld, const NewtonJoint* const joint);
- NEWTON_API void NewtonJointSetDestructor (const NewtonJoint* const joint, NewtonConstraintDestructor destructor);
-
- NEWTON_API int NewtonJointIsActive (const NewtonJoint* const joint);
-
-
-
- // **********************************************************************************************
- //
- // particle system interface (soft bodies, individual, pressure bodies and cloth)
- //
- // **********************************************************************************************
- NEWTON_API NewtonCollision* NewtonCreateClothPatch (const NewtonWorld* const newtonWorld, NewtonMesh* const mesh, int shapeID, NewtonClothPatchMaterial* const structuralMaterial, NewtonClothPatchMaterial* const bendMaterial);
- NEWTON_API NewtonCollision* NewtonCreateDeformableMesh (const NewtonWorld* const newtonWorld, NewtonMesh* const mesh, int shapeID);
-
- NEWTON_API void NewtonDeformableMeshCreateClusters (NewtonCollision* const deformableMesh, int clusterCount, dFloat overlapingWidth);
- NEWTON_API void NewtonDeformableMeshSetDebugCallback (NewtonCollision* const deformableMesh, NewtonCollisionIterator callback);
-
- NEWTON_API int NewtonDeformableMeshGetParticleCount (const NewtonCollision* const deformableMesh);
- NEWTON_API void NewtonDeformableMeshGetParticlePosition (NewtonCollision* const deformableMesh, int particleIndex, dFloat* const posit);
-
- NEWTON_API void NewtonDeformableMeshBeginConfiguration (const NewtonCollision* const deformableMesh);
- NEWTON_API void NewtonDeformableMeshUnconstraintParticle (NewtonCollision* const deformableMesh, int particleIndex);
- NEWTON_API void NewtonDeformableMeshConstraintParticle (NewtonCollision* const deformableMesh, int particleIndex, const dFloat* const posit, const NewtonBody* const body);
- NEWTON_API void NewtonDeformableMeshEndConfiguration (const NewtonCollision* const deformableMesh);
-
-// NEWTON_API void NewtonDeformableMeshSetPlasticity (NewtonCollision* const deformableMesh, dFloat plasticity);
-// NEWTON_API void NewtonDeformableMeshSetStiffness (NewtonCollision* const deformableMesh, dFloat stiffness);
- NEWTON_API void NewtonDeformableMeshSetSkinThickness (NewtonCollision* const deformableMesh, dFloat skinThickness);
-
- NEWTON_API void NewtonDeformableMeshUpdateRenderNormals (const NewtonCollision* const deformableMesh);
- NEWTON_API int NewtonDeformableMeshGetVertexCount (const NewtonCollision* const deformableMesh);
- NEWTON_API void NewtonDeformableMeshGetVertexStreams (const NewtonCollision* const deformableMesh, int vertexStrideInByte, dFloat* const vertex, int normalStrideInByte, dFloat* const normal, int uvStrideInByte0, dFloat* const uv0);
- NEWTON_API NewtonDeformableMeshSegment* NewtonDeformableMeshGetFirstSegment (const NewtonCollision* const deformableMesh);
- NEWTON_API NewtonDeformableMeshSegment* NewtonDeformableMeshGetNextSegment (const NewtonCollision* const deformableMesh, const NewtonDeformableMeshSegment* const segment);
-
- NEWTON_API int NewtonDeformableMeshSegmentGetMaterialID (const NewtonCollision* const deformableMesh, const NewtonDeformableMeshSegment* const segment);
- NEWTON_API int NewtonDeformableMeshSegmentGetIndexCount (const NewtonCollision* const deformableMesh, const NewtonDeformableMeshSegment* const segment);
- NEWTON_API const int* NewtonDeformableMeshSegmentGetIndexList (const NewtonCollision* const deformableMesh, const NewtonDeformableMeshSegment* const segment);
-
-
-
-
- // **********************************************************************************************
- //
- // Ball and Socket joint functions
- //
- // **********************************************************************************************
- NEWTON_API NewtonJoint* NewtonConstraintCreateBall (const NewtonWorld* const newtonWorld, const dFloat* pivotPoint,
- const NewtonBody* const childBody, const NewtonBody* const parentBody);
- NEWTON_API void NewtonBallSetUserCallback (const NewtonJoint* const ball, NewtonBallCallback callback);
- NEWTON_API void NewtonBallGetJointAngle (const NewtonJoint* const ball, dFloat* angle);
- NEWTON_API void NewtonBallGetJointOmega (const NewtonJoint* const ball, dFloat* omega);
- NEWTON_API void NewtonBallGetJointForce (const NewtonJoint* const ball, dFloat* const force);
- NEWTON_API void NewtonBallSetConeLimits (const NewtonJoint* const ball, const dFloat* pin, dFloat maxConeAngle, dFloat maxTwistAngle);
-
- // **********************************************************************************************
- //
- // Hinge joint functions
- //
- // **********************************************************************************************
- NEWTON_API NewtonJoint* NewtonConstraintCreateHinge (const NewtonWorld* const newtonWorld,
- const dFloat* pivotPoint, const dFloat* pinDir,
- const NewtonBody* const childBody, const NewtonBody* const parentBody);
-
- NEWTON_API void NewtonHingeSetUserCallback (const NewtonJoint* const hinge, NewtonHingeCallback callback);
- NEWTON_API dFloat NewtonHingeGetJointAngle (const NewtonJoint* const hinge);
- NEWTON_API dFloat NewtonHingeGetJointOmega (const NewtonJoint* const hinge);
- NEWTON_API void NewtonHingeGetJointForce (const NewtonJoint* const hinge, dFloat* const force);
- NEWTON_API dFloat NewtonHingeCalculateStopAlpha (const NewtonJoint* const hinge, const NewtonHingeSliderUpdateDesc* const desc, dFloat angle);
-
- // **********************************************************************************************
- //
- // Slider joint functions
- //
- // **********************************************************************************************
- NEWTON_API NewtonJoint* NewtonConstraintCreateSlider (const NewtonWorld* const newtonWorld,
- const dFloat* pivotPoint, const dFloat* pinDir,
- const NewtonBody* const childBody, const NewtonBody* const parentBody);
- NEWTON_API void NewtonSliderSetUserCallback (const NewtonJoint* const slider, NewtonSliderCallback callback);
- NEWTON_API dFloat NewtonSliderGetJointPosit (const NewtonJoint* slider);
- NEWTON_API dFloat NewtonSliderGetJointVeloc (const NewtonJoint* slider);
- NEWTON_API void NewtonSliderGetJointForce (const NewtonJoint* const slider, dFloat* const force);
- NEWTON_API dFloat NewtonSliderCalculateStopAccel (const NewtonJoint* const slider, const NewtonHingeSliderUpdateDesc* const desc, dFloat position);
-
-
- // **********************************************************************************************
- //
- // Corkscrew joint functions
- //
- // **********************************************************************************************
- NEWTON_API NewtonJoint* NewtonConstraintCreateCorkscrew (const NewtonWorld* const newtonWorld,
- const dFloat* pivotPoint, const dFloat* pinDir,
- const NewtonBody* const childBody, const NewtonBody* const parentBody);
- NEWTON_API void NewtonCorkscrewSetUserCallback (const NewtonJoint* const corkscrew, NewtonCorkscrewCallback callback);
- NEWTON_API dFloat NewtonCorkscrewGetJointPosit (const NewtonJoint* const corkscrew);
- NEWTON_API dFloat NewtonCorkscrewGetJointAngle (const NewtonJoint* const corkscrew);
- NEWTON_API dFloat NewtonCorkscrewGetJointVeloc (const NewtonJoint* const corkscrew);
- NEWTON_API dFloat NewtonCorkscrewGetJointOmega (const NewtonJoint* const corkscrew);
- NEWTON_API void NewtonCorkscrewGetJointForce (const NewtonJoint* const corkscrew, dFloat* const force);
- NEWTON_API dFloat NewtonCorkscrewCalculateStopAlpha (const NewtonJoint* const corkscrew, const NewtonHingeSliderUpdateDesc* const desc, dFloat angle);
- NEWTON_API dFloat NewtonCorkscrewCalculateStopAccel (const NewtonJoint* const corkscrew, const NewtonHingeSliderUpdateDesc* const desc, dFloat position);
-
-
- // **********************************************************************************************
- //
- // Universal joint functions
- //
- // **********************************************************************************************
- NEWTON_API NewtonJoint* NewtonConstraintCreateUniversal (const NewtonWorld* const newtonWorld,
- const dFloat* pivotPoint, const dFloat* pinDir0, const dFloat* pinDir1,
- const NewtonBody* const childBody, const NewtonBody* const parentBody);
- NEWTON_API void NewtonUniversalSetUserCallback (const NewtonJoint* const universal, NewtonUniversalCallback callback);
- NEWTON_API dFloat NewtonUniversalGetJointAngle0 (const NewtonJoint* const universal);
- NEWTON_API dFloat NewtonUniversalGetJointAngle1 (const NewtonJoint* const universal);
- NEWTON_API dFloat NewtonUniversalGetJointOmega0 (const NewtonJoint* const universal);
- NEWTON_API dFloat NewtonUniversalGetJointOmega1 (const NewtonJoint* const universal);
- NEWTON_API void NewtonUniversalGetJointForce (const NewtonJoint* const universal, dFloat* const force);
- NEWTON_API dFloat NewtonUniversalCalculateStopAlpha0 (const NewtonJoint* const universal, const NewtonHingeSliderUpdateDesc* const desc, dFloat angle);
- NEWTON_API dFloat NewtonUniversalCalculateStopAlpha1 (const NewtonJoint* const universal, const NewtonHingeSliderUpdateDesc* const desc, dFloat angle);
-
-
- // **********************************************************************************************
- //
- // Up vector joint functions
- //
- // **********************************************************************************************
- NEWTON_API NewtonJoint* NewtonConstraintCreateUpVector (const NewtonWorld* const newtonWorld, const dFloat* pinDir, const NewtonBody* const body);
- NEWTON_API void NewtonUpVectorGetPin (const NewtonJoint* const upVector, dFloat *pin);
- NEWTON_API void NewtonUpVectorSetPin (const NewtonJoint* const upVector, const dFloat *pin);
-
-
- // **********************************************************************************************
- //
- // User defined bilateral Joint
- //
- // **********************************************************************************************
- NEWTON_API NewtonJoint* NewtonConstraintCreateUserJoint (const NewtonWorld* const newtonWorld, int maxDOF,
- NewtonUserBilateralCallback callback,
- NewtonUserBilateralGetInfoCallback getInfo,
- const NewtonBody* const childBody, const NewtonBody* const parentBody) ;
- NEWTON_API void NewtonUserJointSetFeedbackCollectorCallback (const NewtonJoint* const joint, NewtonUserBilateralCallback getFeedback);
- NEWTON_API void NewtonUserJointAddLinearRow (const NewtonJoint* const joint, const dFloat* const pivot0, const dFloat* const pivot1, const dFloat* const dir);
- NEWTON_API void NewtonUserJointAddAngularRow (const NewtonJoint* const joint, dFloat relativeAngle, const dFloat* const dir);
- NEWTON_API void NewtonUserJointAddGeneralRow (const NewtonJoint* const joint, const dFloat* const jacobian0, const dFloat* const jacobian1);
- NEWTON_API void NewtonUserJointSetRowMinimumFriction (const NewtonJoint* const joint, dFloat friction);
- NEWTON_API void NewtonUserJointSetRowMaximumFriction (const NewtonJoint* const joint, dFloat friction);
- NEWTON_API void NewtonUserJointSetRowAcceleration (const NewtonJoint* const joint, dFloat acceleration);
- NEWTON_API void NewtonUserJointSetRowSpringDamperAcceleration (const NewtonJoint* const joint, dFloat springK, dFloat springD);
- NEWTON_API void NewtonUserJointSetRowStiffness (const NewtonJoint* const joint, dFloat stiffness);
- NEWTON_API dFloat NewtonUserJointGetRowForce (const NewtonJoint* const joint, int row);
-
- NEWTON_API void NewtonUserJointSetSolver (const NewtonJoint* const joint, int solver, int maxContactJoints);
-
-
- // ************************************************************************************************************************
- //
- // Acyclic articulation offer the same level of accuracy that Feather stone reduced coordinate link chains algorithm
- // these are goo to make near perfect Rag dolls, physically based Created animated bodies, simple robotic contractions with not internal loops,
- // Vehicles, Ropes, etc. that all interact seamlessly and natural with the physics world.
- //
- // ************************************************************************************************************************
- NEWTON_API NewtonAcyclicArticulation* NewtonAcyclicArticulationCreate (NewtonBody* const rootBone);
- NEWTON_API void NewtonAcyclicArticulationDelete (NewtonAcyclicArticulation* const articulation);
- NEWTON_API void* NewtonAcyclicArticulationAttachBone (NewtonAcyclicArticulation* const articulation, NewtonBody* const parentBone, NewtonBody* const childBone);
- NEWTON_API void NewtonAcyclicArticulationDetachBone (NewtonAcyclicArticulation* const articulation, void* const bone);
- NEWTON_API void NewtonAcyclicArticulationAddJoint (NewtonAcyclicArticulation* const articulation, NewtonJoint* const joint);
-
-
- // **********************************************************************************************
- //
- // Mesh joint functions
- //
- // **********************************************************************************************
- NEWTON_API NewtonMesh* NewtonMeshCreate(const NewtonWorld* const newtonWorld);
- NEWTON_API NewtonMesh* NewtonMeshCreateFromMesh(const NewtonMesh* const mesh);
- NEWTON_API NewtonMesh* NewtonMeshCreateFromCollision(const NewtonCollision* const collision);
- NEWTON_API NewtonMesh* NewtonMeshCreateConvexHull (const NewtonWorld* const newtonWorld, int pointCount, const dFloat* const vertexCloud, int strideInBytes, dFloat tolerance);
- NEWTON_API NewtonMesh* NewtonMeshCreateDelaunayTetrahedralization (const NewtonWorld* const newtonWorld, int pointCount, const dFloat* const vertexCloud, int strideInBytes, int materialID, const dFloat* const textureMatrix);
- NEWTON_API NewtonMesh* NewtonMeshCreateVoronoiConvexDecomposition (const NewtonWorld* const newtonWorld, int pointCount, const dFloat* const vertexCloud, int strideInBytes, int materialID, const dFloat* const textureMatrix);
- NEWTON_API NewtonMesh* NewtonMeshCreateFromSerialization (const NewtonWorld* const newtonWorld, NewtonDeserializeCallback deserializeFunction, void* const serializeHandle);
- NEWTON_API void NewtonMeshDestroy(const NewtonMesh* const mesh);
-
- NEWTON_API void NewtonMeshSerialize (const NewtonMesh* const mesh, NewtonSerializeCallback serializeFunction, void* const serializeHandle);
- NEWTON_API void NewtonMeshSaveOFF(const NewtonMesh* const mesh, const char* const filename);
- NEWTON_API NewtonMesh* NewtonMeshLoadOFF(const NewtonWorld* const newtonWorld, const char* const filename);
-
- NEWTON_API void NewtonMeshApplyTransform (const NewtonMesh* const mesh, const dFloat* const matrix);
- NEWTON_API void NewtonMeshCalculateOOBB(const NewtonMesh* const mesh, dFloat* const matrix, dFloat* const x, dFloat* const y, dFloat* const z);
-
- NEWTON_API void NewtonMeshCalculateVertexNormals(const NewtonMesh* const mesh, dFloat angleInRadians);
- NEWTON_API void NewtonMeshApplySphericalMapping(const NewtonMesh* const mesh, int material);
- NEWTON_API void NewtonMeshApplyCylindricalMapping(const NewtonMesh* const mesh, int cylinderMaterial, int capMaterial);
- NEWTON_API void NewtonMeshApplyBoxMapping(const NewtonMesh* const mesh, int frontMaterial, int sideMaterial, int topMaterial);
- NEWTON_API void NewtonMeshApplyAngleBasedMapping(const NewtonMesh* const mesh, int material, NewtonReportProgress reportPrograssCallback, void* const reportPrgressUserData);
-
-
- NEWTON_API int NewtonMeshIsOpenMesh (const NewtonMesh* const mesh);
- NEWTON_API void NewtonMeshFixTJoints (const NewtonMesh* const mesh);
-
- NEWTON_API void NewtonMeshPolygonize (const NewtonMesh* const mesh);
- NEWTON_API void NewtonMeshTriangulate (const NewtonMesh* const mesh);
- NEWTON_API NewtonMesh* NewtonMeshUnion (const NewtonMesh* const mesh, const NewtonMesh* const clipper, const dFloat* const clipperMatrix);
- NEWTON_API NewtonMesh* NewtonMeshDifference (const NewtonMesh* const mesh, const NewtonMesh* const clipper, const dFloat* const clipperMatrix);
- NEWTON_API NewtonMesh* NewtonMeshIntersection (const NewtonMesh* const mesh, const NewtonMesh* const clipper, const dFloat* const clipperMatrix);
- NEWTON_API void NewtonMeshClip (const NewtonMesh* const mesh, const NewtonMesh* const clipper, const dFloat* const clipperMatrix, NewtonMesh** const topMesh, NewtonMesh** const bottomMesh);
-
- NEWTON_API NewtonMesh* NewtonMeshConvexMeshIntersection (const NewtonMesh* const mesh, const NewtonMesh* const convexMesh);
-
- NEWTON_API NewtonMesh* NewtonMeshSimplify (const NewtonMesh* const mesh, int maxVertexCount, NewtonReportProgress reportPrograssCallback, void* const reportPrgressUserData);
- NEWTON_API NewtonMesh* NewtonMeshApproximateConvexDecomposition (const NewtonMesh* const mesh, dFloat maxConcavity, dFloat backFaceDistanceFactor, int maxCount, int maxVertexPerHull, NewtonReportProgress reportProgressCallback, void* const reportProgressUserData);
-
- NEWTON_API void NewtonRemoveUnusedVertices(const NewtonMesh* const mesh, int* const vertexRemapTable);
-
- NEWTON_API void NewtonMeshBeginFace(const NewtonMesh* const mesh);
- NEWTON_API void NewtonMeshAddFace(const NewtonMesh* const mesh, int vertexCount, const dFloat* const vertex, int strideInBytes, int materialIndex);
- NEWTON_API void NewtonMeshEndFace(const NewtonMesh* const mesh);
-
- NEWTON_API void NewtonMeshBuildFromVertexListIndexList(const NewtonMesh* const mesh,
- int faceCount, const int* const faceIndexCount, const int* const faceMaterialIndex,
- const dFloat* const vertex, int vertexStrideInBytes, const int* const vertexIndex,
- const dFloat* const normal, int normalStrideInBytes, const int* const normalIndex,
- const dFloat* const uv0, int uv0StrideInBytes, const int* const uv0Index,
- const dFloat* const uv1, int uv1StrideInBytes, const int* const uv1Index);
-
- NEWTON_API void NewtonMeshGetVertexStreams (const NewtonMesh* const mesh,
- int vertexStrideInByte, dFloat* const vertex,
- int normalStrideInByte, dFloat* const normal,
- int uvStrideInByte0, dFloat* const uv0,
- int uvStrideInByte1, dFloat* const uv1);
-
- NEWTON_API void NewtonMeshGetIndirectVertexStreams(const NewtonMesh* const mesh,
- int vertexStrideInByte, dFloat* const vertex, int* const vertexIndices, int* const vertexCount,
- int normalStrideInByte, dFloat* const normal, int* const normalIndices, int* const normalCount,
- int uvStrideInByte0, dFloat* const uv0, int* const uvIndices0, int* const uvCount0,
- int uvStrideInByte1, dFloat* const uv1, int* const uvIndices1, int* const uvCount1);
-
- NEWTON_API void* NewtonMeshBeginHandle (const NewtonMesh* const mesh);
- NEWTON_API void NewtonMeshEndHandle (const NewtonMesh* const mesh, void* const handle);
- NEWTON_API int NewtonMeshFirstMaterial (const NewtonMesh* const mesh, void* const handle);
- NEWTON_API int NewtonMeshNextMaterial (const NewtonMesh* const mesh, void* const handle, int materialId);
- NEWTON_API int NewtonMeshMaterialGetMaterial (const NewtonMesh* const mesh, void* const handle, int materialId);
- NEWTON_API int NewtonMeshMaterialGetIndexCount (const NewtonMesh* const mesh, void* const handle, int materialId);
- NEWTON_API void NewtonMeshMaterialGetIndexStream (const NewtonMesh* const mesh, void* const handle, int materialId, int* const index);
- NEWTON_API void NewtonMeshMaterialGetIndexStreamShort (const NewtonMesh* const mesh, void* const handle, int materialId, short int* const index);
-
- NEWTON_API NewtonMesh* NewtonMeshCreateFirstSingleSegment (const NewtonMesh* const mesh);
- NEWTON_API NewtonMesh* NewtonMeshCreateNextSingleSegment (const NewtonMesh* const mesh, const NewtonMesh* const segment);
-
- NEWTON_API NewtonMesh* NewtonMeshCreateFirstLayer (const NewtonMesh* const mesh);
- NEWTON_API NewtonMesh* NewtonMeshCreateNextLayer (const NewtonMesh* const mesh, const NewtonMesh* const segment);
-
-
- NEWTON_API int NewtonMeshGetTotalFaceCount (const NewtonMesh* const mesh);
- NEWTON_API int NewtonMeshGetTotalIndexCount (const NewtonMesh* const mesh);
- NEWTON_API void NewtonMeshGetFaces (const NewtonMesh* const mesh, int* const faceIndexCount, int* const faceMaterial, void** const faceIndices);
-
-
- NEWTON_API int NewtonMeshGetPointCount (const NewtonMesh* const mesh);
- NEWTON_API int NewtonMeshGetPointStrideInByte (const NewtonMesh* const mesh);
- NEWTON_API dFloat64* NewtonMeshGetPointArray (const NewtonMesh* const mesh);
- NEWTON_API dFloat64* NewtonMeshGetNormalArray (const NewtonMesh* const mesh);
- NEWTON_API dFloat64* NewtonMeshGetUV0Array (const NewtonMesh* const mesh);
- NEWTON_API dFloat64* NewtonMeshGetUV1Array (const NewtonMesh* const mesh);
-
- NEWTON_API int NewtonMeshGetVertexCount (const NewtonMesh* const mesh);
- NEWTON_API int NewtonMeshGetVertexStrideInByte (const NewtonMesh* const mesh);
- NEWTON_API dFloat64* NewtonMeshGetVertexArray (const NewtonMesh* const mesh);
-
-
- NEWTON_API void* NewtonMeshGetFirstVertex (const NewtonMesh* const mesh);
- NEWTON_API void* NewtonMeshGetNextVertex (const NewtonMesh* const mesh, const void* const vertex);
- NEWTON_API int NewtonMeshGetVertexIndex (const NewtonMesh* const mesh, const void* const vertex);
-
- NEWTON_API void* NewtonMeshGetFirstPoint (const NewtonMesh* const mesh);
- NEWTON_API void* NewtonMeshGetNextPoint (const NewtonMesh* const mesh, const void* const point);
- NEWTON_API int NewtonMeshGetPointIndex (const NewtonMesh* const mesh, const void* const point);
- NEWTON_API int NewtonMeshGetVertexIndexFromPoint (const NewtonMesh* const mesh, const void* const point);
-
-
- NEWTON_API void* NewtonMeshGetFirstEdge (const NewtonMesh* const mesh);
- NEWTON_API void* NewtonMeshGetNextEdge (const NewtonMesh* const mesh, const void* const edge);
- NEWTON_API void NewtonMeshGetEdgeIndices (const NewtonMesh* const mesh, const void* const edge, int* const v0, int* const v1);
- //NEWTON_API void NewtonMeshGetEdgePointIndices (const NewtonMesh* const mesh, const void* const edge, int* const v0, int* const v1);
-
- NEWTON_API void* NewtonMeshGetFirstFace (const NewtonMesh* const mesh);
- NEWTON_API void* NewtonMeshGetNextFace (const NewtonMesh* const mesh, const void* const face);
- NEWTON_API int NewtonMeshIsFaceOpen (const NewtonMesh* const mesh, const void* const face);
- NEWTON_API int NewtonMeshGetFaceMaterial (const NewtonMesh* const mesh, const void* const face);
- NEWTON_API int NewtonMeshGetFaceIndexCount (const NewtonMesh* const mesh, const void* const face);
- NEWTON_API void NewtonMeshGetFaceIndices (const NewtonMesh* const mesh, const void* const face, int* const indices);
- NEWTON_API void NewtonMeshGetFacePointIndices (const NewtonMesh* const mesh, const void* const face, int* const indices);
- NEWTON_API void NewtonMeshCalculateFaceNormal (const NewtonMesh* const mesh, const void* const face, dFloat64* const normal);
-
- NEWTON_API void NewtonMeshSetFaceMaterial (const NewtonMesh* const mesh, const void* const face, int matId);
-
-
-#ifdef __cplusplus
+NEWTON_API NewtonCollision* NewtonCreateSceneCollision (const NewtonWorld* const newtonWorld, int shapeID);
+NEWTON_API NewtonSceneProxy* NewtonSceneCollisionCreateProxy (NewtonCollision* const scene, NewtonCollision* const collision, const dFloat* const matrix);
+
+NEWTON_API void NewtonSceneCollisionDestroyProxy (NewtonCollision* const scene, NewtonSceneProxy* Proxy);
+NEWTON_API void NewtonSceneProxySetMatrix (NewtonSceneProxy* const proxy, const dFloat* matrix);
+NEWTON_API void NewtonSceneProxyGetMatrix (NewtonSceneProxy* const proxy, dFloat* matrix);
+NEWTON_API void NewtonSceneSetProxyUserData (NewtonSceneProxy* const proxy, void* userData);
+NEWTON_API void* NewtonSceneGetProxyUserData (NewtonSceneProxy* const proxy);
+
+NEWTON_API NewtonSceneProxy* NewtonSceneGetFirstProxy (NewtonCollision* const scene);
+NEWTON_API NewtonSceneProxy* NewtonSceneGetNextProxy (NewtonCollision* const scene, NewtonSceneProxy* const proxy);
+
+NEWTON_API void NewtonSceneCollisionOptimize (NewtonCollision* scene);
+
+// ***********************************************************************************************************
+//
+// Collision serialization functions
+//
+// ***********************************************************************************************************
+NEWTON_API NewtonCollision* NewtonCreateCollisionFromSerialization (const NewtonWorld* const newtonWorld, NewtonDeserialize deserializeFunction, void* const serializeHandle);
+NEWTON_API void NewtonCollisionSerialize (const NewtonWorld* const newtonWorld, const NewtonCollision* const collision, NewtonSerialize serializeFunction, void* const serializeHandle);
+NEWTON_API void NewtonCollisionGetInfo (const NewtonCollision* const collision, NewtonCollisionInfoRecord* const collisionInfo);
+
+// **********************************************************************************************
+//
+// Static collision shapes functions
+//
+// **********************************************************************************************
+NEWTON_API NewtonCollision* NewtonCreateHeightFieldCollision (const NewtonWorld* const newtonWorld, int width, int height, int gridsDiagonals,
+ const unsigned short* const elevationMap, const char* const attributeMap,
+ dFloat horizontalScale, dFloat verticalScale, int shapeID);
+NEWTON_API void NewtonHeightFieldSetUserRayCastCallback (const NewtonCollision* const treeCollision, NewtonHeightFieldRayCastCallback rayHitCallback);
+
+
+NEWTON_API NewtonCollision* NewtonCreateTreeCollision (const NewtonWorld* const newtonWorld, int shapeID);
+NEWTON_API NewtonCollision* NewtonCreateTreeCollisionFromMesh (const NewtonWorld* const newtonWorld, const NewtonMesh* const mesh, int shapeID);
+
+NEWTON_API void NewtonTreeCollisionSetUserRayCastCallback (const NewtonCollision* const treeCollision, NewtonCollisionTreeRayCastCallback rayHitCallback);
+
+NEWTON_API void NewtonTreeCollisionBeginBuild (const NewtonCollision* treeCollision);
+NEWTON_API void NewtonTreeCollisionAddFace (const NewtonCollision* const treeCollision, int vertexCount, const dFloat* const vertexPtr, int strideInBytes, int faceAttribute);
+NEWTON_API void NewtonTreeCollisionEndBuild (const NewtonCollision* const treeCollision, int optimize);
+
+NEWTON_API int NewtonTreeCollisionGetFaceAtribute (const NewtonCollision* const treeCollision, const int* const faceIndexArray);
+NEWTON_API void NewtonTreeCollisionSetFaceAtribute (const NewtonCollision* const treeCollision, const int* const faceIndexArray, int attribute);
+NEWTON_API int NewtonTreeCollisionGetVertexListIndexListInAABB (const NewtonCollision* const treeCollision, const dFloat* const p0, const dFloat* const p1, const dFloat** const vertexArray, int* const vertexCount, int* const vertexStrideInBytes, const int* const indexList, int maxIndexCount, const int* const faceAttribute);
+
+
+NEWTON_API void NewtonStaticCollisionSetDebugCallback (const NewtonCollision* const staticCollision, NewtonTreeCollisionCallback userCallback);
+
+// **********************************************************************************************
+//
+// General purpose collision library functions
+//
+// **********************************************************************************************
+NEWTON_API int NewtonCollisionPointDistance (const NewtonWorld* const newtonWorld, const dFloat* const point,
+ const NewtonCollision* const collision, const dFloat* const matrix, dFloat* const contact, dFloat* const normal, int threadIndex);
+
+NEWTON_API int NewtonCollisionClosestPoint (const NewtonWorld* const newtonWorld,
+ const NewtonCollision* const collisionA, const dFloat* const matrixA, const NewtonCollision* const collisionB, const dFloat* const matrixB,
+ dFloat* const contactA, dFloat* const contactB, dFloat* const normalAB, int threadIndex);
+
+NEWTON_API int NewtonCollisionCollide (const NewtonWorld* const newtonWorld, int maxSize,
+ const NewtonCollision* const collisionA, const dFloat* const matrixA,
+ const NewtonCollision* const collisionB, const dFloat* const matrixB,
+ dFloat* const contacts, dFloat* const normals, dFloat* const penetration, int threadIndex);
+
+NEWTON_API int NewtonCollisionCollideContinue (const NewtonWorld* const newtonWorld, int maxSize, const dFloat timestep,
+ const NewtonCollision* const collisionA, const dFloat* const matrixA, const dFloat* const velocA, const dFloat* omegaA,
+ const NewtonCollision* const collisionB, const dFloat* const matrixB, const dFloat* const velocB, const dFloat* const omegaB,
+ dFloat* const timeOfImpact, dFloat* const contacts, dFloat* const normals, dFloat* const penetration, int threadIndex);
+
+NEWTON_API void NewtonCollisionSupportVertex (const NewtonCollision* const collision, const dFloat* const dir, dFloat* const vertex);
+NEWTON_API dFloat NewtonCollisionRayCast (const NewtonCollision* const collision, const dFloat* const p0, const dFloat* const p1, dFloat* const normal, int* const attribute);
+NEWTON_API void NewtonCollisionCalculateAABB (const NewtonCollision* const collision, const dFloat* const matrix, dFloat* const p0, dFloat* const p1);
+NEWTON_API void NewtonCollisionForEachPolygonDo (const NewtonCollision* const collision, const dFloat* const matrix, NewtonCollisionIterator callback, void* const userData);
+
+
+// **********************************************************************************************
+//
+// transforms utility functions
+//
+// **********************************************************************************************
+NEWTON_API void NewtonGetEulerAngle (const dFloat* const matrix, dFloat* const eulersAngles);
+NEWTON_API void NewtonSetEulerAngle (const dFloat* const eulersAngles, dFloat* const matrix);
+NEWTON_API dFloat NewtonCalculateSpringDamperAcceleration (dFloat dt, dFloat ks, dFloat x, dFloat kd, dFloat s);
+
+// **********************************************************************************************
+//
+// body manipulation functions
+//
+// **********************************************************************************************
+NEWTON_API NewtonBody* NewtonCreateBody (const NewtonWorld* const newtonWorld, const NewtonCollision* const collision, const dFloat* const matrix);
+NEWTON_API void NewtonDestroyBody(const NewtonWorld* const newtonWorld, const NewtonBody* const body);
+
+NEWTON_API void NewtonBodyAddForce (const NewtonBody* const body, const dFloat* const force);
+NEWTON_API void NewtonBodyAddTorque (const NewtonBody* const body, const dFloat* const torque);
+NEWTON_API void NewtonBodyCalculateInverseDynamicsForce (const NewtonBody* const body, dFloat timestep, const dFloat* const desiredVeloc, dFloat* const forceOut);
+
+NEWTON_API void NewtonBodySetMatrix (const NewtonBody* const body, const dFloat* const matrix);
+NEWTON_API void NewtonBodySetMatrixRecursive (const NewtonBody* const body, const dFloat* const matrix);
+NEWTON_API void NewtonBodySetMassMatrix (const NewtonBody* const body, dFloat mass, dFloat Ixx, dFloat Iyy, dFloat Izz);
+NEWTON_API void NewtonBodySetMaterialGroupID (const NewtonBody* const body, int id);
+NEWTON_API void NewtonBodySetContinuousCollisionMode (const NewtonBody* const body, unsigned state);
+NEWTON_API void NewtonBodySetJointRecursiveCollision (const NewtonBody* const body, unsigned state);
+NEWTON_API void NewtonBodySetOmega (const NewtonBody* const body, const dFloat* const omega);
+NEWTON_API void NewtonBodySetVelocity (const NewtonBody* const body, const dFloat* const velocity);
+NEWTON_API void NewtonBodySetForce (const NewtonBody* const body, const dFloat* const force);
+NEWTON_API void NewtonBodySetTorque (const NewtonBody* const body, const dFloat* const torque);
+
+NEWTON_API void NewtonBodySetCentreOfMass (const NewtonBody* const body, const dFloat* const com);
+NEWTON_API void NewtonBodySetLinearDamping (const NewtonBody* const body, dFloat linearDamp);
+NEWTON_API void NewtonBodySetAngularDamping (const NewtonBody* const body, const dFloat* const angularDamp);
+NEWTON_API void NewtonBodySetUserData (const NewtonBody* const body, void* const userData);
+NEWTON_API void NewtonBodySetCollision (const NewtonBody* const body, const NewtonCollision* const collision);
+
+
+
+NEWTON_API int NewtonBodyGetSleepState (const NewtonBody* const body);
+NEWTON_API int NewtonBodyGetAutoSleep (const NewtonBody* const body);
+NEWTON_API void NewtonBodySetAutoSleep (const NewtonBody* const body, int state);
+
+NEWTON_API int NewtonBodyGetFreezeState(const NewtonBody* const body);
+NEWTON_API void NewtonBodySetFreezeState (const NewtonBody* const body, int state);
+
+
+// NEWTON_API void NewtonBodySetAutoFreeze(const NewtonBody* const body, int state);
+// NEWTON_API void NewtonBodyCoriolisForcesMode (const NewtonBody* const body, int mode);
+// NEWTON_API void NewtonBodySetGyroscopicForcesMode (const NewtonBody* const body, int mode);
+// NEWTON_API int NewtonBodyGetGyroscopicForcesMode (const NewtonBody* const body);
+// NEWTON_API int NewtonBodyGetFreezeState (const NewtonBody* const body);
+// NEWTON_API void NewtonBodySetFreezeState (const NewtonBody* const body, int state);
+// NEWTON_API void NewtonBodyGetFreezeTreshold (const NewtonBody* const body, dFloat* freezeSpeed2, dFloat* freezeOmega2);
+// NEWTON_API void NewtonBodySetFreezeTreshold (const NewtonBody* const body, dFloat freezeSpeed2, dFloat freezeOmega2, int framesCount);
+// NEWTON_API void NewtonBodySetAutoactiveCallback (const NewtonBody* const body, NewtonBodyActivationState callback);
+
+
+NEWTON_API void NewtonBodySetDestructorCallback (const NewtonBody* const body, NewtonBodyDestructor callback);
+
+NEWTON_API void NewtonBodySetTransformCallback (const NewtonBody* const body, NewtonSetTransform callback);
+NEWTON_API NewtonSetTransform NewtonBodyGetTransformCallback (const NewtonBody* const body);
+
+NEWTON_API void NewtonBodySetForceAndTorqueCallback (const NewtonBody* const body, NewtonApplyForceAndTorque callback);
+NEWTON_API NewtonApplyForceAndTorque NewtonBodyGetForceAndTorqueCallback (const NewtonBody* const body);
+NEWTON_API void* NewtonBodyGetUserData (const NewtonBody* const body);
+NEWTON_API NewtonWorld* NewtonBodyGetWorld (const NewtonBody* const body);
+NEWTON_API NewtonCollision* NewtonBodyGetCollision (const NewtonBody* const body);
+NEWTON_API int NewtonBodyGetMaterialGroupID (const NewtonBody* const body);
+
+NEWTON_API int NewtonBodyGetContinuousCollisionMode (const NewtonBody* const body);
+NEWTON_API int NewtonBodyGetJointRecursiveCollision (const NewtonBody* const body);
+
+NEWTON_API void NewtonBodyGetMatrix(const NewtonBody* const body, dFloat* const matrix);
+NEWTON_API void NewtonBodyGetRotation(const NewtonBody* const body, dFloat* const rotation);
+NEWTON_API void NewtonBodyGetMassMatrix (const NewtonBody* const body, dFloat* mass, dFloat* const Ixx, dFloat* const Iyy, dFloat* const Izz);
+NEWTON_API void NewtonBodyGetInvMass(const NewtonBody* const body, dFloat* const invMass, dFloat* const invIxx, dFloat* const invIyy, dFloat* const invIzz);
+NEWTON_API void NewtonBodyGetOmega(const NewtonBody* const body, dFloat* const vector);
+NEWTON_API void NewtonBodyGetVelocity(const NewtonBody* const body, dFloat* const vector);
+NEWTON_API void NewtonBodyGetForce(const NewtonBody* const body, dFloat* const vector);
+NEWTON_API void NewtonBodyGetTorque(const NewtonBody* const body, dFloat* const vector);
+NEWTON_API void NewtonBodyGetForceAcc(const NewtonBody* const body, dFloat* const vector);
+NEWTON_API void NewtonBodyGetTorqueAcc(const NewtonBody* const body, dFloat* const vector);
+NEWTON_API void NewtonBodyGetCentreOfMass (const NewtonBody* const body, dFloat* const com);
+
+NEWTON_API dFloat NewtonBodyGetLinearDamping (const NewtonBody* const body);
+NEWTON_API void NewtonBodyGetAngularDamping (const NewtonBody* const body, dFloat* const vector);
+NEWTON_API void NewtonBodyGetAABB (const NewtonBody* const body, dFloat* const p0, dFloat* const p1);
+NEWTON_API NewtonJoint* NewtonBodyGetFirstJoint (const NewtonBody* const body);
+NEWTON_API NewtonJoint* NewtonBodyGetNextJoint (const NewtonBody* const body, const NewtonJoint* const joint);
+NEWTON_API NewtonJoint* NewtonBodyGetFirstContactJoint (const NewtonBody* const body);
+NEWTON_API NewtonJoint* NewtonBodyGetNextContactJoint (const NewtonBody* const body, const NewtonJoint* const contactJoint);
+
+NEWTON_API void* NewtonContactJointGetFirstContact (const NewtonJoint* const contactJoint);
+NEWTON_API void* NewtonContactJointGetNextContact (const NewtonJoint* const contactJoint, void* const contact);
+
+NEWTON_API int NewtonContactJointGetContactCount(const NewtonJoint* const contactJoint);
+NEWTON_API void NewtonContactJointRemoveContact(const NewtonJoint* const contactJoint, void* const contact);
+
+NEWTON_API NewtonMaterial* NewtonContactGetMaterial (const void* const contact);
+
+
+NEWTON_API void NewtonBodyAddBuoyancyForce (const NewtonBody* const body, dFloat fluidDensity,
+ dFloat fluidLinearViscosity, dFloat fluidAngularViscosity,
+ const dFloat* const gravityVector, NewtonGetBuoyancyPlane buoyancyPlane, void* const context);
+
+// NEWTON_API void NewtonBodyForEachPolygonDo (const NewtonBody* const body, NewtonCollisionIterator callback);
+NEWTON_API void NewtonBodyAddImpulse (const NewtonBody* const body, const dFloat* const pointDeltaVeloc, const dFloat* const pointPosit);
+
+
+NEWTON_API void NewtonBodyApplyImpulseArray (const NewtonBody* const body, int impuleCount, int strideInByte, const dFloat* const impulseArray, const dFloat* const pointArray);
+
+
+// **********************************************************************************************
+//
+// Common joint functions
+//
+// **********************************************************************************************
+NEWTON_API void* NewtonJointGetUserData (const NewtonJoint* const joint);
+NEWTON_API void NewtonJointSetUserData (const NewtonJoint* const joint, void* const userData);
+
+NEWTON_API NewtonBody* NewtonJointGetBody0 (const NewtonJoint* const joint);
+NEWTON_API NewtonBody* NewtonJointGetBody1 (const NewtonJoint* const joint);
+
+NEWTON_API void NewtonJointGetInfo (const NewtonJoint* const joint, NewtonJointRecord* const info);
+NEWTON_API int NewtonJointGetCollisionState (const NewtonJoint* const joint);
+NEWTON_API void NewtonJointSetCollisionState (const NewtonJoint* const joint, int state);
+
+NEWTON_API dFloat NewtonJointGetStiffness (const NewtonJoint* const joint);
+NEWTON_API void NewtonJointSetStiffness (const NewtonJoint* const joint, dFloat state);
+
+NEWTON_API void NewtonDestroyJoint(const NewtonWorld* const newtonWorld, const NewtonJoint* const joint);
+NEWTON_API void NewtonJointSetDestructor (const NewtonJoint* const joint, NewtonConstraintDestructor destructor);
+
+
+
+
+// **********************************************************************************************
+//
+// Ball and Socket joint functions
+//
+// **********************************************************************************************
+NEWTON_API NewtonJoint* NewtonConstraintCreateBall (const NewtonWorld* const newtonWorld, const dFloat* pivotPoint,
+ const NewtonBody* const childBody, const NewtonBody* const parentBody);
+NEWTON_API void NewtonBallSetUserCallback (const NewtonJoint* const ball, NewtonBallCallBack callback);
+NEWTON_API void NewtonBallGetJointAngle (const NewtonJoint* const ball, dFloat* angle);
+NEWTON_API void NewtonBallGetJointOmega (const NewtonJoint* const ball, dFloat* omega);
+NEWTON_API void NewtonBallGetJointForce (const NewtonJoint* const ball, dFloat* const force);
+NEWTON_API void NewtonBallSetConeLimits (const NewtonJoint* const ball, const dFloat* pin, dFloat maxConeAngle, dFloat maxTwistAngle);
+
+// **********************************************************************************************
+//
+// Hinge joint functions
+//
+// **********************************************************************************************
+NEWTON_API NewtonJoint* NewtonConstraintCreateHinge (const NewtonWorld* const newtonWorld,
+ const dFloat* pivotPoint, const dFloat* pinDir,
+ const NewtonBody* const childBody, const NewtonBody* const parentBody);
+
+NEWTON_API void NewtonHingeSetUserCallback (const NewtonJoint* const hinge, NewtonHingeCallBack callback);
+NEWTON_API dFloat NewtonHingeGetJointAngle (const NewtonJoint* const hinge);
+NEWTON_API dFloat NewtonHingeGetJointOmega (const NewtonJoint* const hinge);
+NEWTON_API void NewtonHingeGetJointForce (const NewtonJoint* const hinge, dFloat* const force);
+NEWTON_API dFloat NewtonHingeCalculateStopAlpha (const NewtonJoint* const hinge, const NewtonHingeSliderUpdateDesc* const desc, dFloat angle);
+
+// **********************************************************************************************
+//
+// Slider joint functions
+//
+// **********************************************************************************************
+NEWTON_API NewtonJoint* NewtonConstraintCreateSlider (const NewtonWorld* const newtonWorld,
+ const dFloat* pivotPoint, const dFloat* pinDir,
+ const NewtonBody* const childBody, const NewtonBody* const parentBody);
+NEWTON_API void NewtonSliderSetUserCallback (const NewtonJoint* const slider, NewtonSliderCallBack callback);
+NEWTON_API dFloat NewtonSliderGetJointPosit (const NewtonJoint* slider);
+NEWTON_API dFloat NewtonSliderGetJointVeloc (const NewtonJoint* slider);
+NEWTON_API void NewtonSliderGetJointForce (const NewtonJoint* const slider, dFloat* const force);
+NEWTON_API dFloat NewtonSliderCalculateStopAccel (const NewtonJoint* const slider, const NewtonHingeSliderUpdateDesc* const desc, dFloat position);
+
+
+// **********************************************************************************************
+//
+// Corkscrew joint functions
+//
+// **********************************************************************************************
+NEWTON_API NewtonJoint* NewtonConstraintCreateCorkscrew (const NewtonWorld* const newtonWorld,
+ const dFloat* pivotPoint, const dFloat* pinDir,
+ const NewtonBody* const childBody, const NewtonBody* const parentBody);
+NEWTON_API void NewtonCorkscrewSetUserCallback (const NewtonJoint* const corkscrew, NewtonCorkscrewCallBack callback);
+NEWTON_API dFloat NewtonCorkscrewGetJointPosit (const NewtonJoint* const corkscrew);
+NEWTON_API dFloat NewtonCorkscrewGetJointAngle (const NewtonJoint* const corkscrew);
+NEWTON_API dFloat NewtonCorkscrewGetJointVeloc (const NewtonJoint* const corkscrew);
+NEWTON_API dFloat NewtonCorkscrewGetJointOmega (const NewtonJoint* const corkscrew);
+NEWTON_API void NewtonCorkscrewGetJointForce (const NewtonJoint* const corkscrew, dFloat* const force);
+NEWTON_API dFloat NewtonCorkscrewCalculateStopAlpha (const NewtonJoint* const corkscrew, const NewtonHingeSliderUpdateDesc* const desc, dFloat angle);
+NEWTON_API dFloat NewtonCorkscrewCalculateStopAccel (const NewtonJoint* const corkscrew, const NewtonHingeSliderUpdateDesc* const desc, dFloat position);
+
+
+// **********************************************************************************************
+//
+// Universal joint functions
+//
+// **********************************************************************************************
+NEWTON_API NewtonJoint* NewtonConstraintCreateUniversal (const NewtonWorld* const newtonWorld,
+ const dFloat* pivotPoint, const dFloat* pinDir0, const dFloat* pinDir1,
+ const NewtonBody* const childBody, const NewtonBody* const parentBody);
+NEWTON_API void NewtonUniversalSetUserCallback (const NewtonJoint* const universal, NewtonUniversalCallBack callback);
+NEWTON_API dFloat NewtonUniversalGetJointAngle0 (const NewtonJoint* const universal);
+NEWTON_API dFloat NewtonUniversalGetJointAngle1 (const NewtonJoint* const universal);
+NEWTON_API dFloat NewtonUniversalGetJointOmega0 (const NewtonJoint* const universal);
+NEWTON_API dFloat NewtonUniversalGetJointOmega1 (const NewtonJoint* const universal);
+NEWTON_API void NewtonUniversalGetJointForce (const NewtonJoint* const universal, dFloat* const force);
+NEWTON_API dFloat NewtonUniversalCalculateStopAlpha0 (const NewtonJoint* const universal, const NewtonHingeSliderUpdateDesc* const desc, dFloat angle);
+NEWTON_API dFloat NewtonUniversalCalculateStopAlpha1 (const NewtonJoint* const universal, const NewtonHingeSliderUpdateDesc* const desc, dFloat angle);
+
+
+// **********************************************************************************************
+//
+// Up vector joint functions
+//
+// **********************************************************************************************
+NEWTON_API NewtonJoint* NewtonConstraintCreateUpVector (const NewtonWorld* const newtonWorld, const dFloat* pinDir, const NewtonBody* const body);
+NEWTON_API void NewtonUpVectorGetPin (const NewtonJoint* const upVector, dFloat *pin);
+NEWTON_API void NewtonUpVectorSetPin (const NewtonJoint* const upVector, const dFloat *pin);
+
+
+// **********************************************************************************************
+//
+// User defined bilateral Joint
+//
+// **********************************************************************************************
+NEWTON_API NewtonJoint* NewtonConstraintCreateUserJoint (const NewtonWorld* const newtonWorld, int maxDOF,
+ NewtonUserBilateralCallBack callback,
+ NewtonUserBilateralGetInfoCallBack getInfo,
+ const NewtonBody* const childBody, const NewtonBody* const parentBody) ;
+NEWTON_API void NewtonUserJointSetFeedbackCollectorCallback (const NewtonJoint* const joint, NewtonUserBilateralCallBack getFeedback);
+NEWTON_API void NewtonUserJointAddLinearRow (const NewtonJoint* const joint, const dFloat* const pivot0, const dFloat* const pivot1, const dFloat* const dir);
+NEWTON_API void NewtonUserJointAddAngularRow (const NewtonJoint* const joint, dFloat relativeAngle, const dFloat* const dir);
+NEWTON_API void NewtonUserJointAddGeneralRow (const NewtonJoint* const joint, const dFloat* const jacobian0, const dFloat* const jacobian1);
+NEWTON_API void NewtonUserJointSetRowMinimumFriction (const NewtonJoint* const joint, dFloat friction);
+NEWTON_API void NewtonUserJointSetRowMaximumFriction (const NewtonJoint* const joint, dFloat friction);
+NEWTON_API void NewtonUserJointSetRowAcceleration (const NewtonJoint* const joint, dFloat acceleration);
+NEWTON_API void NewtonUserJointSetRowSpringDamperAcceleration (const NewtonJoint* const joint, dFloat springK, dFloat springD);
+NEWTON_API void NewtonUserJointSetRowStiffness (const NewtonJoint* const joint, dFloat stiffness);
+NEWTON_API dFloat NewtonUserJointGetRowForce (const NewtonJoint* const joint, int row);
+
+
+// **********************************************************************************************
+//
+// Mesh joint functions
+//
+// **********************************************************************************************
+NEWTON_API NewtonMesh* NewtonMeshCreate(const NewtonWorld* const newtonWorld);
+NEWTON_API NewtonMesh* NewtonMeshCreateFromMesh(const NewtonMesh* const mesh);
+NEWTON_API NewtonMesh* NewtonMeshCreateFromCollision(const NewtonCollision* const collision);
+NEWTON_API NewtonMesh* NewtonMeshConvexHull (const NewtonWorld* const newtonWorld, int count, const dFloat* const vertexCloud, int strideInBytes, dFloat tolerance);
+NEWTON_API NewtonMesh* NewtonMeshCreatePlane (const NewtonWorld* const newtonWorld, const dFloat* const locationMatrix, dFloat witdth, dFloat breadth, int material, const dFloat* const textureMatrix0, const dFloat* const textureMatrix1);
+
+NEWTON_API void NewtonMeshDestroy(const NewtonMesh* const mesh);
+
+ NEWTON_API void NewtonMesApplyTransform (const NewtonMesh* const mesh, const dFloat* const matrix);
+NEWTON_API void NewtonMeshCalculateOOBB(const NewtonMesh* const mesh, dFloat* const matrix, dFloat* const x, dFloat* const y, dFloat* const z);
+
+NEWTON_API void NewtonMeshCalculateVertexNormals(const NewtonMesh* const mesh, dFloat angleInRadians);
+NEWTON_API void NewtonMeshApplySphericalMapping(const NewtonMesh* const mesh, int material);
+NEWTON_API void NewtonMeshApplyBoxMapping(const NewtonMesh* const mesh, int front, int side, int top);
+NEWTON_API void NewtonMeshApplyCylindricalMapping(const NewtonMesh* const mesh, int cylinderMaterial, int capMaterial);
+
+NEWTON_API int NewtonMeshIsOpenMesh (const NewtonMesh* const mesh);
+NEWTON_API void NewtonMeshFixTJoints (const NewtonMesh* const mesh);
+
+
+NEWTON_API void NewtonMeshPolygonize (const NewtonMesh* const mesh);
+NEWTON_API void NewtonMeshTriangulate (const NewtonMesh* const mesh);
+NEWTON_API NewtonMesh* NewtonMeshUnion (const NewtonMesh* const mesh, const NewtonMesh* const clipper, const dFloat* const clipperMatrix);
+NEWTON_API NewtonMesh* NewtonMeshDifference (const NewtonMesh* const mesh, const NewtonMesh* const clipper, const dFloat* const clipperMatrix);
+NEWTON_API NewtonMesh* NewtonMeshIntersection (const NewtonMesh* const mesh, const NewtonMesh* const clipper, const dFloat* const clipperMatrix);
+NEWTON_API void NewtonMeshClip (const NewtonMesh* const mesh, const NewtonMesh* const clipper, const dFloat* const clipperMatrix, NewtonMesh** const topMesh, NewtonMesh** const bottomMesh);
+NEWTON_API void NewtonMeshPlaneClip (const NewtonMesh* const mesh, dFloat* const planeMatrix, const dFloat* const planeTextureMatrix, int planeMaterial, NewtonMesh** const topMesh, NewtonMesh** const bottomMesh);
+
+NEWTON_API NewtonMesh* NewtonMeshApproximateConvexDecomposition (const NewtonMesh* const mesh, dFloat maxConcavity, int maxCount);
+NEWTON_API NewtonMesh* NewtonMeshTetrahedralization (const NewtonMesh* const mesh, int internalMaterial, const dFloat* const textureMatrix);
+NEWTON_API NewtonMesh* NewtonMeshVoronoiDecomposition (const NewtonMesh* const mesh, int pointCount, int pointStrideInBytes, const dFloat* const pointCloud, int internalMaterial, const dFloat* const textureMatrix);
+
+
+NEWTON_API void NewtonRemoveUnusedVertices(const NewtonMesh* const mesh, int* const vertexRemapTable);
+
+NEWTON_API void NewtonMeshBeginFace(const NewtonMesh* const mesh);
+NEWTON_API void NewtonMeshAddFace(const NewtonMesh* const mesh, int vertexCount, const dFloat* const vertex, int strideInBytes, int materialIndex);
+NEWTON_API void NewtonMeshEndFace(const NewtonMesh* const mesh);
+
+NEWTON_API void NewtonMeshBuildFromVertexListIndexList(const NewtonMesh* const mesh,
+ int faceCount, const int* const faceIndexCount, const int* const faceMaterialIndex,
+ const dFloat* const vertex, int vertexStrideInBytes, const int* const vertexIndex,
+ const dFloat* const normal, int normalStrideInBytes, const int* const normalIndex,
+ const dFloat* const uv0, int uv0StrideInBytes, const int* const uv0Index,
+ const dFloat* const uv1, int uv1StrideInBytes, const int* const uv1Index);
+
+
+
+NEWTON_API void NewtonMeshGetVertexStreams (const NewtonMesh* const mesh,
+ int vertexStrideInByte, dFloat* const vertex,
+ int normalStrideInByte, dFloat* const normal,
+ int uvStrideInByte0, dFloat* const uv0,
+ int uvStrideInByte1, dFloat* const uv1);
+NEWTON_API void NewtonMeshGetIndirectVertexStreams(const NewtonMesh* const mesh,
+ int vertexStrideInByte, dFloat* const vertex, int* const vertexIndices, int* const vertexCount,
+ int normalStrideInByte, dFloat* const normal, int* const normalIndices, int* const normalCount,
+ int uvStrideInByte0, dFloat* const uv0, int* const uvIndices0, int* const uvCount0,
+ int uvStrideInByte1, dFloat* const uv1, int* const uvIndices1, int* const uvCount1);
+NEWTON_API void* NewtonMeshBeginHandle (const NewtonMesh* const mesh);
+NEWTON_API void NewtonMeshEndHandle (const NewtonMesh* const mesh, void* const handle);
+NEWTON_API int NewtonMeshFirstMaterial (const NewtonMesh* const mesh, void* const handle);
+NEWTON_API int NewtonMeshNextMaterial (const NewtonMesh* const mesh, void* const handle, int materialId);
+NEWTON_API int NewtonMeshMaterialGetMaterial (const NewtonMesh* const mesh, void* const handle, int materialId);
+NEWTON_API int NewtonMeshMaterialGetIndexCount (const NewtonMesh* const mesh, void* const handle, int materialId);
+NEWTON_API void NewtonMeshMaterialGetIndexStream (const NewtonMesh* const mesh, void* const handle, int materialId, int* const index);
+NEWTON_API void NewtonMeshMaterialGetIndexStreamShort (const NewtonMesh* const mesh, void* const handle, int materialId, short int* const index);
+
+NEWTON_API NewtonMesh* NewtonMeshCreateFirstSingleSegment (const NewtonMesh* const mesh);
+NEWTON_API NewtonMesh* NewtonMeshCreateNextSingleSegment (const NewtonMesh* const mesh, const NewtonMesh* const segment);
+
+NEWTON_API NewtonMesh* NewtonMeshCreateFirstLayer (const NewtonMesh* const mesh);
+NEWTON_API NewtonMesh* NewtonMeshCreateNextLayer (const NewtonMesh* const mesh, const NewtonMesh* const segment);
+
+
+NEWTON_API int NewtonMeshGetTotalFaceCount (const NewtonMesh* const mesh);
+NEWTON_API int NewtonMeshGetTotalIndexCount (const NewtonMesh* const mesh);
+NEWTON_API void NewtonMeshGetFaces (const NewtonMesh* const mesh, int* const faceIndexCount, int* const faceMaterial, void** const faceIndices);
+
+
+NEWTON_API int NewtonMeshGetPointCount (const NewtonMesh* const mesh);
+NEWTON_API int NewtonMeshGetPointStrideInByte (const NewtonMesh* const mesh);
+NEWTON_API dFloat64* NewtonMeshGetPointArray (const NewtonMesh* const mesh);
+NEWTON_API dFloat64* NewtonMeshGetNormalArray (const NewtonMesh* const mesh);
+NEWTON_API dFloat64* NewtonMeshGetUV0Array (const NewtonMesh* const mesh);
+NEWTON_API dFloat64* NewtonMeshGetUV1Array (const NewtonMesh* const mesh);
+
+NEWTON_API int NewtonMeshGetVertexCount (const NewtonMesh* const mesh);
+NEWTON_API int NewtonMeshGetVertexStrideInByte (const NewtonMesh* const mesh);
+NEWTON_API dFloat64* NewtonMeshGetVertexArray (const NewtonMesh* const mesh);
+
+
+NEWTON_API void* NewtonMeshGetFirstVertex (const NewtonMesh* const mesh);
+NEWTON_API void* NewtonMeshGetNextVertex (const NewtonMesh* const mesh, const void* const vertex);
+NEWTON_API int NewtonMeshGetVertexIndex (const NewtonMesh* const mesh, const void* const vertex);
+
+NEWTON_API void* NewtonMeshGetFirstPoint (const NewtonMesh* const mesh);
+NEWTON_API void* NewtonMeshGetNextPoint (const NewtonMesh* const mesh, const void* const point);
+NEWTON_API int NewtonMeshGetPointIndex (const NewtonMesh* const mesh, const void* const point);
+NEWTON_API int NewtonMeshGetVertexIndexFromPoint (const NewtonMesh* const mesh, const void* const point);
+
+
+NEWTON_API void* NewtonMeshGetFirstEdge (const NewtonMesh* const mesh);
+NEWTON_API void* NewtonMeshGetNextEdge (const NewtonMesh* const mesh, const void* const edge);
+NEWTON_API void NewtonMeshGetEdgeIndices (const NewtonMesh* const mesh, const void* const edge, int* const v0, int* const v1);
+//NEWTON_API void NewtonMeshGetEdgePointIndices (const NewtonMesh* const mesh, const void* const edge, int* const v0, int* const v1);
+
+NEWTON_API void* NewtonMeshGetFirstFace (const NewtonMesh* const mesh);
+NEWTON_API void* NewtonMeshGetNextFace (const NewtonMesh* const mesh, const void* const face);
+NEWTON_API int NewtonMeshIsFaceOpen (const NewtonMesh* const mesh, const void* const face);
+NEWTON_API int NewtonMeshGetFaceMaterial (const NewtonMesh* const mesh, const void* const face);
+NEWTON_API int NewtonMeshGetFaceIndexCount (const NewtonMesh* const mesh, const void* const face);
+NEWTON_API void NewtonMeshGetFaceIndices (const NewtonMesh* const mesh, const void* const face, int* const indices);
+NEWTON_API void NewtonMeshGetFacePointIndices (const NewtonMesh* const mesh, const void* const face, int* const indices);
+
+
+#ifdef __cplusplus
}
#endif
+
#endif
Commit: 1ec1c49dfeb1d0c2ca6d4fccd0fe6badc4ac6968
https://github.com/scummvm/scummvm/commit/1ec1c49dfeb1d0c2ca6d4fccd0fe6badc4ac6968
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:36+01:00
Commit Message:
HPL1: implement ColliderShapeNewton class
Changed paths:
engines/hpl1/engine/impl/CollideShapeNewton.cpp
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.cpp b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
index 8bd4e7c8752..c0e12d9f9a4 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.cpp
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
@@ -62,28 +62,26 @@ cCollideShapeNewton::cCollideShapeNewton(eCollideShapeType aType, const cVector3
////////////////////////////////////////////
// Create Newton collision
-#if 0
switch(aType)
{
case eCollideShapeType_Null: mpNewtonCollision = NewtonCreateNull(apNewtonWorld); break;
case eCollideShapeType_Box: mpNewtonCollision = NewtonCreateBox(apNewtonWorld,
mvSize.x, mvSize.y, mvSize.z,
- pMtx, nullptr); break;
+ 0, pMtx); break;
case eCollideShapeType_Sphere: mpNewtonCollision = NewtonCreateSphere(apNewtonWorld,
mvSize.x, mvSize.y, mvSize.z,
- pMtx, nullptr); break;
+ 0, pMtx); break;
case eCollideShapeType_Cylinder: mpNewtonCollision = NewtonCreateCylinder(apNewtonWorld,
mvSize.x, mvSize.y,
- pMtx); break;
+ 0, pMtx); break;
case eCollideShapeType_Capsule: mpNewtonCollision = NewtonCreateCapsule(apNewtonWorld,
mvSize.x, mvSize.y,
- pMtx); break;
+ 0, pMtx); break;
}
-#endif
////////////////////////////////////////////
// Calculate Bounding volume and volume.
@@ -123,11 +121,8 @@ cCollideShapeNewton::cCollideShapeNewton(eCollideShapeType aType, const cVector3
cCollideShapeNewton::~cCollideShapeNewton() {
// Release Newton Collision
-#if 0
- if(mpNewtonCollision)
- NewtonReleaseCollision(mpNewtonWorld,mpNewtonCollision);
-#endif
-
+ if(mpNewtonCollision)
+ NewtonReleaseCollision(mpNewtonWorld,mpNewtonCollision);
// Release all subshapes (for compound objects)
for (int i = 0; i < (int)mvSubShapes.size(); i++) {
mpWorld->DestroyShape(mvSubShapes[i]);
@@ -225,10 +220,8 @@ void cCollideShapeNewton::CreateFromShapeVec(tCollideShapeVec &avShapes) {
mfVolume += pNewtonShape->GetVolume();
}
-#if 0
- mpNewtonCollision = NewtonCreateCompoundCollision(mpNewtonWorld, (int)vNewtonColliders.size(),
- &vNewtonColliders[0]);
-#endif
+ mpNewtonCollision = NewtonCreateCompoundCollision(mpNewtonWorld, (int)vNewtonColliders.size(),
+ &vNewtonColliders[0], 0);
// Create bounding volume
cVector3f vFinalMax = avShapes[0]->GetBoundingVolume().GetMax();
Commit: 8e4738f6fdeda96b234b7dfa235009d85fb40797
https://github.com/scummvm/scummvm/commit/8e4738f6fdeda96b234b7dfa235009d85fb40797
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:36+01:00
Commit Message:
HPL1: implement PhysicsBodyNewton class
Changed paths:
engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
engines/hpl1/engine/impl/PhysicsBodyNewton.h
engines/hpl1/engine/physics/PhysicsBody.h
engines/hpl1/engine/resources/EntityLoader_Object.cpp
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
index e91edce77d9..6e9e36ecc74 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
@@ -31,7 +31,11 @@
#include "hpl1/engine/impl/CollideShapeNewton.h"
#include "hpl1/engine/impl/PhysicsMaterialNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
+#include "hpl1/engine/libraries/angelscript/angelscript.h"
+#include "hpl1/engine/libraries/newton/Newton.h"
#include "hpl1/engine/math/Math.h"
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/math/Vector3.h"
#include "hpl1/engine/scene/Node3D.h"
#include "hpl1/engine/system/low_level_system.h"
@@ -47,38 +51,36 @@ bool cPhysicsBodyNewton::mbUseCallback = true;
cPhysicsBodyNewton::cPhysicsBodyNewton(const tString &asName, iPhysicsWorld *apWorld, iCollideShape *apShape)
: iPhysicsBody(asName, apWorld, apShape) {
-#if 0
- cPhysicsWorldNewton *pWorldNewton = static_cast<cPhysicsWorldNewton*>(apWorld);
- cCollideShapeNewton *pShapeNewton = static_cast<cCollideShapeNewton*>(apShape);
+ cPhysicsWorldNewton *pWorldNewton = static_cast<cPhysicsWorldNewton *>(apWorld);
+ cCollideShapeNewton *pShapeNewton = static_cast<cCollideShapeNewton *>(apShape);
- mpNewtonWorld = pWorldNewton->GetNewtonWorld();
- mpNewtonBody = NewtonCreateBody(pWorldNewton->GetNewtonWorld(),
- pShapeNewton->GetNewtonCollision());
+ mpNewtonWorld = pWorldNewton->GetNewtonWorld();
+ mpNewtonBody = NewtonCreateBody(pWorldNewton->GetNewtonWorld(),
+ pShapeNewton->GetNewtonCollision(), cMatrixf::Identity.v);
- mpCallback = hplNew( cPhysicsBodyNewtonCallback, () );
+ mpCallback = hplNew(cPhysicsBodyNewtonCallback, ());
- AddCallback(mpCallback);
+ AddCallback(mpCallback);
- // Setup the callbacks and set this body as user data
- // This is so that the transform gets updated and
- // to add gravity, forces and user sink.
- NewtonBodySetForceAndTorqueCallback(mpNewtonBody,OnUpdateCallback);
- NewtonBodySetTransformCallback(mpNewtonBody, OnTransformCallback);
- NewtonBodySetUserData(mpNewtonBody, this);
+ // Setup the callbacks and set this body as user data
+ // This is so that the transform gets updated and
+ // to add gravity, forces and user sink.
+ NewtonBodySetForceAndTorqueCallback(mpNewtonBody, OnUpdateCallback);
+ NewtonBodySetTransformCallback(mpNewtonBody, OnTransformCallback);
+ NewtonBodySetUserData(mpNewtonBody, this);
- //Set default property settings
- mbGravity = true;
+ // Set default property settings
+ mbGravity = true;
- mfMaxLinearSpeed =0;
- mfMaxAngularSpeed =0;
- mfMass =0;
+ mfMaxLinearSpeed = 0;
+ mfMaxAngularSpeed = 0;
+ mfMass = 0;
- mfAutoDisableLinearThreshold = 0.01f;
- mfAutoDisableAngularThreshold = 0.01f;
- mlAutoDisableNumSteps = 10;
+ mfAutoDisableLinearThreshold = 0.01f;
+ mfAutoDisableAngularThreshold = 0.01f;
+ mlAutoDisableNumSteps = 10;
- //Log("Creating newton body '%s' %d\n",msName.c_str(),(size_t)this);
-#endif
+ // Log("Creating newton body '%s' %d\n",msName.c_str(),(size_t)this);
}
//-----------------------------------------------------------------------
@@ -90,12 +92,10 @@ cPhysicsBodyNewton::~cPhysicsBodyNewton() {
//-----------------------------------------------------------------------
void cPhysicsBodyNewton::DeleteLowLevel() {
-#if 0
- //Log(" Newton body %d\n", (size_t)mpNewtonBody);
- NewtonDestroyBody(mpNewtonWorld,mpNewtonBody);
- //Log(" Callback\n");
- hplDelete(mpCallback);
-#endif
+ // Log(" Newton body %d\n", (size_t)mpNewtonBody);
+ NewtonDestroyBody(mpNewtonWorld, mpNewtonBody);
+ // Log(" Callback\n");
+ hplDelete(mpCallback);
}
//-----------------------------------------------------------------------
@@ -140,8 +140,8 @@ void cPhysicsBodyNewton::SetMaterial(iPhysicsMaterial *apMaterial) {
//-----------------------------------------------------------------------
void cPhysicsBodyNewton::SetLinearVelocity(const cVector3f &avVel) {
- const float arrayVec[] = {avVel.x, avVel.y, avVel.y};
- NewtonBodySetVelocity(mpNewtonBody, arrayVec);
+ VEC3_CONST_ARRAY(vel, avVel);
+ NewtonBodySetVelocity(mpNewtonBody, vel);
}
cVector3f cPhysicsBodyNewton::GetLinearVelocity() const {
float arrayVec[3];
@@ -156,9 +156,9 @@ void cPhysicsBodyNewton::SetAngularVelocity(const cVector3f &avVel) {
NewtonBodySetOmega(mpNewtonBody, faVel);
}
cVector3f cPhysicsBodyNewton::GetAngularVelocity() const {
- float faVel[3];
- NewtonBodyGetOmega(mpNewtonBody, faVel);
- return {faVel[0], faVel[1], faVel[2]};
+ float vel[3];
+ NewtonBodyGetOmega(mpNewtonBody, vel);
+ return {vel[0], vel[1], vel[2]};
}
//-----------------------------------------------------------------------
@@ -173,8 +173,8 @@ float cPhysicsBodyNewton::GetLinearDamping() const {
//-----------------------------------------------------------------------
void cPhysicsBodyNewton::SetAngularDamping(float afDamping) {
- float fDamp[3] = {afDamping, afDamping, afDamping};
- NewtonBodySetAngularDamping(mpNewtonBody, fDamp);
+ float damp[3] = {afDamping, afDamping, afDamping};
+ NewtonBodySetAngularDamping(mpNewtonBody, damp);
}
float cPhysicsBodyNewton::GetAngularDamping() const {
float fDamp[3];
@@ -240,8 +240,8 @@ float cPhysicsBodyNewton::GetMass() const {
}
void cPhysicsBodyNewton::SetMassCentre(const cVector3f &avCentre) {
- const float faCenter[3] = {avCentre.x, avCentre.y, avCentre.z};
- NewtonBodySetCentreOfMass(mpNewtonBody, faCenter);
+ VEC3_CONST_ARRAY(ctr, avCentre);
+ NewtonBodySetCentreOfMass(mpNewtonBody, ctr);
}
cVector3f cPhysicsBodyNewton::GetMassCentre() const {
@@ -287,67 +287,48 @@ void cPhysicsBodyNewton::AddTorque(const cVector3f &avTorque) {
//-----------------------------------------------------------------------
void cPhysicsBodyNewton::AddImpulse(const cVector3f &avImpulse) {
-#if 0
- cVector3f vMassCentre = GetMassCentre();
- if(vMassCentre != cVector3f(0,0,0))
- {
- cVector3f vCentreOffset = cMath::MatrixMul( GetWorldMatrix().GetRotation(),
- vMassCentre);
-
- cVector3f vWorldPosition = GetWorldPosition() + vCentreOffset;
- NewtonAddBodyImpulse(mpNewtonBody, avImpulse.v, vWorldPosition.v);
- }
- else
- {
- NewtonAddBodyImpulse(mpNewtonBody, avImpulse.v, GetWorldPosition().v);
- }
-#endif
+ cVector3f vMassCentre = GetMassCentre();
+ VEC3_CONST_ARRAY(impulse, avImpulse);
+ if (vMassCentre != cVector3f(0, 0, 0)) {
+ cVector3f vCentreOffset = cMath::MatrixMul(GetWorldMatrix().GetRotation(),
+ vMassCentre);
+ VEC3_CONST_ARRAY(worldPosition, (GetWorldPosition() + vCentreOffset));
+ NewtonBodyAddImpulse(mpNewtonBody, impulse, worldPosition);
+ } else {
+ VEC3_CONST_ARRAY(worldPosition, GetWorldPosition());
+ NewtonBodyAddImpulse(mpNewtonBody, impulse, worldPosition);
+ }
}
void cPhysicsBodyNewton::AddImpulseAtPosition(const cVector3f &avImpulse, const cVector3f &avPos) {
-#if 0
- NewtonAddBodyImpulse(mpNewtonBody, avImpulse.v, avPos.v);
-#endif
+ VEC3_CONST_ARRAY(impulse, avImpulse);
+ VEC3_CONST_ARRAY(pos, avPos);
+ NewtonBodyAddImpulse(mpNewtonBody, impulse, pos);
}
//-----------------------------------------------------------------------
void cPhysicsBodyNewton::SetEnabled(bool abEnabled) {
-#if 0
- if (abEnabled)
- NewtonWorldUnfreezeBody(mpNewtonWorld, mpNewtonBody);
- else
- NewtonWorldFreezeBody(mpNewtonWorld, mpNewtonBody);
-#endif
+ NewtonBodySetFreezeState(mpNewtonBody, abEnabled);
}
bool cPhysicsBodyNewton::GetEnabled() const {
-#if 0
- return NewtonBodyGetSleepingState(mpNewtonBody) ==0?false: true;
-#endif
- return false;
+ return NewtonBodyGetSleepState(mpNewtonBody) == 0 ? false : true;
}
//-----------------------------------------------------------------------
void cPhysicsBodyNewton::SetAutoDisable(bool abEnabled) {
-#if 0
- NewtonBodySetAutoFreeze(mpNewtonBody, abEnabled ? 1 : 0);
-#endif
+ NewtonBodySetAutoSleep(mpNewtonBody, abEnabled);
}
bool cPhysicsBodyNewton::GetAutoDisable() const {
-#if 0
- return NewtonBodyGetAutoFreeze(mpNewtonBody) == 0 ? false : true;
-#endif
- return false;
+ return NewtonBodyGetAutoSleep(mpNewtonBody) == 0 ? false : true;
}
//-----------------------------------------------------------------------
-
-void cPhysicsBodyNewton::SetAutoDisableLinearThreshold(float afThresold) {
#if 0
- mfAutoDisableLinearThreshold = afThresold;
- NewtonBodySetFreezeTreshold(mpNewtonBody, mfAutoDisableLinearThreshold,
- mfAutoDisableAngularThreshold, mlAutoDisableNumSteps);
-#endif
+void cPhysicsBodyNewton::SetAutoDisableLinearThreshold(float afThresold) {
+ mfAutoDisableLinearThreshold = afThresold;
+ NewtonBodySetFreezeTreshold(mpNewtonBody, mfAutoDisableLinearThreshold,
+ mfAutoDisableAngularThreshold, mlAutoDisableNumSteps);
}
float cPhysicsBodyNewton::GetAutoDisableLinearThreshold() const {
return mfAutoDisableLinearThreshold;
@@ -356,11 +337,9 @@ float cPhysicsBodyNewton::GetAutoDisableLinearThreshold() const {
//-----------------------------------------------------------------------
void cPhysicsBodyNewton::SetAutoDisableAngularThreshold(float afThresold) {
-#if 0
- mfAutoDisableAngularThreshold = afThresold;
- NewtonBodySetFreezeTreshold(mpNewtonBody, mfAutoDisableLinearThreshold,
- mfAutoDisableAngularThreshold, mlAutoDisableNumSteps);
-#endif
+ mfAutoDisableAngularThreshold = afThresold;
+ NewtonBodySetFreezeTreshold(mpNewtonBody, mfAutoDisableLinearThreshold,
+ mfAutoDisableAngularThreshold, mlAutoDisableNumSteps);
}
float cPhysicsBodyNewton::GetAutoDisableAngularThreshold() const {
return mfAutoDisableAngularThreshold;
@@ -369,17 +348,14 @@ float cPhysicsBodyNewton::GetAutoDisableAngularThreshold() const {
//-----------------------------------------------------------------------
void cPhysicsBodyNewton::SetAutoDisableNumSteps(int anNum) {
-#if 0
- mlAutoDisableNumSteps = anNum;
- NewtonBodySetFreezeTreshold(mpNewtonBody, mfAutoDisableLinearThreshold,
- mfAutoDisableAngularThreshold, mlAutoDisableNumSteps);
-#endif
+ mlAutoDisableNumSteps = anNum;
+ NewtonBodySetFreezeTreshold(mpNewtonBody, mfAutoDisableLinearThreshold,
+ mfAutoDisableAngularThreshold, mlAutoDisableNumSteps);
}
-
int cPhysicsBodyNewton::GetAutoDisableNumSteps() const {
return mlAutoDisableNumSteps;
}
-
+#endif
//-----------------------------------------------------------------------
void cPhysicsBodyNewton::SetContinuousCollision(bool abOn) {
@@ -446,7 +422,7 @@ void cPhysicsBodyNewton::ClearForces() {
//-----------------------------------------------------------------------
-void cPhysicsBodyNewton::OnTransformCallback(const NewtonBody *apBody, const dFloat *apMatrix) {
+void cPhysicsBodyNewton::OnTransformCallback(const NewtonBody *apBody, const dFloat *apMatrix, int) {
cPhysicsBodyNewton *pRigidBody = (cPhysicsBodyNewton *)NewtonBodyGetUserData(apBody);
pRigidBody->m_mtxLocalTransform.FromTranspose(apMatrix);
@@ -472,73 +448,67 @@ static int BuoyancyPlaneCallback(const int alCollisionID, void *apContext,
return 1;
}
-void cPhysicsBodyNewton::OnUpdateCallback(const NewtonBody *apBody) {
-#if 0
- float fMass;
- float fX,fY,fZ;
-
- cPhysicsBodyNewton* pRigidBody = (cPhysicsBodyNewton*) NewtonBodyGetUserData(apBody);
-
- if(pRigidBody->IsActive()==false) return;
+void cPhysicsBodyNewton::OnUpdateCallback(const NewtonBody *apBody, float, int) {
+ float fMass;
+ float fX, fY, fZ;
- cVector3f vGravity = pRigidBody->mpWorld->GetGravity();
+ cPhysicsBodyNewton *pRigidBody = (cPhysicsBodyNewton *)NewtonBodyGetUserData(apBody);
- //Create some gravity
- if (pRigidBody->mbGravity)
- {
- NewtonBodyGetMassMatrix(apBody, &fMass, &fX, &fY, &fZ);
+ if (pRigidBody->IsActive() == false)
+ return;
- float fForce[3] = { fMass * vGravity.x, fMass * vGravity.y, fMass * vGravity.z};
+ cVector3f vGravity = pRigidBody->mpWorld->GetGravity();
- NewtonBodyAddForce(apBody, &fForce[0]);
- }
+ // Create some gravity
+ if (pRigidBody->mbGravity) {
+ NewtonBodyGetMassMatrix(apBody, &fMass, &fX, &fY, &fZ);
+ VEC3_CONST_ARRAY(force, (vGravity * fMass));
+ NewtonBodyAddForce(apBody, force);
+ }
- // Create Buoyancy
- if (pRigidBody->mBuoyancy.mbActive)
- {
- gSurfacePlane = pRigidBody->mBuoyancy.mSurface;
- NewtonBodyAddBuoyancyForce( apBody,
- pRigidBody->mBuoyancy.mfDensity,
- pRigidBody->mBuoyancy.mfLinearViscosity,
- pRigidBody->mBuoyancy.mfAngularViscosity,
- vGravity.v, BuoyancyPlaneCallback,
- pRigidBody);
- }
+ // Create Buoyancy
+ if (pRigidBody->mBuoyancy.mbActive) {
+ gSurfacePlane = pRigidBody->mBuoyancy.mSurface;
+ VEC3_CONST_ARRAY(gravity, vGravity);
+ NewtonBodyAddBuoyancyForce(apBody,
+ pRigidBody->mBuoyancy.mfDensity,
+ pRigidBody->mBuoyancy.mfLinearViscosity,
+ pRigidBody->mBuoyancy.mfAngularViscosity,
+ gravity, BuoyancyPlaneCallback,
+ pRigidBody);
+ }
- // Add forces from calls to Addforce(..), etc
- NewtonBodyAddForce(apBody, pRigidBody->mvTotalForce.v);
- NewtonBodyAddTorque(apBody, pRigidBody->mvTotalTorque.v);
-
- // Check so that all speeds are within thresholds
- // Linear
- if (pRigidBody->mfMaxLinearSpeed > 0)
- {
- cVector3f vVel = pRigidBody->GetLinearVelocity();
- float fSpeed = vVel.Length();
- if (fSpeed > pRigidBody->mfMaxLinearSpeed)
- {
- vVel = cMath::Vector3Normalize(vVel) * pRigidBody->mfMaxLinearSpeed;
- pRigidBody->SetLinearVelocity(vVel);
- }
+ // Add forces from calls to Addforce(..), etc
+ VEC3_CONST_ARRAY(totForce, pRigidBody->mvTotalForce);
+ NewtonBodyAddForce(apBody, totForce);
+ VEC3_CONST_ARRAY(totTorque, pRigidBody->mvTotalTorque);
+ NewtonBodyAddTorque(apBody, totTorque);
+
+ // Check so that all speeds are within thresholds
+ // Linear
+ if (pRigidBody->mfMaxLinearSpeed > 0) {
+ cVector3f vVel = pRigidBody->GetLinearVelocity();
+ float fSpeed = vVel.Length();
+ if (fSpeed > pRigidBody->mfMaxLinearSpeed) {
+ vVel = cMath::Vector3Normalize(vVel) * pRigidBody->mfMaxLinearSpeed;
+ pRigidBody->SetLinearVelocity(vVel);
}
- // Angular
- if (pRigidBody->mfMaxAngularSpeed > 0)
- {
- cVector3f vVel = pRigidBody->GetAngularVelocity();
- float fSpeed = vVel.Length();
- if (fSpeed > pRigidBody->mfMaxAngularSpeed)
- {
- vVel = cMath::Vector3Normalize(vVel) * pRigidBody->mfMaxAngularSpeed;
- pRigidBody->SetAngularVelocity(vVel);
- }
+ }
+ // Angular
+ if (pRigidBody->mfMaxAngularSpeed > 0) {
+ cVector3f vVel = pRigidBody->GetAngularVelocity();
+ float fSpeed = vVel.Length();
+ if (fSpeed > pRigidBody->mfMaxAngularSpeed) {
+ vVel = cMath::Vector3Normalize(vVel) * pRigidBody->mfMaxAngularSpeed;
+ pRigidBody->SetAngularVelocity(vVel);
}
+ }
- //cVector3f vForce;
- //NewtonBodyGetForce(apBody,vForce.v);
- //Log("Engine force %s\n",pRigidBody->mvTotalForce.ToString().c_str());
- //Log("Engine force %s, body force: %s \n",pRigidBody->mvTotalForce.ToString().c_str(),
- // vForce.ToString().c_str());
-#endif
+ // cVector3f vForce;
+ // NewtonBodyGetForce(apBody,vForce.v);
+ // Log("Engine force %s\n",pRigidBody->mvTotalForce.ToString().c_str());
+ // Log("Engine force %s, body force: %s \n",pRigidBody->mvTotalForce.ToString().c_str(),
+ // vForce.ToString().c_str());
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.h b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
index 002e47c1e2b..0b093ae9521 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
@@ -76,12 +76,14 @@ public:
bool GetEnabled() const;
void SetAutoDisable(bool abEnabled);
bool GetAutoDisable() const;
+#if 0
void SetAutoDisableLinearThreshold(float afThresold);
float GetAutoDisableLinearThreshold() const;
void SetAutoDisableAngularThreshold(float afThresold);
float GetAutoDisableAngularThreshold() const;
void SetAutoDisableNumSteps(int alNum);
int GetAutoDisableNumSteps() const;
+#endif
void SetContinuousCollision(bool abOn);
bool GetContinuousCollision();
@@ -99,8 +101,8 @@ public:
static void SetUseCallback(bool abX) { mbUseCallback = abX; }
private:
- static void OnTransformCallback(const NewtonBody *apBody, const dFloat *apMatrix);
- static void OnUpdateCallback(const NewtonBody *apBody);
+ static void OnTransformCallback(const NewtonBody *apBody, const dFloat *apMatrix, int);
+ static void OnUpdateCallback(const NewtonBody *apBody, float, int);
NewtonBody *mpNewtonBody;
NewtonWorld *mpNewtonWorld;
diff --git a/engines/hpl1/engine/physics/PhysicsBody.h b/engines/hpl1/engine/physics/PhysicsBody.h
index 67b7c70419e..9e4485ed29d 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.h
+++ b/engines/hpl1/engine/physics/PhysicsBody.h
@@ -168,12 +168,14 @@ public:
virtual bool GetEnabled() const = 0;
virtual void SetAutoDisable(bool abEnabled) = 0;
virtual bool GetAutoDisable() const = 0;
+#if 0
virtual void SetAutoDisableLinearThreshold(float afThresold) = 0;
virtual float GetAutoDisableLinearThreshold() const = 0;
virtual void SetAutoDisableAngularThreshold(float afThresold) = 0;
virtual float GetAutoDisableAngularThreshold() const = 0;
virtual void SetAutoDisableNumSteps(int alNum) = 0;
virtual int GetAutoDisableNumSteps() const = 0;
+#endif
virtual void SetContinuousCollision(bool abOn) = 0;
virtual bool GetContinuousCollision() = 0;
diff --git a/engines/hpl1/engine/resources/EntityLoader_Object.cpp b/engines/hpl1/engine/resources/EntityLoader_Object.cpp
index d75f2c256d7..3b5f3e5b71f 100644
--- a/engines/hpl1/engine/resources/EntityLoader_Object.cpp
+++ b/engines/hpl1/engine/resources/EntityLoader_Object.cpp
@@ -29,8 +29,8 @@
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/scene/World3D.h"
-#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/physics/CollideShape.h"
#include "hpl1/engine/physics/PhysicsBody.h"
@@ -640,11 +640,11 @@ void cEntityLoader_Object::SetBodyProperties(iPhysicsBody *apBody, TiXmlElement
apBody->SetCanAttachCharacter(bCanAttachCharacter);
apBody->SetContinuousCollision(bContinuousCollision);
-
+#if 0
apBody->SetAutoDisableLinearThreshold(fAutoDisableLinearThreshold);
apBody->SetAutoDisableAngularThreshold(fAutoDisableAngularThreshold);
apBody->SetAutoDisableNumSteps(lAutoDisableNumSteps);
-
+#endif
apBody->SetPushedByCharacterGravity(bPushedByCharacterGravity);
// Log("Body %s contin: %d\n",apBody->GetName().c_str(), apBody->GetContinuousCollision()?1:0);
Commit: 6439edf99da770bfa47aa460d11df5fa9044aee7
https://github.com/scummvm/scummvm/commit/6439edf99da770bfa47aa460d11df5fa9044aee7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:36+01:00
Commit Message:
HPL1: implement PhysicsMaterialNewton class
Changed paths:
engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
engines/hpl1/engine/impl/PhysicsMaterialNewton.h
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
index f9bcf47a1e4..cce30eacd98 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
@@ -29,6 +29,9 @@
#include "hpl1/engine/impl/PhysicsBodyNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
+#include "hpl1/engine/libraries/newton/Newton.h"
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/physics/PhysicsMaterial.h"
#include "hpl1/engine/physics/SurfaceData.h"
#include "hpl1/engine/system/low_level_system.h"
@@ -148,39 +151,35 @@ ePhysicsMaterialCombMode cPhysicsMaterialNewton::GetElasticityCombMode() const {
//-----------------------------------------------------------------------
void cPhysicsMaterialNewton::UpdateMaterials() {
-#if 0
- cPhysicsMaterialIterator MatIt = mpWorld->GetMaterialIterator();
+ cPhysicsMaterialIterator MatIt = mpWorld->GetMaterialIterator();
- while(MatIt.HasNext())
- {
- cPhysicsMaterialNewton* pMat = static_cast<cPhysicsMaterialNewton*>(MatIt.Next());
+ while (MatIt.HasNext()) {
+ cPhysicsMaterialNewton *pMat = static_cast<cPhysicsMaterialNewton *>(MatIt.Next());
- ePhysicsMaterialCombMode frictionMode = (ePhysicsMaterialCombMode) std::max(mFrictionMode,
- pMat->mFrictionMode);
- ePhysicsMaterialCombMode elasticityMode = (ePhysicsMaterialCombMode) std::max(mElasticityMode,
- pMat->mElasticityMode);
-
- //If the material is the same do not blend.
- if(pMat == this){
- frictionMode = ePhysicsMaterialCombMode_Average;
- elasticityMode = ePhysicsMaterialCombMode_Average;
- }
+ ePhysicsMaterialCombMode frictionMode = (ePhysicsMaterialCombMode)std::max(mFrictionMode,
+ pMat->mFrictionMode);
+ ePhysicsMaterialCombMode elasticityMode = (ePhysicsMaterialCombMode)std::max(mElasticityMode,
+ pMat->mElasticityMode);
+ // If the material is the same do not blend.
+ if (pMat == this) {
+ frictionMode = ePhysicsMaterialCombMode_Average;
+ elasticityMode = ePhysicsMaterialCombMode_Average;
+ }
- NewtonMaterialSetDefaultElasticity(mpNewtonWorld,mlMaterialId,pMat->mlMaterialId,
- Combine(elasticityMode,mfElasticity, pMat->mfElasticity));
+ NewtonMaterialSetDefaultElasticity(mpNewtonWorld, mlMaterialId, pMat->mlMaterialId,
+ Combine(elasticityMode, mfElasticity, pMat->mfElasticity));
- NewtonMaterialSetDefaultFriction(mpNewtonWorld,mlMaterialId,pMat->mlMaterialId,
- Combine(frictionMode,mfStaticFriction, pMat->mfStaticFriction),
- Combine(frictionMode,mfKineticFriction, pMat->mfKineticFriction));
+ NewtonMaterialSetDefaultFriction(mpNewtonWorld, mlMaterialId, pMat->mlMaterialId,
+ Combine(frictionMode, mfStaticFriction, pMat->mfStaticFriction),
+ Combine(frictionMode, mfKineticFriction, pMat->mfKineticFriction));
- NewtonMaterialSetContinuousCollisionMode(mpNewtonWorld,mlMaterialId,pMat->mlMaterialId,
- 1);
+ NewtonMaterialSetContinuousCollisionMode(mpNewtonWorld, mlMaterialId, pMat->mlMaterialId,
+ 1);
- NewtonMaterialSetCollisionCallback(mpNewtonWorld,mlMaterialId,pMat->mlMaterialId,
- (void*)NULL,BeginContactCallback,ProcessContactCallback,EndContactCallback);
- }
-#endif
+ NewtonMaterialSetCollisionCallback(mpNewtonWorld, mlMaterialId, pMat->mlMaterialId,
+ nullptr, BeginContactCallback, ProcessContactCallback);
+ }
}
//-----------------------------------------------------------------------
@@ -206,46 +205,35 @@ float cPhysicsMaterialNewton::Combine(ePhysicsMaterialCombMode aMode, float afX,
// STATIC NEWTON CALLBACKS
//////////////////////////////////////////////////////////////////////////
-iPhysicsBody *cPhysicsMaterialNewton::mpContactBody1 = NULL;
-iPhysicsBody *cPhysicsMaterialNewton::mpContactBody2 = NULL;
-int cPhysicsMaterialNewton::mlContactNum = 0;
-cPhysicsContactData cPhysicsMaterialNewton::mContactData;
-
//-----------------------------------------------------------------------
int cPhysicsMaterialNewton::BeginContactCallback(const NewtonMaterial *material,
- const NewtonBody *apBody1, const NewtonBody *apBody2) {
- mpContactBody1 = (cPhysicsBodyNewton *)NewtonBodyGetUserData(apBody1);
- mpContactBody2 = (cPhysicsBodyNewton *)NewtonBodyGetUserData(apBody2);
+ const NewtonBody *body0, const NewtonBody *body1, int) {
+ iPhysicsBody *contactBody0 = (cPhysicsBodyNewton *)NewtonBodyGetUserData(body0);
+ iPhysicsBody *contactBody1 = (cPhysicsBodyNewton *)NewtonBodyGetUserData(body1);
- if (mpContactBody1->GetCollide() == false)
+ if (contactBody0->GetCollide() == false)
return 0;
- if (mpContactBody2->GetCollide() == false)
+ if (contactBody1->GetCollide() == false)
return 0;
- if (mpContactBody1->IsActive() == false)
+ if (contactBody0->IsActive() == false)
return 0;
- if (mpContactBody2->IsActive() == false)
+ if (contactBody1->IsActive() == false)
return 0;
- if (mpContactBody1->IsRagDoll() && mpContactBody2->GetCollideRagDoll() == false)
+ if (contactBody0->IsRagDoll() && contactBody1->GetCollideRagDoll() == false)
return 0;
- if (mpContactBody2->IsRagDoll() && mpContactBody1->GetCollideRagDoll() == false)
+ if (contactBody1->IsRagDoll() && contactBody0->GetCollideRagDoll() == false)
return 0;
- if (mpContactBody1->IsCharacter() && mpContactBody2->GetCollideCharacter() == false)
+ if (contactBody0->IsCharacter() && contactBody1->GetCollideCharacter() == false)
return 0;
- if (mpContactBody2->IsCharacter() && mpContactBody1->GetCollideCharacter() == false)
+ if (contactBody1->IsCharacter() && contactBody0->GetCollideCharacter() == false)
return 0;
- // Log("----- Begin contact between body '%s' and '%s'.\n",mpContactBody1->GetName().c_str(),
- // mpContactBody2->GetName().c_str());
-
- // Reset contact num
- mlContactNum = 0;
-
- if (mpContactBody1->OnBeginCollision(mpContactBody2) == false)
+ if (contactBody0->OnBeginCollision(contactBody1) == false)
return 0;
- if (mpContactBody2->OnBeginCollision(mpContactBody1) == false)
+ if (contactBody1->OnBeginCollision(contactBody0) == false)
return 0;
return 1;
@@ -253,117 +241,122 @@ int cPhysicsMaterialNewton::BeginContactCallback(const NewtonMaterial *material,
//-----------------------------------------------------------------------
-int cPhysicsMaterialNewton::ProcessContactCallback(const NewtonMaterial *apMaterial,
- const NewtonContact *apContact) {
-#if 0
- //Log(" Process contact between body '%s' and '%s'.\n",mpContactBody1->GetName().c_str(),
- // mpContactBody2->GetName().c_str());
-
- //Normal speed
- float fNormSpeed = NewtonMaterialGetContactNormalSpeed(apMaterial,apContact);
- if(mContactData.mfMaxContactNormalSpeed < fNormSpeed) mContactData.mfMaxContactNormalSpeed = fNormSpeed;
-
- //Tangent speed
- float fTanSpeed0 = NewtonMaterialGetContactTangentSpeed(apMaterial,apContact,0);
- float fTanSpeed1 = NewtonMaterialGetContactTangentSpeed(apMaterial,apContact,1);
- if(std::abs(mContactData.mfMaxContactTangentSpeed) < std::abs(fTanSpeed0)) mContactData.mfMaxContactTangentSpeed = fTanSpeed0;
- if(std::abs(mContactData.mfMaxContactTangentSpeed) < std::abs(fTanSpeed1)) mContactData.mfMaxContactTangentSpeed = fTanSpeed1;
-
- //Force
- cVector3f vForce;
- NewtonMaterialGetContactForce(apMaterial,vForce.v);
- mContactData.mvForce += vForce;
-
- //Position and normal
- cVector3f vPos, vNormal;
- NewtonMaterialGetContactPositionAndNormal(apMaterial,vPos.v, vNormal.v);
-
- mContactData.mvContactNormal += vNormal;
- mContactData.mvContactPosition += vPos;
-
- //cVector3f vForce;
- //NewtonMaterialGetContactForce(apMaterial,vForce.v);
-
- //Log(" Norm: %f Tan0: %f Tan1: %f\n",fNormSpeed, fTanSpeed0, fTanSpeed1);
- //Log("Force: %s\n",vForce.ToString().c_str());
-
- if(mpContactBody1->GetWorld()->GetSaveContactPoints())
- {
- cCollidePoint collidePoint;
- collidePoint.mfDepth = 1;
- NewtonMaterialGetContactPositionAndNormal (apMaterial, collidePoint.mvPoint.v,
- collidePoint.mvNormal.v);
-
- mpContactBody1->GetWorld()->GetContactPoints()->push_back(collidePoint);
- }
-
- mlContactNum++;
-
-#endif
- return 1;
+class ContactProcessor {
+public:
+ ContactProcessor(const NewtonJoint *joint);
+
+ bool hasNext();
+ void processNext();
+ void endProcessing();
+
+private:
+ void *_contact;
+ int _contacts;
+ const NewtonJoint *_joint;
+ NewtonBody *_body0;
+ NewtonBody *_body1;
+ cPhysicsBodyNewton *_contactBody0;
+ cPhysicsBodyNewton *_contactBody1;
+ cPhysicsContactData _contactData;
+};
+
+ContactProcessor::ContactProcessor(const NewtonJoint *joint) : _joint(joint), _contacts(0), _contact(nullptr) {
+ _body0 = NewtonJointGetBody0(joint);
+ _body1 = NewtonJointGetBody1(joint);
+ _contactBody0 = (cPhysicsBodyNewton *)NewtonBodyGetUserData(_body0);
+ _contactBody1 = (cPhysicsBodyNewton *)NewtonBodyGetUserData(_body1);
}
-//-----------------------------------------------------------------------
+bool ContactProcessor::hasNext() {
+ return (_contact = NewtonContactJointGetNextContact(_joint, _contact));
+}
-void cPhysicsMaterialNewton::EndContactCallback(const NewtonMaterial *apMaterial) {
- // Log("--- End contact between body '%s' and '%s'.\n",mpContactBody1->GetName().c_str(),
- // mpContactBody2->GetName().c_str());
+void ContactProcessor::processNext() {
+ NewtonMaterial *_material = NewtonContactGetMaterial(_contact);
+
+ float fNormSpeed = NewtonMaterialGetContactNormalSpeed(_material);
+ if (_contactData.mfMaxContactNormalSpeed < fNormSpeed)
+ _contactData.mfMaxContactNormalSpeed = fNormSpeed;
+
+ // Tangent speed
+ float fTanSpeed0 = NewtonMaterialGetContactTangentSpeed(_material, 0);
+ float fTanSpeed1 = NewtonMaterialGetContactTangentSpeed(_material, 1);
+ if (std::abs(_contactData.mfMaxContactTangentSpeed) < std::abs(fTanSpeed0))
+ _contactData.mfMaxContactTangentSpeed = fTanSpeed0;
+ if (std::abs(_contactData.mfMaxContactTangentSpeed) < std::abs(fTanSpeed1))
+ _contactData.mfMaxContactTangentSpeed = fTanSpeed1;
+
+ // Force
+ float force[3];
+ NewtonMaterialGetContactForce(_material, _body0, force);
+ _contactData.mvForce += cVector3f::fromArray(force);
+
+ // Position and normal
+ float matPos[3], matNormal[3];
+ NewtonMaterialGetContactPositionAndNormal(_material, _body0, matPos, matNormal);
+ _contactData.mvContactNormal += cVector3f::fromArray(matNormal);
+ _contactData.mvContactPosition += cVector3f::fromArray(matPos);
+
+ if (_contactBody0->GetWorld()->GetSaveContactPoints()) {
+ NewtonMaterialGetContactPositionAndNormal(_material, _body0, matPos, matNormal);
+ cCollidePoint collidePoint;
+ collidePoint.mfDepth = 1;
+ collidePoint.mvPoint = cVector3f::fromArray(matPos);
+ collidePoint.mvNormal = cVector3f::fromArray(matNormal);
+ _contactBody0->GetWorld()->GetContactPoints()->push_back(collidePoint);
+ }
+ _contacts++;
+}
- if (mlContactNum <= 0)
+void ContactProcessor::endProcessing() {
+ if (_contacts == 0)
return;
- iPhysicsMaterial *pMaterial1 = mpContactBody1->GetMaterial();
- iPhysicsMaterial *pMaterial2 = mpContactBody2->GetMaterial();
+ iPhysicsMaterial *pMaterial1 = _contactBody0->GetMaterial();
+ iPhysicsMaterial *pMaterial2 = _contactBody1->GetMaterial();
- mContactData.mvContactNormal = mContactData.mvContactNormal / (float)mlContactNum;
- mContactData.mvContactPosition = mContactData.mvContactPosition / (float)mlContactNum;
+ _contactData.mvContactNormal = _contactData.mvContactNormal / (float)_contacts;
+ _contactData.mvContactPosition = _contactData.mvContactPosition / (float)_contacts;
- pMaterial1->GetSurfaceData()->CreateImpactEffect(mContactData.mfMaxContactNormalSpeed,
- mContactData.mvContactPosition,
- mlContactNum, pMaterial2->GetSurfaceData());
+ pMaterial1->GetSurfaceData()->CreateImpactEffect(_contactData.mfMaxContactNormalSpeed,
+ _contactData.mvContactPosition,
+ _contacts, pMaterial2->GetSurfaceData());
int lPrio1 = pMaterial1->GetSurfaceData()->GetPriority();
int lPrio2 = pMaterial2->GetSurfaceData()->GetPriority();
if (lPrio1 >= lPrio2) {
- if (std::abs(mContactData.mfMaxContactNormalSpeed) > 0)
- pMaterial1->GetSurfaceData()->OnImpact(mContactData.mfMaxContactNormalSpeed,
- mContactData.mvContactPosition,
- mlContactNum, mpContactBody1);
- if (std::abs(mContactData.mfMaxContactTangentSpeed) > 0)
- pMaterial1->GetSurfaceData()->OnSlide(mContactData.mfMaxContactTangentSpeed,
- mContactData.mvContactPosition,
- mlContactNum, mpContactBody1, mpContactBody2);
+ if (std::abs(_contactData.mfMaxContactNormalSpeed) > 0)
+ pMaterial1->GetSurfaceData()->OnImpact(_contactData.mfMaxContactNormalSpeed,
+ _contactData.mvContactPosition,
+ _contacts, _contactBody0);
+ if (std::abs(_contactData.mfMaxContactTangentSpeed) > 0)
+ pMaterial1->GetSurfaceData()->OnSlide(_contactData.mfMaxContactTangentSpeed,
+ _contactData.mvContactPosition,
+ _contacts, _contactBody0, _contactBody1);
}
if (lPrio2 >= lPrio1 && pMaterial2 != pMaterial1) {
- if (std::abs(mContactData.mfMaxContactNormalSpeed) > 0)
- pMaterial2->GetSurfaceData()->OnImpact(mContactData.mfMaxContactNormalSpeed,
- mContactData.mvContactPosition,
- mlContactNum, mpContactBody2);
- if (std::abs(mContactData.mfMaxContactTangentSpeed) > 0)
- pMaterial2->GetSurfaceData()->OnSlide(mContactData.mfMaxContactTangentSpeed,
- mContactData.mvContactPosition,
- mlContactNum, mpContactBody2, mpContactBody1);
+ if (std::abs(_contactData.mfMaxContactNormalSpeed) > 0)
+ pMaterial2->GetSurfaceData()->OnImpact(_contactData.mfMaxContactNormalSpeed,
+ _contactData.mvContactPosition,
+ _contacts, _contactBody1);
+ if (std::abs(_contactData.mfMaxContactTangentSpeed) > 0)
+ pMaterial2->GetSurfaceData()->OnSlide(_contactData.mfMaxContactTangentSpeed,
+ _contactData.mvContactPosition,
+ _contacts, _contactBody1, _contactBody0);
}
- mpContactBody1->OnCollide(mpContactBody2, &mContactData);
- mpContactBody2->OnCollide(mpContactBody1, &mContactData);
-
- // Reset contact data
- mpContactBody1 = NULL;
- mpContactBody2 = NULL;
-
- mlContactNum = 0;
+ _contactBody0->OnCollide(_contactBody1, &_contactData);
+ _contactBody1->OnCollide(_contactBody0, &_contactData);
+}
- mContactData.mfMaxContactTangentSpeed = 0;
- mContactData.mfMaxContactNormalSpeed = 0;
+void cPhysicsMaterialNewton::ProcessContactCallback(const NewtonJoint *joint, float, int) {
+ ContactProcessor processor(joint);
- mContactData.mvContactPosition = cVector3f(0, 0, 0);
- mContactData.mvContactNormal = cVector3f(0, 0, 0);
- mContactData.mvForce = cVector3f(0, 0, 0);
+ while (processor.hasNext())
+ processor.processNext();
+ processor.endProcessing();
}
-//-----------------------------------------------------------------------
-
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.h b/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
index 16457e92dbd..552ab93f688 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
@@ -64,15 +64,8 @@ private:
float Combine(ePhysicsMaterialCombMode aMode, float afX, float afY);
static int BeginContactCallback(const NewtonMaterial *material,
- const NewtonBody *apBody1, const NewtonBody *apBody2);
- static int ProcessContactCallback(const NewtonMaterial *apMaterial,
- const NewtonContact *apContact);
- static void EndContactCallback(const NewtonMaterial *apMaterial);
-
- static iPhysicsBody *mpContactBody1;
- static iPhysicsBody *mpContactBody2;
- static cPhysicsContactData mContactData;
- static int mlContactNum;
+ const NewtonBody *apBody1, const NewtonBody *apBody2, int);
+ static void ProcessContactCallback(const NewtonJoint *joint, float, int);
NewtonWorld *mpNewtonWorld;
Commit: 374e3c1c3d6ac0a43600c4641d271936f30cbb5d
https://github.com/scummvm/scummvm/commit/374e3c1c3d6ac0a43600c4641d271936f30cbb5d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:37+01:00
Commit Message:
HPL1: cleanup PhysicsJointScrewNewton class
Changed paths:
engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
diff --git a/engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
index 693b5d532e9..31511a83e21 100644
--- a/engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointScrewNewton.cpp
@@ -29,6 +29,7 @@
#include "hpl1/engine/impl/PhysicsBodyNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
+#include "hpl1/engine/math/Vector3.h"
namespace hpl {
@@ -45,9 +46,9 @@ cPhysicsJointScrewNewton::cPhysicsJointScrewNewton(const tString &asName,
mvPin = avPinDir;
mvPin.Normalise();
- const float fPivotPoint[3] = {avPivotPoint.x, avPivotPoint.y, avPivotPoint.z};
- const float fPinDir[3] = {avPinDir.x, avPinDir.y, avPinDir.z};
- mpNewtonJoint = NewtonConstraintCreateCorkscrew(mpNewtonWorld, fPivotPoint, fPinDir, mpNewtonChildBody,
+ VEC3_CONST_ARRAY(pvPoint, avPivotPoint);
+ VEC3_CONST_ARRAY(pDir, avPinDir);
+ mpNewtonJoint = NewtonConstraintCreateCorkscrew(mpNewtonWorld, pvPoint, pDir, mpNewtonChildBody,
mpNewtonParentBody);
NewtonJointSetUserData(mpNewtonJoint, (void *)this);
Commit: 548b4c4233d5c7bf98b8cf12f37e0a685a36d985
https://github.com/scummvm/scummvm/commit/548b4c4233d5c7bf98b8cf12f37e0a685a36d985
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:37+01:00
Commit Message:
HPL1: implement PhysicsWorldNewton class
Changed paths:
engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
diff --git a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
index ec5ab775abd..b00794be338 100644
--- a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
@@ -39,6 +39,7 @@
#include "hpl1/engine/impl/PhysicsControllerNewton.h"
+#include "hpl1/engine/math/Vector3.h"
#include "hpl1/engine/scene/PortalContainer.h"
#include "hpl1/engine/scene/World3D.h"
@@ -138,12 +139,11 @@ float cPhysicsWorldNewton::GetMaxTimeStep() {
//-----------------------------------------------------------------------
void cPhysicsWorldNewton::SetWorldSize(const cVector3f &avMin, const cVector3f &avMax) {
-#if 0
- mvWorldSizeMin = avMin;
- mvWorldSizeMax = avMax;
-
- NewtonSetWorldSize(mpNewtonWorld,avMin.v, avMax.v);
-#endif
+ mvWorldSizeMin = avMin;
+ mvWorldSizeMax = avMax;
+ VEC3_CONST_ARRAY(min, avMin);
+ VEC3_CONST_ARRAY(max, avMax);
+ NewtonSetWorldSize(mpNewtonWorld, min, max);
}
cVector3f cPhysicsWorldNewton::GetWorldSizeMin() {
@@ -423,26 +423,24 @@ void cPhysicsWorldNewton::CastRay(iPhysicsRayCallback *apCallback,
const cVector3f &avOrigin, const cVector3f &avEnd,
bool abCalcDist, bool abCalcNormal, bool abCalcPoint,
bool abUsePrefilter) {
-#if 0
- gbRayCalcPoint = abCalcPoint;
- gbRayCalcNormal = abCalcNormal;
- gbRayCalcDist = abCalcDist;
+ gbRayCalcPoint = abCalcPoint;
+ gbRayCalcNormal = abCalcNormal;
+ gbRayCalcDist = abCalcDist;
- gvRayOrigin = avOrigin;
- gvRayEnd = avEnd;
+ gvRayOrigin = avOrigin;
+ gvRayEnd = avEnd;
- gvRayDelta = avEnd - avOrigin;
- gfRayLength = gvRayDelta.Length();
+ gvRayDelta = avEnd - avOrigin;
+ gfRayLength = gvRayDelta.Length();
- gpRayCallback = apCallback;
- const float fOrigin[3] = { avOrigin.x,avOrigin.y, avOrigin.z};
- const float fEnd[3] = {avEnd.x, avEnd.y, avEnd.z};
+ gpRayCallback = apCallback;
+ VEC3_CONST_ARRAY(origin, avOrigin);
+ VEC3_CONST_ARRAY(end, avEnd);
- if(abUsePrefilter)
- NewtonWorldRayCast(mpNewtonWorld, fOrigin, fEnd,RayCastFilterFunc, NULL, RayCastPrefilterFunc);
- else
- NewtonWorldRayCast(mpNewtonWorld, fOrigin, fEnd,RayCastFilterFunc, NULL, NULL);
-#endif
+ if (abUsePrefilter)
+ NewtonWorldRayCast(mpNewtonWorld, origin, end, RayCastFilterFunc, NULL, RayCastPrefilterFunc);
+ else
+ NewtonWorldRayCast(mpNewtonWorld, origin, end, RayCastFilterFunc, NULL, NULL);
}
//-----------------------------------------------------------------------
@@ -450,108 +448,101 @@ void cPhysicsWorldNewton::CastRay(iPhysicsRayCallback *apCallback,
bool cPhysicsWorldNewton::CheckShapeCollision(iCollideShape *apShapeA, const cMatrixf &a_mtxA,
iCollideShape *apShapeB, const cMatrixf &a_mtxB,
cCollideData &aCollideData, int alMaxPoints) {
-#if 0
- cCollideShapeNewton *pNewtonShapeA = static_cast<cCollideShapeNewton*>(apShapeA);
- cCollideShapeNewton *pNewtonShapeB = static_cast<cCollideShapeNewton*>(apShapeB);
-
- cMatrixf mtxTransposeA = a_mtxA.GetTranspose();
- cMatrixf mtxTransposeB = a_mtxB.GetTranspose();
+ cCollideShapeNewton *pNewtonShapeA = static_cast<cCollideShapeNewton *>(apShapeA);
+ cCollideShapeNewton *pNewtonShapeB = static_cast<cCollideShapeNewton *>(apShapeB);
- bool bLog = false;
- //if(alMaxPoints== 1) bLog = true;
+ cMatrixf mtxTransposeA = a_mtxA.GetTranspose();
+ cMatrixf mtxTransposeB = a_mtxB.GetTranspose();
- //////////////////////////////
- //Check compound collision
- if(pNewtonShapeA->GetType() == eCollideShapeType_Compound ||
- pNewtonShapeB->GetType() == eCollideShapeType_Compound)
- {
- int lACount = pNewtonShapeA->GetSubShapeNum();
- int lBCount = pNewtonShapeB->GetSubShapeNum();
+ //////////////////////////////
+ // Check compound collision
+ if (pNewtonShapeA->GetType() == eCollideShapeType_Compound ||
+ pNewtonShapeB->GetType() == eCollideShapeType_Compound) {
+ int lACount = pNewtonShapeA->GetSubShapeNum();
+ int lBCount = pNewtonShapeB->GetSubShapeNum();
- bool bCollision = false;
- aCollideData.mlNumOfPoints = 0;
- int lCollideDataStart =0;
+ bool bCollision = false;
+ aCollideData.mlNumOfPoints = 0;
+ int lCollideDataStart = 0;
- for(int a=0; a< lACount; a++)
- {
- for(int b=0; b< lBCount; b++)
- {
- cCollideShapeNewton *pSubShapeA = static_cast<cCollideShapeNewton*>(pNewtonShapeA->GetSubShape(a));
- cCollideShapeNewton *pSubShapeB = static_cast<cCollideShapeNewton*>(pNewtonShapeB->GetSubShape(b));
+ for (int a = 0; a < lACount; a++) {
+ for (int b = 0; b < lBCount; b++) {
+ cCollideShapeNewton *pSubShapeA = static_cast<cCollideShapeNewton *>(pNewtonShapeA->GetSubShape(a));
+ cCollideShapeNewton *pSubShapeB = static_cast<cCollideShapeNewton *>(pNewtonShapeB->GetSubShape(b));
- int lNum = NewtonCollisionCollide(mpNewtonWorld, alMaxPoints,
- pSubShapeA->GetNewtonCollision(), &(mtxTransposeA.m[0][0]),
- pSubShapeB->GetNewtonCollision(), &(mtxTransposeB.m[0][0]),
- mpTempPoints, mpTempNormals, mpTempDepths);
- if(lNum<1) continue;
- if(lNum > alMaxPoints )lNum = alMaxPoints;
+ int lNum = NewtonCollisionCollide(mpNewtonWorld, alMaxPoints,
+ pSubShapeA->GetNewtonCollision(), &(mtxTransposeA.m[0][0]),
+ pSubShapeB->GetNewtonCollision(), &(mtxTransposeB.m[0][0]),
+ mpTempPoints, mpTempNormals, mpTempDepths, 0);
+ if (lNum < 1)
+ continue;
+ if (lNum > alMaxPoints)
+ lNum = alMaxPoints;
- bCollision = true;
+ bCollision = true;
- //Log("Collided %d vs %d. Num: %d\n",a,b,lNum);
+ // Log("Collided %d vs %d. Num: %d\n",a,b,lNum);
- //Negate for each iteration.
- alMaxPoints -= lNum;
+ // Negate for each iteration.
+ alMaxPoints -= lNum;
- for(int i=0; i<lNum; i++)
- {
- cCollidePoint &CollPoint = aCollideData.mvContactPoints[lCollideDataStart + i];
- CollPoint.mfDepth = mpTempDepths[i];
+ for (int i = 0; i < lNum; i++) {
+ cCollidePoint &CollPoint = aCollideData.mvContactPoints[lCollideDataStart + i];
+ CollPoint.mfDepth = mpTempDepths[i];
- int lVertex = i*3;
+ int lVertex = i * 3;
- CollPoint.mvNormal.x = mpTempNormals[lVertex+0];
- CollPoint.mvNormal.y = mpTempNormals[lVertex+1];
- CollPoint.mvNormal.z = mpTempNormals[lVertex+2];
+ CollPoint.mvNormal.x = mpTempNormals[lVertex + 0];
+ CollPoint.mvNormal.y = mpTempNormals[lVertex + 1];
+ CollPoint.mvNormal.z = mpTempNormals[lVertex + 2];
- CollPoint.mvPoint.x = mpTempPoints[lVertex+0];
- CollPoint.mvPoint.y = mpTempPoints[lVertex+1];
- CollPoint.mvPoint.z = mpTempPoints[lVertex+2];
- }
+ CollPoint.mvPoint.x = mpTempPoints[lVertex + 0];
+ CollPoint.mvPoint.y = mpTempPoints[lVertex + 1];
+ CollPoint.mvPoint.z = mpTempPoints[lVertex + 2];
+ }
- lCollideDataStart += lNum;
- aCollideData.mlNumOfPoints += lNum;
+ lCollideDataStart += lNum;
+ aCollideData.mlNumOfPoints += lNum;
- if(alMaxPoints <= 0) break;
- }
- if(alMaxPoints <= 0) break;
+ if (alMaxPoints <= 0)
+ break;
}
-
- return bCollision;
+ if (alMaxPoints <= 0)
+ break;
}
- //////////////////////////////
- //Check NON compound collision
- else
- {
- int lNum = NewtonCollisionCollide(mpNewtonWorld, alMaxPoints,
- pNewtonShapeA->GetNewtonCollision(), &(mtxTransposeA.m[0][0]),
- pNewtonShapeB->GetNewtonCollision(), &(mtxTransposeB.m[0][0]),
- mpTempPoints, mpTempNormals, mpTempDepths);
-
- if(lNum<1) return false;
- if(lNum > alMaxPoints )lNum = alMaxPoints;
-
- for(int i=0; i<lNum; i++)
- {
- cCollidePoint &CollPoint = aCollideData.mvContactPoints[i];
- CollPoint.mfDepth = mpTempDepths[i];
-
- int lVertex = i*3;
-
- CollPoint.mvNormal.x = mpTempNormals[lVertex+0];
- CollPoint.mvNormal.y = mpTempNormals[lVertex+1];
- CollPoint.mvNormal.z = mpTempNormals[lVertex+2];
-
- CollPoint.mvPoint.x = mpTempPoints[lVertex+0];
- CollPoint.mvPoint.y = mpTempPoints[lVertex+1];
- CollPoint.mvPoint.z = mpTempPoints[lVertex+2];
- }
- aCollideData.mlNumOfPoints = lNum;
+ return bCollision;
+ }
+ //////////////////////////////
+ // Check NON compound collision
+ else {
+ int lNum = NewtonCollisionCollide(mpNewtonWorld, alMaxPoints,
+ pNewtonShapeA->GetNewtonCollision(), &(mtxTransposeA.m[0][0]),
+ pNewtonShapeB->GetNewtonCollision(), &(mtxTransposeB.m[0][0]),
+ mpTempPoints, mpTempNormals, mpTempDepths, 0);
+
+ if (lNum < 1)
+ return false;
+ if (lNum > alMaxPoints)
+ lNum = alMaxPoints;
+
+ for (int i = 0; i < lNum; i++) {
+ cCollidePoint &CollPoint = aCollideData.mvContactPoints[i];
+ CollPoint.mfDepth = mpTempDepths[i];
+
+ int lVertex = i * 3;
+
+ CollPoint.mvNormal.x = mpTempNormals[lVertex + 0];
+ CollPoint.mvNormal.y = mpTempNormals[lVertex + 1];
+ CollPoint.mvNormal.z = mpTempNormals[lVertex + 2];
+
+ CollPoint.mvPoint.x = mpTempPoints[lVertex + 0];
+ CollPoint.mvPoint.y = mpTempPoints[lVertex + 1];
+ CollPoint.mvPoint.z = mpTempPoints[lVertex + 2];
}
-#endif
-
+ aCollideData.mlNumOfPoints = lNum;
+ }
return true;
}
Commit: 520a35e7fa7a060f1a840c52cc6623f0582e4261
https://github.com/scummvm/scummvm/commit/520a35e7fa7a060f1a840c52cc6623f0582e4261
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:37+01:00
Commit Message:
HPL1: add newton library code
Changed paths:
A engines/hpl1/engine/libraries/newton/Newton.cpp
A engines/hpl1/engine/libraries/newton/NewtonClass.cpp
A engines/hpl1/engine/libraries/newton/NewtonClass.h
A engines/hpl1/engine/libraries/newton/NewtonStdAfx.h
A engines/hpl1/engine/libraries/newton/core/dg.cpp
A engines/hpl1/engine/libraries/newton/core/dg.h
A engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
A engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.h
A engines/hpl1/engine/libraries/newton/core/dgArray.h
A engines/hpl1/engine/libraries/newton/core/dgCRC.cpp
A engines/hpl1/engine/libraries/newton/core/dgCRC.h
A engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.cpp
A engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.h
A engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.cpp
A engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.h
A engines/hpl1/engine/libraries/newton/core/dgDebug.cpp
A engines/hpl1/engine/libraries/newton/core/dgDebug.h
A engines/hpl1/engine/libraries/newton/core/dgDelaunayTetrahedralization.cpp
A engines/hpl1/engine/libraries/newton/core/dgDelaunayTetrahedralization.h
A engines/hpl1/engine/libraries/newton/core/dgGeneralMatrix.cpp
A engines/hpl1/engine/libraries/newton/core/dgGeneralMatrix.h
A engines/hpl1/engine/libraries/newton/core/dgGeneralVector.cpp
A engines/hpl1/engine/libraries/newton/core/dgGeneralVector.h
A engines/hpl1/engine/libraries/newton/core/dgGoogol.cpp
A engines/hpl1/engine/libraries/newton/core/dgGoogol.h
A engines/hpl1/engine/libraries/newton/core/dgGraph.h
A engines/hpl1/engine/libraries/newton/core/dgHeap.h
A engines/hpl1/engine/libraries/newton/core/dgIntersections.cpp
A engines/hpl1/engine/libraries/newton/core/dgIntersections.h
A engines/hpl1/engine/libraries/newton/core/dgList.h
A engines/hpl1/engine/libraries/newton/core/dgMatrix.cpp
A engines/hpl1/engine/libraries/newton/core/dgMatrix.h
A engines/hpl1/engine/libraries/newton/core/dgMemory.cpp
A engines/hpl1/engine/libraries/newton/core/dgMemory.h
A engines/hpl1/engine/libraries/newton/core/dgNode.cpp
A engines/hpl1/engine/libraries/newton/core/dgNode.h
A engines/hpl1/engine/libraries/newton/core/dgPathFinder.h
A engines/hpl1/engine/libraries/newton/core/dgPlane.h
A engines/hpl1/engine/libraries/newton/core/dgPolygonSoupBuilder.cpp
A engines/hpl1/engine/libraries/newton/core/dgPolygonSoupBuilder.h
A engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
A engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
A engines/hpl1/engine/libraries/newton/core/dgPolyhedra.h
A engines/hpl1/engine/libraries/newton/core/dgPolyhedraMassProperties.cpp
A engines/hpl1/engine/libraries/newton/core/dgPolyhedraMassProperties.h
A engines/hpl1/engine/libraries/newton/core/dgQuaternion.cpp
A engines/hpl1/engine/libraries/newton/core/dgQuaternion.h
A engines/hpl1/engine/libraries/newton/core/dgRandom.cpp
A engines/hpl1/engine/libraries/newton/core/dgRandom.h
A engines/hpl1/engine/libraries/newton/core/dgRef.cpp
A engines/hpl1/engine/libraries/newton/core/dgRef.h
A engines/hpl1/engine/libraries/newton/core/dgRefCounter.cpp
A engines/hpl1/engine/libraries/newton/core/dgRefCounter.h
A engines/hpl1/engine/libraries/newton/core/dgRtti.h
A engines/hpl1/engine/libraries/newton/core/dgSPDMatrix.cpp
A engines/hpl1/engine/libraries/newton/core/dgSPDMatrix.h
A engines/hpl1/engine/libraries/newton/core/dgSimd_Instrutions.h
A engines/hpl1/engine/libraries/newton/core/dgSmallDeterminant.cpp
A engines/hpl1/engine/libraries/newton/core/dgSmallDeterminant.h
A engines/hpl1/engine/libraries/newton/core/dgSphere.cpp
A engines/hpl1/engine/libraries/newton/core/dgSphere.h
A engines/hpl1/engine/libraries/newton/core/dgStack.h
A engines/hpl1/engine/libraries/newton/core/dgStdafx.h
A engines/hpl1/engine/libraries/newton/core/dgThreads.cpp
A engines/hpl1/engine/libraries/newton/core/dgThreads.h
A engines/hpl1/engine/libraries/newton/core/dgTree.cpp
A engines/hpl1/engine/libraries/newton/core/dgTree.h
A engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
A engines/hpl1/engine/libraries/newton/core/dgTypes.h
A engines/hpl1/engine/libraries/newton/core/dgVector.h
A engines/hpl1/engine/libraries/newton/physics/dgBallConstraint.cpp
A engines/hpl1/engine/libraries/newton/physics/dgBallConstraint.h
A engines/hpl1/engine/libraries/newton/physics/dgBilateralConstraint.cpp
A engines/hpl1/engine/libraries/newton/physics/dgBilateralConstraint.h
A engines/hpl1/engine/libraries/newton/physics/dgBody.cpp
A engines/hpl1/engine/libraries/newton/physics/dgBody.h
A engines/hpl1/engine/libraries/newton/physics/dgBodyMasterList.cpp
A engines/hpl1/engine/libraries/newton/physics/dgBodyMasterList.h
A engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.cpp
A engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.h
A engines/hpl1/engine/libraries/newton/physics/dgCollision.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollision.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionBVH.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionBVH.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionBox.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionBox.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionCompound.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionCompound.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionCone.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionCone.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexHull.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexHull.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexModifier.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexModifier.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionCylinder.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionCylinder.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionEllipse.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionEllipse.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionHeightField.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionHeightField.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionNull.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionNull.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionSphere.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionSphere.h
A engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.h
A engines/hpl1/engine/libraries/newton/physics/dgConnectorConstraint.cpp
A engines/hpl1/engine/libraries/newton/physics/dgConnectorConstraint.h
A engines/hpl1/engine/libraries/newton/physics/dgConstraint.cpp
A engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
A engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
A engines/hpl1/engine/libraries/newton/physics/dgContact.h
A engines/hpl1/engine/libraries/newton/physics/dgCorkscrewConstraint.cpp
A engines/hpl1/engine/libraries/newton/physics/dgCorkscrewConstraint.h
A engines/hpl1/engine/libraries/newton/physics/dgHingeConstraint.cpp
A engines/hpl1/engine/libraries/newton/physics/dgHingeConstraint.h
A engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
A engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
A engines/hpl1/engine/libraries/newton/physics/dgMeshEffect2.cpp
A engines/hpl1/engine/libraries/newton/physics/dgMeshEffect3.cpp
A engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.cpp
A engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.h
A engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
A engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.h
A engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
A engines/hpl1/engine/libraries/newton/physics/dgPhysics.h
A engines/hpl1/engine/libraries/newton/physics/dgPhysicsStdafx.h
A engines/hpl1/engine/libraries/newton/physics/dgPointToCurveConstraint.cpp
A engines/hpl1/engine/libraries/newton/physics/dgPointToCurveConstraint.h
A engines/hpl1/engine/libraries/newton/physics/dgSlidingConstraint.cpp
A engines/hpl1/engine/libraries/newton/physics/dgSlidingConstraint.h
A engines/hpl1/engine/libraries/newton/physics/dgUniversalConstraint.cpp
A engines/hpl1/engine/libraries/newton/physics/dgUniversalConstraint.h
A engines/hpl1/engine/libraries/newton/physics/dgUpVectorConstraint.cpp
A engines/hpl1/engine/libraries/newton/physics/dgUpVectorConstraint.h
A engines/hpl1/engine/libraries/newton/physics/dgUserConstraint.cpp
A engines/hpl1/engine/libraries/newton/physics/dgUserConstraint.h
A engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
A engines/hpl1/engine/libraries/newton/physics/dgWorld.h
A engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
A engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
new file mode 100644
index 00000000000..fb2b40c2ae8
--- /dev/null
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -0,0 +1,9488 @@
+/*
+ * Copyright (c) <2003-2011> <Julio Jerez, Newton Game Dynamics>
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source distribution.
+ */
+
+#include "Newton.h"
+#include "NewtonClass.h"
+#include "NewtonStdAfx.h"
+
+#ifdef _WIN32
+#ifdef _DEBUG
+//#define DG_USED_DEBUG_EXCEPTIONS
+#endif // _DEBUG
+#endif // _WIN32
+
+#ifdef _DEBUG
+
+void TraceFuntionName(const char *name) {
+ // static int trace;
+ // dgTrace(("%d %s\n", trace, name));
+ dgTrace(("%s\n", name));
+}
+
+//#define TRACE_FUNTION(name) TraceFuntionName (name)
+#define TRACE_FUNTION(name)
+#else
+#define TRACE_FUNTION(name)
+#endif // _DEBUG
+
+#ifndef _NEWTON_STATIC_LIB
+#ifdef __MINGW32__
+int main(int argc, char *argv[]) {
+ return 0;
+}
+#endif // _MINGW32__
+
+#ifdef _MSC_VER
+BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
+ return TRUE;
+}
+#endif
+#endif // _NEWTON_STATIC_LIB
+
+//#define SAVE_COLLISION
+#ifdef SAVE_COLLISION
+
+void SerializeFile(void *serializeHandle, const void *buffer, size_t size) {
+ fwrite(buffer, size, 1, (FILE *)serializeHandle);
+}
+
+void DeSerializeFile(void *serializeHandle, void *buffer, size_t size) {
+ fread(buffer, size, 1, (FILE *)serializeHandle);
+}
+
+void SaveCollision(const NewtonCollision *collisionPtr) {
+ FILE *file;
+ // save the collision file
+ file = fopen("collisiontest.bin", "wb");
+ // SerializeFile(file, MAGIC_NUMBER, strlen(MAGIC_NUMBER) + 1);
+ NewtonCollisionSerialize(collisionPtr, SerializeFile, file);
+ fclose(file);
+}
+
+#endif // SAVE_COLLISION
+
+/*
+ * *dFloat* globalScale - global scale factor that will scale all internal tolerance.
+ * Remarks: the physics system in theory should be dimensionless, however in practice the engine have to be implemented with
+ * limited precision floating numbers and is also built for real-time simulation, it is inevitable that tolerances have to be used in order to increase performance, and
+ * reduce instabilities. These tolerances make the engine dimension dependent, for example let say a rigid body is considered at rest when
+ * its velocity is less than 0.01 units per second for some frames. For a program using meters as unit this translate to 0.01 meters per second,
+ * however for a program using centimeter this translate to 0.0001 meter per second, since the precession of speed is independent of the unit system,
+ * this means that in the second system the engine has to work much harder to bring the body to rest. A solution for this is to scale all tolerances
+ * to match the unit system. The argument *globalScale* must be a constant to convert the unit system in the game to meters, for example if in your game you are using 39 units is a meter,
+ * the *globaScale* must be 39. The exact conversion factor does not have to be exact, but the closer it is to reality the better performance the application will get.
+ * Applications that are already using meters as the unit system must pass 1.0 as *globalSscale*.
+ */
+
+/*!
+ * Return the exact amount of memory use by the engine and any given time time.
+ *
+ * @return
+ * Total memory use by the engine.
+ *
+ * @remarks
+ * This function is useful for application to determine if the memory
+ * use by the engine is balanced at all time.
+ *
+ * @see
+ * NewtonCreate
+ */
+int NewtonGetMemoryUsed() {
+ // Newton* world;
+ // dgMemoryAllocator* allocator;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ // world = (Newton*)newtonWorld;
+ // allocator = world->dgWorld::GetAllocator();
+
+ return dgGetMemoryUsed();
+}
+
+void NewtonSetMemorySystem(NewtonAllocMemory mallocFnt, NewtonFreeMemory mfreeFnt) {
+ dgMemFree _free;
+ dgMemAlloc _malloc;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ if (mallocFnt && mfreeFnt) {
+ _malloc = (dgMemAlloc)mallocFnt;
+ _free = (dgMemFree)mfreeFnt;
+ } else {
+ _malloc = (dgMemAlloc)Newton::DefaultAllocMemory;
+ _free = (dgMemFree)Newton::DefaultFreeMemory;
+ }
+
+ dgSetGlobalAllocators(_malloc, _free);
+}
+
+// ***************************************************************************************************************
+//
+// Name: World interface
+//
+// ***************************************************************************************************************
+
+/*!
+ * Create an instance of the Newton world.
+ *
+ * @return
+ * A pointer to an instance of the Newton world.
+ *
+ * @remarks
+ * This function must be called before any of the other API functions.
+ *
+ * @see
+ * NewtonDestroy,
+ * NewtonDestroyAllBodies
+ */
+NewtonWorld *NewtonCreate() {
+ TRACE_FUNTION(__FUNCTION__);
+ dgMemoryAllocator *const allocator = new dgMemoryAllocator();
+
+ dFloat p0[4];
+ dFloat p1[4];
+
+ NewtonWorld *const world = (NewtonWorld *)new (allocator) Newton(
+ dgFloat32(1.0f), allocator);
+
+ p0[0] = -100.0f;
+ p0[1] = -100.0f;
+ p0[2] = -100.0f;
+ p1[0] = 100.0f;
+ p1[1] = 100.0f;
+ p1[2] = 100.0f;
+
+ NewtonSetWorldSize(world, p0, p1);
+ return world;
+}
+
+/*!
+ * Destroy an instance of the Newton world.
+ *
+ * @param newtonWorld
+ * Is the pointer to the Newton world.
+ *
+ * @remarks
+ * This function will destroy the entire Newton world.
+ *
+ * @see
+ * NewtonCreate,
+ * NewtonDestroyAllBodies
+ */
+void NewtonDestroy(const NewtonWorld *const newtonWorld) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ Newton *const world = (Newton *)newtonWorld;
+ dgMemoryAllocator *const allocator = world->dgWorld::GetAllocator();
+
+ delete world;
+ delete allocator;
+}
+
+// Name: NewtonInvalidateCache
+// Reset all internal states of the engine.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+//
+// Remarks: When an application wants to reset the state of all the objects in the world to a predefined initial condition,
+// just setting the initial position and velocity is not sufficient to reproduce equal runs since the engine maintain
+// there are internal states that in order to take advantage of frame to frame coherence.
+// In this cases this function will reset all of the internal states.
+//
+// Remarks: This function must be call outside of a Newton Update. this function should only be used for special case of synchronization,
+// using it as part of the simulation loop will severally affect the engine performance.
+//
+// See also: NewtonUpdate
+void NewtonInvalidateCache(const NewtonWorld *const newtonWorld) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+ world->FlushCache();
+}
+
+// Name: NewtonGetGlobalScale
+// Get the global scale factor.
+//
+// Remarks: the physics system in theory should be dimensionless, however in practice the engine have to be implemented with
+// limited precision floating numbers and is also built for real-time simulation, it is inevitable that tolerances have to be used in order to increase performance, and
+// reduce instabilities. These tolerances make the engine dimension dependent, for example let say a rigid body is considered at rest when
+// its velocity is less than 0.01 units per second for some frames. For a program using meters as unit this translate to 0.01 meters per second,
+// however for a program using centimeter this translate to 0.0001 meter per second, since the precession of speed is independent of the unit system,
+// this means that in the second system the engine has to work much harder to bring the body to rest. A solution for this is to scale all tolerances
+// to match the unit system. The argument *globalScale* must be a constant to convert the unit system in the game to meters, for example if in your game you are using 39 units is a meter,
+// the *globaScale* must be 39. The exact conversion factor does not have to be exact, but the closer it is to reality the better performance the application will get.
+// Applications that are already using meters as the unit system must pass 1.0 as *globalScale*.
+//
+// See also: NewtonCreate
+// dFloat NewtonGetGlobalScale(const NewtonWorld* const newtonWorld)
+//{
+// Newton* world;
+// world = (Newton *) newtonWorld;
+// return world->GetGlobalScale();
+// return dgFloat32(1.0f);
+//}
+
+// Name: NewtonSetPlatformArchitecture
+// Set the current platform hardware architecture.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *int* model - model of operation 0 = default, 1 = medium, n = best.
+//
+// Return: Nothing
+//
+// Remarks: This function allows the application to configure the Newton to take advantage
+// for specific hardware architecture in the same platform.
+//
+// 0: force the hardware lower common denominator for the running platform.
+//
+// 1: will try to use common floating point enhancement like special instruction set
+// on the specific architecture. This mode made lead to result that differ from mode 1 and 2 as the accumulation
+// round off errors maybe different.
+//
+// Remarks: the only hardware mode guarantee to work is mode 0. all other are only
+// hints to the engine, for example setting mode 1 will take not effect on CPUs without
+// specially floating point instructions set.
+//
+// See also: NewtonGetPlatformArchitecture
+void NewtonSetPlatformArchitecture(const NewtonWorld *const newtonWorld,
+ int mode) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+ world->SetHardwareMode(mode);
+}
+
+// Name: NewtonGetPlatformArchitecture
+// Get the current platform hardware architecture.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *char* *description - pointer to a string to contain a description of the current architecture
+//
+// Return: index indicating the current platform architecture.
+//
+// Remarks: if *description* is not NULL, then is must be at least 32 characters long.
+//
+// Remarks: This function allows the application to configure the Newton to take advantage
+// for specific hardware architecture in the same platform.
+//
+// 0: force the hardware lower common denominator for the running platform.
+//
+// 1: will try to use common floating point enhancement like special instruction set
+// on the specific architecture. This mode made lead to result that differ from mode 1 and 2 as the accumulation
+// round off errors maybe different.
+//
+// Remarks: the only hardware mode guarantee to work is mode 0. all other are only
+// hints to the engine, for example setting mode 1 will take not effect on CPUs without
+// specially floating point instructions set.
+//
+// See also: NewtonSetPlatformArchitecture
+int NewtonGetPlatformArchitecture(const NewtonWorld *const newtonWorld,
+ char *description) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+ return world->GetHardwareMode(description);
+}
+
+// Name: NewtonWorldCriticalSectionLock
+// this function block all other threads from executing the same subsequent code simultaneously.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+//
+// Remarks: this function should use to present racing conditions when when a call back ins executed form a mutithreaded loop.
+// In general most call back are thread safe when they do not write to object outside the scope of the call back.
+// this means for example that the application can modify values of object pointed by the arguments and or call that function
+// that are allowed to be call for such callback.
+// There are cases, however, when the application need to collect data for the client logic, example of such case are collecting
+// information to display debug information, of collecting data for feedback.
+// In these situations it is possible the the same critical code could be execute at the same time but several thread causing unpredictable side effect.
+// so it is necessary to block all of the thread from executing any pieces of critical code.
+//
+// Remarks: Not calling function *NewtonWorldCriticalSectionUnlock* will result on the engine going into an infinite loop.
+//
+// Remarks: it is important that the critical section wrapped by functions *NewtonWorldCriticalSectionLock* and
+// *NewtonWorldCriticalSectionUnlock* be keep small if the application is using the multi threaded functionality of the engine
+// no doing so will lead to serialization of the parallel treads since only one thread can run the a critical section at a time.
+//
+// Return: Nothing.
+//
+// See also: NewtonWorldCriticalSectionUnlock
+void NewtonWorldCriticalSectionLock(const NewtonWorld *const newtonWorld) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ Newton *const world = (Newton *)newtonWorld;
+ world->dgGetUserLock();
+}
+
+// Name: NewtonWorldCriticalSectionUnlock
+// this function block all other threads from executing the same subsequent code simultaneously.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+//
+//
+// Remarks: this function should use to present racing conditions when when a call back ins executed form a mutithreaded loop.
+// In general most call back are thread safe when they do not write to object outside the scope of the call back.
+// this means for example that the application can modify values of object pointed by the arguments and or call that function
+// that are allowed to be call for such callback.
+// There are cases, however, when the application need to collect data for the client logic, example of such case are collecting
+// information to display debug information, of collecting data for feedback.
+// In these situations it is possible the the same critical code could be execute at the same time but several thread causing unpredictable side effect.
+// so it is necessary to block all of the thread from executing any pieces of critical code.
+//
+// Remarks: it is important that the critical section wrapped by functions *NewtonWorldCriticalSectionLock* and
+// *NewtonWorldCriticalSectionUnlock* be keep small if the application is using the multi threaded functionality of the engine
+// no doing so will lead to serialization of the parallel treads since only one thread can run the a critical section at a time.
+//
+// Return: Nothing.
+//
+// See also: NewtonWorldCriticalSectionLock
+void NewtonWorldCriticalSectionUnlock(const NewtonWorld *const newtonWorld) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ Newton *const world = (Newton *)newtonWorld;
+ world->dgReleasedUserLock();
+}
+
+// Name: NewtonSetThreadsCount
+// Set the maximum number of thread the engine is allowed to use by the application.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *int* threads - max number of threaded allowed
+//
+// Return: Nothing
+//
+// Remarks: The maximum number of threaded is set on initialization to the maximum number of CPU in the system.
+//
+// Remarks: The engine will only allow a maximum number of thread equal are lower to the maximum number of cores visible in the system.
+// if *threads* is set to a value larger that then number of logical CPUs in the system, the *threads* will be clamped to the number of logical CPUs.
+//
+// Remarks: the function is only only have effect on the multi core version of the engine.
+//
+// See also: NewtonGetThreadNumber, NewtonGetThreadsCount
+void NewtonSetThreadsCount(const NewtonWorld *const newtonWorld, int threads) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ Newton *const world = (Newton *)newtonWorld;
+ world->SetThreadsCount(threads);
+}
+
+// Name: NewtonGetThreadsCount
+// Get the total number of thread running in the engine.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+//
+// Return: number threads
+//
+// Remarks: The maximum number of threaded is set on initialization to the maximum number of CPU in the system.
+//
+// Remarks: the function will always return 1 on the none multi core version of the library..
+//
+// See also: NewtonGetThreadNumber, NewtonSetThreadsCount, NewtonSetMultiThreadSolverOnSingleIsland
+int NewtonGetThreadsCount(const NewtonWorld *const newtonWorld) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ Newton *const world = (Newton *)newtonWorld;
+ return world->GetThreadsCount();
+}
+
+// Name: NewtonGetMaxThreadsCount
+// Get the maximu number of thread abialble.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+//
+// Return: number threads
+//
+// Remarks: The maximum number of threaded is set on initialization to the maximum number of CPU in the system.
+//
+// Remarks: the function will always return 1 on the none multi core version of the library..
+//
+// See also: NewtonGetThreadNumber, NewtonSetThreadsCount, NewtonSetMultiThreadSolverOnSingleIsland
+int NewtonGetMaxThreadsCount(const NewtonWorld *const newtonWorld) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ Newton *const world = (Newton *)newtonWorld;
+ return world->GetMaxThreadsCount();
+}
+
+/*
+ // Name: NewtonGetThreadNumber
+ // Get the current thread the Engine is running
+ //
+ // Parameters:
+ // *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+ //
+ // Return: the index to the current workir thread runnin the call back. -1 if the function is called ourxoed of a call back
+ //
+ // Remarks: This function let application to read the current thread running in a callback
+ //
+ // Remarks: the function will always return 1 on the none multi core version of the library..
+ //
+ // See also: NewtonGetThreadsCount, NewtonSetThreadsCount, NewtonSetMultiThreadSolverOnSingleIsland
+ int NewtonGetThreadNumber(const NewtonWorld* const newtonWorld)
+ {
+ Newton* world;
+ world = (Newton *)newtonWorld;
+ TRACE_FUNTION(__FUNCTION__);
+ return world->GetThreadNumber();
+ }
+ */
+
+// Name: NewtonSetMultiThreadSolverOnSingleIsland
+// Enable or disable solver to resolve constraint forces in multi threaded mode when large island configurations. Mode is disabled by default.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *int* mode - solver mode 1 enable parallel mode 0 disable parallel mode, default
+//
+// Return: Nothing
+//
+// Remarks: When running in multi threaded mode it is not always faster to calculate constraint forces in parallel.
+// there reasons for this are:
+// 1 - there is a significant software cost for setting threads both in memory and instructions overhead.
+// 2 - different systems have different cost for running separate threads in a share memory environment
+// 3 - numerical algorithms have decreased converge rate when implemented in parallel, typical lost of converge can be as high as half
+// of the of the sequential version, for this reason the parallel version require higher number of interaction to achieve similar convergence.
+//
+// Remarks: It is recommended this option is enabled on system with more than two cores, since the performance gain in a dual core system are marginally better.
+// at the very list the application must test the option to verify the performance gains.
+//
+// Remarks: disabling or enabling this option have not impact on the execution of the any of the other subsystems of the engine.
+//
+// See also: NewtonGetThreadsCount, NewtonSetThreadsCount
+void NewtonSetMultiThreadSolverOnSingleIsland(
+ const NewtonWorld *const newtonWorld, int mode) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+ TRACE_FUNTION(__FUNCTION__);
+ world->EnableThreadOnSingleIsland(mode);
+}
+
+int NewtonGetMultiThreadSolverOnSingleIsland(
+ const NewtonWorld *const newtonWorld) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+ TRACE_FUNTION(__FUNCTION__);
+ return world->GetThreadOnSingleIsland();
+}
+
+// Name: NewtonSetSolverModel
+// Set the solver precision mode.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *int* model - model of operation 0 = exact, 1 = adaptive, n = linear. The default is exact.
+//
+// Return: Nothing
+//
+// Remarks: This function allows the application to configure the Newton solver to work in three different modes.
+//
+// 0: Is the exact mode. This is good for application where precision is more important than speed, ex: realistic simulation.
+//
+// 1: Is the adaptive mode, the solver is not as exact but the simulation will still maintain a high degree of accuracy.
+// This mode is good for applications were a good degree of stability is important but not as important as speed.
+//
+// n: Linear mode. The solver will not try to reduce the joints relative acceleration errors to below some limit,
+// instead it will perform up to n passes over the joint configuration each time reducing the acceleration error,
+// but it will terminate when the number of passes is exhausted regardless of the error magnitude.
+// In general this is the fastest mode and is is good for applications where speed is the only important factor, ex: video games.
+//
+// Remarks: the adaptive friction model combined with the linear model make for the fastest possible configuration
+// of the Newton solver. This setup is best for games.
+// If you need the best realistic behavior, we recommend the use of the exact solver and exact friction model which are the defaults.
+//
+// See also: NewtonSetFrictionModel, NewtonGetThreadNumber
+void NewtonSetSolverModel(const NewtonWorld *const newtonWorld, int model) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world->SetSolverMode(model);
+}
+
+// Name: NewtonSetFrictionModel
+// Set coulomb model of friction.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *int* model - friction model; 0 = exact coulomb, 1 = adaptive coulomb, The default is exact.
+//
+// Return: Nothing.
+//
+// Remarks: This function allows the application to chose between and exact or an adaptive coulomb friction model
+//
+// 0: Is the exact model. Friction forces are calculated in each frame.
+// This model is good for applications where precision is more important than speed, ex: realistic simulation.
+//
+// 1: Is the adaptive model. Here values from previous frames are used to determine the maximum friction values of the current frame.
+// This is about 10% faster than the exact model however it may introduce strange friction behaviors. For example a
+// bouncing object tumbling down a ramp will act as a friction less object because the contacts do not have continuity.
+// In general each time a new contact is generated the friction value is zero, only if the contact persist a non zero
+// friction values is used. The second effect is that if a normal force is very strong, and if the contact is suddenly
+// destroyed, a very strong friction force will be generated at the contact point making the object react in a non-familiar way.
+//
+// Remarks: the adaptive friction model combined with the linear model make for the fastest possible configuration
+// of the Newton solver. This setup is best for games.
+// If you need the best realistic behavior, we recommend the use of the exact solver and exact friction model which are the defaults.
+//
+// See also: NewtonSetSolverModel
+void NewtonSetFrictionModel(const NewtonWorld *const newtonWorld, int model) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world->SetFrictionMode(model);
+}
+
+// Name: NewtonSetPerformanceClock
+// Set performance Counter callback.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *NewtonGetTicksCountCallback* callback - application define callback
+//
+// Remarks: The application can use this function to profile Newton. *NewtonGetTicksCountCallback* callback is a
+// function call back that should return and absolute time since the the application started.
+//
+// Return: Nothing.
+//
+// See also: NewtonReadPerformanceTicks
+void NewtonSetPerformanceClock(const NewtonWorld *const newtonWorld,
+ NewtonGetTicksCountCallback callback) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world->SetPerfomanceCounter((OnGetPerformanceCountCallback)callback);
+}
+
+// Name: NewtonReadPerformanceTicks
+// Get the number of ticks used by the engine in one of the major components
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *unsigned* performanceEntry - index to one of the engine internal components.
+//
+// Remarks: there are 9 hierarchical counters
+//
+// NEWTON_PROFILER_WORLD_UPDATE: measure total ticks in each update call
+// NEWTON_PROFILER_COLLISION_UPDATE: total ticks in each collision and contact calculation
+// NEWTON_PROFILER_COLLISION_UPDATE_BROAD_PHASE: measure ticks on colliding pairs.
+// NEWTON_PROFILER_COLLISION_UPDATE_NARROW_PHASE: measure ticks calculating contacts for each colliding pair.
+// NEWTON_PROFILER_DYNAMICS_UPDATE: measure ticks on solving constraints, contact inter penetration, and integration
+// NEWTON_PROFILER_DYNAMICS_CONSTRAINT_GRAPH: measure ticks solving contacts and constraint graph interconnectivity.
+// NEWTON_PROFILER_DYNAMICS_BUILD_MASS_MATRIX: measure ticks solving preparing constraint matrix
+// NEWTON_PROFILER_DYNAMICS_SOLVE_CONSTRAINT_GRAPH: measure tick solving constraint matrix and calculating reaction forces and integration.
+//
+// Remarks: This function will return zero unless the application had previous
+// set a performance counter callback by calling the function *NewtonSetPerformanceClock*
+//
+// Return: Ticks count used by application in lass call to *NewtonUpdate*
+//
+// See also: NewtonReadPerformanceTicks, NewtonUpdate
+unsigned NewtonReadPerformanceTicks(const NewtonWorld *const newtonWorld,
+ unsigned performanceEntry) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return world->GetPerfomanceTicks(performanceEntry);
+}
+
+unsigned NewtonReadThreadPerformanceTicks(const NewtonWorld *newtonWorld,
+ unsigned threadIndex) {
+ Newton *const world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return world->GetThreadPerfomanceTicks(threadIndex);
+}
+
+#ifdef DG_USED_DEBUG_EXCEPTIONS
+dgInt32 ExecptionHandler(void *exceptPtr) {
+ EXCEPTION_RECORD *record;
+
+ record = ((EXCEPTION_POINTERS *)exceptPtr)->ExceptionRecord;
+ // if (record->ExceptionCode != EXCEPTION_ACCESS_VIOLATION) {
+ // return 0;
+ // }
+ return 1;
+}
+#endif
+
+// Name: NewtonUpdate
+// Advance the simulation by an amount of time.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *dFloat* timestep - time step in seconds
+//
+// Return: Nothing
+//
+// Remarks: This function will advance the simulation by the amount of time specified by *timestep*. The Newton Engine does
+// not perform sub-steps, and does not need tuning parameters. It is the responsibility of the application to
+// ensure that *timestep* is small enough to guarantee physics stability.
+//
+// Return: This function call NewtonCollisionUpdate at the lower level to get the colliding contacts.
+//
+// See also: NewtonInvalidateCache, NewtonCollisionUpdate
+void NewtonUpdate(const NewtonWorld *const newtonWorld, dFloat timestep) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+
+ // timestep = ClampValue (timestep, MIN_TIMESTEP, MAX_TIMESTEP * 2.0f);
+ timestep = ClampValue(dgFloat32(timestep), dgFloat32(MIN_TIMESTEP),
+ dgFloat32(dgFloat32(1.0f / 60.0f)));
+ dgInt32 count = dgInt32(
+ dgCeil(timestep / (world->g_maxTimeStep + dgFloat32(1.0e-10f))));
+ dgFloat32 time = timestep / count;
+
+ for (dgInt32 i = 0; i < count; i++) {
+#ifdef DG_USED_DEBUG_EXCEPTIONS
+ __try {
+ world->UpdatePhysics(time);
+ } __except (ExecptionHandler(_exception_info())) {
+ _ASSERTE(0);
+ // world->UpdatePhysics (time);
+ }
+#else
+ world->UpdatePhysics(time);
+#endif
+ }
+}
+
+// Name: NewtonCollisionUpdate
+// Update the collision state of all object in eh world.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+//
+// Return: Nothing
+//
+// Remarks: This function will update all of the collision for all body in the physics world.
+// the function is meant for application that are using the engine as collision system only,
+// sample of these are legacy application that use collision but no physics, level editor, plug in for modeling packages
+// and even physics application that some time do not need to execute and dynamics simulation step for what every reason
+//
+// Return: when calling this function the application do not need to call NetwonUpdate
+//
+// See also: NewtonUpdate, NewtonInvalidateCache
+void NewtonCollisionUpdate(const NewtonWorld *const newtonWorld) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+
+#ifdef DG_USED_DEBUG_EXCEPTIONS
+ __try {
+ world->UpdateCollision();
+ } __except (ExecptionHandler(_exception_info())) {
+ world->UpdateCollision();
+ }
+#else
+ world->UpdateCollision();
+#endif
+}
+
+// Name: NewtonSetMinimumFrameRate
+// Set the minimum frame rate at which the simulation can run.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *dFloat* frameRate - minimum frame rate of the simulation in frame per second. This value is clamped between 60fps and 1000fps
+//
+// Return: nothing
+//
+// Remarks: the default minimum frame rate of the simulation is 60 frame per second. When the simulation falls below the specified minimum frame, Newton will
+// perform sub steps in order to meet the desired minimum FPS.
+void NewtonSetMinimumFrameRate(const NewtonWorld *const newtonWorld,
+ dFloat frameRate) {
+ Newton *world;
+
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ _ASSERTE(
+ dgFloat32(1.0f) / dgFloat32(MAX_TIMESTEP) < dgFloat32(1.0f) / dgFloat32(MIN_TIMESTEP));
+ frameRate = ClampValue(frameRate, dgFloat32(1.0f) / dgFloat32(MAX_TIMESTEP),
+ dgFloat32(1.0f) / dgFloat32(MIN_TIMESTEP));
+ world->g_maxTimeStep = dgFloat32(1.0f) / frameRate;
+}
+
+/*
+ // Name: NewtonGetTimeStep
+ // Return the correct time step for this simulation update.
+ //
+ // Parameters:
+ // *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+ //
+ // Remark: This application can used this function to get the current simulation time step.
+ //
+ // Return: correct update timestep.
+ dFloat NewtonGetTimeStep(const NewtonWorld* const newtonWorld)
+ {
+ Newton* world;
+ world = (Newton *)newtonWorld;
+ return world->GetTimeStep();
+ }
+ */
+
+// Name: NewtonDestroyAllBodies
+// Remove all bodies and joints from the newton world.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is a pointer to the Newton world
+//
+// Return: Nothing
+//
+// Remarks: This function will destroy all bodies and all joints in the Newton world, but it will retain group IDs.
+// Use this function for when you want to clear the world but preserve all the group IDs and material pairs.
+//
+// See also: NewtonMaterialDestroyAllGroupID
+void NewtonDestroyAllBodies(const NewtonWorld *const newtonWorld) {
+ dFloat p0[4];
+ dFloat p1[4];
+ Newton *world;
+
+ p0[0] = -100.0f;
+ p0[1] = -100.0f;
+ p0[2] = -100.0f;
+ p1[0] = 100.0f;
+ p1[1] = 100.0f;
+ p1[2] = 100.0f;
+
+ TRACE_FUNTION(__FUNCTION__);
+ NewtonSetWorldSize(newtonWorld, p0, p1);
+
+ world = (Newton *)newtonWorld;
+
+ // world->RagDollList::DestroyAll();
+ world->DestroyAllBodies();
+}
+
+// Name: NewtonSetWorldSize
+// Set the size of the Newton world.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *const dFloat* *minPtr - is the minimum point of the world bounding box
+// *const dFloat* *maxPtr - is the maximum point of the world bounding box
+//
+// Return: Nothing.
+//
+// Remarks: The Newton world must have a finite size. The size of the world is set to a box +- 100 units in all three dimensions
+// at creation time and after a call to the function _NewtonRemoveAllBodies_
+//
+// See also: NewtonSetBodyLeaveWorldEvent
+void NewtonSetWorldSize(const NewtonWorld *const newtonWorld,
+ const dFloat *const minPtr, const dFloat *const maxPtr) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+ dgVector p0(minPtr[0], minPtr[1], minPtr[2], dgFloat32(1.0f));
+ dgVector p1(maxPtr[0], maxPtr[1], maxPtr[2], dgFloat32(1.0f));
+ world->SetWorldSize(p0, p1);
+}
+
+// Name: NewtonSetIslandUpdateEvent
+// Set a function callback to be call on each island update.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *NewtonIslandUpdate* slandUpdate - application defined callback
+//
+// Return: Nothing.
+//
+// Remarks: The application can set a function callback to be called just after the array of all bodies making an island of articulated and colliding bodies are collected for resolution.
+// This function will be called just before the array is accepted for solution and integration.
+// The function callback may return one to validate the array or zero to skip the resolution of this array of bodies on this frame only.
+// This functionality can be used by the application to implement in game physics LOD. For example the application can determine the AABB of the
+// island and check against the view frustum, if the entire island AABB is invisible then the application can suspend simulation even if they are not in equilibrium.
+// another functionality is the implementation of visual debuggers, and also the implementation of auto frozen bodies under arbitrary condition set by the logic of the application.
+//
+// Remarks: The application should not modify the position, velocity, or it create or destroy any body or joint during this function call. Doing so will result in unpredictable malfunctions.
+//
+// See also: NewtonIslandGetBody
+void NewtonSetIslandUpdateEvent(const NewtonWorld *const newtonWorld,
+ NewtonIslandUpdate islandUpdate) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ world->SetIslandUpdateCallback((OnIslandUpdate)islandUpdate);
+}
+
+// Name: NewtonSetCollisionDestructor
+// Set a function callback to be call on each island update.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *NewtonIslandUpdate* slandUpdate - application defined callback
+//
+// Return: Nothing.
+void NewtonSetCollisionDestructor(const NewtonWorld *const newtonWorld,
+ NewtonCollisionDestructor callback) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ world->SetDestroyCollisionCallback((OnDestroyCollision)callback);
+}
+
+// Name: NewtonSetDestroyBodyByExeciveForce
+// Set a function callback to be call when the force applied at a contact point exceed the max force allowed for that convex shape
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *NewtonDestroyBodyByExeciveForce* callback - application defined callback
+//
+// Remarks: Only convex Hull shapes can have max brak force parameter.
+//
+// Return: Nothing.
+void NewtonSetDestroyBodyByExeciveForce(const NewtonWorld *const newtonWorld,
+ NewtonDestroyBodyByExeciveForce callback) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ world->SetBodyDestructionByExeciveForce(
+ (OnBodyDestructionByExeciveForce)callback);
+}
+
+// Name: NewtonSetBodyLeaveWorldEvent
+// Set the event callback function to be called in the event a body is escaping the limits of the world
+// during simulation time.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *NewtonBodyLeaveWorld* callback - is the pointer to the function callback
+//
+// Return: Nothing
+//
+// Remarks: When a body moves outside the bounding box that defines the world space the body is automatically disabled
+// and Newton calls the application defined callback function *NewtonBodyLeaveWorld callback*.
+// The application should decide how to handle the event, because Newton will make the callback once.
+// The only options available to the application are: do nothing or destroy the object.
+//
+// See also: NewtonSetWorldSize, NewtonBodyGetFirstJoint, NewtonBodyGetNextJoint
+void NewtonSetBodyLeaveWorldEvent(const NewtonWorld *const newtonWorld,
+ NewtonBodyLeaveWorld callback) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world->SetLeavingWorldCallback((OnLeavingWorldAction)callback);
+}
+
+// Name: NewtonWorldGetFirstBody
+// get th firt body in the body in the world body list.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+//
+// Return: nothing
+//
+// Remarks: The application can call this function to iterate thought every body in the world.
+//
+// Remarks: The application call this function for debugging purpose
+// See also: NewtonWorldGetNextBody, NewtonBodyForEachPolygonDo, NewtonWorldForEachBodyInAABBDo, NewtonWorldForEachJointDo
+NewtonBody *NewtonWorldGetFirstBody(const NewtonWorld *const newtonWorld) {
+ Newton *world;
+ dgBodyMasterList::dgListNode *node;
+
+ world = (Newton *)newtonWorld;
+ dgBodyMasterList &masterList = *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ _ASSERTE(
+ masterList.GetFirst()->GetInfo().GetBody() == world->GetSentinelBody());
+ node = masterList.GetFirst()->GetNext();
+ // body = node->GetInfo().GetBody();
+ // node = node->GetNext();
+ // callback ((const NewtonBody*) body);
+ // }
+ if (node) {
+ return (NewtonBody *)node->GetInfo().GetBody();
+ } else {
+ return NULL;
+ }
+}
+
+// Name: NewtonWorldGetFirstBody
+// get the fixt body in the general body.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+//
+// Return: nothing
+//
+// Remarks: The application can call this function to iterate thought every body in the world.
+//
+// Remarks: The application call this function for debugging purpose
+// See also: NewtonWorldGetFirstBody, NewtonBodyForEachPolygonDo, NewtonWorldForEachBodyInAABBDo, NewtonWorldForEachJointDo
+NewtonBody *NewtonWorldGetNextBody(const NewtonWorld *const newtonWorld,
+ const NewtonBody *const curBody) {
+ dgBody *const body = (dgBody *)curBody;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ dgBodyMasterList::dgListNode *const node = body->GetMasterList()->GetNext();
+ if (node) {
+ return (NewtonBody *)node->GetInfo().GetBody();
+ } else {
+ return NULL;
+ }
+}
+
+// Name: NewtonWorldForEachJointDo
+// Iterate thought every joint in the world calling the function callback.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *NewtonJointIterator* callback - application define callback
+// *void* callback - application define userdata
+//
+// Return: nothing
+//
+// Remarks: The application can call this function to iterate thought every joint in the world.
+// the application should provide the function *NewtonJointIterator callback* to be called by Newton for every joint in the world
+//
+// Remarks: this function affect severally the performance of Newton. The application should call this function only for debugging
+// or for serialization purposes.
+//
+// See also: NewtonBodyForEachPolygonDo, NewtonWorldForEachBodyInAABBDo, NewtonWorldGetFirstBody
+void NewtonWorldForEachJointDo(const NewtonWorld *const newtonWorld,
+ NewtonJointIterator callback, void *const userData) {
+ Newton *world;
+ dgBodyMasterList::dgListNode *node;
+ dgBodyMasterListRow::dgListNode *jointNode;
+
+ world = (Newton *)newtonWorld;
+ dgBodyMasterList &masterList = *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgTree<dgConstraint *, dgConstraint *> jointMap(world->dgWorld::GetAllocator());
+ for (node = masterList.GetFirst()->GetNext(); node; node = node->GetNext()) {
+ dgBodyMasterListRow &row = node->GetInfo();
+ for (jointNode = row.GetFirst(); jointNode;
+ jointNode = jointNode->GetNext()) {
+ const dgBodyMasterListCell &cell = jointNode->GetInfo();
+ if (cell.m_joint->GetId() != dgContactConstraintId) {
+ if (!jointMap.Find(cell.m_joint)) {
+ jointMap.Insert(cell.m_joint, cell.m_joint);
+ callback((const NewtonJoint *)cell.m_joint, userData);
+ }
+ }
+ }
+ }
+}
+
+// Name: NewtonWorldForEachBodyInAABBDo
+// Iterate thought every body in the world that intersect the AABB calling the function callback.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const dFloat* *p0 - pointer to an array of at least three floats to hold minimum value for the AABB.
+// *const dFloat* *p1 - pointer to an array of at least three floats to hold maximum value for the AABB.
+// *NewtonBodyIterator* callback - application define callback
+// *void* callback - application define userdata
+//
+// Return: nothing
+//
+// Remarks: The application can call this function to iterate thought every body in the world.
+// the application should provide the function *NewtonBodyIterator callback* to be called by Newton for every body in the world
+//
+// Remarks: For relatively small AABB volumes this function is much more inefficients
+// that NewtonWorldGetFirstBody, however in case where the AABB contain must of the objects in the scene,
+// the overhead of scanning the internal Broad face collision plus the AABB test make this function more expensive.
+//
+// See also: NewtonBodyForEachPolygonDo, NewtonWorldGetFirstBody
+void NewtonWorldForEachBodyInAABBDo(const NewtonWorld *const newtonWorld,
+ const dFloat *const p0, const dFloat *const p1, NewtonBodyIterator callback,
+ void *const userData) {
+ Newton *world;
+
+ world = (Newton *)newtonWorld;
+ dgVector q0(p0[0], p0[1], p0[2], dgFloat32(0.0f));
+ dgVector q1(p1[0], p1[1], p1[2], dgFloat32(0.0f));
+
+ TRACE_FUNTION(__FUNCTION__);
+ world->ForEachBodyInAABB(q0, q1, (OnBodiesInAABB)callback, userData);
+}
+
+// Name: NewtonWorldGetVersion
+// Return the current library version number.
+//
+// Parameters:
+//
+// Return: release decimal three digit value x.xx
+// the first digit: is mayor version number (interface changes among other things)
+// the second digit: is mayor patch number (new features, and bug fixes)
+// third digit: is minor bug fixed patch.
+int NewtonWorldGetVersion() {
+ TRACE_FUNTION(__FUNCTION__);
+ return NEWTON_MAJOR_VERSION * 100 + NEWTON_MINOR_VERSION;
+}
+
+// Name: NewtonWorldFloatSize
+// Return the current sizeof of float value in bytes.
+//
+// Parameters:
+//
+// Return: sizeof of float value in bytes
+int NewtonWorldFloatSize() {
+ TRACE_FUNTION(__FUNCTION__);
+ return sizeof(dFloat);
+}
+
+// Name: NewtonWorldSetUserData
+// Store a user defined data value with the world.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the newton world.
+// *void* *userDataPtr - pointer to the user defined user data value.
+//
+// Return: Nothing.
+//
+// Remarks: The application can store a user defined value with the Newton world. The user data is useful for application developing
+// object oriented classes based on the Newton API.
+//
+// See also: NewtonWorldGetUserData
+void NewtonWorldSetUserData(const NewtonWorld *const newtonWorld,
+ void *const userData) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+
+ world->SetUserData(userData);
+}
+
+// Name: NewtonWorldGetUserData
+// Retrieve a user previously stored user define value with the world.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+//
+// Return: user data value.
+//
+// Remarks: The application can store a user defined value with the Newton world. The user data is useful for application developing
+// object oriented classes based on the Newton API.
+//
+// See also: NewtonWorldSetDestructorCallBack, NewtonWorldGetUserData
+void *NewtonWorldGetUserData(const NewtonWorld *const newtonWorld) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return world->GetUserData();
+}
+
+// Name: NewtonWorldSetDestructorCallBack
+// set a function pointer as destructor call back.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *NewtonDestroyWorld* destructor - function poiter callback
+//
+// Remarks: The application can store a user defined destrutor call back function to be called at the time the world is to be destruyed
+//
+// See also: NewtonWorldGetUserData
+void NewtonWorldSetDestructorCallBack(const NewtonWorld *const newtonWorld,
+ NewtonDestroyWorld destructor) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ world->m_destructor = destructor;
+}
+
+// Name: NewtonWorldSetDestructorCallBack
+// Return the function call back Pointer.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+//
+// Remarks: The application can store a user defined destrutor call back function to be called at the time the world is to be destruyed
+//
+// See also: NewtonWorldGetUserData, NewtonWorldSetDestructorCallBack
+NewtonDestroyWorld NewtonWorldGetDestructorCallBack(
+ const NewtonWorld *const newtonWorld) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ return world->m_destructor;
+}
+
+// Name: NewtonWorldGetBodyCount
+// return the total number of rigid bodies in the world.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+//
+// Return: number of rigid bodies in this world.
+//
+int NewtonWorldGetBodyCount(const NewtonWorld *const newtonWorld) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ // dgBodyMasterList &masterList = *world;
+
+ // _ASSERTE (masterList.GetFirst()->GetInfo().GetBody() == world->GetSentinelBody());
+ // return masterList.GetCount() - 1;
+ return world->GetBodiesCount();
+}
+
+// Name: NewtonWorldGetConstraintCount
+// return the total number of contsting in th eworld.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+//
+// remark: this function will retrun the total numbe of joint including conctats
+//
+// Return: number of rigid bodies in this world.
+//
+int NewtonWorldGetConstraintCount(const NewtonWorld *const newtonWorld) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ return world->GetConstraintsCount();
+}
+
+// Name: NewtonWorldRayCast
+// Shoot a ray from p0 to p1 and call the application callback with each ray intersection.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the world.
+// *const dFloat* *p0 - pointer to an array of at least three floats containing the beginning of the ray in global space.
+// *const dFloat* *p1 - pointer to an array of at least three floats containing the end of the ray in global space.
+// *NewtonWorldRayFilterCallback* filter - user define function to be called for each body hit during the ray scan.
+// *void* *userData - user data to be passed to the filter callback.
+// *NewtonWorldRayPrefilterCallback* prefilter - user define function to be called for each body before intersection.
+//
+// Return: nothing
+//
+// Remarks: The ray cast function will call the application with each body intersecting the line segment.
+// By writing the callback filter function in different ways the application can implement different flavors of ray casting.
+// For example an all body ray cast can be easily implemented by having the filter function always returning 1.0, and copying each
+// rigid body into an array of pointers; a closest hit ray cast can be implemented by saving the body with the smaller intersection
+// parameter and returning the parameter t; and a report the first body hit can be implemented by having the filter function returning
+// zero after the first call and saving the pointer to the rigid body.
+//
+// Remarks: The most common use for the ray cast function is the closest body hit, In this case it is important, for performance reasons,
+// that the filter function returns the intersection parameter. If the filter function returns a value of zero the ray cast will terminate
+// immediately.
+//
+// Remarks: if prefilter is not NULL, Newton will call the application right before executing the intersections between the ray and the primitive.
+// if the function returns zero the Newton will not ray cast the primitive. passing a NULL pointer will ray cast the.
+// The application can use this implement faster or smarter filters when implementing complex logic, otherwise for normal all ray cast
+// this parameter could be NULL.
+//
+// Remarks: The ray cast function is provided as an utility function, this means that even thought the function is very high performance
+// by function standards, it can not by batched and therefore it can not be an incremental function. For example the cost of calling 1000
+// ray cast is 1000 times the cost of calling one ray cast. This is much different than the collision system where the cost of calculating
+// collision for 1000 pairs in much, much less that the 1000 times the cost of one pair. Therefore this function must be used with care,
+// as excessive use of it can degrade performance.
+//
+// See also: NewtonWorldConvexCast
+void NewtonWorldRayCast(const NewtonWorld *const newtonWorld,
+ const dFloat *const p0, const dFloat *const p1,
+ NewtonWorldRayFilterCallback filter, void *const userData,
+ NewtonWorldRayPrefilterCallback prefilter) {
+
+ TRACE_FUNTION(__FUNCTION__);
+ if (filter) {
+ dgVector pp0(p0[0], p0[1], p0[2], dgFloat32(0.0f));
+ dgVector pp1(p1[0], p1[1], p1[2], dgFloat32(0.0f));
+ Newton *const world = (Newton *)newtonWorld;
+ world->RayCast(pp0, pp1, (OnRayCastAction)filter,
+ (OnRayPrecastAction)prefilter, userData);
+ }
+}
+
+// Name: NewtonWorldConvexCast
+// cast a simple convex shape along the ray that goes for the matrix position to the destination and get the firsts contacts of collision.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the world.
+// *const dFloat* *matrix - pointer to an array of at least three floats containing the beginning and orienetaion of the shape in global space.
+// *const dFloat* *target - pointer to an array of at least three floats containing the end of the ray in global space.
+// *const NewtonCollision* shape - collision shap[e use to cat the ray.
+// *dFloat* hitParam - pointe to a variable the will contart the time to closet aproah to the collision.
+// *void* *userData - user data to be passed to the prefilter callback.
+// *NewtonWorldRayPrefilterCallback* prefilter - user define function to be called for each body before intersection.
+// *NewtonWorldConvexCastReturnInfo* *info - pointer to an array of contacts at the point of intesections.
+// *int* maxContactsCount - maximun number of contacts to be conclaculated, the variable sould be initialized to the capaciaty of *info*
+// *int* threadIndex - thread index from whe thsi function is called, zero if call form outsize a newton update
+//
+// Return: the number of contact at the intesection point (a value equal o lower than maxContactsCount.
+// variable *hitParam* will be set the uintesation parameter an the momen of impact.
+//
+// Remarks: passing and value of NULL in *info* an dzero in maxContactsCount will turn thos function into a spcial Ray cast
+// where the function will only calculate the *hitParam* at the momenet of contacts. tshi si one of the most effiecnet way to use thsio function.
+//
+// Remarks: these function is similar to *NewtonWorldRayCast* but instead of casting a point it cast a simple convex shape along a ray for maoprix.m_poit
+// to target position. the shape is global orientation and position is set to matrix and then is swept along the segment to target and it will stop at the very first intersession contact.
+//
+// Remarks: for case where the application need to cast solid short to medium rays, it is better to use this function instead of casting and array of parallel rays segments.
+// examples of these are: implementation of ray cast cars with cylindrical tires, foot placement of character controllers, kinematic motion of objects, user controlled continue collision, etc.
+// this function may not be as efficient as sampling ray for long segment, for these cases try using parallel ray cast.
+//
+// Remarks: The most common use for the ray cast function is the closest body hit, In this case it is important, for performance reasons,
+// that the filter function returns the intersection parameter. If the filter function returns a value of zero the ray cast will terminate
+// immediately.
+//
+// Remarks: if prefilter is not NULL, Newton will call the application right before executing the intersections between the ray and the primitive.
+// if the function returns zero the Newton will not ray cast the primitive.
+// The application can use this callback to implement faster or smarter filters when implementing complex logic, otherwise for normal all ray cast
+// this parameter could be NULL.
+//
+// See also: NewtonWorldRayCast
+int NewtonWorldConvexCast(const NewtonWorld *const newtonWorld,
+ const dFloat *const matrix, const dFloat *const target,
+ const NewtonCollision *const shape, dFloat *const hitParam,
+ void *const userData, NewtonWorldRayPrefilterCallback prefilter,
+ NewtonWorldConvexCastReturnInfo *const info, int maxContactsCount,
+ int threadIndex) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector destination(target[0], target[1], target[2], dgFloat32(0.0f));
+ Newton *const world = (Newton *)newtonWorld;
+ return world->ConvexCast((dgCollision *)shape, *((dgMatrix *)matrix),
+ destination, *(dgFloat32 *)hitParam, (OnRayPrecastAction)prefilter,
+ userData, (dgConvexCastReturnInfo *)info, maxContactsCount, threadIndex);
+}
+
+// Name: NewtonIslandGetBody
+// Get the body indexed by bodyIndex form and island.
+//
+// Parameters:
+// *const void* *island - is the pointer to current island
+// *int* bodyIndex - index to the body in current island
+//
+// Return: body at location bodtIndex.
+//
+// Remarks: This function can only be called from an island update callback.
+//
+// Remarks: The application can set a function callback to be called just after the array of all bodies making an island of connected bodies are collected.
+// This function will be called just before the array is accepted for solution and integration.
+// The function callback may return one to validate the array of zero to freeze it.
+// This functionality can be used by the application to implement in game physics LOD. For example the application can determine the AABB of the
+// island and check against the view frustum, if the entire island AABB is invisible then the application can suspend simulation even if they are not in equilibrium.
+// another functionality is the implementation of visual debuggers, and also the implementation of auto frozen bodies under arbitrary condition set by the logic of the application.
+//
+// Remarks: The application should not modify any parameter of the origin body when the callback is called, nor it should create or destroy any body or joint. Do so will result in unpredictable malfunction.
+//
+// See also: NewtonSetIslandUpdateEvent
+NewtonBody *NewtonIslandGetBody(const void *const island, int bodyIndex) {
+ dgWorld *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = *(dgWorld **)island;
+ return (NewtonBody *)world->GetIslandBody(island, bodyIndex);
+}
+
+// Name: NewtonIslandGetBodyAABB
+// Return the AABB of the body on this island
+//
+// Parameters:
+// *const void* *island - is the pointer to current island
+// *int* bodyIndex - index to the body in current island
+//
+// Remarks: This function can only be called from an island update callback.
+//
+// Remarks: The application can set a function callback to be called just after the array of all bodies making an island of connected bodies are collected.
+// This function will be called just before the array is accepted for solution and integration.
+// The function callback may return one to validate the array of zero to freeze it.
+// This functionality can be used by the application to implement in game physics LOD. For example the application can determine the AABB of the
+// island and check against the view frustum, if the entire island AABB is invisible then the application can suspend simulation even if they are not in equilibrium.
+// another functionality is the implementation of visual debuggers, and also the implementation of auto frozen bodies under arbitrary condition set by the logic of the application.
+//
+// Remarks: The application should not modify any parameter of the origin body when the callback is called, nor it should create or destroy any body or joint. Do so will result in unpredictable malfunction.
+//
+// See also: NewtonSetIslandUpdateEvent
+void NewtonIslandGetBodyAABB(const void *const island, int bodyIndex,
+ dFloat *const p0, dFloat *const p1) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgBody *const body = (dgBody *)NewtonIslandGetBody(island, bodyIndex);
+ if (body) {
+ body->GetAABB((dgVector &)*p0, (dgVector &)*p1);
+ }
+}
+
+// ***************************************************************************************************************
+//
+// Name: GroupID interface
+//
+// ***************************************************************************************************************
+
+// Name: NewtonMaterialGetDefaultGroupID
+// Get the value of the default MaterialGroupID.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+//
+// Return: The ID number for the default Group ID.
+//
+// Remarks: Group IDs can be interpreted as the nodes of a dense graph. The edges of the graph are the physics materials.
+// When the Newton world is created, the default Group ID is created by the engine.
+// When bodies are created the application assigns a group ID to the body.
+int NewtonMaterialGetDefaultGroupID(const NewtonWorld *const newtonWorld) {
+ Newton *const world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return int(world->GetDefualtBodyGroupID());
+}
+
+// Name: NewtonMaterialCreateGroupID
+// Create a new MaterialGroupID.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+//
+// Return: The ID of a new GroupID.
+//
+// Remarks: Group IDs can be interpreted as the nodes of a dense graph. The edges of the graph are the physics materials.
+// When the Newton world is created, the default Group ID is created by the engine.
+// When bodies are created the application assigns a group ID to the body.
+//
+// Note: The only way to destroy a Group ID after its creation is by destroying all the bodies and calling the function *NewtonMaterialDestroyAllGroupID*.
+//
+// See also: NewtonMaterialDestroyAllGroupID
+int NewtonMaterialCreateGroupID(const NewtonWorld *const newtonWorld) {
+ Newton *const world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return int(world->CreateBodyGroupID());
+}
+
+// Name: NewtonMaterialDestroyAllGroupID
+// Remove all groups ID from the Newton world.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+//
+// Return: Nothing.
+//
+// Remarks: This function removes all groups ID from the Newton world.
+// This function must be called after there are no more rigid bodies in the word.
+//
+// See also: NewtonDestroyAllBodies
+void NewtonMaterialDestroyAllGroupID(const NewtonWorld *const newtonWorld) {
+ Newton *world;
+
+ // _ASSERTE (0);
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world->RemoveAllGroupID();
+}
+
+// int NewtonGetActiveBodiesCount()
+//{
+// _ASSERTE (0);
+// return 0;
+// }
+
+// int NewtonGetActiveConstraintsCount()
+//{
+// _ASSERTE (0);
+// return 0;
+// }
+
+// ***************************************************************************************************************
+//
+// Name: Material setup interface
+//
+// ***************************************************************************************************************
+
+// Name: NewtonMaterialSetDefaultCollidable
+// Set the material interaction between two physics materials to be collidable or non-collidable by default.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *int* id0 - group id0
+// *int* id1 - group id1
+// *int* state - state for this material: 1 = collidable; 0 = non collidable
+//
+// Return: Nothing.
+void NewtonMaterialSetDefaultCollidable(const NewtonWorld *const newtonWorld,
+ int id0, int id1, int state) {
+ Newton *const world = (Newton *)newtonWorld;
+ dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
+ dgUnsigned32(id1));
+
+ TRACE_FUNTION(__FUNCTION__);
+ // material->m_collisionEnable = state ? true : false;
+ if (state) {
+ material->m_flags |= dgContactMaterial::m_collisionEnable__;
+ } else {
+ material->m_flags &= ~dgContactMaterial::m_collisionEnable__;
+ }
+}
+
+// Name: NewtonMaterialSetContinuousCollisionMode
+// Set the material interaction between two physics materials to enable or disable continue collision.
+// continue collision is on by defaults.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *int* id0 - group id0
+// *int* id1 - group id1
+// *int* state - state for this material: 1 = continue collision on; 0 = continue collision off, default mode is on
+//
+// Return: Nothing.
+//
+// Remarks: continue collision mode enable allow the engine to predict colliding contact on rigid bodies
+// Moving at high speed of subject to strong forces.
+//
+// Remarks: continue collision mode does not prevent rigid bodies from inter penetration instead it prevent bodies from
+// passing trough each others by extrapolating contact points when the bodies normal contact calculation determine the bodies are not colliding.
+//
+// Remarks: for performance reason the bodies angular velocities is only use on the broad face of the collision,
+// but not on the contact calculation.
+//
+// Remarks: continue collision does not perform back tracking to determine time of contact, instead it extrapolate contact by incrementally
+// extruding the collision geometries of the two colliding bodies along the linear velocity of the bodies during the time step,
+// if during the extrusion colliding contact are found, a collision is declared and the normal contact resolution is called.
+//
+// Remarks: for continue collision to be active the continue collision mode must on the material pair of the colliding bodies as well as on at least one of the two colliding bodies.
+//
+// Remarks: Because there is penalty of about 40% to 80% depending of the shape complexity of the collision geometry, this feature is set
+// off by default. It is the job of the application to determine what bodies need this feature on. Good guidelines are: very small objects,
+// and bodies that move a height speed.
+//
+// See also: NewtonBodySetContinuousCollisionMode
+void NewtonMaterialSetContinuousCollisionMode(
+ const NewtonWorld *const newtonWorld, int id0, int id1, int state) {
+ Newton *const world = (Newton *)newtonWorld;
+ dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
+ dgUnsigned32(id1));
+
+ TRACE_FUNTION(__FUNCTION__);
+ // material->m_collisionContinueCollisionEnable = state ? true : false;
+ if (state) {
+ material->m_flags |=
+ dgContactMaterial::m_collisionContinueCollisionEnable__;
+ } else {
+ material->m_flags &=
+ ~dgContactMaterial::m_collisionContinueCollisionEnable__;
+ }
+}
+
+// Name: NewtonMaterialSetSurfaceThickness
+// Set an imaginary thickness between the collision geometry of two colliding bodies who�s physics
+// properties are defined by this material pair
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *int* id0 - group id0
+// *int* id1 - group id1
+// *dFloat* thickness - material thickness a value form 0.0 to 0.125; the default surface value is 0.0
+//
+// Return: Nothing.
+//
+// Remarks: when two bodies collide the engine resolve contact inter penetration by applying a small restoring
+// velocity at each contact point. By default this restoring velocity will stop when the two contacts are
+// at zero inter penetration distance. However by setting a non zero thickness the restoring velocity will
+// continue separating the contacts until the distance between the two point of the collision geometry is equal
+// to the surface thickness.
+//
+// Remark: Surfaces thickness can improve the behaviors of rolling objects on flat surfaces.
+//
+// Remarks: Surface thickness does not alter the performance of contact calculation.
+void NewtonMaterialSetSurfaceThickness(const NewtonWorld *const newtonWorld,
+ int id0, int id1, dFloat thickness) {
+
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+ dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
+ dgUnsigned32(id1));
+
+ material->m_penetrationPadding = GetMin(GetMax(thickness, dgFloat32(0.0)),
+ dgFloat32(DG_MAX_COLLISION_PADDING));
+}
+
+// Name: NewtonMaterialSetDefaultFriction
+// Set the default coefficients of friction for the material interaction between two physics materials .
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *int* id0 - group id0
+// *int* id1 - group id1
+// *dFloat* staticFriction - static friction coefficients
+// *dFloat* kineticFriction - dynamic coefficient of friction
+//
+// Return: Nothing.
+//
+// Remarks: *staticFriction* and *kineticFriction* must be positive values. *kineticFriction* must be lower than *staticFriction*.
+// It is recommended that *staticFriction* and *kineticFriction* be set to a value lower or equal to 1.0, however because some synthetic materials
+// can have higher than one coefficient of friction Newton allows for the coefficient of friction to be as high as 2.0.
+void NewtonMaterialSetDefaultFriction(const NewtonWorld *const newtonWorld,
+ int id0, int id1, dFloat staticFriction, dFloat kineticFriction) {
+ dFloat stat;
+ dFloat kine;
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
+ dgUnsigned32(id1));
+
+ staticFriction = dgAbsf(staticFriction);
+ kineticFriction = dgAbsf(kineticFriction);
+
+ if (material) {
+ if (staticFriction >= dgFloat32(1.e-2f)) {
+ stat = ClampValue(staticFriction, dFloat(0.01f), dFloat(2.0f));
+ kine = ClampValue(kineticFriction, dFloat(0.01f), dFloat(2.0f));
+ stat = GetMax(stat, kine);
+ material->m_staticFriction0 = stat;
+ material->m_staticFriction1 = stat;
+ material->m_dynamicFriction0 = kine;
+ material->m_dynamicFriction1 = kine;
+ } else {
+ // material->m_friction0Enable = false;
+ // material->m_friction1Enable = false;
+ material->m_flags &= ~(dgContactMaterial::m_friction0Enable__ | dgContactMaterial::m_friction1Enable__);
+ }
+ }
+}
+
+// Name: NewtonMaterialSetDefaultElasticity
+// Set the default coefficients of restitution (elasticity) for the material interaction between two physics materials .
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *int* id0 - group id0
+// *int* id1 - group id1
+// *dFloat* elasticCoef - static friction coefficients
+//
+// Return: Nothing.
+//
+// Remarks: *elasticCoef* must be a positive value.
+// It is recommended that *elasticCoef* be set to a value lower or equal to 1.0
+void NewtonMaterialSetDefaultElasticity(const NewtonWorld *const newtonWorld,
+ int id0, int id1, dFloat elasticCoef) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
+ dgUnsigned32(id1));
+
+ material->m_restitution = ClampValue(elasticCoef, dFloat(0.01f),
+ dFloat(2.0f));
+}
+
+// Name: NewtonMaterialSetDefaultSoftness
+// Set the default softness coefficients for the material interaction between two physics materials .
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world
+// *int* id0 - group id0
+// *int* id1 - group id1
+// *dFloat* softnessCoef - softness coefficient
+//
+// Return: Nothing.
+//
+// Remarks: *softnessCoef* must be a positive value.
+// It is recommended that *softnessCoef* be set to value lower or equal to 1.0
+// A low value for *softnessCoef* will make the material soft. A typical value for *softnessCoef* is 0.15
+void NewtonMaterialSetDefaultSoftness(const NewtonWorld *const newtonWorld,
+ int id0, int id1, dFloat softnessCoef) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
+ dgUnsigned32(id1));
+
+ material->m_softness = ClampValue(softnessCoef, dFloat(0.01f),
+ dFloat(dgFloat32(1.0f)));
+}
+
+// Name: NewtonMaterialSetCollisionCallback
+// Set userData and the functions event handlers for the material interaction between two physics materials .
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *int* id0 - group id0.
+// *int* id1 - group id1.
+// *void* *userData - user data value.
+// *NewtonOnAABBOverlap* aabbOverlap - address of the event function called when the AABB of tow bodyes overlap. This parameter can be NULL.
+// *NewtonContactsProcess* processCallback - address of the event function called for every contact resulting from contact calculation. This parameter can be NULL.
+//
+// Return: Nothing.
+//
+// Remarks: When the AABB extend of the collision geometry of two bodies overlap, Newton collision system retrieves the material
+// interaction that defines the behavior between the pair of bodies. The material interaction is collected from a database of materials,
+// indexed by the material gruopID assigned to the bodies. If the material is tagged as non collidable,
+// then no action is taken and the simulation continues.
+// If the material is tagged as collidable, and a *aabbOverlap* was set for this material, then the *aabbOverlap* function is called.
+// If the function *aabbOverlap* returns 0, no further action is taken for this material (this can be use to ignore the interaction under
+// certain conditions). If the function *aabbOverlap* returns 1, Newton proceeds to calculate the array of contacts for the pair of
+// colliding bodies. If the function *processCallback* was set, the application receives a callback for every contact found between the
+// two colliding bodies. Here the application can perform fine grain control over the behavior of the collision system. For example,
+// rejecting the contact, making the contact frictionless, applying special effects to the surface etc.
+// After all contacts are processed and if the function *endCallback* was set, Newton calls *endCallback*.
+// Here the application can collect information gathered during the contact-processing phase and provide some feedback to the player.
+// A typical use for the material callback is to play sound effects. The application passes the address of structure in the *userData* along with
+// three event function callbacks. When the function *aabbOverlap* is called by Newton, the application resets a variable say *maximumImpactSpeed*.
+// Then for every call to the function *processCallback*, the application compares the impact speed for this contact with the value of
+// *maximumImpactSpeed*, if the value is larger, then the application stores the new value along with the position, and any other quantity desired.
+// When the application receives the call to *endCallback* the application plays a 3d sound based in the position and strength of the contact.
+//
+// See also: NewtonMaterialAsThreadSafe
+void NewtonMaterialSetCollisionCallback(const NewtonWorld *const newtonWorld,
+ int id0, int id1, void *userData, NewtonOnAABBOverlap aabbOverlap,
+ NewtonContactsProcess processCallback) {
+ Newton *world;
+
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
+ dgUnsigned32(id1));
+
+ material->SetUserData(userData);
+ material->SetCollisionCallback((OnAABBOverlap)aabbOverlap,
+ (OnContactCallback)processCallback);
+}
+
+// Name: NewtonMaterialSetCollisionCallback
+// Set userData and the functions event handlers for the material interaction between two physics materials .
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *int* id0 - group id0.
+// *int* id1 - group id1.
+// *void* *userData - user data value.
+// *NewtonOnAABBOverlap* aabbOverlap - address of the event function called before contact calculation for collision. This parameter can be NULL.
+// *NewtonContactsProcess* processCallback - address of the event function called for every contact resulting from contact calculation. This parameter can be NULL.
+// *NewtonContactEnd* endCallback - address of the event function called after all contacts are processed. This parameter can be NULL.
+//
+// Return: Nothing.
+//
+// Remarks: When the AABB extend of the collision geometry of two bodies overlap, Newton collision system retrieves the material
+// interaction that defines the behavior between the pair of bodies. The material interaction is collected from a database of materials,
+// indexed by the material gruopID assigned to the bodies. If the material is tagged as non collidable,
+// then no action is taken and the simulation continues.
+// If the material is tagged as collidable, and a *aabbOverlap* was set for this material, then the *aabbOverlap* function is called.
+// If the function *aabbOverlap* returns 0, no further action is taken for this material (this can be use to ignore the interaction under
+// certain conditions). If the function *aabbOverlap* returns 1, Newton proceeds to calculate the array of contacts for the pair of
+// colliding bodies. If the function *processCallback* was set, the application receives a callback for every contact found between the
+// two colliding bodies. Here the application can perform fine grain control over the behavior of the collision system. For example,
+// rejecting the contact, making the contact frictionless, applying special effects to the surface etc.
+// After all contacts are processed and if the function *endCallback* was set, Newton calls *endCallback*.
+// Here the application can collect information gathered during the contact-processing phase and provide some feedback to the player.
+// A typical use for the material callback is to play sound effects. The application passes the address of structure in the *userData* along with
+// three event function callbacks. When the function *aabbOverlap* is called by Newton, the application resets a variable say *maximumImpactSpeed*.
+// Then for every call to the function *processCallback*, the application compares the impact speed for this contact with the value of
+// *maximumImpactSpeed*, if the value is larger, then the application stores the new value along with the position, and any other quantity desired.
+// When the application receives the call to *endCallback* the application plays a 3d sound based in the position and strength of the contact.
+void NewtonMaterialSetCompondCollisionCallback(
+ const NewtonWorld *const newtonWorld, int id0, int id1,
+ NewtonOnAABBOverlap aabbOverlap) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
+ dgUnsigned32(id1));
+
+ material->SetCompoundCollisionCallback((OnAABBOverlap)aabbOverlap);
+}
+
+// Name: NewtonMaterialGetUserData
+// Get userData associated with this material.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *int* id0 - group id0.
+// *int* id1 - group id1.
+//
+// Return: Nothing.
+void *NewtonMaterialGetUserData(const NewtonWorld *const newtonWorld, int id0,
+ int id1) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
+ dgUnsigned32(id1));
+
+ return material->GetUserData();
+}
+
+// Name: NewtonWorldGetFirstMaterial
+// Get the first Material pair from the material array.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+//
+// Return: the first material.
+//
+// See also: NewtonWorldGetNextMaterial
+NewtonMaterial *NewtonWorldGetFirstMaterial(
+ const NewtonWorld *const newtonWorld) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ return (NewtonMaterial *)world->GetFirstMaterial();
+}
+
+// Name: NewtonWorldGetNextMaterial
+// Get the next Material pair from the material array.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const NewtonMaterial* *material - corrent material
+//
+// Return: next material in material array or NULL if material is the last material in the list.
+//
+// See also: NewtonWorldGetFirstMaterial
+NewtonMaterial *NewtonWorldGetNextMaterial(const NewtonWorld *const newtonWorld,
+ const NewtonMaterial *const material) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+
+ return (NewtonMaterial *)world->GetNextMaterial((dgContactMaterial *)material);
+}
+
+// ***************************************************************************************************************
+//
+// Name: Contact behavior control interface
+//
+// ***************************************************************************************************************
+/*
+ // Name: NewtonMaterialDisableContact
+ // Disable processing for the contact.
+ //
+ // Parameters:
+ // *const NewtonMaterial* materialHandle - pointer to a material pair
+ //
+ // Return: Nothing.
+ //
+ // Remarks: This function can only be called from a material callback event handler.
+ //
+ // See also: NewtonMaterialSetCollisionCallback
+ void NewtonMaterialDisableContact(const NewtonMaterial* const materialHandle)
+ {
+ material = (dgContactMaterial*) materialHandle;
+ dgContactMaterial* const material->m_collisionEnable = false;
+ }
+ */
+
+// Name: NewtonMaterialGetMaterialPairUserData
+// Get the userData set by the application when it created this material pair.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair
+//
+// Return: Application user data.
+//
+// Remarks: This function can only be called from a material callback event handler.
+//
+// See also: NewtonMaterialSetCollisionCallback
+void *NewtonMaterialGetMaterialPairUserData(
+ const NewtonMaterial *const materialHandle) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ return material->GetUserData();
+}
+
+// Name: NewtonMaterialGetContactFaceAttribute
+// Return the face attribute assigned to this face when for a user defined collision or a Newton collision tree.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair
+//
+// Return: face attribute for collision trees. Zero if the contact was generated by two convex collisions.
+//
+// Remarks: This function can only be called from a material callback event handler.
+//
+// Remarks: this function can be used by the application to retrieve the face id of a polygon for a collision tree.
+//
+// See also: NewtonMaterialSetCollisionCallback
+unsigned NewtonMaterialGetContactFaceAttribute(
+ const NewtonMaterial *const materialHandle) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ return (unsigned)material->m_userId;
+}
+
+/*
+ // Name: NewtonMaterialGetCurrentTimestep
+ // Get the current time step.
+ //
+ // Parameters:
+ // *const NewtonMaterial* materialHandle - pointer to a material pair
+ //
+ // Return: the current time step.
+ //
+ // Remarks: This function can only be called from a material callback event handler. The function can be useful for the implementation of powered contacts.
+ //
+ // See also: NewtonMaterialSetCollisionCallback
+ dFloat NewtonMaterialGetCurrentTimestep(const NewtonMaterial* const materialHandle)
+ {
+ dgContactMaterial* const material = (dgContactMaterial*) materialHandle;
+ // return material->m_currTimestep;
+
+ _ASSERTE (material->m_body0);
+ return material->m_body0->GetWorld()->GetTimeStep();
+ }
+ */
+
+// Name: NewtonMaterialGetContactNormalSpeed
+// Calculate the speed of this contact along the normal vector of the contact.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair
+//
+// Return: Contact speed. A positive value means the contact is repulsive.
+//
+// Remarks: This function can only be called from a material callback event handler.
+//
+// See also: NewtonMaterialSetCollisionCallback
+dFloat NewtonMaterialGetContactNormalSpeed(
+ const NewtonMaterial *const materialHandle) {
+ // _ASSERTE (0);
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ // contact = (dgContact*) contactlHandle;
+
+ dgBody *const body0 = material->m_body0;
+ dgBody *const body1 = material->m_body1;
+
+ dgVector p0(material->m_point - body0->GetPosition());
+ dgVector p1(material->m_point - body1->GetPosition());
+
+ dgVector v0(body0->GetVelocity() + body0->GetOmega() * p0);
+ dgVector v1(body1->GetVelocity() + body1->GetOmega() * p1);
+
+ dgVector dv(v1 - v0);
+
+ dFloat speed = dv % material->m_normal;
+ return speed;
+}
+
+// Name: NewtonMaterialGetContactTangentSpeed
+// Calculate the speed of this contact along the tangent vector of the contact.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *int* index - index to the tangent vector. This value can be 0 for primary tangent direction or 1 for the secondary tangent direction.
+//
+// Return: Contact tangent speed.
+//
+// Remarks: This function can only be called from a material callback event handler.
+//
+// See also: NewtonMaterialSetCollisionCallback
+dFloat NewtonMaterialGetContactTangentSpeed(
+ const NewtonMaterial *const materialHandle, int index) {
+ // _ASSERTE (0);
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ // contact = (dgContact*) contactlHandle;
+
+ dgBody *const body0 = material->m_body0;
+ dgBody *const body1 = material->m_body1;
+
+ dgVector p0(material->m_point - body0->GetPosition());
+ dgVector p1(material->m_point - body1->GetPosition());
+
+ dgVector v0(body0->GetVelocity() + body0->GetOmega() * p0);
+ dgVector v1(body1->GetVelocity() + body1->GetOmega() * p1);
+
+ dgVector dv(v1 - v0);
+
+ dgVector dir;
+ if (index) {
+ dir = material->m_dir1;
+ } else {
+ dir = material->m_dir0;
+ }
+ dFloat speed = dv % dir;
+ return -speed;
+}
+
+// Name: NewtonMaterialGetContactPositionAndNormal
+// Get the contact position and normal in global space.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *dFloat* *positPtr - pointer to an array of at least three floats to hold the contact position.
+// *dFloat* *normalPtr - pointer to an array of at least three floats to hold the contact normal.
+//
+// Return: Nothing.
+//
+// Remarks: This function can only be called from a material callback event handle.
+//
+// See also: NewtonMaterialSetCollisionCallback
+void NewtonMaterialGetContactPositionAndNormal(
+ const NewtonMaterial *const materialHandle, NewtonBody *const body,
+ dFloat *const positPtr, dFloat *const normalPtr) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+
+ positPtr[0] = material->m_point.m_x;
+ positPtr[1] = material->m_point.m_y;
+ positPtr[2] = material->m_point.m_z;
+
+ normalPtr[0] = material->m_normal.m_x;
+ normalPtr[1] = material->m_normal.m_y;
+ normalPtr[2] = material->m_normal.m_z;
+
+ if ((dgBody *)body != material->m_body0) {
+ normalPtr[0] *= dgFloat32(-1.0f);
+ normalPtr[1] *= dgFloat32(-1.0f);
+ normalPtr[2] *= dgFloat32(-1.0f);
+ }
+}
+
+// Name: NewtonMaterialGetContactForce
+// Get the contact force vector in global space.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *dFloat* *forcePtr - pointer to an array of at least three floats to hold the force vector in global space.
+//
+// Return: Nothing.
+//
+// Remarks: The contact force value is only valid when calculating resting contacts. This means if two bodies collide with
+// non zero relative velocity, the reaction force will be an impulse, which is not a reaction force, this will return zero vector.
+// this function will only return meaningful values when the colliding bodies are at rest.
+//
+// Remarks: This function can only be called from a material callback event handler.
+//
+// See also: NewtonMaterialSetCollisionCallback
+void NewtonMaterialGetContactForce(const NewtonMaterial *const materialHandle,
+ NewtonBody *const body, dFloat *const forcePtr) {
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+
+ dgVector force(
+ material->m_normal.Scale(material->m_normal_Force) + material->m_dir0.Scale(material->m_dir0_Force) + material->m_dir1.Scale(material->m_dir1_Force));
+
+ forcePtr[0] = force.m_x;
+ forcePtr[1] = force.m_y;
+ forcePtr[2] = force.m_z;
+
+ if ((dgBody *)body != material->m_body0) {
+ forcePtr[0] *= dgFloat32(-1.0f);
+ forcePtr[1] *= dgFloat32(-1.0f);
+ forcePtr[2] *= dgFloat32(-1.0f);
+ }
+}
+
+// Name: NewtonMaterialGetContactTangentDirections
+// Get the contact tangent vector to the contact point.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *dFloat* *dir0 - pointer to an array of at least three floats to hold the contact primary tangent vector.
+// *dFloat* *dir1 - pointer to an array of at least three floats to hold the contact secondary tangent vector.
+//
+// Return: Nothing.
+//
+// Remarks: This function can only be called from a material callback event handler.
+//
+// See also: NewtonMaterialSetCollisionCallback
+void NewtonMaterialGetContactTangentDirections(
+ const NewtonMaterial *const materialHandle, NewtonBody *const body,
+ dFloat *const dir0, dFloat *const dir1) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+
+ dir0[0] = material->m_dir0.m_x;
+ dir0[1] = material->m_dir0.m_y;
+ dir0[2] = material->m_dir0.m_z;
+
+ dir1[0] = material->m_dir1.m_x;
+ dir1[1] = material->m_dir1.m_y;
+ dir1[2] = material->m_dir1.m_z;
+
+ if ((dgBody *)body != material->m_body0) {
+ dir0[0] *= dgFloat32(-1.0f);
+ dir0[1] *= dgFloat32(-1.0f);
+ dir0[2] *= dgFloat32(-1.0f);
+
+ dir1[0] *= dgFloat32(-1.0f);
+ dir1[1] *= dgFloat32(-1.0f);
+ dir1[2] *= dgFloat32(-1.0f);
+ }
+}
+
+// Name: NewtonMaterialGetBodyCollisionID
+// Retrieve a user defined value stored with a convex collision primitive.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+//
+// Return: a user defined value. Zero if not id was stored with the collision primitive.
+//
+// Remarks: the application can store an id with any collision primitive. This id can be used to identify what type of collision primitive generated a contact.
+// This function can only be called from a contact callback,
+//
+// Remarks: this function can only be called from a contact process callback. If called from contact callback begin this function will crash the application.
+//
+// See also: NewtonCollisionSetUserID, NewtonCreateBox, NewtonCreateSphere
+/*
+unsigned NewtonMaterialGetBodyCollisionID(const NewtonMaterial* const material, const NewtonBody* const body)
+{
+ TRACE_FUNTION(__FUNCTION__);
+ dgBody* const bodyPtr = (dgBody*) body;
+ dgContactMaterial* const materialPtr = (dgContactMaterial*) material;
+
+ dgCollision* collision = materialPtr->m_collision0;
+ if (bodyPtr == materialPtr->m_body1) {
+ collision = materialPtr->m_collision1;
+ }
+
+ return collision->SetUserDataID();
+}
+*/
+
+NewtonCollision *NewtonMaterialGetBodyCollidingShape(const NewtonMaterial *const material, const NewtonBody *const body) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgBody *const bodyPtr = (dgBody *)body;
+ dgContactMaterial *const materialPtr = (dgContactMaterial *)material;
+
+ dgCollision *collision = materialPtr->m_collision0;
+ if (bodyPtr == materialPtr->m_body1) {
+ collision = materialPtr->m_collision1;
+ }
+ return (NewtonCollision *)collision;
+}
+
+// Name: NewtonMaterialSetContactSoftness
+// Override the default softness value for the contact.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *dFloat* softness - softness value, must be positive.
+//
+// Return: Nothing.
+//
+// Remarks: This function can only be called from a material callback event handler.
+//
+// See also: NewtonMaterialSetCollisionCallback, NewtonMaterialSetDefaultSoftness
+void NewtonMaterialSetContactSoftness(
+ const NewtonMaterial *const materialHandle, dFloat softness) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ material->m_softness = ClampValue(softness, dFloat(0.01f), dFloat(0.7f));
+}
+
+// Name: NewtonMaterialSetContactElasticity
+// Override the default elasticity (coefficient of restitution) value for the contact.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *dFloat* restitution - elasticity value, must be positive.
+//
+// Return: Nothing.
+//
+// Remarks: This function can only be called from a material callback event handler.
+//
+// See also: NewtonMaterialSetCollisionCallback, NewtonMaterialSetDefaultElasticity
+void NewtonMaterialSetContactElasticity(
+ const NewtonMaterial *const materialHandle, dFloat restitution) {
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+
+ material->m_restitution = ClampValue(restitution, dFloat(0.01f),
+ dFloat(2.0f));
+}
+
+// Name: NewtonMaterialSetContactFrictionState
+// Enable or disable friction calculation for this contact.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *int* state* - new state. 0 makes the contact frictionless along the index tangent vector.
+// *int* index - index to the tangent vector. 0 for primary tangent vector or 1 for the secondary tangent vector.
+//
+// Return: Nothing.
+//
+// Remarks: This function can only be called from a material callback event handler.
+//
+// See also: NewtonMaterialSetCollisionCallback
+void NewtonMaterialSetContactFrictionState(
+ const NewtonMaterial *const materialHandle, int state, int index) {
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+
+ if (index) {
+ // material->m_friction1Enable = state ? true : false;
+ if (state) {
+ material->m_flags |= dgContactMaterial::m_friction1Enable__;
+ } else {
+ material->m_flags &= ~dgContactMaterial::m_friction1Enable__;
+ }
+ } else {
+ // material->m_friction0Enable = state ? true : false;
+ if (state) {
+ material->m_flags |= dgContactMaterial::m_friction0Enable__;
+ } else {
+ material->m_flags &= ~dgContactMaterial::m_friction0Enable__;
+ }
+ }
+}
+
+// Name: NewtonMaterialSetContactFrictionCoef
+// Override the default value of the kinetic and static coefficient of friction for this contact.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *dFloat* staticFrictionCoef - static friction coefficient. Must be positive.
+// *dFloat* kineticFrictionCoef - static friction coefficient. Must be positive.
+// *int* index - index to the tangent vector. 0 for primary tangent vector or 1 for the secondary tangent vector.
+//
+// Return: Nothing.
+//
+// Remarks: This function can only be called from a material callback event handler.
+//
+// Remarks: It is recommended that *coef* be set to a value lower or equal to 1.0, however because some synthetic materials
+// can have hight than one coefficient of friction Newton allows for the coefficient of friction to be as high as 2.0.
+//
+// Remarks: the value *staticFrictionCoef* and *kineticFrictionCoef* will be clamped between 0.01f and 2.0.
+// If the application wants to set a kinetic friction higher than the current static friction it must increase the static friction first.
+//
+// See also: NewtonMaterialSetCollisionCallback, NewtonMaterialSetDefaultFriction, NewtonMaterialSetContactStaticFrictionCoef
+void NewtonMaterialSetContactFrictionCoef(
+ const NewtonMaterial *const materialHandle, dFloat staticFrictionCoef,
+ dFloat kineticFrictionCoef, int index) {
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+
+ if (staticFrictionCoef < kineticFrictionCoef) {
+ staticFrictionCoef = kineticFrictionCoef;
+ }
+
+ if (index) {
+ material->m_staticFriction1 = ClampValue(staticFrictionCoef, dFloat(0.01f),
+ dFloat(2.0f));
+ material->m_dynamicFriction1 = ClampValue(kineticFrictionCoef,
+ dFloat(0.01f), dFloat(2.0f));
+ } else {
+ material->m_staticFriction0 = ClampValue(staticFrictionCoef, dFloat(0.01f),
+ dFloat(2.0f));
+ material->m_dynamicFriction0 = ClampValue(kineticFrictionCoef,
+ dFloat(0.01f), dFloat(2.0f));
+ }
+}
+
+// Name: NewtonMaterialSetContactNormalAcceleration
+// Force the contact point to have a non-zero acceleration aligned this the contact normal.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *dFloat* accel - desired contact acceleration, Must be a positive value
+//
+// Return: Nothing.
+//
+// Remarks: This function can only be called from a material callback event handler.
+//
+// Remarks: This function can be used for spacial effects like implementing jump, of explosive contact in a call back.
+//
+// See also: NewtonMaterialSetCollisionCallback
+void NewtonMaterialSetContactNormalAcceleration(
+ const NewtonMaterial *const materialHandle, dFloat accel) {
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+
+ // if (accel > dFloat (0.0f)) {
+ material->m_normal_Force = accel;
+ // material->m_overrideNormalAccel = true;
+ material->m_flags |= dgContactMaterial::m_overrideNormalAccel__;
+ // }
+}
+
+// Name: NewtonMaterialSetContactTangentAcceleration
+// Force the contact point to have a non-zero acceleration along the surface plane.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *dFloat* accel - desired contact acceleration.
+// *int* index - index to the tangent vector. 0 for primary tangent vector or 1 for the secondary tangent vector.
+//
+// Return: Nothing.
+//
+// Remarks: This function can only be called from a material callback event handler.
+//
+// See also: NewtonMaterialSetCollisionCallback, NewtonMaterialContactRotateTangentDirections
+void NewtonMaterialSetContactTangentAcceleration(
+ const NewtonMaterial *const materialHandle, dFloat accel, int index) {
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ if (index) {
+ material->m_dir1_Force = accel;
+ // material->m_override1Accel = true;
+ material->m_flags |= dgContactMaterial::m_override1Accel__;
+ } else {
+ material->m_dir0_Force = accel;
+ // material->m_override0Accel = true;
+ material->m_flags |= dgContactMaterial::m_override0Accel__;
+ }
+}
+
+// Name: NewtonMaterialSetContactNormalDirection
+// Set the new direction of the for this contact point.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *const dFloat* *direction - pointer to an array of at least three floats holding the direction vector.
+//
+// Return: Nothing.
+//
+// Remarks: This function can only be called from a material callback event handler.
+// This function changes the basis of the contact point to one where the contact normal is aligned to the new direction vector
+// and the tangent direction are recalculated to be perpendicular to the new contact normal.
+//
+// Remarks: In 99.9% of the cases the collision system can calculates a very good contact normal.
+// however this algorithm that calculate the contact normal use as criteria the normal direction
+// that will resolve the inter penetration with the least amount on motion.
+// There are situations however when this solution is not the best. Take for example a rolling
+// ball over a tessellated floor, when the ball is over a flat polygon, the contact normal is always
+// perpendicular to the floor and pass by the origin of the sphere, however when the sphere is going
+// across two adjacent polygons, the contact normal is now perpendicular to the polygons edge and this does
+// not guarantee they it will pass bay the origin of the sphere, but we know that the best normal is always
+// the one passing by the origin of the sphere.
+//
+// See also: NewtonMaterialSetCollisionCallback, NewtonMaterialContactRotateTangentDirections
+void NewtonMaterialSetContactNormalDirection(
+ const NewtonMaterial *const materialHandle, const dFloat *const direction) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ dgVector normal(direction[0], direction[1], direction[2], dgFloat32(0.0f));
+
+ _ASSERTE(
+ (dgAbsf(normal % material->m_normal) - dgFloat32(1.0f)) < dgFloat32(0.01f));
+ if ((normal % material->m_normal) < dgFloat32(0.0f)) {
+ normal = normal.Scale(-dgFloat32(1.0f));
+ }
+ material->m_normal = normal;
+
+ dgMatrix matrix(normal);
+ material->m_dir1 = matrix.m_up;
+ material->m_dir0 = matrix.m_right;
+ // NewtonMaterialContactRotateTangentDirections(materialHandle, &material->m_dir0[0]);
+}
+
+// Name: NewtonMaterialContactRotateTangentDirections
+// Rotate the tangent direction of the contacts until the primary direction is aligned with the alignVector.
+//
+// Parameters:
+// *const NewtonMaterial* materialHandle - pointer to a material pair.
+// *const dFloat* *alignVector - pointer to an array of at least three floats holding the aligning vector.
+//
+// Return: Nothing.
+//
+// Remarks: This function can only be called from a material callback event handler.
+// This function rotates the tangent vectors of the contact point until the primary tangent vector and the align vector
+// are perpendicular (ex. when the dot product between the primary tangent vector and the alignVector is 1.0). This
+// function can be used in conjunction with NewtonMaterialSetContactTangentAcceleration in order to
+// create special effects. For example, conveyor belts, cheap low LOD vehicles, slippery surfaces, etc.
+//
+// See also: NewtonMaterialSetCollisionCallback, NewtonMaterialSetContactNormalDirection
+void NewtonMaterialContactRotateTangentDirections(
+ const NewtonMaterial *const materialHandle, const dFloat *const alignVector) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+
+ const dgVector dir0(alignVector[0], alignVector[1], alignVector[2],
+ dgFloat32(0.0f));
+
+ dgVector dir1 = material->m_normal * dir0;
+ dFloat mag2 = dir1 % dir1;
+ if (mag2 > 1.0e-6f) {
+ material->m_dir1 = dir1.Scale(dgRsqrt(mag2));
+ material->m_dir0 = material->m_dir1 * material->m_normal;
+ }
+}
+
+// **********************************************************************************************
+//
+// Name: Convex collision primitives interface
+//
+// **********************************************************************************************
+
+// Name: NewtonCreateNull
+// Create a transparent collision primitive.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+//
+// Return: Pointer to the collision object.
+//
+// Remarks: Some times the application needs to create helper rigid bodies that will never collide with other bodies,
+// for example the neck of a rag doll, or an internal part of an articulated structure. This can be done by using the material system
+// but it too much work and it will increase unnecessarily the material count, and therefore the project complexity. The Null collision
+// is a collision object that satisfy all this conditions without having to change the engine philosophy.
+//
+// Remarks: Collision primitives are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the objects.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+// Collision primitives can be reused with more than one body. This will reduce the amount of memory used by the engine, as well
+// as speed up some calculations.
+//
+// See also: NewtonReleaseCollision
+NewtonCollision *NewtonCreateNull(const NewtonWorld *const newtonWorld) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ return (NewtonCollision *)world->CreateNull();
+}
+
+// Name: NewtonCreateBox
+// Create a box primitive for collision.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *dFloat* dx - box side one x dimension.
+// *dFloat* dy - box side one y dimension.
+// *dFloat* dz - box side one z dimension.
+// *const dFloat* *offsetMatrix - pointer to an array of 16 floats containing the offset matrix of the box relative to the body. If this parameter is NULL, then the primitive is centered at the origin of the body.
+//
+// Return: Pointer to the box
+//
+// Remarks: Collision primitives are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+// Collision primitives can be reused with more than one body. This will reduce the amount of memory used be the engine, as well
+// as speed up some calculations.
+//
+// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
+NewtonCollision *NewtonCreateBox(const NewtonWorld *const newtonWorld,
+ dFloat dx, dFloat dy, dFloat dz, int shapeID,
+ const dFloat *const offsetMatrix) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ dgMatrix matrix(dgGetIdentityMatrix());
+ if (offsetMatrix) {
+ matrix = *((dgMatrix *)offsetMatrix);
+ }
+ return (NewtonCollision *)world->CreateBox(dx, dy, dz, shapeID, matrix);
+}
+
+// Name: NewtonCreateSphere
+// Create a generalized ellipsoid primitive..
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *dFloat* radiusX - sphere radius along x axis.
+// *dFloat* radiusY - sphere radius along x axis.
+// *dFloat* radiusZ - sphere radius along x axis.
+// *const dFloat* *offsetMatrix - pointer to an array of 16 floats containing the offset matrix of the sphere relative to the body. If this parameter is NULL then the sphere is centered at the origin of the body.
+//
+// Return: Pointer to the generalized sphere.
+//
+// Remarks: Sphere collision are generalized ellipsoids, the application can create many different kind of objects by just playing with dimensions of the radius.
+// for example to make a sphere set all tree radius to the same value, to make a ellipse of revolution just set two of the tree radius to the same value.
+//
+// Remarks: General ellipsoids are very good hull geometries to represent the outer shell of avatars in a game.
+//
+// Remarks: Collision primitives are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+// Collision primitives can be reused with more than one body. This will reduce the amount of memory used be the engine, as well
+// as speed up some calculations.
+//
+// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
+NewtonCollision *NewtonCreateSphere(const NewtonWorld *const newtonWorld,
+ dFloat radiusX, dFloat radiusY, dFloat radiusZ, int shapeID,
+ const dFloat *const offsetMatrix) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ dgMatrix matrix(dgGetIdentityMatrix());
+ if (offsetMatrix) {
+ matrix = *((dgMatrix *)offsetMatrix);
+ }
+
+ radiusX = dgAbsf(radiusX);
+ radiusY = dgAbsf(radiusY);
+ radiusZ = dgAbsf(radiusZ);
+
+ if ((dgAbsf(radiusX - radiusY) < 1.0e-5f) && (dgAbsf(radiusX - radiusZ) < 1.0e-5f)) {
+ return (NewtonCollision *)world->CreateSphere(radiusX, shapeID, matrix);
+ }
+
+ return (NewtonCollision *)world->CreateEllipse(radiusX, radiusY, radiusZ,
+ shapeID, matrix);
+}
+
+// Name: NewtonCreateCone
+// Create a cone primitive for collision.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *dFloat* radius - cone radius at the base.
+// *dFloat* height - cone height along the x local axis from base to tip.
+// *const dFloat* *offsetMatrix - pointer to an array of 16 floats containing the offset matrix of the box relative to the body. If this parameter is NULL, then the primitive is centered at the origin of the body.
+//
+// Return: Pointer to the box
+//
+// Remarks: Collision primitives are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+// Collision primitives can be reused with more than one body. This will reduce the amount of memory used be the engine, as well
+// as speed up some calculations.
+//
+// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
+NewtonCollision *NewtonCreateCone(const NewtonWorld *const newtonWorld,
+ dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ dgMatrix matrix(dgGetIdentityMatrix());
+ if (offsetMatrix) {
+ matrix = *((dgMatrix *)offsetMatrix);
+ }
+ return (NewtonCollision *)world->CreateCone(radius, height, shapeID, matrix);
+}
+
+// Name: NewtonCreateCapsule
+// Create a capsule primitive for collision.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *dFloat* radius - capsule radius at the base.
+// *dFloat* height - capsule height along the x local axis from tip to tip.
+// *const dFloat* *offsetMatrix - pointer to an array of 16 floats containing the offset matrix of the box relative to the body. If this parameter is NULL, then the primitive is centered at the origin of the body.
+//
+// Return: Pointer to the box
+//
+// Remark: the capsule height must equal of larger than the sum of the cap radius. If this is not the case the height will be clamped the 2 * radius.
+//
+// Remarks: Collision primitives are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+// Collision primitives can be reused with more than one body. This will reduce the amount of memory used be the engine, as well
+// as speed up some calculations.
+//
+// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
+NewtonCollision *NewtonCreateCapsule(const NewtonWorld *const newtonWorld,
+ dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ dgMatrix matrix(dgGetIdentityMatrix());
+ if (offsetMatrix) {
+ matrix = *((dgMatrix *)offsetMatrix);
+ }
+ return (NewtonCollision *)world->CreateCapsule(radius, height, shapeID,
+ matrix);
+}
+
+// Name: NewtonCreateCylinder
+// Create a cylinder primitive for collision.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *dFloat* radius - cylinder radius at the base.
+// *dFloat* height - cylinder height along the x local axis.
+// *const dFloat* *offsetMatrix - pointer to an array of 16 floats containing the offset matrix of the box relative to the body. If this parameter is NULL, then the primitive is centered at the origin of the body.
+//
+// Return: Pointer to the box
+//
+// Remarks: Collision primitives are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+// Collision primitives can be reused with more than one body. This will reduce the amount of memory used be the engine, as well
+// as speed up some calculations.
+//
+// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
+NewtonCollision *NewtonCreateCylinder(const NewtonWorld *const newtonWorld,
+ dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ dgMatrix matrix(dgGetIdentityMatrix());
+ if (offsetMatrix) {
+ matrix = *((dgMatrix *)offsetMatrix);
+ }
+ return (NewtonCollision *)world->CreateCylinder(radius, height, shapeID,
+ matrix);
+}
+
+NewtonCollision *NewtonCreateChamferCylinder(
+ const NewtonWorld *const newtonWorld, dFloat radius, dFloat height,
+ const dFloat *const offsetMatrix);
+
+// Name: NewtonCreateChamferCylinder
+// Create a ChamferCylinder primitive for collision.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *dFloat* radius - ChamferCylinder radius at the base.
+// *dFloat* height - ChamferCylinder height along the x local axis.
+// *const dFloat* *offsetMatrix - pointer to an array of 16 floats containing the offset matrix of the box relative to the body. If this parameter is NULL, then the primitive is centered at the origin of the body.
+//
+// Return: Pointer to the box
+//
+// Remarks: Collision primitives are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+// Collision primitives can be reused with more than one body. This will reduce the amount of memory used be the engine, as well
+// as speed up some calculations.
+//
+// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
+NewtonCollision *NewtonCreateChamferCylinder(
+ const NewtonWorld *const newtonWorld, dFloat radius, dFloat height,
+ int shapeID, const dFloat *const offsetMatrix) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ dgMatrix matrix(dgGetIdentityMatrix());
+ if (offsetMatrix) {
+ matrix = *((dgMatrix *)offsetMatrix);
+ }
+ return (NewtonCollision *)world->CreateChamferCylinder(radius, height,
+ shapeID, matrix);
+}
+
+// Name: NewtonCreateConvexHull
+// Create a ConvexHull primitive from collision from a cloud of points.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *int* count - number of consecutive point to follow must be at least 4.
+// *const dFloat* *vertexCloud - pointer to and array of point.
+// *int* strideInBytes - vertex size in bytes, must be at least 12.
+// *dFloat* tolerance - tolerance value for the hull generation.
+// *const dFloat* *offsetMatrix - pointer to an array of 16 floats containing the offset matrix of the box relative to the body. If this parameter is NULL, then the primitive is centered at the origin of the body.
+//
+// Return: Pointer to the collision mesh, NULL if the function fail to generate convex shape
+//
+// Remarks: Convex hulls are the solution to collision primitive that can not be easily represented by an implicit solid.
+// The implicit solid primitives (spheres, cubes, cylinders, capsules, cones, etc.), have constant time complexity for contact calculation
+// and are also extremely efficient on memory usage, therefore the application get perfect smooth behavior.
+// However for cases where the shape is too difficult or a polygonal representation is desired, convex hulls come closest to the to the model shape.
+// For example it is a mistake to model a 10000 point sphere as a convex hull when the perfect sphere is available, but it is better to represent a
+// pyramid by a convex hull than with a sphere or a box.
+//
+// Remarks: There is not upper limit as to how many vertex the application can pass to make a hull shape,
+// however for performance and memory usage concern it is the application responsibility to keep the max vertex at the possible minimum.
+// The minimum number of vertex should be equal or larger than 4 and it is the application responsibility that the points are part of a solid geometry.
+// Unpredictable results will occur if all points happen to be collinear or coplanar.
+//
+// remark: The performance of collision with convex hull proxies is sensitive to the vertex count of the hull. Since a the convex hull
+// of a visual geometry is already an approximation of the mesh, for visual purpose there is not significant difference between the
+// appeal of a exact hull and one close to the exact hull but with but with a smaller vertex count.
+// It just happens that sometime complex meshes lead to generation of convex hulls with lots of small detail that play not
+// roll of the quality of the simulation but that have a significant impact on the performance because of a large vertex count.
+// For this reason the application have the option to set a *tolerance* parameter.
+// *tolerance* is use to post process the final geometry in the following faction, a point on the surface of the hull can
+// be remove if the distance of all of the surrounding vertex immediately adjacent to the average plane equation formed the
+// faces adjacent to that point, is smaller than the tolerance. A value of zero in *tolerance* will generate an exact hull and a value langer that zero
+// will generate a loosely fitting hull and it willbe faster to generate.
+//
+// Remarks: Collision primitives are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+// Collision primitives can be reused with more than one body. This will reduce the amount of memory used be the engine, as well
+// as speed up some calculations.
+//
+// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
+NewtonCollision *NewtonCreateConvexHull(const NewtonWorld *const newtonWorld,
+ int count, const dFloat *const vertexCloud, int strideInBytes,
+ dgFloat32 tolerance, int shapeID, const dFloat *const offsetMatrix) {
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ dgMatrix matrix(dgGetIdentityMatrix());
+ if (offsetMatrix) {
+ matrix = *((dgMatrix *)offsetMatrix);
+ }
+ tolerance = ClampValue(tolerance, dgFloat32(0.0f), dgFloat32(0.125f));
+ return (NewtonCollision *)world->CreateConvexHull(count, vertexCloud,
+ strideInBytes, tolerance, shapeID, matrix);
+}
+
+// Name: NewtonCreateConvexHullFromMesh
+// Create a ConvexHull primitive from a special effect mesh.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const NewtonMesh* *mesh - special effect mesh
+// *dFloat* tolerance - tolerance value for the hull generation.
+//
+// Return: Pointer to the collision mesh, NULL if the function fail to generate convex shape
+//
+// Remark: Because the in general this function is used for runtime special effect like debris and or solid particles
+// it is recommended that the source mesh complexity is kept small.
+//
+// See also: NewtonCreateConvexHull, NewtonMeshCreate
+NewtonCollision *NewtonCreateConvexHullFromMesh(
+ const NewtonWorld *const newtonWorld, const NewtonMesh *const mesh,
+ dFloat tolerance, int shapeID) {
+ TRACE_FUNTION(__FUNCTION__);
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *const)mesh;
+ return (NewtonCollision *)meshEffect->CreateConvexCollision(tolerance,
+ shapeID);
+}
+
+// Name: NewtonCreateConvexHullModifier
+// Create a collision modifier for any convex collision part.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *NewtonCollision* convexHullCollision.
+//
+// Return: Pointer to the collision modifier
+//
+// Remarks: The matrix should be arranged in row-major order.
+// a collision modifier can take any type of transformation matrix, as long as the matrix can be invertible by straight
+// Gaussian elimination process. Typical uses are non-uniform scaling, translation and skewing.
+//
+// Remarks: Collision modifier can be used by the application to achieve effects like animating collision geometry at run time,
+// however care must taken as animation of a collision primitive could result in unwanted penetrations.
+//
+// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonConvexHullModifierSetMatrix, NewtonConvexHullModifierGetMatrix
+NewtonCollision *NewtonCreateConvexHullModifier(
+ const NewtonWorld *const newtonWorld,
+ const NewtonCollision *const convexHullCollision, int shapeID) {
+ Newton *world;
+ dgCollision *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+
+ collision = world->CreateConvexModifier((dgCollision *)convexHullCollision);
+
+ collision->SetUserDataID(dgUnsigned32(shapeID));
+
+ return (NewtonCollision *)collision;
+}
+
+// Name: NewtonConvexHullModifierGetMatrix
+// Get the transformation matrix of a convex hull modifier collision.
+//
+// Parameters:
+// *const NewtonCollision* *convexHullModifier - pointer to the body.
+// *dFloat* *matrixPtr - pointer to an array of 16 floats containing the global matrix of the collision modifier.
+//
+// Return: Nothing.
+//
+// Remarks: The matrix should be arranged in row-major order.
+// a collision modifier can take any type of transformation matrix, as long as the matrix can be invertible by straight
+// Gaussian elimination process. Typical uses are non-uniform scaling, translation and skewing.
+//
+// Remarks: Collision modifier can be used by the application to achieve effects like animating collision geometry at run time,
+// however care must taken as animation of a collision primitive could result into unwanted penetrations.
+//
+// See also: NewtonCreateConvexHullModifier, NewtonConvexHullModifierSetMatrix
+void NewtonConvexHullModifierGetMatrix(
+ const NewtonCollision *convexHullModifier, dFloat *matrixPtr) {
+ dgCollision *collision;
+ collision = (dgCollision *)convexHullModifier;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgMatrix &matrix = (*((dgMatrix *)matrixPtr));
+ matrix = collision->ModifierGetMatrix();
+}
+
+// Name: NewtonConvexHullModifierSetMatrix
+// Set the transformation matrix of a convex hull modifier collision.
+//
+// Parameters:
+// *const NewtonCollision* *convexHullModifier - pointer to the body.
+// *const dFloat* *matrixPtr - pointer to an array of 16 floats containing the global matrix of the collision modifier.
+//
+// Return: Nothing.
+//
+// Remarks: The matrix should be arranged in row-major order.
+// a collision modifier can take any type of transformation matrix, as long as the matrix can be invertible by straight
+// Gaussian elimination process. Typical uses are non-uniform scaling, translation and skewing.
+//
+// Remarks: Collision modifier can be used by the application to achieve effects like animating collision geometry at run time,
+// however care must taken as animation of a collision primitive could result into unwanted penetrations.
+//
+// See also: NewtonCreateConvexHullModifier, NewtonConvexHullModifierGetMatrix
+void NewtonConvexHullModifierSetMatrix(
+ const NewtonCollision *convexHullModifier, const dFloat *const matrixPtr) {
+ dgCollision *collision;
+ collision = (dgCollision *)convexHullModifier;
+
+ TRACE_FUNTION(__FUNCTION__);
+ const dgMatrix &matrix = (*((dgMatrix *)matrixPtr));
+ collision->ModifierSetMatrix(matrix);
+}
+
+// Name: NewtonCreateCompoundCollision
+// Create a container to hold an array of convex collision primitives.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *int* count - number of primitives in the array.
+// *const NewtonCollision* **collisionPrimitiveArray - pointer to an array of convex collision primitives. This array must be filled with convex collision primitives before this function is called.
+// *int* shapeID
+//
+// Return: Pointer to the compound collision.
+//
+// Remarks: Compound collision primitives can only be made of convex collision primitives and they can not contain compound collision. Therefore they are treated as convex primitives.
+//
+// Remarks: Compound collision primitives are treated as instance collision objects that can not shared by multiples rigid bodies.
+//
+// Remarks: Collision primitives are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+//
+// See also: NewtonReleaseCollision
+NewtonCollision *NewtonCreateCompoundCollision(
+ const NewtonWorld *const newtonWorld, int count,
+ NewtonCollision *const collisionPrimitiveArray[], int shapeID) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *world = (Newton *)newtonWorld;
+ dgCollision *collision = world->CreateCollisionCompound(count,
+ (dgCollision **)collisionPrimitiveArray);
+ collision->SetUserDataID(dgUnsigned32(shapeID));
+ return (NewtonCollision *)collision;
+}
+
+// Name: NewtonCreateCompoundCollisionFromMesh
+// Create a compound collision from a concave mesh by an approximate convex partition
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const NewtonMesh* *mesh - pointed concave mesh.
+// *int* maxsubShapesCount,
+// *int* shapeID
+// *int* subShapeId
+//
+//
+// Return: Pointer to the compound collision.
+//
+// Remarks: The algorithm will separated the the original mesh into a series of sub meshes until either
+// the worse concave point is smaller than the specified min concavity or the max number convex shapes is reached.
+//
+// Remarks: is is recommended that convex approximation are made by person with a graphics toll by physically overlaying collision primitives over the concave mesh.
+// but for quit test of maybe for simple meshes and algorithm approximations can be used.
+//
+// Remarks: is is recommended that for best performance this function is used in an off line toll and serialize the output.
+//
+// Remarks: Compound collision primitives are treated as instanced collision objects that cannot be shared by multiples rigid bodies.
+//
+// Remarks: Collision primitives are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+//
+// See also: NewtonCreateCompoundCollision
+NEWTON_API NewtonCollision *NewtonCreateCompoundCollisionFromMesh(const NewtonWorld *const newtonWorld, const NewtonMesh *const convexAproximation, dFloat hullTolerance, int shapeID, int subShapeID) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+ // dgMeshEffect* const convexAproximation = (dgMeshEffect*) mesh;
+
+ dgList<NewtonCollision *> list(world->dgWorld::GetAllocator());
+ NewtonMesh *nextSegment = NULL;
+ for (NewtonMesh *segment = NewtonMeshCreateFirstSingleSegment(convexAproximation); segment; segment = nextSegment) {
+ nextSegment = NewtonMeshCreateNextSingleSegment(convexAproximation, segment);
+
+ NewtonCollision *convexHull = NewtonCreateConvexHullFromMesh(newtonWorld, segment, 0.01f, subShapeID);
+ if (convexHull) {
+ list.Append(convexHull);
+ }
+ NewtonMeshDestroy(segment);
+ }
+
+ dgInt32 count = 0;
+ dgStack<NewtonCollision *> array(list.GetCount());
+ for (dgList<NewtonCollision *>::dgListNode *node = list.GetFirst(); node; node = node->GetNext()) {
+ array[count] = node->GetInfo();
+ count++;
+ }
+
+ NewtonCollision *const collision = NewtonCreateCompoundCollision(newtonWorld, count, &array[0], shapeID);
+ for (dgInt32 i = 0; i < count; i++) {
+ NewtonReleaseCollision(newtonWorld, array[i]);
+ }
+ return collision;
+}
+
+NEWTON_API NewtonCollision *NewtonCreateCompoundBreakable(
+ const NewtonWorld *const newtonWorld, int meshCount,
+ const NewtonMesh **const solids, const int *const shapeIDArray,
+ const dFloat *const densities, const int *const internalFaceMaterial,
+ int shapeID, int debriID, dFloat debriSeparationGap) {
+ Newton *world;
+ dgCollision *collision;
+
+ world = (Newton *)newtonWorld;
+ TRACE_FUNTION(__FUNCTION__);
+
+ collision = world->CreateCollisionCompoundBreakable(meshCount,
+ (dgMeshEffect **)solids, shapeIDArray, densities, internalFaceMaterial,
+ debriID, debriSeparationGap);
+
+ collision->SetUserDataID(dgUnsigned32(shapeID));
+ return (NewtonCollision *)collision;
+}
+
+void NewtonCompoundBreakableResetAnchoredPieces(
+ const NewtonCollision *const compoundBreakable) {
+ dgCollision *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = (dgCollision *)compoundBreakable;
+
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ compound->ResetAnchor();
+ }
+}
+
+void NewtonCompoundBreakableSetAnchoredPieces(
+ const NewtonCollision *const compoundBreakable, int fixShapesCount,
+ dFloat *const matrixPallete, NewtonCollision **const fixedShapesArray) {
+ dgCollision *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = (dgCollision *)compoundBreakable;
+
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ compound->SetAnchoredParts(fixShapesCount, (dgMatrix *)matrixPallete,
+ (const dgCollision **)fixedShapesArray);
+ }
+}
+
+NewtonbreakableComponentMesh *NewtonBreakableGetMainMesh(
+ const NewtonCollision *const compoundBreakable) {
+ dgCollision *collision;
+ NewtonbreakableComponentMesh *mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = (dgCollision *)compoundBreakable;
+
+ mesh = NULL;
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ mesh = (NewtonbreakableComponentMesh *)compound->GetMainMesh();
+ }
+ return mesh;
+}
+
+void NewtonBreakableBeginDelete(const NewtonCollision *const compoundBreakable) {
+ dgCollision *collision;
+ NewtonbreakableComponentMesh *mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = (dgCollision *)compoundBreakable;
+
+ mesh = NULL;
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ compound->DeleteComponentBegin();
+ }
+}
+
+NewtonBody *NewtonBreakableCreateDebrieBody(
+ const NewtonCollision *const compoundBreakable,
+ const NewtonbreakableComponentMesh *const component) {
+ dgBody *body;
+ dgCollision *collision;
+ NewtonbreakableComponentMesh *mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = (dgCollision *)compoundBreakable;
+
+ mesh = NULL;
+ body = NULL;
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ body = compound->CreateComponentBody(
+ (dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)component);
+ }
+
+ return (NewtonBody *)body;
+}
+
+void NewtonBreakableDeleteComponent(
+ const NewtonCollision *const compoundBreakable,
+ const NewtonbreakableComponentMesh *const component) {
+ dgCollision *collision;
+ NewtonbreakableComponentMesh *mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = (dgCollision *)compoundBreakable;
+
+ mesh = NULL;
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ compound->DeleteComponent(
+ (dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)component);
+ }
+}
+
+void NewtonBreakableEndDelete(const NewtonCollision *const compoundBreakable) {
+ dgCollision *collision;
+ NewtonbreakableComponentMesh *mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = (dgCollision *)compoundBreakable;
+
+ mesh = NULL;
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ compound->DeleteComponentEnd();
+ }
+}
+
+NewtonbreakableComponentMesh *NewtonBreakableGetFirstComponent(
+ const NewtonCollision *const compoundBreakable) {
+ dgCollision *collision;
+ NewtonbreakableComponentMesh *mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = (dgCollision *)compoundBreakable;
+
+ mesh = NULL;
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ mesh = (NewtonbreakableComponentMesh *)compound->GetFirstComponentMesh();
+ }
+ return mesh;
+}
+
+NewtonbreakableComponentMesh *NewtonBreakableGetNextComponent(
+ const NewtonbreakableComponentMesh *const component) {
+ dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *node;
+
+ TRACE_FUNTION(__FUNCTION__);
+ node = (dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)component;
+ node = node->GetNext();
+
+ return node->GetNext() ? (NewtonbreakableComponentMesh *)node : NULL;
+}
+
+int NewtonCompoundBreakableGetVertexCount(
+ const NewtonCollision *const compoundBreakable) {
+ dgInt32 count;
+ dgCollision *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = (dgCollision *)compoundBreakable;
+
+ count = 0;
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ count = compound->GetVertecCount();
+ }
+ return count;
+}
+
+void NewtonCompoundBreakableGetVertexStreams(
+ const NewtonCollision *const compoundBreakable, int vertexStrideInByte,
+ dFloat *const vertex, int normalStrideInByte, dFloat *const normal,
+ int uvStrideInByte, dFloat *const uv) {
+ dgCollision *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = (dgCollision *)compoundBreakable;
+
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ compound->GetVertexStreams(vertexStrideInByte, vertex, normalStrideInByte,
+ normal, uvStrideInByte, uv);
+ }
+}
+
+void *NewtonBreakableGetFirstSegment(
+ const NewtonbreakableComponentMesh *const breakableComponent) {
+ dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *node;
+ TRACE_FUNTION(__FUNCTION__);
+
+ node =
+ (dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)breakableComponent;
+ return node->GetInfo().m_nodeData.m_mesh->GetFirst();
+}
+
+void *NewtonBreakableGetNextSegment(const void *const segment) {
+ dgCollisionCompoundBreakable::dgMesh::dgListNode *node;
+ TRACE_FUNTION(__FUNCTION__);
+
+ node = (dgCollisionCompoundBreakable::dgMesh::dgListNode *)segment;
+ return node->GetNext();
+}
+
+int NewtonBreakableGetComponentsInRadius(
+ const NewtonCollision *const compoundBreakable, const dFloat *position,
+ dFloat radius, NewtonbreakableComponentMesh **const segments, int maxCount) {
+ dgInt32 count;
+ dgCollision *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ count = 0;
+ collision = (dgCollision *)compoundBreakable;
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ dgVector origin(position[0], position[1], position[2], dgFloat32(0.0f));
+ count = compound->GetSegmentsInRadius(origin, radius,
+ (dgCollisionCompoundBreakable::dgDebriGraph::dgListNode **)segments,
+ maxCount);
+ }
+
+ return count;
+}
+
+int NewtonBreakableSegmentGetMaterial(const void *const segment) {
+ dgCollisionCompoundBreakable::dgMesh::dgListNode *node;
+ TRACE_FUNTION(__FUNCTION__);
+
+ node = (dgCollisionCompoundBreakable::dgMesh::dgListNode *)segment;
+ return node->GetInfo().m_material;
+}
+
+int NewtonBreakableSegmentGetIndexCount(const void *const segment) {
+ dgCollisionCompoundBreakable::dgMesh::dgListNode *node;
+ TRACE_FUNTION(__FUNCTION__);
+
+ node = (dgCollisionCompoundBreakable::dgMesh::dgListNode *)segment;
+ return node->GetInfo().m_faceCount * 3;
+}
+
+int NewtonBreakableSegmentGetIndexStream(
+ const NewtonCollision *const compoundBreakable,
+ const NewtonbreakableComponentMesh *const meshOwner,
+ const void *const segment, int *const index) {
+ int count;
+ dgCollision *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ count = 0;
+ collision = (dgCollision *)compoundBreakable;
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ count = compound->GetSegmentIndexStream(
+ (dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)meshOwner,
+ (dgCollisionCompoundBreakable::dgMesh::dgListNode *)segment, index);
+ }
+ return count;
+}
+
+int NewtonBreakableSegmentGetIndexStreamShort(
+ const NewtonCollision *const compoundBreakable,
+ const NewtonbreakableComponentMesh *const meshOwner,
+ const void *const segment, short int *const index) {
+ int count;
+ dgCollision *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ count = 0;
+ collision = (dgCollision *)compoundBreakable;
+ if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
+ dgCollisionCompoundBreakable *compound;
+ compound = (dgCollisionCompoundBreakable *)collision;
+ count = compound->GetSegmentIndexStreamShort(
+ (dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)meshOwner,
+ (dgCollisionCompoundBreakable::dgMesh::dgListNode *)segment, index);
+ }
+ return count;
+}
+
+// Name: NewtonCollisionSetAsTriggerVolume
+// Return the trigger volume flag of this shape.
+//
+// Parameters:
+// *const NewtonCollision* convexCollision - is the pointer to a convex collision primitive.
+//
+// Return: 0 if collison shape is solid, non zero is collision shspe is a trigger volume.
+//
+// Remarks: this function can be used to place collision triggers in the scene.
+// Setting this flag is not really a neessesary to place a collision trigger however this option hint the egine that
+// this particular shape is a trigger volume and no contact calculation is desired.
+//
+// See also: NewtonCollisionIsTriggerVolume
+int NewtonCollisionIsTriggerVolume(const NewtonCollision *const convexCollision) {
+ dgCollision *collision;
+ collision = (dgCollision *)convexCollision;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ return collision->IsTriggerVolume() ? 1 : 0;
+}
+
+// Name: NewtonCollisionSetAsTriggerVolume
+// Set a flag on a convex collision shape to indicate that no contacts should calculated for this shape.
+//
+// Parameters:
+// *const NewtonCollision* convexCollision - is the pointer to a convex collision primitive.
+// *unsigned* triggerMode - 1 set diecable contact calculation 0 enable contact calculation.
+//
+// Return: nothing
+//
+// Remarks: this function can be used to place collision triggers in the scene.
+// Setting this flag is not really a nessesary to place a collision trigger however this option hint the egine that
+// this particular shape is a trigger volume and no contact calculation is desired.
+//
+// See also: NewtonCollisionIsTriggerVolume
+void NewtonCollisionSetAsTriggerVolume(const NewtonCollision *convexCollision,
+ int trigger) {
+ dgCollision *collision;
+ collision = (dgCollision *)convexCollision;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ collision->SetAsTriggerVolume(trigger ? true : false);
+}
+
+void NewtonCollisionSetMaxBreakImpactImpulse(
+ const NewtonCollision *const convexHullCollision, dFloat maxImpactImpulse) {
+ dgCollision *collision;
+ collision = (dgCollision *)convexHullCollision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision->SetBreakImpulse(dgFloat32(maxImpactImpulse));
+}
+
+dFloat NewtonCollisionGetMaxBreakImpactImpulse(
+ const NewtonCollision *const convexHullCollision) {
+ dgCollision *collision;
+ collision = (dgCollision *)convexHullCollision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return dgFloat32(collision->GetBreakImpulse());
+}
+
+// Name: NewtonCollisionSetUserID
+// Store a user defined value with a convex collision primitive.
+//
+// Parameters:
+// *const NewtonCollision* collision - is the pointer to a collision primitive.
+// *unsigned* id - value to store with the collision primitive.
+//
+// Return: nothing
+//
+// Remarks: the application can store an id with any collision primitive. This id can be used to identify what type of collision primitive generated a contact.
+//
+// See also: NewtonMaterialGetBodyCollisionID, NewtonCollisionGetUserID, NewtonCreateBox, NewtonCreateSphere
+void NewtonCollisionSetUserID(const NewtonCollision *const collision,
+ unsigned id) {
+
+ dgCollision *coll;
+ coll = (dgCollision *)collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ coll->SetUserDataID(id);
+}
+
+// Name: NewtonCollisionGetUserID
+// Return a user define value with a convex collision primitive.
+//
+// Parameters:
+// *const NewtonCollision* collision - is the pointer to a convex collision primitive.
+//
+// Return: user id
+//
+// Remarks: the application can store an id with any collision primitive. This id can be used to identify what type of collision primitive generated a contact.
+//
+// See also: NewtonMaterialGetBodyCollisionID, NewtonMaterialGetBodyCollisionID, NewtonCreateBox, NewtonCreateSphere
+unsigned NewtonCollisionGetUserID(const NewtonCollision *const collision) {
+ dgCollision *coll;
+
+ TRACE_FUNTION(__FUNCTION__);
+ coll = (dgCollision *)collision;
+ // //return unsigned (dgUnsigned64 (collision->GetUserData()));
+ // return unsigned (PointerToInt (collision->GetUserData()));
+ return coll->SetUserDataID();
+}
+
+// Name: NewtonConvexHullGetFaceIndices
+// Return the number of vertices of face and copy each index into array faceIndices.
+//
+// Parameters:
+// *const NewtonCollision* convexHullCollision - is the pointer to a convex collision hull primitive.
+//
+// Return: user face count of face.
+//
+// Remarks: this function will return zero on all shapes other than a convex full collision shape.
+//
+// Remarks: To get the number of faces of a convex hull shape see function *NewtonCollisionGetInfo*
+//
+// See also: NewtonCollisionGetInfo, NewtonCreateConvexHull
+int NewtonConvexHullGetFaceIndices(
+ const NewtonCollision *const convexHullCollision, int face,
+ int *const faceIndices) {
+ dgCollision *coll;
+
+ TRACE_FUNTION(__FUNCTION__);
+ coll = (dgCollision *)convexHullCollision;
+
+ if (coll->IsType(dgCollision::dgCollisionConvexHull_RTTI)) {
+ return ((dgCollisionConvexHull *)coll)->GetFaceIndices(face, faceIndices);
+ } else {
+ return 0;
+ }
+}
+
+// Name: NewtonConvexCollisionCalculateVolume
+// calculate the total volume defined by a convex collision geometry.
+//
+// Parameters:
+// *const NewtonCollision* *convexCollision - pointer to the collision.
+//
+// Return: collision geometry volume. This function will return zero if the body collision geometry is no convex.
+//
+// Remarks: The total volume calculated by the function is only an approximation of the ideal volume. This is not an error, it is a fact resulting from the polygonal representation of convex solids.
+//
+// Remarks: This function can be used to assist the application in calibrating features like fluid density weigh factor when calibrating buoyancy forces for more realistic result.
+//
+// See also: NewtonBodyAddBuoyancyForce
+dFloat NewtonConvexCollisionCalculateVolume(
+ const NewtonCollision *const convexCollision) {
+ dgCollision *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = (dgCollision *)convexCollision;
+ return collision->GetVolume();
+}
+
+// Name: NewtonConvexCollisionCalculateInertialMatrix
+// Calculate the three principal axis and the the values of the inertia matrix of a convex collision objects.
+//
+// Parameters:
+// *const NewtonCollision* convexCollision - is the pointer to a convex collision primitive.
+// *dFloat* *inertia - pointer to and array of a least 3 floats to hold the values of the principal inertia.
+// *dFloat* *origin - pointer to and array of a least 3 floats to hold the values of the center of mass for the principal inertia.
+//
+// Remarks: This function calculate a general inertial matrix for arbitrary convex collision including compound collisions.
+//
+// See also: NewtonBodySetMassMatrix, NewtonBodyGetMassMatrix, NewtonBodySetCentreOfMass, NewtonBodyGetCentreOfMass
+void NewtonConvexCollisionCalculateInertialMatrix(
+ const NewtonCollision *convexCollision, dFloat *const inertia,
+ dFloat *const origin) {
+ dgCollision *collision;
+ collision = (dgCollision *)convexCollision;
+
+ dgVector tmpInertia;
+ dgVector tmpOringin;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision->CalculateInertia(tmpInertia, tmpOringin);
+
+ inertia[0] = tmpInertia[0];
+ inertia[1] = tmpInertia[1];
+ inertia[2] = tmpInertia[2];
+ origin[0] = tmpOringin[0];
+ origin[1] = tmpOringin[1];
+ origin[2] = tmpOringin[2];
+}
+
+// **********************************************************************************************
+//
+// Name: Complex collision primitives interface
+//
+// **********************************************************************************************
+
+// Name: NewtonCreateUserMeshCollision
+// Create a complex collision geometry to be controlled by the application.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const dFloat* *minBox - pointer to an array of at least three floats to hold minimum value for the box relative to the collision.
+// *const dFloat* *maxBox - pointer to an array of at least three floats to hold maximum value for the box relative to the collision.
+// *void* *userData - pointer to user data to be used as context for event callback.
+// *NewtonUserMeshCollisionCollideCallback* collideCallback - pointer to an event function for providing Newton with the polygon inside a given box region.
+// *NewtonUserMeshCollisionRayHitCallback* rayHitCallBack - pointer to an event function for providing Newton with ray intersection information.
+// *NewtonUserMeshCollisionDestroyCallback* destroyCallback - pointer to an event function for destroying any data allocated for use by the application.
+// *NewtonUserMeshCollisionGetCollisionInfo* getInfoCallback - xxxxx
+// *NewtonUserMeshCollisionGetFacesInAABB* facesInAABBCallback - xxxxxxxxxx
+//
+// Return: Pointer to the user collision.
+//
+// Remarks: *UserMeshCollision* provides the application with a method of overloading the built-in collision system for background objects.
+// UserMeshCollision can be used for implementing collisions with height maps, collisions with BSP, and any other collision structure the application
+// supports and wishes to preserve.
+// However, *UserMeshCollision* can not take advantage of the efficient and sophisticated algorithms and data structures of the
+// built-in *TreeCollision*. We suggest you experiment with both methods and use the method best suited to your situation.
+//
+// Remarks: When a *UserMeshCollision* is assigned to a body, the mass of the body is ignored in all dynamics calculations.
+// This make the body behave as a static body.
+//
+// Remarks: Collision primitives are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+// Collision primitives can be reused with more than one body. This will reduce the amount of memory used be the engine, as well
+// as speed up some calculations.
+//
+// See also: NewtonReleaseCollision
+NewtonCollision *NewtonCreateUserMeshCollision(
+ const NewtonWorld *const newtonWorld, const dFloat *const minBox,
+ const dFloat *const maxBox, void *const userData,
+ NewtonUserMeshCollisionCollideCallback collideCallback,
+ NewtonUserMeshCollisionRayHitCallback rayHitCallBack,
+ NewtonUserMeshCollisionDestroyCallback destroyCallback,
+ NewtonUserMeshCollisionGetCollisionInfo getInfoCallback,
+ NewtonUserMeshCollisionGetFacesInAABB facesInAABBCallback, int shapeID) {
+ Newton *world;
+ dgCollision *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector p0(minBox[0], minBox[1], minBox[2], dgFloat32(1.0f));
+ dgVector p1(maxBox[0], maxBox[1], maxBox[2], dgFloat32(1.0f));
+
+ world = (Newton *)newtonWorld;
+
+ dgUserMeshCreation data;
+ data.m_userData = userData;
+ data.m_collideCallback = (OnUserMeshCollideCallback)collideCallback;
+ data.m_rayHitCallBack = (OnUserMeshRayHitCallback)rayHitCallBack;
+ data.m_destroyCallback = (OnUserMeshDestroyCallback)destroyCallback;
+ data.m_getInfo = (UserMeshCollisionInfo)getInfoCallback;
+ data.m_faceInAabb = (UserMeshFacesInAABB)facesInAABBCallback;
+
+ collision = world->CreateStaticUserMesh(p0, p1, data);
+ collision->SetUserDataID(dgUnsigned32(shapeID));
+ return (NewtonCollision *)collision;
+}
+
+// Name: NewtonCreateTreeCollision
+// Create an empty complex collision geometry tree.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+//
+// Return: Pointer to the collision tree.
+//
+// Remarks: *TreeCollision* is the preferred method within Newton for collision with polygonal meshes of arbitrary complexity.
+// The mesh must be made of flat non-intersecting polygons, but they do not explicitly need to be triangles.
+// *TreeCollision* can be serialized by the application to/from an arbitrary storage device.
+//
+// Remarks: When a *TreeCollision* is assigned to a body the mass of the body is ignored in all dynamics calculations.
+// This makes the body behave as a static body.
+//
+// Remarks: Collision primitives are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+// Collision primitives can be reused with more than one body. This will reduce the amount of memory used by the engine, as well
+// as speed up some calculations.
+//
+// See also: NewtonTreeCollisionBeginBuild, NewtonTreeCollisionAddFace, NewtonTreeCollisionEndBuild, NewtonStaticCollisionSetDebugCallback, NewtonTreeCollisionGetFaceAtribute, NewtonTreeCollisionSetFaceAtribute, NewtonReleaseCollision
+NewtonCollision *NewtonCreateTreeCollision(const NewtonWorld *const newtonWorld,
+ int shapeID) {
+ Newton *world;
+ dgCollision *collision;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = world->CreateBVH();
+ collision->SetUserDataID(dgUnsigned32(shapeID));
+ return (NewtonCollision *)collision;
+}
+
+NewtonCollision *NewtonCreateTreeCollisionFromMesh(const NewtonWorld *const newtonWorld, const NewtonMesh *const mesh, int shapeID) {
+ TRACE_FUNTION(__FUNCTION__);
+ // Newton* const world = (Newton *)newtonWorld;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *const)mesh;
+ dgCollision *const collision = meshEffect->CreateCollisionTree(shapeID);
+ // dgCollision* const collision = world->CreateBVH ();
+ // collision->SetUserDataID(dgUnsigned32 (shapeID));
+ return (NewtonCollision *)collision;
+}
+
+// Name: NewtonStaticCollisionSetDebugCallback
+// set a function call back to be call during the face query of a collision tree.
+//
+// Parameters:
+// *const NewtonCollision* *staticCollision - is the pointer to the static collision (a CollisionTree of a HeightFieldCollision)
+// *NewtonTreeCollisionCallback *userCallback - pointer to an event function to call before Newton evaluates the polygons colliding with a body. This parameter can be NULL.
+//
+// Remarks: because debug display display report all the faces of a collision primitive, it could get slow on very large static collision.
+// this function can be used for debugging purpose to just report only faces intersetion the collision AABB of the collision shape colliding with the polyginal mesh collision.
+//
+// Remarks: this function is not recommended to use for production code only for debug purpose.
+//
+// See also: NewtonTreeCollisionGetFaceAtribute, NewtonTreeCollisionSetFaceAtribute
+void NewtonStaticCollisionSetDebugCallback(
+ const NewtonCollision *const staticCollision,
+ NewtonTreeCollisionCallback userCallback) {
+ /*
+ dgCollision* collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ collision = (dgCollision*) staticCollision;
+ if (collision->IsType(dgCollision::dgCollisionPolygonalSoup_RTTI)) {
+ dgCollisionPolygonalSoup* collisionTree;
+ collisionTree = (dgCollisionPolygonalSoup*) collision;
+ if (collisionTree->GetCallBack___() == NewtonCollisionTree::GetIntersectingPolygons) {
+ NewtonCollisionTree& tree = *((NewtonCollisionTree*) collisionTree->GetUserData());
+ tree.SetCollisionCallback (userCallback);
+
+ } else if (collisionTree->GetCallBack___() == NewtonHeightFieldCollision::GetIntersectingPolygons) {
+ NewtonHeightFieldCollision& heightField = *((NewtonHeightFieldCollision*) collisionTree->GetUserData());
+ heightField.SetCollisionCallback (userCallback);
+ }
+ }
+ */
+
+ dgCollision *collision;
+ // dgCollisionMesh* collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision = (dgCollision *)staticCollision;
+ if (collision->IsType(dgCollision::dgCollisionMesh_RTTI)) {
+ dgCollisionMesh *mesh;
+ mesh = (dgCollisionMesh *)staticCollision;
+ mesh->SetCollisionCallback((dgCollisionMeshCollisionCallback)userCallback);
+ } else if (collision->IsType(dgCollision::dgCollisionScene_RTTI)) {
+ dgCollisionScene *scene;
+ scene = (dgCollisionScene *)staticCollision;
+ scene->SetCollisionCallback(
+ (dgCollisionMeshCollisionCallback)userCallback);
+ }
+}
+
+// Name: NewtonTreeCollisionSetUserRayCastCallback
+// set a function call back to be called during the face query of a collision tree.
+//
+// Parameters:
+// *const NewtonCollision* *treeCollision - is the pointer to the collision tree.
+// *NewtonCollisionTreeRayCastCallback *userCallback - pointer to an event function to call before Newton evaluates the polygons colliding with a body. This parameter can be NULL.
+//
+// Remarks: In general a ray cast on a collision tree will stops at the first interceptions with the closest face in the tree
+// that was hit by the ray. In some cases the application may be interested in the intesation with faces other than the fiorst hit.
+// In this cases the application can set this alternate callback and the ray scanner will notify the application of each face hit by the ray scan.
+//
+// Remarks: since this function faces the ray scanner to visit all of the potential faces intersected by the ray,
+// setting the function call back make the ray casting on collision tree less efficient than the default behavior.
+// So it is this functionality is only recommended for cases were the application is using especial effects like transparencies, or other effects
+//
+// Remarks: calling this function with *rayHitCallback* = NULL will rest the collision tree to it default raycast mode, which is return with the closest hit.
+//
+// Remarks: when *rayHitCallback* is not null then the callback is dalled with the follwing arguments
+// *const NetwonCollisio* collision - pointer to the collision tree
+// *dFloat* interseption - inetstion parameters of the ray
+// *dFloat* *normal - unnormalized face mormal in the space fo eth parent of the collision.
+// *int* faceId - id of this face in the collision tree.
+//
+// See also: NewtonTreeCollisionGetFaceAtribute, NewtonTreeCollisionSetFaceAtribute
+void NewtonTreeCollisionSetUserRayCastCallback(
+ const NewtonCollision *const treeCollision,
+ NewtonCollisionTreeRayCastCallback rayHitCallback) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgCollisionBVH *const collision = (dgCollisionBVH *)treeCollision;
+ if (collision->IsType(dgCollision::dgCollisionBVH_RTTI)) {
+ collision->SetCollisionRayCastCallback(
+ (dgCollisionBVHUserRayCastCallback)rayHitCallback);
+ }
+}
+
+void NewtonHeightFieldSetUserRayCastCallback(
+ const NewtonCollision *treeCollision,
+ NewtonHeightFieldRayCastCallback rayHitCallback) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgCollisionHeightField *const collision =
+ (dgCollisionHeightField *)treeCollision;
+ if (collision->IsType(dgCollision::dgCollisionHeightField_RTTI)) {
+ collision->SetCollisionRayCastCallback(
+ (dgCollisionHeightFieldRayCastCallback)rayHitCallback);
+ }
+}
+
+// Name: NewtonTreeCollisionBeginBuild
+// Prepare a *TreeCollision* to begin to accept the polygons that comprise the collision mesh.
+//
+// Parameters:
+// *const NewtonCollision* *treeCollision - is the pointer to the collision tree.
+//
+// Return: Nothing.
+//
+// See also: NewtonTreeCollisionAddFace, NewtonTreeCollisionEndBuild
+void NewtonTreeCollisionBeginBuild(const NewtonCollision *treeCollision) {
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgCollisionBVH *const collision = (dgCollisionBVH *)treeCollision;
+ _ASSERTE(collision->IsType(dgCollision::dgCollisionBVH_RTTI));
+
+ collision->BeginBuild();
+}
+
+// Name: NewtonTreeCollisionAddFace
+// Add an individual polygon to a *TreeCollision*.
+//
+// Parameters:
+// *const NewtonCollision* *treeCollision - is the pointer to the collision tree.
+// *int* vertexCount - number of vertex in *vertexPtr*
+// *const dFloat* *vertexPtr - pointer to an array of vertex. The vertex should consist of at least 3 floats each.
+// *int* strideInBytes - size of each vertex in bytes. This value should be 12 or larger.
+// *int* faceAttribute - id that identifies the polygon. The application can use this value to customize the behavior of the collision geometry.
+//
+// Return: Nothing.
+//
+// Remarks: After the call to *NewtonTreeCollisionBeginBuild* the *TreeCollision* is ready to accept polygons. The application should iterate
+// through the application's mesh, adding the mesh polygons to the *TreeCollision* one at a time.
+// The polygons must be flat and non-self intersecting.
+//
+// See also: NewtonTreeCollisionAddFace, NewtonTreeCollisionEndBuild
+void NewtonTreeCollisionAddFace(const NewtonCollision *const treeCollision,
+ int vertexCount, const dFloat *const vertexPtr, int strideInBytes,
+ int faceAttribute) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgCollisionBVH *const collision = (dgCollisionBVH *)treeCollision;
+ _ASSERTE(collision->IsType(dgCollision::dgCollisionBVH_RTTI));
+ collision->AddFace(vertexCount, vertexPtr, strideInBytes, faceAttribute);
+}
+
+// Name: NewtonTreeCollisionEndBuild
+// Finalize the construction of the polygonal mesh.
+//
+// Parameters:
+// *const NewtonCollision* *treeCollision - is the pointer to the collision tree.
+// *int* optimize - flag that indicates to Newton whether it should optimize this mesh. Set to 1 to optimize the mesh, otherwise 0.
+//
+// Return: Nothing.
+//
+//
+// Remarks: After the application has finished adding polygons to the *TreeCollision*, it must call this function to finalize the construction of the collision mesh.
+// If concave polygons are added to the *TreeCollision*, the application must call this function with the parameter *optimize* set to 1.
+// With the *optimize* parameter set to 1, Newton will optimize the collision mesh by removing non essential edges from adjacent flat polygons.
+// Newton will not change the topology of the mesh but significantly reduces the number of polygons in the mesh. The reduction factor of the number of polygons in the mesh depends upon the irregularity of the mesh topology.
+// A reduction factor of 1.5 to 2.0 is common.
+// Calling this function with the parameter *optimize* set to zero, will leave the mesh geometry unaltered.
+//
+// See also: NewtonTreeCollisionAddFace, NewtonTreeCollisionEndBuild
+void NewtonTreeCollisionEndBuild(const NewtonCollision *const treeCollision,
+ int optimize) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgCollisionBVH *const collision = (dgCollisionBVH *)treeCollision;
+ _ASSERTE(collision->IsType(dgCollision::dgCollisionBVH_RTTI));
+ collision->EndBuild(optimize);
+}
+
+// Name: NewtonTreeCollisionGetFaceAtribute
+// Get the user defined collision attributes stored with each face of the collision mesh.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const int* *faceIndexArray - pointer to the face index list passed to the function *NewtonTreeCollisionCallback userCallback*
+//
+// Return: User id of the face.
+//
+// Remarks: This function is used to obtain the user data stored in faces of the collision geometry.
+// The application can use this user data to achieve per polygon material behavior in large static collision meshes.
+//
+// See also: NewtonTreeCollisionSetFaceAtribute, NewtonCreateTreeCollision, NewtonCreateTreeCollisionFromSerialization
+int NewtonTreeCollisionGetFaceAtribute(
+ const NewtonCollision *const treeCollision, const int *const faceIndexArray) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgCollisionBVH *const collision = (dgCollisionBVH *)treeCollision;
+ _ASSERTE(collision->IsType(dgCollision::dgCollisionBVH_RTTI));
+
+ return int(collision->GetTagId(faceIndexArray));
+}
+
+// Name: NewtonTreeCollisionSetFaceAtribute
+// Change the user defined collision attribute stored with faces of the collision mesh.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const int* *faceIndexArray - pointer to the face index list passed to the function *NewtonTreeCollisionCallback userCallback*
+// *int* attribute - value of the user defined attribute to be stored with the face.
+//
+// Return: User id of the face.
+//
+// Remarks: This function is used to obtain the user data stored in faces of the collision geometry.
+// The application can use this user data to achieve per polygon material behavior in large static collision meshes.
+// By changing the value of this user data the application can achieve modifiable surface behavior with the collision geometry.
+// For example, in a driving game, the surface of a polygon that represents the street can changed from pavement to oily or wet after
+// some collision event occurs.
+//
+// See also: NewtonTreeCollisionGetFaceAtribute, NewtonCreateTreeCollision, NewtonCreateTreeCollisionFromSerialization
+void NewtonTreeCollisionSetFaceAtribute(
+ const NewtonCollision *const treeCollision, const int *const faceIndexArray,
+ int attribute) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgCollisionBVH *const collision = (dgCollisionBVH *)treeCollision;
+ _ASSERTE(collision->IsType(dgCollision::dgCollisionBVH_RTTI));
+
+ collision->SetTagId(faceIndexArray, dgUnsigned32(attribute));
+}
+
+// Name: NewtonTreeCollisionGetVertexListIndexListInAABB
+// collect the vertex list index list mesh intersecting the AABB in collision mesh.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *dFloat* *p0 - pointer to an array of at least three floats representing the ray origin in the local space of the geometry.
+// *dFloat* *p1 - pointer to an array of at least three floats representing the ray end in the local space of the geometry.
+// *const dFloat* **vertexArray - pointer to a the vertex array of vertex.
+// *int* *vertexCount - pointer int to return the number of vertex in vertexArray.
+// *int* *vertexStrideInBytes - pointer to int to return the size of each vertex in vertexArray.
+// *const int* *indexList - pointer to array on integers containing the triangles intersection the aabb.
+// *const int* maxIndexCount - maximum number of indices the function will copy to indexList.
+// *const int* *faceAttribute - pointer to array on integers top contain the face containing the .
+//
+// Return: the number of triangles in indexList.
+//
+// Remarks: indexList should be a list 3 * maxIndexCount the number of elements.
+//
+// Remarks: faceAttributet should be a list maxIndexCount the number of elements.
+//
+// Remarks: this function could be used by the application for many purposes.
+// for example it can be used to draw the collision geometry intersecting a collision primitive instead
+// of drawing the entire collision tree in debug mode.
+// Another use for this function is to to efficient draw projective texture shadows.
+int NewtonTreeCollisionGetVertexListIndexListInAABB(
+ const NewtonCollision *const treeCollision, const dFloat *const p0,
+ const dFloat *const p1, const dFloat **const vertexArray,
+ int *const vertexCount, int *const vertexStrideInBytes,
+ const int *const indexList, int maxIndexCount,
+ const int *const faceAttribute) {
+ dgInt32 count;
+ dgCollision *meshColl;
+
+ count = 0;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ meshColl = (dgCollision *)treeCollision;
+
+ if (meshColl->IsType(dgCollision::dgCollisionMesh_RTTI)) {
+ dgCollisionMesh *collision;
+ collision = (dgCollisionMesh *)meshColl;
+
+ // NewtonCollisionTree& tree = *((NewtonCollisionTree*) collisionTree->GetUserData());
+ dgVector pmin(p0[0], p0[1], p0[2], dgFloat32(0.0f));
+ dgVector pmax(p1[0], p1[1], p1[2], dgFloat32(0.0f));
+
+ dgCollisionMesh::dgGetVertexListIndexList data;
+ data.m_indexList = (dgInt32 *)indexList;
+ data.m_userDataList = (dgInt32 *)faceAttribute;
+ data.m_maxIndexCount = maxIndexCount;
+ data.m_triangleCount = 0;
+ collision->GetVertexListIndexList(pmin, pmax, data);
+
+ count = data.m_triangleCount;
+ *vertexArray = data.m_veterxArray;
+ *vertexCount = data.m_vertexCount;
+ *vertexStrideInBytes = data.m_vertexStrideInBytes;
+ }
+
+ return count;
+}
+
+// Name: NewtonCreateHeightFieldCollision
+// Create a height field collision geometry.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *int* width -
+// *int* height -
+// *int* cellsDiagonals -
+// *unsigned short* elevationMap -
+// *char* atributeMap -
+// *dFloat* horizontalScale -
+// *dFloat* verticalScale -
+//
+// Return: Pointer to the collision.
+//
+// Remarks:
+// Remarks:
+// Remarks:
+//
+// See also: NewtonCreateTreeCollision, NewtonReleaseCollision
+NewtonCollision *NewtonCreateHeightFieldCollision(
+ const NewtonWorld *const newtonWorld, int width, int height,
+ int cellsDiagonals, const unsigned short *const elevationMap,
+ const char *const atributeMap, dFloat horizontalScale, dFloat verticalScale,
+ int shapeID) {
+ Newton *world;
+ dgCollision *collision;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ collision = world->CreateBVHFieldCollision(width, height, cellsDiagonals,
+ elevationMap, atributeMap, horizontalScale, verticalScale);
+ collision->SetUserDataID(dgUnsigned32(shapeID));
+ return (NewtonCollision *)collision;
+}
+
+// Name: NewtonCreateSceneCollision
+// Create a height field collision geometry.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+//
+// Return: Pointer to the collision.
+//
+// Remarks:
+// Remarks:
+// Remarks:
+//
+// See also: NewtonCreateTreeCollision, NewtonReleaseCollision
+NewtonCollision *NewtonCreateSceneCollision(
+ const NewtonWorld *const newtonWorld, int shapeID) {
+ Newton *world;
+ dgCollision *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+
+ collision = world->CreateScene();
+
+ collision->SetUserDataID(dgUnsigned32(shapeID));
+ return (NewtonCollision *)collision;
+}
+
+NewtonSceneProxy *NewtonSceneCollisionCreateProxy(NewtonCollision *const scene,
+ NewtonCollision *const collision, const dFloat *const matrixPtr) {
+ dgMatrix matrix(*((dgMatrix *)matrixPtr));
+ matrix.m_front.m_w = dgFloat32(0.0f);
+ matrix.m_up.m_w = dgFloat32(0.0f);
+ matrix.m_right.m_w = dgFloat32(0.0f);
+ matrix.m_posit.m_w = dgFloat32(1.0f);
+
+ dgCollisionScene *const newtonScene = (dgCollisionScene *)scene;
+ _ASSERTE(newtonScene->IsType(dgCollision::dgCollisionScene_RTTI));
+ return (NewtonSceneProxy *)newtonScene->AddProxy((dgCollision *)collision,
+ matrix);
+}
+
+void NewtonSceneCollisionDestroyProxy(NewtonCollision *const scene,
+ NewtonSceneProxy *const proxy) {
+ dgCollisionScene *const newtonScene = (dgCollisionScene *)scene;
+ _ASSERTE(newtonScene->IsType(dgCollision::dgCollisionScene_RTTI));
+ newtonScene->RemoveProxy(proxy);
+}
+
+void NewtonSceneProxySetMatrix(NewtonSceneProxy *const proxy,
+ const dFloat *const matrix) {
+ dgList<dgCollisionScene::dgProxy *>::dgListNode *const node = (dgList<
+ dgCollisionScene::dgProxy *>::dgListNode *)proxy;
+ dgCollisionScene *const newtonScene = node->GetInfo()->m_owner;
+ dgMatrix &offset = *((dgMatrix *)matrix);
+ newtonScene->SetProxyMatrix(node, offset);
+}
+
+void NewtonSceneProxyGetMatrix(NewtonSceneProxy *const proxy,
+ dFloat *const matrix) {
+ dgList<dgCollisionScene::dgProxy *>::dgListNode *const node = (dgList<
+ dgCollisionScene::dgProxy *>::dgListNode *)proxy;
+ dgCollisionScene *const newtonScene = node->GetInfo()->m_owner;
+
+ dgMatrix &offset = *((dgMatrix *)matrix);
+ offset = newtonScene->GetProxyMatrix(node);
+}
+
+void NewtonSceneSetProxyUserData(NewtonSceneProxy *const proxy, void *userData) {
+ dgList<dgCollisionScene::dgProxy *>::dgListNode *const node = (dgList<
+ dgCollisionScene::dgProxy *>::dgListNode *)proxy;
+ dgCollisionScene *const newtonScene = node->GetInfo()->m_owner;
+
+ newtonScene->SetProxyUserData(node, userData);
+}
+
+void *NewtonSceneGetProxyUserData(NewtonSceneProxy *const proxy) {
+ dgList<dgCollisionScene::dgProxy *>::dgListNode *const node = (dgList<
+ dgCollisionScene::dgProxy *>::dgListNode *)proxy;
+ dgCollisionScene *const newtonScene = node->GetInfo()->m_owner;
+
+ return newtonScene->GetProxyUserData(node);
+}
+
+NewtonSceneProxy *NewtonSceneGetFirstProxy(NewtonCollision *const scene) {
+ dgCollisionScene *const newtonScene = (dgCollisionScene *)scene;
+ return (NewtonSceneProxy *)newtonScene->GetFirstProxy();
+}
+
+NewtonSceneProxy *NewtonSceneGetNextProxy(NewtonCollision *const scene,
+ NewtonSceneProxy *const proxy) {
+ dgList<dgCollisionScene::dgProxy *>::dgListNode *const node = (dgList<
+ dgCollisionScene::dgProxy *>::dgListNode *)proxy;
+ dgCollisionScene *const newtonScene = node->GetInfo()->m_owner;
+
+ return (NewtonSceneProxy *)newtonScene->GetNextProxy(proxy);
+}
+
+void NewtonSceneCollisionOptimize(NewtonCollision *const scene) {
+ dgCollisionScene *const newtonScene = (dgCollisionScene *)scene;
+ _ASSERTE(newtonScene->IsType(dgCollision::dgCollisionScene_RTTI));
+ newtonScene->ImproveTotalFitness();
+}
+
+// **********************************************************************************************
+//
+// Name: Generic collision library functions
+//
+// **********************************************************************************************
+
+// Name: NewtonCollisionPointDistance
+// Calculate the closest point between a point and convex collision primitive.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *dFloat* *point - pointer to and array of a least 3 floats representing the origin.
+// *const NewtonCollision* *collision - pointer to collision primitive.
+// *const dFloat* *matrix - pointer to an array of 16 floats containing the offset matrix of collision primitiveA.
+// *dFloat* *contact - pointer to and array of a least 3 floats to contain the closest point to collisioA.
+// *dFloat* *normal - pointer to and array of a least 3 floats to contain the separating vector normal.
+// *int* threadIndex -Thread index form where the call is made from, zeor otherwize
+//
+// Return: one if the two bodies are disjoint and the closest point could be found,
+// zero if the point is inside the convex primitive.
+//
+// Remarks: This function can be used as a low-level building block for a stand-alone collision system.
+// Applications that have already there own physics system, and only want and quick and fast collision solution,
+// can use Newton advanced collision engine as the low level collision detection part.
+// To do this the application only needs to initialize Newton, create the collision primitives at application discretion,
+// and just call this function when the objects are in close proximity. Applications using Newton as a collision system
+// only, are responsible for implementing their own broad phase collision determination, based on any high level tree structure.
+// Also the application should implement their own trivial aabb test, before calling this function .
+//
+// Remarks: the current implementation of this function do work on collision trees, or user define collision.
+//
+// See also: NewtonCollisionCollideContinue, NewtonCollisionClosestPoint, NewtonCollisionCollide, NewtonCollisionRayCast, NewtonCollisionCalculateAABB
+int NewtonCollisionPointDistance(const NewtonWorld *const newtonWorld,
+ const dFloat *const point, const NewtonCollision *const collision,
+ const dFloat *const matrix, dFloat *const contact, dFloat *const normal,
+ int threadIndex) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return world->ClosestPoint(*((dgTriplex *)point), (dgCollision *)collision,
+ *((dgMatrix *)matrix), *((dgTriplex *)contact), *((dgTriplex *)normal),
+ threadIndex);
+}
+
+// Name: NewtonCollisionClosestPoint
+// Calculate the closest points between two disjoint convex collision primitive.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const NewtonCollision* *collisionA - pointer to collision primitive A.
+// *const dFloat* *matrixA - pointer to an array of 16 floats containing the offset matrix of collision primitiveA.
+// *const NewtonCollision* *collisionB - pointer to collision primitive B.
+// *const dFloat* *matrixB - pointer to an array of 16 floats containing the offset matrix of collision primitiveB.
+// *dFloat* *contactA - pointer to and array of a least 3 floats to contain the closest point to collisionA.
+// *dFloat* *contactB - pointer to and array of a least 3 floats to contain the closest point to collisionB.
+// *dFloat* *normalAB - pointer to and array of a least 3 floats to contain the separating vector normal.
+// *int* threadIndex -Thread index form where the call is made from, zeor otherwize
+//
+// Return: one if the tow bodies are disjoint and he closest point could be found,
+// zero if the two collision primitives are intersecting.
+//
+// Remarks: This function can be used as a low-level building block for a stand-alone collision system.
+// Applications that have already there own physics system, and only want and quick and fast collision solution,
+// can use Newton advanced collision engine as the low level collision detection part.
+// To do this the application only needs to initialize Newton, create the collision primitives at application discretion,
+// and just call this function when the objects are in close proximity. Applications using Newton as a collision system
+// only, are responsible for implementing their own broad phase collision determination, based on any high level tree structure.
+// Also the application should implement their own trivial aabb test, before calling this function .
+//
+// Remarks: the current implementation of this function does not work on collision trees, or user define collision.
+//
+// See also: NewtonCollisionCollideContinue, NewtonCollisionPointDistance, NewtonCollisionCollide, NewtonCollisionRayCast, NewtonCollisionCalculateAABB
+int NewtonCollisionClosestPoint(const NewtonWorld *const newtonWorld,
+ const NewtonCollision *const collisionA, const dFloat *const matrixA,
+ const NewtonCollision *const collisionB, const dFloat *const matrixB,
+ dFloat *const contactA, dFloat *const contactB, dFloat *const normalAB,
+ int threadIndex) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return world->ClosestPoint((dgCollision *)collisionA, *((dgMatrix *)matrixA),
+ (dgCollision *)collisionB, *((dgMatrix *)matrixB),
+ *((dgTriplex *)contactA), *((dgTriplex *)contactB),
+ *((dgTriplex *)normalAB), threadIndex);
+}
+
+// Name: NewtonCollisionCollide
+// Calculate contact points between two collision primitive.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *int* maxSize - size of maximum number of elements in contacts, normals, and penetration.
+// *const NewtonCollision* *collisionA - pointer to collision primitive A.
+// *const dFloat* *matrixA - pointer to an array of 16 floats containing the offset matrix of collision primitiveA.
+// *const NewtonCollision* *collisionB - pointer to collision primitive B.
+// *const dFloat* *matrixB - pointer to an array of 16 floats containing the offset matrix of collision primitiveB.
+// *dFloat* *contacts - pointer to and array of a least 3 times maxSize floats to contain the collision contact points.
+// *dFloat* *normals - pointer to and array of a least 3 times maxSize floats to contain the collision contact normals.
+// *dFloat* *penetration - pointer to and array of a least maxSize floats to contain the collision penetration at each contact.
+// *int* threadIndex -Thread index form where the call is made from, zeor otherwize
+//
+// Return: the number of contact points.
+//
+// Remarks: This function can be used as a low-level building block for a stand-alone collision system.
+// Applications that have already there own physics system, and only want and quick and fast collision solution,
+// can use Newton advanced collision engine as the low level collision detection part.
+// To do this the application only needs to initialize Newton, create the collision primitives at application discretion,
+// and just call this function when the objects are in close proximity. Applications using Newton as a collision system
+// only, are responsible for implementing their own broad phase collision determination, based on any high level tree structure.
+// Also the application should implement their own trivial aabb test, before calling this function .
+//
+// See also: NewtonCollisionCollideContinue, NewtonCollisionClosestPoint, NewtonCollisionPointDistance, NewtonCollisionRayCast, NewtonCollisionCalculateAABB
+int NewtonCollisionCollide(const NewtonWorld *const newtonWorld, int maxSize,
+ const NewtonCollision *const collisionA, const dFloat *const matrixA,
+ const NewtonCollision *const collisionB, const dFloat *const matrixB,
+ dFloat *const contacts, dFloat *const normals, dFloat *const penetration,
+ int threadIndex) {
+ Newton *world;
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return world->Collide((dgCollision *)collisionA, *((dgMatrix *)matrixA),
+ (dgCollision *)collisionB, *((dgMatrix *)matrixB), (dgTriplex *)contacts,
+ (dgTriplex *)normals, penetration, maxSize, threadIndex);
+}
+
+// Name: NewtonCollisionCollideContinue
+// Calculate time of impact of impact and contact points between two collision primitive.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *int* maxSize - size of maximum number of elements in contacts, normals, and penetration.
+// *const dFloat* timestep - maximum time interval considered for the continue collision calculation.
+// *const NewtonCollision* *collisionA - pointer to collision primitive A.
+// *const dFloat* *matrixA - pointer to an array of 16 floats containing the offset matrix of collision primitiveA.
+// *const dFloat* *velocA - pointer to and array of a least 3 times maxSize floats containing the linear velocity of collision primitiveA.
+// *const dFloat* *omegaA - pointer to and array of a least 3 times maxSize floats containing the angular velocity of collision primitiveA.
+// *const NewtonCollision* *collisionB - pointer to collision primitive B.
+// *const dFloat* *matrixB - pointer to an array of 16 floats containing the offset matrix of collision primitiveB.
+// *const dFloat* *velocB - pointer to and array of a least 3 times maxSize floats containing the linear velocity of collision primitiveB.
+// *const dFloat* *omegaB - pointer to and array of a least 3 times maxSize floats containing the angular velocity of collision primitiveB.
+// *dFloat* *timeOfImpact - pointer to least 1 float variable to contain the time of the intersection.
+// *dFloat* *contacts - pointer to and array of a least 3 times maxSize floats to contain the collision contact points.
+// *dFloat* *normals - pointer to and array of a least 3 times maxSize floats to contain the collision contact normals.
+// *dFloat* *penetration - pointer to and array of a least maxSize floats to contain the collision penetration at each contact.
+// *int* threadIndex -Thread index form where the call is made from, zeor otherwize
+//
+// Return: the number of contact points.
+//
+// Remarks: by passing zero as *maxSize* not contact will be calculated and the function will just determine the time of impact is any.
+//
+// Remarks: if the body are inter penetrating the time of impact will be zero.
+//
+// Remarks: if the bodies do not collide time of impact will be set to *timestep*
+//
+// Remarks: This function can be used as a low-level building block for a stand-alone collision system.
+// Applications that have already there own physics system, and only want and quick and fast collision solution,
+// can use Newton advanced collision engine as the low level collision detection part.
+// To do this the application only needs to initialize Newton, create the collision primitives at application discretion,
+// and just call this function when the objects are in close proximity. Applications using Newton as a collision system
+// only, are responsible for implementing their own broad phase collision determination, based on any high level tree structure.
+// Also the application should implement their own trivial aabb test, before calling this function .
+//
+// See also: NewtonCollisionCollide, NewtonCollisionClosestPoint, NewtonCollisionPointDistance, NewtonCollisionRayCast, NewtonCollisionCalculateAABB
+int NewtonCollisionCollideContinue(const NewtonWorld *const newtonWorld,
+ int maxSize, const dFloat timestep, const NewtonCollision *const collisionA,
+ const dFloat *const matrixA, const dFloat *const velocA,
+ const dFloat *const omegaA, const NewtonCollision *const collisionB,
+ const dFloat *const matrixB, const dFloat *const velocB,
+ const dFloat *const omegaB, dFloat *const timeOfImpact,
+ dFloat *const contacts, dFloat *const normals, dFloat *const penetration,
+ int threadIndex) {
+
+ Newton *const world = (Newton *)newtonWorld;
+
+ *timeOfImpact = timestep;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return world->CollideContinue((dgCollision *)collisionA,
+ *((dgMatrix *)matrixA), *((dgVector *)velocA), *((dgVector *)omegaA),
+ (dgCollision *)collisionB, *((dgMatrix *)matrixB), *((dgVector *)velocB),
+ *((dgVector *)omegaB), *timeOfImpact, (dgTriplex *)contacts,
+ (dgTriplex *)normals, penetration, maxSize, threadIndex);
+}
+
+// Name: NewtonCollisionSupportVertex
+// Calculate the most extreme point of a convex collision shape along the given direction.
+//
+// Parameters:
+// *const NewtonCollision* *collisionPtr - pointer to the collision object.
+// *const dFloat* *dir - pointer to an array of at least three floats representing the search direction.
+// *dFloat* *vertex - pointer to an array of at least three floats to hold the collision most extreme vertex along the search direction.
+//
+// Return: nothing.
+//
+// Remarks: the search direction must be in the space of the collision shape.
+//
+// See also: NewtonCollisionRayCast, NewtonCollisionClosestPoint, NewtonCollisionPointDistance
+void NewtonCollisionSupportVertex(const NewtonCollision *collisionPtr,
+ const dFloat *const dir, dFloat *const vertex) {
+ dgCollisionConvex *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ collision = (dgCollisionConvex *)collisionPtr;
+ // _ASSERTE (collision->IsType (dgCollision::dgConvexCollision_RTTI));
+
+ const dgMatrix &matrix = collision->GetOffsetMatrix();
+ dgVector searchDir(
+ matrix.UnrotateVector(dgVector(dir[0], dir[1], dir[2], dgFloat32(0.0f))));
+ searchDir = searchDir.Scale(dgRsqrt(searchDir % searchDir));
+
+ dgVector vertexOut(
+ matrix.TransformVector(collision->SupportVertex(searchDir)));
+
+ vertex[0] = vertexOut[0];
+ vertex[1] = vertexOut[1];
+ vertex[2] = vertexOut[2];
+}
+
+// Name: NewtonCollisionRayCast
+// Ray cast specific collision object.
+//
+// Parameters:
+// *const NewtonCollision* *collisionPtr - pointer to the collision object.
+// *const dFloat* *p0 - pointer to an array of at least three floats representing the ray origin in the local space of the geometry.
+// *const dFloat* *p1 - pointer to an array of at least three floats representing the ray end in the local space of the geometry.
+// *dFloat* *normal - pointer to an array of at least three floats to hold the normal at the intersection point.
+// *int* *attribute - pointer to an array of at least one floats to hold the ID of the face hit by the ray.
+//
+// Return: the parametric value of the intersection, between 0.0 and 1.0, an value larger than 1.0 if the ray miss.
+//
+// Remarks: This function is intended for applications using newton collision system separate from the dynamics system, also for applications
+// implementing any king of special purpose logic like sensing distance to another object.
+//
+// Remarks: the ray most be local to the collisions geometry, for example and application ray casting the collision geometry of
+// of a rigid body, must first take the points p0, and p1 to the local space of the rigid body by multiplying the points by the
+// inverse of he rigid body transformation matrix.
+//
+// See also: NewtonCollisionClosestPoint, NewtonCollisionSupportVertex, NewtonCollisionPointDistance, NewtonCollisionCollide, NewtonCollisionCalculateAABB
+dFloat NewtonCollisionRayCast(const NewtonCollision *collisionPtr,
+ const dFloat *const p0, const dFloat *const p1, dFloat *const normal,
+ int *const attribute) {
+ dFloat t;
+ dgCollision *collision;
+
+ collision = (dgCollision *)collisionPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ const dgMatrix &matrix = collision->GetOffsetMatrix();
+
+ dgVector q0(
+ matrix.UntransformVector(dgVector(p0[0], p0[1], p0[2], dgFloat32(0.0f))));
+ dgVector q1(
+ matrix.UntransformVector(dgVector(p1[0], p1[1], p1[2], dgFloat32(0.0f))));
+ dgContactPoint contact;
+
+ t = collision->RayCast(q0, q1, contact, NULL, NULL, NULL);
+ if (t >= dFloat(0.0f) && t <= dFloat(dgFloat32(1.0f))) {
+ attribute[0] = (int)contact.m_userId;
+
+ dgVector n(matrix.RotateVector(contact.m_normal));
+ normal[0] = n[0];
+ normal[1] = n[1];
+ normal[2] = n[2];
+ }
+ return t;
+}
+
+// Name: NewtonCollisionCalculateAABB
+// Calculate an axis-aligned bounding box for this collision, the box is calculated relative to *offsetMatrix*.
+//
+// Parameters:
+// *const NewtonCollision* *collisionPtr - pointer to the collision object.
+// *const dFloat* *offsetMatrix - pointer to an array of 16 floats containing the offset matrix used as the coordinate system and center of the AABB.
+// *dFloat* *p0 - pointer to an array of at least three floats to hold minimum value for the AABB.
+// *dFloat* *p1 - pointer to an array of at least three floats to hold maximum value for the AABB.
+//
+// Return: Nothing.
+//
+// See also: NewtonCollisionClosestPoint, NewtonCollisionPointDistance, NewtonCollisionCollide, NewtonCollisionRayCast
+void NewtonCollisionCalculateAABB(const NewtonCollision *collisionPtr,
+ const dFloat *const offsetMatrix, dFloat *const p0, dFloat *const p1) {
+ dgCollision *collision;
+ collision = (dgCollision *)collisionPtr;
+ // const dgMatrix& matrix = *((dgMatrix*) offsetMatrix);
+ dgMatrix matrix(collision->GetOffsetMatrix() * (*((dgMatrix *)offsetMatrix)));
+
+ dgVector q0;
+ dgVector q1;
+
+ TRACE_FUNTION(__FUNCTION__);
+ collision->CalcAABB(matrix, q0, q1);
+ p0[0] = q0.m_x;
+ p0[1] = q0.m_y;
+ p0[2] = q0.m_z;
+
+ p1[0] = q1.m_x;
+ p1[1] = q1.m_y;
+ p1[2] = q1.m_z;
+}
+
+// Name: NewtonCollisionForEachPolygonDo
+// Iterate thought polygon of the collision geometry of a body calling the function callback.
+//
+// Parameters:
+// *const NewtonBody* *collisionPtr - is the pointer to the collision objects.
+// *const dFloat32* *matrix - is the pointer to the collision objects.
+// *NewtonCollisionIterator* callback - application define callback
+// *void* *userDataPtr - pointer to the user defined user data value.
+//
+// Return: nothing
+//
+// Remarks: This function used to be a member of the rigid body, but to making it a member of the collision object provides better
+// low lever display capabilities. The application can still call this function to show the collision of a rigid body by
+// getting the collision and the transformation matrix from the rigid, and then calling this functions.
+//
+// Remarks: This function can be called by the application in order to show the collision geometry. The application should provide a pointer to the function *NewtonCollisionIterator*,
+// Newton will convert the collision geometry into a polygonal mesh, and will call *callback* for every polygon of the mesh
+//
+// Remarks: this function affect severely the performance of Newton. The application should call this function only for debugging purpose
+//
+// Remarks: This function will ignore user define collision mesh
+// See also: NewtonWorldGetFirstBody, NewtonWorldForEachBodyInAABBDo
+void NewtonCollisionForEachPolygonDo(const NewtonCollision *collisionPtr,
+ const dFloat *const matrixPtr, NewtonCollisionIterator callback,
+ void *const userDataPtr) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgCollision *const collision = (dgCollision *)(collisionPtr);
+ dgMatrix matrix = *((dgMatrix *)matrixPtr);
+
+ collision->DebugCollision(matrix, (OnDebugCollisionMeshCallback)callback,
+ userDataPtr);
+}
+
+// Name: NewtonCollisionMakeUnique
+// Convert a collision primitive to a unique instance by removing it for the collision cache.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const NewtonCollision* *collisionPtr - pointer to the collision object
+//
+// Return: Nothing.
+//
+// Remarks:
+// This function will not make preexisting collision object unique instances, so for best result this function should be call immediately after the
+// creation of the collision object.
+//
+// Remarks:
+// Collision objects are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+void NewtonCollisionMakeUnique(const NewtonWorld *const newtonWorld,
+ const NewtonCollision *const collisionPtr) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+ dgCollision *const collision = (dgCollision *)collisionPtr;
+ world->RemoveFromCache(collision);
+}
+
+// Name: NewtonAddCollisionReference
+// Increase the reference count of this collision object.
+//
+// Parameters:
+// *const NewtonCollision* *collisionPtr - pointer to the collision object
+//
+// Return: the new refCount.
+//
+// Remarks: to get the correct reference count of a collision primitive the application can call fution *NewtonCollisionGetInfo*
+//
+// Remarks:
+// Collision objects are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+//
+// See also: NewtonReleaseCollision , NewtonCollisionGetInfo, NewtonCollisionSerialize
+int NewtonAddCollisionReference(const NewtonCollision *collisionPtr) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgCollision *const collision = (dgCollision *)collisionPtr;
+ collision->AddRef();
+ return collision->GetRefCount();
+}
+
+// Name: NewtonReleaseCollision
+// Release a reference from this collision object returning control to Newton.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const NewtonCollision* *collisionPtr - pointer to the collision object
+//
+// Return: Nothing.
+//
+// Remarks: to get the correct reference count of a collision primitive the application can call function *NewtonCollisionGetInfo*
+//
+// Remarks:
+// Collision objects are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
+// Neglecting to release references to collision primitives is a common cause of memory leaks.
+//
+// See also: NewtonAddCollisionReference, NewtonCollisionGetInfo, NewtonCollisionSerialize
+void NewtonReleaseCollision(const NewtonWorld *const newtonWorld,
+ const NewtonCollision *const collisionPtr) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+ dgCollision *const collision = (dgCollision *)collisionPtr;
+ world->ReleaseCollision(collision);
+}
+
+// Name: NewtonCollisionSerialize
+// Serialize a * general collision shape.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const NewtonCollision* *collision - is the pointer to the collision tree shape.
+// *NewtonSerialize* serializeFunction - pointer to the event function that will do the serialization.
+// *void* *serializeHandle - user data that will be passed to the *NewtonSerialize* callback.
+//
+// Return: Nothing.
+//
+// Remarks: Small and medium collision shapes like *TreeCollision* (under 50000 polygons) small convex hulls or compude collision can be constructed at application
+// startup without significant processing overhead.
+//
+//
+// See also: NewtonCollisionGetInfo
+void NewtonCollisionSerialize(const NewtonWorld *const newtonWorld,
+ const NewtonCollision *const collision, NewtonSerialize serializeFunction,
+ void *const serializeHandle) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+ world->Serialize((dgCollision *)collision, (dgSerialize)serializeFunction,
+ serializeHandle);
+}
+
+// Name: NewtonCreateCollisionFromSerialization
+// Create a collision shape via a serialization function.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *NewtonTreeCollisionCallback *userCallback - pointer to an event function to call before Newton is begins collecting polygons that are colliding with a body. This parameter can be NULL.
+// *NewtonSerialize* callback - pointer to the callback function that will handle the serialization.
+// *void* *userData - user data that will be passed as the argument to *NewtonSerialize* callback.
+//
+// Return: Nothing.
+//
+// Remarks: this function is useful to to load collision primitive for and archive file. In the case of complex shapes like convex hull and compound collision the
+// it save a significant amount of construction time.
+//
+// Remarks: if this function is called to load a serialized tree collision, the tree collision will be loaded, but the function pointer callback will be set to NULL.
+// for this operation see function *NewtonCreateTreeCollisionFromSerialization*
+//
+// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCollisionSerialize, NewtonCollisionGetInfo
+NewtonCollision *NewtonCreateCollisionFromSerialization(
+ const NewtonWorld *const newtonWorld, NewtonDeserialize deserializeFunction,
+ void *const serializeHandle) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+ return (NewtonCollision *)world->CreateFromSerialization(
+ (dgDeserialize)deserializeFunction, serializeHandle);
+}
+
+/*
+ // Name: NewtonCreateTreeCollisionFromSerialization
+ // Create a tree collision and load the polygon mesh via a serialization function.
+ //
+ // Parameters:
+ // *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+ // *NewtonTreeCollisionCallback *userCallback - pointer to an event function to call before Newton is begins collecting polygons that are colliding with a body. This parameter can be NULL.
+ // *NewtonSerialize* callback - pointer to the callback function that will handle the serialization.
+ // *void* *userData - user data that will be passed as the argument to *NewtonSerialize* callback.
+ //
+ // Return: Nothing.
+ //
+ // Remarks: if this function is call on a non tree collision, the results are unpredictable.
+ //
+ // Remarks: Small and medium size *TreeCollision* objects (under 50000 polygons) can be constructed at application startup without significant processing overhead.
+ // However, for very large polygons sets (over 50000 polygons) it is recommended that the application use *NewtonCreateTreeCollision*
+ // in an off-line tool. Then the application can call this function to store the *TreeCollision* to a file or
+ // any file packer system the application is using. At run time the application can use the function *NewtonCreateTreeCollisionFromSerialization*
+ // to create and load a pre-made *TreeCollision*
+ //
+ // See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCollisionSerialize, NewtonCollisionGetInfo
+ NewtonCollision* NewtonCreateTreeCollisionFromSerialization(const NewtonWorld* const newtonWorld, NewtonTreeCollisionCallback userCallback, NewtonDeserialize deserializeFunction, void* const serializeHandle)
+ {
+ Newton* world;
+ dgCollision* collision;
+ NewtonCollisionTree *dataBase;
+
+ world = (Newton *)newtonWorld;
+
+ dataBase = new NewtonCollisionTree (world, userCallback);
+ dataBase->Deserialize (deserializeFunction, serializeHandle);
+
+ dgVector p0;
+ dgVector p1;
+
+ dataBase->GetAABB (p0, p1);
+
+ world = (Newton *)newtonWorld;
+
+ collision = world->CreatePolygonSoup (dataBase,
+ NewtonCollisionTree::GetIntersectingPolygons,
+ NewtonCollisionTree::RayHit,
+ NewtonCollisionTree::Destroy, NULL, NULL);
+
+ collision->SetCollisionBBox(p0, p1);
+ return (NewtonCollision*)collision;
+ }
+ */
+
+// Name: NewtonCollisionGetInfo
+// Get creation parameters for this collision objects.
+//
+// Parameters:
+// *const NewtonCollision* collision - is the pointer to a convex collision primitive.
+// *NewtonCollisionInfoRecord* *collisionInfo - pointer to a collision information record.
+//
+// Remarks: This function can be used by the application for writing file format and for serialization.
+//
+// See also: NewtonCollisionGetInfo, NewtonCollisionSerialize
+void NewtonCollisionGetInfo(const NewtonCollision *const collision,
+ NewtonCollisionInfoRecord *const collisionInfo) {
+ dgCollision *coll;
+ coll = (dgCollision *)collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ _ASSERTE(sizeof(dgCollisionInfo) <= sizeof(NewtonCollisionInfoRecord));
+ coll->GetCollisionInfo((dgCollisionInfo *)collisionInfo);
+}
+
+// **********************************************************************************************
+//
+// Name: Transform utility functions
+//
+// **********************************************************************************************
+
+// Name: NewtonGetEulerAngle
+// Get the three Euler angles from a 4x4 rotation matrix arranged in row-major order.
+//
+// Parameters:
+// *const dFloat* matrix - pointer to the 4x4 rotation matrix.
+// *dFloat* angles - pointer to an array of at least three floats to hold the Euler angles.
+//
+// Return: Nothing.
+//
+// Remarks: The motivation for this function is that many graphics engines still use Euler angles to represent the orientation
+// of graphics entities.
+// The angles are expressed in radians and represent:
+// *angle[0]* - rotation about first matrix row
+// *angle[1]* - rotation about second matrix row
+// *angle[2]* - rotation about third matrix row
+//
+// See also: NewtonSetEulerAngle
+void NewtonGetEulerAngle(const dFloat *const matrix, dFloat *const angles) {
+ const dgMatrix &mat = *((dgMatrix *)matrix);
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector eulers(mat.CalcPitchYawRoll());
+ angles[0] = eulers.m_x;
+ angles[1] = eulers.m_y;
+ angles[2] = eulers.m_z;
+}
+
+// Name: NewtonSetEulerAngle
+// Build a rotation matrix from the Euler angles in radians.
+//
+// Parameters:
+// *dFloat* matrix - pointer to the 4x4 rotation matrix.
+// *const dFloat* angles - pointer to an array of at least three floats to hold the Euler angles.
+//
+// Return: Nothing.
+//
+// Remarks: The motivation for this function is that many graphics engines still use Euler angles to represent the orientation
+// of graphics entities.
+// The angles are expressed in radians and represent:
+// *angle[0]* - rotation about first matrix row
+// *angle[1]* - rotation about second matrix row
+// *angle[2]* - rotation about third matrix row
+//
+// See also: NewtonGetEulerAngle
+void NewtonSetEulerAngle(const dFloat *const angles, dFloat *const matrix) {
+ dgInt32 i;
+ dgInt32 j;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgMatrix mat(
+ dgPitchMatrix(angles[0]) * dgYawMatrix(angles[1]) * dgRollMatrix(angles[2]));
+ dgMatrix &retMatrix = *((dgMatrix *)matrix);
+
+ retMatrix[3][3] = dgFloat32(1.0f);
+ for (i = 0; i < 3; i++) {
+ retMatrix[3][i] = 0.0f;
+ for (j = 0; j < 4; j++) {
+ retMatrix[i][j] = mat[i][j];
+ }
+ }
+}
+
+// Name: NewtonCalculateSpringDamperAcceleration
+// Calculates the acceleration to satisfy the specified the spring damper system.
+//
+// Parameters:
+// *dFloat* dt - integration time step.
+// *dFloat* ks - spring stiffness, it must be a positive value.
+// *dFloat* x - spring position.
+// *dFloat* kd - desired spring damper, it must be a positive value.
+// *dFloat* s - spring velocity.
+//
+// return: the spring acceleration.
+//
+// Remark: the acceleration calculated by this function represent the mass, spring system of the form
+// a = -ks * x - kd * v.
+dFloat NewtonCalculateSpringDamperAcceleration(dFloat dt, dFloat ks, dFloat x,
+ dFloat kd, dFloat s) {
+ dFloat accel;
+ // accel = - (ks * x + kd * s);
+
+ TRACE_FUNTION(__FUNCTION__);
+ // at = [- ks (x2 - x1) - kd * (v2 - v1) - dt * ks * (v2 - v1)] / [1 + dt * kd + dt * dt * ks]
+ dgFloat32 ksd = dt * ks;
+ dgFloat32 num = ks * x + kd * s + ksd * s;
+ dgFloat32 den = dgFloat32(1.0f) + dt * kd + dt * ksd;
+ _ASSERTE(den > 0.0f);
+ accel = -num / den;
+ // dgCheckFloat (accel);
+ return accel;
+}
+
+// **********************************************************************************************
+//
+// Name: Rigid body interface
+//
+// **********************************************************************************************
+
+// Name: NewtonCreateBody
+// Create a rigid body.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const NewtonCollision* *collisionPtr - pointer to the collision object.
+//
+// Return: Pointer to the rigid body.
+//
+// Remarks: This function creates a Newton rigid body and assigns a *collisionPtr* as the collision geometry representing the rigid body.
+// This function increments the reference count of the collision geometry.
+// All event functions are set to NULL and the material gruopID of the body is set to the default GroupID.
+//
+// See also: NewtonDestroyBody
+NewtonBody *NewtonCreateBody(const NewtonWorld *const newtonWorld,
+ const NewtonCollision *const collisionPtr, const dFloat *const matrixPtr) {
+
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+ dgCollision *const collision = (dgCollision *)collisionPtr;
+
+#ifdef SAVE_COLLISION
+ SaveCollision(collisionPtr);
+#endif
+
+ dgMatrix matrix(*((dgMatrix *)matrixPtr));
+#ifdef _DEBUG
+ // matrix.m_front = matrix.m_front.Scale (dgRsqrt (matrix.m_front % matrix.m_front));
+ // matrix.m_right = matrix.m_front * matrix.m_up;
+ // matrix.m_right = matrix.m_right.Scale (dgRsqrt (matrix.m_right % matrix.m_right));
+ // matrix.m_up = matrix.m_right * matrix.m_front;
+#endif
+
+ matrix.m_front.m_w = dgFloat32(0.0f);
+ matrix.m_up.m_w = dgFloat32(0.0f);
+ matrix.m_right.m_w = dgFloat32(0.0f);
+ matrix.m_posit.m_w = dgFloat32(1.0f);
+
+ return (NewtonBody *)world->CreateBody(collision, matrix);
+}
+
+// Name: NewtonDestroyBody
+// Destroy a rigid body.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const NewtonBody* *bodyPtr - pointer to the body to be destroyed.
+//
+// Return: Nothing.
+//
+// Remarks: If this function is called from inside a simulation step the destruction of the body will be delayed until end of the time step.
+// This function will decrease the reference count of the collision geometry by one. If the reference count reaches zero, then the collision
+// geometry will be destroyed. This function will destroy all joints associated with this body.
+//
+// See also: NewtonCreateBody
+void NewtonDestroyBody(const NewtonWorld *const newtonWorld,
+ const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body = (dgBody *)bodyPtr;
+ world = (Newton *)newtonWorld;
+ world->DestroyBody(body);
+}
+
+// Name: NewtonBodySetUserData
+// Store a user defined data value with the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *void* *userDataPtr - pointer to the user defined user data value.
+//
+// Return: Nothing.
+//
+// Remarks: The application can store a user defined value with the Body. This value can be the pointer to a structure containing some application data for special effect.
+// if the application allocate some resource to store the user data, the application can register a joint destructor to get rid of the allocated resource when the body is destroyed
+//
+// See also: NewtonBodyGetUserData, NewtonBodySetDestructorCallback
+void NewtonBodySetUserData(const NewtonBody *const bodyPtr,
+ void *const userDataPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body->SetUserData(userDataPtr);
+}
+
+// Name: NewtonBodyGetUserData
+// Retrieve a user defined data value stored with the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+//
+// Return: The user defined data.
+//
+// Remarks: The application can store a user defined value with a rigid body. This value can be the pointer
+// to a structure which is the graphical representation of the rigid body.
+//
+// See also: NewtonBodySetUserData
+void *NewtonBodyGetUserData(const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return body->GetUserData();
+}
+
+// Name: NewtonBodyGetWorld
+// Retrieve get the pointer to the world from the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+//
+// Return: the world that own this body.
+//
+// Remarks: The application can use this function to determine what world own this body. If the application
+// have to get the world from a joint, it can do so by getting one of the bodies attached to the joint and getting the world from
+// that body.
+//
+NewtonWorld *NewtonBodyGetWorld(const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return (NewtonWorld *)body->GetWorld();
+}
+
+// Name: NewtonBodySetTransformCallback
+// Assign a transformation event function to the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *NewtonSetTransform callback - pointer to a function callback in used to update the transformation matrix of the visual object that represents the rigid body.
+//
+// Return: Nothing.
+//
+// Remarks: The function *NewtonSetTransform callback* is called by the Newton engine every time a visual object that represents the rigid body has changed.
+// The application can obtain the pointer user data value that points to the visual object.
+// The Newton engine does not call the *NewtonSetTransform callback* function for bodies that are inactive or have reached a state of stable equilibrium.
+//
+// Remarks: The matrix should be organized in row-major order (this is the way directX and OpenGL stores matrices).
+//
+// See also: NewtonBodyGetUserData, NewtonBodyGetUserData
+void NewtonBodySetTransformCallback(const NewtonBody *const bodyPtr,
+ NewtonSetTransform callback) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body->SetMatrixUpdateCallback((OnMatrixUpdateCallback)callback);
+}
+
+// Name: NewtonBodyGetTransformCallback
+// Assign a transformation event function to the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *NewtonSetTransform callback - pointer to a function callback in used to update the transformation matrix of the visual object that represents the rigid body.
+//
+// Return: Nothing.
+//
+// Remarks: The function *NewtonSetTransform callback* is called by the Newton engine every time a visual object that represents the rigid body has changed.
+// The application can obtain the pointer user data value that points to the visual object.
+// The Newton engine does not call the *NewtonSetTransform callback* function for bodies that are inactive or have reached a state of stable equilibrium.
+//
+// Remarks: The matrix should be organized in row-major order (this is the way directX and OpenGL stores matrices).
+//
+// See also: NewtonBodyGetUserData, NewtonBodyGetUserData
+NewtonSetTransform NewtonBodyGetTransformCallback(
+ const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return (NewtonSetTransform)body->GetMatrixUpdateCallback();
+}
+
+// Name: NewtonBodySetForceAndTorqueCallback
+// Assign an event function for applying external force and torque to a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *NewtonApplyForceAndTorque callback - pointer to a function callback used to apply force and torque to a rigid body.
+//
+// Return: Nothing.
+//
+// Remarks: Before the *NewtonApplyForceAndTorque callback* is called for a body, Newton first clears the net force and net torque for the body.
+//
+// Remarks: The function *NewtonApplyForceAndTorque callback* is called by the Newton Engine every time an active body is going to be simulated.
+// The Newton Engine does not call the *NewtonApplyForceAndTorque callback* function for bodies that are inactive or have reached a state of stable equilibrium.
+//
+// See also: NewtonBodyGetUserData, NewtonBodyGetUserData, NewtonBodyGetForceAndTorqueCallback
+void NewtonBodySetForceAndTorqueCallback(const NewtonBody *const bodyPtr,
+ NewtonApplyForceAndTorque callback) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body->SetExtForceAndTorqueCallback((OnApplyExtForceAndTorque)callback);
+}
+
+// Name: NewtonBodyGetForceAndTorqueCallback
+// Return the pointer to the current force and torque call back function.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+//
+// Return: pointer to the force call back.
+//
+// Remarks: This function can be used to concatenate different force calculation components making more modular the
+// design of function components dedicated to apply special effect. For example a body may have a basic force a force that
+// only apply the effect of gravity, but that application can place a region in where there can be a fluid volume, or another gravity field.
+// we this function the application can read the correct function and save into a local variable, and set a new one.
+// this new function will firs call the save function pointer and upon return apply the correct effect.
+// this similar to the concept of virtual methods on objected oriented languages.
+//
+// Remarks: The function *NewtonApplyForceAndTorque callback* is called by the Newton Engine every time an active body is going to be simulated.
+// The Newton Engine does not call the *NewtonApplyForceAndTorque callback* function for bodies that are inactive or have reached a state of stable equilibrium.
+//
+// See also: NewtonBodyGetUserData, NewtonBodyGetUserData, NewtonBodySetForceAndTorqueCallback
+NewtonApplyForceAndTorque NewtonBodyGetForceAndTorqueCallback(
+ const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return (NewtonApplyForceAndTorque)body->GetExtForceAndTorqueCallback();
+}
+
+// Name: NewtonBodySetDestructorCallback
+// Assign an event function to be called when this body is about to be destroyed.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body to be destroyed.
+// *NewtonBodyDestructor* callback - pointer to a function callback.
+//
+// Return: Nothing.
+//
+// Remarks:
+// This function *NewtonBodyDestructor callback* acts like a destruction function in CPP. This function
+// is called when the body and all data joints associated with the body are about to be destroyed.
+// The application could use this function to destroy or release any resource associated with this body.
+// The application should not make reference to this body after this function returns.
+//
+// Remarks:
+// The destruction of a body will destroy all joints associated with the body.
+//
+// See also: NewtonBodyGetUserData, NewtonBodyGetUserData
+void NewtonBodySetDestructorCallback(const NewtonBody *const bodyPtr,
+ NewtonBodyDestructor callback) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body->SetDestructorCallback((OnBodyDestroy)callback);
+}
+
+// Name: NewtonBodySetMassMatrix
+// Set the mass matrix of a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *dFloat* mass - mass value.
+// *dFloat* Ixx - moment of inertia of the first principal axis of inertia of the body.
+// *dFloat* Iyy - moment of inertia of the first principal axis of inertia of the body.
+// *dFloat* Izz - moment of inertia of the first principal axis of inertia of the body.
+//
+// Return: Nothing.
+//
+// Remarks: Newton algorithms have no restriction on the values for the mass, but due to floating point dynamic
+// range (24 bit precision) it is best if the ratio between the heaviest and the lightest body in the scene is limited to 200.
+// There are no special utility functions in Newton to calculate the moment of inertia of common primitives.
+// The application should specify the inertial values, keeping in mind that realistic inertia values are necessary for
+// realistic physics behavior.
+//
+// See also: NewtonConvexCollisionCalculateInertialMatrix, NewtonBodyGetMassMatrix, NewtonBodyGetInvMass
+void NewtonBodySetMassMatrix(const NewtonBody *const bodyPtr, dFloat mass,
+ dFloat Ixx, dFloat Iyy, dFloat Izz) {
+ dgBody *body;
+ dFloat Ixx1;
+ dFloat Iyy1;
+ dFloat Izz1;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ mass = dgAbsf(mass);
+ Ixx = dgAbsf(Ixx);
+ Iyy = dgAbsf(Iyy);
+ Izz = dgAbsf(Izz);
+
+ Ixx1 = ClampValue(Ixx, dgFloat32(0.001f) * mass, dgFloat32(100.0f) * mass);
+ Iyy1 = ClampValue(Iyy, dgFloat32(0.001f) * mass, dgFloat32(100.0f) * mass);
+ Izz1 = ClampValue(Izz, dgFloat32(0.001f) * mass, dgFloat32(100.0f) * mass);
+ if (mass < dgFloat32(1.0e-3f)) {
+ mass = DG_INFINITE_MASS * dgFloat32(1.5f);
+ }
+
+ body->SetMassMatrix(mass, Ixx1, Iyy1, Izz1);
+ body->SetAparentMassMatrix(dgVector(Ixx, Iyy, Izz, mass));
+}
+
+// Name: NewtonBodyGetMassMatrix
+// Get the mass matrix of a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *dFloat* *mass - pointer to a variable that will hold the mass value of the body.
+// *dFloat* *Ixx - pointer to a variable that will hold the moment of inertia of the first principal axis of inertia of the body.
+// *dFloat* *Iyy - pointer to a variable that will hold the moment of inertia of the first principal axis of inertia of the body.
+// *dFloat* *Izz - pointer to a variable that will hold the moment of inertia of the first principal axis of inertia of the body.
+//
+// Return: Nothing.
+//
+// See also: NewtonBodySetMassMatrix, NewtonBodyGetInvMass
+void NewtonBodyGetMassMatrix(const NewtonBody *const bodyPtr,
+ dFloat *const mass, dFloat *const Ixx, dFloat *const Iyy, dFloat *const Izz) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ // dgVector vector (body->GetMass ());
+ dgVector vector(body->GetAparentMass());
+ Ixx[0] = vector.m_x;
+ Iyy[0] = vector.m_y;
+ Izz[0] = vector.m_z;
+ mass[0] = vector.m_w;
+ if (vector.m_w > DG_INFINITE_MASS * 0.5f) {
+ Ixx[0] = 0.0f;
+ Iyy[0] = 0.0f;
+ Izz[0] = 0.0f;
+ mass[0] = 0.0f;
+ }
+}
+
+// Name: NewtonBodyGetInvMass
+// Get the inverse mass matrix of a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *dFloat* *invMass - pointer to a variable that will hold the mass inverse value of the body.
+// *dFloat* *invIxx - pointer to a variable that will hold the moment of inertia inverse of the first principal axis of inertia of the body.
+// *dFloat* *invIyy - pointer to a variable that will hold the moment of inertia inverse of the first principal axis of inertia of the body.
+// *dFloat* *invIzz - pointer to a variable that will hold the moment of inertia inverse of the first principal axis of inertia of the body.
+//
+// Return: Nothing.
+//
+// See also: NewtonBodySetMassMatrix, NewtonBodyGetMassMatrix
+void NewtonBodyGetInvMass(const NewtonBody *const bodyPtr,
+ dFloat *const invMass, dFloat *const invIxx, dFloat *const invIyy,
+ dFloat *const invIzz) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ // dgVector vector (body->GetInvMass ());
+ // invIxx[0] = vector.m_x;
+ // invIyy[0] = vector.m_y;
+ // invIzz[0] = vector.m_z;
+ // invMass[0] = vector.m_w;
+
+ dgVector vector1(body->GetAparentMass());
+ invIxx[0] = dgFloat32(1.0f) / (vector1.m_x + dgFloat32(1.0e-8f));
+ invIyy[0] = dgFloat32(1.0f) / (vector1.m_y + dgFloat32(1.0e-8f));
+ invIzz[0] = dgFloat32(1.0f) / (vector1.m_z + dgFloat32(1.0e-8f));
+ invMass[0] = dgFloat32(1.0f) / (vector1.m_w + dgFloat32(1.0e-8f));
+}
+
+// Name: NewtonBodySetMatrix
+// Set the transformation matrix of a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const dFloat* *matrixPtr - pointer to an array of 16 floats containing the global matrix of the rigid body.
+//
+// Return: Nothing.
+//
+// Remarks: The matrix should be arranged in row-major order.
+// If you are using OpenGL matrices (column-major) you will need to transpose you matrices into a local array, before
+// passing them to Newton.
+//
+// Remarks: That application should make sure the transformation matrix has not scale, otherwise unpredictable result will occur.
+//
+// See also: NewtonBodyGetMatrix
+void NewtonBodySetMatrix(const NewtonBody *const bodyPtr,
+ const dFloat *const matrixPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+ dgMatrix matrix(*((dgMatrix *)matrixPtr));
+
+ TRACE_FUNTION(__FUNCTION__);
+
+#ifdef _DEBUG
+// matrix.m_front = matrix.m_front.Scale (dgRsqrt (matrix.m_front % matrix.m_front));
+// matrix.m_right = matrix.m_front * matrix.m_up;
+// matrix.m_right = matrix.m_right.Scale (dgRsqrt (matrix.m_right % matrix.m_right));
+// matrix.m_up = matrix.m_right * matrix.m_front;
+#endif
+
+ matrix.m_front.m_w = dgFloat32(0.0f);
+ matrix.m_up.m_w = dgFloat32(0.0f);
+ matrix.m_right.m_w = dgFloat32(0.0f);
+ matrix.m_posit.m_w = dgFloat32(1.0f);
+ body->SetMatrixIgnoreSleep(matrix);
+}
+
+// Name: NewtonBodySetMatrixRecursive
+// Apply hierarchical transformation to a body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const dFloat* *matrixPtr - pointer to an array of 16 floats containing the global matrix of the rigid body.
+//
+// Return: Nothing.
+//
+// Remarks: This function applies the transformation matrix to the *body* and also applies the appropriate transformation matrix to
+// set of articulated bodies. If the body is in contact with another body the other body is not transformed.
+//
+// Remarks: this function should not be used to transform set of articulated bodies that are connected to a static body.
+// doing so will result in unpredictables results. Think for example moving a chain attached to a ceiling from one place to another,
+// to do that in real life a person first need to disconnect the chain (destroy the joint), move the chain (apply the transformation to the
+// entire chain), the reconnect it in the new position (recreate the joint again).
+//
+// Remarks: this function will set to zero the linear and angular velocity of all bodies that are part of the set of articulated body array.
+//
+// Remarks: The matrix should be arranged in row-major order (this is the way direct x stores matrices).
+// If you are using OpenGL matrices (column-major) you will need to transpose you matrices into a local array, before
+// passing them to Newton.
+//
+// See also: NewtonBodySetMatrix
+void NewtonBodySetMatrixRecursive(const NewtonBody *const bodyPtr,
+ const dFloat *const matrixPtr) {
+ dgBody *body;
+ Newton *world;
+
+ body = (dgBody *)bodyPtr;
+ world = (Newton *)body->GetWorld();
+ dgMatrix matrix(*((dgMatrix *)matrixPtr));
+
+ world->BodySetMatrix(body, matrix);
+}
+
+// Name: NewtonBodyGetMatrix
+// Get the transformation matrix of a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const dFloat* *matrixPtr - pointer to an array of 16 floats that will hold the global matrix of the rigid body.
+//
+// Return: Nothing.
+//
+// Remarks: The matrix should be arranged in row-major order (this is the way direct x stores matrices).
+// If you are using OpenGL matrices (column-major) you will need to transpose you matrices into a local array, before
+// passing them to Newton.
+//
+// See also: NewtonBodySetMatrix, NewtonBodyGetRotation
+void NewtonBodyGetMatrix(const NewtonBody *const bodyPtr,
+ dFloat *const matrixPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgMatrix &matrix = *((dgMatrix *)matrixPtr);
+ matrix = body->GetMatrix();
+}
+
+// Name: NewtonBodyGetRotation
+// Get the rotation part of the transformation matrix of a body, in form of a unit quaternion.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const dFloat* *rotPtr - pointer to an array of 4 floats that will hold the global rotation of the rigid body.
+//
+// Return: Nothing.
+//
+// Remarks: The rotation matrix is written set in the form of a unit quaternion in the format Rot (q0, q1, q1, q3)
+//
+// Remarks: The rotation quaternion is the same as what the application would get by using at function to extract a quaternion form a matrix.
+// however since the rigid body already contained the rotation in it, it is more efficient to just call this function avoiding expensive conversion.
+//
+// Remarks: this function could be very useful for the implementation of pseudo frame rate independent simulation.
+// by running the simulation at a fix rate and using linear interpolation between the last two simulation frames.
+// to determine the exact fraction of the render step.
+//
+// See also: NewtonBodySetMatrix, NewtonBodyGetMatrix
+void NewtonBodyGetRotation(const NewtonBody *const bodyPtr, dFloat *rotPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgQuaternion &rot = *((dgQuaternion *)rotPtr);
+ rot = body->GetRotation();
+}
+
+// Name: NewtonBodySetForce
+// Set the net force applied to a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const dFloat* *vectorPtr - pointer to an array of 3 floats containing the net force to be applied to the body.
+//
+// Return: Nothing.
+//
+// Remarks: This function is only effective when called from *NewtonApplyForceAndTorque callback*
+//
+// See also: NewtonBodyAddForce, NewtonBodyGetForce, NewtonBodyGetForceAcc
+void NewtonBodySetForce(const NewtonBody *const bodyPtr,
+ const dFloat *vectorPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector vector(vectorPtr[0], vectorPtr[1], vectorPtr[2], dgFloat32(0.0f));
+ body->SetForce(vector);
+}
+
+// Name: NewtonBodyAddForce
+// Add the net force applied to a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body to be destroyed.
+// *const dFloat* *vectorPtr - pointer to an array of 3 floats containing the net force to be applied to the body.
+//
+// Return: Nothing.
+//
+// Remarks: This function is only effective when called from *NewtonApplyForceAndTorque callback*
+//
+// See also: NewtonBodySetForce, NewtonBodyGetForce, NewtonBodyGetForceAcc
+void NewtonBodyAddForce(const NewtonBody *const bodyPtr,
+ const dFloat *const vectorPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector vector(vectorPtr[0], vectorPtr[1], vectorPtr[2], dgFloat32(0.0f));
+
+ body->AddForce(vector);
+}
+
+// Name: NewtonBodyGetForceAcc
+// Get the force applied on the last call to apply force and torque callback.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const dFloat* *vectorPtr - pointer to an array of 3 floats to hold the net force of the body.
+//
+// Remark: this function can be useful to modify force from joint callback
+//
+// Return: Nothing.
+//
+// See also: NewtonBodyAddForce, NewtonBodyGetForce, NewtonBodyGetForce
+void NewtonBodyGetForceAcc(const NewtonBody *const bodyPtr,
+ dFloat *const vectorPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector vector(body->GetForce());
+ vectorPtr[0] = vector.m_x;
+ vectorPtr[1] = vector.m_y;
+ vectorPtr[2] = vector.m_z;
+}
+
+// Name: NewtonBodyGetForce
+// Get the net force applied to a rigid body after the last NewtonUpdate.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const dFloat* *vectorPtr - pointer to an array of 3 floats to hold the net force of the body.
+//
+// Return: Nothing.
+//
+// See also: NewtonBodyAddForce, NewtonBodyGetForce, NewtonBodyGetForceAcc
+void NewtonBodyGetForce(const NewtonBody *const bodyPtr,
+ dFloat *const vectorPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector vector(body->GetNetForce());
+ vectorPtr[0] = vector.m_x;
+ vectorPtr[1] = vector.m_y;
+ vectorPtr[2] = vector.m_z;
+}
+
+// Name: NewtonBodyCalculateInverseDynamicsForce
+// Calculate the next force that net to be applied to the body to archive the desired velocity in the current time step.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *dFloat* timestep - time step that the force will be applyed.
+// *const dFloat* *desiredVeloc - pointer to an array of 3 floats containing the desired velocity.
+// *dFloat* *forceOut - pointer to an array of 3 floats to hold the calculated net force.
+//
+// Remark: this function can be useful when creating object for game play.
+//
+// remark: this treat the body as a point mass and is uses the solver to calculates the net force that need to be applied to the body
+// such that is reach the desired velocity in the net time step.
+// In general the force should be calculated by the expression f = M * (dsiredVeloc - bodyVeloc) / timestep
+// however due to algorithmic optimization and limitations if such equation is used then the solver will generate a different desired velocity.
+//
+// Return: Nothing.
+//
+// See also: NewtonBodySetForce, NewtonBodyAddForce, NewtonBodyGetForce, NewtonBodyGetForceAcc
+void NewtonBodyCalculateInverseDynamicsForce(const NewtonBody *const bodyPtr,
+ dFloat timestep, const dFloat *const desiredVeloc, dFloat *const forceOut) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector veloc(desiredVeloc[0], desiredVeloc[1], desiredVeloc[2],
+ dgFloat32(0.0f));
+
+ dgVector force(body->CalculateInverseDynamicForce(veloc, timestep));
+ forceOut[0] = force[0];
+ forceOut[1] = force[1];
+ forceOut[2] = force[2];
+}
+
+// Name: NewtonBodySetTorque
+// Set the net torque applied to a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const dFloat* *vectorPtr - pointer to an array of 3 floats containing the net torque to be applied to the body.
+//
+// Return: Nothing.
+//
+// Remarks: This function is only effective when called from *NewtonApplyForceAndTorque callback*
+//
+// See also: NewtonBodyAddTorque, NewtonBodyGetTorque, NewtonBodyGetTorqueAcc
+void NewtonBodySetTorque(const NewtonBody *const bodyPtr,
+ const dFloat *const vectorPtr) {
+ dgBody *body;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body = (dgBody *)bodyPtr;
+ dgVector vector(vectorPtr[0], vectorPtr[1], vectorPtr[2], dgFloat32(0.0f));
+ body->SetTorque(vector);
+}
+
+// Name: NewtonBodyAddTorque
+// Add the net torque applied to a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const dFloat* *vectorPtr - pointer to an array of 3 floats containing the net torque to be applied to the body.
+//
+// Return: Nothing.
+//
+// Remarks: This function is only effective when called from *NewtonApplyForceAndTorque callback*
+//
+// See also: NewtonBodySetTorque, NewtonBodyGetTorque, NewtonBodyGetTorqueAcc
+void NewtonBodyAddTorque(const NewtonBody *const bodyPtr,
+ const dFloat *const vectorPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector vector(vectorPtr[0], vectorPtr[1], vectorPtr[2], dgFloat32(0.0f));
+ body->AddTorque(vector);
+}
+
+// Name: NewtonBodyGetTorque
+// Get the net torque applied to a rigid body after the last NewtonUpdate.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const dFloat* *vectorPtr - pointer to an array of 3 floats to hold the net torque of the body.
+//
+// Return: Nothing.
+//
+// See also: NewtonBodyAddTorque, NewtonBodyGetTorque, NewtonBodyGetTorqueAcc
+void NewtonBodyGetTorque(const NewtonBody *const bodyPtr,
+ dFloat *const vectorPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector vector(body->GetNetTorque());
+ vectorPtr[0] = vector.m_x;
+ vectorPtr[1] = vector.m_y;
+ vectorPtr[2] = vector.m_z;
+}
+
+// Name: NewtonBodyGetTorqueAcc
+// Get the torque applied on the last call to apply force and torque callback.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const dFloat* *vectorPtr - pointer to an array of 3 floats to hold the net force of the body.
+//
+// Remark: this function can be useful to modify torque form joint callback
+//
+// Return: Nothing.
+//
+// See also: NewtonBodyAddTorque, NewtonBodyGetTorque, NewtonBodyGetTorque
+void NewtonBodyGetTorqueAcc(const NewtonBody *const bodyPtr,
+ dFloat *const vectorPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector vector(body->GetTorque());
+ vectorPtr[0] = vector.m_x;
+ vectorPtr[1] = vector.m_y;
+ vectorPtr[2] = vector.m_z;
+}
+
+// Name: NewtonBodySetCentreOfMass
+// Set the relative position of the center of mass of a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const dFloat* *comPtr - pointer to an array of 3 floats containing the relative offset of the center of mass of the body.
+//
+// Return: Nothing.
+//
+// Remarks: This function can be used to set the relative offset of the center of mass of a rigid body.
+// when a rigid body is created the center of mass is set the the point c(0, 0, 0), and normally this is
+// the best setting for a rigid body. However the are situations in which and object does not have symmetry or
+// simple some kind of special effect is desired, and this origin need to be changed.
+//
+// Remarks: Care must be taken when offsetting the center of mass of a body.
+// The application must make sure that the external torques resulting from forces applied at at point
+// relative to the center of mass are calculated appropriately.
+// this could be done Transform and Torque callback function as the follow pseudo code fragment shows:
+//
+// Matrix matrix;
+// Vector center;
+//
+// NewtonGatMetrix(body, matrix)
+// NewtonGetCentreOfMass(body, center);
+//
+// for global space torque.
+// Vector localForce (fx, fy, fz);
+// Vector localPosition (x, y, z);
+// Vector localTroque (crossproduct ((localPosition - center). localForce);
+// Vector globalTroque (matrix.RotateVector (localTroque));
+//
+// for global space torque.
+// Vector globalCentre (matrix.TranformVector (center));
+// Vector globalPosition (x, y, z);
+// Vector globalForce (fx, fy, fz);
+// Vector globalTroque (crossproduct ((globalPosition - globalCentre). globalForce);
+//
+// See also: NewtonConvexCollisionCalculateInertialMatrix, NewtonBodyGetCentreOfMass
+void NewtonBodySetCentreOfMass(const NewtonBody *const bodyPtr,
+ const dFloat *const comPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector vector(comPtr[0], comPtr[1], comPtr[2], dgFloat32(1.0f));
+ body->SetCentreOfMass(vector);
+}
+
+// Name: NewtonBodyGetCentreOfMass
+// Get the relative position of the center of mass of a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *dFloat* *comPtr - pointer to an array of 3 floats to hold the relative offset of the center of mass of the body.
+//
+// Return: Nothing.
+//
+// Remarks: This function can be used to set the relative offset of the center of mass of a rigid body.
+// when a rigid body is created the center of mass is set the the point c(0, 0, 0), and normally this is
+// the best setting for a rigid body. However the are situations in which and object does not have symmetry or
+// simple some kind of special effect is desired, and this origin need to be changed.
+//
+// Remarks: This function can be used in conjunction with *NewtonConvexCollisionCalculateInertialMatrix*
+//
+// See also: NewtonConvexCollisionCalculateInertialMatrix, NewtonBodySetCentreOfMass
+void NewtonBodyGetCentreOfMass(const NewtonBody *const bodyPtr,
+ dFloat *const comPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector vector(body->GetCentreOfMass());
+ comPtr[0] = vector.m_x;
+ comPtr[1] = vector.m_y;
+ comPtr[2] = vector.m_z;
+}
+
+// Name: NewtonBodyGetFirstJoint
+// Return a pointer to the first joint attached to this rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+//
+// Return: Joint if at least one is attached to the body, NULL if not joint is attached
+//
+// Remarks: this function will only return the pointer to user defined joints, older build in constraints will be skipped by this function.
+//
+// Remark: this function can be used to implement recursive walk of complex articulated arrangement of rodid bodies.
+//
+// See also: NewtonBodyGetNextJoint
+NewtonJoint *NewtonBodyGetFirstJoint(const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return (NewtonJoint *)body->GetFirstJoint();
+}
+
+// Name: NewtonBodyGetNextJoint
+// Return a pointer to the next joint attached to this body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const NewtonJoint* *joint - pointer to current joint.
+//
+// Return: Joint is at least one joint is attached to the body, NULL if not joint is attached
+//
+// Remarks: this function will only return the pointer to User defined joint, older build in constraints will be skipped by this function.
+//
+// Remark: this function can be used to implement recursive walk of complex articulated arrangement of rodid bodies.
+//
+// See also: NewtonBodyGetFirstJoint
+NewtonJoint *NewtonBodyGetNextJoint(const NewtonBody *const bodyPtr,
+ const NewtonJoint *const jointPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return (NewtonJoint *)body->GetNextJoint((dgConstraint *)jointPtr);
+}
+
+// Name: NewtonBodyGetFirstContactJoint
+// Return a pointer to the first contact joint attached to this rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+//
+// Return: Contact if the body is colliding with anther body, NULL otherwise
+//
+// See also: NewtonBodyGetNextContactJoint, NewtonContactJointGetFirstContact, NewtonContactJointGetNextContact, NewtonContactJointRemoveContact
+NewtonJoint *NewtonBodyGetFirstContactJoint(const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return (NewtonJoint *)body->GetFirstContact();
+}
+
+// Name: NewtonBodyGetNextContactJoint
+// Return a pointer to the next contactjoint attached to this rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const NewtonJoint* *contactJoint - pointer to corrent contact joint.
+//
+// Return: Contact if the body is colliding with anther body, NULL otherwise
+//
+// See also: NewtonBodyGetFirstContactJoint, NewtonContactJointGetFirstContact, NewtonContactJointGetNextContact, NewtonContactJointRemoveContact
+NewtonJoint *NewtonBodyGetNextContactJoint(const NewtonBody *const bodyPtr,
+ const NewtonJoint *const contactPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return (NewtonJoint *)body->GetNextContact((dgConstraint *)contactPtr);
+}
+
+// Name: NewtonContactJointGetContactCount
+// Return to number of contact int thsi contact joint.
+//
+// Parameters:
+// *const NewtonJoint* *contactJoint - pointer to corrent contact joint.
+//
+// Return: numbet of contacts.
+//
+// See also: NewtonContactJointGetFirstContact, NewtonContactJointGetNextContact, NewtonContactJointRemoveContact
+int NewtonContactJointGetContactCount(const NewtonJoint *const contactJoint) {
+ dgContact *joint;
+ joint = (dgContact *)contactJoint;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ if ((joint->GetId() == dgContactConstraintId) && joint->GetCount()) {
+ return joint->GetCount();
+ } else {
+ return 0;
+ }
+}
+
+// Name: NewtonContactJointGetFirstContact
+// Return to the next contact from the cantact array of the contact joint.
+//
+// Parameters:
+// *const NewtonJoint* *contactJoint - pointer to corrent contact joint.
+//
+// Return: first contact contact array of the joint contact exist, NULL otherwise
+//
+// See also: NewtonContactJointGetNextContact, NewtonContactGetMaterial, NewtonContactJointRemoveContact
+void *NewtonContactJointGetFirstContact(const NewtonJoint *const contactJoint) {
+ dgContact *joint;
+ joint = (dgContact *)contactJoint;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ if ((joint->GetId() == dgContactConstraintId) && joint->GetCount()) {
+ return joint->GetFirst();
+ } else {
+ return NULL;
+ }
+}
+
+// Name: NewtonContactJointGetNextContact
+// Return to the first contact fromm the cantact array of the contact joint.
+//
+// Parameters:
+// *const NewtonJoint* *contactJoint - pointer to corrent contact joint.
+// *void* *contact - pointer to current contact.
+//
+// Return: a handle to the next contact contact in the contact array if contact exist, NULL otherwise.
+//
+// See also: NewtonContactJointGetFirstContact, NewtonContactGetMaterial, NewtonContactJointRemoveContact
+void *NewtonContactJointGetNextContact(const NewtonJoint *const contactJoint,
+ void *const contact) {
+ dgContact *joint;
+ joint = (dgContact *)contactJoint;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ if ((joint->GetId() == dgContactConstraintId) && joint->GetCount()) {
+ dgList<dgContactMaterial>::dgListNode *node;
+ node = (dgList<dgContactMaterial>::dgListNode *)contact;
+ return node->GetNext();
+ } else {
+ return NULL;
+ }
+}
+
+// Name: NewtonContactJointRemoveContact
+// Return to the next contact from the cantact array of the contact joint.
+//
+// Parameters:
+// *const NewtonJoint* *contactJoint - pointer to corrent contact joint.
+//
+// Return: first contact contact array of the joint contact exist, NULL otherwise
+//
+// See also: NewtonBodyGetFirstContactJoint, NewtonBodyGetNextContactJoint, NewtonContactJointGetFirstContact, NewtonContactJointGetNextContact
+void NewtonContactJointRemoveContact(const NewtonJoint *const contactJoint,
+ void *const contact) {
+ dgContact *joint;
+ joint = (dgContact *)contactJoint;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ if ((joint->GetId() == dgContactConstraintId) && joint->GetCount()) {
+ dgList<dgContactMaterial>::dgListNode *node;
+ node = (dgList<dgContactMaterial>::dgListNode *)contact;
+ joint->Remove(node);
+ }
+}
+
+// Name: NewtonContactGetMaterial
+// Return to the next contact from the cantact array of the contact joint.
+//
+// Parameters:
+// *const NewtonJoint* *contactJoint - pointer to corrent contact joint.
+//
+// Return: first contact contact array of the joint contact exist, NULL otherwise
+//
+// See also: NewtonContactJointGetFirstContact, NewtonContactJointGetNextContact
+NewtonMaterial *NewtonContactGetMaterial(const void *const contact) {
+ dgList<dgContactMaterial>::dgListNode *node;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ node = (dgList<dgContactMaterial>::dgListNode *)contact;
+ dgContactMaterial &contactMaterial = node->GetInfo();
+ return (NewtonMaterial *)&contactMaterial;
+}
+
+// Name: NewtonBodyAddBuoyancyForce
+// Add buoyancy force and torque for bodies immersed in a fluid.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *dFloat* fluidDensity - fluid density.
+// *dFloat* fluidLinearViscosity - fluid linear viscosity (resistance to linear translation).
+// *dFloat* fluidAngularViscosity - fluid angular viscosity (resistance to rotation).
+// *const dFloat* *gravityVector - pointer to an array of floats containing the gravity vector.
+// *NewtonGetBuoyancyPlane* *buoyancyPlane - pointer to an array of at least 4 floats containing the plane equation of the surface of the fluid. This parameter can be NULL
+//
+// Return: Nothing.
+//
+// Remarks: This function is only effective when called from *NewtonApplyForceAndTorque callback*
+//
+// Remarks: This function adds buoyancy force and torque to a body when it is immersed in a fluid.
+// The force is calculated according to Archimedes� Buoyancy Principle. When the parameter *buoyancyPlane* is set to NULL, the body is considered
+// to completely immersed in the fluid. This can be used to simulate boats and lighter than air vehicles etc..
+//
+// Remarks: If *buoyancyPlane* return 0 buoyancy calculation for this collision primitive is ignored, this could be used to filter buoyancy calculation
+// of compound collision geometry with different IDs.
+//
+// See also: NewtonConvexCollisionCalculateVolume
+void NewtonBodyAddBuoyancyForce(const NewtonBody *const bodyPtr,
+ dFloat fluidDensity, dFloat fluidLinearViscosity,
+ dFloat fluidAngularViscosity, const dFloat *const gravityVector,
+ NewtonGetBuoyancyPlane buoyancyPlane, void *const context) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector gravity(gravityVector[0], gravityVector[1], gravityVector[2],
+ dgFloat32(0.0f));
+ body->AddBuoyancyForce(fluidDensity, fluidLinearViscosity,
+ fluidAngularViscosity, gravity, (GetBuoyancyPlane)buoyancyPlane,
+ context);
+}
+
+// Name: NewtonBodySetCollision
+// Assign a collision primitive to the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *const collisionPtr* *collisionPtr - pointer to the new collision geometry.
+//
+// Return: Nothing.
+//
+// Remarks: This function replaces a collision geometry of a body with the new collision geometry.
+// This function increments the reference count of the collision geometry and decrements the reference count
+// of the old collision geometry. If the reference count of the old collision geometry reaches zero, the old collision geometry is destroyed.
+// This function can be used to swap the collision geometry of bodies at runtime.
+//
+// See also: NewtonCreateBody, NewtonBodyGetCollision
+void NewtonBodySetCollision(const NewtonBody *const bodyPtr,
+ const NewtonCollision *const collisionPtr) {
+ dgBody *body;
+ dgCollision *collision;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body = (dgBody *)bodyPtr;
+ collision = (dgCollision *)collisionPtr;
+ body->AttachCollision(collision);
+}
+
+/*
+ // Name: NewtonBodySetGyroscopicForcesMode
+ // Enable or disable Coriolis and gyroscopic force calculation for this body.
+ //
+ // Parameters:
+ // *const NewtonBody* *bodyPtr - pointer to the body.
+ // *int* mode - force mode zero indicate not gyroscopic force calculation.
+ //
+ // Return: Nothing.
+ //
+ // Remarks: Gyroscopic forces internal forces generated as a result of an asymmetric tensor. They are a pure mathematical consequence that the physics have to comply in order to agree with the math. As Gyroscopic forces are not real forces but the result of net unbalance of the changing inertia tensor or a rigid body when its angular velocity is measured on a reference frame different than the body�s own.
+ // Gyroscopic forces are extremely non linear by nature, therefore a first order implicit integrator will have a extremely hard time at dealing with this kind of forces, however because the fact that they are not real forces they do not make much difference in the outcome of the integration.
+ // Fortunately due to the fact that the magnitude of gyroscopic forces is proportional to the unbalance of the inertia tensor, it is possible to disregard the effect of this forces by assuming their inertial tensor is symmetric for the purpose of this calculation. For most cases an ordinary person is not capable to distinguish the motion of a body subject to gyroscopic forces and one that is not, especially when the motion is constrained.
+ // Because of this fact gyroscopic force are turned off by default in Newton, however there are cases when the desire effect is precisely to simulate these forces like a spinning top, or the design of a space navigational system, etc. The most important feature of gyroscopic forces is that they make the rigid body to process.
+ void NewtonBodySetGyroscopicForcesMode(const NewtonBody* const bodyPtr, int mode)
+ {
+ dgBody *body;
+
+ body = (dgBody *)bodyPtr;
+ body->SetGyroscopicTorqueMode (mode ? true : false);
+ }
+
+
+ // Name: NewtonBodyGetGyroscopicForcesMode
+ // get a values indicating if Coriolis and gyroscopic force calculation for this body are enable.
+ //
+ // Parameters:
+ // *const NewtonBody* *bodyPtr - pointer to the body.
+ //
+ // Return: force mode 1 means Gyro copy force are on.
+ //
+ // Remarks: Gyroscopic forces are internal forces generated as a result of an asymmetric tensor. They are a pure mathematical consequence that the physics have to comply in order to agree with the math. As Gyroscopic forces are not real forces but the result of net unbalance of the changing inertia tensor or a rigid body when its angular velocity is measured on a reference frame different than the body�s own.
+ // Gyroscopic forces are extremely non linear by nature, therefore a first order implicit integrator will have a extremely hard time at dealing with this kind of forces, however because the fact that they are not real forces they do not make much difference in the outcome of the integration.
+ // Fortunately due to the fact that the magnitude of gyroscopic forces is proportional to the unbalance of the inertia tensor, it is possible to disregard the effect of this forces by assuming their inertial tensor is symmetric for the purpose of this calculation. For most cases an ordinary person is not capable to distinguish the motion of a body subject to gyroscopic forces and one that is not, especially when the motion is constrained.
+ // Because of this fact gyroscopic force are turned off by default in Newton, however there are cases when the desire effect is precisely to simulate these forces like a spinning top, or the design of a space navigational system, etc. The most important feature of gyroscopic forces is that they make the rigid body to process.
+ int NewtonBodyGetGyroscopicForcesMode(const NewtonBody* const bodyPtr)
+ {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+ return body->GetGyroscopicTorqueMode () ? 1 : 0;
+ }
+ */
+
+// Name: NewtonBodyGetCollision
+// Get the collision primitive of a body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+//
+// Return: Pointer to body collision geometry.
+//
+// Remarks: This function does not increment the reference count of the collision geometry.
+//
+// See also: NewtonCreateBody, NewtonBodySetCollision
+NewtonCollision *NewtonBodyGetCollision(const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return (NewtonCollision *)body->GetCollision();
+}
+
+// Name: NewtonBodySetMaterialGroupID
+// Assign a material group id to the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *int* id - id of a previously created material group.
+//
+// Return: Nothing.
+//
+// Remarks: When the application creates a body, the default material group, *defaultGroupId*, is applied by default.
+//
+// See also: NewtonBodyGetMaterialGroupID, NewtonMaterialCreateGroupID, NewtonMaterialGetDefaultGroupID
+void NewtonBodySetMaterialGroupID(const NewtonBody *const bodyPtr, int id) {
+ dgBody *const body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body->SetGroupID(dgUnsigned32(id));
+}
+
+// Name: NewtonBodyGetMaterialGroupID
+// Get the material group id of the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *int* id - id of a previously created material group.
+//
+// Return: Nothing.
+//
+// See also: NewtonBodySetMaterialGroupID
+int NewtonBodyGetMaterialGroupID(const NewtonBody *const bodyPtr) {
+ dgBody *const body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return int(body->GetGroupID());
+}
+
+// Name: NewtonBodySetContinuousCollisionMode
+// Set the continuous collision state mode for this rigid body.
+// continue collision flag is off by default in when bodies are created.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *int* state - collision state. 1 indicates this body may tunnel through other objects while moving at high speed. 0 ignore high speed collision checks.
+//
+// Return: Nothing.
+//
+// Remarks: continue collision mode enable allow the engine to predict colliding contact on rigid bodies
+// Moving at high speed of subject to strong forces.
+//
+// Remarks: continue collision mode does not prevent rigid bodies from inter penetration instead it prevent bodies from
+// passing trough each others by extrapolating contact points when the bodies normal contact calculation determine the bodies are not colliding.
+//
+// Remarks: for performance reason the bodies angular velocities is only use on the broad face of the collision,
+// but not on the contact calculation.
+//
+// Remarks: continue collision does not perform back tracking to determine time of contact, instead it extrapolate contact by incrementally
+// extruding the collision geometries of the two colliding bodies along the linear velocity of the bodies during the time step,
+// if during the extrusion colliding contact are found, a collision is declared and the normal contact resolution is called.
+//
+// Remarks: for continue collision to be active the continue collision mode must on the material pair of the colliding bodies as well as on at least one of the two colliding bodies.
+//
+// Remarks: Because there is penalty of about 40% to 80% depending of the shape complexity of the collision geometry, this feature is set
+// off by default. It is the job of the application to determine what bodies need this feature on. Good guidelines are: very small objects,
+// and bodies that move a height speed.
+//
+// See also: NewtonBodyGetContinuousCollisionMode, NewtonBodySetContinuousCollisionMode
+void NewtonBodySetContinuousCollisionMode(const NewtonBody *const bodyPtr,
+ unsigned state) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body->SetContinuesCollisionMode(state ? true : false);
+}
+
+// Name: NewtonBodyGetContinuousCollisionMode
+// Get the continuous collision state mode for this rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+//
+// Return: Nothing.
+//
+// Remarks:
+// Remark: Because there is there is penalty of about 3 to 5 depending of the shape complexity of the collision geometry, this feature is set
+// off by default. It is the job of the application to determine what bodies need this feature on. Good guidelines are: very small objects,
+// and bodies that move a height speed.
+//
+// Remark: this feature is currently disabled:
+//
+// See also: NewtonBodySetContinuousCollisionMode, NewtonBodySetContinuousCollisionMode
+int NewtonBodyGetContinuousCollisionMode(const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return body->GetContinuesCollisionMode() ? 1 : false;
+}
+
+// Name: NewtonBodySetJointRecursiveCollision
+// Set the collision state flag of this body when the body is connected to another body by a hierarchy of joints.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+// *int* state - collision state. 1 indicates this body will collide with any linked body. 0 disable collision with body connected to this one by joints.
+//
+// Return: Nothing.
+//
+// Remarks: sometimes when making complicated arrangements of linked bodies it is possible the collision geometry of these bodies is in the way of the
+// joints work space. This could be a problem for the normal operation of the joints. When this situation happens the application can determine which bodies
+// are the problem and disable collision for those bodies while they are linked by joints. For the collision to be disable for a pair of body,
+// both bodies must have the collision disabled. If the joints connecting the bodies are destroyed these bodies become collidable automatically.
+// This feature can also be achieved by making special material for the whole configuration of jointed bodies, however it is a lot easier just to set collision disable
+// for jointed bodies.
+//
+// See also: NewtonBodySetMaterialGroupID
+void NewtonBodySetJointRecursiveCollision(const NewtonBody *const bodyPtr,
+ unsigned state) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body->SetCollisionWithLinkedBodies(state ? true : false);
+}
+
+// Name: NewtonBodyGetJointRecursiveCollision
+// Get the collision state flag when the body is joint.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - pointer to the body.
+//
+// Return: return the collision state flag for this body.
+//
+// See also: NewtonBodySetMaterialGroupID
+int NewtonBodyGetJointRecursiveCollision(const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return body->GetCollisionWithLinkedBodies() ? 1 : 0;
+}
+
+// Name: NewtonBodyGetFreezeState
+// get the freeze state of this body
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body to be frozen
+//
+// Return: 1 id the bode is frozen, 0 if bode is unfrozen.
+//
+// Remarks: When a body is created it is automatically placed in the active simulation list. As an optimization
+// for large scenes, you may use this function to put background bodies in an inactive equilibrium state.
+//
+// Remarks: This function tells Newton that this body does not currently need to be simulated.
+// However, if the body is part of a larger configuration it may be affected indirectly by the reaction forces
+// of objects that it is connected to.
+//
+// See also: NewtonBodySetAutoSleep, NewtonBodyGetAutoSleep
+int NewtonBodyGetFreezeState(const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return body->GetFreeze() ? 1 : 0;
+}
+
+// Name: NewtonBodySetFreezeState
+// This function tells Newton to simulate or suspend simulation of this body and all other bodies in contact with it
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body to be activated
+// *int* state - 1 teels newton to freeze the bode and allconceted bodiesm, 0 to unfreze it
+//
+// Return: Nothing
+//
+// Remarks: This function to no activate the body, is just lock or unlock the body for physics simulation.
+//
+// See also: NewtonBodyGetFreezeState, NewtonBodySetAutoSleep, NewtonBodyGetAutoSleep
+void NewtonBodySetFreezeState(const NewtonBody *const bodyPtr, int state) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body->SetFreeze(state ? true : false);
+}
+
+// Name: NewtonBodySetAutoSleep
+// Set the auto-activation mode for this body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+// *int* state - active mode: 1 = auto-activation on (controlled by Newton). 0 = auto-activation off and body is active all the time.
+//
+// Return: Nothing.
+//
+// Remarks: Bodies are created with auto-activation on by default.
+//
+// Remarks: Auto activation enabled is the default state for the majority of bodies in a large scene.
+// However, for player control, ai control or some other special circumstance, the application may want to control
+// the activation/deactivation of the body.
+// In that case, the application may call NewtonBodySetAutoSleep (body, 0) followed by
+// NewtonBodySetFreezeState(body), this will make the body active forever.
+//
+// See also: NewtonBodyGetFreezeState, NewtonBodySetFreezeState, NewtonBodyGetAutoSleep, NewtonBodySetFreezeTreshold
+void NewtonBodySetAutoSleep(const NewtonBody *const bodyPtr, int state) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ // body->SetAutoSleep (state ? false : true);
+ body->SetAutoSleep(state ? true : false);
+}
+
+// Name: NewtonBodyGetAutoSleep
+// Get the auto-activation state of the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+//
+// Return: Auto activation state: 1 = auto-activation on. 0 = auto-activation off.
+//
+// See also: NewtonBodySetAutoSleep, NewtonBodyGetSleepState
+int NewtonBodyGetAutoSleep(const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return body->GetAutoSleep() ? 1 : 0;
+}
+
+// Name: NewtonBodyGetSleepState
+// Return the sleep mode of a rigid body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+//
+// Return: Sleep state: 1 = active. 0 = sleeping.
+//
+// See also: NewtonBodySetAutoSleep
+int NewtonBodyGetSleepState(const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+ return body->GetSleepState() ? 1 : 0;
+}
+
+/*
+ // Name: NewtonBodySetFreezeTreshold
+ // Set the minimum values for velocity of a body that will be considered at rest.
+ //
+ // Parameters:
+ // *const NewtonBody* *bodyPtr - is the pointer to the body.
+ // *dFloat* freezeSpeedMag2 - magnitude squared of the velocity threshold.
+ // *dFloat* freezeOmegaMag2 - magnitude squared of angular velocity threshold.
+ // *int* framesCount - number of frames the body velocity and angular will not exceed freezeSpeedMag and freezeOmegaMag.
+ //
+ // Remarks: Ideally, a body should be deactivated when it reaches a state of stable equilibrium. However, because of floating point
+ // inaccuracy, discrete time step simulation and other factors it is virtually impossible for a body to reach that state
+ // in a real-time simulation. Therefore, in the Newton World, a body is considered to be in stable equilibrium when its
+ // velocity and angular velocity fall below some threshold for a consecutive number of frames.
+ //
+ // Remarks: The default and minimum values for the thresholds is 0.01 for speed and 10 for frames count.
+ // These values are tuned for single objects colliding under the influence of gravity. It is possible that for complex configuration
+ // of bodies like multiples pendulums, rag dolls, etc. these values may need to be increased. This is because joints have the property that they
+ // add a small amount of energy to the system in order to reduce the separation error. This may cause the bodies reach a state of unstable
+ // equilibrium. That is, when a body oscillates between two different positions because the energy added to the body is equal to the energy
+ // dissipated by the integrator. This is a situation that is hard to predict, and the best solution is to tweak these values for specific cases.
+ //
+ // See also: NewtonBodySetAutoSleep, NewtonBodyGetFreezeTreshold
+ void NewtonBodySetFreezeTreshold(const NewtonBody* const bodyPtr, dFloat freezeSpeedMag2, dFloat freezeOmegaMag2, int framesCount)
+ {
+ // dFloat alpha;
+ // dFloat accel;
+ dgBody *body;
+
+ body = (dgBody *)bodyPtr;
+ // framesCount = GetMin (framesCount * 2, 30);
+ // alpha = 60.0f * dgSqrt (freezeOmegaMag2) / framesCount;
+ // accel = 60.0f * dgSqrt (freezeSpeedMag2) / framesCount;
+ // body->SetFreezeTreshhold (accel * accel, alpha * alpha, freezeSpeedMag2, freezeOmegaMag2);
+ // dFloat scale;
+ // slace = dgFloat32(1.0f) / (framesCount
+
+ body->SetFreezeTreshhold (freezeSpeedMag2, freezeOmegaMag2, freezeSpeedMag2 * dgFloat32(0.1f), freezeOmegaMag2 * dgFloat32(0.1f));
+ }
+
+ // Name: NewtonBodyGetFreezeTreshold
+ // Get the minimum values for velocity of a body the will be considered at rest.
+ //
+ // Parameters:
+ // *const NewtonBody* *bodyPtr - is the pointer to the body.
+ // *dFloat* freezeSpeedMag2 - point the to a dFloat to hold the velocity threshold
+ // *dFloat* freezeOmegaMag2 - point the to a dFloat to hold the angular velocity threshold
+ //
+ // See also: NewtonBodySetFreezeTreshold
+ void NewtonBodyGetFreezeTreshold(const NewtonBody* const bodyPtr, dFloat* freezeSpeedMag2, dFloat* freezeOmegaMag2)
+ {
+ dgBody *body;
+ dFloat alpha;
+ dFloat accel;
+
+ body = (dgBody *)bodyPtr;
+ body->GetFreezeTreshhold (accel, alpha, *freezeSpeedMag2, *freezeOmegaMag2);
+
+ freezeSpeedMag2[0] *= 10.0f;
+ freezeOmegaMag2[0] *= 10.0f;
+ }
+ */
+
+// Name: NewtonBodyGetAABB
+// Get the world axis aligned bounding box (AABB) of the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+// *dFloat* *p0 - pointer to an array of at least three floats to hold minimum value for the AABB.
+// *dFloat* *p1 - pointer to an array of at least three floats to hold maximum value for the AABB.
+//
+void NewtonBodyGetAABB(const NewtonBody *const bodyPtr, dFloat *const p0,
+ dFloat *const p1) {
+ dgBody *body;
+
+ dgVector vector0;
+ dgVector vector1;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body = (dgBody *)bodyPtr;
+ body->GetAABB(vector0, vector1);
+
+ p0[0] = vector0.m_x;
+ p0[1] = vector0.m_y;
+ p0[2] = vector0.m_z;
+
+ p1[0] = vector1.m_x;
+ p1[1] = vector1.m_y;
+ p1[2] = vector1.m_z;
+}
+
+// Name: NewtonBodySetVelocity
+// Set the global linear velocity of the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+// *const dFloat* *velocity - pointer to an array of at least three floats containing the velocity vector.
+//
+// See also: NewtonBodyGetVelocity
+void NewtonBodySetVelocity(const NewtonBody *const bodyPtr,
+ const dFloat *const velocity) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector vector(velocity[0], velocity[1], velocity[2], dgFloat32(0.0f));
+ body->SetVelocity(vector);
+}
+
+// Name: NewtonBodyGetVelocity
+// Get the global linear velocity of the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+// *const dFloat* *velocity - pointer to an array of at least three floats to hold the velocity vector.
+//
+// See also: NewtonBodySetVelocity
+void NewtonBodyGetVelocity(const NewtonBody *const bodyPtr,
+ dFloat *const velocity) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ // dgVector& vector = *((dgVector*) velocity);
+ // vector = body->GetVelocity();
+
+ dgVector vector(body->GetVelocity());
+ velocity[0] = vector.m_x;
+ velocity[1] = vector.m_y;
+ velocity[2] = vector.m_z;
+}
+
+// Name: NewtonBodySetOmega
+// Set the global angular velocity of the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+// *const dFloat* *omega - pointer to an array of at least three floats containing the angular velocity vector.
+//
+// See also: NewtonBodyGetOmega
+void NewtonBodySetOmega(const NewtonBody *const bodyPtr,
+ const dFloat *const omega) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector vector(omega[0], omega[1], omega[2], dgFloat32(0.0f));
+ body->SetOmega(vector);
+}
+
+// Name: NewtonBodyGetOmega
+// Get the global angular velocity of the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body
+// *dFloat* *omega - pointer to an array of at least three floats to hold the angular velocity vector.
+//
+// See also: NewtonBodySetOmega
+void NewtonBodyGetOmega(const NewtonBody *const bodyPtr, dFloat *const omega) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ // dgVector& vector = *((dgVector*) omega);
+ // vector = body->GetOmega();
+
+ dgVector vector(body->GetOmega());
+ omega[0] = vector.m_x;
+ omega[1] = vector.m_y;
+ omega[2] = vector.m_z;
+}
+
+// Name: NewtonBodySetLinearDamping
+// Apply the linear viscous damping coefficient to the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+// *dFloat* linearDamp - linear damping coefficient.
+//
+// Remarks: the default value of *linearDamp* is clamped to a value between 0.0 and 1.0; the default value is 0.1,
+// There is a non zero implicit attenuation value of 0.0001 assume by the integrator.
+//
+// Remarks: The dampening viscous friction force is added to the external force applied to the body every frame before going to the solver-integrator.
+// This force is proportional to the square of the magnitude of the velocity to the body in the opposite direction of the velocity of the body.
+// An application can set *linearDamp* to zero when the application takes control of the external forces and torque applied to the body, should the application
+// desire to have absolute control of the forces over that body. However, it is recommended that the *linearDamp* coefficient is set to a non-zero
+// value for the majority of background bodies. This saves the application from having to control these forces and also prevents the integrator from
+// adding very large velocities to a body.
+//
+// See also: NewtonBodyGetLinearDamping
+void NewtonBodySetLinearDamping(const NewtonBody *const bodyPtr,
+ dFloat linearDamp) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body->SetLinearDamping(linearDamp);
+}
+
+// Name: NewtonBodyGetLinearDamping
+// Get the linear viscous damping of the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+//
+// Return: The linear damping coefficient.
+//
+// See also: NewtonBodySetLinearDamping
+dFloat NewtonBodyGetLinearDamping(const NewtonBody *const bodyPtr) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return body->GetLinearDamping();
+}
+
+// Name: NewtonBodySetAngularDamping
+// Apply the angular viscous damping coefficient to the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+// *dFloat* *angularDamp - pointer to an array of at least three floats containing the angular damping coefficients for the principal axis of the body.
+//
+// Remarks: the default value of *angularDamp* is clamped to a value between 0.0 and 1.0; the default value is 0.1,
+// There is a non zero implicit attenuation value of 0.0001 assumed by the integrator.
+//
+// Remarks: The dampening viscous friction torque is added to the external torque applied to the body every frame before going to the solver-integrator.
+// This torque is proportional to the square of the magnitude of the angular velocity to the body in the opposite direction of the angular velocity of the body.
+// An application can set *angularDamp* to zero when the to take control of the external forces and torque applied to the body, should the application
+// desire to have absolute control of the forces over that body. However, it is recommended that the *linearDamp* coefficient be set to a non-zero
+// value for the majority of background bodies. This saves the application from needing to control these forces and also prevents the integrator from
+// adding very large velocities to a body.
+//
+// See also: NewtonBodyGetAngularDamping
+void NewtonBodySetAngularDamping(const NewtonBody *const bodyPtr,
+ const dFloat *angularDamp) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector vector(angularDamp[0], angularDamp[1], angularDamp[2],
+ dgFloat32(0.0f));
+ body->SetAngularDamping(vector);
+}
+
+// Name: NewtonBodyGetAngularDamping
+// Get the linear viscous damping of the body.
+//
+// Parameters:
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+// *dFloat* *angularDamp - pointer to an array of at least three floats to hold the angular damping coefficient for the principal axis of the body.
+//
+// See also: NewtonBodySetAngularDamping
+void NewtonBodyGetAngularDamping(const NewtonBody *const bodyPtr,
+ dFloat *angularDamp) {
+ dgBody *body;
+ body = (dgBody *)bodyPtr;
+
+ TRACE_FUNTION(__FUNCTION__);
+ // dgVector& vector = *((dgVector*) angularDamp);
+ // vector = body->GetAngularDamping();
+
+ dgVector vector(body->GetAngularDamping());
+ angularDamp[0] = vector.m_x;
+ angularDamp[1] = vector.m_y;
+ angularDamp[2] = vector.m_z;
+}
+
+/*
+ // Name: NewtonBodyForEachPolygonDo
+ // Iterate thought polygon of the collision geometry of a body calling the function callback.
+ //
+ // Parameters:
+ // *const NewtonBody* *bodyPtr - is the pointer to the body.
+ // *NewtonCollisionIterator* callback - application define callback
+ //
+ // Return: nothing
+ //
+ // Remarks: This function can be called by the application in order to show the collision geometry. The application should provide a pointer to the function *NewtonCollisionIterator*,
+ // Newton will convert the collision geometry into a polygonal mesh, and will call *callback* for every polygon of the mesh
+ //
+ // Remarks: this function affect severely the performance of Newton. The application should call this function only for debugging purpose
+ //
+ // Remarks: This function will ignore user define collision mesh
+ // See also: NewtonWorldGetFirstBody, NewtonWorldForEachBodyInAABBDo, NewtonCollisionForEachPolygonDo
+ void NewtonBodyForEachPolygonDo(const NewtonBody* const bodyPtr, NewtonCollisionIterator callback)
+ {
+ dgBody *body;
+ void *saveCallBack;
+ dgCollision *collision;
+ dgCollisionPolygonalSoup *treeCollision;
+
+ body = (dgBody *) bodyPtr;
+ collision = body->GetCollision();
+ if (collision->IsType (dgCollision::dgCollisionPolygonalSoup_RTTI)) {
+ treeCollision = (dgCollisionPolygonalSoup*) collision;
+ saveCallBack = treeCollision->GetCallBack();
+ if (saveCallBack == NewtonCollisionTree::GetIntersectingPolygons) {
+ treeCollision->SetCallBack ((void*)NewtonCollisionTree::IteratePolygonMesh);
+ collision->DebugCollision (*body, (DebugCollisionMeshCallback) callback);
+ treeCollision->SetCallBack (saveCallBack);
+ }
+ } else {
+ collision->DebugCollision (*body, (DebugCollisionMeshCallback) callback);
+ }
+ }
+ */
+
+// Name: NewtonBodyAddImpulse
+// Add an impulse to a specific point on a body.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - pointer to the Newton world.
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+// *const dFloat* pointDeltaVeloc - pointer to an array of at least three floats containing the desired change in velocity to point pointPosit.
+// *const dFloat* pointPosit - pointer to an array of at least three floats containing the center of the impulse in global space.
+//
+// Return: Nothing.
+//
+// Remarks: This function will activate the body.
+//
+// Remarks: *pointPosit* and *pointDeltaVeloc* must be specified in global space.
+//
+// Remarks: *pointDeltaVeloc* represent a change in velocity. For example, a value of *pointDeltaVeloc* of (1, 0, 0) changes the velocity
+// of *bodyPtr* in such a way that the velocity of point *pointDeltaVeloc* will increase by (1, 0, 0)
+//
+// Remarks: Because *pointDeltaVeloc* represents a change in velocity, this function must be used with care. Repeated calls
+// to this function will result in an increase of the velocity of the body and may cause to integrator to lose stability.
+void NewtonBodyAddImpulse(const NewtonBody *const bodyPtr,
+ const dFloat *const pointDeltaVeloc, const dFloat *const pointPosit) {
+ dgBody *body;
+ dgWorld *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body = (dgBody *)bodyPtr;
+ world = body->GetWorld();
+
+ dgVector p(pointPosit);
+ dgVector v(pointDeltaVeloc);
+
+ world->AddBodyImpulse(body, v, p);
+}
+
+// Name: NewtonBodyAddImpulse
+// Add an train of impulses to a specific point on a body.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - pointer to the Newton world.
+// *const NewtonBody* *bodyPtr - is the pointer to the body.
+// int impulseCount - number of impulses and distances in the array distance
+// int strideInByte - sized in bytes of vector impulse and
+// *const dFloat* impulseArray - pointer to an array containing the desired impulse to apply ate psoition pointarray.
+// *const dFloat* pointArray - pointer to an array of at least three floats containing the center of the impulse in global space.
+//
+// Return: Nothing.
+//
+// Remarks: This function will activate the body.
+//
+// Remarks: *pointPosit* and *pointDeltaVeloc* must be specified in global space.
+//
+//
+// Remarks: this function apply at general impulse to a body a oppose to a desired change on velocity
+// this mean that the body mass, and Inertia will determine the gain on velocity.
+void NewtonBodyApplyImpulseArray(const NewtonBody *const bodyPtr,
+ int impuleCount, int strideInByte, const dFloat *const impulseArray,
+ const dFloat *const pointArray) {
+ dgBody *body;
+ dgWorld *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body = (dgBody *)bodyPtr;
+ world = body->GetWorld();
+
+ world->ApplyImpulseArray(body, impuleCount, strideInByte, impulseArray,
+ pointArray);
+}
+
+// ***************************************************************************************************************
+//
+// Name: Ball and Socket joint interface
+//
+// ***************************************************************************************************************
+
+// Name: NewtonConstraintCreateBall
+// Create a ball an socket joint.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const NewtonCollision* *pivotPoint - is origin of ball and socket in global space.
+// *const NewtonBody* *childBody - is the pointer to the attached rigid body, this body can not be NULL or it can not have an infinity (zero) mass.
+// *const NewtonBody* *parentBody - is the pointer to the parent rigid body, this body can be NULL or any kind of rigid body.
+//
+// Return: Pointer to the ball and socket joint.
+//
+// Remarks: This function creates a ball and socket and add it to the world. By default joint disables collision with the linked bodies.
+NewtonJoint *NewtonConstraintCreateBall(const NewtonWorld *const newtonWorld,
+ const dFloat *pivotPoint, const NewtonBody *const childBody,
+ const NewtonBody *const parentBody) {
+ dgBody *body0;
+ dgBody *body1;
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ body0 = (dgBody *)childBody;
+ body1 = (dgBody *)parentBody;
+ dgVector pivot(pivotPoint[0], pivotPoint[1], pivotPoint[2], dgFloat32(0.0f));
+ return (NewtonJoint *)world->CreateBallConstraint(pivot, body0, body1);
+}
+
+// Name: NewtonBallSetConeLimits
+// Set the ball and socket cone and twist limits.
+//
+// Parameters:
+// *const NewtonJoint* *ball - is the pointer to a ball and socket joint.
+// *const NewtonCollision* *pin - pointer to a unit vector defining the cone axis in global space.
+// *const dFloat* maxConeAngle - max angle in radians the attached body is allow to swing relative to the pin axis, a value of zero will disable this limits.
+// *const dFloat* maxTwistAngle - max angle in radians the attached body is allow to twist relative to the pin axis, a value of zero will disable this limits.
+//
+// Remarks: limits are disabled at creation time. A value of zero for *maxConeAngle* disable the cone limit, a value of zero for *maxTwistAngle* disable the twist limit
+// all non-zero value for *maxConeAngle* are clamped between 5 degree and 175 degrees
+//
+// See also: NewtonConstraintCreateBall
+void NewtonBallSetConeLimits(const NewtonJoint *const ball, const dFloat *pin,
+ dFloat maxConeAngle, dFloat maxTwistAngle) {
+ dgBallConstraint *joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ joint = (dgBallConstraint *)ball;
+
+ dgVector coneAxis(pin[0], pin[1], pin[2], dgFloat32(0.0f));
+
+ if ((coneAxis % coneAxis) < 1.0e-3f) {
+ coneAxis.m_x = dgFloat32(1.0f);
+ }
+ dgVector tmp(dgFloat32(1.0f), dgFloat32(0.0f), dgFloat32(0.0f),
+ dgFloat32(0.0f));
+ if (dgAbsf(tmp % coneAxis) > dgFloat32(0.999f)) {
+ tmp = dgVector(dgFloat32(0.0f), dgFloat32(1.0f), dgFloat32(0.0f),
+ dgFloat32(0.0f));
+ if (dgAbsf(tmp % coneAxis) > dgFloat32(0.999f)) {
+ tmp = dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(1.0f),
+ dgFloat32(0.0f));
+ _ASSERTE(dgAbsf(tmp % coneAxis) < dgFloat32(0.999f));
+ }
+ }
+ dgVector lateral(tmp * coneAxis);
+ lateral = lateral.Scale(dgRsqrt(lateral % lateral));
+ coneAxis = coneAxis.Scale(dgRsqrt(coneAxis % coneAxis));
+
+ maxConeAngle = dgAbsf(maxConeAngle);
+ maxTwistAngle = dgAbsf(maxTwistAngle);
+ joint->SetConeLimitState((maxConeAngle > dgDEG2RAD) ? true : false);
+ joint->SetTwistLimitState((maxTwistAngle > dgDEG2RAD) ? true : false);
+ joint->SetLatealLimitState(false);
+ joint->SetLimits(coneAxis, -maxConeAngle, maxConeAngle, maxTwistAngle,
+ lateral, 0.0f, 0.0f);
+}
+
+// Name: NewtonBallSetUserCallback
+// Set an update call back to be called when either of the two bodies linked by the joint is active.
+//
+// Parameters:
+// *const NewtonJoint* *ball - pointer to the joint.
+// *NewtonBallCallBack* callback - pointer to the joint function call back.
+//
+// Return: nothing.
+//
+// Remarks: if the application wants to have some feedback from the joint simulation, the application can register a function
+// update callback to be called every time any of the bodies linked by this joint is active. This is useful to provide special
+// effects like particles, sound or even to simulate breakable moving parts.
+//
+// See also: NewtonJointSetUserData
+void NewtonBallSetUserCallback(const NewtonJoint *const ball,
+ NewtonBallCallBack callback) {
+ dgBallConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgBallConstraint *)ball;
+ contraint->SetJointParameterCallBack((dgBallJointFriction)callback);
+}
+
+// Name: NewtonBallGetJointAngle
+// Get the relative joint angle between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *ball - pointer to the joint.
+// *dFloat* *angle - pointer to an array of a least three floats to hold the joint relative Euler angles.
+//
+// Return: nothing.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play a bell sound when the joint angle passes some max value.
+//
+// See also: NewtonBallSetUserCallback
+void NewtonBallGetJointAngle(const NewtonJoint *const ball, dFloat *angle) {
+ dgBallConstraint *contraint;
+
+ contraint = (dgBallConstraint *)ball;
+ dgVector angleVector(contraint->GetJointAngle());
+
+ TRACE_FUNTION(__FUNCTION__);
+ angle[0] = angleVector.m_x;
+ angle[1] = angleVector.m_y;
+ angle[2] = angleVector.m_z;
+}
+
+// Name: NewtonBallGetJointOmega
+// Get the relative joint angular velocity between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *ball - pointer to the joint.
+// *dFloat* *omega - pointer to an array of a least three floats to hold the joint relative angular velocity.
+//
+// Return: nothing.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play the creaky noise of a hanging lamp.
+//
+// See also: NewtonBallSetUserCallback
+void NewtonBallGetJointOmega(const NewtonJoint *const ball, dFloat *omega) {
+ dgBallConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgBallConstraint *)ball;
+ dgVector omegaVector(contraint->GetJointOmega());
+ omega[0] = omegaVector.m_x;
+ omega[1] = omegaVector.m_y;
+ omega[2] = omegaVector.m_z;
+}
+
+// Name: NewtonBallGetJointForce
+// Get the total force asserted over the joint pivot point, to maintain the constraint.
+//
+// Parameters:
+// *const NewtonJoint* *ball - pointer to the joint.
+// *dFloat* *force - pointer to an array of a least three floats to hold the force value of the joint.
+//
+// Return: nothing.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can destroy the joint if the force exceeds some predefined value.
+//
+// See also: NewtonBallSetUserCallback
+void NewtonBallGetJointForce(const NewtonJoint *const ball, dFloat *const force) {
+ dgBallConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgBallConstraint *)ball;
+ dgVector forceVector(contraint->GetJointForce());
+ force[0] = forceVector.m_x;
+ force[1] = forceVector.m_y;
+ force[2] = forceVector.m_z;
+}
+
+// ***************************************************************************************************************
+//
+// Name: Hinge joint interface
+//
+// ***************************************************************************************************************
+
+// Name: NewtonConstraintCreateHinge
+// Create a hinge joint.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const dFloat* *pivotPoint - is origin of the hinge in global space.
+// *const dFloat* *pinDir - is the line of action of the hinge in global space.
+// *const NewtonBody* *childBody - is the pointer to the attached rigid body, this body can not be NULL or it can not have an infinity (zero) mass.
+// *const NewtonBody* *parentBody - is the pointer to the parent rigid body, this body can be NULL or any kind of rigid body.
+//
+// Return: Pointer to the hinge joint.
+//
+// Remarks: This function creates a hinge and add it to the world. By default joint disables collision with the linked bodies.
+NewtonJoint *NewtonConstraintCreateHinge(const NewtonWorld *const newtonWorld,
+ const dFloat *pivotPoint, const dFloat *pinDir,
+ const NewtonBody *const childBody, const NewtonBody *const parentBody) {
+ dgBody *body0;
+ dgBody *body1;
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ body0 = (dgBody *)childBody;
+ body1 = (dgBody *)parentBody;
+ dgVector pivot(pivotPoint[0], pivotPoint[1], pivotPoint[2], dgFloat32(0.0f));
+ dgVector pin(pinDir[0], pinDir[1], pinDir[2], dgFloat32(0.0f));
+ return (NewtonJoint *)world->CreateHingeConstraint(pivot, pin, body0, body1);
+}
+
+// Name: NewtonHingeSetUserCallback
+// Set an update call back to be called when either of the two body linked by the joint is active.
+//
+// Parameters:
+// *const NewtonJoint* *Hinge - pointer to the joint.
+// *NewtonHingeCallBack* callback - pointer to the joint function call back.
+//
+// Return: nothing.
+//
+// Remarks: if the application wants to have some feedback from the joint simulation, the application can register a function
+// update callback to be call every time any of the bodies linked by this joint is active. This is useful to provide special
+// effects like particles, sound or even to simulate breakable moving parts.
+//
+// See also: NewtonJointGetUserData, NewtonJointSetUserData
+void NewtonHingeSetUserCallback(const NewtonJoint *const hinge,
+ NewtonHingeCallBack callback) {
+ dgHingeConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgHingeConstraint *)hinge;
+ contraint->SetJointParameterCallBack((dgHingeJointAcceleration)callback);
+}
+
+// Name: NewtonHingeGetJointAngle
+// Get the relative joint angle between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *Hinge - pointer to the joint.
+//
+// Return: the joint angle relative to the hinge pin.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play a bell sound when the joint angle passes some max value.
+//
+// See also: NewtonHingeSetUserCallback
+dFloat NewtonHingeGetJointAngle(const NewtonJoint *const hinge) {
+ dgHingeConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgHingeConstraint *)hinge;
+ return contraint->GetJointAngle();
+}
+
+// Name: NewtonHingeGetJointOmega
+// Get the relative joint angular velocity between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *Hinge - pointer to the joint.
+//
+// Return: the joint angular velocity relative to the pin axis.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play the creaky noise of a hanging lamp.
+//
+// See also: NewtonHingeSetUserCallback
+dFloat NewtonHingeGetJointOmega(const NewtonJoint *const hinge) {
+ dgHingeConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgHingeConstraint *)hinge;
+ return contraint->GetJointOmega();
+}
+
+// Name: NewtonHingeGetJointForce
+// Calculate the angular acceleration needed to stop the hinge at the desired angle.
+//
+// Parameters:
+// *const NewtonJoint* *Hinge - pointer to the joint.
+// *NewtonHingeSliderUpdateDesc* *desc - is the pointer to and the Hinge or slide structure.
+// *dFloat* angle - is the desired hinge stop angle
+//
+// Return: the relative angular acceleration needed to stop the hinge.
+//
+// Remarks: this function can only be called from a *NewtonHingeCallBack* and it can be used by the application to implement hinge limits.
+//
+// See also: NewtonHingeSetUserCallback
+dFloat NewtonHingeCalculateStopAlpha(const NewtonJoint *const hinge,
+ const NewtonHingeSliderUpdateDesc *const desc, dFloat angle) {
+ dgHingeConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgHingeConstraint *)hinge;
+ return contraint->CalculateStopAlpha(angle, (dgJointCallBackParam *)desc);
+}
+
+// Name: NewtonHingeGetJointForce
+// Get the total force asserted over the joint pivot point, to maintain the constraint.
+//
+// Parameters:
+// *const NewtonJoint* *Hinge - pointer to the joint.
+// *dFloat* *force - pointer to an array of a least three floats to hold the force value of the joint.
+//
+// Return: nothing.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can destroy the joint if the force exceeds some predefined value.
+//
+// See also: NewtonHingeSetUserCallback
+void NewtonHingeGetJointForce(const NewtonJoint *const hinge,
+ dFloat *const force) {
+ dgHingeConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgHingeConstraint *)hinge;
+ dgVector forceVector(contraint->GetJointForce());
+ force[0] = forceVector.m_x;
+ force[1] = forceVector.m_y;
+ force[2] = forceVector.m_z;
+}
+
+// ***************************************************************************************************************
+//
+// Name: Slider joint interface
+//
+// ***************************************************************************************************************
+
+// Name: NewtonConstraintCreateSlider
+// Create a slider joint.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const dFloat* *pivotPoint - is origin of the slider in global space.
+// *const dFloat* *pinDir - is the line of action of the slider in global space.
+// *const NewtonBody* *childBody - is the pointer to the attached rigid body, this body can not be NULL or it can not have an infinity (zero) mass.
+// *const NewtonBody* *parentBody - is the pointer to the parent rigid body, this body can be NULL or any kind of rigid body.
+//
+// Return: Pointer to the slider joint.
+//
+// Remarks: This function creates a slider and add it to the world. By default joint disables collision with the linked bodies.
+NewtonJoint *NewtonConstraintCreateSlider(const NewtonWorld *const newtonWorld,
+ const dFloat *pivotPoint, const dFloat *pinDir,
+ const NewtonBody *const childBody, const NewtonBody *const parentBody) {
+ dgBody *body0;
+ dgBody *body1;
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ body0 = (dgBody *)childBody;
+ body1 = (dgBody *)parentBody;
+ dgVector pin(pinDir[0], pinDir[1], pinDir[2], dgFloat32(0.0f));
+ dgVector pivot(pivotPoint[0], pivotPoint[1], pivotPoint[2], dgFloat32(0.0f));
+ return (NewtonJoint *)world->CreateSlidingConstraint(pivot, pin, body0, body1);
+}
+
+// Name: NewtonSliderSetUserCallback
+// Set an update call back to be called when either of the two body linked by the joint is active.
+//
+// Parameters:
+// *const NewtonJoint* *Slider - pointer to the joint.
+// *NewtonSliderCallBack* callback - pointer to the joint function call back.
+//
+// Return: nothing.
+//
+// Remarks: if the application wants to have some feedback from the joint simulation, the application can register a function
+// update callback to be call every time any of the bodies linked by this joint is active. This is useful to provide special
+// effects like particles, sound or even to simulate breakable moving parts.
+//
+// See also: NewtonJointGetUserData, NewtonJointSetUserData
+void NewtonSliderSetUserCallback(const NewtonJoint *const slider,
+ NewtonSliderCallBack callback) {
+ dgSlidingConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgSlidingConstraint *)slider;
+ contraint->SetJointParameterCallBack((dgSlidingJointAcceleration)callback);
+}
+
+// Name: NewtonSliderGetJointPosit
+// Get the relative joint angle between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *Slider - pointer to the joint.
+//
+// Return: the joint angle relative to the hinge pin.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play a bell sound when the joint angle passes some max value.
+//
+// See also: NewtonSliderSetUserCallback
+dFloat NewtonSliderGetJointPosit(const NewtonJoint *Slider) {
+ dgSlidingConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgSlidingConstraint *)Slider;
+ return contraint->GetJointPosit();
+}
+
+// Name: NewtonSliderGetJointVeloc
+// Get the relative joint angular velocity between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *Slider - pointer to the joint.
+//
+// Return: the joint angular velocity relative to the pin axis.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play the creaky noise of a hanging lamp.
+//
+// See also: NewtonSliderSetUserCallback
+dFloat NewtonSliderGetJointVeloc(const NewtonJoint *Slider) {
+ dgSlidingConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgSlidingConstraint *)Slider;
+ return contraint->GetJointVeloc();
+}
+
+// Name: NewtonSliderGetJointForce
+// Calculate the angular acceleration needed to stop the slider at the desired angle.
+//
+// Parameters:
+// *const NewtonJoint* *slider - pointer to the joint.
+// *NewtonSliderSliderUpdateDesc* *desc - is the pointer to the Slider or slide structure.
+// *dFloat* distance - desired stop distance relative to the pivot point
+//
+// Return: the relative linear acceleration needed to stop the slider.
+//
+// Remarks: this function can only be called from a *NewtonSliderCallBack* and it can be used by the application to implement slider limits.
+//
+// See also: NewtonSliderSetUserCallback
+dFloat NewtonSliderCalculateStopAccel(const NewtonJoint *const slider,
+ const NewtonHingeSliderUpdateDesc *const desc, dFloat distance) {
+ dgSlidingConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgSlidingConstraint *)slider;
+ return contraint->CalculateStopAccel(distance, (dgJointCallBackParam *)desc);
+}
+
+// Name: NewtonSliderGetJointForce
+// Get the total force asserted over the joint pivot point, to maintain the constraint.
+//
+// Parameters:
+// *const NewtonJoint* *Slider - pointer to the joint.
+// *dFloat* *force - pointer to an array of a least three floats to hold the force value of the joint.
+//
+// Return: nothing.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can destroy the joint if the force exceeds some predefined value.
+//
+// See also: NewtonSliderSetUserCallback
+void NewtonSliderGetJointForce(const NewtonJoint *const slider,
+ dFloat *const force) {
+ dgSlidingConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgSlidingConstraint *)slider;
+ dgVector forceVector(contraint->GetJointForce());
+ force[0] = forceVector.m_x;
+ force[1] = forceVector.m_y;
+ force[2] = forceVector.m_z;
+}
+
+// ***************************************************************************************************************
+//
+// Name: Corkscrew joint interface
+//
+// ***************************************************************************************************************
+
+// Name: NewtonConstraintCreateCorkscrew
+// Create a corkscrew joint.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const dFloat* *pivotPoint - is origin of the corkscrew in global space.
+// *const dFloat* *pinDir - is the line of action of the corkscrew in global space.
+// *const NewtonBody* *childBody - is the pointer to the attached rigid body, this body can not be NULL or it can not have an infinity (zero) mass.
+// *const NewtonBody* *parentBody - is the pointer to the parent rigid body, this body can be NULL or any kind of rigid body.
+//
+// Return: Pointer to the corkscrew joint.
+//
+// Remarks: This function creates a corkscrew and add it to the world. By default joint disables collision with the linked bodies.
+NewtonJoint *NewtonConstraintCreateCorkscrew(
+ const NewtonWorld *const newtonWorld, const dFloat *pivotPoint,
+ const dFloat *pinDir, const NewtonBody *const childBody,
+ const NewtonBody *const parentBody) {
+ dgBody *body0;
+ dgBody *body1;
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ body0 = (dgBody *)childBody;
+ body1 = (dgBody *)parentBody;
+ dgVector pin(pinDir[0], pinDir[1], pinDir[2], dgFloat32(0.0f));
+ dgVector pivot(pivotPoint[0], pivotPoint[1], pivotPoint[2], dgFloat32(0.0f));
+ return (NewtonJoint *)world->CreateCorkscrewConstraint(pivot, pin, body0,
+ body1);
+}
+
+// Name: NewtonCorkscrewSetUserCallback
+// Set an update call back to be called when either of the two body linked by the joint is active.
+//
+// Parameters:
+// *const NewtonJoint* *Corkscrew - pointer to the joint.
+// *NewtonCorkscrewCallBack* callback - pointer to the joint function call back.
+//
+// Return: nothing.
+//
+// Remarks: if the application wants to have some feedback from the joint simulation, the application can register a function
+// update callback to be call every time any of the bodies linked by this joint is active. This is useful to provide special
+// effects like particles, sound or even to simulate breakable moving parts.
+//
+// Remarks: the function *NewtonCorkscrewCallBack callback* should return a bit field code.
+// if the application does not want to set the joint acceleration the return code is zero
+// if the application only wants to change the joint linear acceleration the return code is 1
+// if the application only wants to change the joint angular acceleration the return code is 2
+// if the application only wants to change the joint angular and linear acceleration the return code is 3
+//
+// See also: NewtonJointGetUserData, NewtonJointSetUserData
+void NewtonCorkscrewSetUserCallback(const NewtonJoint *const corkscrew,
+ NewtonCorkscrewCallBack callback) {
+ dgCorkscrewConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgCorkscrewConstraint *)corkscrew;
+ contraint->SetJointParameterCallBack((dgCorkscrewJointAcceleration)callback);
+}
+
+// Name: NewtonCorkscrewGetJointPosit
+// Get the relative joint angle between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *Corkscrew - pointer to the joint.
+//
+// Return: the joint angle relative to the hinge pin.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play a bell sound when the joint angle passes some max value.
+//
+// See also: NewtonCorkscrewSetUserCallback
+dFloat NewtonCorkscrewGetJointPosit(const NewtonJoint *const corkscrew) {
+ dgCorkscrewConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgCorkscrewConstraint *)corkscrew;
+ return contraint->GetJointPosit();
+}
+
+// Name: NewtonCorkscrewGetJointVeloc
+// Get the relative joint angular velocity between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *Corkscrew - pointer to the joint.
+//
+// Return: the joint angular velocity relative to the pin axis.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play the creaky noise of a hanging lamp.
+//
+// See also: NewtonCorkscrewSetUserCallback
+dFloat NewtonCorkscrewGetJointVeloc(const NewtonJoint *const corkscrew) {
+ dgCorkscrewConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgCorkscrewConstraint *)corkscrew;
+ return contraint->GetJointVeloc();
+}
+
+// Name: NewtonCorkscrewGetJointAngle
+// Get the relative joint angle between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *Corkscrew - pointer to the joint.
+//
+// Return: the joint angle relative to the corkscrew pin.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play a bell sound when the joint angle passes some max value.
+//
+// See also: NewtonCorkscrewSetUserCallback
+dFloat NewtonCorkscrewGetJointAngle(const NewtonJoint *const corkscrew) {
+ dgCorkscrewConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgCorkscrewConstraint *)corkscrew;
+ return contraint->GetJointAngle();
+}
+
+// Name: NewtonCorkscrewGetJointOmega
+// Get the relative joint angular velocity between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *Corkscrew - pointer to the joint.
+//
+// Return: the joint angular velocity relative to the pin axis.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play the creaky noise of a hanging lamp.
+//
+// See also: NewtonCorkscrewSetUserCallback
+dFloat NewtonCorkscrewGetJointOmega(const NewtonJoint *const corkscrew) {
+ dgCorkscrewConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgCorkscrewConstraint *)corkscrew;
+ return contraint->GetJointOmega();
+}
+
+// Name: NewtonCorkscrewCalculateStopAlpha
+// Calculate the angular acceleration needed to stop the corkscrew at the desired angle.
+//
+// Parameters:
+// *const NewtonJoint* *Corkscrew - pointer to the joint.
+// *NewtonCorkscrewSliderUpdateDesc* *desc - is the pointer to the Corkscrew or slide structure.
+// *dFloat* angle - is the desired corkscrew stop angle
+//
+// Return: the relative angular acceleration needed to stop the corkscrew.
+//
+// Remarks: this function can only be called from a *NewtonCorkscrewCallBack* and it can be used by the application to implement corkscrew limits.
+//
+// See also: NewtonCorkscrewSetUserCallback
+dFloat NewtonCorkscrewCalculateStopAlpha(const NewtonJoint *const corkscrew,
+ const NewtonHingeSliderUpdateDesc *const desc, dFloat angle) {
+ dgCorkscrewConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgCorkscrewConstraint *)corkscrew;
+ return contraint->CalculateStopAlpha(angle, (dgJointCallBackParam *)desc);
+}
+
+// Name: NewtonCorkscrewGetJointForce
+// Calculate the angular acceleration needed to stop the corkscrew at the desired angle.
+//
+// Parameters:
+// *const NewtonJoint* *corkscrew - pointer to the joint.
+// *NewtonCorkscrewCorkscrewUpdateDesc* *desc - is the pointer to the Corkscrew or slide structure.
+// *dFloat* distance - desired stop distance relative to the pivot point
+//
+// Return: the relative linear acceleration needed to stop the corkscrew.
+//
+// Remarks: this function can only be called from a *NewtonCorkscrewCallBack* and it can be used by the application to implement corkscrew limits.
+//
+// See also: NewtonCorkscrewSetUserCallback
+dFloat NewtonCorkscrewCalculateStopAccel(const NewtonJoint *const corkscrew,
+ const NewtonHingeSliderUpdateDesc *const desc, dFloat distance) {
+ dgCorkscrewConstraint *contraint;
+ contraint = (dgCorkscrewConstraint *)corkscrew;
+ return contraint->CalculateStopAccel(distance, (dgJointCallBackParam *)desc);
+}
+
+// Name: NewtonCorkscrewGetJointForce
+// Get the total force asserted over the joint pivot point, to maintain the constraint.
+//
+// Parameters:
+// *const NewtonJoint* *Corkscrew - pointer to the joint.
+// *dFloat* *force - pointer to an array of a least three floats to hold the force value of the joint.
+//
+// Return: nothing.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can destroy the joint if the force exceeds some predefined value.
+//
+// See also: NewtonCorkscrewSetUserCallback
+void NewtonCorkscrewGetJointForce(const NewtonJoint *const corkscrew,
+ dFloat *const force) {
+ dgCorkscrewConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgCorkscrewConstraint *)corkscrew;
+ dgVector forceVector(contraint->GetJointForce());
+ force[0] = forceVector.m_x;
+ force[1] = forceVector.m_y;
+ force[2] = forceVector.m_z;
+}
+
+// ***************************************************************************************************************
+//
+// Name: Universal joint interface
+//
+// ***************************************************************************************************************
+
+// Name: NewtonConstraintCreateUniversal
+// Create a universal joint.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const dFloat* *pivotPoint - is origin of the universal joint in global space.
+// *const dFloat* *pinDir0 - first axis of rotation fixed on childBody body and perpendicular to pinDir1.
+// *const dFloat* *pinDir1 - second axis of rotation fixed on parentBody body and perpendicular to pinDir0.
+// *const NewtonBody* *childBody - is the pointer to the attached rigid body, this body can not be NULL or it can not have an infinity (zero) mass.
+// *const NewtonBody* *parentBody - is the pointer to the parent rigid body, this body can be NULL or any kind of rigid body.
+//
+// Return: Pointer to the universal joint.
+//
+// Remarks: This function creates a universal joint and add it to the world. By default joint disables collision with the linked bodies.
+//
+// Remark: a universal joint is a constraint that restricts twp rigid bodies to be connected to a point fixed on both bodies,
+// while and allowing one body to spin around a fix axis in is own frame, and the other body to spin around another axis fixes on
+// it own frame. Both axis must be mutually perpendicular.
+NewtonJoint *NewtonConstraintCreateUniversal(
+ const NewtonWorld *const newtonWorld, const dFloat *pivotPoint,
+ const dFloat *pinDir0, const dFloat *pinDir1,
+ const NewtonBody *const childBody, const NewtonBody *const parentBody) {
+ dgBody *body0;
+ dgBody *body1;
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ body0 = (dgBody *)childBody;
+ body1 = (dgBody *)parentBody;
+ dgVector pin0(pinDir0[0], pinDir0[1], pinDir0[2], dgFloat32(0.0f));
+ dgVector pin1(pinDir1[0], pinDir1[1], pinDir1[2], dgFloat32(0.0f));
+ dgVector pivot(pivotPoint[0], pivotPoint[1], pivotPoint[2], dgFloat32(0.0f));
+ return (NewtonJoint *)world->CreateUniversalConstraint(pivot, pin0, pin1,
+ body0, body1);
+}
+
+// Name: NewtonUniversalSetUserCallback
+// Set an update call back to be called when either of the two body linked by the joint is active.
+//
+// Parameters:
+// *const NewtonJoint* *Universal - pointer to the joint.
+// *NewtonUniversalCallBack* callback - pointer to the joint function call back.
+//
+// Return: nothing.
+//
+// Remarks: if the application wants to have some feedback from the joint simulation, the application can register a function
+// update callback to be called every time any of the bodies linked by this joint is active. This is useful to provide special
+// effects like particles, sound or even to simulate breakable moving parts.
+//
+// Remarks: the function *NewtonUniversalCallBack callback* should return a bit field code.
+// if the application does not want to set the joint acceleration the return code is zero
+// if the application only wants to change the joint linear acceleration the return code is 1
+// if the application only wants to change the joint angular acceleration the return code is 2
+// if the application only wants to change the joint angular and linear acceleration the return code is 3
+//
+// See also: NewtonJointGetUserData, NewtonJointSetUserData
+void NewtonUniversalSetUserCallback(const NewtonJoint *const universal,
+ NewtonUniversalCallBack callback) {
+ dgUniversalConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgUniversalConstraint *)universal;
+ contraint->SetJointParameterCallBack((dgUniversalJointAcceleration)callback);
+}
+
+// Name: NewtonUniversalGetJointAngle0
+// Get the relative joint angle between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *Universal - pointer to the joint.
+//
+// Return: the joint angle relative to the universal pin0.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play a bell sound when the joint angle passes some max value.
+//
+// See also: NewtonUniversalSetUserCallback
+dFloat NewtonUniversalGetJointAngle0(const NewtonJoint *const universal) {
+ dgUniversalConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgUniversalConstraint *)universal;
+ return contraint->GetJointAngle0();
+}
+
+// Name: NewtonUniversalGetJointAngle1
+// Get the relative joint angle between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *Universal - pointer to the joint.
+//
+// Return: the joint angle relative to the universal pin1.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play a bell sound when the joint angle passes some max value.
+//
+// See also: NewtonUniversalSetUserCallback
+dFloat NewtonUniversalGetJointAngle1(const NewtonJoint *const universal) {
+ dgUniversalConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgUniversalConstraint *)universal;
+ return contraint->GetJointAngle1();
+}
+
+// Name: NewtonUniversalGetJointOmega0
+// Get the relative joint angular velocity between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *Universal - pointer to the joint.
+//
+// Return: the joint angular velocity relative to the pin0 axis.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play the creaky noise of a hanging lamp.
+//
+// See also: NewtonUniversalSetUserCallback
+dFloat NewtonUniversalGetJointOmega0(const NewtonJoint *const universal) {
+ dgUniversalConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgUniversalConstraint *)universal;
+ return contraint->GetJointOmega0();
+}
+
+// Name: NewtonUniversalGetJointOmega1
+// Get the relative joint angular velocity between the two bodies.
+//
+// Parameters:
+// *const NewtonJoint* *Universal - pointer to the joint.
+//
+// Return: the joint angular velocity relative to the pin1 axis.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can play the creaky noise of a hanging lamp.
+//
+// See also: NewtonUniversalSetUserCallback
+dFloat NewtonUniversalGetJointOmega1(const NewtonJoint *const universal) {
+ dgUniversalConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgUniversalConstraint *)universal;
+ return contraint->GetJointOmega1();
+}
+
+// Name: NewtonUniversalCalculateStopAlpha0
+// Calculate the angular acceleration needed to stop the universal at the desired angle.
+//
+// Parameters:
+// *const NewtonJoint* *Universal - pointer to the joint.
+// *NewtonUniversalSliderUpdateDesc* *desc - is the pointer to the Universal or slide structure.
+// *dFloat* angle - is the desired universal stop angle rotation around pin0
+//
+// Return: the relative angular acceleration needed to stop the universal.
+//
+// Remarks: this function can only be called from a *NewtonUniversalCallBack* and it can be used by the application to implement universal limits.
+//
+// See also: NewtonUniversalSetUserCallback
+dFloat NewtonUniversalCalculateStopAlpha0(const NewtonJoint *const universal,
+ const NewtonHingeSliderUpdateDesc *const desc, dFloat angle) {
+ dgUniversalConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgUniversalConstraint *)universal;
+ return contraint->CalculateStopAlpha0(angle, (dgJointCallBackParam *)desc);
+}
+
+// Name: NewtonUniversalCalculateStopAlpha1
+// Calculate the angular acceleration needed to stop the universal at the desired angle.
+//
+// Parameters:
+// *const NewtonJoint* *Universal - pointer to the joint.
+// *NewtonUniversalSliderUpdateDesc* *desc - is the pointer to and the Universal or slide structure.
+// *dFloat* angle - is the desired universal stop angle rotation around pin1
+//
+// Return: the relative angular acceleration needed to stop the universal.
+//
+// Remarks: this function can only be called from a *NewtonUniversalCallBack* and it can be used by the application to implement universal limits.
+//
+// See also: NewtonUniversalSetUserCallback
+dFloat NewtonUniversalCalculateStopAlpha1(const NewtonJoint *const universal,
+ const NewtonHingeSliderUpdateDesc *const desc, dFloat angle) {
+ dgUniversalConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgUniversalConstraint *)universal;
+ return contraint->CalculateStopAlpha1(angle, (dgJointCallBackParam *)desc);
+}
+
+// Name: NewtonUniversalGetJointForce
+// Get the total force asserted over the joint pivot point, to maintain the constraint.
+//
+// Parameters:
+// *const NewtonJoint* *Universal - pointer to the joint.
+// *dFloat* *force - pointer to an array of a least three floats to hold the force value of the joint.
+//
+// Return: nothing.
+//
+// Remarks: this function can be used during a function update call back to provide the application with some special effect.
+// for example the application can destroy the joint if the force exceeds some predefined value.
+//
+// See also: NewtonUniversalSetUserCallback
+void NewtonUniversalGetJointForce(const NewtonJoint *const universal,
+ dFloat *const force) {
+ dgUniversalConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgUniversalConstraint *)universal;
+ dgVector forceVector(contraint->GetJointForce());
+ force[0] = forceVector.m_x;
+ force[1] = forceVector.m_y;
+ force[2] = forceVector.m_z;
+}
+
+// ***************************************************************************************************************
+//
+// Name: UpVector joint Interface
+//
+// ***************************************************************************************************************
+
+// Name: NewtonConstraintCreateUpVector
+// Create a UpVector joint.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const dFloat* *pinDir - is the aligning vector.
+// *const NewtonBody* *body - is the pointer to the attached rigid body, this body can not be NULL or it can not have an infinity (zero) mass.
+//
+// Return: Pointer to the up vector joint.
+//
+// Remarks: This function creates an up vector joint. An up vector joint is a constraint that allows a body to translate freely in 3d space,
+// but it only allows the body to rotate around the pin direction vector. This could be use by the application to control a character
+// with physics and collision.
+//
+// Remark: Since the UpVector joint is a unary constraint, there is not need to have user callback or user data assigned to it.
+// The application can simple hold to the joint handle and update the pin on the force callback function of the rigid body owning the joint.
+NewtonJoint *NewtonConstraintCreateUpVector(
+ const NewtonWorld *const newtonWorld, const dFloat *pinDir,
+ const NewtonBody *const body) {
+ dgBody *body0;
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ body0 = (dgBody *)body;
+ dgVector pin(pinDir[0], pinDir[1], pinDir[2], dgFloat32(0.0f));
+ return (NewtonJoint *)world->CreateUpVectorConstraint(pin, body0);
+}
+
+// Name: NewtonUpVectorGetPin
+// Get the up vector pin of this joint in global space.
+//
+// Parameters:
+// *const NewtonJoint* *upVector - pointer to the joint.
+// *dFloat* *pin - pointer to an array of a least three floats to hold the up vector direction in global space.
+//
+// Return: nothing.
+//
+// Remarks: the application ca call this function to read the up vector, this is useful to animate the up vector.
+// if the application is going to animated the up vector, it must do so by applying only small rotation,
+// too large rotation can cause vibration of the joint.
+//
+// See also: NewtonUpVectorSetUserCallback, NewtonUpVectorSetPin
+void NewtonUpVectorGetPin(const NewtonJoint *const upVector, dFloat *pin) {
+ dgUpVectorConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgUpVectorConstraint *)upVector;
+
+ dgVector pinVector(contraint->GetPinDir());
+ pin[0] = pinVector.m_x;
+ pin[1] = pinVector.m_y;
+ pin[2] = pinVector.m_z;
+}
+
+// Name: NewtonUpVectorSetPin
+// Set the up vector pin of this joint in global space.
+//
+// Parameters:
+// *const NewtonJoint* *upVector - pointer to the joint.
+// *dFloat* *pin - pointer to an array of a least three floats containing the up vector direction in global space.
+//
+// Return: nothing.
+//
+// Remarks: the application ca call this function to change the joint up vector, this is useful to animate the up vector.
+// if the application is going to animated the up vector, it must do so by applying only small rotation,
+// too large rotation can cause vibration of the joint.
+//
+// See also: NewtonUpVectorSetUserCallback, NewtonUpVectorGetPin
+void NewtonUpVectorSetPin(const NewtonJoint *const upVector, const dFloat *pin) {
+ dgUpVectorConstraint *contraint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint = (dgUpVectorConstraint *)upVector;
+
+ dgVector pinVector(pin[0], pin[1], pin[2], dgFloat32(0.0f));
+ contraint->SetPinDir(pinVector);
+}
+
+// ***************************************************************************************************************
+//
+// Name: User defined joint interface
+//
+// ***************************************************************************************************************
+
+// Name: NewtonConstraintCreateUserJoint
+// Create a user define bilateral joint.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *in*t maxDOF - is the maximum number of degree of freedom controlled by this joint.
+// *NewtonUserBilateralCallBack* submitConstraints - pointer to the joint constraint definition function call back.
+// *NewtonUserBilateralGetInfoCallBack* getInfo - pointer to callback for collecting joint information.
+// *const NewtonBody* *childBody - is the pointer to the attached rigid body, this body can not be NULL or it can not have an infinity (zero) mass.
+// *const NewtonBody* *parentBody - is the pointer to the parent rigid body, this body can be NULL or any kind of rigid body.
+//
+// Remark: Bilateral joint are constraints that can have up to 6 degree of freedoms, 3 linear and 3 angular.
+// By restricting the motion along any number of these degree of freedom a very large number of useful joint between
+// two rigid bodies can be accomplished. Some of the degree of freedoms restriction makes no sense, and also some
+// combinations are so rare that only make sense to a very specific application, the Newton engine implements the more
+// commons combinations like, hinges, ball and socket, etc. However if and application is in the situation that any of
+// the provided joints can achieve the desired effect, then the application can design it own joint.
+//
+// Remark: User defined joint is a very advance feature that should be look at, only for very especial situations.
+// The designer must be a person with a very good understanding of constrained dynamics, and it may be the case
+// that many trial have to be made before a good result can be accomplished.
+//
+// Remark: function *submitConstraints* is called before the solver state to get the jacobian derivatives and the righ hand acceleration
+// for the definition of the constraint.
+//
+// Remark: maxDOF is and upper bound as to how many degrees of freedoms the joint can control, usually this value
+// can be 6 for bilateral joints, but it can be higher for special joints like vehicles where by the used of friction clamping
+// the number of rows can be higher.
+// In general the application should determine maxDof correctly, passing an unnecessary excessive value will lead to performance decreased.
+//
+// See also: NewtonUserJointSetFeedbackCollectorCallback
+NewtonJoint *NewtonConstraintCreateUserJoint(
+ const NewtonWorld *const newtonWorld, int maxDOF,
+ NewtonUserBilateralCallBack submitConstraints,
+ NewtonUserBilateralGetInfoCallBack getInfo,
+ const NewtonBody *const childBody, const NewtonBody *const parentBody) {
+ dgBody *body0;
+ dgBody *body1;
+ Newton *world;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world = (Newton *)newtonWorld;
+ body0 = (dgBody *)childBody;
+ body1 = (dgBody *)parentBody;
+
+ return (NewtonJoint *)new (world->dgWorld::GetAllocator()) NewtonUserJoint(
+ world, maxDOF, submitConstraints, getInfo, body0, body1);
+}
+
+// Name: NewtonUserJointAddLinearRow
+// Add a linear restricted degree of freedom.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *const dFloat* *pivot0 - pointer of a vector in global space fixed on body zero.
+// *const dFloat* *pivot1 - pointer of a vector in global space fixed on body one.
+// *const dFloat* *pin - pointer of a unit vector in global space along which the relative position, velocity and acceleration between the bodies will be driven to zero.
+//
+// Remark: A linear constraint row calculates the Jacobian derivatives and relative acceleration required to enforce the constraint condition at
+// the attachment point and the pin direction considered fixed to both bodies.
+//
+// Remark: The acceleration is calculated such that the relative linear motion between the two points is zero, the application can
+// afterward override this value to create motors.
+//
+// Remark: after this function is call and internal DOF index will point to the current row entry in the constraint matrix.
+//
+// Remark: This function call only be called from inside a *NewtonUserBilateralCallBack* callback.
+//
+// See also: NewtonUserJointAddAngularRow,
+void NewtonUserJointAddLinearRow(const NewtonJoint *const joint,
+ const dFloat *const pivot0, const dFloat *const pivot1,
+ const dFloat *const dir) {
+ NewtonUserJoint *userJoint;
+ userJoint = (NewtonUserJoint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgVector direction(dir[0], dir[1], dir[2], dgFloat32(0.0f));
+ direction = direction.Scale(dgRsqrt(direction % direction));
+ _ASSERTE(
+ dgAbsf(direction % direction - dgFloat32(1.0f)) < dgFloat32(1.0e-2f));
+ dgVector pivotPoint0(pivot0[0], pivot0[1], pivot0[2], dgFloat32(0.0f));
+ dgVector pivotPoint1(pivot1[0], pivot1[1], pivot1[2], dgFloat32(0.0f));
+
+ userJoint->AddLinearRowJacobian(pivotPoint0, pivotPoint1, direction);
+}
+
+// Name: NewtonUserJointAddAngularRow
+// Add an angular restricted degree of freedom.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *dFloat* relativeAngleError - relative angle error between both bodies around pin axis.
+// *const dFloat* *pin - pointer of a unit vector in global space along which the relative position, velocity and acceleration between the bodies will be driven to zero.
+//
+// Remark: An angular constraint row calculates the Jacobian derivatives and relative acceleration required to enforce the constraint condition at
+// pin direction considered fixed to both bodies.
+//
+// Remark: The acceleration is calculated such that the relative angular motion between the two points is zero, The application can
+// afterward override this value to create motors.
+//
+// Remark: After this function is called and internal DOF index will point to the current row entry in the constraint matrix.
+//
+// Remark: This function call only be called from inside a *NewtonUserBilateralCallBack* callback.
+//
+// Remark: This function is of not practical to enforce hard constraints, but it is very useful for making angular motors.
+//
+// See also: NewtonUserJointAddLinearRow, NewtonUserJointAddIndependentAngularRow
+void NewtonUserJointAddAngularRow(const NewtonJoint *const joint,
+ dFloat relativeAngleError, const dFloat *const pin) {
+ NewtonUserJoint *userJoint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ userJoint = (NewtonUserJoint *)joint;
+ dgVector direction(pin[0], pin[1], pin[2], dgFloat32(0.0f));
+ direction = direction.Scale(dgRsqrt(direction % direction));
+ _ASSERTE(
+ dgAbsf(direction % direction - dgFloat32(1.0f)) < dgFloat32(1.0e-3f));
+
+ userJoint->AddAngularRowJacobian(direction, relativeAngleError);
+}
+
+// Name: NewtonUserJointAddGeneralRow
+// set the general linear and angular Jacobian for the desired degree of freedom
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *const dFloat* *jacobian0 - pointer of a set of six values defining the linear and angular Jacobian for body0.
+// *const dFloat* *jacobian1 - pointer of a set of six values defining the linear and angular Jacobian for body1.
+//
+// Remark: In general this function must be used for very special effects and in combination with other joints.
+// it is expected that the user have a knowledge of Constrained dynamics to make a good used of this function.
+// Must typical application of this function are the creation of synchronization or control joints like gears, pulleys,
+// worm gear and some other mechanical control.
+//
+// Remark: this function set the relative acceleration for this degree of freedom to zero. It is the
+// application responsibility to set the relative acceleration after a call to this function
+//
+// See also: NewtonUserJointAddLinearRow, NewtonUserJointAddAngularRow
+void NewtonUserJointAddGeneralRow(const NewtonJoint *const joint,
+ const dFloat *const jacobian0, const dFloat *const jacobian1) {
+ NewtonUserJoint *userJoint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ userJoint = (NewtonUserJoint *)joint;
+ userJoint->AddGeneralRowJacobian(jacobian0, jacobian1);
+}
+
+// Name: NewtonUserJointSetRowMaximumFriction
+// Set the maximum friction value the solver is allow to apply to the joint row.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *dFloat* friction - maximum friction value for this row. It must be a positive value between 0.0 and INFINITY.
+//
+// Remark: This function will override the default friction values set after a call to NewtonUserJointAddLinearRow or NewtonUserJointAddAngularRow.
+// friction value is context sensitive, if for linear constraint friction is a Max friction force, for angular constraint friction is a
+// max friction is a Max friction torque.
+//
+// See also: NewtonUserJointSetRowMinimumFriction, NewtonUserJointAddLinearRow, NewtonUserJointAddAngularRow
+void NewtonUserJointSetRowMaximumFriction(const NewtonJoint *const joint,
+ dFloat friction) {
+ NewtonUserJoint *userJoint;
+ userJoint = (NewtonUserJoint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ userJoint->SetHighFriction(friction);
+}
+
+// Name: NewtonUserJointSetRowMinimumFriction
+// Set the minimum friction value the solver is allow to apply to the joint row.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *dFloat* friction - friction value for this row. It must be a negative value between 0.0 and -INFINITY.
+//
+// Remark: This function will override the default friction values set after a call to NewtonUserJointAddLinearRow or NewtonUserJointAddAngularRow.
+// friction value is context sensitive, if for linear constraint friction is a Min friction force, for angular constraint friction is a
+// friction is a Min friction torque.
+//
+// See also: NewtonUserJointSetRowMaximumFriction, NewtonUserJointAddLinearRow, NewtonUserJointAddAngularRow
+void NewtonUserJointSetRowMinimumFriction(const NewtonJoint *const joint,
+ dFloat friction) {
+ NewtonUserJoint *userJoint;
+ userJoint = (NewtonUserJoint *)joint;
+
+ userJoint->SetLowerFriction(friction);
+}
+
+// Name: NewtonUserJointSetRowAcceleration
+// Set the value for the desired acceleration for the current constraint row.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *dFloat* acceleration - desired acceleration value for this row.
+//
+// Remark: This function will override the default acceleration values set after a call to NewtonUserJointAddLinearRow or NewtonUserJointAddAngularRow.
+// friction value is context sensitive, if for linear constraint acceleration is a linear acceleration, for angular constraint acceleration is an
+// angular acceleration.
+//
+// See also: NewtonUserJointAddLinearRow, NewtonUserJointAddAngularRow
+void NewtonUserJointSetRowAcceleration(const NewtonJoint *const joint,
+ dFloat acceleration) {
+ NewtonUserJoint *userJoint;
+ userJoint = (NewtonUserJoint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ userJoint->SetAcceleration(acceleration);
+}
+
+// Name: NewtonUserJointSetRowSpringDamperAcceleration
+// Calculates the row acceleration to satisfy the specified the spring damper system.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *dFloat* springK - desired spring stiffness, it must be a positive value.
+// *dFloat* springD - desired spring damper, it must be a positive value.
+//
+// Remark: This function will override the default acceleration values set after a call to NewtonUserJointAddLinearRow or NewtonUserJointAddAngularRow.
+// friction value is context sensitive, if for linear constraint acceleration is a linear acceleration, for angular constraint acceleration is an
+// angular acceleration.
+//
+// Remark: the acceleration calculated by this function represent the mass, spring system of the form
+// a = -ks * x - kd * v.
+//
+// Remark: for this function to take place the joint stiffness must be set to a values lower than 1.0
+//
+// See also: NewtonUserJointSetRowAcceleration, NewtonUserJointSetRowStiffness
+void NewtonUserJointSetRowSpringDamperAcceleration(
+ const NewtonJoint *const joint, dFloat springK, dFloat springD) {
+ NewtonUserJoint *userJoint;
+ userJoint = (NewtonUserJoint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ userJoint->SetSpringDamperAcceleration(springK, springD);
+}
+
+// Name: NewtonUserJointSetRowStiffness
+// Set the maximum percentage of the constraint force that will be applied to the constraint row.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *dFloat* stiffness - row stiffness, it must be a values between 0.0 and 1.0, the default is 0.9.
+//
+// Remark: This function will override the default stiffness value set after a call to NewtonUserJointAddLinearRow or NewtonUserJointAddAngularRow.
+// the row stiffness is the percentage of the constraint force that will be applied to the rigid bodies. Ideally the value should be
+// 1.0 (100% stiff) but dues to numerical integration error this could be the joint a little unstable, and lower values are preferred.
+//
+// See also: NewtonUserJointAddLinearRow, NewtonUserJointAddAngularRow, NewtonUserJointSetRowSpringDamperAcceleration
+void NewtonUserJointSetRowStiffness(const NewtonJoint *const joint,
+ dFloat stiffness) {
+ NewtonUserJoint *userJoint;
+ userJoint = (NewtonUserJoint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ userJoint->SetRowStiffness(stiffness);
+}
+
+// Name: NewtonUserJointGetRowForce
+// Return the magnitude previews force or torque value calculated by the solver for this constraint row.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *int* row - index to the constraint row.
+//
+// Remark: This function can be call for any of the previews row for this particular joint, The application must keep track of the meaning of the row.
+//
+// Remark: This function can be used to produce special effects like breakable or malleable joints, fro example a hinge can turn into ball and socket
+// after the force in some of the row exceed certain high value.
+dFloat NewtonUserJointGetRowForce(const NewtonJoint *const joint, int row) {
+ NewtonUserJoint *userJoint;
+ userJoint = (NewtonUserJoint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return userJoint->GetRowForce(row);
+}
+
+// Name: NewtonUserJointSetFeedbackCollectorCallback
+// Set a constrain callback to collect the force calculated by the solver to enforce this constraint
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *NewtonUserBilateralCallBack* getFeedback - pointer to the joint constraint definition function call back.
+//
+// See also: NewtonUserJointGetRowForce
+void NewtonUserJointSetFeedbackCollectorCallback(const NewtonJoint *const joint,
+ NewtonUserBilateralCallBack getFeedback) {
+ NewtonUserJoint *userJoint;
+ userJoint = (NewtonUserJoint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return userJoint->SetUpdateFeedbackFunction(getFeedback);
+}
+
+// ***************************************************************************************************************
+//
+// Name: Joint common function s
+//
+// ***************************************************************************************************************
+
+// Name: NewtonJointSetUserData
+// Store a user defined data value with the joint.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *void* *userDataPtr - pointer to the user defined user data value.
+//
+// Return: Nothing.
+//
+// Remarks: The application can store a user defined value with the Joint. This value can be the pointer to a structure containing some application data for special effect.
+// if the application allocate some resource to store the user data, the application can register a joint destructor to get rid of the allocated resource when the Joint is destroyed
+//
+// See also: NewtonConstraintCreateJoint, NewtonJointSetDestructor
+void NewtonJointSetUserData(const NewtonJoint *const joint,
+ void *const userData) {
+ dgConstraint *contraint;
+
+ contraint = (dgConstraint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint->SetUserData(userData);
+}
+
+// Name: NewtonJointGetUserData
+// Retrieve a user defined data value stored with the joint.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+//
+// Return: The user defined data.
+//
+// Remarks: The application can store a user defined value with a joint. This value can be the pointer
+// to a structure to store some game play data for special effect.
+//
+// See also: NewtonJointSetUserData
+void *NewtonJointGetUserData(const NewtonJoint *const joint) {
+ dgConstraint *contraint;
+
+ contraint = (dgConstraint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return contraint->GetUserData();
+}
+
+/*
+ // Name: NewtonJointGetBody0
+ // Retrieve the first rigid body controlled by this joint.
+ //
+ // Parameters:
+ // *const NewtonJoint* *joint - pointer to the joint.
+ //
+ // Return: pointer the first body
+ //
+ // See also: NewtonJointGetBody1
+ NewtonBody* NewtonJointGetBody0(const NewtonJoint* const joint)
+ {
+ dgBody* body;
+ dgWorld* world;
+ dgConstraint* contraint;
+ contraint = (dgConstraint*) joint;
+
+ body = contraint->GetBody0();
+ world = body->GetWorld();
+ if (body == world->GetSentinelBody()) {
+ body = NULL;
+ }
+ return (NewtonBody*) body;
+ }
+
+
+ // Name: NewtonJointGetBody1
+ // Retrieve the second rigid body controlled by this joint.
+ //
+ // Parameters:
+ // *const NewtonJoint* *joint - pointer to the joint.
+ //
+ // Return: pointer the second body.
+ //
+ // See also: NewtonJointGetBody0
+ NewtonBody* NewtonJointGetBody1(const NewtonJoint* const joint)
+ {
+ dgBody* body;
+ dgWorld* world;
+ dgConstraint* contraint;
+ contraint = (dgConstraint*) joint;
+
+ body = contraint->GetBody1();
+ world = body->GetWorld();
+ if (body == world->GetSentinelBody()) {
+ body = NULL;
+ }
+ return (NewtonBody*) body;
+ }
+ */
+
+// Name: NewtonJointGetInfo
+// Get creation parameters for this joint.
+//
+// Parameters:
+// *const NewtonJoint* joint - is the pointer to a convex collision primitive.
+// *NewtonJointRecord* *jointInfo - pointer to a collision information record.
+//
+// Remarks: This function can be used by the application for writing file format and for serialization.
+//
+// See also:
+void NewtonJointGetInfo(const NewtonJoint *const joint,
+ NewtonJointRecord *const jointInfo) {
+ dgConstraint *contraint;
+ contraint = (dgConstraint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint->GetInfo((dgConstraintInfo *)jointInfo);
+}
+
+// Name: NewtonJointGetBody0
+// Get the first body connected by this joint.
+//
+// Parameters:
+// *const NewtonJoint* joint - is the pointer to a convex collision primitive.
+//
+//
+// See also:
+NewtonBody *NewtonJointGetBody0(const NewtonJoint *const joint) {
+
+ dgConstraint *contraint;
+ contraint = (dgConstraint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ return (NewtonBody *)contraint->GetBody0();
+}
+
+// Name: NewtonJointGetBody1
+// Get the secund body connected by this joint.
+//
+// Parameters:
+// *const NewtonJoint* joint - is the pointer to a convex collision primitive.
+//
+// See also:
+NewtonBody *NewtonJointGetBody1(const NewtonJoint *const joint) {
+ dgBody *body;
+ dgWorld *world;
+
+ dgConstraint *contraint;
+ contraint = (dgConstraint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ body = contraint->GetBody1();
+ world = body->GetWorld();
+
+ return (world->GetSentinelBody() != body) ? (NewtonBody *)body : NULL;
+}
+
+// Name: NewtonJointSetCollisionState
+// Enable or disable collision between the two bodies linked by this joint. The default state is collision disable when the joint is created.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *int* state - collision state, zero mean disable collision, non zero enable collision between linked bodies.
+//
+// Return: nothing.
+//
+// Remarks: usually when two bodies are linked by a joint, the application wants collision between this two bodies to be disabled.
+// This is the default behavior of joints when they are created, however when this behavior is not desired the application can change
+// it by setting collision on. If the application decides to enable collision between jointed bodies, the application should make sure the
+// collision geometry do not collide in the work space of the joint.
+//
+// Remarks: if the joint is destroyed the collision state of the two bodies linked by this joint is determined by the material pair assigned to each body.
+//
+// See also: NewtonJointGetCollisionState, NewtonBodySetJointRecursiveCollision
+void NewtonJointSetCollisionState(const NewtonJoint *const joint, int state) {
+ dgConstraint *contraint;
+
+ contraint = (dgConstraint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return contraint->SetCollidable(state ? true : false);
+}
+
+// Name: NewtonJointGetCollisionState
+// Get the collision state of the two bodies linked by the joint.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+//
+// Return: the collision state.
+//
+// Remarks: usually when two bodies are linked by a joint, the application wants collision between this two bodies to be disabled.
+// This is the default behavior of joints when they are created, however when this behavior is not desired the application can change
+// it by setting collision on. If the application decides to enable collision between jointed bodies, the application should make sure the
+// collision geometry do not collide in the work space of the joint.
+//
+// See also: NewtonJointSetCollisionState
+int NewtonJointGetCollisionState(const NewtonJoint *const joint) {
+ dgConstraint *contraint;
+ contraint = (dgConstraint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return contraint->IsCollidable() ? 1 : 0;
+}
+
+// Name: NewtonJointSetStiffness
+// Set the strength coefficient to be applied to the joint reaction forces.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *dFloat* stiffness - stiffness coefficient, a value between 0, and 1.0, the default value for most joint is 0.9
+//
+// Return: nothing.
+//
+// Remarks: Constraint keep bodies together by calculating the exact force necessary to cancel the relative acceleration between one or
+// more common points fixed in the two bodies. The problem is that when the bodies drift apart due to numerical integration inaccuracies,
+// the reaction force work to pull eliminated the error but at the expense of adding extra energy to the system, does violating the rule
+// that constraint forces must be work less. This is a inevitable situation and the only think we can do is to minimize the effect of the
+// extra energy by dampening the force by some amount. In essence the stiffness coefficient tell Newton calculate the precise reaction force
+// by only apply a fraction of it to the joint point. And value of 1.0 will apply the exact force, and a value of zero will apply only
+// 10 percent.
+//
+// Remark: The stiffness is set to a all around value that work well for most situation, however the application can play with these
+// parameter to make finals adjustment. A high value will make the joint stronger but more prompt to vibration of instability; a low
+// value will make the joint more stable but weaker.
+//
+// See also: NewtonJointGetStiffness
+void NewtonJointSetStiffness(const NewtonJoint *const joint, dFloat stiffness) {
+ dgConstraint *contraint;
+
+ contraint = (dgConstraint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint->SetStiffness(stiffness);
+}
+
+// Name: NewtonJointGetStiffness
+// Get the strength coefficient bing applied to the joint reaction forces.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *dFloat* stiffness - stiffness coefficient, a value between 0, and 1.0, the default value for most joint is 0.9
+//
+// Return: stiffness coefficient.
+//
+// Remarks: Constraint keep bodies together by calculating the exact force necessary to cancel the relative acceleration between one or
+// more common points fixed in the two bodies. The problem is that when the bodies drift apart due to numerical integration inaccuracies,
+// the reaction force work to pull eliminated the error but at the expense of adding extra energy to the system, does violating the rule
+// that constraint forces must be work less. This is a inevitable situation and the only think we can do is to minimize the effect of the
+// extra energy by dampening the force by some amount. In essence the stiffness coefficient tell Newton calculate the precise reaction force
+// by only apply a fraction of it to the joint point. And value of 1.0 will apply the exact force, and a value of zero will apply only
+// 10 percent.
+//
+// Remark: The stiffness is set to a all around value that work well for most situation, however the application can play with these
+// parameter to make finals adjustment. A high value will make the joint stronger but more prompt to vibration of instability; a low
+// value will make the joint more stable but weaker.
+//
+// See also: NewtonJointSetStiffness
+dFloat NewtonJointGetStiffness(const NewtonJoint *const joint) {
+ dgConstraint *contraint;
+
+ contraint = (dgConstraint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return contraint->GetStiffness();
+}
+
+// Name: NewtonJointSetDestructor
+// Register a destructor callback to be called when the joint is about to be destroyed.
+//
+// Parameters:
+// *const NewtonJoint* *joint - pointer to the joint.
+// *NewtonJointCallBack* destructor - pointer to the joint destructor callback.
+//
+// Return: nothing.
+//
+// Remarks: If application stores any resource with the joint, or the application wants to be notified when the
+// joint is about to be destroyed. The application can register a destructor call back with the joint.
+//
+// See also: NewtonJointSetUserData
+void NewtonJointSetDestructor(const NewtonJoint *const joint,
+ NewtonConstraintDestructor destructor) {
+ dgConstraint *contraint;
+
+ contraint = (dgConstraint *)joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ contraint->SetDestructorCallback((OnConstraintDestroy)destructor);
+}
+
+// Name: NewtonDestroyJoint
+// destroy a joint.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the body.
+// *const NewtonJoint* *joint - pointer to joint to be destroyed
+//
+// Return: nothing
+//
+// Remarks: The application can call this function when it wants to destroy a joint. This function can be used by the application to simulate
+// breakable joints
+//
+// See also: NewtonConstraintCreateJoint, NewtonConstraintCreateHinge, NewtonConstraintCreateSlider
+void NewtonDestroyJoint(const NewtonWorld *const newtonWorld,
+ const NewtonJoint *const joint) {
+ Newton *world;
+
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world->DestroyJoint((dgConstraint *)joint);
+}
+
+// ***************************************************************************************************************
+//
+// Name: Special effect mesh interface
+//
+// ***************************************************************************************************************
+
+NewtonMesh *NewtonMeshCreate(const NewtonWorld *const newtonWorld) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ Newton *world = (Newton *)newtonWorld;
+ dgMeshEffect *mesh = new (world->dgWorld::GetAllocator()) dgMeshEffect(
+ world->dgWorld::GetAllocator(), true);
+ return (NewtonMesh *)mesh;
+}
+
+NewtonMesh *NewtonMeshCreateFromMesh(const NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgMeshEffect *srcMesh = (dgMeshEffect *)mesh;
+
+ dgMeshEffect *clone = new (srcMesh->GetAllocator()) dgMeshEffect(*srcMesh);
+ return (NewtonMesh *)clone;
+}
+
+NewtonMesh *NewtonMeshCreateFromCollision(
+ const NewtonCollision *const collision) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ dgCollision *const shape = (dgCollision *)collision;
+ dgMeshEffect *const mesh = new (shape->GetAllocator()) dgMeshEffect(shape);
+ return (NewtonMesh *)mesh;
+}
+
+NewtonMesh *NewtonMeshConvexHull(const NewtonWorld *const newtonWorld,
+ int count, const dFloat *const vertexCloud, int strideInBytes,
+ dFloat tolerance) {
+ TRACE_FUNTION(__FUNCTION__);
+ Newton *const world = (Newton *)newtonWorld;
+ dgStack<dgBigVector> pool(count);
+
+ dgInt32 stride = strideInBytes / sizeof(dgFloat32);
+ for (dgInt32 i = 0; i < count; i++) {
+ pool[i].m_x = vertexCloud[i * stride + 0];
+ pool[i].m_y = vertexCloud[i * stride + 1];
+ pool[i].m_z = vertexCloud[i * stride + 2];
+ pool[i].m_w = dgFloat64(0.0);
+ }
+ dgMeshEffect *const mesh = new (world->dgWorld::GetAllocator()) dgMeshEffect(
+ world->dgWorld::GetAllocator(), &pool[0].m_x, count, sizeof(dgBigVector),
+ tolerance);
+ return (NewtonMesh *)mesh;
+}
+
+/*
+ NewtonMesh* NewtonMeshCreatePlane (const NewtonWorld* const newtonWorld, const dFloat* const locationMatrix, dFloat witdth, dFloat breadth, int material, const dFloat* const textureMatrix0, const dFloat* const textureMatrix1)
+ {
+ TRACE_FUNTION(__FUNCTION__);
+
+ Newton* world = (Newton *) newtonWorld;
+ dgMeshEffect* mesh = new (world->dgWorld::GetAllocator()) dgMeshEffect (world->dgWorld::GetAllocator(), *(dgMatrix*)locationMatrix, witdth, breadth, material, *(dgMatrix*)textureMatrix0, *(dgMatrix*)textureMatrix1);
+ return (NewtonMesh*) mesh;
+ }
+ */
+
+void NewtonMeshDestroy(const NewtonMesh *const mesh) {
+
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *const)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ delete meshEffect;
+}
+
+void NewtonMesApplyTransform(NewtonMesh *const mesh, const dFloat *const matrix) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgMeshEffect *const meshEffect = (dgMeshEffect *const)mesh;
+
+ dgMatrix transform(*((dgMatrix *)matrix));
+ meshEffect->ApplyTransform(transform);
+}
+
+void NewtonMeshCalculateOOBB(const NewtonMesh *const mesh, dFloat *const matrix,
+ dFloat *const x, dFloat *const y, dFloat *const z) {
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *const)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgBigVector size;
+ dgMatrix alignMatrix(meshEffect->CalculateOOBB(size));
+
+ *((dgMatrix *)matrix) = alignMatrix;
+ *x = dgFloat32(size.m_x);
+ *y = dgFloat32(size.m_y);
+ *z = dgFloat32(size.m_z);
+}
+
+void NewtonMeshCalculateVertexNormals(NewtonMesh *const mesh,
+ dFloat angleInRadians) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *const)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ meshEffect->CalculateNormals(angleInRadians);
+}
+
+void NewtonMeshApplySphericalMapping(NewtonMesh *const mesh, int material) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *const)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ meshEffect->SphericalMapping(material);
+}
+
+void NewtonMeshApplyBoxMapping(NewtonMesh *const mesh, int front,
+ int side, int top) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *const)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ meshEffect->BoxMapping(front, side, top);
+}
+
+void NewtonMeshApplyCylindricalMapping(NewtonMesh *const mesh,
+ int cylinderMaterial, int capMaterial) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *const)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ meshEffect->CylindricalMapping(cylinderMaterial, capMaterial);
+}
+
+void NewtonMeshTriangulate(NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+ ((dgMeshEffect *)mesh)->Triangulate();
+}
+
+void NewtonMeshPolygonize(NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ ((dgMeshEffect *const)mesh)->ConvertToPolygons();
+}
+
+int NewtonMeshIsOpenMesh(const NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ return ((const dgMeshEffect *)mesh)->HasOpenEdges() ? 1 : 0;
+}
+
+void NewtonMeshFixTJoints(NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ return ((dgMeshEffect *)mesh)->RepairTJoints(false);
+}
+
+void NewtonMeshClip(const NewtonMesh *const mesh,
+ const NewtonMesh *const clipper, const dFloat *const clipperMatrix,
+ NewtonMesh **const topMesh, NewtonMesh **const bottomMesh) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ *topMesh = NULL;
+ *bottomMesh = NULL;
+ dgMatrix &matrix = *((dgMatrix *)clipperMatrix);
+
+ ((const dgMeshEffect *)mesh)->ClipMesh(matrix, (const dgMeshEffect *)clipper, (dgMeshEffect **)topMesh, (dgMeshEffect **)bottomMesh);
+}
+
+void NewtonMeshPlaneClip(const NewtonMesh *const mesh,
+ dFloat *const planeMatrix, const dFloat *const planeTextureMatrix,
+ int planeMaterial, NewtonMesh **const topMesh,
+ NewtonMesh **const bottomMesh) {
+ TRACE_FUNTION(__FUNCTION__);
+ *topMesh = NULL;
+ *bottomMesh = NULL;
+ dgMatrix &matrix = *((dgMatrix *)planeMatrix);
+ const dgMatrix &texMatrix = *((const dgMatrix *)planeTextureMatrix);
+ ((const dgMeshEffect *)mesh)->PlaneClipMesh(matrix, texMatrix, planeMaterial, (dgMeshEffect **)topMesh, (dgMeshEffect **)bottomMesh);
+}
+
+NewtonMesh *NewtonMeshApproximateConvexDecomposition(const NewtonMesh *const mesh, dFloat maxConcavity, int maxCount) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ return (NewtonMesh *)((dgMeshEffect *)mesh)->CreateConvexApproximation(maxConcavity, maxCount);
+}
+
+NewtonMesh *NewtonMeshTetrahedralization(const NewtonMesh *const mesh,
+ int internalMaterial, const dFloat *const textureMatrix) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgMatrix &tetMatrix = *((dgMatrix *)textureMatrix);
+ return (NewtonMesh *)((dgMeshEffect *)mesh)->CreateDelanayTretrahedralization(internalMaterial, tetMatrix);
+}
+
+NewtonMesh *NewtonMeshVoronoiDecomposition(const NewtonMesh *const mesh,
+ int pointCount, int pointStrideInBytes, const dFloat *const pointCloud,
+ int internalMaterial, const dFloat *const textureMatrix) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgMatrix &tetMatrix = *((dgMatrix *)textureMatrix);
+ return (NewtonMesh *)((dgMeshEffect *)mesh)->CreateVoronoiPartition(pointCount, pointStrideInBytes, pointCloud, internalMaterial, tetMatrix);
+}
+
+NewtonMesh *NewtonMeshUnion(const NewtonMesh *const mesh,
+ const NewtonMesh *const clipper, const dFloat *const clipperMatrix) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgMatrix &matrix = *((dgMatrix *)clipperMatrix);
+
+ return (NewtonMesh *)((dgMeshEffect *)mesh)->Union(matrix, (dgMeshEffect *)clipper);
+}
+
+NewtonMesh *NewtonMeshDifference(const NewtonMesh *const mesh,
+ const NewtonMesh *const clipper, const dFloat *const clipperMatrix) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgMatrix &matrix = *((dgMatrix *)clipperMatrix);
+
+ return (NewtonMesh *)((dgMeshEffect *)mesh)->Difference(matrix, (dgMeshEffect *)clipper);
+}
+
+NewtonMesh *NewtonMeshIntersection(const NewtonMesh *const mesh,
+ const NewtonMesh *const clipper, const dFloat *const clipperMatrix) {
+ TRACE_FUNTION(__FUNCTION__);
+ dgMatrix &matrix = *((dgMatrix *)clipperMatrix);
+
+ return (NewtonMesh *)((dgMeshEffect *)mesh)->Intersection(matrix, (dgMeshEffect *)clipper);
+}
+
+void NewtonRemoveUnusedVertices(const NewtonMesh *const mesh,
+ int *const vertexRemapTable) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ ((dgMeshEffect *)mesh)->RemoveUnusedVertices(vertexRemapTable);
+}
+
+void NewtonMeshBeginFace(const NewtonMesh *const mesh) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ meshEffect->BeginPolygon();
+}
+
+void NewtonMeshAddFace(const NewtonMesh *const mesh, int vertexCount,
+ const dFloat *const vertex, int strideInBytes, int materialIndex) {
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ meshEffect->AddPolygon(vertexCount, vertex, strideInBytes, materialIndex);
+}
+
+void NewtonMeshEndFace(const NewtonMesh *const mesh) {
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ meshEffect->EndPolygon(dgFloat64(1.0e-8f));
+}
+
+void NewtonMeshBuildFromVertexListIndexList(const NewtonMesh *const mesh,
+ int faceCount, const int *const faceIndexCount,
+ const int *const faceMaterialIndex, const dFloat *const vertex,
+ int vertexStrideInBytes, const int *const vertexIndex,
+ const dFloat *const normal, int normalStrideInBytes,
+ const int *const normalIndex, const dFloat *const uv0, int uv0StrideInBytes,
+ const int *const uv0Index, const dFloat *const uv1, int uv1StrideInBytes,
+ const int *const uv1Index) {
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ meshEffect->BuildFromVertexListIndexList(faceCount, faceIndexCount,
+ faceMaterialIndex, vertex, vertexStrideInBytes, vertexIndex, normal,
+ normalStrideInBytes, normalIndex, uv0, uv0StrideInBytes, uv0Index, uv1,
+ uv1StrideInBytes, uv1Index);
+}
+
+int NewtonMeshGetVertexCount(const NewtonMesh *const mesh) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ // return meshEffect->GetPropertiesCount();
+ return meshEffect->GetVertexCount();
+}
+
+int NewtonMeshGetVertexStrideInByte(const NewtonMesh *const mesh) {
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->GetVertexStrideInByte();
+}
+
+dFloat64 *NewtonMeshGetVertexArray(const NewtonMesh *const mesh) {
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->GetVertexPool();
+}
+
+int NewtonMeshGetPointCount(const NewtonMesh *const mesh) {
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->GetPropertiesCount();
+}
+
+int NewtonMeshGetPointStrideInByte(const NewtonMesh *const mesh) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->GetPropertiesStrideInByte();
+}
+
+dFloat64 *NewtonMeshGetPointArray(const NewtonMesh *const mesh) {
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->GetAttributePool();
+}
+
+dFloat64 *NewtonMeshGetNormalArray(const NewtonMesh *const mesh) {
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->GetNormalPool();
+}
+
+dFloat64 *NewtonMeshGetUV0Array(const NewtonMesh *const mesh) {
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->GetUV0Pool();
+}
+
+dFloat64 *NewtonMeshGetUV1Array(const NewtonMesh *const mesh) {
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->GetUV1Pool();
+}
+
+void NewtonMeshGetVertexStreams(const NewtonMesh *const mesh,
+ dgInt32 vetexStrideInByte, dFloat *const vertex, dgInt32 normalStrideInByte,
+ dFloat *const normal, dgInt32 uvStrideInByte0, dFloat *const uv0,
+ dgInt32 uvStrideInByte1, dFloat *const uv1) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ meshEffect->GetVertexStreams(vetexStrideInByte, (dgFloat32 *)vertex,
+ normalStrideInByte, (dgFloat32 *)normal, uvStrideInByte0,
+ (dgFloat32 *)uv0, uvStrideInByte1, (dgFloat32 *)uv1);
+}
+
+void NewtonMeshGetIndirectVertexStreams(const NewtonMesh *const mesh,
+ int vetexStrideInByte, dFloat *const vertex, int *const vertexIndices,
+ int *const vertexCount, int normalStrideInByte, dFloat *const normal,
+ int *const normalIndices, int *const normalCount, int uvStrideInByte0,
+ dFloat *const uv0, int *const uvIndices0, int *const uvCount0,
+ int uvStrideInByte1, dFloat *const uv1, int *const uvIndices1,
+ int *const uvCount1) {
+ _ASSERTE(0);
+ /*
+
+ dgMeshEffect* const meshEffect = (dgMeshEffect*) mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ meshEffect->GetIndirectVertexStreams (vetexStrideInByte, (dgFloat32*) vertex, (dgInt32*) vertexIndices, (dgInt32*) vertexCount,
+ normalStrideInByte, (dgFloat32*) normal, (dgInt32*) normalIndices, (dgInt32*) normalCount,
+ uvStrideInByte0, (dgFloat32*) uv0, (dgInt32*) uvIndices0, (dgInt32*) uvCount0,
+ uvStrideInByte1, (dgFloat32*) uv1, (dgInt32*) uvIndices1, (dgInt32*) uvCount1);
+ */
+}
+
+void *NewtonMeshBeginHandle(const NewtonMesh *const mesh) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->MaterialGeometryBegin();
+}
+
+void NewtonMeshEndHandle(const NewtonMesh *const mesh, void *const handle) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+
+ meshEffect->MaterialGeomteryEnd((dgMeshEffect::dgIndexArray *)handle);
+}
+
+int NewtonMeshFirstMaterial(const NewtonMesh *const mesh, void *const handle) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->GetFirstMaterial((dgMeshEffect::dgIndexArray *)handle);
+}
+
+int NewtonMeshNextMaterial(const NewtonMesh *const mesh, void *const handle,
+ int materialId) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->GetNextMaterial((dgMeshEffect::dgIndexArray *)handle,
+ materialId);
+}
+
+int NewtonMeshMaterialGetMaterial(const NewtonMesh *const mesh,
+ void *const handle, int materialId) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->GetMaterialID((dgMeshEffect::dgIndexArray *)handle,
+ materialId);
+}
+
+int NewtonMeshMaterialGetIndexCount(const NewtonMesh *const mesh,
+ void *const handle, int materialId) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return meshEffect->GetMaterialIndexCount((dgMeshEffect::dgIndexArray *)handle,
+ materialId);
+}
+
+void NewtonMeshMaterialGetIndexStream(const NewtonMesh *const mesh,
+ void *const handle, int materialId, int *const index) {
+
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+
+ TRACE_FUNTION(__FUNCTION__);
+ meshEffect->GetMaterialGetIndexStream((dgMeshEffect::dgIndexArray *)handle,
+ materialId, index);
+}
+
+void NewtonMeshMaterialGetIndexStreamShort(const NewtonMesh *const mesh,
+ void *const handle, int materialId, short int *const index) {
+ dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ TRACE_FUNTION(__FUNCTION__);
+ meshEffect->GetMaterialGetIndexStreamShort(
+ (dgMeshEffect::dgIndexArray *)handle, materialId, index);
+}
+
+NewtonMesh *NewtonMeshCreateFirstSingleSegment(const NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ dgMeshEffect *const effectMesh = (dgMeshEffect *)mesh;
+
+ dgPolyhedra segment(effectMesh->GetAllocator());
+
+ effectMesh->BeginConectedSurface();
+ if (effectMesh->GetConectedSurface(segment)) {
+ dgMeshEffect *const solid = new (effectMesh->GetAllocator()) dgMeshEffect(
+ segment, *((dgMeshEffect *)mesh));
+ return (NewtonMesh *)solid;
+ } else {
+ return NULL;
+ }
+}
+
+NewtonMesh *NewtonMeshCreateNextSingleSegment(const NewtonMesh *const mesh,
+ const NewtonMesh *const segment) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ dgMeshEffect *const effectMesh = (dgMeshEffect *)mesh;
+ dgPolyhedra nextSegment(effectMesh->GetAllocator());
+
+ _ASSERTE(segment);
+ dgInt32 moreSegments = effectMesh->GetConectedSurface(nextSegment);
+
+ dgMeshEffect *solid;
+ if (moreSegments) {
+ solid = new (effectMesh->GetAllocator()) dgMeshEffect(nextSegment,
+ *effectMesh);
+ } else {
+ solid = NULL;
+ effectMesh->EndConectedSurface();
+ }
+
+ return (NewtonMesh *)solid;
+}
+
+NewtonMesh *NewtonMeshCreateFirstLayer(const NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ dgMeshEffect *const effectMesh = (dgMeshEffect *)mesh;
+ return (NewtonMesh *)effectMesh->GetFirstLayer();
+}
+
+NewtonMesh *NewtonMeshCreateNextLayer(const NewtonMesh *const mesh,
+ const NewtonMesh *const segment) {
+ TRACE_FUNTION(__FUNCTION__);
+
+ dgMeshEffect *const effectMesh = (dgMeshEffect *)mesh;
+ return (NewtonMesh *)effectMesh->GetNextLayer((dgMeshEffect *)segment);
+}
+
+int NewtonMeshGetTotalFaceCount(const NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetTotalFaceCount();
+}
+
+int NewtonMeshGetTotalIndexCount(const NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetTotalIndexCount();
+}
+
+void NewtonMeshGetFaces(const NewtonMesh *const mesh, int *const faceIndexCount,
+ int *const faceMaterial, void **const faceIndices) {
+ ((dgMeshEffect *)mesh)->GetFaces(faceIndexCount, faceMaterial, faceIndices);
+}
+
+void *NewtonMeshGetFirstVertex(const NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetFirstVertex();
+}
+
+void *NewtonMeshGetNextVertex(const NewtonMesh *const mesh,
+ const void *const vertex) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetNextVertex(vertex);
+}
+
+int NewtonMeshGetVertexIndex(const NewtonMesh *const mesh,
+ const void *const vertex) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetVertexIndex(vertex);
+}
+
+void *NewtonMeshGetFirstPoint(const NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetFirstPoint();
+}
+void *NewtonMeshGetNextPoint(const NewtonMesh *const mesh,
+ const void *const point) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetNextPoint(point);
+}
+
+int NewtonMeshGetPointIndex(const NewtonMesh *const mesh,
+ const void *const point) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetPointIndex(point);
+}
+
+int NewtonMeshGetVertexIndexFromPoint(const NewtonMesh *const mesh,
+ const void *const point) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetVertexIndexFromPoint(point);
+}
+
+void *NewtonMeshGetFirstEdge(const NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetFirstEdge();
+}
+
+void *NewtonMeshGetNextEdge(const NewtonMesh *const mesh,
+ const void *const edge) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetNextEdge(edge);
+}
+
+void NewtonMeshGetEdgeIndices(const NewtonMesh *const mesh,
+ const void *const edge, int *const v0, int *const v1) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetEdgeIndex(edge, *v0, *v1);
+}
+
+// void NewtonMeshGetEdgePointIndices (const NewtonMesh* const mesh, const void* const edge, int* const v0, int* const v1)
+//{
+// return ((dgMeshEffect*)mesh)->GetEdgeAttributeIndex (edge, *v0, *v1);
+// }
+
+void *NewtonMeshGetFirstFace(const NewtonMesh *const mesh) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetFirstFace();
+}
+
+void *NewtonMeshGetNextFace(const NewtonMesh *const mesh,
+ const void *const face) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetNextFace(face);
+}
+
+int NewtonMeshIsFaceOpen(const NewtonMesh *const mesh, const void *const face) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->IsFaceOpen(face);
+}
+
+int NewtonMeshGetFaceIndexCount(const NewtonMesh *const mesh,
+ const void *const face) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetFaceIndexCount(face);
+}
+
+int NewtonMeshGetFaceMaterial(const NewtonMesh *const mesh,
+ const void *const face) {
+ TRACE_FUNTION(__FUNCTION__);
+ return ((dgMeshEffect *)mesh)->GetFaceMaterial(face);
+}
+
+void NewtonMeshGetFaceIndices(const NewtonMesh *const mesh,
+ const void *const face, int *const indices) {
+ TRACE_FUNTION(__FUNCTION__);
+ ((dgMeshEffect *)mesh)->GetFaceIndex(face, indices);
+}
+
+void NewtonMeshGetFacePointIndices(const NewtonMesh *const mesh,
+ const void *const face, int *const indices) {
+ TRACE_FUNTION(__FUNCTION__);
+ ((dgMeshEffect *)mesh)->GetFaceAttributeIndex(face, indices);
+}
+
+#if 0
+
+// ***************************************************************************************************************
+//
+// Name: Rag doll joint container Interface
+//
+// ***************************************************************************************************************
+
+// Name: NewtonCreateRagDoll
+// Create an empty rag doll container.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+//
+// Return: handle to an empty rag doll container.
+//
+// Remarks: A rag doll container is the encapsulation of a group of ball and socket joints, under a common object. It provides common functional
+// shared by all joints in the tree like structure. The rag doll object job is to simplify some of the common task that the programmer encounters
+// when it tries to make a rag doll model by connecting joints.
+// It also has some limitations, for example the hierarchy of joints is made of Ball and socket joints, it only support tree like structures of
+// joints, the joints can not by detached from the array once they are added to the rag doll.
+// Rag doll joints are good to make articulated creatures, like humans, monsters, horses, etc.
+// They are good to simulate effects like death of a character in a game.
+//
+// See also: NewtonDestroyRagDoll
+NewtonRagDoll* NewtonCreateRagDoll(const NewtonWorld* newtonWorld)
+{
+ Newton* world;
+
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return (NewtonRagDoll*) world->RagDollList::Create(world);
+}
+
+// Name: NewtonDestroyRagDoll
+// Destroy a rag doll containers and all it components.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const NewtonRagDoll* *ragDoll - handle to a rag doll container.
+//
+// Return: nothing
+//
+// See also: NewtonCreateRagDoll
+void NewtonDestroyRagDoll(const NewtonWorld* newtonWorld, const NewtonRagDoll* ragDoll)
+{
+ Newton* world;
+
+ world = (Newton *)newtonWorld;
+
+ TRACE_FUNTION(__FUNCTION__);
+ world->RagDollList::Destroy ((RagdollHeader*) ragDoll);
+}
+
+// Name: NewtonRagDollBegin
+// Prepare a rag doll object to accept bones and making the skeleton.
+//
+// Parameters:
+// *const NewtonRagDoll* *ragDoll - handle to a rag doll container.
+//
+// Return: nothing
+//
+// Remarks: This function will clean up the rag doll container of any previously
+// added bone. After the constructions process of the rag doll is completed the application should call
+// *NewtonRagDollEnd*, not doing so will result in unpredictable results.
+//
+// See also: NewtonRagDollEnd, NewtonRagDollAddBone, SetExtForceAndTorqueCallback, SetTransformCallback
+void NewtonRagDollBegin(const NewtonRagDoll* ragDoll)
+{
+ RagdollHeader* ragDollHeader;
+
+ ragDollHeader = (RagdollHeader*) ragDoll;
+
+ TRACE_FUNTION(__FUNCTION__);
+ ragDollHeader->Begin();
+}
+
+// Name: NewtonRagDollEnd
+// Finalized the rag doll construction process.
+//
+// Parameters:
+// *const NewtonRagDoll* *ragDoll - handle to a rag doll container.
+//
+// Return: nothing
+//
+// Remarks: This function should be called after the constructions process of the rag doll in completed.
+// calling this function without first calling *NewtonRagDollBegin* will produce unpredictable results.
+//
+// See also: NewtonRagDollBegin
+void NewtonRagDollEnd(const NewtonRagDoll* ragDoll)
+{
+ RagdollHeader* ragDollHeader;
+
+ ragDollHeader = (RagdollHeader*) ragDoll;
+
+ TRACE_FUNTION(__FUNCTION__);
+ ragDollHeader->End();
+}
+
+// Name: NewtonRagDollAddBone
+// Add a bone to a rag doll objects.
+//
+// Parameters:
+// *const NewtonRagDoll* *ragDoll - handle to a rag doll container.
+// *const NewtonRagDollBone* *parent - handle to the bone parent for this bone. If this is the root bone the *parent* should be NULL.
+// *void* *userData - user data value. The application can use this parameter to store the pointer on index into the graphical part representing this bone.
+// *dFloat* mass - mass of this body part.
+// *const dFloat* *matrix - pointer to a 4x4 transformation matrix in the local space of the bone. The matrix should be expressed relative to the parent bone.
+// *const NewtonCollision* *boneCollision - bone collision geometry.
+// *const dFloat* size - pointer to an array of three dFloat specifying the size of this body part. The first component of the array is interpreted as the length of the bone.
+//
+// Return: the handle to a Rag doll bone
+//
+// Remarks: The user data value of a rag doll rigid body is set to the *NewtonRagDollBone*, Unpredictable result will happens if the application set the
+// user data of a rag doll node rigid body.
+//
+// Remarks: this function can only be called from inside of a NewtonRagDollBegin/NewtonRagDollEnd pair.
+//
+// See also: NewtonRagDollBegin
+NewtonRagDollBone* NewtonRagDollAddBone(const NewtonRagDoll* ragDoll, const NewtonRagDollBone* parent, void *userData,
+ dFloat mass, const dFloat* matrix, const NewtonCollision* boneCollision, const dFloat* size)
+{
+ dgCollision *collision;
+ RagdollHeader* ragDollHeader;
+
+ TRACE_FUNTION(__FUNCTION__);
+ ragDollHeader = (RagdollHeader*) ragDoll;
+
+ dgMatrix boneMatrix (*(dgMatrix*) matrix);
+ dgVector boneSize (size[0], size[1], size[2], dgFloat32 (0.0f));
+ collision = (dgCollision *)boneCollision;
+
+ return (NewtonRagDollBone*) ragDollHeader->AddBone ((RagdollBone*) parent, userData, mass, boneMatrix, collision, boneSize);
+}
+
+// Name: NewtonRagDollBoneGetUserData
+// Retrieve a user defined data value stored with the rag doll bone.
+//
+// Parameters:
+// *const NewtonRagDollBone* *bone - pointer to the bone.
+//
+// Return: The user defined data.
+//
+// Remarks: The application can store a user defined value with a rigid body. This value can be the pointer
+// to a structure which is the graphical representation of the bone.
+//
+// See also: NewtonRagDollAddBone
+void* NewtonRagDollBoneGetUserData(const NewtonRagDollBone* bone)
+{
+ RagdollBone* dollBone;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dollBone = (RagdollBone*) bone;
+ return dollBone->GetUserData();
+}
+
+// Name: NewtonRagDollSetTransformCallback
+// Assign a transformation event function to a rag doll object.
+//
+// Parameters:
+// *const NewtonRagDoll* *ragDoll - handle to a rag doll container.
+// *NewtonSetRagDollTransform callback - pointer to a function callback is used to update the transformation matrix of the visual object that represents the rag doll.
+//
+// Return: Nothing.
+//
+// Remarks: The function *NewtonSetRagDollTransform callback* is called by the Newton engine every time a visual object that represent a bone of a rag doll has changed.
+// The application can obtain the pointer user data value that points to the visual object.
+// The Newton engine does not call the *NewtonSetRagDollTransform callback* function for bones that are inactive or have reached a state of stable equilibrium.
+//
+// Remarks: The user data value of a rag doll rigid body is set to the *NewtonRagDollBone*, Unpredictable result will happens if the application set the
+// user data of a rag doll node rigid body.
+// The application can get the pointer to the application graphical data by retrieving the user data stored with the *NewtonRagDollBone*.
+//
+// Remarks: The matrix should be organized in row-major order (this is the way directX stores matrices).
+// If you are using OpenGL matrices (column-major) you will need to transpose the matrices into a local array, before
+// you pass them to Newton.
+//
+// Remarks: this function can only be called from inside of a NewtonRagDollBegin/NewtonRagDollEnd pair.
+//
+// See also: NewtonRagDollBegin, NewtonRagDollAddBone
+void NewtonRagDollSetTransformCallback(const NewtonRagDoll* ragDoll, NewtonSetRagDollTransform callback)
+{
+ RagdollHeader* ragDollHeader;
+
+ TRACE_FUNTION(__FUNCTION__);
+ ragDollHeader = (RagdollHeader*) ragDoll;
+ ragDollHeader->SetTransformCallback (callback);
+}
+
+// Name: NewtonRagDollSetForceAndTorqueCallback
+// Assign an event function for applying external force and torque to a Rag doll.
+//
+// Parameters:
+// *const NewtonRagDoll* *ragDoll - handle to a rag doll container.
+// *NewtonApplyForceAndTorque callback - pointer to a function callback used to apply force and torque to a rigid body bone.
+//
+// Return: Nothing.
+//
+// Remarks: this function can be seen as a utility function that will call *NewtonBodySetForceAndTorqueCallback* for every bone of a rag doll object.
+//
+// Remarks: The user data value of a rag doll rigid body is set to the *NewtonRagDollBone*, unpredictable result will happens if the application set the
+// user data of a rag doll node rigid body.
+// The application can get the pointer to the application graphical data by retrieving the user data stored with the *NewtonRagDollBone*.
+//
+// Remarks: Before the *NewtonApplyForceAndTorque callback* is called for a body, Newton first clears the net force and net torque for the body.
+//
+// Remarks: The function *NewtonApplyForceAndTorque callback* is called by the Newton Engine every time an active body is going to be simulated.
+// The Newton Engine does not call the *NewtonApplyForceAndTorque callback* function for bodies that are inactive or have reached a state of stable equilibrium.
+//
+// See also: NewtonRagDollBegin, NewtonRagDollAddBone
+void NewtonRagDollSetForceAndTorqueCallback(const NewtonRagDoll* ragDoll, NewtonApplyForceAndTorque callback)
+{
+ RagdollHeader* ragDollHeader;
+
+ TRACE_FUNTION(__FUNCTION__);
+ ragDollHeader = (RagdollHeader*) ragDoll;
+ ragDollHeader->SetExtForceAndTorqueCallback ((OnApplyExtForceAndTorque) callback);
+}
+
+// Name: NewtonRagDollBoneSetID
+// Set an id for this particular bone.
+//
+// Parameters:
+// *const NewtonRagDollBone* *bone - handle to the bone.
+// *int* id - identifier for this bone.
+//
+// Return: Nothing.
+//
+// Remarks: during the construction, the application has the option to set an identifier for each bone. It is good idea to make this identifier unique for the rag doll.
+//
+// See also: NewtonRagDollAddBone, NewtonRagDollFindBone
+void NewtonRagDollBoneSetID (const NewtonRagDollBone* bone, int id)
+{
+ RagdollBone* dollBone;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dollBone = (RagdollBone*) bone;
+ dollBone->SetNameID (id);
+}
+
+// Name: NewtonRagDollFindBone
+// Find the first bone with this id in this rag doll.
+//
+// Parameters:
+// *const NewtonRagDoll* *ragDoll - handle to a rag doll container.
+// *int* id - identifier for this bone.
+//
+// Return: the handle to the bone with this identifier. NULL if no bone in the rag doll has this id
+//
+// Remarks: during the construction, the application has the option to set an identifier for each bone. It is good idea to make this identifier unique for the rag doll.
+// the application can use this id to find particular bones in the rag doll body. This is useful for authoring tolls.
+//
+// See also: NewtonRagDollBoneSetID
+NewtonRagDollBone* NewtonRagDollFindBone(const NewtonRagDoll* ragDoll, int id)
+{
+ RagdollHeader* ragDollHeader;
+
+ TRACE_FUNTION(__FUNCTION__);
+ ragDollHeader = (RagdollHeader*) ragDoll;
+ return (NewtonRagDollBone*) ragDollHeader->FindBone (id);
+}
+
+// Name: NewtonRagDollBoneGetBody
+// Retrieve the rigid body assigned to this bone.
+//
+// Parameters:
+// *const NewtonRagDollBone* *bone - handle to the bone.
+//
+// Return: The rigid body assigned to this bone
+//
+// Remarks: this function can be used to customized some of the properties of the rigid body assigned to the bone.
+// the application should not override the pointer to *TransformCallback* or *ApplyForceAndTorque* of a rigid body assigned
+// to a Rag doll bone. It should call the functions *NewtonRagDollSetTransformCallback* and *NewtonRagDollSetForceAndTorqueCallback* instead.
+//
+// See also: NewtonRagDollAddBone, NewtonRagDollSetTransformCallback, NewtonRagDollSetForceAndTorqueCallback
+NewtonBody* NewtonRagDollBoneGetBody(const NewtonRagDollBone* bone)
+{
+ RagdollBone* dollBone;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dollBone = (RagdollBone*) bone;
+ return (NewtonBody*) dollBone->m_body;
+}
+
+// Name: NewtonRagDollBoneSetLimits
+// Set the stop limits for this bone.
+//
+// Parameters:
+// *const NewtonRagDollBone* *bone - handle to this particular bone. If this parameter is the root bone, then the limits do not have any effect.
+// *const dFloat* *coneDir - pointer to an array of tree dFloat specifying the direction in global space of the cone limits for this bone.
+// *dFloat* minConeAngle - minimum value of the cone of the cone limit.
+// *dFloat* maxConeAngle - maximum value of the cone of the cone limit.
+// *dFloat* maxTwistAngle - maximum and minimum that this bone is allow to spin around the coneDir.
+// *const dFloat* *lateralConeDir - this parameter is ignored in this release.
+// *dFloat* negativeBilateralConeAngle - this parameter is ignored in this release.
+// *dFloat* negativeBilateralConeAngle - this parameter is ignored in this release.
+//
+//
+// Remarks: This function set a cone fixed on the frame of the parent of this bone and defining the work space of the bone.
+//
+// See also: NewtonRagDollBegin
+void NewtonRagDollBoneSetLimits(const NewtonRagDollBone* bone, const dFloat* coneDir, dFloat minConeAngle, dFloat maxConeAngle, dFloat maxTwistAngle, const dFloat* lateralConeDir, dFloat negativeBilateralConeAngle, dFloat positiveBilateralConeAngle)
+{
+ RagdollBone* dollBone;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dollBone = (RagdollBone*) bone;
+
+ dgVector coneAxis (coneDir[0], coneDir[1], coneDir[2], dgFloat32 (0.0f));
+ // dgVector lateralAxis (lateralConeDir[0], lateralConeDir[1], lateralConeDir[2]);
+ dgVector lateralAxis (dgFloat32(1.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f));
+ dollBone->SetJointLimits (coneDir, minConeAngle, maxConeAngle, maxTwistAngle, lateralAxis, negativeBilateralConeAngle, positiveBilateralConeAngle);
+}
+
+// Name: NewtonRagDollBoneGetLocalMatrix
+// Get the transformation matrix for this bone in the local space of the bone.
+//
+// Parameters:
+// *const NewtonRagDollBone* *bone - handle to this particular bone. If this parameter is the root bone, then the limits do not have any effect.
+// *dFloat* *matrix - pointer to a 4x4 transformation matrix to receive the transformation matrix for this bone.
+//
+// Remarks: the application can call this function from a NewtonSetRagDollTransform to get the transformation matrix for the graphical representation of the bone in local space.
+//
+// See also: NewtonRagDollSetTransformCallback
+void NewtonRagDollBoneGetLocalMatrix(const NewtonRagDollBone* bone, dFloat* matrixPtr)
+{
+ RagdollBone* dollBone;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgMatrix& matrix (*((dgMatrix*) matrixPtr));
+ dollBone = (RagdollBone*) bone;
+ matrix = dollBone->GetBoneLocalMatrix ();
+}
+
+// Name: NewtonRagDollBoneGetGlobalMatrix
+// Get the transformation matrix for this bone in the global space of the bone.
+//
+// Parameters:
+// *const NewtonRagDollBone* *bone - handle to this particular bone. If this parameter is the root bone, then the limits do not have any effect.
+// *dFloat* *matrix - pointer to a 4x4 transformation matrix to receive the transformation matrix for this bone.
+//
+// Remarks: the application can call this function from a NewtonSetRagDollTransform to get the transformation matrix for the graphical representation of the bone in global space.
+//
+// See also: NewtonRagDollSetTransformCallback
+void NewtonRagDollBoneGetGlobalMatrix(const NewtonRagDollBone* bone, dFloat* matrixPtr)
+{
+ RagdollBone* dollBone;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgMatrix& matrix (*((dgMatrix*) matrixPtr));
+ dollBone = (RagdollBone*) bone;
+ matrix = dollBone->GetBoneMatrix ();
+}
+
+//void NewtonRagDollSetFriction (const NewtonRagDoll* ragDoll, dFloat friction)
+//{
+//RagdollHeader* ragDollHeader;
+//ragDollHeader = (RagdollHeader*) ragDoll;
+//ragDollHeader->SetFriction(friction);
+//}
+
+// ***************************************************************************************************************
+//
+// Name: Vehicle constraint interface
+//
+// ***************************************************************************************************************
+
+// Name: NewtonConstraintCreateVehicle
+// Create and empty vehicle joint.
+//
+// Parameters:
+// *const NewtonWorld* *newtonWorld - is the pointer to the Newton world.
+// *const dFloat* *upDir - is the unit vector defined by the tires pivot points, usually the opposite direction to the gravity vector.
+// *const NewtonBody* *body - is the pointer to the attached rigid body, this body can not be NULL or it can not have an infinity (zero) mass.
+//
+// Return: Pointer to the vehicle joint.
+//
+// Remarks: This joint provides basics functionality for simulating real-time simplistic vehicle dynamics. The joint is not meant to be and
+// accurate and realistic representation of a real vehicle, that is out of the scope of a real-time physics engine. The vehicle is made out
+// of a main rigid body visible to the application and attached to it a set of tires not visible to the application directly as rigid bodies.
+// The tires are connected to the body via rigid wheel joints providing the ability for the tire to spin, have suspension, and turn. The
+// internal vehicle mechanics like transmission, power transfer shaft, suspension mechanism, doors etc. It only models the vehicle body
+// mounted on a set of wheels, with suspension and the ability to roll.
+NewtonJoint* NewtonConstraintCreateVehicle(const NewtonWorld* newtonWorld, const dFloat* upDir, const NewtonBody* body)
+{
+ Newton* world;
+ dgBody *carBody;
+
+ TRACE_FUNTION(__FUNCTION__);
+ carBody = (dgBody *)body;
+ world = (Newton *)newtonWorld;
+ dgVector pin (upDir[0], upDir[1], upDir[2], dgFloat32 (0.0f));
+ return (NewtonJoint*) world->CreateVehicleContraint(pin, carBody);
+}
+
+// Name: NewtonVehicleSetTireCallback
+// Store a function callback pointer for vehicle update.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *NewtonVehicleTireUpdate* update - pointer to the callback function.
+//
+// Return: nothing
+//
+// Remarks: The only way to control a vehicle is by implementing the vehicle update callback.
+// The application should iterate through each tire applying tire dynamics to each one.
+//
+// See also: NewtonVehicleGetFirstTireID, NewtonVehicleGetNextTireID
+void NewtonVehicleSetTireCallback(const NewtonJoint* vehicle, NewtonVehicleTireUpdate update)
+{
+ dgVehicleConstraint* joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ joint = (dgVehicleConstraint*)vehicle;
+ joint->SetTireCallback ((OnVehicleUpdate) update);
+}
+
+// Name: NewtonVehicleAddTire
+// Add a new tire to the vehicle container.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *const dFloat* *localMatrix - pointer to an array of 16 floats containing the offset of the tire relative to the vehicle body.
+// *const dFloat* pin - pointer to an array of 3 floats containing the rotation axis of the tire, in the space of the tire.
+// *dFloat* mass - tire mass, must be much smaller than the vehicle body. ratio of 50:1 to 100:1 are the recommended values.
+// *dFloat* width - width of the tire, must be smaller than the tire radius.
+// *dFloat* radius - tire radius.
+// *dFloat* suspesionShock - parametrized damping constant for a spring, mass, damper system. A value of one corresponds to a critically damped system.
+// *dFloat* suspesionSpring - parametrized spring constant for a spring, mass, damper system. A value of one corresponds to a critically damped system.
+// *dFloat* suspesionLength - distance from the tire set position to the upper stop on the vehicle body frame. The total suspension length is twice that.
+// *void* *userData - pointer to a user define data value. Usually used to store the pointer to the graphical representation of the tire.
+// *int* collisionID - the collision ID use by the application to identify the tire contacts in a contact callback function.
+//
+// Return: the tire ID.
+//
+// Remarks: After the application creates the vehicle joint, it must add the tires.
+// Tires are added one at a time at the graphics set position and with the appropriate.
+// the application should calculate the correct tire parameters, like tire mass, position, width height,
+// spring and damper constants.
+//
+// See also: NewtonVehicleRemoveTire
+void* NewtonVehicleAddTire(const NewtonJoint* vehicle, const dFloat* localMatrix, const dFloat* pin, dFloat mass, dFloat width, dFloat radius,
+ dFloat suspesionShock, dFloat suspesionSpring, dFloat suspesionLength, void* userData, int collisionID)
+{
+ dgVehicleConstraint* joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ joint = (dgVehicleConstraint*)vehicle;
+
+ dgMatrix& matrix (*((dgMatrix*) localMatrix));
+ dgVector tirePin (pin[0], pin[1], pin[2], dgFloat32 (0.0f));
+ //return joint->AddTire (matrix, pin, mass, width, radius, suspesionShock, suspesionSpring, suspesionLength, (void*)(dgUnsigned64(collisionID)), userData);
+ return joint->AddTire (matrix, pin, mass, width, radius, suspesionShock, suspesionSpring, suspesionLength, IntToPointer(collisionID), userData);
+}
+
+// Name: NewtonVehicleReset
+// Reset all tires velocities to zero.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+//
+// Return: nothing.
+//
+// This function is useful for reposition the vehicle.
+void NewtonVehicleReset(const NewtonJoint* vehicle)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->Reset();
+}
+
+// Name: NewtonVehicleRemoveTire
+// Detach and destroy a tire from the vehicle.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - tire index to be destroyed.
+//
+// Return: nothing.
+void NewtonVehicleRemoveTire(const NewtonJoint* vehicle, void* tireId)
+{
+ dgVehicleConstraint* joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ joint = (dgVehicleConstraint*)vehicle;
+ joint->RemoveTire (tireId);
+}
+
+// Name: NewtonVehicleGetFirstTireID
+// Get the index of the first tire of the vehicle tire set.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+//
+// Return: tire index.
+//
+// Remarks: This function is usually used from inside the vehicle update callback. It is used to iterate through the tire set applying the tire dynamics.
+//
+// See also: NewtonVehicleGetNextTireID
+void* NewtonVehicleGetFirstTireID(const NewtonJoint* vehicle)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ return joint->GetFirstTireIndex();
+}
+
+// Name: NewtonVehicleGetNextTireID
+// Get the index of the next tire on the tire set.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+//
+// Return: Next tire index, or zero if index *tireId* was pointing to the last tire in the set.
+//
+// Remarks: This function is usually used from inside a tire update callback. It is used to iterate through the tire set applying the tire dynamics.
+//
+// See also: NewtonVehicleGetFirstTireID
+void* NewtonVehicleGetNextTireID(const NewtonJoint* vehicle, void* tireId)
+{
+ dgVehicleConstraint* joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ joint = (dgVehicleConstraint*)vehicle;
+ return joint->GetNextTireIndex(tireId);
+}
+
+// Name: NewtonVehicleGetTireUserData
+// Retrieve the pointer to the tire user data.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+//
+// Return: tire user data.
+//
+// Remarks: This function is usually used from the vehicle update callback or from transformation callback of the vehicle body,
+// It can used do set the transformation matrix of the tire graphical representation.
+void* NewtonVehicleGetTireUserData (const NewtonJoint* vehicle, void* tireId)
+{
+ dgVehicleConstraint* joint;
+
+ TRACE_FUNTION(__FUNCTION__);
+ joint = (dgVehicleConstraint*)vehicle;
+ return joint->GetTireUserData (tireId);
+}
+
+// Name: NewtonVehicleGetTireMatrix
+// Retrieve the transformation matrix of the tire in global space.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+// *dFloat* matrix - pointer to an array of 16 floats containing the global matrix of the tire.
+//
+// Return: nothing
+//
+// Remarks: This function is usually used from the tire update callback or from transformation callback of the vehicle body,
+// It can be used to set the transformation of the tire graphical representation.
+void NewtonVehicleGetTireMatrix(const NewtonJoint* vehicle, void* tireId, dFloat* matrix)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ dgMatrix& retMatrix = *((dgMatrix*) matrix);
+ joint->GetTireMatrix (tireId, retMatrix);
+}
+
+// Name: NewtonVehicleGetTireSteerAngle
+// Get the tire steering angle.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+//
+// Return: steering angle.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application wants to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+dFloat NewtonVehicleGetTireSteerAngle(const NewtonJoint* vehicle, void* tireId)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->GetSteerAngle(tireId);
+}
+
+// Name: NewtonVehicleSetTireSteerAngle
+// Set the tire steering angle.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+// *dFloat* angle - new steering angle.
+//
+// Return: nothing.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application wants to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+void NewtonVehicleSetTireSteerAngle(const NewtonJoint* vehicle, void* tireId, dFloat angle)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->SetSteerAngle(tireId, angle);
+}
+
+// Name: NewtonVehicleSetTireTorque
+// Set the tire torque.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+// *dFloat* torque - new torque value.
+//
+// Return: nothing.
+//
+// Remarks: This function is useful to simulate normal vehicles with wheels that propel by applying torque to a the tire axis
+// in order to move.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application wants to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+void NewtonVehicleSetTireTorque(const NewtonJoint* vehicle, void* tireId, dFloat torque)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->SetTireTorque(tireId, torque);
+}
+
+// Name: NewtonVehicleGetTireOmega
+// Retrieve the tire angular velocity.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+//
+// Return: angular velocity.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application wants to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+dFloat NewtonVehicleGetTireOmega(const NewtonJoint* vehicle, void* tireId)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->GetTireOmega(tireId);
+}
+
+// Name: NewtonVehicleGetTireNormalLoad
+// Return the part of the vehicle weight supported by this tire.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+//
+// Return: magnitude of the vehicle weight supported by this tire.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application wants to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+dFloat NewtonVehicleGetTireNormalLoad(const NewtonJoint* vehicle, void* tireId)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->GetTireNormalLoad(tireId);
+}
+
+// Name: NewtonVehicleTireSetBrakeAcceleration
+// Apply the acceleration and max friction torque to a tire axis.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+// *dFloat* acceleration - desire tire acceleration.
+// *dFloat* maxFrictionTorque - maximum friction torque the tire brake, or tire motor can withstand.
+//
+// Return: noting.
+//
+// Remarks: This is a multipurpose function. The more common use is to apply hand or soft brakes to a vehicle.
+// To apply brakes the application may use the function *NewtonVehicleTireSetBrakeAcceleration* to determine the exact acceleration
+// needed to stop the tire from continue to spin in one frame. To simulated the variable brakes strength the application can use
+// a nominal maximum friction torque (just like in real life any device will withstand a max value) and modulate this value with an analog
+// control. For hand brakes the application set the control to the maximum and for soft brakes it can just modulate the variable friction.
+// Another use for this function is to simulate rolling friction, For this effect the application apply the acceleration to stop
+// but with a friction value set to a minimum non zero fixed value. Note that brakes and tire torque are not mutually exclusive,
+// the application can apply then simultaneously. As a matter of fact doing so is quite a satisfying test showing how the vehicles rocks
+// forth and back due to the engine torque, while the tire prevent it from moving. Another use for this function is the simulation of
+// track based vehicles. For this the application apply an arbitrary fix acceleration to
+// the tires on each side of the vehicle. A function as simple as *A = Ad minus Ks x Omega* can do the trick, where Ad is the desire acceleration
+// controlled by the application joystick, Ks is some viscous velocity damping, and omega is the current tire angular velocity reported by the
+// function *NewtonVehicleGetTireOmega*.
+// To make the vehicle take turns the application can elaborate the equation like *A = Ad + At minus Ks x Omega* where At is the differential
+// acceleration supplied by the steering control, for the tires on the right side At is positive while for tires of the left side At is negative.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application wants to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+//
+// See also: NewtonVehicleTireCalculateMaxBrakeAcceleration, NewtonVehicleGetTireOmega
+void NewtonVehicleTireSetBrakeAcceleration(const NewtonJoint* vehicle, void* tireId, dFloat acceleration, dFloat maxFrictionTorque)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->TireSetBrakeAcceleration(tireId, acceleration, maxFrictionTorque);
+}
+
+// Name: NewtonVehicleTireCalculateMaxBrakeAcceleration
+// Calculate the exact acceleration needed to be applied to a tire axis in order to bring it to full stop in one time step.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+//
+// Return: exact acceleration for full stop of the tire.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application want to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+//
+// See also: NewtonVehicleTireSetBrakeAcceleration
+dFloat NewtonVehicleTireCalculateMaxBrakeAcceleration(const NewtonJoint* vehicle, void* tireId)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->TireCalculateMaxBrakeAcceleration(tireId);
+}
+
+// Name: NewtonVehicleGetTireLateralSpeed
+// Return the tire speed along the tire pin axis.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+//
+// Return: tire lateral speed.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application want to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+dFloat NewtonVehicleGetTireLateralSpeed(const NewtonJoint* vehicle, void* tireId)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->GetTireLateralSpeed(tireId);
+}
+
+// Name: NewtonVehicleGetTireLongitudinalSpeed
+// Return the tire speed along tire center line.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+//
+// Return: tire longitudinal speed.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application want to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+dFloat NewtonVehicleGetTireLongitudinalSpeed(const NewtonJoint* vehicle, void* tireId)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->GetTireLongitudinalSpeed(tireId);
+}
+
+// Name: NewtonVehicleSetTireMaxSideSleepSpeed
+// Set the maximum side slip velocity for the tire to be considered to lose grip.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+// *dFloat* speed - maximum side speed before the vehicle is considered to loose side grip.
+//
+// Return: nothing.
+//
+// Remarks: Tire operation involve a mix of elastic distortion and sliding friction. To have and idea how to code a convincing
+// approximation of a real tire we must run some experiment and make some reflection upon the result. First we will run a static
+// test: keeping a tire at equilibrium applying a constant load and without rolling, we will apply a lateral force perpendicular
+// to the tire plane and applied at the tire center. If we run this experiment we will find that the tire will deflect in response
+// to the lateral force. If we increase the magnitude of the lateral force, the magnitude of the deflection is proportional to the
+// magnitude of the lateral force, until the tire begins to slide. This show that when a tire is not moving it behaves like a spring
+// (elastic distortion). If we repeat this experiment but this time increasing the tire load, but still not moving the tire, we will
+// see that the max deflection is proportional to the magnitude of the tire load. This indicates the tire behavior is proportional
+// to two variables, the lateral force and the tire load. (Fortunately the side force in practice is a linear function of the tire
+// load so this keeps the model simple) Now we will run the first experiment but this time we will rotate the tire with a constant
+// angular velocity (think of those tune up machines at check up stations.) With the tire rolling at constant angular velocity if we
+// apply a lateral force we will see that as the tire deflect, the part of the tire in contact with the floor keeps rolling and another
+// part take its place, but this part also start to deflect, allowing the tire to move sideways with a velocity proportional to the
+// tire rolling angular velocity. Notice that the tire does this without sliding as the part of it in contact with the floor never
+// loses grip. Now if we increase the lateral force we will find that the lateral speed of the tire will also increase. This suggests
+// that the side speed of the tire is proportional to the lateral force and also proportional to the rolling angular velocity. This
+// is the tire elastic properties give then some kind of damping property when they are rolling. There is not known macroscopic
+// mathematical model that can explain this behavior. The best we can do is to write the values of the experiment and use then to
+// interpolate and extrapolate intermediate values. One thing we know is that the tires operates within some limits, and we can use
+// those parameters to treat then as a constraint optimization problem, which is the Newton approach. When the tire is rolling and
+// side slipping is not that the tire lost grip, nor that the tire is generating some force. It is rather that the tire have the
+// capacity to absorb some of the lateral force by sliding and convert it to side velocity, this means that for the tire to
+// loose grip a stronger force is necessary. In another word at rest a tire will lose grip under a much lower lateral force than
+// if the tire was rolling. In Newton this behavior is treaded as a constrain optimization problem by asking the application how
+// much side slip velocity is the tire allow to have before it is considered to lose grip, and how much of the lateral forces
+// generated by the rigid body dynamics will be adsorbed by the tire at a given speed. It is the application responsibility to
+// set these parameters as close to the real tire as it chooses. This approach allows for a very wide range of behaviors form arcade,
+// to toy cars to very realistic.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application want to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+//
+// See also: NewtonVehicleSetTireSideSleepCoeficient
+void NewtonVehicleSetTireMaxSideSleepSpeed(const NewtonJoint* vehicle, void* tireId, dFloat speed)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->SetTireMaxSideSleepSpeed(tireId, speed);
+}
+
+// Name: NewtonVehicleSetTireSideSleepCoeficient
+// Set the coefficient that tell the engine how much of the lateral force can be absorbed by the tire.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+// *dFloat* coefficient - side slip coefficient.
+//
+// Return: nothing.
+//
+// Remarks: See description of side slip on function *NewtonVehicleSetTireMaxSideSleepSpeed*
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application want to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+//
+// See also: NewtonVehicleSetTireMaxSideSleepSpeed
+void NewtonVehicleSetTireSideSleepCoeficient(const NewtonJoint* vehicle, void* tireId, dFloat coeficient)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->SetTireSideSleepCoeficient(tireId, coeficient);
+}
+
+// Name: NewtonVehicleSetTireMaxLongitudinalSlideSpeed
+// Set the maximum side slide velocity for the tire to be considered to lose traction.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+// *dFloat* speed - maximum side speed before the vehicle is considered to loose side traction.
+//
+// Return: nothing.
+//
+// Remarks: The explanation of longitudinal slide is similar to the side slip, however it is not so critical to achieve realistic behavior.
+// See description of side slip on function *NewtonVehicleSetTireMaxSideSleepSpeed*
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application want to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+//
+// See also: NewtonVehicleSetTireLongitudinalSlideCoeficient
+void NewtonVehicleSetTireMaxLongitudinalSlideSpeed(const NewtonJoint* vehicle, void* tireId, dFloat speed)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->SetTireMaxLongitudinalSlideSpeed(tireId, speed);
+}
+
+// Name: NewtonVehicleSetTireLongitudinalSlideCoeficient
+// Set the coefficient that tell the engine how much of the longitudinal force can be absorbed by the tire.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+// *dFloat* coefficient - longitudinal slide coefficient.
+//
+// Return: nothing.
+//
+// Remarks: The explanation of longitudinal slide is similar to the side slip, however it is not so critical to achieve realistic behavior.
+// See description of side slip on function *NewtonVehicleSetTireMaxSideSleepSpeed*
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application want to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+//
+// See also: NewtonVehicleSetTireMaxLongitudinalSlideSpeed
+void NewtonVehicleSetTireLongitudinalSlideCoeficient(const NewtonJoint* vehicle, void* tireId, dFloat coeficient)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->SetTireLongitudinalSlideCoeficient(tireId, coeficient);
+}
+
+// Name: NewtonVehicleTireIsAirBorne
+// Return a boolean value that tells the application if this tire is touching the ground.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+//
+// Return: airborne state 1 on the air, 0 on the ground.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application want to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+int NewtonVehicleTireIsAirBorne(const NewtonJoint* vehicle, void* tireId)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->IsTireAirBorned(tireId) ? 1 : 0;
+}
+
+// Name: NewtonVehicleTireLostSideGrip
+// Return a boolean value that tell the application if this tire lost side grip..
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+//
+// Return: Grip state.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application want to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+int NewtonVehicleTireLostSideGrip(const NewtonJoint* vehicle, void* tireId)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->TireLostSideGrip(tireId) ? 1 : 0;
+}
+
+// Name: NewtonVehicleTireLostTraction
+// Return a boolean value that tell the application if this tire lost longitudinal traction.
+//
+// Parameters:
+// *const NewtonJoint* *vehicle - pointer to the vehicle joint.
+// *void* *tireId - index to current tire.
+//
+// Return: traction state.
+//
+// Remarks: The vehicle joint provides a rich set of interface functions to the application. Which function to use
+// is only determined by the level of fidelity the application want to achieve. In not case the use of one method is better than
+// other, and it may be that some tweaking and trial is necessary before the desired vehicle behavior is achieved.
+//
+// Remarks: The parameters applied to a tire are reset to default values each time the update function is called.
+// So the application should set the desired value in each simulation frame.
+//
+// Remarks: This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
+int NewtonVehicleTireLostTraction(const NewtonJoint* vehicle, void* tireId)
+{
+ dgVehicleConstraint* joint;
+ joint = (dgVehicleConstraint*)vehicle;
+
+ TRACE_FUNTION(__FUNCTION__);
+ return joint->TireLostTraction(tireId) ? 1 : 0;
+}
+#endif
diff --git a/engines/hpl1/engine/libraries/newton/NewtonClass.cpp b/engines/hpl1/engine/libraries/newton/NewtonClass.cpp
new file mode 100644
index 00000000000..eb538d758ea
--- /dev/null
+++ b/engines/hpl1/engine/libraries/newton/NewtonClass.cpp
@@ -0,0 +1,319 @@
+/* Copyright (c) <2003-2011> <Julio Jerez, Newton Game Dynamics>
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source distribution.
+ */
+
+#include "NewtonStdAfx.h"
+#include "NewtonClass.h"
+
+NewtonDeadBodies::NewtonDeadBodies(dgMemoryAllocator* const allocator) :
+ dgTree<dgBody*, void*>(allocator)
+{
+ Insert((dgBody*) NULL, 0);
+}
+
+void NewtonDeadBodies::DestroyBodies(Newton& world)
+{
+ dgBody* body;
+ dgTreeNode* node;
+
+ Iterator iter(*this);
+ for (iter.Begin(); iter;)
+ {
+ node = iter.GetNode();
+ iter++;
+ body = node->GetInfo();
+ if (body)
+ {
+ Remove(node);
+ world.DestroyBody(body);
+ }
+ }
+}
+
+NewtonDeadJoints::NewtonDeadJoints(dgMemoryAllocator* const allocator) :
+ dgTree<dgConstraint*, void*>(allocator)
+{
+ Insert((dgConstraint*) NULL, 0);
+}
+
+void NewtonDeadJoints::DestroyJoints(Newton& world)
+{
+ dgTreeNode* node;
+ dgConstraint* joint;
+
+ Iterator iter(*this);
+ for (iter.Begin(); iter;)
+ {
+ node = iter.GetNode();
+ iter++;
+ joint = node->GetInfo();
+ if (joint)
+ {
+ Remove(node);
+ world.DestroyConstraint(joint);
+ }
+ }
+}
+
+void* Newton::DefaultAllocMemory(dgInt32 size)
+{
+ return malloc(size_t(size));
+}
+
+void Newton::DefaultFreeMemory(void *ptr, dgInt32 size)
+{
+ free(ptr);
+}
+
+Newton::Newton(dgFloat32 scale, dgMemoryAllocator* const allocator) :
+ dgWorld(allocator), NewtonDeadBodies(allocator), NewtonDeadJoints(allocator)
+{
+ m_updating = false;
+ g_maxTimeStep = dgFloat32(1.0f / 60.0f);
+
+ m_destructor = NULL;
+// SetGlobalScale (scale);
+}
+
+Newton::~Newton()
+{
+ if (m_destructor)
+ {
+ m_destructor((NewtonWorld*) this);
+ }
+}
+
+void Newton::UpdatePhysics(dgFloat32 timestep)
+{
+ m_updating = true;
+ Update(timestep);
+
+// RagdollHeaderActiveList::UpdateMatrix();
+ m_updating = false;
+
+ NewtonDeadBodies& bodyList = *this;
+ NewtonDeadJoints& jointList = *this;
+
+ jointList.DestroyJoints(*this);
+ bodyList.DestroyBodies(*this);
+}
+
+void Newton::DestroyJoint(dgConstraint* joint)
+{
+ if (m_updating)
+ {
+ NewtonDeadJoints& jointList = *this;
+ jointList.Insert(joint, joint);
+ }
+ else
+ {
+ dgWorld::DestroyConstraint(joint);
+ }
+}
+
+void Newton::DestroyBody(dgBody* body)
+{
+ if (m_updating)
+ {
+ NewtonDeadBodies& bodyList = *this;
+ bodyList.Insert(body, body);
+ }
+ else
+ {
+ dgWorld::DestroyBody(body);
+ }
+}
+
+NewtonUserJoint::NewtonUserJoint(dgWorld* world, dgInt32 maxDof,
+ NewtonUserBilateralCallBack callback,
+ NewtonUserBilateralGetInfoCallBack getInfo, dgBody *dyn0, dgBody *dyn1) :
+ dgUserConstraint(world, dyn0, dyn1, 1)
+{
+ m_rows = 0;
+ m_maxDOF = dgUnsigned8(maxDof);
+ m_jacobianFnt = callback;
+ m_getInfoCallback = getInfo;
+
+ _ASSERTE(world);
+ m_forceArray = m_jointForce;
+ if (m_maxDOF > 24)
+ {
+ _ASSERTE(0);
+ m_forceArray = (dgFloat32*) world->GetAllocator()->Malloc(
+ dgInt32(m_maxDOF * sizeof(dgFloat32)));
+ }
+ memset(m_forceArray, 0, m_maxDOF * sizeof(dgFloat32));
+}
+
+NewtonUserJoint::~NewtonUserJoint()
+{
+ if (m_forceArray != m_jointForce)
+ {
+ m_body0->GetWorld()->GetAllocator()->Free(m_forceArray);
+ }
+
+}
+
+dgUnsigned32 NewtonUserJoint::JacobianDerivative(dgContraintDescritor& params)
+{
+ m_rows = 0;
+ m_param = ¶ms;
+ m_jacobianFnt((NewtonJoint*) this, params.m_timestep, params.m_threadIndex);
+ return dgUnsigned32(m_rows);
+}
+
+void NewtonUserJoint::AddLinearRowJacobian(const dgVector& pivot0,
+ const dgVector& pivot1, const dgVector& dir)
+{
+ dgPointParam pointData;
+ InitPointParam(pointData, m_stiffness, pivot0, pivot1);
+
+ m_lastPosit0 = pivot0;
+ m_lastPosit1 = pivot1;
+ m_lastJointAngle = dgFloat32(0.0f);
+ CalculatePointDerivative(m_rows, *m_param, dir, pointData,
+ &m_forceArray[m_rows]);
+ m_rows++;
+ _ASSERTE(m_rows <= dgInt32 (m_maxDOF));
+}
+
+void NewtonUserJoint::AddAngularRowJacobian(const dgVector& dir,
+ dgFloat32 relAngle)
+{
+ m_lastPosit0 = dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
+ dgFloat32(0.0f));
+ m_lastPosit1 = dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
+ dgFloat32(0.0f));
+ m_lastJointAngle = relAngle;
+ CalculateAngularDerivative(m_rows, *m_param, dir, m_stiffness, relAngle,
+ &m_forceArray[m_rows]);
+ m_rows++;
+ _ASSERTE(m_rows <= dgInt32 (m_maxDOF));
+}
+
+void NewtonUserJoint::AddGeneralRowJacobian(const dgFloat32* jacobian0,
+ const dgFloat32* jacobian1)
+{
+ m_lastPosit0 = dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
+ dgFloat32(0.0f));
+ m_lastPosit1 = dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
+ dgFloat32(0.0f));
+ m_lastJointAngle = 0.0f;
+
+ SetJacobianDerivative(m_rows, *m_param, jacobian0, jacobian1,
+ &m_forceArray[m_rows]);
+ m_rows++;
+ _ASSERTE(m_rows <= dgInt32 (m_maxDOF));
+}
+
+void NewtonUserJoint::SetAcceleration(dgFloat32 acceleration)
+{
+ dgInt32 index;
+ index = m_rows - 1;
+ if ((index >= 0) && (index < dgInt32(m_maxDOF)))
+ {
+// m_param->m_jointAccel[index] = acceleration;
+ SetMotorAcceleration(index, acceleration, *m_param);
+ }
+}
+
+void NewtonUserJoint::SetSpringDamperAcceleration(dFloat springK,
+ dFloat springD)
+{
+ dgInt32 index;
+ index = m_rows - 1;
+ if ((index >= 0) && (index < dgInt32(m_maxDOF)))
+ {
+ dgFloat32 accel;
+ accel = CalculateSpringDamperAcceleration(index, *m_param, m_lastJointAngle,
+ m_lastPosit0, m_lastPosit1, springK, springD);
+ _ASSERTE(0);
+// m_param->m_jointAccel[index] = accel;
+ SetMotorAcceleration(index, accel, *m_param);
+ }
+}
+
+void NewtonUserJoint::SetHighFriction(dgFloat32 friction)
+{
+ dgInt32 index;
+ index = m_rows - 1;
+ if ((index >= 0) && (index < dgInt32(m_maxDOF)))
+ {
+ m_param->m_forceBounds[index].m_upper = ClampValue(friction,
+ dgFloat32(0.001f), dgFloat32(DG_MAX_BOUND));
+ m_param->m_forceBounds[index].m_normalIndex =
+ DG_BILATERAL_FRICTION_CONSTRAINT;
+ }
+}
+
+void NewtonUserJoint::SetLowerFriction(dgFloat32 friction)
+{
+ dgInt32 index;
+ index = m_rows - 1;
+ if ((index >= 0) && (index < dgInt32(m_maxDOF)))
+ {
+ m_param->m_forceBounds[index].m_low = ClampValue(friction,
+ dgFloat32(DG_MIN_BOUND), dgFloat32(-0.001f));
+ m_param->m_forceBounds[index].m_normalIndex =
+ DG_BILATERAL_FRICTION_CONSTRAINT;
+ }
+}
+
+void NewtonUserJoint::SetRowStiffness(dgFloat32 stiffness)
+{
+ dgInt32 index;
+ index = m_rows - 1;
+ if ((index >= 0) && (index < dgInt32(m_maxDOF)))
+ {
+ stiffness = ClampValue(stiffness, dgFloat32(0.0f), dgFloat32(1.0f));
+ stiffness = 100.0f - stiffness * 99.0f;
+ m_param->m_jointStiffness[index] = stiffness;
+ }
+}
+
+dgFloat32 NewtonUserJoint::GetRowForce(dgInt32 row) const
+{
+ dgFloat32 force;
+
+ force = 0.0f;
+ if ((row >= 0) && (row < dgInt32(m_maxDOF)))
+ {
+ force = m_forceArray[row];
+ }
+ return force;
+}
+
+void NewtonUserJoint::GetInfo(dgConstraintInfo* const info) const
+{
+ memset(info, 0, sizeof(dgConstraintInfo));
+ if (m_getInfoCallback)
+ {
+ InitInfo(info);
+ m_getInfoCallback((NewtonJoint*) this, (NewtonJointRecord*) info);
+ }
+}
+
+void NewtonUserJoint::SetUpdateFeedbackFunction(
+ NewtonUserBilateralCallBack getFeedback)
+{
+ dgUserConstraint::SetUpdateFeedbackFunction(
+ (ConstraintsForceFeeback) getFeedback);
+}
+
diff --git a/engines/hpl1/engine/libraries/newton/NewtonClass.h b/engines/hpl1/engine/libraries/newton/NewtonClass.h
new file mode 100644
index 00000000000..f21f593dcb4
--- /dev/null
+++ b/engines/hpl1/engine/libraries/newton/NewtonClass.h
@@ -0,0 +1,120 @@
+/* Copyright (c) <2003-2011> <Julio Jerez, Newton Game Dynamics>
+*
+* This software is provided 'as-is', without any express or implied
+* warranty. In no event will the authors be held liable for any damages
+* arising from the use of this software.
+*
+* Permission is granted to anyone to use this software for any purpose,
+* including commercial applications, and to alter it and redistribute it
+* freely, subject to the following restrictions:
+*
+* 1. The origin of this software must not be misrepresented; you must not
+* claim that you wrote the original software. If you use this software
+* in a product, an acknowledgment in the product documentation would be
+* appreciated but is not required.
+*
+* 2. Altered source versions must be plainly marked as such, and must not be
+* misrepresented as being the original software.
+*
+* 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef __NewotnClass_3HL6356GYL459020__
+#define __NewotnClass_3HL6356GYL459020__
+
+#include "NewtonStdAfx.h"
+#include "Newton.h"
+
+
+
+#define MAX_TIMESTEP (1.0f / 60.0f)
+#define MIN_TIMESTEP (1.0f / 1000.0f)
+
+class Newton;
+
+
+class NewtonDeadBodies: public dgTree<dgBody*, void* >
+{
+ public:
+ NewtonDeadBodies(dgMemoryAllocator* const allocator);
+ void DestroyBodies(Newton& world);
+};
+
+
+class NewtonDeadJoints: public dgTree<dgConstraint*, void *>
+{
+ public:
+ NewtonDeadJoints(dgMemoryAllocator* const allocator);
+ void DestroyJoints(Newton& world);
+};
+
+
+class Newton:
+ public dgWorld,
+ public NewtonDeadBodies,
+ public NewtonDeadJoints
+{
+ public:
+ DG_CLASS_ALLOCATOR(allocator)
+
+ Newton (dgFloat32 scale, dgMemoryAllocator* const allocator);
+ ~Newton ();
+
+ void DestroyBody(dgBody* body);
+ void DestroyJoint(dgConstraint* joint);
+
+ void UpdatePhysics (dgFloat32 timestep);
+ static void* DefaultAllocMemory (dgInt32 size);
+ static void DefaultFreeMemory (void *ptr, dgInt32 size);
+
+ dgFloat32 g_maxTimeStep;
+ bool m_updating;
+
+ NewtonDestroyWorld m_destructor;
+
+};
+
+
+
+class NewtonUserJoint: public dgUserConstraint
+{
+ public:
+ NewtonUserJoint (dgWorld* world, dgInt32 maxDof,
+ NewtonUserBilateralCallBack callback, NewtonUserBilateralGetInfoCallBack getInfo,
+ dgBody *dyn0, dgBody *dyn1);
+ ~NewtonUserJoint ();
+
+ dgUnsigned32 JacobianDerivative (dgContraintDescritor& params);
+
+ void AddAngularRowJacobian (const dgVector& dir, dgFloat32 relAngle);
+ void AddGeneralRowJacobian (const dgFloat32* jacobian0, const dgFloat32* jacobian1);
+ void AddLinearRowJacobian (const dgVector& pivot0, const dgVector& pivot1, const dgVector& dir);
+
+ dgFloat32 GetRowForce (dgInt32 row) const;
+ void SetHighFriction (dgFloat32 friction);
+ void SetLowerFriction (dgFloat32 friction);
+ void SetRowStiffness (dgFloat32 stiffness);
+ void SetAcceleration (dgFloat32 acceleration);
+ void SetSpringDamperAcceleration (dgFloat32 springK, dgFloat32 springD);
+ void GetInfo (dgConstraintInfo* const info) const;
+
+ void SetUpdateFeedbackFunction (NewtonUserBilateralCallBack getFeedback);
+
+
+
+ private:
+ NewtonUserBilateralCallBack m_jacobianFnt;
+ NewtonUserBilateralGetInfoCallBack m_getInfoCallback;
+
+ dgInt32 m_rows;
+ dgFloat32* m_forceArray;
+ dgContraintDescritor* m_param;
+
+ dgFloat32 m_lastJointAngle;
+ dgVector m_lastPosit0;
+ dgVector m_lastPosit1;
+};
+
+
+
+#endif
diff --git a/engines/hpl1/engine/libraries/newton/NewtonStdAfx.h b/engines/hpl1/engine/libraries/newton/NewtonStdAfx.h
new file mode 100644
index 00000000000..f7efa69dd2f
--- /dev/null
+++ b/engines/hpl1/engine/libraries/newton/NewtonStdAfx.h
@@ -0,0 +1,32 @@
+/* Copyright (c) <2003-2011> <Julio Jerez, Newton Game Dynamics>
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source distribution.
+ */
+
+#if !defined(AFX_STDAFX_H__7B02FF2D_C0C3_4291_9676_333105355F57__INCLUDED_)
+#define AFX_STDAFX_H__7B02FF2D_C0C3_4291_9676_333105355F57__INCLUDED_
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+// TODO: reference additional headers your program requires here
+
+#include "hpl1/engine/libraries/newton/core/dg.h"
+#include "hpl1/engine/libraries/newton/physics/dgPhysics.h"
+
+#endif // !defined(AFX_STDAFX_H__7B02FF2D_C0C3_4291_9676_333105355F57__INCLUDED_)
diff --git a/engines/hpl1/engine/libraries/newton/core/dg.cpp b/engines/hpl1/engine/libraries/newton/core/dg.cpp
new file mode 100644
index 00000000000..281071049ce
--- /dev/null
+++ b/engines/hpl1/engine/libraries/newton/core/dg.cpp
@@ -0,0 +1,23 @@
+/* Copyright (c) <2003-2011> <Julio Jerez, Newton Game Dynamics>
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
Commit: a424a85fdbdc7c94140effbc5f0ac1f6f8dbb582
https://github.com/scummvm/scummvm/commit/a424a85fdbdc7c94140effbc5f0ac1f6f8dbb582
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:37+01:00
Commit Message:
HPL1: Fix warnings
Changed paths:
engines/hpl1/engine/libraries/newton/Newton.h
diff --git a/engines/hpl1/engine/libraries/newton/Newton.h b/engines/hpl1/engine/libraries/newton/Newton.h
index 9dbef0a37d2..f953e09034f 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.h
+++ b/engines/hpl1/engine/libraries/newton/Newton.h
@@ -72,14 +72,14 @@ extern "C" {
#define NEWTON_PROFILER_FORCE_CALLBACK_UPDATE 7
-typedef struct NewtonMesh{} NewtonMesh;
-typedef struct NewtonBody{} NewtonBody;
-typedef struct NewtonWorld{} NewtonWorld;
-typedef struct NewtonJoint{} NewtonJoint;
-typedef struct NewtonMaterial{} NewtonMaterial;
-typedef struct NewtonCollision{} NewtonCollision;
-typedef struct NewtonSceneProxy{} NewtonSceneProxy;
-typedef struct NewtonbreakableComponentMesh{} NewtonbreakableComponentMesh;
+class NewtonMesh;
+class NewtonBody;
+class NewtonWorld;
+class NewtonJoint;
+class NewtonMaterial;
+class NewtonCollision;
+class NewtonSceneProxy;
+class NewtonbreakableComponentMesh;
// typedef struct NewtonRagDoll{} NewtonRagDoll;
// typedef struct NewtonRagDollBone{} NewtonRagDollBone;
Commit: e3c3d70c47af0f0aa949bad48204a6a011034970
https://github.com/scummvm/scummvm/commit/e3c3d70c47af0f0aa949bad48204a6a011034970
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:37+01:00
Commit Message:
HPL1: add missing files to module.mk
Changed paths:
engines/hpl1/module.mk
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 89dedb9c7b0..e589db4f99d 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -352,6 +352,8 @@ MODULE_OBJS := \
engine/libraries/newton/physics/dgHingeConstraint.o \
engine/libraries/newton/physics/dgMeshEffect.o \
engine/libraries/newton/physics/dgMeshEffect2.o \
+ engine/libraries/newton/physics/dgMeshEffect3.o \
+ engine/libraries/newton/physics/dgMeshEffectSolidTree.o \
engine/libraries/newton/physics/dgMinkowskiConv.o \
engine/libraries/newton/physics/dgNarrowPhaseCollision.o \
engine/libraries/newton/physics/dgPointToCurveConstraint.o \
Commit: 98c92aba2909bc019e444e615b113f66d01db83e
https://github.com/scummvm/scummvm/commit/98c92aba2909bc019e444e615b113f66d01db83e
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:37+01:00
Commit Message:
HPL1: add angelscript code
Changed paths:
A engines/hpl1/engine/libraries/angelscript/sources/as_array.h
A engines/hpl1/engine/libraries/angelscript/sources/as_atomic.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_atomic.h
A engines/hpl1/engine/libraries/angelscript/sources/as_builder.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_builder.h
A engines/hpl1/engine/libraries/angelscript/sources/as_bytecode.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_bytecode.h
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc.h
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64_gcc.S
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64_msvc.asm
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_gcc.S
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_msvc.asm
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_vita.S
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_xcode.S
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_mips.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_ppc.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_ppc_64.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_sh4.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_gcc.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_mingw.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_msvc.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_msvc_asm.asm
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x86.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_xenon.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_compiler.h
A engines/hpl1/engine/libraries/angelscript/sources/as_config.h
A engines/hpl1/engine/libraries/angelscript/sources/as_configgroup.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_configgroup.h
A engines/hpl1/engine/libraries/angelscript/sources/as_context.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_context.h
A engines/hpl1/engine/libraries/angelscript/sources/as_criticalsection.h
A engines/hpl1/engine/libraries/angelscript/sources/as_datatype.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_datatype.h
A engines/hpl1/engine/libraries/angelscript/sources/as_debug.h
A engines/hpl1/engine/libraries/angelscript/sources/as_gc.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_gc.h
A engines/hpl1/engine/libraries/angelscript/sources/as_generic.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_generic.h
A engines/hpl1/engine/libraries/angelscript/sources/as_globalproperty.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_map.h
A engines/hpl1/engine/libraries/angelscript/sources/as_memory.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_memory.h
A engines/hpl1/engine/libraries/angelscript/sources/as_module.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_module.h
A engines/hpl1/engine/libraries/angelscript/sources/as_namespace.h
A engines/hpl1/engine/libraries/angelscript/sources/as_objecttype.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_objecttype.h
A engines/hpl1/engine/libraries/angelscript/sources/as_outputbuffer.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_outputbuffer.h
A engines/hpl1/engine/libraries/angelscript/sources/as_parser.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_parser.h
A engines/hpl1/engine/libraries/angelscript/sources/as_property.h
A engines/hpl1/engine/libraries/angelscript/sources/as_restore.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_restore.h
A engines/hpl1/engine/libraries/angelscript/sources/as_scriptcode.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_scriptcode.h
A engines/hpl1/engine/libraries/angelscript/sources/as_scriptengine.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_scriptengine.h
A engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.h
A engines/hpl1/engine/libraries/angelscript/sources/as_scriptnode.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_scriptnode.h
A engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.h
A engines/hpl1/engine/libraries/angelscript/sources/as_string.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_string.h
A engines/hpl1/engine/libraries/angelscript/sources/as_string_util.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_string_util.h
A engines/hpl1/engine/libraries/angelscript/sources/as_symboltable.h
A engines/hpl1/engine/libraries/angelscript/sources/as_texts.h
A engines/hpl1/engine/libraries/angelscript/sources/as_thread.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_thread.h
A engines/hpl1/engine/libraries/angelscript/sources/as_tokendef.h
A engines/hpl1/engine/libraries/angelscript/sources/as_tokenizer.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_tokenizer.h
A engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.h
A engines/hpl1/engine/libraries/angelscript/sources/as_variablescope.cpp
A engines/hpl1/engine/libraries/angelscript/sources/as_variablescope.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_array.h b/engines/hpl1/engine/libraries/angelscript/sources/as_array.h
new file mode 100644
index 00000000000..8894dac67a1
--- /dev/null
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_array.h
@@ -0,0 +1,530 @@
+/*
+ AngelCode Scripting Library
+ Copyright (c) 2003-2015 Andreas Jonsson
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any
+ damages arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any
+ purpose, including commercial applications, and to alter it and
+ redistribute it freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you
+ must not claim that you wrote the original software. If you use
+ this software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and
+ must not be misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source
+ distribution.
+
+ The original version of this library can be located at:
+ http://www.angelcode.com/angelscript/
+
+ Andreas Jonsson
+ andreas at angelcode.com
+*/
+
+#ifndef AS_ARRAY_H
+#define AS_ARRAY_H
+
+#if !defined(AS_NO_MEMORY_H)
+#include <memory.h>
+#endif
+#include <string.h> // some compilers declare memcpy() here
+
+#ifdef _MSC_VER
+#pragma warning(disable:4345) // warning about a change in how the code is handled in this version
+#endif
+
+#include "as_config.h"
+
+BEGIN_AS_NAMESPACE
+
+template <class T> class asCArray
+{
+public:
+ asCArray();
+ asCArray(const asCArray<T> &);
+ asCArray(asUINT reserve);
+ ~asCArray();
+
+ void Allocate(asUINT numElements, bool keepData);
+ void AllocateNoConstruct(asUINT numElements, bool keepData);
+ asUINT GetCapacity() const;
+
+ void PushLast(const T &element);
+ T PopLast();
+
+ bool SetLength(asUINT numElements);
+ bool SetLengthNoConstruct(asUINT numElements);
+ asUINT GetLength() const;
+
+ void Copy(const T*, asUINT count);
+ asCArray<T> &operator =(const asCArray<T> &);
+ void SwapWith(asCArray<T> &other);
+
+ const T &operator [](asUINT index) const;
+ T &operator [](asUINT index);
+ T *AddressOf();
+ const T *AddressOf() const;
+
+ bool Concatenate(const asCArray<T> &);
+ void Concatenate(T*, unsigned int count);
+
+ bool Exists(const T &element) const;
+ int IndexOf(const T &element) const;
+ void RemoveIndex(asUINT index); // Removes the entry without reordering the array
+ void RemoveValue(const T &element); // Removes the value without reordering the array
+ void RemoveIndexUnordered(asUINT index); // Removes the entry without keeping the order
+
+ bool operator==(const asCArray<T> &) const;
+ bool operator!=(const asCArray<T> &) const;
+
+protected:
+ T *array;
+ asUINT length; // 32bits is enough for all uses of this array
+ asUINT maxLength;
+ char buf[2*4*AS_PTR_SIZE]; // Avoid dynamically allocated memory for tiny arrays
+};
+
+// Implementation
+
+template <class T>
+T *asCArray<T>::AddressOf()
+{
+ return array;
+}
+
+template <class T>
+const T *asCArray<T>::AddressOf() const
+{
+ return array;
+}
+
+template <class T>
+asCArray<T>::asCArray(void)
+{
+ array = 0;
+ length = 0;
+ maxLength = 0;
+}
+
+template <class T>
+asCArray<T>::asCArray(const asCArray<T> ©)
+{
+ array = 0;
+ length = 0;
+ maxLength = 0;
+
+ *this = copy;
+}
+
+template <class T>
+asCArray<T>::asCArray(asUINT reserve)
+{
+ array = 0;
+ length = 0;
+ maxLength = 0;
+
+ Allocate(reserve, false);
+}
+
+template <class T>
+asCArray<T>::~asCArray(void)
+{
+ // Allocating a zero length array will free all memory
+ Allocate(0,0);
+}
+
+template <class T>
+asUINT asCArray<T>::GetLength() const
+{
+ return length;
+}
+
+template <class T>
+const T &asCArray<T>::operator [](asUINT index) const
+{
+ asASSERT(index < length);
+
+ return array[index];
+}
+
+template <class T>
+T &asCArray<T>::operator [](asUINT index)
+{
+ asASSERT(index < length);
+
+ return array[index];
+}
+
+template <class T>
+void asCArray<T>::PushLast(const T &element)
+{
+ if( length == maxLength )
+ {
+ if( maxLength == 0 )
+ Allocate(1, false);
+ else
+ Allocate(2*maxLength, true);
+
+ if( length == maxLength )
+ {
+ // Out of memory. Return without doing anything
+ return;
+ }
+ }
+
+ array[length++] = element;
+}
+
+template <class T>
+T asCArray<T>::PopLast()
+{
+ asASSERT(length > 0);
+
+ return array[--length];
+}
+
+template <class T>
+void asCArray<T>::Allocate(asUINT numElements, bool keepData)
+{
+ // We have 4 situations
+ // 1. The previous array is 8 bytes or smaller and the new array is also 8 bytes or smaller
+ // 2. The previous array is 8 bytes or smaller and the new array is larger than 8 bytes
+ // 3. The previous array is larger than 8 bytes and the new array is 8 bytes or smaller
+ // 4. The previous array is larger than 8 bytes and the new array is also larger than 8 bytes
+
+ T *tmp = 0;
+ if( numElements )
+ {
+ if( sizeof(T)*numElements <= sizeof(buf) )
+ // Use the internal buffer
+ tmp = reinterpret_cast<T*>(buf);
+ else
+ {
+ // Allocate the array and construct each of the elements
+ tmp = asNEWARRAY(T,numElements);
+ if( tmp == 0 )
+ {
+ // Out of memory. Return without doing anything
+ return;
+ }
+ }
+
+ if( array == tmp )
+ {
+ // Construct only the newly allocated elements
+ for( asUINT n = length; n < numElements; n++ )
+ new (&tmp[n]) T();
+ }
+ else
+ {
+ // Construct all elements
+ for( asUINT n = 0; n < numElements; n++ )
+ new (&tmp[n]) T();
+ }
+ }
+
+ if( array )
+ {
+ asUINT oldLength = length;
+
+ if( array == tmp )
+ {
+ if( keepData )
+ {
+ if( length > numElements )
+ length = numElements;
+ }
+ else
+ length = 0;
+
+ // Call the destructor for elements that are no longer used
+ for( asUINT n = length; n < oldLength; n++ )
+ array[n].~T();
+ }
+ else
+ {
+ if( keepData )
+ {
+ if( length > numElements )
+ length = numElements;
+
+ for( asUINT n = 0; n < length; n++ )
+ tmp[n] = array[n];
+ }
+ else
+ length = 0;
+
+ // Call the destructor for all elements
+ for( asUINT n = 0; n < oldLength; n++ )
+ array[n].~T();
+
+ if( array != reinterpret_cast<T*>(buf) )
+ asDELETEARRAY(array);
+ }
+ }
+
+ array = tmp;
+ maxLength = numElements;
+}
+
+template <class T>
+void asCArray<T>::AllocateNoConstruct(asUINT numElements, bool keepData)
+{
+ // We have 4 situations
+ // 1. The previous array is 8 bytes or smaller and the new array is also 8 bytes or smaller
+ // 2. The previous array is 8 bytes or smaller and the new array is larger than 8 bytes
+ // 3. The previous array is larger than 8 bytes and the new array is 8 bytes or smaller
+ // 4. The previous array is larger than 8 bytes and the new array is also larger than 8 bytes
+
+ T *tmp = 0;
+ if( numElements )
+ {
+ if( sizeof(T)*numElements <= sizeof(buf) )
+ // Use the internal buffer
+ tmp = reinterpret_cast<T*>(buf);
+ else
+ {
+ // Allocate the array and construct each of the elements
+ tmp = asNEWARRAY(T,numElements);
+ if( tmp == 0 )
+ {
+ // Out of memory. Return without doing anything
+ return;
+ }
+ }
+ }
+
+ if( array )
+ {
+ if( array == tmp )
+ {
+ if( keepData )
+ {
+ if( length > numElements )
+ length = numElements;
+ }
+ else
+ length = 0;
+ }
+ else
+ {
+ if( keepData )
+ {
+ if( length > numElements )
+ length = numElements;
+
+ memcpy(tmp, array, sizeof(T)*length);
+ }
+ else
+ length = 0;
+
+ if( array != reinterpret_cast<T*>(buf) )
+ asDELETEARRAY(array);
+ }
+ }
+
+ array = tmp;
+ maxLength = numElements;
+}
+
+template <class T>
+asUINT asCArray<T>::GetCapacity() const
+{
+ return maxLength;
+}
+
+template <class T>
+bool asCArray<T>::SetLength(asUINT numElements)
+{
+ if( numElements > maxLength )
+ {
+ Allocate(numElements, true);
+ if( numElements > maxLength )
+ {
+ // Out of memory. Return without doing anything
+ return false;
+ }
+ }
+
+ length = numElements;
+ return true;
+}
+
+template <class T>
+bool asCArray<T>::SetLengthNoConstruct(asUINT numElements)
+{
+ if( numElements > maxLength )
+ {
+ AllocateNoConstruct(numElements, true);
+ if( numElements > maxLength )
+ {
+ // Out of memory. Return without doing anything
+ return false;
+ }
+ }
+
+ length = numElements;
+ return true;
+}
+
+template <class T>
+void asCArray<T>::Copy(const T *data, asUINT count)
+{
+ if( maxLength < count )
+ {
+ Allocate(count, false);
+ if( maxLength < count )
+ {
+ // Out of memory. Return without doing anything
+ return;
+ }
+ }
+
+ for( asUINT n = 0; n < count; n++ )
+ array[n] = data[n];
+
+ length = count;
+}
+
+template <class T>
+asCArray<T> &asCArray<T>::operator =(const asCArray<T> ©)
+{
+ Copy(copy.array, copy.length);
+
+ return *this;
+}
+
+template <class T>
+void asCArray<T>::SwapWith(asCArray<T> &other)
+{
+ T *tmpArray = array;
+ asUINT tmpLength = length;
+ asUINT tmpMaxLength = maxLength;
+ char tmpBuf[sizeof(buf)];
+ memcpy(tmpBuf, buf, sizeof(buf));
+
+ array = other.array;
+ length = other.length;
+ maxLength = other.maxLength;
+ memcpy(buf, other.buf, sizeof(buf));
+
+ other.array = tmpArray;
+ other.length = tmpLength;
+ other.maxLength = tmpMaxLength;
+ memcpy(other.buf, tmpBuf, sizeof(buf));
+
+ // If the data is in the internal buffer, then the array pointer must refer to it
+ if( array == reinterpret_cast<T*>(other.buf) )
+ array = reinterpret_cast<T*>(buf);
+ if( other.array == reinterpret_cast<T*>(buf) )
+ other.array = reinterpret_cast<T*>(other.buf);
+}
+
+template <class T>
+bool asCArray<T>::operator ==(const asCArray<T> &other) const
+{
+ if( length != other.length ) return false;
+
+ for( asUINT n = 0; n < length; n++ )
+ if( array[n] != other.array[n] )
+ return false;
+
+ return true;
+}
+
+template <class T>
+bool asCArray<T>::operator !=(const asCArray<T> &other) const
+{
+ return !(*this == other);
+}
+
+
+// Returns false if the concatenation wasn't successful due to out of memory
+template <class T>
+bool asCArray<T>::Concatenate(const asCArray<T> &other)
+{
+ if( maxLength < length + other.length )
+ {
+ Allocate(length + other.length, true);
+ if( maxLength < length + other.length )
+ {
+ // Out of memory
+ return false;
+ }
+ }
+
+ for( asUINT n = 0; n < other.length; n++ )
+ array[length+n] = other.array[n];
+
+ length += other.length;
+
+ // Success
+ return true;
+}
+
+template <class T>
+void asCArray<T>::Concatenate(T* other, unsigned int count)
+{
+ for( unsigned int c = 0; c < count; c++ )
+ PushLast(other[c]);
+}
+
+template <class T>
+bool asCArray<T>::Exists(const T &e) const
+{
+ return IndexOf(e) == -1 ? false : true;
+}
+
+template <class T>
+int asCArray<T>::IndexOf(const T &e) const
+{
+ for( asUINT n = 0; n < length; n++ )
+ if( array[n] == e ) return static_cast<int>(n);
+
+ return -1;
+}
+
+template <class T>
+void asCArray<T>::RemoveIndex(asUINT index)
+{
+ if( index < length )
+ {
+ for( asUINT n = index; n < length-1; n++ )
+ array[n] = array[n+1];
+
+ PopLast();
+ }
+}
+
+template <class T>
+void asCArray<T>::RemoveValue(const T &e)
+{
+ for( asUINT n = 0; n < length; n++ )
+ {
+ if( array[n] == e )
+ {
+ RemoveIndex(n);
+ break;
+ }
+ }
+}
+
+template <class T>
+void asCArray<T>::RemoveIndexUnordered(asUINT index)
+{
+ if( index == length - 1 )
+ PopLast();
+ else if( index < length )
+ array[index] = PopLast();
+}
+
+END_AS_NAMESPACE
+
+#endif
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.cpp
new file mode 100644
index 00000000000..e110b3fc9dd
--- /dev/null
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.cpp
@@ -0,0 +1,179 @@
+/*
+ AngelCode Scripting Library
+ Copyright (c) 2003-2014 Andreas Jonsson
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any
+ damages arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any
+ purpose, including commercial applications, and to alter it and
+ redistribute it freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you
+ must not claim that you wrote the original software. If you use
+ this software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and
+ must not be misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source
+ distribution.
+
+ The original version of this library can be located at:
+ http://www.angelcode.com/angelscript/
+
+ Andreas Jonsson
+ andreas at angelcode.com
+*/
+
+//
+// as_atomic.cpp
+//
+// The implementation of the atomic class for thread safe reference counting
+//
+
+#include "as_atomic.h"
+
+BEGIN_AS_NAMESPACE
+
+asCAtomic::asCAtomic()
+{
+ value = 0;
+}
+
+asDWORD asCAtomic::get() const
+{
+ // A very high ref count is highly unlikely. It most likely a problem with
+ // memory that has been overwritten or is being accessed after it was deleted.
+ asASSERT(value < 1000000);
+
+ return value;
+}
+
+void asCAtomic::set(asDWORD val)
+{
+ // A very high ref count is highly unlikely. It most likely a problem with
+ // memory that has been overwritten or is being accessed after it was deleted.
+ asASSERT(value < 1000000);
+
+ value = val;
+}
+
+asDWORD asCAtomic::atomicInc()
+{
+ // A very high ref count is highly unlikely. It most likely a problem with
+ // memory that has been overwritten or is being accessed after it was deleted.
+ asASSERT(value < 1000000);
+
+ return asAtomicInc((int&)value);
+}
+
+asDWORD asCAtomic::atomicDec()
+{
+ // A very high ref count is highly unlikely. It most likely a problem with
+ // memory that has been overwritten or is being accessed after it was deleted.
+ asASSERT(value < 1000000);
+
+ return asAtomicDec((int&)value);
+}
+
+//
+// The following code implements the atomicInc and atomicDec on different platforms
+//
+#if defined(AS_NO_THREADS) || defined(AS_NO_ATOMIC)
+
+int asAtomicInc(int &value)
+{
+ return ++value;
+}
+
+int asAtomicDec(int &value)
+{
+ return --value;
+}
+
+#elif defined(AS_XENON) /// XBox360
+
+END_AS_NAMESPACE
+#include <xtl.h>
+BEGIN_AS_NAMESPACE
+
+int asAtomicInc(int &value)
+{
+ return InterlockedIncrement((LONG*)&value);
+}
+
+int asAtomicDec(int &value)
+{
+ return InterlockedDecrement((LONG*)&value);
+}
+
+#elif defined(AS_WIN)
+
+END_AS_NAMESPACE
+#define WIN32_MEAN_AND_LEAN
+#include <windows.h>
+BEGIN_AS_NAMESPACE
+
+int asAtomicInc(int &value)
+{
+ return InterlockedIncrement((LONG*)&value);
+}
+
+int asAtomicDec(int &value)
+{
+ asASSERT(value > 0);
+ return InterlockedDecrement((LONG*)&value);
+}
+
+#elif defined(AS_LINUX) || defined(AS_BSD) || defined(AS_ILLUMOS) || defined(AS_ANDROID)
+
+//
+// atomic_inc_and_test() and atomic_dec_and_test() from asm/atomic.h is not meant
+// to be used outside the Linux kernel. Instead we should use the GNUC provided
+// __sync_add_and_fetch() and __sync_sub_and_fetch() functions.
+//
+// Reference: http://golubenco.org/blog/atomic-operations/
+//
+// These are only available in GCC 4.1 and above, so for older versions we
+// use the critical sections, though it is a lot slower.
+//
+
+int asAtomicInc(int &value)
+{
+ return __sync_add_and_fetch(&value, 1);
+}
+
+int asAtomicDec(int &value)
+{
+ return __sync_sub_and_fetch(&value, 1);
+}
+
+#elif defined(AS_MAC) || defined(AS_IPHONE)
+
+END_AS_NAMESPACE
+#include <libkern/OSAtomic.h>
+BEGIN_AS_NAMESPACE
+
+int asAtomicInc(int &value)
+{
+ return OSAtomicIncrement32((int32_t*)&value);
+}
+
+int asAtomicDec(int &value)
+{
+ return OSAtomicDecrement32((int32_t*)&value);
+}
+
+#else
+
+// If we get here, then the configuration in as_config.h
+// is wrong for the compiler/platform combination.
+int ERROR_PleaseFixTheConfig[-1];
+
+#endif
+
+END_AS_NAMESPACE
+
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.h b/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.h
new file mode 100644
index 00000000000..c6fea885dcc
--- /dev/null
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.h
@@ -0,0 +1,69 @@
+/*
+ AngelCode Scripting Library
+ Copyright (c) 2003-2013 Andreas Jonsson
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any
+ damages arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any
+ purpose, including commercial applications, and to alter it and
+ redistribute it freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you
+ must not claim that you wrote the original software. If you use
+ this software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and
+ must not be misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source
+ distribution.
+
+ The original version of this library can be located at:
+ http://www.angelcode.com/angelscript/
+
+ Andreas Jonsson
+ andreas at angelcode.com
+*/
+
+
+//
+// as_atomic.h
+//
+// The asCAtomic class provides methods for performing threadsafe
+// operations on a single dword, e.g. reference counting and
+// bitfields.
+//
+
+
+
+#ifndef AS_ATOMIC_H
+#define AS_ATOMIC_H
+
+#include "as_config.h"
+
+BEGIN_AS_NAMESPACE
+
+class asCAtomic
+{
+public:
+ asCAtomic();
+
+ asDWORD get() const;
+ void set(asDWORD val);
+
+ // Increase and return new value
+ asDWORD atomicInc();
+
+ // Decrease and return new value
+ asDWORD atomicDec();
+
+protected:
+ asDWORD value;
+};
+
+END_AS_NAMESPACE
+
+#endif
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_builder.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_builder.cpp
new file mode 100644
index 00000000000..5d0f29d6f95
--- /dev/null
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_builder.cpp
@@ -0,0 +1,6490 @@
+/*
+ AngelCode Scripting Library
+ Copyright (c) 2003-2021 Andreas Jonsson
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any
+ damages arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any
+ purpose, including commercial applications, and to alter it and
+ redistribute it freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you
+ must not claim that you wrote the original software. If you use
+ this software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and
+ must not be misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source
+ distribution.
+
+ The original version of this library can be located at:
+ http://www.angelcode.com/angelscript/
+
+ Andreas Jonsson
+ andreas at angelcode.com
+*/
+
+
+//
+// as_builder.cpp
+//
+// This is the class that manages the compilation of the scripts
+//
+
+
+#include "as_config.h"
+#include "as_builder.h"
+#include "as_parser.h"
+#include "as_compiler.h"
+#include "as_tokendef.h"
+#include "as_string_util.h"
+#include "as_outputbuffer.h"
+#include "as_texts.h"
+#include "as_scriptobject.h"
+#include "as_debug.h"
+
+BEGIN_AS_NAMESPACE
+
+#ifndef AS_NO_COMPILER
+
+// asCSymbolTable template specializations for sGlobalVariableDescription entries
+template<>
+void asCSymbolTable<sGlobalVariableDescription>::GetKey(const sGlobalVariableDescription *entry, asSNameSpaceNamePair &key) const
+{
+ asSNameSpace *ns = entry->ns;
+ asCString name = entry->name;
+ key = asSNameSpaceNamePair(ns, name);
+}
+
+// Comparator for exact variable search
+class asCCompGlobVarType : public asIFilter
+{
+public:
+ const asCDataType &m_type;
+ asCCompGlobVarType(const asCDataType &type) : m_type(type) {}
+
+ bool operator()(const void *p) const
+ {
+ const sGlobalVariableDescription* desc = reinterpret_cast<const sGlobalVariableDescription*>(p);
+ return desc->datatype == m_type;
+ }
+
+private:
+ // The assignment operator is required for MSVC9, otherwise it will complain that it is not possible to auto generate the operator
+ asCCompGlobVarType &operator=(const asCCompGlobVarType &) {return *this;}
+};
+
+#endif
+
+asCBuilder::asCBuilder(asCScriptEngine *_engine, asCModule *_module)
+{
+ this->engine = _engine;
+ this->module = _module;
+ silent = false;
+}
+
+asCBuilder::~asCBuilder()
+{
+#ifndef AS_NO_COMPILER
+ asUINT n;
+
+ // Free all functions
+ for( n = 0; n < functions.GetLength(); n++ )
+ {
+ if( functions[n] )
+ {
+ if( functions[n]->node )
+ functions[n]->node->Destroy(engine);
+
+ asDELETE(functions[n],sFunctionDescription);
+ }
+
+ functions[n] = 0;
+ }
+
+ // Free all global variables
+ CleanupEnumValues();
+ asCSymbolTable<sGlobalVariableDescription>::iterator it = globVariables.List();
+ while( it )
+ {
+ if( (*it)->declaredAtNode )
+ (*it)->declaredAtNode->Destroy(engine);
+ if( (*it)->initializationNode )
+ (*it)->initializationNode->Destroy(engine);
+ asDELETE((*it),sGlobalVariableDescription);
+ it++;
+ }
+ globVariables.Clear();
+
+ // Free all the loaded files
+ for( n = 0; n < scripts.GetLength(); n++ )
+ {
+ if( scripts[n] )
+ asDELETE(scripts[n],asCScriptCode);
+
+ scripts[n] = 0;
+ }
+
+ // Free all class declarations
+ for( n = 0; n < classDeclarations.GetLength(); n++ )
+ {
+ if( classDeclarations[n] )
+ {
+ if( classDeclarations[n]->node )
+ classDeclarations[n]->node->Destroy(engine);
+
+ asDELETE(classDeclarations[n],sClassDeclaration);
+ classDeclarations[n] = 0;
+ }
+ }
+
+ for( n = 0; n < interfaceDeclarations.GetLength(); n++ )
+ {
+ if( interfaceDeclarations[n] )
+ {
+ if( interfaceDeclarations[n]->node )
+ interfaceDeclarations[n]->node->Destroy(engine);
+
+ asDELETE(interfaceDeclarations[n],sClassDeclaration);
+ interfaceDeclarations[n] = 0;
+ }
+ }
+
+ for( n = 0; n < namedTypeDeclarations.GetLength(); n++ )
+ {
+ if( namedTypeDeclarations[n] )
+ {
+ if( namedTypeDeclarations[n]->node )
+ namedTypeDeclarations[n]->node->Destroy(engine);
+
+ asDELETE(namedTypeDeclarations[n],sClassDeclaration);
+ namedTypeDeclarations[n] = 0;
+ }
+ }
+
+ for( n = 0; n < funcDefs.GetLength(); n++ )
+ {
+ if( funcDefs[n] )
+ {
+ if( funcDefs[n]->node )
+ funcDefs[n]->node->Destroy(engine);
+
+ asDELETE(funcDefs[n],sFuncDef);
+ funcDefs[n] = 0;
+ }
+ }
+
+ for( n = 0; n < mixinClasses.GetLength(); n++ )
+ {
+ if( mixinClasses[n] )
+ {
+ if( mixinClasses[n]->node )
+ mixinClasses[n]->node->Destroy(engine);
+
+ asDELETE(mixinClasses[n],sMixinClass);
+ mixinClasses[n] = 0;
+ }
+ }
+
+#endif // AS_NO_COMPILER
+}
+
+void asCBuilder::Reset()
+{
+ numErrors = 0;
+ numWarnings = 0;
+ engine->preMessage.isSet = false;
+
+#ifndef AS_NO_COMPILER
+ // Clear the cache of known types
+ hasCachedKnownTypes = false;
+ knownTypes.EraseAll();
+#endif
+}
+
+#ifndef AS_NO_COMPILER
+int asCBuilder::AddCode(const char *name, const char *code, int codeLength, int lineOffset, int sectionIdx, bool makeCopy)
+{
+ asCScriptCode *script = asNEW(asCScriptCode);
+ if( script == 0 )
+ return asOUT_OF_MEMORY;
+
+ int r = script->SetCode(name, code, codeLength, makeCopy);
+ if( r < 0 )
+ {
+ asDELETE(script, asCScriptCode);
+ return r;
+ }
+
+ script->lineOffset = lineOffset;
+ script->idx = sectionIdx;
+ scripts.PushLast(script);
+
+ return 0;
+}
+
+asCScriptCode *asCBuilder::FindOrAddCode(const char *name, const char *code, size_t length)
+{
+ for (asUINT n = 0; n < scripts.GetLength(); n++)
+ if( scripts[n]->name == name && scripts[n]->codeLength == length && memcmp(scripts[n]->code, code, length) == 0 )
+ return scripts[n];
+
+ asCScriptCode *script = asNEW(asCScriptCode);
+ if (script == 0)
+ return 0;
+
+ int r = script->SetCode(name, code, length, true);
+ if (r < 0)
+ {
+ asDELETE(script, asCScriptCode);
+ return 0;
+ }
+
+ script->idx = engine->GetScriptSectionNameIndex(name);
+ scripts.PushLast(script);
+ return script;
+}
+
+void asCBuilder::EvaluateTemplateInstances(asUINT startIdx, bool keepSilent)
+{
+ // Backup the original message stream
+ bool msgCallback = engine->msgCallback;
+ asSSystemFunctionInterface msgCallbackFunc = engine->msgCallbackFunc;
+ void *msgCallbackObj = engine->msgCallbackObj;
+
+ // Set the new temporary message stream
+ asCOutputBuffer outBuffer;
+ if( keepSilent )
+ engine->SetMessageCallback(asMETHOD(asCOutputBuffer, Callback), &outBuffer, asCALL_THISCALL);
+
+ // Evaluate each of the template instances that have been created since the start of the build
+ // TODO: This is not exactly correct, since another thread may have created template instances in parallel
+ for( asUINT n = startIdx; n < engine->templateInstanceTypes.GetLength(); n++ )
+ {
+ bool dontGarbageCollect = false;
+ asCObjectType *tmpl = engine->templateInstanceTypes[n];
+ asCScriptFunction *callback = engine->scriptFunctions[tmpl->beh.templateCallback];
+ if( callback && !engine->CallGlobalFunctionRetBool(tmpl, &dontGarbageCollect, callback->sysFuncIntf, callback) )
+ {
+ asCString sub = tmpl->templateSubTypes[0].Format(engine->nameSpaces[0]);
+ for( asUINT m = 1; m < tmpl->templateSubTypes.GetLength(); m++ )
+ {
+ sub += ",";
+ sub += tmpl->templateSubTypes[m].Format(engine->nameSpaces[0]);
+ }
+ asCString str;
+ str.Format(TXT_INSTANCING_INVLD_TMPL_TYPE_s_s, tmpl->name.AddressOf(), sub.AddressOf());
+ WriteError(tmpl->scriptSectionIdx >= 0 ? engine->scriptSectionNames[tmpl->scriptSectionIdx]->AddressOf() : "", str, tmpl->declaredAt&0xFFFFF, (tmpl->declaredAt>>20)&0xFFF);
+ }
+ else
+ {
+ // If the callback said this template instance won't be garbage collected then remove the flag
+ if( dontGarbageCollect )
+ tmpl->flags &= ~asOBJ_GC;
+ }
+ }
+
+ // Restore message callback
+ if( keepSilent )
+ {
+ engine->msgCallback = msgCallback;
+ engine->msgCallbackFunc = msgCallbackFunc;
+ engine->msgCallbackObj = msgCallbackObj;
+ }
+}
+
+int asCBuilder::Build()
+{
+ Reset();
+
+ // The template callbacks must only be called after the subtypes have a known structure,
+ // otherwise the callback may think it is not possible to create the template instance,
+ // even though it is.
+ // TODO: This flag shouldn't be set globally in the engine, as it would mean that another
+ // thread requesting a template instance in parallel to the compilation wouldn't
+ // evaluate the template instance.
+ engine->deferValidationOfTemplateTypes = true;
+ asUINT numTempl = (asUINT)engine->templateInstanceTypes.GetLength();
+
+ ParseScripts();
+ if (numErrors > 0)
+ return asERROR;
+
+ // Compile the types first
+ CompileInterfaces();
+ CompileClasses(numTempl);
+
+ // Evaluate the template instances one last time, this time with error messages, as we know
+ // all classes have been fully built and it is known which ones will need garbage collection.
+ EvaluateTemplateInstances(numTempl, false);
+ engine->deferValidationOfTemplateTypes = false;
+ if (numErrors > 0)
+ return asERROR;
+
+ // Then the global variables. Here the variables declared with auto
+ // will be resolved, so they can be accessed properly in the functions
+ CompileGlobalVariables();
+
+ // Finally the global functions and class methods
+ CompileFunctions();
+
+ // TODO: Attempt to reorder the initialization of global variables so that
+ // they do not access other uninitialized global variables out-of-order
+ // The builder needs to check for each of the global variable, what functions
+ // that are accessed, and what global variables are access by these functions.
+
+ if( numWarnings > 0 && engine->ep.compilerWarnings == 2 )
+ WriteError(TXT_WARNINGS_TREATED_AS_ERROR, 0, 0);
+
+ if( numErrors > 0 )
+ return asERROR;
+
+ // Make sure something was compiled, otherwise return an error
+ if( module->IsEmpty() )
+ {
+ WriteError(TXT_NOTHING_WAS_BUILT, 0, 0);
+ return asERROR;
+ }
+
+ return asSUCCESS;
+}
+
+int asCBuilder::CompileGlobalVar(const char *sectionName, const char *code, int lineOffset)
+{
+ Reset();
+
+ // Add the string to the script code
+ asCScriptCode *script = asNEW(asCScriptCode);
+ if( script == 0 )
+ return asOUT_OF_MEMORY;
+
+ script->SetCode(sectionName, code, true);
+ script->lineOffset = lineOffset;
+ script->idx = engine->GetScriptSectionNameIndex(sectionName ? sectionName : "");
+ scripts.PushLast(script);
+
+ // Parse the string
+ asCParser parser(this);
+ if( parser.ParseScript(scripts[0]) < 0 )
+ return asERROR;
+
+ asCScriptNode *node = parser.GetScriptNode();
+
+ // Make sure there is nothing else than the global variable in the script code
+ if( node == 0 ||
+ node->firstChild == 0 ||
+ node->firstChild != node->lastChild ||
+ node->firstChild->nodeType != snDeclaration )
+ {
+ WriteError(TXT_ONLY_ONE_VARIABLE_ALLOWED, script, 0);
+ return asERROR;
+ }
+
+ node = node->firstChild;
+ node->DisconnectParent();
+ RegisterGlobalVar(node, script, module->m_defaultNamespace);
+
+ CompileGlobalVariables();
+
+ // It is possible that the global variable initialization included anonymous functions that must be compiled too
+ for( asUINT n = 0; n < functions.GetLength(); n++ )
+ {
+ asCCompiler compiler(engine);
+ asCScriptFunction *func = engine->scriptFunctions[functions[n]->funcId];
+ int r = compiler.CompileFunction(this, functions[n]->script, func->parameterNames, functions[n]->node, func, 0);
+ if( r < 0 )
+ break;
+ }
+
+ if( numWarnings > 0 && engine->ep.compilerWarnings == 2 )
+ WriteError(TXT_WARNINGS_TREATED_AS_ERROR, 0, 0);
+
+ // None of the functions should be added to the module if any error occurred,
+ // or it was requested that the functions wouldn't be added to the scope
+ if( numErrors > 0 )
+ {
+ for( asUINT n = 0; n < functions.GetLength(); n++ )
+ {
+ asCScriptFunction *func = engine->scriptFunctions[functions[n]->funcId];
+ if( module->m_globalFunctions.GetIndex(func) >= 0 )
+ {
+ module->m_globalFunctions.Erase(module->m_globalFunctions.GetIndex(func));
+ module->m_scriptFunctions.RemoveValue(func);
+ func->ReleaseInternal();
+ }
+ }
+ }
+
+ if( numErrors > 0 )
+ {
+ // Remove the variable from the module, if it was registered
+ if( globVariables.GetSize() > 0 )
+ module->RemoveGlobalVar(module->GetGlobalVarCount()-1);
+
+ return asERROR;
+ }
+
+ return 0;
+}
+#endif
+
+int asCBuilder::ValidateDefaultArgs(asCScriptCode *script, asCScriptNode *node, asCScriptFunction *func)
+{
+ int firstArgWithDefaultValue = -1;
+ for( asUINT n = 0; n < func->defaultArgs.GetLength(); n++ )
+ {
+ if( func->defaultArgs[n] )
+ firstArgWithDefaultValue = n;
+ else if( firstArgWithDefaultValue >= 0 )
+ {
+ asCString str;
+ str.Format(TXT_DEF_ARG_MISSING_IN_FUNC_s, func->GetDeclaration());
+ WriteError(str, script, node);
+ return asINVALID_DECLARATION;
+ }
+ }
+
+ return 0;
+}
+
+#ifndef AS_NO_COMPILER
+// This function will verify if the newly created function will conflict another overload due to having
+// identical function arguments that are not default args, e.g: foo(int) and foo(int, int=0)
+int asCBuilder::CheckForConflictsDueToDefaultArgs(asCScriptCode *script, asCScriptNode *node, asCScriptFunction *func, asCObjectType *objType)
+{
+ // TODO: Implement for global functions too
+ if( func->objectType == 0 || objType == 0 ) return 0;
+
+ asCArray<int> funcs;
+ GetObjectMethodDescriptions(func->name.AddressOf(), objType, funcs, false);
+ for( asUINT n = 0; n < funcs.GetLength(); n++ )
+ {
+ asCScriptFunction *func2 = engine->scriptFunctions[funcs[n]];
+ if( func == func2 )
+ continue;
+
+ if( func->IsReadOnly() != func2->IsReadOnly() )
+ continue;
+
+ bool match = true;
+ asUINT p = 0;
+ for( ; p < func->parameterTypes.GetLength() && p < func2->parameterTypes.GetLength(); p++ )
+ {
+ // Only verify until the first argument with default args
+ if( (func->defaultArgs.GetLength() > p && func->defaultArgs[p]) ||
+ (func2->defaultArgs.GetLength() > p && func2->defaultArgs[p]) )
+ break;
+
+ if( func->parameterTypes[p] != func2->parameterTypes[p] ||
+ func->inOutFlags[p] != func2->inOutFlags[p] )
+ {
+ match = false;
+ break;
+ }
+ }
+
+ if( match )
+ {
+ if( !((p >= func->parameterTypes.GetLength() && p < func2->defaultArgs.GetLength() && func2->defaultArgs[p]) ||
+ (p >= func2->parameterTypes.GetLength() && p < func->defaultArgs.GetLength() && func->defaultArgs[p])) )
+ {
+ // The argument lists match for the full length of the shorter, but the next
+ // argument on the longer does not have a default arg so there is no conflict
+ match = false;
+ }
+ }
+
+ if( match )
+ {
+ WriteWarning(TXT_OVERLOAD_CONFLICTS_DUE_TO_DEFAULT_ARGS, script, node);
+ WriteInfo(func->GetDeclaration(), script, node);
+ WriteInfo(func2->GetDeclaration(), script, node);
+ break;
+ }
+ }
+
+ return 0;
+}
+
+int asCBuilder::CompileFunction(const char *sectionName, const char *code, int lineOffset, asDWORD compileFlags, asCScriptFunction **outFunc)
+{
+ asASSERT(outFunc != 0);
+
+ Reset();
+
+ // Add the string to the script code
+ asCScriptCode *script = asNEW(asCScriptCode);
+ if( script == 0 )
+ return asOUT_OF_MEMORY;
+
+ script->SetCode(sectionName, code, true);
+ script->lineOffset = lineOffset;
+ script->idx = engine->GetScriptSectionNameIndex(sectionName ? sectionName : "");
+ scripts.PushLast(script);
+
+ // Parse the string
+ asCParser parser(this);
+ if( parser.ParseScript(scripts[0]) < 0 )
+ return asERROR;
+
+ asCScriptNode *node = parser.GetScriptNode();
+
+ // Make sure there is nothing else than the function in the script code
+ if( node == 0 ||
+ node->firstChild == 0 ||
+ node->firstChild != node->lastChild ||
+ node->firstChild->nodeType != snFunction )
+ {
+ WriteError(TXT_ONLY_ONE_FUNCTION_ALLOWED, script, 0);
+ return asERROR;
+ }
+
+ // Find the function node
+ node = node->firstChild;
+
+ // Create the function
+ asSFunctionTraits funcTraits;
+ asCScriptFunction *func = asNEW(asCScriptFunction)(engine, compileFlags & asCOMP_ADD_TO_MODULE ? module : 0, asFUNC_SCRIPT);
+ if( func == 0 )
+ return asOUT_OF_MEMORY;
+
+ GetParsedFunctionDetails(node, scripts[0], 0, func->name, func->returnType, func->parameterNames, func->parameterTypes, func->inOutFlags, func->defaultArgs, funcTraits, module->m_defaultNamespace);
+ func->id = engine->GetNextScriptFunctionId();
+ func->scriptData->scriptSectionIdx = engine->GetScriptSectionNameIndex(sectionName ? sectionName : "");
+ int row, col;
+ scripts[0]->ConvertPosToRowCol(node->tokenPos, &row, &col);
+ func->scriptData->declaredAt = (row & 0xFFFFF)|((col & 0xFFF)<<20);
+ func->nameSpace = module->m_defaultNamespace;
+
+ // Make sure the default args are declared correctly
+ int r = ValidateDefaultArgs(script, node, func);
+ if( r < 0 )
+ {
+ func->ReleaseInternal();
+ return asERROR;
+ }
+
+ // Tell the engine that the function exists already so the compiler can access it
+ if( compileFlags & asCOMP_ADD_TO_MODULE )
+ {
+ r = CheckNameConflict(func->name.AddressOf(), node, scripts[0], module->m_defaultNamespace, false, false);
+ if( r < 0 )
+ {
+ func->ReleaseInternal();
+ return asERROR;
+ }
+
+ module->m_globalFunctions.Put(func);
+
+ module->AddScriptFunction(func);
+ }
+ else
+ engine->AddScriptFunction(func);
+
+ // Fill in the function info for the builder too
+ node->DisconnectParent();
+ sFunctionDescription *funcDesc = asNEW(sFunctionDescription);
+ if( funcDesc == 0 )
+ {
+ func->ReleaseInternal();
+ return asOUT_OF_MEMORY;
+ }
+
+ functions.PushLast(funcDesc);
+ funcDesc->script = scripts[0];
+ funcDesc->node = node;
+ funcDesc->name = func->name;
+ funcDesc->funcId = func->id;
+ funcDesc->paramNames = func->parameterNames;
+ funcDesc->isExistingShared = false;
+
+ // This must be done in a loop, as it is possible that additional functions get declared as lambda's in the code
+ for( asUINT n = 0; n < functions.GetLength(); n++ )
+ {
+ asCCompiler compiler(engine);
+ asCScriptFunction *f = engine->scriptFunctions[functions[n]->funcId];
+ r = compiler.CompileFunction(this, functions[n]->script, f->parameterNames, functions[n]->node, f, 0);
+ if( r < 0 )
+ break;
+ }
+
+ if( numWarnings > 0 && engine->ep.compilerWarnings == 2 )
+ WriteError(TXT_WARNINGS_TREATED_AS_ERROR, 0, 0);
+
+ // None of the functions should be added to the module if any error occurred,
+ // or it was requested that the functions wouldn't be added to the scope
+ if( !(compileFlags & asCOMP_ADD_TO_MODULE) || numErrors > 0 )
+ {
+ for( asUINT n = 0; n < functions.GetLength(); n++ )
+ {
+ asCScriptFunction *f = engine->scriptFunctions[functions[n]->funcId];
+ if( module->m_globalFunctions.GetIndex(f) >= 0 )
+ {
+ module->m_globalFunctions.Erase(module->m_globalFunctions.GetIndex(f));
+ module->m_scriptFunctions.RemoveValue(f);
+ f->ReleaseInternal();
+ }
+ }
+ }
+
+ if( numErrors > 0 )
+ {
+ // Release the function pointer that would otherwise be returned if no errors occured
+ func->ReleaseInternal();
+
+ return asERROR;
+ }
+
+ // Return the function
+ *outFunc = func;
+
+ return asSUCCESS;
+}
+
+void asCBuilder::ParseScripts()
+{
+ TimeIt("asCBuilder::ParseScripts");
+
+ asCArray<asCParser*> parsers((int)scripts.GetLength());
+
+ // Parse all the files as if they were one
+ asUINT n = 0;
+ for( n = 0; n < scripts.GetLength(); n++ )
+ {
+ asCParser *parser = asNEW(asCParser)(this);
+ if( parser != 0 )
+ {
+ parsers.PushLast(parser);
+
+ // Parse the script file
+ parser->ParseScript(scripts[n]);
+ }
+ }
+
+ if (numErrors == 0)
+ {
+ // Find all type declarations
+ for (n = 0; n < scripts.GetLength(); n++)
+ {
+ asCScriptNode *node = parsers[n]->GetScriptNode();
+ RegisterTypesFromScript(node, scripts[n], engine->nameSpaces[0]);
+ }
+
+ // Before moving forward the builder must establish the relationship between types
+ // so that a derived type can see the child types of the parent type.
+ DetermineTypeRelations();
+
+ // Complete function definitions (defining returntype and parameters)
+ for( n = 0; n < funcDefs.GetLength(); n++ )
+ CompleteFuncDef(funcDefs[n]);
+
+ // Find other global nodes
+ for (n = 0; n < scripts.GetLength(); n++)
+ {
+ // Find other global nodes
+ asCScriptNode *node = parsers[n]->GetScriptNode();
+ RegisterNonTypesFromScript(node, scripts[n], engine->nameSpaces[0]);
+ }
+
+ // Register script methods found in the interfaces
+ for( n = 0; n < interfaceDeclarations.GetLength(); n++ )
+ {
+ sClassDeclaration *decl = interfaceDeclarations[n];
+ asCScriptNode *node = decl->node->firstChild->next;
+
+ // Skip list of inherited interfaces
+ while( node && node->nodeType == snIdentifier )
+ node = node->next;
+
+ while( node )
+ {
+ asCScriptNode *next = node->next;
+ if( node->nodeType == snFunction )
+ {
+ node->DisconnectParent();
+ RegisterScriptFunctionFromNode(node, decl->script, CastToObjectType(decl->typeInfo), true, false, 0, decl->isExistingShared);
+ }
+ else if( node->nodeType == snVirtualProperty )
+ {
+ node->DisconnectParent();
+ RegisterVirtualProperty(node, decl->script, CastToObjectType(decl->typeInfo), true, false, 0, decl->isExistingShared);
+ }
+
+ node = next;
+ }
+ }
+
+ // Register script methods found in the classes
+ for( n = 0; n < classDeclarations.GetLength(); n++ )
+ {
+ sClassDeclaration *decl = classDeclarations[n];
+
+ asCScriptNode *node = decl->node->firstChild->next;
+
+ // Skip list of classes and interfaces
+ while( node && node->nodeType == snIdentifier )
+ node = node->next;
+
+ while( node )
+ {
+ asCScriptNode *next = node->next;
+ if( node->nodeType == snFunction )
+ {
+ node->DisconnectParent();
+ RegisterScriptFunctionFromNode(node, decl->script, CastToObjectType(decl->typeInfo), false, false, 0, decl->isExistingShared);
+ }
+ else if( node->nodeType == snVirtualProperty )
+ {
+ node->DisconnectParent();
+ RegisterVirtualProperty(node, decl->script, CastToObjectType(decl->typeInfo), false, false, 0, decl->isExistingShared);
+ }
+
+ node = next;
+ }
+
+ // Make sure the default factory & constructor exists for classes
+ asCObjectType *ot = CastToObjectType(decl->typeInfo);
+ if( ot->beh.construct == engine->scriptTypeBehaviours.beh.construct )
+ {
+ if( ot->beh.constructors.GetLength() == 1 || engine->ep.alwaysImplDefaultConstruct )
+ {
+ AddDefaultConstructor(ot, decl->script);
+ }
+ else
+ {
+ // As the class has another constructor we shouldn't provide the default constructor
+ if( ot->beh.construct )
+ {
+ engine->scriptFunctions[ot->beh.construct]->ReleaseInternal();
+ ot->beh.construct = 0;
+ ot->beh.constructors.RemoveIndex(0);
+ }
+ if( ot->beh.factory )
+ {
+ engine->scriptFunctions[ot->beh.factory]->ReleaseInternal();
+ ot->beh.factory = 0;
+ ot->beh.factories.RemoveIndex(0);
+ }
+ // Only remove the opAssign method if the script hasn't provided one
+ if( ot->beh.copy == engine->scriptTypeBehaviours.beh.copy )
+ {
+ engine->scriptFunctions[ot->beh.copy]->ReleaseInternal();
+ ot->beh.copy = 0;
+ }
+ }
+ }
+ }
+ }
+
+ for( n = 0; n < parsers.GetLength(); n++ )
+ {
+ asDELETE(parsers[n],asCParser);
+ }
+}
+
+void asCBuilder::RegisterTypesFromScript(asCScriptNode *node, asCScriptCode *script, asSNameSpace *ns)
+{
+ asASSERT(node->nodeType == snScript);
+
+ // Find structure definitions first
+ node = node->firstChild;
+ while( node )
+ {
+ asCScriptNode *next = node->next;
+ if( node->nodeType == snNamespace )
+ {
+ // Recursively register the entities defined in the namespace
+ asCString nsName;
+ nsName.Assign(&script->code[node->firstChild->tokenPos], node->firstChild->tokenLength);
+ if( ns->name != "" )
+ nsName = ns->name + "::" + nsName;
+
+ asSNameSpace *nsChild = engine->AddNameSpace(nsName.AddressOf());
+ RegisterTypesFromScript(node->lastChild, script, nsChild);
+ }
+ else
+ {
+ if( node->nodeType == snClass )
+ {
+ node->DisconnectParent();
+ RegisterClass(node, script, ns);
+ }
+ else if( node->nodeType == snInterface )
+ {
+ node->DisconnectParent();
+ RegisterInterface(node, script, ns);
+ }
+ else if( node->nodeType == snEnum )
+ {
+ node->DisconnectParent();
+ RegisterEnum(node, script, ns);
+ }
+ else if( node->nodeType == snTypedef )
+ {
+ node->DisconnectParent();
+ RegisterTypedef(node, script, ns);
+ }
+ else if( node->nodeType == snFuncDef )
+ {
+ node->DisconnectParent();
+ RegisterFuncDef(node, script, ns, 0);
+ }
+ else if( node->nodeType == snMixin )
+ {
+ node->DisconnectParent();
+ RegisterMixinClass(node, script, ns);
+ }
+ }
+
+ node = next;
+ }
+}
+
+void asCBuilder::RegisterNonTypesFromScript(asCScriptNode *node, asCScriptCode *script, asSNameSpace *ns)
+{
+ node = node->firstChild;
+ while( node )
+ {
+ asCScriptNode *next = node->next;
+ if( node->nodeType == snNamespace )
+ {
+ // Determine the name of the namespace
+ asCString nsName;
+ nsName.Assign(&script->code[node->firstChild->tokenPos], node->firstChild->tokenLength);
+ if( ns->name != "" )
+ nsName = ns->name + "::" + nsName;
+
+ // Declare the namespace, then add the entities
+ asSNameSpace *nsChild = engine->AddNameSpace(nsName.AddressOf());
+ RegisterNonTypesFromScript(node->lastChild, script, nsChild);
+ }
+ else
+ {
+ node->DisconnectParent();
+ if( node->nodeType == snFunction )
+ RegisterScriptFunctionFromNode(node, script, 0, false, true, ns);
+ else if( node->nodeType == snDeclaration )
+ RegisterGlobalVar(node, script, ns);
+ else if( node->nodeType == snVirtualProperty )
+ RegisterVirtualProperty(node, script, 0, false, true, ns);
+ else if( node->nodeType == snImport )
+ RegisterImportedFunction(module->GetNextImportedFunctionId(), node, script, ns);
+ else
+ {
+ // Unused script node
+ int r, c;
+ script->ConvertPosToRowCol(node->tokenPos, &r, &c);
+
+ WriteWarning(script->name, TXT_UNUSED_SCRIPT_NODE, r, c);
+
+ node->Destroy(engine);
+ }
+ }
+
+ node = next;
+ }
+}
+
+void asCBuilder::CompileFunctions()
+{
+ // Compile each function
+ for( asUINT n = 0; n < functions.GetLength(); n++ )
+ {
+ sFunctionDescription *current = functions[n];
+ if( current == 0 ) continue;
+
+ // Don't compile the function again if it was an existing shared function
+ if( current->isExistingShared ) continue;
+
+ // Don't compile if there is no statement block
+ if (current->node && !(current->node->nodeType == snStatementBlock || current->node->lastChild->nodeType == snStatementBlock))
+ continue;
+
+ asCCompiler compiler(engine);
+ asCScriptFunction *func = engine->scriptFunctions[current->funcId];
+
+ // Find the class declaration for constructors
+ sClassDeclaration *classDecl = 0;
+ if( current->objType && current->name == current->objType->name )
+ {
+ for( asUINT c = 0; c < classDeclarations.GetLength(); c++ )
+ {
+ if( classDeclarations[c]->typeInfo == current->objType )
+ {
+ classDecl = classDeclarations[c];
+ break;
+ }
+ }
+
+ asASSERT( classDecl );
+ }
+
+ if( current->node )
+ {
+ int r, c;
+ current->script->ConvertPosToRowCol(current->node->tokenPos, &r, &c);
+
+ asCString str = func->GetDeclarationStr();
+ str.Format(TXT_COMPILING_s, str.AddressOf());
+ WriteInfo(current->script->name, str, r, c, true);
+
+ // When compiling a constructor need to pass the class declaration for member initializations
+ compiler.CompileFunction(this, current->script, current->paramNames, current->node, func, classDecl);
+
+ engine->preMessage.isSet = false;
+ }
+ else if( current->objType && current->name == current->objType->name )
+ {
+ asCScriptNode *node = classDecl->node;
+
+ int r = 0, c = 0;
+ if( node )
+ current->script->ConvertPosToRowCol(node->tokenPos, &r, &c);
+
+ asCString str = func->GetDeclarationStr();
+ str.Format(TXT_COMPILING_s, str.AddressOf());
+ WriteInfo(current->script->name, str, r, c, true);
+
+ // This is the default constructor that is generated
+ // automatically if not implemented by the user.
+ compiler.CompileDefaultConstructor(this, current->script, node, func, classDecl);
+
+ engine->preMessage.isSet = false;
+ }
+ else
+ {
+ asASSERT( false );
+ }
+ }
+}
+#endif
+
+// Called from module and engine
+int asCBuilder::ParseDataType(const char *datatype, asCDataType *result, asSNameSpace *implicitNamespace, bool isReturnType)
+{
+ Reset();
+
+ asCScriptCode source;
+ source.SetCode("", datatype, true);
+
+ asCParser parser(this);
+ int r = parser.ParseDataType(&source, isReturnType);
+ if( r < 0 )
+ return asINVALID_TYPE;
+
+ // Get data type and property name
+ asCScriptNode *dataType = parser.GetScriptNode()->firstChild;
+
+ *result = CreateDataTypeFromNode(dataType, &source, implicitNamespace, true);
+ if( isReturnType )
+ *result = ModifyDataTypeFromNode(*result, dataType->next, &source, 0, 0);
+
+ if( numErrors > 0 )
+ return asINVALID_TYPE;
+
+ return asSUCCESS;
+}
+
+int asCBuilder::ParseTemplateDecl(const char *decl, asCString *name, asCArray<asCString> &subtypeNames)
+{
+ Reset();
+
+ asCScriptCode source;
+ source.SetCode("", decl, true);
+
+ asCParser parser(this);
+ int r = parser.ParseTemplateDecl(&source);
+ if( r < 0 )
+ return asINVALID_TYPE;
+
+ // Get the template name and subtype names
+ asCScriptNode *node = parser.GetScriptNode()->firstChild;
+
+ name->Assign(&decl[node->tokenPos], node->tokenLength);
+ while( (node = node->next) != 0 )
+ {
+ asCString subtypeName;
+ subtypeName.Assign(&decl[node->tokenPos], node->tokenLength);
+ subtypeNames.PushLast(subtypeName);
+ }
+
+ // TODO: template: check for name conflicts
+
+ if( numErrors > 0 )
+ return asINVALID_DECLARATION;
+
+ return asSUCCESS;
+}
+
+int asCBuilder::VerifyProperty(asCDataType *dt, const char *decl, asCString &name, asCDataType &type, asSNameSpace *ns)
+{
+ // Either datatype or namespace must be informed
+ asASSERT( dt || ns );
+
+ Reset();
+
+ if( dt )
+ {
+ // Verify that the object type exist
+ if( CastToObjectType(dt->GetTypeInfo()) == 0 )
+ return asINVALID_OBJECT;
+ }
+
+ // Check property declaration and type
+ asCScriptCode source;
+ source.SetCode(TXT_PROPERTY, decl, true);
+
+ asCParser parser(this);
+ int r = parser.ParsePropertyDeclaration(&source);
+ if( r < 0 )
+ return asINVALID_DECLARATION;
+
+ // Get data type
+ asCScriptNode *dataType = parser.GetScriptNode()->firstChild;
+
+ // Check if the property is declared 'by reference'
+ bool isReference = (dataType->next->tokenType == ttAmp);
+
+ // Get the name of the property
+ asCScriptNode *nameNode = isReference ? dataType->next->next : dataType->next;
+
+ // If an object property is registered, then use the
+ // object's namespace, otherwise use the specified namespace
+ type = CreateDataTypeFromNode(dataType, &source, dt ? dt->GetTypeInfo()->nameSpace : ns);
+ name.Assign(&decl[nameNode->tokenPos], nameNode->tokenLength);
+ type.MakeReference(isReference);
+
+ // Validate that the type really can be a registered property
+ // We cannot use CanBeInstantiated, as it is allowed to register
+ // properties of type that cannot otherwise be instantiated
+ if( type.IsFuncdef() && !type.IsObjectHandle() )
+ {
+ // Function definitions must always be handles
+ return asINVALID_DECLARATION;
+ }
+
+ // Verify property name
+ if( dt )
+ {
+ if( CheckNameConflictMember(dt->GetTypeInfo(), name.AddressOf(), nameNode, &source, true, false) < 0 )
+ return asNAME_TAKEN;
+ }
+ else
+ {
+ if( CheckNameConflict(name.AddressOf(), nameNode, &source, ns, true, false) < 0 )
+ return asNAME_TAKEN;
+ }
+
+ if( numErrors > 0 )
+ return asINVALID_DECLARATION;
+
+ return asSUCCESS;
+}
+
+#ifndef AS_NO_COMPILER
+asCObjectProperty *asCBuilder::GetObjectProperty(asCDataType &obj, const char *prop)
+{
+ asASSERT(CastToObjectType(obj.GetTypeInfo()) != 0);
+
+ // TODO: optimize: Improve linear search
+ asCArray<asCObjectProperty *> &props = CastToObjectType(obj.GetTypeInfo())->properties;
+ for( asUINT n = 0; n < props.GetLength(); n++ )
+ {
+ if( props[n]->name == prop )
+ {
+ if( module->m_accessMask & props[n]->accessMask )
+ return props[n];
+ else
+ return 0;
+ }
+ }
+
+ return 0;
+}
+#endif
+
+bool asCBuilder::DoesGlobalPropertyExist(const char *prop, asSNameSpace *ns, asCGlobalProperty **outProp, sGlobalVariableDescription **outDesc, bool *isAppProp)
+{
+ if( outProp ) *outProp = 0;
+ if( outDesc ) *outDesc = 0;
+ if( isAppProp ) *isAppProp = false;
+
+ // Check application registered properties
+ asCString name(prop);
+ asCGlobalProperty *globProp = engine->registeredGlobalProps.GetFirst(ns, name);
+ if( globProp )
+ {
+ if( isAppProp ) *isAppProp = true;
+ if( outProp ) *outProp = globProp;
+ return true;
+ }
+
+#ifndef AS_NO_COMPILER
+ // Check properties being compiled now
+ sGlobalVariableDescription* desc = globVariables.GetFirst(ns, prop);
+ if( desc && !desc->isEnumValue )
+ {
+ if( outProp ) *outProp = desc->property;
+ if( outDesc ) *outDesc = desc;
+ return true;
+ }
+#endif
+
+ // Check previously compiled global variables
+ if( module )
+ {
+ globProp = module->m_scriptGlobals.GetFirst(ns, prop);
+ if( globProp )
+ {
+ if( outProp ) *outProp = globProp;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+asCGlobalProperty *asCBuilder::GetGlobalProperty(const char *prop, asSNameSpace *ns, bool *isCompiled, bool *isPureConstant, asQWORD *constantValue, bool *isAppProp)
+{
+ if( isCompiled ) *isCompiled = true;
+ if( isPureConstant ) *isPureConstant = false;
+ if( isAppProp ) *isAppProp = false;
+ if( constantValue ) *constantValue = 0;
+
+ asCGlobalProperty *globProp = 0;
+ sGlobalVariableDescription *globDesc = 0;
+ if( DoesGlobalPropertyExist(prop, ns, &globProp, &globDesc, isAppProp) )
+ {
+#ifndef AS_NO_COMPILER
+ if( globDesc )
+ {
+ // The property was declared in this build call, check if it has been compiled successfully already
+ if( isCompiled ) *isCompiled = globDesc->isCompiled;
+ if( isPureConstant ) *isPureConstant = globDesc->isPureConstant;
+ if( constantValue ) *constantValue = globDesc->constantValue;
+ }
+ else
+#endif
+ if( isAppProp )
+ {
+ // Don't return the property if the module doesn't have access to it
+ if( !(module->m_accessMask & globProp->accessMask) )
+ globProp = 0;
+ }
+ return globProp;
+ }
+
+ return 0;
+}
+
+int asCBuilder::ParseFunctionDeclaration(asCObjectType *objType, const char *decl, asCScriptFunction *func, bool isSystemFunction, asCArray<bool> *paramAutoHandles, bool *returnAutoHandle, asSNameSpace *ns, asCScriptNode **listPattern, asCObjectType **outParentClass)
+{
+ asASSERT( objType || ns );
+
+ if (listPattern)
+ *listPattern = 0;
+ if (outParentClass)
+ *outParentClass = 0;
+
+ // TODO: Can't we use GetParsedFunctionDetails to do most of what is done in this function?
+
+ Reset();
+
+ asCScriptCode source;
+ source.SetCode(TXT_SYSTEM_FUNCTION, decl, true);
+
+ asCParser parser(this);
+ int r = parser.ParseFunctionDefinition(&source, listPattern != 0);
+ if( r < 0 )
+ return asINVALID_DECLARATION;
+
+ asCScriptNode *node = parser.GetScriptNode();
+
+ // Determine scope
+ asCScriptNode *n = node->firstChild->next->next;
+ asCObjectType *parentClass = 0;
+ func->nameSpace = GetNameSpaceFromNode(n, &source, ns, &n, &parentClass);
+ if( func->nameSpace == 0 && parentClass == 0 )
+ return asINVALID_DECLARATION;
+ if (parentClass && func->funcType != asFUNC_FUNCDEF)
+ return asINVALID_DECLARATION;
+
+ if (outParentClass)
+ *outParentClass = parentClass;
+
+ // Find name
+ func->name.Assign(&source.code[n->tokenPos], n->tokenLength);
+
+ // Initialize a script function object for registration
+ bool autoHandle;
+
+ // Scoped reference types are allowed to use handle when returned from application functions
+ func->returnType = CreateDataTypeFromNode(node->firstChild, &source, objType ? objType->nameSpace : ns, true, parentClass ? parentClass : objType);
+ func->returnType = ModifyDataTypeFromNode(func->returnType, node->firstChild->next, &source, 0, &autoHandle);
+ if( autoHandle && (!func->returnType.IsObjectHandle() || func->returnType.IsReference()) )
+ return asINVALID_DECLARATION;
+ if( returnAutoHandle ) *returnAutoHandle = autoHandle;
+
+ // Reference types cannot be returned by value from system functions
+ if( isSystemFunction &&
+ (func->returnType.GetTypeInfo() &&
+ (func->returnType.GetTypeInfo()->flags & asOBJ_REF)) &&
+ !(func->returnType.IsReference() ||
+ func->returnType.IsObjectHandle()) )
+ return asINVALID_DECLARATION;
+
+ // Count number of parameters
+ int paramCount = 0;
+ asCScriptNode *paramList = n->next;
+ n = paramList->firstChild;
+ while( n )
+ {
+ paramCount++;
+ n = n->next->next;
+ if( n && n->nodeType == snIdentifier )
+ n = n->next;
+
+ if( n && n->nodeType == snExpression )
+ n = n->next;
+ }
+
+ // Preallocate memory
+ func->parameterTypes.Allocate(paramCount, false);
+ func->parameterNames.SetLength(paramCount);
+ func->inOutFlags.Allocate(paramCount, false);
+ func->defaultArgs.Allocate(paramCount, false);
+ if( paramAutoHandles ) paramAutoHandles->Allocate(paramCount, false);
+
+ n = paramList->firstChild;
+ asUINT index = 0;
+ while( n )
+ {
+ asETypeModifiers inOutFlags;
+ asCDataType type = CreateDataTypeFromNode(n, &source, objType ? objType->nameSpace : ns, false, parentClass ? parentClass : objType);
+ type = ModifyDataTypeFromNode(type, n->next, &source, &inOutFlags, &autoHandle);
+
+ // Reference types cannot be passed by value to system functions
+ if( isSystemFunction &&
+ (type.GetTypeInfo() &&
+ (type.GetTypeInfo()->flags & asOBJ_REF)) &&
+ !(type.IsReference() ||
+ type.IsObjectHandle()) )
+ return asINVALID_DECLARATION;
+
+ // Store the parameter type
+ func->parameterTypes.PushLast(type);
+ func->inOutFlags.PushLast(inOutFlags);
+
+ // Don't permit void parameters
+ if( type.GetTokenType() == ttVoid )
+ return asINVALID_DECLARATION;
+
+ if( autoHandle && (!type.IsObjectHandle() || type.IsReference()) )
+ return asINVALID_DECLARATION;
+
+ if( paramAutoHandles ) paramAutoHandles->PushLast(autoHandle);
+
+ // Make sure that var type parameters are references
+ if( type.GetTokenType() == ttQuestion &&
+ !type.IsReference() )
+ return asINVALID_DECLARATION;
+
+ // Move to next parameter
+ n = n->next->next;
+ if( n && n->nodeType == snIdentifier )
+ {
+ func->parameterNames[index] = asCString(&source.code[n->tokenPos], n->tokenLength);
+ n = n->next;
+ }
+ ++index;
+
+ if( n && n->nodeType == snExpression )
+ {
+ // Strip out white space and comments to better share the string
+ asCString *defaultArgStr = asNEW(asCString);
+ if( defaultArgStr )
+ {
+ *defaultArgStr = GetCleanExpressionString(n, &source);
+ func->defaultArgs.PushLast(defaultArgStr);
+ }
+
+ n = n->next;
+ }
+ else
+ func->defaultArgs.PushLast(0);
+ }
+
+ // Set the read-only flag if const is declared after parameter list
+ n = paramList->next;
+ if( n && n->nodeType == snUndefined && n->tokenType == ttConst )
+ {
+ if( objType == 0 )
+ return asINVALID_DECLARATION;
+ func->SetReadOnly(true);
+
+ n = n->next;
+ }
+ else
+ func->SetReadOnly(false);
+
+ // Check for additional function traits
+ while (n && n->nodeType == snIdentifier)
+ {
+ if (source.TokenEquals(n->tokenPos, n->tokenLength, EXPLICIT_TOKEN))
+ func->SetExplicit(true);
+ else if( source.TokenEquals(n->tokenPos, n->tokenLength, PROPERTY_TOKEN))
+ func->SetProperty(true);
+ else
+ return asINVALID_DECLARATION;
+
+ n = n->next;
+ }
+
+ // If the caller expects a list pattern, check for the existence, else report an error if not
+ if( listPattern )
+ {
+ if( n == 0 || n->nodeType != snListPattern )
+ return asINVALID_DECLARATION;
+ else
+ {
+ *listPattern = n;
+ n->DisconnectParent();
+ }
+ }
+ else
+ {
+ if( n )
+ return asINVALID_DECLARATION;
+ }
+
+ // Make sure the default args are declared correctly
+ ValidateDefaultArgs(&source, node, func);
+
+ if( numErrors > 0 || numWarnings > 0 )
+ return asINVALID_DECLARATION;
+
+ return 0;
+}
+
+int asCBuilder::ParseVariableDeclaration(const char *decl, asSNameSpace *implicitNamespace, asCString &outName, asSNameSpace *&outNamespace, asCDataType &outDt)
+{
+ Reset();
+
+ asCScriptCode source;
+ source.SetCode(TXT_VARIABLE_DECL, decl, true);
+
+ asCParser parser(this);
+
+ int r = parser.ParsePropertyDeclaration(&source);
+ if( r < 0 )
+ return asINVALID_DECLARATION;
+
+ asCScriptNode *node = parser.GetScriptNode();
+
+ // Determine the scope from declaration
+ asCScriptNode *n = node->firstChild->next;
+ // TODO: child funcdef: The parentType will be set if the scope is actually a type rather than a namespace
+ outNamespace = GetNameSpaceFromNode(n, &source, implicitNamespace, &n);
+ if( outNamespace == 0 )
+ return asINVALID_DECLARATION;
+
+ // Find name
+ outName.Assign(&source.code[n->tokenPos], n->tokenLength);
+
+ // Initialize a script variable object for registration
+ outDt = CreateDataTypeFromNode(node->firstChild, &source, implicitNamespace);
+
+ if( numErrors > 0 || numWarnings > 0 )
+ return asINVALID_DECLARATION;
+
+ return 0;
+}
+
+// TODO: This should use SymbolLookupMember, which should be available in the TypeInfo class
+int asCBuilder::CheckNameConflictMember(asCTypeInfo *t, const char *name, asCScriptNode *node, asCScriptCode *code, bool isProperty, bool isVirtualProperty)
+{
+ // It's not necessary to check against object types
+
+ asCObjectType *ot = CastToObjectType(t);
+ if (!ot)
+ return 0;
+
+ // Check against properties
+ // TODO: optimize: Improve linear search
+ // Properties are allowed to have the same name as virtual properties
+ if( !isVirtualProperty )
+ {
+ asCArray<asCObjectProperty *> &props = ot->properties;
+ for( asUINT n = 0; n < props.GetLength(); n++ )
+ {
+ if( props[n]->name == name )
+ {
+ if( code )
+ {
+ asCString str;
+ str.Format(TXT_NAME_CONFLICT_s_OBJ_PROPERTY, name);
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+ }
+ }
+
+ // Check against virtual properties
+ // Don't do this when the check is for a virtual property, as it is allowed to have multiple overloads for virtual properties
+ // Properties are allowed to have the same name as virtual properties
+ if( !isProperty && !isVirtualProperty )
+ {
+ asCArray<int> methods = ot->methods;
+ for( asUINT n = 0; n < methods.GetLength(); n++ )
+ {
+ asCScriptFunction *func = engine->scriptFunctions[methods[n]];
+ if( func->IsProperty() && func->name.SubString(4) == name )
+ {
+ if( code )
+ {
+ asCString str;
+ str.Format(TXT_NAME_CONFLICT_s_OBJ_PROPERTY, name);
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+ }
+ }
+
+ // Check against child types
+ asCArray<asCFuncdefType*> &funcdefs = ot->childFuncDefs;
+ for (asUINT n = 0; n < funcdefs.GetLength(); n++)
+ {
+ if (funcdefs[n]->name == name)
+ {
+ if (code)
+ {
+ asCString str;
+ str.Format(TXT_NAME_CONFLICT_s_IS_FUNCDEF, name);
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+ }
+
+ // Property names must be checked against method names
+ if( isProperty )
+ {
+ asCArray<int> methods = ot->methods;
+ for( asUINT n = 0; n < methods.GetLength(); n++ )
+ {
+ if( engine->scriptFunctions[methods[n]]->name == name )
+ {
+ if( code )
+ {
+ asCString str;
+ str.Format(TXT_NAME_CONFLICT_s_METHOD, name);
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+ }
+ }
+
+ // If there is a namespace at the same level with the same name as the class, then need to check for conflicts with symbols in that namespace too
+ // TODO: When classes can have static members, the code should change so that class name cannot be the same as a namespace
+ asCString scope;
+ if (ot->nameSpace->name != "")
+ scope = ot->nameSpace->name + "::" + ot->name;
+ else
+ scope = ot->name;
+ asSNameSpace *ns = engine->FindNameSpace(scope.AddressOf());
+ if (ns)
+ {
+ // Check as if not a function as it doesn't matter the function signature
+ return CheckNameConflict(name, node, code, ns, true, isVirtualProperty);
+ }
+
+ return 0;
+}
+
+// TODO: This should use SymbolLookup
+int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScriptCode *code, asSNameSpace *ns, bool isProperty, bool isVirtualProperty)
+{
+ // Check against registered object types
+ if( engine->GetRegisteredType(name, ns) != 0 )
+ {
+ if( code )
+ {
+ asCString str;
+ if (ns->name != "")
+ str = ns->name + "::" + name;
+ else
+ str = name;
+ str.Format(TXT_NAME_CONFLICT_s_EXTENDED_TYPE, str.AddressOf());
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+
+ // Check against global properties
+ // Virtual properties are allowed to have the same name as a real property
+ if( !isVirtualProperty && DoesGlobalPropertyExist(name, ns) )
+ {
+ if( code )
+ {
+ asCString str;
+ if (ns->name != "")
+ str = ns->name + "::" + name;
+ else
+ str = name;
+ str.Format(TXT_NAME_CONFLICT_s_GLOBAL_PROPERTY, str.AddressOf());
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+
+ // Check against registered global virtual properties
+ // Don't do this when the check is for a virtual property, as it is allowed to have multiple overloads for virtual properties
+ if( !isProperty || !isVirtualProperty )
+ {
+ for (asUINT n = 0; n < engine->registeredGlobalFuncs.GetSize(); n++)
+ {
+ asCScriptFunction *func = engine->registeredGlobalFuncs.Get(n);
+ if (func->IsProperty() &&
+ func->nameSpace == ns &&
+ func->name.SubString(4) == name)
+ {
+ if (code)
+ {
+ asCString str;
+ if (ns->name != "")
+ str = ns->name + "::" + name;
+ else
+ str = name;
+ str.Format(TXT_NAME_CONFLICT_s_IS_VIRTPROP, str.AddressOf());
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+ }
+ }
+
+ // Property names must be checked against function names
+ if (isProperty)
+ {
+ for (asUINT n = 0; n < engine->registeredGlobalFuncs.GetSize(); n++)
+ {
+ if (engine->registeredGlobalFuncs.Get(n)->name == name &&
+ engine->registeredGlobalFuncs.Get(n)->nameSpace == ns)
+ {
+ if (code)
+ {
+ asCString str;
+ if (ns->name != "")
+ str = ns->name + "::" + name;
+ else
+ str = name;
+ str.Format(TXT_NAME_CONFLICT_s_IS_FUNCTION, str.AddressOf());
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+ }
+ }
+
+#ifndef AS_NO_COMPILER
+ // Check against interface types
+ asUINT n;
+ for (n = 0; n < interfaceDeclarations.GetLength(); n++)
+ {
+ if (interfaceDeclarations[n]->name == name &&
+ interfaceDeclarations[n]->typeInfo->nameSpace == ns)
+ {
+ if (code)
+ {
+ asCString str;
+ if (ns->name != "")
+ str = ns->name + "::" + name;
+ else
+ str = name;
+ str.Format(TXT_NAME_CONFLICT_s_INTF, str.AddressOf());
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+ }
+
+ // Check against class types
+ for( n = 0; n < classDeclarations.GetLength(); n++ )
+ {
+ if( classDeclarations[n]->name == name &&
+ classDeclarations[n]->typeInfo->nameSpace == ns )
+ {
+ if( code )
+ {
+ asCString str;
+ if (ns->name != "")
+ str = ns->name + "::" + name;
+ else
+ str = name;
+ str.Format(TXT_NAME_CONFLICT_s_STRUCT, str.AddressOf());
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+ }
+
+ // Check against named types
+ for( n = 0; n < namedTypeDeclarations.GetLength(); n++ )
+ {
+ if( namedTypeDeclarations[n]->name == name &&
+ namedTypeDeclarations[n]->typeInfo->nameSpace == ns )
+ {
+ if( code )
+ {
+ asCString str;
+ if (ns->name != "")
+ str = ns->name + "::" + name;
+ else
+ str = name;
+ str.Format(TXT_NAME_CONFLICT_s_IS_NAMED_TYPE, str.AddressOf());
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+ }
+
+ // Must check for name conflicts with funcdefs
+ for( n = 0; n < funcDefs.GetLength(); n++ )
+ {
+ if( funcDefs[n]->name == name &&
+ module->m_funcDefs[funcDefs[n]->idx]->nameSpace == ns )
+ {
+ if( code )
+ {
+ asCString str;
+ if (ns->name != "")
+ str = ns->name + "::" + name;
+ else
+ str = name;
+ str.Format(TXT_NAME_CONFLICT_s_IS_FUNCDEF, str.AddressOf());
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+ }
+
+ // Check against mixin classes
+ if( GetMixinClass(name, ns) )
+ {
+ if( code )
+ {
+ asCString str;
+ if (ns->name != "")
+ str = ns->name + "::" + name;
+ else
+ str = name;
+ str.Format(TXT_NAME_CONFLICT_s_IS_MIXIN, str.AddressOf());
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+
+ // Check against virtual properties
+ // Don't do this when the check is for a virtual property, as it is allowed to have multiple overloads for virtual properties
+ if( !isProperty && !isVirtualProperty )
+ {
+ for (n = 0; n < functions.GetLength(); n++)
+ {
+ asCScriptFunction *func = engine->scriptFunctions[functions[n] ? functions[n]->funcId : 0];
+ if (func &&
+ func->IsProperty() &&
+ func->objectType == 0 &&
+ func->nameSpace == ns &&
+ func->name.SubString(4) == name)
+ {
+ if (code)
+ {
+ asCString str;
+ if (ns->name != "")
+ str = ns->name + "::" + name;
+ else
+ str = name;
+ str.Format(TXT_NAME_CONFLICT_s_IS_VIRTPROP, str.AddressOf());
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+ }
+ }
+
+ // Property names must be checked against function names
+ if (isProperty)
+ {
+ for (n = 0; n < functions.GetLength(); n++)
+ {
+ if (functions[n] &&
+ functions[n]->objType == 0 &&
+ functions[n]->name == name &&
+ engine->scriptFunctions[functions[n]->funcId]->nameSpace == ns )
+ {
+ if (code)
+ {
+ asCString str;
+ if (ns->name != "")
+ str = ns->name + "::" + name;
+ else
+ str = name;
+ str.Format(TXT_NAME_CONFLICT_s_IS_FUNCTION, str.AddressOf());
+ WriteError(str, code, node);
+ }
+
+ return -1;
+ }
+ }
+ }
+#endif
+
+ return 0;
+}
+
+// Returns a negative value on invalid property
+// -2 incorrect prefix
+// -3 invalid signature
+// -4 mismatching type for get/set
+// -5 name conflict
+int asCBuilder::ValidateVirtualProperty(asCScriptFunction *func)
+{
+ asASSERT( func->IsProperty() );
+
+ // A virtual property must have the prefix "get_" or "set_"
+ asCString prefix = func->name.SubString(0, 4);
+ if( prefix != "get_" && prefix != "set_" )
+ return -2;
+
+ // A getter must return a non-void type and have at most 1 argument (indexed property)
+ if( prefix == "get_" && (func->returnType == asCDataType::CreatePrimitive(ttVoid, false) || func->parameterTypes.GetLength() > 1) )
+ return -3;
+
+ // A setter must return a void and have 1 or 2 arguments (indexed property)
+ if( prefix == "set_" && (func->returnType != asCDataType::CreatePrimitive(ttVoid, false) || func->parameterTypes.GetLength() < 1 || func->parameterTypes.GetLength() > 2) )
+ return -3;
+
+ // Check matching getter/setter
+ asCDataType getType, setType;
+ bool found = false;
+ if( prefix == "get_" )
+ {
+ getType = func->returnType;
+
+ // Find if there is a set accessor in the same scope, and then validate the type of it
+ // TODO: optimize search
+ asCString setName = "set_" + func->name.SubString(4);
+ for( asUINT n = 0; n < engine->scriptFunctions.GetLength(); n++ )
+ {
+ asCScriptFunction *setFunc = engine->scriptFunctions[n];
+ if( setFunc == 0 || setFunc->name != setName || !setFunc->IsProperty() )
+ continue;
+
+ // Is it the same scope?
+ if( func->module != setFunc->module || func->nameSpace != setFunc->nameSpace || func->objectType != setFunc->objectType )
+ continue;
+
+ setType = setFunc->parameterTypes[setFunc->parameterTypes.GetLength() - 1];
+ found = true;
+ break;
+ }
+ }
+ else
+ {
+ setType = func->parameterTypes[func->parameterTypes.GetLength() - 1];
+
+ // Find if there is a get accessor in the same scope and then validate the type of it
+ // TODO: optimize search
+ asCString getName = "get_" + func->name.SubString(4);
+ for( asUINT n = 0; n < engine->scriptFunctions.GetLength(); n++ )
+ {
+ asCScriptFunction *getFunc = engine->scriptFunctions[n];
+ if( getFunc == 0 || getFunc->name != getName || !getFunc->IsProperty() )
+ continue;
+
+ // Is it the same scope?
+ if( func->module != getFunc->module || func->nameSpace != getFunc->nameSpace || func->objectType != getFunc->objectType )
+ continue;
+
+ getType = getFunc->returnType;
+ found = true;
+ break;
+ }
+ }
+
+ if( found )
+ {
+ // Check that the type matches
+ // It is permitted for a getter to return a handle and the setter to take a reference
+ if( !getType.IsEqualExceptRefAndConst(setType) &&
+ !((getType.IsObjectHandle() && !setType.IsObjectHandle()) &&
+ (getType.GetTypeInfo() == setType.GetTypeInfo())) )
+ {
+ return -4;
+ }
+ }
+
+ // Check name conflict with other entities in the same scope
+ // It is allowed to have a real property of the same name, in which case the virtual property hides the real one.
+ int r;
+ if( func->objectType )
+ r = CheckNameConflictMember(func->objectType, func->name.SubString(4).AddressOf(), 0, 0, true, true);
+ else
+ r = CheckNameConflict(func->name.SubString(4).AddressOf(), 0, 0, func->nameSpace, true, true);
+ if( r < 0 )
+ return -5;
+
+ // Everything is OK
+ return 0;
+}
+
+#ifndef AS_NO_COMPILER
+sMixinClass *asCBuilder::GetMixinClass(const char *name, asSNameSpace *ns)
+{
+ for( asUINT n = 0; n < mixinClasses.GetLength(); n++ )
+ if( mixinClasses[n]->name == name &&
+ mixinClasses[n]->ns == ns )
+ return mixinClasses[n];
+
+ return 0;
+}
+
+int asCBuilder::RegisterFuncDef(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns, asCObjectType *parent)
+{
+ // namespace and parent are exclusively mutual
+ asASSERT((ns == 0 && parent) || (ns && parent == 0));
+
+ // Skip leading 'shared' and 'external' keywords
+ asCScriptNode *n = node->firstChild;
+ while (n->nodeType == snIdentifier)
+ n = n->next;
+
+ // Find the name
+ asASSERT( n->nodeType == snDataType );
+ n = n->next->next;
+
+ asCString name;
+ name.Assign(&file->code[n->tokenPos], n->tokenLength);
+
+ // Check for name conflict with other types
+ if (ns)
+ {
+ int r = CheckNameConflict(name.AddressOf(), node, file, ns, true, false);
+ if (asSUCCESS != r)
+ {
+ node->Destroy(engine);
+ return r;
+ }
+ }
+ else
+ {
+ int r = CheckNameConflictMember(parent, name.AddressOf(), node, file, false, false);
+ if (asSUCCESS != r)
+ {
+ node->Destroy(engine);
+ return r;
+ }
+ }
+
+ // The function definition should be stored as a asCScriptFunction so that the application
+ // can use the asIScriptFunction interface to enumerate the return type and parameters
+
+ // The return type and parameter types aren't determined in this function. A second pass is
+ // necessary after all type declarations have been identified. The second pass is implemented
+ // in CompleteFuncDef().
+
+ sFuncDef *fd = asNEW(sFuncDef);
+ if( fd == 0 )
+ {
+ node->Destroy(engine);
+ return asOUT_OF_MEMORY;
+ }
+
+ fd->name = name;
+ fd->node = node;
+ fd->script = file;
+ fd->idx = module->AddFuncDef(name, ns, parent);
+
+ funcDefs.PushLast(fd);
+
+ return 0;
+}
+
+void asCBuilder::CompleteFuncDef(sFuncDef *funcDef)
+{
+ asCArray<asCString *> defaultArgs;
+ asSFunctionTraits funcTraits;
+
+ asCFuncdefType *fdt = module->m_funcDefs[funcDef->idx];
+ asASSERT( fdt );
+ asCScriptFunction *func = fdt->funcdef;
+
+ asSNameSpace *implicitNs = func->nameSpace ? func->nameSpace : fdt->parentClass->nameSpace;
+ GetParsedFunctionDetails(funcDef->node, funcDef->script, fdt->parentClass, funcDef->name, func->returnType, func->parameterNames, func->parameterTypes, func->inOutFlags, defaultArgs, funcTraits, implicitNs);
+
+ // There should not be any defaultArgs, but if there are any we need to delete them to avoid leaks
+ for( asUINT n = 0; n < defaultArgs.GetLength(); n++ )
+ if( defaultArgs[n] )
+ asDELETE(defaultArgs[n], asCString);
+
+ // All funcdefs are shared, unless one of the parameter types or return type is not shared
+ bool declaredShared = funcTraits.GetTrait(asTRAIT_SHARED);
+ funcTraits.SetTrait(asTRAIT_SHARED, true);
+ if (func->returnType.GetTypeInfo() && !func->returnType.GetTypeInfo()->IsShared())
+ {
+ if (declaredShared)
+ {
+ asCString s;
+ s.Format(TXT_SHARED_CANNOT_USE_NON_SHARED_TYPE_s, func->returnType.GetTypeInfo()->name.AddressOf());
+ WriteError(s.AddressOf(), funcDef->script, funcDef->node);
+ }
+ funcTraits.SetTrait(asTRAIT_SHARED, false);
+ }
+ for( asUINT n = 0; funcTraits.GetTrait(asTRAIT_SHARED) && n < func->parameterTypes.GetLength(); n++ )
+ if (func->parameterTypes[n].GetTypeInfo() && !func->parameterTypes[n].GetTypeInfo()->IsShared())
+ {
+ if (declaredShared)
+ {
+ asCString s;
+ s.Format(TXT_SHARED_CANNOT_USE_NON_SHARED_TYPE_s, func->parameterTypes[n].GetTypeInfo()->name.AddressOf());
+ WriteError(s.AddressOf(), funcDef->script, funcDef->node);
+ }
+ funcTraits.SetTrait(asTRAIT_SHARED, false);
+ }
+ func->SetShared(funcTraits.GetTrait(asTRAIT_SHARED));
+
+ // Check if there is another identical funcdef from another module and if so reuse that instead
+ bool found = false;
+ if( func->IsShared() )
+ {
+ for( asUINT n = 0; n < engine->funcDefs.GetLength(); n++ )
+ {
+ asCFuncdefType *fdt2 = engine->funcDefs[n];
+ if( fdt2 == 0 || fdt == fdt2 )
+ continue;
+
+ if( !fdt2->funcdef->IsShared() )
+ continue;
+
+ if( fdt2->name == fdt->name &&
+ fdt2->nameSpace == fdt->nameSpace &&
+ fdt2->funcdef->IsSignatureExceptNameEqual(func) )
+ {
+ // Replace our funcdef for the existing one
+ funcDef->idx = fdt2->funcdef->id;
+ module->ReplaceFuncDef(fdt, fdt2);
+ fdt2->AddRefInternal();
+
+ engine->funcDefs.RemoveValue(fdt);
+
+ fdt->ReleaseInternal();
+ found = true;
+ break;
+ }
+ }
+ }
+
+ // If the funcdef was declared as external then the existing shared declaration must have been found
+ if (funcTraits.GetTrait(asTRAIT_EXTERNAL) && !found)
+ {
+ asCString str;
+ str.Format(TXT_EXTERNAL_SHARED_s_NOT_FOUND, funcDef->name.AddressOf());
+ WriteError(str, funcDef->script, funcDef->node);
+ }
+
+ // Remember if the type was declared as external so the saved bytecode can be flagged accordingly
+ if (funcTraits.GetTrait(asTRAIT_EXTERNAL) && found)
+ module->m_externalTypes.PushLast(engine->scriptFunctions[funcDef->idx]->funcdefType);
+}
+
+int asCBuilder::RegisterGlobalVar(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns)
+{
+ // Has the application disabled global vars?
+ if( engine->ep.disallowGlobalVars )
+ WriteError(TXT_GLOBAL_VARS_NOT_ALLOWED, file, node);
+
+ // What data type is it?
+ asCDataType type = CreateDataTypeFromNode(node->firstChild, file, ns);
+
+ if( !type.CanBeInstantiated() )
+ {
+ asCString str;
+ if( type.IsAbstractClass() )
+ str.Format(TXT_ABSTRACT_CLASS_s_CANNOT_BE_INSTANTIATED, type.Format(ns).AddressOf());
+ else if( type.IsInterface() )
+ str.Format(TXT_INTERFACE_s_CANNOT_BE_INSTANTIATED, type.Format(ns).AddressOf());
+ else
+ // TODO: Improve error message to explain why
+ str.Format(TXT_DATA_TYPE_CANT_BE_s, type.Format(ns).AddressOf());
+
+ WriteError(str, file, node);
+ }
+
+ asCScriptNode *n = node->firstChild->next;
+
+ while( n )
+ {
+ // Verify that the name isn't taken
+ asCString name(&file->code[n->tokenPos], n->tokenLength);
+ CheckNameConflict(name.AddressOf(), n, file, ns, true, false);
+
+ // Register the global variable
+ sGlobalVariableDescription *gvar = asNEW(sGlobalVariableDescription);
+ if( gvar == 0 )
+ {
+ node->Destroy(engine);
+ return asOUT_OF_MEMORY;
+ }
+
+ gvar->script = file;
+ gvar->name = name;
+ gvar->isCompiled = false;
+ gvar->datatype = type;
+ gvar->isEnumValue = false;
+ gvar->ns = ns;
+
+ // TODO: Give error message if wrong
+ asASSERT(!gvar->datatype.IsReference());
+
+ // Allocation is done when the variable is compiled, to allow for autos
+ gvar->property = 0;
+ gvar->index = 0;
+
+ globVariables.Put(gvar);
+
+
+ gvar->declaredAtNode = n;
+ n = n->next;
+ gvar->declaredAtNode->DisconnectParent();
+ gvar->initializationNode = 0;
+ if( n &&
+ ( n->nodeType == snAssignment ||
+ n->nodeType == snArgList ||
+ n->nodeType == snInitList ) )
+ {
+ gvar->initializationNode = n;
+ n = n->next;
+ gvar->initializationNode->DisconnectParent();
+ }
+ }
+
+ node->Destroy(engine);
+
+ return 0;
+}
+
+int asCBuilder::RegisterMixinClass(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns)
+{
+ asCScriptNode *cl = node->firstChild;
+ asASSERT( cl->nodeType == snClass );
+
+ asCScriptNode *n = cl->firstChild;
+
+ // Skip potential decorator tokens
+ while( n->tokenType == ttIdentifier &&
+ (file->TokenEquals(n->tokenPos, n->tokenLength, FINAL_TOKEN) ||
+ file->TokenEquals(n->tokenPos, n->tokenLength, SHARED_TOKEN) ||
+ file->TokenEquals(n->tokenPos, n->tokenLength, ABSTRACT_TOKEN) ||
+ file->TokenEquals(n->tokenPos, n->tokenLength, EXTERNAL_TOKEN)) )
+ {
+ // Report error, because mixin class cannot be final or shared
+ asCString msg;
+ msg.Format(TXT_MIXIN_CANNOT_BE_DECLARED_AS_s, asCString(&file->code[n->tokenPos], n->tokenLength).AddressOf());
+ WriteError(msg, file, n);
+
+ asCScriptNode *tmp = n;
+ n = n->next;
+
+ // Remove the invalid node, so compilation can continue as if it wasn't there
+ tmp->DisconnectParent();
+ tmp->Destroy(engine);
+ }
+
+ asCString name(&file->code[n->tokenPos], n->tokenLength);
+
+ int r, c;
+ file->ConvertPosToRowCol(n->tokenPos, &r, &c);
+
+ CheckNameConflict(name.AddressOf(), n, file, ns, true, false);
+
+ sMixinClass *decl = asNEW(sMixinClass);
+ if( decl == 0 )
+ {
+ node->Destroy(engine);
+ return asOUT_OF_MEMORY;
+ }
+
+ mixinClasses.PushLast(decl);
+ decl->name = name;
+ decl->ns = ns;
+ decl->node = cl;
+ decl->script = file;
+
+ // Clean up memory
+ cl->DisconnectParent();
+ node->Destroy(engine);
+
+ // Check that the mixin class doesn't contain any child types
+ // TODO: Add support for child types in mixin classes
+ n = cl->firstChild;
+ while (n)
+ {
+ if (n->nodeType == snFuncDef)
+ {
+ WriteError(TXT_MIXIN_CANNOT_HAVE_CHILD_TYPES, file, n);
+ break;
+ }
+ n = n->next;
+ }
+
+ return 0;
+}
+
+int asCBuilder::RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns)
+{
+ asCScriptNode *n = node->firstChild;
+ bool isFinal = false;
+ bool isShared = false;
+ bool isAbstract = false;
+ bool isExternal = false;
+
+ // Check the class modifiers
+ while( n->tokenType == ttIdentifier )
+ {
+ if( file->TokenEquals(n->tokenPos, n->tokenLength, FINAL_TOKEN) )
+ {
+ if( isAbstract )
+ WriteError(TXT_CLASS_CANT_BE_FINAL_AND_ABSTRACT, file, n);
+ else
+ {
+ if( isFinal )
+ {
+ asCString msg;
+ msg.Format(TXT_ATTR_s_INFORMED_MULTIPLE_TIMES, asCString(&file->code[n->tokenPos], n->tokenLength).AddressOf());
+ WriteWarning(msg, file, n);
+ }
+ isFinal = true;
+ }
+ }
+ else if( file->TokenEquals(n->tokenPos, n->tokenLength, SHARED_TOKEN) )
+ {
+ if( isShared )
+ {
+ asCString msg;
+ msg.Format(TXT_ATTR_s_INFORMED_MULTIPLE_TIMES, asCString(&file->code[n->tokenPos], n->tokenLength).AddressOf());
+ WriteWarning(msg, file, n);
+ }
+ isShared = true;
+ }
+ else if (file->TokenEquals(n->tokenPos, n->tokenLength, EXTERNAL_TOKEN))
+ {
+ if (isExternal)
+ {
+ asCString msg;
+ msg.Format(TXT_ATTR_s_INFORMED_MULTIPLE_TIMES, asCString(&file->code[n->tokenPos], n->tokenLength).AddressOf());
+ WriteWarning(msg, file, n);
+ }
+ isExternal = true;
+ }
+ else if( file->TokenEquals(n->tokenPos, n->tokenLength, ABSTRACT_TOKEN) )
+ {
+ if( isFinal )
+ WriteError(TXT_CLASS_CANT_BE_FINAL_AND_ABSTRACT, file, n);
+ else
+ {
+ if( isAbstract )
+ {
+ asCString msg;
+ msg.Format(TXT_ATTR_s_INFORMED_MULTIPLE_TIMES, asCString(&file->code[n->tokenPos], n->tokenLength).AddressOf());
+ WriteWarning(msg, file, n);
+ }
+ isAbstract = true;
+ }
+ }
+ else
+ {
+ // This is the name of the class
+ break;
+ }
+
+ n = n->next;
+ }
+
+ asCString name(&file->code[n->tokenPos], n->tokenLength);
+
+ int r, c;
+ file->ConvertPosToRowCol(n->tokenPos, &r, &c);
+
+ CheckNameConflict(name.AddressOf(), n, file, ns, true, false);
+
+ sClassDeclaration *decl = asNEW(sClassDeclaration);
+ if( decl == 0 )
+ {
+ node->Destroy(engine);
+ return asOUT_OF_MEMORY;
+ }
+
+ classDeclarations.PushLast(decl);
+ decl->name = name;
+ decl->script = file;
+ decl->node = node;
+
+ // External shared interfaces must not try to redefine the interface
+ if (isExternal && (n->next == 0 || n->next->tokenType != ttEndStatement))
+ {
+ asCString str;
+ str.Format(TXT_EXTERNAL_SHARED_s_CANNOT_REDEF, name.AddressOf());
+ WriteError(str, file, n);
+ }
+ else if (!isExternal && n->next && n->next->tokenType == ttEndStatement)
+ {
+ asCString str;
+ str.Format(TXT_MISSING_DEFINITION_OF_s, name.AddressOf());
+ WriteError(str, file, n);
+ }
+
+ // If this type is shared and there already exist another shared
+ // type of the same name, then that one should be used instead of
+ // creating a new one.
+ asCObjectType *st = 0;
+ if( isShared )
+ {
+ for( asUINT i = 0; i < engine->sharedScriptTypes.GetLength(); i++ )
+ {
+ st = CastToObjectType(engine->sharedScriptTypes[i]);
+ if( st &&
+ st->IsShared() &&
+ st->name == name &&
+ st->nameSpace == ns &&
+ !st->IsInterface() )
+ {
+ // We'll use the existing type
+ decl->isExistingShared = true;
+ decl->typeInfo = st;
+ module->AddClassType(st);
+ st->AddRefInternal();
+ break;
+ }
+ }
+ }
+
+ // If the class was declared as external then it must have been compiled in a different module first
+ if (isExternal && decl->typeInfo == 0)
+ {
+ asCString str;
+ str.Format(TXT_EXTERNAL_SHARED_s_NOT_FOUND, name.AddressOf());
+ WriteError(str, file, n);
+ }
+
+ // Remember if the class was declared as external so the saved bytecode can be flagged accordingly
+ if (isExternal)
+ module->m_externalTypes.PushLast(st);
+
+ if (!decl->isExistingShared)
+ {
+ // Create a new object type for this class
+ st = asNEW(asCObjectType)(engine);
+ if (st == 0)
+ return asOUT_OF_MEMORY;
+
+ // By default all script classes are marked as garbage collected.
+ // Only after the complete structure and relationship between classes
+ // is known, can the flag be cleared for those objects that truly cannot
+ // form circular references. This is important because a template
+ // callback may be called with a script class before the compilation
+ // completes, and until it is known, the callback must assume the class
+ // is garbage collected.
+ st->flags = asOBJ_REF | asOBJ_SCRIPT_OBJECT | asOBJ_GC;
+
+ if (isShared)
+ st->flags |= asOBJ_SHARED;
+
+ if (isFinal)
+ st->flags |= asOBJ_NOINHERIT;
+
+ if (isAbstract)
+ st->flags |= asOBJ_ABSTRACT;
+
+ if (node->tokenType == ttHandle)
+ st->flags |= asOBJ_IMPLICIT_HANDLE;
+
+ st->size = sizeof(asCScriptObject);
+ st->name = name;
+ st->nameSpace = ns;
+ st->module = module;
+ module->AddClassType(st);
+ if (isShared)
+ {
+ engine->sharedScriptTypes.PushLast(st);
+ st->AddRefInternal();
+ }
+ decl->typeInfo = st;
+
+ // Use the default script class behaviours
+ st->beh = engine->scriptTypeBehaviours.beh;
+
+ // TODO: Move this to asCObjectType so that the asCRestore can reuse it
+ engine->scriptFunctions[st->beh.addref]->AddRefInternal();
+ engine->scriptFunctions[st->beh.release]->AddRefInternal();
+ engine->scriptFunctions[st->beh.gcEnumReferences]->AddRefInternal();
+ engine->scriptFunctions[st->beh.gcGetFlag]->AddRefInternal();
+ engine->scriptFunctions[st->beh.gcGetRefCount]->AddRefInternal();
+ engine->scriptFunctions[st->beh.gcReleaseAllReferences]->AddRefInternal();
+ engine->scriptFunctions[st->beh.gcSetFlag]->AddRefInternal();
+ engine->scriptFunctions[st->beh.copy]->AddRefInternal();
+ engine->scriptFunctions[st->beh.factory]->AddRefInternal();
+ engine->scriptFunctions[st->beh.construct]->AddRefInternal();
+ // TODO: weak: Should not do this if the class has been declared with noweak
+ engine->scriptFunctions[st->beh.getWeakRefFlag]->AddRefInternal();
+
+ // Skip to the content of the class
+ while (n && n->nodeType == snIdentifier)
+ n = n->next;
+ }
+
+ // Register possible child types
+ while (n)
+ {
+ node = n->next;
+ if (n->nodeType == snFuncDef)
+ {
+ n->DisconnectParent();
+ if (!decl->isExistingShared)
+ RegisterFuncDef(n, file, 0, st);
+ else
+ {
+ // Destroy the node, since it won't be used
+ // TODO: Should verify that the funcdef is identical to the one in the existing shared class
+ n->Destroy(engine);
+ }
+ }
+ n = node;
+ }
+
+ return 0;
+}
+
+int asCBuilder::RegisterInterface(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns)
+{
+ asCScriptNode *n = node->firstChild;
+
+ bool isShared = false;
+ bool isExternal = false;
+ while( n->nodeType == snIdentifier )
+ {
+ if (file->TokenEquals(n->tokenPos, n->tokenLength, SHARED_TOKEN))
+ isShared = true;
+ else if (file->TokenEquals(n->tokenPos, n->tokenLength, EXTERNAL_TOKEN))
+ isExternal = true;
+ else
+ break;
+ n = n->next;
+ }
+
+ int r, c;
+ file->ConvertPosToRowCol(n->tokenPos, &r, &c);
+
+ asCString name;
+ name.Assign(&file->code[n->tokenPos], n->tokenLength);
+ CheckNameConflict(name.AddressOf(), n, file, ns, true, false);
+
+ sClassDeclaration *decl = asNEW(sClassDeclaration);
+ if( decl == 0 )
+ {
+ node->Destroy(engine);
+ return asOUT_OF_MEMORY;
+ }
+
+ interfaceDeclarations.PushLast(decl);
+ decl->name = name;
+ decl->script = file;
+ decl->node = node;
+
+ // External shared interfaces must not try to redefine the interface
+ if (isExternal && (n->next == 0 || n->next->tokenType != ttEndStatement) )
+ {
+ asCString str;
+ str.Format(TXT_EXTERNAL_SHARED_s_CANNOT_REDEF, name.AddressOf());
+ WriteError(str, file, n);
+ }
+ else if (!isExternal && n->next && n->next->tokenType == ttEndStatement)
+ {
+ asCString str;
+ str.Format(TXT_MISSING_DEFINITION_OF_s, name.AddressOf());
+ WriteError(str, file, n);
+ }
+
+ // If this type is shared and there already exist another shared
+ // type of the same name, then that one should be used instead of
+ // creating a new one.
+ if( isShared )
+ {
+ for( asUINT i = 0; i < engine->sharedScriptTypes.GetLength(); i++ )
+ {
+ asCObjectType *st = CastToObjectType(engine->sharedScriptTypes[i]);
+ if( st &&
+ st->IsShared() &&
+ st->name == name &&
+ st->nameSpace == ns &&
+ st->IsInterface() )
+ {
+ // We'll use the existing type
+ decl->isExistingShared = true;
+ decl->typeInfo = st;
+ module->AddClassType(st);
+ st->AddRefInternal();
+
+ // Remember if the interface was declared as external so the saved bytecode can be flagged accordingly
+ if (isExternal)
+ module->m_externalTypes.PushLast(st);
+
+ return 0;
+ }
+ }
+ }
+
+ // If the interface was declared as external then it must have been compiled in a different module first
+ if (isExternal)
+ {
+ asCString str;
+ str.Format(TXT_EXTERNAL_SHARED_s_NOT_FOUND, name.AddressOf());
+ WriteError(str, file, n);
+ }
+
+ // Register the object type for the interface
+ asCObjectType *st = asNEW(asCObjectType)(engine);
+ if( st == 0 )
+ return asOUT_OF_MEMORY;
+
+ st->flags = asOBJ_REF | asOBJ_SCRIPT_OBJECT;
+
+ if( isShared )
+ st->flags |= asOBJ_SHARED;
+
+ st->size = 0; // Cannot be instantiated
+ st->name = name;
+ st->nameSpace = ns;
+ st->module = module;
+ module->AddClassType(st);
+ if( isShared )
+ {
+ engine->sharedScriptTypes.PushLast(st);
+ st->AddRefInternal();
+ }
+ decl->typeInfo = st;
+
+ // Use the default script class behaviours
+ st->beh.construct = 0;
+ st->beh.addref = engine->scriptTypeBehaviours.beh.addref;
+ engine->scriptFunctions[st->beh.addref]->AddRefInternal();
+ st->beh.release = engine->scriptTypeBehaviours.beh.release;
+ engine->scriptFunctions[st->beh.release]->AddRefInternal();
+ st->beh.copy = 0;
+
+ return 0;
+}
+
+void asCBuilder::CompileGlobalVariables()
+{
+ bool compileSucceeded = true;
+
+ // Store state of compilation (errors, warning, output)
+ int currNumErrors = numErrors;
+ int currNumWarnings = numWarnings;
+
+ // Backup the original message stream
+ bool msgCallback = engine->msgCallback;
+ asSSystemFunctionInterface msgCallbackFunc = engine->msgCallbackFunc;
+ void *msgCallbackObj = engine->msgCallbackObj;
+
+ // Set the new temporary message stream
+ asCOutputBuffer outBuffer;
+ engine->SetMessageCallback(asMETHOD(asCOutputBuffer, Callback), &outBuffer, asCALL_THISCALL);
+
+ asCOutputBuffer finalOutput;
+ asCScriptFunction *initFunc = 0;
+
+ asCSymbolTable<asCGlobalProperty> initOrder;
+
+ // We first try to compile all the primitive global variables, and only after that
+ // compile the non-primitive global variables. This permits the constructors
+ // for the complex types to use the already initialized variables of primitive
+ // type. Note, we currently don't know which global variables are used in the
+ // constructors, so we cannot guarantee that variables of complex types are
+ // initialized in the correct order, so we won't reorder those.
+ bool compilingPrimitives = true;
+
+ // Compile each global variable
+ while( compileSucceeded )
+ {
+ compileSucceeded = false;
+
+ int accumErrors = 0;
+ int accumWarnings = 0;
+
+ // Restore state of compilation
+ finalOutput.Clear();
+ asCSymbolTable<sGlobalVariableDescription>::iterator it = globVariables.List();
+ for( ; it; it++ )
+ {
+ sGlobalVariableDescription *gvar = *it;
+ if( gvar->isCompiled )
+ continue;
+
+ asCByteCode init(engine);
+ numWarnings = 0;
+ numErrors = 0;
+ outBuffer.Clear();
+
+ // Skip this for now if we're not compiling complex types yet
+ if( compilingPrimitives && !gvar->datatype.IsPrimitive() )
+ continue;
+
+ if( gvar->declaredAtNode )
+ {
+ int r, c;
+ gvar->script->ConvertPosToRowCol(gvar->declaredAtNode->tokenPos, &r, &c);
+ asCString str = gvar->datatype.Format(gvar->ns);
+ str += " " + gvar->name;
+ str.Format(TXT_COMPILING_s, str.AddressOf());
+ WriteInfo(gvar->script->name, str, r, c, true);
+ }
+
+ if( gvar->isEnumValue )
+ {
+ int r;
+ if( gvar->initializationNode )
+ {
+ asCCompiler comp(engine);
+ asCScriptFunction func(engine, module, asFUNC_SCRIPT);
+
+ // Set the namespace that should be used during the compilation
+ func.nameSpace = gvar->datatype.GetTypeInfo()->nameSpace;
+
+ // Temporarily switch the type of the variable to int so it can be compiled properly
+ asCDataType saveType;
+ saveType = gvar->datatype;
+ gvar->datatype = asCDataType::CreatePrimitive(ttInt, true);
+ r = comp.CompileGlobalVariable(this, gvar->script, gvar->initializationNode, gvar, &func);
+ gvar->datatype = saveType;
+
+ // Make the function a dummy so it doesn't try to release objects while destroying the function
+ func.funcType = asFUNC_DUMMY;
+ }
+ else
+ {
+ r = 0;
+
+ // When there is no assignment the value is the last + 1
+ int enumVal = 0;
+ asCSymbolTable<sGlobalVariableDescription>::iterator prev_it = it;
+ prev_it--;
+ if( prev_it )
+ {
+ sGlobalVariableDescription *gvar2 = *prev_it;
+ if(gvar2->datatype == gvar->datatype )
+ {
+ enumVal = int(gvar2->constantValue) + 1;
+
+ if( !gvar2->isCompiled )
+ {
+ int row, col;
+ gvar->script->ConvertPosToRowCol(gvar->declaredAtNode->tokenPos, &row, &col);
+
+ asCString str = gvar->datatype.Format(gvar->ns);
+ str += " " + gvar->name;
+ str.Format(TXT_COMPILING_s, str.AddressOf());
+ WriteInfo(gvar->script->name, str, row, col, true);
+
+ str.Format(TXT_UNINITIALIZED_GLOBAL_VAR_s, gvar2->name.AddressOf());
+ WriteError(gvar->script->name, str, row, col);
+ r = -1;
+ }
+ }
+ }
+
+ gvar->constantValue = enumVal;
+ }
+
+ if( r >= 0 )
+ {
+ // Set the value as compiled
+ gvar->isCompiled = true;
+ compileSucceeded = true;
+ }
+ }
+ else
+ {
+ // Compile the global variable
+ initFunc = asNEW(asCScriptFunction)(engine, module, asFUNC_SCRIPT);
+ if( initFunc == 0 )
+ {
+ // Out of memory
+ return;
+ }
+
+ // Set the namespace that should be used for this function
+ initFunc->nameSpace = gvar->ns;
+
+ asCCompiler comp(engine);
+ int r = comp.CompileGlobalVariable(this, gvar->script, gvar->initializationNode, gvar, initFunc);
+ if( r >= 0 )
+ {
+ // Compilation succeeded
+ gvar->isCompiled = true;
+ compileSucceeded = true;
+ }
+ else
+ {
+ // Compilation failed
+ initFunc->funcType = asFUNC_DUMMY;
+ asDELETE(initFunc, asCScriptFunction);
+ initFunc = 0;
+ }
+ }
+
+ if( gvar->isCompiled )
+ {
+ // Add warnings for this constant to the total build
+ if( numWarnings )
+ {
+ currNumWarnings += numWarnings;
+ if( msgCallback )
+ outBuffer.SendToCallback(engine, &msgCallbackFunc, msgCallbackObj);
+ }
+
+ // Determine order of variable initializations
+ if( gvar->property && !gvar->isEnumValue )
+ initOrder.Put(gvar->property);
+
+ // Does the function contain more than just a SUSPEND followed by a RET instruction?
+ if( initFunc && initFunc->scriptData->byteCode.GetLength() > 2 )
+ {
+ // Create the init function for this variable
+ initFunc->id = engine->GetNextScriptFunctionId();
+ engine->AddScriptFunction(initFunc);
+
+ // Finalize the init function for this variable
+ initFunc->returnType = asCDataType::CreatePrimitive(ttVoid, false);
+ initFunc->scriptData->scriptSectionIdx = engine->GetScriptSectionNameIndex(gvar->script->name.AddressOf());
+ if( gvar->declaredAtNode )
+ {
+ int row, col;
+ gvar->script->ConvertPosToRowCol(gvar->declaredAtNode->tokenPos, &row, &col);
+ initFunc->scriptData->declaredAt = (row & 0xFFFFF)|((col & 0xFFF)<<20);
+ }
+
+ gvar->property->SetInitFunc(initFunc);
+
+ initFunc->ReleaseInternal();
+ initFunc = 0;
+ }
+ else if( initFunc )
+ {
+ // Destroy the function as it won't be used
+ initFunc->funcType = asFUNC_DUMMY;
+ asDELETE(initFunc, asCScriptFunction);
+ initFunc = 0;
+ }
+
+ // Convert enums to true enum values, so subsequent compilations can access it as an enum
+ if( gvar->isEnumValue )
+ {
+ asCEnumType *enumType = CastToEnumType(gvar->datatype.GetTypeInfo());
+ asASSERT(NULL != enumType);
+
+ asSEnumValue *e = asNEW(asSEnumValue);
+ if( e == 0 )
+ {
+ // Out of memory
+ numErrors++;
+ return;
+ }
+
+ e->name = gvar->name;
+ e->value = int(gvar->constantValue);
+
+ enumType->enumValues.PushLast(e);
+ }
+ }
+ else
+ {
+ // Add output to final output
+ finalOutput.Append(outBuffer);
+ accumErrors += numErrors;
+ accumWarnings += numWarnings;
+ }
+
+ engine->preMessage.isSet = false;
+ }
+
+ if( !compileSucceeded )
+ {
+ if( compilingPrimitives )
+ {
+ // No more primitives could be compiled, so
+ // switch to compiling the complex variables
+ compilingPrimitives = false;
+ compileSucceeded = true;
+ }
+ else
+ {
+ // No more variables can be compiled
+ // Add errors and warnings to total build
+ currNumWarnings += accumWarnings;
+ currNumErrors += accumErrors;
+ if( msgCallback )
+ finalOutput.SendToCallback(engine, &msgCallbackFunc, msgCallbackObj);
+ }
+ }
+ }
+
+ // Restore states
+ engine->msgCallback = msgCallback;
+ engine->msgCallbackFunc = msgCallbackFunc;
+ engine->msgCallbackObj = msgCallbackObj;
+
+ numWarnings = currNumWarnings;
+ numErrors = currNumErrors;
+
+ // Set the correct order of initialization
+ if( numErrors == 0 )
+ {
+ // If the length of the arrays are not the same, then this is the compilation
+ // of a single variable, in which case the initialization order of the previous
+ // variables must be preserved.
+ if( module->m_scriptGlobals.GetSize() == initOrder.GetSize() )
+ module->m_scriptGlobals.SwapWith(initOrder);
+ }
+
+ CleanupEnumValues();
+}
+
+void asCBuilder::CleanupEnumValues()
+{
+ // Delete the enum expressions
+ asCSymbolTableIterator<sGlobalVariableDescription> it = globVariables.List();
+ while (it)
+ {
+ sGlobalVariableDescription *gvar = *it;
+ if (gvar->isEnumValue)
+ {
+ // Remove from symboltable. This has to be done prior to freeing the memeory
+ globVariables.Erase(it.GetIndex());
+
+ // Destroy the gvar property
+ if (gvar->declaredAtNode)
+ {
+ gvar->declaredAtNode->Destroy(engine);
+ gvar->declaredAtNode = 0;
+ }
+ if (gvar->initializationNode)
+ {
+ gvar->initializationNode->Destroy(engine);
+ gvar->initializationNode = 0;
+ }
+ if (gvar->property)
+ {
+ asDELETE(gvar->property, asCGlobalProperty);
+ gvar->property = 0;
+ }
+
+ asDELETE(gvar, sGlobalVariableDescription);
+ }
+ else
+ it++;
+ }
+}
+
+int asCBuilder::GetNamespaceAndNameFromNode(asCScriptNode *n, asCScriptCode *script, asSNameSpace *implicitNs, asSNameSpace *&outNs, asCString &outName)
+{
+ // TODO: child funcdef: The node might be a snScope now
+ asASSERT( n->nodeType == snIdentifier );
+
+ // Get the optional scope from the node
+ // TODO: child funcdef: The parentType will be set if the scope is actually a type rather than a namespace
+ asSNameSpace *ns = GetNameSpaceFromNode(n->firstChild, script, implicitNs, 0);
+ if( ns == 0 )
+ return -1;
+
+ // Get the name
+ asCString name(&script->code[n->lastChild->tokenPos], n->lastChild->tokenLength);
+
+ outNs = ns;
+ outName = name;
+
+ return 0;
+}
+
+void asCBuilder::AddInterfaceFromMixinToClass(sClassDeclaration *decl, asCScriptNode *errNode, sMixinClass *mixin)
+{
+ // Determine what interfaces that the mixin implements
+ asCScriptNode *node = mixin->node;
+ asASSERT(node->nodeType == snClass);
+
+ // Skip the name of the mixin
+ node = node->firstChild->next;
+
+
+ while( node && node->nodeType == snIdentifier )
+ {
+ bool ok = true;
+ asSNameSpace *ns;
+ asCString name;
+ if( GetNamespaceAndNameFromNode(node, mixin->script, mixin->ns, ns, name) < 0 )
+ ok = false;
+ else
+ {
+ // Find the object type for the interface
+ asCObjectType *objType = GetObjectType(name.AddressOf(), ns);
+
+ // Check that the object type is an interface
+ if( objType && objType->IsInterface() )
+ {
+ // Only add the interface if the class doesn't already implement it
+ if( !decl->typeInfo->Implements(objType) )
+ AddInterfaceToClass(decl, errNode, objType);
+ }
+ else
+ {
+ WriteError(TXT_MIXIN_CLASS_CANNOT_INHERIT, mixin->script, node);
+ ok = false;
+ }
+ }
+
+ if( !ok )
+ {
+ // Remove this node so the error isn't reported again
+ asCScriptNode *delNode = node;
+ node = node->prev;
+ delNode->DisconnectParent();
+ delNode->Destroy(engine);
+ }
+
+ node = node->next;
+ }
+}
+
+void asCBuilder::AddInterfaceToClass(sClassDeclaration *decl, asCScriptNode *errNode, asCObjectType *intfType)
+{
+ // A shared type may only implement from shared interfaces
+ if( decl->typeInfo->IsShared() && !intfType->IsShared() )
+ {
+ asCString msg;
+ msg.Format(TXT_SHARED_CANNOT_IMPLEMENT_NON_SHARED_s, intfType->name.AddressOf());
+ WriteError(msg, decl->script, errNode);
+ return;
+ }
+
+ if( decl->isExistingShared )
+ {
+ // If the class is an existing shared class, then just check if the
+ // interface exists in the original declaration too
+ if( !decl->typeInfo->Implements(intfType) )
+ {
+ asCString str;
+ str.Format(TXT_SHARED_s_DOESNT_MATCH_ORIGINAL, decl->typeInfo->GetName());
+ WriteError(str, decl->script, errNode);
+ return;
+ }
+ }
+ else
+ {
+ // If the interface is already in the class then don't add it again
+ if( decl->typeInfo->Implements(intfType) )
+ return;
+
+ // Add the interface to the class
+ CastToObjectType(decl->typeInfo)->interfaces.PushLast(intfType);
+
+ // Add the inherited interfaces too
+ // For interfaces this will be done outside to handle out-of-order declarations
+ if( !CastToObjectType(decl->typeInfo)->IsInterface() )
+ {
+ for( asUINT n = 0; n < intfType->interfaces.GetLength(); n++ )
+ AddInterfaceToClass(decl, errNode, intfType->interfaces[n]);
+ }
+ }
+}
+
+void asCBuilder::CompileInterfaces()
+{
+ asUINT n;
+
+ // Order the interfaces with inheritances so that the inherited
+ // of inherited interfaces can be added properly
+ for( n = 0; n < interfaceDeclarations.GetLength(); n++ )
+ {
+ sClassDeclaration *intfDecl = interfaceDeclarations[n];
+ asCObjectType *intfType = CastToObjectType(intfDecl->typeInfo);
+
+ if( intfType->interfaces.GetLength() == 0 ) continue;
+
+ // If any of the derived interfaces are found after this interface, then move this to the end of the list
+ for( asUINT m = n+1; m < interfaceDeclarations.GetLength(); m++ )
+ {
+ if( intfType != interfaceDeclarations[m]->typeInfo &&
+ intfType->Implements(interfaceDeclarations[m]->typeInfo) )
+ {
+ interfaceDeclarations.RemoveIndex(n);
+ interfaceDeclarations.PushLast(intfDecl);
+
+ // Decrease index so that we don't skip an entry
+ n--;
+ break;
+ }
+ }
+ }
+
+ // Now recursively add the additional inherited interfaces
+ for( n = 0; n < interfaceDeclarations.GetLength(); n++ )
+ {
+ sClassDeclaration *intfDecl = interfaceDeclarations[n];
+ if( intfDecl->isExistingShared )
+ {
+ // Set the declaration as validated already, so that other
+ // types that contain this will accept this type
+ intfDecl->validState = 1;
+ continue;
+ }
+
+ asCObjectType *intfType = CastToObjectType(intfDecl->typeInfo);
+
+ // TODO: Is this really at the correct place? Hasn't the vfTableIdx already been set here?
+ // Co-opt the vfTableIdx value in our own methods to indicate the
+ // index the function should have in the table chunk for this interface.
+ for( asUINT d = 0; d < intfType->methods.GetLength(); d++ )
+ {
+ asCScriptFunction *func = GetFunctionDescription(intfType->methods[d]);
+ func->vfTableIdx = d;
+
+ asASSERT(func->objectType == intfType);
+ }
+
+ // As new interfaces will be added to the end of the list, all
+ // interfaces will be traversed the same as recursively
+ for( asUINT m = 0; m < intfType->interfaces.GetLength(); m++ )
+ {
+ asCObjectType *base = intfType->interfaces[m];
+
+ // Add any interfaces not already implemented
+ for( asUINT l = 0; l < base->interfaces.GetLength(); l++ )
+ AddInterfaceToClass(intfDecl, intfDecl->node, base->interfaces[l]);
+
+ // Add the methods from the implemented interface
+ for( asUINT l = 0; l < base->methods.GetLength(); l++ )
+ {
+ // If the derived interface implements the same method, then don't add the base interface' method
+ asCScriptFunction *baseFunc = GetFunctionDescription(base->methods[l]);
+ asCScriptFunction *derivedFunc = 0;
+ bool found = false;
+ for( asUINT d = 0; d < intfType->methods.GetLength(); d++ )
+ {
+ derivedFunc = GetFunctionDescription(intfType->methods[d]);
+ if( derivedFunc->IsSignatureEqual(baseFunc) )
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if( !found )
+ {
+ // Add the method
+ intfType->methods.PushLast(baseFunc->id);
+ baseFunc->AddRefInternal();
+ }
+ }
+ }
+ }
+}
+
+void asCBuilder::DetermineTypeRelations()
+{
+ // Determine inheritance between interfaces
+ for (asUINT n = 0; n < interfaceDeclarations.GetLength(); n++)
+ {
+ sClassDeclaration *intfDecl = interfaceDeclarations[n];
+ asCObjectType *intfType = CastToObjectType(intfDecl->typeInfo);
+
+ asCScriptNode *node = intfDecl->node;
+ asASSERT(node && node->nodeType == snInterface);
+ node = node->firstChild;
+
+ // Skip the 'shared' & 'external' keywords
+ while( node->nodeType == snIdentifier &&
+ (intfDecl->script->TokenEquals(node->tokenPos, node->tokenLength, SHARED_TOKEN) ||
+ intfDecl->script->TokenEquals(node->tokenPos, node->tokenLength, EXTERNAL_TOKEN)) )
+ node = node->next;
+
+ // Skip the name
+ node = node->next;
+
+ // Verify the inherited interfaces
+ while (node && node->nodeType == snIdentifier)
+ {
+ asSNameSpace *ns;
+ asCString name;
+ if (GetNamespaceAndNameFromNode(node, intfDecl->script, intfType->nameSpace, ns, name) < 0)
+ {
+ node = node->next;
+ continue;
+ }
+
+ // Find the object type for the interface
+ asCObjectType *objType = 0;
+ while (ns)
+ {
+ objType = GetObjectType(name.AddressOf(), ns);
+ if (objType) break;
+
+ ns = engine->GetParentNameSpace(ns);
+ }
+
+ // Check that the object type is an interface
+ bool ok = true;
+ if (objType && objType->IsInterface())
+ {
+ // Check that the implemented interface is shared if the base interface is shared
+ if (intfType->IsShared() && !objType->IsShared())
+ {
+ asCString str;
+ str.Format(TXT_SHARED_CANNOT_IMPLEMENT_NON_SHARED_s, objType->GetName());
+ WriteError(str, intfDecl->script, node);
+ ok = false;
+ }
+ }
+ else
+ {
+ WriteError(TXT_INTERFACE_CAN_ONLY_IMPLEMENT_INTERFACE, intfDecl->script, node);
+ ok = false;
+ }
+
+ if (ok)
+ {
+ // Make sure none of the implemented interfaces implement from this one
+ asCObjectType *base = objType;
+ while (base != 0)
+ {
+ if (base == intfType)
+ {
+ WriteError(TXT_CANNOT_IMPLEMENT_SELF, intfDecl->script, node);
+ ok = false;
+ break;
+ }
+
+ // At this point there is at most one implemented interface
+ if (base->interfaces.GetLength())
+ base = base->interfaces[0];
+ else
+ break;
+ }
+ }
+
+ if (ok)
+ AddInterfaceToClass(intfDecl, node, objType);
+
+ // Remove the nodes so they aren't parsed again
+ asCScriptNode *delNode = node;
+ node = node->next;
+ delNode->DisconnectParent();
+ delNode->Destroy(engine);
+ }
+ }
+
+ // Determine class inheritances and interfaces
+ for (asUINT n = 0; n < classDeclarations.GetLength(); n++)
+ {
+ sClassDeclaration *decl = classDeclarations[n];
+ asCScriptCode *file = decl->script;
+
+ // Find the base class that this class inherits from
+ bool multipleInheritance = false;
+ asCScriptNode *node = decl->node->firstChild;
+
+ while (file->TokenEquals(node->tokenPos, node->tokenLength, FINAL_TOKEN) ||
+ file->TokenEquals(node->tokenPos, node->tokenLength, SHARED_TOKEN) ||
+ file->TokenEquals(node->tokenPos, node->tokenLength, ABSTRACT_TOKEN) ||
+ file->TokenEquals(node->tokenPos, node->tokenLength, EXTERNAL_TOKEN))
+ {
+ node = node->next;
+ }
+
+ // Skip the name of the class
+ asASSERT(node->tokenType == ttIdentifier);
+ node = node->next;
+
+ while (node && node->nodeType == snIdentifier)
+ {
+ asSNameSpace *ns;
+ asCString name;
+ if (GetNamespaceAndNameFromNode(node, file, decl->typeInfo->nameSpace, ns, name) < 0)
+ {
+ node = node->next;
+ continue;
+ }
+
+ // Find the object type for the interface
+ asCObjectType *objType = 0;
+ sMixinClass *mixin = 0;
+ asSNameSpace *origNs = ns;
+ while (ns)
+ {
+ objType = GetObjectType(name.AddressOf(), ns);
+ if (objType == 0)
+ mixin = GetMixinClass(name.AddressOf(), ns);
+
+ if (objType || mixin)
+ break;
+
+ ns = engine->GetParentNameSpace(ns);
+ }
+
+ if (objType == 0 && mixin == 0)
+ {
+ asCString str;
+ if (origNs->name == "")
+ str.Format(TXT_IDENTIFIER_s_NOT_DATA_TYPE_IN_GLOBAL_NS, name.AddressOf());
+ else
+ str.Format(TXT_IDENTIFIER_s_NOT_DATA_TYPE_IN_NS_s, name.AddressOf(), origNs->name.AddressOf());
+ WriteError(str, file, node);
+ }
+ else if (mixin)
+ {
+ AddInterfaceFromMixinToClass(decl, node, mixin);
+ }
+ else if (!(objType->flags & asOBJ_SCRIPT_OBJECT) ||
+ (objType->flags & asOBJ_NOINHERIT))
+ {
+ // Either the class is not a script class or interface
+ // or the class has been declared as 'final'
+ asCString str;
+ str.Format(TXT_CANNOT_INHERIT_FROM_s_FINAL, objType->name.AddressOf());
+ WriteError(str, file, node);
+ }
+ else if (objType->size != 0)
+ {
+ // The class inherits from another script class
+ if (!decl->isExistingShared && CastToObjectType(decl->typeInfo)->derivedFrom != 0)
+ {
+ if (!multipleInheritance)
+ {
+ WriteError(TXT_CANNOT_INHERIT_FROM_MULTIPLE_CLASSES, file, node);
+ multipleInheritance = true;
+ }
+ }
+ else
+ {
+ // Make sure none of the base classes inherit from this one
+ asCObjectType *base = objType;
+ bool error = false;
+ while (base != 0)
+ {
+ if (base == decl->typeInfo)
+ {
+ WriteError(TXT_CANNOT_INHERIT_FROM_SELF, file, node);
+ error = true;
+ break;
+ }
+
+ base = base->derivedFrom;
+ }
+
+ if (!error)
+ {
+ // A shared type may only inherit from other shared types
+ if ((decl->typeInfo->IsShared()) && !(objType->IsShared()))
+ {
+ asCString msg;
+ msg.Format(TXT_SHARED_CANNOT_INHERIT_FROM_NON_SHARED_s, objType->name.AddressOf());
+ WriteError(msg, file, node);
+ error = true;
+ }
+ }
+
+ if (!error)
+ {
+ if (decl->isExistingShared)
+ {
+ // Verify that the base class is the same as the original shared type
+ if (CastToObjectType(decl->typeInfo)->derivedFrom != objType)
+ {
+ asCString str;
+ str.Format(TXT_SHARED_s_DOESNT_MATCH_ORIGINAL, decl->typeInfo->GetName());
+ WriteError(str, file, node);
+ }
+ }
+ else
+ {
+ // Set the base class
+ CastToObjectType(decl->typeInfo)->derivedFrom = objType;
+ objType->AddRefInternal();
+ }
+ }
+ }
+ }
+ else
+ {
+ // The class implements an interface
+ AddInterfaceToClass(decl, node, objType);
+ }
+
+ node = node->next;
+ }
+ }
+}
+
+// numTempl is the number of template instances that existed in the engine before the build begun
+void asCBuilder::CompileClasses(asUINT numTempl)
+{
+ asUINT n;
+ asCArray<sClassDeclaration*> toValidate((int)classDeclarations.GetLength());
+
+ // Order class declarations so that base classes are compiled before derived classes.
+ // This will allow the derived classes to copy properties and methods in the next step.
+ for( n = 0; n < classDeclarations.GetLength(); n++ )
+ {
+ sClassDeclaration *decl = classDeclarations[n];
+ asCObjectType *derived = CastToObjectType(decl->typeInfo);
+ asCObjectType *base = derived->derivedFrom;
+
+ if( base == 0 ) continue;
+
+ // If the base class is found after the derived class, then move the derived class to the end of the list
+ for( asUINT m = n+1; m < classDeclarations.GetLength(); m++ )
+ {
+ sClassDeclaration *declBase = classDeclarations[m];
+ if( base == declBase->typeInfo )
+ {
+ classDeclarations.RemoveIndex(n);
+ classDeclarations.PushLast(decl);
+
+ // Decrease index so that we don't skip an entry
+ n--;
+ break;
+ }
+ }
+ }
+
+ // Go through each of the classes and register the object type descriptions
+ for( n = 0; n < classDeclarations.GetLength(); n++ )
+ {
+ sClassDeclaration *decl = classDeclarations[n];
+ asCObjectType *ot = CastToObjectType(decl->typeInfo);
+ if( decl->isExistingShared )
+ {
+ // Set the declaration as validated already, so that other
+ // types that contain this will accept this type
+ decl->validState = 1;
+
+ // We'll still validate the declaration to make sure nothing new is
+ // added to the shared class that wasn't there in the previous
+ // compilation. We do not care if something that is there in the previous
+ // declaration is not included in the new declaration though.
+
+ asASSERT( ot->interfaces.GetLength() == ot->interfaceVFTOffsets.GetLength() );
+ }
+
+ // Methods included from mixin classes should take precedence over inherited methods
+ IncludeMethodsFromMixins(decl);
+
+ // Add all properties and methods from the base class
+ if( !decl->isExistingShared && ot->derivedFrom )
+ {
+ asCObjectType *baseType = ot->derivedFrom;
+
+ // The derived class inherits all interfaces from the base class
+ for( unsigned int m = 0; m < baseType->interfaces.GetLength(); m++ )
+ {
+ if( !ot->Implements(baseType->interfaces[m]) )
+ ot->interfaces.PushLast(baseType->interfaces[m]);
+ }
+
+ // TODO: Need to check for name conflict with new class methods
+
+ // Copy properties from base class to derived class
+ for( asUINT p = 0; p < baseType->properties.GetLength(); p++ )
+ {
+ asCObjectProperty *prop = AddPropertyToClass(decl, baseType->properties[p]->name, baseType->properties[p]->type, baseType->properties[p]->isPrivate, baseType->properties[p]->isProtected, true);
+
+ // The properties must maintain the same offset
+ asASSERT(prop && prop->byteOffset == baseType->properties[p]->byteOffset); UNUSED_VAR(prop);
+ }
+
+ // Copy methods from base class to derived class
+ for( asUINT m = 0; m < baseType->methods.GetLength(); m++ )
+ {
+ // If the derived class implements the same method, then don't add the base class' method
+ asCScriptFunction *baseFunc = GetFunctionDescription(baseType->methods[m]);
+ asCScriptFunction *derivedFunc = 0;
+ bool found = false;
+ for( asUINT d = 0; d < ot->methods.GetLength(); d++ )
+ {
+ derivedFunc = GetFunctionDescription(ot->methods[d]);
+ if( baseFunc->name == "opConv" || baseFunc->name == "opImplConv" ||
+ baseFunc->name == "opCast" || baseFunc->name == "opImplCast" )
+ {
+ // For the opConv and opCast methods, the return type can differ if they are different methods
+ if( derivedFunc->name == baseFunc->name &&
+ derivedFunc->IsSignatureExceptNameEqual(baseFunc) )
+ {
+ if( baseFunc->IsFinal() )
+ {
+ asCString msg;
+ msg.Format(TXT_METHOD_CANNOT_OVERRIDE_s, baseFunc->GetDeclaration());
+ WriteError(msg, decl->script, decl->node);
+ }
+
+ // Move the function from the methods array to the virtualFunctionTable
+ ot->methods.RemoveIndex(d);
+ ot->virtualFunctionTable.PushLast(derivedFunc);
+ found = true;
+ break;
+ }
+ }
+ else
+ {
+ if( derivedFunc->name == baseFunc->name &&
+ derivedFunc->IsSignatureExceptNameAndReturnTypeEqual(baseFunc) )
+ {
+ if( baseFunc->returnType != derivedFunc->returnType )
+ {
+ asCString msg;
+ msg.Format(TXT_DERIVED_METHOD_MUST_HAVE_SAME_RETTYPE_s, baseFunc->GetDeclaration());
+ WriteError(msg, decl->script, decl->node);
+ }
+
+ if( baseFunc->IsFinal() )
+ {
+ asCString msg;
+ msg.Format(TXT_METHOD_CANNOT_OVERRIDE_s, baseFunc->GetDeclaration());
+ WriteError(msg, decl->script, decl->node);
+ }
+
+ // Move the function from the methods array to the virtualFunctionTable
+ ot->methods.RemoveIndex(d);
+ ot->virtualFunctionTable.PushLast(derivedFunc);
+ found = true;
+ break;
+ }
+ }
+ }
+
+ if( !found )
+ {
+ // Push the base class function on the virtual function table
+ ot->virtualFunctionTable.PushLast(baseType->virtualFunctionTable[m]);
+ baseType->virtualFunctionTable[m]->AddRefInternal();
+
+ CheckForConflictsDueToDefaultArgs(decl->script, decl->node, baseType->virtualFunctionTable[m], ot);
+ }
+
+ ot->methods.PushLast(baseType->methods[m]);
+ engine->scriptFunctions[baseType->methods[m]]->AddRefInternal();
+ }
+ }
+
+ if( !decl->isExistingShared )
+ {
+ // Move this class' methods into the virtual function table
+ for( asUINT m = 0; m < ot->methods.GetLength(); m++ )
+ {
+ asCScriptFunction *func = GetFunctionDescription(ot->methods[m]);
+ if( func->funcType != asFUNC_VIRTUAL )
+ {
+ // Move the reference from the method list to the virtual function list
+ ot->methods.RemoveIndex(m);
+ ot->virtualFunctionTable.PushLast(func);
+
+ // Substitute the function description in the method list for a virtual method
+ // Make sure the methods are in the same order as the virtual function table
+ ot->methods.PushLast(CreateVirtualFunction(func, (int)ot->virtualFunctionTable.GetLength() - 1));
+ m--;
+ }
+ }
+
+ // Make virtual function table chunks for each implemented interface
+ for( asUINT m = 0; m < ot->interfaces.GetLength(); m++ )
+ {
+ asCObjectType *intf = ot->interfaces[m];
+
+ // Add all the interface's functions to the virtual function table
+ asUINT offset = asUINT(ot->virtualFunctionTable.GetLength());
+ ot->interfaceVFTOffsets.PushLast(offset);
+
+ for( asUINT j = 0; j < intf->methods.GetLength(); j++ )
+ {
+ asCScriptFunction *intfFunc = GetFunctionDescription(intf->methods[j]);
+
+ // Only create the table for functions that are explicitly from this interface,
+ // inherited interface methods will be put in that interface's table.
+ if( intfFunc->objectType != intf )
+ continue;
+
+ asASSERT((asUINT)intfFunc->vfTableIdx == j);
+
+ //Find the interface function in the list of methods
+ asCScriptFunction *realFunc = 0;
+ for( asUINT p = 0; p < ot->methods.GetLength(); p++ )
+ {
+ asCScriptFunction *func = GetFunctionDescription(ot->methods[p]);
+
+ if( func->signatureId == intfFunc->signatureId )
+ {
+ if( func->funcType == asFUNC_VIRTUAL )
+ {
+ realFunc = ot->virtualFunctionTable[func->vfTableIdx];
+ }
+ else
+ {
+ // This should not happen, all methods were moved into the virtual table
+ asASSERT(false);
+ }
+ break;
+ }
+ }
+
+ // If realFunc is still null, the interface was not
+ // implemented and we error out later in the checks.
+ ot->virtualFunctionTable.PushLast(realFunc);
+ if( realFunc )
+ realFunc->AddRefInternal();
+ }
+ }
+ }
+
+ // Enumerate each of the declared properties
+ asCScriptNode *node = decl->node->firstChild->next;
+
+ // Skip list of classes and interfaces
+ while( node && node->nodeType == snIdentifier )
+ node = node->next;
+
+ while( node && node->nodeType == snDeclaration )
+ {
+ asCScriptNode *nd = node->firstChild;
+
+ // Is the property declared as private or protected?
+ bool isPrivate = false, isProtected = false;
+ if( nd && nd->tokenType == ttPrivate )
+ {
+ isPrivate = true;
+ nd = nd->next;
+ }
+ else if( nd && nd->tokenType == ttProtected )
+ {
+ isProtected = true;
+ nd = nd->next;
+ }
+
+ // Determine the type of the property
+ asCScriptCode *file = decl->script;
+ asCDataType dt = CreateDataTypeFromNode(nd, file, ot->nameSpace, false, ot);
+ if( ot->IsShared() && dt.GetTypeInfo() && !dt.GetTypeInfo()->IsShared() )
+ {
+ asCString msg;
+ msg.Format(TXT_SHARED_CANNOT_USE_NON_SHARED_TYPE_s, dt.GetTypeInfo()->name.AddressOf());
+ WriteError(msg, file, node);
+ }
+
+ if( dt.IsReadOnly() )
+ WriteError(TXT_PROPERTY_CANT_BE_CONST, file, node);
+
+ // Multiple properties can be declared separated by ,
+ nd = nd->next;
+ while( nd )
+ {
+ asCString name(&file->code[nd->tokenPos], nd->tokenLength);
+
+ if( !decl->isExistingShared )
+ {
+ CheckNameConflictMember(ot, name.AddressOf(), nd, file, true, false);
+ AddPropertyToClass(decl, name, dt, isPrivate, isProtected, false, file, nd);
+ }
+ else
+ {
+ // Verify that the property exists in the original declaration
+ bool found = false;
+ for( asUINT p = 0; p < ot->properties.GetLength(); p++ )
+ {
+ asCObjectProperty *prop = ot->properties[p];
+ if( prop->isPrivate == isPrivate &&
+ prop->isProtected == isProtected &&
+ prop->name == name &&
+ prop->type.IsEqualExceptRef(dt) )
+ {
+ found = true;
+ break;
+ }
+ }
+ if( !found )
+ {
+ asCString str;
+ str.Format(TXT_SHARED_s_DOESNT_MATCH_ORIGINAL, ot->GetName());
+ WriteError(str, file, nd);
+ }
+ }
+
+ // Skip the initialization node
+ if( nd->next && nd->next->nodeType != snIdentifier )
+ nd = nd->next;
+
+ nd = nd->next;
+ }
+
+ node = node->next;
+ }
+
+ // Add properties from included mixin classes that don't conflict with existing properties
+ IncludePropertiesFromMixins(decl);
+
+ if( !decl->isExistingShared )
+ toValidate.PushLast(decl);
+
+ asASSERT( ot->interfaces.GetLength() == ot->interfaceVFTOffsets.GetLength() );
+ }
+
+ // TODO: Warn if a method overrides a base method without marking it as 'override'.
+ // It must be possible to turn off this warning through engine property.
+
+ // TODO: A base class should be able to mark a method as 'abstract'. This will
+ // allow a base class to provide a partial implementation, but still force
+ // derived classes to implement specific methods.
+
+ // Verify that all interface methods are implemented in the classes
+ // We do this here so the base class' methods have already been inherited
+ for( n = 0; n < classDeclarations.GetLength(); n++ )
+ {
+ sClassDeclaration *decl = classDeclarations[n];
+ if( decl->isExistingShared ) continue;
+
+ asCObjectType *ot = CastToObjectType(decl->typeInfo);
+ asCArray<bool> overrideValidations(ot->GetMethodCount());
+ for( asUINT k = 0; k < ot->methods.GetLength(); k++ )
+ overrideValidations.PushLast( !static_cast<asCScriptFunction*>(ot->GetMethodByIndex(k, false))->IsOverride() );
+
+ for( asUINT m = 0; m < ot->interfaces.GetLength(); m++ )
+ {
+ asCObjectType *objType = ot->interfaces[m];
+ for( asUINT i = 0; i < objType->methods.GetLength(); i++ )
+ {
+ // Only check the interface methods that was explicitly declared in this interface
+ // Methods that was inherited from other interfaces will be checked in those interfaces
+ if( objType != engine->scriptFunctions[objType->methods[i]]->objectType )
+ continue;
+
+ asUINT overrideIndex;
+ if( !DoesMethodExist(ot, objType->methods[i], &overrideIndex) )
+ {
+ asCString str;
+ str.Format(TXT_MISSING_IMPLEMENTATION_OF_s,
+ engine->GetFunctionDeclaration(objType->methods[i]).AddressOf());
+ WriteError(str, decl->script, decl->node);
+ }
+ else
+ overrideValidations[overrideIndex] = true;
+ }
+ }
+
+ bool hasBaseClass = ot->derivedFrom != 0;
+
+ for( asUINT j = 0; j < overrideValidations.GetLength(); j++ )
+ {
+ if( !overrideValidations[j] && (!hasBaseClass || !DoesMethodExist(ot->derivedFrom, ot->methods[j])) )
+ {
+ asCString msg;
+ msg.Format(TXT_METHOD_s_DOES_NOT_OVERRIDE, ot->GetMethodByIndex(j, false)->GetDeclaration());
+ WriteError(msg, decl->script, decl->node);
+ }
+ }
+ }
+
+ // Verify that the declared structures are valid, e.g. that the structure
+ // doesn't contain a member of its own type directly or indirectly
+ while( toValidate.GetLength() > 0 )
+ {
+ asUINT numClasses = (asUINT)toValidate.GetLength();
+
+ asCArray<sClassDeclaration*> toValidateNext((int)toValidate.GetLength());
+ while( toValidate.GetLength() > 0 )
+ {
+ sClassDeclaration *decl = toValidate[toValidate.GetLength()-1];
+ asCObjectType *ot = CastToObjectType(decl->typeInfo);
+ int validState = 1;
+ for( n = 0; n < ot->properties.GetLength(); n++ )
+ {
+ // A valid structure is one that uses only primitives or other valid objects
+ asCObjectProperty *prop = ot->properties[n];
+ asCDataType dt = prop->type;
+
+ // TODO: Add this check again, once solving the issues commented below
+ /*
+ if( dt.IsTemplate() )
+ {
+ // TODO: This must verify all sub types, not just the first one
+ // TODO: Just because the subtype is not a handle doesn't mean the template will actually instance the object
+ // this it shouldn't automatically raise an error for this, e.g. weakref<Object> should be legal as member
+ // of the Object class
+ asCDataType sub = dt;
+ while( sub.IsTemplate() && !sub.IsObjectHandle() )
+ sub = sub.GetSubType();
+
+ dt = sub;
+ }
+ */
+
+ if( dt.IsObject() && !dt.IsObjectHandle() )
+ {
+ // Find the class declaration
+ sClassDeclaration *pdecl = 0;
+ for( asUINT p = 0; p < classDeclarations.GetLength(); p++ )
+ {
+ if( classDeclarations[p]->typeInfo == dt.GetTypeInfo() )
+ {
+ pdecl = classDeclarations[p];
+ break;
+ }
+ }
+
+ if( pdecl )
+ {
+ if( pdecl->typeInfo == decl->typeInfo )
+ {
+ WriteError(TXT_ILLEGAL_MEMBER_TYPE, decl->script, decl->node);
+ validState = 2;
+ break;
+ }
+ else if( pdecl->validState != 1 )
+ {
+ validState = pdecl->validState;
+ break;
+ }
+ }
+ }
+ }
+
+ if( validState == 1 )
+ {
+ decl->validState = 1;
+ toValidate.PopLast();
+ }
+ else if( validState == 2 )
+ {
+ decl->validState = 2;
+ toValidate.PopLast();
+ }
+ else
+ {
+ toValidateNext.PushLast(toValidate.PopLast());
+ }
+ }
+
+ toValidate = toValidateNext;
+ toValidateNext.SetLength(0);
+
+ if( numClasses == toValidate.GetLength() )
+ {
+ WriteError(TXT_ILLEGAL_MEMBER_TYPE, toValidate[0]->script, toValidate[0]->node);
+ break;
+ }
+ }
+
+ if( numErrors > 0 ) return;
+
+ // Verify which script classes can really form circular references, and mark only those as garbage collected.
+ // This must be done in the correct order, so that a class that contains another class isn't needlessly marked
+ // as garbage collected, just because the contained class was evaluated afterwards.
+
+ // TODO: runtime optimize: This algorithm can be further improved by checking the types that inherits from
+ // a base class. If the base class is not shared all the classes that derive from it
+ // are known at compile time, and can thus be checked for potential circular references too.
+ //
+ // Observe, that doing this would conflict with another potential future feature, which is to
+ // allow incremental builds, i.e. allow application to add or replace classes in an
+ // existing module. However, the applications that want to use that should use a special
+ // build flag to not finalize the module.
+
+ asCArray<asCObjectType*> typesToValidate;
+ for( n = 0; n < classDeclarations.GetLength(); n++ )
+ {
+ // Existing shared classes won't need evaluating, nor interfaces
+ sClassDeclaration *decl = classDeclarations[n];
+ if( decl->isExistingShared ) continue;
+
+ asCObjectType *ot = CastToObjectType(decl->typeInfo);
+ if( ot->IsInterface() ) continue;
+
+ typesToValidate.PushLast(ot);
+ }
+
+ asUINT numReevaluations = 0;
+ while( typesToValidate.GetLength() )
+ {
+ if( numReevaluations > typesToValidate.GetLength() )
+ {
+ // No types could be completely evaluated in the last iteration so
+ // we consider the remaining types in the array as garbage collected
+ break;
+ }
+
+ asCObjectType *type = typesToValidate[0];
+ typesToValidate.RemoveIndex(0);
+
+ // If the type inherits from another type that is yet to be validated, then reinsert it at the end
+ if( type->derivedFrom && typesToValidate.Exists(type->derivedFrom) )
+ {
+ typesToValidate.PushLast(type);
+ numReevaluations++;
+ continue;
+ }
+
+ // If the type inherits from a known garbage collected type, then this type must also be garbage collected
+ if( type->derivedFrom && (type->derivedFrom->flags & asOBJ_GC) )
+ {
+ type->flags |= asOBJ_GC;
+ continue;
+ }
+
+ // Evaluate template instances (silently) before verifying each of the classes, since it is possible that
+ // a class will be marked as non-garbage collected, which in turn will mark the template instance that uses
+ // it as non-garbage collected, which in turn means the class that contains the array also do not have to be
+ // garbage collected
+ EvaluateTemplateInstances(numTempl, true);
+
+ // Is there some path in which this structure is involved in circular references?
+ // If the type contains a member of a type that is yet to be validated, then reinsert it at the end
+ bool mustReevaluate = false;
+ bool gc = false;
+ for( asUINT p = 0; p < type->properties.GetLength(); p++ )
+ {
+ asCDataType dt = type->properties[p]->type;
+
+ if (dt.IsFuncdef())
+ {
+ // If a class holds a function pointer as member then the class must be garbage collected as the
+ // function pointer can form circular references with the class through use of a delegate. Example:
+ //
+ // class A { B @b; void f(); }
+ // class B { F @f; }
+ // funcdef void F();
+ //
+ // A a;
+ // @a.b = B(); // instance of A refers to instance of B
+ // @a.b.f = F(a.f); // instance of B refers to delegate that refers to instance of A
+ //
+ gc = true;
+ break;
+ }
+
+ if( !dt.IsObject() )
+ continue;
+
+ if( typesToValidate.Exists(CastToObjectType(dt.GetTypeInfo())) )
+ mustReevaluate = true;
+ else
+ {
+ if( dt.IsTemplate() )
+ {
+ // Check if any of the subtypes are yet to be evaluated
+ bool skip = false;
+ for( asUINT s = 0; s < dt.GetTypeInfo()->GetSubTypeCount(); s++ )
+ {
+ asCObjectType *t = reinterpret_cast<asCObjectType*>(dt.GetTypeInfo()->GetSubType(s));
+ if( typesToValidate.Exists(t) )
+ {
+ mustReevaluate = true;
+ skip = true;
+ break;
+ }
+ }
+ if( skip )
+ continue;
+ }
+
+ if( dt.IsObjectHandle() )
+ {
+ // If it is known that the handle can't be involved in a circular reference
+ // then this object doesn't need to be marked as garbage collected.
+ asCObjectType *prop = CastToObjectType(dt.GetTypeInfo());
+
+ if( prop->flags & asOBJ_SCRIPT_OBJECT )
+ {
+ // For script objects, treat non-final classes as if they can contain references
+ // as it is not known what derived classes might do. For final types, check all
+ // properties to determine if any of those can cause a circular reference with this
+ // class.
+ if( prop->flags & asOBJ_NOINHERIT )
+ {
+ for( asUINT sp = 0; sp < prop->properties.GetLength(); sp++ )
+ {
+ asCDataType sdt = prop->properties[sp]->type;
+
+ if( sdt.IsObject() )
+ {
+ if( sdt.IsObjectHandle() )
+ {
+ // TODO: runtime optimize: If the handle is again to a final class, then we can recursively check if the circular reference can occur
+ if( sdt.GetTypeInfo()->flags & (asOBJ_SCRIPT_OBJECT | asOBJ_GC) )
+ {
+ gc = true;
+ break;
+ }
+ }
+ else if( sdt.GetTypeInfo()->flags & asOBJ_GC )
+ {
+ // TODO: runtime optimize: Just because the member type is a potential circle doesn't mean that this one is.
+ // Only if the object is of a type that can reference this type, either directly or indirectly
+ gc = true;
+ break;
+ }
+ }
+ }
+
+ if( gc )
+ break;
+ }
+ else
+ {
+ // Assume it is garbage collected as it is not known at compile time what might inherit from this type
+ gc = true;
+ break;
+ }
+ }
+ else if( prop->flags & asOBJ_GC )
+ {
+ // If a type is not a script object, adopt its GC flag
+ // TODO: runtime optimize: Just because an application registered class is garbage collected, doesn't mean it
+ // can form a circular reference with this script class. Perhaps need a flag to tell
+ // if the script classes that contains the type should be garbage collected or not.
+ gc = true;
+ break;
+ }
+ }
+ else if( dt.GetTypeInfo()->flags & asOBJ_GC )
+ {
+ // TODO: runtime optimize: Just because the member type is a potential circle doesn't mean that this one is.
+ // Only if the object is of a type that can reference this type, either directly or indirectly
+ gc = true;
+ break;
+ }
+ }
+ }
+
+ // If the class wasn't found to require garbage collection, but it
+ // contains another type that has yet to be evaluated then it must be
+ // re-evaluated.
+ if( !gc && mustReevaluate )
+ {
+ typesToValidate.PushLast(type);
+ numReevaluations++;
+ continue;
+ }
+
+ // Update the flag in the object type
+ if( gc )
+ type->flags |= asOBJ_GC;
+ else
+ type->flags &= ~asOBJ_GC;
+
+ // Reset the counter
+ numReevaluations = 0;
+ }
+}
+
+void asCBuilder::IncludeMethodsFromMixins(sClassDeclaration *decl)
+{
+ asCScriptNode *node = decl->node->firstChild;
+
+ // Skip the class attributes
+ while( node->nodeType == snIdentifier &&
+ !decl->script->TokenEquals(node->tokenPos, node->tokenLength, decl->name.AddressOf()) )
+ node = node->next;
+
+ // Skip the name of the class
+ node = node->next;
+
+ // Find the included mixin classes
+ while( node && node->nodeType == snIdentifier )
+ {
+ asSNameSpace *ns;
+ asCString name;
+ if( GetNamespaceAndNameFromNode(node, decl->script, decl->typeInfo->nameSpace, ns, name) < 0 )
+ {
+ node = node->next;
+ continue;
+ }
+
+ sMixinClass *mixin = 0;
+ while( ns )
+ {
+ // Need to make sure the name is not an object type
+ asCObjectType *objType = GetObjectType(name.AddressOf(), ns);
+ if( objType == 0 )
+ mixin = GetMixinClass(name.AddressOf(), ns);
+
+ if( objType || mixin )
+ break;
+
+ ns = engine->GetParentNameSpace(ns);
+ }
+
+ if( mixin )
+ {
+ // Find methods from mixin declaration
+ asCScriptNode *n = mixin->node->firstChild;
+
+ // Skip to the member declarations
+ // Possible keywords 'final' and 'shared' are removed in RegisterMixinClass so we don't need to worry about those here
+ while( n && n->nodeType == snIdentifier )
+ n = n->next;
+
+ // Add methods from the mixin that are not already existing in the class
+ while( n )
+ {
+ if( n->nodeType == snFunction )
+ {
+ // Instead of disconnecting the node, we need to clone it, otherwise other
+ // classes that include the same mixin will not see the methods
+ asCScriptNode *copy = n->CreateCopy(engine);
+
+ // Register the method, but only if it doesn't already exist in the class
+ RegisterScriptFunctionFromNode(copy, mixin->script, CastToObjectType(decl->typeInfo), false, false, mixin->ns, false, true);
+ }
+ else if( n->nodeType == snVirtualProperty )
+ {
+ // TODO: mixin: Support virtual properties too
+ WriteError("The virtual property syntax is currently not supported for mixin classes", mixin->script, n);
+ //RegisterVirtualProperty(node, decl->script, decl->objType, false, false);
+ }
+
+ n = n->next;
+ }
+ }
+
+ node = node->next;
+ }
+}
+
+void asCBuilder::IncludePropertiesFromMixins(sClassDeclaration *decl)
+{
+ asCScriptNode *node = decl->node->firstChild;
+
+ // Skip the class attributes
+ while( node->nodeType == snIdentifier &&
+ !decl->script->TokenEquals(node->tokenPos, node->tokenLength, decl->name.AddressOf()) )
+ node = node->next;
+
+ // Skip the name of the class
+ node = node->next;
+
+ // Find the included mixin classes
+ while( node && node->nodeType == snIdentifier )
+ {
+ asSNameSpace *ns;
+ asCString name;
+ if( GetNamespaceAndNameFromNode(node, decl->script, decl->typeInfo->nameSpace, ns, name) < 0 )
+ {
+ node = node->next;
+ continue;
+ }
+
+ sMixinClass *mixin = 0;
+ while( ns )
+ {
+ // Need to make sure the name is not an object type
+ asCObjectType *objType = GetObjectType(name.AddressOf(), ns);
+ if( objType == 0 )
+ mixin = GetMixinClass(name.AddressOf(), ns);
+
+ if( objType || mixin )
+ break;
+
+ ns = engine->GetParentNameSpace(ns);
+ }
+
+ if( mixin )
+ {
+ // Find properties from mixin declaration
+ asCScriptNode *n = mixin->node->firstChild;
+
+ // Skip to the member declarations
+ // Possible keywords 'final' and 'shared' are removed in RegisterMixinClass so we don't need to worry about those here
+ while( n && n->nodeType == snIdentifier )
+ n = n->next;
+
+ // Add properties from the mixin that are not already existing in the class
+ while( n )
+ {
+ if( n->nodeType == snDeclaration )
+ {
+ asCScriptNode *n2 = n->firstChild;
+ bool isPrivate = false, isProtected = false;
+ if( n2 && n2->tokenType == ttPrivate )
+ {
+ isPrivate = true;
+ n2 = n2->next;
+ }
+ else if( n2 && n2->tokenType == ttProtected )
+ {
+ isProtected = true;
+ n2 = n2->next;
+ }
+
+ asCScriptCode *file = mixin->script;
+ asCDataType dt = CreateDataTypeFromNode(n2, file, mixin->ns);
+
+ if( decl->typeInfo->IsShared() && dt.GetTypeInfo() && !dt.GetTypeInfo()->IsShared() )
+ {
+ asCString msg;
+ msg.Format(TXT_SHARED_CANNOT_USE_NON_SHARED_TYPE_s, dt.GetTypeInfo()->name.AddressOf());
+ WriteError(msg, file, n);
+ WriteInfo(TXT_WHILE_INCLUDING_MIXIN, decl->script, node);
+ }
+
+ if( dt.IsReadOnly() )
+ WriteError(TXT_PROPERTY_CANT_BE_CONST, file, n);
+
+ n2 = n2->next;
+ while( n2 )
+ {
+ name.Assign(&file->code[n2->tokenPos], n2->tokenLength);
+
+ // Add the property only if it doesn't already exist in the class
+ bool exists = false;
+ asCObjectType *ot = CastToObjectType(decl->typeInfo);
+ for( asUINT p = 0; p < ot->properties.GetLength(); p++ )
+ if( ot->properties[p]->name == name )
+ {
+ exists = true;
+ break;
+ }
+
+ if( !exists )
+ {
+ if( !decl->isExistingShared )
+ {
+ // It must not conflict with the name of methods
+ int r = CheckNameConflictMember(ot, name.AddressOf(), n2, file, true, false);
+ if( r < 0 )
+ WriteInfo(TXT_WHILE_INCLUDING_MIXIN, decl->script, node);
+
+ AddPropertyToClass(decl, name, dt, isPrivate, isProtected, false, file, n2);
+ }
+ else
+ {
+ // Verify that the property exists in the original declaration
+ bool found = false;
+ for( asUINT p = 0; p < ot->properties.GetLength(); p++ )
+ {
+ asCObjectProperty *prop = ot->properties[p];
+ if( prop->isPrivate == isPrivate &&
+ prop->isProtected == isProtected &&
+ prop->name == name &&
+ prop->type == dt )
+ {
+ found = true;
+ break;
+ }
+ }
+ if( !found )
+ {
+ asCString str;
+ str.Format(TXT_SHARED_s_DOESNT_MATCH_ORIGINAL, ot->GetName());
+ WriteError(str, decl->script, decl->node);
+ WriteInfo(TXT_WHILE_INCLUDING_MIXIN, decl->script, node);
+ }
+ }
+ }
+
+ // Skip the initialization expression
+ if( n2->next && n2->next->nodeType != snIdentifier )
+ n2 = n2->next;
+
+ n2 = n2->next;
+ }
+ }
+
+ n = n->next;
+ }
+ }
+
+ node = node->next;
+ }
+}
+
+int asCBuilder::CreateVirtualFunction(asCScriptFunction *func, int idx)
+{
+ asCScriptFunction *vf = asNEW(asCScriptFunction)(engine, module, asFUNC_VIRTUAL);
+ if( vf == 0 )
+ return asOUT_OF_MEMORY;
+
+ vf->name = func->name;
+ vf->nameSpace = func->nameSpace;
+ vf->returnType = func->returnType;
+ vf->parameterTypes = func->parameterTypes;
+ vf->inOutFlags = func->inOutFlags;
+ vf->id = engine->GetNextScriptFunctionId();
+ vf->objectType = func->objectType;
+ vf->objectType->AddRefInternal();
+ vf->signatureId = func->signatureId;
+ vf->vfTableIdx = idx;
+ vf->traits = func->traits;
+
+ // Clear the shared trait since the virtual function should not have that
+ vf->SetShared(false);
+
+ // It is not necessary to copy the default args, as they have no meaning in the virtual function
+
+ module->AddScriptFunction(vf);
+
+ // Add a dummy to the builder so that it doesn't mix up function ids
+ functions.PushLast(0);
+
+ return vf->id;
+}
+
+asCObjectProperty *asCBuilder::AddPropertyToClass(sClassDeclaration *decl, const asCString &name, const asCDataType &dt, bool isPrivate, bool isProtected, bool isInherited, asCScriptCode *file, asCScriptNode *node)
+{
+ if( node )
+ {
+ asASSERT(!isInherited);
+
+ // Check if the property is allowed
+ if( !dt.CanBeInstantiated() )
+ {
+ if( file && node )
+ {
+ asCString str;
+ if( dt.IsAbstractClass() )
+ str.Format(TXT_ABSTRACT_CLASS_s_CANNOT_BE_INSTANTIATED, dt.Format(decl->typeInfo->nameSpace).AddressOf());
+ else if( dt.IsInterface() )
+ str.Format(TXT_INTERFACE_s_CANNOT_BE_INSTANTIATED, dt.Format(decl->typeInfo->nameSpace).AddressOf());
+ else
+ // TODO: Improve error message to explain why
+ str.Format(TXT_DATA_TYPE_CANT_BE_s, dt.Format(decl->typeInfo->nameSpace).AddressOf());
+ WriteError(str, file, node);
+ }
+ return 0;
+ }
+
+ // Register the initialization expression (if any) to be compiled later
+ asCScriptNode *declNode = node;
+ asCScriptNode *initNode = 0;
+ if( node->next && node->next->nodeType != snIdentifier )
+ {
+ asASSERT( node->next->nodeType == snAssignment );
+ initNode = node->next;
+ }
+
+ sPropertyInitializer p(name, declNode, initNode, file);
+ decl->propInits.PushLast(p);
+ }
+ else
+ {
+ // If the declaration node is not given, then
+ // this property is inherited from a base class
+ asASSERT(isInherited);
+ }
+
+ // Add the property to the object type
+ return CastToObjectType(decl->typeInfo)->AddPropertyToClass(name, dt, isPrivate, isProtected, isInherited);
+}
+
+bool asCBuilder::DoesMethodExist(asCObjectType *objType, int methodId, asUINT *methodIndex)
+{
+ asCScriptFunction *method = GetFunctionDescription(methodId);
+
+ for( asUINT n = 0; n < objType->methods.GetLength(); n++ )
+ {
+ asCScriptFunction *m = GetFunctionDescription(objType->methods[n]);
+
+ if( m->name != method->name ) continue;
+ if( m->returnType != method->returnType ) continue;
+ if( m->IsReadOnly() != method->IsReadOnly() ) continue;
+ if( m->parameterTypes != method->parameterTypes ) continue;
+ if( m->inOutFlags != method->inOutFlags ) continue;
+
+ if( methodIndex )
+ *methodIndex = n;
+
+ return true;
+ }
+
+ return false;
+}
+
+void asCBuilder::AddDefaultConstructor(asCObjectType *objType, asCScriptCode *file)
+{
+ int funcId = engine->GetNextScriptFunctionId();
+
+ asCDataType returnType = asCDataType::CreatePrimitive(ttVoid, false);
+ asCArray<asCDataType> parameterTypes;
+ asCArray<asETypeModifiers> inOutFlags;
+ asCArray<asCString *> defaultArgs;
+ asCArray<asCString> parameterNames;
+
+ // Add the script function
+ // TODO: declaredAt should be set to where the class has been declared
+ module->AddScriptFunction(file->idx, 0, funcId, objType->name, returnType, parameterTypes, parameterNames, inOutFlags, defaultArgs, false, objType, false, asSFunctionTraits(), objType->nameSpace);
+
+ // Set it as default constructor
+ if( objType->beh.construct )
+ engine->scriptFunctions[objType->beh.construct]->ReleaseInternal();
+ objType->beh.construct = funcId;
+ objType->beh.constructors[0] = funcId;
+ engine->scriptFunctions[funcId]->AddRefInternal();
+
+ // The bytecode for the default constructor will be generated
+ // only after the potential inheritance has been established
+ sFunctionDescription *func = asNEW(sFunctionDescription);
+ if( func == 0 )
+ {
+ // Out of memory
+ return;
+ }
+
+ functions.PushLast(func);
+
+ func->script = file;
+ func->node = 0;
+ func->name = objType->name;
+ func->objType = objType;
+ func->funcId = funcId;
+ func->isExistingShared = false;
+
+ // Add a default factory as well
+ funcId = engine->GetNextScriptFunctionId();
+ if( objType->beh.factory )
+ engine->scriptFunctions[objType->beh.factory]->ReleaseInternal();
+ objType->beh.factory = funcId;
+ objType->beh.factories[0] = funcId;
+ returnType = asCDataType::CreateObjectHandle(objType, false);
+ // TODO: should be the same as the constructor
+ module->AddScriptFunction(file->idx, 0, funcId, objType->name, returnType, parameterTypes, parameterNames, inOutFlags, defaultArgs, false);
+ functions.PushLast(0);
+ asCCompiler compiler(engine);
+ compiler.CompileFactory(this, file, engine->scriptFunctions[funcId]);
+ engine->scriptFunctions[funcId]->AddRefInternal();
+
+ // If the object is shared, then the factory must also be marked as shared
+ if( objType->flags & asOBJ_SHARED )
+ engine->scriptFunctions[funcId]->SetShared(true);
+}
+
+int asCBuilder::RegisterEnum(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns)
+{
+ // Is it a shared enum?
+ bool isShared = false;
+ bool isExternal = false;
+ asCEnumType *existingSharedType = 0;
+ asCScriptNode *tmp = node->firstChild;
+ while( tmp->nodeType == snIdentifier )
+ {
+ if (file->TokenEquals(tmp->tokenPos, tmp->tokenLength, SHARED_TOKEN))
+ isShared = true;
+ else if (file->TokenEquals(tmp->tokenPos, tmp->tokenLength, EXTERNAL_TOKEN))
+ isExternal = true;
+ else
+ break;
+ tmp = tmp->next;
+ }
+
+ // Grab the name of the enumeration
+ asCString name;
+ asASSERT(snDataType == tmp->nodeType);
+ asASSERT(snIdentifier == tmp->firstChild->nodeType);
+ name.Assign(&file->code[tmp->firstChild->tokenPos], tmp->firstChild->tokenLength);
+
+ if( isShared )
+ {
+ // Look for a pre-existing shared enum with the same signature
+ for( asUINT n = 0; n < engine->sharedScriptTypes.GetLength(); n++ )
+ {
+ asCTypeInfo *o = engine->sharedScriptTypes[n];
+ if( o &&
+ o->IsShared() &&
+ (o->flags & asOBJ_ENUM) &&
+ o->name == name &&
+ o->nameSpace == ns )
+ {
+ existingSharedType = CastToEnumType(o);
+ break;
+ }
+ }
+ }
+
+ // If the enum was declared as external then it must have been compiled in a different module first
+ if (isExternal && existingSharedType == 0)
+ {
+ asCString str;
+ str.Format(TXT_EXTERNAL_SHARED_s_NOT_FOUND, name.AddressOf());
+ WriteError(str, file, tmp);
+ }
+
+ // Remember if the type was declared as external so the saved bytecode can be flagged accordingly
+ if (isExternal && existingSharedType)
+ module->m_externalTypes.PushLast(existingSharedType);
+
+ // Check the name and add the enum
+ int r = CheckNameConflict(name.AddressOf(), tmp->firstChild, file, ns, true, false);
+ if( asSUCCESS == r )
+ {
+ asCEnumType *st;
+
+ if( existingSharedType )
+ {
+ st = existingSharedType;
+ st->AddRefInternal();
+ }
+ else
+ {
+ st = asNEW(asCEnumType)(engine);
+ if( st == 0 )
+ return asOUT_OF_MEMORY;
+
+ st->flags = asOBJ_ENUM;
+ if( isShared )
+ st->flags |= asOBJ_SHARED;
+ st->size = 4;
+ st->name = name;
+ st->nameSpace = ns;
+ st->module = module;
+ }
+ module->AddEnumType(st);
+
+ if( !existingSharedType && isShared )
+ {
+ engine->sharedScriptTypes.PushLast(st);
+ st->AddRefInternal();
+ }
+
+ // Store the location of this declaration for reference in name collisions
+ sClassDeclaration *decl = asNEW(sClassDeclaration);
+ if( decl == 0 )
+ return asOUT_OF_MEMORY;
+
+ decl->name = name;
+ decl->script = file;
+ decl->typeInfo = st;
+ namedTypeDeclarations.PushLast(decl);
+
+ asCDataType type = CreateDataTypeFromNode(tmp, file, ns);
+ asASSERT(!type.IsReference());
+
+ // External shared enums must not redeclare the enum values
+ if (isExternal && (tmp->next == 0 || tmp->next->tokenType != ttEndStatement) )
+ {
+ asCString str;
+ str.Format(TXT_EXTERNAL_SHARED_s_CANNOT_REDEF, name.AddressOf());
+ WriteError(str, file, tmp);
+ }
+ else if (!isExternal && tmp->next && tmp->next->tokenType == ttEndStatement)
+ {
+ asCString str;
+ str.Format(TXT_MISSING_DEFINITION_OF_s, name.AddressOf());
+ WriteError(str, file, tmp);
+ }
+
+ // Register the enum values
+ tmp = tmp->next;
+ while( tmp && tmp->nodeType == snIdentifier )
+ {
+ name.Assign(&file->code[tmp->tokenPos], tmp->tokenLength);
+
+ if( existingSharedType )
+ {
+ // If this is a pre-existent shared enum, then just double check
+ // that the value is already defined in the original declaration
+ bool found = false;
+ for( asUINT n = 0; n < st->enumValues.GetLength(); n++ )
+ if( st->enumValues[n]->name == name )
+ {
+ found = true;
+ break;
+ }
+
+ if( !found )
+ {
+ asCString str;
+ str.Format(TXT_SHARED_s_DOESNT_MATCH_ORIGINAL, st->GetName());
+ WriteError(str, file, tmp);
+ break;
+ }
+
+ tmp = tmp->next;
+ if( tmp && tmp->nodeType == snAssignment )
+ tmp = tmp->next;
+ continue;
+ }
+ else
+ {
+ // Check for name conflict errors with other values in the enum
+ if( globVariables.GetFirst(ns, name, asCCompGlobVarType(type)) )
+ {
+ asCString str;
+ str.Format(TXT_NAME_CONFLICT_s_ALREADY_USED, name.AddressOf());
+ WriteError(str, file, tmp);
+
+ tmp = tmp->next;
+ if( tmp && tmp->nodeType == snAssignment )
+ tmp = tmp->next;
+ continue;
+ }
+
+ // Check for assignment
+ asCScriptNode *asnNode = tmp->next;
+ if( asnNode && snAssignment == asnNode->nodeType )
+ asnNode->DisconnectParent();
+ else
+ asnNode = 0;
+
+ // Create the global variable description so the enum value can be evaluated
+ sGlobalVariableDescription *gvar = asNEW(sGlobalVariableDescription);
+ if( gvar == 0 )
+ return asOUT_OF_MEMORY;
+
+ gvar->script = file;
+ gvar->declaredAtNode = tmp;
+ tmp = tmp->next;
+ gvar->declaredAtNode->DisconnectParent();
+ gvar->initializationNode = asnNode;
+ gvar->name = name;
+ gvar->datatype = type;
+ gvar->ns = ns;
+ // No need to allocate space on the global memory stack since the values are stored in the asCObjectType
+ // Set the index to a negative to allow compiler to diferentiate from ordinary global var when compiling the initialization
+ gvar->index = -1;
+ gvar->isCompiled = false;
+ gvar->isPureConstant = true;
+ gvar->isEnumValue = true;
+ gvar->constantValue = 0xdeadbeef;
+
+ // Allocate dummy property so we can compile the value.
+ // This will be removed later on so we don't add it to the engine.
+ gvar->property = asNEW(asCGlobalProperty);
+ if( gvar->property == 0 )
+ return asOUT_OF_MEMORY;
+
+ gvar->property->name = name;
+ gvar->property->nameSpace = ns;
+ gvar->property->type = gvar->datatype;
+ gvar->property->id = 0;
+
+ globVariables.Put(gvar);
+ }
+ }
+ }
+
+ node->Destroy(engine);
+
+ return r;
+}
+
+int asCBuilder::RegisterTypedef(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns)
+{
+ // Get the native data type
+ asCScriptNode *tmp = node->firstChild;
+ asASSERT(NULL != tmp && snDataType == tmp->nodeType);
+ asCDataType dataType;
+ dataType.CreatePrimitive(tmp->tokenType, false);
+ dataType.SetTokenType(tmp->tokenType);
+ tmp = tmp->next;
+
+ // Grab the name of the typedef
+ asASSERT(NULL != tmp && NULL == tmp->next);
+ asCString name;
+ name.Assign(&file->code[tmp->tokenPos], tmp->tokenLength);
+
+ // If the name is not already in use add it
+ int r = CheckNameConflict(name.AddressOf(), tmp, file, ns, true, false);
+
+ asCTypedefType *st = 0;
+ if( asSUCCESS == r )
+ {
+ // Create the new type
+ st = asNEW(asCTypedefType)(engine);
+ if( st == 0 )
+ r = asOUT_OF_MEMORY;
+ }
+
+ if( asSUCCESS == r )
+ {
+ st->flags = asOBJ_TYPEDEF;
+ st->size = dataType.GetSizeInMemoryBytes();
+ st->name = name;
+ st->nameSpace = ns;
+ st->aliasForType = dataType;
+ st->module = module;
+
+ module->AddTypeDef(st);
+
+ // Store the location of this declaration for reference in name collisions
+ sClassDeclaration *decl = asNEW(sClassDeclaration);
+ if( decl == 0 )
+ r = asOUT_OF_MEMORY;
+ else
+ {
+ decl->name = name;
+ decl->script = file;
+ decl->typeInfo = st;
+ namedTypeDeclarations.PushLast(decl);
+ }
+ }
+
+ node->Destroy(engine);
+
+ return r;
+}
+
+void asCBuilder::GetParsedFunctionDetails(asCScriptNode *node, asCScriptCode *file, asCObjectType *objType, asCString &name, asCDataType &returnType, asCArray<asCString> ¶meterNames, asCArray<asCDataType> ¶meterTypes, asCArray<asETypeModifiers> &inOutFlags, asCArray<asCString *> &defaultArgs, asSFunctionTraits &funcTraits, asSNameSpace *implicitNamespace)
+{
+ node = node->firstChild;
+
+ // Is the function shared?
+ funcTraits.SetTrait(asTRAIT_SHARED, false);
+ funcTraits.SetTrait(asTRAIT_EXTERNAL, false);
+ while (node->tokenType == ttIdentifier)
+ {
+ if (file->TokenEquals(node->tokenPos, node->tokenLength, SHARED_TOKEN))
+ funcTraits.SetTrait(asTRAIT_SHARED, true);
+ else if (file->TokenEquals(node->tokenPos, node->tokenLength, EXTERNAL_TOKEN))
+ funcTraits.SetTrait(asTRAIT_EXTERNAL, true);
+ else
+ break;
+ node = node->next;
+ }
+
+ // Is the function a private or protected class method?
+ funcTraits.SetTrait(asTRAIT_PRIVATE, false);
+ funcTraits.SetTrait(asTRAIT_PROTECTED, false);
+ if( node->tokenType == ttPrivate )
+ {
+ funcTraits.SetTrait(asTRAIT_PRIVATE, true);
+ node = node->next;
+ }
+ else if( node->tokenType == ttProtected )
+ {
+ funcTraits.SetTrait(asTRAIT_PROTECTED, true);
+ node = node->next;
+ }
+
+ // Find the name
+ funcTraits.SetTrait(asTRAIT_CONSTRUCTOR, false);
+ funcTraits.SetTrait(asTRAIT_DESTRUCTOR, false);
+ asCScriptNode *n = 0;
+ if( node->nodeType == snDataType )
+ n = node->next->next;
+ else
+ {
+ // If the first node is a ~ token, then we know it is a destructor
+ if( node->tokenType == ttBitNot )
+ {
+ n = node->next;
+ funcTraits.SetTrait(asTRAIT_DESTRUCTOR, true);
+ }
+ else
+ {
+ n = node;
+ funcTraits.SetTrait(asTRAIT_CONSTRUCTOR, true);
+ }
+ }
+ name.Assign(&file->code[n->tokenPos], n->tokenLength);
+
+ if( !funcTraits.GetTrait(asTRAIT_CONSTRUCTOR) && !funcTraits.GetTrait(asTRAIT_DESTRUCTOR) )
+ {
+ returnType = CreateDataTypeFromNode(node, file, implicitNamespace, false, objType);
+ returnType = ModifyDataTypeFromNode(returnType, node->next, file, 0, 0);
+
+ if( engine->ep.disallowValueAssignForRefType &&
+ returnType.GetTypeInfo() &&
+ (returnType.GetTypeInfo()->flags & asOBJ_REF) &&
+ !(returnType.GetTypeInfo()->flags & asOBJ_SCOPED) &&
+ !returnType.IsReference() &&
+ !returnType.IsObjectHandle() )
+ {
+ WriteError(TXT_REF_TYPE_CANT_BE_RETURNED_BY_VAL, file, node);
+ }
+ }
+ else
+ returnType = asCDataType::CreatePrimitive(ttVoid, false);
+
+ funcTraits.SetTrait(asTRAIT_CONST, false);
+ funcTraits.SetTrait(asTRAIT_FINAL, false);
+ funcTraits.SetTrait(asTRAIT_OVERRIDE, false);
+ funcTraits.SetTrait(asTRAIT_EXPLICIT, false);
+ funcTraits.SetTrait(asTRAIT_PROPERTY, false);
+
+ if( n->next->next )
+ {
+ asCScriptNode *decorator = n->next->next;
+
+ // Is this a const method?
+ if( objType && decorator->tokenType == ttConst )
+ {
+ funcTraits.SetTrait(asTRAIT_CONST, true);
+ decorator = decorator->next;
+ }
+
+ while( decorator && decorator->tokenType == ttIdentifier )
+ {
+ if (objType && file->TokenEquals(decorator->tokenPos, decorator->tokenLength, FINAL_TOKEN))
+ funcTraits.SetTrait(asTRAIT_FINAL, true);
+ else if (objType && file->TokenEquals(decorator->tokenPos, decorator->tokenLength, OVERRIDE_TOKEN))
+ funcTraits.SetTrait(asTRAIT_OVERRIDE, true);
+ else if (objType && file->TokenEquals(decorator->tokenPos, decorator->tokenLength, EXPLICIT_TOKEN))
+ funcTraits.SetTrait(asTRAIT_EXPLICIT, true);
+ else if (file->TokenEquals(decorator->tokenPos, decorator->tokenLength, PROPERTY_TOKEN))
+ funcTraits.SetTrait(asTRAIT_PROPERTY, true);
+ else
+ {
+ asCString msg(&file->code[decorator->tokenPos], decorator->tokenLength);
+ msg.Format(TXT_UNEXPECTED_TOKEN_s, msg.AddressOf());
+ WriteError(msg.AddressOf(), file, decorator);
+ }
+
+ decorator = decorator->next;
+ }
+ }
+
+ // Count the number of parameters
+ int count = 0;
+ asCScriptNode *c = n->next->firstChild;
+ while( c )
+ {
+ count++;
+ c = c->next->next;
+ if( c && c->nodeType == snIdentifier )
+ c = c->next;
+ if( c && c->nodeType == snExpression )
+ c = c->next;
+ }
+
+ // Get the parameter types
+ parameterNames.Allocate(count, false);
+ parameterTypes.Allocate(count, false);
+ inOutFlags.Allocate(count, false);
+ defaultArgs.Allocate(count, false);
+ n = n->next->firstChild;
+ while( n )
+ {
+ asETypeModifiers inOutFlag;
+ asCDataType type = CreateDataTypeFromNode(n, file, implicitNamespace, false, objType);
+ type = ModifyDataTypeFromNode(type, n->next, file, &inOutFlag, 0);
+
+ if( engine->ep.disallowValueAssignForRefType &&
+ type.GetTypeInfo() &&
+ (type.GetTypeInfo()->flags & asOBJ_REF) &&
+ !(type.GetTypeInfo()->flags & asOBJ_SCOPED) &&
+ !type.IsReference() &&
+ !type.IsObjectHandle() )
+ {
+ WriteError(TXT_REF_TYPE_CANT_BE_PASSED_BY_VAL, file, node);
+ }
+
+ // Store the parameter type
+ parameterTypes.PushLast(type);
+ inOutFlags.PushLast(inOutFlag);
+
+ // Move to next parameter
+ n = n->next->next;
+ if( n && n->nodeType == snIdentifier )
+ {
+ asCString paramName(&file->code[n->tokenPos], n->tokenLength);
+ parameterNames.PushLast(paramName);
+ n = n->next;
+ }
+ else
+ {
+ // No name was given for the parameter
+ parameterNames.PushLast(asCString());
+ }
+
+ if( n && n->nodeType == snExpression )
+ {
+ // Strip out white space and comments to better share the string
+ asCString *defaultArgStr = asNEW(asCString);
+ if( defaultArgStr )
+ *defaultArgStr = GetCleanExpressionString(n, file);
+ defaultArgs.PushLast(defaultArgStr);
+
+ n = n->next;
+ }
+ else
+ defaultArgs.PushLast(0);
+ }
+}
+#endif
+
+asCString asCBuilder::GetCleanExpressionString(asCScriptNode *node, asCScriptCode *file)
+{
+ asASSERT(node && node->nodeType == snExpression);
+
+ asCString str;
+ str.Assign(file->code + node->tokenPos, node->tokenLength);
+
+ asCString cleanStr;
+ for( asUINT n = 0; n < str.GetLength(); )
+ {
+ asUINT len = 0;
+ asETokenClass tok = engine->ParseToken(str.AddressOf() + n, str.GetLength() - n, &len);
+ if( tok != asTC_COMMENT && tok != asTC_WHITESPACE )
+ {
+ if( cleanStr.GetLength() ) cleanStr += " ";
+ cleanStr.Concatenate(str.AddressOf() + n, len);
+ }
+ n += len;
+ }
+
+ return cleanStr;
+}
+
+#ifndef AS_NO_COMPILER
+int asCBuilder::RegisterScriptFunctionFromNode(asCScriptNode *node, asCScriptCode *file, asCObjectType *objType, bool isInterface, bool isGlobalFunction, asSNameSpace *ns, bool isExistingShared, bool isMixin)
+{
+ asCString name;
+ asCDataType returnType;
+ asCArray<asCString> parameterNames;
+ asCArray<asCDataType> parameterTypes;
+ asCArray<asETypeModifiers> inOutFlags;
+ asCArray<asCString *> defaultArgs;
+ asSFunctionTraits funcTraits;
+
+ asASSERT( (objType && ns == 0) || isGlobalFunction || isMixin );
+
+ // Set the default namespace
+ if( ns == 0 )
+ {
+ if( objType )
+ ns = objType->nameSpace;
+ else
+ ns = engine->nameSpaces[0];
+ }
+
+ GetParsedFunctionDetails(node, file, objType, name, returnType, parameterNames, parameterTypes, inOutFlags, defaultArgs, funcTraits, ns);
+
+ return RegisterScriptFunction(node, file, objType, isInterface, isGlobalFunction, ns, isExistingShared, isMixin, name, returnType, parameterNames, parameterTypes, inOutFlags, defaultArgs, funcTraits);
+}
+
+asCScriptFunction *asCBuilder::RegisterLambda(asCScriptNode *node, asCScriptCode *file, asCScriptFunction *funcDef, const asCString &name, asSNameSpace *ns, bool isShared)
+{
+ // Get the parameter names from the node
+ asCArray<asCString> parameterNames;
+ asCArray<asCString*> defaultArgs;
+ asCScriptNode *args = node->firstChild;
+ while( args && args->nodeType != snStatementBlock )
+ {
+ if (args->nodeType == snIdentifier)
+ {
+ asCString argName;
+ argName.Assign(&file->code[args->tokenPos], args->tokenLength);
+ parameterNames.PushLast(argName);
+ defaultArgs.PushLast(0);
+ }
+ args = args->next;
+ }
+
+ // The statement block for the function must be disconnected, as the builder is going to be the owner of it
+ args->DisconnectParent();
+
+ // Get the return and parameter types from the funcDef
+ asCString funcName = name;
+ asSFunctionTraits traits;
+ traits.SetTrait(asTRAIT_SHARED, isShared);
+ int r = RegisterScriptFunction(args, file, 0, 0, true, ns, false, false, funcName, funcDef->returnType, parameterNames, funcDef->parameterTypes, funcDef->inOutFlags, defaultArgs, traits);
+ if( r < 0 )
+ return 0;
+
+ // Return the function that was just created (but that will be compiled later)
+ return engine->scriptFunctions[functions[functions.GetLength()-1]->funcId];
+}
+
+int asCBuilder::RegisterScriptFunction(asCScriptNode *node, asCScriptCode *file, asCObjectType *objType, bool isInterface, bool isGlobalFunction, asSNameSpace *ns, bool isExistingShared, bool isMixin, asCString &name, asCDataType &returnType, asCArray<asCString> ¶meterNames, asCArray<asCDataType> ¶meterTypes, asCArray<asETypeModifiers> &inOutFlags, asCArray<asCString *> &defaultArgs, asSFunctionTraits funcTraits)
+{
+ // Determine default namespace if not specified
+ if( ns == 0 )
+ {
+ if( objType )
+ ns = objType->nameSpace;
+ else
+ ns = engine->nameSpaces[0];
+ }
+
+ if( isExistingShared )
+ {
+ asASSERT( objType );
+
+ // Should validate that the function really exists in the class/interface
+ bool found = false;
+ if(funcTraits.GetTrait(asTRAIT_CONSTRUCTOR) || funcTraits.GetTrait(asTRAIT_DESTRUCTOR) )
+ {
+ // TODO: shared: Should check the existance of these too
+ found = true;
+ }
+ else
+ {
+ for( asUINT n = 0; n < objType->methods.GetLength(); n++ )
+ {
+ asCScriptFunction *func = engine->scriptFunctions[objType->methods[n]];
+ if( func->name == name &&
+ func->IsSignatureExceptNameEqual(returnType, parameterTypes, inOutFlags, objType, funcTraits.GetTrait(asTRAIT_CONST)) )
+ {
+ // Add the shared function in this module too
+ module->AddScriptFunction(func);
+
+ found = true;
+ break;
+ }
+ }
+ }
+
+ if( !found )
+ {
+ asCString str;
+ str.Format(TXT_SHARED_s_DOESNT_MATCH_ORIGINAL, objType->GetName());
+ WriteError(str, file, node);
+ }
+
+ // Free the default args
+ for( asUINT n = 0; n < defaultArgs.GetLength(); n++ )
+ if( defaultArgs[n] )
+ asDELETE(defaultArgs[n], asCString);
+
+ node->Destroy(engine);
+ return 0;
+ }
+
+ // Check for name conflicts
+ if( !funcTraits.GetTrait(asTRAIT_CONSTRUCTOR) && !funcTraits.GetTrait(asTRAIT_DESTRUCTOR) )
+ {
+ if( objType )
+ {
+ CheckNameConflictMember(objType, name.AddressOf(), node, file, false, false);
+
+ if( name == objType->name )
+ WriteError(TXT_METHOD_CANT_HAVE_NAME_OF_CLASS, file, node);
+ }
+ else
+ CheckNameConflict(name.AddressOf(), node, file, ns, false, false);
+ }
+ else
+ {
+ if( isMixin )
+ {
+ // Mixins cannot implement constructors/destructors
+ WriteError(TXT_MIXIN_CANNOT_HAVE_CONSTRUCTOR, file, node);
+
+ // Free the default args
+ for( asUINT n = 0; n < defaultArgs.GetLength(); n++ )
+ if( defaultArgs[n] )
+ asDELETE(defaultArgs[n], asCString);
+
+ node->Destroy(engine);
+ return 0;
+ }
+
+ // Verify that the name of the constructor/destructor is the same as the class
+ if( name != objType->name )
+ {
+ asCString str;
+ if(funcTraits.GetTrait(asTRAIT_DESTRUCTOR) )
+ str.Format(TXT_DESTRUCTOR_s_s_NAME_ERROR, objType->name.AddressOf(), name.AddressOf());
+ else
+ str.Format(TXT_METHOD_s_s_HAS_NO_RETURN_TYPE, objType->name.AddressOf(), name.AddressOf());
+ WriteError(str, file, node);
+ }
+
+ if(funcTraits.GetTrait(asTRAIT_DESTRUCTOR))
+ name = "~" + name;
+ }
+
+ // Validate virtual properties signature
+ if( funcTraits.GetTrait(asTRAIT_PROPERTY) )
+ {
+ asCScriptFunction func(engine, module, asFUNC_SCRIPT);
+ func.name = name;
+ func.nameSpace = ns;
+ func.objectType = objType;
+ if( objType )
+ objType->AddRefInternal();
+ func.traits = funcTraits;
+ func.returnType = returnType;
+ func.parameterTypes = parameterTypes;
+
+ int r = ValidateVirtualProperty(&func);
+ if( r < 0 )
+ {
+ asCString str;
+ if( r == -2 || r == -3 )
+ str.Format(TXT_INVALID_SIG_FOR_VIRTPROP);
+ else if( r == -4 )
+ str.Format(TXT_GET_SET_ACCESSOR_TYPE_MISMATCH_FOR_s, name.SubString(4).AddressOf());
+ else if( r == -5 )
+ str.Format(TXT_NAME_CONFLICT_s_ALREADY_USED, name.SubString(4).AddressOf());
+ WriteError(str, file, node);
+ }
+
+ func.funcType = asFUNC_DUMMY;
+ }
+
+ isExistingShared = false;
+ int funcId = engine->GetNextScriptFunctionId();
+ if( !isInterface )
+ {
+ sFunctionDescription *func = asNEW(sFunctionDescription);
+ if( func == 0 )
+ {
+ // Free the default args
+ for( asUINT n = 0; n < defaultArgs.GetLength(); n++ )
+ if( defaultArgs[n] )
+ asDELETE(defaultArgs[n], asCString);
+
+ return asOUT_OF_MEMORY;
+ }
+
+ functions.PushLast(func);
+
+ func->script = file;
+ func->node = node;
+ func->name = name;
+ func->objType = objType;
+ func->funcId = funcId;
+ func->isExistingShared = false;
+ func->paramNames = parameterNames;
+
+ if(funcTraits.GetTrait(asTRAIT_SHARED))
+ {
+ // Look for a pre-existing shared function with the same signature
+ for( asUINT n = 0; n < engine->scriptFunctions.GetLength(); n++ )
+ {
+ asCScriptFunction *f = engine->scriptFunctions[n];
+ if( f &&
+ f->IsShared() &&
+ f->name == name &&
+ f->nameSpace == ns &&
+ f->objectType == objType &&
+ f->IsSignatureExceptNameEqual(returnType, parameterTypes, inOutFlags, 0, false) )
+ {
+ funcId = func->funcId = f->id;
+ isExistingShared = func->isExistingShared = true;
+ break;
+ }
+ }
+ }
+
+ // Remember if the function was declared as external so the saved bytecode can be flagged accordingly
+ if (funcTraits.GetTrait(asTRAIT_EXTERNAL) && func->isExistingShared)
+ module->m_externalFunctions.PushLast(engine->scriptFunctions[func->funcId]);
+
+ if (funcTraits.GetTrait(asTRAIT_EXTERNAL) && !func->isExistingShared)
+ {
+ // Mark it as existing shared to avoid compiling it
+ func->isExistingShared = true;
+
+ asCString str;
+ str.Format(TXT_EXTERNAL_SHARED_s_NOT_FOUND, name.AddressOf());
+ WriteError(str, file, node);
+ }
+
+ // External shared function must not try to redefine the interface
+ if (funcTraits.GetTrait(asTRAIT_EXTERNAL) && !(node->tokenType == ttEndStatement || node->lastChild->tokenType == ttEndStatement))
+ {
+ asCString str;
+ str.Format(TXT_EXTERNAL_SHARED_s_CANNOT_REDEF, name.AddressOf());
+ WriteError(str, file, node);
+ }
+ else if (!funcTraits.GetTrait(asTRAIT_EXTERNAL) && !(node->nodeType == snStatementBlock || node->lastChild->nodeType == snStatementBlock) )
+ {
+ asCString str;
+ str.Format(TXT_MISSING_DEFINITION_OF_s, name.AddressOf());
+ WriteError(str, file, node);
+ }
+ }
+
+ // Destructors may not have any parameters
+ if (funcTraits.GetTrait(asTRAIT_DESTRUCTOR) && parameterTypes.GetLength() > 0)
+ WriteError(TXT_DESTRUCTOR_MAY_NOT_HAVE_PARM, file, node);
+
+ // If a function, class, or interface is shared then only shared types may be used in the signature
+ if( (objType && objType->IsShared()) || funcTraits.GetTrait(asTRAIT_SHARED))
+ {
+ asCTypeInfo *ti = returnType.GetTypeInfo();
+ if( ti && !ti->IsShared() )
+ {
+ asCString msg;
+ msg.Format(TXT_SHARED_CANNOT_USE_NON_SHARED_TYPE_s, ti->name.AddressOf());
+ WriteError(msg, file, node);
+ }
+
+ for( asUINT p = 0; p < parameterTypes.GetLength(); ++p )
+ {
+ ti = parameterTypes[p].GetTypeInfo();
+ if( ti && !ti->IsShared() )
+ {
+ asCString msg;
+ msg.Format(TXT_SHARED_CANNOT_USE_NON_SHARED_TYPE_s, ti->name.AddressOf());
+ WriteError(msg, file, node);
+ }
+ }
+ }
+
+ // Check that the same function hasn't been registered already in the namespace
+ asCArray<int> funcs;
+ if( objType )
+ GetObjectMethodDescriptions(name.AddressOf(), objType, funcs, false);
+ else
+ GetFunctionDescriptions(name.AddressOf(), funcs, ns);
+ if( objType && (name == "opConv" || name == "opImplConv" || name == "opCast" || name == "opImplCast") && parameterTypes.GetLength() == 0 )
+ {
+ // opConv and opCast are special methods used for type casts
+ for( asUINT n = 0; n < funcs.GetLength(); ++n )
+ {
+ asCScriptFunction *func = GetFunctionDescription(funcs[n]);
+ if( func->IsSignatureExceptNameEqual(returnType, parameterTypes, inOutFlags, objType, funcTraits.GetTrait(asTRAIT_CONST)) )
+ {
+ // TODO: clean up: Reuse the same error handling for both opConv and normal methods
+ if( isMixin )
+ {
+ // Clean up the memory, as the function will not be registered
+ if( node )
+ node->Destroy(engine);
+ sFunctionDescription *funcDesc = functions.PopLast();
+ asDELETE(funcDesc, sFunctionDescription);
+
+ // Free the default args
+ for( n = 0; n < defaultArgs.GetLength(); n++ )
+ if( defaultArgs[n] )
+ asDELETE(defaultArgs[n], asCString);
+
+ return 0;
+ }
+
+ WriteError(TXT_FUNCTION_ALREADY_EXIST, file, node);
+ break;
+ }
+ }
+ }
+ else
+ {
+ for( asUINT n = 0; n < funcs.GetLength(); ++n )
+ {
+ asCScriptFunction *func = GetFunctionDescription(funcs[n]);
+ if( func->IsSignatureExceptNameAndReturnTypeEqual(parameterTypes, inOutFlags, objType, funcTraits.GetTrait(asTRAIT_CONST)) )
+ {
+ if( isMixin )
+ {
+ // Clean up the memory, as the function will not be registered
+ if( node )
+ node->Destroy(engine);
+ sFunctionDescription *funcDesc = functions.PopLast();
+ asDELETE(funcDesc, sFunctionDescription);
+
+ // Free the default args
+ for( n = 0; n < defaultArgs.GetLength(); n++ )
+ if( defaultArgs[n] )
+ asDELETE(defaultArgs[n], asCString);
+
+ return 0;
+ }
+
+ WriteError(TXT_FUNCTION_ALREADY_EXIST, file, node);
+ break;
+ }
+ }
+ }
+
+ // Register the function
+ if( isExistingShared )
+ {
+ // Delete the default args as they won't be used anymore
+ for( asUINT n = 0; n < defaultArgs.GetLength(); n++ )
+ if( defaultArgs[n] )
+ asDELETE(defaultArgs[n], asCString);
+
+ asCScriptFunction *f = engine->scriptFunctions[funcId];
+ module->AddScriptFunction(f);
+
+ // TODO: clean up: This should be done by AddScriptFunction() itself
+ module->m_globalFunctions.Put(f);
+ }
+ else
+ {
+ int row = 0, col = 0;
+ if( node )
+ file->ConvertPosToRowCol(node->tokenPos, &row, &col);
+ module->AddScriptFunction(file->idx, (row&0xFFFFF)|((col&0xFFF)<<20), funcId, name, returnType, parameterTypes, parameterNames, inOutFlags, defaultArgs, isInterface, objType, isGlobalFunction, funcTraits, ns);
+ }
+
+ // Make sure the default args are declared correctly
+ ValidateDefaultArgs(file, node, engine->scriptFunctions[funcId]);
+ CheckForConflictsDueToDefaultArgs(file, node, engine->scriptFunctions[funcId], objType);
+
+ if( objType )
+ {
+ asASSERT( !isExistingShared );
+
+ engine->scriptFunctions[funcId]->AddRefInternal();
+ if(funcTraits.GetTrait(asTRAIT_CONSTRUCTOR))
+ {
+ int factoryId = engine->GetNextScriptFunctionId();
+ if( parameterTypes.GetLength() == 0 )
+ {
+ // Overload the default constructor
+ engine->scriptFunctions[objType->beh.construct]->ReleaseInternal();
+ objType->beh.construct = funcId;
+ objType->beh.constructors[0] = funcId;
+
+ // Register the default factory as well
+ engine->scriptFunctions[objType->beh.factory]->ReleaseInternal();
+ objType->beh.factory = factoryId;
+ objType->beh.factories[0] = factoryId;
+ }
+ else
+ {
+ // The copy constructor needs to be marked for easy finding
+ if( parameterTypes.GetLength() == 1 &&
+ parameterTypes[0].GetTypeInfo() == objType &&
+ (parameterTypes[0].IsReference() || parameterTypes[0].IsObjectHandle()) )
+ {
+ // Verify that there are not multiple options matching the copy constructor
+ // TODO: Need a better message, since the parameters can be slightly different, e.g. & vs @
+ if( objType->beh.copyconstruct )
+ WriteError(TXT_FUNCTION_ALREADY_EXIST, file, node);
+
+ objType->beh.copyconstruct = funcId;
+ objType->beh.copyfactory = factoryId;
+ }
+
+ // Register as a normal constructor
+ objType->beh.constructors.PushLast(funcId);
+
+ // Register the factory as well
+ objType->beh.factories.PushLast(factoryId);
+ }
+
+ // We must copy the default arg strings to avoid deleting the same object multiple times
+ for( asUINT n = 0; n < defaultArgs.GetLength(); n++ )
+ if( defaultArgs[n] )
+ defaultArgs[n] = asNEW(asCString)(*defaultArgs[n]);
+
+ asCDataType dt = asCDataType::CreateObjectHandle(objType, false);
+ module->AddScriptFunction(file->idx, engine->scriptFunctions[funcId]->scriptData->declaredAt, factoryId, name, dt, parameterTypes, parameterNames, inOutFlags, defaultArgs, false, 0, false, funcTraits);
+
+ // If the object is shared, then the factory must also be marked as shared
+ if( objType->flags & asOBJ_SHARED )
+ engine->scriptFunctions[factoryId]->SetShared(true);
+
+ // Add a dummy function to the builder so that it doesn't mix up the fund Ids
+ functions.PushLast(0);
+
+ // Compile the factory immediately
+ asCCompiler compiler(engine);
+ compiler.CompileFactory(this, file, engine->scriptFunctions[factoryId]);
+ engine->scriptFunctions[factoryId]->AddRefInternal();
+ }
+ else if(funcTraits.GetTrait(asTRAIT_DESTRUCTOR))
+ objType->beh.destruct = funcId;
+ else
+ {
+ // If the method is the assignment operator we need to replace the default implementation
+ asCScriptFunction *f = engine->scriptFunctions[funcId];
+ if( f->name == "opAssign" && f->parameterTypes.GetLength() == 1 &&
+ f->parameterTypes[0].GetTypeInfo() == f->objectType &&
+ (f->inOutFlags[0] & asTM_INREF) )
+ {
+ engine->scriptFunctions[objType->beh.copy]->ReleaseInternal();
+ objType->beh.copy = funcId;
+ f->AddRefInternal();
+ }
+
+ objType->methods.PushLast(funcId);
+ }
+ }
+
+ // We need to delete the node already if this is an interface method
+ if( isInterface && node )
+ node->Destroy(engine);
+
+ return 0;
+}
+
+int asCBuilder::RegisterVirtualProperty(asCScriptNode *node, asCScriptCode *file, asCObjectType *objType, bool isInterface, bool isGlobalFunction, asSNameSpace *ns, bool isExistingShared)
+{
+ if( engine->ep.propertyAccessorMode < 2 )
+ {
+ WriteError(TXT_PROPERTY_ACCESSOR_DISABLED, file, node);
+ node->Destroy(engine);
+ return 0;
+ }
+
+ asASSERT( (objType && ns == 0) || isGlobalFunction );
+
+ if( ns == 0 )
+ {
+ if( objType )
+ ns = objType->nameSpace;
+ else
+ ns = engine->nameSpaces[0];
+ }
+
+ bool isPrivate = false, isProtected = false;
+ asCString emulatedName;
+ asCDataType emulatedType;
+
+ asCScriptNode *mainNode = node;
+ node = node->firstChild;
+
+ if( !isGlobalFunction && node->tokenType == ttPrivate )
+ {
+ isPrivate = true;
+ node = node->next;
+ }
+ else if( !isGlobalFunction && node->tokenType == ttProtected )
+ {
+ isProtected = true;
+ node = node->next;
+ }
+
+ emulatedType = CreateDataTypeFromNode(node, file, ns);
+ emulatedType = ModifyDataTypeFromNode(emulatedType, node->next, file, 0, 0);
+ node = node->next->next;
+ emulatedName.Assign(&file->code[node->tokenPos], node->tokenLength);
+
+ if( node->next == 0 )
+ WriteError(TXT_PROPERTY_WITHOUT_ACCESSOR, file, node);
+
+ node = node->next;
+ while (node)
+ {
+ asCScriptNode *next = node->next;
+ asCScriptNode *funcNode = 0;
+ bool success = false;
+ asSFunctionTraits funcTraits;
+ asCDataType returnType;
+ asCArray<asCString> paramNames;
+ asCArray<asCDataType> paramTypes;
+ asCArray<asETypeModifiers> paramModifiers;
+ asCArray<asCString*> defaultArgs;
+ asCString name;
+
+ funcTraits.SetTrait(asTRAIT_PRIVATE, isPrivate);
+ funcTraits.SetTrait(asTRAIT_PROTECTED, isProtected);
+ funcTraits.SetTrait(asTRAIT_PROPERTY, true);
+
+ if (node->firstChild->nodeType == snIdentifier && file->TokenEquals(node->firstChild->tokenPos, node->firstChild->tokenLength, GET_TOKEN))
+ name = "get_";
+ else if (node->firstChild->nodeType == snIdentifier && file->TokenEquals(node->firstChild->tokenPos, node->firstChild->tokenLength, SET_TOKEN))
+ name = "set_";
+ else
+ WriteError(TXT_UNRECOGNIZED_VIRTUAL_PROPERTY_NODE, file, node);
+
+ if (name != "")
+ {
+ success = true;
+ funcNode = node->firstChild->next;
+
+ if (funcNode && funcNode->tokenType == ttConst)
+ {
+ funcTraits.SetTrait(asTRAIT_CONST, true);
+ funcNode = funcNode->next;
+ }
+
+ while (funcNode && funcNode->nodeType != snStatementBlock)
+ {
+ if (funcNode->tokenType == ttIdentifier && file->TokenEquals(funcNode->tokenPos, funcNode->tokenLength, FINAL_TOKEN))
+ funcTraits.SetTrait(asTRAIT_FINAL, true);
+ else if (funcNode->tokenType == ttIdentifier && file->TokenEquals(funcNode->tokenPos, funcNode->tokenLength, OVERRIDE_TOKEN))
+ funcTraits.SetTrait(asTRAIT_OVERRIDE, true);
+ else
+ {
+ asCString msg(&file->code[funcNode->tokenPos], funcNode->tokenLength);;
+ msg.Format(TXT_UNEXPECTED_TOKEN_s, msg.AddressOf());
+ WriteError(msg.AddressOf(), file, node);
+ }
+
+ funcNode = funcNode->next;
+ }
+
+ if (funcNode)
+ funcNode->DisconnectParent();
+
+ if (funcNode == 0 && (objType == 0 || !objType->IsInterface()))
+ {
+ // TODO: getset: If no implementation is supplied the builder should provide an automatically generated implementation
+ // The compiler needs to be able to handle the different types, primitive, value type, and handle
+ // The code is also different for global property accessors
+ WriteError(TXT_PROPERTY_ACCESSOR_MUST_BE_IMPLEMENTED, file, node);
+ }
+
+ if (name == "get_")
+ {
+ // Setup the signature for the get accessor method
+ returnType = emulatedType;
+ name = "get_" + emulatedName;
+ }
+ else if (name == "set_")
+ {
+ // Setup the signature for the set accessor method
+ returnType = asCDataType::CreatePrimitive(ttVoid, false);
+ paramModifiers.PushLast(asTM_NONE);
+ paramNames.PushLast("value");
+ paramTypes.PushLast(emulatedType);
+ defaultArgs.PushLast(0);
+ name = "set_" + emulatedName;
+ }
+ }
+
+ if( success )
+ {
+ if( !isExistingShared )
+ RegisterScriptFunction(funcNode, file, objType, isInterface, isGlobalFunction, ns, false, false, name, returnType, paramNames, paramTypes, paramModifiers, defaultArgs, funcTraits);
+ else
+ {
+ // Free the funcNode as it won't be used
+ if( funcNode ) funcNode->Destroy(engine);
+
+ // Should validate that the function really exists in the class/interface
+ bool found = false;
+ for( asUINT n = 0; n < objType->methods.GetLength(); n++ )
+ {
+ asCScriptFunction *func = engine->scriptFunctions[objType->methods[n]];
+ if( func->name == name &&
+ func->IsSignatureExceptNameEqual(returnType, paramTypes, paramModifiers, objType, funcTraits.GetTrait(asTRAIT_CONST)) )
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if( !found )
+ {
+ asCString str;
+ str.Format(TXT_SHARED_s_DOESNT_MATCH_ORIGINAL, objType->GetName());
+ WriteError(str, file, node);
+ }
+ }
+ }
+
+ node = next;
+ };
+
+ mainNode->Destroy(engine);
+
+ return 0;
+}
+
+int asCBuilder::RegisterImportedFunction(int importID, asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns)
+{
+ asCString name;
+ asCDataType returnType;
+ asCArray<asCString> parameterNames;
+ asCArray<asCDataType> parameterTypes;
+ asCArray<asETypeModifiers> inOutFlags;
+ asCArray<asCString *> defaultArgs;
+ asSFunctionTraits funcTraits;
+
+ if( ns == 0 )
+ ns = engine->nameSpaces[0];
+
+ GetParsedFunctionDetails(node->firstChild, file, 0, name, returnType, parameterNames, parameterTypes, inOutFlags, defaultArgs, funcTraits, ns);
+ CheckNameConflict(name.AddressOf(), node, file, ns, false, false);
+
+ // Check that the same function hasn't been registered already in the namespace
+ asCArray<int> funcs;
+ GetFunctionDescriptions(name.AddressOf(), funcs, ns);
+ for( asUINT n = 0; n < funcs.GetLength(); ++n )
+ {
+ asCScriptFunction *func = GetFunctionDescription(funcs[n]);
+ if( func->IsSignatureExceptNameAndReturnTypeEqual(parameterTypes, inOutFlags, 0, false) )
+ {
+ WriteError(TXT_FUNCTION_ALREADY_EXIST, file, node);
+ break;
+ }
+ }
+
+ // Read the module name as well
+ asCScriptNode *nd = node->lastChild;
+ asASSERT( nd->nodeType == snConstant && nd->tokenType == ttStringConstant );
+ asCString moduleName;
+ moduleName.Assign(&file->code[nd->tokenPos+1], nd->tokenLength-2);
+
+ node->Destroy(engine);
+
+ // Register the function
+ module->AddImportedFunction(importID, name, returnType, parameterTypes, inOutFlags, defaultArgs, funcTraits, ns, moduleName);
+
+ return 0;
+}
+
+asCScriptFunction *asCBuilder::GetFunctionDescription(int id)
+{
+ // TODO: import: This should be improved when the imported functions are removed
+ // Get the description from the engine
+ if( (id & FUNC_IMPORTED) == 0 )
+ return engine->scriptFunctions[id];
+ else
+ return engine->importedFunctions[id & ~FUNC_IMPORTED]->importedFunctionSignature;
+}
+
+void asCBuilder::GetFunctionDescriptions(const char *name, asCArray<int> &funcs, asSNameSpace *ns)
+{
+ asUINT n;
+
+ // Get the script declared global functions
+ const asCArray<unsigned int> &idxs = module->m_globalFunctions.GetIndexes(ns, name);
+ for( n = 0; n < idxs.GetLength(); n++ )
+ {
+ const asCScriptFunction *f = module->m_globalFunctions.Get(idxs[n]);
+ asASSERT( f->objectType == 0 );
+ funcs.PushLast(f->id);
+ }
+
+ // Add the imported functions
+ // TODO: optimize: Linear search: This is probably not that critial. Also bindInformation will probably be removed in near future
+ for( n = 0; n < module->m_bindInformations.GetLength(); n++ )
+ {
+ if( module->m_bindInformations[n]->importedFunctionSignature->name == name &&
+ module->m_bindInformations[n]->importedFunctionSignature->nameSpace == ns )
+ funcs.PushLast(module->m_bindInformations[n]->importedFunctionSignature->id);
+ }
+
+ // Add the registered global functions
+ const asCArray<unsigned int> &idxs2 = engine->registeredGlobalFuncs.GetIndexes(ns, name);
+ for( n = 0; n < idxs2.GetLength(); n++ )
+ {
+ asCScriptFunction *f = engine->registeredGlobalFuncs.Get(idxs2[n]);
+
+ // Verify if the module has access to the function
+ if( module->m_accessMask & f->accessMask )
+ {
+ funcs.PushLast(f->id);
+ }
+ }
+}
+
+// scope is only informed when looking for a base class' method
+void asCBuilder::GetObjectMethodDescriptions(const char *name, asCObjectType *objectType, asCArray<int> &methods, bool objIsConst, const asCString &scope, asCScriptNode *errNode, asCScriptCode *script)
+{
+ asASSERT(objectType);
+
+ if( scope != "" )
+ {
+ // If searching with a scope informed, then the node and script must also be informed for potential error reporting
+ asASSERT( errNode && script );
+
+ // If the scope contains ::identifier, then use the last identifier as the class name and the rest of it as the namespace
+ // TODO: child funcdef: A scope can include a template type, e.g. array<ns::type>
+ int n = scope.FindLast("::");
+ asCString className = n >= 0 ? scope.SubString(n+2) : scope;
+ asCString nsName = n >= 0 ? scope.SubString(0, n) : asCString("");
+
+ // If a namespace was specifically defined, then this must be used
+ asSNameSpace *ns = 0;
+ if (n >= 0)
+ {
+ if (nsName == "")
+ ns = engine->nameSpaces[0];
+ else
+ ns = GetNameSpaceByString(nsName, objectType->nameSpace, errNode, script, 0, false);
+
+ // If the namespace isn't found return silently and let the calling
+ // function report the error if it cannot resolve the symbol
+ if (ns == 0)
+ return;
+ }
+
+ // Find the base class with the specified scope
+ while (objectType)
+ {
+ // If the name and namespace matches it is the correct class. If no
+ // specific namespace was given, then don't compare the namespace
+ if (objectType->name == className && (ns == 0 || objectType->nameSpace == ns))
+ break;
+
+ objectType = objectType->derivedFrom;
+ }
+
+ // If the scope is not any of the base classes, then return no methods
+ if( objectType == 0 )
+ return;
+ }
+
+ // Find the methods in the object that match the name
+ // TODO: optimize: Improve linear search
+ for( asUINT n = 0; n < objectType->methods.GetLength(); n++ )
+ {
+ asCScriptFunction *func = engine->scriptFunctions[objectType->methods[n]];
+ if( func->name == name &&
+ (!objIsConst || func->IsReadOnly()) &&
+ (func->accessMask & module->m_accessMask) )
+ {
+ // When the scope is defined the returned methods should be the true methods, not the virtual method stubs
+ if( scope == "" )
+ methods.PushLast(engine->scriptFunctions[objectType->methods[n]]->id);
+ else
+ {
+ asCScriptFunction *f = engine->scriptFunctions[objectType->methods[n]];
+ if( f && f->funcType == asFUNC_VIRTUAL )
+ f = objectType->virtualFunctionTable[f->vfTableIdx];
+ methods.PushLast(f->id);
+ }
+ }
+ }
+}
+#endif
+
+void asCBuilder::WriteInfo(const asCString &scriptname, const asCString &message, int r, int c, bool pre)
+{
+ // Need to store the pre message in a structure
+ if( pre )
+ {
+ engine->preMessage.isSet = true;
+ engine->preMessage.c = c;
+ engine->preMessage.r = r;
+ engine->preMessage.message = message;
+ engine->preMessage.scriptname = scriptname;
+ }
+ else
+ {
+ engine->preMessage.isSet = false;
+
+ if( !silent )
+ engine->WriteMessage(scriptname.AddressOf(), r, c, asMSGTYPE_INFORMATION, message.AddressOf());
+ }
+}
+
+void asCBuilder::WriteInfo(const asCString &message, asCScriptCode *file, asCScriptNode *node)
+{
+ int r = 0, c = 0;
+ if( node )
+ file->ConvertPosToRowCol(node->tokenPos, &r, &c);
+
+ WriteInfo(file->name, message, r, c, false);
+}
+
+void asCBuilder::WriteError(const asCString &message, asCScriptCode *file, asCScriptNode *node)
+{
+ int r = 0, c = 0;
+ if( node && file )
+ file->ConvertPosToRowCol(node->tokenPos, &r, &c);
+
+ WriteError(file ? file->name : asCString(""), message, r, c);
+}
+
+void asCBuilder::WriteError(const asCString &scriptname, const asCString &message, int r, int c)
+{
+ numErrors++;
+
+ if( !silent )
+ engine->WriteMessage(scriptname.AddressOf(), r, c, asMSGTYPE_ERROR, message.AddressOf());
+}
+
+void asCBuilder::WriteWarning(const asCString &scriptname, const asCString &message, int r, int c)
+{
+ if( engine->ep.compilerWarnings )
+ {
+ numWarnings++;
+
+ if( !silent )
+ engine->WriteMessage(scriptname.AddressOf(), r, c, asMSGTYPE_WARNING, message.AddressOf());
+ }
+}
+
+void asCBuilder::WriteWarning(const asCString &message, asCScriptCode *file, asCScriptNode *node)
+{
+ int r = 0, c = 0;
+ if( node && file )
+ file->ConvertPosToRowCol(node->tokenPos, &r, &c);
+
+ WriteWarning(file ? file->name : asCString(""), message, r, c);
+}
+
+// TODO: child funcdef: Should try to eliminate this function. GetNameSpaceFromNode is more complete
+asCString asCBuilder::GetScopeFromNode(asCScriptNode *node, asCScriptCode *script, asCScriptNode **next)
+{
+ if (node->nodeType != snScope)
+ {
+ if (next)
+ *next = node;
+ return "";
+ }
+
+ asCString scope;
+ asCScriptNode *sn = node->firstChild;
+ if( sn->tokenType == ttScope )
+ {
+ scope = "::";
+ sn = sn->next;
+ }
+
+ // TODO: child funcdef: A scope can have a template type as the innermost
+ while( sn && sn->next && sn->next->tokenType == ttScope )
+ {
+ asCString tmp;
+ tmp.Assign(&script->code[sn->tokenPos], sn->tokenLength);
+ if( scope != "" && scope != "::" )
+ scope += "::";
+ scope += tmp;
+ sn = sn->next->next;
+ }
+
+ if( next )
+ *next = node->next;
+
+ return scope;
+}
+
+asSNameSpace *asCBuilder::GetNameSpaceFromNode(asCScriptNode *node, asCScriptCode *script, asSNameSpace *implicitNs, asCScriptNode **next, asCObjectType **objType)
+{
+ if (objType)
+ *objType = 0;
+
+ // If no scope has been informed, then return the implicit namespace
+ if (node->nodeType != snScope)
+ {
+ if (next)
+ *next = node;
+ return implicitNs ? implicitNs : engine->nameSpaces[0];
+ }
+
+ if (next)
+ *next = node->next;
+
+ asCString scope;
+ asCScriptNode *sn = node->firstChild;
+ if (sn && sn->tokenType == ttScope)
+ {
+ scope = "::";
+ sn = sn->next;
+ }
+
+ while (sn)
+ {
+ if (sn->next->tokenType == ttScope)
+ {
+ asCString tmp;
+ tmp.Assign(&script->code[sn->tokenPos], sn->tokenLength);
+ if (scope != "" && scope != "::")
+ scope += "::";
+ scope += tmp;
+ sn = sn->next->next;
+ }
+ else
+ {
+ // This is a template type
+ asASSERT(sn->next->nodeType == snDataType);
+
+ asSNameSpace *ns = implicitNs;
+ if (scope != "")
+ ns = engine->FindNameSpace(scope.AddressOf());
+
+ asCString templateName(&script->code[sn->tokenPos], sn->tokenLength);
+ asCObjectType *templateType = GetObjectType(templateName.AddressOf(), ns);
+ if (templateType == 0 || (templateType->flags & asOBJ_TEMPLATE) == 0)
+ {
+ // TODO: child funcdef: Report error
+ return ns;
+ }
+
+ if (objType)
+ *objType = GetTemplateInstanceFromNode(sn, script, templateType, implicitNs, 0);
+
+ // Return no namespace, since this is an object type
+ return 0;
+ }
+ }
+
+ asCTypeInfo *ti = 0;
+ asSNameSpace *ns = GetNameSpaceByString(scope, implicitNs ? implicitNs : engine->nameSpaces[0], node, script, &ti);
+ if (ti && objType)
+ *objType = CastToObjectType(ti);
+ return ns;
+}
+
+asSNameSpace *asCBuilder::GetNameSpaceByString(const asCString &nsName, asSNameSpace *implicitNs, asCScriptNode *errNode, asCScriptCode *script, asCTypeInfo **scopeType, bool isRequired)
+{
+ if( scopeType )
+ *scopeType = 0;
+
+ asSNameSpace *ns = implicitNs;
+ if( nsName == "::" )
+ ns = engine->nameSpaces[0];
+ else if( nsName != "" )
+ {
+ ns = engine->FindNameSpace(nsName.AddressOf());
+ if (ns == 0 && scopeType)
+ {
+ asCString typeName;
+ asCString searchNs;
+
+ // Split the scope with at the inner most ::
+ int pos = nsName.FindLast("::");
+ bool recursive = false;
+ if (pos >= 0)
+ {
+ // Fully qualified namespace
+ typeName = nsName.SubString(pos + 2);
+ searchNs = nsName.SubString(0, pos);
+ }
+ else
+ {
+ // Partially qualified, use the implicit namespace and then search recursively for the type
+ typeName = nsName;
+ searchNs = implicitNs->name;
+ recursive = true;
+ }
+
+ asSNameSpace *nsTmp = searchNs == "::" ? engine->nameSpaces[0] : engine->FindNameSpace(searchNs.AddressOf());
+ asCTypeInfo *ti = 0;
+ while( !ti && nsTmp )
+ {
+ // Check if the typeName is an existing type in the namespace
+ ti = GetType(typeName.AddressOf(), nsTmp, 0);
+ if (ti)
+ {
+ // The informed scope is not a namespace, but it does match a type
+ *scopeType = ti;
+ return 0;
+ }
+ nsTmp = recursive ? engine->GetParentNameSpace(nsTmp) : 0;
+ }
+ }
+
+ if (ns == 0 && isRequired)
+ {
+ asCString msg;
+ msg.Format(TXT_NAMESPACE_s_DOESNT_EXIST, nsName.AddressOf());
+ WriteError(msg, script, errNode);
+ }
+ }
+
+ return ns;
+}
+
+asCDataType asCBuilder::CreateDataTypeFromNode(asCScriptNode *node, asCScriptCode *file, asSNameSpace *implicitNamespace, bool acceptHandleForScope, asCObjectType *currentType, bool reportError, bool *isValid)
+{
+ asASSERT(node->nodeType == snDataType || node->nodeType == snIdentifier || node->nodeType == snScope );
+
+ asCDataType dt;
+
+ asCScriptNode *n = node->firstChild;
+
+ if (isValid)
+ *isValid = true;
+
+ // If the informed node is an identifier or scope, then the
+ // datatype should be identified directly from that
+ if (node->nodeType != snDataType)
+ n = node;
+
+ bool isConst = false;
+ bool isImplicitHandle = false;
+ if( n->tokenType == ttConst )
+ {
+ isConst = true;
+ n = n->next;
+ }
+
+ // Determine namespace (or parent type) to search for the data type in
+ asCObjectType *parentType = 0;
+ asSNameSpace *ns = GetNameSpaceFromNode(n, file, implicitNamespace, &n, &parentType);
+ if( ns == 0 && parentType == 0 )
+ {
+ // The namespace and parent type doesn't exist. Return a dummy type instead.
+ dt = asCDataType::CreatePrimitive(ttInt, false);
+ if (isValid)
+ *isValid = false;
+ return dt;
+ }
+
+ if( n->tokenType == ttIdentifier )
+ {
+ bool found = false;
+
+ asCString str;
+ str.Assign(&file->code[n->tokenPos], n->tokenLength);
+
+ // Recursively search parent namespaces for matching type
+ asSNameSpace *origNs = ns;
+ asCObjectType *origParentType = parentType;
+ while( (ns || parentType) && !found )
+ {
+ asCTypeInfo *ti = 0;
+
+ if (currentType)
+ {
+ // If this is for a template type, then we must first determine if the
+ // identifier matches any of the template subtypes
+ if (currentType->flags & asOBJ_TEMPLATE)
+ {
+ for (asUINT subtypeIndex = 0; subtypeIndex < currentType->templateSubTypes.GetLength(); subtypeIndex++)
+ {
+ asCTypeInfo *type = currentType->templateSubTypes[subtypeIndex].GetTypeInfo();
+ if (type && str == type->name)
+ {
+ ti = type;
+ break;
+ }
+ }
+ }
+
+ if (ti == 0)
+ {
+ // Check if the type is a child type of the current type
+ ti = GetFuncDef(str.AddressOf(), 0, currentType);
+ if (ti)
+ {
+ dt = asCDataType::CreateType(ti, false);
+ found = true;
+ }
+ }
+ }
+
+ if( ti == 0 )
+ ti = GetType(str.AddressOf(), ns, parentType);
+ if( ti == 0 && !module && currentType )
+ ti = GetTypeFromTypesKnownByObject(str.AddressOf(), currentType);
+
+ if( ti && !found )
+ {
+ found = true;
+
+ if( ti->flags & asOBJ_IMPLICIT_HANDLE )
+ isImplicitHandle = true;
+
+ // Make sure the module has access to the object type
+ if( !module || (module->m_accessMask & ti->accessMask) )
+ {
+ if( asOBJ_TYPEDEF == (ti->flags & asOBJ_TYPEDEF) )
+ {
+ // TODO: typedef: A typedef should be considered different from the original type (though with implicit conversions between the two)
+ // Create primitive data type based on object flags
+ dt = CastToTypedefType(ti)->aliasForType;
+ dt.MakeReadOnly(isConst);
+ }
+ else
+ {
+ if( ti->flags & asOBJ_TEMPLATE )
+ {
+ ti = GetTemplateInstanceFromNode(n, file, CastToObjectType(ti), implicitNamespace, currentType, &n);
+ if (ti == 0)
+ {
+ if (isValid)
+ *isValid = false;
+
+ // Return a dummy
+ return asCDataType::CreatePrimitive(ttInt, false);
+ }
+ }
+ else if( n && n->next && n->next->nodeType == snDataType )
+ {
+ if (reportError)
+ {
+ asCString msg;
+ msg.Format(TXT_TYPE_s_NOT_TEMPLATE, ti->name.AddressOf());
+ WriteError(msg, file, n);
+ }
+ if (isValid)
+ *isValid = false;
+ }
+
+ // Create object data type
+ if( ti )
+ dt = asCDataType::CreateType(ti, isConst);
+ else
+ dt = asCDataType::CreatePrimitive(ttInt, isConst);
+ }
+ }
+ else
+ {
+ if (reportError)
+ {
+ asCString msg;
+ msg.Format(TXT_TYPE_s_NOT_AVAILABLE_FOR_MODULE, (const char *)str.AddressOf());
+ WriteError(msg, file, n);
+ }
+
+ dt.SetTokenType(ttInt);
+ if (isValid)
+ *isValid = false;
+ }
+ }
+
+ if( !found )
+ {
+ // Try to find it in the parent namespace
+ if( ns )
+ ns = engine->GetParentNameSpace(ns);
+ if (parentType)
+ parentType = 0;
+ }
+ }
+
+ if( !found )
+ {
+ if (reportError)
+ {
+ asCString msg;
+ if (origNs && origNs->name == "")
+ msg.Format(TXT_IDENTIFIER_s_NOT_DATA_TYPE_IN_GLOBAL_NS, str.AddressOf());
+ else if (origNs)
+ msg.Format(TXT_IDENTIFIER_s_NOT_DATA_TYPE_IN_NS_s, str.AddressOf(), origNs->name.AddressOf());
+ else
+ {
+ // TODO: child funcdef: Message should explain that the identifier is not a type of the parent type
+ asCDataType pt = asCDataType::CreateType(origParentType, false);
+ msg.Format(TXT_IDENTIFIER_s_NOT_DATA_TYPE_IN_NS_s, str.AddressOf(), pt.Format(origParentType->nameSpace, false).AddressOf());
+ }
+ WriteError(msg, file, n);
+ }
+
+ dt = asCDataType::CreatePrimitive(ttInt, isConst);
+ if (isValid)
+ *isValid = false;
+ return dt;
+ }
+ }
+ else if( n->tokenType == ttAuto )
+ {
+ dt = asCDataType::CreateAuto(isConst);
+ }
+ else
+ {
+ // Create primitive data type
+ dt = asCDataType::CreatePrimitive(n->tokenType, isConst);
+ }
+
+ // Determine array dimensions and object handles
+ n = n->next;
+ while( n && (n->tokenType == ttOpenBracket || n->tokenType == ttHandle) )
+ {
+ if( n->tokenType == ttOpenBracket )
+ {
+ if (isImplicitHandle)
+ {
+ // Make the type a handle
+ if (dt.MakeHandle(true, acceptHandleForScope) < 0)
+ {
+ if (reportError)
+ WriteError(TXT_OBJECT_HANDLE_NOT_SUPPORTED, file, n);
+ if (isValid)
+ *isValid = false;
+ }
+ isImplicitHandle = false;
+ }
+
+ // Make sure the sub type can be instantiated
+ if( !dt.CanBeInstantiated() )
+ {
+ if (reportError)
+ {
+ asCString str;
+ if (dt.IsAbstractClass())
+ str.Format(TXT_ABSTRACT_CLASS_s_CANNOT_BE_INSTANTIATED, dt.Format(ns).AddressOf());
+ else if (dt.IsInterface())
+ str.Format(TXT_INTERFACE_s_CANNOT_BE_INSTANTIATED, dt.Format(ns).AddressOf());
+ else
+ // TODO: Improve error message to explain why
+ str.Format(TXT_DATA_TYPE_CANT_BE_s, dt.Format(ns).AddressOf());
+
+ WriteError(str, file, n);
+ }
+ if (isValid)
+ *isValid = false;
+ }
+
+ // Make the type an array (or multidimensional array)
+ if( dt.MakeArray(engine, module) < 0 )
+ {
+ if( reportError )
+ WriteError(TXT_NO_DEFAULT_ARRAY_TYPE, file, n);
+ if (isValid)
+ *isValid = false;
+ break;
+ }
+ }
+ else
+ {
+ // Make the type a handle
+ if( dt.IsObjectHandle() )
+ {
+ if( reportError )
+ WriteError(TXT_HANDLE_OF_HANDLE_IS_NOT_ALLOWED, file, n);
+ if (isValid)
+ *isValid = false;
+ break;
+ }
+ else
+ {
+ if( dt.MakeHandle(true, acceptHandleForScope) < 0 )
+ {
+ if( reportError )
+ WriteError(TXT_OBJECT_HANDLE_NOT_SUPPORTED, file, n);
+ if (isValid)
+ *isValid = false;
+ break;
+ }
+
+ // Check if the handle should be read-only
+ if( n && n->next && n->next->tokenType == ttConst )
+ dt.MakeReadOnly(true);
+ }
+ }
+ n = n->next;
+ }
+
+ if( isImplicitHandle )
+ {
+ // Make the type a handle
+ if (dt.MakeHandle(true, acceptHandleForScope) < 0)
+ {
+ if( reportError )
+ WriteError(TXT_OBJECT_HANDLE_NOT_SUPPORTED, file, n);
+ if (isValid)
+ *isValid = false;
+ }
+ }
+
+ return dt;
+}
+
+asCObjectType *asCBuilder::GetTemplateInstanceFromNode(asCScriptNode *node, asCScriptCode *file, asCObjectType *templateType, asSNameSpace *implicitNamespace, asCObjectType *currentType, asCScriptNode **next)
+{
+ // Check if the subtype is a type or the template's subtype
+ // if it is the template's subtype then this is the actual template type,
+ // orderwise it is a template instance.
+ // Only do this for application registered interface, as the
+ // scripts cannot implement templates.
+ asCArray<asCDataType> subTypes;
+ asUINT subtypeIndex;
+ asCScriptNode *n = node;
+ while (n && n->next && n->next->nodeType == snDataType)
+ {
+ n = n->next;
+
+ // When parsing function definitions for template registrations (currentType != 0) it is necessary
+ // to pass in the current template type to the recursive call since it is this ones sub-template types
+ // that should be allowed.
+ asCDataType subType = CreateDataTypeFromNode(n, file, implicitNamespace, false, module ? 0 : (currentType ? currentType : templateType));
+ subTypes.PushLast(subType);
+
+ if (subType.IsReadOnly())
+ {
+ asCString msg;
+ msg.Format(TXT_TMPL_SUBTYPE_MUST_NOT_BE_READ_ONLY);
+ WriteError(msg, file, n);
+
+ // Return a dummy
+ return 0;
+ }
+ }
+
+ if (next)
+ *next = n;
+
+ if (subTypes.GetLength() != templateType->templateSubTypes.GetLength())
+ {
+ asCString msg;
+ msg.Format(TXT_TMPL_s_EXPECTS_d_SUBTYPES, templateType->name.AddressOf(), int(templateType->templateSubTypes.GetLength()));
+ WriteError(msg, file, node);
+
+ // Return a dummy
+ return 0;
+ }
+
+ // Check if any of the given subtypes are different from the template's declared subtypes
+ bool isDifferent = false;
+ for (subtypeIndex = 0; subtypeIndex < subTypes.GetLength(); subtypeIndex++)
+ {
+ if (subTypes[subtypeIndex].GetTypeInfo() != templateType->templateSubTypes[subtypeIndex].GetTypeInfo())
+ {
+ isDifferent = true;
+ break;
+ }
+ }
+
+ if (isDifferent)
+ {
+ // This is a template instance
+ // Need to find the correct object type
+ asCObjectType *otInstance = engine->GetTemplateInstanceType(templateType, subTypes, module);
+
+ if (otInstance && otInstance->scriptSectionIdx < 0)
+ {
+ // If this is the first time the template instance is used, store where it was declared from
+ otInstance->scriptSectionIdx = engine->GetScriptSectionNameIndex(file->name.AddressOf());
+ int row, column;
+ file->ConvertPosToRowCol(n->tokenPos, &row, &column);
+ otInstance->declaredAt = (row & 0xFFFFF) | (column << 20);
+ }
+
+ if (!otInstance)
+ {
+ asCString sub = subTypes[0].Format(templateType->nameSpace);
+ for (asUINT s = 1; s < subTypes.GetLength(); s++)
+ {
+ sub += ",";
+ sub += subTypes[s].Format(templateType->nameSpace);
+ }
+ asCString msg;
+ msg.Format(TXT_INSTANCING_INVLD_TMPL_TYPE_s_s, templateType->name.AddressOf(), sub.AddressOf());
+ WriteError(msg, file, n);
+ }
+
+ return otInstance;
+ }
+
+ return templateType;
+}
+
+asCDataType asCBuilder::ModifyDataTypeFromNode(const asCDataType &type, asCScriptNode *node, asCScriptCode *file, asETypeModifiers *inOutFlags, bool *autoHandle)
+{
+ asCDataType dt = type;
+
+ if( inOutFlags ) *inOutFlags = asTM_NONE;
+
+ // Is the argument sent by reference?
+ asCScriptNode *n = node->firstChild;
+ if( n && n->tokenType == ttAmp )
+ {
+ if (dt.GetTokenType() == ttVoid)
+ {
+ asCString msg;
+ msg.Format(TXT_TYPE_s_CANNOT_BE_REFERENCE, type.Format(0).AddressOf());
+ WriteError(msg, file, node->firstChild);
+ return dt;
+ }
+
+ dt.MakeReference(true);
+ n = n->next;
+
+ if( n )
+ {
+ if( inOutFlags )
+ {
+ if( n->tokenType == ttIn )
+ *inOutFlags = asTM_INREF;
+ else if( n->tokenType == ttOut )
+ *inOutFlags = asTM_OUTREF;
+ else if( n->tokenType == ttInOut )
+ *inOutFlags = asTM_INOUTREF;
+ else
+ asASSERT(false);
+ }
+
+ n = n->next;
+ }
+ else
+ {
+ if( inOutFlags )
+ *inOutFlags = asTM_INOUTREF; // ttInOut
+ }
+
+ if( !engine->ep.allowUnsafeReferences &&
+ inOutFlags && *inOutFlags == asTM_INOUTREF &&
+ !(dt.GetTypeInfo() && (dt.GetTypeInfo()->flags & asOBJ_TEMPLATE_SUBTYPE)) )
+ {
+ // Verify that the base type support &inout parameter types
+ if( !dt.IsObject() || dt.IsObjectHandle() ||
+ !((dt.GetTypeInfo()->flags & asOBJ_NOCOUNT) || (CastToObjectType(dt.GetTypeInfo())->beh.addref && CastToObjectType(dt.GetTypeInfo())->beh.release)) )
+ WriteError(TXT_ONLY_OBJECTS_MAY_USE_REF_INOUT, file, node->firstChild);
+ }
+ }
+
+ if( autoHandle ) *autoHandle = false;
+
+ if( n && n->tokenType == ttPlus )
+ {
+ // Autohandles are not supported for types with NOCOUNT
+ // If the type is not a handle then there was an error with building the type, but
+ // this error would already have been reported so no need to report another error here
+ if( dt.IsObjectHandle() && (dt.GetTypeInfo()->flags & asOBJ_NOCOUNT) )
+ WriteError(TXT_AUTOHANDLE_CANNOT_BE_USED_FOR_NOCOUNT, file, node->firstChild);
+
+ if( autoHandle ) *autoHandle = true;
+ }
+
+ if (n && n->tokenType == ttIdentifier)
+ {
+ asCString str;
+ str.Assign(&file->code[n->tokenPos], n->tokenLength);
+ if (str == IF_HANDLE_TOKEN)
+ dt.SetIfHandleThenConst(true);
+ else
+ {
+ // TODO: Should give error if not currently parsing template registration
+ asCString msg;
+ msg.Format(TXT_UNEXPECTED_TOKEN_s, str.AddressOf());
+ WriteError(msg, file, node->firstChild);
+ }
+ }
+
+ return dt;
+}
+
+asCTypeInfo *asCBuilder::GetType(const char *type, asSNameSpace *ns, asCObjectType *parentType)
+{
+ asASSERT((ns == 0 && parentType) || (ns && parentType == 0));
+
+ if (ns)
+ {
+ asCTypeInfo *ti = engine->GetRegisteredType(type, ns);
+ if (!ti && module)
+ ti = module->GetType(type, ns);
+ return ti;
+ }
+ else
+ {
+ // Recursively check base classes
+ asCObjectType *currType = parentType;
+ while (currType)
+ {
+ for (asUINT n = 0; n < currType->childFuncDefs.GetLength(); n++)
+ {
+ asCFuncdefType *funcDef = currType->childFuncDefs[n];
+ if (funcDef && funcDef->name == type)
+ return funcDef;
+ }
+ currType = currType->derivedFrom;
+ }
+ }
+
+ return 0;
+}
+
+asCObjectType *asCBuilder::GetObjectType(const char *type, asSNameSpace *ns)
+{
+ return CastToObjectType(GetType(type, ns, 0));
+}
+
+#ifndef AS_NO_COMPILER
+// This function will return true if there are any types in the engine or module
+// with the given name. The namespace is ignored in this verification.
+bool asCBuilder::DoesTypeExist(const asCString &type)
+{
+ asUINT n;
+
+ // This function is only used when parsing expressions for building bytecode
+ // and this is only done after all types are known. For this reason the types
+ // can be safely cached in a map for quick lookup. Once the builder is released
+ // the cache will also be destroyed thus avoiding unnecessary memory consumption.
+ if( !hasCachedKnownTypes )
+ {
+ // Only do this once
+ hasCachedKnownTypes = true;
+
+ // Add registered types
+ asSMapNode<asSNameSpaceNamePair, asCTypeInfo*> *cursor;
+ engine->allRegisteredTypes.MoveFirst(&cursor);
+ while( cursor )
+ {
+ if( !knownTypes.MoveTo(0, cursor->key.name) )
+ knownTypes.Insert(cursor->key.name, true);
+
+ engine->allRegisteredTypes.MoveNext(&cursor, cursor);
+ }
+
+ if (module)
+ {
+ // Add script classes and interfaces
+ for (n = 0; n < module->m_classTypes.GetLength(); n++)
+ if (!knownTypes.MoveTo(0, module->m_classTypes[n]->name))
+ knownTypes.Insert(module->m_classTypes[n]->name, true);
+
+ // Add script enums
+ for (n = 0; n < module->m_enumTypes.GetLength(); n++)
+ if (!knownTypes.MoveTo(0, module->m_enumTypes[n]->name))
+ knownTypes.Insert(module->m_enumTypes[n]->name, true);
+
+ // Add script typedefs
+ for (n = 0; n < module->m_typeDefs.GetLength(); n++)
+ if (!knownTypes.MoveTo(0, module->m_typeDefs[n]->name))
+ knownTypes.Insert(module->m_typeDefs[n]->name, true);
+
+ // Add script funcdefs
+ for (n = 0; n < module->m_funcDefs.GetLength(); n++)
+ if (!knownTypes.MoveTo(0, module->m_funcDefs[n]->name))
+ knownTypes.Insert(module->m_funcDefs[n]->name, true);
+ }
+ }
+
+ // Check if the type is known
+ return knownTypes.MoveTo(0, type);
+}
+#endif
+
+asCTypeInfo *asCBuilder::GetTypeFromTypesKnownByObject(const char *type, asCObjectType *currentType)
+{
+ if (currentType->name == type)
+ return currentType;
+
+ asUINT n;
+
+ asCTypeInfo *found = 0;
+
+ for (n = 0; found == 0 && n < currentType->properties.GetLength(); n++)
+ if (currentType->properties[n]->type.GetTypeInfo() &&
+ currentType->properties[n]->type.GetTypeInfo()->name == type)
+ found = currentType->properties[n]->type.GetTypeInfo();
+
+ for (n = 0; found == 0 && n < currentType->methods.GetLength(); n++)
+ {
+ asCScriptFunction *func = engine->scriptFunctions[currentType->methods[n]];
+ if (func->returnType.GetTypeInfo() &&
+ func->returnType.GetTypeInfo()->name == type)
+ found = func->returnType.GetTypeInfo();
+
+ for (asUINT f = 0; found == 0 && f < func->parameterTypes.GetLength(); f++)
+ if (func->parameterTypes[f].GetTypeInfo() &&
+ func->parameterTypes[f].GetTypeInfo()->name == type)
+ found = func->parameterTypes[f].GetTypeInfo();
+ }
+
+ if (found)
+ {
+ // In case we find a template instance it mustn't be returned
+ // because it is not known if the subtype is really matching
+ if (found->flags & asOBJ_TEMPLATE)
+ return 0;
+ }
+
+ return found;
+}
+
+asCFuncdefType *asCBuilder::GetFuncDef(const char *type, asSNameSpace *ns, asCObjectType *parentType)
+{
+ asASSERT((ns == 0 && parentType) || (ns && parentType == 0));
+
+ if (ns)
+ {
+ for (asUINT n = 0; n < engine->registeredFuncDefs.GetLength(); n++)
+ {
+ asCFuncdefType *funcDef = engine->registeredFuncDefs[n];
+ // TODO: access: Only return the definitions that the module has access to
+ if (funcDef && funcDef->nameSpace == ns && funcDef->name == type)
+ return funcDef;
+ }
+
+ if (module)
+ {
+ for (asUINT n = 0; n < module->m_funcDefs.GetLength(); n++)
+ {
+ asCFuncdefType *funcDef = module->m_funcDefs[n];
+ if (funcDef && funcDef->nameSpace == ns && funcDef->name == type)
+ return funcDef;
+ }
+ }
+ }
+ else
+ {
+ // Recursively check base classes
+ asCObjectType *currType = parentType;
+ while (currType)
+ {
+ for (asUINT n = 0; n < currType->childFuncDefs.GetLength(); n++)
+ {
+ asCFuncdefType *funcDef = currType->childFuncDefs[n];
+ if (funcDef && funcDef->name == type)
+ return funcDef;
+ }
+ currType = currType->derivedFrom;
+ }
+ }
+
+ return 0;
+}
+
+#ifndef AS_NO_COMPILER
+
+int asCBuilder::GetEnumValueFromType(asCEnumType *type, const char *name, asCDataType &outDt, asDWORD &outValue)
+{
+ if( !type || !(type->flags & asOBJ_ENUM) )
+ return 0;
+
+ for( asUINT n = 0; n < type->enumValues.GetLength(); ++n )
+ {
+ if( type->enumValues[n]->name == name )
+ {
+ outDt = asCDataType::CreateType(type, true);
+ outValue = type->enumValues[n]->value;
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+int asCBuilder::GetEnumValue(const char *name, asCDataType &outDt, asDWORD &outValue, asSNameSpace *ns)
+{
+ bool found = false;
+
+ // Search all available enum types
+ asUINT t;
+ for( t = 0; t < engine->registeredEnums.GetLength(); t++ )
+ {
+ asCEnumType *et = engine->registeredEnums[t];
+ if( ns != et->nameSpace ) continue;
+
+ // Don't bother with types the module doesn't have access to
+ if( (et->accessMask & module->m_accessMask) == 0 )
+ continue;
+
+ if( GetEnumValueFromType(et, name, outDt, outValue) )
+ {
+ if( !found )
+ found = true;
+ else
+ {
+ // Found more than one value in different enum types
+ return 2;
+ }
+ }
+ }
+
+ for( t = 0; t < module->m_enumTypes.GetLength(); t++ )
+ {
+ asCEnumType *et = module->m_enumTypes[t];
+ if( ns != et->nameSpace ) continue;
+
+ if( GetEnumValueFromType(et, name, outDt, outValue) )
+ {
+ if( !found )
+ found = true;
+ else
+ {
+ // Found more than one value in different enum types
+ return 2;
+ }
+ }
+ }
+
+ if( found )
+ return 1;
+
+ // Didn't find any value
+ return 0;
+}
+
+#endif // AS_NO_COMPILER
+
+END_AS_NAMESPACE
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_builder.h b/engines/hpl1/engine/libraries/angelscript/sources/as_builder.h
new file mode 100644
index 00000000000..d20270da30d
--- /dev/null
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_builder.h
@@ -0,0 +1,262 @@
+/*
+ AngelCode Scripting Library
+ Copyright (c) 2003-2021 Andreas Jonsson
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any
+ damages arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any
+ purpose, including commercial applications, and to alter it and
+ redistribute it freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you
+ must not claim that you wrote the original software. If you use
+ this software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and
+ must not be misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source
+ distribution.
+
+ The original version of this library can be located at:
+ http://www.angelcode.com/angelscript/
+
+ Andreas Jonsson
+ andreas at angelcode.com
+*/
+
+
+//
+// as_builder.h
+//
+// This is the class that manages the compilation of the scripts
+//
+
+
+#ifndef AS_BUILDER_H
+#define AS_BUILDER_H
+
+#include "as_config.h"
+#include "as_symboltable.h"
+#include "as_scriptengine.h"
+#include "as_module.h"
+#include "as_memory.h"
+#include "as_scriptcode.h"
+#include "as_scriptnode.h"
+#include "as_datatype.h"
+#include "as_property.h"
+
+BEGIN_AS_NAMESPACE
+
+#ifdef AS_NO_COMPILER
+// Forward declare the structure, as it is part of some function signatures used even without the compiler
+struct sGlobalVariableDescription;
+#endif
+
+#ifndef AS_NO_COMPILER
+
+struct sFunctionDescription
+{
+ asCScriptCode *script;
+ asCScriptNode *node;
+ asCString name;
+ asCObjectType *objType;
+ asCArray<asCString> paramNames;
+ int funcId;
+ bool isExistingShared;
+};
+
+struct sGlobalVariableDescription
+{
+ asCScriptCode *script;
+ asCScriptNode *declaredAtNode;
+ asCScriptNode *initializationNode;
+ asCString name;
+ asCGlobalProperty *property;
+ asCDataType datatype;
+ asSNameSpace *ns;
+ int index;
+ bool isCompiled;
+ bool isPureConstant;
+ bool isEnumValue;
+ asQWORD constantValue;
+};
+
+struct sPropertyInitializer
+{
+ sPropertyInitializer() : declNode(0), initNode(0), file(0) {}
+ sPropertyInitializer(const asCString &nm, asCScriptNode *decl, asCScriptNode *init, asCScriptCode *f) : name(nm), declNode(decl), initNode(init), file(f) {}
+ sPropertyInitializer &operator=(const sPropertyInitializer &o) {name = o.name; declNode = o.declNode; initNode = o.initNode; file = o.file; return *this;}
+
+ asCString name;
+ asCScriptNode *declNode;
+ asCScriptNode *initNode;
+ asCScriptCode *file;
+};
+
+struct sClassDeclaration
+{
+ sClassDeclaration() {script = 0; node = 0; validState = 0; typeInfo = 0; isExistingShared = false; isFinal = false;}
+
+ asCScriptCode *script;
+ asCScriptNode *node;
+ asCString name;
+ int validState;
+ asCTypeInfo *typeInfo;
+ bool isExistingShared;
+ bool isFinal;
+
+ asCArray<sPropertyInitializer> propInits;
+};
+
+struct sFuncDef
+{
+ asCScriptCode *script;
+ asCScriptNode *node;
+ asCString name;
+ int idx;
+};
+
+struct sMixinClass
+{
+ asCScriptCode *script;
+ asCScriptNode *node;
+ asCString name;
+ asSNameSpace *ns;
+};
+
+#endif // AS_NO_COMPILER
+
+class asCBuilder
+{
+public:
+ asCBuilder(asCScriptEngine *engine, asCModule *module);
+ ~asCBuilder();
+
+ // These methods are used by the application interface
+ int VerifyProperty(asCDataType *dt, const char *decl, asCString &outName, asCDataType &outType, asSNameSpace *ns);
+ int ParseDataType(const char *datatype, asCDataType *result, asSNameSpace *implicitNamespace, bool isReturnType = false);
+ int ParseTemplateDecl(const char *decl, asCString *name, asCArray<asCString> &subtypeNames);
+ int ParseFunctionDeclaration(asCObjectType *type, const char *decl, asCScriptFunction *func, bool isSystemFunction, asCArray<bool> *paramAutoHandles = 0, bool *returnAutoHandle = 0, asSNameSpace *ns = 0, asCScriptNode **outListPattern = 0, asCObjectType **outParentClass = 0);
+ int ParseVariableDeclaration(const char *decl, asSNameSpace *implicitNamespace, asCString &outName, asSNameSpace *&outNamespace, asCDataType &outDt);
+ int CheckNameConflict(const char *name, asCScriptNode *node, asCScriptCode *code, asSNameSpace *ns, bool isProperty, bool isVirtualProperty);
+ int CheckNameConflictMember(asCTypeInfo *type, const char *name, asCScriptNode *node, asCScriptCode *code, bool isProperty, bool isVirtualProperty);
+ int ValidateVirtualProperty(asCScriptFunction *func);
+
+#ifndef AS_NO_COMPILER
+ int AddCode(const char *name, const char *code, int codeLength, int lineOffset, int sectionIdx, bool makeCopy);
+ asCScriptCode *FindOrAddCode(const char *name, const char *code, size_t length);
+ int Build();
+
+ int CompileFunction(const char *sectionName, const char *code, int lineOffset, asDWORD compileFlags, asCScriptFunction **outFunc);
+ int CompileGlobalVar(const char *sectionName, const char *code, int lineOffset);
+#endif
+
+protected:
+ friend class asCModule;
+ friend class asCParser;
+ friend class asCScriptFunction;
+ friend class asCScriptEngine;
+
+ void Reset();
+
+ void WriteInfo(const asCString &scriptname, const asCString &msg, int r, int c, bool preMessage);
+ void WriteInfo(const asCString &msg, asCScriptCode *file, asCScriptNode *node);
+ void WriteError(const asCString &scriptname, const asCString &msg, int r, int c);
+ void WriteError(const asCString &msg, asCScriptCode *file, asCScriptNode *node);
+ void WriteWarning(const asCString &scriptname, const asCString &msg, int r, int c);
+ void WriteWarning(const asCString &msg, asCScriptCode *file, asCScriptNode *node);
+
+ bool DoesGlobalPropertyExist(const char *prop, asSNameSpace *ns, asCGlobalProperty **outProp = 0, sGlobalVariableDescription **outDesc = 0, bool *isAppProp = 0);
+ asCGlobalProperty *GetGlobalProperty(const char *prop, asSNameSpace *ns, bool *isCompiled, bool *isPureConstant, asQWORD *constantValue, bool *isAppProp);
+ int ValidateDefaultArgs(asCScriptCode *script, asCScriptNode *node, asCScriptFunction *func);
+ asCString GetCleanExpressionString(asCScriptNode *n, asCScriptCode *file);
+
+ asSNameSpace *GetNameSpaceFromNode(asCScriptNode *node, asCScriptCode *script, asSNameSpace *implicitNs, asCScriptNode **next, asCObjectType **objType = 0);
+ asSNameSpace *GetNameSpaceByString(const asCString &nsName, asSNameSpace *implicitNs, asCScriptNode *errNode, asCScriptCode *script, asCTypeInfo **scopeType = 0, bool isRequired = true);
+ asCString GetScopeFromNode(asCScriptNode *n, asCScriptCode *script, asCScriptNode **next = 0);
+
+ asCTypeInfo *GetType(const char *type, asSNameSpace *ns, asCObjectType *parentType);
+ asCObjectType *GetObjectType(const char *type, asSNameSpace *ns);
+ asCFuncdefType *GetFuncDef(const char *type, asSNameSpace *ns, asCObjectType *parentType);
+ asCTypeInfo *GetTypeFromTypesKnownByObject(const char *type, asCObjectType *currentType);
+ asCDataType CreateDataTypeFromNode(asCScriptNode *node, asCScriptCode *file, asSNameSpace *implicitNamespace, bool acceptHandleForScope = false, asCObjectType *currentType = 0, bool reportError = true, bool *isValid = 0);
+ asCObjectType *GetTemplateInstanceFromNode(asCScriptNode *node, asCScriptCode *file, asCObjectType *templateType, asSNameSpace *implicitNamespace, asCObjectType *currentType, asCScriptNode **next = 0);
+ asCDataType ModifyDataTypeFromNode(const asCDataType &type, asCScriptNode *node, asCScriptCode *file, asETypeModifiers *inOutFlag, bool *autoHandle);
+
+ int numErrors;
+ int numWarnings;
+ bool silent;
+
+ asCScriptEngine *engine;
+ asCModule *module;
+
+#ifndef AS_NO_COMPILER
+protected:
+ friend class asCCompiler;
+
+ int CheckForConflictsDueToDefaultArgs(asCScriptCode *script, asCScriptNode *node, asCScriptFunction *func, asCObjectType *objType);
+ int GetNamespaceAndNameFromNode(asCScriptNode *n, asCScriptCode *script, asSNameSpace *implicitNs, asSNameSpace *&outNs, asCString &outName);
+ int RegisterMixinClass(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
+ sMixinClass *GetMixinClass(const char *name, asSNameSpace *ns);
+ void IncludePropertiesFromMixins(sClassDeclaration *decl);
+ void IncludeMethodsFromMixins(sClassDeclaration *decl);
+ void AddInterfaceToClass(sClassDeclaration *decl, asCScriptNode *errNode, asCObjectType *intf);
+ void AddInterfaceFromMixinToClass(sClassDeclaration *decl, asCScriptNode *errNode, sMixinClass *mixin);
+
+ int RegisterScriptFunctionFromNode(asCScriptNode *node, asCScriptCode *file, asCObjectType *object = 0, bool isInterface = false, bool isGlobalFunction = false, asSNameSpace *ns = 0, bool isExistingShared = false, bool isMixin = false);
+ int RegisterScriptFunction(asCScriptNode *node, asCScriptCode *file, asCObjectType *objType, bool isInterface, bool isGlobalFunction, asSNameSpace *ns, bool isExistingShared, bool isMixin, asCString &name, asCDataType &returnType, asCArray<asCString> ¶meterNames, asCArray<asCDataType> ¶meterTypes, asCArray<asETypeModifiers> &inOutFlags, asCArray<asCString *> &defaultArgs, asSFunctionTraits funcTraits);
+ int RegisterVirtualProperty(asCScriptNode *node, asCScriptCode *file, asCObjectType *object = 0, bool isInterface = false, bool isGlobalFunction = false, asSNameSpace *ns = 0, bool isExistingShared = false);
+ int RegisterImportedFunction(int funcID, asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
+ int RegisterGlobalVar(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
+ int RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
+ int RegisterInterface(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
+ int RegisterEnum(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
+ int RegisterTypedef(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
+ int RegisterFuncDef(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns, asCObjectType *parent);
+ asCScriptFunction *RegisterLambda(asCScriptNode *node, asCScriptCode *file, asCScriptFunction *funcDef, const asCString &name, asSNameSpace *ns, bool isShared);
+ void CompleteFuncDef(sFuncDef *funcDef);
+ void CompileInterfaces();
+ void CompileClasses(asUINT originalNumTempl);
+ void DetermineTypeRelations();
+ void GetParsedFunctionDetails(asCScriptNode *node, asCScriptCode *file, asCObjectType *objType, asCString &name, asCDataType &returnType, asCArray<asCString> ¶meterNames, asCArray<asCDataType> ¶meterTypes, asCArray<asETypeModifiers> &inOutFlags, asCArray<asCString *> &defaultArgs, asSFunctionTraits &traits, asSNameSpace *implicitNamespace);
+ bool DoesMethodExist(asCObjectType *objType, int methodId, asUINT *methodIndex = 0);
+ void AddDefaultConstructor(asCObjectType *objType, asCScriptCode *file);
+ asCObjectProperty *AddPropertyToClass(sClassDeclaration *c, const asCString &name, const asCDataType &type, bool isPrivate, bool isProtected, bool isInherited, asCScriptCode *file = 0, asCScriptNode *node = 0);
+ int CreateVirtualFunction(asCScriptFunction *func, int idx);
+ void ParseScripts();
+ void RegisterTypesFromScript(asCScriptNode *node, asCScriptCode *script, asSNameSpace *ns);
+ void RegisterNonTypesFromScript(asCScriptNode *node, asCScriptCode *script, asSNameSpace *ns);
+ void CompileFunctions();
+ void CompileGlobalVariables();
+ int GetEnumValueFromType(asCEnumType *type, const char *name, asCDataType &outDt, asDWORD &outValue);
+ int GetEnumValue(const char *name, asCDataType &outDt, asDWORD &outValue, asSNameSpace *ns);
+ bool DoesTypeExist(const asCString &type);
+ asCObjectProperty *GetObjectProperty(asCDataType &obj, const char *prop);
+ asCScriptFunction *GetFunctionDescription(int funcId);
+ void GetFunctionDescriptions(const char *name, asCArray<int> &funcs, asSNameSpace *ns);
+ void GetObjectMethodDescriptions(const char *name, asCObjectType *objectType, asCArray<int> &methods, bool objIsConst, const asCString &scope = "", asCScriptNode *errNode = 0, asCScriptCode *script = 0);
+ void EvaluateTemplateInstances(asUINT startIdx, bool keepSilent);
+ void CleanupEnumValues();
+
+ asCArray<asCScriptCode *> scripts;
+ asCArray<sFunctionDescription *> functions;
+ asCSymbolTable<sGlobalVariableDescription> globVariables;
+ asCArray<sClassDeclaration *> classDeclarations;
+ asCArray<sClassDeclaration *> interfaceDeclarations;
+ asCArray<sClassDeclaration *> namedTypeDeclarations;
+ asCArray<sFuncDef *> funcDefs;
+ asCArray<sMixinClass *> mixinClasses;
+
+ // For use with the DoesTypeExists() method
+ bool hasCachedKnownTypes;
+ asCMap<asCString, bool> knownTypes;
+#endif
+};
+
+END_AS_NAMESPACE
+
+#endif
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_bytecode.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_bytecode.cpp
new file mode 100644
index 00000000000..d006d326a38
--- /dev/null
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_bytecode.cpp
@@ -0,0 +1,3023 @@
+/*
+ AngelCode Scripting Library
+ Copyright (c) 2003-2019 Andreas Jonsson
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any
+ damages arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any
+ purpose, including commercial applications, and to alter it and
+ redistribute it freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you
+ must not claim that you wrote the original software. If you use
+ this software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and
+ must not be misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source
+ distribution.
+
+ The original version of this library can be located at:
+ http://www.angelcode.com/angelscript/
+
+ Andreas Jonsson
+ andreas at angelcode.com
+*/
+
+
+//
+// as_bytecode.cpp
+//
+// A class for constructing the final byte code
+//
+
+#include <stdio.h> // fopen(), fprintf(), fclose()
+
+#include "as_config.h"
+
+#ifndef AS_NO_COMPILER
+
+#include "as_bytecode.h"
+#include "as_debug.h" // mkdir()
+#include "as_memory.h"
+#include "as_string.h"
+#include "as_scriptengine.h"
+#include "as_debug.h"
+
+BEGIN_AS_NAMESPACE
+
+asCByteCode::asCByteCode(asCScriptEngine *engine)
+{
+ first = 0;
+ last = 0;
+ largestStackUsed = -1;
+ temporaryVariables = 0;
+
+ this->engine = engine;
+}
+
+asCByteCode::~asCByteCode()
+{
+ ClearAll();
+}
+
+void asCByteCode::Finalize(const asCArray<int> &tempVariableOffsets)
+{
+ temporaryVariables = &tempVariableOffsets;
+
+ // verify the bytecode
+ PostProcess();
+
+ // Optimize the code
+ Optimize();
+
+ // Resolve jumps
+ ResolveJumpAddresses();
+
+ // Build line numbers buffer
+ ExtractLineNumbers();
+}
+
+void asCByteCode::ClearAll()
+{
+ asCByteInstruction *del = first;
+
+ while( del )
+ {
+ first = del->next;
+ engine->memoryMgr.FreeByteInstruction(del);
+ del = first;
+ }
+
+ first = 0;
+ last = 0;
+
+ lineNumbers.SetLength(0);
+
+ largestStackUsed = -1;
+}
+
+void asCByteCode::InsertIfNotExists(asCArray<int> &vars, int var)
+{
+ if( !vars.Exists(var) )
+ vars.PushLast(var);
+}
+
+void asCByteCode::GetVarsUsed(asCArray<int> &vars)
+{
+ TimeIt("asCByteCode::GetVarsUsed");
+
+ asCByteInstruction *curr = first;
+ while( curr )
+ {
+ if( asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG )
+ {
+ InsertIfNotExists(vars, curr->wArg[0]);
+ InsertIfNotExists(vars, curr->wArg[1]);
+ InsertIfNotExists(vars, curr->wArg[2]);
+ }
+ else if( asBCInfo[curr->op].type == asBCTYPE_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_W_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_QW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_W_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_DW_DW_ARG )
+ {
+ InsertIfNotExists(vars, curr->wArg[0]);
+ }
+ else if( asBCInfo[curr->op].type == asBCTYPE_wW_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_rW_DW_ARG )
+ {
+ InsertIfNotExists(vars, curr->wArg[0]);
+ InsertIfNotExists(vars, curr->wArg[1]);
+ }
+ else if( curr->op == asBC_LoadThisR )
+ {
+ InsertIfNotExists(vars, 0);
+ }
+
+ curr = curr->next;
+ }
+}
+
+bool asCByteCode::IsVarUsed(int offset)
+{
+ TimeIt("asCByteCode::IsVarUsed");
+
+ asCByteInstruction *curr = first;
+ while( curr )
+ {
+ // Verify all ops that use variables
+ if( asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG )
+ {
+ if( curr->wArg[0] == offset || curr->wArg[1] == offset || curr->wArg[2] == offset )
+ return true;
+ }
+ else if( asBCInfo[curr->op].type == asBCTYPE_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_W_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_QW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_W_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_DW_DW_ARG )
+ {
+ if( curr->wArg[0] == offset )
+ return true;
+ }
+ else if( asBCInfo[curr->op].type == asBCTYPE_wW_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_rW_DW_ARG )
+ {
+ if( curr->wArg[0] == offset || curr->wArg[1] == offset )
+ return true;
+ }
+ else if( curr->op == asBC_LoadThisR )
+ {
+ if( offset == 0 )
+ return true;
+ }
+
+ curr = curr->next;
+ }
+
+ return false;
+}
+
+void asCByteCode::ExchangeVar(int oldOffset, int newOffset)
+{
+ asASSERT(oldOffset != 0);
+
+ asCByteInstruction *curr = first;
+ while( curr )
+ {
+ // Verify all ops that use variables
+ if( asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG )
+ {
+ if( curr->wArg[0] == oldOffset )
+ curr->wArg[0] = (short)newOffset;
+ if( curr->wArg[1] == oldOffset )
+ curr->wArg[1] = (short)newOffset;
+ if( curr->wArg[2] == oldOffset )
+ curr->wArg[2] = (short)newOffset;
+ }
+ else if( asBCInfo[curr->op].type == asBCTYPE_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_W_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_QW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_W_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_DW_DW_ARG )
+ {
+ if( curr->wArg[0] == oldOffset )
+ curr->wArg[0] = (short)newOffset;
+ }
+ else if( asBCInfo[curr->op].type == asBCTYPE_wW_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_rW_ARG )
+ {
+ if( curr->wArg[0] == oldOffset )
+ curr->wArg[0] = (short)newOffset;
+ if( curr->wArg[1] == oldOffset )
+ curr->wArg[1] = (short)newOffset;
+ }
+
+ curr = curr->next;
+ }
+}
+
+void asCByteCode::AddPath(asCArray<asCByteInstruction *> &paths, asCByteInstruction *instr, int stackSize)
+{
+ if( instr->marked )
+ {
+ // Verify the size of the stack
+ asASSERT(instr->stackSize == stackSize);
+ }
+ else
+ {
+ // Add the destination to the code paths
+ instr->marked = true;
+ instr->stackSize = stackSize;
+ paths.PushLast(instr);
+ }
+}
+
+asCByteInstruction *asCByteCode::ChangeFirstDeleteNext(asCByteInstruction *curr, asEBCInstr bc)
+{
+ curr->op = bc;
+
+ if( curr->next ) DeleteInstruction(curr->next);
+
+ // Continue optimization with the instruction before the altered one
+ if( curr->prev )
+ return curr->prev;
+ else
+ return curr;
+}
+
+asCByteInstruction *asCByteCode::DeleteFirstChangeNext(asCByteInstruction *curr, asEBCInstr bc)
+{
+ asASSERT( curr->next );
+
+ asCByteInstruction *instr = curr->next;
+ instr->op = bc;
+
+ DeleteInstruction(curr);
+
+ // Continue optimization with the instruction before the altered one
+ if( instr->prev )
+ return instr->prev;
+ else
+ return instr;
+}
+
+void asCByteCode::InsertBefore(asCByteInstruction *before, asCByteInstruction *instr)
+{
+ asASSERT(instr->next == 0);
+ asASSERT(instr->prev == 0);
+
+ if( before->prev ) before->prev->next = instr;
+ instr->prev = before->prev;
+ before->prev = instr;
+ instr->next = before;
+
+ if( first == before ) first = instr;
+}
+
+void asCByteCode::RemoveInstruction(asCByteInstruction *instr)
+{
+ if( instr == first ) first = first->next;
+ if( instr == last ) last = last->prev;
+
+ if( instr->prev ) instr->prev->next = instr->next;
+ if( instr->next ) instr->next->prev = instr->prev;
+
+ instr->next = 0;
+ instr->prev = 0;
+}
+
+bool asCByteCode::CanBeSwapped(asCByteInstruction *curr)
+{
+ asASSERT( curr->op == asBC_SwapPtr );
+
+ if( !curr->prev || !curr->prev->prev ) return false;
+
+ asCByteInstruction *b = curr->prev;
+ asCByteInstruction *a = b->prev;
+
+ if( a->op != asBC_PshNull &&
+ a->op != asBC_PshVPtr &&
+ a->op != asBC_PSF )
+ return false;
+
+ if( b->op != asBC_PshNull &&
+ b->op != asBC_PshVPtr &&
+ b->op != asBC_PSF )
+ return false;
+
+ return true;
+}
+
+asCByteInstruction *asCByteCode::GoBack(asCByteInstruction *curr)
+{
+ // Go back 2 instructions
+ if( !curr ) return 0;
+ if( curr->prev ) curr = curr->prev;
+ if( curr->prev ) curr = curr->prev;
+ return curr;
+}
+
+asCByteInstruction *asCByteCode::GoForward(asCByteInstruction *curr)
+{
+ // Go forward 2 instructions
+ if( !curr ) return 0;
+ if( curr->next ) curr = curr->next;
+ if( curr->next ) curr = curr->next;
+ return curr;
+}
+
+bool asCByteCode::PostponeInitOfTemp(asCByteInstruction *curr, asCByteInstruction **next)
+{
+ TimeIt("asCByteCode::PostponeInitOfTemp");
+
+ // This is not done for pointers
+ if( (curr->op != asBC_SetV4 && curr->op != asBC_SetV8) ||
+ !IsTemporary(curr->wArg[0]) ) return false;
+
+ // Move the initialization to just before it's use.
+ // Don't move it beyond any labels or jumps.
+ asCByteInstruction *use = curr->next;
+ while( use )
+ {
+ if( IsTempVarReadByInstr(use, curr->wArg[0]) )
+ break;
+
+ if( IsTempVarOverwrittenByInstr(use, curr->wArg[0]) )
+ return false;
+
+ if( IsInstrJmpOrLabel(use) )
+ return false;
+
+ use = use->next;
+ }
+
+ if( use && use->prev != curr )
+ {
+ asCByteInstruction *orig = curr->next;
+
+ // Move the instruction
+ RemoveInstruction(curr);
+ InsertBefore(use, curr);
+
+ // Try a RemoveUnusedValue to see if it can be combined with the other
+ if( RemoveUnusedValue(curr, 0) )
+ {
+ // Optimizations should continue from the instruction that uses the value
+ *next = orig;
+ return true;
+ }
+
+ // Return the instructions to its original position as it wasn't useful
+ RemoveInstruction(curr);
+ InsertBefore(orig, curr);
+ }
+
+ return false;
+}
+
+bool asCByteCode::RemoveUnusedValue(asCByteInstruction *curr, asCByteInstruction **next)
+{
+ TimeIt("asCByteCode::RemoveUnusedValue");
+
+ asCByteInstruction *dummy;
+ if( next == 0 )
+ next = &dummy;
+
+ // TODO: runtime optimize: Should work for 64bit types as well
+
+ // TODO: runtime optimize: Need a asBCTYPE_rwW_ARG to cover the instructions that read
+ // and write to the same variable. Currently they are considered
+ // as readers only, so they are not optimized away. This includes
+ // NOT, BNOT, IncV, DecV, NEG, iTOf (and all other type casts)
+
+ // The value isn't used for anything
+ if( curr->op != asBC_FREE && // Can't remove the FREE instruction
+ (asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_rW_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_QW_ARG) &&
+ IsTemporary(curr->wArg[0]) &&
+ !IsTempVarRead(curr, curr->wArg[0]) )
+ {
+ if( curr->op == asBC_LdGRdR4 && IsTempRegUsed(curr) )
+ {
+ curr->op = asBC_LDG;
+ *next = GoForward(curr);
+ return true;
+ }
+
+ *next = GoForward(DeleteInstruction(curr));
+ return true;
+ }
+
+ if( curr->op == asBC_SetV4 && curr->next )
+ {
+ // The value is immediately used and then never again
+ if( (curr->next->op == asBC_CMPi ||
+ curr->next->op == asBC_CMPf ||
+ curr->next->op == asBC_CMPu) &&
+ curr->wArg[0] == curr->next->wArg[1] &&
+ IsTemporary(curr->wArg[0]) && // The variable is temporary and never used again
+ !IsTempVarRead(curr->next, curr->wArg[0]) )
+ {
+ if( curr->next->op == asBC_CMPi ) curr->next->op = asBC_CMPIi;
+ else if( curr->next->op == asBC_CMPf ) curr->next->op = asBC_CMPIf;
+ else if( curr->next->op == asBC_CMPu ) curr->next->op = asBC_CMPIu;
+ curr->next->size = asBCTypeSize[asBCInfo[asBC_CMPIi].type];
+ curr->next->arg = curr->arg;
+ *next = GoForward(DeleteInstruction(curr));
+ return true;
+ }
+
+ // The value is immediately used and then never again
+ if( (curr->next->op == asBC_ADDi ||
+ curr->next->op == asBC_SUBi ||
+ curr->next->op == asBC_MULi ||
+ curr->next->op == asBC_ADDf ||
+ curr->next->op == asBC_SUBf ||
+ curr->next->op == asBC_MULf) &&
+ curr->wArg[0] == curr->next->wArg[2] &&
+ (curr->next->wArg[0] == curr->wArg[0] || // The variable is overwritten
+ (IsTemporary(curr->wArg[0]) && // The variable is temporary and never used again
+ !IsTempVarRead(curr->next, curr->wArg[0]))) )
+ {
+ if( curr->next->op == asBC_ADDi ) curr->next->op = asBC_ADDIi;
+ else if( curr->next->op == asBC_SUBi ) curr->next->op = asBC_SUBIi;
+ else if( curr->next->op == asBC_MULi ) curr->next->op = asBC_MULIi;
+ else if( curr->next->op == asBC_ADDf ) curr->next->op = asBC_ADDIf;
+ else if( curr->next->op == asBC_SUBf ) curr->next->op = asBC_SUBIf;
+ else if( curr->next->op == asBC_MULf ) curr->next->op = asBC_MULIf;
+ curr->next->size = asBCTypeSize[asBCInfo[asBC_ADDIi].type];
+ curr->next->arg = curr->arg;
+ *next = GoForward(DeleteInstruction(curr));
+ return true;
+ }
+
+ if( (curr->next->op == asBC_ADDi ||
+ curr->next->op == asBC_MULi ||
+ curr->next->op == asBC_ADDf ||
+ curr->next->op == asBC_MULf) &&
+ curr->wArg[0] == curr->next->wArg[1] &&
+ (curr->next->wArg[0] == curr->wArg[0] || // The variable is overwritten
+ (IsTemporary(curr->wArg[0]) && // The variable is temporary and never used again
+ !IsTempVarRead(curr->next, curr->wArg[0]))) )
+ {
+ if( curr->next->op == asBC_ADDi ) curr->next->op = asBC_ADDIi;
+ else if( curr->next->op == asBC_MULi ) curr->next->op = asBC_MULIi;
+ else if( curr->next->op == asBC_ADDf ) curr->next->op = asBC_ADDIf;
+ else if( curr->next->op == asBC_MULf ) curr->next->op = asBC_MULIf;
+ curr->next->size = asBCTypeSize[asBCInfo[asBC_ADDIi].type];
+ curr->next->arg = curr->arg;
+
+ // The order of the operands are changed
+ curr->next->wArg[1] = curr->next->wArg[2];
+
+ *next = GoForward(DeleteInstruction(curr));
+ return true;
+ }
+
+ // The constant value is immediately moved to another variable and then not used again
+ if( curr->next->op == asBC_CpyVtoV4 &&
+ curr->wArg[0] == curr->next->wArg[1] &&
+ IsTemporary(curr->wArg[0]) &&
+ !IsTempVarRead(curr->next, curr->wArg[0]) )
+ {
+ curr->wArg[0] = curr->next->wArg[0];
+ *next = GoForward(DeleteInstruction(curr->next));
+ return true;
+ }
+
+ // The constant is copied to a temp and then immediately pushed on the stack
+ if( curr->next->op == asBC_PshV4 &&
+ curr->wArg[0] == curr->next->wArg[0] &&
+ IsTemporary(curr->wArg[0]) &&
+ !IsTempVarRead(curr->next, curr->wArg[0]) )
+ {
+ curr->op = asBC_PshC4;
+ curr->stackInc = asBCInfo[asBC_PshC4].stackInc;
+ *next = GoForward(DeleteInstruction(curr->next));
+ return true;
+ }
+
+ // The constant is copied to a global variable and then never used again
+ if( curr->next->op == asBC_CpyVtoG4 &&
+ curr->wArg[0] == curr->next->wArg[0] &&
+ IsTemporary(curr->wArg[0]) &&
+ !IsTempVarRead(curr->next, curr->wArg[0]) )
+ {
+ curr->op = asBC_SetG4;
+ curr->size = asBCTypeSize[asBCInfo[asBC_SetG4].type];
+ *(((asDWORD*)&curr->arg)+AS_PTR_SIZE) = *ARG_DW(curr->arg);
+ *ARG_PTR(curr->arg) = *ARG_PTR(curr->next->arg);
+ *next = GoForward(DeleteInstruction(curr->next));
+ return true;
+ }
+ }
+
+ // The value is immediately moved to another variable and then not used again
+ if( (asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_rW_DW_ARG) &&
+ curr->next && curr->next->op == asBC_CpyVtoV4 &&
+ curr->wArg[0] == curr->next->wArg[1] &&
+ IsTemporary(curr->wArg[0]) &&
+ !IsTempVarRead(curr->next, curr->wArg[0]) )
+ {
+ curr->wArg[0] = curr->next->wArg[0];
+ *next = GoForward(DeleteInstruction(curr->next));
+ return true;
+ }
+
+ // The register is copied to a temp variable and then back to the register again without being used afterwards
+ if( curr->op == asBC_CpyRtoV4 && curr->next && curr->next->op == asBC_CpyVtoR4 &&
+ curr->wArg[0] == curr->next->wArg[0] &&
+ IsTemporary(curr->wArg[0]) &&
+ !IsTempVarRead(curr->next, curr->wArg[0]) )
+ {
+ // Delete both instructions
+ DeleteInstruction(curr->next);
+ *next = GoForward(DeleteInstruction(curr));
+ return true;
+ }
+
+ // The global value is copied to a temp and then immediately pushed on the stack
+ if( curr->op == asBC_CpyGtoV4 && curr->next && curr->next->op == asBC_PshV4 &&
+ curr->wArg[0] == curr->next->wArg[0] &&
+ IsTemporary(curr->wArg[0]) &&
+ !IsTempVarRead(curr->next, curr->wArg[0]) )
+ {
+ curr->op = asBC_PshG4;
+ curr->size = asBCTypeSize[asBCInfo[asBC_PshG4].type];
+ curr->stackInc = asBCInfo[asBC_PshG4].stackInc;
+ *next = GoForward(DeleteInstruction(curr->next));
+ return true;
+ }
+
+ // The constant is assigned to a variable, then the value of the variable
+ // pushed on the stack, and then the variable is never used again
+ if( curr->op == asBC_SetV8 && curr->next && curr->next->op == asBC_PshV8 &&
+ curr->wArg[0] == curr->next->wArg[0] &&
+ IsTemporary(curr->wArg[0]) &&
+ !IsTempVarRead(curr->next, curr->wArg[0]) )
+ {
+ curr->op = asBC_PshC8;
+ curr->stackInc = asBCInfo[asBC_PshC8].stackInc;
+ *next = GoForward(DeleteInstruction(curr->next));
+ return true;
+ }
+
+ return false;
+}
+
+bool asCByteCode::IsTemporary(int offset)
+{
+ TimeIt("asCByteCode::IsTemporary");
+
+ asASSERT(temporaryVariables);
+
+ return temporaryVariables->Exists(offset);
+}
+
+void asCByteCode::OptimizeLocally(const asCArray<int> &tempVariableOffsets)
+{
+ // This function performs the optimizations that doesn't require global knowledge of the
+ // entire function, e.g. replacement of sequences of bytecodes for specialized instructions.
+
+ if( !engine->ep.optimizeByteCode )
+ return;
+
+ temporaryVariables = &tempVariableOffsets;
+
+ // TODO: runtime optimize: VAR + GET... should be optimized if the only instructions between them are trivial, i.e. no
+ // function calls that can suspend the execution.
+
+ // TODO: runtime optimize: Remove temporary copies of handles, when the temp is just copied to yet another location
+
+ // TODO: runtime optimize: A single bytecode for incrementing a variable, comparing, and jumping can probably improve
+ // loops a lot. How often do these loops really occur?
+
+ // TODO: runtime optimize: Need a bytecode BC_AddRef so that BC_CALLSYS doesn't have to be used for this trivial call
+
+ // TODO: optimize: Should possibly do two loops. Some of the checks are best doing by iterating from
+ // the end to beginning, e.g. the removal of unused values. Other checks are best
+ // doing by iterating from the beginning to end, e.g. replacement of sequences with
+ // shorter ones. By doing this, we should be able to avoid backtracking with every
+ // change thus avoid unnecessary duplicate checks.
+
+ // Iterate through the bytecode instructions in the reverse order.
+ // An optimization in an instruction may mean that another instruction before that
+ // can also be optimized, e.g. if an add instruction is removed because the result is not
+ // used, then the instructions that created the operands may potentially also be removed.
+ asCByteInstruction *instr = last;
+ while( instr )
+ {
+ asCByteInstruction *curr = instr;
+ instr = instr->prev;
+
+ // Remove instructions when the result is not used anywhere
+ // This will return true if the instruction is deleted, and
+ // false if it is not deleted. Observe that the instruction
+ // can be modified.
+ if( RemoveUnusedValue(curr, &instr) ) continue;
+
+ // Postpone initializations so that they may be combined in the second pass.
+ // If the initialization is postponed, then the optimizations should continue
+ // from where the value was used, so instr will be updated to point to that.
+ if( PostponeInitOfTemp(curr, &instr) ) continue;
+
+ // Look for sequences that can be replaced with shorter ones
+ const asEBCInstr currOp = curr->op;
+ if( currOp == asBC_SwapPtr )
+ {
+ // XXX x, YYY y, SwapPtr -> YYY y, XXX x
+ if( CanBeSwapped(curr) )
+ {
+ // Delete the SwapPtr
+ DeleteInstruction(curr);
+
+ // Swap instructions
+ asCByteInstruction *a = instr->prev;
+ RemoveInstruction(instr);
+ InsertBefore(a, instr);
+
+ // Continue the optimization from the second instruction
+ instr = GoForward(a);
+ continue;
+ }
+ }
+ else if( currOp == asBC_ClrHi )
+ {
+ // T??, ClrHi -> T??
+ if( instr &&
+ (instr->op == asBC_TZ ||
+ instr->op == asBC_TNZ ||
+ instr->op == asBC_TS ||
+ instr->op == asBC_TNS ||
+ instr->op == asBC_TP ||
+ instr->op == asBC_TNP) )
+ {
+ // Remove the ClrHi instruction since the test
+ // instructions always clear the top bytes anyway
+ instr = GoForward(DeleteInstruction(curr));
+ continue;
+ }
+
+ // ClrHi, JZ -> JLowZ
+ if( curr->next &&
+ curr->next->op == asBC_JZ )
+ {
+ curr->next->op = asBC_JLowZ;
+ instr = GoForward(DeleteInstruction(curr));
+ continue;
+ }
+
+ // ClrHi, JNZ -> JLowNZ
+ if( curr->next &&
+ curr->next->op == asBC_JNZ )
+ {
+ curr->next->op = asBC_JLowNZ;
+ instr = GoForward(DeleteInstruction(curr));
+ continue;
+ }
+ }
+ else if( currOp == asBC_LDV && curr->next )
+ {
+ // LDV x, INCi -> IncVi x
+ if( curr->next->op == asBC_INCi && !IsTempRegUsed(curr->next) )
+ {
+ curr->op = asBC_IncVi;
+ DeleteInstruction(curr->next);
+ instr = GoForward(curr);
+ }
+ // LDV x, DECi -> DecVi x
+ else if( curr->next->op == asBC_DECi && !IsTempRegUsed(curr->next) )
+ {
+ curr->op = asBC_DecVi;
+ DeleteInstruction(curr->next);
+ instr = GoForward(curr);
+ }
+ }
+ else if( currOp == asBC_LDG && curr->next )
+ {
+ // LDG x, WRTV4 y -> CpyVtoG4 y, x
+ if( curr->next->op == asBC_WRTV4 && !IsTempRegUsed(curr->next) )
+ {
+ curr->op = asBC_CpyVtoG4;
+ curr->size = asBCTypeSize[asBCInfo[asBC_CpyVtoG4].type];
+ curr->wArg[0] = curr->next->wArg[0];
+ DeleteInstruction(curr->next);
+ instr = GoForward(curr);
+ }
+ // LDG x, RDR4 y -> CpyGtoV4 y, x
+ else if( curr->next->op == asBC_RDR4 )
+ {
+ if( !IsTempRegUsed(curr->next) )
+ curr->op = asBC_CpyGtoV4;
+ else
+ curr->op = asBC_LdGRdR4;
+ curr->size = asBCTypeSize[asBCInfo[asBC_CpyGtoV4].type];
+ curr->wArg[0] = curr->next->wArg[0];
+ DeleteInstruction(curr->next);
+ instr = GoForward(curr);
+ }
+ }
+ else if( currOp == asBC_CHKREF )
+ {
+ // CHKREF, ADDSi -> ADDSi
+ // CHKREF, RDSPtr -> RDSPtr
+ if( curr->next &&
+ (curr->next->op == asBC_ADDSi || curr->next->op == asBC_RDSPtr) )
+ {
+ // As ADDSi & RDSPtr already checks the pointer the CHKREF instruction is unnecessary
+ instr = GoForward(DeleteInstruction(curr));
+ }
+ // ADDSi, CHKREF -> ADDSi
+ // PGA, CHKREF -> PGA
+ // PSF, CHKREF -> PSF
+ else if( instr &&
+ (instr->op == asBC_ADDSi ||
+ instr->op == asBC_PGA ||
+ instr->op == asBC_PSF) )
+ {
+ // ADDSi is guaranteed to work on valid pointers so CHKREF is not necessary.
+ // PGA and PSF always pushes a valid address on the stack.
+ instr = GoForward(DeleteInstruction(curr));
+ }
+ // PGA, ChkRefS, CHKREF -> PGA, ChkRefS
+ else if( instr && instr->op == asBC_ChkRefS &&
+ instr->prev && instr->prev->op == asBC_PGA )
+ {
+ // Delete CHKREF since PGA always pushes a valid address on the stack
+ instr = GoForward(DeleteInstruction(curr));
+ }
+ }
+ else if( currOp == asBC_PopPtr )
+ {
+ // RDSPtr, PopPtr -> PopPtr
+ if( instr && instr->op == asBC_RDSPtr )
+ {
+ instr = GoForward(DeleteInstruction(instr));
+ }
+ // PshNull, RefCpyV, PopPtr -> FREE
+ else if( instr && instr->op == asBC_RefCpyV &&
+ instr->prev && instr->prev->op == asBC_PshNull )
+ {
+ DeleteInstruction(curr);
+ DeleteInstruction(instr->prev);
+ instr->op = asBC_FREE;
+ instr = GoForward(instr);
+ }
+ // PshVPtr y, PopPtr -> nothing
+ // PSF y , PopPtr -> nothing
+ // VAR y , PopPtr -> nothing
+ // PshNull , PopPtr -> nothing
+ // PshRPtr , PopPtr -> nothing
+ else if( instr &&
+ (instr->op == asBC_PshRPtr ||
+ instr->op == asBC_PSF ||
+ instr->op == asBC_VAR ||
+ instr->op == asBC_PshVPtr ||
+ instr->op == asBC_PshNull) )
+ {
+ // A pointer is pushed on the stack then immediately removed
+ // Remove both instructions as they cancel each other
+ DeleteInstruction(curr);
+ instr = GoForward(DeleteInstruction(instr));
+ }
+ // PSF, ChkRefS, PopPtr -> ChkNullV
+ else if( instr && instr->op == asBC_ChkRefS &&
+ instr->prev && instr->prev->op == asBC_PSF )
+ {
+ instr = instr->prev;
+ instr->op = asBC_ChkNullV;
+ instr->stackInc = 0;
+ // Delete the PopPtr instruction
+ DeleteInstruction(curr);
+ // Delete the ChkRefS instruction
+ DeleteInstruction(instr->next);
+ instr = GoForward(instr);
+ }
+ // PshVPtr, CHKREF, PopPtr -> ChkNullV
+ else if( instr && instr->op == asBC_CHKREF &&
+ instr->prev && instr->prev->op == asBC_PshVPtr )
+ {
+ instr = instr->prev;
+ instr->op = asBC_ChkNullV;
+ instr->stackInc = 0;
+ DeleteInstruction(curr->prev);
+ DeleteInstruction(curr);
+ instr = GoForward(instr);
+ }
+ // STOREOBJ y, PSF y, RDSPtr, PSF x, REFCPY, FREE y, PopPtr -> FREE x, STOREOBJ x
+ else if( instr && instr->op == asBC_FREE )
+ {
+ asCByteInstruction *i = instr->prev;
+ if( !i || i->op != asBC_REFCPY ) continue;
+ i = i->prev;
+ if( !i || i->op != asBC_PSF ) continue;
+ short x = i->wArg[0];
+ i = i->prev;
+ if( !i || i->op != asBC_RDSPtr ) continue;
+ i = i->prev;
+ if( !i || i->op != asBC_PSF ) continue;
+ short y = i->wArg[0];
+ i = i->prev;
+ if( !i || i->op != asBC_STOREOBJ || i->wArg[0] != y ) continue;
+
+ // Don't do the substitution if the var y is not a temporary, or if it is used after PopPtr
+ if( !IsTemporary(y) || IsTempVarRead(curr, y) ) continue;
+
+ // Transform the PopPtr into STOREOBJ
+ curr->op = asBC_STOREOBJ;
+ curr->stackInc = 0;
+ curr->wArg[0] = x;
+ curr->size = i->size;
+
+ // Change arg of the FREE to x
+ // TODO: runtime optimize: The FREE instruction shouldn't be necessary. STOREOBJ should free the previous value by itself
+ instr->wArg[0] = x;
+
+ // Delete all other instructions
+ DeleteInstruction(instr->prev); // REFCPY
+ DeleteInstruction(instr->prev); // PSF
+ DeleteInstruction(instr->prev); // RDSTR
+ DeleteInstruction(instr->prev); // PSF
+ DeleteInstruction(instr->prev); // STOREOBJ
+
+ instr = GoForward(curr);
+ }
+ }
+ else if( currOp == asBC_RDSPtr )
+ {
+ // PGA, RDSPtr -> PshGPtr
+ if( instr && instr->op == asBC_PGA )
+ {
+ instr->op = asBC_PshGPtr;
+ DeleteInstruction(curr);
+ instr = GoForward(instr);
+ }
+ // ChkRefS, RDSPtr -> RDSPtr, CHKREF
+ else if( instr && instr->op == asBC_ChkRefS )
+ {
+ // This exchange removes one pointer dereference, and also
+ // makes it easier to completely remove the CHKREF instruction
+ curr->op = asBC_CHKREF;
+ instr->op = asBC_RDSPtr;
+ instr = GoForward(curr);
+ }
+ // PSF, RDSPtr -> PshVPtr
+ else if( instr && instr->op == asBC_PSF )
+ {
+ instr->op = asBC_PshVPtr;
+ instr = GoForward(DeleteInstruction(curr));
+ }
+ // PSF, ChkRefS, RDSPtr -> PshVPtr, CHKREF
+ else if( instr && instr->op == asBC_ChkRefS &&
+ instr->prev && instr->prev->op == asBC_PSF )
+ {
+ instr->prev->op = asBC_PshVPtr;
+ instr->op = asBC_CHKREF;
+ instr = GoForward(DeleteInstruction(curr));
+ }
+ }
+ else if( currOp == asBC_PopRPtr )
+ {
+ // PshVPtr 0, ADDSi, PopRPtr -> LoadThisR
+ if( instr && instr->op == asBC_ADDSi &&
+ instr->prev && instr->prev->op == asBC_PshVPtr &&
+ instr->prev->wArg[0] == 0 )
+ {
+ DeleteInstruction(instr->prev);
+ ChangeFirstDeleteNext(instr, asBC_LoadThisR);
+ instr = GoForward(instr);
+ }
+ // TODO: runtime optimize: PshVPtr x, PopRPtr -> LoadRObjR x, 0
+ // PshVPtr x, ADDSi, PopRPtr -> LoadRObjR
+ else if( instr && instr->op == asBC_ADDSi &&
+ instr->prev && instr->prev->op == asBC_PshVPtr &&
+ instr->prev->wArg[0] != 0 )
+ {
+ instr = instr->prev;
+ instr->op = asBC_LoadRObjR;
+ instr->size = asBCTypeSize[asBCInfo[asBC_LoadRObjR].type];
+ instr->stackInc = asBCInfo[asBC_LoadRObjR].stackInc;
+ instr->wArg[1] = instr->next->wArg[0];
+ *(asDWORD*)&instr->arg = *(asDWORD*)&instr->next->arg;
+ DeleteInstruction(instr->next);
+ DeleteInstruction(curr);
+ instr = GoForward(instr);
+ }
+ // PSF x, ADDSi, PopRPtr -> LoadVObjR
+ else if( instr && instr->op == asBC_ADDSi &&
+ instr->prev && instr->prev->op == asBC_PSF )
+ {
+ instr = instr->prev;
+ instr->op = asBC_LoadVObjR;
+ instr->size = asBCTypeSize[asBCInfo[asBC_LoadVObjR].type];
+ instr->stackInc = asBCInfo[asBC_LoadVObjR].stackInc;
+ instr->wArg[1] = instr->next->wArg[0];
+ *(asDWORD*)&instr->arg = *(asDWORD*)&instr->next->arg;
+ DeleteInstruction(instr->next);
+ DeleteInstruction(curr);
+ instr = GoForward(instr);
+ }
+ }
+ else if( currOp == asBC_REFCPY )
+ {
+ // PSF x, REFCPY -> RefCpyV x
+ if( instr && instr->op == asBC_PSF )
+ {
+ curr->op = asBC_RefCpyV;
+ curr->wArg[0] = instr->wArg[0];
+ curr->stackInc = asBCInfo[asBC_LoadVObjR].stackInc;
+ DeleteInstruction(instr);
+ instr = GoForward(curr);
+ }
+ }
+ else if( ((currOp >= asBC_JZ && currOp <= asBC_JNP) || currOp == asBC_JLowZ || currOp == asBC_JLowNZ) && instr )
+ {
+ // T**; J** +x -> J** +x
+ if( (instr->op == asBC_TZ && (currOp == asBC_JZ || currOp == asBC_JLowZ)) ||
+ (instr->op == asBC_TNZ && (currOp == asBC_JNZ || currOp == asBC_JLowNZ)) )
+ instr = GoForward(DeleteFirstChangeNext(instr, asBC_JNZ));
+ else if( (instr->op == asBC_TNZ && (currOp == asBC_JZ || currOp == asBC_JLowZ)) ||
+ (instr->op == asBC_TZ && (currOp == asBC_JNZ || currOp == asBC_JLowNZ)) )
+ instr = GoForward(DeleteFirstChangeNext(instr, asBC_JZ));
+ else if( (instr->op == asBC_TS && (currOp == asBC_JZ || currOp == asBC_JLowZ)) ||
+ (instr->op == asBC_TNS && (currOp == asBC_JNZ || currOp == asBC_JLowNZ)) )
+ instr = GoForward(DeleteFirstChangeNext(instr, asBC_JNS));
+ else if( (instr->op == asBC_TNS && (currOp == asBC_JZ || currOp == asBC_JLowZ)) ||
+ (instr->op == asBC_TS && (currOp == asBC_JNZ || currOp == asBC_JLowNZ)) )
+ instr = GoForward(DeleteFirstChangeNext(instr, asBC_JS));
+ else if( (instr->op == asBC_TP && (currOp == asBC_JZ || currOp == asBC_JLowZ)) ||
+ (instr->op == asBC_TNP && (currOp == asBC_JNZ || currOp == asBC_JLowNZ)) )
+ instr = GoForward(DeleteFirstChangeNext(instr, asBC_JNP));
+ else if( (instr->op == asBC_TNP && (currOp == asBC_JZ || currOp == asBC_JLowZ)) ||
+ (instr->op == asBC_TP && (currOp == asBC_JNZ || currOp == asBC_JLowNZ)) )
+ instr = GoForward(DeleteFirstChangeNext(instr, asBC_JP));
+ }
+ else if( currOp == asBC_FREE && instr )
+ {
+ // PSF, FREE -> FREE, PSF
+ if( instr->op == asBC_PSF )
+ {
+ // This pattern usually happens when a function returns an object, or handle
+ // and then releases a temporary variable, possibly used in one of the arguments.
+ // By swapping the order of these instructions, the code can be further optimized
+ // to combine the PSF with the following instructions
+ RemoveInstruction(curr);
+ InsertBefore(instr, curr);
+ instr = GoForward(instr);
+ }
+ // VAR, FREE -> FREE, VAR
+ else if( instr->op == asBC_VAR )
+ {
+ // Swap the two instructions, so that the VAR instruction
+ // gets closer to its corresponding GET instruction and thus
+ // has a greater chance of getting optimized
+ RemoveInstruction(curr);
+ InsertBefore(instr, curr);
+ instr = GoForward(instr);
+ }
+ }
+ else if( currOp == asBC_VAR )
+ {
+ // VAR, PSF, GETOBJREF {PTR_SIZE} -> PshVPtr, PSF
+ if( curr->next && curr->next->op == asBC_PSF &&
+ curr->next->next && curr->next->next->op == asBC_GETOBJREF &&
+ curr->next->next->wArg[0] == AS_PTR_SIZE )
+ {
+ curr->op = asBC_PshVPtr;
+ DeleteInstruction(curr->next->next);
+ instr = GoForward(curr);
+ }
+ // VAR a, GETREF 0 -> PSF a
+ else if( curr->next && curr->next->op == asBC_GETREF && curr->next->wArg[0] == 0 )
+ {
+ ChangeFirstDeleteNext(curr, asBC_PSF);
+ instr = GoForward(curr);
+ }
+ // VAR a, GETOBJREF 0 -> PshVPtr a
+ else if( curr->next && curr->next->op == asBC_GETOBJREF && curr->next->wArg[0] == 0 )
+ {
+ ChangeFirstDeleteNext(curr, asBC_PshVPtr);
+ instr = GoForward(curr);
+ }
+ // VAR, PSF, GETREF {PTR_SIZE} -> PSF, PSF
+ if( curr->next && curr->next->op == asBC_PSF &&
+ curr->next->next && curr->next->next->op == asBC_GETREF &&
+ curr->next->next->wArg[0] == AS_PTR_SIZE )
+ {
+ curr->op = asBC_PSF;
+ DeleteInstruction(curr->next->next);
+ instr = GoForward(curr);
+ }
+ }
+ }
+
+ // Optimize unnecessary refcpy for return handle. This scenario only happens for return statements
+ // and LOADOBJ can only be the last instruction before the RET, so doing this check after the rest of
+ // the optimizations have taken place saves us time.
+ if( last && last->op == asBC_LOADOBJ && IsTemporary(last->wArg[0]) )
+ {
+ // A temporary handle is being loaded into the object register.
+ // Let's look for a trivial RefCpyV to that temporary variable, and a Free of the original
+ // variable. If this is found, then we can simply load the original value into the register
+ // and avoid both the RefCpy and the Free.
+ short tempVar = last->wArg[0];
+ asCArray<short> freedVars;
+
+ instr = last->prev;
+ asASSERT( instr && instr->op == asBC_Block );
+ instr = instr->prev;
+ while( instr && instr->op == asBC_FREE )
+ {
+ freedVars.PushLast(instr->wArg[0]);
+ instr = instr->prev;
+ }
+
+ // If there is any non-trivial cleanups, e.g. call to destructors, then we skip this optimizations
+ // TODO: runtime optimize: Do we need to skip it? Is there really a chance the local variable
+ // will be invalidated while the destructor, or any other function for
+ // that matter, is being called?
+ if( instr && instr->op == asBC_Block )
+ {
+ // We expect a sequence PshVPtr, RefCpyV, PopPtr just before the clean up block
+ instr = instr->prev;
+ if( instr && instr->op == asBC_PopPtr ) instr = instr->prev;
+ if( instr && instr->op == asBC_RefCpyV && instr->wArg[0] == tempVar ) instr = instr->prev;
+ if( instr && instr->op == asBC_PshVPtr && freedVars.Exists(instr->wArg[0]) )
+ {
+ // Update the LOADOBJ to load the local variable directly
+ tempVar = instr->wArg[0];
+ last->wArg[0] = tempVar;
+
+ // Remove the copy of the local variable into the temp
+ DeleteInstruction(instr->next); // deletes RefCpyV
+ DeleteInstruction(instr->next); // deletes PopPtr
+ DeleteInstruction(instr); // deletes PshVPtr
+
+ // Find and remove the FREE instruction for the local variable too
+ instr = last->prev->prev;
+ while( instr )
+ {
+ asASSERT( instr->op == asBC_FREE );
+ if( instr->wArg[0] == tempVar )
+ {
+ DeleteInstruction(instr);
+ break;
+ }
+ instr = instr->prev;
+ }
+ }
+ }
+ }
+}
+
+void asCByteCode::Optimize()
+{
+ // This function performs the optimizations that require global knowledge of the entire function
+
+ TimeIt("asCByteCode::Optimize");
+
+ if( !engine->ep.optimizeByteCode )
+ return;
+
+ // TODO: runtime optimize: The optimizer should be able to inline function calls.
+ // If the called function has only a few instructions, the function call should be inlined.
+ // This is especially useful with the factory stubs used for template types and script classes.
+
+ asCByteInstruction *instr = first;
+ while( instr )
+ {
+ asCByteInstruction *curr = instr;
+ instr = instr->next;
+
+ const asEBCInstr currOp = curr->op;
+
+ // Delete JitEntry if the JIT instructions are not supposed to be included
+ if( currOp == asBC_JitEntry && !engine->ep.includeJitInstructions )
+ {
+ instr = GoBack(DeleteInstruction(curr));
+ continue;
+ }
+
+ if( instr )
+ {
+ const asEBCInstr instrOp = instr->op;
+
+ // PopPtr, RET b -> RET b
+ if( currOp == asBC_PopPtr && instrOp == asBC_RET )
+ {
+ // We don't combine the PopPtr+RET because RET first restores
+ // the previous stack pointer and then pops the arguments
+
+ // Delete PopPtr
+ instr = GoBack(DeleteInstruction(curr));
+ }
+ else if( currOp == asBC_SUSPEND )
+ {
+ // SUSPEND, JitEntry, SUSPEND -> SUSPEND
+ if( instrOp == asBC_JitEntry && instr->next && instr->next->op == asBC_SUSPEND )
+ {
+ // Delete the two first instructions
+ DeleteInstruction(instr);
+ instr = GoBack(DeleteInstruction(curr));
+ }
+ // SUSPEND, SUSPEND -> SUSPEND
+ else if( instrOp == asBC_SUSPEND )
+ {
+ // Delete the first instruction
+ instr = GoBack(DeleteInstruction(curr));
+ }
+ // SUSPEND, Block, SUSPEND -> Block, SUSPEND
+ else if( instrOp == asBC_Block && instr->next && instr->next->op == asBC_SUSPEND )
+ {
+ // Delete the first instruction
+ instr = GoBack(DeleteInstruction(curr));
+ }
+ }
+ else if( currOp == asBC_LINE )
+ {
+ // LINE, JitEntry, LINE -> LINE
+ if( instrOp == asBC_JitEntry && instr->next && instr->next->op == asBC_LINE )
+ {
+ // Delete the two first instructions
+ DeleteInstruction(instr);
+ instr = GoBack(DeleteInstruction(curr));
+ }
+ // LINE, VarDecl, LINE -> VarDecl, LINE
+ else if (instrOp == asBC_VarDecl && instr->next && instr->next->op == asBC_LINE )
+ {
+ // Delete the first instruction
+ instr = GoBack(DeleteInstruction(curr));
+ }
+ // LINE, LINE -> LINE
+ else if( instrOp == asBC_LINE )
+ {
+ // Delete the first instruction
+ instr = GoBack(DeleteInstruction(curr));
+ }
+ // LINE, Block, LINE -> Block, LINE
+ else if( instrOp == asBC_Block && instr->next && instr->next->op == asBC_LINE )
+ {
+ // Delete the first instruction
+ instr = GoBack(DeleteInstruction(curr));
+ }
+ }
+ // JMP +0 -> remove
+ else if( currOp == asBC_JMP && instrOp == asBC_LABEL && *(int*)&curr->arg == instr->wArg[0] )
+ instr = GoBack(DeleteInstruction(curr));
+ }
+ }
+}
+
+bool asCByteCode::IsTempVarReadByInstr(asCByteInstruction *curr, int offset)
+{
+ // Which instructions read from variables?
+ if( asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG &&
+ (int(curr->wArg[1]) == offset || int(curr->wArg[2]) == offset) )
+ return true;
+ else if( (asBCInfo[curr->op].type == asBCTYPE_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_QW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_W_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_rW_DW_DW_ARG ||
+ curr->op == asBC_FREE) && // FREE both read and write to the variable
+ int(curr->wArg[0]) == offset )
+ return true;
+ else if( (asBCInfo[curr->op].type == asBCTYPE_wW_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_rW_DW_ARG) &&
+ int(curr->wArg[1]) == offset )
+ return true;
+ else if( asBCInfo[curr->op].type == asBCTYPE_rW_rW_ARG &&
+ (int(curr->wArg[0]) == offset || int(curr->wArg[1]) == offset) )
+ return true;
+ else if( curr->op == asBC_LoadThisR && offset == 0 )
+ return true;
+
+ return false;
+}
+
+bool asCByteCode::IsInstrJmpOrLabel(asCByteInstruction *curr)
+{
+ if( curr->op == asBC_JS ||
+ curr->op == asBC_JNS ||
+ curr->op == asBC_JP ||
+ curr->op == asBC_JNP ||
+ curr->op == asBC_JMPP ||
+ curr->op == asBC_JMP ||
+ curr->op == asBC_JZ ||
+ curr->op == asBC_JNZ ||
+ curr->op == asBC_JLowZ ||
+ curr->op == asBC_JLowNZ ||
+ curr->op == asBC_LABEL )
+ return true;
+
+ return false;
+}
+
+bool asCByteCode::IsTempVarOverwrittenByInstr(asCByteInstruction *curr, int offset)
+{
+ // Which instructions overwrite the variable or discard it?
+ if( curr->op == asBC_RET ||
+ curr->op == asBC_SUSPEND )
+ return true;
+ else if( (asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_rW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_rW_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_W_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_DW_ARG ||
+ asBCInfo[curr->op].type == asBCTYPE_wW_QW_ARG) &&
+ int(curr->wArg[0]) == offset )
+ return true;
+
+ return false;
+}
+
+bool asCByteCode::IsTempVarRead(asCByteInstruction *curr, int offset)
+{
+ TimeIt("asCByteCode::IsTempVarRead");
+
+ asCArray<asCByteInstruction *> openPaths;
+ asCArray<asCByteInstruction *> closedPaths;
+
+ // We're not interested in the first instruction, since it is the one that sets the variable
+ openPaths.PushLast(curr->next);
+
+ while( openPaths.GetLength() )
+ {
+ curr = openPaths.PopLast();
+
+ // Add the instruction to the closed paths so that we don't verify it again
+ closedPaths.PushLast(curr);
+
+ while( curr )
+ {
+ if( IsTempVarReadByInstr(curr, offset) )
+ return true;
+
+ if( IsTempVarOverwrittenByInstr(curr, offset) ) break;
+
+ // In case of jumps, we must follow the each of the paths
+ if( curr->op == asBC_JMP )
+ {
+ // Find the destination. If it cannot be found it is because we're doing a localized
+ // optimization and the label hasn't been added to the final bytecode yet
+
+ int label = *((int*)ARG_DW(curr->arg));
+ int r = FindLabel(label, curr, &curr, 0);
+ if( r >= 0 &&
+ !closedPaths.Exists(curr) &&
+ !openPaths.Exists(curr) )
+ openPaths.PushLast(curr);
+
+ break;
+ }
+ else if( curr->op == asBC_JZ || curr->op == asBC_JNZ ||
+ curr->op == asBC_JS || curr->op == asBC_JNS ||
+ curr->op == asBC_JP || curr->op == asBC_JNP ||
+ curr->op == asBC_JLowZ || curr->op == asBC_JLowNZ )
+ {
+ // Find the destination. If it cannot be found it is because we're doing a localized
+ // optimization and the label hasn't been added to the final bytecode yet
+
+ asCByteInstruction *dest = 0;
+ int label = *((int*)ARG_DW(curr->arg));
+ int r = FindLabel(label, curr, &dest, 0);
+ if( r >= 0 &&
+ !closedPaths.Exists(dest) &&
+ !openPaths.Exists(dest) )
+ openPaths.PushLast(dest);
+ }
+ else if( curr->op == asBC_JMPP )
+ {
+ // A JMPP instruction is always followed by a series of JMP instructions
+ // that give the real destination (like a look-up table). We need add all
+ // of these as open paths.
+ curr = curr->next;
+ while( curr->op == asBC_JMP )
+ {
+ // Find the destination. If it cannot be found it is because we're doing a localized
+ // optimization and the label hasn't been added to the final bytecode yet
+
+ asCByteInstruction *dest = 0;
+ int label = *((int*)ARG_DW(curr->arg));
+ int r = FindLabel(label, curr, &dest, 0);
+ if( r >= 0 &&
+ !closedPaths.Exists(dest) &&
+ !openPaths.Exists(dest) )
+ openPaths.PushLast(dest);
+
+ curr = curr->next;
+ }
+
+ // We should now be on a label which is the destination of the
+ // first JMP in the sequence and is already added in the open paths
+ asASSERT(curr->op == asBC_LABEL);
+ break;
+ }
+
+ curr = curr->next;
+ }
+ }
+
+ return false;
+}
+
+bool asCByteCode::IsTempRegUsed(asCByteInstruction *curr)
+{
+ TimeIt("asCByteCode::IsTempRegUsed");
+
+ // We're not interested in the first instruction, since it is the one that sets the register
+ while( curr->next )
+ {
+ curr = curr->next;
+
+ // Which instructions read from the register?
+ if( curr->op == asBC_INCi ||
+ curr->op == asBC_INCi16 ||
+ curr->op == asBC_INCi8 ||
+ curr->op == asBC_INCf ||
+ curr->op == asBC_INCd ||
+ curr->op == asBC_DECi ||
+ curr->op == asBC_DECi16 ||
+ curr->op == asBC_DECi8 ||
+ curr->op == asBC_DECf ||
+ curr->op == asBC_DECd ||
+ curr->op == asBC_WRTV1 ||
+ curr->op == asBC_WRTV2 ||
+ curr->op == asBC_WRTV4 ||
+ curr->op == asBC_WRTV8 ||
+ curr->op == asBC_RDR1 ||
+ curr->op == asBC_RDR2 ||
+ curr->op == asBC_RDR4 ||
+ curr->op == asBC_RDR8 ||
+ curr->op == asBC_PshRPtr ||
+ curr->op == asBC_CpyRtoV4 ||
+ curr->op == asBC_CpyRtoV8 ||
+ curr->op == asBC_TZ ||
+ curr->op == asBC_TNZ ||
+ curr->op == asBC_TS ||
+ curr->op == asBC_TNS ||
+ curr->op == asBC_TP ||
+ curr->op == asBC_TNP ||
+ curr->op == asBC_JZ ||
+ curr->op == asBC_JNZ ||
+ curr->op == asBC_JLowZ ||
+ curr->op == asBC_JLowNZ ||
+ curr->op == asBC_JS ||
+ curr->op == asBC_JNS ||
+ curr->op == asBC_JP ||
+ curr->op == asBC_JNP )
+ return true;
+
+ // Which instructions overwrite the register or discard the value?
+ if( curr->op == asBC_CALL ||
+ curr->op == asBC_PopRPtr ||
+ curr->op == asBC_CALLSYS ||
+ curr->op == asBC_CALLBND ||
+ curr->op == asBC_Thiscall1 ||
+ curr->op == asBC_SUSPEND ||
+ curr->op == asBC_ALLOC ||
+ curr->op == asBC_CpyVtoR4 ||
+ curr->op == asBC_LdGRdR4 ||
+ curr->op == asBC_LDG ||
+ curr->op == asBC_LDV ||
+ curr->op == asBC_TZ ||
+ curr->op == asBC_TNZ ||
+ curr->op == asBC_TS ||
+ curr->op == asBC_TNS ||
+ curr->op == asBC_TP ||
+ curr->op == asBC_TNP ||
+ curr->op == asBC_JS ||
+ curr->op == asBC_JNS ||
+ curr->op == asBC_JP ||
+ curr->op == asBC_JNP ||
+ curr->op == asBC_JMPP ||
+ curr->op == asBC_JMP ||
+ curr->op == asBC_JZ ||
+ curr->op == asBC_JNZ ||
+ curr->op == asBC_JLowZ ||
+ curr->op == asBC_JLowNZ ||
+ curr->op == asBC_CMPi ||
+ curr->op == asBC_CMPu ||
+ curr->op == asBC_CMPf ||
+ curr->op == asBC_CMPd ||
+ curr->op == asBC_CMPIi ||
+ curr->op == asBC_CMPIu ||
+ curr->op == asBC_CMPIf ||
+ curr->op == asBC_LABEL ||
+ curr->op == asBC_LoadThisR ||
+ curr->op == asBC_LoadRObjR ||
+ curr->op == asBC_LoadVObjR )
+ return false;
+ }
+
+ return false;
+}
+
+bool asCByteCode::IsSimpleExpression()
+{
+ // A simple expression is one that cannot be suspended at any time, i.e.
+ // it doesn't have any calls to other routines, and doesn't have any suspend instructions
+ asCByteInstruction *instr = first;
+ while( instr )
+ {
+ if( instr->op == asBC_ALLOC ||
+ instr->op == asBC_CALL ||
+ instr->op == asBC_CALLSYS ||
+ instr->op == asBC_SUSPEND ||
+ instr->op == asBC_LINE ||
+ instr->op == asBC_FREE ||
+ instr->op == asBC_CallPtr ||
+ instr->op == asBC_CALLINTF ||
+ instr->op == asBC_CALLBND ||
+ instr->op == asBC_Thiscall1 )
+ return false;
+
+ instr = instr->next;
+ }
+
+ return true;
+}
+
+void asCByteCode::ExtractLineNumbers()
+{
+ // This function will extract the line number and source file for each statement by looking for LINE instructions.
+ // The LINE instructions will be converted to SUSPEND instructions, or removed depending on the configuration.
+
+ TimeIt("asCByteCode::ExtractLineNumbers");
+
+ int lastLinePos = -1;
+ int pos = 0;
+ asCByteInstruction *instr = first;
+ while( instr )
+ {
+ asCByteInstruction *curr = instr;
+ instr = instr->next;
+
+ if( curr->op == asBC_LINE )
+ {
+ if( lastLinePos == pos )
+ {
+ lineNumbers.PopLast(); // pop position
+ lineNumbers.PopLast(); // pop line number
+ sectionIdxs.PopLast(); // pop section index
+ }
+
+ lastLinePos = pos;
+ lineNumbers.PushLast(pos);
+ lineNumbers.PushLast(*(int*)ARG_DW(curr->arg));
+ sectionIdxs.PushLast(*((int*)ARG_DW(curr->arg)+1));
+
+ if( !engine->ep.buildWithoutLineCues )
+ {
+ // Transform BC_LINE into BC_SUSPEND
+ curr->op = asBC_SUSPEND;
+ curr->size = asBCTypeSize[asBCInfo[asBC_SUSPEND].type];
+ pos += curr->size;
+ }
+ else
+ {
+ // Delete the instruction
+ DeleteInstruction(curr);
+ }
+ }
+ else
+ pos += curr->size;
+ }
+}
+
+void asCByteCode::ExtractObjectVariableInfo(asCScriptFunction *outFunc)
+{
+ asASSERT( outFunc->scriptData );
+
+ unsigned int pos = 0;
+ asCByteInstruction *instr = first;
+ int blockLevel = 0;
+ while( instr )
+ {
+ if( instr->op == asBC_Block )
+ {
+ asSObjectVariableInfo info;
+ info.programPos = pos;
+ info.variableOffset = 0;
+ info.option = instr->wArg[0] ? asBLOCK_BEGIN : asBLOCK_END;
+ if( info.option == asBLOCK_BEGIN )
+ {
+ blockLevel++;
+ outFunc->scriptData->objVariableInfo.PushLast(info);
+ }
+ else
+ {
+ blockLevel--;
+ asASSERT( blockLevel >= 0 );
+ if( outFunc->scriptData->objVariableInfo[outFunc->scriptData->objVariableInfo.GetLength()-1].option == asBLOCK_BEGIN &&
+ outFunc->scriptData->objVariableInfo[outFunc->scriptData->objVariableInfo.GetLength()-1].programPos == pos )
+ outFunc->scriptData->objVariableInfo.PopLast();
+ else
+ outFunc->scriptData->objVariableInfo.PushLast(info);
+ }
+ }
+ else if( instr->op == asBC_ObjInfo )
+ {
+ asSObjectVariableInfo info;
+ info.programPos = pos;
+ info.variableOffset = (short)instr->wArg[0];
+ info.option = (asEObjVarInfoOption)*(int*)ARG_DW(instr->arg);
+ outFunc->scriptData->objVariableInfo.PushLast(info);
+ }
+ else if( instr->op == asBC_VarDecl )
+ {
+ // Record the position for debug info
+ outFunc->scriptData->variables[instr->wArg[0]]->declaredAtProgramPos = pos;
+
+ // Record declaration of object variables for try/catch handling
+ // This is used for identifying if handles and objects on the heap should be cleared upon catching an exception
+ // Only extract this info if there is a try/catch block in the function, so we don't use up unnecessary space
+ if( outFunc->scriptData->tryCatchInfo.GetLength() && outFunc->scriptData->variables[instr->wArg[0]]->type.GetTypeInfo() )
+ {
+ asSObjectVariableInfo info;
+ info.programPos = pos;
+ info.variableOffset = outFunc->scriptData->variables[instr->wArg[0]]->stackOffset;
+ info.option = asOBJ_VARDECL;
+ outFunc->scriptData->objVariableInfo.PushLast(info);
+ }
+ }
+ else
+ pos += instr->size;
+
+ instr = instr->next;
+ }
+ asASSERT( blockLevel == 0 );
+}
+
+void asCByteCode::ExtractTryCatchInfo(asCScriptFunction *outFunc)
+{
+ asASSERT(outFunc->scriptData);
+
+ unsigned int pos = 0;
+ asCByteInstruction *instr = first;
+ while (instr)
+ {
+ if (instr->op == asBC_TryBlock)
+ {
+ asSTryCatchInfo info;
+ info.tryPos = pos;
+ info.catchPos = *ARG_DW(instr->arg);
+ outFunc->scriptData->tryCatchInfo.PushLast(info);
+ }
+
+ pos += instr->size;
+ instr = instr->next;
+ }
+}
+
+int asCByteCode::GetSize()
+{
+ int size = 0;
+ asCByteInstruction *instr = first;
+ while( instr )
+ {
+ size += instr->GetSize();
+
+ instr = instr->next;
+ }
+
+ return size;
+}
+
+void asCByteCode::AddCode(asCByteCode *bc)
+{
+ if( bc == this ) return;
+ if( bc->first )
+ {
+ if( first == 0 )
+ {
+ first = bc->first;
+ last = bc->last;
+ bc->first = 0;
+ bc->last = 0;
+ }
+ else
+ {
+ last->next = bc->first;
+ bc->first->prev = last;
+ last = bc->last;
+ bc->first = 0;
+ bc->last = 0;
+ }
+ }
+}
+
+int asCByteCode::AddInstruction()
+{
+ void *ptr = engine->memoryMgr.AllocByteInstruction();
+ if( ptr == 0 )
+ {
+ // Out of memory
+ return 0;
+ }
+
+ asCByteInstruction *instr = new(ptr) asCByteInstruction();
+ if( first == 0 )
+ {
+ first = last = instr;
+ }
+ else
+ {
+ last->AddAfter(instr);
+ last = instr;
+ }
+
+ return 0;
+}
+
+int asCByteCode::AddInstructionFirst()
+{
+ void *ptr = engine->memoryMgr.AllocByteInstruction();
+ if( ptr == 0 )
+ {
+ // Out of memory
+ return 0;
+ }
+
+ asCByteInstruction *instr = new(ptr) asCByteInstruction();
+ if( first == 0 )
+ {
+ first = last = instr;
+ }
+ else
+ {
+ first->AddBefore(instr);
+ first = instr;
+ }
+
+ return 0;
+}
+
+void asCByteCode::Call(asEBCInstr instr, int funcID, int pop)
+{
+ if( AddInstruction() < 0 )
+ return;
+
+ asASSERT(asBCInfo[instr].type == asBCTYPE_DW_ARG);
+
+ last->op = instr;
+ last->size = asBCTypeSize[asBCInfo[instr].type];
+ last->stackInc = -pop; // BC_CALL and BC_CALLBND doesn't pop the argument but when the callee returns the arguments are already popped
+ *((int*)ARG_DW(last->arg)) = funcID;
+
+ // Add a JitEntry instruction after function calls so that JIT's can resume execution
+ InstrPTR(asBC_JitEntry, 0);
+}
+
+void asCByteCode::CallPtr(asEBCInstr instr, int funcPtrVar, int pop)
+{
+ if( AddInstruction() < 0 )
+ return;
+
+ asASSERT(asBCInfo[instr].type == asBCTYPE_rW_ARG);
+
+ last->op = instr;
+ last->size = asBCTypeSize[asBCInfo[instr].type];
+ last->stackInc = -pop;
+ last->wArg[0] = (short)funcPtrVar;
+
+ // Add a JitEntry instruction after function calls so that JIT's can resume execution
+ InstrPTR(asBC_JitEntry, 0);
+}
+
+void asCByteCode::Alloc(asEBCInstr instr, void *objID, int funcID, int pop)
+{
+ if( AddInstruction() < 0 )
+ return;
+
+ last->op = instr;
+ last->size = asBCTypeSize[asBCInfo[instr].type];
+ last->stackInc = -pop; // BC_ALLOC
+
+ asASSERT(asBCInfo[instr].type == asBCTYPE_PTR_DW_ARG);
+ *ARG_PTR(last->arg) = (asPWORD)objID;
+ *((int*)(ARG_DW(last->arg)+AS_PTR_SIZE)) = funcID;
+
+ // Add a JitEntry instruction after function calls so that JIT's can resume execution
+ InstrPTR(asBC_JitEntry, 0);
+}
+
+void asCByteCode::Ret(int pop)
+{
+ if( AddInstruction() < 0 )
+ return;
+
+ asASSERT(asBCInfo[asBC_RET].type == asBCTYPE_W_ARG);
+
+ last->op = asBC_RET;
+ last->size = asBCTypeSize[asBCInfo[asBC_RET].type];
+ last->stackInc = 0; // The instruction pops the argument, but it doesn't affect current function
+ last->wArg[0] = (short)pop;
+}
+
+void asCByteCode::JmpP(int var, asDWORD max)
+{
+ if( AddInstruction() < 0 )
+ return;
+
+ asASSERT(asBCInfo[asBC_JMPP].type == asBCTYPE_rW_ARG);
+
+ last->op = asBC_JMPP;
+ last->size = asBCTypeSize[asBCInfo[asBC_JMPP].type];
+ last->stackInc = asBCInfo[asBC_JMPP].stackInc;
+ last->wArg[0] = (short)var;
+
+ // Store the largest jump that is made for PostProcess()
+ *ARG_DW(last->arg) = max;
+}
+
+void asCByteCode::Label(short label)
+{
+ if( AddInstruction() < 0 )
+ return;
+
+ last->op = asBC_LABEL;
+ last->size = 0;
+ last->stackInc = 0;
+ last->wArg[0] = label;
+}
+
+void asCByteCode::Line(int line, int column, int scriptIdx)
+{
+ if( AddInstruction() < 0 )
+ return;
+
+ last->op = asBC_LINE;
+ // If the build is without line cues these instructions will be removed
+ // otherwise they will be transformed into SUSPEND instructions.
+ if( engine->ep.buildWithoutLineCues )
+ last->size = 0;
+ else
+ last->size = asBCTypeSize[asBCInfo[asBC_SUSPEND].type];
+ last->stackInc = 0;
+ *((int*)ARG_DW(last->arg)) = (line & 0xFFFFF)|((column & 0xFFF)<<20);
+ *((int*)ARG_DW(last->arg)+1) = scriptIdx;
+
+ // Add a JitEntry after the line instruction to allow the JIT function to resume after a suspend
+ InstrPTR(asBC_JitEntry, 0);
+}
+
+void asCByteCode::ObjInfo(int offset, int info)
+{
+ if( AddInstruction() < 0 )
+ return;
+
+ // Add the special instruction that will be used to tell the exception
+ // handler when an object is initialized and deinitialized.
+ last->op = asBC_ObjInfo;
+ last->size = 0;
+ last->stackInc = 0;
+ last->wArg[0] = (short)offset;
+ *((int*)ARG_DW(last->arg)) = info;
+}
+
+void asCByteCode::Block(bool start)
+{
+ if( AddInstruction() < 0 )
+ return;
+
+ last->op = asBC_Block;
+ last->size = 0;
+ last->stackInc = 0;
+ last->wArg[0] = start ? 1 : 0;
+}
+
+void asCByteCode::TryBlock(short catchLabel)
+{
+ if (AddInstruction() < 0)
+ return;
+
+ last->op = asBC_TryBlock;
+ last->size = 0;
+ last->stackInc = 0;
+ *ARG_DW(last->arg) = catchLabel;
+}
+
+void asCByteCode::VarDecl(int varDeclIdx)
+{
+ if( AddInstruction() < 0 )
+ return;
+
+ last->op = asBC_VarDecl;
+ last->size = 0;
+ last->stackInc = 0;
+ last->wArg[0] = asWORD(varDeclIdx);
+}
+
+int asCByteCode::FindLabel(int label, asCByteInstruction *from, asCByteInstruction **dest, int *positionDelta)
+{
+ TimeIt("asCByteCode::FindLabel");
+
+ // Search forward
+ int labelPos = -from->GetSize();
+
+ asCByteInstruction *labelInstr = from;
+ while( labelInstr )
+ {
+ labelPos += labelInstr->GetSize();
+ labelInstr = labelInstr->next;
+
+ if( labelInstr && labelInstr->op == asBC_LABEL )
+ {
+ if( labelInstr->wArg[0] == label )
+ break;
+ }
+ }
+
+ if( labelInstr == 0 )
+ {
+ // Search backwards
+ labelPos = -from->GetSize();
+
+ labelInstr = from;
+ while( labelInstr )
+ {
+ labelInstr = labelInstr->prev;
+ if( labelInstr )
+ {
+ labelPos -= labelInstr->GetSize();
+
+ if( labelInstr->op == asBC_LABEL )
+ {
+ if( labelInstr->wArg[0] == label )
+ break;
+ }
+ }
+ }
+ }
+
+ if( labelInstr != 0 )
+ {
+ if( dest ) *dest = labelInstr;
+ if( positionDelta ) *positionDelta = labelPos;
+ return 0;
+ }
+
+ return -1;
+}
+
+int asCByteCode::ResolveJumpAddresses()
+{
+ TimeIt("asCByteCode::ResolveJumpAddresses");
+
+ asUINT currPos = 0;
+
+ asCByteInstruction *instr = first;
+ while( instr )
+ {
+ if( instr->op == asBC_JMP ||
+ instr->op == asBC_JZ || instr->op == asBC_JNZ ||
+ instr->op == asBC_JLowZ || instr->op == asBC_JLowNZ ||
+ instr->op == asBC_JS || instr->op == asBC_JNS ||
+ instr->op == asBC_JP || instr->op == asBC_JNP )
+ {
+ int label = *((int*) ARG_DW(instr->arg));
+ int labelPosOffset;
+ int r = FindLabel(label, instr, 0, &labelPosOffset);
+ if( r == 0 )
+ *((int*) ARG_DW(instr->arg)) = labelPosOffset;
+ else
+ return -1;
+ }
+ else if (instr->op == asBC_TryBlock)
+ {
+ int label = *((int*)ARG_DW(instr->arg));
+ int labelPosOffset;
+ int r = FindLabel(label, instr, 0, &labelPosOffset);
+ if (r == 0)
+ {
+ // Should store the absolute address so the exception handler doesn't need to figure it out
+ *((int*)ARG_DW(instr->arg)) = currPos + labelPosOffset;
+ }
+ else
+ return -1;
+ }
+
+ currPos += instr->GetSize();
+ instr = instr->next;
+ }
+
+ return 0;
+}
+
+
+asCByteInstruction *asCByteCode::DeleteInstruction(asCByteInstruction *instr)
+{
+ if( instr == 0 ) return 0;
+
+ asCByteInstruction *ret = instr->prev ? instr->prev : instr->next;
+
+ RemoveInstruction(instr);
+
+ engine->memoryMgr.FreeByteInstruction(instr);
+
+ return ret;
+}
+
+void asCByteCode::Output(asDWORD *array)
+{
+ TimeIt("asCByteCode::Output");
+
+ // TODO: Receive a script function pointer instead of the bytecode array
+
+ asDWORD *ap = array;
+
+ asCByteInstruction *instr = first;
+ while( instr )
+ {
+ if( instr->GetSize() > 0 )
+ {
+ *(asBYTE*)ap = asBYTE(instr->op);
+ *(((asBYTE*)ap)+1) = 0; // Second byte is always zero
+ switch( asBCInfo[instr->op].type )
+ {
+ case asBCTYPE_NO_ARG:
+ *(((asWORD*)ap)+1) = 0; // Clear upper bytes
+ break;
+ case asBCTYPE_wW_rW_rW_ARG:
+ *(((asWORD*)ap)+1) = instr->wArg[0];
+ *(((asWORD*)ap)+2) = instr->wArg[1];
+ *(((asWORD*)ap)+3) = instr->wArg[2];
+ break;
+ case asBCTYPE_wW_DW_ARG:
+ case asBCTYPE_rW_DW_ARG:
+ case asBCTYPE_W_DW_ARG:
+ *(((asWORD*)ap)+1) = instr->wArg[0];
+ *(ap+1) = *(asDWORD*)&instr->arg;
+ break;
+ case asBCTYPE_wW_rW_DW_ARG:
+ case asBCTYPE_rW_W_DW_ARG:
+ *(((asWORD*)ap)+1) = instr->wArg[0];
+ *(((asWORD*)ap)+2) = instr->wArg[1];
+ *(ap+2) = *(asDWORD*)&instr->arg;
+ break;
+ case asBCTYPE_wW_QW_ARG:
+ case asBCTYPE_rW_QW_ARG:
+ *(((asWORD*)ap)+1) = instr->wArg[0];
+ *(asQWORD*)(ap+1) = asQWORD(instr->arg);
+ break;
+ case asBCTYPE_W_ARG:
+ case asBCTYPE_rW_ARG:
+ case asBCTYPE_wW_ARG:
+ *(((asWORD*)ap)+1) = instr->wArg[0];
+ break;
+ case asBCTYPE_wW_rW_ARG:
+ case asBCTYPE_rW_rW_ARG:
+ case asBCTYPE_wW_W_ARG:
+ *(((asWORD *)ap)+1) = instr->wArg[0];
+ *(((asWORD *)ap)+2) = instr->wArg[1];
+ break;
+ case asBCTYPE_QW_DW_ARG:
+ case asBCTYPE_DW_DW_ARG:
+ case asBCTYPE_QW_ARG:
+ case asBCTYPE_DW_ARG:
+ *(((asWORD*)ap)+1) = 0; // Clear upper bytes
+ memcpy(ap+1, &instr->arg, instr->GetSize()*4-4);
+ break;
+ case asBCTYPE_rW_DW_DW_ARG:
+ *(((asWORD*)ap)+1) = instr->wArg[0];
+ memcpy(ap+1, &instr->arg, instr->GetSize()*4-4);
+ break;
+ default:
+ // How did we get here?
+ asASSERT(false);
+ break;
+ }
+ }
+
+ ap += instr->GetSize();
+ instr = instr->next;
+ }
+}
+
+void asCByteCode::PostProcess()
+{
+ TimeIt("asCByteCode::PostProcess");
+
+ if( first == 0 ) return;
+
+ // This function will do the following
+ // - Verify if there is any code that never gets executed and remove it
+ // - Calculate the stack size at the position of each byte code
+ // - Calculate the largest stack needed
+
+ largestStackUsed = 0;
+
+ asCByteInstruction *instr = first;
+ while( instr )
+ {
+ instr->marked = false;
+ instr->stackSize = -1;
+ instr = instr->next;
+ }
+
+ // Add the first instruction to the list of unchecked code paths
+ asCArray<asCByteInstruction *> paths;
+ AddPath(paths, first, 0);
+
+ // Go through each of the code paths
+ for( asUINT p = 0; p < paths.GetLength(); ++p )
+ {
+ instr = paths[p];
+ int stackSize = instr->stackSize;
+
+ while( instr )
+ {
+ instr->marked = true;
+ instr->stackSize = stackSize;
+ stackSize += instr->stackInc;
+ if( stackSize > largestStackUsed )
+ largestStackUsed = stackSize;
+
+ if( instr->op == asBC_JMP )
+ {
+ // Find the label that we should jump to
+ int label = *((int*) ARG_DW(instr->arg));
+ asCByteInstruction *dest = 0;
+ int r = FindLabel(label, instr, &dest, 0); asASSERT( r == 0 ); UNUSED_VAR(r);
+
+ AddPath(paths, dest, stackSize);
+ break;
+ }
+ else if( instr->op == asBC_JZ || instr->op == asBC_JNZ ||
+ instr->op == asBC_JLowZ || instr->op == asBC_JLowNZ ||
+ instr->op == asBC_JS || instr->op == asBC_JNS ||
+ instr->op == asBC_JP || instr->op == asBC_JNP ||
+ instr->op == asBC_TryBlock )
+ {
+ // Find the label that is being jumped to
+ int label = *((int*) ARG_DW(instr->arg));
+ asCByteInstruction *dest = 0;
+ int r = FindLabel(label, instr, &dest, 0); asASSERT( r == 0 ); UNUSED_VAR(r);
+
+ AddPath(paths, dest, stackSize);
+
+ // Add both paths to the code paths
+ AddPath(paths, instr->next, stackSize);
+
+ break;
+ }
+ else if( instr->op == asBC_JMPP )
+ {
+ // I need to know the largest value possible
+ asDWORD max = *ARG_DW(instr->arg);
+
+ // Add all destinations to the code paths
+ asCByteInstruction *dest = instr->next;
+ for( asDWORD n = 0; n <= max && dest != 0; ++n )
+ {
+ AddPath(paths, dest, stackSize);
+ dest = dest->next;
+ }
+
+ break;
+ }
+ else
+ {
+ instr = instr->next;
+ if( instr == 0 || instr->marked )
+ break;
+ }
+ }
+ }
+
+ // Are there any instructions that didn't get visited?
+ instr = first;
+ while( instr )
+ {
+ // Don't remove asBC_Block instructions as then the start and end of blocks may become mismatched
+ if( instr->marked == false && instr->op != asBC_Block )
+ {
+ // Remove it
+ asCByteInstruction *curr = instr;
+ instr = instr->next;
+ DeleteInstruction(curr);
+ }
+ else
+ {
+#ifndef AS_DEBUG
+ // If the stackSize is negative, then there is a problem with the bytecode.
+ // If AS_DEBUG is turned on, this same check is done in DebugOutput.
+ asASSERT( instr->stackSize >= 0 || asBCInfo[instr->op].type == asBCTYPE_INFO );
+#endif
+ instr = instr->next;
+ }
+ }
+}
+
+#ifdef AS_DEBUG
+void asCByteCode::DebugOutput(const char *name, asCScriptFunction *func)
+{
+#ifndef __MINGW32__
+ // _mkdir is broken on mingw
+ _mkdir("AS_DEBUG");
+#endif
+
+ asCString path = "AS_DEBUG/";
+ path += name;
+
+ // Anonymous functions created from within class methods will contain :: as part of the name
+ // Replace :: with __ to avoid error when creating the file for debug output
+ for (asUINT n = 0; n < path.GetLength(); n++)
+ if (path[n] == ':') path[n] = '_';
+
+#if _MSC_VER >= 1500 && !defined(AS_MARMALADE)
+ FILE *file;
+ fopen_s(&file, path.AddressOf(), "w");
+#else
+ FILE *file = fopen(path.AddressOf(), "w");
+#endif
+
+#if !defined(AS_XENON) && !defined(__MINGW32__)
+ // XBox 360: When running in DVD Emu, no write is allowed
+ // MinGW: As _mkdir is broken, don't assert on file not created if the AS_DEBUG directory doesn't exist
+ asASSERT( file );
+#endif
+
+ if( file == 0 )
+ return;
+
+ asUINT n;
+
+ fprintf(file, "%s\n\n", func->GetDeclaration());
+
+ fprintf(file, "Temps: ");
+ for( n = 0; n < temporaryVariables->GetLength(); n++ )
+ {
+ fprintf(file, "%d", (*temporaryVariables)[n]);
+ if( n < temporaryVariables->GetLength()-1 )
+ fprintf(file, ", ");
+ }
+ fprintf(file, "\n\n");
+
+ fprintf(file, "Variables: \n");
+ for( n = 0; n < func->scriptData->variables.GetLength(); n++ )
+ {
+ int idx = func->scriptData->objVariablePos.IndexOf(func->scriptData->variables[n]->stackOffset);
+ bool isOnHeap = asUINT(idx) < func->scriptData->objVariablesOnHeap ? true : false;
+ fprintf(file, " %.3d: %s%s %s\n", func->scriptData->variables[n]->stackOffset, isOnHeap ? "(heap) " : "", func->scriptData->variables[n]->type.Format(func->nameSpace, true).AddressOf(), func->scriptData->variables[n]->name.AddressOf());
+ }
+ asUINT offset = 0;
+ if( func->objectType )
+ {
+ fprintf(file, " %.3d: %s this\n", 0, func->objectType->name.AddressOf());
+ offset -= AS_PTR_SIZE;
+ }
+ for( n = 0; n < func->parameterTypes.GetLength(); n++ )
+ {
+ bool found = false;
+ for( asUINT v = 0; v < func->scriptData->variables.GetLength(); v++ )
+ {
+ if( func->scriptData->variables[v]->stackOffset == (int)offset )
+ {
+ found = true;
+ break;
+ }
+ }
+ if( !found )
+ {
+ int idx = func->scriptData->objVariablePos.IndexOf(offset);
+ bool isOnHeap = asUINT(idx) < func->scriptData->objVariablesOnHeap ? true : false;
+ fprintf(file, " %.3d: %s%s {noname param}\n", offset, isOnHeap ? "(heap) " : "", func->parameterTypes[n].Format(func->nameSpace, true).AddressOf());
+ }
+
+ offset -= func->parameterTypes[n].GetSizeOnStackDWords();
+ }
+ for( n = 0; n < func->scriptData->objVariablePos.GetLength(); n++ )
+ {
+ bool found = false;
+ for( asUINT v = 0; v < func->scriptData->variables.GetLength(); v++ )
+ {
+ if( func->scriptData->variables[v]->stackOffset == func->scriptData->objVariablePos[n] )
+ {
+ found = true;
+ break;
+ }
+ }
+ if( !found )
+ {
+ if( func->scriptData->objVariableTypes[n] )
+ {
+ int idx = func->scriptData->objVariablePos.IndexOf(func->scriptData->objVariablePos[n]);
+ bool isOnHeap = asUINT(idx) < func->scriptData->objVariablesOnHeap ? true : false;
+ fprintf(file, " %.3d: %s%s {noname}\n", func->scriptData->objVariablePos[n], isOnHeap ? "(heap) " : "", func->scriptData->objVariableTypes[n]->name.AddressOf());
+ }
+ else
+ fprintf(file, " %.3d: null handle {noname}\n", func->scriptData->objVariablePos[n]);
+ }
+ }
+ fprintf(file, "\n\n");
+
+ bool invalidStackSize = false;
+ int pos = 0;
+ asUINT lineIndex = 0;
+ asCByteInstruction *instr = first;
+ while( instr )
+ {
+ if( lineIndex < lineNumbers.GetLength() && lineNumbers[lineIndex] == pos )
+ {
+ asDWORD line = lineNumbers[lineIndex+1];
+ fprintf(file, "- %d,%d -\n", (int)(line&0xFFFFF), (int)(line>>20));
+ lineIndex += 2;
+ }
+
+ if( instr->GetSize() > 0 )
+ {
+ fprintf(file, "%5d ", pos);
+ pos += instr->GetSize();
+
+ fprintf(file, "%3d %c ", int(instr->stackSize + func->scriptData->variableSpace), instr->marked ? '*' : ' ');
+ if( instr->stackSize < 0 )
+ invalidStackSize = true;
+ }
+ else
+ {
+ fprintf(file, " ");
+ }
+
+ switch( asBCInfo[instr->op].type )
+ {
+ case asBCTYPE_W_ARG:
+ fprintf(file, " %-8s %d\n", asBCInfo[instr->op].name, instr->wArg[0]);
+ break;
+
+ case asBCTYPE_wW_ARG:
+ case asBCTYPE_rW_ARG:
+ fprintf(file, " %-8s v%d\n", asBCInfo[instr->op].name, instr->wArg[0]);
+ break;
+
+ case asBCTYPE_wW_rW_ARG:
+ case asBCTYPE_rW_rW_ARG:
+ fprintf(file, " %-8s v%d, v%d\n", asBCInfo[instr->op].name, instr->wArg[0], instr->wArg[1]);
+ break;
+
+ case asBCTYPE_wW_W_ARG:
+ fprintf(file, " %-8s v%d, %d\n", asBCInfo[instr->op].name, instr->wArg[0], instr->wArg[1]);
+ break;
+
+ case asBCTYPE_wW_rW_DW_ARG:
+ case asBCTYPE_rW_W_DW_ARG:
+ switch( instr->op )
+ {
+ case asBC_ADDIf:
+ case asBC_SUBIf:
+ case asBC_MULIf:
+ fprintf(file, " %-8s v%d, v%d, %f\n", asBCInfo[instr->op].name, instr->wArg[0], instr->wArg[1], *((float*) ARG_DW(instr->arg)));
+ break;
+ default:
+ fprintf(file, " %-8s v%d, v%d, %d\n", asBCInfo[instr->op].name, instr->wArg[0], instr->wArg[1], *((int*) ARG_DW(instr->arg)));
+ break;
+ }
+ break;
+
+ case asBCTYPE_DW_ARG:
+ switch( instr->op )
+ {
+ case asBC_OBJTYPE:
+ {
+ asCObjectType *ot = *(asCObjectType**)ARG_DW(instr->arg);
+ fprintf(file, " %-8s 0x%x (type:%s)\n", asBCInfo[instr->op].name, (asUINT)*ARG_DW(instr->arg), ot->GetName());
+ }
+ break;
+
+ case asBC_FuncPtr:
+ {
+ asCScriptFunction *f = *(asCScriptFunction**)ARG_DW(instr->arg);
+ fprintf(file, " %-8s 0x%x (func:%s)\n", asBCInfo[instr->op].name, (asUINT)*ARG_DW(instr->arg), f->GetDeclaration());
+ }
+ break;
+
+ case asBC_PshC4:
+ case asBC_Cast:
+ fprintf(file, " %-8s 0x%x (i:%d, f:%g)\n", asBCInfo[instr->op].name, (asUINT)*ARG_DW(instr->arg), *((int*) ARG_DW(instr->arg)), *((float*) ARG_DW(instr->arg)));
+ break;
+
+ case asBC_TYPEID:
+ fprintf(file, " %-8s 0x%x '%s'\n", asBCInfo[instr->op].name, (asUINT)*ARG_DW(instr->arg), engine->GetTypeDeclaration((int)*ARG_DW(instr->arg)));
+ break;
+
+ case asBC_CALL:
+ case asBC_CALLSYS:
+ case asBC_CALLBND:
+ case asBC_CALLINTF:
+ case asBC_Thiscall1:
+ {
+ int funcID = *(int*)ARG_DW(instr->arg);
+ asCString decl = engine->GetFunctionDeclaration(funcID);
+
+ fprintf(file, " %-8s %d (%s)\n", asBCInfo[instr->op].name, *((int*) ARG_DW(instr->arg)), decl.AddressOf());
+ }
+ break;
+
+ case asBC_REFCPY:
+ fprintf(file, " %-8s 0x%x\n", asBCInfo[instr->op].name, *((int*) ARG_DW(instr->arg)));
+ break;
+
+ case asBC_JMP:
+ case asBC_JZ:
+ case asBC_JLowZ:
+ case asBC_JS:
+ case asBC_JP:
+ case asBC_JNZ:
+ case asBC_JLowNZ:
+ case asBC_JNS:
+ case asBC_JNP:
+ fprintf(file, " %-8s %+d (d:%d)\n", asBCInfo[instr->op].name, *((int*) ARG_DW(instr->arg)), pos+*((int*) ARG_DW(instr->arg)));
+ break;
+
+ default:
+ fprintf(file, " %-8s %d\n", asBCInfo[instr->op].name, *((int*) ARG_DW(instr->arg)));
+ break;
+ }
+ break;
+
+ case asBCTYPE_QW_ARG:
+ switch( instr->op )
+ {
+ case asBC_OBJTYPE:
+ {
+ asCObjectType *ot = *(asCObjectType**)ARG_QW(instr->arg);
+ fprintf(file, " %-8s 0x%x (type:%s)\n", asBCInfo[instr->op].name, (asUINT)*ARG_QW(instr->arg), ot->GetName());
+ }
+ break;
+
+ case asBC_FuncPtr:
+ {
+ asCScriptFunction *f = *(asCScriptFunction**)ARG_QW(instr->arg);
+ fprintf(file, " %-8s 0x%x (func:%s)\n", asBCInfo[instr->op].name, (asUINT)*ARG_QW(instr->arg), f->GetDeclaration());
+ }
+ break;
+
+ case asBC_PGA:
+ {
+ void *ptr = *(void**)ARG_QW(instr->arg);
+ asSMapNode<void*, asCGlobalProperty*> *cursor = 0;
+ if( engine->varAddressMap.MoveTo(&cursor, ptr) )
+ {
+ fprintf(file, " %-8s 0x%x (var:%s)\n", asBCInfo[instr->op].name, (asUINT)*ARG_QW(instr->arg), cursor->value->name.AddressOf());
+ }
+ else
+ {
+ asUINT length;
+ engine->stringFactory->GetRawStringData(ptr, 0, &length);
+ asCString str;
+ str.SetLength(length);
+ engine->stringFactory->GetRawStringData(ptr, str.AddressOf(), &length);
+ if (str.GetLength() > 20)
+ {
+ // TODO: Replace non-visible characters with space or something like it
+ str.SetLength(20);
+ str += "...";
+ }
+ fprintf(file, " %-8s 0x%x (str:%s)\n", asBCInfo[instr->op].name, (asUINT)*ARG_QW(instr->arg), str.AddressOf());
+ }
+ }
+ break;
+
+ default:
+#ifdef __GNUC__
+#ifdef _LP64
+ fprintf(file, " %-8s 0x%lx (i:%ld, f:%g)\n", asBCInfo[instr->op].name, *ARG_QW(instr->arg), *((asINT64*) ARG_QW(instr->arg)), *((double*) ARG_QW(instr->arg)));
+#else
+ fprintf(file, " %-8s 0x%llx (i:%lld, f:%g)\n", asBCInfo[instr->op].name, *ARG_QW(instr->arg), *((asINT64*) ARG_QW(instr->arg)), *((double*) ARG_QW(instr->arg)));
+#endif
+#else
+ fprintf(file, " %-8s 0x%I64x (i:%I64d, f:%g)\n", asBCInfo[instr->op].name, *ARG_QW(instr->arg), *((asINT64*) ARG_QW(instr->arg)), *((double*) ARG_QW(instr->arg)));
+#endif
+ }
+ break;
+
+ case asBCTYPE_wW_QW_ARG:
+ case asBCTYPE_rW_QW_ARG:
+ switch( instr->op )
+ {
+ case asBC_RefCpyV:
+ case asBC_FREE:
+ {
+ asCObjectType *ot = *(asCObjectType**)ARG_QW(instr->arg);
+ fprintf(file, " %-8s v%d, 0x%x (type:%s)\n", asBCInfo[instr->op].name, instr->wArg[0], (asUINT)*ARG_QW(instr->arg), ot->GetName());
+ }
+ break;
+
+ default:
+#ifdef __GNUC__
+#ifdef _LP64
+ fprintf(file, " %-8s v%d, 0x%lx (i:%ld, f:%g)\n", asBCInfo[instr->op].name, instr->wArg[0], *ARG_QW(instr->arg), *((asINT64*) ARG_QW(instr->arg)), *((double*) ARG_QW(instr->arg)));
+#else
Commit: a9290eeb6dd5044fe42248f87834536b2e5af497
https://github.com/scummvm/scummvm/commit/a9290eeb6dd5044fe42248f87834536b2e5af497
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:37+01:00
Commit Message:
HPL1: add and replace angelscript add-ons
Changed paths:
A engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
A engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h
A engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
A engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h
R engines/hpl1/engine/impl/scriptstring.cpp
R engines/hpl1/engine/impl/scriptstring.h
R engines/hpl1/engine/impl/stdstring.cpp
R engines/hpl1/engine/impl/stdstring.h
engines/hpl1/engine/engine.h
engines/hpl1/engine/system/low_level_system.cpp
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index 2708209e061..d8d81da433e 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -153,8 +153,6 @@
#include "hpl1/engine/impl/VertexBufferOGL.h"
#include "hpl1/engine/impl/VertexBufferVBO.h"
#include "hpl1/engine/impl/VideoStreamTheora.h"
-#include "hpl1/engine/impl/scriptstring.h"
-#include "hpl1/engine/impl/stdstring.h"
#include "hpl1/engine/impl/temp-types.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/input/Action.h"
diff --git a/engines/hpl1/engine/impl/scriptstring.cpp b/engines/hpl1/engine/impl/scriptstring.cpp
deleted file mode 100644
index 70ca69b3610..00000000000
--- a/engines/hpl1/engine/impl/scriptstring.cpp
+++ /dev/null
@@ -1,661 +0,0 @@
-#include "hpl1/engine/impl/scriptstring.h"
-#include <assert.h>
-#include <sstream>
-#include <string.h>
-using namespace std;
-
-BEGIN_AS_NAMESPACE
-
-//--------------
-// constructors
-//--------------
-
-asCScriptString::asCScriptString() {
- // Count the first reference
- refCount = 1;
-}
-
-asCScriptString::asCScriptString(const char *s) {
- refCount = 1;
- buffer = s;
-}
-
-asCScriptString::asCScriptString(const string &s) {
- refCount = 1;
- buffer = s;
-}
-
-asCScriptString::asCScriptString(const asCScriptString &s) {
- refCount = 1;
- buffer = s.buffer;
-}
-
-asCScriptString::~asCScriptString() {
- assert(refCount == 0);
-}
-
-//--------------------
-// reference counting
-//--------------------
-
-void asCScriptString::AddRef() {
- refCount++;
-}
-
-static void StringAddRef_Generic(asIScriptGeneric *gen) {
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- thisPointer->AddRef();
-}
-
-void asCScriptString::Release() {
- if (--refCount == 0)
- delete this;
-}
-
-static void StringRelease_Generic(asIScriptGeneric *gen) {
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- thisPointer->Release();
-}
-
-//-----------------
-// string = string
-//-----------------
-
-asCScriptString &asCScriptString::operator=(const asCScriptString &other) {
- // Copy only the buffer, not the reference counter
- buffer = other.buffer;
-
- // Return a reference to this object
- return *this;
-}
-
-static void AssignString_Generic(asIScriptGeneric *gen) {
- asCScriptString *a = (asCScriptString *)gen->GetArgAddress(0);
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- *thisPointer = *a;
- gen->SetReturnAddress(thisPointer);
-}
-
-//------------------
-// string += string
-//------------------
-
-asCScriptString &asCScriptString::operator+=(const asCScriptString &other) {
- buffer += other.buffer;
- return *this;
-}
-
-static void AddAssignString_Generic(asIScriptGeneric *gen) {
- asCScriptString *a = (asCScriptString *)gen->GetArgAddress(0);
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- *thisPointer += *a;
- gen->SetReturnAddress(thisPointer);
-}
-
-//-----------------
-// string + string
-//-----------------
-
-asCScriptString *operator+(const asCScriptString &a, const asCScriptString &b) {
- // Return a new object as a script handle
- return new asCScriptString(a.buffer + b.buffer);
-}
-
-static void ConcatenateStrings_Generic(asIScriptGeneric *gen) {
- asCScriptString *a = (asCScriptString *)gen->GetArgAddress(0);
- asCScriptString *b = (asCScriptString *)gen->GetArgAddress(1);
- asCScriptString *out = *a + *b;
- gen->SetReturnAddress(out);
-}
-
-//----------------
-// string = value
-//----------------
-
-static asCScriptString &AssignBitsToString(asDWORD i, asCScriptString &dest) {
- ostringstream stream;
- stream << hex << i;
- dest.buffer = stream.str();
-
- // Return a reference to the object
- return dest;
-}
-
-static void AssignBitsToString_Generic(asIScriptGeneric *gen) {
- asDWORD i = gen->GetArgDWord(0);
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- AssignBitsToString(i, *thisPointer);
- gen->SetReturnAddress(thisPointer);
-}
-
-static asCScriptString &AssignUIntToString(unsigned int i, asCScriptString &dest) {
- ostringstream stream;
- stream << i;
- dest.buffer = stream.str();
- return dest;
-}
-
-static void AssignUIntToString_Generic(asIScriptGeneric *gen) {
- unsigned int i = gen->GetArgDWord(0);
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- AssignUIntToString(i, *thisPointer);
- gen->SetReturnAddress(thisPointer);
-}
-
-static asCScriptString &AssignIntToString(int i, asCScriptString &dest) {
- ostringstream stream;
- stream << i;
- dest.buffer = stream.str();
- return dest;
-}
-
-static void AssignIntToString_Generic(asIScriptGeneric *gen) {
- int i = gen->GetArgDWord(0);
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- AssignIntToString(i, *thisPointer);
- gen->SetReturnAddress(thisPointer);
-}
-
-static asCScriptString &AssignFloatToString(float f, asCScriptString &dest) {
- ostringstream stream;
- stream << f;
- dest.buffer = stream.str();
- return dest;
-}
-
-static void AssignFloatToString_Generic(asIScriptGeneric *gen) {
- float f = gen->GetArgFloat(0);
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- AssignFloatToString(f, *thisPointer);
- gen->SetReturnAddress(thisPointer);
-}
-
-static asCScriptString &AssignDoubleToString(double f, asCScriptString &dest) {
- ostringstream stream;
- stream << f;
- dest.buffer = stream.str();
- return dest;
-}
-
-static void AssignDoubleToString_Generic(asIScriptGeneric *gen) {
- double f = gen->GetArgDouble(0);
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- AssignDoubleToString(f, *thisPointer);
- gen->SetReturnAddress(thisPointer);
-}
-
-//-----------------
-// string += value
-//-----------------
-
-static asCScriptString &AddAssignBitsToString(asDWORD i, asCScriptString &dest) {
- ostringstream stream;
- stream << hex << i;
- dest.buffer += stream.str();
- return dest;
-}
-
-static void AddAssignBitsToString_Generic(asIScriptGeneric *gen) {
- asDWORD i = gen->GetArgDWord(0);
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- AddAssignBitsToString(i, *thisPointer);
- gen->SetReturnAddress(thisPointer);
-}
-
-static asCScriptString &AddAssignUIntToString(unsigned int i, asCScriptString &dest) {
- ostringstream stream;
- stream << i;
- dest.buffer += stream.str();
- return dest;
-}
-
-static void AddAssignUIntToString_Generic(asIScriptGeneric *gen) {
- unsigned int i = gen->GetArgDWord(0);
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- AddAssignUIntToString(i, *thisPointer);
- gen->SetReturnAddress(thisPointer);
-}
-
-static asCScriptString &AddAssignIntToString(int i, asCScriptString &dest) {
- ostringstream stream;
- stream << i;
- dest.buffer += stream.str();
- return dest;
-}
-
-static void AddAssignIntToString_Generic(asIScriptGeneric *gen) {
- int i = gen->GetArgDWord(0);
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- AddAssignIntToString(i, *thisPointer);
- gen->SetReturnAddress(thisPointer);
-}
-
-static asCScriptString &AddAssignFloatToString(float f, asCScriptString &dest) {
- ostringstream stream;
- stream << f;
- dest.buffer += stream.str();
- return dest;
-}
-
-static void AddAssignFloatToString_Generic(asIScriptGeneric *gen) {
- float f = gen->GetArgFloat(0);
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- AddAssignFloatToString(f, *thisPointer);
- gen->SetReturnAddress(thisPointer);
-}
-
-static asCScriptString &AddAssignDoubleToString(double f, asCScriptString &dest) {
- ostringstream stream;
- stream << f;
- dest.buffer += stream.str();
- return dest;
-}
-
-static void AddAssignDoubleToString_Generic(asIScriptGeneric *gen) {
- double f = gen->GetArgDouble(0);
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- AddAssignDoubleToString(f, *thisPointer);
- gen->SetReturnAddress(thisPointer);
-}
-
-//----------------
-// string + value
-//----------------
-
-static asCScriptString *AddStringBits(const asCScriptString &str, asDWORD i) {
- ostringstream stream;
- stream << hex << i;
- return new asCScriptString(str.buffer + stream.str());
-}
-
-static void AddStringBits_Generic(asIScriptGeneric *gen) {
- asCScriptString *str = (asCScriptString *)gen->GetArgAddress(0);
- asDWORD i = gen->GetArgDWord(1);
- asCScriptString *out = AddStringBits(*str, i);
- gen->SetReturnAddress(out);
-}
-
-static asCScriptString *AddStringUInt(const asCScriptString &str, unsigned int i) {
- ostringstream stream;
- stream << i;
- return new asCScriptString(str.buffer + stream.str());
-}
-
-static void AddStringUInt_Generic(asIScriptGeneric *gen) {
- asCScriptString *str = (asCScriptString *)gen->GetArgAddress(0);
- unsigned int i = gen->GetArgDWord(1);
- asCScriptString *out = AddStringUInt(*str, i);
- gen->SetReturnAddress(out);
-}
-
-static asCScriptString *AddStringInt(const asCScriptString &str, int i) {
- ostringstream stream;
- stream << i;
- return new asCScriptString(str.buffer + stream.str());
-}
-
-static void AddStringInt_Generic(asIScriptGeneric *gen) {
- asCScriptString *str = (asCScriptString *)gen->GetArgAddress(0);
- int i = gen->GetArgDWord(1);
- asCScriptString *out = AddStringInt(*str, i);
- gen->SetReturnAddress(out);
-}
-
-static asCScriptString *AddStringFloat(const asCScriptString &str, float f) {
- ostringstream stream;
- stream << f;
- return new asCScriptString(str.buffer + stream.str());
-}
-
-static void AddStringFloat_Generic(asIScriptGeneric *gen) {
- asCScriptString *str = (asCScriptString *)gen->GetArgAddress(0);
- float f = gen->GetArgFloat(1);
- asCScriptString *out = AddStringFloat(*str, f);
- gen->SetReturnAddress(out);
-}
-
-static asCScriptString *AddStringDouble(const asCScriptString &str, double f) {
- ostringstream stream;
- stream << f;
- return new asCScriptString(str.buffer + stream.str());
-}
-
-static void AddStringDouble_Generic(asIScriptGeneric *gen) {
- asCScriptString *str = (asCScriptString *)gen->GetArgAddress(0);
- double f = gen->GetArgDouble(1);
- asCScriptString *out = AddStringDouble(*str, f);
- gen->SetReturnAddress(out);
-}
-
-//----------------
-// value + string
-//----------------
-
-static asCScriptString *AddBitsString(asDWORD i, const asCScriptString &str) {
- ostringstream stream;
- stream << hex << i;
- return new asCScriptString(stream.str() + str.buffer);
-}
-
-static void AddBitsString_Generic(asIScriptGeneric *gen) {
- asDWORD i = gen->GetArgDWord(0);
- asCScriptString *str = (asCScriptString *)gen->GetArgAddress(1);
- asCScriptString *out = AddBitsString(i, *str);
- gen->SetReturnAddress(out);
-}
-
-static asCScriptString *AddIntString(int i, const asCScriptString &str) {
- ostringstream stream;
- stream << i;
- return new asCScriptString(stream.str() + str.buffer);
-}
-
-static void AddIntString_Generic(asIScriptGeneric *gen) {
- int i = gen->GetArgDWord(0);
- asCScriptString *str = (asCScriptString *)gen->GetArgAddress(1);
- asCScriptString *out = AddIntString(i, *str);
- gen->SetReturnAddress(out);
-}
-
-static asCScriptString *AddUIntString(unsigned int i, const asCScriptString &str) {
- ostringstream stream;
- stream << i;
- return new asCScriptString(stream.str() + str.buffer);
-}
-
-static void AddUIntString_Generic(asIScriptGeneric *gen) {
- unsigned int i = gen->GetArgDWord(0);
- asCScriptString *str = (asCScriptString *)gen->GetArgAddress(1);
- asCScriptString *out = AddUIntString(i, *str);
- gen->SetReturnAddress(out);
-}
-
-static asCScriptString *AddFloatString(float f, const asCScriptString &str) {
- ostringstream stream;
- stream << f;
- return new asCScriptString(stream.str() + str.buffer);
-}
-
-static void AddFloatString_Generic(asIScriptGeneric *gen) {
- float f = gen->GetArgFloat(0);
- asCScriptString *str = (asCScriptString *)gen->GetArgAddress(1);
- asCScriptString *out = AddFloatString(f, *str);
- gen->SetReturnAddress(out);
-}
-
-static asCScriptString *AddDoubleString(double f, const asCScriptString &str) {
- ostringstream stream;
- stream << f;
- return new asCScriptString(stream.str() + str.buffer);
-}
-
-static void AddDoubleString_Generic(asIScriptGeneric *gen) {
- double f = gen->GetArgDouble(0);
- asCScriptString *str = (asCScriptString *)gen->GetArgAddress(1);
- asCScriptString *out = AddDoubleString(f, *str);
- gen->SetReturnAddress(out);
-}
-
-//----------
-// string[]
-//----------
-
-static char *StringCharAt(unsigned int i, asCScriptString &str) {
- if (i >= str.buffer.size()) {
- // Set a script exception
- asIScriptContext *ctx = asGetActiveContext();
- ctx->SetException("Out of range");
-
- // Return a null pointer
- return 0;
- }
-
- return &str.buffer[i];
-}
-
-static void StringCharAt_Generic(asIScriptGeneric *gen) {
- unsigned int i = gen->GetArgDWord(0);
- asCScriptString *str = (asCScriptString *)gen->GetObject();
- char *ch = StringCharAt(i, *str);
- gen->SetReturnAddress(ch);
-}
-
-//-----------------------
-// AngelScript functions
-//-----------------------
-
-// This function allocates memory for the string object
-static void *StringAlloc(int) {
- return new char[sizeof(asCScriptString)];
-}
-
-// This function deallocates the memory for the string object
-static void StringFree(void *p) {
- assert(p);
- delete[](char *) p;
-}
-
-// This is the string factory that creates new strings for the script
-static asCScriptString *StringFactory(asUINT length, const char *s) {
- // Return a script handle to a new string
- return new asCScriptString(s);
-}
-
-static void StringFactory_Generic(asIScriptGeneric *gen) {
- asUINT length = gen->GetArgDWord(0);
- const char *s = (const char *)gen->GetArgAddress(1);
- asCScriptString *str = StringFactory(length, s);
- gen->SetReturnAddress(str);
-}
-
-// This is a wrapper for the default asCScriptString constructor, since
-// it is not possible to take the address of the constructor directly
-static void ConstructString(asCScriptString *thisPointer) {
- // Construct the string in the memory received
- new (thisPointer) asCScriptString();
-}
-
-static void ConstructString_Generic(asIScriptGeneric *gen) {
- asCScriptString *thisPointer = (asCScriptString *)gen->GetObject();
- ConstructString(thisPointer);
-}
-
-static void StringEqual_Generic(asIScriptGeneric *gen) {
- string *a = (string *)gen->GetArgAddress(0);
- string *b = (string *)gen->GetArgAddress(1);
- bool r = *a == *b;
- gen->SetReturnDWord(r);
-}
-
-static void StringNotEqual_Generic(asIScriptGeneric *gen) {
- string *a = (string *)gen->GetArgAddress(0);
- string *b = (string *)gen->GetArgAddress(1);
- bool r = *a != *b;
- gen->SetReturnDWord(r);
-}
-
-static void StringLesserOrEqual_Generic(asIScriptGeneric *gen) {
- string *a = (string *)gen->GetArgAddress(0);
- string *b = (string *)gen->GetArgAddress(1);
- bool r = *a <= *b;
- gen->SetReturnDWord(r);
-}
-
-static void StringGreaterOrEqual_Generic(asIScriptGeneric *gen) {
- string *a = (string *)gen->GetArgAddress(0);
- string *b = (string *)gen->GetArgAddress(1);
- bool r = *a >= *b;
- gen->SetReturnDWord(r);
-}
-
-static void StringLesser_Generic(asIScriptGeneric *gen) {
- string *a = (string *)gen->GetArgAddress(0);
- string *b = (string *)gen->GetArgAddress(1);
- bool r = *a < *b;
- gen->SetReturnDWord(r);
-}
-
-static void StringGreater_Generic(asIScriptGeneric *gen) {
- string *a = (string *)gen->GetArgAddress(0);
- string *b = (string *)gen->GetArgAddress(1);
- bool r = *a > *b;
- gen->SetReturnDWord(r);
-}
-
-static void StringLength_Generic(asIScriptGeneric *gen) {
- string *s = (string *)gen->GetObject();
- size_t l = s->size();
- gen->SetReturnDWord((asUINT)l);
-}
-
-// This is where we register the string type
-void RegisterScriptString_Native(asIScriptEngine *engine) {
-#if 0
- int r;
-
- // Register the type
- r = engine->RegisterObjectType("string", sizeof(asCScriptString), asOBJ_CLASS_CDA); assert( r >= 0 );
-
- // Register the object operator overloads
- // Note: We don't have to register the destructor, since the object uses reference counting
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADDREF, "void f()", asMETHOD(asCScriptString,AddRef), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_RELEASE, "void f()", asMETHOD(asCScriptString,Release), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(const string &in)", asMETHODPR(asCScriptString, operator =, (const asCScriptString&), asCScriptString&), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(const string &in)", asMETHODPR(asCScriptString, operator+=, (const asCScriptString&), asCScriptString&), asCALL_THISCALL); assert( r >= 0 );
-
- // Register the memory allocator routines. This will make all memory allocations for the string
- // object be made in one place, which is important if for example the script library is used from a dll
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ALLOC, "string &f(uint)", asFUNCTION(StringAlloc), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_FREE, "void f(string &in)", asFUNCTION(StringFree), asCALL_CDECL); assert( r >= 0 );
-
- // Register the factory to return a handle to a new string
- // Note: We must register the string factory after the basic behaviours,
- // otherwise the library will not allow the use of object handles for this type
- r = engine->RegisterStringFactory("string@", asFUNCTION(StringFactory), asCALL_CDECL); assert( r >= 0 );
-
- // Register the global operator overloads
- // Note: We can use std::string's methods directly because the
- // internal std::string is placed at the beginning of the class
- r = engine->RegisterGlobalBehaviour(asBEHAVE_EQUAL, "bool f(const string &in, const string &in)", asFUNCTIONPR(operator==, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_NOTEQUAL, "bool f(const string &in, const string &in)", asFUNCTIONPR(operator!=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_LEQUAL, "bool f(const string &in, const string &in)", asFUNCTIONPR(operator<=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_GEQUAL, "bool f(const string &in, const string &in)", asFUNCTIONPR(operator>=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_LESSTHAN, "bool f(const string &in, const string &in)", asFUNCTIONPR(operator <, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_GREATERTHAN, "bool f(const string &in, const string &in)", asFUNCTIONPR(operator >, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(const string &in, const string &in)", asFUNCTIONPR(operator +, (const asCScriptString &, const asCScriptString &), asCScriptString*), asCALL_CDECL); assert( r >= 0 );
-
- // Register the index operator, both as a mutator and as an inspector
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_INDEX, "uint8 &f(uint)", asFUNCTION(StringCharAt), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_INDEX, "const uint8 &f(uint) const", asFUNCTION(StringCharAt), asCALL_CDECL_OBJLAST); assert( r >= 0 );
-
- // Register the object methods
- r = engine->RegisterObjectMethod("string", "uint length() const", asMETHOD(string,size), asCALL_THISCALL); assert( r >= 0 );
-
- // Automatic conversion from values
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(double)", asFUNCTION(AssignDoubleToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(double)", asFUNCTION(AddAssignDoubleToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(const string &in, double)", asFUNCTION(AddStringDouble), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(double, const string &in)", asFUNCTION(AddDoubleString), asCALL_CDECL); assert( r >= 0 );
-
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(float)", asFUNCTION(AssignFloatToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(float)", asFUNCTION(AddAssignFloatToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(const string &in, float)", asFUNCTION(AddStringFloat), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(float, const string &in)", asFUNCTION(AddFloatString), asCALL_CDECL); assert( r >= 0 );
-
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(int)", asFUNCTION(AssignIntToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(int)", asFUNCTION(AddAssignIntToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(const string &in, int)", asFUNCTION(AddStringInt), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(int, const string &in)", asFUNCTION(AddIntString), asCALL_CDECL); assert( r >= 0 );
-
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(uint)", asFUNCTION(AssignUIntToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(uint)", asFUNCTION(AddAssignUIntToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(const string &in, uint)", asFUNCTION(AddStringUInt), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(uint, const string &in)", asFUNCTION(AddUIntString), asCALL_CDECL); assert( r >= 0 );
-
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(bits)", asFUNCTION(AssignBitsToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(bits)", asFUNCTION(AddAssignBitsToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(const string &in, bits)", asFUNCTION(AddStringBits), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(bits, const string &in)", asFUNCTION(AddBitsString), asCALL_CDECL); assert( r >= 0 );
-#endif
-}
-
-void RegisterScriptString_Generic(asIScriptEngine *engine) {
-#if 0
- int r;
-
- // Register the type
- r = engine->RegisterObjectType("string", sizeof(asCScriptString), asOBJ_CLASS_CDA); assert( r >= 0 );
-
- // Register the object operator overloads
- // Note: We don't have to register the destructor, since the object uses reference counting
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructString_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADDREF, "void f()", asFUNCTION(StringAddRef_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_RELEASE, "void f()", asFUNCTION(StringRelease_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(const string &in)", asFUNCTION(AssignString_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(const string &in)", asFUNCTION(AddAssignString_Generic), asCALL_GENERIC); assert( r >= 0 );
-
- // Register the memory allocator routines. This will make all memory allocations for the string
- // object be made in one place, which is important if for example the script library is used from a dll
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ALLOC, "string &f(uint)", asFUNCTION(StringAlloc), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_FREE, "void f(string &in)", asFUNCTION(StringFree), asCALL_CDECL); assert( r >= 0 );
-
- // Register the factory to return a handle to a new string
- // Note: We must register the string factory after the basic behaviours,
- // otherwise the library will not allow the use of object handles for this type
- r = engine->RegisterStringFactory("string@", asFUNCTION(StringFactory_Generic), asCALL_GENERIC); assert( r >= 0 );
-
- // Register the global operator overloads
- // Note: We can use std::string's methods directly because the
- // internal std::string is placed at the beginning of the class
- r = engine->RegisterGlobalBehaviour(asBEHAVE_EQUAL, "bool f(const string &in, const string &in)", asFUNCTION(StringEqual_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_NOTEQUAL, "bool f(const string &in, const string &in)", asFUNCTION(StringNotEqual_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_LEQUAL, "bool f(const string &in, const string &in)", asFUNCTION(StringLesserOrEqual_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_GEQUAL, "bool f(const string &in, const string &in)", asFUNCTION(StringGreaterOrEqual_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_LESSTHAN, "bool f(const string &in, const string &in)", asFUNCTION(StringLesser_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_GREATERTHAN, "bool f(const string &in, const string &in)", asFUNCTION(StringGreater_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(const string &in, const string &in)", asFUNCTION(ConcatenateStrings_Generic), asCALL_GENERIC); assert( r >= 0 );
-
- // Register the index operator, both as a mutator and as an inspector
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_INDEX, "uint8 &f(uint)", asFUNCTION(StringCharAt_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_INDEX, "const uint8 &f(uint) const", asFUNCTION(StringCharAt_Generic), asCALL_GENERIC); assert( r >= 0 );
-
- // Register the object methods
- r = engine->RegisterObjectMethod("string", "uint length() const", asFUNCTION(StringLength_Generic), asCALL_GENERIC); assert( r >= 0 );
-
- // Automatic conversion from values
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(double)", asFUNCTION(AssignDoubleToString_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(double)", asFUNCTION(AddAssignDoubleToString_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(const string &in, double)", asFUNCTION(AddStringDouble_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(double, const string &in)", asFUNCTION(AddDoubleString_Generic), asCALL_GENERIC); assert( r >= 0 );
-
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(float)", asFUNCTION(AssignFloatToString_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(float)", asFUNCTION(AddAssignFloatToString_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(const string &in, float)", asFUNCTION(AddStringFloat_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(float, const string &in)", asFUNCTION(AddFloatString_Generic), asCALL_GENERIC); assert( r >= 0 );
-
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(int)", asFUNCTION(AssignIntToString_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(int)", asFUNCTION(AddAssignIntToString_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(const string &in, int)", asFUNCTION(AddStringInt_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(int, const string &in)", asFUNCTION(AddIntString_Generic), asCALL_GENERIC); assert( r >= 0 );
-
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(uint)", asFUNCTION(AssignUIntToString_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(uint)", asFUNCTION(AddAssignUIntToString_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(const string &in, uint)", asFUNCTION(AddStringUInt_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(uint, const string &in)", asFUNCTION(AddUIntString_Generic), asCALL_GENERIC); assert( r >= 0 );
-
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(bits)", asFUNCTION(AssignBitsToString_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(bits)", asFUNCTION(AddAssignBitsToString_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(const string &in, bits)", asFUNCTION(AddStringBits_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string@ f(bits, const string &in)", asFUNCTION(AddBitsString_Generic), asCALL_GENERIC); assert( r >= 0 );
-#endif
-}
-
-void RegisterScriptString(asIScriptEngine *engine) {
- if (strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY"))
- RegisterScriptString_Generic(engine);
- else
- RegisterScriptString_Native(engine);
-}
-
-END_AS_NAMESPACE
diff --git a/engines/hpl1/engine/impl/scriptstring.h b/engines/hpl1/engine/impl/scriptstring.h
deleted file mode 100644
index 4749ea11a75..00000000000
--- a/engines/hpl1/engine/impl/scriptstring.h
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// asCScriptString
-//
-// This class is used to pass strings between the application and the script engine.
-// It is basically a container for the normal std::string, with the addition of a
-// reference counter so that the script can use object handles to hold the type.
-//
-// Because the class is reference counted it cannot be stored locally in the
-// application functions, nor be received or returned by value. Instead it should
-// be manipulated through pointers or references.
-//
-// Note, because the internal buffer is placed at the beginning of the class
-// structure it is infact possible to receive this type as a reference or pointer
-// to a normal std::string where the reference counter doesn't have to be manipulated.
-//
-
-#ifndef SCRIPTSTRING_H
-#define SCRIPTSTRING_H
-
-#include "hpl1/engine/libraries/angelscript/angelscript.h"
-#include <string>
-
-BEGIN_AS_NAMESPACE
-
-class asCScriptString {
-public:
- asCScriptString();
- asCScriptString(const asCScriptString &other);
- asCScriptString(const char *s);
- asCScriptString(const std::string &s);
-
- void AddRef();
- void Release();
-
- asCScriptString &operator=(const asCScriptString &other);
- asCScriptString &operator+=(const asCScriptString &other);
-
- std::string buffer;
-
-protected:
- ~asCScriptString();
- int refCount;
-};
-
-// This function will determine the configuration of the engine
-// and use one of the two functions below to register the string type
-void RegisterScriptString(asIScriptEngine *engine);
-
-// Call this function to register the string type
-// using native calling conventions
-void RegisterScriptString_Native(asIScriptEngine *engine);
-
-// Use this one instead if native calling conventions
-// are not supported on the target platform
-void RegisterScriptString_Generic(asIScriptEngine *engine);
-
-END_AS_NAMESPACE
-
-#endif
diff --git a/engines/hpl1/engine/impl/stdstring.cpp b/engines/hpl1/engine/impl/stdstring.cpp
deleted file mode 100644
index 8f7a9817bb0..00000000000
--- a/engines/hpl1/engine/impl/stdstring.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-#include "hpl1/engine/impl/stdstring.h"
-#include <assert.h>
-#include <sstream>
-using namespace std;
-
-static string StringFactory(asUINT length, const char *s) {
- return string(s);
-}
-
-static void ConstructString(string *thisPointer) {
- new (thisPointer) string();
-}
-
-static void DestructString(string *thisPointer) {
- thisPointer->~string();
-}
-
-static string &AssignBitsToString(unsigned int i, string &dest) {
- ostringstream stream;
- stream << hex << i;
- dest = stream.str();
- return dest;
-}
-
-static string &AddAssignBitsToString(unsigned int i, string &dest) {
- ostringstream stream;
- stream << hex << i;
- dest += stream.str();
- return dest;
-}
-
-static string AddStringBits(string &str, unsigned int i) {
- ostringstream stream;
- stream << hex << i;
- str += stream.str();
- return str;
-}
-
-static string AddBitsString(unsigned int i, string &str) {
- ostringstream stream;
- stream << hex << i;
- return stream.str() + str;
-}
-
-static string &AssignUIntToString(unsigned int i, string &dest) {
- ostringstream stream;
- stream << i;
- dest = stream.str();
- return dest;
-}
-
-static string &AddAssignUIntToString(unsigned int i, string &dest) {
- ostringstream stream;
- stream << i;
- dest += stream.str();
- return dest;
-}
-
-static string AddStringUInt(string &str, unsigned int i) {
- ostringstream stream;
- stream << i;
- str += stream.str();
- return str;
-}
-
-static string AddIntString(int i, string &str) {
- ostringstream stream;
- stream << i;
- return stream.str() + str;
-}
-
-static string &AssignIntToString(int i, string &dest) {
- ostringstream stream;
- stream << i;
- dest = stream.str();
- return dest;
-}
-
-static string &AddAssignIntToString(int i, string &dest) {
- ostringstream stream;
- stream << i;
- dest += stream.str();
- return dest;
-}
-
-static string AddStringInt(string &str, int i) {
- ostringstream stream;
- stream << i;
- str += stream.str();
- return str;
-}
-
-static string AddUIntString(unsigned int i, string &str) {
- ostringstream stream;
- stream << i;
- return stream.str() + str;
-}
-
-static string &AssignDoubleToString(double f, string &dest) {
- ostringstream stream;
- stream << f;
- dest = stream.str();
- return dest;
-}
-
-static string &AddAssignDoubleToString(double f, string &dest) {
- ostringstream stream;
- stream << f;
- dest += stream.str();
- return dest;
-}
-
-static string AddStringDouble(string &str, double f) {
- ostringstream stream;
- stream << f;
- str += stream.str();
- return str;
-}
-
-static string AddDoubleString(double f, string &str) {
- ostringstream stream;
- stream << f;
- return stream.str() + str;
-}
-
-void RegisterStdString(asIScriptEngine *engine) {
-#if 0
- int r;
-
- // Register the bstr type
- r = engine->RegisterObjectType("string", sizeof(string), asOBJ_CLASS_CDA); assert( r >= 0 );
-
- // Register the bstr factory
- r = engine->RegisterStringFactory("string", asFUNCTION(StringFactory), asCALL_CDECL); assert( r >= 0 );
-
- // Register the object operator overloads
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(string &in)", asMETHODPR(string, operator =, (const string&), string&), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(string &in)", asMETHODPR(string, operator+=, (const string&), string&), asCALL_THISCALL); assert( r >= 0 );
-
- // Register the global operator overloads
- r = engine->RegisterGlobalBehaviour(asBEHAVE_EQUAL, "bool f(string &in, string &in)", asFUNCTIONPR(operator==, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_NOTEQUAL, "bool f(string &in, string &in)", asFUNCTIONPR(operator!=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_LEQUAL, "bool f(string &in, string &in)", asFUNCTIONPR(operator<=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_GEQUAL, "bool f(string &in, string &in)", asFUNCTIONPR(operator>=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_LESSTHAN, "bool f(string &in, string &in)", asFUNCTIONPR(operator <, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_GREATERTHAN, "bool f(string &in, string &in)", asFUNCTIONPR(operator >, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string f(string &in, string &in)", asFUNCTIONPR(operator +, (const string &, const string &), string), asCALL_CDECL); assert( r >= 0 );
-
- // Register the object methods
- r = engine->RegisterObjectMethod("string", "uint length()", asMETHOD(string,size), asCALL_THISCALL); assert( r >= 0 );
-
- // Automatic conversion from values
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(double)", asFUNCTION(AssignDoubleToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(double)", asFUNCTION(AddAssignDoubleToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string f(string &in, double)", asFUNCTION(AddStringDouble), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string f(double, string &in)", asFUNCTION(AddDoubleString), asCALL_CDECL); assert( r >= 0 );
-
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(int)", asFUNCTION(AssignIntToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(int)", asFUNCTION(AddAssignIntToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string f(string &in, int)", asFUNCTION(AddStringInt), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string f(int, string &in)", asFUNCTION(AddIntString), asCALL_CDECL); assert( r >= 0 );
-
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(uint)", asFUNCTION(AssignUIntToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(uint)", asFUNCTION(AddAssignUIntToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string f(string &in, uint)", asFUNCTION(AddStringUInt), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string f(uint, string &in)", asFUNCTION(AddUIntString), asCALL_CDECL); assert( r >= 0 );
-
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(bits)", asFUNCTION(AssignBitsToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(bits)", asFUNCTION(AddAssignBitsToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string f(string &in, bits)", asFUNCTION(AddStringBits), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string f(bits, string &in)", asFUNCTION(AddBitsString), asCALL_CDECL); assert( r >= 0 );
-#endif
-}
diff --git a/engines/hpl1/engine/impl/stdstring.h b/engines/hpl1/engine/impl/stdstring.h
deleted file mode 100644
index 707af0503c0..00000000000
--- a/engines/hpl1/engine/impl/stdstring.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef HPL_STDSTR_H
-#define HPL_STDSTR_H
-
-#include "hpl1/engine/libraries/angelscript/angelscript.h"
-#include <string>
-
-void RegisterStdString(asIScriptEngine *engine);
-
-#endif
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
new file mode 100644
index 00000000000..118001074e3
--- /dev/null
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
@@ -0,0 +1,89 @@
+#include <string.h>
+#include "scripthelper.h"
+#include <assert.h>
+#include <stdio.h>
+#include <fstream>
+#include <set>
+#include <stdlib.h>
+
+using namespace std;
+
+BEGIN_AS_NAMESPACE
+
+int ExecuteString(asIScriptEngine *engine, const char *code, asIScriptModule *mod, asIScriptContext *ctx)
+{
+ return ExecuteString(engine, code, 0, asTYPEID_VOID, mod, ctx);
+}
+
+int ExecuteString(asIScriptEngine *engine, const char *code, void *ref, int refTypeId, asIScriptModule *mod, asIScriptContext *ctx)
+{
+ // Wrap the code in a function so that it can be compiled and executed
+ string funcCode = " ExecuteString() {\n";
+ funcCode += code;
+ funcCode += "\n;}";
+
+ // Determine the return type based on the type of the ref arg
+ funcCode = engine->GetTypeDeclaration(refTypeId, true) + funcCode;
+
+ // GetModule will free unused types, so to be on the safe side we'll hold on to a reference to the type
+ asITypeInfo *type = 0;
+ if( refTypeId & asTYPEID_MASK_OBJECT )
+ {
+ type = engine->GetTypeInfoById(refTypeId);
+ if( type )
+ type->AddRef();
+ }
+
+ // If no module was provided, get a dummy from the engine
+ asIScriptModule *execMod = mod ? mod : engine->GetModule("ExecuteString", asGM_ALWAYS_CREATE);
+
+ // Now it's ok to release the type
+ if( type )
+ type->Release();
+
+ // Compile the function that can be executed
+ asIScriptFunction *func = 0;
+ int r = execMod->CompileFunction("ExecuteString", funcCode.c_str(), -1, 0, &func);
+ if( r < 0 )
+ return r;
+
+ // If no context was provided, request a new one from the engine
+ asIScriptContext *execCtx = ctx ? ctx : engine->RequestContext();
+ r = execCtx->Prepare(func);
+ if (r >= 0)
+ {
+ // Execute the function
+ r = execCtx->Execute();
+
+ // Unless the provided type was void retrieve it's value
+ if (ref != 0 && refTypeId != asTYPEID_VOID)
+ {
+ if (refTypeId & asTYPEID_OBJHANDLE)
+ {
+ // Expect the pointer to be null to start with
+ assert(*reinterpret_cast<void**>(ref) == 0);
+ *reinterpret_cast<void**>(ref) = *reinterpret_cast<void**>(execCtx->GetAddressOfReturnValue());
+ engine->AddRefScriptObject(*reinterpret_cast<void**>(ref), engine->GetTypeInfoById(refTypeId));
+ }
+ else if (refTypeId & asTYPEID_MASK_OBJECT)
+ {
+ // Use the registered assignment operator to do a value assign.
+ // This assumes that the ref is pointing to a valid object instance.
+ engine->AssignScriptObject(ref, execCtx->GetAddressOfReturnValue(), engine->GetTypeInfoById(refTypeId));
+ }
+ else
+ {
+ // Copy the primitive value
+ memcpy(ref, execCtx->GetAddressOfReturnValue(), engine->GetSizeOfPrimitiveType(refTypeId));
+ }
+ }
+ }
+
+ // Clean up
+ func->Release();
+ if( !ctx ) engine->ReturnContext(execCtx);
+
+ return r;
+}
+
+END_AS_NAMESPACE
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h
new file mode 100644
index 00000000000..8e83ead2c7a
--- /dev/null
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h
@@ -0,0 +1,27 @@
+#ifndef SCRIPTHELPER_H
+#define SCRIPTHELPER_H
+
+#include <sstream>
+#include <string>
+
+#ifndef ANGELSCRIPT_H
+// Avoid having to inform include path if header is already include before
+#include "hpl1/engine/libraries/angelscript/angelscript.h"
+#endif
+
+
+BEGIN_AS_NAMESPACE
+
+// Compile and execute simple statements
+// The module is optional. If given the statements can access the entities compiled in the module.
+// The caller can optionally provide its own context, for example if a context should be reused.
+int ExecuteString(asIScriptEngine *engine, const char *code, asIScriptModule *mod = 0, asIScriptContext *ctx = 0);
+
+// Compile and execute simple statements with option of return value
+// The module is optional. If given the statements can access the entitites compiled in the module.
+// The caller can optionally provide its own context, for example if a context should be reused.
+int ExecuteString(asIScriptEngine *engine, const char *code, void *ret, int retTypeId, asIScriptModule *mod = 0, asIScriptContext *ctx = 0);
+
+END_AS_NAMESPACE
+
+#endif
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
new file mode 100644
index 00000000000..befc4d4b0d5
--- /dev/null
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -0,0 +1,1365 @@
+#include "hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h"
+#include <assert.h> // assert()
+#include <sstream> // std::stringstream
+#include <string.h> // strstr()
+#include <stdio.h> // sprintf()
+#include <stdlib.h> // strtod()
+#ifndef __psp2__
+ #include <locale.h> // setlocale()
+#endif
+
+using namespace std;
+
+// This macro is used to avoid warnings about unused variables.
+// Usually where the variables are only used in debug mode.
+#define UNUSED_VAR(x) (void)(x)
+
+#ifdef AS_CAN_USE_CPP11
+// The string factory doesn't need to keep a specific order in the
+// cache, so the unordered_map is faster than the ordinary map
+#include <unordered_map> // std::unordered_map
+BEGIN_AS_NAMESPACE
+typedef unordered_map<string, int> map_t;
+END_AS_NAMESPACE
+#else
+#include <map> // std::map
+BEGIN_AS_NAMESPACE
+typedef map<string, int> map_t;
+END_AS_NAMESPACE
+#endif
+
+BEGIN_AS_NAMESPACE
+class CStdStringFactory : public asIStringFactory
+{
+public:
+ CStdStringFactory() {}
+ ~CStdStringFactory()
+ {
+ // The script engine must release each string
+ // constant that it has requested
+ assert(stringCache.size() == 0);
+ }
+
+ const void *GetStringConstant(const char *data, asUINT length)
+ {
+ // The string factory might be modified from multiple
+ // threads, so it is necessary to use a mutex.
+ asAcquireExclusiveLock();
+
+ string str(data, length);
+ map_t::iterator it = stringCache.find(str);
+ if (it != stringCache.end())
+ it->second++;
+ else
+ it = stringCache.insert(map_t::value_type(str, 1)).first;
+
+ asReleaseExclusiveLock();
+
+ return reinterpret_cast<const void*>(&it->first);
+ }
+
+ int ReleaseStringConstant(const void *str)
+ {
+ if (str == 0)
+ return asERROR;
+
+ int ret = asSUCCESS;
+
+ // The string factory might be modified from multiple
+ // threads, so it is necessary to use a mutex.
+ asAcquireExclusiveLock();
+
+ map_t::iterator it = stringCache.find(*reinterpret_cast<const string*>(str));
+ if (it == stringCache.end())
+ ret = asERROR;
+ else
+ {
+ it->second--;
+ if (it->second == 0)
+ stringCache.erase(it);
+ }
+
+ asReleaseExclusiveLock();
+
+ return ret;
+ }
+
+ int GetRawStringData(const void *str, char *data, asUINT *length) const
+ {
+ if (str == 0)
+ return asERROR;
+
+ if (length)
+ *length = (asUINT)reinterpret_cast<const string*>(str)->length();
+
+ if (data)
+ memcpy(data, reinterpret_cast<const string*>(str)->c_str(), reinterpret_cast<const string*>(str)->length());
+
+ return asSUCCESS;
+ }
+
+ // THe access to the string cache is protected with the common mutex provided by AngelScript
+ map_t stringCache;
+};
+
+static CStdStringFactory *stringFactory = 0;
+
+// TODO: Make this public so the application can also use the string
+// factory and share the string constants if so desired, or to
+// monitor the size of the string factory cache.
+CStdStringFactory *GetStdStringFactorySingleton()
+{
+ if( stringFactory == 0 )
+ {
+ // The following instance will be destroyed by the global
+ // CStdStringFactoryCleaner instance upon application shutdown
+ stringFactory = new CStdStringFactory();
+ }
+ return stringFactory;
+}
+
+class CStdStringFactoryCleaner
+{
+public:
+ ~CStdStringFactoryCleaner()
+ {
+ if (stringFactory)
+ {
+ // Only delete the string factory if the stringCache is empty
+ // If it is not empty, it means that someone might still attempt
+ // to release string constants, so if we delete the string factory
+ // the application might crash. Not deleting the cache would
+ // lead to a memory leak, but since this is only happens when the
+ // application is shutting down anyway, it is not important.
+ if (stringFactory->stringCache.empty())
+ {
+ delete stringFactory;
+ stringFactory = 0;
+ }
+ }
+ }
+};
+
+static CStdStringFactoryCleaner cleaner;
+
+
+static void ConstructString(string *thisPointer)
+{
+ new(thisPointer) string();
+}
+
+static void CopyConstructString(const string &other, string *thisPointer)
+{
+ new(thisPointer) string(other);
+}
+
+static void DestructString(string *thisPointer)
+{
+ thisPointer->~string();
+}
+
+static string &AddAssignStringToString(const string &str, string &dest)
+{
+ // We don't register the method directly because some compilers
+ // and standard libraries inline the definition, resulting in the
+ // linker being unable to find the declaration.
+ // Example: CLang/LLVM with XCode 4.3 on OSX 10.7
+ dest += str;
+ return dest;
+}
+
+// bool string::isEmpty()
+// bool string::empty() // if AS_USE_STLNAMES == 1
+static bool StringIsEmpty(const string &str)
+{
+ // We don't register the method directly because some compilers
+ // and standard libraries inline the definition, resulting in the
+ // linker being unable to find the declaration
+ // Example: CLang/LLVM with XCode 4.3 on OSX 10.7
+ return str.empty();
+}
+
+static string &AssignUInt64ToString(asQWORD i, string &dest)
+{
+ ostringstream stream;
+ stream << i;
+ dest = stream.str();
+ return dest;
+}
+
+static string &AddAssignUInt64ToString(asQWORD i, string &dest)
+{
+ ostringstream stream;
+ stream << i;
+ dest += stream.str();
+ return dest;
+}
+
+static string AddStringUInt64(const string &str, asQWORD i)
+{
+ ostringstream stream;
+ stream << i;
+ return str + stream.str();
+}
+
+static string AddInt64String(asINT64 i, const string &str)
+{
+ ostringstream stream;
+ stream << i;
+ return stream.str() + str;
+}
+
+static string &AssignInt64ToString(asINT64 i, string &dest)
+{
+ ostringstream stream;
+ stream << i;
+ dest = stream.str();
+ return dest;
+}
+
+static string &AddAssignInt64ToString(asINT64 i, string &dest)
+{
+ ostringstream stream;
+ stream << i;
+ dest += stream.str();
+ return dest;
+}
+
+static string AddStringInt64(const string &str, asINT64 i)
+{
+ ostringstream stream;
+ stream << i;
+ return str + stream.str();
+}
+
+static string AddUInt64String(asQWORD i, const string &str)
+{
+ ostringstream stream;
+ stream << i;
+ return stream.str() + str;
+}
+
+static string &AssignDoubleToString(double f, string &dest)
+{
+ ostringstream stream;
+ stream << f;
+ dest = stream.str();
+ return dest;
+}
+
+static string &AddAssignDoubleToString(double f, string &dest)
+{
+ ostringstream stream;
+ stream << f;
+ dest += stream.str();
+ return dest;
+}
+
+static string &AssignFloatToString(float f, string &dest)
+{
+ ostringstream stream;
+ stream << f;
+ dest = stream.str();
+ return dest;
+}
+
+static string &AddAssignFloatToString(float f, string &dest)
+{
+ ostringstream stream;
+ stream << f;
+ dest += stream.str();
+ return dest;
+}
+
+static string &AssignBoolToString(bool b, string &dest)
+{
+ ostringstream stream;
+ stream << (b ? "true" : "false");
+ dest = stream.str();
+ return dest;
+}
+
+static string &AddAssignBoolToString(bool b, string &dest)
+{
+ ostringstream stream;
+ stream << (b ? "true" : "false");
+ dest += stream.str();
+ return dest;
+}
+
+static string AddStringDouble(const string &str, double f)
+{
+ ostringstream stream;
+ stream << f;
+ return str + stream.str();
+}
+
+static string AddDoubleString(double f, const string &str)
+{
+ ostringstream stream;
+ stream << f;
+ return stream.str() + str;
+}
+
+static string AddStringFloat(const string &str, float f)
+{
+ ostringstream stream;
+ stream << f;
+ return str + stream.str();
+}
+
+static string AddFloatString(float f, const string &str)
+{
+ ostringstream stream;
+ stream << f;
+ return stream.str() + str;
+}
+
+static string AddStringBool(const string &str, bool b)
+{
+ ostringstream stream;
+ stream << (b ? "true" : "false");
+ return str + stream.str();
+}
+
+static string AddBoolString(bool b, const string &str)
+{
+ ostringstream stream;
+ stream << (b ? "true" : "false");
+ return stream.str() + str;
+}
+
+static char *StringCharAt(unsigned int i, string &str)
+{
+ if( i >= str.size() )
+ {
+ // Set a script exception
+ asIScriptContext *ctx = asGetActiveContext();
+ ctx->SetException("Out of range");
+
+ // Return a null pointer
+ return 0;
+ }
+
+ return &str[i];
+}
+
+// AngelScript signature:
+// int string::opCmp(const string &in) const
+static int StringCmp(const string &a, const string &b)
+{
+ int cmp = 0;
+ if( a < b ) cmp = -1;
+ else if( a > b ) cmp = 1;
+ return cmp;
+}
+
+// This function returns the index of the first position where the substring
+// exists in the input string. If the substring doesn't exist in the input
+// string -1 is returned.
+//
+// AngelScript signature:
+// int string::findFirst(const string &in sub, uint start = 0) const
+static int StringFindFirst(const string &sub, asUINT start, const string &str)
+{
+ // We don't register the method directly because the argument types change between 32bit and 64bit platforms
+ return (int)str.find(sub, (size_t)(start < 0 ? string::npos : start));
+}
+
+// This function returns the index of the first position where the one of the bytes in substring
+// exists in the input string. If the characters in the substring doesn't exist in the input
+// string -1 is returned.
+//
+// AngelScript signature:
+// int string::findFirstOf(const string &in sub, uint start = 0) const
+static int StringFindFirstOf(const string &sub, asUINT start, const string &str)
+{
+ // We don't register the method directly because the argument types change between 32bit and 64bit platforms
+ return (int)str.find_first_of(sub, (size_t)(start < 0 ? string::npos : start));
+}
+
+// This function returns the index of the last position where the one of the bytes in substring
+// exists in the input string. If the characters in the substring doesn't exist in the input
+// string -1 is returned.
+//
+// AngelScript signature:
+// int string::findLastOf(const string &in sub, uint start = -1) const
+static int StringFindLastOf(const string &sub, asUINT start, const string &str)
+{
+ // We don't register the method directly because the argument types change between 32bit and 64bit platforms
+ return (int)str.find_last_of(sub, (size_t)(start < 0 ? string::npos : start));
+}
+
+// This function returns the index of the first position where a byte other than those in substring
+// exists in the input string. If none is found -1 is returned.
+//
+// AngelScript signature:
+// int string::findFirstNotOf(const string &in sub, uint start = 0) const
+static int StringFindFirstNotOf(const string &sub, asUINT start, const string &str)
+{
+ // We don't register the method directly because the argument types change between 32bit and 64bit platforms
+ return (int)str.find_first_not_of(sub, (size_t)(start < 0 ? string::npos : start));
+}
+
+// This function returns the index of the last position where a byte other than those in substring
+// exists in the input string. If none is found -1 is returned.
+//
+// AngelScript signature:
+// int string::findLastNotOf(const string &in sub, uint start = -1) const
+static int StringFindLastNotOf(const string &sub, asUINT start, const string &str)
+{
+ // We don't register the method directly because the argument types change between 32bit and 64bit platforms
+ return (int)str.find_last_not_of(sub, (size_t)(start < 0 ? string::npos : start));
+}
+
+// This function returns the index of the last position where the substring
+// exists in the input string. If the substring doesn't exist in the input
+// string -1 is returned.
+//
+// AngelScript signature:
+// int string::findLast(const string &in sub, int start = -1) const
+static int StringFindLast(const string &sub, int start, const string &str)
+{
+ // We don't register the method directly because the argument types change between 32bit and 64bit platforms
+ return (int)str.rfind(sub, (size_t)(start < 0 ? string::npos : start));
+}
+
+// AngelScript signature:
+// void string::insert(uint pos, const string &in other)
+static void StringInsert(unsigned int pos, const string &other, string &str)
+{
+ // We don't register the method directly because the argument types change between 32bit and 64bit platforms
+ str.insert(pos, other);
+}
+
+// AngelScript signature:
+// void string::erase(uint pos, int count = -1)
+static void StringErase(unsigned int pos, int count, string &str)
+{
+ // We don't register the method directly because the argument types change between 32bit and 64bit platforms
+ str.erase(pos, (size_t)(count < 0 ? string::npos : count));
+}
+
+
+// AngelScript signature:
+// uint string::length() const
+static asUINT StringLength(const string &str)
+{
+ // We don't register the method directly because the return type changes between 32bit and 64bit platforms
+ return (asUINT)str.length();
+}
+
+
+// AngelScript signature:
+// void string::resize(uint l)
+static void StringResize(asUINT l, string &str)
+{
+ // We don't register the method directly because the argument types change between 32bit and 64bit platforms
+ str.resize(l);
+}
+
+// AngelScript signature:
+// string formatInt(int64 val, const string &in options, uint width)
+static string formatInt(asINT64 value, const string &options, asUINT width)
+{
+ bool leftJustify = options.find("l") != string::npos;
+ bool padWithZero = options.find("0") != string::npos;
+ bool alwaysSign = options.find("+") != string::npos;
+ bool spaceOnSign = options.find(" ") != string::npos;
+ bool hexSmall = options.find("h") != string::npos;
+ bool hexLarge = options.find("H") != string::npos;
+
+ string fmt = "%";
+ if( leftJustify ) fmt += "-";
+ if( alwaysSign ) fmt += "+";
+ if( spaceOnSign ) fmt += " ";
+ if( padWithZero ) fmt += "0";
+
+#ifdef _WIN32
+ fmt += "*I64";
+#else
+#ifdef _LP64
+ fmt += "*l";
+#else
+ fmt += "*ll";
+#endif
+#endif
+
+ if( hexSmall ) fmt += "x";
+ else if( hexLarge ) fmt += "X";
+ else fmt += "d";
+
+ string buf;
+ buf.resize(width+30);
+#if _MSC_VER >= 1400 && !defined(__S3E__)
+ // MSVC 8.0 / 2005 or newer
+ sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, value);
+#else
+ sprintf(&buf[0], fmt.c_str(), width, value);
+#endif
+ buf.resize(strlen(&buf[0]));
+
+ return buf;
+}
+
+// AngelScript signature:
+// string formatUInt(uint64 val, const string &in options, uint width)
+static string formatUInt(asQWORD value, const string &options, asUINT width)
+{
+ bool leftJustify = options.find("l") != string::npos;
+ bool padWithZero = options.find("0") != string::npos;
+ bool alwaysSign = options.find("+") != string::npos;
+ bool spaceOnSign = options.find(" ") != string::npos;
+ bool hexSmall = options.find("h") != string::npos;
+ bool hexLarge = options.find("H") != string::npos;
+
+ string fmt = "%";
+ if( leftJustify ) fmt += "-";
+ if( alwaysSign ) fmt += "+";
+ if( spaceOnSign ) fmt += " ";
+ if( padWithZero ) fmt += "0";
+
+#ifdef _WIN32
+ fmt += "*I64";
+#else
+#ifdef _LP64
+ fmt += "*l";
+#else
+ fmt += "*ll";
+#endif
+#endif
+
+ if( hexSmall ) fmt += "x";
+ else if( hexLarge ) fmt += "X";
+ else fmt += "u";
+
+ string buf;
+ buf.resize(width+30);
+#if _MSC_VER >= 1400 && !defined(__S3E__)
+ // MSVC 8.0 / 2005 or newer
+ sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, value);
+#else
+ sprintf(&buf[0], fmt.c_str(), width, value);
+#endif
+ buf.resize(strlen(&buf[0]));
+
+ return buf;
+}
+
+// AngelScript signature:
+// string formatFloat(double val, const string &in options, uint width, uint precision)
+static string formatFloat(double value, const string &options, asUINT width, asUINT precision)
+{
+ bool leftJustify = options.find("l") != string::npos;
+ bool padWithZero = options.find("0") != string::npos;
+ bool alwaysSign = options.find("+") != string::npos;
+ bool spaceOnSign = options.find(" ") != string::npos;
+ bool expSmall = options.find("e") != string::npos;
+ bool expLarge = options.find("E") != string::npos;
+
+ string fmt = "%";
+ if( leftJustify ) fmt += "-";
+ if( alwaysSign ) fmt += "+";
+ if( spaceOnSign ) fmt += " ";
+ if( padWithZero ) fmt += "0";
+
+ fmt += "*.*";
+
+ if( expSmall ) fmt += "e";
+ else if( expLarge ) fmt += "E";
+ else fmt += "f";
+
+ string buf;
+ buf.resize(width+precision+50);
+#if _MSC_VER >= 1400 && !defined(__S3E__)
+ // MSVC 8.0 / 2005 or newer
+ sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, precision, value);
+#else
+ sprintf(&buf[0], fmt.c_str(), width, precision, value);
+#endif
+ buf.resize(strlen(&buf[0]));
+
+ return buf;
+}
+
+// AngelScript signature:
+// int64 parseInt(const string &in val, uint base = 10, uint &out byteCount = 0)
+static asINT64 parseInt(const string &val, asUINT base, asUINT *byteCount)
+{
+ // Only accept base 10 and 16
+ if( base != 10 && base != 16 )
+ {
+ if( byteCount ) *byteCount = 0;
+ return 0;
+ }
+
+ const char *end = &val[0];
+
+ // Determine the sign
+ bool sign = false;
+ if( *end == '-' )
+ {
+ sign = true;
+ end++;
+ }
+ else if( *end == '+' )
+ end++;
+
+ asINT64 res = 0;
+ if( base == 10 )
+ {
+ while( *end >= '0' && *end <= '9' )
+ {
+ res *= 10;
+ res += *end++ - '0';
+ }
+ }
+ else if( base == 16 )
+ {
+ while( (*end >= '0' && *end <= '9') ||
+ (*end >= 'a' && *end <= 'f') ||
+ (*end >= 'A' && *end <= 'F') )
+ {
+ res *= 16;
+ if( *end >= '0' && *end <= '9' )
+ res += *end++ - '0';
+ else if( *end >= 'a' && *end <= 'f' )
+ res += *end++ - 'a' + 10;
+ else if( *end >= 'A' && *end <= 'F' )
+ res += *end++ - 'A' + 10;
+ }
+ }
+
+ if( byteCount )
+ *byteCount = asUINT(size_t(end - val.c_str()));
+
+ if( sign )
+ res = -res;
+
+ return res;
+}
+
+// AngelScript signature:
+// uint64 parseUInt(const string &in val, uint base = 10, uint &out byteCount = 0)
+static asQWORD parseUInt(const string &val, asUINT base, asUINT *byteCount)
+{
+ // Only accept base 10 and 16
+ if (base != 10 && base != 16)
+ {
+ if (byteCount) *byteCount = 0;
+ return 0;
+ }
+
+ const char *end = &val[0];
+
+ asQWORD res = 0;
+ if (base == 10)
+ {
+ while (*end >= '0' && *end <= '9')
+ {
+ res *= 10;
+ res += *end++ - '0';
+ }
+ }
+ else if (base == 16)
+ {
+ while ((*end >= '0' && *end <= '9') ||
+ (*end >= 'a' && *end <= 'f') ||
+ (*end >= 'A' && *end <= 'F'))
+ {
+ res *= 16;
+ if (*end >= '0' && *end <= '9')
+ res += *end++ - '0';
+ else if (*end >= 'a' && *end <= 'f')
+ res += *end++ - 'a' + 10;
+ else if (*end >= 'A' && *end <= 'F')
+ res += *end++ - 'A' + 10;
+ }
+ }
+
+ if (byteCount)
+ *byteCount = asUINT(size_t(end - val.c_str()));
+
+ return res;
+}
+
+// AngelScript signature:
+// double parseFloat(const string &in val, uint &out byteCount = 0)
+double parseFloat(const string &val, asUINT *byteCount)
+{
+ char *end;
+
+ // WinCE doesn't have setlocale. Some quick testing on my current platform
+ // still manages to parse the numbers such as "3.14" even if the decimal for the
+ // locale is ",".
+#if !defined(_WIN32_WCE) && !defined(ANDROID) && !defined(__psp2__)
+ // Set the locale to C so that we are guaranteed to parse the float value correctly
+ char *tmp = setlocale(LC_NUMERIC, 0);
+ string orig = tmp ? tmp : "C";
+ setlocale(LC_NUMERIC, "C");
+#endif
+
+ double res = strtod(val.c_str(), &end);
+
+#if !defined(_WIN32_WCE) && !defined(ANDROID) && !defined(__psp2__)
+ // Restore the locale
+ setlocale(LC_NUMERIC, orig.c_str());
+#endif
+
+ if( byteCount )
+ *byteCount = asUINT(size_t(end - val.c_str()));
+
+ return res;
+}
+
+// This function returns a string containing the substring of the input string
+// determined by the starting index and count of characters.
+//
+// AngelScript signature:
+// string string::substr(uint start = 0, int count = -1) const
+static string StringSubString(asUINT start, int count, const string &str)
+{
+ // Check for out-of-bounds
+ string ret;
+ if( start < str.length() && count != 0 )
+ ret = str.substr(start, (size_t)(count < 0 ? string::npos : count));
+
+ return ret;
+}
+
+// String equality comparison.
+// Returns true iff lhs is equal to rhs.
+//
+// For some reason gcc 4.7 has difficulties resolving the
+// asFUNCTIONPR(operator==, (const string &, const string &)
+// makro, so this wrapper was introduced as work around.
+static bool StringEquals(const std::string& lhs, const std::string& rhs)
+{
+ return lhs == rhs;
+}
+
+void RegisterStdString_Native(asIScriptEngine *engine)
+{
+ int r = 0;
+ UNUSED_VAR(r);
+
+ // Register the string type
+#if AS_CAN_USE_CPP11
+ // With C++11 it is possible to use asGetTypeTraits to automatically determine the correct flags to use
+ r = engine->RegisterObjectType("string", sizeof(string), asOBJ_VALUE | asGetTypeTraits<string>()); assert( r >= 0 );
+#else
+ r = engine->RegisterObjectType("string", sizeof(string), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 );
+#endif
+
+ r = engine->RegisterStringFactory("string", GetStdStringFactorySingleton());
+
+ // Register the object operator overloads
+ r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f(const string &in)", asFUNCTION(CopyConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAssign(const string &in)", asMETHODPR(string, operator =, (const string&), string&), asCALL_THISCALL); assert( r >= 0 );
+ // Need to use a wrapper on Mac OS X 10.7/XCode 4.3 and CLang/LLVM, otherwise the linker fails
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asFUNCTION(AddAssignStringToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+// r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asMETHODPR(string, operator+=, (const string&), string&), asCALL_THISCALL); assert( r >= 0 );
+
+ // Need to use a wrapper for operator== otherwise gcc 4.7 fails to compile
+ r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in) const", asFUNCTIONPR(StringEquals, (const string &, const string &), bool), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "int opCmp(const string &in) const", asFUNCTION(StringCmp), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(const string &in) const", asFUNCTIONPR(operator +, (const string &, const string &), string), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
+
+ // The string length can be accessed through methods or through virtual property
+ // TODO: Register as size() for consistency with other types
+#if AS_USE_ACCESSORS != 1
+ r = engine->RegisterObjectMethod("string", "uint length() const", asFUNCTION(StringLength), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+#endif
+ r = engine->RegisterObjectMethod("string", "void resize(uint)", asFUNCTION(StringResize), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+#if AS_USE_STLNAMES != 1 && AS_USE_ACCESSORS == 1
+ // Don't register these if STL names is used, as they conflict with the method size()
+ r = engine->RegisterObjectMethod("string", "uint get_length() const property", asFUNCTION(StringLength), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "void set_length(uint) property", asFUNCTION(StringResize), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+#endif
+ // Need to use a wrapper on Mac OS X 10.7/XCode 4.3 and CLang/LLVM, otherwise the linker fails
+// r = engine->RegisterObjectMethod("string", "bool isEmpty() const", asMETHOD(string, empty), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "bool isEmpty() const", asFUNCTION(StringIsEmpty), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+
+ // Register the index operator, both as a mutator and as an inspector
+ // Note that we don't register the operator[] directly, as it doesn't do bounds checking
+ r = engine->RegisterObjectMethod("string", "uint8 &opIndex(uint)", asFUNCTION(StringCharAt), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "const uint8 &opIndex(uint) const", asFUNCTION(StringCharAt), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+
+ // Automatic conversion from values
+ r = engine->RegisterObjectMethod("string", "string &opAssign(double)", asFUNCTION(AssignDoubleToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(double)", asFUNCTION(AddAssignDoubleToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(double) const", asFUNCTION(AddStringDouble), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(double) const", asFUNCTION(AddDoubleString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(float)", asFUNCTION(AssignFloatToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(float)", asFUNCTION(AddAssignFloatToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(float) const", asFUNCTION(AddStringFloat), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(float) const", asFUNCTION(AddFloatString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(int64)", asFUNCTION(AssignInt64ToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(int64)", asFUNCTION(AddAssignInt64ToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(int64) const", asFUNCTION(AddStringInt64), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(int64) const", asFUNCTION(AddInt64String), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(uint64)", asFUNCTION(AssignUInt64ToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(uint64)", asFUNCTION(AddAssignUInt64ToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(uint64) const", asFUNCTION(AddStringUInt64), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(uint64) const", asFUNCTION(AddUInt64String), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(bool)", asFUNCTION(AssignBoolToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(bool)", asFUNCTION(AddAssignBoolToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(bool) const", asFUNCTION(AddStringBool), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(bool) const", asFUNCTION(AddBoolString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+
+ // Utilities
+ r = engine->RegisterObjectMethod("string", "string substr(uint start = 0, int count = -1) const", asFUNCTION(StringSubString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "int findFirst(const string &in, uint start = 0) const", asFUNCTION(StringFindFirst), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "int findFirstOf(const string &in, uint start = 0) const", asFUNCTION(StringFindFirstOf), asCALL_CDECL_OBJLAST); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findFirstNotOf(const string &in, uint start = 0) const", asFUNCTION(StringFindFirstNotOf), asCALL_CDECL_OBJLAST); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findLast(const string &in, int start = -1) const", asFUNCTION(StringFindLast), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "int findLastOf(const string &in, int start = -1) const", asFUNCTION(StringFindLastOf), asCALL_CDECL_OBJLAST); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findLastNotOf(const string &in, int start = -1) const", asFUNCTION(StringFindLastNotOf), asCALL_CDECL_OBJLAST); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "void insert(uint pos, const string &in other)", asFUNCTION(StringInsert), asCALL_CDECL_OBJLAST); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "void erase(uint pos, int count = -1)", asFUNCTION(StringErase), asCALL_CDECL_OBJLAST); assert(r >= 0);
+
+
+ r = engine->RegisterGlobalFunction("string formatInt(int64 val, const string &in options = \"\", uint width = 0)", asFUNCTION(formatInt), asCALL_CDECL); assert(r >= 0);
+ r = engine->RegisterGlobalFunction("string formatUInt(uint64 val, const string &in options = \"\", uint width = 0)", asFUNCTION(formatUInt), asCALL_CDECL); assert(r >= 0);
+ r = engine->RegisterGlobalFunction("string formatFloat(double val, const string &in options = \"\", uint width = 0, uint precision = 0)", asFUNCTION(formatFloat), asCALL_CDECL); assert(r >= 0);
+ r = engine->RegisterGlobalFunction("int64 parseInt(const string &in, uint base = 10, uint &out byteCount = 0)", asFUNCTION(parseInt), asCALL_CDECL); assert(r >= 0);
+ r = engine->RegisterGlobalFunction("uint64 parseUInt(const string &in, uint base = 10, uint &out byteCount = 0)", asFUNCTION(parseUInt), asCALL_CDECL); assert(r >= 0);
+ r = engine->RegisterGlobalFunction("double parseFloat(const string &in, uint &out byteCount = 0)", asFUNCTION(parseFloat), asCALL_CDECL); assert(r >= 0);
+
+#if AS_USE_STLNAMES == 1
+ // Same as length
+ r = engine->RegisterObjectMethod("string", "uint size() const", asFUNCTION(StringLength), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ // Same as isEmpty
+ r = engine->RegisterObjectMethod("string", "bool empty() const", asFUNCTION(StringIsEmpty), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ // Same as findFirst
+ r = engine->RegisterObjectMethod("string", "int find(const string &in, uint start = 0) const", asFUNCTION(StringFindFirst), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ // Same as findLast
+ r = engine->RegisterObjectMethod("string", "int rfind(const string &in, int start = -1) const", asFUNCTION(StringFindLast), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+#endif
+
+ // TODO: Implement the following
+ // findAndReplace - replaces a text found in the string
+ // replaceRange - replaces a range of bytes in the string
+ // multiply/times/opMul/opMul_r - takes the string and multiplies it n times, e.g. "-".multiply(5) returns "-----"
+}
+
+static void ConstructStringGeneric(asIScriptGeneric * gen)
+{
+ new (gen->GetObject()) string();
+}
+
+static void CopyConstructStringGeneric(asIScriptGeneric * gen)
+{
+ string * a = static_cast<string *>(gen->GetArgObject(0));
+ new (gen->GetObject()) string(*a);
+}
+
+static void DestructStringGeneric(asIScriptGeneric * gen)
+{
+ string * ptr = static_cast<string *>(gen->GetObject());
+ ptr->~string();
+}
+
+static void AssignStringGeneric(asIScriptGeneric *gen)
+{
+ string * a = static_cast<string *>(gen->GetArgObject(0));
+ string * self = static_cast<string *>(gen->GetObject());
+ *self = *a;
+ gen->SetReturnAddress(self);
+}
+
+static void AddAssignStringGeneric(asIScriptGeneric *gen)
+{
+ string * a = static_cast<string *>(gen->GetArgObject(0));
+ string * self = static_cast<string *>(gen->GetObject());
+ *self += *a;
+ gen->SetReturnAddress(self);
+}
+
+static void StringEqualsGeneric(asIScriptGeneric * gen)
+{
+ string * a = static_cast<string *>(gen->GetObject());
+ string * b = static_cast<string *>(gen->GetArgAddress(0));
+ *(bool*)gen->GetAddressOfReturnLocation() = (*a == *b);
+}
+
+static void StringCmpGeneric(asIScriptGeneric * gen)
+{
+ string * a = static_cast<string *>(gen->GetObject());
+ string * b = static_cast<string *>(gen->GetArgAddress(0));
+
+ int cmp = 0;
+ if( *a < *b ) cmp = -1;
+ else if( *a > *b ) cmp = 1;
+
+ *(int*)gen->GetAddressOfReturnLocation() = cmp;
+}
+
+static void StringAddGeneric(asIScriptGeneric * gen)
+{
+ string * a = static_cast<string *>(gen->GetObject());
+ string * b = static_cast<string *>(gen->GetArgAddress(0));
+ string ret_val = *a + *b;
+ gen->SetReturnObject(&ret_val);
+}
+
+static void StringLengthGeneric(asIScriptGeneric * gen)
+{
+ string * self = static_cast<string *>(gen->GetObject());
+ *static_cast<asUINT *>(gen->GetAddressOfReturnLocation()) = (asUINT)self->length();
+}
+
+static void StringIsEmptyGeneric(asIScriptGeneric * gen)
+{
+ string * self = reinterpret_cast<string *>(gen->GetObject());
+ *reinterpret_cast<bool *>(gen->GetAddressOfReturnLocation()) = StringIsEmpty(*self);
+}
+
+static void StringResizeGeneric(asIScriptGeneric * gen)
+{
+ string * self = static_cast<string *>(gen->GetObject());
+ self->resize(*static_cast<asUINT *>(gen->GetAddressOfArg(0)));
+}
+
+static void StringInsert_Generic(asIScriptGeneric *gen)
+{
+ string * self = static_cast<string *>(gen->GetObject());
+ asUINT pos = gen->GetArgDWord(0);
+ string *other = reinterpret_cast<string*>(gen->GetArgAddress(1));
+ StringInsert(pos, *other, *self);
+}
+
+static void StringErase_Generic(asIScriptGeneric *gen)
+{
+ string * self = static_cast<string *>(gen->GetObject());
+ asUINT pos = gen->GetArgDWord(0);
+ int count = int(gen->GetArgDWord(1));
+ StringErase(pos, count, *self);
+}
+
+static void StringFindFirst_Generic(asIScriptGeneric * gen)
+{
+ string *find = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ asUINT start = gen->GetArgDWord(1);
+ string *self = reinterpret_cast<string *>(gen->GetObject());
+ *reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindFirst(*find, start, *self);
+}
+
+static void StringFindLast_Generic(asIScriptGeneric * gen)
+{
+ string *find = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ asUINT start = gen->GetArgDWord(1);
+ string *self = reinterpret_cast<string *>(gen->GetObject());
+ *reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindLast(*find, start, *self);
+}
+
+static void StringFindFirstOf_Generic(asIScriptGeneric * gen)
+{
+ string *find = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ asUINT start = gen->GetArgDWord(1);
+ string *self = reinterpret_cast<string *>(gen->GetObject());
+ *reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindFirstOf(*find, start, *self);
+}
+
+static void StringFindLastOf_Generic(asIScriptGeneric * gen)
+{
+ string *find = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ asUINT start = gen->GetArgDWord(1);
+ string *self = reinterpret_cast<string *>(gen->GetObject());
+ *reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindLastOf(*find, start, *self);
+}
+
+static void StringFindFirstNotOf_Generic(asIScriptGeneric * gen)
+{
+ string *find = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ asUINT start = gen->GetArgDWord(1);
+ string *self = reinterpret_cast<string *>(gen->GetObject());
+ *reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindFirstNotOf(*find, start, *self);
+}
+
+static void StringFindLastNotOf_Generic(asIScriptGeneric * gen)
+{
+ string *find = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ asUINT start = gen->GetArgDWord(1);
+ string *self = reinterpret_cast<string *>(gen->GetObject());
+ *reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindLastNotOf(*find, start, *self);
+}
+
+static void formatInt_Generic(asIScriptGeneric * gen)
+{
+ asINT64 val = gen->GetArgQWord(0);
+ string *options = reinterpret_cast<string*>(gen->GetArgAddress(1));
+ asUINT width = gen->GetArgDWord(2);
+ new(gen->GetAddressOfReturnLocation()) string(formatInt(val, *options, width));
+}
+
+static void formatUInt_Generic(asIScriptGeneric * gen)
+{
+ asQWORD val = gen->GetArgQWord(0);
+ string *options = reinterpret_cast<string*>(gen->GetArgAddress(1));
+ asUINT width = gen->GetArgDWord(2);
+ new(gen->GetAddressOfReturnLocation()) string(formatUInt(val, *options, width));
+}
+
+static void formatFloat_Generic(asIScriptGeneric *gen)
+{
+ double val = gen->GetArgDouble(0);
+ string *options = reinterpret_cast<string*>(gen->GetArgAddress(1));
+ asUINT width = gen->GetArgDWord(2);
+ asUINT precision = gen->GetArgDWord(3);
+ new(gen->GetAddressOfReturnLocation()) string(formatFloat(val, *options, width, precision));
+}
+
+static void parseInt_Generic(asIScriptGeneric *gen)
+{
+ string *str = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ asUINT base = gen->GetArgDWord(1);
+ asUINT *byteCount = reinterpret_cast<asUINT*>(gen->GetArgAddress(2));
+ gen->SetReturnQWord(parseInt(*str,base,byteCount));
+}
+
+static void parseUInt_Generic(asIScriptGeneric *gen)
+{
+ string *str = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ asUINT base = gen->GetArgDWord(1);
+ asUINT *byteCount = reinterpret_cast<asUINT*>(gen->GetArgAddress(2));
+ gen->SetReturnQWord(parseUInt(*str, base, byteCount));
+}
+
+static void parseFloat_Generic(asIScriptGeneric *gen)
+{
+ string *str = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ asUINT *byteCount = reinterpret_cast<asUINT*>(gen->GetArgAddress(1));
+ gen->SetReturnDouble(parseFloat(*str,byteCount));
+}
+
+static void StringCharAtGeneric(asIScriptGeneric * gen)
+{
+ unsigned int index = gen->GetArgDWord(0);
+ string * self = static_cast<string *>(gen->GetObject());
+
+ if (index >= self->size())
+ {
+ // Set a script exception
+ asIScriptContext *ctx = asGetActiveContext();
+ ctx->SetException("Out of range");
+
+ gen->SetReturnAddress(0);
+ }
+ else
+ {
+ gen->SetReturnAddress(&(self->operator [](index)));
+ }
+}
+
+static void AssignInt2StringGeneric(asIScriptGeneric *gen)
+{
+ asINT64 *a = static_cast<asINT64*>(gen->GetAddressOfArg(0));
+ string *self = static_cast<string*>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << *a;
+ *self = sstr.str();
+ gen->SetReturnAddress(self);
+}
+
+static void AssignUInt2StringGeneric(asIScriptGeneric *gen)
+{
+ asQWORD *a = static_cast<asQWORD*>(gen->GetAddressOfArg(0));
+ string *self = static_cast<string*>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << *a;
+ *self = sstr.str();
+ gen->SetReturnAddress(self);
+}
+
+static void AssignDouble2StringGeneric(asIScriptGeneric *gen)
+{
+ double *a = static_cast<double*>(gen->GetAddressOfArg(0));
+ string *self = static_cast<string*>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << *a;
+ *self = sstr.str();
+ gen->SetReturnAddress(self);
+}
+
+static void AssignFloat2StringGeneric(asIScriptGeneric *gen)
+{
+ float *a = static_cast<float*>(gen->GetAddressOfArg(0));
+ string *self = static_cast<string*>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << *a;
+ *self = sstr.str();
+ gen->SetReturnAddress(self);
+}
+
+static void AssignBool2StringGeneric(asIScriptGeneric *gen)
+{
+ bool *a = static_cast<bool*>(gen->GetAddressOfArg(0));
+ string *self = static_cast<string*>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << (*a ? "true" : "false");
+ *self = sstr.str();
+ gen->SetReturnAddress(self);
+}
+
+static void AddAssignDouble2StringGeneric(asIScriptGeneric * gen)
+{
+ double * a = static_cast<double *>(gen->GetAddressOfArg(0));
+ string * self = static_cast<string *>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << *a;
+ *self += sstr.str();
+ gen->SetReturnAddress(self);
+}
+
+static void AddAssignFloat2StringGeneric(asIScriptGeneric * gen)
+{
+ float * a = static_cast<float *>(gen->GetAddressOfArg(0));
+ string * self = static_cast<string *>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << *a;
+ *self += sstr.str();
+ gen->SetReturnAddress(self);
+}
+
+static void AddAssignInt2StringGeneric(asIScriptGeneric * gen)
+{
+ asINT64 * a = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
+ string * self = static_cast<string *>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << *a;
+ *self += sstr.str();
+ gen->SetReturnAddress(self);
+}
+
+static void AddAssignUInt2StringGeneric(asIScriptGeneric * gen)
+{
+ asQWORD * a = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
+ string * self = static_cast<string *>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << *a;
+ *self += sstr.str();
+ gen->SetReturnAddress(self);
+}
+
+static void AddAssignBool2StringGeneric(asIScriptGeneric * gen)
+{
+ bool * a = static_cast<bool *>(gen->GetAddressOfArg(0));
+ string * self = static_cast<string *>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << (*a ? "true" : "false");
+ *self += sstr.str();
+ gen->SetReturnAddress(self);
+}
+
+static void AddString2DoubleGeneric(asIScriptGeneric * gen)
+{
+ string * a = static_cast<string *>(gen->GetObject());
+ double * b = static_cast<double *>(gen->GetAddressOfArg(0));
+ std::stringstream sstr;
+ sstr << *a << *b;
+ std::string ret_val = sstr.str();
+ gen->SetReturnObject(&ret_val);
+}
+
+static void AddString2FloatGeneric(asIScriptGeneric * gen)
+{
+ string * a = static_cast<string *>(gen->GetObject());
+ float * b = static_cast<float *>(gen->GetAddressOfArg(0));
+ std::stringstream sstr;
+ sstr << *a << *b;
+ std::string ret_val = sstr.str();
+ gen->SetReturnObject(&ret_val);
+}
+
+static void AddString2IntGeneric(asIScriptGeneric * gen)
+{
+ string * a = static_cast<string *>(gen->GetObject());
+ asINT64 * b = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
+ std::stringstream sstr;
+ sstr << *a << *b;
+ std::string ret_val = sstr.str();
+ gen->SetReturnObject(&ret_val);
+}
+
+static void AddString2UIntGeneric(asIScriptGeneric * gen)
+{
+ string * a = static_cast<string *>(gen->GetObject());
+ asQWORD * b = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
+ std::stringstream sstr;
+ sstr << *a << *b;
+ std::string ret_val = sstr.str();
+ gen->SetReturnObject(&ret_val);
+}
+
+static void AddString2BoolGeneric(asIScriptGeneric * gen)
+{
+ string * a = static_cast<string *>(gen->GetObject());
+ bool * b = static_cast<bool *>(gen->GetAddressOfArg(0));
+ std::stringstream sstr;
+ sstr << *a << (*b ? "true" : "false");
+ std::string ret_val = sstr.str();
+ gen->SetReturnObject(&ret_val);
+}
+
+static void AddDouble2StringGeneric(asIScriptGeneric * gen)
+{
+ double* a = static_cast<double *>(gen->GetAddressOfArg(0));
+ string * b = static_cast<string *>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << *a << *b;
+ std::string ret_val = sstr.str();
+ gen->SetReturnObject(&ret_val);
+}
+
+static void AddFloat2StringGeneric(asIScriptGeneric * gen)
+{
+ float* a = static_cast<float *>(gen->GetAddressOfArg(0));
+ string * b = static_cast<string *>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << *a << *b;
+ std::string ret_val = sstr.str();
+ gen->SetReturnObject(&ret_val);
+}
+
+static void AddInt2StringGeneric(asIScriptGeneric * gen)
+{
+ asINT64* a = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
+ string * b = static_cast<string *>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << *a << *b;
+ std::string ret_val = sstr.str();
+ gen->SetReturnObject(&ret_val);
+}
+
+static void AddUInt2StringGeneric(asIScriptGeneric * gen)
+{
+ asQWORD* a = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
+ string * b = static_cast<string *>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << *a << *b;
+ std::string ret_val = sstr.str();
+ gen->SetReturnObject(&ret_val);
+}
+
+static void AddBool2StringGeneric(asIScriptGeneric * gen)
+{
+ bool* a = static_cast<bool *>(gen->GetAddressOfArg(0));
+ string * b = static_cast<string *>(gen->GetObject());
+ std::stringstream sstr;
+ sstr << (*a ? "true" : "false") << *b;
+ std::string ret_val = sstr.str();
+ gen->SetReturnObject(&ret_val);
+}
+
+static void StringSubString_Generic(asIScriptGeneric *gen)
+{
+ // Get the arguments
+ string *str = (string*)gen->GetObject();
+ asUINT start = *(int*)gen->GetAddressOfArg(0);
+ int count = *(int*)gen->GetAddressOfArg(1);
+
+ // Return the substring
+ new(gen->GetAddressOfReturnLocation()) string(StringSubString(start, count, *str));
+}
+
+void RegisterStdString_Generic(asIScriptEngine *engine)
+{
+ int r = 0;
+ UNUSED_VAR(r);
+
+ // Register the string type
+ r = engine->RegisterObjectType("string", sizeof(string), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 );
+
+ r = engine->RegisterStringFactory("string", GetStdStringFactorySingleton());
+
+ // Register the object operator overloads
+ r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructStringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f(const string &in)", asFUNCTION(CopyConstructStringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructStringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAssign(const string &in)", asFUNCTION(AssignStringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asFUNCTION(AddAssignStringGeneric), asCALL_GENERIC); assert( r >= 0 );
+
+ r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in) const", asFUNCTION(StringEqualsGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "int opCmp(const string &in) const", asFUNCTION(StringCmpGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(const string &in) const", asFUNCTION(StringAddGeneric), asCALL_GENERIC); assert( r >= 0 );
+
+ // Register the object methods
+#if AS_USE_ACCESSORS != 1
+ r = engine->RegisterObjectMethod("string", "uint length() const", asFUNCTION(StringLengthGeneric), asCALL_GENERIC); assert( r >= 0 );
+#endif
+ r = engine->RegisterObjectMethod("string", "void resize(uint)", asFUNCTION(StringResizeGeneric), asCALL_GENERIC); assert( r >= 0 );
+#if AS_USE_STLNAMES != 1 && AS_USE_ACCESSORS == 1
+ r = engine->RegisterObjectMethod("string", "uint get_length() const property", asFUNCTION(StringLengthGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "void set_length(uint) property", asFUNCTION(StringResizeGeneric), asCALL_GENERIC); assert( r >= 0 );
+#endif
+ r = engine->RegisterObjectMethod("string", "bool isEmpty() const", asFUNCTION(StringIsEmptyGeneric), asCALL_GENERIC); assert( r >= 0 );
+
+ // Register the index operator, both as a mutator and as an inspector
+ r = engine->RegisterObjectMethod("string", "uint8 &opIndex(uint)", asFUNCTION(StringCharAtGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "const uint8 &opIndex(uint) const", asFUNCTION(StringCharAtGeneric), asCALL_GENERIC); assert( r >= 0 );
+
+ // Automatic conversion from values
+ r = engine->RegisterObjectMethod("string", "string &opAssign(double)", asFUNCTION(AssignDouble2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(double)", asFUNCTION(AddAssignDouble2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(double) const", asFUNCTION(AddString2DoubleGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(double) const", asFUNCTION(AddDouble2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(float)", asFUNCTION(AssignFloat2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(float)", asFUNCTION(AddAssignFloat2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(float) const", asFUNCTION(AddString2FloatGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(float) const", asFUNCTION(AddFloat2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(int64)", asFUNCTION(AssignInt2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(int64)", asFUNCTION(AddAssignInt2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(int64) const", asFUNCTION(AddString2IntGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(int64) const", asFUNCTION(AddInt2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(uint64)", asFUNCTION(AssignUInt2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(uint64)", asFUNCTION(AddAssignUInt2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(uint64) const", asFUNCTION(AddString2UIntGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(uint64) const", asFUNCTION(AddUInt2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(bool)", asFUNCTION(AssignBool2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(bool)", asFUNCTION(AddAssignBool2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(bool) const", asFUNCTION(AddString2BoolGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(bool) const", asFUNCTION(AddBool2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
+
+ r = engine->RegisterObjectMethod("string", "string substr(uint start = 0, int count = -1) const", asFUNCTION(StringSubString_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findFirst(const string &in, uint start = 0) const", asFUNCTION(StringFindFirst_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findFirstOf(const string &in, uint start = 0) const", asFUNCTION(StringFindFirstOf_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findFirstNotOf(const string &in, uint start = 0) const", asFUNCTION(StringFindFirstNotOf_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findLast(const string &in, int start = -1) const", asFUNCTION(StringFindLast_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findLastOf(const string &in, int start = -1) const", asFUNCTION(StringFindLastOf_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findLastNotOf(const string &in, int start = -1) const", asFUNCTION(StringFindLastNotOf_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "void insert(uint pos, const string &in other)", asFUNCTION(StringInsert_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "void erase(uint pos, int count = -1)", asFUNCTION(StringErase_Generic), asCALL_GENERIC); assert(r >= 0);
+
+
+ r = engine->RegisterGlobalFunction("string formatInt(int64 val, const string &in options = \"\", uint width = 0)", asFUNCTION(formatInt_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterGlobalFunction("string formatUInt(uint64 val, const string &in options = \"\", uint width = 0)", asFUNCTION(formatUInt_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterGlobalFunction("string formatFloat(double val, const string &in options = \"\", uint width = 0, uint precision = 0)", asFUNCTION(formatFloat_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterGlobalFunction("int64 parseInt(const string &in, uint base = 10, uint &out byteCount = 0)", asFUNCTION(parseInt_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterGlobalFunction("uint64 parseUInt(const string &in, uint base = 10, uint &out byteCount = 0)", asFUNCTION(parseUInt_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterGlobalFunction("double parseFloat(const string &in, uint &out byteCount = 0)", asFUNCTION(parseFloat_Generic), asCALL_GENERIC); assert(r >= 0);
+}
+
+void RegisterStdString(asIScriptEngine * engine)
+{
+ if (strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY"))
+ RegisterStdString_Generic(engine);
+ else
+ RegisterStdString_Native(engine);
+}
+
+END_AS_NAMESPACE
+
+
+
+
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h
new file mode 100644
index 00000000000..a814ce6fe4e
--- /dev/null
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h
@@ -0,0 +1,47 @@
+//
+// Script std::string
+//
+// This function registers the std::string type with AngelScript to be used as the default string type.
+//
+// The string type is registered as a value type, thus may have performance issues if a lot of
+// string operations are performed in the script. However, for relatively few operations, this should
+// not cause any problem for most applications.
+//
+
+#ifndef SCRIPTSTDSTRING_H
+#define SCRIPTSTDSTRING_H
+
+#ifndef ANGELSCRIPT_H
+// Avoid having to inform include path if header is already include before
+#include "hpl1/engine/libraries/angelscript/angelscript.h"
+#endif
+
+#include <string>
+
+//---------------------------
+// Compilation settings
+//
+
+// Sometimes it may be desired to use the same method names as used by C++ STL.
+// This may for example reduce time when converting code from script to C++ or
+// back.
+//
+// 0 = off
+// 1 = on
+#ifndef AS_USE_STLNAMES
+#define AS_USE_STLNAMES 0
+#endif
+
+// Some prefer to use property accessors to get/set the length of the string
+// This option registers the accessors instead of the method length()
+#ifndef AS_USE_ACCESSORS
+#define AS_USE_ACCESSORS 0
+#endif
+
+BEGIN_AS_NAMESPACE
+
+void RegisterStdString(asIScriptEngine *engine);
+
+END_AS_NAMESPACE
+
+#endif
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index 472a80728ec..7fe06989c8b 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -21,8 +21,7 @@
#include "hpl1/engine/libraries/angelscript/angelscript.h"
#include "hpl1/engine/impl/SqScript.h"
-#include "hpl1/engine/impl/scriptstring.h"
-#include "hpl1/engine/impl/stdstring.h"
+#include "hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/debug.h"
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 573968795ad..d7d84515e05 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -123,8 +123,8 @@ MODULE_OBJS := \
engine/impl/VertexBufferOGL.o \
engine/impl/VertexBufferVBO.o \
engine/impl/VideoStreamTheora.o \
- engine/impl/scriptstring.o \
- engine/impl/stdstring.o \
+ engine/libraries/angelscript/add-ons/scriptstdstring.o \
+ engine/libraries/angelscript/add-ons/scripthelper.o \
engine/impl/tinyXML/tinyxml.o \
engine/impl/tinyXML/tinyxmlerror.o \
engine/impl/tinyXML/tinyxmlparser.o \
Commit: a1b2054f95d19252afc215328c67e62934b0468b
https://github.com/scummvm/scummvm/commit/a1b2054f95d19252afc215328c67e62934b0468b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:38+01:00
Commit Message:
HPL1: modify implementation of SqScript
Changed paths:
engines/hpl1/engine/impl/SqScript.cpp
engines/hpl1/engine/impl/SqScript.h
diff --git a/engines/hpl1/engine/impl/SqScript.cpp b/engines/hpl1/engine/impl/SqScript.cpp
index 070bae12e98..e571e482e85 100644
--- a/engines/hpl1/engine/impl/SqScript.cpp
+++ b/engines/hpl1/engine/impl/SqScript.cpp
@@ -25,12 +25,14 @@
* This file is part of HPL1 Engine.
*/
+#include "hpl1/engine/libraries/angelscript/add-ons/scripthelper.h"
#include "hpl1/engine/impl/SqScript.h"
-#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/low_level_system.h"
-#include "hpl1/engine/system/String.h"
#include "common/file.h"
#include "hpl1/debug.h"
+#include "hpl1/engine/libraries/angelscript/angelscript.h"
+#include "hpl1/engine/math/Math.h"
+#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
@@ -47,7 +49,7 @@ cSqScript::cSqScript(const tString &asName, asIScriptEngine *apScriptEngine,
mpScriptOutput = apScriptOutput;
mlHandle = alHandle;
- //mpContext = mpScriptEngine->CreateContext();
+ mpContext = mpScriptEngine->CreateContext();
// Create a unique module name
msModuleName = "Module_" + cString::ToString(cMath::RandRectl(0, 1000000)) +
@@ -55,10 +57,8 @@ cSqScript::cSqScript(const tString &asName, asIScriptEngine *apScriptEngine,
}
cSqScript::~cSqScript() {
-#if 0
- mpScriptEngine->Discard(msModuleName.c_str());
- mpContext->Release();
-#endif
+ _module->Discard();
+ mpContext->Release();
}
//-----------------------------------------------------------------------
@@ -70,49 +70,40 @@ cSqScript::~cSqScript() {
//-----------------------------------------------------------------------
bool cSqScript::CreateFromFile(const tString &asFileName) {
-#if 0
- int lLength;
- char *pCharBuffer = LoadCharBuffer(asFileName,lLength);
- if(pCharBuffer==NULL){
- Error("Couldn't load script '%s'!\n",asFileName.c_str());
- return false;
- }
-
- if(mpScriptEngine->AddScriptSection(msModuleName.c_str(), "main", pCharBuffer, lLength)<0)
- {
- Error("Couldn't add script '%s'!\n",asFileName.c_str());
- hplDeleteArray(pCharBuffer);
- return false;
- }
-
- if(mpScriptEngine->Build(msModuleName.c_str())<0)
- {
- Error("Couldn't build script '%s'!\n",asFileName.c_str());
- Log("------- SCRIPT OUTPUT BEGIN --------------------------\n");
- mpScriptOutput->Display();
- mpScriptOutput->Clear();
- Log("------- SCRIPT OUTPUT END ----------------------------\n");
-
+ int lLength;
+ char *pCharBuffer = LoadCharBuffer(asFileName, lLength);
+ if (pCharBuffer == nullptr) {
+ Error("Couldn't load script '%s'!\n", asFileName.c_str());
+ return false;
+ }
+ _module = mpScriptEngine->GetModule(msModuleName.c_str(), asGM_ALWAYS_CREATE);
+ if (_module->AddScriptSection(msModuleName.c_str(), pCharBuffer, lLength) < 0) {
+ Error("Couldn't add script '%s'!\n", asFileName.c_str());
+ hplDeleteArray(pCharBuffer);
+ return false;
+ }
- hplDeleteArray(pCharBuffer);
- return false;
- }
+ if (_module->Build() < 0) {
+ Error("Couldn't build script '%s'!\n", asFileName.c_str());
+ Log("------- SCRIPT OUTPUT BEGIN --------------------------\n");
+ mpScriptOutput->Display();
mpScriptOutput->Clear();
+ Log("------- SCRIPT OUTPUT END ----------------------------\n");
hplDeleteArray(pCharBuffer);
- return true;
-#endif
- return false;
+ return false;
+ }
+ mpScriptOutput->Clear();
+
+ hplDeleteArray(pCharBuffer);
+ return true;
}
//-----------------------------------------------------------------------
int cSqScript::GetFuncHandle(const tString &asFunc) {
-#if 0
- return mpScriptEngine->GetFunctionIDByName(msModuleName.c_str(),asFunc.c_str());
-#endif
- return 0;
+ return _module->GetFunctionByName(asFunc.c_str())->GetId();
}
//-----------------------------------------------------------------------
@@ -123,27 +114,14 @@ void cSqScript::AddArg(const tString &asArg) {
//-----------------------------------------------------------------------
bool cSqScript::Run(const tString &asFuncLine) {
-#if 0
- mpScriptEngine->ExecuteString(msModuleName.c_str(), asFuncLine.c_str());
-
- return true;
-#endif
- return false;
+ ExecuteString(mpScriptEngine, asFuncLine.c_str(), _module);
+ return true;
}
//-----------------------------------------------------------------------
bool cSqScript::Run(int alHandle) {
-#if 0
- mpContext->Prepare(alHandle);
-
- /* Set all the args here */
-
- mpContext->Execute();
-
- return true;
-#endif
- return false;
+ error("call to unimplemented function cSqScript::run(int)");
}
//-----------------------------------------------------------------------
@@ -155,22 +133,22 @@ bool cSqScript::Run(int alHandle) {
//-----------------------------------------------------------------------
char *cSqScript::LoadCharBuffer(const tString &asFileName, int &alLength) {
- Common::File file;
- //FIXME: use proper string types
+ Common::File file;
+ // FIXME: use proper string types
file.open(asFileName.c_str());
- if(!file.isOpen()) {
- debugCN(Hpl1::kDebugLevelError, Hpl1::kDebugFilePath,
- "script file at %s could not be opened", asFileName.c_str());
+ if (!file.isOpen()) {
+ debugCN(Hpl1::kDebugLevelError, Hpl1::kDebugFilePath,
+ "script file at %s could not be opened", asFileName.c_str());
return nullptr;
}
-
- alLength = file.size();
+
+ alLength = file.size();
char *pBuffer = hplNewArray(char, alLength);
file.read(pBuffer, alLength);
- if(file.err()) {
- debugCN(Hpl1::kDebugLevelError, Hpl1::kDebugResourceLoading,
- "error in reading script file %s", asFileName.c_str());
- return nullptr;
+ if (file.err()) {
+ debugCN(Hpl1::kDebugLevelError, Hpl1::kDebugResourceLoading,
+ "error in reading script file %s", asFileName.c_str());
+ return nullptr;
}
return pBuffer;
}
diff --git a/engines/hpl1/engine/impl/SqScript.h b/engines/hpl1/engine/impl/SqScript.h
index d1fe703e517..fc1bab36eae 100644
--- a/engines/hpl1/engine/impl/SqScript.h
+++ b/engines/hpl1/engine/impl/SqScript.h
@@ -63,6 +63,7 @@ public:
private:
asIScriptEngine *mpScriptEngine;
+ asIScriptModule *_module;
cScriptOutput *mpScriptOutput;
asIScriptContext *mpContext;
Commit: ff6c653c8d9770ac946cadbbffaca00f74b782ab
https://github.com/scummvm/scummvm/commit/ff6c653c8d9770ac946cadbbffaca00f74b782ab
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:38+01:00
Commit Message:
HPL1: enable mesh loaders
Changed paths:
engines/hpl1/engine/resources/low_level_resources.cpp
diff --git a/engines/hpl1/engine/resources/low_level_resources.cpp b/engines/hpl1/engine/resources/low_level_resources.cpp
index 37b654a0e3b..d4b2df9dc08 100644
--- a/engines/hpl1/engine/resources/low_level_resources.cpp
+++ b/engines/hpl1/engine/resources/low_level_resources.cpp
@@ -23,6 +23,8 @@
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/resources/MeshLoaderHandler.h"
#include "hpl1/engine/resources/VideoManager.h"
+#include "hpl1/engine/impl/MeshLoaderCollada.h"
+#include "hpl1/engine/impl/MeshLoaderMSH.h"
#include "common/fs.h"
#include "hpl1/debug.h"
#include "common/file.h"
@@ -49,10 +51,8 @@ void LowLevelResources::getSupportedImageFormats(tStringList &formats) {
}
void LowLevelResources::addMeshLoaders(cMeshLoaderHandler *ml) {
-#if 0
- ml->AddLoader(hplNew(cMeshLoaderMSH, (mpLowLevelGraphics)));
- ml->AddLoader(hplNew(cMeshLoaderCollada, (mpLowLevelGraphics)));
-#endif
+ ml->AddLoader(hplNew(cMeshLoaderMSH, (_lowLevelGraphics)));
+ ml->AddLoader(hplNew(cMeshLoaderCollada, (_lowLevelGraphics)));
}
void LowLevelResources::addVideoLoaders(cVideoManager *vm) {
Commit: e777ca4b24339c15d6b201d1f7948b98318980bd
https://github.com/scummvm/scummvm/commit/e777ca4b24339c15d6b201d1f7948b98318980bd
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:38+01:00
Commit Message:
HPL1: enable OcclusionQueryOGL class
Changed paths:
engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
diff --git a/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp b/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
index d2812452b60..10f8bf87d4f 100644
--- a/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
+++ b/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
@@ -26,6 +26,7 @@
*/
#include "hpl1/engine/impl/OcclusionQueryOGL.h"
+#include "hpl1/opengl.h"
//#include <GL/GLee.h>
@@ -38,18 +39,14 @@ namespace hpl {
//-----------------------------------------------------------------------
cOcclusionQueryOGL::cOcclusionQueryOGL() {
-#if 0
- glGenQueriesARB(1, (GLuint *)&mlQueryId);
- mlLastSampleCount =0;
-#endif
+ glGenQueries(1, (GLuint *)&mlQueryId);
+ mlLastSampleCount = 0;
}
//-----------------------------------------------------------------------
cOcclusionQueryOGL::~cOcclusionQueryOGL() {
-#if 0
- glDeleteQueriesARB(1, (GLuint *)&mlQueryId);
-#endif
+ glDeleteQueries(1, (GLuint *)&mlQueryId);
}
//-----------------------------------------------------------------------
@@ -61,25 +58,20 @@ cOcclusionQueryOGL::~cOcclusionQueryOGL() {
//-----------------------------------------------------------------------
void cOcclusionQueryOGL::Begin() {
-#if 0
- glBeginQueryARB(GL_SAMPLES_PASSED_ARB,mlQueryId);
-#endif
+ glBeginQuery(GL_SAMPLES_PASSED, mlQueryId);
}
void cOcclusionQueryOGL::End() {
-#if 0
- glEndQueryARB(GL_SAMPLES_PASSED_ARB);
-#endif
+ glEndQuery(GL_SAMPLES_PASSED);
}
bool cOcclusionQueryOGL::FetchResults() {
-#if 0
- int lAvailable=0;
- glGetQueryObjectivARB(mlQueryId,GL_QUERY_RESULT_AVAILABLE_ARB,(GLint *)&lAvailable);
- if(lAvailable==0) return false;
+ int lAvailable = 0;
+ glGetQueryObjectiv(mlQueryId, GL_QUERY_RESULT_AVAILABLE, (GLint *)&lAvailable);
+ if (lAvailable == 0)
+ return false;
- glGetQueryObjectivARB(mlQueryId,GL_QUERY_RESULT_ARB,(GLint *)&mlLastSampleCount);
-#endif
+ glGetQueryObjectiv(mlQueryId, GL_QUERY_RESULT, (GLint *)&mlLastSampleCount);
return true;
}
Commit: 3f426575c02a891c7466cfe60398a14e3ed9feee
https://github.com/scummvm/scummvm/commit/3f426575c02a891c7466cfe60398a14e3ed9feee
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:38+01:00
Commit Message:
HPL1: enable physics system creation
Changed paths:
engines/hpl1/engine/game/low_level_game_setup.cpp
diff --git a/engines/hpl1/engine/game/low_level_game_setup.cpp b/engines/hpl1/engine/game/low_level_game_setup.cpp
index ec1c354d506..1b8d5bdf516 100644
--- a/engines/hpl1/engine/game/low_level_game_setup.cpp
+++ b/engines/hpl1/engine/game/low_level_game_setup.cpp
@@ -32,34 +32,33 @@
namespace hpl {
LowLevelGameSetup::LowLevelGameSetup() {
- _lowLevelSystem = hplNew( LowLevelSystem, () );
- _lowLevelGraphics = hplNew( cLowLevelGraphicsSDL,() );
- _lowLevelInput = hplNew( cLowLevelInputSDL,(_lowLevelGraphics) );
- _lowLevelResources = hplNew( LowLevelResources,(_lowLevelGraphics) );
- _lowLevelSound = hplNew( cLowLevelSoundOpenAL,() );
- //_lowLevelPhysics = hplNew( cLowLevelPhysicsNewton,() );
+ _lowLevelSystem = hplNew(LowLevelSystem, ());
+ _lowLevelGraphics = hplNew(cLowLevelGraphicsSDL, ());
+ _lowLevelInput = hplNew(cLowLevelInputSDL, (_lowLevelGraphics));
+ _lowLevelResources = hplNew(LowLevelResources, (_lowLevelGraphics));
+ _lowLevelSound = hplNew(cLowLevelSoundOpenAL, ());
+ _lowLevelPhysics = hplNew(cLowLevelPhysicsNewton, ());
_lowLevelHaptic = nullptr;
}
LowLevelGameSetup::~LowLevelGameSetup() {
-#if 0
- Log("- Deleting lowlevel stuff.\n");
-
- Log(" Physics\n");
- hplDelete(mpLowLevelPhysics);
- Log(" Sound\n");
- hplDelete(mpLowLevelSound);
- Log(" Input\n");
- hplDelete(mpLowLevelInput);
- Log(" Resources\n");
- hplDelete(mpLowLevelResources);
- Log(" System\n");
- hplDelete(mpLowLevelSystem);
- Log(" Graphics\n");
- hplDelete(mpLowLevelGraphics);
- Log(" Haptic\n");
- if(mpLowLevelHaptic) hplDelete(mpLowLevelHaptic);
-#endif
+ Log("Deleting lowlevel stuff.\n");
+
+ Log("Physics\n");
+ hplDelete(_lowLevelSystem);
+ Log("Sound\n");
+ hplDelete(_lowLevelSound);
+ Log("Input\n");
+ hplDelete(_lowLevelInput);
+ Log("Resources\n");
+ hplDelete(_lowLevelResources);
+ Log("System\n");
+ hplDelete(_lowLevelSystem);
+ Log("Graphics\n");
+ hplDelete(_lowLevelGraphics);
+ Log("Haptic\n");
+ if (_lowLevelHaptic)
+ hplDelete(_lowLevelHaptic);
}
cScene *LowLevelGameSetup::createScene(cGraphics *graphics, cResources *resources, cSound *sound,
@@ -71,7 +70,6 @@ cResources *LowLevelGameSetup::createResources(cGraphics *graphics) {
return hplNew(cResources, (_lowLevelResources, _lowLevelGraphics));
}
-
cInput *LowLevelGameSetup::createInput(cGraphics *graphics) {
return hplNew(cInput, (_lowLevelInput));
}
Commit: 1478794e6381b1c2d1934d2e0275bd6be69b4bfe
https://github.com/scummvm/scummvm/commit/1478794e6381b1c2d1934d2e0275bd6be69b4bfe
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:38+01:00
Commit Message:
HPL1: fix opengl texture formats
Changed paths:
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/SDLTexture.h
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index bd22c6cef51..ec0a0266b92 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -35,6 +35,32 @@
namespace hpl {
+static void getSettings(Bitmap2D *apSrc, int &alChannels, GLint &internalFormat, GLenum &format) {
+ alChannels = apSrc->getNumChannels();
+ tString sType = cString::ToLowerCase(apSrc->getType());
+
+ if (alChannels == 4) {
+ internalFormat = GL_RGBA;
+ if (sType == "tga") {
+ format = GL_BGRA;
+ } else {
+ format = GL_RGBA;
+ }
+ }
+ if (alChannels == 3) {
+ internalFormat = GL_RGB;
+ if (sType == "tga") {
+ format = GL_BGR;
+ } else {
+ format = GL_RGB;
+ }
+ }
+ if (alChannels == 1) {
+ format = GL_RED;
+ internalFormat = GL_RED;
+ }
+}
+
//////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
//////////////////////////////////////////////////////////////////////////
@@ -144,9 +170,10 @@ bool cSDLTexture::CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps) {
int lChannels;
GLenum format;
- GetSettings(pSrc, lChannels, format);
+ GLint internalFormat;
+ getSettings(pSrc, lChannels, internalFormat, format);
- glTexImage2D(target, 0, lChannels, pSrc->getWidth(), pSrc->getHeight(),
+ glTexImage2D(target, 0, internalFormat, pSrc->getWidth(), pSrc->getHeight(),
0, format, GL_UNSIGNED_BYTE, pSrc->getRawData());
// No mip maps for cubemap
@@ -199,10 +226,10 @@ bool cSDLTexture::CreateFromArray(unsigned char *apPixelData, int alChannels, co
GLenum format = 0;
switch (lChannels) {
case 1:
- format = GL_LUMINANCE;
+ format = GL_R;
break;
case 2:
- format = GL_LUMINANCE_ALPHA;
+ format = GL_RG;
break;
case 3:
format = GL_RGB;
@@ -221,13 +248,13 @@ bool cSDLTexture::CreateFromArray(unsigned char *apPixelData, int alChannels, co
}
if (mTarget == eTextureTarget_1D) {
- GL_CHECK(glTexImage1D(GLTarget, 0, lChannels, _width, 0, format,
+ GL_CHECK(glTexImage1D(GLTarget, 0, format, _width, 0, format,
GL_UNSIGNED_BYTE, apPixelData));
} else if (mTarget == eTextureTarget_2D) {
- GL_CHECK(glTexImage2D(GLTarget, 0, lChannels, _width, _height,
+ GL_CHECK(glTexImage2D(GLTarget, 0, format, _width, _height,
0, format, GL_UNSIGNED_BYTE, apPixelData));
} else if (mTarget == eTextureTarget_3D) {
- GL_CHECK(glTexImage3D(GLTarget, 0, lChannels, avSize.x, avSize.y, avSize.z,
+ GL_CHECK(glTexImage3D(GLTarget, 0, format, avSize.x, avSize.y, avSize.z,
0, format, GL_UNSIGNED_BYTE, apPixelData));
}
@@ -485,8 +512,9 @@ bool cSDLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
int lChannels = 0;
+ GLint internalFormat = 0;
GLenum format = 0;
- GetSettings(pBitmapSrc, lChannels, format);
+ getSettings(pBitmapSrc, lChannels, internalFormat, format);
_bpp = lChannels * 8;
@@ -546,10 +574,10 @@ bool cSDLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
GL_CHECK_FN();
if (mTarget == eTextureTarget_1D)
- glTexImage1D(GLTarget, 0, format, _width, 0, format,
+ glTexImage1D(GLTarget, 0, internalFormat, _width, 0, format,
GL_UNSIGNED_BYTE, pPixelSrc);
else
- glTexImage2D(GLTarget, 0, format, _width, _height,
+ glTexImage2D(GLTarget, 0, internalFormat, _width, _height,
0, format, GL_UNSIGNED_BYTE, pPixelSrc);
if (glGetError() != GL_NO_ERROR)
@@ -600,33 +628,6 @@ void cSDLTexture::PostCreation(GLenum aGLTarget) {
//-----------------------------------------------------------------------
-void cSDLTexture::GetSettings(Bitmap2D *apSrc, int &alChannels, GLenum &aFormat) {
- alChannels = apSrc->getNumChannels();
- aFormat = GL_RGBA;
-
- tString sType = cString::ToLowerCase(apSrc->getType());
-
- if (alChannels == 4) {
- if (sType == "tga") {
- aFormat = GL_BGRA;
- } else {
- aFormat = GL_RGBA;
- }
- }
- if (alChannels == 3) {
- if (sType == "tga") {
- aFormat = GL_BGR;
- } else {
- aFormat = GL_RGB;
- }
- }
- if (alChannels == 1) {
- aFormat = GL_ALPHA;
- }
-}
-
-//-----------------------------------------------------------------------
-
GLenum cSDLTexture::GetGLWrap(eTextureWrap aMode) {
switch (aMode) {
case eTextureWrap_Clamp:
diff --git a/engines/hpl1/engine/impl/SDLTexture.h b/engines/hpl1/engine/impl/SDLTexture.h
index a43099b5193..8e527436e2d 100644
--- a/engines/hpl1/engine/impl/SDLTexture.h
+++ b/engines/hpl1/engine/impl/SDLTexture.h
@@ -90,8 +90,6 @@ private:
GLenum GetGLWrap(eTextureWrap aMode);
- void GetSettings(Bitmap2D *apSrc, int &alChannels, GLenum &aFormat);
-
tUIntVec mvTextureHandles;
bool mbContainsData;
cLowLevelGraphicsSDL *mpGfxSDL;
Commit: acfcb879c4ba23da720ac57b5b2a3187662e3f84
https://github.com/scummvm/scummvm/commit/acfcb879c4ba23da720ac57b5b2a3187662e3f84
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:38+01:00
Commit Message:
HPL1: remove shader creation
Changed paths:
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/engine/resources/GpuProgramManager.cpp
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index e9a1ca52a67..a20ce82f199 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -38,9 +38,9 @@
#include "hpl1/engine/math/BoundingVolume.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/resources/GpuProgramManager.h"
-#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/resources/TextureManager.h"
+#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/scene/Camera3D.h"
#include "hpl1/engine/scene/Entity3D.h"
#include "hpl1/engine/scene/Light3D.h"
@@ -821,8 +821,9 @@ void cRenderer3D::RenderOcclusionQueries(cCamera3D *apCamera) {
}
pPrevMatrix = pObject->mpMatrix;
// Set the vertex program matrix.
- mpDiffuseVtxProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
- eGpuProgramMatrixOp_Identity);
+ if (mpDiffuseVtxProgram)
+ mpDiffuseVtxProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
+ eGpuProgramMatrixOp_Identity);
if (mbLog)
Log(" Setting matrix %d\n", pObject->mpMatrix);
diff --git a/engines/hpl1/engine/resources/GpuProgramManager.cpp b/engines/hpl1/engine/resources/GpuProgramManager.cpp
index 9cc6b7a1f43..8fd2ffaa696 100644
--- a/engines/hpl1/engine/resources/GpuProgramManager.cpp
+++ b/engines/hpl1/engine/resources/GpuProgramManager.cpp
@@ -28,8 +28,8 @@
#include "hpl1/engine/resources/GpuProgramManager.h"
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/LowLevelGraphics.h"
-#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
@@ -73,6 +73,8 @@ iResourceBase *cGpuProgramManager::Create(const tString &asName) {
iGpuProgram *cGpuProgramManager::CreateProgram(const tString &asName, const tString &asEntry,
eGpuProgramType aType) {
+ return nullptr;
+#if 0
tString sPath;
iGpuProgram *pProgram;
pProgram = static_cast<iGpuProgram *>(FindLoadedResource(asName, sPath));
@@ -99,6 +101,7 @@ iGpuProgram *cGpuProgramManager::CreateProgram(const tString &asName, const tStr
EndLoad();
return pProgram;
+#endif
}
//-----------------------------------------------------------------------
Commit: 0c83a0deb739075b626974277f22b3cafe2b5f08
https://github.com/scummvm/scummvm/commit/0c83a0deb739075b626974277f22b3cafe2b5f08
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:38+01:00
Commit Message:
HPL1: fix collision processing
Changed paths:
engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
index cce30eacd98..88de1affd02 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
@@ -245,8 +245,7 @@ class ContactProcessor {
public:
ContactProcessor(const NewtonJoint *joint);
- bool hasNext();
- void processNext();
+ bool processNext();
void endProcessing();
private:
@@ -265,15 +264,11 @@ ContactProcessor::ContactProcessor(const NewtonJoint *joint) : _joint(joint), _c
_body1 = NewtonJointGetBody1(joint);
_contactBody0 = (cPhysicsBodyNewton *)NewtonBodyGetUserData(_body0);
_contactBody1 = (cPhysicsBodyNewton *)NewtonBodyGetUserData(_body1);
+ _contact = NewtonContactJointGetFirstContact(_joint);
}
-bool ContactProcessor::hasNext() {
- return (_contact = NewtonContactJointGetNextContact(_joint, _contact));
-}
-
-void ContactProcessor::processNext() {
+bool ContactProcessor::processNext() {
NewtonMaterial *_material = NewtonContactGetMaterial(_contact);
-
float fNormSpeed = NewtonMaterialGetContactNormalSpeed(_material);
if (_contactData.mfMaxContactNormalSpeed < fNormSpeed)
_contactData.mfMaxContactNormalSpeed = fNormSpeed;
@@ -305,7 +300,8 @@ void ContactProcessor::processNext() {
collidePoint.mvNormal = cVector3f::fromArray(matNormal);
_contactBody0->GetWorld()->GetContactPoints()->push_back(collidePoint);
}
- _contacts++;
+ ++_contacts;
+ return (_contact = NewtonContactJointGetNextContact(_joint, _contact));
}
void ContactProcessor::endProcessing() {
@@ -354,8 +350,7 @@ void ContactProcessor::endProcessing() {
void cPhysicsMaterialNewton::ProcessContactCallback(const NewtonJoint *joint, float, int) {
ContactProcessor processor(joint);
- while (processor.hasNext())
- processor.processNext();
+ while (processor.processNext()) {}
processor.endProcessing();
}
Commit: cb22b849df87e1063c9be0d07aae61d9481bdf59
https://github.com/scummvm/scummvm/commit/cb22b849df87e1063c9be0d07aae61d9481bdf59
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:38+01:00
Commit Message:
HPL1: enable scripting system and fix related bugs
Changed paths:
engines/hpl1/engine/system/Script.h
engines/hpl1/engine/system/low_level_system.cpp
engines/hpl1/engine/system/low_level_system.h
diff --git a/engines/hpl1/engine/system/Script.h b/engines/hpl1/engine/system/Script.h
index 7cf0c6a30d9..09b8d1cdf6f 100644
--- a/engines/hpl1/engine/system/Script.h
+++ b/engines/hpl1/engine/system/Script.h
@@ -199,7 +199,7 @@
#define SCRIPT_ARG_string(n) std::string _arg##n = *(std::string *)gen->GetArgObject(n)
#define SCRIPT_ARG_float(n) float _arg##n = gen->GetArgFloat(n)
#define SCRIPT_ARG_int(n) int _arg##n = gen->GetArgDWord(n)
-#define SCRIPT_ARG_bool(n) bool _arg##n = gen->GetArgDWord(n)
+#define SCRIPT_ARG_bool(n) bool _arg##n = gen->GetArgByte(n)
// Return Value Macros
#define SCRIPT_RETURN_string std::string _ret
#define SCRIPT_RETURN_CALL_string _ret =
@@ -217,9 +217,10 @@
#define SCRIPT_RETURN_CALL_void
#define SCRIPT_SET_RETURN_void
+#define AS_MAX_PORTABILITY
#if defined(AS_MAX_PORTABILITY)
#define SCRIPT_REGISTER_FUNC(funcname) \
- GenericScript::funcname##_return + " " #funcname " (" + GenericScript::funcname##_arg + ")", (void *)GenericScript::funcname##_Generic, asCALL_GENERIC
+ GenericScript::funcname##_return + " " #funcname " (" + GenericScript::funcname##_arg + ")", GenericScript::funcname##_Generic, asCALL_GENERIC
#else
#define SCRIPT_REGISTER_FUNC(funcname) \
GenericScript::funcname##_return + " " #funcname " (" + GenericScript::funcname##_arg + ")", (void *)funcname, asCALL_STDCALL
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index 7fe06989c8b..a04fbea7d90 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "hpl1/engine/libraries/angelscript/angelscript.h"
#include "hpl1/engine/impl/SqScript.h"
#include "hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h"
+#include "hpl1/engine/libraries/angelscript/angelscript.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/debug.h"
@@ -32,24 +32,16 @@
namespace hpl {
LowLevelSystem::LowLevelSystem() {
-#if 0
- mpScriptEngine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
-#endif
- //_scriptOutput = hplNew(cScriptOutput, ());
- //_scriptEngine->SetMessageCallback(asMETHOD(cScriptOutput, AddMessage), _scriptOutput, asCALL_THISCALL);
-#if 0
-#ifdef AS_MAX_PORTABILITY
- RegisterScriptString(mpScriptEngine);
-#else
- RegisterStdString(mpScriptEngine);
-#endif
-#endif
+ _scriptEngine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
+ _scriptOutput = hplNew(cScriptOutput, ());
+ _scriptEngine->SetMessageCallback(asMETHOD(cScriptOutput, AddMessage), _scriptOutput, asCALL_THISCALL);
+ RegisterStdString(_scriptEngine);
_handleCount = 0;
}
LowLevelSystem::~LowLevelSystem() {
/*Release all runnings contexts */
-
+ _scriptOutput->Display();
_scriptEngine->Release();
hplDelete(_scriptOutput);
@@ -58,7 +50,7 @@ LowLevelSystem::~LowLevelSystem() {
// gpLogWriter = NULL;
}
-static void commonLog(int level, const char* fmt, va_list args) {
+static void commonLog(int level, const char *fmt, va_list args) {
char buffer[256];
vsnprintf(buffer, 256, fmt, args);
debugN(level, buffer);
@@ -112,12 +104,12 @@ void LogUpdate(const char *fmt, ...) {
//-----------------------------------------------------------------------
void CopyTextToClipboard(const tWString &text) {
- //FIXME: string types
+ // FIXME: string types
g_system->setTextInClipboard(Common::String(cString::To8Char(text.c_str()).c_str()));
}
tWString LoadTextFromClipboard() {
- //FIXME: string types
+ // FIXME: string types
Common::U32String text = g_system->getTextFromClipboard();
return cString::To16Char(Common::String(text).c_str());
}
@@ -381,17 +373,15 @@ iScript *LowLevelSystem::createScript(const tString &name) {
return hplNew(cSqScript, (name, _scriptEngine, _scriptOutput, _handleCount++));
}
-bool LowLevelSystem::addScriptFunc(const tString &funcDecl, void *pFunc, int callConv) {
-#if 0
- if (_scriptEngine->RegisterGlobalFunction(funcDecl.c_str(),
- asFUNCTION(pFunc), callConv) < 0) {
+bool LowLevelSystem::addScriptFunc(const tString &funcDecl, asGENFUNC_t pFunc, int callConv) {
+ if (_scriptEngine->RegisterGlobalFunction(funcDecl.c_str(),
+ asFUNCTION(pFunc), callConv) < 0) {
Error("Couldn't add func '%s'\n", funcDecl.c_str());
+ _scriptOutput->Display();
return false;
}
return true;
-#endif
- return false;
}
bool LowLevelSystem::addScriptVar(const tString &varDecl, void *pVar) {
diff --git a/engines/hpl1/engine/system/low_level_system.h b/engines/hpl1/engine/system/low_level_system.h
index 65442b26ee0..56aeb9e8e57 100644
--- a/engines/hpl1/engine/system/low_level_system.h
+++ b/engines/hpl1/engine/system/low_level_system.h
@@ -28,6 +28,7 @@
#ifndef HPL_LOWLEVELSYSTEM_H
#define HPL_LOWLEVELSYSTEM_H
+#include "hpl1/engine/libraries/angelscript/angelscript.h"
#include "hpl1/engine/system/MemoryManager.h"
#include "hpl1/engine/system/SystemTypes.h"
@@ -121,7 +122,7 @@ public:
* \param funcDecl the declaration.
* \return
*/
- bool addScriptFunc(const tString &funcDecl, void *func, int callConv);
+ bool addScriptFunc(const tString &funcDecl, asGENFUNC_t func, int callConv);
/**
* Add a variable to the script vm. Example: "int MyVar"
Commit: b1eb9ec4288aab87edd1686e84ebebcb08c067cf
https://github.com/scummvm/scummvm/commit/b1eb9ec4288aab87edd1686e84ebebcb08c067cf
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:38+01:00
Commit Message:
HPL1: set default graphics setting to very low
Changed paths:
engines/hpl1/penumbra-overture/Init.cpp
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 35523c6bb30..ef5363ef26b 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -26,6 +26,7 @@
*/
#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/engine/graphics/Material.h"
#include "hpl1/penumbra-overture/ButtonHandler.h"
#include "hpl1/penumbra-overture/GameArea.h"
#include "hpl1/penumbra-overture/GameDamageArea.h"
@@ -148,7 +149,7 @@ bool CheckSupport(cInit *apInit) {
CG_CHECK(CG_PROFILE_GLSLF);
CG_CHECK(CG_PROFILE_GLSLC);
#undef CG_CHECK
-#endif
+#endif
// Try compiling vertex shader
Log("Trying to load vertex program!\n");
iGpuProgram *pTestVtxProg = pLowLevelGraphics->CreateGpuProgram("Test", eGpuProgramType_Vertex);
@@ -272,7 +273,6 @@ bool cInit::Init(tString asCommandLine) {
CreateFolder(sDir);
}
-
// MAIN INIT /////////////////////
// Check for what settings file to use.
@@ -351,7 +351,7 @@ bool cInit::Init(tString asCommandLine) {
mlFSAA = mpConfig->GetInt("Graphics", "FSAA", 0);
mbPostEffects = mpConfig->GetBool("Graphics", "PostEffects", true);
- iMaterial::SetQuality((eMaterialQuality)mpConfig->GetInt("Graphics", "ShaderQuality", eMaterialQuality_High));
+ iMaterial::SetQuality((eMaterialQuality)mpConfig->GetInt("Graphics", "ShaderQuality", eMaterialQuality_VeryLow));
mPhysicsAccuracy = (ePhysicsAccuracy)mpConfig->GetInt("Physics", "Accuracy", ePhysicsAccuracy_High);
mfPhysicsUpdatesPerSec = mpConfig->GetFloat("Physics", "UpdatesPerSec", 60.0f);
Commit: 46a2bc94b6cf73567e055c74d54927c0cbf20143
https://github.com/scummvm/scummvm/commit/46a2bc94b6cf73567e055c74d54927c0cbf20143
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:39+01:00
Commit Message:
HPL1: fix texture formats
Changed paths:
engines/hpl1/engine/impl/SDLTexture.cpp
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index ec0a0266b92..8003c72b415 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -26,6 +26,8 @@
*/
#include "hpl1/engine/impl/SDLTexture.h"
+#include "common/str.h"
+#include "graphics/pixelformat.h"
#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/debug.h"
@@ -38,10 +40,11 @@ namespace hpl {
static void getSettings(Bitmap2D *apSrc, int &alChannels, GLint &internalFormat, GLenum &format) {
alChannels = apSrc->getNumChannels();
tString sType = cString::ToLowerCase(apSrc->getType());
+ const Common::String bmpFormat = apSrc->format().toString();
if (alChannels == 4) {
internalFormat = GL_RGBA;
- if (sType == "tga") {
+ if (bmpFormat.contains("BGRA")) {
format = GL_BGRA;
} else {
format = GL_RGBA;
@@ -49,7 +52,7 @@ static void getSettings(Bitmap2D *apSrc, int &alChannels, GLint &internalFormat,
}
if (alChannels == 3) {
internalFormat = GL_RGB;
- if (sType == "tga") {
+ if (bmpFormat.contains("BGR")) {
format = GL_BGR;
} else {
format = GL_RGB;
Commit: aa5c9ad567d707dfc44e02d9e40783ddc7ac642d
https://github.com/scummvm/scummvm/commit/aa5c9ad567d707dfc44e02d9e40783ddc7ac642d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:39+01:00
Commit Message:
HPL1: fix bug and cleanup PhysicsBodyNewton
Changed paths:
engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
index 6e9e36ecc74..573f63d1a4a 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
@@ -111,8 +111,8 @@ void cPhysicsBodyNewtonCallback::OnTransformUpdate(iEntity3D *apEntity) {
return;
cPhysicsBodyNewton *pRigidBody = static_cast<cPhysicsBodyNewton *>(apEntity);
- auto mTemp = apEntity->GetLocalMatrix().GetTranspose();
- NewtonBodySetMatrix(pRigidBody->mpNewtonBody, &mTemp.m[0][0]);
+ cMatrixf mTemp = apEntity->GetLocalMatrix().GetTranspose();
+ NewtonBodySetMatrix(pRigidBody->mpNewtonBody, mTemp.v);
if (pRigidBody->mpNode)
pRigidBody->mpNode->SetMatrix(apEntity->GetLocalMatrix());
@@ -129,7 +129,7 @@ void cPhysicsBodyNewtonCallback::OnTransformUpdate(iEntity3D *apEntity) {
void cPhysicsBodyNewton::SetMaterial(iPhysicsMaterial *apMaterial) {
mpMaterial = apMaterial;
- if (apMaterial == NULL)
+ if (apMaterial == nullptr)
return;
cPhysicsMaterialNewton *pNewtonMat = static_cast<cPhysicsMaterialNewton *>(mpMaterial);
@@ -144,21 +144,21 @@ void cPhysicsBodyNewton::SetLinearVelocity(const cVector3f &avVel) {
NewtonBodySetVelocity(mpNewtonBody, vel);
}
cVector3f cPhysicsBodyNewton::GetLinearVelocity() const {
- float arrayVec[3];
- NewtonBodyGetVelocity(mpNewtonBody, arrayVec);
- return {arrayVec[0], arrayVec[1], arrayVec[2]};
+ float vel[3];
+ NewtonBodyGetVelocity(mpNewtonBody, vel);
+ return cVector3f::fromArray(vel);
}
//-----------------------------------------------------------------------
void cPhysicsBodyNewton::SetAngularVelocity(const cVector3f &avVel) {
- const float faVel[] = {avVel.x, avVel.y, avVel.y};
- NewtonBodySetOmega(mpNewtonBody, faVel);
+ VEC3_CONST_ARRAY(vel, avVel);
+ NewtonBodySetOmega(mpNewtonBody, vel);
}
cVector3f cPhysicsBodyNewton::GetAngularVelocity() const {
float vel[3];
NewtonBodyGetOmega(mpNewtonBody, vel);
- return {vel[0], vel[1], vel[2]};
+ return cVector3f::fromArray(vel);
}
//-----------------------------------------------------------------------
@@ -222,15 +222,14 @@ cMatrixf cPhysicsBodyNewton::GetInertiaMatrix() {
void cPhysicsBodyNewton::SetMass(float afMass) {
cCollideShapeNewton *pShapeNewton = static_cast<cCollideShapeNewton *>(mpShape);
- float faInertia[3];
- float faOffset[3];
+ float inertia[3];
+ float offset[3];
NewtonConvexCollisionCalculateInertialMatrix(pShapeNewton->GetNewtonCollision(),
- faInertia, faOffset);
+ inertia, offset);
- cVector3f vInertia = {faInertia[0], faInertia[1], faInertia[2]}; // = pShapeNewton->GetInertia(afMass);
- vInertia = vInertia * afMass;
+ cVector3f vInertia = cVector3f::fromArray(inertia) * afMass; // = pShapeNewton->GetInertia(afMass);
- NewtonBodySetCentreOfMass(mpNewtonBody, faOffset);
+ NewtonBodySetCentreOfMass(mpNewtonBody, offset);
NewtonBodySetMassMatrix(mpNewtonBody, afMass, vInertia.x, vInertia.y, vInertia.z);
mfMass = afMass;
@@ -245,9 +244,9 @@ void cPhysicsBodyNewton::SetMassCentre(const cVector3f &avCentre) {
}
cVector3f cPhysicsBodyNewton::GetMassCentre() const {
- float faCentre[3];
- NewtonBodyGetCentreOfMass(mpNewtonBody, faCentre);
- return {faCentre[0], faCentre[1], faCentre[3]};
+ float center[3];
+ NewtonBodyGetCentreOfMass(mpNewtonBody, center);
+ return cVector3f::fromArray(center);
}
//-----------------------------------------------------------------------
@@ -308,7 +307,7 @@ void cPhysicsBodyNewton::AddImpulseAtPosition(const cVector3f &avImpulse, const
//-----------------------------------------------------------------------
void cPhysicsBodyNewton::SetEnabled(bool abEnabled) {
- NewtonBodySetFreezeState(mpNewtonBody, abEnabled);
+ NewtonBodySetFreezeState(mpNewtonBody, !abEnabled);
}
bool cPhysicsBodyNewton::GetEnabled() const {
return NewtonBodyGetSleepState(mpNewtonBody) == 0 ? false : true;
Commit: 268a9ad3241e149653ba6a10fa670face119e9c8
https://github.com/scummvm/scummvm/commit/268a9ad3241e149653ba6a10fa670face119e9c8
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:39+01:00
Commit Message:
HPL1: cleanup PhysicsJointBallNewton
Changed paths:
engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
diff --git a/engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
index d10daa04080..ccf58724ef6 100644
--- a/engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointBallNewton.cpp
@@ -29,6 +29,8 @@
#include "hpl1/engine/impl/PhysicsBodyNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
+#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/engine/math/Vector3.h"
namespace hpl {
@@ -42,8 +44,8 @@ cPhysicsJointBallNewton::cPhysicsJointBallNewton(const tString &asName,
iPhysicsBody *apParentBody, iPhysicsBody *apChildBody,
iPhysicsWorld *apWorld, const cVector3f &avPivotPoint)
: iPhysicsJointNewton<iPhysicsJointBall>(asName, apParentBody, apChildBody, apWorld, avPivotPoint) {
- const float fPivotPoint[3] = {avPivotPoint.x, avPivotPoint.y, avPivotPoint.z};
- mpNewtonJoint = NewtonConstraintCreateBall(mpNewtonWorld, fPivotPoint,
+ VEC3_CONST_ARRAY(pivotPint, avPivotPoint);
+ mpNewtonJoint = NewtonConstraintCreateBall(mpNewtonWorld, pivotPint,
mpNewtonChildBody, mpNewtonParentBody);
mvPinDir = cVector3f(0, 0, 0);
@@ -68,8 +70,8 @@ cPhysicsJointBallNewton::~cPhysicsJointBallNewton() {
//-----------------------------------------------------------------------
void cPhysicsJointBallNewton::SetConeLimits(const cVector3f &avPin, float afMaxConeAngle, float afMaxTwistAngle) {
- const float vaPin[3] = {avPin.x, avPin.y, avPin.z};
- NewtonBallSetConeLimits(mpNewtonJoint, vaPin, afMaxConeAngle, afMaxTwistAngle);
+ VEC3_CONST_ARRAY(pin, avPin);
+ NewtonBallSetConeLimits(mpNewtonJoint, pin, afMaxConeAngle, afMaxTwistAngle);
mvConePin = avPin;
mvPinDir = mvConePin;
mfMaxConeAngle = afMaxConeAngle;
@@ -77,9 +79,9 @@ void cPhysicsJointBallNewton::SetConeLimits(const cVector3f &avPin, float afMaxC
}
cVector3f cPhysicsJointBallNewton::GetAngles() {
- cVector3f vAngles;
- NewtonBallGetJointAngle(mpNewtonJoint, &vAngles.x);
- return vAngles;
+ float angles[3];
+ NewtonBallGetJointAngle(mpNewtonJoint, angles);
+ return cVector3f::fromArray(angles);
}
//-----------------------------------------------------------------------
@@ -88,14 +90,14 @@ cVector3f cPhysicsJointBallNewton::GetVelocity() {
return cVector3f(0, 0, 0);
}
cVector3f cPhysicsJointBallNewton::GetAngularVelocity() {
- cVector3f vVel;
- NewtonBallGetJointOmega(mpNewtonJoint, &vVel.x);
- return vVel;
+ float vel[3];
+ NewtonBallGetJointOmega(mpNewtonJoint, vel);
+ return cVector3f::fromArray(vel);
}
cVector3f cPhysicsJointBallNewton::GetForce() {
- cVector3f vForce;
- NewtonBallGetJointForce(mpNewtonJoint, &vForce.x);
- return vForce;
+ float force[3];
+ NewtonBallGetJointForce(mpNewtonJoint, force);
+ return cVector3f::fromArray(force);
}
//-----------------------------------------------------------------------
Commit: e2882547473710028a0ced64018d418afa21a2ee
https://github.com/scummvm/scummvm/commit/e2882547473710028a0ced64018d418afa21a2ee
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:39+01:00
Commit Message:
HPL1: add magic numbers to fix physics bug
Changed paths:
engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
diff --git a/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp b/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
index 813eff6392d..9943a7f2fd9 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
@@ -26,6 +26,7 @@
*/
#include "hpl1/penumbra-overture/PlayerState_Interact.h"
+#include <math.h>
#include "hpl1/engine/engine.h"
#include "hpl1/penumbra-overture/GameStickArea.h"
@@ -43,8 +44,11 @@ cPlayerState_Grab::cPlayerState_Grab(cInit *apInit, cPlayer *apPlayer) : iPlayer
mpPushBody = NULL;
// Init controllers
- mGrabPid.SetErrorNum(10);
- mRotatePid.SetErrorNum(10);
+ mGrabPid.SetErrorNum(20);
+ mRotatePid.SetErrorNum(20);
+ mRotatePid.p = 0.8f;
+ mRotatePid.i = 0.0f;
+ mRotatePid.d = 0.0f;
// Get variables
mfMaxPidForce = mpInit->mpGameConfig->GetFloat("Interaction_Grab", "MaxPidForce", 0);
@@ -163,31 +167,26 @@ void cPlayerState_Grab::OnUpdate(float afTimeStep) {
// Set speed to 0
if (std::abs(mfYRotation) < 0.001f || mbRotateWithPlayer == false) {
- mRotatePid.p = 0.8f;
- mRotatePid.i = 0.0f;
- mRotatePid.d = 0.0f;
-
cVector3f vTorque = mRotatePid.Output(cVector3f(0, 0, 0) - vOmega, afTimeStep);
- vTorque = vTorque - vOmega * 0.1f;
+ vTorque = vTorque / 5.0f;
- mpPushBody->AddTorque(vTorque * mpPushBody->GetMass());
+ mpPushBody->AddTorque(vTorque * powf(mpPushBody->GetMass(), 1.8f));
// vTorque = cMath::MatrixMul(mpPushBody->GetInertiaMatrix(),vTorque);
// mpPushBody->AddTorque(vTorque);
} else {
- mRotatePid.p = 0.8f;
- mRotatePid.i = 0.0f;
- mRotatePid.d = 0.0f;
-
float fWantedSpeed = mfYRotation * 6;
cVector3f vTorque = mRotatePid.Output(cVector3f(0, fWantedSpeed, 0) - vOmega, afTimeStep);
+ vTorque = vTorque / 5.0f;
- mpPushBody->AddTorque(vTorque * mpPushBody->GetMass());
+ mpPushBody->AddTorque(vTorque * powf(mpPushBody->GetMass(), 1.8f));
// vTorque = cMath::MatrixMul(mpPushBody->GetInertiaMatrix(),vTorque);
// mpPushBody->AddTorque(vTorque);
mfYRotation -= vOmega.y * afTimeStep;
}
+ // the above magic numbers 1.8f and 5.0f are a result of changes in the physics library.
+ // All credits for discovery and testing go to https://github.com/zenmumbler
}
//-----------------------------------------------------------------------
Commit: b986ef990317dcaef3355ede1025bb096724e436
https://github.com/scummvm/scummvm/commit/b986ef990317dcaef3355ede1025bb096724e436
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:39+01:00
Commit Message:
HPL1: fix player collisions
implements a fix found in the HPL2 sources
Changed paths:
engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
engines/hpl1/engine/impl/PhysicsWorldNewton.h
engines/hpl1/engine/physics/PhysicsWorld.cpp
engines/hpl1/engine/physics/PhysicsWorld.h
diff --git a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
index b00794be338..b36d3c5b5fd 100644
--- a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
@@ -39,7 +39,9 @@
#include "hpl1/engine/impl/PhysicsControllerNewton.h"
+#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/math/Vector3.h"
+#include "hpl1/engine/physics/CollideShape.h"
#include "hpl1/engine/scene/PortalContainer.h"
#include "hpl1/engine/scene/World3D.h"
@@ -445,9 +447,17 @@ void cPhysicsWorldNewton::CastRay(iPhysicsRayCallback *apCallback,
//-----------------------------------------------------------------------
+static void correctNormal(cVector3f& normal, const cVector3f& collidePoint, const cVector3f& shapeCenter) {
+ cVector3f vCenterToCollidePoint = collidePoint - shapeCenter;
+ //A check if the normal points in the wrong direction.
+ if(cMath::Vector3Dot(vCenterToCollidePoint, normal)>0)
+ normal = normal * -1;
+}
+
bool cPhysicsWorldNewton::CheckShapeCollision(iCollideShape *apShapeA, const cMatrixf &a_mtxA,
iCollideShape *apShapeB, const cMatrixf &a_mtxB,
- cCollideData &aCollideData, int alMaxPoints) {
+ cCollideData &aCollideData, int alMaxPoints,
+ bool correctNormalDirection) {
cCollideShapeNewton *pNewtonShapeA = static_cast<cCollideShapeNewton *>(apShapeA);
cCollideShapeNewton *pNewtonShapeB = static_cast<cCollideShapeNewton *>(apShapeB);
@@ -499,6 +509,9 @@ bool cPhysicsWorldNewton::CheckShapeCollision(iCollideShape *apShapeA, const cMa
CollPoint.mvPoint.x = mpTempPoints[lVertex + 0];
CollPoint.mvPoint.y = mpTempPoints[lVertex + 1];
CollPoint.mvPoint.z = mpTempPoints[lVertex + 2];
+
+ if (correctNormalDirection && apShapeA->GetType() != eCollideShapeType_Mesh)
+ correctNormal(CollPoint.mvNormal, CollPoint.mvPoint,a_mtxA.GetTranslation());
}
lCollideDataStart += lNum;
@@ -539,6 +552,9 @@ bool cPhysicsWorldNewton::CheckShapeCollision(iCollideShape *apShapeA, const cMa
CollPoint.mvPoint.x = mpTempPoints[lVertex + 0];
CollPoint.mvPoint.y = mpTempPoints[lVertex + 1];
CollPoint.mvPoint.z = mpTempPoints[lVertex + 2];
+
+ if (correctNormalDirection && apShapeA->GetType() != eCollideShapeType_Mesh)
+ correctNormal(CollPoint.mvNormal, CollPoint.mvPoint,a_mtxA.GetTranslation());
}
aCollideData.mlNumOfPoints = lNum;
diff --git a/engines/hpl1/engine/impl/PhysicsWorldNewton.h b/engines/hpl1/engine/impl/PhysicsWorldNewton.h
index 153473e017a..84e85a593a7 100644
--- a/engines/hpl1/engine/impl/PhysicsWorldNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsWorldNewton.h
@@ -88,7 +88,7 @@ public:
bool CheckShapeCollision(iCollideShape *apShapeA, const cMatrixf &a_mtxA,
iCollideShape *apShapeB, const cMatrixf &a_mtxB,
- cCollideData &aCollideData, int alMaxPoints = 4);
+ cCollideData &aCollideData, int alMaxPoints, bool correctNormalDirection = false);
void RenderDebugGeometry(iLowLevelGraphics *apLowLevel, const cColor &aColor);
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.cpp b/engines/hpl1/engine/physics/PhysicsWorld.cpp
index e5b4fc2ed7e..7b61157d17f 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.cpp
+++ b/engines/hpl1/engine/physics/PhysicsWorld.cpp
@@ -374,7 +374,7 @@ bool iPhysicsWorld::CheckShapeWorldCollision(cVector3f *apNewPos,
collideData.SetMaxSize(32);
bool bRet = CheckShapeCollision(apShape, a_mtxTransform, pBody->GetShape(), pBody->GetLocalMatrix(),
- collideData, 32);
+ collideData, 32, true);
if (bRet) {
// if(abDebug) Log(" Collided with '%s'\n",pBody->GetName().c_str());
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.h b/engines/hpl1/engine/physics/PhysicsWorld.h
index 349cccc36c9..29eb7bfb0b3 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.h
+++ b/engines/hpl1/engine/physics/PhysicsWorld.h
@@ -236,7 +236,8 @@ public:
virtual bool CheckShapeCollision(iCollideShape *apShapeA, const cMatrixf &a_mtxA,
iCollideShape *apShapeB, const cMatrixf &a_mtxB,
- cCollideData &aCollideData, int alMaxPoints = 4) = 0;
+ cCollideData &aCollideData, int alMaxPoints,
+ bool correctNormalDirection = false) = 0;
bool CheckShapeWorldCollision(cVector3f *apNewPos,
iCollideShape *apShape, const cMatrixf &a_mtxTransform,
Commit: a659b5900dff05bcb30bbabe919a98740fe5bad2
https://github.com/scummvm/scummvm/commit/a659b5900dff05bcb30bbabe919a98740fe5bad2
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:39+01:00
Commit Message:
HPL1: fix uninitialized variables
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgSlidingConstraint.cpp
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgSlidingConstraint.cpp b/engines/hpl1/engine/libraries/newton/physics/dgSlidingConstraint.cpp
index fb24b63f3cc..cb597601be3 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgSlidingConstraint.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgSlidingConstraint.cpp
@@ -134,7 +134,7 @@ dgUnsigned32 dgSlidingConstraint::JacobianDerivative(
dgMatrix matrix0;
dgMatrix matrix1;
- // dgVector angle(CalculateGlobalMatrixAndAngle(matrix0, matrix1));
+ CalculateGlobalMatrixAndAngle(matrix0, matrix1);
m_posit = (matrix0.m_posit - matrix1.m_posit) % matrix0.m_front;
matrix1.m_posit += matrix1.m_front.Scale(m_posit);
Commit: 6c6cb16bd1b3489b082d5adbb0cdc7b1ccd846e1
https://github.com/scummvm/scummvm/commit/6c6cb16bd1b3489b082d5adbb0cdc7b1ccd846e1
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:39+01:00
Commit Message:
HPL1: remove unused scripting calling conventions
Changed paths:
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm.cpp
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64.cpp
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64_gcc.S
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64_msvc.asm
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_gcc.S
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_msvc.asm
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_vita.S
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_xcode.S
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_mips.cpp
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_ppc.cpp
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_ppc_64.cpp
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_sh4.cpp
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_gcc.cpp
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_mingw.cpp
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_msvc.cpp
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_msvc_asm.asm
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x86.cpp
R engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_xenon.cpp
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm.cpp
deleted file mode 100644
index 6d820702f24..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm.cpp
+++ /dev/null
@@ -1,665 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2015 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-
-//
-// as_callfunc_arm.cpp
-//
-// These functions handle the actual calling of system functions on the arm platform
-//
-// Written by Fredrik Ehnbom in June 2009, based on as_callfunc_x86.cpp
-//
-// The code was complemented to support Linux with ARM by Carlos Luna in December, 2012.
-//
-// Added support for functor methods by Jordi Oliveras Rovira in April, 2014.
-
-
-// This code has to conform to both AAPCS and the modified ABI for iOS
-//
-// Reference:
-//
-// AAPCS: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf
-// iOS: http://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/iPhoneOSABIReference.pdf
-
-#include "as_config.h"
-
-#ifndef AS_MAX_PORTABILITY
-#ifdef AS_ARM
-
-#include "as_callfunc.h"
-#include "as_scriptengine.h"
-#include "as_texts.h"
-#include "as_tokendef.h"
-#include "as_context.h"
-
-#if defined(AS_SOFTFP)
-
-// This code supports the soft-float ABI, i.e. g++ -mfloat-abi=softfp
-//
-// The code for iOS, Android, Marmalade and Windows Phone goes here
-
-BEGIN_AS_NAMESPACE
-
-extern "C" asQWORD armFunc (const asDWORD *, int, asFUNCTION_t);
-extern "C" asQWORD armFuncR0 (const asDWORD *, int, asFUNCTION_t, asDWORD r0);
-extern "C" asQWORD armFuncR0R1 (const asDWORD *, int, asFUNCTION_t, asDWORD r0, asDWORD r1);
-extern "C" asQWORD armFuncObjLast (const asDWORD *, int, asFUNCTION_t, asDWORD obj);
-extern "C" asQWORD armFuncR0ObjLast (const asDWORD *, int, asFUNCTION_t, asDWORD r0, asDWORD obj);
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/, void *secondObject)
-{
- asCScriptEngine *engine = context->m_engine;
- asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
- int callConv = sysFunc->callConv;
-
- asQWORD retQW = 0;
- asFUNCTION_t func = sysFunc->func;
- int paramSize = sysFunc->paramSize;
- asFUNCTION_t *vftable;
-
- if( sysFunc->hostReturnInMemory )
- {
- // The return is made in memory
- callConv++;
- }
- bool isThisCallMethod = callConv >= ICC_THISCALL_OBJLAST;
-
-
- asDWORD paramBuffer[64+2];
- // Android & Linux needs to align 64bit types on even registers, but this isn't done on iOS or Windows Phone
- // TODO: optimize runtime: There should be a check for this in PrepareSystemFunction() so this
- // doesn't have to be done for functions that don't have any 64bit types
-#if !defined(AS_ANDROID) && !defined(AS_LINUX)
- // In cases of thiscall methods, the callstack is configured as a standard thiscall
- // adding the secondObject as first or last element in callstack
- if( sysFunc->takesObjByVal || isThisCallMethod )
-#endif
- {
-#if defined(AS_ANDROID) || defined(AS_LINUX)
- // mask is used as a toggler to skip uneven registers.
- int mask = 1;
-
- if( isThisCallMethod )
- {
- mask = 0;
- }
- else
- {
- // Check for object pointer as first argument
- switch( callConv )
- {
- case ICC_THISCALL:
- case ICC_CDECL_OBJFIRST:
- case ICC_VIRTUAL_THISCALL:
- case ICC_THISCALL_RETURNINMEM:
- case ICC_CDECL_OBJFIRST_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_RETURNINMEM:
- mask = 0;
- break;
- default:
- break;
- }
- }
-
- // Check for hidden address in case of return by value
- if( sysFunc->hostReturnInMemory )
- mask = !mask;
-#endif
- paramSize = 0;
- int spos = 0;
- int dpos = 2;
-
- if( isThisCallMethod && (callConv >= ICC_THISCALL_OBJFIRST &&
- callConv <= ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM) )
- {
- // Add the object pointer as the first parameter
- paramBuffer[dpos++] = (asDWORD)secondObject;
- paramSize++;
- }
-
- for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
- {
- // TODO: runtime optimize: Declare a reference to descr->parameterTypes[n] so the array doesn't have to be access all the time
- if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
- {
-#ifdef COMPLEX_OBJS_PASSED_BY_REF
- if( descr->parameterTypes[n].GetTypeInfo()->flags & COMPLEX_MASK )
- {
- paramBuffer[dpos++] = args[spos++];
- paramSize++;
- }
- else
-#endif
- {
-#if defined(AS_ANDROID) || defined(AS_LINUX)
- if( (descr->parameterTypes[n].GetTypeInfo()->flags & asOBJ_APP_CLASS_ALIGN8) &&
- ((dpos & 1) == mask) )
- {
- // 64 bit value align
- dpos++;
- paramSize++;
- }
-#endif
- // Copy the object's memory to the buffer
- memcpy(¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
-
- // Delete the original memory
- engine->CallFree(*(char**)(args+spos));
- spos++;
- dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
- paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
- }
- }
- else
- {
-#if defined(AS_ANDROID) || defined(AS_LINUX)
- // Should an alignment be performed?
- if( !descr->parameterTypes[n].IsObjectHandle() &&
- !descr->parameterTypes[n].IsReference() &&
- descr->parameterTypes[n].GetSizeOnStackDWords() == 2 &&
- ((dpos & 1) == mask) )
- {
- // 64 bit value align
- dpos++;
- paramSize++;
- }
-#endif
-
- // Copy the value directly
- paramBuffer[dpos++] = args[spos++];
- if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
- paramBuffer[dpos++] = args[spos++];
- paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
- }
- }
-
- if( isThisCallMethod && (callConv >= ICC_THISCALL_OBJLAST &&
- callConv <= ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM) )
- {
- // Add the object pointer as the last parameter
- paramBuffer[dpos++] = (asDWORD)secondObject;
- paramSize++;
- }
-
- // Keep a free location at the beginning
- args = ¶mBuffer[2];
- }
-
- switch( callConv )
- {
- case ICC_CDECL_RETURNINMEM: // fall through
- case ICC_STDCALL_RETURNINMEM:
- retQW = armFuncR0(args, paramSize<<2, func, (asDWORD)retPointer);
- break;
- case ICC_CDECL: // fall through
- case ICC_STDCALL:
- retQW = armFunc(args, paramSize<<2, func);
- break;
- case ICC_THISCALL: // fall through
- case ICC_CDECL_OBJFIRST:
- case ICC_THISCALL_OBJFIRST:
- case ICC_THISCALL_OBJLAST:
- retQW = armFuncR0(args, paramSize<<2, func, (asDWORD)obj);
- break;
- case ICC_THISCALL_RETURNINMEM:
- case ICC_THISCALL_OBJFIRST_RETURNINMEM:
- case ICC_THISCALL_OBJLAST_RETURNINMEM:
-#ifdef __GNUC__
- // On GNUC the address where the return value will be placed should be put in R0
- retQW = armFuncR0R1(args, paramSize<<2, func, (asDWORD)retPointer, (asDWORD)obj);
-#else
- // On Windows the R0 should always hold the object pointer, and the address for the return value comes after
- retQW = armFuncR0R1(args, paramSize<<2, func, (asDWORD)obj, (asDWORD)retPointer);
-#endif
- break;
- case ICC_CDECL_OBJFIRST_RETURNINMEM:
- retQW = armFuncR0R1(args, paramSize<<2, func, (asDWORD)retPointer, (asDWORD)obj);
- break;
- case ICC_VIRTUAL_THISCALL:
- case ICC_VIRTUAL_THISCALL_OBJFIRST:
- case ICC_VIRTUAL_THISCALL_OBJLAST:
- // Get virtual function table from the object pointer
- vftable = *(asFUNCTION_t**)obj;
- retQW = armFuncR0(args, paramSize<<2, vftable[FuncPtrToUInt(func)>>2], (asDWORD)obj);
- break;
- case ICC_VIRTUAL_THISCALL_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM:
- // Get virtual function table from the object pointer
- vftable = *(asFUNCTION_t**)obj;
-#ifdef __GNUC__
- // On GNUC the address where the return value will be placed should be put in R0
- retQW = armFuncR0R1(args, (paramSize+1)<<2, vftable[FuncPtrToUInt(func)>>2], (asDWORD)retPointer, (asDWORD)obj);
-#else
- // On Windows the R0 should always hold the object pointer, and the address for the return value comes after
- retQW = armFuncR0R1(args, (paramSize+1)<<2, vftable[FuncPtrToUInt(func)>>2], (asDWORD)obj, (asDWORD)retPointer);
-#endif
- break;
- case ICC_CDECL_OBJLAST:
- retQW = armFuncObjLast(args, paramSize<<2, func, (asDWORD)obj);
- break;
- case ICC_CDECL_OBJLAST_RETURNINMEM:
- retQW = armFuncR0ObjLast(args, paramSize<<2, func, (asDWORD)retPointer, (asDWORD)obj);
- break;
- default:
- context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
- }
-
- return retQW;
-}
-
-END_AS_NAMESPACE
-
-#elif !defined(AS_SOFTFP)
-
-// This code supports the hard-float ABI, i.e. g++ -mfloat-abi=hard
-// The main difference is that the floating point values are passed in the fpu registers
-
-#define VFP_OFFSET 70
-#define STACK_OFFSET 6
-#define PARAM_BUFFER_SIZE 104
-
-BEGIN_AS_NAMESPACE
-
-extern "C" asQWORD armFunc (const asDWORD *, int, asFUNCTION_t);
-extern "C" asQWORD armFuncR0 (const asDWORD *, int, asFUNCTION_t, asDWORD r0);
-extern "C" asQWORD armFuncR0R1 (const asDWORD *, int, asFUNCTION_t, asDWORD r0, asDWORD r1);
-extern "C" asQWORD armFuncObjLast (const asDWORD *, int, asFUNCTION_t, asDWORD obj);
-extern "C" asQWORD armFuncR0ObjLast (const asDWORD *, int, asFUNCTION_t, asDWORD r0, asDWORD obj);
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/, void *secondObject)
-{
- asCScriptEngine *engine = context->m_engine;
- asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
- int callConv = sysFunc->callConv;
-
- asQWORD retQW = 0;
- asFUNCTION_t func = sysFunc->func;
- int paramSize = sysFunc->paramSize;
- asFUNCTION_t *vftable;
-
- //---------------------------------------------------------------------------- RPi
- int freeFloatSlot = VFP_OFFSET;
- int freeDoubleSlot = VFP_OFFSET;
- int stackPos = STACK_OFFSET;
- int stackSize = 0;
- //----------------------------------------------------------------------------
-
- //---------------------------------------------------------------------------- RPi
- // We´ll divide paramBuffer into several segments:
- //
- // 0-1 Unused
- // 2-5 (+8 / +0 asm) values that should be placed in R0 - R3
- // 6-67 (+24 / +16 asm) values that should be placed on the stack
- // 68 (+272 / +264 asm) number of values stored in r registers (R0 - R3)
- // 69 (+276 / +268 asm) number of args stored on the stack
- // 70-85 (+280 / +272 asm) values that should be placed in VFP registers (16)
- // 86-87 (+344 / +336 asm) sp original value - sp final value - for debugging
- // 88-103 (+352 / +344 asm) Check area for free-used VFP registers
- //
- // Total number of elements: 104
- //
- // When passing the paramBuffer to the asm routines via the args pointer we are
- // offsetting the start of the array to being at element # 2. That´s why in asm
- // all addresses must have an offset of -2 words (-8 bytes).
- //---------------------------------------------------------------------------- RPi
-
- asDWORD paramBuffer[PARAM_BUFFER_SIZE];
- memset(paramBuffer, 0, sizeof(asDWORD) * PARAM_BUFFER_SIZE);
-
- if( sysFunc->hostReturnInMemory )
- {
- // TODO: runtime optimize: This check should be done in PrepareSystemFunction
- if ( !( descr->returnType.GetTypeInfo()->flags & COMPLEX_RETURN_MASK ) &&
- ( descr->returnType.GetTypeInfo()->flags & asOBJ_APP_CLASS_ALLFLOATS ) &&
- descr->returnType.GetSizeInMemoryBytes() <= 8 )
- callConv--;
-
- // The return is made in memory
- callConv++;
- }
-
- bool isThisCallMethod = callConv >= ICC_THISCALL_OBJLAST;
-
- // Linux needs to align 64bit types on even registers, but this isn't done on iOS or Windows Phone
- // TODO: optimize runtime: There should be a check for this in PrepareSystemFunction() so this
- // doesn't have to be done for functions that don't have any 64bit types
- {
- // mask is used as a toggler to skip uneven registers.
- int mask = 1;
-
- if( isThisCallMethod )
- {
- mask = 0;
- }
- else
- {
- // Check for object pointer as first argument
- switch( callConv )
- {
- case ICC_THISCALL:
- case ICC_CDECL_OBJFIRST:
- case ICC_VIRTUAL_THISCALL:
- case ICC_THISCALL_RETURNINMEM:
- case ICC_CDECL_OBJFIRST_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_RETURNINMEM:
- mask = 0;
- break;
- default:
- break;
- }
- }
- // Check for hidden address in case of return by value
- if( sysFunc->hostReturnInMemory )
- mask = !mask;
-
- paramSize = 0;
- int spos = 0;
- int dpos = 2;
-
- if( isThisCallMethod && (callConv >= ICC_THISCALL_OBJFIRST &&
- callConv <= ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM) )
- {
- // Add the object pointer as the first parameter
- paramBuffer[dpos++] = (asDWORD)secondObject;
- paramSize++;
- }
-
- for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
- {
- // TODO: runtime optimize: Declare a reference to descr->parameterTypes[n] so the array doesn't have to be access all the time
- if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() &&
- !(descr->parameterTypes[n].GetTypeInfo()->flags & asOBJ_APP_ARRAY) )
- {
-#ifdef COMPLEX_OBJS_PASSED_BY_REF
- if( descr->parameterTypes[n].GetTypeInfo()->flags & COMPLEX_MASK )
- {
- paramBuffer[dpos++] = args[spos++];
- paramSize++;
- }
- else
-#endif
- {
- if( (descr->parameterTypes[n].GetTypeInfo()->flags & asOBJ_APP_CLASS_ALIGN8) )
- {
- if ( (dpos & 1) == mask )
- {
- // 64 bit value align
- dpos++;
- paramSize++;
- }
-
- if ( (stackPos & 1) == mask )
- {
- // 64 bit value align
- stackPos++;
- stackSize++;
- }
- }
-
- // Copy the object's memory to the buffer
- if (descr->parameterTypes[n].GetTypeInfo()->flags & asOBJ_APP_CLASS_ALLFLOATS)
- {
- int target = (freeFloatSlot > freeDoubleSlot) ? freeFloatSlot : freeDoubleSlot;
-
- if ( descr->parameterTypes[n].GetSizeInMemoryDWords() <= ( (VFP_OFFSET + 16) - target) )
- {
- memcpy(¶mBuffer[target], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
- memset(¶mBuffer[target + 18], (asDWORD)1, descr->parameterTypes[n].GetSizeInMemoryDWords());
- target += descr->parameterTypes[n].GetSizeInMemoryDWords();
- freeFloatSlot = freeDoubleSlot = target;
- }
- else
- {
- memcpy(¶mBuffer[stackPos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
- stackPos += descr->parameterTypes[n].GetSizeInMemoryDWords();
- stackSize += descr->parameterTypes[n].GetSizeOnStackDWords();
- }
- }
- else
- {
- memcpy(¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
- dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
- paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
- }
-
- // Delete the original memory
- engine->CallFree(*(char**)(args+spos));
- spos++;
- }
-
- continue;
- }
- else if( descr->parameterTypes[n].IsFloatType() && !descr->parameterTypes[n].IsReference() )
- {
- // Are there any "s" registers available?
- if ( freeFloatSlot < (VFP_OFFSET + 16) )
- {
- if (freeFloatSlot == freeDoubleSlot)
- freeDoubleSlot += 2;
-
- paramBuffer[freeFloatSlot + 18] = (asDWORD)1;
- paramBuffer[freeFloatSlot++] = args[spos++];
-
- while(freeFloatSlot < (VFP_OFFSET + 16) && paramBuffer[freeFloatSlot + 18] != 0)
- freeFloatSlot++;
- }
- // If not, then store the float arg in the stack area
- else
- {
- paramBuffer[stackPos++] = args[spos++];
- stackSize++;
- }
-
- continue;
- }
- else if( descr->parameterTypes[n].IsDoubleType() && !descr->parameterTypes[n].IsReference() )
- {
- // Are there any "d" registers available?
- if ( freeDoubleSlot < (VFP_OFFSET + 15) )
- {
- if (freeFloatSlot == freeDoubleSlot)
- freeFloatSlot += 2;
-
- // Copy two dwords for the double
- paramBuffer[freeDoubleSlot + 18] = (asDWORD)1;
- paramBuffer[freeDoubleSlot + 19] = (asDWORD)1;
- paramBuffer[freeDoubleSlot++] = args[spos++];
- paramBuffer[freeDoubleSlot++] = args[spos++];
-
- while(freeDoubleSlot < (VFP_OFFSET + 15) && paramBuffer[freeDoubleSlot + 18] != 0)
- freeDoubleSlot += 2;
- }
- // If not, then store the double arg in the stack area
- else
- {
- if ( (stackPos & 1) == mask )
- {
- // 64 bit value align
- stackPos++;
- stackSize++;
- }
-
- paramBuffer[stackPos++] = args[spos++];
- paramBuffer[stackPos++] = args[spos++];
- stackSize += 2;
- }
-
- continue;
- }
- else
- {
- // Copy the value directly to "r" registers or the stack, checking for alignment
- if (paramSize < 4)
- {
- // Should an alignment be performed?
- if( (dpos & 1) == mask && descr->parameterTypes[n].GetSizeOnStackDWords() == 2 &&
- !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() &&
- !descr->parameterTypes[n].IsAnyType() )
- {
- // 64 bit value align
- dpos++;
- paramSize++;
- }
-
- paramBuffer[dpos++] = args[spos++];
- paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
- }
- else
- {
- // Should an alignment be performed?
- if( (stackPos & 1) == mask && descr->parameterTypes[n].GetSizeOnStackDWords() == 2 &&
- !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() &&
- !descr->parameterTypes[n].IsAnyType() )
- {
- // 64 bit value align
- stackPos++;
- stackSize++;
- }
-
- paramBuffer[stackPos++] = args[spos++];
- stackSize += descr->parameterTypes[n].GetSizeOnStackDWords();
- }
-
- if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
- {
- if (paramSize < 5)
- paramBuffer[dpos++] = args[spos++];
- else
- paramBuffer[stackPos++] = args[spos++];
- }
- }// else...
- }// Loop
-
- if( isThisCallMethod && (callConv >= ICC_THISCALL_OBJLAST &&
- callConv <= ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM) )
- {
- if (paramSize < 4)
- {
- paramBuffer[dpos++] = (asDWORD)secondObject;
- paramSize++;
- }
- else
- {
- paramBuffer[stackPos++] = (asDWORD)secondObject;
- stackSize++;
- }
- }
-
- // Keep a free location at the beginning
- args = ¶mBuffer[2];
- }
-
- paramBuffer[69] = static_cast<asDWORD>(stackSize<<2);
-
- switch( callConv )
- {
- case ICC_CDECL_RETURNINMEM: // fall through
- case ICC_STDCALL_RETURNINMEM:
- retQW = armFuncR0(args, paramSize<<2, func, (asDWORD)retPointer);
- break;
- case ICC_CDECL: // fall through
- case ICC_STDCALL:
- retQW = armFunc(args, paramSize<<2, func);
- break;
- case ICC_THISCALL: // fall through
- case ICC_CDECL_OBJFIRST:
- case ICC_THISCALL_OBJFIRST:
- case ICC_THISCALL_OBJLAST:
- retQW = armFuncR0(args, paramSize<<2, func, (asDWORD)obj);
- break;
- case ICC_THISCALL_RETURNINMEM:
- case ICC_THISCALL_OBJFIRST_RETURNINMEM:
- case ICC_THISCALL_OBJLAST_RETURNINMEM:
- // On GNUC the address where the return value will be placed should be put in R0
- retQW = armFuncR0R1(args, paramSize<<2, func, (asDWORD)retPointer, (asDWORD)obj);
- break;
- case ICC_CDECL_OBJFIRST_RETURNINMEM:
- retQW = armFuncR0R1(args, paramSize<<2, func, (asDWORD)retPointer, (asDWORD)obj);
- break;
- case ICC_VIRTUAL_THISCALL:
- case ICC_VIRTUAL_THISCALL_OBJFIRST:
- case ICC_VIRTUAL_THISCALL_OBJLAST:
- // Get virtual function table from the object pointer
- vftable = *(asFUNCTION_t**)obj;
- retQW = armFuncR0(args, paramSize<<2, vftable[FuncPtrToUInt(func)>>2], (asDWORD)obj);
- break;
- case ICC_VIRTUAL_THISCALL_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM:
- // Get virtual function table from the object pointer
- vftable = *(asFUNCTION_t**)obj;
- // On GNUC the address where the return value will be placed should be put in R0
- retQW = armFuncR0R1(args, (paramSize+1)<<2, vftable[FuncPtrToUInt(func)>>2], (asDWORD)retPointer, (asDWORD)obj);
- break;
- case ICC_CDECL_OBJLAST:
- retQW = armFuncObjLast(args, paramSize<<2, func, (asDWORD)obj);
- break;
- case ICC_CDECL_OBJLAST_RETURNINMEM:
- retQW = armFuncR0ObjLast(args, paramSize<<2, func, (asDWORD)retPointer, (asDWORD)obj);
- break;
- default:
- context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
- }
-
- // On Linux with arm the float and double values are returns in the
- // floating point registers, s0 and s1. Objects that contain only
- // float types and are not considered complex are also returned in the
- // floating point registers.
- if( sysFunc->hostReturnFloat )
- {
- retQW = paramBuffer[VFP_OFFSET];
-
- if ( sysFunc->hostReturnSize > 1 )
- retQW = *( (asQWORD*)¶mBuffer[VFP_OFFSET] );
- }
- else if ( descr->returnType.IsObject() )
- {
- // TODO: runtime optimize: This should be identified with a flag determined in PrepareSystemFunction
- if ( !descr->returnType.IsObjectHandle() &&
- !descr->returnType.IsReference() &&
- !(descr->returnType.GetTypeInfo()->flags & COMPLEX_RETURN_MASK) &&
- (descr->returnType.GetTypeInfo()->flags & asOBJ_APP_CLASS_ALLFLOATS) )
- memcpy( retPointer, ¶mBuffer[VFP_OFFSET], descr->returnType.GetSizeInMemoryBytes() );
- }
-
- return retQW;
-}
-
-END_AS_NAMESPACE
-
-#endif // AS_LINUX
-
-#endif // AS_ARM
-#endif // AS_MAX_PORTABILITY
-
-
-
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64.cpp
deleted file mode 100644
index 280b3ed179f..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64.cpp
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2020-2021 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-
-//
-// as_callfunc_arm64.cpp
-//
-// These functions handle the actual calling of system functions on the arm64 platform
-//
-// Written by Max Waine in July 2020, based on as_callfunc_arm.cpp
-//
-
-
-#include "as_config.h"
-
-#ifndef AS_MAX_PORTABILITY
-#ifdef AS_ARM64
-
-#include "as_callfunc.h"
-#include "as_scriptengine.h"
-#include "as_texts.h"
-#include "as_tokendef.h"
-#include "as_context.h"
-
-// ARM64 targets use has no software floating-point ABI, it's all hardware (or totally disabled)
-
-#define HFA_RET_REGISTERS 4 // s0-s3/d0-d3
-#define GP_ARG_REGISTERS 8 // x0-x7
-#define FLOAT_ARG_REGISTERS 8 // v0-v7
-
-BEGIN_AS_NAMESPACE
-
-// x0-7: Argument registers (pass params or return results. OK as volatile local variables)
-// x8: Indirect result register (e.g. address of large returned struct)
-// x9-15: Volatile local variable registers
-// x16-17: Intra-procedure-call temporary registers
-// x18: Platform register (reserved for use of platform ABIs)
-// x19-29: Non-volatile variable registers (must be saved and restored if modified)
-// x29: Frame pointer register
-// x30: Link register (where to return to)
-
-extern "C" void GetHFAReturnDouble(asQWORD *out1, asQWORD *out2, asQWORD returnSize);
-extern "C" void GetHFAReturnFloat(asQWORD *out1, asQWORD *out2, asQWORD returnSize);
-
-extern "C" asQWORD CallARM64RetInMemory(
- const asQWORD *gpRegArgs, asQWORD numGPRegArgs,
- const asQWORD *floatRegArgs, asQWORD numFloatRegArgs,
- const asQWORD *stackArgs, asQWORD numStackArgs,
- void *retPointer, asFUNCTION_t func
-);
-extern "C" double CallARM64Double(
- const asQWORD *gpRegArgs, asQWORD numGPRegArgs,
- const asQWORD *floatRegArgs, asQWORD numFloatRegArgs,
- const asQWORD *stackArgs, asQWORD numStackArgs,
- asFUNCTION_t func
-);
-extern "C" float CallARM64Float(
- const asQWORD *gpRegArgs, asQWORD numGPRegArgs,
- const asQWORD *floatRegArgs, asQWORD numFloatRegArgs,
- const asQWORD *stackArgs, asQWORD numStackArgs,
- asFUNCTION_t func
-);
-extern "C" asQWORD CallARM64(
- const asQWORD *gpRegArgs, asQWORD numGPRegArgs,
- const asQWORD *floatRegArgs, asQWORD numFloatRegArgs,
- const asQWORD *stackArgs, asQWORD numStackArgs,
- asFUNCTION_t func
-);
-extern "C" asQWORD CallARM64Ret128(
- const asQWORD *gpRegArgs, asQWORD numGPRegArgs,
- const asQWORD *floatRegArgs, asQWORD numFloatRegArgs,
- const asQWORD *stackArgs, asQWORD numStackArgs,
- asQWORD *higherQWORD, asFUNCTION_t func
-);
-
-//
-// If it's possible to fit in registers,
-// there may not be enough float register space even if true is returned
-//
-static inline bool IsRegisterHFA(const asCDataType &type)
-{
- const asCTypeInfo *const typeInfo = type.GetTypeInfo();
-
- if( typeInfo == nullptr ||
- (typeInfo->flags & asOBJ_APP_CLASS_ALLFLOATS) == 0 ||
- type.IsObjectHandle() || type.IsReference() )
- return false;
-
- const bool doubles = (typeInfo->flags & asOBJ_APP_CLASS_ALIGN8) != 0;
- const int maxAllowedSize = doubles ? sizeof(double) * HFA_RET_REGISTERS : sizeof(float) * HFA_RET_REGISTERS;
-
- return type.GetSizeInMemoryBytes() <= maxAllowedSize;
-}
-
-//
-// If it's possible to fit it in registers,
-// if true is returned there is enough space to fit
-//
-static inline bool IsRegisterHFAParameter(const asCDataType &type, const asQWORD numFloatRegArgs)
-{
- if( !IsRegisterHFA(type) )
- return false;
-
- const bool doubles = (type.GetTypeInfo()->flags & asOBJ_APP_CLASS_ALIGN8) != 0;
- const int registersUsed = type.GetSizeInMemoryDWords() / (doubles ? sizeof(double) : sizeof(float));
-
- return numFloatRegArgs + registersUsed <= FLOAT_ARG_REGISTERS;
-}
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &retQW2, void *secondObject)
-{
- asCScriptEngine *engine = context->m_engine;
- const asSSystemFunctionInterface *const sysFunc = descr->sysFuncIntf;
- const asCDataType &retType = descr->returnType;
- const asCTypeInfo *const retTypeInfo = retType.GetTypeInfo();
- asFUNCTION_t func = sysFunc->func;
- int callConv = sysFunc->callConv;
- asQWORD retQW = 0;
-
- asQWORD gpRegArgs[GP_ARG_REGISTERS];
- asQWORD floatRegArgs[FLOAT_ARG_REGISTERS];
- asQWORD stackArgs[64]; // It's how many x64 users can have
- asQWORD numGPRegArgs = 0;
- asQWORD numFloatRegArgs = 0;
- asQWORD numStackArgs = 0;
-
- asFUNCTION_t *vftable;
-
- // Optimization to avoid check 12 values (all ICC_ that contains THISCALL)
- if( (callConv >= ICC_THISCALL && callConv <= ICC_VIRTUAL_THISCALL_RETURNINMEM) ||
- (callConv >= ICC_THISCALL_OBJLAST && callConv <= ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM) )
- {
- // Add the object pointer as the first parameter
- gpRegArgs[numGPRegArgs++] = (asQWORD)obj;
- }
-
- if( callConv == ICC_CDECL_OBJFIRST || callConv == ICC_CDECL_OBJFIRST_RETURNINMEM )
- {
- // Add the object pointer as the first parameter
- gpRegArgs[numGPRegArgs++] = (asQWORD)obj;
- }
- else if( callConv == ICC_THISCALL_OBJFIRST || callConv == ICC_THISCALL_OBJFIRST_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL_OBJFIRST || callConv == ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM )
- {
- // Add the object pointer as the first parameter
- gpRegArgs[numGPRegArgs++] = (asQWORD)secondObject;
- }
-
- if( callConv == ICC_VIRTUAL_THISCALL || callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM || callConv == ICC_VIRTUAL_THISCALL_OBJFIRST ||
- callConv == ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM || callConv == ICC_VIRTUAL_THISCALL_OBJLAST || callConv == ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM )
- {
- // Get virtual function table from the object pointer
- vftable = *(asFUNCTION_t**)obj;
- func = vftable[FuncPtrToUInt(func)/sizeof(void*)];
- }
-
- asUINT argsPos = 0;
- for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
- {
- const asCDataType &parmType = descr->parameterTypes[n];
- const asCTypeInfo *const parmTypeInfo = parmType.GetTypeInfo();
-
- if( parmType.IsObject() && !parmType.IsObjectHandle() && !parmType.IsReference() )
- {
- const asUINT parmDWords = parmType.GetSizeInMemoryDWords();
- const asUINT parmQWords = (parmDWords >> 1) + (parmDWords & 1);
-
- const bool passedAsPointer = parmQWords <= 2;
- const bool fitsInRegisters = passedAsPointer ? (numGPRegArgs < GP_ARG_REGISTERS) : (numGPRegArgs + parmQWords <= GP_ARG_REGISTERS);
- asQWORD *const argsArray = fitsInRegisters ? gpRegArgs : stackArgs;
- asQWORD &numArgs = fitsInRegisters ? numGPRegArgs : numStackArgs;
-
- if( (parmTypeInfo->flags & COMPLEX_MASK) )
- {
- argsArray[numArgs++] = *(asQWORD*)&args[argsPos];
- argsPos += AS_PTR_SIZE;
- }
- else if( IsRegisterHFAParameter(parmType, numFloatRegArgs) )
- {
- if( (parmTypeInfo->flags & asOBJ_APP_CLASS_ALIGN8) != 0 )
- {
- const asQWORD *const contents = *(asQWORD**)&args[argsPos];
- for( asUINT i = 0; i < parmQWords; i++ )
- floatRegArgs[numFloatRegArgs++] = *(asQWORD*)&contents[i];
- }
- else
- {
- const asDWORD *const contents = *(asDWORD**)&args[argsPos];
- for( asUINT i = 0; i < parmDWords; i++ )
- floatRegArgs[numFloatRegArgs++] = *(asQWORD*)&contents[i];
- }
- engine->CallFree(*(char**)(args+argsPos));
- argsPos += AS_PTR_SIZE;
- }
- else
- {
- // Copy the object's memory to the buffer
- memcpy(&argsArray[numArgs], *(void**)(args+argsPos), parmType.GetSizeInMemoryBytes());
-
- // Delete the original memory
- engine->CallFree(*(char**)(args+argsPos));
- argsPos += AS_PTR_SIZE;
- numArgs += parmQWords;
- }
- }
- else if( parmType.IsFloatType() && !parmType.IsReference() )
- {
- if( numFloatRegArgs >= FLOAT_ARG_REGISTERS )
- stackArgs[numStackArgs++] = args[argsPos];
- else
- floatRegArgs[numFloatRegArgs++] = args[argsPos];
- argsPos++;
- }
- else if( parmType.IsDoubleType() && !parmType.IsReference() )
- {
- if( numFloatRegArgs >= FLOAT_ARG_REGISTERS )
- stackArgs[numStackArgs++] = *(asQWORD*)&args[argsPos];
- else
- floatRegArgs[numFloatRegArgs++] = *(asQWORD*)&args[argsPos];
- argsPos += 2;
- }
- else
- {
- // Copy the value directly
- const asUINT parmDWords = parmType.GetSizeOnStackDWords();
- const asUINT parmQWords = (parmDWords >> 1) + (parmDWords & 1);
-
- const bool fitsInRegisters = numGPRegArgs + parmQWords <= GP_ARG_REGISTERS;
- asQWORD *const argsArray = fitsInRegisters ? gpRegArgs : stackArgs;
- asQWORD &numArgs = fitsInRegisters ? numGPRegArgs : numStackArgs;
-
- memcpy(&argsArray[numArgs], (void*)(args+argsPos), parmDWords * 4);
- argsPos += parmDWords;
- numArgs += parmQWords;
- }
- }
-
- if( callConv == ICC_CDECL_OBJLAST || callConv == ICC_CDECL_OBJLAST_RETURNINMEM )
- {
- // Add the object pointer as the last parameter
- if( numGPRegArgs < GP_ARG_REGISTERS )
- gpRegArgs[numGPRegArgs++] = (asQWORD)obj;
- else
- stackArgs[numStackArgs++] = (asQWORD)obj;
- }
- else if( callConv == ICC_THISCALL_OBJLAST || callConv == ICC_THISCALL_OBJLAST_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL_OBJLAST || callConv == ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM )
- {
- // Add the object pointer as the last parameter
- if( numGPRegArgs < GP_ARG_REGISTERS )
- gpRegArgs[numGPRegArgs++] = (asQWORD)secondObject;
- else
- stackArgs[numStackArgs++] = (asQWORD)secondObject;
- }
-
- if( IsRegisterHFA(retType) && !(retTypeInfo->flags & COMPLEX_MASK) )
- {
- // This is to deal with HFAs (Homogeneous Floating-point Aggregates):
- // ARM64 will place all-float composite types (of equal precision)
- // with <= 4 members in the float return registers
-
- const int structSize = retType.GetSizeInMemoryBytes();
-
- CallARM64(gpRegArgs, numGPRegArgs, floatRegArgs, numFloatRegArgs, stackArgs, numStackArgs, func);
- if( (retTypeInfo->flags & asOBJ_APP_CLASS_ALIGN8) != 0 )
- {
- if( structSize <= sizeof(double) * 2 )
- GetHFAReturnDouble(&retQW, &retQW2, structSize);
- else
- GetHFAReturnDouble((asQWORD*)retPointer, ((asQWORD*)retPointer) + 1, structSize);
- }
- else
- GetHFAReturnFloat(&retQW, &retQW2, structSize);
- }
- else if( sysFunc->hostReturnFloat )
- {
- if( sysFunc->hostReturnSize == 1 )
- *(float*)&retQW = CallARM64Float(gpRegArgs, numGPRegArgs, floatRegArgs, numFloatRegArgs, stackArgs, numStackArgs, func);
- else
- *(double*)&retQW = CallARM64Double(gpRegArgs, numGPRegArgs, floatRegArgs, numFloatRegArgs, stackArgs, numStackArgs, func);
- }
- else if( sysFunc->hostReturnInMemory )
- retQW = CallARM64RetInMemory(gpRegArgs, numGPRegArgs, floatRegArgs, numFloatRegArgs, stackArgs, numStackArgs, retPointer, func);
- else
- {
- if( retType.GetSizeInMemoryBytes() > sizeof(asQWORD) )
- retQW = CallARM64Ret128(gpRegArgs, numGPRegArgs, floatRegArgs, numFloatRegArgs, stackArgs, numStackArgs, &retQW2, func);
- else
- retQW = CallARM64(gpRegArgs, numGPRegArgs, floatRegArgs, numFloatRegArgs, stackArgs, numStackArgs, func);
- }
-
- return retQW;
-}
-
-END_AS_NAMESPACE
-
-#endif // AS_ARM64
-#endif // AS_MAX_PORTABILITY
-
-
-
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64_gcc.S b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64_gcc.S
deleted file mode 100644
index 27c8c1678cc..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64_gcc.S
+++ /dev/null
@@ -1,227 +0,0 @@
-//
-// AngelCode Scripting Library
-// Copyright (c) 2020-2021 Andreas Jonsson
-//
-// This software is provided 'as-is', without any express or implied
-// warranty. In no event will the authors be held liable for any
-// damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any
-// purpose, including commercial applications, and to alter it and
-// redistribute it freely, subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented// you
-// must not claim that you wrote the original software. If you use
-// this software in a product, an acknowledgment in the product
-// documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such, and
-// must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source
-// distribution.
-//
-// The original version of this library can be located at:
-// http://www.angelcode.com/angelscript/
-//
-// Andreas Jonsson
-// andreas at angelcode.com
-//
-
-
-// Assembly routines for the ARM64/AArch64 call convention used for Linux
-// Written by Max Waine in July 2020, based on as_callfunc_arm_msvc.asm,
-// with assistance & guidance provided by Sir Kane
-
-// Compile with GCC/GAS
-
-#if !defined(AS_MAX_PORTABILITY)
-
-#if defined(__aarch64__)
-
-.arch armv8-a
-.text
-
-.global GetHFAReturnDouble
-.global GetHFAReturnFloat
-.global CallARM64Ret128
-.global CallARM64RetInMemory
-.global CallARM64Double
-.global CallARM64Float
-.global CallARM64
-
-.type GetHFAReturnDouble, %function
-.type GetHFAReturnFloat, %function
-.type CallARM64Ret128, %function
-.type CallARM64RetInMemory, %function
-.type CallARM64Double, %function
-.type CallARM64Float, %function
-.type CallARM64, %function
-
-.align 2
-GetHFAReturnDouble:
- adr x9, populateDoubles
- sub x9, x9, x1, lsr 1 // x9 -= returnSize >> 1; (/2 because double is 2x instruction size)
- br x9
-
- str d3, [x0, #0x18]
- str d2, [x0, #0x10]
- str d1, [x1]
- str d0, [x0]
-populateDoubles:
-
- ret
-
-.align 2
-GetHFAReturnFloat:
- adr x9, populateFloats
- sub x9, x9, x2 // x9 -= returnSize; (already 4 bytes per return)
- br x9
-
- str s3, [x1, #0x4]
- str s2, [x1]
- str s1, [x0, #0x4]
- str s0, [x0]
-populateFloats:
-
- ret
-
-
-//[returnType] CallARM64[type](
-// const asQWORD *gpRegArgs, asQWORD numGPRegArgs,
-// const asQWORD *floatRegArgs, asQWORD numFloatRegArgs,
-// const asQWORD *stackArgs, asQWORD numStackArgs,
-// asFUNCTION_t func
-//)
-.align 2
-CallARM64Double:
-CallARM64Float:
-CallARM64:
- .cfi_startproc
- stp fp, lr, [sp,#-0x20]!
- str x20, [sp,#0x10]
- .cfi_def_cfa_offset 0x20
- .cfi_offset 20, 0x10
- .cfi_offset fp, -0x20
- .cfi_offset lr, -0x18
- mov fp, sp
-
- mov x20, #0
-
- cbz x5, stackArgsLoopEnd
-
- // Align count to 2, then multiply by 8, resulting in a size aligned to 16
- add x20, x5, #1
- lsl x20, x20, #3
- and x20, x20, #-0x10
- // Multiply count by 8
- lsl x10, x5, #3
- sub sp, sp, x20
-stackArgsLoopStart:
- ldp x9,x11, [x4],#16
- stp x9,x11, [sp],#16
- subs x10, x10, #16
- bgt stackArgsLoopStart
-stackArgsLoopEnd:
-
- // Calculate amount to jump forward, avoiding pointless instructions
- adr x9, populateFloatRegisterArgsEnd
- sub x9, x9, x3, lsl 2 // x9 -= numFloatRegArgs * 4
- br x9
-
- ldr d7, [x2, #0x38]
- ldr d6, [x2, #0x30]
- ldr d5, [x2, #0x28]
- ldr d4, [x2, #0x20]
- ldr d3, [x2, #0x18]
- ldr d2, [x2, #0x10]
- ldr d1, [x2, #0x08]
- ldr d0, [x2]
-populateFloatRegisterArgsEnd:
-
- mov x15, x6
- // Calculate amount to jump forward, avoiding pointless instructions
- adr x9, populateGPRegisterArgsEnd
- sub x9, x9, x1, lsl 2 // x9 -= numGPRegArgs * 4
- br x9
-
- ldr x7, [x0, #0x38]
- ldr x6, [x0, #0x30]
- ldr x5, [x0, #0x28]
- ldr x4, [x0, #0x20]
- ldr x3, [x0, #0x18]
- ldr x2, [x0, #0x10]
- ldr x1, [x0, #0x08]
- ldr x0, [x0]
-populateGPRegisterArgsEnd:
-
- // Actually call function
- sub sp, sp, x20
- blr x15
- add sp, sp, x20
-
- ldr x20, [sp,#0x10]
- ldp fp, lr, [sp],#0x20
-
- .cfi_restore lr
- .cfi_restore fp
- .cfi_restore 20
- .cfi_def_cfa_offset 0
- ret
- .cfi_endproc
-
-.align 2
-CallARM64Ret128:
- .cfi_startproc
- stp fp, lr, [sp,#-0x20]!
- str x20, [sp,#0x10]
- .cfi_def_cfa_offset 0x20
- .cfi_offset 20, 0x10
- .cfi_offset fp, -0x20
- .cfi_offset lr, -0x18
- mov fp, sp
-
- mov x20, x6
- mov x6, x7
- mov x7, #0
- bl CallARM64
-
- str x1, [x20]
-
- ldr x20, [sp,#0x10]
- ldp fp, lr, [sp],#0x20
-
- .cfi_restore lr
- .cfi_restore fp
- .cfi_restore 20
- .cfi_def_cfa_offset 0
- ret
- .cfi_endproc
-
-.align 2
-CallARM64RetInMemory:
- .cfi_startproc
- stp fp, lr, [sp,#-0x10]!
- mov fp, sp
- .cfi_def_cfa_offset 0x10
- .cfi_offset fp, -0x10
- .cfi_offset lr, -0x08
-
- mov x8, x6
- mov x6, x7
- mov x7, #0
- bl CallARM64
-
- mov x0, x8
-
- ldp fp, lr, [sp],#0x10
-
- .cfi_restore lr
- .cfi_restore fp
- .cfi_def_cfa_offset 0
- ret
- .cfi_endproc
-
-#endif /* __aarch64__ */
-
-#endif /* !AS_MAX_PORTABILITY */
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64_msvc.asm b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64_msvc.asm
deleted file mode 100644
index c8a5531c9f9..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm64_msvc.asm
+++ /dev/null
@@ -1,205 +0,0 @@
-;
-; AngelCode Scripting Library
-; Copyright (c) 2020-2020 Andreas Jonsson
-;
-; This software is provided 'as-is', without any express or implied
-; warranty. In no event will the authors be held liable for any
-; damages arising from the use of this software.
-;
-; Permission is granted to anyone to use this software for any
-; purpose, including commercial applications, and to alter it and
-; redistribute it freely, subject to the following restrictions:
-;
-; 1. The origin of this software must not be misrepresented; you
-; must not claim that you wrote the original software. If you use
-; this software in a product, an acknowledgment in the product
-; documentation would be appreciated but is not required.
-;
-; 2. Altered source versions must be plainly marked as such, and
-; must not be misrepresented as being the original software.
-;
-; 3. This notice may not be removed or altered from any source
-; distribution.
-;
-; The original version of this library can be located at:
-; http://www.angelcode.com/angelscript/
-;
-; Andreas Jonsson
-; andreas at angelcode.com
-;
-
-
-; Assembly routines for the ARM64/AArch64 call convention used for Windows 10 on ARM
-; Written by Max Waine in July 2020, based on as_callfunc_arm_msvc.asm
-
-; MSVC currently doesn't support inline assembly for the ARM64 platform,
-; and if they're treating it like x64 /won't/ ever support inline assembly,
-; so this separate file is needed.
-
-; Compile with Microsoft ARM64 assembler (armasm64)
-; http://msdn.microsoft.com/en-us/library/hh873190.aspx
-
- AREA |.rdata|, DATA, READONLY
- EXPORT GetHFAReturnDouble
- EXPORT GetHFAReturnFloat
- EXPORT CallARM64Ret128
- EXPORT CallARM64RetInMemory
- EXPORT CallARM64Double
- EXPORT CallARM64Float
- EXPORT CallARM64
-
- AREA |.text|, CODE, ALIGN=2
-
- ALIGN 4
-GetHFAReturnDouble PROC
- adr x9, |populateDoubles|
- sub x9, x9, x1, lsr 1 ; x9 -= returnSize >> 1; (/2 because double is 2x instruction size)
- br x9
-
- str d3, [x0, #0x18]
- str d2, [x0, #0x10]
- str d1, [x1]
- str d0, [x0]
-|populateDoubles|
-
- ret
- ENDP ; GetHFAReturnDouble
-
- ALIGN 4
-GetHFAReturnFloat PROC
- adr x9, |populateFloats|
- sub x9, x9, x2 // x9 -= returnSize; (already 4 bytes per return)
- br x9
-
- str s3, [x1, #0x4]
- str s2, [x1]
- str s1, [x0, #0x4]
- str s0, [x0]
-|populateFloats|
-
- ret
- ENDP ; GetHFAReturnFloat
-
-
-;[returnType] CallARM64[type](
-; const asQWORD *gpRegArgs, asQWORD numGPRegArgs,
-; const asQWORD *floatRegArgs, asQWORD numFloatRegArgs,
-; const asQWORD *stackArgs, asQWORD numStackArgs,
-; asFUNCTION_t func
-;)
- ALIGN 4
-CallARM64Double PROC
- stp fp, lr, [sp,#-0x10]!
- bl CallARM64
- ldp fp, lr, [sp,#-0x10]!
- ret
- ENDP ; CallARM64Double
-
- ALIGN 4
-CallARM64Float PROC
- stp fp, lr, [sp,#-0x10]!
- bl CallARM64
- ldp fp, lr, [sp,#-0x10]!
- ret
- ENDP ; CallARM64Float
-
- ALIGN 4
-CallARM64 PROC
- stp fp, lr, [sp,#-0x20]!
- str x20, [sp,#0x10]
-
- mov x20, #0;
-
- cbz x5, |stackArgsLoopEnd|
-
- ; Align count to 2, then multiply by 8, resulting in a size aligned to 16
- add x20, x5, #1
- lsl x20, x20, #3
- and x20, x20, #-0x10
- ; Multiply count by 8
- lsl x10, x5, #3
- sub sp, sp, x20
-|stackArgsLoopStart|
- ldp x9,x11, [x4],#16
- stp x9,x11, [sp],#16
- subs x10, x10, #16
- bgt |stackArgsLoopStart|
-|stackArgsLoopEnd|
-
- ; Calculate amount to jump forward, avoiding pointless instructions
- adr x9, |populateFloatRegisterArgsEnd|
- sub x9, x9, x3, lsl 2 ; x9 -= numFloatRegArgs * 4
- br x9
-
- ldr d7, [x2, #0x38]
- ldr d6, [x2, #0x30]
- ldr d5, [x2, #0x28]
- ldr d4, [x2, #0x20]
- ldr d3, [x2, #0x18]
- ldr d2, [x2, #0x10]
- ldr d1, [x2, #0x08]
- ldr d0, [x2]
-|populateFloatRegisterArgsEnd|
-
- mov x15, x6
- ; Calculate amount to jump forward, avoiding pointless instructions
- adr x9, |populateGPRegisterArgsEnd|
- sub x9, x9, x1, lsl 2 ; x9 -= numGPRegArgs * 4
- br x9
-
- ldr x7, [x0, #0x38]
- ldr x6, [x0, #0x30]
- ldr x5, [x0, #0x28]
- ldr x4, [x0, #0x20]
- ldr x3, [x0, #0x18]
- ldr x2, [x0, #0x10]
- ldr x1, [x0, #0x08]
- ldr x0, [x0]
-|populateGPRegisterArgsEnd|
-
- ; Actually call function
- sub sp, sp, x20
- blr x15
- add sp, sp, x20
-
- ldr x20, [sp,#0x10]
- ldp fp, lr, [sp],#0x20
-
- ret
- ENDP ; CallARM64
-
- ALIGN 4
-CallARM64Ret128 PROC
- stp fp, lr, [sp,#-0x20]!
- str x20, [sp,#0x10]
- mov fp, sp
-
- mov x20, x6
- mov x6, x7
- mov x7, #0
- bl CallARM64
-
- str x1, [x20]
-
- ldr x20, [sp,#0x10]
- ldp fp, lr, [sp],#0x20
-
- ret ; CallARM64Ret128
-
- ALIGN 4
-CallARM64RetInMemory PROC
- stp fp, lr, [sp,#-0x10]!
- mov fp, sp
-
- mov x8, x6
- mov x6, x7
- mov x7, #0
- bl CallARM64
-
- mov x0, x8
-
- ldp fp, lr, [sp],#0x10
-
- ret ; CallARM64RetInMemory
-
- END
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_gcc.S b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_gcc.S
deleted file mode 100644
index 1dde510b22b..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_gcc.S
+++ /dev/null
@@ -1,730 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2020 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-/*
- Assembly routines for the ARM call convention
- Written by Fredrik Ehnbom in June 2009
-
- Adapted to GNUC by darktemplar216 in September 2009
-
- Modified by Lasse Oorni for 8-byte stack alignment in May 2012
-
- The assembler routines for Linux were written by Carlos Luna in December 2012
-*/
-
-#if !defined(AS_MAX_PORTABILITY)
-
-#if defined(__arm__) || defined(__ARM__) || defined(I3D_ARCH_ARM)
-
-#if !defined(__linux__) || defined(__ANDROID__) || defined(ANDROID) || defined(__SOFTFP__) || defined(__ARM_PCS)
-
-/* iOS, Android, Marmalade, and Linux with soft-float ABI goes here */
-
-.global armFunc
-.global armFuncR0
-.global armFuncR0R1
-.global armFuncObjLast
-.global armFuncR0ObjLast
-
-/* --------------------------------------------------------------------------------------------*/
-armFunc:
- stmdb sp!, {r4-r8, lr}
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
- mov r8, #0
-
- beq nomoreargs
-
- /* Load the first 4 arguments into r0-r3 */
- cmp r7, #4
- ldrge r0, [r6],#4
- cmp r7, #2*4
- ldrge r1, [r6],#4
- cmp r7, #3*4
- ldrge r2, [r6],#4
- cmp r7, #4*4
- ldrge r3, [r6],#4
- ble nomoreargs
-
- /* Load the rest of the arguments onto the stack */
- sub r7, r7, #4*4 /* skip the 4 registers already loaded into r0-r3 */
- add r8, r7, #4 /* ensure 8-byte stack alignment */
- bic r8, r8, #4
- sub sp, sp, r8
- mov r12, sp /* copy size != frame size, so store frame start sp */
-stackargsloop:
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne stackargsloop
- mov sp, r12
-nomoreargs:
-#if defined (__ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
- mov lr, pc /* older ARM didn't support blx */
- mov pc, r4
-#else
- blx r4
-#endif
- add sp, sp, r8
- ldmia sp!, {r4-r8, pc}
-
-/* --------------------------------------------------------------------------------------------*/
-armFuncObjLast:
- stmdb sp!, {r4-r8, lr}
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
- mov r8, #0
-
- mov r0, r3 /* objlast. might get overwritten */
- mov r5, r3 /* objlast to temp reg */
-
- beq nomoreargsarmFuncObjLast
-
- /* Load the first 4 arguments into r0-r3 */
- cmp r7, #4
- ldrge r0, [r6],#4
- cmp r7, #2*4
- ldrge r1, [r6],#4
- movlt r1, r5
- cmp r7, #3*4
- ldrge r2, [r6],#4
- movlt r2, r5
- cmp r7, #4*4
- ldrge r3, [r6],#4
- movlt r3, r5
- blt nomoreargsarmFuncObjLast
-
- /* Load the rest of the arguments onto the stack */
- sub r7, r7, #4*4 /* skip the 4 registers already loaded into r0-r3 */
- add r8, r7, #8 /* account for the objlast pointer, ensure 8-byte stack alignment */
- bic r8, r8, #4
- str r5, [sp,#-4] /* store the objlast on stack, twice in case we adjusted alignment */
- str r5, [sp,#-8]
- sub sp, sp, r8 /* adjust frame */
- cmp r7, #0 /* we may also have come here with no extra params */
- beq nomoreargsarmFuncObjLast
- mov r12, sp /* copy size != frame size, so store frame start sp */
-stackargslooparmFuncObjLast:
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne stackargslooparmFuncObjLast
- mov sp, r12
-nomoreargsarmFuncObjLast:
-#if defined (__ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
- mov lr, pc /* older ARM didn't support blx */
- mov pc, r4
-#else
- blx r4
-#endif
- add sp, sp, r8
- ldmia sp!, {r4-r8, pc}
-
-/* --------------------------------------------------------------------------------------------*/
-armFuncR0ObjLast:
- stmdb sp!, {r4-r8, lr}
- ldr r5, [sp,#6*4] /* objlast to temp reg */
-
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
- mov r8, #0
-
- mov r0, r3 /* r0 explicitly set */
- mov r1, r5 /* objlast. might get overwritten */
-
- beq nomoreargsarmFuncR0ObjLast
-
- /* Load the first 3 arguments into r1-r3 */
- cmp r7, #1*4
- ldrge r1, [r6],#4
- cmp r7, #2*4
- ldrge r2, [r6],#4
- movlt r2, r5
- cmp r7, #3*4
- ldrge r3, [r6],#4
- movlt r3, r5
- blt nomoreargsarmFuncR0ObjLast
-
- /* Load the rest of the arguments onto the stack */
- sub r7, r7, #3*4 /* skip the 3 registers already loaded into r1-r3 */
- add r8, r7, #8 /* account for the objlast pointer, ensure 8-byte stack alignment */
- bic r8, r8, #4
- str r5, [sp,#-4] /* store the objlast on stack, twice in case we adjusted alignment */
- str r5, [sp,#-8]
- sub sp, sp, r8 /* adjust frame */
- cmp r7, #0 /* we may also have come here with no extra params */
- beq nomoreargsarmFuncR0ObjLast
- mov r12, sp /* copy size != frame size, so store frame start sp */
-stackargslooparmFuncR0ObjLast:
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne stackargslooparmFuncR0ObjLast
- mov sp, r12
-nomoreargsarmFuncR0ObjLast:
-#if defined (__ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
- mov lr, pc /* older ARM didn't support blx */
- mov pc, r4
-#else
- blx r4
-#endif
- add sp, sp, r8
- ldmia sp!, {r4-r8, pc}
-
-/* --------------------------------------------------------------------------------------------*/
-armFuncR0:
- stmdb sp!, {r4-r8, lr}
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
- mov r8, #0
-
- mov r0, r3 /* r0 explicitly set */
-
- beq nomoreargsarmFuncR0
-
- /* Load the first 3 arguments into r1-r3 */
- cmp r7, #1*4
- ldrge r1, [r6],#4
- cmp r7, #2*4
- ldrge r2, [r6],#4
- cmp r7, #3*4
- ldrge r3, [r6],#4
- ble nomoreargsarmFuncR0
-
- /* Load the rest of the arguments onto the stack */
- sub r7, r7, #3*4 /* skip the 3 registers already loaded into r1-r3 */
- add r8, r7, #4 /* ensure 8-byte stack alignment */
- bic r8, r8, #4
- sub sp, sp, r8
- mov r12, sp /* copy size != frame size, so store frame start sp */
-stackargslooparmFuncR0:
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne stackargslooparmFuncR0
- mov sp, r12
-nomoreargsarmFuncR0:
-#if defined (__ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
- mov lr, pc /* older ARM didn't support blx */
- mov pc, r4
-#else
- blx r4
-#endif
- add sp, sp, r8
- ldmia sp!, {r4-r8, pc}
-
-/* --------------------------------------------------------------------------------------------*/
-armFuncR0R1:
- stmdb sp!, {r4-r8, lr}
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
- mov r8, #0
-
- mov r0, r3 /* r0 explicitly set */
- ldr r1, [sp, #6*4] /* r1 explicitly set too */
-
- beq nomoreargsarmFuncR0R1
-
- /* Load the first 2 arguments into r2-r3 */
- cmp r7, #1*4
- ldrge r2, [r6],#4
- cmp r7, #2*4
- ldrge r3, [r6],#4
- ble nomoreargsarmFuncR0R1
-
- /* Load the rest of the arguments onto the stack */
- sub r7, r7, #2*4 /* skip the 2 registers already loaded into r2-r3 */
- add r8, r7, #4 /* ensure 8-byte stack alignment */
- bic r8, r8, #4
- sub sp, sp, r8
- mov r12, sp /* copy size != frame size, so store frame start sp */
-stackargslooparmFuncR0R1:
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne stackargslooparmFuncR0R1
- mov sp, r12
-nomoreargsarmFuncR0R1:
-#if defined (__ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
- mov lr, pc /* older ARM didn't support blx */
- mov pc, r4
-#else
- blx r4
-#endif
- add sp, sp, r8
- ldmia sp!, {r4-r8, pc}
-
-/* --------------------------------------------------------------------------------------------*/
-#elif defined(__linux__) && !defined(__SOFTFP__) && !defined(__ARM_PCS)
-
-/* The Linux with hard-float ABI code goes here */
-
-
-/* These codes are suitable for armeabi + vfp / armeabihf */
-/* when using armeabi + vfp, please set C_FLAGS -mfloat-abi=softfp -mfpu=vfp */
-/* using armeabihf, please set C_FLAGS -mfloat-abi=hard -mfpu=vfpv3-d16 */
-
-/* if you prefer to run in ARM mode, please add -marm to C_FLAGS */
-/* while using thumb mode, please add -mthumb -Wa,-mimplicit-it=thumb */
-
-
-/* SP is a multiple of 8 when control first enters a program.*/
-/* This places an obligation on authors of low level OS, RTOS, and runtime library code to align SP at all points */
-/* at which control first enters a body of (AAPCS-conforming) code. (please read "ARM IHI 0046B" document)*/
-
-
-.section .text
-
- .align 2 /* Align the function code to a 4-byte (2^n) word boundary. */
-#if defined(__thumb__) || defined(__thumb2__)
- .thumb
- .syntax unified
-#else
- .arm /* Use ARM instructions instead of Thumb.*/
-#endif
- .globl armFunc /* Make the function globally accessible.*/
-armFunc:
- push {r4-r8, r10, r11, lr} /* sp must be 8-byte alignment for ABI compliance, so the pushed registers must be even */
-
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
-
- /* Load float and double args into d0-d7 and s0-s15 */
- add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
- mov r8, #0
- vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
-
- /* If there are no arguments to set into r0-r3 */
- /* go check if there are arguments for the stack */
- beq stackargs
-
- /* Load the first 4 arguments into r0-r3 */
- cmp r7, #4
- ldrge r0, [r6]
- cmp r7, #8
- ldrge r1, [r6, #4]
- cmp r7, #12
- ldrge r2, [r6, #8]
- cmp r7, #16
- ldrge r3, [r6, #12]
-
-stackargs:
- ldr r5, [r6, #268] /* Load stack size into r5 */
- movs r7, r5 /* Load stack size into r7, checking for 0 args */
-
- /* If there are no args for the stack, branch */
- beq nomoreargs
-
- /* Load the rest of the arguments onto the stack */
- /* Ensure 8-byte stack alignment */
- mov r8, sp
- sub sp, sp, r7
- add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
-
- sub r12, sp, #8
- bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
- sub r8, r8, r12
- mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
-
-stackargsloop:
- ldr r5, [r6], #4
- subs r7, r7, #4
- str r5, [sp], #4
- bne stackargsloop
- mov sp, r12
-
-nomoreargs:
-#if defined (__ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
- mov lr, pc /* older ARM didn't support blx */
- mov pc, r4
-#else
- blx r4
-#endif
- add sp, sp, r8
- vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d7 to the address stored in r10 */
-
- pop {r4-r8, r10, r11, pc}
-
-/* --------------------------------------------------------------------------------------------*/
- .align 2 /* Align the function code to a 4-byte (2^n) word boundary. */
-#if defined(__thumb__) || defined(__thumb2__)
- .thumb
- .syntax unified
-#else
- .arm /* Use ARM instructions instead of Thumb.*/
-#endif
- .globl armFuncObjLast /* Make the function globally accessible.*/
-armFuncObjLast:
- push {r4-r8, r10, r11, lr} /* We´re storing r11 just to keep the stack aligned to an 8 byte boundary */
-
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
-
- mov r0, r3 /* objlast. might get overwritten */
- mov r5, #0 /* This will hold an offset of #4 only if objlast couldn´t be placed into an "r" register */
-
- /* Load float and double args into d0-d7 and s0-s15 (r10 holds pointer to first float value) */
- add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
- mov r8, #0
- vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
-
- /* If there are no arguments to set into r0-r3 */
- /* go check if there are arguments for the stack */
- beq stackargsFuncObjLast
-
- mov r5, r3 /* store objlast in r5 temporarily */
-
- /* Load the first 4 arguments into r0-r3 */
- cmp r7, #4
- ldrge r0, [r6]
- cmp r7, #8
- ldrge r1, [r6,#4]
- movlt r1, r5
- cmp r7, #12
- ldrge r2, [r6,#8]
- movlt r2, r5
- cmp r7, #16
- ldrge r3, [r6,#12]
- movlt r3, r5
- movlt r5, #0 /* If objlast got placed into a register, r5 = 0 */
- blt stackargsFuncObjLast /* If objlast got placed into a register, go to stackargsFuncObjLast */
-
- str r5, [r6, #12] /* Put objlast in r6 + 12 */
- mov r5, #4 /* Set r5 with an offset of #4, so objlast can be loaded into the stack */
-
-stackargsFuncObjLast:
- ldr r7, [r6, #268] /* Load stack size into r7 */
- add r7, r7, r5 /* Add the offset placed in r5 (could be #0 or #4) */
- cmp r7, #0 /* Check for 0 args */
-
- /* If there are no args for the stack, branch */
- beq nomoreargsarmFuncObjLast
-
- /* Load the rest of the arguments onto the stack */
- /* Ensure 8-byte stack alignment */
- mov r8, sp
- sub sp, sp, r7
- add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
-
- sub r12, sp, #8
- sub r6, r6, r5 /* r6 = r6 - r5 (r5 can be #0 or #4) */
- bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
- sub r8, r8, r12
- mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
-
-stackargslooparmFuncObjLast:
- ldr r5, [r6], #4
- subs r7, r7, #4
- str r5, [sp], #4
- bne stackargslooparmFuncObjLast
- mov sp, r12
-
-nomoreargsarmFuncObjLast:
-#if defined (__ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
- mov lr, pc /* older ARM didn't support blx */
- mov pc, r4
-#else
- blx r4
-#endif
- add sp, sp, r8
- vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d10 to the address stored in r10 */
-
- pop {r4-r8, r10,r11, pc}
-
-/* ------------------------------------------------------------------------------------------- */
- .align 2 /* Align the function code to a 4-byte (2^n) word boundary. */
-#if defined(__thumb__) || defined(__thumb2__)
- .thumb
- .syntax unified
-#else
- .arm /* Use ARM instructions instead of Thumb.*/
-#endif
- .globl armFuncR0ObjLast /* Make the function globally accessible.*/
-armFuncR0ObjLast:
- push {r4-r8, r10, r11, lr}
-
- ldr r5, [sp,#32] /* objlast to temp reg */
-
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
-
- mov r0, r3 /* r0 explicitly set */
- mov r1, r5 /* objlast. might get overwritten */
- mov r5, #0 /* This will hold an offset of #4 or #8 if objlast or one arg couldn´t be placed into an "r" register */
-
- /* Load float and double args into d0-d7 and s0-s15 (r10 holds pointer to first float value) */
- add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
- mov r8, #0
- vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
-
- /* If there are no arguments to set into r0-r3 */
- /* go check if there are arguments for the stack */
- beq stackargsFuncR0ObjLast
-
- mov r5, r1 /* store objlast in r5 temporarily */
-
- /* Load the first 3 arguments into r1-r3 */
- cmp r7, #4
- ldrge r1, [r6]
- cmp r7, #8
- ldrge r2, [r6,#4]
- movlt r2, r5
- cmp r7, #12
- ldrge r3, [r6,#8]
- movlt r3, r5
- movlt r5, #0 /* If objlast got placed into a register, r5 = 0 */
- blt stackargsFuncR0ObjLast /* If objlast got placed into a register, go to stackargsFuncR0ObjLast */
-
- cmp r7, #16 /* Else if we have one last arg set the offset accordingly and store the arg in the array */
- ldrge r7, [r6, #12]
- strge r7, [r6, #8]
-
- str r5, [r6, #12] /* Put objlast in r6 + 12 */
- mov r5, #0
-
- movge r5, #4 /* Set r5 with an offset of #4 if there´s one last arg that couldn´t be placed in r registers */
- add r5, r5, #4 /* Set r5 with an offset of + #4, so objlast can be loaded into the stack */
-
-stackargsFuncR0ObjLast:
- ldr r7, [r6, #268] /* Load stack size into r7 */
- add r7, r7, r5 /* Add the offset placed in r5 (could be #0 or #4) */
- cmp r7, #0 /* Check for 0 args */
-
- /* If there are no args for the stack, branch */
- beq nomoreargsarmFuncR0ObjLast
-
- /* Load the rest of the arguments onto the stack */
- /* Ensure 8-byte stack alignment */
- mov r8, sp
- sub sp, sp, r7
- add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
-
- sub r12, sp, #8
- sub r6, r6, r5 /* r6 = r6 - r5 (r5 can be #0 or #4) */
- bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
- sub r8, r8, r12
- mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
-
-stackargslooparmFuncR0ObjLast:
- ldr r5, [r6], #4
- subs r7, r7, #4
- str r5, [sp], #4
- bne stackargslooparmFuncR0ObjLast
- mov sp, r12
-
-nomoreargsarmFuncR0ObjLast:
-#if defined (__ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
- mov lr, pc /* older ARM didn't support blx */
- mov pc, r4
-#else
- blx r4
-#endif
- add sp, sp, r8
- vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d10 to the address stored in r10 */
-
- pop {r4-r8, r10, r11, pc}
-
-/* ------------------------------------------------------------------------------------------- */
- .align 2 /* Align the function code to a 4-byte (2^n) word boundary. */
-#if defined(__thumb__) || defined(__thumb2__)
- .thumb
- .syntax unified
-#else
- .arm /* Use ARM instructions instead of Thumb.*/
-#endif
- .globl armFuncR0 /* Make the function globally accessible.*/
-armFuncR0:
- push {r4-r8, r10, r11, lr}
-
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
- mov r11, #0 /* This will hold an offset of #4 only if the last arg that should have been placed into an "r" reg needs to go to the stack */
- mov r0, r3 /* r0 explicitly set */
-
- /* Load float and double args into d0-d7 and s0-s15 (r10 holds pointer to first float value) */
- add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
- mov r8, #0
- vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
-
- /* If there are no arguments to set into r0-r3 */
- /* go check if there are arguments for the stack */
- beq stackargsarmFuncR0
-
- /* Load the first 3 arguments into r1-r3 */
- cmp r7, #4
- ldrge r1, [r6]
- cmp r7, #8
- ldrge r2, [r6, #4]
- cmp r7, #12
- ldrge r3, [r6, #8]
- cmp r7, #16
- movge r11, #4 /* If there is still one arg to be placed, set the offset in r11 to #4 */
-
-stackargsarmFuncR0:
- ldr r5, [r6, #268] /* Load stack size into r5 */
- add r5, r11 /* Add the offset placed in r11 (could be #0 or #4) */
- movs r7, r5 /* Load stack size into r7, checking for 0 args */
-
- /* If there are no args for the stack, branch */
- beq nomoreargsarmFuncR0
-
- /* Load the rest of the arguments onto the stack */
- /* Ensure 8-byte stack alignment */
- mov r8, sp
- sub sp, sp, r7
- add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
-
- sub r12, sp, #8
- sub r6, r6, r11 /* r6 = r6 - r11 (r11 can be #0 or #4) */
- bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
- sub r8, r8, r12
- mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
-
-stackargslooparmFuncR0:
- ldr r5, [r6], #4
- subs r7, r7, #4
- str r5, [sp], #4
- bne stackargslooparmFuncR0
- mov sp, r12
-
-nomoreargsarmFuncR0:
-#if defined (__ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
- mov lr, pc /* older ARM didn't support blx */
- mov pc, r4
-#else
- blx r4
-#endif
- add sp, sp, r8
- vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d10 to the address stored in r10 */
-
- pop {r4-r8, r10, r11, pc}
-
-/* ------------------------------------------------------------------------------------------- */
- .align 2 /* Align the function code to a 4-byte (2^n) word boundary. */
-#if defined(__thumb__) || defined(__thumb2__)
- .thumb
- .syntax unified
-#else
- .arm /* Use ARM instructions instead of Thumb.*/
-#endif
- .globl armFuncR0R1 /* Make the function globally accessible.*/
-armFuncR0R1:
- push {r4-r8, r10, r11, lr}
-
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
- mov r11, #0 /* This will hold an offset of #4 or #8 only if the last arg (or last 2 args) that should have been placed into "r" regs need to go to the stack */
-
- mov r0, r3 /* r0 explicitly set */
- ldr r1, [sp, #32] /* r1 explicitly set too */
-
- /* Load float and double args into d0-d7 and s0-s15 (r10 holds pointer to first float value) */
- add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
- mov r8, #0
- vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
-
- /* If there are no arguments to set into r2-r3 */
- /* go check if there are arguments for the stack */
- beq stackargsarmFuncR0R1
-
- /* Load the first 2 arguments into r2-r3 */
- cmp r7, #4
- ldrge r2, [r6]
- cmp r7, #8
- ldrge r3, [r6, #4]
- cmp r7, #12
- movge r11, #4 /* If there is a third arg to be placed, set the offset in r11 to #4 */
- cmp r7, #16
- movge r11, #8 /* If there is a fourth arg to be placed, set the offset in r11 to #8 */
- ldrlt r7, [r6, #8] /* Else copy the third arg to the correct place in the array */
- strlt r7, [r6, #12]
-
-stackargsarmFuncR0R1:
- ldr r5, [r6, #268] /* Load stack size into r5 */
- add r5, r11 /* Add the offset placed in r11 (could be #0 or #4 or #8) */
- movs r7, r5 /* Load stack size into r7, checking for 0 args */
-
- /* If there are no args for the stack, branch */
- beq nomoreargsarmFuncR0R1
-
- /* Load the rest of the arguments onto the stack */
- /* Ensure 8-byte stack alignment */
- mov r8, sp
- sub sp, sp, r7
- add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
-
- sub r12, sp, #8
- sub r6, r6, r11 /* r6 = r6 - r11 (r11 can be #0 or #4 or #8) */
- bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
- sub r8, r8, r12
- mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
-
-stackargslooparmFuncR0R1:
- ldr r5, [r6], #4
- subs r7, r7, #4
- str r5, [sp], #4
- bne stackargslooparmFuncR0R1
- mov sp, r12
-
-nomoreargsarmFuncR0R1:
-#if defined (__ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
- mov lr, pc /* older ARM didn't support blx */
- mov pc, r4
-#else
- blx r4
-#endif
- add sp, sp, r8
- vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d10 to the address stored in r10 */
-
- pop {r4-r8, r10, r11, pc}
-
-#endif /* hard float abi */
-
-#endif /* arm */
-
-#if defined(__linux__) && defined(__ELF__)
-/* ref: http://hardened.gentoo.org/gnu-stack.xml
- ref: https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart */
-.section .note.GNU-stack,"",%progbits
-#endif
-
-#endif /* !AS_MAX_PORTABILITY */
-
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_msvc.asm b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_msvc.asm
deleted file mode 100644
index 7ddf99758ec..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_msvc.asm
+++ /dev/null
@@ -1,249 +0,0 @@
-;
-; AngelCode Scripting Library
-; Copyright (c) 2003-2014 Andreas Jonsson
-;
-; This software is provided 'as-is', without any express or implied
-; warranty. In no event will the authors be held liable for any
-; damages arising from the use of this software.
-;
-; Permission is granted to anyone to use this software for any
-; purpose, including commercial applications, and to alter it and
-; redistribute it freely, subject to the following restrictions:
-;
-; 1. The origin of this software must not be misrepresented; you
-; must not claim that you wrote the original software. If you use
-; this software in a product, an acknowledgment in the product
-; documentation would be appreciated but is not required.
-;
-; 2. Altered source versions must be plainly marked as such, and
-; must not be misrepresented as being the original software.
-;
-; 3. This notice may not be removed or altered from any source
-; distribution.
-;
-; The original version of this library can be located at:
-; http://www.angelcode.com/angelscript/
-;
-; Andreas Jonsson
-; andreas at angelcode.com
-;
-
-
-; Assembly routines for the ARM call convention used for Windows CE
-; Written by Fredrik Ehnbom in June 2009
-
-; MSVC currently doesn't support inline assembly for the ARM platform
-; so this separate file is needed.
-
-; Compile with Microsoft ARM assembler (armasm)
-; http://msdn.microsoft.com/en-us/library/hh873190.aspx
-
-
- AREA |.rdata|, DATA, READONLY
- EXPORT armFunc
- EXPORT armFuncR0
- EXPORT armFuncR0R1
- EXPORT armFuncObjLast
- EXPORT armFuncR0ObjLast
-
- AREA |.text|, CODE, ARM, ALIGN=3
-
- ALIGN 8
-armFunc PROC
- stmdb sp!, {r4-r8, lr}
- mov r6, r0 ; arg table
- movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments)
- mov r4, r2 ; function address
- mov r8, #0
-
- beq |nomoreargs|
-
- ; Load the first 4 arguments into r0-r3
- cmp r7, #4
- ldrge r0, [r6],#4
- cmp r7, #2*4
- ldrge r1, [r6],#4
- cmp r7, #3*4
- ldrge r2, [r6],#4
- cmp r7, #4*4
- ldrge r3, [r6],#4
- ble |nomoreargs|
-
- ; Load the rest of the arguments onto the stack
- sub r7, r7, #4*4 ; skip the 4 registers already loaded into r0-r3
- sub sp, sp, r7
- mov r8, r7
-|stackargsloop|
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne |stackargsloop|
-|nomoreargs|
- sub sp, sp, r8
- blx r4
- add sp, sp, r8
- ldmia sp!, {r4-r8, pc}
- ENDP
-
- ALIGN 8
-armFuncObjLast PROC
- stmdb sp!, {r4-r8, lr}
- mov r6, r0 ; arg table
- movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments)
- mov r4, r2 ; function address
- mov r8, #0
-
- mov r0, r3 ; objlast. might get overwritten
- str r3, [sp, #-4]! ; objlast again.
-
- beq |nomoreargs at armFuncObjLast|
-
- ; Load the first 4 arguments into r0-r3
- cmp r7, #4
- ldrge r0, [r6],#4
- cmp r7, #2*4
- ldrge r1, [r6],#4
- ldrlt r1, [sp]
- cmp r7, #3*4
- ldrge r2, [r6],#4
- ldrlt r2, [sp]
- cmp r7, #4*4
- ldrge r3, [r6],#4
- ldrlt r3, [sp]
- ble |nomoreargs at armFuncObjLast|
-
- ; Load the rest of the arguments onto the stack
- sub r7, r7, #4*4 ; skip the 4 registers already loaded into r0-r3
- sub sp, sp, r7
- mov r8, r7
-|stackargsloop at armFuncObjLast|
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne |stackargsloop at armFuncObjLast|
-|nomoreargs at armFuncObjLast|
- sub sp, sp, r8
- blx r4
- add sp, sp, r8
- add sp, sp, #4
- ldmia sp!, {r4-r8, pc}
- ENDP
-
- ALIGN 8
-armFuncR0ObjLast PROC
- stmdb sp!, {r4-r8, lr}
- ldr r7, [sp,#6*4]
- str r7, [sp,#-4]!
-
- mov r6, r0 ; arg table
- movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments)
- mov r4, r2 ; function address
- mov r8, #0
-
- mov r0, r3 ; r0 explicitly set
- ldr r1, [sp] ; objlast. might get overwritten
-
- beq |nomoreargs at armFuncR0ObjLast|
-
- ; Load the first 3 arguments into r1-r3
- cmp r7, #1*4
- ldrge r1, [r6],#4
- cmp r7, #2*4
- ldrge r2, [r6],#4
- ldrlt r2, [sp]
- cmp r7, #3*4
- ldrge r3, [r6],#4
- ldrlt r3, [sp]
- ble |nomoreargs at armFuncR0ObjLast|
-
- ; Load the rest of the arguments onto the stack
- sub r7, r7, #3*4 ; skip the 3 registers already loaded into r1-r3
- sub sp, sp, r7
- mov r8, r7
-|stackargsloop at armFuncR0ObjLast|
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne |stackargsloop at armFuncR0ObjLast|
-|nomoreargs at armFuncR0ObjLast|
- sub sp, sp, r8
- blx r4
- add sp, sp, r8
- add sp, sp, #4
- ldmia sp!, {r4-r8, pc}
- ENDP
-
- ALIGN 8
-armFuncR0 PROC
- stmdb sp!, {r4-r8, lr}
- mov r6, r0 ; arg table
- movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments)
- mov r4, r2 ; function address
- mov r8, #0
-
- mov r0, r3 ; r0 explicitly set
-
- beq |nomoreargs at armFuncR0|
-
- ; Load the first 3 arguments into r1-r3
- cmp r7, #1*4
- ldrge r1, [r6],#4
- cmp r7, #2*4
- ldrge r2, [r6],#4
- cmp r7, #3*4
- ldrge r3, [r6],#4
- ble |nomoreargs at armFuncR0|
-
- ; Load the rest of the arguments onto the stack
- sub r7, r7, #3*4 ; skip the 3 registers already loaded into r1-r3
- sub sp, sp, r7
- mov r8, r7
-|stackargsloop at armFuncR0|
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne |stackargsloop at armFuncR0|
-|nomoreargs at armFuncR0|
- sub sp, sp, r8
- blx r4
- add sp, sp, r8
- ldmia sp!, {r4-r8, pc}
- ENDP
-
- ALIGN 8
-armFuncR0R1 PROC
- stmdb sp!, {r4-r8, lr}
- mov r6, r0 ; arg table
- movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments)
- mov r4, r2 ; function address
- mov r8, #0
-
- mov r0, r3 ; r0 explicitly set
- ldr r1, [sp, #6*4] ; r1 explicitly set too
-
- beq |nomoreargs at armFuncR0R1|
-
- ; Load the first 2 arguments into r2-r3
- cmp r7, #1*4
- ldrge r2, [r6],#4
- cmp r7, #2*4
- ldrge r3, [r6],#4
- ble |nomoreargs at armFuncR0R1|
-
- ; Load the rest of the arguments onto the stack
- sub r7, r7, #2*4 ; skip the 2 registers already loaded into r2-r3
- sub sp, sp, r7
- mov r8, r7
-|stackargsloop at armFuncR0R1|
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne |stackargsloop at armFuncR0R1|
-|nomoreargs at armFuncR0R1|
- sub sp, sp, r8
- blx r4
- add sp, sp, r8
- ldmia sp!, {r4-r8, pc}
- ENDP
-
- END
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_vita.S b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_vita.S
deleted file mode 100644
index adae391b535..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_vita.S
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2015 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-/*
- Assembly routines for the Playstation Vita SNC call convention.
-
- This code was adapted from as_callfunc_arm_gcc (ARM, Linux hard float) by Brandon Bare on October 2014.
-*/
-
-#if !defined(AS_MAX_PORTABILITY)
-
-#ifdef __psp2__
-
-.syntax unified
-.cpu cortex-a9
-.fpu neon
-
-.section .text.armCallFunc
-.balign 2
-.thumb
-.thumb_func
-
-.align 2
-
-.global armFunc
-.global armFuncR0
-.global armFuncR0R1
-.global armFuncObjLast
-.global armFuncR0ObjLast
-
-.type armFunc, %function
-.type armFuncR0, %function
-.type armFuncR0R1, %function
-.type armFuncObjLast, %function
-.type armFuncR0ObjLast, %function
-
-/* --------------------------------------------------------------------------------------------*/
-armFunc:
- .fnstart
-
- push {r4-r8, r10, r11, lr} /* sp must be 8-byte alignment for ABI compliance, so the pushed registers must be even */
-
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
-
- /* Load float and double args into d0-d7 and s0-s15 */
- add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
- mov r8, #0
- vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
-
- /* If there are no arguments to set into r0-r3 */
- /* go check if there are arguments for the stack */
- beq stackargs
-
- /* Load the first 4 arguments into r0-r3 */
- cmp r7, #4
-
- it ge
- ldrge r0, [r6]
- cmp r7, #8
-
- it ge
- ldrge r1, [r6, #4]
- cmp r7, #12
-
- it ge
- ldrge r2, [r6, #8]
- cmp r7, #16
-
- it ge
- ldrge r3, [r6, #12]
-
-stackargs:
- ldr r5, [r6, #268] /* Load stack size into r5 */
- movs r7, r5 /* Load stack size into r7, checking for 0 args */
-
- /* If there are no args for the stack, branch */
- beq nomoreargs
-
- /* Load the rest of the arguments onto the stack */
- /* Ensure 8-byte stack alignment */
- mov r8, sp
- sub sp, sp, r7
- add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
-
- sub r12, sp, #8
- bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
- sub r8, r8, r12
- mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
-
-stackargsloop:
- ldr r5, [r6], #4
- subs r7, r7, #4
- str r5, [sp], #4
- bne stackargsloop
- mov sp, r12
-
-nomoreargs:
- blx r4
- add sp, sp, r8
- vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d7 to the address stored in r10 */
-
- pop {r4-r8, r10, r11, pc}
-
- .fnend
-
-/* --------------------------------------------------------------------------------------------*/
-armFuncObjLast:
- .fnstart
-
- push {r4-r8, r10, r11, lr} /* We´re storing r11 just to keep the stack aligned to an 8 byte boundary */
-
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
-
- mov r0, r3 /* objlast. might get overwritten */
- mov r5, #0 /* This will hold an offset of #4 only if objlast couldn´t be placed into an "r" register */
-
- /* Load float and double args into d0-d7 and s0-s15 (r10 holds pointer to first float value) */
- add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
- mov r8, #0
- vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
-
- /* If there are no arguments to set into r0-r3 */
- /* go check if there are arguments for the stack */
- beq stackargsFuncObjLast
-
- mov r5, r3 /* store objlast in r5 temporarily */
-
- /* Load the first 4 arguments into r0-r3 */
- cmp r7, #4
-
- it ge
- ldrge r0, [r6]
- cmp r7, #8
-
- it ge
- ldrge r1, [r6,#4]
-
- it lt
- movlt r1, r5
- cmp r7, #12
-
- it ge
- ldrge r2, [r6,#8]
-
- it lt
- movlt r2, r5
- cmp r7, #16
-
- it ge
- ldrge r3, [r6,#12]
-
- ittt lt
- movlt r3, r5
- movlt r5, #0 /* If objlast got placed into a register, r5 = 0 */
- blt stackargsFuncObjLast /* If objlast got placed into a register, go to stackargsFuncObjLast */
-
- str r5, [r6, #12] /* Put objlast in r6 + 12 */
- mov r5, #4 /* Set r5 with an offset of #4, so objlast can be loaded into the stack */
-
-stackargsFuncObjLast:
- ldr r7, [r6, #268] /* Load stack size into r7 */
- add r7, r7, r5 /* Add the offset placed in r5 (could be #0 or #4) */
- cmp r7, #0 /* Check for 0 args */
-
- /* If there are no args for the stack, branch */
- beq nomoreargsarmFuncObjLast
-
- /* Load the rest of the arguments onto the stack */
- /* Ensure 8-byte stack alignment */
- mov r8, sp
- sub sp, sp, r7
- add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
-
- sub r12, sp, #8
- sub r6, r6, r5 /* r6 = r6 - r5 (r5 can be #0 or #4) */
- bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
- sub r8, r8, r12
- mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
-
-stackargslooparmFuncObjLast:
- ldr r5, [r6], #4
- subs r7, r7, #4
- str r5, [sp], #4
- bne stackargslooparmFuncObjLast
- mov sp, r12
-
-nomoreargsarmFuncObjLast:
- blx r4
- add sp, sp, r8
- vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d10 to the address stored in r10 */
-
- pop {r4-r8, r10,r11, pc}
-
- .fnend
-
-/* --------------------------------------------------------------------------------------------*/
-armFuncR0ObjLast:
- .fnstart
-
- push {r4-r8, r10, r11, lr}
-
- ldr r5, [sp,#32] /* objlast to temp reg */
-
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
-
- mov r0, r3 /* r0 explicitly set */
- mov r1, r5 /* objlast. might get overwritten */
- mov r5, #0 /* This will hold an offset of #4 or #8 if objlast or one arg couldn´t be placed into an "r" register */
-
- /* Load float and double args into d0-d7 and s0-s15 (r10 holds pointer to first float value) */
- add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
- mov r8, #0
- vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
-
- /* If there are no arguments to set into r0-r3 */
- /* go check if there are arguments for the stack */
- beq stackargsFuncR0ObjLast
-
- mov r5, r1 /* store objlast in r5 temporarily */
-
- /* Load the first 3 arguments into r1-r3 */
- cmp r7, #4
-
- it ge
- ldrge r1, [r6]
- cmp r7, #8
-
- it ge
- ldrge r2, [r6,#4]
-
- it lt
- movlt r2, r5
- cmp r7, #12
-
- it ge
- ldrge r3, [r6,#8]
-
- ittt lt
- movlt r3, r5
- movlt r5, #0 /* If objlast got placed into a register, r5 = 0 */
- blt stackargsFuncR0ObjLast /* If objlast got placed into a register, go to stackargsFuncR0ObjLast */
-
- cmp r7, #16 /* Else if we have one last arg set the offset accordingly and store the arg in the array */
-
- itt ge
- ldrge r7, [r6, #12]
- strge r7, [r6, #8]
-
- str r5, [r6, #12] /* Put objlast in r6 + 12 */
- mov r5, #0
-
- it ge
- movge r5, #4 /* Set r5 with an offset of #4 if there´s one last arg that couldn´t be placed in r registers */
- add r5, r5, #4 /* Set r5 with an offset of + #4, so objlast can be loaded into the stack */
-
-stackargsFuncR0ObjLast:
- ldr r7, [r6, #268] /* Load stack size into r7 */
- add r7, r7, r5 /* Add the offset placed in r5 (could be #0 or #4) */
- cmp r7, #0 /* Check for 0 args */
-
- /* If there are no args for the stack, branch */
- beq nomoreargsarmFuncR0ObjLast
-
- /* Load the rest of the arguments onto the stack */
- /* Ensure 8-byte stack alignment */
- mov r8, sp
- sub sp, sp, r7
- add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
-
- sub r12, sp, #8
- sub r6, r6, r5 /* r6 = r6 - r5 (r5 can be #0 or #4) */
- bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
- sub r8, r8, r12
- mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
-
-stackargslooparmFuncR0ObjLast:
- ldr r5, [r6], #4
- subs r7, r7, #4
- str r5, [sp], #4
- bne stackargslooparmFuncR0ObjLast
- mov sp, r12
-
-nomoreargsarmFuncR0ObjLast:
- blx r4
- add sp, sp, r8
- vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d10 to the address stored in r10 */
-
- pop {r4-r8, r10, r11, pc}
-
- .fnend
-
-/* --------------------------------------------------------------------------------------------*/
-armFuncR0:
- .fnstart
-
- push {r4-r8, r10, r11, lr}
-
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
- mov r11, #0 /* This will hold an offset of #4 only if the last arg that should have been placed into an "r" reg needs to go to the stack */
- mov r0, r3 /* r0 explicitly set */
-
- /* Load float and double args into d0-d7 and s0-s15 (r10 holds pointer to first float value) */
- add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
- mov r8, #0
- vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
-
- /* If there are no arguments to set into r0-r3 */
- /* go check if there are arguments for the stack */
- beq stackargsarmFuncR0
-
- /* Load the first 3 arguments into r1-r3 */
- cmp r7, #4
-
- it ge
- ldrge r1, [r6]
- cmp r7, #8
-
- it ge
- ldrge r2, [r6, #4]
- cmp r7, #12
-
- it ge
- ldrge r3, [r6, #8]
- cmp r7, #16
-
- it ge
- movge r11, #4 /* If there is still one arg to be placed, set the offset in r11 to #4 */
-
-stackargsarmFuncR0:
- ldr r5, [r6, #268] /* Load stack size into r5 */
- add r5, r11 /* Add the offset placed in r11 (could be #0 or #4) */
- movs r7, r5 /* Load stack size into r7, checking for 0 args */
-
- /* If there are no args for the stack, branch */
- beq nomoreargsarmFuncR0
-
- /* Load the rest of the arguments onto the stack */
- /* Ensure 8-byte stack alignment */
- mov r8, sp
- sub sp, sp, r7
- add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
-
- sub r12, sp, #8
- sub r6, r6, r11 /* r6 = r6 - r11 (r11 can be #0 or #4) */
- bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
- sub r8, r8, r12
- mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
-
-stackargslooparmFuncR0:
- ldr r5, [r6], #4
- subs r7, r7, #4
- str r5, [sp], #4
- bne stackargslooparmFuncR0
- mov sp, r12
-
-nomoreargsarmFuncR0:
- blx r4
- add sp, sp, r8
- vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d10 to the address stored in r10 */
-
- pop {r4-r8, r10, r11, pc}
-
- .fnend
-
-/* --------------------------------------------------------------------------------------------*/
-armFuncR0R1:
- .fnstart
-
- push {r4-r8, r10, r11, lr}
-
- mov r6, r0 /* arg table */
- movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
- mov r4, r2 /* function address */
- mov r11, #0 /* This will hold an offset of #4 or #8 only if the last arg (or last 2 args) that should have been placed into "r" regs need to go to the stack */
-
- mov r0, r3 /* r0 explicitly set */
- ldr r1, [sp, #32] /* r1 explicitly set too */
-
- /* Load float and double args into d0-d7 and s0-s15 (r10 holds pointer to first float value) */
- add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
- mov r8, #0
- vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
-
- /* If there are no arguments to set into r2-r3 */
- /* go check if there are arguments for the stack */
- beq stackargsarmFuncR0R1
-
- /* Load the first 2 arguments into r2-r3 */
- cmp r7, #4
-
- it ge
- ldrge r2, [r6]
- cmp r7, #8
-
- it ge
- ldrge r3, [r6, #4]
- cmp r7, #12
-
- it ge
- movge r11, #4 /* If there is a third arg to be placed, set the offset in r11 to #4 */
-
- cmp r7, #16
-
- it ge
- movge r11, #8 /* If there is a fourth arg to be placed, set the offset in r11 to #8 */
-
- itt lt
- ldrlt r7, [r6, #8] /* Else copy the third arg to the correct place in the array */
- strlt r7, [r6, #12]
-
-stackargsarmFuncR0R1:
- ldr r5, [r6, #268] /* Load stack size into r5 */
- add r5, r11 /* Add the offset placed in r11 (could be #0 or #4 or #8) */
- movs r7, r5 /* Load stack size into r7, checking for 0 args */
-
- /* If there are no args for the stack, branch */
- beq nomoreargsarmFuncR0R1
-
- /* Load the rest of the arguments onto the stack */
- /* Ensure 8-byte stack alignment */
- mov r8, sp
- sub sp, sp, r7
- add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
-
- sub r12, sp, #8
- sub r6, r6, r11 /* r6 = r6 - r11 (r11 can be #0 or #4 or #8) */
- bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
- sub r8, r8, r12
- mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
-
-stackargslooparmFuncR0R1:
- ldr r5, [r6], #4
- subs r7, r7, #4
- str r5, [sp], #4
- bne stackargslooparmFuncR0R1
- mov sp, r12
-
-nomoreargsarmFuncR0R1:
- blx r4
- add sp, sp, r8
- vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d10 to the address stored in r10 */
-
- pop {r4-r8, r10, r11, pc}
-
- .fnend
-
-#endif
-
-#endif /* !AS_MAX_PORTABILITY */
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_xcode.S b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_xcode.S
deleted file mode 100644
index e77277476b2..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_arm_xcode.S
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2015 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-
-// Assembly routines for the ARM call convention
-// Written by Fredrik Ehnbom in June 2009
-
-// Adapted to GNUC by darktemplar216 in September 2009
-// Small fixed to work under XCode GCC by Gilad Novik in October 2009
-
-#if !defined(AS_MAX_PORTABILITY)
-
-#if defined(__arm__) || defined(__ARM__)
-
-.align 2
-.globl _armFunc
-.globl _armFuncR0
-.globl _armFuncR0R1
-.globl _armFuncObjLast
-.globl _armFuncR0ObjLast
-
-_armFunc:
- stmdb sp!, {r4-r8, lr}
- mov r6, r0 // arg table
- movs r7, r1 // arg size (also set the condition code flags so that we detect if there are no arguments)
- mov r4, r2 // function address
- mov r8, #0
-
- beq nomoreargs
-
- // Load the first 4 arguments into r0-r3
- cmp r7, #4
- ldrge r0, [r6],#4
- cmp r7, #2*4
- ldrge r1, [r6],#4
- cmp r7, #3*4
- ldrge r2, [r6],#4
- cmp r7, #4*4
- ldrge r3, [r6],#4
- ble nomoreargs
-
- // Load the rest of the arguments onto the stack
- sub r7, r7, #4*4 // skip the 4 registers already loaded into r0-r3
- sub sp, sp, r7
- mov r8, r7
-stackargsloop:
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne stackargsloop
-nomoreargs:
- sub sp, sp, r8
- blx r4
- add sp, sp, r8
- ldmia sp!, {r4-r8, pc}
-
-_armFuncObjLast:
- stmdb sp!, {r4-r8, lr}
- mov r6, r0 // arg table
- movs r7, r1 // arg size (also set the condition code flags so that we detect if there are no arguments)
- mov r4, r2 // function address
- mov r8, #0
-
- mov r0, r3 // objlast. might get overwritten
- str r3, [sp, #-4]! // objlast again.
-
- beq nomoreargsarmFuncObjLast
-
- // Load the first 4 arguments into r0-r3
- cmp r7, #4
- ldrge r0, [r6],#4
- cmp r7, #2*4
- ldrge r1, [r6],#4
- ldrlt r1, [sp]
- cmp r7, #3*4
- ldrge r2, [r6],#4
- ldrlt r2, [sp]
- cmp r7, #4*4
- ldrge r3, [r6],#4
- ldrlt r3, [sp]
- ble nomoreargsarmFuncObjLast
-
- // Load the rest of the arguments onto the stack
- sub r7, r7, #4*4 // skip the 4 registers already loaded into r0-r3
- sub sp, sp, r7
- mov r8, r7
-stackargslooparmFuncObjLast:
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne stackargslooparmFuncObjLast
-nomoreargsarmFuncObjLast:
- sub sp, sp, r8
- blx r4
- add sp, sp, r8
- add sp, sp, #4
- ldmia sp!, {r4-r8, pc}
-
-_armFuncR0ObjLast:
- stmdb sp!, {r4-r8, lr}
- ldr r7, [sp,#6*4]
- str r7, [sp,#-4]!
-
- mov r6, r0 // arg table
- movs r7, r1 // arg size (also set the condition code flags so that we detect if there are no arguments)
- mov r4, r2 // function address
- mov r8, #0
-
- mov r0, r3 // r0 explicitly set
- ldr r1, [sp] // objlast. might get overwritten
-
- beq nomoreargsarmFuncR0ObjLast
-
- // Load the first 3 arguments into r1-r3
- cmp r7, #1*4
- ldrge r1, [r6],#4
- cmp r7, #2*4
- ldrge r2, [r6],#4
- ldrlt r2, [sp]
- cmp r7, #3*4
- ldrge r3, [r6],#4
- ldrlt r3, [sp]
- ble nomoreargsarmFuncR0ObjLast
-
- // Load the rest of the arguments onto the stack
- sub r7, r7, #3*4 // skip the 3 registers already loaded into r1-r3
- sub sp, sp, r7
- mov r8, r7
-stackargslooparmFuncR0ObjLast:
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne stackargslooparmFuncR0ObjLast
-nomoreargsarmFuncR0ObjLast:
- sub sp, sp, r8
- blx r4
- add sp, sp, r8
- add sp, sp, #4
- ldmia sp!, {r4-r8, pc}
-
-
-_armFuncR0:
- stmdb sp!, {r4-r8, lr}
- mov r6, r0 // arg table
- movs r7, r1 // arg size (also set the condition code flags so that we detect if there are no arguments)
- mov r4, r2 // function address
- mov r8, #0
-
- mov r0, r3 // r0 explicitly set
-
- beq nomoreargsarmFuncR0
-
- // Load the first 3 arguments into r1-r3
- cmp r7, #1*4
- ldrge r1, [r6],#4
- cmp r7, #2*4
- ldrge r2, [r6],#4
- cmp r7, #3*4
- ldrge r3, [r6],#4
- ble nomoreargsarmFuncR0
-
- // Load the rest of the arguments onto the stack
- sub r7, r7, #3*4 // skip the 3 registers already loaded into r1-r3
- sub sp, sp, r7
- mov r8, r7
-stackargslooparmFuncR0:
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne stackargslooparmFuncR0
-nomoreargsarmFuncR0:
- sub sp, sp, r8
- blx r4
- add sp, sp, r8
- ldmia sp!, {r4-r8, pc}
-
-
-_armFuncR0R1:
- stmdb sp!, {r4-r8, lr}
- mov r6, r0 // arg table
- movs r7, r1 // arg size (also set the condition code flags so that we detect if there are no arguments)
- mov r4, r2 // function address
- mov r8, #0
-
- mov r0, r3 // r0 explicitly set
- ldr r1, [sp, #6*4] // r1 explicitly set too
-
- beq nomoreargsarmFuncR0R1
-
- // Load the first 2 arguments into r2-r3
- cmp r7, #1*4
- ldrge r2, [r6],#4
- cmp r7, #2*4
- ldrge r3, [r6],#4
- ble nomoreargsarmFuncR0R1
-
- // Load the rest of the arguments onto the stack
- sub r7, r7, #2*4 // skip the 2 registers already loaded into r2-r3
- sub sp, sp, r7
- mov r8, r7
-stackargslooparmFuncR0R1:
- ldr r5, [r6], #4
- str r5, [sp], #4
- subs r7, r7, #4
- bne stackargslooparmFuncR0R1
-nomoreargsarmFuncR0R1:
- sub sp, sp, r8
- blx r4
- add sp, sp, r8
- ldmia sp!, {r4-r8, pc}
-
-#endif
-
-#endif /* !AS_MAX_PORTABILITY */
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_mips.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_mips.cpp
deleted file mode 100644
index be7d1895271..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_mips.cpp
+++ /dev/null
@@ -1,735 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2015 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-
-//
-// as_callfunc_mips.cpp
-//
-// These functions handle the actual calling of system functions
-//
-// This version is MIPS specific and was originally written
-// by Manu Evans in April, 2006 for Playstation Portable (PSP)
-//
-// Support for Linux with MIPS was added by Andreas Jonsson in April, 2015
-//
-
-
-#include "as_config.h"
-
-#ifndef AS_MAX_PORTABILITY
-#ifdef AS_MIPS
-
-#include "as_callfunc.h"
-#include "as_scriptengine.h"
-#include "as_texts.h"
-#include "as_tokendef.h"
-#include "as_context.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#if !defined(AS_ANDROID)
-#include <regdef.h>
-#endif
-
-BEGIN_AS_NAMESPACE
-
-#if defined(__linux__) && defined(_ABIO32)
-
-// The MIPS ABI used by Linux is implemented here
-// (Tested on CI20 MIPS Creator with Debian Linux)
-//
-// ref: SYSTEM V
-// APPLICATION BINARY INTERFACE
-// MIPS RISC Processor
-// http://math-atlas.sourceforge.net/devel/assembly/mipsabi32.pdf
-//
-// ref: MIPS Instruction Reference
-// http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html
-
-union SFloatRegs
-{
- union { double d0; struct { float f0; asDWORD dummy0; };};
- union { double d1; struct { float f1; asDWORD dummy1; };};
-} ;
-
-extern "C" asQWORD mipsFunc(asUINT argSize, asDWORD *argBuffer, void *func, SFloatRegs &floatRegs);
-asDWORD GetReturnedFloat();
-asQWORD GetReturnedDouble();
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/, void *secondObject)
-{
- asCScriptEngine *engine = context->m_engine;
- asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
- int callConv = sysFunc->callConv;
-
- asQWORD retQW = 0;
-
- void *func = (void*)sysFunc->func;
- void **vftable;
-
- asDWORD argBuffer[128]; // Ought to be big enough
- asASSERT( sysFunc->paramSize < 128 );
-
- asDWORD argOffset = 0;
-
- SFloatRegs floatRegs;
- asDWORD floatOffset = 0;
-
- // If the application function returns the value in memory then
- // the first argument must be the pointer to that memory
- if( sysFunc->hostReturnInMemory )
- {
- asASSERT( retPointer );
- argBuffer[argOffset++] = (asPWORD)retPointer;
- }
-
- if( callConv == ICC_CDECL_OBJFIRST || callConv == ICC_CDECL_OBJFIRST_RETURNINMEM ||
- callConv == ICC_THISCALL || callConv == ICC_THISCALL_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL || callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM ||
- callConv == ICC_THISCALL_OBJFIRST || callConv == ICC_VIRTUAL_THISCALL_OBJFIRST ||
- callConv == ICC_THISCALL_OBJFIRST_RETURNINMEM || callConv == ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM ||
- callConv == ICC_THISCALL_OBJLAST || callConv == ICC_VIRTUAL_THISCALL_OBJLAST ||
- callConv == ICC_THISCALL_OBJLAST_RETURNINMEM || callConv == ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM )
- {
- // Add the object pointer as the first argument
- argBuffer[argOffset++] = (asPWORD)obj;
- }
-
- if( callConv == ICC_THISCALL_OBJFIRST || callConv == ICC_VIRTUAL_THISCALL_OBJFIRST ||
- callConv == ICC_THISCALL_OBJFIRST_RETURNINMEM || callConv == ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM )
- {
- // Add the second object pointer
- argBuffer[argOffset++] = (asPWORD)secondObject;
- }
-
- int spos = 0;
- for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
- {
- asCDataType ¶mType = descr->parameterTypes[n];
- if( paramType.IsObject() && !paramType.IsObjectHandle() && !paramType.IsReference() )
- {
- if( paramType.GetTypeInfo()->flags & COMPLEX_MASK )
- {
- // The object is passed by reference
- argBuffer[argOffset++] = args[spos++];
- }
- else
- {
- // Ensure 8byte alignment for classes that need it
- if( (paramType.GetTypeInfo()->flags & asOBJ_APP_CLASS_ALIGN8) && (argOffset & 1) )
- argOffset++;
-
- // Copy the object's memory to the buffer
- memcpy(&argBuffer[argOffset], *(void**)(args+spos), paramType.GetSizeInMemoryBytes());
- // Delete the original memory
- engine->CallFree(*(char**)(args+spos));
- spos++;
- argOffset += paramType.GetSizeInMemoryDWords();
- }
- }
- else if( paramType.GetTokenType() == ttQuestion )
- {
- // Copy both pointer and type id
- argBuffer[argOffset++] = args[spos++];
- argBuffer[argOffset++] = args[spos++];
- }
- else
- {
- // The first 2 floats or doubles are loaded into the float registers.
- // Actually this is only done if they are the first arguments to the function,
- // but it doesn't cause any harm to load them into the registers even if they
- // won't be used so we don't need to check if they really are the first args.
- if( floatOffset == 0 )
- {
- if( paramType.GetTokenType() == ttFloat )
- floatRegs.f0 = *reinterpret_cast<float*>(&args[spos]);
- else if( paramType.GetTokenType() == ttDouble )
- floatRegs.d0 = *reinterpret_cast<double*>(&args[spos]);
- floatOffset++;
- }
- else if( floatOffset == 1 )
- {
- if( paramType.GetTokenType() == ttFloat )
- floatRegs.f1 = *reinterpret_cast<float*>(&args[spos]);
- else if( paramType.GetTokenType() == ttDouble )
- floatRegs.d1 = *reinterpret_cast<double*>(&args[spos]);
- floatOffset++;
- }
-
- // Copy the value directly
- if( paramType.GetSizeOnStackDWords() > 1 )
- {
- // Make sure the argument is 8byte aligned
- if( argOffset & 1 )
- argOffset++;
- *reinterpret_cast<asQWORD*>(&argBuffer[argOffset]) = *reinterpret_cast<asQWORD*>(&args[spos]);
- argOffset += 2;
- spos += 2;
- }
- else
- argBuffer[argOffset++] = args[spos++];
- }
- }
-
- if( callConv == ICC_CDECL_OBJLAST || callConv == ICC_CDECL_OBJLAST_RETURNINMEM )
- {
- // Add the object pointer as the last argument
- argBuffer[argOffset++] = (asPWORD)obj;
- }
-
- if( callConv == ICC_THISCALL_OBJLAST || callConv == ICC_VIRTUAL_THISCALL_OBJLAST ||
- callConv == ICC_THISCALL_OBJLAST_RETURNINMEM || callConv == ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM )
- {
- // Add the second object pointer
- argBuffer[argOffset++] = (asPWORD)secondObject;
- }
-
- switch( callConv )
- {
- case ICC_CDECL:
- case ICC_CDECL_RETURNINMEM:
- case ICC_STDCALL:
- case ICC_STDCALL_RETURNINMEM:
- case ICC_CDECL_OBJLAST:
- case ICC_CDECL_OBJLAST_RETURNINMEM:
- case ICC_CDECL_OBJFIRST:
- case ICC_CDECL_OBJFIRST_RETURNINMEM:
- case ICC_THISCALL:
- case ICC_THISCALL_RETURNINMEM:
- case ICC_THISCALL_OBJFIRST:
- case ICC_THISCALL_OBJFIRST_RETURNINMEM:
- case ICC_THISCALL_OBJLAST:
- case ICC_THISCALL_OBJLAST_RETURNINMEM:
- retQW = mipsFunc(argOffset*4, argBuffer, func, floatRegs);
- break;
-
- case ICC_VIRTUAL_THISCALL:
- case ICC_VIRTUAL_THISCALL_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_OBJFIRST:
- case ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_OBJLAST:
- case ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM:
- // Get virtual function table from the object pointer
- vftable = *(void***)obj;
- retQW = mipsFunc(argOffset*4, argBuffer, vftable[asPWORD(func)>>2], floatRegs);
- break;
- default:
- context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
- }
-
- // If the return is a float value we need to get the value from the FP register
- if( sysFunc->hostReturnFloat )
- {
- if( sysFunc->hostReturnSize == 1 )
- *(asDWORD*)&retQW = GetReturnedFloat();
- else
- retQW = GetReturnedDouble();
- }
-
- return retQW;
-}
-
-asDWORD GetReturnedFloat()
-{
- asDWORD f;
-
- asm("swc1 $f0, %0\n" : "=m"(f));
-
- return f;
-}
-
-asQWORD GetReturnedDouble()
-{
- asQWORD d = 0;
-
- asm("sdc1 $f0, %0\n" : "=m"(d));
-
- return d;
-}
-
-// asQWORD mipsFunc(asUINT argSize, asDWORD *argBuffer, void *func, SFloatRegs &floatRegs);
-// $2,$3 $4 $5 $6 $7
-asm(
-" .text\n"
-//" .align 2\n"
-" .cfi_startproc\n"
-" .global mipsFunc\n"
-" .ent mipsFunc\n"
-"mipsFunc:\n"
-//" .frame $fp,64,$31 # vars= 0, regs= 0/0, args= 0, gp= 0\n"
-//" .mask 0x00000000,0\n"
-//" .fmask 0x00000000,0\n"
-" .set noreorder\n"
-" .set nomacro\n"
-
-// align the stack frame to 8 bytes
-" addiu $12, $4, 7\n" // t4 ($12) = argSize ($4) + 7
-" li $13, -8\n" // t5 ($13) = 0xfffffffffffffff8
-" and $12, $12, $13\n" // t4 ($12) &= t5 ($13). t4 holds the size of the argument block
-// It is required that the caller reserves space for at least 16 bytes even if there are less than 4 arguments
-// and add 8 bytes for the return pointer and s0 ($16) backup
-" addiu $13, $12, 24\n" // t5 = t4 + 24. t5 ($13) holds the total size of the stack frame (including return pointer)
-// save the s0 register (so we can use it to remember where our return pointer is lives)
-" sw $16, -4($sp)\n" // store the s0 register (so we can use it to remember how big our stack frame is)
-" .cfi_offset 16, -4\n"
-// store the return pointer
-" sw $31, -8($sp)\n"
-" .cfi_offset 31, -8\n"
-// keep original stack pointer
-" move $16, $sp\n"
-" .cfi_def_cfa_register 16\n"
-// push the stack
-" subu $sp, $sp, $13\n"
-
-// store the argument in temporary registers
-" addiu $25, $6, 0\n" // t9 ($25) holds the function pointer (must be t9 for position independent code)
-" addiu $3, $4, 0\n" // v1 ($3) holds the size of the argument buffer
-" move $15, $5\n" // t7 ($15) holds the pointer to the argBuffer
-" move $14, $7\n" // t6 ($14) holds the values for the float registers
-
-// load integer registers
-" lw $4, 0($15)\n" // a0 ($4)
-" lw $5, 4($15)\n" // a1 ($5)
-" lw $6, 8($15)\n" // a2 ($6)
-" lw $7, 12($15)\n" // a3 ($7)
-
-// load float registers
-" ldc1 $f12, 8($14)\n"
-" ldc1 $f14, 0($14)\n"
-
-// skip stack parameters if there are 4 or less as they are moved into the registers
-" addi $14, $3, -16\n" // The first 4 args were already loaded into registers
-" blez $14, andCall\n"
-" nop\n"
-
-// push stack parameters
-"pushArgs:\n"
-" addi $3, -4\n"
-// load from $15 + stack bytes ($3)
-" addu $14, $15, $3\n"
-" lw $14, 0($14)\n"
-// store to $sp + stack bytes ($3)
-" addu $13, $sp, $3\n"
-" sw $14, 0($13)\n"
-// if there are more, loop...
-" bne $3, $0, pushArgs\n"
-" nop\n"
-
-// and call the function
-"andCall:\n"
-" jalr $25\n"
-" nop\n"
-
-// restore original stack pointer
-" move $sp, $16\n"
-// restore the return pointer
-" lw $31, -8($sp)\n"
-// restore the original value of $16
-" lw $16, -4($sp)\n"
-// and return from the function
-" jr $31\n"
-" nop\n"
-
-" .set macro\n"
-" .set reorder\n"
-" .end mipsFunc\n"
-" .cfi_endproc\n"
-" .size mipsFunc, .-mipsFunc\n"
-);
-
-#else // !(defined(__linux__) && defined(_ABIO32))
-
-// The MIPS ABI used by PSP and PS2 is implemented here
-
-#define AS_MIPS_MAX_ARGS 32
-#define AS_NUM_REG_FLOATS 8
-#define AS_NUM_REG_INTS 8
-
-// The array used to send values to the correct places.
-// first 0-8 regular values to load into the a0-a3, t0-t3 registers
-// then 0-8 float values to load into the f12-f19 registers
-// then (AS_MIPS_MAX_ARGS - 16) values to load onto the stack
-// the +1 is for when CallThis (object methods) is used
-// extra +1 when returning in memory
-extern "C" {
-// TODO: This array shouldn't be global. It should be a local array in CallSystemFunctionNative
-asDWORD mipsArgs[AS_MIPS_MAX_ARGS + 1 + 1];
-}
-
-// Loads all data into the correct places and calls the function.
-// intArgSize is the size in bytes for how much data to put in int registers
-// floatArgSize is the size in bytes for how much data to put in float registers
-// stackArgSize is the size in bytes for how much data to put on the callstack
-extern "C" asQWORD mipsFunc(int intArgSize, int floatArgSize, int stackArgSize, asDWORD func);
-
-// puts the arguments in the correct place in the mipsArgs-array. See comments above.
-// This could be done better.
-inline void splitArgs(const asDWORD *args, int argNum, int &numRegIntArgs, int &numRegFloatArgs, int &numRestArgs, int hostFlags)
-{
- int i;
-
- int argBit = 1;
- for (i = 0; i < argNum; i++)
- {
- if (hostFlags & argBit)
- {
- if (numRegFloatArgs < AS_NUM_REG_FLOATS)
- {
- // put in float register
- mipsArgs[AS_NUM_REG_INTS + numRegFloatArgs] = args[i];
- numRegFloatArgs++;
- }
- else
- {
- // put in stack
- mipsArgs[AS_NUM_REG_INTS + AS_NUM_REG_FLOATS + numRestArgs] = args[i];
- numRestArgs++;
- }
- }
- else
- {
- if (numRegIntArgs < AS_NUM_REG_INTS)
- {
- // put in int register
- mipsArgs[numRegIntArgs] = args[i];
- numRegIntArgs++;
- }
- else
- {
- // put in stack
- mipsArgs[AS_NUM_REG_INTS + AS_NUM_REG_FLOATS + numRestArgs] = args[i];
- numRestArgs++;
- }
- }
- argBit <<= 1;
- }
-}
-
-asQWORD CallCDeclFunction(const asDWORD *args, int argSize, asDWORD func, int flags)
-{
- int argNum = argSize >> 2;
-
- int intArgs = 0;
- int floatArgs = 0;
- int restArgs = 0;
-
- // put the arguments in the correct places in the mipsArgs array
- if(argNum > 0)
- splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags);
-
- return mipsFunc(intArgs << 2, floatArgs << 2, restArgs << 2, func);
-}
-
-// This function is identical to CallCDeclFunction, with the only difference that
-// the value in the first parameter is the object
-asQWORD CallThisCallFunction(const void *obj, const asDWORD *args, int argSize, asDWORD func, int flags)
-{
- int argNum = argSize >> 2;
-
- int intArgs = 1;
- int floatArgs = 0;
- int restArgs = 0;
-
- mipsArgs[0] = (asDWORD) obj;
-
- // put the arguments in the correct places in the mipsArgs array
- if (argNum > 0)
- splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags);
-
- return mipsFunc(intArgs << 2, floatArgs << 2, restArgs << 2, func);
-}
-
-// This function is identical to CallCDeclFunction, with the only difference that
-// the value in the last parameter is the object
-asQWORD CallThisCallFunction_objLast(const void *obj, const asDWORD *args, int argSize, asDWORD func, int flags)
-{
- int argNum = argSize >> 2;
-
- int intArgs = 0;
- int floatArgs = 0;
- int restArgs = 0;
-
- // put the arguments in the correct places in the mipsArgs array
- if(argNum > 0)
- splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags);
-
- if(intArgs < AS_NUM_REG_INTS)
- {
- mipsArgs[intArgs] = (asDWORD) obj;
- intArgs++;
- }
- else
- {
- mipsArgs[AS_NUM_REG_INTS + AS_NUM_REG_FLOATS + restArgs] = (asDWORD) obj;
- restArgs++;
- }
-
- return mipsFunc(intArgs << 2, floatArgs << 2, restArgs << 2, func);
-}
-
-asDWORD GetReturnedFloat()
-{
- asDWORD f;
-
- asm("swc1 $f0, %0\n" : "=m"(f));
-
- return f;
-}
-
-asQWORD GetReturnedDouble()
-{
- asQWORD d = 0;
-
- asm("sdc1 $f0, %0\n" : "=m"(d));
-
- return d;
-}
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/, void */*secondObject*/)
-{
- asCScriptEngine *engine = context->m_engine;
- asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
- int callConv = sysFunc->callConv;
-
- // TODO: Mips does not yet support THISCALL_OBJFIRST/LAST
-
- asQWORD retQW = 0;
-
- void *func = (void*)sysFunc->func;
- int paramSize = sysFunc->paramSize;
- asDWORD *vftable;
-
- if( descr->returnType.IsObject() && !descr->returnType.IsReference() && !descr->returnType.IsObjectHandle() )
- {
- mipsArgs[AS_MIPS_MAX_ARGS+1] = (asDWORD) retPointer;
- }
-
- asASSERT(descr->parameterTypes.GetLength() <= AS_MIPS_MAX_ARGS);
-
- // mark all float arguments
- int argBit = 1;
- int hostFlags = 0;
- int intArgs = 0;
- for( size_t a = 0; a < descr->parameterTypes.GetLength(); a++ )
- {
- if (descr->parameterTypes[a].IsFloatType())
- hostFlags |= argBit;
- else
- intArgs++;
- argBit <<= 1;
- }
-
- asDWORD paramBuffer[64];
- if( sysFunc->takesObjByVal )
- {
- paramSize = 0;
- int spos = 0;
- int dpos = 1;
- for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
- {
- if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
- {
-#ifdef COMPLEX_OBJS_PASSED_BY_REF
- if( descr->parameterTypes[n].GetTypeInfo()->flags & COMPLEX_MASK )
- {
- paramBuffer[dpos++] = args[spos++];
- paramSize++;
- }
- else
-#endif
- {
- // Copy the object's memory to the buffer
- memcpy(¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
- // Delete the original memory
- engine->CallFree(*(char**)(args+spos));
- spos++;
- dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
- paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
- }
- }
- else
- {
- // Copy the value directly
- paramBuffer[dpos++] = args[spos++];
- if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
- paramBuffer[dpos++] = args[spos++];
- paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
- }
- }
- // Keep a free location at the beginning
- args = ¶mBuffer[1];
- }
-
- switch( callConv )
- {
- case ICC_CDECL:
- case ICC_CDECL_RETURNINMEM:
- case ICC_STDCALL:
- case ICC_STDCALL_RETURNINMEM:
- retQW = CallCDeclFunction(args, paramSize<<2, (asDWORD)func, hostFlags);
- break;
- case ICC_THISCALL:
- case ICC_THISCALL_RETURNINMEM:
- retQW = CallThisCallFunction(obj, args, paramSize<<2, (asDWORD)func, hostFlags);
- break;
- case ICC_VIRTUAL_THISCALL:
- case ICC_VIRTUAL_THISCALL_RETURNINMEM:
- // Get virtual function table from the object pointer
- vftable = *(asDWORD**)obj;
- retQW = CallThisCallFunction(obj, args, paramSize<<2, vftable[asDWORD(func)>>2], hostFlags);
- break;
- case ICC_CDECL_OBJLAST:
- case ICC_CDECL_OBJLAST_RETURNINMEM:
- retQW = CallThisCallFunction_objLast(obj, args, paramSize<<2, (asDWORD)func, hostFlags);
- break;
- case ICC_CDECL_OBJFIRST:
- case ICC_CDECL_OBJFIRST_RETURNINMEM:
- retQW = CallThisCallFunction(obj, args, paramSize<<2, (asDWORD)func, hostFlags);
- break;
- default:
- context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
- }
-
- // If the return is a float value we need to get the value from the FP register
- if( sysFunc->hostReturnFloat )
- {
- if( sysFunc->hostReturnSize == 1 )
- *(asDWORD*)&retQW = GetReturnedFloat();
- else
- retQW = GetReturnedDouble();
- }
-
- return retQW;
-}
-
-
-asm(
-" .text\n"
-//" .align 2\n"
-" .global mipsFunc\n"
-" .ent mipsFunc\n"
-"mipsFunc:\n"
-//" .frame $fp,64,$31 # vars= 0, regs= 0/0, args= 0, gp= 0\n"
-//" .mask 0x00000000,0\n"
-//" .fmask 0x00000000,0\n"
-" .set noreorder\n"
-" .set nomacro\n"
-// align the stack frame to 8 bytes
-" addiu $12, $6, 7\n"
-" li $13, -8\n" // 0xfffffffffffffff8
-" and $12, $12, $13\n" // t4 holds the size of the argument block
-// and add 8 bytes for the return pointer and s0 backup
-" addiu $13, $12, 8\n" // t5 holds the total size of the stack frame (including return pointer)
-// save the s0 register (so we can use it to remember where our return pointer is lives)
-" sw $16, -4($sp)\n" // store the s0 register (so we can use it to remember how big our stack frame is)
-// push the stack
-" subu $sp, $sp, $13\n"
-// find the return address, place in s0
-" addu $16, $sp, $12\n"
-// store the return pointer
-" sw $31, 0($16)\n"
-
-// backup our function params
-" addiu $2, $7, 0\n"
-" addiu $3, $6, 0\n"
-
-// get global mipsArgs[] array pointer
-//" lui $15, %hi(mipsArgs)\n"
-//" addiu $15, $15, %lo(mipsArgs)\n"
-// we'll use the macro instead because SN Systems doesnt like %hi/%lo
-".set macro\n"
-" la $15, mipsArgs\n"
-".set nomacro\n"
-// load register params
-" lw $4, 0($15)\n"
-" lw $5, 4($15)\n"
-" lw $6, 8($15)\n"
-" lw $7, 12($15)\n"
-" lw $8, 16($15)\n"
-" lw $9, 20($15)\n"
-" lw $10, 24($15)\n"
-" lw $11, 28($15)\n"
-
-// load float params
-" lwc1 $f12, 32($15)\n"
-" lwc1 $f13, 36($15)\n"
-" lwc1 $f14, 40($15)\n"
-" lwc1 $f15, 44($15)\n"
-" lwc1 $f16, 48($15)\n"
-" lwc1 $f17, 52($15)\n"
-" lwc1 $f18, 56($15)\n"
-" lwc1 $f19, 60($15)\n"
-
-// skip stack paramaters if there are none
-" beq $3, $0, andCall\n"
-
-// push stack paramaters
-" addiu $15, $15, 64\n"
-"pushArgs:\n"
-" addiu $3, -4\n"
-// load from $15 + stack bytes ($3)
-" addu $14, $15, $3\n"
-" lw $14, 0($14)\n"
-// store to $sp + stack bytes ($3)
-" addu $13, $sp, $3\n"
-" sw $14, 0($13)\n"
-// if there are more, loop...
-" bne $3, $0, pushArgs\n"
-" nop\n"
-
-// and call the function
-"andCall:\n"
-" jal $2\n"
-" nop\n"
-
-// restore the return pointer
-" lw $31, 0($16)\n"
-// pop the stack pointer (remembering the return pointer was 8 bytes below the top)
-" addiu $sp, $16, 8\n"
-// and return from the function
-" jr $31\n"
-// restore the s0 register (in the branch delay slot)
-" lw $16, -4($sp)\n"
-" .set macro\n"
-" .set reorder\n"
-" .end mipsFunc\n"
-" .size mipsFunc, .-mipsFunc\n"
-);
-
-#endif // PSP and PS2 MIPS ABI
-
-END_AS_NAMESPACE
-
-#endif // AS_MIPS
-#endif // AS_MAX_PORTABILITY
-
-
-
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_ppc.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_ppc.cpp
deleted file mode 100644
index 053221fe943..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_ppc.cpp
+++ /dev/null
@@ -1,674 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2015 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-
-//
-// as_callfunc_ppc.cpp
-//
-// These functions handle the actual calling of system functions
-//
-// This version is PPC specific
-//
-
-#include <stdio.h>
-
-#include "as_config.h"
-
-#ifndef AS_MAX_PORTABILITY
-#ifdef AS_PPC
-
-#include "as_callfunc.h"
-#include "as_scriptengine.h"
-#include "as_texts.h"
-#include "as_tokendef.h"
-#include "as_context.h"
-
-#include <stdlib.h>
-
-BEGIN_AS_NAMESPACE
-
-// This part was originally written by Pecan Heber, June 2006, for
-// use on MacOS X with 32bit PPC processor. He based the code on the
-// code in as_callfunc_sh4.cpp
-
-#define AS_PPC_MAX_ARGS 32
-
-// The array used to send values to the correct places.
-// Contains a byte of argTypes to indicate the register tYpe to load
-// or zero if end of arguments
-// The +1 is for when CallThis (object methods) is used
-// Extra +1 when returning in memory
-// Extra +1 in ppcArgsType to ensure zero end-of-args marker
-
-// TODO: multithread: We need to remove these global variables for thread-safety
-
-enum argTypes { ppcENDARG, ppcINTARG, ppcFLOATARG, ppcDOUBLEARG };
-static asDWORD ppcArgs[2*AS_PPC_MAX_ARGS + 1 + 1];
-
-// Using extern "C" because we use this symbol name in the assembly code
-extern "C"
-{
- static asBYTE ppcArgsType[2*AS_PPC_MAX_ARGS + 1 + 1 + 1];
-}
-
-// NOTE: these values are for PowerPC 32 bit.
-#define PPC_LINKAGE_SIZE (24) // how big the PPC linkage area is in a stack frame
-#define PPC_NUM_REGSTORE (9) // how many registers of the PPC we need to store/restore for ppcFunc()
-#define PPC_REGSTORE_SIZE (4*PPC_NUM_REGSTORE) // how many bytes are required for register store/restore
-#define EXTRA_STACK_SIZE (PPC_LINKAGE_SIZE + PPC_REGSTORE_SIZE) // memory required, not including parameters, for the stack frame
-#define PPC_STACK_SIZE(numParams) (-( ( ((((numParams)<8)?8:(numParams))<<2) + EXTRA_STACK_SIZE + 15 ) & ~15 )) // calculates the total stack size needed for ppcFunc64, must pad to 16bytes
-
-// Loads all data into the correct places and calls the function.
-// ppcArgsType is an array containing a byte type (enum argTypes) for each argument.
-// stackArgSize is the size in bytes for how much data to put on the stack frame
-extern "C" asQWORD ppcFunc(const asDWORD* argsPtr, int StackArgSize, asDWORD func);
-
-asm(" .text\n"
- " .align 2\n" // align the code to 1 << 2 = 4 bytes
- " .globl _ppcFunc\n"
- "_ppcFunc:\n"
-
- // We're receiving the following parameters
-
- // r3 : argsPtr
- // r4 : StackArgSize
- // r5 : func
-
- // The following registers are used through out the function
-
- // r31 : the address of the label address, as reference for all other labels
- // r30 : temporary variable
- // r29 : arg list pointer
- // r28 : number of FPR registers used by the parameters
- // r27 : the function pointer that will be called
- // r26 : the location of the parameters for the call
- // r25 : arg type list pointer
- // r24 : temporary variable
- // r23 : number of GPR registers used by the parameters
- // r1 : this is stack pointer
- // r0 : temporary variable
- // f0 : temporary variable
-
- // We need to store some of the registers for restoral before returning to caller
-
- // lr - always stored in 8(r1) - this is the return address
- // cr - not required to be stored, but if it is, its place is in 4(r1) - this is the condition register
- // r1 - always stored in 0(r1) - this is the stack pointer
- // r11
- // r13 to r31
- // f14 to f31
-
- // Store register values and setup our stack frame
- " mflr r0 \n" // move the return address into r0
- " stw r0, 8(r1) \n" // Store the return address on the stack
- " stmw r23, -36(r1) \n" // Store registers r23 to r31 on the stack
- " stwux r1, r1, r4 \n" // Increase the stack with the needed space and store the original value in the destination
-
- // Obtain an address that we'll use as our position of reference when obtaining addresses of other labels
- " bl address \n"
- "address: \n"
- " mflr r31 \n"
-
- // initial registers for the function
- " mr r29, r3 \n" // (r29) args list
- " mr r27, r5 \n" // load the function pointer to call. func actually holds the pointer to our function
- " addi r26, r1, 24 \n" // setup the pointer to the parameter area to the function we're going to call
- " sub r0, r0, r0 \n" // zero out r0
- " mr r23, r0 \n" // zero out r23, which holds the number of used GPR registers
- " mr r28, r0 \n" // zero our r22, which holds the number of used float registers
-
- // load the global ppcArgsType which holds the types of arguments for each argument
- " addis r25, r31, ha16(_ppcArgsType - address) \n" // load the upper 16 bits of the address to r25
- " la r25, lo16(_ppcArgsType - address)(r25) \n" // load the lower 16 bits of the address to r25
- " subi r25, r25, 1 \n" // since we increment r25 on its use, we'll pre-decrement it
-
- // loop through the arguments
- "ppcNextArg: \n"
- " addi r25, r25, 1 \n" // increment r25, our arg type pointer
- // switch based on the current argument type (0:end, 1:int, 2:float 3:double)
- " lbz r24, 0(r25) \n" // load the current argument type (it's a byte)
- " mulli r24, r24, 4 \n" // our jump table has 4 bytes per case (1 instruction)
- " addis r30, r31, ha16(ppcTypeSwitch - address) \n" // load the address of the jump table for the switch
- " la r30, lo16(ppcTypeSwitch - address)(r30) \n"
-
- " add r0, r30, r24 \n" // offset by our argument type
- " mtctr r0 \n" // load the jump address into CTR
- " bctr \n" // jump into the jump table/switch
- " nop \n"
-
- // the jump table/switch based on the current argument type
- "ppcTypeSwitch: \n"
- " b ppcArgsEnd \n"
- " b ppcArgIsInteger \n"
- " b ppcArgIsFloat \n"
- " b ppcArgIsDouble \n"
-
- // when we get here we have finished processing all the arguments
- // everything is ready to go to call the function
- "ppcArgsEnd: \n"
- " mtctr r27 \n" // the function pointer is stored in r27, load that into CTR
- " bctrl \n" // call the function. We have to do it this way so that the LR gets the proper
- " nop \n" // return value (the next instruction below). So we have to branch from CTR instead of LR.
-
- // Restore registers and caller's stack frame, then return to caller
- " lwz r1, 0(r1) \n" // restore the caller's stack pointer
- " lwz r0, 8(r1) \n" // load in the caller's LR
- " mtlr r0 \n" // restore the caller's LR
- " lmw r23, -36(r1) \n" // restore registers r23 to r31 from the stack
- " blr \n" // return back to the caller
- " nop \n"
-
- // Integer argument (GPR register)
- "ppcArgIsInteger: \n"
- " addis r30, r31, ha16(ppcLoadIntReg - address) \n" // load the address to the jump table for integer registers
- " la r30, lo16(ppcLoadIntReg - address)(r30) \n"
- " mulli r0, r23, 8 \n" // each item in the jump table is 2 instructions (8 bytes)
- " add r0, r0, r30 \n" // calculate ppcLoadIntReg[numUsedGPRRegs]
- " lwz r30, 0(r29) \n" // load the next argument from the argument list into r30
- " cmpwi r23, 8 \n" // we can only load GPR3 through GPR10 (8 registers)
- " bgt ppcLoadIntRegUpd \n" // if we're beyond 8 GPR registers, we're in the stack, go there
- " mtctr r0 \n" // load the address of our ppcLoadIntReg jump table (we're below 8 GPR registers)
- " bctr \n" // load the argument into a GPR register
- " nop \n"
- // jump table for GPR registers, for the first 8 GPR arguments
- "ppcLoadIntReg: \n"
- " mr r3, r30 \n" // arg0 (to r3)
- " b ppcLoadIntRegUpd \n"
- " mr r4, r30 \n" // arg1 (to r4)
- " b ppcLoadIntRegUpd \n"
- " mr r5, r30 \n" // arg2 (to r5)
- " b ppcLoadIntRegUpd \n"
- " mr r6, r30 \n" // arg3 (to r6)
- " b ppcLoadIntRegUpd \n"
- " mr r7, r30 \n" // arg4 (to r7)
- " b ppcLoadIntRegUpd \n"
- " mr r8, r30 \n" // arg5 (to r8)
- " b ppcLoadIntRegUpd \n"
- " mr r9, r30 \n" // arg6 (to r9)
- " b ppcLoadIntRegUpd \n"
- " mr r10, r30 \n" // arg7 (to r10)
- " b ppcLoadIntRegUpd \n"
- // all GPR arguments still go on the stack
- "ppcLoadIntRegUpd: \n"
- " stw r30, 0(r26) \n" // store the argument into the next slot on the stack's argument list
- " addi r23, r23, 1 \n" // count a used GPR register
- " addi r29, r29, 4 \n" // move to the next argument on the list
- " addi r26, r26, 4 \n" // adjust our argument stack pointer for the next
- " b ppcNextArg \n" // next argument
-
- // single Float argument
- "ppcArgIsFloat:\n"
- " addis r30, r31, ha16(ppcLoadFloatReg - address) \n" // get the base address of the float register jump table
- " la r30, lo16(ppcLoadFloatReg - address)(r30) \n"
- " mulli r0, r28, 8 \n" // each jump table entry is 8 bytes
- " add r0, r0, r30 \n" // calculate the offset to ppcLoadFloatReg[numUsedFloatReg]
- " lfs f0, 0(r29) \n" // load the next argument as a float into f0
- " cmpwi r28, 13 \n" // can't load more than 13 float/double registers
- " bgt ppcLoadFloatRegUpd \n" // if we're beyond 13 registers, just fall to inserting into the stack
- " mtctr r0 \n" // jump into the float jump table
- " bctr \n"
- " nop \n"
- // jump table for float registers, for the first 13 float arguments
- "ppcLoadFloatReg: \n"
- " fmr f1, f0 \n" // arg0 (f1)
- " b ppcLoadFloatRegUpd \n"
- " fmr f2, f0 \n" // arg1 (f2)
- " b ppcLoadFloatRegUpd \n"
- " fmr f3, f0 \n" // arg2 (f3)
- " b ppcLoadFloatRegUpd \n"
- " fmr f4, f0 \n" // arg3 (f4)
- " b ppcLoadFloatRegUpd \n"
- " fmr f5, f0 \n" // arg4 (f5)
- " b ppcLoadFloatRegUpd \n"
- " fmr f6, f0 \n" // arg5 (f6)
- " b ppcLoadFloatRegUpd \n"
- " fmr f7, f0 \n" // arg6 (f7)
- " b ppcLoadFloatRegUpd \n"
- " fmr f8, f0 \n" // arg7 (f8)
- " b ppcLoadFloatRegUpd \n"
- " fmr f9, f0 \n" // arg8 (f9)
- " b ppcLoadFloatRegUpd \n"
- " fmr f10, f0 \n" // arg9 (f10)
- " b ppcLoadFloatRegUpd \n"
- " fmr f11, f0 \n" // arg10 (f11)
- " b ppcLoadFloatRegUpd \n"
- " fmr f12, f0 \n" // arg11 (f12)
- " b ppcLoadFloatRegUpd \n"
- " fmr f13, f0 \n" // arg12 (f13)
- " b ppcLoadFloatRegUpd \n"
- " nop \n"
- // all float arguments still go on the stack
- "ppcLoadFloatRegUpd: \n"
- " stfs f0, 0(r26) \n" // store, as a single float, f0 (current argument) on to the stack argument list
- " addi r23, r23, 1 \n" // a float register eats up a GPR register
- " addi r28, r28, 1 \n" // ...and, of course, a float register
- " addi r29, r29, 4 \n" // move to the next argument in the list
- " addi r26, r26, 4 \n" // move to the next stack slot
- " b ppcNextArg \n" // on to the next argument
- " nop \n"
-
- // double Float argument
- "ppcArgIsDouble: \n"
- " addis r30, r31, ha16(ppcLoadDoubleReg - address) \n" // load the base address of the jump table for double registers
- " la r30, lo16(ppcLoadDoubleReg - address)(r30) \n"
- " mulli r0, r28, 8 \n" // each slot of the jump table is 8 bytes
- " add r0, r0, r30 \n" // calculate ppcLoadDoubleReg[numUsedFloatReg]
- " lfd f0, 0(r29) \n" // load the next argument, as a double float, into f0
- " cmpwi r28, 13 \n" // the first 13 floats must go into float registers also
- " bgt ppcLoadDoubleRegUpd \n" // if we're beyond 13, then just put on to the stack
- " mtctr r0 \n" // we're under 13, first load our register
- " bctr \n" // jump into the jump table
- " nop \n"
- // jump table for float registers, for the first 13 float arguments
- "ppcLoadDoubleReg: \n"
- " fmr f1, f0 \n" // arg0 (f1)
- " b ppcLoadDoubleRegUpd \n"
- " fmr f2, f0 \n" // arg1 (f2)
- " b ppcLoadDoubleRegUpd \n"
- " fmr f3, f0 \n" // arg2 (f3)
- " b ppcLoadDoubleRegUpd \n"
- " fmr f4, f0 \n" // arg3 (f4)
- " b ppcLoadDoubleRegUpd \n"
- " fmr f5, f0 \n" // arg4 (f5)
- " b ppcLoadDoubleRegUpd \n"
- " fmr f6, f0 \n" // arg5 (f6)
- " b ppcLoadDoubleRegUpd \n"
- " fmr f7, f0 \n" // arg6 (f7)
- " b ppcLoadDoubleRegUpd \n"
- " fmr f8, f0 \n" // arg7 (f8)
- " b ppcLoadDoubleRegUpd \n"
- " fmr f9, f0 \n" // arg8 (f9)
- " b ppcLoadDoubleRegUpd \n"
- " fmr f10, f0 \n" // arg9 (f10)
- " b ppcLoadDoubleRegUpd \n"
- " fmr f11, f0 \n" // arg10 (f11)
- " b ppcLoadDoubleRegUpd \n"
- " fmr f12, f0 \n" // arg11 (f12)
- " b ppcLoadDoubleRegUpd \n"
- " fmr f13, f0 \n" // arg12 (f13)
- " b ppcLoadDoubleRegUpd \n"
- " nop \n"
- // all float arguments still go on the stack
- "ppcLoadDoubleRegUpd: \n"
- " stfd f0, 0(r26) \n" // store f0, as a double, into the argument list on the stack
- " addi r23, r23, 2 \n" // a double float eats up two GPRs
- " addi r28, r28, 1 \n" // ...and, of course, a float
- " addi r29, r29, 8 \n" // increment to our next argument we need to process (8 bytes for the 64bit float)
- " addi r26, r26, 8 \n" // increment to the next slot on the argument list on the stack (8 bytes)
- " b ppcNextArg \n" // on to the next argument
- " nop \n"
-);
-
-asDWORD GetReturnedFloat()
-{
- asDWORD f;
- asm(" stfs f1, %0\n" : "=m"(f));
- return f;
-}
-
-asQWORD GetReturnedDouble()
-{
- asQWORD f;
- asm(" stfd f1, %0\n" : "=m"(f));
- return f;
-}
-
-// puts the arguments in the correct place in the stack array. See comments above.
-void stackArgs(const asDWORD *args, const asBYTE *argsType, int& numIntArgs, int& numFloatArgs, int& numDoubleArgs)
-{
- int i;
- int argWordPos = numIntArgs + numFloatArgs + (numDoubleArgs*2);
- int typeOffset = numIntArgs + numFloatArgs + numDoubleArgs;
-
- int typeIndex;
- for( i = 0, typeIndex = 0; ; i++, typeIndex++ )
- {
- // store the type
- ppcArgsType[typeOffset++] = argsType[typeIndex];
- if( argsType[typeIndex] == ppcENDARG )
- break;
-
- switch( argsType[typeIndex] )
- {
- case ppcFLOATARG:
- // stow float
- ppcArgs[argWordPos] = args[i]; // it's just a bit copy
- numFloatArgs++;
- argWordPos++; //add one word
- break;
-
- case ppcDOUBLEARG:
- // stow double
- memcpy( &ppcArgs[argWordPos], &args[i], sizeof(double) ); // we have to do this because of alignment
- numDoubleArgs++;
- argWordPos+=2; //add two words
- i++;//doubles take up 2 argument slots
- break;
-
- case ppcINTARG:
- // stow register
- ppcArgs[argWordPos] = args[i];
- numIntArgs++;
- argWordPos++;
- break;
- }
- }
-
- // close off the argument list (if we have max args we won't close it off until here)
- ppcArgsType[typeOffset] = ppcENDARG;
-}
-
-static asQWORD CallCDeclFunction(const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory)
-{
- int baseArgCount = 0;
- if( retInMemory )
- {
- // the first argument is the 'return in memory' pointer
- ppcArgs[0] = (asDWORD)retInMemory;
- ppcArgsType[0] = ppcINTARG;
- ppcArgsType[1] = ppcENDARG;
- baseArgCount = 1;
- }
-
- // put the arguments in the correct places in the ppcArgs array
- int numTotalArgs = baseArgCount;
- if( argSize > 0 )
- {
- int intArgs = baseArgCount, floatArgs = 0, doubleArgs = 0;
- stackArgs( pArgs, pArgsType, intArgs, floatArgs, doubleArgs );
- numTotalArgs = intArgs + floatArgs + 2*doubleArgs; // doubles occupy two slots
- }
- else
- {
- // no arguments, cap the type list
- ppcArgsType[baseArgCount] = ppcENDARG;
- }
-
- // call the function with the arguments
- return ppcFunc( ppcArgs, PPC_STACK_SIZE(numTotalArgs), func );
-}
-
-// This function is identical to CallCDeclFunction, with the only difference that
-// the value in the first parameter is the object (unless we are returning in memory)
-static asQWORD CallThisCallFunction(const void *obj, const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory )
-{
- int baseArgCount = 0;
- if( retInMemory )
- {
- // the first argument is the 'return in memory' pointer
- ppcArgs[0] = (asDWORD)retInMemory;
- ppcArgsType[0] = ppcINTARG;
- ppcArgsType[1] = ppcENDARG;
- baseArgCount = 1;
- }
-
- // the first argument is the 'this' of the object
- ppcArgs[baseArgCount] = (asDWORD)obj;
- ppcArgsType[baseArgCount++] = ppcINTARG;
- ppcArgsType[baseArgCount] = ppcENDARG;
-
- // put the arguments in the correct places in the ppcArgs array
- int numTotalArgs = baseArgCount;
- if( argSize > 0 )
- {
- int intArgs = baseArgCount, floatArgs = 0, doubleArgs = 0;
- stackArgs( pArgs, pArgsType, intArgs, floatArgs, doubleArgs );
- numTotalArgs = intArgs + floatArgs + 2*doubleArgs; // doubles occupy two slots
- }
-
- // call the function with the arguments
- return ppcFunc( ppcArgs, PPC_STACK_SIZE(numTotalArgs), func);
-}
-
-// This function is identical to CallCDeclFunction, with the only difference that
-// the value in the last parameter is the object
-// NOTE: on PPC the order for the args is reversed
-static asQWORD CallThisCallFunction_objLast(const void *obj, const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory)
-{
- UNUSED_VAR(argSize);
- int baseArgCount = 0;
- if( retInMemory )
- {
- // the first argument is the 'return in memory' pointer
- ppcArgs[0] = (asDWORD)retInMemory;
- ppcArgsType[0] = ppcINTARG;
- ppcArgsType[1] = ppcENDARG;
- baseArgCount = 1;
- }
-
- // stack any of the arguments
- int intArgs = baseArgCount, floatArgs = 0, doubleArgs = 0;
- stackArgs( pArgs, pArgsType, intArgs, floatArgs, doubleArgs );
- int numTotalArgs = intArgs + floatArgs + doubleArgs;
-
- // can we fit the object in at the end?
- if( numTotalArgs < AS_PPC_MAX_ARGS )
- {
- // put the object pointer at the end
- int argPos = intArgs + floatArgs + (doubleArgs * 2);
- ppcArgs[argPos] = (asDWORD)obj;
- ppcArgsType[numTotalArgs++] = ppcINTARG;
- ppcArgsType[numTotalArgs] = ppcENDARG;
- }
-
- // call the function with the arguments
- return ppcFunc( ppcArgs, PPC_STACK_SIZE(numTotalArgs), func );
-}
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/, void */*secondObject*/)
-{
- // TODO: PPC does not yet support THISCALL_OBJFIRST/LAST
-
- // use a working array of types, we'll configure the final one in stackArgs
- asBYTE argsType[2*AS_PPC_MAX_ARGS + 1 + 1 + 1];
- memset( argsType, 0, sizeof(argsType));
-
- asCScriptEngine *engine = context->m_engine;
- asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
-
- asQWORD retQW = 0;
- void *func = (void*)sysFunc->func;
- int paramSize = sysFunc->paramSize;
- asDWORD *vftable = NULL;
- int a, s;
-
- // convert the parameters that are < 4 bytes from little endian to big endian
- int argDwordOffset = 0;
- for( a = 0; a < (int)descr->parameterTypes.GetLength(); a++ )
- {
- int numBytes = descr->parameterTypes[a].GetSizeInMemoryBytes();
- if( numBytes >= 4 || descr->parameterTypes[a].IsReference() || descr->parameterTypes[a].IsObjectHandle() )
- {
- argDwordOffset += descr->parameterTypes[a].GetSizeOnStackDWords();
- continue;
- }
-
- // flip
- asASSERT( numBytes == 1 || numBytes == 2 );
- switch( numBytes )
- {
- case 1:
- {
- volatile asBYTE *bPtr = (asBYTE*)ARG_DW(args[argDwordOffset]);
- asBYTE t = bPtr[0];
- bPtr[0] = bPtr[3];
- bPtr[3] = t;
- t = bPtr[1];
- bPtr[1] = bPtr[2];
- bPtr[2] = t;
- }
- break;
- case 2:
- {
- volatile asWORD *wPtr = (asWORD*)ARG_DW(args[argDwordOffset]);
- asWORD t = wPtr[0];
- wPtr[0] = wPtr[1];
- wPtr[1] = t;
- }
- break;
- }
- argDwordOffset++;
- }
-
- // mark all float/double/int arguments
- if( !sysFunc->takesObjByVal )
- {
- for( s = 0, a = 0; s < (int)descr->parameterTypes.GetLength(); s++, a++ )
- {
- if( descr->parameterTypes[s].IsFloatType() && !descr->parameterTypes[s].IsReference() )
- {
- argsType[a] = ppcFLOATARG;
- }
- else if( descr->parameterTypes[s].IsDoubleType() && !descr->parameterTypes[s].IsReference() )
- {
- argsType[a] = ppcDOUBLEARG;
- }
- else
- {
- argsType[a] = ppcINTARG;
- if( descr->parameterTypes[s].GetSizeOnStackDWords() == 2 )
- {
- // Add an extra integer argument for the extra size
- a++;
- argsType[a] = ppcINTARG;
- }
- }
- }
- }
-
- asDWORD paramBuffer[64];
- if( sysFunc->takesObjByVal )
- {
- paramSize = 0;
- int spos = 0;
- int dpos = 1;
-
- int a = 0;
- for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
- {
- if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
- {
-#ifdef COMPLEX_OBJS_PASSED_BY_REF
- if( descr->parameterTypes[n].GetTypeInfo()->flags & COMPLEX_MASK )
- {
- argsType[a++] = ppcINTARG;
- paramBuffer[dpos++] = args[spos++];
- paramSize++;
- }
- else
-#endif
- {
- // TODO: Probably have to handle asOBJ_APP_FLOAT as a primitive
-
- // Copy the object's memory to the buffer
- memcpy( ¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes() );
-
- // Delete the original memory
- engine->CallFree(*(char**)(args+spos) );
- spos++;
- asUINT dwords = descr->parameterTypes[n].GetSizeInMemoryDWords();
- dpos += dwords;
- paramSize += dwords;
- for( asUINT i = 0; i < dwords; i++ )
- argsType[a++] = ppcINTARG;
- }
- }
- else
- {
- // Copy the value directly
- paramBuffer[dpos++] = args[spos++];
- if( descr->parameterTypes[n].IsFloatType() && !descr->parameterTypes[n].IsReference() )
- argsType[a++] = ppcFLOATARG;
- else if( descr->parameterTypes[n].IsDoubleType() && !descr->parameterTypes[n].IsReference() )
- argsType[a++] = ppcDOUBLEARG;
- else
- argsType[a++] = ppcINTARG;
- if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
- {
- paramBuffer[dpos++] = args[spos++];
- if( !descr->parameterTypes[n].IsDoubleType() ) // Double already knows it is 2 dwords
- argsType[a++] = ppcINTARG;
- }
- paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
- }
- }
-
- // Keep a free location at the beginning
- args = ¶mBuffer[1];
- }
-
- int callConv = sysFunc->callConv;
- switch( callConv )
- {
- case ICC_CDECL:
- case ICC_CDECL_RETURNINMEM:
- case ICC_STDCALL:
- case ICC_STDCALL_RETURNINMEM:
- retQW = CallCDeclFunction( args, argsType, paramSize, (asDWORD)func, retPointer );
- break;
- case ICC_THISCALL:
- case ICC_THISCALL_RETURNINMEM:
- retQW = CallThisCallFunction(obj, args, argsType, paramSize, (asDWORD)func, retPointer );
- break;
- case ICC_VIRTUAL_THISCALL:
- case ICC_VIRTUAL_THISCALL_RETURNINMEM:
- // Get virtual function table from the object pointer
- vftable = *(asDWORD**)obj;
- retQW = CallThisCallFunction( obj, args, argsType, paramSize, vftable[asDWORD(func)>>2], retPointer );
- break;
- case ICC_CDECL_OBJLAST:
- case ICC_CDECL_OBJLAST_RETURNINMEM:
- retQW = CallThisCallFunction_objLast( obj, args, argsType, paramSize, (asDWORD)func, retPointer );
- break;
- case ICC_CDECL_OBJFIRST:
- case ICC_CDECL_OBJFIRST_RETURNINMEM:
- retQW = CallThisCallFunction( obj, args, argsType, paramSize, (asDWORD)func, retPointer );
- break;
- default:
- context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
- }
-
- // If the return is a float value we need to get the value from the FP register
- if( sysFunc->hostReturnFloat )
- {
- if( sysFunc->hostReturnSize == 1 )
- *(asDWORD*)&retQW = GetReturnedFloat();
- else
- retQW = GetReturnedDouble();
- }
-
- return retQW;
-}
-
-END_AS_NAMESPACE
-
-#endif // AS_PPC
-#endif // AS_MAX_PORTABILITY
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_ppc_64.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_ppc_64.cpp
deleted file mode 100644
index 275f6152b41..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_ppc_64.cpp
+++ /dev/null
@@ -1,773 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2016 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-
-//
-// as_callfunc_ppc_64.cpp
-//
-// These functions handle the actual calling of system functions
-//
-// This version is 64 bit PPC specific
-//
-
-#include "as_config.h"
-
-#ifndef AS_MAX_PORTABILITY
-#ifdef AS_PPC_64
-#if AS_PTR_SIZE == 2
-// TODO: Add support for PPC 64bit platforms with 64bit pointers, for example Linux PPC64 (big endian) and PPC64 (little endian)
-#error This code has not been prepared for PPC with 64bit pointers. Most likely the ABI is different
-#else
-
-#include "as_callfunc.h"
-#include "as_scriptengine.h"
-#include "as_texts.h"
-#include "as_tokendef.h"
-#include "as_context.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef __SNC__
-#include "ppu_asm_intrinsics.h"
-#endif
-
-
-BEGIN_AS_NAMESPACE
-
-// This part was written and tested by Jeff Slutter
-// from Reactor Zero, Abril, 2007, for PlayStation 3, which
-// is a PowerPC 64bit based architecture. Even though it is
-// 64bit it seems the pointer size is still 32bit.
-
-// It still remains to be seen how well this code works
-// on other PPC platforms, such as XBox 360, GameCube.
-
-#define AS_PPC_MAX_ARGS 32
-
-// The array used to send values to the correct places.
-// Contains a byte of argTypes to indicate the register type to load
-// or zero if end of arguments
-// The +1 is for when CallThis (object methods) is used
-// Extra +1 when returning in memory
-// Extra +1 in ppcArgsType to ensure zero end-of-args marker
-
-// TODO: multithread: The global variables must be removed to make the code thread safe
-
-extern "C"
-{
- enum argTypes { ppcENDARG = 0, ppcINTARG = 1, ppcFLOATARG = 2, ppcDOUBLEARG = 3, ppcLONGARG = 4 };
- static asBYTE ppcArgsType[AS_PPC_MAX_ARGS + 1 + 1 + 1];
- static asDWORD ppcArgs[2*AS_PPC_MAX_ARGS + 1 + 1];
-}
-
-// NOTE: these values are for PowerPC 64 bit. I'm sure things are different for PowerPC 32bit, but I don't have one.
-// I'm pretty sure that PPC 32bit sets up a stack frame slightly different (only 24 bytes for linkage area for instance)
-#define PPC_LINKAGE_SIZE (0x30) // how big the PPC linkage area is in a stack frame
-#define PPC_NUM_REGSTORE (10) // how many registers of the PPC we need to store/restore for ppcFunc64()
-#define PPC_REGSTORE_SIZE (8*PPC_NUM_REGSTORE) // how many bytes are required for register store/restore
-#define EXTRA_STACK_SIZE (PPC_LINKAGE_SIZE + PPC_REGSTORE_SIZE) // memory required, not including parameters, for the stack frame
-#define PPC_STACK_SIZE(numParams) ( -(( ( (((numParams)<8)?8:(numParams))<<3) + EXTRA_STACK_SIZE + 15 ) & ~15) ) // calculates the total stack size needed for ppcFunc64, must pad to 16bytes
-
-// This is PowerPC 64 bit specific
-// Loads all data into the correct places and calls the function.
-// ppcArgsType is an array containing a byte type (enum argTypes) for each argument.
-// StackArgSizeInBytes is the size in bytes of the stack frame (takes into account linkage area, etc. must be multiple of 16)
-extern "C" asQWORD ppcFunc64(const asDWORD* argsPtr, int StackArgSizeInBytes, asDWORD func);
-asm(""
- ".text\n"
- ".align 4\n"
- ".p2align 4,,15\n"
- ".globl .ppcFunc64\n"
- ".ppcFunc64:\n"
-
- // function prolog
- "std %r22, -0x08(%r1)\n" // we need a register other than r0, to store the old stack pointer
- "mr %r22, %r1\n" // store the old stack pointer, for now (to make storing registers easier)
- "stdux %r1, %r1, %r4\n" // atomically store and update the stack pointer for the new stack frame (in case of a signal/interrupt)
- "mflr %r0\n" // get the caller's LR register
- "std %r0, 0x10(%r22)\n" // store the caller's LR register
- "std %r23, -0x10(%r22)\n" //
- "std %r24, -0x18(%r22)\n" //
- "std %r25, -0x20(%r22)\n" //
- "std %r26, -0x28(%r22)\n" //
- "std %r27, -0x30(%r22)\n" //
- "std %r28, -0x38(%r22)\n" //
- "std %r29, -0x40(%r22)\n" //
- "std %r30, -0x48(%r22)\n" //
- "std %r31, -0x50(%r22)\n" //
- "std %r3, 0x30(%r22)\n" // save our parameters
- "std %r4, 0x38(%r22)\n" //
- "std %r5, 0x40(%r22)\n" //
- "mr %r31, %r1\n" // functions tend to store the stack pointer here too
-
- // initial registers for the function
- "mr %r29, %r3\n" // (r29) args list
- "lwz %r27, 0(%r5)\n" // load the function pointer to call. func actually holds the pointer to our function
- "addi %r26, %r1, 0x30\n" // setup the pointer to the parameter area to the function we're going to call
- "sub %r0,%r0,%r0\n" // zero out r0
- "mr %r23,%r0\n" // zero out r23, which holds the number of used GPR registers
- "mr %r22,%r0\n" // zero our r22, which holds the number of used float registers
-
- // load the global ppcArgsType which holds the types of arguments for each argument
- "lis %r25, ppcArgsType at ha\n" // load the upper 16 bits of the address to r25
- "addi %r25, %r25, ppcArgsType at l\n" // load the lower 16 bits of the address to r25
- "subi %r25, %r25, 1\n" // since we increment r25 on its use, we'll pre-decrement it
-
- // loop through the arguments
- "ppcNextArg:\n"
- "addi %r25, %r25, 1\n" // increment r25, our arg type pointer
- // switch based on the current argument type (0:end, 1:int, 2:float 3:double)
- "lbz %r24, 0(%r25)\n" // load the current argument type (it's a byte)
- "mulli %r24, %r24, 4\n" // our jump table has 4 bytes per case (1 instruction)
- "lis %r30, ppcTypeSwitch at ha\n" // load the address of the jump table for the switch
- "addi %r30, %r30, ppcTypeSwitch at l\n"
- "add %r0, %r30, %r24\n" // offset by our argument type
- "mtctr %r0\n" // load the jump address into CTR
- "bctr\n" // jump into the jump table/switch
- "nop\n"
- // the jump table/switch based on the current argument type
- "ppcTypeSwitch:\n"
- "b ppcArgsEnd\n"
- "b ppcArgIsInteger\n"
- "b ppcArgIsFloat\n"
- "b ppcArgIsDouble\n"
- "b ppcArgIsLong\n"
-
- // when we get here we have finished processing all the arguments
- // everything is ready to go to call the function
- "ppcArgsEnd:\n"
- "mtctr %r27\n" // the function pointer is stored in r27, load that into CTR
- "bctrl\n" // call the function. We have to do it this way so that the LR gets the proper
- "nop\n" // return value (the next instruction below). So we have to branch from CTR instead of LR.
- // when we get here, the function has returned, this is the function epilog
- "ld %r11,0x00(%r1)\n" // load in the caller's stack pointer
- "ld %r0,0x10(%r11)\n" // load in the caller's LR
- "mtlr %r0\n" // restore the caller's LR
- "ld %r22, -0x08(%r11)\n" // load registers
- "ld %r23, -0x10(%r11)\n" //
- "ld %r24, -0x18(%r11)\n" //
- "ld %r25, -0x20(%r11)\n" //
- "ld %r26, -0x28(%r11)\n" //
- "ld %r27, -0x30(%r11)\n" //
- "ld %r28, -0x38(%r11)\n" //
- "ld %r29, -0x40(%r11)\n" //
- "ld %r30, -0x48(%r11)\n" //
- "ld %r31, -0x50(%r11)\n" //
- "mr %r1, %r11\n" // restore the caller's SP
- "blr\n" // return back to the caller
- "nop\n"
- // Integer argument (GPR register)
- "ppcArgIsInteger:\n"
- "lis %r30,ppcLoadIntReg at ha\n" // load the address to the jump table for integer registers
- "addi %r30, %r30, ppcLoadIntReg at l\n"
- "mulli %r0, %r23, 8\n" // each item in the jump table is 2 instructions (8 bytes)
- "add %r0, %r0, %r30\n" // calculate ppcLoadIntReg[numUsedGPRRegs]
- "lwz %r30,0(%r29)\n" // load the next argument from the argument list into r30
- "cmpwi %r23, 8\n" // we can only load GPR3 through GPR10 (8 registers)
- "bgt ppcLoadIntRegUpd\n" // if we're beyond 8 GPR registers, we're in the stack, go there
- "mtctr %r0\n" // load the address of our ppcLoadIntReg jump table (we're below 8 GPR registers)
- "bctr\n" // load the argument into a GPR register
- "nop\n"
- // jump table for GPR registers, for the first 8 GPR arguments
- "ppcLoadIntReg:\n"
- "mr %r3,%r30\n" // arg0 (to r3)
- "b ppcLoadIntRegUpd\n"
- "mr %r4,%r30\n" // arg1 (to r4)
- "b ppcLoadIntRegUpd\n"
- "mr %r5,%r30\n" // arg2 (to r5)
- "b ppcLoadIntRegUpd\n"
- "mr %r6,%r30\n" // arg3 (to r6)
- "b ppcLoadIntRegUpd\n"
- "mr %r7,%r30\n" // arg4 (to r7)
- "b ppcLoadIntRegUpd\n"
- "mr %r8,%r30\n" // arg5 (to r8)
- "b ppcLoadIntRegUpd\n"
- "mr %r9,%r30\n" // arg6 (to r9)
- "b ppcLoadIntRegUpd\n"
- "mr %r10,%r30\n" // arg7 (to r10)
- "b ppcLoadIntRegUpd\n"
-
- // all GPR arguments still go on the stack
- "ppcLoadIntRegUpd:\n"
- "std %r30,0(%r26)\n" // store the argument into the next slot on the stack's argument list
- "addi %r23, %r23, 1\n" // count a used GPR register
- "addi %r29, %r29, 4\n" // move to the next argument on the list
- "addi %r26, %r26, 8\n" // adjust our argument stack pointer for the next
- "b ppcNextArg\n" // next argument
-
- // single Float argument
- "ppcArgIsFloat:\n"
- "lis %r30,ppcLoadFloatReg at ha\n" // get the base address of the float register jump table
- "addi %r30, %r30, ppcLoadFloatReg at l\n"
- "mulli %r0, %r22 ,8\n" // each jump table entry is 8 bytes
- "add %r0, %r0, %r30\n" // calculate the offset to ppcLoadFloatReg[numUsedFloatReg]
- "lfs 0, 0(%r29)\n" // load the next argument as a float into f0
- "cmpwi %r22, 13\n" // can't load more than 13 float/double registers
- "bgt ppcLoadFloatRegUpd\n" // if we're beyond 13 registers, just fall to inserting into the stack
- "mtctr %r0\n" // jump into the float jump table
- "bctr\n"
- "nop\n"
- // jump table for float registers, for the first 13 float arguments
- "ppcLoadFloatReg:\n"
- "fmr 1,0\n" // arg0 (f1)
- "b ppcLoadFloatRegUpd\n"
- "fmr 2,0\n" // arg1 (f2)
- "b ppcLoadFloatRegUpd\n"
- "fmr 3,0\n" // arg2 (f3)
- "b ppcLoadFloatRegUpd\n"
- "fmr 4,0\n" // arg3 (f4)
- "b ppcLoadFloatRegUpd\n"
- "fmr 5,0\n" // arg4 (f5)
- "b ppcLoadFloatRegUpd\n"
- "fmr 6,0\n" // arg5 (f6)
- "b ppcLoadFloatRegUpd\n"
- "fmr 7,0\n" // arg6 (f7)
- "b ppcLoadFloatRegUpd\n"
- "fmr 8,0\n" // arg7 (f8)
- "b ppcLoadFloatRegUpd\n"
- "fmr 9,0\n" // arg8 (f9)
- "b ppcLoadFloatRegUpd\n"
- "fmr 10,0\n" // arg9 (f10)
- "b ppcLoadFloatRegUpd\n"
- "fmr 11,0\n" // arg10 (f11)
- "b ppcLoadFloatRegUpd\n"
- "fmr 12,0\n" // arg11 (f12)
- "b ppcLoadFloatRegUpd\n"
- "fmr 13,0\n" // arg12 (f13)
- "b ppcLoadFloatRegUpd\n"
- "nop\n"
- // all float arguments still go on the stack
- "ppcLoadFloatRegUpd:\n"
- "stfs 0, 0x04(%r26)\n" // store, as a single float, f0 (current argument) on to the stack argument list
- "addi %r23, %r23, 1\n" // a float register eats up a GPR register
- "addi %r22, %r22, 1\n" // ...and, of course, a float register
- "addi %r29, %r29, 4\n" // move to the next argument in the list
- "addi %r26, %r26, 8\n" // move to the next stack slot
- "b ppcNextArg\n" // on to the next argument
- "nop\n"
- // double Float argument
- "ppcArgIsDouble:\n"
- "lis %r30, ppcLoadDoubleReg at ha\n" // load the base address of the jump table for double registers
- "addi %r30, %r30, ppcLoadDoubleReg at l\n"
- "mulli %r0, %r22, 8\n" // each slot of the jump table is 8 bytes
- "add %r0, %r0, %r30\n" // calculate ppcLoadDoubleReg[numUsedFloatReg]
- "lfd 0, 0(%r29)\n" // load the next argument, as a double float, into f0
- "cmpwi %r22,13\n" // the first 13 floats must go into float registers also
- "bgt ppcLoadDoubleRegUpd\n" // if we're beyond 13, then just put on to the stack
- "mtctr %r0\n" // we're under 13, first load our register
- "bctr\n" // jump into the jump table
- "nop\n"
- // jump table for float registers, for the first 13 float arguments
- "ppcLoadDoubleReg:\n"
- "fmr 1,0\n" // arg0 (f1)
- "b ppcLoadDoubleRegUpd\n"
- "fmr 2,0\n" // arg1 (f2)
- "b ppcLoadDoubleRegUpd\n"
- "fmr 3,0\n" // arg2 (f3)
- "b ppcLoadDoubleRegUpd\n"
- "fmr 4,0\n" // arg3 (f4)
- "b ppcLoadDoubleRegUpd\n"
- "fmr 5,0\n" // arg4 (f5)
- "b ppcLoadDoubleRegUpd\n"
- "fmr 6,0\n" // arg5 (f6)
- "b ppcLoadDoubleRegUpd\n"
- "fmr 7,0\n" // arg6 (f7)
- "b ppcLoadDoubleRegUpd\n"
- "fmr 8,0\n" // arg7 (f8)
- "b ppcLoadDoubleRegUpd\n"
- "fmr 9,0\n" // arg8 (f9)
- "b ppcLoadDoubleRegUpd\n"
- "fmr 10,0\n" // arg9 (f10)
- "b ppcLoadDoubleRegUpd\n"
- "fmr 11,0\n" // arg10 (f11)
- "b ppcLoadDoubleRegUpd\n"
- "fmr 12,0\n" // arg11 (f12)
- "b ppcLoadDoubleRegUpd\n"
- "fmr 13,0\n" // arg12 (f13)
- "b ppcLoadDoubleRegUpd\n"
- "nop\n"
- // all float arguments still go on the stack
- "ppcLoadDoubleRegUpd:\n"
- "stfd 0,0(%r26)\n" // store f0, as a double, into the argument list on the stack
- "addi %r23, %r23, 1\n" // a double float eats up one GPR
- "addi %r22, %r22, 1\n" // ...and, of course, a float
- "addi %r29, %r29, 8\n" // increment to our next argument we need to process (8 bytes for the 64bit float)
- "addi %r26, %r26, 8\n" // increment to the next slot on the argument list on the stack (8 bytes)
- "b ppcNextArg\n" // on to the next argument
- "nop\n"
-
- // Long (64 bit int) argument
- "ppcArgIsLong:\n"
- "lis %r30,ppcLoadLongReg at ha\n" // load the address to the jump table for integer64
- "addi %r30, %r30, ppcLoadLongReg at l\n"
- "mulli %r0, %r23, 8\n" // each item in the jump table is 2 instructions (8 bytes)
- "add %r0, %r0, %r30\n" // calculate ppcLoadLongReg[numUsedGPRRegs]
- "ld %r30,0(%r29)\n" // load the next argument from the argument list into r30
- "cmpwi %r23, 8\n" // we can only load GPR3 through GPR10 (8 registers)
- "bgt ppcLoadLongRegUpd\n" // if we're beyond 8 GPR registers, we're in the stack, go there
- "mtctr %r0\n" // load the address of our ppcLoadLongReg jump table (we're below 8 GPR registers)
- "bctr\n" // load the argument into a GPR register
- "nop\n"
- // jump table for GPR registers, for the first 8 GPR arguments
- "ppcLoadLongReg:\n"
- "mr %r3,%r30\n" // arg0 (to r3)
- "b ppcLoadLongRegUpd\n"
- "mr %r4,%r30\n" // arg1 (to r4)
- "b ppcLoadLongRegUpd\n"
- "mr %r5,%r30\n" // arg2 (to r5)
- "b ppcLoadLongRegUpd\n"
- "mr %r6,%r30\n" // arg3 (to r6)
- "b ppcLoadLongRegUpd\n"
- "mr %r7,%r30\n" // arg4 (to r7)
- "b ppcLoadLongRegUpd\n"
- "mr %r8,%r30\n" // arg5 (to r8)
- "b ppcLoadLongRegUpd\n"
- "mr %r9,%r30\n" // arg6 (to r9)
- "b ppcLoadLongRegUpd\n"
- "mr %r10,%r30\n" // arg7 (to r10)
- "b ppcLoadLongRegUpd\n"
-
- // all GPR arguments still go on the stack
- "ppcLoadLongRegUpd:\n"
- "std %r30,0(%r26)\n" // store the argument into the next slot on the stack's argument list
- "addi %r23, %r23, 1\n" // count a used GPR register
- "addi %r29, %r29, 8\n" // move to the next argument on the list
- "addi %r26, %r26, 8\n" // adjust our argument stack pointer for the next
- "b ppcNextArg\n" // next argument
-);
-
-static asDWORD GetReturnedFloat(void)
-{
- asDWORD f;
-#ifdef __SNC__
- __stfs( __freg(1), 0, (void*)&f);
-#else
- asm(" stfs 1, %0\n" : "=m"(f));
-#endif
- return f;
-}
-
-static asQWORD GetReturnedDouble(void)
-{
- asQWORD f;
-#ifdef __SNC__
- __stfd( __freg(1), 0, (void*)&f);
-#else
- asm(" stfd 1, %0\n" : "=m"(f));
-#endif
- return f;
-}
-
-// puts the arguments in the correct place in the stack array. See comments above.
-static void stackArgs( const asDWORD *args, const asBYTE *argsType, int &numIntArgs, int &numFloatArgs, int &numDoubleArgs, int &numLongArgs )
-{
- // initialize our offset based on any already placed arguments
- int i;
- int argWordPos = numIntArgs + numFloatArgs + (numDoubleArgs*2) + (numLongArgs*2);
- int typeOffset = numIntArgs + numFloatArgs + numDoubleArgs + numLongArgs;
-
- int typeIndex;
- for( i = 0, typeIndex = 0; ; i++, typeIndex++ )
- {
- // store the type
- ppcArgsType[typeOffset++] = argsType[typeIndex];
- if( argsType[typeIndex] == ppcENDARG )
- break;
-
- switch( argsType[typeIndex] )
- {
- case ppcFLOATARG:
- {
- // stow float
- ppcArgs[argWordPos] = args[i]; // it's just a bit copy
- numFloatArgs++;
- argWordPos++; //add one word
- }
- break;
-
- case ppcDOUBLEARG:
- {
- // stow double
- memcpy( &ppcArgs[argWordPos], &args[i], sizeof(double) ); // we have to do this because of alignment
- numDoubleArgs++;
- argWordPos+=2; //add two words
- i++;//doubles take up 2 argument slots
- }
- break;
-
- case ppcINTARG:
- {
- // stow register
- ppcArgs[argWordPos] = args[i];
- numIntArgs++;
- argWordPos++;
- }
- break;
-
- case ppcLONGARG:
- {
- // stow long
- memcpy( &ppcArgs[argWordPos], &args[i], 8 ); // for alignment purposes, we use memcpy
- numLongArgs++;
- argWordPos += 2; // add two words
- i++; // longs take up 2 argument slots
- }
- break;
- }
- }
-
- // close off the argument list (if we have max args we won't close it off until here)
- ppcArgsType[typeOffset] = ppcENDARG;
-}
-
-static asQWORD CallCDeclFunction(const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory)
-{
- int baseArgCount = 0;
- if( retInMemory )
- {
- // the first argument is the 'return in memory' pointer
- ppcArgs[0] = (asDWORD)retInMemory;
- ppcArgsType[0] = ppcINTARG;
- ppcArgsType[1] = ppcENDARG;
- baseArgCount = 1;
- }
-
- // put the arguments in the correct places in the ppcArgs array
- int numTotalArgs = baseArgCount;
- if( argSize > 0 )
- {
- int intArgs = baseArgCount, floatArgs = 0, doubleArgs = 0, longArgs = 0;
- stackArgs( pArgs, pArgsType, intArgs, floatArgs, doubleArgs, longArgs );
- numTotalArgs = intArgs + floatArgs + doubleArgs + longArgs;
- }
- else
- {
- // no arguments, cap the type list
- ppcArgsType[baseArgCount] = ppcENDARG;
- }
-
- // call the function with the arguments
- return ppcFunc64( ppcArgs, PPC_STACK_SIZE(numTotalArgs), func );
-}
-
-// This function is identical to CallCDeclFunction, with the only difference that
-// the value in the first parameter is the object (unless we are returning in memory)
-static asQWORD CallThisCallFunction(const void *obj, const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory )
-{
- int baseArgCount = 0;
- if( retInMemory )
- {
- // the first argument is the 'return in memory' pointer
- ppcArgs[0] = (asDWORD)retInMemory;
- ppcArgsType[0] = ppcINTARG;
- ppcArgsType[1] = ppcENDARG;
- baseArgCount = 1;
- }
-
- // the first argument is the 'this' of the object
- ppcArgs[baseArgCount] = (asDWORD)obj;
- ppcArgsType[baseArgCount++] = ppcINTARG;
- ppcArgsType[baseArgCount] = ppcENDARG;
-
- // put the arguments in the correct places in the ppcArgs array
- int numTotalArgs = baseArgCount;
- if( argSize > 0 )
- {
- int intArgs = baseArgCount, floatArgs = 0, doubleArgs = 0, longArgs = 0;
- stackArgs( pArgs, pArgsType, intArgs, floatArgs, doubleArgs, longArgs );
- numTotalArgs = intArgs + floatArgs + doubleArgs + longArgs;
- }
-
- // call the function with the arguments
- return ppcFunc64( ppcArgs, PPC_STACK_SIZE(numTotalArgs), func);
-}
-
-// This function is identical to CallCDeclFunction, with the only difference that
-// the value in the last parameter is the object
-// NOTE: on PPC the order for the args is reversed
-static asQWORD CallThisCallFunction_objLast(const void *obj, const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory)
-{
- UNUSED_VAR(argSize);
- int baseArgCount = 0;
- if( retInMemory )
- {
- // the first argument is the 'return in memory' pointer
- ppcArgs[0] = (asDWORD)retInMemory;
- ppcArgsType[0] = ppcINTARG;
- ppcArgsType[1] = ppcENDARG;
- baseArgCount = 1;
- }
-
- // stack any of the arguments
- int intArgs = baseArgCount, floatArgs = 0, doubleArgs = 0, longArgs = 0;
- stackArgs( pArgs, pArgsType, intArgs, floatArgs, doubleArgs, longArgs );
- int numTotalArgs = intArgs + floatArgs + doubleArgs;
-
- // can we fit the object in at the end?
- if( numTotalArgs < AS_PPC_MAX_ARGS )
- {
- // put the object pointer at the end
- int argPos = intArgs + floatArgs + (doubleArgs * 2) + (longArgs *2);
- ppcArgs[argPos] = (asDWORD)obj;
- ppcArgsType[numTotalArgs++] = ppcINTARG;
- ppcArgsType[numTotalArgs] = ppcENDARG;
- }
-
- // call the function with the arguments
- return ppcFunc64( ppcArgs, PPC_STACK_SIZE(numTotalArgs), func );
-}
-
-// returns true if the given parameter is a 'variable argument'
-inline bool IsVariableArgument( asCDataType type )
-{
- return (type.GetTokenType() == ttQuestion) ? true : false;
-}
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/, void */*secondObject*/)
-{
- // TODO: PPC 64 does not yet support THISCALL_OBJFIRST/LAST
-
- // use a working array of types, we'll configure the final one in stackArgs
- asBYTE argsType[AS_PPC_MAX_ARGS + 1 + 1 + 1];
- memset( argsType, 0, sizeof(argsType));
-
- asCScriptEngine *engine = context->m_engine;
- asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
-
- int callConv = sysFunc->callConv;
-
- asQWORD retQW = 0;
- void *func = (void*)sysFunc->func;
- int paramSize = sysFunc->paramSize;
- asDWORD *vftable = NULL;
- int a;
-
- // convert the parameters that are < 4 bytes from little endian to big endian
- int argDwordOffset = 0;
- int totalArgumentCount = 0;
-
- for( a = 0; a < (int)descr->parameterTypes.GetLength(); ++a )
- {
- // get the size for the parameter
- int numBytes = descr->parameterTypes[a].GetSizeInMemoryBytes();
- ++totalArgumentCount;
-
- // is this a variable argument?
- // for variable arguments, the typeID will always follow...but we know it is 4 bytes
- // so we can skip that parameter automatically.
- bool isVarArg = IsVariableArgument( descr->parameterTypes[a] );
- if( isVarArg )
- {
- ++totalArgumentCount;
- }
-
- if( numBytes >= 4 || descr->parameterTypes[a].IsReference() || descr->parameterTypes[a].IsObjectHandle() )
- {
- // DWORD or larger parameter --- no flipping needed
- argDwordOffset += descr->parameterTypes[a].GetSizeOnStackDWords();
- }
- else
- {
- // flip
- asASSERT( numBytes == 1 || numBytes == 2 );
- switch( numBytes )
- {
- case 1:
- {
- volatile asBYTE *bPtr = (asBYTE*)ARG_DW(args[argDwordOffset]);
- asBYTE t = bPtr[0];
- bPtr[0] = bPtr[3];
- bPtr[3] = t;
- t = bPtr[1];
- bPtr[1] = bPtr[2];
- bPtr[2] = t;
- }
- break;
- case 2:
- {
- volatile asWORD *wPtr = (asWORD*)ARG_DW(args[argDwordOffset]);
- asWORD t = wPtr[0];
- wPtr[0] = wPtr[1];
- wPtr[1] = t;
- }
- break;
- }
- ++argDwordOffset;
- }
-
- if( isVarArg )
- {
- // skip the implicit typeID
- ++argDwordOffset;
- }
- }
-
- asASSERT( totalArgumentCount <= AS_PPC_MAX_ARGS );
-
- // mark all float/double/int arguments
- int argIndex = 0;
- for( a = 0; a < (int)descr->parameterTypes.GetLength(); ++a, ++argIndex )
- {
- // get the base type
- argsType[argIndex] = ppcINTARG;
- if( descr->parameterTypes[a].IsFloatType() && !descr->parameterTypes[a].IsReference() )
- {
- argsType[argIndex] = ppcFLOATARG;
- }
- if( descr->parameterTypes[a].IsDoubleType() && !descr->parameterTypes[a].IsReference() )
- {
- argsType[argIndex] = ppcDOUBLEARG;
- }
- if( descr->parameterTypes[a].GetSizeOnStackDWords() == 2 && !descr->parameterTypes[a].IsDoubleType() && !descr->parameterTypes[a].IsReference() )
- {
- argsType[argIndex] = ppcLONGARG;
- }
-
- // if it is a variable argument, account for the typeID
- if( IsVariableArgument(descr->parameterTypes[a]) )
- {
- // implicitly add another parameter (AFTER the parameter above), for the TypeID
- argsType[++argIndex] = ppcINTARG;
- }
- }
- asASSERT( argIndex == totalArgumentCount );
-
- asDWORD paramBuffer[64];
- if( sysFunc->takesObjByVal )
- {
- paramSize = 0;
- int spos = 0;
- int dpos = 1;
-
- for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
- {
- if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() &&
- !(descr->parameterTypes[n].GetTypeInfo()->flags & asOBJ_APP_ARRAY) )
- {
-#ifdef COMPLEX_OBJS_PASSED_BY_REF
- if( descr->parameterTypes[n].GetTypeInfo()->flags & COMPLEX_MASK )
- {
- paramBuffer[dpos++] = args[spos++];
- ++paramSize;
- }
- else
-#endif
- {
- // NOTE: we may have to do endian flipping here
-
- // Copy the object's memory to the buffer
- memcpy( ¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes() );
-
- // Delete the original memory
- engine->CallFree( *(char**)(args+spos) );
- spos++;
- dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
- paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
- }
- }
- else
- {
- // Copy the value directly
- paramBuffer[dpos++] = args[spos++];
- if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
- {
- paramBuffer[dpos++] = args[spos++];
- }
- paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
- }
-
- // if this was a variable argument parameter, then account for the implicit typeID
- if( IsVariableArgument( descr->parameterTypes[n] ) )
- {
- // the TypeID is just a DWORD
- paramBuffer[dpos++] = args[spos++];
- ++paramSize;
- }
- }
-
- // Keep a free location at the beginning
- args = ¶mBuffer[1];
- }
-
- // one last verification to make sure things are how we expect
- switch( callConv )
- {
- case ICC_CDECL:
- case ICC_CDECL_RETURNINMEM:
- case ICC_STDCALL:
- case ICC_STDCALL_RETURNINMEM:
- retQW = CallCDeclFunction( args, argsType, paramSize, (asDWORD)func, retPointer );
- break;
- case ICC_THISCALL:
- case ICC_THISCALL_RETURNINMEM:
- retQW = CallThisCallFunction(obj, args, argsType, paramSize, (asDWORD)func, retPointer );
- break;
- case ICC_VIRTUAL_THISCALL:
- case ICC_VIRTUAL_THISCALL_RETURNINMEM:
- // Get virtual function table from the object pointer
- vftable = *(asDWORD**)obj;
- retQW = CallThisCallFunction( obj, args, argsType, paramSize, vftable[asDWORD(func)>>2], retPointer );
- break;
- case ICC_CDECL_OBJLAST:
- case ICC_CDECL_OBJLAST_RETURNINMEM:
- retQW = CallThisCallFunction_objLast( obj, args, argsType, paramSize, (asDWORD)func, retPointer );
- break;
- case ICC_CDECL_OBJFIRST:
- case ICC_CDECL_OBJFIRST_RETURNINMEM:
- retQW = CallThisCallFunction( obj, args, argsType, paramSize, (asDWORD)func, retPointer );
- break;
- default:
- context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
- }
-
- if( sysFunc->hostReturnFloat )
- {
- // If the return is a float value we need to get the value from the FP register
- if( sysFunc->hostReturnSize == 1 )
- *(asDWORD*)&retQW = GetReturnedFloat();
- else
- retQW = GetReturnedDouble();
- }
- else if( sysFunc->hostReturnSize == 1 )
- {
- // Move the bits to the higher value to compensate for the adjustment that the caller does
- retQW <<= 32;
- }
-
- return retQW;
-}
-
-END_AS_NAMESPACE
-
-#endif // AS_PTR_SIZE == 2
-#endif // AS_PPC_64
-#endif // AS_MAX_PORTABILITY
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_sh4.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_sh4.cpp
deleted file mode 100644
index b24be9a5454..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_sh4.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2015 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-
-//
-// as_callfunc_sh4.cpp
-//
-// These functions handle the actual calling of system functions
-//
-// This version is SH4 specific and was originally written
-// by Fredrik Ehnbom in May, 2004
-// Later updated for angelscript 2.0.0 by Fredrik Ehnbom in Jan, 2005
-
-// References:
-// * http://www.renesas.com/avs/resource/japan/eng/pdf/mpumcu/e602156_sh4.pdf
-// * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcechp40/html/_callsh4_SH_4_Calling_Standard.asp
-
-
-#include "as_config.h"
-
-#ifndef AS_MAX_PORTABILITY
-#ifdef AS_SH4
-
-#include "as_callfunc.h"
-#include "as_scriptengine.h"
-#include "as_texts.h"
-#include "as_tokendef.h"
-#include "as_context.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-BEGIN_AS_NAMESPACE
-
-#define AS_SH4_MAX_ARGS 32
-// The array used to send values to the correct places.
-// first 0-4 regular values to load into the r4-r7 registers
-// then 0-8 float values to load into the fr4-fr11 registers
-// then (AS_SH4_MAX_ARGS - 12) values to load onto the stack
-// the +1 is for when CallThis (object methods) is used
-// extra +1 when returning in memory
-extern "C" {
-static asDWORD sh4Args[AS_SH4_MAX_ARGS + 1 + 1];
-}
-
-// Loads all data into the correct places and calls the function.
-// intArgSize is the size in bytes for how much data to put in int registers
-// floatArgSize is the size in bytes for how much data to put in float registers
-// stackArgSize is the size in bytes for how much data to put on the callstack
-extern "C" asQWORD sh4Func(int intArgSize, int floatArgSize, int stackArgSize, asDWORD func);
-
-asm(""
-" .align 4\n"
-" .global _sh4Func\n"
-"_sh4Func:\n"
-" mov.l r14, at -r15\n"
-" mov.l r13, at -r15\n"
-" mov.l r12, at -r15\n"
-" sts.l pr, at -r15\n" // must be saved since we call a subroutine
-" mov r7, r14\n" // func
-" mov r6, r13\n" // stackArgSize
-" mov.l r5, at -r15\n" // floatArgSize
-" mov.l sh4Args,r0\n"
-" pref @r0\n"
-" mov r4, r1\n" // intArgsize
-" mov #33*4,r2\n"
-" extu.b r2,r2\n" // make unsigned (33*4 = 132 => 128)
-" mov.l @(r0,r2), r2\n" // r2 has adress for when returning in memory
-"_sh4f_intarguments:\n" // copy all the int arguments to the respective registers
-" mov #4*2*2,r3\n" // calculate how many bytes to skip
-" sub r1,r3\n"
-" braf r3\n"
-" add #-4,r1\n" // we are indexing the array backwards, so subtract one (delayed slot)
-" mov.l @(r0,r1),r7\n" // 4 arguments
-" add #-4,r1\n"
-" mov.l @(r0,r1),r6\n" // 3 arguments
-" add #-4,r1\n"
-" mov.l @(r0,r1),r5\n" // 2 arguments
-" add #-4,r1\n"
-" mov.l @(r0,r1),r4\n" // 1 argument
-" nop\n"
-"_sh4f_floatarguments:\n" // copy all the float arguments to the respective registers
-" add #4*4, r0\n"
-" mov.l @r15+,r1\n" // floatArgSize
-" mov #8*2*2,r3\n" // calculate how many bytes to skip
-" sub r1,r3\n"
-" braf r3\n"
-" add #-4,r1\n" // we are indexing the array backwards, so subtract one (delayed slot)
-" fmov.s @(r0,r1),fr11\n" // 8 arguments
-" add #-4,r1\n"
-" fmov.s @(r0,r1),fr10\n" // 7 arguments
-" add #-4,r1\n"
-" fmov.s @(r0,r1),fr9\n" // 6 arguments
-" add #-4,r1\n"
-" fmov.s @(r0,r1),fr8\n" // 5 arguments
-" add #-4,r1\n"
-" fmov.s @(r0,r1),fr7\n" // 4 arguments
-" add #-4,r1\n"
-" fmov.s @(r0,r1),fr6\n" // 3 arguments
-" add #-4,r1\n"
-" fmov.s @(r0,r1),fr5\n" // 2 arguments
-" add #-4,r1\n"
-" fmov.s @(r0,r1),fr4\n" // 1 argument
-" nop\n"
-"_sh4f_stackarguments:\n" // copy all the stack argument onto the stack
-" add #8*4, r0\n"
-" mov r0, r1\n"
-" mov #0, r0\n" // init position counter (also used as a 0-check on the line after)
-" cmp/eq r0, r13\n"
-" bt _sh4f_functioncall\n" // no arguments to push onto the stack
-" mov r13, r3\n" // stackArgSize
-" sub r3,r15\n" // "allocate" space on the stack
-" shlr2 r3\n" // make into a counter
-"_sh4f_stackloop:\n"
-" mov.l @r1+, r12\n"
-" mov.l r12, @(r0, r15)\n"
-" add #4, r0\n"
-" dt r3\n"
-" bf _sh4f_stackloop\n"
-"_sh4f_functioncall:\n"
-" jsr @r14\n" // no arguments
-" nop\n"
-" add r13, r15\n" // restore stack position
-" lds.l @r15+,pr\n"
-" mov.l @r15+, r12\n"
-" mov.l @r15+, r13\n"
-" rts\n"
-" mov.l @r15+, r14\n" // delayed slot
-"\n"
-" .align 4\n"
-"sh4Args:\n"
-" .long _sh4Args\n"
-);
-
-// puts the arguments in the correct place in the sh4Args-array. See comments above.
-// This could be done better.
-inline void splitArgs(const asDWORD *args, int argNum, int &numRegIntArgs, int &numRegFloatArgs, int &numRestArgs, int hostFlags) {
- int i;
-
- int argBit = 1;
- for (i = 0; i < argNum; i++) {
- if (hostFlags & argBit) {
- if (numRegFloatArgs < 12 - 4) {
- // put in float register
- sh4Args[4 + numRegFloatArgs] = args[i];
- numRegFloatArgs++;
- } else {
- // put in stack
- sh4Args[4 + 8 + numRestArgs] = args[i];
- numRestArgs++;
- }
- } else {
- if (numRegIntArgs < 8 - 4) {
- // put in int register
- sh4Args[numRegIntArgs] = args[i];
- numRegIntArgs++;
- } else {
- // put in stack
- sh4Args[4 + 8 + numRestArgs] = args[i];
- numRestArgs++;
- }
- }
- argBit <<= 1;
- }
-}
-asQWORD CallCDeclFunction(const asDWORD *args, int argSize, asDWORD func, int flags)
-{
- int argNum = argSize >> 2;
-
- int intArgs = 0;
- int floatArgs = 0;
- int restArgs = 0;
-
- // put the arguments in the correct places in the sh4Args array
- if (argNum > 0)
- splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags);
-
- return sh4Func(intArgs << 2, floatArgs << 2, restArgs << 2, func);
-}
-
-// This function is identical to CallCDeclFunction, with the only difference that
-// the value in the first parameter is the object
-asQWORD CallThisCallFunction(const void *obj, const asDWORD *args, int argSize, asDWORD func, int flags)
-{
- int argNum = argSize >> 2;
-
- int intArgs = 1;
- int floatArgs = 0;
- int restArgs = 0;
-
- sh4Args[0] = (asDWORD) obj;
-
- // put the arguments in the correct places in the sh4Args array
- if (argNum >= 1)
- splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags);
-
- return sh4Func(intArgs << 2, floatArgs << 2, restArgs << 2, func);
-}
-// This function is identical to CallCDeclFunction, with the only difference that
-// the value in the last parameter is the object
-asQWORD CallThisCallFunction_objLast(const void *obj, const asDWORD *args, int argSize, asDWORD func, int flags)
-{
- int argNum = argSize >> 2;
-
- int intArgs = 0;
- int floatArgs = 0;
- int restArgs = 0;
-
-
- // put the arguments in the correct places in the sh4Args array
- if (argNum >= 1)
- splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags);
-
- if (intArgs < 4) {
- sh4Args[intArgs] = (asDWORD) obj;
- intArgs++;
- } else {
- sh4Args[4 + 8 + restArgs] = (asDWORD) obj;
- restArgs++;
- }
-
-
- return sh4Func(intArgs << 2, floatArgs << 2, restArgs << 2, func);
-}
-
-asDWORD GetReturnedFloat()
-{
- asDWORD f;
-
- asm("fmov.s fr0, %0\n" : "=m"(f));
-
- return f;
-}
-
-// sizeof(double) == 4 with sh-elf-gcc (3.4.0) -m4
-// so this isn't really used...
-asQWORD GetReturnedDouble()
-{
- asQWORD d;
-
- asm("fmov dr0, %0\n" : "=m"(d));
-
- return d;
-}
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/, void */*secondObject*/)
-{
- // TODO: SH4 does not yet support THISCALL_OBJFIRST/LAST
-
- asCScriptEngine *engine = context->m_engine;
- asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
- int callConv = sysFunc->callConv;
-
- asQWORD retQW = 0;
-
- void *func = (void*)sysFunc->func;
- int paramSize = sysFunc->paramSize;
- asDWORD *vftable;
-
- if( descr->returnType.IsObject() && !descr->returnType.IsReference() && !descr->returnType.IsObjectHandle() )
- {
- sh4Args[AS_SH4_MAX_ARGS+1] = (asDWORD) retPointer;
- }
-
- asASSERT(descr->parameterTypes.GetLength() <= 32);
-
- // mark all float arguments
- int argBit = 1;
- int hostFlags = 0;
- int intArgs = 0;
- for( asUINT a = 0; a < descr->parameterTypes.GetLength(); a++ ) {
- if (descr->parameterTypes[a].IsFloatType()) {
- hostFlags |= argBit;
- } else intArgs++;
- argBit <<= 1;
- }
-
- asDWORD paramBuffer[64];
- if( sysFunc->takesObjByVal )
- {
- paramSize = 0;
- int spos = 0;
- int dpos = 1;
- for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
- {
- if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
- {
-#ifdef COMPLEX_OBJS_PASSED_BY_REF
- if( descr->parameterTypes[n].GetTypeInfo()->flags & COMPLEX_MASK )
- {
- paramBuffer[dpos++] = args[spos++];
- paramSize++;
- }
- else
-#endif
- {
- // Copy the object's memory to the buffer
- memcpy(¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
- // Delete the original memory
- engine->CallFree(*(char**)(args+spos));
- spos++;
- dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
- paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
- }
- }
- else
- {
- // Copy the value directly
- paramBuffer[dpos++] = args[spos++];
- if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
- paramBuffer[dpos++] = args[spos++];
- paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
- }
- }
- // Keep a free location at the beginning
- args = ¶mBuffer[1];
- }
-
- switch( callConv )
- {
- case ICC_CDECL:
- case ICC_CDECL_RETURNINMEM:
- case ICC_STDCALL:
- case ICC_STDCALL_RETURNINMEM:
- retQW = CallCDeclFunction(args, paramSize<<2, (asDWORD)func, hostFlags);
- break;
- case ICC_THISCALL:
- case ICC_THISCALL_RETURNINMEM:
- retQW = CallThisCallFunction(obj, args, paramSize<<2, (asDWORD)func, hostFlags);
- break;
- case ICC_VIRTUAL_THISCALL:
- case ICC_VIRTUAL_THISCALL_RETURNINMEM:
- // Get virtual function table from the object pointer
- vftable = *(asDWORD**)obj;
- retQW = CallThisCallFunction(obj, args, paramSize<<2, vftable[asDWORD(func)>>2], hostFlags);
- break;
- case ICC_CDECL_OBJLAST:
- case ICC_CDECL_OBJLAST_RETURNINMEM:
- retQW = CallThisCallFunction_objLast(obj, args, paramSize<<2, (asDWORD)func, hostFlags);
- break;
- case ICC_CDECL_OBJFIRST:
- case ICC_CDECL_OBJFIRST_RETURNINMEM:
- retQW = CallThisCallFunction(obj, args, paramSize<<2, (asDWORD)func, hostFlags);
- break;
- default:
- context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
- }
-
- // If the return is a float value we need to get the value from the FP register
- if( sysFunc->hostReturnFloat )
- {
- if( sysFunc->hostReturnSize == 1 )
- *(asDWORD*)&retQW = GetReturnedFloat();
- else
- retQW = GetReturnedDouble();
- }
-
- return retQW;
-}
-
-END_AS_NAMESPACE
-
-#endif // AS_SH4
-#endif // AS_MAX_PORTABILITY
-
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_gcc.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_gcc.cpp
deleted file mode 100644
index ad6c27fb6d1..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_gcc.cpp
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2017 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-/*
- * Implements the AMD64 calling convention for gcc-based 64bit Unices
- *
- * Author: Ionut "gargltk" Leonte <ileonte at bitdefender.com>
- *
- * Initial author: niteice
- *
- * Added support for functor methods by Jordi Oliveras Rovira in April, 2014.
- */
-
-// Useful references for the System V AMD64 ABI:
-// http://eli.thegreenplace.net/2011/09/06/stack-frame-layout-on-x86-64/
-// http://math-atlas.sourceforge.net/devel/assembly/abi_sysV_amd64.pdf
-
-#include "as_config.h"
-
-#ifndef AS_MAX_PORTABILITY
-#ifdef AS_X64_GCC
-
-#include "as_scriptengine.h"
-#include "as_texts.h"
-#include "as_context.h"
-
-BEGIN_AS_NAMESPACE
-
-enum argTypes { x64INTARG = 0, x64FLOATARG = 1 };
-typedef asQWORD ( *funcptr_t )( void );
-
-#define X64_MAX_ARGS 32
-#define MAX_CALL_INT_REGISTERS 6
-#define MAX_CALL_SSE_REGISTERS 8
-#define X64_CALLSTACK_SIZE ( X64_MAX_ARGS + MAX_CALL_SSE_REGISTERS + 3 )
-
-// Note to self: Always remember to inform the used registers on the clobber line,
-// so that the gcc optimizer doesn't try to use them for other things
-
-static asQWORD __attribute__((noinline)) X64_CallFunction(const asQWORD *args, int cnt, funcptr_t func, asQWORD &retQW2, bool returnFloat)
-{
- // Need to flag the variable as volatile so the compiler doesn't optimize out the variable
- volatile asQWORD retQW1 = 0;
-
- // Reference: http://www.x86-64.org/documentation/abi.pdf
-
- __asm__ __volatile__ (
-
- " movq %0, %%rcx \n" // rcx = cnt
- " movq %1, %%r10 \n" // r10 = args
- " movq %2, %%r11 \n" // r11 = func
-
- // Backup stack pointer in R15 that is guaranteed to maintain its value over function calls
- " movq %%rsp, %%r15 \n"
-#ifdef __OPTIMIZE__
- // Make sure the stack unwind logic knows we've backed up the stack pointer in register r15
- // This should only be done if any optimization is done. If no optimization (-O0) is used,
- // then the compiler already backups the rsp before entering the inline assembler code
- " .cfi_def_cfa_register r15 \n"
-#endif
-
- // Skip the first 128 bytes on the stack frame, called "red zone",
- // that might be used by the compiler to store temporary values
- " sub $128, %%rsp \n"
-
- // Make sure the stack pointer will be aligned to 16 bytes when the function is called
- " movq %%rcx, %%rdx \n"
- " salq $3, %%rdx \n"
- " movq %%rsp, %%rax \n"
- " sub %%rdx, %%rax \n"
- " and $15, %%rax \n"
- " sub %%rax, %%rsp \n"
-
- // Push the stack parameters, i.e. the arguments that won't be loaded into registers
- " movq %%rcx, %%rsi \n"
- " testl %%esi, %%esi \n"
- " jle endstack \n"
- " subl $1, %%esi \n"
- " xorl %%edx, %%edx \n"
- " leaq 8(, %%rsi, 8), %%rcx \n"
- "loopstack: \n"
- " movq 112(%%r10, %%rdx), %%rax \n"
- " pushq %%rax \n"
- " addq $8, %%rdx \n"
- " cmpq %%rcx, %%rdx \n"
- " jne loopstack \n"
- "endstack: \n"
-
- // Populate integer and floating point parameters
- " movq %%r10, %%rax \n"
- " mov (%%rax), %%rdi \n"
- " mov 8(%%rax), %%rsi \n"
- " mov 16(%%rax), %%rdx \n"
- " mov 24(%%rax), %%rcx \n"
- " mov 32(%%rax), %%r8 \n"
- " mov 40(%%rax), %%r9 \n"
- " add $48, %%rax \n"
- " movsd (%%rax), %%xmm0 \n"
- " movsd 8(%%rax), %%xmm1 \n"
- " movsd 16(%%rax), %%xmm2 \n"
- " movsd 24(%%rax), %%xmm3 \n"
- " movsd 32(%%rax), %%xmm4 \n"
- " movsd 40(%%rax), %%xmm5 \n"
- " movsd 48(%%rax), %%xmm6 \n"
- " movsd 56(%%rax), %%xmm7 \n"
-
- // Call the function
- " call *%%r11 \n"
-
- // Restore stack pointer
- " mov %%r15, %%rsp \n"
-#ifdef __OPTIMIZE__
- // Inform the stack unwind logic that the stack pointer has been restored
- // This should only be done if any optimization is done. If no optimization (-O0) is used,
- // then the compiler already backups the rsp before entering the inline assembler code
- " .cfi_def_cfa_register rsp \n"
-#endif
-
- // Put return value in retQW1 and retQW2, using either RAX:RDX or XMM0:XMM1 depending on type of return value
- " movl %5, %%ecx \n"
- " testb %%cl, %%cl \n"
- " je intret \n"
- " lea %3, %%rax \n"
- " movq %%xmm0, (%%rax) \n"
- " lea %4, %%rdx \n"
- " movq %%xmm1, (%%rdx) \n"
- " jmp endcall \n"
- "intret: \n"
- " movq %%rax, %3 \n"
- " movq %%rdx, %4 \n"
- "endcall: \n"
-
- : : "g" ((asQWORD)cnt), "g" (args), "g" (func), "m" (retQW1), "m" (retQW2), "m" (returnFloat)
- : "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7",
- "%rdi", "%rsi", "%rax", "%rdx", "%rcx", "%r8", "%r9", "%r10", "%r11", "%r15");
-
- return retQW1;
-}
-
-// returns true if the given parameter is a 'variable argument'
-static inline bool IsVariableArgument( asCDataType type )
-{
- return ( type.GetTokenType() == ttQuestion ) ? true : false;
-}
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &retQW2, void *secondObject)
-{
- asCScriptEngine *engine = context->m_engine;
- asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
- int callConv = sysFunc->callConv;
- asQWORD retQW = 0;
- asDWORD *stack_pointer = args;
- funcptr_t *vftable = NULL;
- int totalArgumentCount = 0;
- int n = 0;
- int param_post = 0;
- int argIndex = 0;
- funcptr_t func = (funcptr_t)sysFunc->func;
-
- if( sysFunc->hostReturnInMemory )
- {
- // The return is made in memory
- callConv++;
- }
-
-#ifdef AS_NO_THISCALL_FUNCTOR_METHOD
- // Determine the real function pointer in case of virtual method
- if ( obj && ( callConv == ICC_VIRTUAL_THISCALL || callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM ) )
-#else
- if ( obj && ( callConv == ICC_VIRTUAL_THISCALL ||
- callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL_OBJFIRST ||
- callConv == ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL_OBJLAST ||
- callConv == ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM) )
-#endif
- {
- vftable = *((funcptr_t**)obj);
- func = vftable[FuncPtrToUInt(asFUNCTION_t(func)) >> 3];
- }
-
- // Determine the type of the arguments, and prepare the input array for the X64_CallFunction
- asQWORD paramBuffer[X64_CALLSTACK_SIZE] = { 0 };
- asBYTE argsType[X64_CALLSTACK_SIZE] = { 0 };
-
- switch ( callConv )
- {
- case ICC_CDECL_RETURNINMEM:
- case ICC_STDCALL_RETURNINMEM:
- {
- paramBuffer[0] = (asPWORD)retPointer;
- argsType[0] = x64INTARG;
-
- argIndex = 1;
-
- break;
- }
-#ifndef AS_NO_THISCALL_FUNCTOR_METHOD
- case ICC_THISCALL_OBJLAST:
- case ICC_VIRTUAL_THISCALL_OBJLAST:
- param_post = 2;
-#endif
- case ICC_THISCALL:
- case ICC_VIRTUAL_THISCALL:
- case ICC_CDECL_OBJFIRST:
- {
- paramBuffer[0] = (asPWORD)obj;
- argsType[0] = x64INTARG;
-
- argIndex = 1;
-
- break;
- }
-#ifndef AS_NO_THISCALL_FUNCTOR_METHOD
- case ICC_THISCALL_OBJLAST_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM:
- param_post = 2;
-#endif
- case ICC_THISCALL_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_RETURNINMEM:
- case ICC_CDECL_OBJFIRST_RETURNINMEM:
- {
- paramBuffer[0] = (asPWORD)retPointer;
- paramBuffer[1] = (asPWORD)obj;
- argsType[0] = x64INTARG;
- argsType[1] = x64INTARG;
-
- argIndex = 2;
-
- break;
- }
-#ifndef AS_NO_THISCALL_FUNCTOR_METHOD
- case ICC_THISCALL_OBJFIRST:
- case ICC_VIRTUAL_THISCALL_OBJFIRST:
- {
- paramBuffer[0] = (asPWORD)obj;
- paramBuffer[1] = (asPWORD)secondObject;
- argsType[0] = x64INTARG;
- argsType[1] = x64INTARG;
-
- argIndex = 2;
- break;
- }
- case ICC_THISCALL_OBJFIRST_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM:
- {
- paramBuffer[0] = (asPWORD)retPointer;
- paramBuffer[1] = (asPWORD)obj;
- paramBuffer[2] = (asPWORD)secondObject;
- argsType[0] = x64INTARG;
- argsType[1] = x64INTARG;
- argsType[2] = x64INTARG;
-
- argIndex = 3;
- break;
- }
-#endif
- case ICC_CDECL_OBJLAST:
- param_post = 1;
- break;
- case ICC_CDECL_OBJLAST_RETURNINMEM:
- {
- paramBuffer[0] = (asPWORD)retPointer;
- argsType[0] = x64INTARG;
-
- argIndex = 1;
- param_post = 1;
-
- break;
- }
- }
-
- int argumentCount = ( int )descr->parameterTypes.GetLength();
- for( int a = 0; a < argumentCount; ++a )
- {
- const asCDataType &parmType = descr->parameterTypes[a];
- if( parmType.IsFloatType() && !parmType.IsReference() )
- {
- argsType[argIndex] = x64FLOATARG;
- memcpy(paramBuffer + argIndex, stack_pointer, sizeof(float));
- argIndex++;
- stack_pointer++;
- }
- else if( parmType.IsDoubleType() && !parmType.IsReference() )
- {
- argsType[argIndex] = x64FLOATARG;
- memcpy(paramBuffer + argIndex, stack_pointer, sizeof(double));
- argIndex++;
- stack_pointer += 2;
- }
- else if( IsVariableArgument( parmType ) )
- {
- // The variable args are really two, one pointer and one type id
- argsType[argIndex] = x64INTARG;
- argsType[argIndex+1] = x64INTARG;
- memcpy(paramBuffer + argIndex, stack_pointer, sizeof(void*));
- memcpy(paramBuffer + argIndex + 1, stack_pointer + 2, sizeof(asDWORD));
- argIndex += 2;
- stack_pointer += 3;
- }
- else if( parmType.IsPrimitive() ||
- parmType.IsReference() ||
- parmType.IsObjectHandle() )
- {
- argsType[argIndex] = x64INTARG;
- if( parmType.GetSizeOnStackDWords() == 1 )
- {
- memcpy(paramBuffer + argIndex, stack_pointer, sizeof(asDWORD));
- stack_pointer++;
- }
- else
- {
- memcpy(paramBuffer + argIndex, stack_pointer, sizeof(asQWORD));
- stack_pointer += 2;
- }
- argIndex++;
- }
- else
- {
- // An object is being passed by value
- if( (parmType.GetTypeInfo()->flags & COMPLEX_MASK) ||
- parmType.GetSizeInMemoryDWords() > 4 )
- {
- // Copy the address of the object
- argsType[argIndex] = x64INTARG;
- memcpy(paramBuffer + argIndex, stack_pointer, sizeof(asQWORD));
- argIndex++;
- }
- else if( (parmType.GetTypeInfo()->flags & asOBJ_APP_CLASS_ALLINTS) ||
- (parmType.GetTypeInfo()->flags & asOBJ_APP_PRIMITIVE) )
- {
- // Copy the value of the object
- if( parmType.GetSizeInMemoryDWords() > 2 )
- {
- argsType[argIndex] = x64INTARG;
- argsType[argIndex+1] = x64INTARG;
- memcpy(paramBuffer + argIndex, *(asDWORD**)stack_pointer, parmType.GetSizeInMemoryBytes());
- argIndex += 2;
- }
- else
- {
- argsType[argIndex] = x64INTARG;
- memcpy(paramBuffer + argIndex, *(asDWORD**)stack_pointer, parmType.GetSizeInMemoryBytes());
- argIndex++;
- }
- // Delete the original memory
- engine->CallFree(*(void**)stack_pointer);
- }
- else if( (parmType.GetTypeInfo()->flags & asOBJ_APP_CLASS_ALLFLOATS) ||
- (parmType.GetTypeInfo()->flags & asOBJ_APP_FLOAT) )
- {
- // Copy the value of the object
- if( parmType.GetSizeInMemoryDWords() > 2 )
- {
- argsType[argIndex] = x64FLOATARG;
- argsType[argIndex+1] = x64FLOATARG;
- memcpy(paramBuffer + argIndex, *(asDWORD**)stack_pointer, parmType.GetSizeInMemoryBytes());
- argIndex += 2;
- }
- else
- {
- argsType[argIndex] = x64FLOATARG;
- memcpy(paramBuffer + argIndex, *(asDWORD**)stack_pointer, parmType.GetSizeInMemoryBytes());
- argIndex++;
- }
- // Delete the original memory
- engine->CallFree(*(void**)stack_pointer);
- }
- stack_pointer += 2;
- }
- }
-
- // For the CDECL_OBJ_LAST calling convention we need to add the object pointer as the last argument
- if( param_post )
- {
-#ifdef AS_NO_THISCALL_FUNCTOR_METHOD
- paramBuffer[argIndex] = (asPWORD)obj;
-#else
- paramBuffer[argIndex] = (asPWORD)(param_post > 1 ? secondObject : obj);
-#endif
- argsType[argIndex] = x64INTARG;
- argIndex++;
- }
-
- totalArgumentCount = argIndex;
-
- /*
- * Q: WTF is going on here !?
- *
- * A: The idea is to pre-arange the parameters so that X64_CallFunction() can do
- * it's little magic which must work regardless of how the compiler decides to
- * allocate registers. Basically:
- * - the first MAX_CALL_INT_REGISTERS entries in tempBuff will
- * contain the values/types of the x64INTARG parameters - that is the ones who
- * go into the registers. If the function has less then MAX_CALL_INT_REGISTERS
- * integer parameters then the last entries will be set to 0
- * - the next MAX_CALL_SSE_REGISTERS entries will contain the float/double arguments
- * that go into the floating point registers. If the function has less than
- * MAX_CALL_SSE_REGISTERS floating point parameters then the last entries will
- * be set to 0
- * - index MAX_CALL_INT_REGISTERS + MAX_CALL_SSE_REGISTERS marks the start of the
- * parameters which will get passed on the stack. These are added to the array
- * in reverse order so that X64_CallFunction() can simply push them to the stack
- * without the need to perform further tests
- */
- asQWORD tempBuff[X64_CALLSTACK_SIZE] = { 0 };
- asBYTE argsSet[X64_CALLSTACK_SIZE] = { 0 };
- int used_int_regs = 0;
- int used_sse_regs = 0;
- int used_stack_args = 0;
- int idx = 0;
- for ( n = 0; ( n < totalArgumentCount ) && ( used_int_regs < MAX_CALL_INT_REGISTERS ); n++ )
- {
- if ( argsType[n] == x64INTARG )
- {
- argsSet[n] = 1;
- tempBuff[idx++] = paramBuffer[n];
- used_int_regs++;
- }
- }
- idx = MAX_CALL_INT_REGISTERS;
- for ( n = 0; ( n < totalArgumentCount ) && ( used_sse_regs < MAX_CALL_SSE_REGISTERS ); n++ )
- {
- if ( argsType[n] == x64FLOATARG )
- {
- argsSet[n] = 1;
- tempBuff[idx++] = paramBuffer[n];
- used_sse_regs++;
- }
- }
- idx = MAX_CALL_INT_REGISTERS + MAX_CALL_SSE_REGISTERS;
- for ( n = totalArgumentCount - 1; n >= 0; n-- )
- {
- if ( !argsSet[n] )
- {
- tempBuff[idx++] = paramBuffer[n];
- used_stack_args++;
- }
- }
-
- retQW = X64_CallFunction( tempBuff, used_stack_args, func, retQW2, sysFunc->hostReturnFloat );
-
- return retQW;
-}
-
-END_AS_NAMESPACE
-
-#endif // AS_X64_GCC
-#endif // AS_MAX_PORTABILITY
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_mingw.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_mingw.cpp
deleted file mode 100644
index 1c5bdb55236..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_mingw.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2015 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-//
-// This code was adapted from as_callfunc_x64_msvc by _Vicious_ on August 20th, 2011.
-//
-// Added support for functor methods by Jordi Oliveras Rovira in April, 2014.
-//
-
-#include <stdio.h>
-
-#include "as_config.h"
-
-#ifndef AS_MAX_PORTABILITY
-#ifdef AS_X64_MINGW
-
-#include "as_callfunc.h"
-#include "as_scriptengine.h"
-#include "as_texts.h"
-#include "as_context.h"
-
-BEGIN_AS_NAMESPACE
-
-static asQWORD __attribute__((noinline)) CallX64(const asQWORD *args, const asQWORD *floatArgs, const int paramSize, asQWORD func)
-{
- volatile asQWORD ret = 0;
-
- __asm__ __volatile__ (
- "# Move the parameters into registers before the rsp is modified\n"
- "mov %1, %%r10\n" // r10 = args
- "mov %2, %%r11\n" // r11 = floatArgs
- "xor %%r12, %%r12\n"
- "mov %3, %%r12d\n"
- "mov %4, %%r14\n" // r14 = func
-
- "# Store the stack pointer in r15 since it is guaranteed not to change over a function call\n"
- "mov %%rsp, %%r15\n"
-
- "# Allocate space on the stack for the arguments\n"
- "# Make room for at least 4 arguments even if there are less. When\n"
- "# the compiler does optimizations for speed it may use these for \n"
- "# temporary storage.\n"
- "mov %%r12, %%rdi\n"
- "add $32,%%edi\n"
-
- "# Make sure the stack pointer is 16byte aligned so the\n"
- "# whole program optimizations will work properly\n"
- "# TODO: runtime optimize: Can this be optimized with fewer instructions?\n"
- "mov %%rsp,%%rsi\n"
- "sub %%rdi,%%rsi\n"
- "and $0x8,%%rsi\n"
- "add %%rsi,%%rdi\n"
- "sub %%rdi,%%rsp\n"
-
- "# Jump straight to calling the function if no parameters\n"
- "cmp $0,%%r12 # Compare paramSize with 0\n"
- "je callfunc # Jump to call funtion if (paramSize == 0)\n"
-
- "# Copy arguments from script stack to application stack\n"
- "# Order is (first to last):\n"
- "# rcx, rdx, r8, r9 & everything else goes on stack\n"
- "movq (%%r10),%%rcx\n"
- "movq 8(%%r10),%%rdx\n"
- "movq 16(%%r10),%%r8\n"
- "movq 24(%%r10),%%r9\n"
-
- "# Negate the 4 params from the size to be copied\n"
- "sub $32,%%r12d\n"
- "js copyfloat # Jump if negative result\n"
- "jz copyfloat # Jump if zero result\n"
-
- "# Now copy all remaining params onto stack allowing space for first four\n"
- "# params to be flushed back to the stack if required by the callee.\n"
- "add $32,%%r10 # Position input pointer 4 args ahead\n"
- "mov %%rsp,%%r13 # Put the stack pointer into r13\n"
- "add $32,%%r13 # Leave space for first 4 args on stack\n"
-
- "copyoverflow:\n"
- "movq (%%r10),%%rdi # Read param from source stack into rdi\n"
- "movq %%rdi,(%%r13) # Copy param to real stack\n"
- "add $8,%%r13 # Move virtual stack pointer\n"
- "add $8,%%r10 # Move source stack pointer\n"
- "sub $8,%%r12d # Decrement remaining count\n"
- "jnz copyoverflow # Continue if more params\n"
-
- "copyfloat:\n"
- "# Any floating point params?\n"
- "cmp $0,%%r11\n"
- "je callfunc\n"
-
- "movlpd (%%r11),%%xmm0\n"
- "movlpd 8(%%r11),%%xmm1\n"
- "movlpd 16(%%r11),%%xmm2\n"
- "movlpd 24(%%r11),%%xmm3\n"
-
- "callfunc:\n"
- "call *%%r14\n"
-
- "# restore stack pointer\n"
- "mov %%r15, %%rsp\n"
-
- "lea %0, %%rbx\n" // Load the address of the ret variable into rbx
- "movq %%rax,(%%rbx)\n" // Copy the returned value into the ret variable
-
- : // no output
- : "m" (ret), "r" (args), "r" (floatArgs), "r" (paramSize), "r" (func)
- : "rdi", "rsi", "rsp", "rbx", "r10", "r11", "%r12", "r13", "r14", "r15"
- );
-
- return ret;
-}
-
-static asDWORD GetReturnedFloat()
-{
- volatile asDWORD ret = 0;
-
- __asm__ __volatile__ (
- "lea %0, %%rax\n"
- "movss %%xmm0, (%%rax)"
- : /* no output */
- : "m" (ret)
- : "%rax"
- );
-
- return ret;
-}
-
-static asQWORD GetReturnedDouble()
-{
- volatile asQWORD ret = 0;
-
- __asm__ __volatile__ (
- "lea %0, %%rax\n"
- "movlpd %%xmm0, (%%rax)"
- : /* no optput */
- : "m" (ret)
- : "%rax"
- );
-
- return ret;
-}
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/, void *secondObject)
-{
- asCScriptEngine *engine = context->m_engine;
- asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
-
- asQWORD retQW = 0;
- void *func = (void*)sysFunc->func;
- asUINT paramSize = 0; // QWords
- void **vftable;
-
- asQWORD allArgBuffer[64];
- asQWORD floatArgBuffer[4];
-
- int callConv = sysFunc->callConv;
-
- if( sysFunc->hostReturnInMemory )
- {
- // The return is made in memory
- callConv++;
-
- // Set the return pointer as the first argument
- allArgBuffer[paramSize++] = (asQWORD)retPointer;
- }
-
-#ifdef AS_NO_THISCALL_FUNCTOR_METHOD
- if( callConv == ICC_THISCALL ||
- callConv == ICC_THISCALL_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL ||
- callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM )
-#else
- // Optimization to avoid check 12 values (all ICC_ that contains THISCALL)
- if( (callConv >= ICC_THISCALL && callConv <= ICC_VIRTUAL_THISCALL_RETURNINMEM) ||
- (callConv >= ICC_THISCALL_OBJLAST && callConv <= ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM) )
-#endif
- {
- // Add the object pointer as the first parameter
- allArgBuffer[paramSize++] = (asQWORD)obj;
- }
-
- if( callConv == ICC_CDECL_OBJFIRST ||
- callConv == ICC_CDECL_OBJFIRST_RETURNINMEM )
- {
- // Add the object pointer as the first parameter
- allArgBuffer[paramSize++] = (asQWORD)obj;
- }
-#ifndef AS_NO_THISCALL_FUNCTOR_METHOD
- else if( callConv == ICC_THISCALL_OBJFIRST ||
- callConv == ICC_THISCALL_OBJFIRST_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL_OBJFIRST ||
- callConv == ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM )
- {
- // Add the object pointer as the first parameter
- allArgBuffer[paramSize++] = (asQWORD)secondObject;
- }
-#endif
-
-#ifdef AS_NO_THISCALL_FUNCTOR_METHOD
- if( callConv == ICC_VIRTUAL_THISCALL ||
- callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM )
-#else
- if( callConv == ICC_VIRTUAL_THISCALL ||
- callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL_OBJFIRST ||
- callConv == ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL_OBJLAST ||
- callConv == ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM )
-#endif
- {
- // Get the true function pointer from the virtual function table
- vftable = *(void***)obj;
- func = vftable[asPWORD(func)>>3];
- }
-
- // Move the arguments to the buffer
- asUINT dpos = paramSize;
- asUINT spos = 0;
- for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
- {
- if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
- {
- if( descr->parameterTypes[n].GetSizeInMemoryDWords() >= AS_LARGE_OBJ_MIN_SIZE ||
- (descr->parameterTypes[n].GetTypeInfo()->flags & COMPLEX_MASK) )
- {
- allArgBuffer[dpos++] = *(asQWORD*)&args[spos];
- spos += AS_PTR_SIZE;
- paramSize++;
- }
- else
- {
- // Copy the object's memory to the buffer
- memcpy(&allArgBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
-
- // Delete the original memory
- engine->CallFree(*(char**)(args+spos));
- spos += AS_PTR_SIZE;
- asUINT dwords = descr->parameterTypes[n].GetSizeInMemoryDWords();
- asUINT qwords = (dwords >> 1) + (dwords & 1);
- dpos += qwords;
- paramSize += qwords;
- }
- }
- else if( descr->parameterTypes[n].GetTokenType() == ttQuestion )
- {
- // Copy the reference and the type id
- allArgBuffer[dpos++] = *(asQWORD*)&args[spos];
- spos += 2;
- allArgBuffer[dpos++] = args[spos++];
- paramSize += 2;
- }
- else
- {
- // Copy the value directly
- asUINT dwords = descr->parameterTypes[n].GetSizeOnStackDWords();
- if( dwords > 1 )
- {
- allArgBuffer[dpos] = *(asQWORD*)&args[spos];
-
- // Double arguments are moved to a separate buffer in order to be placed in the XMM registers,
- // though this is only done for first 4 arguments, the rest are placed on the stack
- if( paramSize < 4 && descr->parameterTypes[n].IsDoubleType() )
- floatArgBuffer[dpos] = *(asQWORD*)&args[spos];
-
- dpos++;
- spos += 2;
- }
- else
- {
- allArgBuffer[dpos] = args[spos];
-
- // Float arguments are moved to a separate buffer in order to be placed in the XMM registers,
- // though this is only done for first 4 arguments, the rest are placed on the stack
- if( paramSize < 4 && descr->parameterTypes[n].IsFloatType() )
- floatArgBuffer[dpos] = args[spos];
-
- dpos++;
- spos++;
- }
-
- paramSize++;
- }
- }
-
- if( callConv == ICC_CDECL_OBJLAST ||
- callConv == ICC_CDECL_OBJLAST_RETURNINMEM )
- {
- // Add the object pointer as the last parameter
- allArgBuffer[paramSize++] = (asQWORD)obj;
- }
-#ifndef AS_NO_THISCALL_FUNCTOR_METHOD
- else if( callConv == ICC_THISCALL_OBJLAST ||
- callConv == ICC_THISCALL_OBJLAST_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL_OBJLAST ||
- callConv == ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM )
- {
- // Add the object pointer as the last parameter
- allArgBuffer[paramSize++] = (asQWORD)secondObject;
- }
-#endif
-
- retQW = CallX64(allArgBuffer, floatArgBuffer, paramSize*8, (asPWORD)func);
-
- // If the return is a float value we need to get the value from the FP register
- if( sysFunc->hostReturnFloat )
- {
- if( sysFunc->hostReturnSize == 1 )
- *(asDWORD*)&retQW = GetReturnedFloat();
- else
- retQW = GetReturnedDouble();
- }
-
- return retQW;
-}
-
-END_AS_NAMESPACE
-
-#endif // AS_X64_MSVC
-#endif // AS_MAX_PORTABILITY
-
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_msvc.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_msvc.cpp
deleted file mode 100644
index 8af5adc01b8..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_msvc.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2015 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-//
-// Added support for thiscall methods by Jordi Oliveras Rovira in April, 2014.
-//
-
-#include <stdio.h>
-
-#include "as_config.h"
-
-#ifndef AS_MAX_PORTABILITY
-#ifdef AS_X64_MSVC
-
-#include "as_callfunc.h"
-#include "as_scriptengine.h"
-#include "as_texts.h"
-#include "as_context.h"
-
-BEGIN_AS_NAMESPACE
-
-// These functions are implemented in as_callfunc_x64_msvc.asm
-extern "C" asQWORD CallX64(const asQWORD *args, const asQWORD *floatArgs, int paramSize, asQWORD func);
-extern "C" asDWORD GetReturnedFloat();
-extern "C" asQWORD GetReturnedDouble();
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/, void *secondObject)
-{
- asCScriptEngine *engine = context->m_engine;
- asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
-
- asQWORD retQW = 0;
- void *func = (void*)sysFunc->func;
- asUINT paramSize = 0; // QWords
- void **vftable;
-
- asQWORD allArgBuffer[64];
- asQWORD floatArgBuffer[4];
-
- int callConv = sysFunc->callConv;
-
- // Optimization to avoid check 12 values (all ICC_ that contains THISCALL)
- if( (callConv >= ICC_THISCALL && callConv <= ICC_VIRTUAL_THISCALL_RETURNINMEM) ||
- (callConv >= ICC_THISCALL_OBJLAST && callConv <= ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM) )
- {
- // Add the object pointer as the first parameter
- allArgBuffer[paramSize++] = (asQWORD)obj;
- }
-
- if( sysFunc->hostReturnInMemory )
- {
- // The return is made in memory
- callConv++;
-
- // Set the return pointer as the first argument
- allArgBuffer[paramSize++] = (asQWORD)retPointer;
- }
-
- if( callConv == ICC_CDECL_OBJFIRST ||
- callConv == ICC_CDECL_OBJFIRST_RETURNINMEM )
- {
- // Add the object pointer as the first parameter
- allArgBuffer[paramSize++] = (asQWORD)obj;
- }
- else if( callConv == ICC_THISCALL_OBJFIRST ||
- callConv == ICC_THISCALL_OBJFIRST_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL_OBJFIRST ||
- callConv == ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM )
- {
- // Add the object pointer as the first parameter
- allArgBuffer[paramSize++] = (asQWORD)secondObject;
- }
-
- if( callConv == ICC_VIRTUAL_THISCALL ||
- callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL_OBJFIRST ||
- callConv == ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL_OBJLAST ||
- callConv == ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM )
- {
- // Get the true function pointer from the virtual function table
- vftable = *(void***)obj;
- func = vftable[asPWORD(func)>>2];
- }
-
- // Move the arguments to the buffer
- asUINT dpos = paramSize;
- asUINT spos = 0;
- for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
- {
- asCDataType &dt = descr->parameterTypes[n];
- if( dt.IsObject() && !dt.IsObjectHandle() && !dt.IsReference() )
- {
- if( dt.GetSizeInMemoryDWords() >= AS_LARGE_OBJ_MIN_SIZE ||
- (dt.GetTypeInfo()->flags & COMPLEX_MASK) )
- {
- allArgBuffer[dpos++] = *(asQWORD*)&args[spos];
- spos += AS_PTR_SIZE;
- paramSize++;
- }
- else
- {
- // Copy the object's memory to the buffer
- memcpy(&allArgBuffer[dpos], *(void**)(args+spos), dt.GetSizeInMemoryBytes());
-
- // Delete the original memory
- engine->CallFree(*(char**)(args+spos));
- spos += AS_PTR_SIZE;
- asUINT dwords = dt.GetSizeInMemoryDWords();
- asUINT qwords = (dwords >> 1) + (dwords & 1);
- dpos += qwords;
- paramSize += qwords;
- }
- }
- else if( dt.GetTokenType() == ttQuestion )
- {
- // Copy the reference and the type id
- allArgBuffer[dpos++] = *(asQWORD*)&args[spos];
- spos += 2;
- allArgBuffer[dpos++] = args[spos++];
- paramSize += 2;
- }
- else
- {
- // Copy the value directly
- asUINT dwords = dt.GetSizeOnStackDWords();
- if( dwords > 1 )
- {
- allArgBuffer[dpos] = *(asQWORD*)&args[spos];
-
- // Double arguments are moved to a separate buffer in order to be placed in the XMM registers,
- // though this is only done for first 4 arguments, the rest are placed on the stack
- if( paramSize < 4 && dt.IsDoubleType() )
- floatArgBuffer[dpos] = *(asQWORD*)&args[spos];
-
- dpos++;
- spos += 2;
- }
- else
- {
- allArgBuffer[dpos] = args[spos];
-
- // Float arguments are moved to a separate buffer in order to be placed in the XMM registers,
- // though this is only done for first 4 arguments, the rest are placed on the stack
- if( paramSize < 4 && dt.IsFloatType() )
- floatArgBuffer[dpos] = args[spos];
-
- dpos++;
- spos++;
- }
-
- paramSize++;
- }
- }
-
- if( callConv == ICC_CDECL_OBJLAST ||
- callConv == ICC_CDECL_OBJLAST_RETURNINMEM )
- {
- // Add the object pointer as the last parameter
- allArgBuffer[paramSize++] = (asQWORD)obj;
- }
- else if( callConv == ICC_THISCALL_OBJLAST ||
- callConv == ICC_THISCALL_OBJLAST_RETURNINMEM ||
- callConv == ICC_VIRTUAL_THISCALL_OBJLAST ||
- callConv == ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM )
- {
- // Add the object pointer as the last parameter
- allArgBuffer[paramSize++] = (asQWORD)secondObject;
- }
-
- retQW = CallX64(allArgBuffer, floatArgBuffer, paramSize*8, (asPWORD)func);
-
- // If the return is a float value we need to get the value from the FP register
- if( sysFunc->hostReturnFloat )
- {
- if( sysFunc->hostReturnSize == 1 )
- *(asDWORD*)&retQW = GetReturnedFloat();
- else
- retQW = GetReturnedDouble();
- }
-
- return retQW;
-}
-
-END_AS_NAMESPACE
-
-#endif // AS_X64_MSVC
-#endif // AS_MAX_PORTABILITY
-
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_msvc_asm.asm b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_msvc_asm.asm
deleted file mode 100644
index 80c53ed874d..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x64_msvc_asm.asm
+++ /dev/null
@@ -1,208 +0,0 @@
-;
-; AngelCode Scripting Library
-; Copyright (c) 2003-2011 Andreas Jonsson
-;
-; This software is provided 'as-is', without any express or implied
-; warranty. In no event will the authors be held liable for any
-; damages arising from the use of this software.
-;
-; Permission is granted to anyone to use this software for any
-; purpose, including commercial applications, and to alter it and
-; redistribute it freely, subject to the following restrictions:
-;
-; 1. The origin of this software must not be misrepresented; you
-; must not claim that you wrote the original software. If you use
-; this software in a product, an acknowledgment in the product
-; documentation would be appreciated but is not required.
-;
-; 2. Altered source versions must be plainly marked as such, and
-; must not be misrepresented as being the original software.
-;
-; 3. This notice may not be removed or altered from any source
-; distribution.
-;
-; The original version of this library can be located at:
-; http://www.angelcode.com/angelscript/
-;
-; Andreas Jonsson
-; andreas at angelcode.com
-;
-
-.code
-PUBLIC CallX64
-
-; asQWORD CallX64(const asQWORD *args, const asQWORD *floatArgs, int paramSize, asQWORD func)
-
-CallX64 PROC FRAME
-
- ; PROLOG
-
- ; We must save preserved registers that are used
- ; TODO: No need to save unused registers
-
- push rbp
-.pushreg rbp
- push rsi
-.pushreg rsi
- push r11
-.pushreg r11
- push rdi
-.pushreg rdi
- push r12
-.pushreg r12
- push r13
-.pushreg r13
- push r14
-.pushreg r14
- push r15
-.pushreg r15
- push rbx
-.pushreg rbx
- sub rsp, 050h
-.allocstack 050h
- mov rbp, rsp
-.setframe rbp, 0
-.endprolog
-
- ; Move function param to non-scratch register
- mov r14, r9 ; r14 = function
-
- ; Allocate space on the stack for the arguments
- ; Make room for at least 4 arguments even if there are less. When
- ; the compiler does optimizations for speed it may use these for
- ; temporary storage.
- mov rdi, r8
- add rdi, 32
-
- ; Make sure the stack pointer is 16byte aligned so the
- ; whole program optimizations will work properly
- ; TODO: optimize: Can this be optimized with fewer instructions?
- mov rsi, rsp
- sub rsi, rdi
- and rsi, 8h
- add rdi, rsi
- sub rsp, rdi
-
- ; Jump straight to calling the function if no parameters
- cmp r8d, 0 ; Compare paramSize with 0
- je callfunc ; Jump to call funtion if (paramSize == 0)
-
- ; Move params to non-scratch registers
- mov rsi, rcx ; rsi = pArgs
- mov r11, rdx ; r11 = pFloatArgs (can be NULL)
- mov r12d, r8d ; r12 = paramSize
-
- ; Copy arguments from script stack to application stack
- ; Order is (first to last):
- ; rcx, rdx, r8, r9 & everything else goes on stack
- mov rcx, qword ptr [rsi]
- mov rdx, qword ptr [rsi + 8]
- mov r8, qword ptr [rsi + 16]
- mov r9, qword ptr [rsi + 24]
-
- ; Negate the 4 params from the size to be copied
- sub r12d, 32
- js copyfloat ; Jump if negative result
- jz copyfloat ; Jump if zero result
-
- ; Now copy all remaining params onto stack allowing space for first four
- ; params to be flushed back to the stack if required by the callee.
-
- add rsi, 32 ; Position input pointer 4 args ahead
- mov r13, rsp ; Put the stack pointer into r13
- add r13, 32 ; Leave space for first 4 args on stack
-
-copyoverflow:
- mov r15, qword ptr [rsi] ; Read param from source stack into r15
- mov qword ptr [r13], r15 ; Copy param to real stack
- add r13, 8 ; Move virtual stack pointer
- add rsi, 8 ; Move source stack pointer
- sub r12d, 8 ; Decrement remaining count
- jnz copyoverflow ; Continue if more params
-
-copyfloat:
- ; Any floating point params?
- cmp r11, 0
- je callfunc
-
- movlpd xmm0, qword ptr [r11]
- movlpd xmm1, qword ptr [r11 + 8]
- movlpd xmm2, qword ptr [r11 + 16]
- movlpd xmm3, qword ptr [r11 + 24]
-
-callfunc:
-
- ; Call function
- call r14
-
- ; Restore the stack
- mov rsp, rbp
-
- ; EPILOG: Restore stack & preserved registers
- add rsp, 050h
- pop rbx
- pop r15
- pop r14
- pop r13
- pop r12
- pop rdi
- pop r11
- pop rsi
- pop rbp
-
- ; return value in RAX
- ret
-
-CallX64 ENDP
-
-
-PUBLIC GetReturnedFloat
-
-; asDWORD GetReturnedFloat()
-
-GetReturnedFloat PROC FRAME
-
- ; PROLOG: Store registers and allocate stack space
-
- sub rsp, 8 ; We'll need 4 bytes for temporary storage (8 bytes with alignment)
-.allocstack 8
-.endprolog
-
- ; Move the float value from the XMM0 register to RAX register
- movss dword ptr [rsp], xmm0
- mov eax, dword ptr [rsp]
-
- ; EPILOG: Clean up
-
- add rsp, 8
-
- ret
-
-GetReturnedFloat ENDP
-
-
-PUBLIC GetReturnedDouble
-
-; asDWORD GetReturnedDouble()
-
-GetReturnedDouble PROC FRAME
-
- ; PROLOG: Store registers and allocate stack space
-
- sub rsp, 8 ; We'll need 8 bytes for temporary storage
-.allocstack 8
-.endprolog
-
- ; Move the double value from the XMM0 register to the RAX register
- movlpd qword ptr [rsp], xmm0
- mov rax, qword ptr [rsp]
-
- ; EPILOG: Clean up
-
- add rsp, 8
-
- ret
-
-GetReturnedDouble ENDP
-
-END
\ No newline at end of file
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x86.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x86.cpp
deleted file mode 100644
index 551f41a12f9..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_x86.cpp
+++ /dev/null
@@ -1,1514 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2018 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-
-//
-// as_callfunc_x86.cpp
-//
-// These functions handle the actual calling of system functions
-//
-// Added support for functor methods by Jordi Oliveras Rovira in April, 2014.
-//
-
-
-
-#include "as_config.h"
-
-#ifndef AS_MAX_PORTABILITY
-#ifdef AS_X86
-
-#include "as_callfunc.h"
-#include "as_scriptengine.h"
-#include "as_texts.h"
-#include "as_tokendef.h"
-#include "as_context.h"
-
-BEGIN_AS_NAMESPACE
-
-//
-// With some compile level optimizations the functions don't clear the FPU
-// stack themselves. So we have to do it as part of calling the native functions,
-// as the compiler will not be able to predict when it is supposed to do it by
-// itself due to the dynamic nature of scripts
-//
-// - fninit clears the FPU stack and the FPU control word
-// - emms only clears the FPU stack, while preserving the FPU control word
-//
-// By default I use fninit as it seems to be what works for most people,
-// but some may find it necessary to define this as emms instead.
-//
-// TODO: Figure out when one or the other must be used, and a way to
-// configure this automatically in as_config.h
-//
-#ifndef CLEAR_FPU_STACK
-#define CLEAR_FPU_STACK fninit
-#endif
-
-// These macros are just to allow me to use the above macro in the GNUC style inline assembly
-#define _S(x) _TOSTRING(x)
-#define _TOSTRING(x) #x
-
-// Prototypes
-asQWORD CallCDeclFunction(const asDWORD *args, int paramSize, asFUNCTION_t func);
-asQWORD CallCDeclFunctionObjLast(const void *obj, const asDWORD *args, int paramSize, asFUNCTION_t func);
-asQWORD CallCDeclFunctionObjFirst(const void *obj, const asDWORD *args, int paramSize, asFUNCTION_t func);
-asQWORD CallCDeclFunctionRetByRef(const asDWORD *args, int paramSize, asFUNCTION_t func, void *retPtr);
-asQWORD CallCDeclFunctionRetByRefObjLast(const void *obj, const asDWORD *args, int paramSize, asFUNCTION_t func, void *retPtr);
-asQWORD CallCDeclFunctionRetByRefObjFirst(const void *obj, const asDWORD *args, int paramSize, asFUNCTION_t func, void *retPtr);
-asQWORD CallSTDCallFunction(const asDWORD *args, int paramSize, asFUNCTION_t func);
-asQWORD CallThisCallFunction(const void *obj, const asDWORD *args, int paramSize, asFUNCTION_t func);
-asQWORD CallThisCallFunctionRetByRef(const void *, const asDWORD *, int, asFUNCTION_t, void *retPtr);
-
-asDWORD GetReturnedFloat();
-asQWORD GetReturnedDouble();
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/, void *secondObject)
-{
- asCScriptEngine *engine = context->m_engine;
- asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
-
- asQWORD retQW = 0;
-
- // Prepare the parameters
- asDWORD paramBuffer[64];
- int callConv = sysFunc->callConv;
-
- // Changed because need check for ICC_THISCALL_OBJFIRST or
- // ICC_THISCALL_OBJLAST if sysFunc->takesObjByVal (avoid copy code)
- // Check if is THISCALL_OBJ* calling convention (in this case needs to add secondObject pointer into stack).
- bool isThisCallMethod = callConv >= ICC_THISCALL_OBJLAST;
- int paramSize = isThisCallMethod || sysFunc->takesObjByVal ? 0 : sysFunc->paramSize;
-
- int dpos = 1;
-
- if( isThisCallMethod &&
- (callConv >= ICC_THISCALL_OBJFIRST &&
- callConv <= ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM) )
- {
- // Add the object pointer as the first parameter
- paramBuffer[dpos++] = (asDWORD)secondObject;
- paramSize++;
- }
-
- if( sysFunc->takesObjByVal || isThisCallMethod )
- {
- int spos = 0;
-
- for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
- {
- if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
- {
-#ifdef COMPLEX_OBJS_PASSED_BY_REF
- if( descr->parameterTypes[n].GetTypeInfo()->flags & COMPLEX_MASK )
- {
- paramBuffer[dpos++] = args[spos++];
- paramSize++;
- }
- else
-#endif
- {
- // Copy the object's memory to the buffer
- // TODO: bug: Must call the object's copy constructor instead of doing a memcpy,
- // as the object may hold a pointer to itself. It's not enough to
- // change only this memcpy as the assembler routine also makes a copy
- // of paramBuffer to the final stack location. To avoid the second
- // copy the C++ routine should point paramBuffer to the final stack
- // position and copy the values directly to that location. The assembler
- // routines then don't need to copy anything, and will just be
- // responsible for setting up the registers and the stack frame appropriately.
- memcpy(¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
-
- // Delete the original memory
- engine->CallFree(*(char**)(args+spos));
- spos++;
- dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
- paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
- }
- }
- else
- {
- // Copy the value directly
- paramBuffer[dpos++] = args[spos++];
- if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
- paramBuffer[dpos++] = args[spos++];
- paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
- }
- }
- // Keep a free location at the beginning
- args = ¶mBuffer[1];
- }
-
- if( isThisCallMethod &&
- (callConv >= ICC_THISCALL_OBJLAST &&
- callConv <= ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM) )
- {
- // Add the object pointer as the last parameter
- paramBuffer[dpos++] = (asDWORD)secondObject;
- paramSize++;
- }
-
- // Make the actual call
- asFUNCTION_t func = sysFunc->func;
- if( sysFunc->hostReturnInMemory )
- callConv++;
-
- switch( callConv )
- {
- case ICC_CDECL:
- retQW = CallCDeclFunction(args, paramSize<<2, func);
- break;
-
- case ICC_CDECL_RETURNINMEM:
- retQW = CallCDeclFunctionRetByRef(args, paramSize<<2, func, retPointer);
- break;
-
- case ICC_STDCALL:
- retQW = CallSTDCallFunction(args, paramSize<<2, func);
- break;
-
- case ICC_STDCALL_RETURNINMEM:
- // Push the return pointer on the stack
- paramSize++;
- args--;
- *(asPWORD*)args = (size_t)retPointer;
-
- retQW = CallSTDCallFunction(args, paramSize<<2, func);
- break;
-
- case ICC_THISCALL:
- case ICC_THISCALL_OBJFIRST:
- case ICC_THISCALL_OBJLAST:
- retQW = CallThisCallFunction(obj, args, paramSize<<2, func);
- break;
-
- case ICC_THISCALL_RETURNINMEM:
- case ICC_THISCALL_OBJFIRST_RETURNINMEM:
- case ICC_THISCALL_OBJLAST_RETURNINMEM:
- retQW = CallThisCallFunctionRetByRef(obj, args, paramSize<<2, func, retPointer);
- break;
-
- case ICC_VIRTUAL_THISCALL:
- case ICC_VIRTUAL_THISCALL_OBJFIRST:
- case ICC_VIRTUAL_THISCALL_OBJLAST:
- {
- // Get virtual function table from the object pointer
- asFUNCTION_t *vftable = *(asFUNCTION_t**)obj;
- retQW = CallThisCallFunction(obj, args, paramSize<<2, vftable[FuncPtrToUInt(func)>>2]);
- }
- break;
-
- case ICC_VIRTUAL_THISCALL_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_OBJFIRST_RETURNINMEM:
- case ICC_VIRTUAL_THISCALL_OBJLAST_RETURNINMEM:
- {
- // Get virtual function table from the object pointer
- asFUNCTION_t *vftable = *(asFUNCTION_t**)obj;
- retQW = CallThisCallFunctionRetByRef(obj, args, paramSize<<2, vftable[FuncPtrToUInt(func)>>2], retPointer);
- }
- break;
-
- case ICC_CDECL_OBJLAST:
- retQW = CallCDeclFunctionObjLast(obj, args, paramSize<<2, func);
- break;
-
- case ICC_CDECL_OBJLAST_RETURNINMEM:
- // Call the system object method as a cdecl with the obj ref as the last parameter
- retQW = CallCDeclFunctionRetByRefObjLast(obj, args, paramSize<<2, func, retPointer);
- break;
-
- case ICC_CDECL_OBJFIRST:
- // Call the system object method as a cdecl with the obj ref as the first parameter
- retQW = CallCDeclFunctionObjFirst(obj, args, paramSize<<2, func);
- break;
-
- case ICC_CDECL_OBJFIRST_RETURNINMEM:
- // Call the system object method as a cdecl with the obj ref as the first parameter
- retQW = CallCDeclFunctionRetByRefObjFirst(obj, args, paramSize<<2, func, retPointer);
- break;
-
- default:
- context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
- }
-
- // If the return is a float value we need to get the value from the FP register
- if( sysFunc->hostReturnFloat )
- {
- if( sysFunc->hostReturnSize == 1 )
- *(asDWORD*)&retQW = GetReturnedFloat();
- else
- retQW = GetReturnedDouble();
- }
-
- return retQW;
-}
-
-// On GCC we need to prevent the compiler from inlining these assembler routines when
-// optimizing for speed (-O3), as the loop labels get duplicated which cause compile errors.
-
-#ifdef __GNUC__
- #define NOINLINE __attribute ((__noinline__))
-#else
- #define NOINLINE
-#endif
-
-
-asQWORD NOINLINE CallCDeclFunction(const asDWORD *args, int paramSize, asFUNCTION_t func)
-{
- volatile asQWORD retQW = 0;
-
-#if defined ASM_INTEL
-
- // Copy the data to the real stack. If we fail to do
- // this we may run into trouble in case of exceptions.
- __asm
- {
- // We must save registers that are used
- push ecx
-
- // Clear the FPU stack, in case the called function doesn't do it by itself
- CLEAR_FPU_STACK
-
- // Copy arguments from script
- // stack to application stack
- mov ecx, paramSize
- mov eax, args
- add eax, ecx
- cmp ecx, 0
- je endcopy
-copyloop:
- sub eax, 4
- push dword ptr [eax]
- sub ecx, 4
- jne copyloop
-endcopy:
-
- // Call function
- call [func]
-
- // Pop arguments from stack
- add esp, paramSize
-
- // Copy return value from EAX:EDX
- lea ecx, retQW
- mov [ecx], eax
- mov 4[ecx], edx
-
- // Restore registers
- pop ecx
- }
-
-#elif defined ASM_AT_N_T
-
- // It is not possible to rely on ESP or BSP to refer to variables or arguments on the stack
- // depending on compiler settings BSP may not even be used, and the ESP is not always on the
- // same offset from the local variables. Because the code adjusts the ESP register it is not
- // possible to inform the arguments through symbolic names below.
-
- // It's not also not possible to rely on the memory layout of the function arguments, because
- // on some compiler versions and settings the arguments may be copied to local variables with a
- // different ordering before they are accessed by the rest of the code.
-
- // I'm copying the arguments into this array where I know the exact memory layout. The address
- // of this array will then be passed to the inline asm in the EDX register.
- volatile asPWORD a[] = {asPWORD(args), asPWORD(paramSize), asPWORD(func)};
-
- asm __volatile__(
-#ifdef __OPTIMIZE__
- // When compiled with optimizations the stack unwind doesn't work properly,
- // causing exceptions to crash the application. By adding this prologue
- // and the epilogue below, the stack unwind works as it should.
- // TODO: runtime optimize: The prologue/epilogue shouldn't be needed if the correct cfi directives are used below
- "pushl %%ebp \n"
- ".cfi_adjust_cfa_offset 4 \n"
- ".cfi_rel_offset ebp, 0 \n"
- "movl %%esp, %%ebp \n"
- ".cfi_def_cfa_register ebp \n"
-#endif
- _S(CLEAR_FPU_STACK) "\n"
- "pushl %%ebx \n"
- "movl %%edx, %%ebx \n"
-
- // Need to align the stack pointer so that it is aligned to 16 bytes when making the function call.
- // It is assumed that when entering this function, the stack pointer is already aligned, so we need
- // to calculate how much we will put on the stack during this call.
- "movl 4(%%ebx), %%eax \n" // paramSize
- "addl $4, %%eax \n" // counting esp that we will push on the stack
- "movl %%esp, %%ecx \n"
- "subl %%eax, %%ecx \n"
- "andl $15, %%ecx \n"
- "movl %%esp, %%eax \n"
- "subl %%ecx, %%esp \n"
- "pushl %%eax \n" // Store the original stack pointer
-
- // Copy all arguments to the stack and call the function
- "movl 4(%%ebx), %%ecx \n" // paramSize
- "movl 0(%%ebx), %%eax \n" // args
- "addl %%ecx, %%eax \n" // push arguments on the stack
- "cmp $0, %%ecx \n"
- "je endcopy \n"
- "copyloop: \n"
- "subl $4, %%eax \n"
- "pushl (%%eax) \n"
- "subl $4, %%ecx \n"
- "jne copyloop \n"
- "endcopy: \n"
- "call *8(%%ebx) \n"
- "addl 4(%%ebx), %%esp \n" // pop arguments
-
- // Pop the alignment bytes
- "popl %%esp \n"
- "popl %%ebx \n"
-#ifdef __OPTIMIZE__
- // Epilogue
- "movl %%ebp, %%esp \n"
- ".cfi_def_cfa_register esp \n"
- "popl %%ebp \n"
- ".cfi_adjust_cfa_offset -4 \n"
- ".cfi_restore ebp \n"
-#endif
- // Copy EAX:EDX to retQW. As the stack pointer has been
- // restored it is now safe to access the local variable
- "leal %1, %%ecx \n"
- "movl %%eax, 0(%%ecx) \n"
- "movl %%edx, 4(%%ecx) \n"
- : // output
- : "d"(a), "m"(retQW) // input - pass pointer of args in edx, pass pointer of retQW in memory argument
- : "%eax", "%ecx" // clobber
- );
-
-#endif
-
- return retQW;
-}
-
-asQWORD NOINLINE CallCDeclFunctionObjLast(const void *obj, const asDWORD *args, int paramSize, asFUNCTION_t func)
-{
- volatile asQWORD retQW = 0;
-
-#if defined ASM_INTEL
-
- // Copy the data to the real stack. If we fail to do
- // this we may run into trouble in case of exceptions.
- __asm
- {
- // We must save registers that are used
- push ecx
-
- // Clear the FPU stack, in case the called function doesn't do it by itself
- CLEAR_FPU_STACK
-
- // Push the object pointer as the last argument to the function
- push obj
-
- // Copy arguments from script
- // stack to application stack
- mov ecx, paramSize
- mov eax, args
- add eax, ecx
- cmp ecx, 0
- je endcopy
-copyloop:
- sub eax, 4
- push dword ptr [eax]
- sub ecx, 4
- jne copyloop
-endcopy:
-
- // Call function
- call [func]
-
- // Pop arguments from stack
- add esp, paramSize
- add esp, 4
-
- // Copy return value from EAX:EDX
- lea ecx, retQW
- mov [ecx], eax
- mov 4[ecx], edx
-
- // Restore registers
- pop ecx
- }
-
-#elif defined ASM_AT_N_T
-
- volatile asPWORD a[] = {asPWORD(obj), asPWORD(args), asPWORD(paramSize), asPWORD(func)};
-
- asm __volatile__ (
-#ifdef __OPTIMIZE__
- // When compiled with optimizations the stack unwind doesn't work properly,
- // causing exceptions to crash the application. By adding this prologue
- // and the epilogue below, the stack unwind works as it should.
- // TODO: runtime optimize: The prologue/epilogue shouldn't be needed if the correct cfi directives are used below
- "pushl %%ebp \n"
- ".cfi_adjust_cfa_offset 4 \n"
- ".cfi_rel_offset ebp, 0 \n"
- "movl %%esp, %%ebp \n"
- ".cfi_def_cfa_register ebp \n"
-#endif
- _S(CLEAR_FPU_STACK) "\n"
- "pushl %%ebx \n"
- "movl %%edx, %%ebx \n"
-
- // Need to align the stack pointer so that it is aligned to 16 bytes when making the function call.
- // It is assumed that when entering this function, the stack pointer is already aligned, so we need
- // to calculate how much we will put on the stack during this call.
- "movl 8(%%ebx), %%eax \n" // paramSize
- "addl $8, %%eax \n" // counting esp that we will push on the stack
- "movl %%esp, %%ecx \n"
- "subl %%eax, %%ecx \n"
- "andl $15, %%ecx \n"
- "movl %%esp, %%eax \n"
- "subl %%ecx, %%esp \n"
- "pushl %%eax \n" // Store the original stack pointer
-
- "pushl 0(%%ebx) \n" // obj
- "movl 8(%%ebx), %%ecx \n" // paramSize
- "movl 4(%%ebx), %%eax \n" // args
- "addl %%ecx, %%eax \n" // push arguments on the stack
- "cmp $0, %%ecx \n"
- "je endcopy8 \n"
- "copyloop8: \n"
- "subl $4, %%eax \n"
- "pushl (%%eax) \n"
- "subl $4, %%ecx \n"
- "jne copyloop8 \n"
- "endcopy8: \n"
- "call *12(%%ebx) \n"
- "addl 8(%%ebx), %%esp \n" // pop arguments
- "addl $4, %%esp \n" // pop obj
-
- // Pop the alignment bytes
- "popl %%esp \n"
- "popl %%ebx \n"
-#ifdef __OPTIMIZE__
- // Epilogue
- "movl %%ebp, %%esp \n"
- ".cfi_def_cfa_register esp \n"
- "popl %%ebp \n"
- ".cfi_adjust_cfa_offset -4 \n"
- ".cfi_restore ebp \n"
-#endif
- // Copy EAX:EDX to retQW. As the stack pointer has been
- // restored it is now safe to access the local variable
- "leal %1, %%ecx \n"
- "movl %%eax, 0(%%ecx) \n"
- "movl %%edx, 4(%%ecx) \n"
- : // output
- : "d"(a), "m"(retQW) // input - pass pointer of args in edx, pass pointer of retQW in memory argument
- : "%eax", "%ecx" // clobber
- );
-
-#endif
-
- return retQW;
-}
-
-asQWORD NOINLINE CallCDeclFunctionObjFirst(const void *obj, const asDWORD *args, int paramSize, asFUNCTION_t func)
-{
- volatile asQWORD retQW = 0;
-
-#if defined ASM_INTEL
-
- // Copy the data to the real stack. If we fail to do
- // this we may run into trouble in case of exceptions.
- __asm
- {
- // We must save registers that are used
- push ecx
-
- // Clear the FPU stack, in case the called function doesn't do it by itself
- CLEAR_FPU_STACK
-
- // Copy arguments from script
- // stack to application stack
- mov ecx, paramSize
- mov eax, args
- add eax, ecx
- cmp ecx, 0
- je endcopy
-copyloop:
- sub eax, 4
- push dword ptr [eax]
- sub ecx, 4
- jne copyloop
-endcopy:
-
- // push object as first parameter
- push obj
-
- // Call function
- call [func]
-
- // Pop arguments from stack
- add esp, paramSize
- add esp, 4
-
- // Copy return value from EAX:EDX
- lea ecx, retQW
- mov [ecx], eax
- mov 4[ecx], edx
-
- // Restore registers
- pop ecx
- }
-
-#elif defined ASM_AT_N_T
-
- volatile asPWORD a[] = {asPWORD(obj), asPWORD(args), asPWORD(paramSize), asPWORD(func)};
-
- asm __volatile__ (
-#ifdef __OPTIMIZE__
- // When compiled with optimizations the stack unwind doesn't work properly,
- // causing exceptions to crash the application. By adding this prologue
- // and the epilogue below, the stack unwind works as it should.
- // TODO: runtime optimize: The prologue/epilogue shouldn't be needed if the correct cfi directives are used below
- "pushl %%ebp \n"
- ".cfi_adjust_cfa_offset 4 \n"
- ".cfi_rel_offset ebp, 0 \n"
- "movl %%esp, %%ebp \n"
- ".cfi_def_cfa_register ebp \n"
-#endif
- _S(CLEAR_FPU_STACK) "\n"
- "pushl %%ebx \n"
- "movl %%edx, %%ebx \n"
-
- // Need to align the stack pointer so that it is aligned to 16 bytes when making the function call.
- // It is assumed that when entering this function, the stack pointer is already aligned, so we need
- // to calculate how much we will put on the stack during this call.
- "movl 8(%%ebx), %%eax \n" // paramSize
- "addl $8, %%eax \n" // counting esp that we will push on the stack
- "movl %%esp, %%ecx \n"
- "subl %%eax, %%ecx \n"
- "andl $15, %%ecx \n"
- "movl %%esp, %%eax \n"
- "subl %%ecx, %%esp \n"
- "pushl %%eax \n" // Store the original stack pointer
-
- "movl 8(%%ebx), %%ecx \n" // paramSize
- "movl 4(%%ebx), %%eax \n" // args
- "addl %%ecx, %%eax \n" // push arguments on the stack
- "cmp $0, %%ecx \n"
- "je endcopy6 \n"
- "copyloop6: \n"
- "subl $4, %%eax \n"
- "pushl (%%eax) \n"
- "subl $4, %%ecx \n"
- "jne copyloop6 \n"
- "endcopy6: \n"
- "pushl 0(%%ebx) \n" // push obj
- "call *12(%%ebx) \n"
- "addl 8(%%ebx), %%esp \n" // pop arguments
- "addl $4, %%esp \n" // pop obj
-
- // Pop the alignment bytes
- "popl %%esp \n"
- "popl %%ebx \n"
-#ifdef __OPTIMIZE__
- // Epilogue
- "movl %%ebp, %%esp \n"
- ".cfi_def_cfa_register esp \n"
- "popl %%ebp \n"
- ".cfi_adjust_cfa_offset -4 \n"
- ".cfi_restore ebp \n"
-#endif
- // Copy EAX:EDX to retQW. As the stack pointer has been
- // restored it is now safe to access the local variable
- "leal %1, %%ecx \n"
- "movl %%eax, 0(%%ecx) \n"
- "movl %%edx, 4(%%ecx) \n"
- : // output
- : "d"(a), "m"(retQW) // input - pass pointer of args in edx, pass pointer of retQW in memory argument
- : "%eax", "%ecx" // clobber
- );
-
-#endif
-
- return retQW;
-}
-
-asQWORD NOINLINE CallCDeclFunctionRetByRefObjFirst(const void *obj, const asDWORD *args, int paramSize, asFUNCTION_t func, void *retPtr)
-{
- volatile asQWORD retQW = 0;
-
-#if defined ASM_INTEL
-
- // Copy the data to the real stack. If we fail to do
- // this we may run into trouble in case of exceptions.
- __asm
- {
- // We must save registers that are used
- push ecx
-
- // Clear the FPU stack, in case the called function doesn't do it by itself
- CLEAR_FPU_STACK
-
- // Copy arguments from script
- // stack to application stack
- mov ecx, paramSize
- mov eax, args
- add eax, ecx
- cmp ecx, 0
- je endcopy
-copyloop:
- sub eax, 4
- push dword ptr [eax]
- sub ecx, 4
- jne copyloop
-endcopy:
-
- // Push the object pointer
- push obj
-
- // Push the return pointer
- push retPtr;
-
- // Call function
- call [func]
-
- // Pop arguments from stack
- add esp, paramSize
-
-#ifndef CALLEE_POPS_HIDDEN_RETURN_POINTER
- // Pop the return pointer
- add esp, 8
-#else
- add esp, 4
-#endif
-
- // Copy return value from EAX:EDX
- lea ecx, retQW
- mov [ecx], eax
- mov 4[ecx], edx
-
- // Restore registers
- pop ecx
- }
-
-#elif defined ASM_AT_N_T
-
- volatile asPWORD a[] = {asPWORD(obj), asPWORD(args), asPWORD(paramSize), asPWORD(func), asPWORD(retPtr)};
-
- asm __volatile__ (
-#ifdef __OPTIMIZE__
- // When compiled with optimizations the stack unwind doesn't work properly,
- // causing exceptions to crash the application. By adding this prologue
- // and the epilogue below, the stack unwind works as it should.
- // TODO: runtime optimize: The prologue/epilogue shouldn't be needed if the correct cfi directives are used below
- "pushl %%ebp \n"
- ".cfi_adjust_cfa_offset 4 \n"
- ".cfi_rel_offset ebp, 0 \n"
- "movl %%esp, %%ebp \n"
- ".cfi_def_cfa_register ebp \n"
-#endif
- _S(CLEAR_FPU_STACK) "\n"
- "pushl %%ebx \n"
- "movl %%edx, %%ebx \n"
-
- // Need to align the stack pointer so that it is aligned to 16 bytes when making the function call.
- // It is assumed that when entering this function, the stack pointer is already aligned, so we need
- // to calculate how much we will put on the stack during this call.
- "movl 8(%%ebx), %%eax \n" // paramSize
- "addl $12, %%eax \n" // counting esp that we will push on the stack
- "movl %%esp, %%ecx \n"
- "subl %%eax, %%ecx \n"
- "andl $15, %%ecx \n"
- "movl %%esp, %%eax \n"
- "subl %%ecx, %%esp \n"
- "pushl %%eax \n" // Store the original stack pointer
-
- "movl 8(%%ebx), %%ecx \n" // paramSize
- "movl 4(%%ebx), %%eax \n" // args
- "addl %%ecx, %%eax \n" // push arguments on the stack
- "cmp $0, %%ecx \n"
- "je endcopy5 \n"
- "copyloop5: \n"
- "subl $4, %%eax \n"
- "pushl (%%eax) \n"
- "subl $4, %%ecx \n"
- "jne copyloop5 \n"
- "endcopy5: \n"
- "pushl 0(%%ebx) \n" // push object first
- "pushl 16(%%ebx) \n" // retPtr
- "call *12(%%ebx) \n" // func
- "addl 8(%%ebx), %%esp \n" // pop arguments
-#ifndef CALLEE_POPS_HIDDEN_RETURN_POINTER
- "addl $8, %%esp \n" // Pop the return pointer and object pointer
-#else
- "addl $4, %%esp \n" // Pop the object pointer
-#endif
- // Pop the alignment bytes
- "popl %%esp \n"
- "popl %%ebx \n"
-#ifdef __OPTIMIZE__
- // Epilogue
- "movl %%ebp, %%esp \n"
- ".cfi_def_cfa_register esp \n"
- "popl %%ebp \n"
- ".cfi_adjust_cfa_offset -4 \n"
- ".cfi_restore ebp \n"
-#endif
- // Copy EAX:EDX to retQW. As the stack pointer has been
- // restored it is now safe to access the local variable
- "leal %1, %%ecx \n"
- "movl %%eax, 0(%%ecx) \n"
- "movl %%edx, 4(%%ecx) \n"
- : // output
- : "d"(a), "m"(retQW) // input - pass pointer of args in edx, pass pointer of retQW in memory argument
- : "%eax", "%ecx" // clobber
- );
-#endif
-
- return retQW;
-}
-
-asQWORD NOINLINE CallCDeclFunctionRetByRef(const asDWORD *args, int paramSize, asFUNCTION_t func, void *retPtr)
-{
- volatile asQWORD retQW = 0;
-
-#if defined ASM_INTEL
-
- // Copy the data to the real stack. If we fail to do
- // this we may run into trouble in case of exceptions.
- __asm
- {
- // We must save registers that are used
- push ecx
-
- // Clear the FPU stack, in case the called function doesn't do it by itself
- CLEAR_FPU_STACK
-
- // Copy arguments from script
- // stack to application stack
- mov ecx, paramSize
- mov eax, args
- add eax, ecx
- cmp ecx, 0
- je endcopy
-copyloop:
- sub eax, 4
- push dword ptr [eax]
- sub ecx, 4
- jne copyloop
-endcopy:
-
- // Push the return pointer
- push retPtr;
-
- // Call function
- call [func]
-
- // Pop arguments from stack
- add esp, paramSize
-
-#ifndef CALLEE_POPS_HIDDEN_RETURN_POINTER
- // Pop the return pointer
- add esp, 4
-#endif
-
- // Copy return value from EAX:EDX
- lea ecx, retQW
- mov [ecx], eax
- mov 4[ecx], edx
-
- // Restore registers
- pop ecx
-
- // return value in EAX or EAX:EDX
- }
-
-#elif defined ASM_AT_N_T
-
- volatile asPWORD a[] = {asPWORD(args), asPWORD(paramSize), asPWORD(func), asPWORD(retPtr)};
-
- asm __volatile__ (
-#ifdef __OPTIMIZE__
- // When compiled with optimizations the stack unwind doesn't work properly,
- // causing exceptions to crash the application. By adding this prologue
- // and the epilogue below, the stack unwind works as it should.
- // TODO: runtime optimize: The prologue/epilogue shouldn't be needed if the correct cfi directives are used below
- "pushl %%ebp \n"
- ".cfi_adjust_cfa_offset 4 \n"
- ".cfi_rel_offset ebp, 0 \n"
- "movl %%esp, %%ebp \n"
- ".cfi_def_cfa_register ebp \n"
-#endif
- _S(CLEAR_FPU_STACK) "\n"
- "pushl %%ebx \n"
- "movl %%edx, %%ebx \n"
-
- // Need to align the stack pointer so that it is aligned to 16 bytes when making the function call.
- // It is assumed that when entering this function, the stack pointer is already aligned, so we need
- // to calculate how much we will put on the stack during this call.
- "movl 4(%%ebx), %%eax \n" // paramSize
- "addl $8, %%eax \n" // counting esp that we will push on the stack
- "movl %%esp, %%ecx \n"
- "subl %%eax, %%ecx \n"
- "andl $15, %%ecx \n"
- "movl %%esp, %%eax \n"
- "subl %%ecx, %%esp \n"
- "pushl %%eax \n" // Store the original stack pointer
-
- "movl 4(%%ebx), %%ecx \n" // paramSize
- "movl 0(%%ebx), %%eax \n" // args
- "addl %%ecx, %%eax \n" // push arguments on the stack
- "cmp $0, %%ecx \n"
- "je endcopy7 \n"
- "copyloop7: \n"
- "subl $4, %%eax \n"
- "pushl (%%eax) \n"
- "subl $4, %%ecx \n"
- "jne copyloop7 \n"
- "endcopy7: \n"
- "pushl 12(%%ebx) \n" // retPtr
- "call *8(%%ebx) \n" // func
- "addl 4(%%ebx), %%esp \n" // pop arguments
-#ifndef CALLEE_POPS_HIDDEN_RETURN_POINTER
- "addl $4, %%esp \n" // Pop the return pointer
-#endif
- // Pop the alignment bytes
- "popl %%esp \n"
- "popl %%ebx \n"
-#ifdef __OPTIMIZE__
- // Epilogue
- "movl %%ebp, %%esp \n"
- ".cfi_def_cfa_register esp \n"
- "popl %%ebp \n"
- ".cfi_adjust_cfa_offset -4 \n"
- ".cfi_restore ebp \n"
-#endif
- // Copy EAX:EDX to retQW. As the stack pointer has been
- // restored it is now safe to access the local variable
- "leal %1, %%ecx \n"
- "movl %%eax, 0(%%ecx) \n"
- "movl %%edx, 4(%%ecx) \n"
- : // output
- : "d"(a), "m"(retQW) // input - pass pointer of args in edx, pass pointer of retQW in memory argument
- : "%eax", "%ecx" // clobber
- );
-
-#endif
-
- return retQW;
-}
-
-asQWORD NOINLINE CallCDeclFunctionRetByRefObjLast(const void *obj, const asDWORD *args, int paramSize, asFUNCTION_t func, void *retPtr)
-{
- volatile asQWORD retQW = 0;
-
-#if defined ASM_INTEL
-
- // Copy the data to the real stack. If we fail to do
- // this we may run into trouble in case of exceptions.
- __asm
- {
- // We must save registers that are used
- push ecx
-
- // Clear the FPU stack, in case the called function doesn't do it by itself
- CLEAR_FPU_STACK
-
- push obj
-
- // Copy arguments from script
- // stack to application stack
- mov ecx, paramSize
- mov eax, args
- add eax, ecx
- cmp ecx, 0
- je endcopy
-copyloop:
- sub eax, 4
- push dword ptr [eax]
- sub ecx, 4
- jne copyloop
-endcopy:
-
- // Push the return pointer
- push retPtr;
-
- // Call function
- call [func]
-
- // Pop arguments from stack
- add esp, paramSize
- add esp, 4
-
-#ifndef CALLEE_POPS_HIDDEN_RETURN_POINTER
- // Pop the return pointer
- add esp, 4
-#endif
-
- // Copy return value from EAX:EDX
- lea ecx, retQW
- mov [ecx], eax
- mov 4[ecx], edx
-
- // Restore registers
- pop ecx
- }
-
-#elif defined ASM_AT_N_T
-
- volatile asPWORD a[] = {asPWORD(obj), asPWORD(args), asPWORD(paramSize), asPWORD(func), asPWORD(retPtr)};
-
- asm __volatile__ (
-#ifdef __OPTIMIZE__
- // When compiled with optimizations the stack unwind doesn't work properly,
- // causing exceptions to crash the application. By adding this prologue
- // and the epilogue below, the stack unwind works as it should.
- // TODO: runtime optimize: The prologue/epilogue shouldn't be needed if the correct cfi directives are used below
- "pushl %%ebp \n"
- ".cfi_adjust_cfa_offset 4 \n"
- ".cfi_rel_offset ebp, 0 \n"
- "movl %%esp, %%ebp \n"
- ".cfi_def_cfa_register ebp \n"
-#endif
- _S(CLEAR_FPU_STACK) "\n"
- "pushl %%ebx \n"
- "movl %%edx, %%ebx \n"
-
- // Need to align the stack pointer so that it is aligned to 16 bytes when making the function call.
- // It is assumed that when entering this function, the stack pointer is already aligned, so we need
- // to calculate how much we will put on the stack during this call.
- "movl 8(%%ebx), %%eax \n" // paramSize
- "addl $12, %%eax \n" // counting esp that we will push on the stack
- "movl %%esp, %%ecx \n"
- "subl %%eax, %%ecx \n"
- "andl $15, %%ecx \n"
- "movl %%esp, %%eax \n"
- "subl %%ecx, %%esp \n"
- "pushl %%eax \n" // Store the original stack pointer
-
- "pushl 0(%%ebx) \n" // obj
- "movl 8(%%ebx), %%ecx \n" // paramSize
- "movl 4(%%ebx), %%eax \n" // args
- "addl %%ecx, %%eax \n" // push arguments on the stack
- "cmp $0, %%ecx \n"
- "je endcopy4 \n"
- "copyloop4: \n"
- "subl $4, %%eax \n"
- "pushl (%%eax) \n"
- "subl $4, %%ecx \n"
- "jne copyloop4 \n"
- "endcopy4: \n"
- "pushl 16(%%ebx) \n" // retPtr
- "call *12(%%ebx) \n" // func
- "addl 8(%%ebx), %%esp \n" // pop arguments
-#ifndef CALLEE_POPS_HIDDEN_RETURN_POINTER
- "addl $8, %%esp \n" // Pop the return pointer and object pointer
-#else
- "addl $4, %%esp \n" // Pop the object pointer
-#endif
- // Pop the alignment bytes
- "popl %%esp \n"
- "popl %%ebx \n"
-#ifdef __OPTIMIZE__
- // Epilogue
- "movl %%ebp, %%esp \n"
- ".cfi_def_cfa_register esp \n"
- "popl %%ebp \n"
- ".cfi_adjust_cfa_offset -4 \n"
- ".cfi_restore ebp \n"
-#endif
- // Copy EAX:EDX to retQW. As the stack pointer has been
- // restored it is now safe to access the local variable
- "leal %1, %%ecx \n"
- "movl %%eax, 0(%%ecx) \n"
- "movl %%edx, 4(%%ecx) \n"
- : // output
- : "d"(a), "m"(retQW) // input - pass pointer of args in edx, pass pointer of retQW in memory argument
- : "%eax", "%ecx" // clobber
- );
-
-#endif
-
- return retQW;
-}
-
-asQWORD NOINLINE CallSTDCallFunction(const asDWORD *args, int paramSize, asFUNCTION_t func)
-{
- volatile asQWORD retQW = 0;
-
-#if defined ASM_INTEL
-
- // Copy the data to the real stack. If we fail to do
- // this we may run into trouble in case of exceptions.
- __asm
- {
- // We must save registers that are used
- push ecx
-
- // Clear the FPU stack, in case the called function doesn't do it by itself
- CLEAR_FPU_STACK
-
- // Copy arguments from script
- // stack to application stack
- mov ecx, paramSize
- mov eax, args
- add eax, ecx
- cmp ecx, 0
- je endcopy
-copyloop:
- sub eax, 4
- push dword ptr [eax]
- sub ecx, 4
- jne copyloop
-endcopy:
-
- // Call function
- call [func]
-
- // The callee already removed parameters from the stack
-
- // Copy return value from EAX:EDX
- lea ecx, retQW
- mov [ecx], eax
- mov 4[ecx], edx
-
- // Restore registers
- pop ecx
- }
-
-#elif defined ASM_AT_N_T
-
- volatile asPWORD a[] = {asPWORD(args), asPWORD(paramSize), asPWORD(func)};
-
- asm __volatile__ (
-#ifdef __OPTIMIZE__
- // When compiled with optimizations the stack unwind doesn't work properly,
- // causing exceptions to crash the application. By adding this prologue
- // and the epilogue below, the stack unwind works as it should.
- // TODO: runtime optimize: The prologue/epilogue shouldn't be needed if the correct cfi directives are used below
- "pushl %%ebp \n"
- ".cfi_adjust_cfa_offset 4 \n"
- ".cfi_rel_offset ebp, 0 \n"
- "movl %%esp, %%ebp \n"
- ".cfi_def_cfa_register ebp \n"
-#endif
- _S(CLEAR_FPU_STACK) "\n"
- "pushl %%ebx \n"
- "movl %%edx, %%ebx \n"
-
- // Need to align the stack pointer so that it is aligned to 16 bytes when making the function call.
- // It is assumed that when entering this function, the stack pointer is already aligned, so we need
- // to calculate how much we will put on the stack during this call.
- "movl 4(%%ebx), %%eax \n" // paramSize
- "addl $4, %%eax \n" // counting esp that we will push on the stack
- "movl %%esp, %%ecx \n"
- "subl %%eax, %%ecx \n"
- "andl $15, %%ecx \n"
- "movl %%esp, %%eax \n"
- "subl %%ecx, %%esp \n"
- "pushl %%eax \n" // Store the original stack pointer
-
- "movl 4(%%ebx), %%ecx \n" // paramSize
- "movl 0(%%ebx), %%eax \n" // args
- "addl %%ecx, %%eax \n" // push arguments on the stack
- "cmp $0, %%ecx \n"
- "je endcopy2 \n"
- "copyloop2: \n"
- "subl $4, %%eax \n"
- "pushl (%%eax) \n"
- "subl $4, %%ecx \n"
- "jne copyloop2 \n"
- "endcopy2: \n"
- "call *8(%%ebx) \n" // callee pops the arguments
-
- // Pop the alignment bytes
- "popl %%esp \n"
- "popl %%ebx \n"
-#ifdef __OPTIMIZE__
- // Epilogue
- "movl %%ebp, %%esp \n"
- ".cfi_def_cfa_register esp \n"
- "popl %%ebp \n"
- ".cfi_adjust_cfa_offset -4 \n"
- ".cfi_restore ebp \n"
-#endif
- // Copy EAX:EDX to retQW. As the stack pointer has been
- // restored it is now safe to access the local variable
- "leal %1, %%ecx \n"
- "movl %%eax, 0(%%ecx) \n"
- "movl %%edx, 4(%%ecx) \n"
- : // output
- : "d"(a), "m"(retQW) // input - pass pointer of args in edx, pass pointer of retQW in memory argument
- : "%eax", "%ecx" // clobber
- );
-
-#endif
-
- return retQW;
-}
-
-
-asQWORD NOINLINE CallThisCallFunction(const void *obj, const asDWORD *args, int paramSize, asFUNCTION_t func)
-{
- volatile asQWORD retQW = 0;
-
-#if defined ASM_INTEL
-
- // Copy the data to the real stack. If we fail to do
- // this we may run into trouble in case of exceptions.
- __asm
- {
- // We must save registers that are used
- push ecx
-
- // Clear the FPU stack, in case the called function doesn't do it by itself
- CLEAR_FPU_STACK
-
- // Copy arguments from script
- // stack to application stack
- mov ecx, paramSize
- mov eax, args
- add eax, ecx
- cmp ecx, 0
- je endcopy
-copyloop:
- sub eax, 4
- push dword ptr [eax]
- sub ecx, 4
- jne copyloop
-endcopy:
-
-#ifdef THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
- // Push the object pointer on the stack
- push obj
-#else
- // Move object pointer to ECX
- mov ecx, obj
-#endif
-
- // Call function
- call [func]
-
-#ifndef THISCALL_CALLEE_POPS_ARGUMENTS
- // Pop arguments
- add esp, paramSize
-#ifdef THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
- // Pop object pointer
- add esp, 4
-#endif
-#endif
-
- // Copy return value from EAX:EDX
- lea ecx, retQW
- mov [ecx], eax
- mov 4[ecx], edx
-
- // Restore registers
- pop ecx
- }
-
-#elif defined ASM_AT_N_T
-
- volatile asPWORD a[] = {asPWORD(obj), asPWORD(args), asPWORD(paramSize), asPWORD(func)};
-
- asm __volatile__ (
-#ifdef __OPTIMIZE__
- // When compiled with optimizations the stack unwind doesn't work properly,
- // causing exceptions to crash the application. By adding this prologue
- // and the epilogue below, the stack unwind works as it should.
- // TODO: runtime optimize: The prologue/epilogue shouldn't be needed if the correct cfi directives are used below
- "pushl %%ebp \n"
- ".cfi_adjust_cfa_offset 4 \n"
- ".cfi_rel_offset ebp, 0 \n"
- "movl %%esp, %%ebp \n"
- ".cfi_def_cfa_register ebp \n"
-#endif
- _S(CLEAR_FPU_STACK) "\n"
- "pushl %%ebx \n"
- "movl %%edx, %%ebx \n"
-
- // Need to align the stack pointer so that it is aligned to 16 bytes when making the function call.
- // It is assumed that when entering this function, the stack pointer is already aligned, so we need
- // to calculate how much we will put on the stack during this call.
- "movl 8(%%ebx), %%eax \n" // paramSize
- "addl $8, %%eax \n" // counting esp that we will push on the stack
- "movl %%esp, %%ecx \n"
- "subl %%eax, %%ecx \n"
- "andl $15, %%ecx \n"
- "movl %%esp, %%eax \n"
- "subl %%ecx, %%esp \n"
- "pushl %%eax \n" // Store the original stack pointer
-
- "movl 8(%%ebx), %%ecx \n" // paramSize
- "movl 4(%%ebx), %%eax \n" // args
- "addl %%ecx, %%eax \n" // push all arguments on the stack
- "cmp $0, %%ecx \n"
- "je endcopy1 \n"
- "copyloop1: \n"
- "subl $4, %%eax \n"
- "pushl (%%eax) \n"
- "subl $4, %%ecx \n"
- "jne copyloop1 \n"
- "endcopy1: \n"
- "movl 0(%%ebx), %%ecx \n" // move obj into ECX
-#ifdef THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
- "pushl %%ecx \n" // push obj on the stack
-#endif
- "call *12(%%ebx) \n"
-#ifndef THISCALL_CALLEE_POPS_ARGUMENTS
- "addl 8(%%ebx), %%esp \n" // pop arguments
-#ifdef THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
- "addl $4, %%esp \n" // pop obj
-#endif
-#endif
- // Pop the alignment bytes
- "popl %%esp \n"
- "popl %%ebx \n"
-#ifdef __OPTIMIZE__
- // Epilogue
- "movl %%ebp, %%esp \n"
- ".cfi_def_cfa_register esp \n"
- "popl %%ebp \n"
- ".cfi_adjust_cfa_offset -4 \n"
- ".cfi_restore ebp \n"
-#endif
- // Copy EAX:EDX to retQW. As the stack pointer has been
- // restored it is now safe to access the local variable
- "leal %1, %%ecx \n"
- "movl %%eax, 0(%%ecx) \n"
- "movl %%edx, 4(%%ecx) \n"
- : // output
- : "d"(a), "m"(retQW) // input - pass pointer of args in edx, pass pointer of retQW in memory argument
- : "%eax", "%ecx" // clobber
- );
-
-#endif
-
- return retQW;
-}
-
-asQWORD NOINLINE CallThisCallFunctionRetByRef(const void *obj, const asDWORD *args, int paramSize, asFUNCTION_t func, void *retPtr)
-{
- volatile asQWORD retQW = 0;
-
-#if defined ASM_INTEL
-
- // Copy the data to the real stack. If we fail to do
- // this we may run into trouble in case of exceptions.
- __asm
- {
- // We must save registers that are used
- push ecx
-
- // Clear the FPU stack, in case the called function doesn't do it by itself
- CLEAR_FPU_STACK
-
- // Copy arguments from script
- // stack to application stack
- mov ecx, paramSize
- mov eax, args
- add eax, ecx
- cmp ecx, 0
- je endcopy
-copyloop:
- sub eax, 4
- push dword ptr [eax]
- sub ecx, 4
- jne copyloop
-endcopy:
-
-#ifdef THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
- // Push the object pointer on the stack
- push obj
-#else
- // Move object pointer to ECX
- mov ecx, obj
-#endif
-
- // Push the return pointer
- push retPtr
-
- // Call function
- call [func]
-
-#ifndef THISCALL_CALLEE_POPS_HIDDEN_RETURN_POINTER
- // Pop the return pointer
- add esp, 4
-#endif
-
-#ifndef THISCALL_CALLEE_POPS_ARGUMENTS
- // Pop arguments
- add esp, paramSize
-#ifdef THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
- // Pop object pointer
- add esp, 4
-#endif
-#endif
-
- // Copy return value from EAX:EDX
- lea ecx, retQW
- mov [ecx], eax
- mov 4[ecx], edx
-
- // Restore registers
- pop ecx
- }
-
-#elif defined ASM_AT_N_T
-
- volatile asPWORD a[] = {asPWORD(obj), asPWORD(args), asPWORD(paramSize), asPWORD(func), asPWORD(retPtr)};
-
- asm __volatile__ (
-#ifdef __OPTIMIZE__
- // When compiled with optimizations the stack unwind doesn't work properly,
- // causing exceptions to crash the application. By adding this prologue
- // and the epilogue below, the stack unwind works as it should.
- // TODO: runtime optimize: The prologue/epilogue shouldn't be needed if the correct cfi directives are used below
- "pushl %%ebp \n"
- ".cfi_adjust_cfa_offset 4 \n"
- ".cfi_rel_offset ebp, 0 \n"
- "movl %%esp, %%ebp \n"
- ".cfi_def_cfa_register ebp \n"
-#endif
- _S(CLEAR_FPU_STACK) "\n"
- "pushl %%ebx \n"
- "movl %%edx, %%ebx \n"
-
- // Need to align the stack pointer so that it is aligned to 16 bytes when making the function call.
- // It is assumed that when entering this function, the stack pointer is already aligned, so we need
- // to calculate how much we will put on the stack during this call.
- "movl 8(%%ebx), %%eax \n" // paramSize
- "addl $12, %%eax \n" // counting esp that we will push on the stack
- "movl %%esp, %%ecx \n"
- "subl %%eax, %%ecx \n"
- "andl $15, %%ecx \n"
- "movl %%esp, %%eax \n"
- "subl %%ecx, %%esp \n"
- "pushl %%eax \n" // Store the original stack pointer
-
- "movl 8(%%ebx), %%ecx \n" // paramSize
- "movl 4(%%ebx), %%eax \n" // args
- "addl %%ecx, %%eax \n" // push all arguments to the stack
- "cmp $0, %%ecx \n"
- "je endcopy3 \n"
- "copyloop3: \n"
- "subl $4, %%eax \n"
- "pushl (%%eax) \n"
- "subl $4, %%ecx \n"
- "jne copyloop3 \n"
- "endcopy3: \n"
-#ifdef AS_MINGW47
- // MinGW made some strange choices with 4.7 and the thiscall calling convention,
- // returning an object in memory is completely different from when not returning
- // in memory
- "pushl 0(%%ebx) \n" // push obj on the stack
- "movl 16(%%ebx), %%ecx \n" // move the return pointer into ECX
- "call *12(%%ebx) \n" // call the function
-#else
- "movl 0(%%ebx), %%ecx \n" // move obj into ECX
-#ifdef THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
- "pushl %%ecx \n" // push obj on the stack
-#endif
- "pushl 16(%%ebx) \n" // push retPtr on the stack
- "call *12(%%ebx) \n"
-#ifndef THISCALL_CALLEE_POPS_HIDDEN_RETURN_POINTER
- "addl $4, %%esp \n" // pop return pointer
-#endif
-#ifndef THISCALL_CALLEE_POPS_ARGUMENTS
- "addl 8(%%ebx), %%esp \n" // pop arguments
-#ifdef THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
- "addl $4, %%esp \n" // pop the object pointer
-#endif
-#endif
-#endif // AS_MINGW47
- // Pop the alignment bytes
- "popl %%esp \n"
- "popl %%ebx \n"
-#ifdef __OPTIMIZE__
- // Epilogue
- "movl %%ebp, %%esp \n"
- ".cfi_def_cfa_register esp \n"
- "popl %%ebp \n"
- ".cfi_adjust_cfa_offset -4 \n"
- ".cfi_restore ebp \n"
-#endif
- // Copy EAX:EDX to retQW. As the stack pointer has been
- // restored it is now safe to access the local variable
- "leal %1, %%ecx \n"
- "movl %%eax, 0(%%ecx) \n"
- "movl %%edx, 4(%%ecx) \n"
- : // output
- : "d"(a), "m"(retQW) // input - pass pointer of args in edx, pass pointer of retQW in memory argument
- : "%eax", "%ecx" // clobber
- );
-
-#endif
-
- return retQW;
-}
-
-asDWORD GetReturnedFloat()
-{
- asDWORD f;
-
-#if defined ASM_INTEL
-
- // Get the float value from ST0
- __asm fstp dword ptr [f]
-
-#elif defined ASM_AT_N_T
-
- asm("fstps %0 \n" : "=m" (f));
-
-#endif
-
- return f;
-}
-
-asQWORD GetReturnedDouble()
-{
- asQWORD d;
-
-#if defined ASM_INTEL
-
- // Get the double value from ST0
- __asm fstp qword ptr [d]
-
-#elif defined ASM_AT_N_T
-
- asm("fstpl %0 \n" : "=m" (d));
-
-#endif
-
- return d;
-}
-
-END_AS_NAMESPACE
-
-#endif // AS_X86
-#endif // AS_MAX_PORTABILITY
-
-
-
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_xenon.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_xenon.cpp
deleted file mode 100644
index c52055e99df..00000000000
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_callfunc_xenon.cpp
+++ /dev/null
@@ -1,737 +0,0 @@
-/*
- AngelCode Scripting Library
- Copyright (c) 2003-2015 Andreas Jonsson
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
- The original version of this library can be located at:
- http://www.angelcode.com/angelscript/
-
- Andreas Jonsson
- andreas at angelcode.com
-*/
-
-
-//
-// as_callfunc_xenon.cpp
-//
-// These functions handle the actual calling of system functions
-//
-// This version is Xenon specific
-// Modified from as_callfunc_ppc.cpp by Laszlo Perneky February 2007
-//
-// Modified by Cyril Tissier March 2010:
-// various fixes in 'float' args passing / function return
-// properly handling 'double' type
-// various fixes in asm ppcFunc
-// fix for variable arguments
-//
-// Modified by Anthony Clark May 2015
-// Fixed the issue where int64 and uint64 could not be passed nativly
-// few minor fixes within asm ppcFunc to handle int64 and uint64
-
-
-// XBox 360 calling convention
-// ===========================
-// I've yet to find an official document with the ABI for XBox 360,
-// but I'll describe what I've gathered from the code and tests
-// performed by the AngelScript community.
-//
-// Arguments are passed in the following registers:
-// r3 - r10 : integer/pointer arguments (each register is 64bit)
-// fr1 - fr13 : float/double arguments (each register is 64bit)
-//
-// Arguments that don't fit in the registers will be pushed on the stack.
-//
-// When a float or double is passed as argument, its value will be placed
-// in the next available float register, but it will also reserve general
-// purpose register.
-//
-// Example: void foo(float a, int b). a will be passed in fr1 and b in r4.
-//
-// For each argument passed to a function an 8byte slot is reserved on the
-// stack, so that the function can offload the value there if needed. The
-// first slot is at r1+20, the next at r1+28, etc.
-//
-// If the function is a class method, the this pointer is passed as hidden
-// first argument. If the function returns an object in memory, the address
-// for that memory is passed as hidden first argument.
-//
-// Return value are placed in the following registers:
-// r3 : integer/pointer values
-// fr1 : float/double values
-//
-// Rules for registers
-// r1 : stack pointer
-// r14-r31 : nonvolatile, i.e. their values must be preserved
-// fr14-fr31 : nonvolatile, i.e. their values must be preserved
-// r0, r2, r13 : dedicated. I'm not sure what it means, but it is probably best not to use them
-//
-// The stack pointer must always be aligned at 8 bytes.
-//
-// References:
-// https://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF77852569970071B0D6/$file/eabi_app.pdf
-//
-// TODO: The code doesn't handle objects passed by value (unless they are max 4 bytes in size)
-
-
-
-#include "as_config.h"
-
-#ifndef AS_MAX_PORTABILITY
-#if defined(AS_XENON)
-
-#include "as_callfunc.h"
-#include "as_scriptengine.h"
-#include "as_texts.h"
-#include "as_tokendef.h"
-#include "as_context.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <xtl.h>
-
-BEGIN_AS_NAMESPACE
-
-#define AS_PPC_MAX_ARGS 32
-#define AS_PPC_THISCALL_REG 1
-#define AS_PPC_RETURNINMEM_REG 1
-#define AS_PPC_ENDOFARGS 1
-
-// The array used to send values to the correct places.
-// Contains a byte of argTypes to indicate the register type to load, or zero if end of arguments
-enum argTypes
-{
- ppcENDARG = 0,
- ppcINTARG = 1,
- ppcFLOATARG = 2,
- ppcDOUBLEARG = 3
-};
-
-// Loads all data into the correct places and calls the function.
-// pArgs is the array of the argument values
-// pArgTypes is an array containing a byte indicating the type (enum argTypes) for each argument.
-// dwFunc is the address of the function that will be called
-asQWORD __declspec( naked ) ppcFunc(const asQWORD* pArgs, asDWORD dwFunc, const asBYTE* pArgTypes)
-{
- __asm
- {
-_ppcFunc:
- // Prologue
- // Read and stack the link register (return address)
- mflr r12
- stw r12,-8(r1)
-
- // Backup all non-volatile registers we use in this function
- std r31,-10h(r1) // stack pointer for pushing arguments
- std r27,-18h(r1) // dwFunc
- std r26,-20h(r1) // pArgs
- std r25,-28h(r1) // pArgTypes
- std r24,-30h(r1) // current arg type
- std r23,-38h(r1) // counter for used GPRs
- std r22,-40h(r1) // counter for used float registers
-
- // Setup the stack frame to make room for the backup of registers
- // and the arguments that will be passed to the application function.
- // 512 bytes is enough for about 50 arguments plus backup of 8
- // TODO: Should perhaps make this dynamic based on number of arguments
- stwu r1,-200h(r1)
-
-//////////////////////////////////////////////////////////////////////////
-// Initialize local variables
-//////////////////////////////////////////////////////////////////////////
-
- // r31 is our pointer into the stack where the arguments will be place
- // The MSVC optimizer seems to rely on nobody copying the r1 register directly
- // so we can't just do a simple 'addi r31, r1, 14h' as the optimizer may
- // end up moving this instruction to before the update of r1 above.
- // Instead we'll read the previous stack pointer from the stack, and then
- // subtract to get the correct offset.
- lwz r31, 0(r1)
- subi r31, r31, 1ECh // prev r1 - 512 + 20 = curr r1 + 20
-
- mr r26, r3 // pArgs
- mr r27, r4 // dwFunc
- mr r25, r5 // pArgTypes
-
- // Counting of used/assigned GPR's
- sub r23, r23, r23
- // Counting of used/assigned Float Registers
- sub r22, r22, r22
-
- // Begin loading and stacking registers
- subi r25, r25, 1
-
-//////////////////////////////////////////////////////////////////////////
-// Fetch the next argument
-//////////////////////////////////////////////////////////////////////////
-ppcNextArg:
- // Increment rArgTypePtr
- addi r25, r25, 1
- // Get data type
- lbz r24, 0(r25)
-
- // r24 holds the data type
- cmplwi cr6, r24, 0
- beq cr6, ppcArgsEnd
- cmplwi cr6, r24, 1
- beq cr6, ppcArgIsInteger
- cmplwi cr6, r24, 2
- beq cr6, ppcArgIsFloat
- cmplwi cr6, r24, 3
- beq cr6, ppcArgIsDouble
-
-//////////////////////////////////////////////////////////////////////////
-// Load and stack integer arguments
-//////////////////////////////////////////////////////////////////////////
-ppcArgIsInteger:
- // Get the arg from the stack
- ld r12, 0(r26)
-
- // r23 holds the integer arg count so far
- cmplwi cr6, r23, 0
- beq cr6, ppcLoadIntReg0
- cmplwi cr6, r23, 1
- beq cr6, ppcLoadIntReg1
- cmplwi cr6, r23, 2
- beq cr6, ppcLoadIntReg2
- cmplwi cr6, r23, 3
- beq cr6, ppcLoadIntReg3
- cmplwi cr6, r23, 4
- beq cr6, ppcLoadIntReg4
- cmplwi cr6, r23, 5
- beq cr6, ppcLoadIntReg5
- cmplwi cr6, r23, 6
- beq cr6, ppcLoadIntReg6
- cmplwi cr6, r23, 7
- beq cr6, ppcLoadIntReg7
-
- // no more than 8 parameters
- b ppcLoadIntRegUpd
-
- ppcLoadIntReg0:
- mr r3, r12
- b ppcLoadIntRegUpd
- ppcLoadIntReg1:
- mr r4, r12
- b ppcLoadIntRegUpd
- ppcLoadIntReg2:
- mr r5, r12
- b ppcLoadIntRegUpd
- ppcLoadIntReg3:
- mr r6, r12
- b ppcLoadIntRegUpd
- ppcLoadIntReg4:
- mr r7, r12
- b ppcLoadIntRegUpd
- ppcLoadIntReg5:
- mr r8, r12
- b ppcLoadIntRegUpd
- ppcLoadIntReg6:
- mr r9, r12
- b ppcLoadIntRegUpd
- ppcLoadIntReg7:
- mr r10, r12
- b ppcLoadIntRegUpd
-
- ppcLoadIntRegUpd:
- std r12, 0(r31) // push on the stack
- addi r31, r31, 8 // inc stack by 1 reg
-
- addi r23, r23, 1 // Increment used int register count
- addi r26, r26, 8 // Increment pArgs
- b ppcNextArg // Call next arg
-
-//////////////////////////////////////////////////////////////////////////
-// Load and stack float arguments
-//////////////////////////////////////////////////////////////////////////
-ppcArgIsFloat:
- // Get the arg from the stack
- lfs fr0, 0(r26)
-
- // r22 holds the float arg count so far
- cmplwi cr6, r22, 0
- beq cr6, ppcLoadFloatReg0
- cmplwi cr6, r22, 1
- beq cr6, ppcLoadFloatReg1
- cmplwi cr6, r22, 2
- beq cr6, ppcLoadFloatReg2
- cmplwi cr6, r22, 3
- beq cr6, ppcLoadFloatReg3
- cmplwi cr6, r22, 4
- beq cr6, ppcLoadFloatReg4
- cmplwi cr6, r22, 5
- beq cr6, ppcLoadFloatReg5
- cmplwi cr6, r22, 6
- beq cr6, ppcLoadFloatReg6
- cmplwi cr6, r22, 7
- beq cr6, ppcLoadFloatReg7
- cmplwi cr6, r22, 8
- beq cr6, ppcLoadFloatReg8
- cmplwi cr6, r22, 9
- beq cr6, ppcLoadFloatReg9
- cmplwi cr6, r22, 10
- beq cr6, ppcLoadFloatReg10
- cmplwi cr6, r22, 11
- beq cr6, ppcLoadFloatReg11
- cmplwi cr6, r22, 12
- beq cr6, ppcLoadFloatReg12
-
- // no more than 12 parameters
- b ppcLoadFloatRegUpd
-
- ppcLoadFloatReg0:
- fmr fr1, fr0
- b ppcLoadFloatRegUpd
- ppcLoadFloatReg1:
- fmr fr2, fr0
- b ppcLoadFloatRegUpd
- ppcLoadFloatReg2:
- fmr fr3, fr0
- b ppcLoadFloatRegUpd
- ppcLoadFloatReg3:
- fmr fr4, fr0
- b ppcLoadFloatRegUpd
- ppcLoadFloatReg4:
- fmr fr5, fr0
- b ppcLoadFloatRegUpd
- ppcLoadFloatReg5:
- fmr fr6, fr0
- b ppcLoadFloatRegUpd
- ppcLoadFloatReg6:
- fmr fr7, fr0
- b ppcLoadFloatRegUpd
- ppcLoadFloatReg7:
- fmr fr8, fr0
- b ppcLoadFloatRegUpd
- ppcLoadFloatReg8:
- fmr fr9, fr0
- b ppcLoadFloatRegUpd
- ppcLoadFloatReg9:
- fmr fr10, fr0
- b ppcLoadFloatRegUpd
- ppcLoadFloatReg10:
- fmr fr11, fr0
- b ppcLoadFloatRegUpd
- ppcLoadFloatReg11:
- fmr fr12, fr0
- b ppcLoadFloatRegUpd
- ppcLoadFloatReg12:
- fmr fr13, fr0
- b ppcLoadFloatRegUpd
-
- ppcLoadFloatRegUpd:
- stfs fr0, 0(r31) // push on the stack
- addi r31, r31, 8 // inc stack by 1 reg
-
- addi r22, r22, 1 // Increment used float register count
- addi r23, r23, 1 // Increment used int register count - a float reg eats up a GPR
- addi r26, r26, 4 // Increment pArgs
- b ppcNextArg // Call next arg
-
-//////////////////////////////////////////////////////////////////////////
-// Load and stack double float arguments
-//////////////////////////////////////////////////////////////////////////
-ppcArgIsDouble:
- // Get the arg from the stack
- lfd fr0, 0(r26)
-
- // r22 holds the float arg count so far
- cmplwi cr6, r22, 0
- beq cr6, ppcLoadDoubleReg0
- cmplwi cr6, r22, 1
- beq cr6, ppcLoadDoubleReg1
- cmplwi cr6, r22, 2
- beq cr6, ppcLoadDoubleReg2
- cmplwi cr6, r22, 3
- beq cr6, ppcLoadDoubleReg3
- cmplwi cr6, r22, 4
- beq cr6, ppcLoadDoubleReg4
- cmplwi cr6, r22, 5
- beq cr6, ppcLoadDoubleReg5
- cmplwi cr6, r22, 6
- beq cr6, ppcLoadDoubleReg6
- cmplwi cr6, r22, 7
- beq cr6, ppcLoadDoubleReg7
- cmplwi cr6, r22, 8
- beq cr6, ppcLoadDoubleReg8
- cmplwi cr6, r22, 9
- beq cr6, ppcLoadDoubleReg9
- cmplwi cr6, r22, 10
- beq cr6, ppcLoadDoubleReg10
- cmplwi cr6, r22, 11
- beq cr6, ppcLoadDoubleReg11
- cmplwi cr6, r22, 12
- beq cr6, ppcLoadDoubleReg12
-
- // no more than 12 parameters
- b ppcLoadDoubleRegUpd
-
- ppcLoadDoubleReg0:
- fmr fr1, fr0
- b ppcLoadDoubleRegUpd
- ppcLoadDoubleReg1:
- fmr fr2, fr0
- b ppcLoadDoubleRegUpd
- ppcLoadDoubleReg2:
- fmr fr3, fr0
- b ppcLoadDoubleRegUpd
- ppcLoadDoubleReg3:
- fmr fr4, fr0
- b ppcLoadDoubleRegUpd
- ppcLoadDoubleReg4:
- fmr fr5, fr0
- b ppcLoadDoubleRegUpd
- ppcLoadDoubleReg5:
- fmr fr6, fr0
- b ppcLoadDoubleRegUpd
- ppcLoadDoubleReg6:
- fmr fr7, fr0
- b ppcLoadDoubleRegUpd
- ppcLoadDoubleReg7:
- fmr fr8, fr0
- b ppcLoadDoubleRegUpd
- ppcLoadDoubleReg8:
- fmr fr9, fr0
- b ppcLoadDoubleRegUpd
- ppcLoadDoubleReg9:
- fmr fr10, fr0
- b ppcLoadDoubleRegUpd
- ppcLoadDoubleReg10:
- fmr fr11, fr0
- b ppcLoadDoubleRegUpd
- ppcLoadDoubleReg11:
- fmr fr12, fr0
- b ppcLoadDoubleRegUpd
- ppcLoadDoubleReg12:
- fmr fr13, fr0
- b ppcLoadDoubleRegUpd
-
- ppcLoadDoubleRegUpd:
- stfd fr0, 0(r31) // push on the stack
- addi r31, r31, 8 // inc stack by 1 reg
-
- addi r22, r22, 1 // Increment used float register count
- addi r23, r23, 1 // Increment used int register count
- addi r26, r26, 8 // Increment pArgs
- b ppcNextArg
-
-//////////////////////////////////////////////////////////////////////////
-// Finished
-//////////////////////////////////////////////////////////////////////////
-ppcArgsEnd:
- // Call the function
- mtctr r27
- bctrl
-
- // Epilogue
- // Restore callers stack
- addi r1, r1, 200h
-
- // restore all registers we used in this fct
- ld r22,-40h(r1)
- ld r23,-38h(r1)
- ld r24,-30h(r1)
- ld r25,-28h(r1)
- ld r26,-20h(r1)
- ld r27,-18h(r1)
- ld r31,-10h(r1)
-
- // Fetch return link to caller
- lwz r12,-8(r1)
- mtlr r12
- blr
- }
-}
-
-asDWORD GetReturnedFloat()
-{
- // This variable must be declared volatile so that the
- // compiler optimizations do not remove its initialization
- // with the fr1 register due to believing the fr1 register
- // isn't initialized.
- volatile asDWORD f;
-
- __asm
- {
- stfs fr1, f
- }
-
- return f;
-}
-
-asQWORD GetReturnedDouble()
-{
- // This variable must be declared volatile so that the
- // compiler optimizations do not remove its initialization
- // with the fr1 register due to believing the fr1 register
- // isn't initialized.
- volatile asQWORD f;
-
- __asm
- {
- stfd fr1, f
- }
-
- return f;
-}
-
-// returns true if the given parameter is a 'variable argument'
-inline bool IsVariableArgument( asCDataType type )
-{
- return (type.GetTokenType() == ttQuestion) ? true : false;
-}
-
-asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/, void */*secondObject*/)
-{
- // TODO: Xenon does not yet support THISCALL_OBJFIRST/LAST
-
- asCScriptEngine *engine = context->m_engine;
- asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
- int callConv = sysFunc->callConv;
- asQWORD retQW = 0;
- void *func = (void*)sysFunc->func;
- asDWORD *vftable;
-
- // Pack the arguments into an array that ppcFunc() can use to load each CPU register properly
- asBYTE ppcArgsType[AS_PPC_MAX_ARGS + AS_PPC_RETURNINMEM_REG + AS_PPC_THISCALL_REG + AS_PPC_ENDOFARGS];
- asQWORD ppcArgs[AS_PPC_MAX_ARGS + AS_PPC_RETURNINMEM_REG + AS_PPC_THISCALL_REG];
- int argsCnt = 0;
-
- // If the function returns an object in memory, we allocate the memory and put the ptr to the front (will go to r3)
- if( sysFunc->hostReturnInMemory )
- {
- ppcArgs[argsCnt] = (asDWORD)retPointer;
- ppcArgsType[argsCnt] = ppcINTARG;
- argsCnt++;
- }
-
- // If we have an object and it's not objectlast, then we put it as the first arg
- if ( obj &&
- callConv != ICC_CDECL_OBJLAST &&
- callConv != ICC_CDECL_OBJLAST_RETURNINMEM )
- {
- ppcArgs[argsCnt] = (asDWORD)obj;
- ppcArgsType[argsCnt] = ppcINTARG;
- argsCnt++;
- }
-
- // If the function takes any objects by value, they must be copied
- // to the stack, shifting the other arguments as necessary. paramBuffer
- // will then replace the args pointer that was received from the VM.
- // TODO: Is this really how XBox 360 passes objects by value?
- asDWORD paramBuffer[AS_PPC_MAX_ARGS];
- if( sysFunc->takesObjByVal )
- {
- int paramSize = 0;
- int spos = 0;
- int dpos = 1;
-
- for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
- {
- // Parameter object by value
- if( descr->parameterTypes[n].IsObject() &&
- !descr->parameterTypes[n].IsObjectHandle() &&
- !descr->parameterTypes[n].IsReference() )
- {
-#ifdef COMPLEX_OBJS_PASSED_BY_REF
- if( descr->parameterTypes[n].GetTypeInfo()->flags & COMPLEX_MASK )
- {
- paramBuffer[dpos++] = args[spos++];
- paramSize++;
- }
- else
-#endif
- {
- // Copy the object's memory to the buffer
- memcpy( ¶mBuffer[dpos], *(void**)(args + spos), descr->parameterTypes[n].GetSizeInMemoryBytes() );
-
- // Delete the original memory
- engine->CallFree(*(char**)(args + spos));
-
- spos++;
- dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
- paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
- }
- }
- else
- {
- // Copy the value directly
- paramBuffer[dpos++] = args[spos++];
- if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
- paramBuffer[dpos++] = args[spos++];
- paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
- }
-
- // If this was a variable argument parameter, then account for the implicit typeId
- if( IsVariableArgument( descr->parameterTypes[n] ) )
- {
- // the TypeId is just a DWORD
- paramBuffer[dpos++] = args[spos++];
- ++paramSize;
- }
- }
-
- // Keep a free location at the beginning
- args = ¶mBuffer[1];
-
- asASSERT( paramSize <= AS_PPC_MAX_ARGS );
- }
-
-
- const asUINT paramCount = (asUINT)descr->parameterTypes.GetLength();
-
- asBYTE * pCurArgType = (asBYTE*)&ppcArgsType[argsCnt];
- asBYTE * pCurFixedArgValue = (asBYTE*)&ppcArgs[argsCnt];
- asBYTE * pCurStackArgValue = (asBYTE*)args;
-
- for( asUINT n = 0; n < paramCount; n++ )
- {
- argsCnt++;
-
- if (descr->parameterTypes[n].IsFloatType() && !descr->parameterTypes[n].IsReference())
- {
- *pCurArgType++ = ppcFLOATARG;
-
- *((float*) pCurFixedArgValue) = *((float*) pCurStackArgValue);
-
- pCurFixedArgValue += 4;
- pCurStackArgValue += 4;
- }
- else if (descr->parameterTypes[n].IsDoubleType() && !descr->parameterTypes[n].IsReference())
- {
- *pCurArgType++ = ppcDOUBLEARG;
-
- *((double*) pCurFixedArgValue) = *((double*) pCurStackArgValue);
-
- pCurFixedArgValue += 8;
- pCurStackArgValue += 8;
- }
- else
- {
- // TODO: The code also ignore the fact that large objects
- // passed by value has been copied to the stack
- // in the above loop.
-
- *pCurArgType++ = ppcINTARG;
-
- *((asQWORD*) pCurFixedArgValue) = *((asUINT*) pCurStackArgValue);
-
- if( !descr->parameterTypes[n].IsReference() )
- {
- // If the arg is not 4 bytes which we coppied, lets do it again the right way
- asUINT numBytes = descr->parameterTypes[n].GetSizeInMemoryBytes();
- if( numBytes == 1 )
- {
- *((asQWORD*) pCurFixedArgValue) = *((asBYTE*) pCurStackArgValue);
- }
- else if( numBytes == 2 )
- {
- *((asQWORD*) pCurFixedArgValue) = *((asWORD*) pCurStackArgValue);
- }
- else if( numBytes == 8 )
- {
- *((asQWORD*) pCurFixedArgValue) = *((asQWORD*) pCurStackArgValue);
- pCurStackArgValue += 4; // Increase our cur stack arg value by 4 bytes to = 8 total later
- }
- }
-
- pCurFixedArgValue += 8;
- pCurStackArgValue += 4;
-
- // if it is a variable argument, account for the typeId
- // implicitly add another parameter (AFTER the parameter above) for the typeId
- if( IsVariableArgument(descr->parameterTypes[n]) )
- {
- argsCnt++;
-
- *pCurArgType++ = ppcINTARG;
-
- *((int*) pCurFixedArgValue) = *((int*) pCurStackArgValue);
-
- pCurFixedArgValue += 4;
- pCurStackArgValue += 4;
- }
- }
- }
-
- // Add the arg list end indicator
- ppcArgsType[argsCnt] = ppcENDARG;
-
- switch( callConv )
- {
- case ICC_CDECL:
- case ICC_CDECL_RETURNINMEM:
- case ICC_STDCALL:
- case ICC_STDCALL_RETURNINMEM:
- case ICC_THISCALL:
- case ICC_THISCALL_RETURNINMEM:
- case ICC_CDECL_OBJFIRST:
- case ICC_CDECL_OBJFIRST_RETURNINMEM:
- {
- retQW = ppcFunc( ppcArgs, (asDWORD)func, ppcArgsType );
- break;
- }
- case ICC_VIRTUAL_THISCALL:
- case ICC_VIRTUAL_THISCALL_RETURNINMEM:
- {
- // Get virtual function table from the object pointer
- vftable = *(asDWORD**)obj;
- retQW = ppcFunc( ppcArgs, vftable[asDWORD(func)>>2], ppcArgsType );
- break;
- }
- case ICC_CDECL_OBJLAST:
- case ICC_CDECL_OBJLAST_RETURNINMEM:
- {
- // Add the object pointer as the last argument
- ppcArgsType[argsCnt++] = ppcINTARG;
- ppcArgsType[argsCnt] = ppcENDARG;
- *((asQWORD*)pCurFixedArgValue) = (asPWORD)obj;
- retQW = ppcFunc( ppcArgs, (asDWORD)func, ppcArgsType );
- break;
- }
- default:
- context->SetInternalException( TXT_INVALID_CALLING_CONVENTION );
- }
-
- // If the return is a float value we need to get the value from the FP register
- if( sysFunc->hostReturnFloat )
- {
- if( sysFunc->hostReturnSize == 1 )
- *(asDWORD*)&retQW = GetReturnedFloat();
- else
- retQW = GetReturnedDouble();
- }
- else if( sysFunc->hostReturnSize == 1 )
- {
- // Move the bits to the higher value to compensate for the adjustment that the caller does
- retQW <<= 32;
- }
-
- return retQW;
-}
-
-END_AS_NAMESPACE
-
-#endif // AS_XENON
-#endif // AS_MAX_PORTABILITY
-
-
-
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index d7d84515e05..1137b4ad506 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -367,17 +367,6 @@ MODULE_OBJS := \
engine/libraries/angelscript/sources/as_builder.o \
engine/libraries/angelscript/sources/as_bytecode.o \
engine/libraries/angelscript/sources/as_callfunc.o \
- engine/libraries/angelscript/sources/as_callfunc_arm.o \
- engine/libraries/angelscript/sources/as_callfunc_arm64.o \
- engine/libraries/angelscript/sources/as_callfunc_mips.o \
- engine/libraries/angelscript/sources/as_callfunc_ppc.o \
- engine/libraries/angelscript/sources/as_callfunc_ppc_64.o \
- engine/libraries/angelscript/sources/as_callfunc_sh4.o \
- engine/libraries/angelscript/sources/as_callfunc_x64_gcc.o \
- engine/libraries/angelscript/sources/as_callfunc_x64_mingw.o \
- engine/libraries/angelscript/sources/as_callfunc_x64_msvc.o \
- engine/libraries/angelscript/sources/as_callfunc_x86.o \
- engine/libraries/angelscript/sources/as_callfunc_xenon.o \
engine/libraries/angelscript/sources/as_compiler.o \
engine/libraries/angelscript/sources/as_configgroup.o \
engine/libraries/angelscript/sources/as_context.o \
Commit: 9fc769c68c0b522d438dab384a4104cf12c9dded
https://github.com/scummvm/scummvm/commit/9fc769c68c0b522d438dab384a4104cf12c9dded
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:39+01:00
Commit Message:
HPL1: fix return value in script macros
Changed paths:
engines/hpl1/engine/system/Script.h
diff --git a/engines/hpl1/engine/system/Script.h b/engines/hpl1/engine/system/Script.h
index 09b8d1cdf6f..a56730005c6 100644
--- a/engines/hpl1/engine/system/Script.h
+++ b/engines/hpl1/engine/system/Script.h
@@ -206,7 +206,7 @@
#define SCRIPT_SET_RETURN_string gen->SetReturnObject(&_ret)
#define SCRIPT_RETURN_bool bool _ret
#define SCRIPT_RETURN_CALL_bool _ret =
-#define SCRIPT_SET_RETURN_bool gen->SetReturnDWord(_ret ? -1 : 0)
+#define SCRIPT_SET_RETURN_bool gen->SetReturnByte(_ret ? -1 : 0)
#define SCRIPT_RETURN_int int _ret
#define SCRIPT_RETURN_CALL_int _ret =
#define SCRIPT_SET_RETURN_int gen->SetReturnDWord(_ret)
Commit: 422283601c8fd813ab7731939cd4dc3991b6ffd1
https://github.com/scummvm/scummvm/commit/422283601c8fd813ab7731939cd4dc3991b6ffd1
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:40+01:00
Commit Message:
HPL1: fix memory fault in mesh loader
Changed paths:
engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
index aab029c6efe..af3dedb838d 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
@@ -1416,7 +1416,9 @@ void cMeshLoaderCollada::LoadGeometry(TiXmlElement *apRootElem, tColladaGeometry
for (int i = 0; i < 3; i++) {
DataVec[i].mlVtx = vIndexArray[lTriangleAdd + i * lTriElements + Geometry.mlPosIdxNum];
DataVec[i].mlNorm = vIndexArray[lTriangleAdd + i * lTriElements + Geometry.mlNormIdxNum];
- DataVec[i].mlTex = vIndexArray[lTriangleAdd + i * lTriElements + Geometry.mlTexIdxNum];
+ // FIXME: temporary fix for a memory fault caused by a negative index value
+ if ((lTriangleAdd + i * lTriElements + Geometry.mlTexIdxNum) >= 0)
+ DataVec[i].mlTex = vIndexArray[lTriangleAdd + i * lTriElements + Geometry.mlTexIdxNum];
}
}
Commit: c3fa0236d1f76a73d7aa18d6fe7db9418f92a8ab
https://github.com/scummvm/scummvm/commit/c3fa0236d1f76a73d7aa18d6fe7db9418f92a8ab
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:40+01:00
Commit Message:
HPL1: specify source for collision fix
Changed paths:
engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
diff --git a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
index b36d3c5b5fd..8608079cfdf 100644
--- a/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsWorldNewton.cpp
@@ -447,6 +447,7 @@ void cPhysicsWorldNewton::CastRay(iPhysicsRayCallback *apCallback,
//-----------------------------------------------------------------------
+// Fix found in HPL2 (https://github.com/FrictionalGames/AmnesiaTheDarkDescent)
static void correctNormal(cVector3f& normal, const cVector3f& collidePoint, const cVector3f& shapeCenter) {
cVector3f vCenterToCollidePoint = collidePoint - shapeCenter;
//A check if the normal points in the wrong direction.
@@ -456,7 +457,7 @@ static void correctNormal(cVector3f& normal, const cVector3f& collidePoint, cons
bool cPhysicsWorldNewton::CheckShapeCollision(iCollideShape *apShapeA, const cMatrixf &a_mtxA,
iCollideShape *apShapeB, const cMatrixf &a_mtxB,
- cCollideData &aCollideData, int alMaxPoints,
+ cCollideData &aCollideData, int alMaxPoints,
bool correctNormalDirection) {
cCollideShapeNewton *pNewtonShapeA = static_cast<cCollideShapeNewton *>(apShapeA);
cCollideShapeNewton *pNewtonShapeB = static_cast<cCollideShapeNewton *>(apShapeB);
Commit: f47dd3ed8526888a1a34f9a77eaf6d28a4d66db2
https://github.com/scummvm/scummvm/commit/f47dd3ed8526888a1a34f9a77eaf6d28a4d66db2
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:40+01:00
Commit Message:
HPL1: add shader files
Changed paths:
A engines/hpl1/engine/impl/glsl_shaders/Ambient_Color.fragment
A engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.fragment
A engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.vertex
A engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light.fragment
A engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light_Spot.fragment
A engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.fragment
A engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.vertex
A engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light.fragment
A engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot.fragment
A engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot_pass2.fragment
A engines/hpl1/engine/impl/glsl_shaders/Bump_Light.fragment
A engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot.fragment
A engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot_pass2.fragment
A engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.fragment
A engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.vertex
A engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.fragment
A engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.vertex
A engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot_pass2.fragment
A engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.fragment
A engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.vertex
A engines/hpl1/engine/impl/glsl_shaders/Diffuse_ColorMul.vertex
A engines/hpl1/engine/impl/glsl_shaders/Diffuse_EnvMap_Reflect.vertex
A engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.fragment
A engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.vertex
A engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.fragment
A engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.vertex
A engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass1.fragment
A engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass2.fragment
A engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
A engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p1.vertex
A engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p2.vertex
A engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
A engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
A engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p1.vertex
A engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p2.vertex
A engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.fragment
A engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.vertex
A engines/hpl1/engine/impl/glsl_shaders/Fog_Trans.vertex
A engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Alpha.fragment
A engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Mod.fragment
A engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_ModX2.fragment
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.fragment
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.vertex
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur.vertex
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_2D.fragment
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_Rect.fragment
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.fragment
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.vertex
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_2D.fragment
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_Rect.fragment
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.fragment
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.vertex
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion_staticloop.fragment
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.fragment
A engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.vertex
A engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.fragment
A engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.vertex
A engines/hpl1/engine/impl/glsl_shaders/Water_Diffuse.vertex
A engines/hpl1/engine/impl/glsl_shaders/Water_Fog.vertex
A engines/hpl1/engine/impl/glsl_shaders/refract.fragment
A engines/hpl1/engine/impl/glsl_shaders/refract.vertex
A engines/hpl1/engine/impl/glsl_shaders/refract_special.fragment
A engines/hpl1/engine/impl/glsl_shaders/refract_water.fragment
A engines/hpl1/engine/impl/glsl_shaders/refract_water.vertex
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Ambient_Color.fragment b/engines/hpl1/engine/impl/glsl_shaders/Ambient_Color.fragment
new file mode 100644
index 00000000000..03bdbfbe4ca
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Ambient_Color.fragment
@@ -0,0 +1,25 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// AMBIENT DIFFUSE COLOR FRAG PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos;
+in vec4 vLightColor;
+in vec2 vUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap;
+uniform vec3 ambientColor;
+
+void main()
+{
+ outColor = texture(diffuseMap, vUv);
+ outColor.xyz *= ambientColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.fragment b/engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.fragment
new file mode 100644
index 00000000000..2f7b66774f4
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.fragment
@@ -0,0 +1,29 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SPECULAR BUMPMAPPING 2D FRAGMENT PROGRAM //////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vColor;
+in vec3 vUv; //in object space
+in vec3 vLightDir;
+in vec2 vScreenPos;
+
+OUTPUT
+
+uniform sampler2D NormalMap = 0;
+uniform sampler2D LightMap = 1;
+
+void main()
+{
+ vec4 BumpVec = (1 - 2*texture(NormalMap, vUv));
+ vec4 LightCol = texture(LightMap,vScreenPos);
+ float Diffuse = dot(vLightDir,BumpVec.xyz)*LightCol.x;
+ outColor.xyz = Diffuse*vColor.xyz;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.vertex b/engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.vertex
new file mode 100644
index 00000000000..4e99aa38976
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.vertex
@@ -0,0 +1,48 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// BUMPMAPPING 2D VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 uv;
+
+out vec4 vPos;
+out vec4 vColor;
+out vec3 vUv;
+out vec3 vLighDir;
+out vec2 vScreenPos;
+
+uniform mat4 worldViewProj;
+uniform vec3 LightPos;
+uniform float LightRadius;
+uniform vec4 LightColor;
+
+void main()
+{
+ vec3 L;
+
+ //Get the direction of the light and normalize it
+ vLighDir.xy = position.xy - LightPos.xy;
+ vScreenPos = (vLighDir.xy + (LightRadius) )/ (LightRadius*2.0);
+ //rotate the light to texture (tangent) space. Normal x=cos(angle) y = sin(angle)
+ vec2 TempLight = vLighDir.xy;
+ vLighDir.x = normal.x*TempLight.x + normal.y*TempLight.y;
+ vLighDir.y = normal.x*TempLight.y - normal.y*TempLight.x;
+ vLighDir.x *= normal.z/abs(normal.z);
+ vLighDir.y *= abs(normal.z)-2.0;
+
+ vLighDir.z = -LightPos.z;
+ vLighDir = normalize(vLighDir);
+
+ vPos = worldViewProj * position;
+
+ vColor = LightColor;
+ vUv = uv;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light.fragment b/engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light.fragment
new file mode 100644
index 00000000000..63a01b24ed8
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light.fragment
@@ -0,0 +1,42 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// BUMP COLOR SPECULAR LIGHTING FRAGMENT PROGRAM ///////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vHalfVec;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform sampler2D normalMap = 1;
+uniform samplerCube normalCubeMap = 2;
+uniform sampler1D falloffMap = 3;
+uniform sampler2D specularMap = 6;
+
+void main()
+{
+ float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
+
+ vec3 bumpVec = texture(normalMap, vUv).xyz;
+ bumpVec.xyz = (2.0*bumpVec.xyz)-vec3(1.0);
+
+ vLightDir = normalize(vLightDir);
+ vHalfVec = normalize(vHalfVec);
+
+ float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
+ specular = pow(specular, 16.0) * vLightColor.w;
+
+ outColor.xyz = texture(diffuseMap, vUv).xyz * vLightColor.xyz * dot(vLightDir, bumpVec.xyz)
+ + (specular * texture(specularMap, vUv).xyz);
+ outColor.xyz *= attenuation;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light_Spot.fragment
new file mode 100644
index 00000000000..e4d84f254ff
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light_Spot.fragment
@@ -0,0 +1,47 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE COLOR SPOTLIGHTING FRAGMENT PROGRAM /////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vHalfVec;
+in vec3 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform sampler2D normalMap = 1;
+uniform samplerCube normalCubeMap = 2;
+uniform sampler1D falloffMap = 3;
+uniform sampler2D spotlightMap = 4;
+uniform sampler1D spotNegRejectMap = 5;
+uniform sampler2D specularMap = 6;
+
+void main()
+{
+ vec3 diffuse = texture(diffuseMap, vUv).xyz;
+
+ vec3 bumpVec = (2.0*texture(normalMap, vUv)-vec3(1.0)).xyz;
+ vec3 lightVec = normalize(vLightDir);
+ vHalfVec = normalize(vHalfVec);
+
+ float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
+ vec4 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z); // CHECK
+ float rejectNeg = texture1D(spotNegRejectMap,vSpotlightUv.z + 0.5).x;
+
+ float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
+ specular = pow(specular, 16.0)* vLightColor.w * spotColor.w;
+
+ outColor.xyz = diffuse * dot(lightVec, bumpVec.xyz) * vLightColor.xyz * spotColor.xyz
+ + (specular * texture(specularMap, vUv).xyz);
+ outColor.xyz *= attenuation * rejectNeg;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.fragment b/engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.fragment
new file mode 100644
index 00000000000..7aff349fde4
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.fragment
@@ -0,0 +1,38 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in
+// LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SPECULAR BUMPMAPPING 2D FRAGMENT PROGRAM //////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; // in projection space
+in vec4 vColor;
+in vec3 vUv; // in object space
+in vec3 vLightDir;
+in vec3 vHalfVec;
+in vec2 vScreenPos;
+
+OUTPUT
+
+uniform sampler2D NormalMap = 0;
+uniform sampler2D LightMap = 1;
+
+void main() {
+ vec4 BumpVec = (vec3(1.0) - 2.0 * texture(NormalMap, uv));
+
+ vec4 LightCol = texture(LightMap, vScreenPos);
+
+ BumpVec.xyz = normalize(BumpVec.xyz);
+ float Diffuse = dot(normalize(vLightDir), BumpVec.xyz) * LightCol.x;
+
+ float Specular = dot(normalize(vHalfVec), BumpVec.xyz);
+ Specular = pow(Specular, 24.0) * BumpVec.w * vColor.w;
+
+ outColor.xyz = Diffuse * vColor.xyz;
+ outColor.w = Specular * LightCol.x;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.vertex b/engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.vertex
new file mode 100644
index 00000000000..b8947429304
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.vertex
@@ -0,0 +1,67 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SPECULAR BUMPMAPPING 2D VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 uv;
+
+out vec4 vPos;
+out vec4 vColor
+out vec3 vUv;
+out vec3 vLighDir;
+out vec3 vHalfVec;
+out vec2 vScreenPos;
+
+uniform mat4 worldViewProj;
+uniform vec3 LightPos;
+uniform vec3 EyePos;
+uniform float LightRadius;
+uniform vec4 LightColor;
+
+void main()
+{
+ vec3 L;
+
+ //Get the direction of the light and normalize it
+ vLighDir.xy = position.xy - LightPos.xy;
+
+ vScreenPos = (vLighDir.xy + (LightRadius)) / (LightRadius * 2.0);
+
+ //rotate the light to texture (tangent) space. Normal x=cos(angle) y = sin(angle)
+ vec2 TempLight = vLighDir.xy;
+ vLighDir.x = normal.x*TempLight.x + normal.y*TempLight.y;
+ vLighDir.y = normal.x*TempLight.y - normal.y*TempLight.x;
+ vLighDir.x *= normal.z / abs(normal.z);
+ vLighDir.y *= abs(normal.z)-2.0;
+
+ vLighDir.z = -LightPos.z;
+ vLighDir = normalize(vLighDir);
+
+ //Get the halfangle and normalize it
+ vHalfVec.xy = position.xy - EyePos.xy;
+ vHalfVec.z = -EyePos.y;
+
+ ///rotate halfvec aswell NOTE: Not sure you need this...
+ vec2 TempHalfVec = vHalfVec.xy;
+ vHalfVec.x = normal.x*TempHalfVec.x + normal.y*TempHalfVec.y;
+ vHalfVec.y = normal.x*TempHalfVec.y - normal.y*TempHalfVec.x;
+ vHalfVec.x *= normal.z/abs(normal.z);
+ vHalfVec.y *= abs(normal.z) - 2.0;
+
+ vHalfVec = normalize(vHalfVec);
+ vHalfVec = normalize(vHalfVec + vLighDir);
+
+ vPos = worldViewProj * position;
+
+ vColor = LightColor;
+
+ vUv = uv;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light.fragment b/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light.fragment
new file mode 100644
index 00000000000..ea188f88a82
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light.fragment
@@ -0,0 +1,41 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// BUMP SPECULAR LIGHTING FRAGMENT PROGRAM ///////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vHalfVec;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform sampler2D normalMap = 1;
+uniform samplerCube normalCubeMap = 2;
+uniform sampler1D falloffMap = 3;
+
+void main()
+{
+ float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
+
+ vec4 bumpVec = texture(normalMap, vUv);
+ bumpVec.xyz = (2.0*bumpVec.xyz)-vec3(1.0);
+
+ vLightDir = normalize(vLightDir);
+ vHalfVec = normalize(vHalfVec);
+
+ float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
+ specular = pow(specular, 16.0) * vLightColor.w * clamp(bumpVec.w, 0.0, 1.0);
+
+ outColor.xyz = texture(diffuseMap, vUv).xyz * vLightColor.xyz * dot(vLightDir, bumpVec.xyz) +
+ specular;
+ outColor.xyz *= attenuation;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot.fragment
new file mode 100644
index 00000000000..d1949196815
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot.fragment
@@ -0,0 +1,48 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE SPOTLIGHTING FRAGMENT PROGRAM /////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vHalfVec;
+in vec3 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform sampler2D normalMap = 1;
+uniform samplerCube normalCubeMap = 2;
+uniform sampler1D falloffMap = 3;
+uniform sampler2D spotlightMap = 4;
+uniform sampler1D spotNegRejectMap = 5;
+
+void main()
+{
+ vec3 diffuse = texture(diffuseMap, vUv).xyz;
+
+ vec4 bumpVec = texture(normalMap, vUv);
+ bumpVec.xyz = (2.0*bumpVec.xyz)-vec3(1.0);
+
+ vec3 lightVec = normalize(vLightDir);//(2*textureCube(normalCubeMap,vLightDir)-1).xyz;
+ vHalfVec = normalize(vHalfVec);//(2*textureCube(normalCubeMap,vHalfVec)-1).xyz;
+
+ float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
+ vec4 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z);
+ float rejectNeg = texture1D(spotNegRejectMap,vSpotlightUv.z + 0.5).x;
+
+ float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
+ specular = pow(specular, 16.0) * vLightColor.w * clamp(bumpVec.w, 0.0, 1.0) * clamp(spotColor.w, 0.0, 1.0);
+
+ outColor.xyz = diffuse * dot(lightVec, bumpVec.xyz) * vLightColor.xyz * spotColor.xyz +
+ specular;
+ outColor.xyz *= attenuation * rejectNeg;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot_pass2.fragment
new file mode 100644
index 00000000000..dd361193d73
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot_pass2.fragment
@@ -0,0 +1,43 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE SPOTLIGHTING FRAGMENT PROGRAM /////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vHalfVec;
+in vec3 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform sampler2D normalMap = 1;
+uniform samplerCube normalCubeMap = 2;
+uniform sampler2D spotlightMap = 3;
+
+void main()
+{
+ vec3 diffuse = texture(diffuseMap, vUv).xyz;
+
+ vec4 bumpVec = texture(normalMap, vUv);
+ bumpVec.xyz = (2.0*bumpVec.xyz)-vec3(1.0);
+
+ vec3 lightVec = (2.0*textureCube(normalCubeMap,vLightDir)-vec3(1.0)).xyz;
+ vHalfVec = (2.0*textureCube(normalCubeMap,vHalfVec)-vec3(1.0)).xyz;
+
+ vec4 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z); // CHECK
+
+ float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
+ specular = pow(specular, 16.0) * vLightColor.w * clamp(bumpVec.w, 0.0, 1.0) * clamp(spotColor.w, 0.0, 1.0);
+
+ outColor.xyz = diffuse * dot(lightVec, bumpVec.xyz) * vLightColor.xyz * spotColor.xyz +
+ specular;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Bump_Light.fragment b/engines/hpl1/engine/impl/glsl_shaders/Bump_Light.fragment
new file mode 100644
index 00000000000..83e22791b95
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Bump_Light.fragment
@@ -0,0 +1,33 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform sampler2D normalMap = 1;
+uniform samplerCube normalCubeMap = 2;
+uniform sampler1D falloffMap = 3;
+
+void main()
+{
+ float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
+
+ vec4 bumpVec = (2*texture(normalMap, vUv)-1);
+ vec4 lightVec = (2.0*textureCube(normalCubeMap,vLightDir)-1.0);
+
+ outColor.xyz = texture(diffuseMap, vUv).xyz * vLightColor.xyz * attenuation * dot(lightVec.xyz,bumpVec.xyz);
+ outColor.w = 0;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot.fragment b/engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot.fragment
new file mode 100644
index 00000000000..a66710eec26
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot.fragment
@@ -0,0 +1,40 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in
+// LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// BUMP SPOTLIGHTING FRAGMENT PROGRAM /////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; // in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap;
+uniform sampler2D normalMap;
+uniform samplerCube normalCubeMap;
+uniform sampler1D falloffMap;
+uniform sampler2D spotlightMap;
+uniform sampler1D spotNegRejectMap;
+
+void main() {
+ vec3 diffuse = texture(diffuseMap, vUv).xyz;
+
+ vec3 bumpVec = (2 * texture(normalMap, vUv) - 1).xyz;
+ vec3 lightVec = (2.0 * textureCube(normalCubeMap, vLightDir) - 1.0).xyz;
+
+ float attenuation = texture1D(falloffMap, dot(vLightDir, vLightDir)).x;
+ vec3 spotColor =
+ texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z).xyz; // CHECK
+ float rejectNeg = texture1D(spotNegRejectMap, vSpotlightUv.z + 0.5).x;
+ outColor.xyz = diffuse * dot(lightVec, bumpVec) * attenuation *
+ vLightColor.xyz * spotColor * rejectNeg;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot_pass2.fragment
new file mode 100644
index 00000000000..9f7f3c1c0fa
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot_pass2.fragment
@@ -0,0 +1,33 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in
+// LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// BUMP SPOTLIGHTING FRAGMENT PROGRAM /////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; // in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0; //: TEXUNIT0,
+uniform sampler2D normalMap = 1; //: TEXUNIT1,
+uniform samplerCube normalCubeMap = 2; //: TEXUNIT2,
+uniform sampler2D spotlightMap = 3; //: TEXUNIT3
+
+void main() {
+ vec3 diffuse = texture(diffuseMap, vUv).xyz;
+ vec3 bumpVec = (2.0 * texture(normalMap, vUv) - vec3(1.0)).xyz;
+ vec3 lightVec = (2.0 * textureCube(normalCubeMap, vLightDir) - vec3(1.0)).xyz;
+ vec3 spotColor =
+ texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z).xyz; // CHECK
+ outColor.xyz = diffuse * dot(lightVec, bumpVec) * vLightColor.xyz * spotColor;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.fragment b/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.fragment
new file mode 100644
index 00000000000..b085fda352d
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.fragment
@@ -0,0 +1,36 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE SPECULAR LIGHTING FRAGMENT PROGRAM ////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vHalfVec;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform samplerCube normalCubeMap = 2;
+uniform sampler1D falloffMap = 3;
+
+void main()
+{
+ float attenuation = texture1D(falloffMap, dot(vLightDir,vLightDir)).x;
+
+ vLightDir = normalize(vLightDir);//(2*textureCube(normalCubeMap,vLightDir)-1).xyz;
+ vHalfVec = normalize(vHalfVec);//(2*textureCube(normalCubeMap,vHalfVec)-1).xyz;
+
+ float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
+ specular = pow(specular, 16.0) * vLightColor.w;
+
+ outColor.xyz = specular + texture(diffuseMap, vUv).xyz * vLightColor.xyz * dot(normalize(vLightDir), vec3(0,0,1));
+ outColor.xyz = outColor.xyz * attenuation;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.vertex b/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.vertex
new file mode 100644
index 00000000000..5a523a39dcc
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.vertex
@@ -0,0 +1,53 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE SPECULAR LIGHTING VERTEX PROGRAM //////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 uv;
+in vec4 tangent;
+
+out vec4 vPos;
+out vec4 vLightColor;
+out vec3 vUv;
+out vec3 vLighDir;
+out vec3 vHalfVec;
+
+uniform mat4 worldViewProj;
+uniform vec3 EyePos;
+uniform vec3 LightPos;
+uniform vec4 LightColor;
+uniform vec3 LightDirMul;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ vUv = uv;
+
+ vec3 lightDir = LightPos - position.xyz;
+ vLighDir = lightDir * LightDirMul;
+
+ //Calculate rotation for light to get it to tangent space.
+ vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
+ mat3 rotation = mat3(tangent.xyz, binormal, normal);
+
+ //Transform the lightdir
+ vLighDir = (rotation * vLighDir);
+
+ //Get the halfvector for the specular term
+ vHalfVec = normalize(EyePos - position.xyz);
+ //vHalfVec = normalize( normalize(EyePos) + normalize(lightDir));
+ //transform to tangent space
+ vHalfVec = (rotation * vHalfVec);
+ vHalfVec = normalize(vLighDir)+vHalfVec;//normalize(vHalfVec + normalize(vLighDir));
+
+ vLightColor = LightColor;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.fragment
new file mode 100644
index 00000000000..09503d56a00
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.fragment
@@ -0,0 +1,43 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE SPECULAR SPOTLIGHTING FRAGMENT PROGRAM /////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vHalfVec;
+in vec3 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform samplerCube normalCubeMap = 2;
+uniform sampler1D falloffMap = 3;
+uniform sampler2D spotlightMap = 4;
+uniform sampler1D spotNegRejectMap = 5;
+
+void main()
+{
+ vec3 diffuse = texture(diffuseMap, vUv).xyz;
+
+ vec3 lightNormal = normalize(vLightDir);//(2*textureCube(normalCubeMap,vLightDir)-1).xyz;
+ vHalfVec = normalize(vHalfVec);//(2*textureCube(normalCubeMap,vHalfVec)-1).xyz;
+
+ float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
+ vec4 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z);
+ float rejectNeg = texture1D(spotNegRejectMap,vSpotlightUv.z + 0.5).x;
+
+ float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
+ specular = pow(specular, 16.0) * vLightColor.w * spotColor.w;
+
+ outColor.xyz = specular + diffuse * dot(lightNormal, vec3(0,0,1)) * vLightColor.xyz * spotColor.xyz;
+ outColor.xyz *= attenuation * rejectNeg;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.vertex b/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.vertex
new file mode 100644
index 00000000000..1fbc4eaf236
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.vertex
@@ -0,0 +1,57 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE SPECUALR SPOT LIGHTING VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 uv;
+in vec4 tangent;
+
+out vec4 vPos;
+out vec4 vLightColor;
+out vec3 vUv;
+out vec3 vLighDir;
+out vec3 vHalfVec;
+out vec4 vSpotlightUv;
+
+uniform mat4 worldViewProj;
+uniform mat4 spotViewProj;
+
+uniform vec3 EyePos;
+uniform vec3 LightPos;
+uniform vec4 LightColor;
+uniform vec3 LightDirMul;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ vUv = uv;
+
+ vSpotlightUv = (spotViewProj * position);
+
+ vec3 lightDir = LightPos - position.xyz;
+ vLighDir = lightDir * LightDirMul;
+
+ //Calculate rotation for light to get it to tangent space.
+ vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
+ mat3 rotation = mat3(tangent.xyz, binormal, normal);
+
+ //Transform the lightdir
+ vLighDir = (rotation * vLighDir);
+
+ //Get the halfvector for the specular term
+ vHalfVec = normalize(EyePos - position.xyz);
+ //transform to tangent space
+ vHalfVec = (rotation * vHalfVec);
+ vHalfVec = normalize(vLighDir)+vHalfVec;
+
+ vLightColor = LightColor;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot_pass2.fragment
new file mode 100644
index 00000000000..ead14f6b5f6
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot_pass2.fragment
@@ -0,0 +1,38 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE SPECULAR SPOTLIGHTING FRAGMENT PROGRAM /////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vHalfVec;
+in vec3 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform samplerCube normalCubeMap = 2;
+uniform sampler2D spotlightMap = 3;
+
+void main()
+{
+ vec3 diffuse = texture(diffuseMap, vUv).xyz;
+
+ vec3 lightNormal = (2.0*textureCube(normalCubeMap,vLightDir)-vec3(1.0)).xyz;
+ vHalfVec = (2.0*textureCube(normalCubeMap,vHalfVec)-vec3(1.0)).xyz;
+
+ vec4 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z);
+
+ float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
+ specular = pow(specular, 16.0) * vLightColor.w * spotColor.w;
+
+ outColor.xyz = specular + diffuse * dot(lightNormal, vec3(0,0,1)) * vLightColor.xyz * spotColor.xyz;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.fragment b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.fragment
new file mode 100644
index 00000000000..5d267c71c42
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.fragment
@@ -0,0 +1,23 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SIMPLE DIFFUSE COLOR FRAGMENT PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vColor;
+in vec2 vUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+
+void main()
+{
+ outColor = texture(diffuseMap, vUv) * vColor;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.vertex b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.vertex
new file mode 100644
index 00000000000..8790f5cb89e
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.vertex
@@ -0,0 +1,27 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec4 color;
+in vec2 uv;
+
+out vec4 vPos;
+out vec4 vColor;
+out vec2 vUv;
+
+uniform mat4 worldViewProj;
+
+void main()
+{
+ vPos = worldViewProj * position;
+ vColor = color;
+ vUv = uv;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_ColorMul.vertex b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_ColorMul.vertex
new file mode 100644
index 00000000000..50b1fd4dca6
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_ColorMul.vertex
@@ -0,0 +1,30 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE COLOR MUL VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 color;
+in vec3 uv;
+
+out vec4 vPos;
+out vec3 vColor;
+out vec3 vUv;
+
+uniform mat4 worldViewProj
+uniform vec4 colorMul;
+
+void main()
+{
+ vPos = worldViewProj * position;
+
+ vColor = color * colorMul;
+
+ vUv = uv;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_EnvMap_Reflect.vertex b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_EnvMap_Reflect.vertex
new file mode 100644
index 00000000000..dbbabe363a9
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_EnvMap_Reflect.vertex
@@ -0,0 +1,40 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 color;
+in vec3 uv;
+
+out vec4 vPos;
+out vec3 vColor;
+out vec3 vUv;
+out vec3 vUv2;
+
+uniform mat4 worldViewProj;
+uniform mat4 objectWorldMatrix;
+uniform vec3 eyeWorldPos;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ vColor = color;
+
+ mat3 rotation = mat3(objectWorldMatrix);
+
+ vec3 worldPos = (objectWorldMatrix * position).xyz;
+ vec3 worldNormal = (rotation * normal);
+ vec3 eyeDir = worldPos - eyeWorldPos;
+
+ vUv = uv;
+ vUv2 = reflect(eyeDir, worldNormal);
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.fragment b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.fragment
new file mode 100644
index 00000000000..a2fae530110
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.fragment
@@ -0,0 +1,31 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
+///////////////////////////////////////////////////////
+
+vec4 vPos; //in projection space
+vec4 vLightColor;
+vec2 vUv;
+vec3 vLightDir;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform samplerCube normalCubeMap = 2;
+uniform sampler1D falloffMap = 3;
+
+void main()
+{
+ float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
+
+ vLightDir = (2.0*textureCube(normalCubeMap,vLightDir)-vec3(1.0)).xyz;
+
+ outColor.xyz = attenuation * texture(diffuseMap, vUv).xyz * vLightColor.xyz * dot(vLightDir, vec3(0,0,1));
+ outColor.w = 0.0;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.vertex b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.vertex
new file mode 100644
index 00000000000..b789bbfb347
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.vertex
@@ -0,0 +1,44 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 uv;
+in vec4 tangent;
+
+out vec4 vPos;
+out vec4 vLightColor;
+out vec3 vUv;
+out vec3 vLighDir;
+
+uniform mat4 worldViewProj;
+uniform vec3 LightPos;
+uniform vec4 LightColor;
+uniform vec3 LightDirMul;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ vUv = uv;
+
+ vec3 lightDir = LightPos - position.xyz;
+ vLighDir = lightDir * LightDirMul;
+
+ //Calculate rotation for light to get it to tangent space.
+ vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
+ mat3 rotation = mat3(tangent.xyz, binormal, normal);
+
+ //Transform the lightdir
+ vLighDir = (rotation * vLighDir);
+
+ vLightColor = LightColor;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.fragment b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.fragment
new file mode 100644
index 00000000000..d1ce26c5255
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.fragment
@@ -0,0 +1,36 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE SPOT LIGHTING FRAGMENT PROGRAM /////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform samplerCube normalCubeMap = 2;
+uniform sampler1D falloffMap = 3;
+uniform sampler2D spotlightMap = 4;
+uniform sampler1D spotNegRejectMap = 5;
+
+void main()
+{
+ vec3 diffuse = texture(diffuseMap, vUv).xyz;
+ vec3 lightNormal = (2.0*textureCube(normalCubeMap,vLightDir)-vec3(1.0)).xyz;
+ float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
+ vec3 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z).xyz;
+ float rejectNeg = texture1D(spotNegRejectMap,vSpotlightUv.z + 0.5).x;
+
+ outColor.xyz = diffuse * dot(lightNormal, vec3(0,0,1)) * attenuation *
+ vLightColor.xyz * spotColor * rejectNeg;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.vertex b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.vertex
new file mode 100644
index 00000000000..c100e62ca8c
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.vertex
@@ -0,0 +1,48 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE SPOT LIGHTING VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 uv;
+in vec4 tangent;
+
+out vec4 vPos;
+out vec4 vLightColor;
+out vec3 vUv;
+out vec3 vLighDir;
+out vec4 vSpotlightUv;
+
+uniform mat4 worldViewProj;
+uniform mat4 spotViewProj;
+uniform vec3 LightPos;
+uniform vec4 LightColor;
+uniform vec3 LightDirMul;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ vUv = uv;
+
+ vSpotlightUv = (spotViewProj * position);
+
+ vec3 lightDir = LightPos - position.xyz;
+ vLighDir = lightDir * LightDirMul;
+
+ //Calculate rotation for light to get it to tangent space.
+ vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
+ mat3 rotation = mat3(tangent.xyz, binormal, normal);
+
+ //Transform the lightdir
+ vLighDir = (rotation * vLighDir);
+
+ vLightColor = LightColor;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass1.fragment b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass1.fragment
new file mode 100644
index 00000000000..0a02994ad44
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass1.fragment
@@ -0,0 +1,30 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE SPOT LIGHTING FRAGMENT PROGRAM /////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler1D falloffMap = 0;
+uniform sampler1D spotNegRejectMap = 1;
+
+void main()
+{
+ float attenuation = texture1D(falloffMap, dot(vLightDir,vLightDir)).x;
+ float rejectNeg = texture1D(spotNegRejectMap, vSpotlightUv.z + 0.5).x;
+
+ outColor.w = attenuation * rejectNeg;
+ outColor.xyz = vec3(0.0);
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass2.fragment
new file mode 100644
index 00000000000..e76f95a963d
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass2.fragment
@@ -0,0 +1,31 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE SPOT LIGHTING FRAGMENT PROGRAM /////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform samplerCube normalCubeMap = 2;
+uniform sampler2D spotlightMap = 3;
+
+void main()
+{
+ vec3 diffuse = texture(diffuseMap, vUv).xyz;
+ vec3 lightNormal = (2.0*textureCube(normalCubeMap,vLightDir)-vec3(1.0)).xyz;
+ vec3 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z).xyz;
+
+ outColor.xyz = diffuse * dot(lightNormal, vec3(0,0,1)) * vLightColor.xyz * spotColor;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_Spot_p2.vertex b/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
new file mode 100644
index 00000000000..77fb14bbbb6
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
@@ -0,0 +1,38 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 uv;
+in vec4 tangent;
+
+out vec4 vPos;
+out vec4 vLightColor;
+out vec3 vUv;
+out vec4 vSpotlightUv;
+out float vRejectUv;
+
+uniform mat4 worldViewProj;
+uniform mat4 spotViewProj;
+uniform vec3 LightPos;
+uniform vec4 LightColor;
+uniform vec3 LightDirMul;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ vUv = uv;
+ vSpotlightUv = (spotViewProj * position);
+ vRejectUv.x = vSpotlightUv.z + 0.5;
+
+ vLightColor = LightColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p1.vertex
new file mode 100644
index 00000000000..8139390b076
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p1.vertex
@@ -0,0 +1,46 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 uv;
+in vec4 tangent;
+
+out vec4 vPos;
+out vec4 vColor
+out vec3 vLighDir;
+out vec3 vUv;
+out vec3 vLightPos;
+
+uniform mat4 worldViewProj;
+uniform vec3 LightPos;
+uniform vec4 LightColor;
+uniform vec3 LightDirMul;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ vUv = uv;
+
+ vec3 lightDir = LightPos - position.xyz;
+ vLighDir = lightDir * LightDirMul;
+ vLightPos = vLighDir *0.5 + 0.5;
+
+ //Calculate rotation for light to get it to tangent space.
+ vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
+ mat3 rotation = mat3(tangent.xyz, binormal, normal);
+
+ //Transform the lightdir
+ vLighDir = (rotation * vLighDir);
+
+ outColor = vec3(1.0);
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p2.vertex b/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p2.vertex
new file mode 100644
index 00000000000..66366bf419f
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p2.vertex
@@ -0,0 +1,33 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 uv;
+in vec4 tangent;
+
+out vec4 vPos;
+out vec4 vLightColor;
+out vec3 vUv;
+
+uniform mat4 worldViewProj;
+uniform vec3 LightPos;
+uniform vec4 LightColor;
+uniform vec3 LightDirMul;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ vUv = uv;
+
+ vLightColor = LightColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p2.vertex b/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
new file mode 100644
index 00000000000..9cfc58e5ac7
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
@@ -0,0 +1,36 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 uv;
+in vec4 tangent;
+
+out vec4 vPos;
+out vec4 vLightColor;
+out float vRejectUv;
+
+uniform mat4 worldViewProj;
+uniform mat4 spotViewProj;
+uniform vec3 LightPos;
+uniform vec4 LightColor;
+uniform vec3 LightDirMul;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ //vUv = uv;
+ vec4 spotlightUv = (spotViewProj * position);
+ vRejectUv.x = spotlightUv.z + 0.5;
+
+ vLightColor = LightColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p3.vertex b/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
new file mode 100644
index 00000000000..58cb8eeba7a
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
@@ -0,0 +1,36 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 uv;
+in vec4 tangent;
+
+out vec4 vPos;
+out vec4 vLightColor;
+out vec3 vUv;
+out vec4 vSpotlightUv;
+
+uniform mat4 worldViewProj;
+uniform mat4 spotViewProj;
+uniform vec3 LightPos;
+uniform vec4 LightColor;
+uniform vec3 LightDirMul;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ vUv = uv;
+ vSpotlightUv = (spotViewProj * position);
+
+ vLightColor = LightColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p1.vertex
new file mode 100644
index 00000000000..5b00b4008a6
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p1.vertex
@@ -0,0 +1,42 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec4 tangent;
+
+out vec4 vPos;
+out vec4 vColor
+out vec3 vLighDir;
+out vec3 vLightPos;
+
+uniform mat4 worldViewProj;
+uniform vec3 LightPos;
+uniform vec4 LightColor;
+uniform vec3 LightDirMul;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ vec3 lightDir = LightPos - position.xyz;
+ vLighDir = lightDir * LightDirMul;
+ vLightPos = vLighDir *0.5 + 0.5;
+
+ //Calculate rotation for light to get it to tangent space.
+ vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
+ mat3 rotation = mat3(tangent.xyz, binormal, normal);
+
+ //Transform the lightdir
+ vLighDir = (rotation * vLighDir);
+
+ vColor = 1;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p2.vertex b/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p2.vertex
new file mode 100644
index 00000000000..66366bf419f
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p2.vertex
@@ -0,0 +1,33 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 uv;
+in vec4 tangent;
+
+out vec4 vPos;
+out vec4 vLightColor;
+out vec3 vUv;
+
+uniform mat4 worldViewProj;
+uniform vec3 LightPos;
+uniform vec4 LightColor;
+uniform vec3 LightDirMul;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ vUv = uv;
+
+ vLightColor = LightColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.fragment b/engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.fragment
new file mode 100644
index 00000000000..1c9f5cc47ee
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.fragment
@@ -0,0 +1,23 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SOLID FOG FRAGMENT PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vColor;
+in float vUv;
+
+OUTPUT
+
+uniform sampler1D diffuseMap = 0;
+
+void main()
+{
+ outColor = texture1D(diffuseMap, uv) * vColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.vertex b/engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.vertex
new file mode 100644
index 00000000000..ba4c04c29ee
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.vertex
@@ -0,0 +1,36 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 color;
+
+out vec4 vPos;
+out vec4 vColor;
+out float vUv;
+
+uniform mat4 worldViewProj;
+uniform vec3 fogColor;
+uniform float fogStart;
+uniform float fogEnd;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ /*vUv.x =0;
+ outColor.xyz = (fogEnd - vPos.z)/(fogEnd - fogStart);*/
+ vUv = (fogEnd - vPos.z)/(fogEnd - fogStart);
+ outColor.xyz = fogColor;
+ outColor.w = 1;
+ /*outColor = 1;
+ vUv = uv;
+ //vUv = (fogEnd - vPos.z)/(fogEnd - fogStart);*/
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans.vertex b/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans.vertex
new file mode 100644
index 00000000000..d81b390f3a6
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans.vertex
@@ -0,0 +1,32 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec4 color;
+in vec3 uv;
+
+out vec4 vPos;
+out vec4 vColor
+out vec3 vUv;
+out float vFogUv;
+
+uniform mat4 worldViewProj;
+uniform float fogStart;
+uniform float fogEnd;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ vUv = uv;
+ vFogUv = (fogEnd - vPos.z)/(fogEnd - fogStart);
+ vColor = color;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Alpha.fragment b/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Alpha.fragment
new file mode 100644
index 00000000000..2f4942546b9
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Alpha.fragment
@@ -0,0 +1,25 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vColor;
+in vec2 vUv;
+in float vFogUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform sampler1D fogMap = 1;
+
+void main()
+{
+ outColor = texture(diffuseMap, vUv) * texture1D(fogMap, vFogUv) * vColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Mod.fragment b/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Mod.fragment
new file mode 100644
index 00000000000..959f85c69f6
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Mod.fragment
@@ -0,0 +1,28 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vColor;
+in vec2 vUv;
+in float vFogUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform sampler1D fogMap = 1;
+
+void main()
+{
+ vec4 diffuse = texture(diffuseMap, vUv);
+ float alpha = texture1D(fogMap, vFogUv).w;
+ outColor.xyz = diffuse.xyz * alpha + vec3(1.0 - alpha);
+ outColor.w = diffuse.w;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_ModX2.fragment b/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_ModX2.fragment
new file mode 100644
index 00000000000..6458ded6a93
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_ModX2.fragment
@@ -0,0 +1,28 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vColor;
+in vec2 vUv;
+in float vFogUv;
+
+OUTPUT
+
+uniform sampler2D diffuseMap = 0;
+uniform sampler1D fogMap = 1;
+
+void main()
+{
+ vec4 diffuse = texture(diffuseMap, vUv);
+ float alpha = texture1D(fogMap, vFogUv).w;
+ outColor.xyz = diffuse.xyz * alpha + vec3(0.5,0.5,0.5)*(1 - alpha);
+ outColor.w = diffuse.w;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.fragment b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.fragment
new file mode 100644
index 00000000000..b197ce1402e
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.fragment
@@ -0,0 +1,29 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// BLOOOM FRAGMENT PROGRAM /////////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vColor;
+in vec2 vUv0;
+in vec2 vUv1;
+
+OUTPUT
+
+uniform sampler2D blurTex = 0;
+uniform sampler2DRect screenTex = 1;
+
+void main()
+{
+ vec4 blurCol = texture(blurTex, vUv0);
+ vec4 screenCol = texture2DRect(screenTex, vUv1);
+
+ blurCol *= blurCol;
+ outColor.xyz = blurCol.xyz * dot(blurCol.xyz,vec3(0.3, 0.58, 0.12)) + screenCol.xyz;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.vertex b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.vertex
new file mode 100644
index 00000000000..85330a746bf
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.vertex
@@ -0,0 +1,31 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// BLOOM VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 color;
+in vec2 uv0;
+in vec2 uv1;
+
+out vec4 vPos;
+out vec3 vColor;
+out vec2 vUv0;
+out vec2 vUv1;
+
+uniform mat4 worldViewProj;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+ vColor = color;
+
+ vUv0 = uv0;
+ vUv1 = uv1;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur.vertex b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur.vertex
new file mode 100644
index 00000000000..60922f9d886
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur.vertex
@@ -0,0 +1,37 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 color;
+in vec2 uv;
+
+out vec4 vPos;
+out vec3 vColor;
+out vec2 vUv0;
+out vec2 vUv1;
+out vec2 vUv2;
+out vec2 vUv3;
+
+uniform mat4 worldViewProj;
+uniform float yOffset;
+uniform float xOffset;
+uniform float amount;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+ vColor = color;
+
+ vUv0 = uv + vec2(xOffset, yOffset) * amount;
+ vUv1 = uv + vec2(xOffset, yOffset) * 2.0 * amount;
+ vUv2 = uv - vec2(xOffset, yOffset) * amount;
+ vUv3 = uv - vec2(xOffset, yOffset) * 2.0 * amount;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_2D.fragment b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_2D.fragment
new file mode 100644
index 00000000000..f75af26bc99
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_2D.fragment
@@ -0,0 +1,38 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vColor;
+in vec2 vUv0;
+in vec2 vUv1;
+in vec2 vUv2;
+in vec2 vUv3;
+
+OUTPUT
+
+uniform sampler2D tex = 0;
+
+void main()
+{
+ //Samples
+ vec4 col5 = texture(tex, (vUv0 + vUv2)/2.0 ) * 0.35;
+
+ vec4 col1 = texture(tex, vUv0) * 0.15;
+ vec4 col3 = texture(tex, vUv2) * 0.15;
+
+ vec4 col6 = texture(tex, (vUv2 + vUv3)/2.0 ) * 0.1;
+ vec4 col7 = texture(tex, (vUv0 + vUv1)/2.0 ) * 0.1;
+
+ vec4 col2 = texture(tex, vUv1) * 0.075;
+ vec4 col4 = texture(tex, vUv3) * 0.075;
+
+ outColor = col1 + col2 + col3 + col4 + col5 + col6 + col7;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_Rect.fragment b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_Rect.fragment
new file mode 100644
index 00000000000..9464030d89f
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_Rect.fragment
@@ -0,0 +1,39 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
+///////////////////////////////////////////////////////
+
+vec4 vPos; //in projection space
+vec4 vColor;
+vec2 vUv0;
+vec2 vUv1;
+vec2 vUv2;
+vec2 vUv3;
+
+OUTPUT
+
+uniform sampler2DRect tex = 0;
+
+void main()
+{
+ //Samples
+ vec4 col5 = texture2DRect(tex, (vUv0 + vUv2)/2.0 ) * 0.35;
+
+ vec4 col1 = texture2DRect(tex, vUv0) * 0.15;
+ vec4 col3 = texture2DRect(tex, vUv2) * 0.15;
+
+ vec4 col6 = texture2DRect(tex, (vUv2 + vUv3)/2.0 ) * 0.1;
+ vec4 col7 = texture2DRect(tex, (vUv0 + vUv1)/2.0 ) * 0.1;
+
+ vec4 col2 = texture2DRect(tex, vUv1) * 0.075;
+ vec4 col4 = texture2DRect(tex, vUv3) * 0.075;
+
+
+ outColor = col1 + col2 + col3 + col4 + col5 + col6 + col7;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.fragment b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.fragment
new file mode 100644
index 00000000000..082889f6ab2
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.fragment
@@ -0,0 +1,38 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DEPTH OF FIELD FRAGMENT PROGRAM /////////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in float vDepth;
+
+OUTPUT
+
+uniform sampler2DRect screenMap = 0;
+uniform sampler2D blurMap = 1;
+uniform vec3 planes;
+uniform float maxBlur;
+uniform vec2 screenSize;
+
+void main()
+{
+ float blur =0;
+
+ if(vDepth < planes.y) {
+ blur = (planes.y - vDepth) / (planes.y - planes.x);
+ }
+ else {
+ blur = (vDepth - planes.y) / (planes.z - planes.y);
+ }
+
+ blur = clamp(blur, 0.0, maxBlur);
+
+ outColor = texture2DRect(screenMap,vPos.xy) * (1-blur) + texture(blurMap,vPos.xy/screenSize) *blur;
+ //outColor = 1 - blur;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.vertex b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.vertex
new file mode 100644
index 00000000000..134421655d1
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.vertex
@@ -0,0 +1,25 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+///DEPTH OF FIELD VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+
+out vec4 vPos;
+out float vDepth;
+
+uniform mat4 worldViewProj;
+
+void main()
+{
+ //Get the positions in window space.
+ vPos = (worldViewProj * position);
+ vDepth = vPos.z;
+
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_2D.fragment b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_2D.fragment
new file mode 100644
index 00000000000..9113ca050d4
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_2D.fragment
@@ -0,0 +1,34 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vColor;
+in vec2 vUv0;
+in vec2 vUv1;
+in vec2 vUv2;
+in vec2 vUv3;
+
+OUTPUT
+
+uniform sampler2D texture0 = 0;
+uniform sampler2D texture1 = 1;
+uniform sampler2D texture2 = 2;
+
+void main()
+{
+ //Samples
+ vec4 col1 = texture(texture0, (vUv0 + vUv1)/2) * 0.3;
+ vec4 col3 = texture(texture1, (vUv2 + vUv3)/2) * 0.3;
+
+ vec4 col2 = texture(texture2, (vUv0 + vUv2)/2 ) * 0.4;
+
+ outColor = col1 + col2 + col3;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_Rect.fragment b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_Rect.fragment
new file mode 100644
index 00000000000..51140a3a5d2
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_Rect.fragment
@@ -0,0 +1,34 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 color;
+in vec2 vUv0;
+in vec2 vUv1;
+in vec2 vUv2;
+in vec2 vUv3;
+
+OUTPUT
+
+uniform sampler2DRect texture0 = 0;
+uniform sampler2DRect texture1 = 1;
+uniform sampler2DRect texture2 = 2;
+
+void main()
+{
+ //Samples
+ vec4 col1 = texture2DRect(texture0, (vUv0 + vUv1)/2.0) * 0.3;
+ vec4 col3 = texture2DRect(texture1, (vUv2 + vUv3)/2.0) * 0.3;
+
+ vec4 col2 = texture2DRect(texture2, (vUv0 + vUv2)/2.0) * 0.4;
+
+ outColor = col1 + col2 + col3;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.fragment b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.fragment
new file mode 100644
index 00000000000..f5eef9ad88d
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.fragment
@@ -0,0 +1,49 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+// MOTION BLUR FRAGMENT PROGRAM
+// Credits to jonathan for optimization
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vVtxPos;
+in vec4 vPrevVtxPos;
+
+OUTPUT
+
+uniform sampler2DRect screenTex = 0;
+uniform vec2 halfScreenSize;
+
+void main()
+{
+ vec2 wpos = vPos.xy;
+ vec2 p1 = vVtxPos.xy / vVtxPos.w;
+ vec2 p2 = vPrevVtxPos.xy / vPrevVtxPos.w;
+
+ vec2 velocity = (p2 - p1) * halfScreenSize;
+
+ //Sample into scene texture along motion vector
+ const float samples = min( max( 1.0, ceil( max( abs( velocity.x ), abs( velocity.y ) ) / 2.0 ) ), 16.0 );
+ const float w = 1.0 / samples; // weight
+ const vec2 s = velocity / samples; // step
+ vec4 a = vec4(0.0);
+
+ for(float i=0.0; i<samples; i+=1.0)
+ {
+ a += texture2DRect(screenTex, wpos) * w;
+ wpos += s;
+ }
+
+ outColor = a;
+ //outColor.xy = 0.5 + velocity *0.005;
+ //outColor.z = 1;
+
+ //outColor.xyz = (1 + velocity) *0.5;
+
+ //outColor = texture2DRect(screenTex, wpos + velocity);
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.vertex b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.vertex
new file mode 100644
index 00000000000..f4a77d28762
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.vertex
@@ -0,0 +1,67 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 normal;
+in vec3 color;
+
+out vec4 vPos;
+out vec3 vColor;
+//out float oVelocity :TEX0
+out vec4 vVtxPos;
+out vec4 vPrevVtxPos;
+
+uniform mat4 modelView;
+uniform mat4 prevModelView;
+uniform mat4 worldViewProj;
+uniform mat4 prevWorldViewProj;
+uniform float blurScale;
+
+void main()
+{
+ //Get the positions in eye space
+ vec4 pos = (modelView * position);
+ vec4 prevPos = (prevModelView * position);
+
+ //Transform normal to eye space
+ vec3 eyeNormal = mat3(modelView) * normal;
+
+ // calculate eye space motion vector
+ vec3 motionVector = pos.xyz - prevPos.xyz;
+
+ //Get the positions in window space.
+ pos = (worldViewProj * position);
+ prevPos = (prevWorldViewProj * position);
+
+ //Interpolate the previous according to blurscale
+ prevPos = mix(pos, prevPos, blurScale);
+
+ //Choose previous or current position based on dot product between motion vector and normal
+ //float flag = dot(motionVector, eyeNormal) > 0;
+ //vec4 Pstretch = flag ? pos : prevPos;
+ //vPos = Pstretch;
+ vPos = pos;
+
+ //Divide by W -> NDC coordinates
+ //pos.xyz = pos.xyz / pos.w;
+ //prevPos.xyz = prevPos.xyz / prevPos.w;
+ //Calculate window space velocity
+ //vec3 windowVel = (prevPos.xyz - pos.xyz);// * vec3(400,300,1);
+ //oVelocity = windowVel * blurScale;
+
+ vVtxPos = pos;
+ vPrevVtxPos = prevPos;
+
+ //vColor.xy = 0.5 + (windowVel.xy * 0.005);
+ //vColor.z = 1;
+ //vColor = (1 + eyeNormal)*0.5;
+ vColor = vec3(0.5);
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion_staticloop.fragment b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion_staticloop.fragment
new file mode 100644
index 00000000000..ce9bb13ff59
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion_staticloop.fragment
@@ -0,0 +1,43 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+// MOTION BLUR FRAGMENT PROGRAM WITH STATIC LOOP
+// Credits to jonathan for optimization
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec4 vVtxPos;
+in vec4 vPrevVtxPos;
+
+OUTPUT
+
+uniform sampler2DRect screenTex = 0;
+uniform vec2 halfScreenSize;
+
+void main()
+{
+ vec2 wpos = vPos.xy;
+ vec2 p1 = vVtxPos.xy / vVtxPos.w;
+ vec2 p2 = vPrevVtxPos.xy / vPrevVtxPos.w;
+
+ vec2 velocity = (p2 - p1) * halfScreenSize;
+
+ //Sample into scene texture along motion vector
+ const float samples = 16.0;
+ const fixed w = 1.0 / samples; // weight
+ const vec2 s = velocity / samples; // step
+ vec4 a = vec4(0.0);
+
+ for(float i=0.0; i<samples; i+=1.0)
+ {
+ a += texture2DRect(screenTex, wpos) * w;
+ wpos += s;
+ }
+
+ outColor = a;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.fragment b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.fragment
new file mode 100644
index 00000000000..5826a1ecca1
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.fragment
@@ -0,0 +1,24 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SPECULAR BUMPMAPPING 2D FRAGMENT PROGRAM //////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec3 vUv; //in object space
+
+OUTPUT
+
+uniform sampler2D ScreenBuffer = 0;
+
+void main()
+{
+ vec4 Col = texture(ScreenBuffer, vUv);
+
+ outColor = Col;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.vertex b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.vertex
new file mode 100644
index 00000000000..a801c00daa7
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.vertex
@@ -0,0 +1,24 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SPECULAR BUMPMAPPING 2D VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 uv;
+
+out vec4 vPos;
+out vec3 vUv;
+
+uniform mat4 worldViewProj;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+ vUv = uv;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.fragment b/engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.fragment
new file mode 100644
index 00000000000..161c700fe84
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.fragment
@@ -0,0 +1,19 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+
+OUTPUT
+
+void main()
+{
+ outColor = vec4(1.0);
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.vertex b/engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.vertex
new file mode 100644
index 00000000000..f622bde574e
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.vertex
@@ -0,0 +1,24 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+
+out vec4 vPos;
+//out vec3 outColor;
+
+uniform mat4 worldViewProj;
+uniform vec3 lightPosition;
+
+void main()
+{
+ vPos = (worldViewProj * vec4((position.xyz - lightPosition*(1.0-position.w)), position.w));
+ //outColor = vec3(0.1,0,0.1);
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Water_Diffuse.vertex b/engines/hpl1/engine/impl/glsl_shaders/Water_Diffuse.vertex
new file mode 100644
index 00000000000..319aabe58f0
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Water_Diffuse.vertex
@@ -0,0 +1,36 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// WATER FOG VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec3 color;
+in vec3 uv;
+
+out vec4 vPos;
+out vec3 vColor;
+out vec3 vUv;
+
+uniform mat4 worldViewProj;
+uniform float timeCount;
+
+void main()
+{
+ float amp = 0.04;
+ float freq = 15.0;
+ float speed = 3.0;
+
+ vPos = (worldViewProj * position);
+ vPos.y += sin(timeCount*speed + (position.x)*freq)*amp;
+ vPos.y += sin(timeCount*speed + (position.z)*freq)*amp;
+
+ vColor = color;
+
+ vUv = uv;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Water_Fog.vertex b/engines/hpl1/engine/impl/glsl_shaders/Water_Fog.vertex
new file mode 100644
index 00000000000..5f4a6f971ad
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/Water_Fog.vertex
@@ -0,0 +1,40 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// WATER FOG VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec4 color;
+in vec3 uv;
+
+out vec4 vPos;
+out vec4 vColor
+out vec3 vUv;
+out float vFogUv;
+
+uniform mat4 worldViewProj;
+uniform float fogStart;
+uniform float fogEnd;
+uniform float timeCount;
+
+void main()
+{
+ float amp = 0.04;
+ float freq = 15.0;
+ float speed = 3.0;
+
+ vPos = (worldViewProj * position);
+ vPos.y += sin(timeCount*speed + (position.x)*freq)*amp;
+ vPos.y += sin(timeCount*speed + (position.z)*freq)*amp;
+
+ vUv = uv;
+ vFogUv = (fogEnd - vPos.z)/(fogEnd - fogStart);
+
+ vColor = color;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/refract.fragment b/engines/hpl1/engine/impl/glsl_shaders/refract.fragment
new file mode 100644
index 00000000000..bb28df141f4
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/refract.fragment
@@ -0,0 +1,29 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// REFRACTION FRAGMENT PROGRAM /////////////////
+///////////////////////////////////////////////////////
+
+in vec4 inPos; //in projection space
+in vec2 uv; //in object space
+in vec4 color;
+
+OUTPUT
+
+uniform sampler2DRect screenMap = 0;
+uniform sampler2D refractMap = 1;
+
+uniform vec2 screenSize;
+uniform float scale
+
+void main()
+{
+ vec3 offset = ((texture(refractMap, uv)*2.0) - vec3(1.0)) * color.w;
+
+ outColor = texture2DRect(screenMap,inPos.xy - (offset.xy*scale) / inPos.z);
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/refract.vertex b/engines/hpl1/engine/impl/glsl_shaders/refract.vertex
new file mode 100644
index 00000000000..427adb12823
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/refract.vertex
@@ -0,0 +1,29 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// REFRACTION VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec4 color;
+in vec2 uv;
+
+out vec4 vPos;
+out vec4 vColor
+out vec2 vUv;
+
+uniform mat4 worldViewProj;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ outColor = color;
+
+ vUv = uv;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/refract_special.fragment b/engines/hpl1/engine/impl/glsl_shaders/refract_special.fragment
new file mode 100644
index 00000000000..bbe2d32079a
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/refract_special.fragment
@@ -0,0 +1,35 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// REFRACTION SPECIAL FRAGMENT PROGRAM /////////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec2 vUv; //in object space
+in vec4 vColor;
+
+OUTPUT
+
+uniform sampler2DRect screenMap = 0;
+uniform sampler2D refractMap = 1;
+uniform sampler2D alphaMap = 2;
+
+uniform vec2 screenSize;
+uniform float t;
+uniform float scale
+
+void main()
+{
+ float alpha = texture(alphaMap, vUv).x;
+ vec2 uv2 = (vPos.xy / screenSize);
+ uv2.x += sin(t + uv2.y*10) * 0.001 * scale;
+ uv2.y += sin(t + uv2.x*10) * 0.001 * scale;
+ vec3 offset = ((texture(refractMap, uv2)*2.0) - vec3(1.0)) * alpha * vColor.w;
+
+ outColor.xyz = texture2DRect(screenMap,vPos.xy - offset.xy*scale);
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/refract_water.fragment b/engines/hpl1/engine/impl/glsl_shaders/refract_water.fragment
new file mode 100644
index 00000000000..005d75511fd
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/refract_water.fragment
@@ -0,0 +1,59 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// REFRACTION FRAGMENT PROGRAM /////////////////
+///////////////////////////////////////////////////////
+
+in vec4 vPos; //in projection space
+in vec2 vUv; //in object space
+in vec3 vNormal;
+in vec3 vEyePos;
+in vec4 vColor;
+
+OUTPUT
+
+uniform sampler2DRect screenMap = 0;
+uniform sampler2D refractMap = 1;
+uniform sampler2D diffuseMap = 2;
+
+uniform vec2 screenSize;
+uniform float scale;
+uniform float t;
+
+void main()
+{
+ //t *= 1;
+ vec2 uv_offset1 = vUv;
+ uv_offset1.x += sin(t*0.8 + vUv.y*10.0)*0.04;
+ uv_offset1.y += sin(t*0.8 + uv_offset1.x*10.0)*0.04;
+
+ vec3 offset1 = ((texture(refractMap, uv_offset1)*2.0) - vec3(1.0));
+
+ vec2 uv_offset2 = vUv;
+ uv_offset2.x += sin(t*-2.6 + vUv.y*12.0)*0.03;
+ uv_offset2.y += sin(t*-2.6 + uv_offset2.x*12.0)*0.03;
+
+ vec3 offset2 = ((texture(refractMap, uv_offset2)*2.0) - vec3(1.0));
+ offset2.xy = -offset2.xy;
+
+ vec3 offset = normalize(offset1*0.7 + offset2*0.3);
+
+ //float fresnel = saturate(dot(normalize(vEyePos), normalize(vNormal)));
+ //fresnel = (fresnel + 0.2)*0.8;
+
+ vec3 waterColor = texture(diffuseMap, uv_offset1).xyz;
+
+ vec4 screenColor = texture2DRect(screenMap,vPos.xy + offset.xy * -scale);
+ if(screenColor.w < 0.5) screenColor = texture2DRect(screenMap,vPos.xy);
+
+ outColor.xyz = screenColor.xyz * waterColor;
+
+ //outColor.y = uv.y+1 + uv_offset1.y;
+ outColor.xyz *= clamp(dot(vec3(1.0/3.0, 1.0/3.0, 1.0/3.0), offset), 0.0, 1.0)*0.5 + 0.5;
+ outColor.xyz += pow(clamp(dot(vec3(1.0/3.0, 1.0/3.0, 1.0/3.0), offset), 0.0, 1.0), 8.0)*5.0;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/refract_water.vertex b/engines/hpl1/engine/impl/glsl_shaders/refract_water.vertex
new file mode 100644
index 00000000000..16ac7ed7560
--- /dev/null
+++ b/engines/hpl1/engine/impl/glsl_shaders/refract_water.vertex
@@ -0,0 +1,37 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// REFRACTION VERTEX PROGRAM ////////////
+///////////////////////////////////////////////////////
+
+in vec4 position;
+in vec4 color;
+in vec2 uv;
+in vec3 normal;
+
+out vec4 vPos;
+out vec4 vColor
+out vec2 vUv;
+out vec3 vNormal;
+out vec3 vEyePos;
+
+uniform vec3 EyePos;
+uniform mat4 worldViewProj;
+
+void main()
+{
+ vPos = (worldViewProj * position);
+
+ outColor = color;
+
+ vUv = uv;
+
+ vNormal = normal;
+
+ vEyePos = normalize(EyePos - position.xyz);
+}
\ No newline at end of file
Commit: 6ae37f24c7dc1b1eec7ecf97e827ec99f2d1ba77
https://github.com/scummvm/scummvm/commit/6ae37f24c7dc1b1eec7ecf97e827ec99f2d1ba77
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:40+01:00
Commit Message:
HPL1: fix null pointer dereference
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgTree.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgTree.cpp b/engines/hpl1/engine/libraries/newton/core/dgTree.cpp
index c1bda704a81..9420789d20a 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgTree.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgTree.cpp
@@ -396,7 +396,7 @@ void dgRedBackNode::Unlink(dgRedBackNode ** const head)
*head = child;
}
- if (endNode->GetColor() == BLACK)
+ if (endNode->GetColor() == BLACK && endNode->m_parent)
{
endNode->m_parent->RemoveFixup(child, head);
}
Commit: 561971270709d40b9c55deddf490c21be91d0069
https://github.com/scummvm/scummvm/commit/561971270709d40b9c55deddf490c21be91d0069
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:40+01:00
Commit Message:
HPL1: add renderer debug channel
Changed paths:
engines/hpl1/debug.h
diff --git a/engines/hpl1/debug.h b/engines/hpl1/debug.h
index 29fb67452f3..4011871489b 100644
--- a/engines/hpl1/debug.h
+++ b/engines/hpl1/debug.h
@@ -30,7 +30,8 @@ enum DebugChannels {
kDebugGraphics = 1 << 0,
kDebugResourceLoading = 1 << 1,
kDebugFilePath = 1 << 2,
- kDebugOpenGL = 1 << 3
+ kDebugOpenGL = 1 << 3,
+ kDebugRenderer = 1 << 4
};
enum DebugLevels {
Commit: 30fe64422e832f0d5f0c6118765fd81f39d42f52
https://github.com/scummvm/scummvm/commit/30fe64422e832f0d5f0c6118765fd81f39d42f52
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:40+01:00
Commit Message:
HPL1: replace shader implementation and use
Changed paths:
engines/hpl1/engine/graphics/GPUProgram.h
engines/hpl1/engine/graphics/LowLevelGraphics.h
engines/hpl1/engine/graphics/Material.h
engines/hpl1/engine/graphics/Material_Additive.cpp
engines/hpl1/engine/graphics/Material_Additive.h
engines/hpl1/engine/graphics/Material_Alpha.cpp
engines/hpl1/engine/graphics/Material_Alpha.h
engines/hpl1/engine/graphics/Material_BaseLight.cpp
engines/hpl1/engine/graphics/Material_BaseLight.h
engines/hpl1/engine/graphics/Material_Bump.cpp
engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
engines/hpl1/engine/graphics/Material_BumpSpec.cpp
engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
engines/hpl1/engine/graphics/Material_BumpSpec2D.h
engines/hpl1/engine/graphics/Material_Diffuse.cpp
engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Flat.cpp
engines/hpl1/engine/graphics/Material_Flat.h
engines/hpl1/engine/graphics/Material_Modulative.cpp
engines/hpl1/engine/graphics/Material_Modulative.h
engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
engines/hpl1/engine/graphics/Material_ModulativeX2.h
engines/hpl1/engine/graphics/Material_Water.cpp
engines/hpl1/engine/graphics/Material_Water.h
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/engine/impl/CGProgram.cpp
engines/hpl1/engine/impl/CGProgram.h
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
engines/hpl1/engine/resources/GpuProgramManager.cpp
engines/hpl1/engine/resources/GpuProgramManager.h
engines/hpl1/penumbra-overture/Init.cpp
diff --git a/engines/hpl1/engine/graphics/GPUProgram.h b/engines/hpl1/engine/graphics/GPUProgram.h
index 9f479fa056c..005165d8ea4 100644
--- a/engines/hpl1/engine/graphics/GPUProgram.h
+++ b/engines/hpl1/engine/graphics/GPUProgram.h
@@ -61,21 +61,12 @@ enum eGpuProgramMatrixOp {
class iGpuProgram : public iResourceBase {
public:
- iGpuProgram(tString asName, eGpuProgramType aType) : iResourceBase(asName, 0) {
- mProgramType = aType;
+ iGpuProgram(const tString &asName) : iResourceBase(asName, 0) {
}
virtual ~iGpuProgram() {}
static void SetLogDebugInformation(bool abX) { mbDebugInfo = abX; }
- /**
- * Create a from a file. Used internally
- * \param asFile
- * \param asEntry
- * \return
- */
- virtual bool CreateFromFile(const tString &asFile, const tString &asEntry) = 0;
-
/**
* Bind the program to the GPU
*/
@@ -108,15 +99,7 @@ public:
virtual bool SetMatrixf(const tString &asName, const cMatrixf &mMtx) = 0;
virtual bool SetMatrixf(const tString &asName, eGpuProgramMatrix mType,
eGpuProgramMatrixOp mOp) = 0;
-
- virtual bool SetTexture(const tString &asName, iTexture *apTexture, bool abAutoDisable = true) = 0;
- virtual bool SetTextureToUnit(int alUnit, iTexture *apTexture) = 0;
-
- eGpuProgramType GetType() { return mProgramType; }
-
protected:
- eGpuProgramType mProgramType;
-
static bool mbDebugInfo;
};
}; // namespace hpl
diff --git a/engines/hpl1/engine/graphics/LowLevelGraphics.h b/engines/hpl1/engine/graphics/LowLevelGraphics.h
index e9109684a27..1f13ba52e83 100644
--- a/engines/hpl1/engine/graphics/LowLevelGraphics.h
+++ b/engines/hpl1/engine/graphics/LowLevelGraphics.h
@@ -266,7 +266,7 @@ public:
virtual Graphics::PixelFormat *GetPixelFormat() = 0;
- virtual iGpuProgram *CreateGpuProgram(const tString &asName, eGpuProgramType aType) = 0;
+ virtual iGpuProgram *CreateGpuProgram(const tString &vertex, const tString &fragment) = 0;
// TODO: Kinda quick and diry, better to have a screen to Bitmap.
// and then a save as in the Bitmap.
diff --git a/engines/hpl1/engine/graphics/Material.h b/engines/hpl1/engine/graphics/Material.h
index 38168517abc..d03de340866 100644
--- a/engines/hpl1/engine/graphics/Material.h
+++ b/engines/hpl1/engine/graphics/Material.h
@@ -134,7 +134,7 @@ class iLight3D;
class iGLStateProgram : public iGpuProgram {
public:
iGLStateProgram(tString asName)
- : iGpuProgram(asName, eGpuProgramType_Fragment) {
+ : iGpuProgram(asName) {
mbSetUpDone = false;
}
virtual ~iGLStateProgram() {}
@@ -161,7 +161,7 @@ public:
bool SetTexture(const tString &asName, iTexture *apTexture, bool abAutoDisable = true) { return false; }
bool SetTextureToUnit(int alUnit, iTexture *apTexture) { return false; }
- eGpuProgramType GetType() { return mProgramType; }
+ eGpuProgramType GetType() { return eGpuProgramType_LastEnum; }
bool reload() { return false; }
void unload() {}
@@ -217,6 +217,9 @@ public:
virtual void Update(float afTimeStep) {}
// The new render system stuff
+ virtual iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) { return nullptr; }
+ virtual iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) { return nullptr; };
+
virtual iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) { return NULL; }
virtual bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight) { return false; }
virtual bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight) { return false; }
@@ -330,8 +333,7 @@ public:
void SetId(int alId) { mlId = alId; }
int GetId() { return mlId; }
- virtual iGpuProgram *GetRefractionVertexProgam() { return NULL; }
- virtual iGpuProgram *GetRefractionFragmentProgam() { return NULL; }
+ virtual iGpuProgram *getRefractionProgram() { return nullptr; }
virtual bool GetRefractionUsesDiffuse() { return false; }
virtual eMaterialTexture GetRefractionDiffuseTexture() { return eMaterialTexture_Diffuse; }
diff --git a/engines/hpl1/engine/graphics/Material_Additive.cpp b/engines/hpl1/engine/graphics/Material_Additive.cpp
index 1f44606e186..8dc5fc89d65 100644
--- a/engines/hpl1/engine/graphics/Material_Additive.cpp
+++ b/engines/hpl1/engine/graphics/Material_Additive.cpp
@@ -72,21 +72,13 @@ cMaterial_Additive::cMaterial_Additive(const tString &asName, iLowLevelGraphics
mbIsGlowing = false;
mbUsesLights = false;
- mpFogVtxProg = mpProgramManager->CreateProgram("Fog_Trans_vp.cg", "main", eGpuProgramType_Vertex);
-
- if (mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_FragmentProgram))
- mpFogFragProg = mpProgramManager->CreateProgram("Fog_Trans_Alpha_fp.cg", "main", eGpuProgramType_Fragment);
- else
- mpFogFragProg = NULL;
+ _fogShader = mpProgramManager->CreateProgram("Fog_Trans", "Fog_Trans_Alpha");
}
//-----------------------------------------------------------------------
cMaterial_Additive::~cMaterial_Additive() {
- if (mpFogVtxProg)
- mpProgramManager->Destroy(mpFogVtxProg);
- if (mpFogFragProg)
- mpProgramManager->Destroy(mpFogFragProg);
+ mpProgramManager->Destroy(_fogShader);
}
//-----------------------------------------------------------------------
@@ -97,18 +89,15 @@ cMaterial_Additive::~cMaterial_Additive() {
//-----------------------------------------------------------------------
-iGpuProgram *cMaterial_Additive::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (mpRenderSettings->mbFogActive)
- return mpFogVtxProg;
- else
- return NULL;
+iGpuProgram *cMaterial_Additive::getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
+ return _fogShader;
}
-iMaterialProgramSetup *cMaterial_Additive::GetVertexProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+iMaterialProgramSetup *cMaterial_Additive::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
if (mpRenderSettings->mbFogActive)
return &gFogProgramSetup;
else
- return NULL;
+ return nullptr;
}
bool cMaterial_Additive::VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
@@ -119,13 +108,6 @@ bool cMaterial_Additive::VertexProgramUsesEye(eMaterialRenderType aType, int alP
return false;
}
-iGpuProgram *cMaterial_Additive::GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (mpRenderSettings->mbFogActive)
- return mpFogFragProg;
- else
- return NULL;
-}
-
eMaterialAlphaMode cMaterial_Additive::GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
return eMaterialAlphaMode_Solid;
}
diff --git a/engines/hpl1/engine/graphics/Material_Additive.h b/engines/hpl1/engine/graphics/Material_Additive.h
index 1d76d65ac7e..501adf09db4 100644
--- a/engines/hpl1/engine/graphics/Material_Additive.h
+++ b/engines/hpl1/engine/graphics/Material_Additive.h
@@ -28,6 +28,7 @@
#ifndef HPL_MATERIAL_ADDITIVE_H
#define HPL_MATERIAL_ADDITIVE_H
+#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Material.h"
namespace hpl {
@@ -45,14 +46,12 @@ public:
bool UsesType(eMaterialRenderType aType);
- iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iMaterialProgramSetup *GetVertexProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight);
+ iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+ iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iGpuProgram *GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
-
eMaterialAlphaMode GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialBlendMode GetBlendMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialChannelMode GetChannelMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
@@ -75,8 +74,7 @@ public:
tVertexVec *apVtxVec, cVector3f *apTransform, unsigned int alIndexAdd) {}
private:
- iGpuProgram *mpFogVtxProg;
- iGpuProgram *mpFogFragProg;
+ iGpuProgram *_fogShader;
};
class cMaterialType_Additive : public iMaterialType {
diff --git a/engines/hpl1/engine/graphics/Material_Alpha.cpp b/engines/hpl1/engine/graphics/Material_Alpha.cpp
index cdbfc06f15b..fa61e711314 100644
--- a/engines/hpl1/engine/graphics/Material_Alpha.cpp
+++ b/engines/hpl1/engine/graphics/Material_Alpha.cpp
@@ -34,6 +34,7 @@
#include "hpl1/engine/resources/TextureManager.h"
#include "hpl1/engine/scene/Camera.h"
#include "hpl1/engine/scene/Light.h"
+#include <cstddef>
namespace hpl {
@@ -69,21 +70,13 @@ cMaterial_Alpha::cMaterial_Alpha(const tString &asName, iLowLevelGraphics *apLow
mbIsGlowing = false;
mbUsesLights = false;
- mpFogVtxProg = mpProgramManager->CreateProgram("Fog_Trans_vp.cg", "main", eGpuProgramType_Vertex);
-
- if (mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_FragmentProgram))
- mpFogFragProg = mpProgramManager->CreateProgram("Fog_Trans_Alpha_fp.cg", "main", eGpuProgramType_Fragment);
- else
- mpFogFragProg = NULL;
+ _fogShader = mpProgramManager->CreateProgram("Fog_Trans", "Fog_Trans_Alpha");
}
//-----------------------------------------------------------------------
cMaterial_Alpha::~cMaterial_Alpha() {
- if (mpFogVtxProg)
- mpProgramManager->Destroy(mpFogVtxProg);
- if (mpFogFragProg)
- mpProgramManager->Destroy(mpFogFragProg);
+ mpProgramManager->Destroy(_fogShader);
}
//-----------------------------------------------------------------------
@@ -94,18 +87,16 @@ cMaterial_Alpha::~cMaterial_Alpha() {
//-----------------------------------------------------------------------
-iGpuProgram *cMaterial_Alpha::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+iGpuProgram *cMaterial_Alpha::getGpuProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
if (mpRenderSettings->mbFogActive)
- return mpFogVtxProg;
- else
- return NULL;
+ return _fogShader;
+ return nullptr;
}
-iMaterialProgramSetup *cMaterial_Alpha::GetVertexProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+iMaterialProgramSetup *cMaterial_Alpha::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
if (mpRenderSettings->mbFogActive)
return &gFogProgramSetup;
- else
- return NULL;
+ return nullptr;
}
bool cMaterial_Alpha::VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
@@ -116,13 +107,6 @@ bool cMaterial_Alpha::VertexProgramUsesEye(eMaterialRenderType aType, int alPass
return false;
}
-iGpuProgram *cMaterial_Alpha::GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (mpRenderSettings->mbFogActive)
- return mpFogFragProg;
- else
- return NULL;
-}
-
eMaterialAlphaMode cMaterial_Alpha::GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
return eMaterialAlphaMode_Solid;
}
diff --git a/engines/hpl1/engine/graphics/Material_Alpha.h b/engines/hpl1/engine/graphics/Material_Alpha.h
index f18a30f760c..3a7df303a35 100644
--- a/engines/hpl1/engine/graphics/Material_Alpha.h
+++ b/engines/hpl1/engine/graphics/Material_Alpha.h
@@ -28,6 +28,7 @@
#ifndef HPL_MATERIAL_ALPHA_H
#define HPL_MATERIAL_ALPHA_H
+#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Material.h"
namespace hpl {
@@ -45,13 +46,12 @@ public:
bool UsesType(eMaterialRenderType aType);
- iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iMaterialProgramSetup *GetVertexProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight);
+ iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+ iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iGpuProgram *GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
-
eMaterialAlphaMode GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialBlendMode GetBlendMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialChannelMode GetChannelMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
@@ -74,8 +74,7 @@ public:
tVertexVec *apVtxVec, cVector3f *apTransform, unsigned int alIndexAdd) {}
private:
- iGpuProgram *mpFogVtxProg;
- iGpuProgram *mpFogFragProg;
+ iGpuProgram *_fogShader;
};
class cMaterialType_Alpha : public iMaterialType {
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
index d96fa171cc0..ede44eddbc5 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
@@ -26,6 +26,7 @@
*/
#include "hpl1/engine/graphics/Material_BaseLight.h"
+#include "common/algorithm.h"
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/graphics/Renderer3D.h"
@@ -37,6 +38,7 @@
#include "hpl1/engine/scene/Light3DSpot.h"
#include "hpl1/engine/scene/PortalContainer.h"
#include "hpl1/engine/system/String.h"
+#include <cstddef>
namespace hpl {
@@ -79,65 +81,37 @@ iMaterial_BaseLight::iMaterial_BaseLight(const tString &asLightVertexProgram,
mbUsesLights = true;
mbUseColorSpecular = false;
- for (int i = 0; i < eBaseLightProgram_LastEnum; i++) {
- mvVtxPrograms[i] = NULL;
- mvFragPrograms[i] = NULL;
- }
-
- ////////////////////////////////////////
- // Get names for other light programs
- tString sSpotVtxProgram = cString::Sub(asLightVertexProgram, 0, (int)asLightVertexProgram.size() - 5) +
- "Spot_vp.cg";
+ Common::fill(_shaders, _shaders + eBaseLightProgram_LastEnum, nullptr);
///////////////////////////////////////////
// Load the light pass vertex program
// Point
- mvVtxPrograms[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram(asLightVertexProgram, "main",
- eGpuProgramType_Vertex);
- // Spot
- mvVtxPrograms[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram(sSpotVtxProgram, "main",
- eGpuProgramType_Vertex);
+ _shaders[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram(asLightVertexProgram, asLightFragmentProgram);
- ///////////////////////////////////////////
- // Load the light pass fragment program
- // Point
- mvFragPrograms[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram(asLightFragmentProgram, "main",
- eGpuProgramType_Fragment);
+ ////////////////////////////////////////
+ // Get names for other light programs
+ tString sSpotVtxProgram = cString::Sub(asLightVertexProgram, 0, (int)asLightVertexProgram.size() - 5) +
+ "Spot";
//////////////////////////////////////////////////////
// Check if there is enough texture units for 1 pass spot
if (mpLowLevelGraphics->GetCaps(eGraphicCaps_MaxTextureImageUnits) > 4) {
mbUsesTwoPassSpot = false;
-
tString sSpotFragProgram = cString::Sub(asLightFragmentProgram, 0, (int)asLightFragmentProgram.size() - 5) +
- "Spot_fp.cg";
-
- mvFragPrograms[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram(sSpotFragProgram, "main",
- eGpuProgramType_Fragment);
+ "Spot";
+ _shaders[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram(sSpotVtxProgram, sSpotFragProgram);
} else {
mbUsesTwoPassSpot = true;
-
- tString sSpotFragProgram1 = "Diffuse_Light_Spot_fp_pass1.cg"; // cString::Sub(asLightFragmentProgram,0, (int)asLightFragmentProgram.size() - 5) +
+ tString sSpotFragProgram1 = "Diffuse_Light_Spot_pass1"; // cString::Sub(asLightFragmentProgram,0, (int)asLightFragmentProgram.size() - 5) +
// "Spot_fp_pass1.cg";
tString sSpotFragProgram2 = cString::Sub(asLightFragmentProgram, 0, (int)asLightFragmentProgram.size() - 5) +
- "Spot_fp_pass2.cg";
-
- mvFragPrograms[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram(sSpotFragProgram1, "main",
- eGpuProgramType_Fragment);
-
- mvFragPrograms[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram(sSpotFragProgram2, "main",
- eGpuProgramType_Fragment);
+ "Spot_pass2";
+ _shaders[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram(sSpotVtxProgram, sSpotFragProgram1);
+ _shaders[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram(sSpotVtxProgram, sSpotFragProgram2);
}
- ///////////////////////////////////////////
- // Load the Z pass vertex program
- iGpuProgram *pVtxProg = mpProgramManager->CreateProgram("Diffuse_Color_vp.cg", "main", eGpuProgramType_Vertex);
- SetProgram(pVtxProg, eGpuProgramType_Vertex, 1);
-
- ///////////////////////////////////////////
- // More fragment programs
- mpSimpleFP = mpProgramManager->CreateProgram("Diffuse_Color_fp.cg", "main", eGpuProgramType_Fragment);
- mpAmbientFP = mpProgramManager->CreateProgram("Ambient_Color_fp.cg", "main", eGpuProgramType_Fragment);
+ _diffuseShader = mpProgramManager->CreateProgram("Diffuse_Color", "Diffuse_Color");
+ _ambientShader = mpProgramManager->CreateProgram("Diffuse_Color", "Ambient_Color");
///////////////////////////////////////////
// Normalization map
@@ -165,15 +139,15 @@ iMaterial_BaseLight::~iMaterial_BaseLight() {
if (mpSpotNegativeRejectMap)
mpTextureManager->Destroy(mpSpotNegativeRejectMap);
- for (int i = 0; i < eBaseLightProgram_LastEnum; i++) {
- if (mvVtxPrograms[i])
- mpProgramManager->Destroy(mvVtxPrograms[i]);
- if (mvFragPrograms[i])
- mpProgramManager->Destroy(mvFragPrograms[i]);
+ for (int i = 0; i < eBaseLightProgram_LastEnum; ++i) {
+ if (_shaders[i])
+ mpProgramManager->Destroy(_shaders[i]);
}
- if (mpSimpleFP)
- mpProgramManager->Destroy(mpSimpleFP);
+ if (_diffuseShader)
+ mpProgramManager->Destroy(_diffuseShader);
+ if (_ambientShader)
+ mpProgramManager->Destroy(_ambientShader);
}
//-----------------------------------------------------------------------
@@ -184,24 +158,33 @@ iMaterial_BaseLight::~iMaterial_BaseLight() {
//-----------------------------------------------------------------------
-iGpuProgram *iMaterial_BaseLight::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (apLight && aType == eMaterialRenderType_Light) {
+iGpuProgram *iMaterial_BaseLight::getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
+ if (aType == eMaterialRenderType_Light) {
eBaseLightProgram program;
-
- if (apLight->GetLightType() == eLight3DType_Point)
- program = eBaseLightProgram_Point1;
- else if (apLight->GetLightType() == eLight3DType_Spot)
- program = eBaseLightProgram_Spot1;
-
- return mvVtxPrograms[program];
+ if (apLight->GetLightType() == eLight3DType_Spot && mbUsesTwoPassSpot) {
+ if (alPass == 0)
+ program = eBaseLightProgram_Spot1;
+ else
+ program = eBaseLightProgram_Spot2;
+ } else {
+ if (apLight->GetLightType() == eLight3DType_Point)
+ program = eBaseLightProgram_Point1;
+ else if (apLight->GetLightType() == eLight3DType_Spot)
+ program = eBaseLightProgram_Spot1;
+ }
+ return _shaders[program];
+ } else if (aType == eMaterialRenderType_Diffuse) {
+ return _diffuseShader;
+ } else if (aType == eMaterialRenderType_Z) {
+ return _ambientShader;
}
+ return nullptr;
+}
+iMaterialProgramSetup *iMaterial_BaseLight::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
if (aType == eMaterialRenderType_Z)
- return mpProgram[eGpuProgramType_Vertex][1];
- if (aType == eMaterialRenderType_Diffuse)
- return mpProgram[eGpuProgramType_Vertex][1];
-
- return NULL;
+ return &gAmbProgramSetup;
+ return nullptr;
}
//------------------------------------------------------------------------------------
@@ -222,46 +205,6 @@ bool iMaterial_BaseLight::VertexProgramUsesEye(eMaterialRenderType aType, int al
//------------------------------------------------------------------------------------
-iGpuProgram *iMaterial_BaseLight::GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (aType == eMaterialRenderType_Light) {
- eBaseLightProgram program;
-
- ///////////////
- // Spot two pass
- if (aType == eMaterialRenderType_Light && apLight->GetLightType() == eLight3DType_Spot && mbUsesTwoPassSpot) {
- if (alPass == 0)
- program = eBaseLightProgram_Spot1;
- else
- program = eBaseLightProgram_Spot2;
- }
- //////////////////
- // Other
- else {
- if (apLight->GetLightType() == eLight3DType_Point)
- program = eBaseLightProgram_Point1;
- else if (apLight->GetLightType() == eLight3DType_Spot)
- program = eBaseLightProgram_Spot1;
- }
-
- return mvFragPrograms[program];
- } else if (aType == eMaterialRenderType_Diffuse) {
- return mpSimpleFP;
- } else if (aType == eMaterialRenderType_Z) {
- return mpAmbientFP;
- }
- return NULL;
-}
-
-iMaterialProgramSetup *iMaterial_BaseLight::GetFragmentProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (aType == eMaterialRenderType_Z) {
- return &gAmbProgramSetup;
- }
-
- return NULL;
-}
-
-//------------------------------------------------------------------------------------
-
eMaterialAlphaMode iMaterial_BaseLight::GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
if (aType == eMaterialRenderType_Z && mbHasAlpha)
return eMaterialAlphaMode_Trans;
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.h b/engines/hpl1/engine/graphics/Material_BaseLight.h
index 3be9aba876c..5ffa9dc9097 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.h
@@ -28,9 +28,9 @@
#ifndef HPL_MATERIAL_BASE_LIGHT_H
#define HPL_MATERIAL_BASE_LIGHT_H
+#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Material.h"
#include "hpl1/engine/scene/Light3D.h"
-#include <vector>
enum eBaseLightProgram {
eBaseLightProgram_Point1 = 0,
@@ -60,13 +60,12 @@ public:
bool UsesType(eMaterialRenderType aType);
- iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
+ iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+ iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iGpuProgram *GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iMaterialProgramSetup *GetFragmentProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight);
-
eMaterialAlphaMode GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialBlendMode GetBlendMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialChannelMode GetChannelMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
@@ -99,11 +98,10 @@ protected:
bool mbUseNormalMap;
bool mbUseColorSpecular;
- iGpuProgram *mpSimpleFP;
- iGpuProgram *mpAmbientFP;
+ iGpuProgram *_diffuseShader;
+ iGpuProgram *_ambientShader;
- iGpuProgram *mvVtxPrograms[eBaseLightProgram_LastEnum];
- iGpuProgram *mvFragPrograms[eBaseLightProgram_LastEnum];
+ iGpuProgram *_shaders[eBaseLightProgram_LastEnum];
};
}; // namespace hpl
diff --git a/engines/hpl1/engine/graphics/Material_Bump.cpp b/engines/hpl1/engine/graphics/Material_Bump.cpp
index ac7b50c7069..f55aa251f69 100644
--- a/engines/hpl1/engine/graphics/Material_Bump.cpp
+++ b/engines/hpl1/engine/graphics/Material_Bump.cpp
@@ -44,8 +44,8 @@ cMaterial_Bump::cMaterial_Bump(const tString &asName, iLowLevelGraphics *apLowLe
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
- : iMaterial_BaseLight("Diffuse_Light_vp.cg",
- "Bump_Light_fp.cg",
+ : iMaterial_BaseLight("Diffuse_Light",
+ "Bump_Light",
asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
mbUseSpecular = false;
diff --git a/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp b/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
index 4dc825a278f..748611ddf30 100644
--- a/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
@@ -45,8 +45,8 @@ cMaterial_BumpColorSpec::cMaterial_BumpColorSpec(const tString &asName, iLowLeve
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
- : iMaterial_BaseLight("DiffuseSpec_Light_vp.cg",
- "BumpColorSpec_Light_fp.cg",
+ : iMaterial_BaseLight("DiffuseSpec_Light",
+ "BumpColorSpec_Light",
asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
mbUseSpecular = true;
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec.cpp b/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
index b8a20b7cba7..7ab5ef41ffc 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
@@ -44,8 +44,8 @@ cMaterial_BumpSpec::cMaterial_BumpSpec(const tString &asName, iLowLevelGraphics
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
- : iMaterial_BaseLight("DiffuseSpec_Light_vp.cg",
- "BumpSpec_Light_fp.cg",
+ : iMaterial_BaseLight("DiffuseSpec_Light",
+ "BumpSpec_Light",
asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
mbUseSpecular = true;
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp b/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
index babfb230d2d..20d07a28e24 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
@@ -49,38 +49,17 @@ cMaterial_BumpSpec2D::cMaterial_BumpSpec2D(const tString &asName, iLowLevelGraph
mbIsTransperant = false;
mbIsGlowing = false;
mbUsesLights = true;
-
mbHasSpecular = true;
-
mType = eMaterialType_BumpSpec;
- if (mbHasSpecular) {
- // load the fragment program
- iGpuProgram *pFragProg = mpProgramManager->CreateProgram("BumpSpec2D_Light_fp.cg", "main",
- eGpuProgramType_Fragment);
- SetProgram(pFragProg, eGpuProgramType_Fragment, 0);
-
- // Load the vertex program
- iGpuProgram *pVtxProg = mpProgramManager->CreateProgram("BumpSpec2D_Light_vp.cg", "main",
- eGpuProgramType_Vertex);
- SetProgram(pVtxProg, eGpuProgramType_Vertex, 0);
- } else // Just use normal bump without specular
- {
- // load the fragment program
- iGpuProgram *pFragProg = mpProgramManager->CreateProgram("Bump2D_Light_fp.cg", "main",
- eGpuProgramType_Fragment);
- SetProgram(pFragProg, eGpuProgramType_Fragment, 0);
-
- // Load the vertex program
- iGpuProgram *pVtxProg = mpProgramManager->CreateProgram("Bump2D_Light_vp.cg", "main",
- eGpuProgramType_Vertex);
- SetProgram(pVtxProg, eGpuProgramType_Vertex, 0);
- }
+ _shader = mpProgramManager->CreateProgram("BumpSpec2D_Light", "BumpSpec2D_Light");
}
//-----------------------------------------------------------------------
cMaterial_BumpSpec2D::~cMaterial_BumpSpec2D() {
+ if (_shader)
+ mpProgramManager->Destroy(_shader);
}
//-----------------------------------------------------------------------
@@ -107,7 +86,7 @@ bool cMaterial_BumpSpec2D::StartRendering(eMaterialRenderType aType, iCamera *ap
cVector3f vLightPos = apLight->GetLightPosition();
cVector3f vEyePos;
- if (apCam != NULL) {
+ if (apCam != nullptr) {
vEyePos = apCam->GetEyePosition();
}
@@ -117,27 +96,22 @@ bool cMaterial_BumpSpec2D::StartRendering(eMaterialRenderType aType, iCamera *ap
mpLowLevelGraphics->SetTexture(0, GetTexture(eMaterialTexture_NMap));
mpLowLevelGraphics->SetTexture(1, mpRenderer->GetLightMap(0));
- mpProgram[eGpuProgramType_Vertex][0]->SetMatrixf("worldViewProj",
- eGpuProgramMatrix_ViewProjection,
- eGpuProgramMatrixOp_Identity);
+ _shader->SetMatrixf("worldViewProj",
+ eGpuProgramMatrix_ViewProjection,
+ eGpuProgramMatrixOp_Identity);
- mpProgram[eGpuProgramType_Vertex][0]->SetVec3f("LightPos", vLightPos.x, vLightPos.y, vLightPos.z);
+ _shader->SetVec3f("LightPos", vLightPos.x, vLightPos.y, vLightPos.z);
- if (mbHasSpecular)
- mpProgram[eGpuProgramType_Vertex][0]->SetVec3f("EyePos", vEyePos.x, vEyePos.y, vEyePos.z);
+ _shader->SetVec3f("EyePos", vEyePos.x, vEyePos.y, vEyePos.z);
- mpProgram[eGpuProgramType_Vertex][0]->SetFloat("LightRadius", apLight->GetFarAttenuation());
- mpProgram[eGpuProgramType_Vertex][0]->SetVec4f("LightColor", apLight->GetDiffuseColor().r,
- apLight->GetDiffuseColor().g, apLight->GetDiffuseColor().b,
- apLight->GetDiffuseColor().a);
-
- mpProgram[eGpuProgramType_Vertex][0]->Bind();
-
- mpProgram[eGpuProgramType_Fragment][0]->Bind();
+ _shader->SetFloat("LightRadius", apLight->GetFarAttenuation());
+ _shader->SetVec4f("LightColor", apLight->GetDiffuseColor().r,
+ apLight->GetDiffuseColor().g, apLight->GetDiffuseColor().b,
+ apLight->GetDiffuseColor().a);
+ _shader->Bind();
} else if (aType == eMaterialRenderType_Diffuse) {
mpLowLevelGraphics->SetBlendActive(true);
mpLowLevelGraphics->SetBlendFunc(eBlendFunc_DestColor, eBlendFunc_DestAlpha);
-
mpLowLevelGraphics->SetTexture(0, GetTexture(eMaterialTexture_Diffuse));
mpLowLevelGraphics->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Add);
mpLowLevelGraphics->SetTextureEnv(eTextureParam_ColorOp1, eTextureOp_OneMinusAlpha);
@@ -157,8 +131,7 @@ void cMaterial_BumpSpec2D::EndRendering(eMaterialRenderType aType) {
mpLowLevelGraphics->SetTexture(0, NULL);
mpLowLevelGraphics->SetTexture(1, NULL);
- mpProgram[eGpuProgramType_Vertex][0]->UnBind();
- mpProgram[eGpuProgramType_Fragment][0]->UnBind();
+ _shader->UnBind();
} else if (aType == eMaterialRenderType_Diffuse) {
mpLowLevelGraphics->SetTexture(0, NULL);
mpLowLevelGraphics->SetBlendActive(false);
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec2D.h b/engines/hpl1/engine/graphics/Material_BumpSpec2D.h
index 426d2db7fe1..44d518dacfa 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec2D.h
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec2D.h
@@ -28,6 +28,7 @@
#ifndef HPL_MATERIAL_BUMP_SPEC2D_H
#define HPL_MATERIAL_BUMP_SPEC2D_H
+#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Material.h"
namespace hpl {
@@ -54,6 +55,7 @@ public:
tVertexVec *apVtxVec, cVector3f *apTransform, unsigned int alIndexAdd);
private:
+ iGpuProgram *_shader;
bool mbHasSpecular;
};
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse.cpp b/engines/hpl1/engine/graphics/Material_Diffuse.cpp
index 19c7ffc2df8..5b86e21011c 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse.cpp
+++ b/engines/hpl1/engine/graphics/Material_Diffuse.cpp
@@ -43,8 +43,8 @@ cMaterial_Diffuse::cMaterial_Diffuse(const tString &asName, iLowLevelGraphics *a
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
- : iMaterial_BaseLight("Diffuse_Light_vp.cg",
- "Diffuse_Light_fp.cg",
+ : iMaterial_BaseLight("Diffuse_Light",
+ "Diffuse_Light",
asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
mbUseSpecular = false;
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp b/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
index e9c3a682c1b..726e0eac9a1 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
@@ -43,8 +43,8 @@ cMaterial_DiffuseSpec::cMaterial_DiffuseSpec(const tString &asName, iLowLevelGra
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
- : iMaterial_BaseLight("DiffuseSpec_Light_vp.cg",
- "DiffuseSpec_Light_fp.cg",
+ : iMaterial_BaseLight("DiffuseSpec_Light",
+ "DiffuseSpec_Light",
asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
mbUseSpecular = true;
diff --git a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
index d12144940ea..2ae2cfae275 100644
--- a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
+++ b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
@@ -102,6 +102,7 @@ cMaterial_EnvMap_Reflect::cMaterial_EnvMap_Reflect(const tString &asName, iLowLe
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
: iMaterial(asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
+ error("cMaterial_EnvMap_Reflect not implemented");
mbIsTransperant = false;
mbIsGlowing = false;
mbUsesLights = false;
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
index 1fb014fa3c9..cea92ad9069 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
@@ -26,6 +26,7 @@
*/
#include "hpl1/engine/graphics/Material_Fallback01_BaseLight.h"
+#include "common/textconsole.h"
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/math/Math.h"
@@ -288,6 +289,8 @@ iMaterial_Fallback01_BaseLight::iMaterial_Fallback01_BaseLight(
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
: iMaterial(asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
+ error("iMaterial_Fallback01_BaseLight not yet implemented");
+
gDiffuseGLState.SetUp(mpLowLevelGraphics);
gBumpGLState.SetUp(mpLowLevelGraphics);
gSpotGLState.SetUp(mpLowLevelGraphics);
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
index 0f46ed175bf..8708a8caa5a 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
@@ -28,6 +28,7 @@
#ifndef HPL_MATERIAL_FALLBACK01_BASE_LIGHT_H
#define HPL_MATERIAL_FALLBACK01_BASE_LIGHT_H
+#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Material.h"
#include "hpl1/engine/scene/Light3D.h"
#include <vector>
@@ -91,6 +92,7 @@ protected:
iTexture *mpAttenuationMap;
+ iGpuProgram *_shaders[eBaseLightProgram_LastEnum];
iGpuProgram *mvVtxPrograms[eBaseLightProgram_LastEnum];
iGpuProgram *mvFragPrograms[eBaseLightProgram_LastEnum];
};
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
index 35ead2d6978..0fc594c4b3a 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
@@ -147,6 +147,8 @@ iMaterial_Fallback02_BaseLight::iMaterial_Fallback02_BaseLight(
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
: iMaterial(asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
+ error("iMaterial_Fallback02_BaseLight not yet implemented");
+
gDiffuseGLState.SetUp(mpLowLevelGraphics);
gSpotGLState.SetUp(mpLowLevelGraphics);
diff --git a/engines/hpl1/engine/graphics/Material_Flat.cpp b/engines/hpl1/engine/graphics/Material_Flat.cpp
index c950609fb72..9dcb4699175 100644
--- a/engines/hpl1/engine/graphics/Material_Flat.cpp
+++ b/engines/hpl1/engine/graphics/Material_Flat.cpp
@@ -52,11 +52,6 @@ cMaterial_Flat::cMaterial_Flat(const tString &asName, iLowLevelGraphics *apLowLe
mbIsTransperant = false;
mbIsGlowing = false;
mbUsesLights = false;
-
- ///////////////////////////////////////////
- // Load the Z pass vertex program
- iGpuProgram *pVtxProg = mpProgramManager->CreateProgram("Diffuse_Color_vp.cg", "main", eGpuProgramType_Vertex);
- SetProgram(pVtxProg, eGpuProgramType_Vertex, 0);
}
//-----------------------------------------------------------------------
@@ -72,10 +67,6 @@ cMaterial_Flat::~cMaterial_Flat() {
//-----------------------------------------------------------------------
-iGpuProgram *cMaterial_Flat::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- return NULL; // return mpProgram[eGpuProgramType_Vertex][0];
-}
-
bool cMaterial_Flat::VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
return false;
}
@@ -84,10 +75,6 @@ bool cMaterial_Flat::VertexProgramUsesEye(eMaterialRenderType aType, int alPass,
return false;
}
-iGpuProgram *cMaterial_Flat::GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- return NULL;
-}
-
eMaterialAlphaMode cMaterial_Flat::GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
if (aType == eMaterialRenderType_Z && mbHasAlpha)
return eMaterialAlphaMode_Trans;
diff --git a/engines/hpl1/engine/graphics/Material_Flat.h b/engines/hpl1/engine/graphics/Material_Flat.h
index 327b67d2c73..228a916d91b 100644
--- a/engines/hpl1/engine/graphics/Material_Flat.h
+++ b/engines/hpl1/engine/graphics/Material_Flat.h
@@ -28,6 +28,7 @@
#ifndef HPL_MATERIAL_FLAT_H
#define HPL_MATERIAL_FLAT_H
+#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Material.h"
namespace hpl {
@@ -45,12 +46,9 @@ public:
bool UsesType(eMaterialRenderType aType);
- iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iGpuProgram *GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
-
eMaterialAlphaMode GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialBlendMode GetBlendMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialChannelMode GetChannelMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
diff --git a/engines/hpl1/engine/graphics/Material_Modulative.cpp b/engines/hpl1/engine/graphics/Material_Modulative.cpp
index 2f38ed32f31..8ea5df1cb03 100644
--- a/engines/hpl1/engine/graphics/Material_Modulative.cpp
+++ b/engines/hpl1/engine/graphics/Material_Modulative.cpp
@@ -37,40 +37,6 @@
namespace hpl {
-//////////////////////////////////////////////////////////////////////////
-// FRAGMENT PRORGAM SETUP
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-class cGLState_ModulateFog : public iGLStateProgram {
-public:
- cGLState_ModulateFog() : iGLStateProgram("ModulateFog") {}
-
- void Bind() {
- mpLowGfx->SetActiveTextureUnit(1);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource2, eTextureSource_Texture);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource0, eTextureSource_Constant);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Interpolate);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorOp2, eTextureOp_OneMinusColor);
- mpLowGfx->SetTextureConstantColor(cColor(1, 1, 1, 1));
- }
-
- void UnBind() {
- mpLowGfx->SetActiveTextureUnit(1);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource0, eTextureSource_Texture);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource1, eTextureSource_Previous);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource2, eTextureSource_Constant);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorOp2, eTextureOp_Color);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Modulate);
- }
-
-private:
- void InitData() {}
-};
-
-static cGLState_ModulateFog gModulateFog;
-
//-----------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////
@@ -105,23 +71,14 @@ cMaterial_Modulative::cMaterial_Modulative(const tString &asName, iLowLevelGraph
mbIsGlowing = false;
mbUsesLights = false;
- gModulateFog.SetUp(apLowLevelGraphics);
-
- mpFogVtxProg = mpProgramManager->CreateProgram("Fog_Trans_vp.cg", "main", eGpuProgramType_Vertex);
-
- if (mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_FragmentProgram))
- mpFogFragProg = mpProgramManager->CreateProgram("Fog_Trans_Mod_fp.cg", "main", eGpuProgramType_Fragment);
- else
- mpFogFragProg = NULL;
+ _fogShader = mpProgramManager->CreateProgram("Fog_Trans", "Fog_Trans_Mod");
}
//-----------------------------------------------------------------------
cMaterial_Modulative::~cMaterial_Modulative() {
- if (mpFogVtxProg)
- mpProgramManager->Destroy(mpFogVtxProg);
- if (mpFogFragProg)
- mpProgramManager->Destroy(mpFogFragProg);
+ if (_fogShader)
+ mpProgramManager->Destroy(_fogShader);
}
//-----------------------------------------------------------------------
@@ -132,18 +89,16 @@ cMaterial_Modulative::~cMaterial_Modulative() {
//-----------------------------------------------------------------------
-iGpuProgram *cMaterial_Modulative::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+iGpuProgram *cMaterial_Modulative::getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
if (mpRenderSettings->mbFogActive)
- return mpFogVtxProg;
- else
- return NULL;
+ return _fogShader;
+ return nullptr;
}
-iMaterialProgramSetup *cMaterial_Modulative::GetVertexProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+iMaterialProgramSetup *cMaterial_Modulative::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
if (mpRenderSettings->mbFogActive)
return &gFogProgramSetup;
- else
- return NULL;
+ return nullptr;
}
bool cMaterial_Modulative::VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
@@ -154,17 +109,6 @@ bool cMaterial_Modulative::VertexProgramUsesEye(eMaterialRenderType aType, int a
return false;
}
-iGpuProgram *cMaterial_Modulative::GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (mpRenderSettings->mbFogActive) {
- if (mpFogFragProg)
- return mpFogFragProg;
- else
- return &gModulateFog;
- } else {
- return NULL;
- }
-}
-
eMaterialAlphaMode cMaterial_Modulative::GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
return eMaterialAlphaMode_Solid;
}
diff --git a/engines/hpl1/engine/graphics/Material_Modulative.h b/engines/hpl1/engine/graphics/Material_Modulative.h
index 09a8505a322..256c3871775 100644
--- a/engines/hpl1/engine/graphics/Material_Modulative.h
+++ b/engines/hpl1/engine/graphics/Material_Modulative.h
@@ -28,6 +28,7 @@
#ifndef HPL_MATERIAL_MODULATIVE_H
#define HPL_MATERIAL_MODULATIVE_H
+#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Material.h"
namespace hpl {
@@ -45,13 +46,12 @@ public:
bool UsesType(eMaterialRenderType aType);
- iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iMaterialProgramSetup *GetVertexProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight);
+ iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+ iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iGpuProgram *GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
-
eMaterialAlphaMode GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialBlendMode GetBlendMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialChannelMode GetChannelMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
@@ -74,8 +74,7 @@ public:
tVertexVec *apVtxVec, cVector3f *apTransform, unsigned int alIndexAdd) {}
private:
- iGpuProgram *mpFogVtxProg;
- iGpuProgram *mpFogFragProg;
+ iGpuProgram *_fogShader;
};
class cMaterialType_Modulative : public iMaterialType {
diff --git a/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp b/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
index 65e336edc42..9f057a4eac7 100644
--- a/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
+++ b/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
@@ -34,45 +34,10 @@
#include "hpl1/engine/resources/TextureManager.h"
#include "hpl1/engine/scene/Camera.h"
#include "hpl1/engine/scene/Light.h"
+#include <cstddef>
namespace hpl {
-//////////////////////////////////////////////////////////////////////////
-// FRAGMENT PRORGAM SETUP
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-class cGLState_ModulateX2Fog : public iGLStateProgram {
-public:
- cGLState_ModulateX2Fog() : iGLStateProgram("ModulateX2Fog") {}
-
- void Bind() {
- mpLowGfx->SetActiveTextureUnit(1);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource2, eTextureSource_Texture);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource0, eTextureSource_Constant);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Interpolate);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorOp2, eTextureOp_OneMinusColor);
- mpLowGfx->SetTextureConstantColor(cColor(0.5, 1));
- }
-
- void UnBind() {
- mpLowGfx->SetActiveTextureUnit(1);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource0, eTextureSource_Texture);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource1, eTextureSource_Previous);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource2, eTextureSource_Constant);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorOp2, eTextureOp_Color);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Modulate);
- }
-
-private:
- void InitData() {}
-};
-
-static cGLState_ModulateX2Fog gModulateX2Fog;
-
-//-----------------------------------------------------------------------
-
//////////////////////////////////////////////////////////////////////////
// VERTEX PRORGAM SETUP
//////////////////////////////////////////////////////////////////////////
@@ -104,24 +69,14 @@ cMaterial_ModulativeX2::cMaterial_ModulativeX2(const tString &asName, iLowLevelG
mbIsTransperant = true;
mbIsGlowing = false;
mbUsesLights = false;
-
- gModulateX2Fog.SetUp(apLowLevelGraphics);
-
- mpFogVtxProg = mpProgramManager->CreateProgram("Fog_Trans_vp.cg", "main", eGpuProgramType_Vertex);
-
- if (mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_FragmentProgram))
- mpFogFragProg = mpProgramManager->CreateProgram("Fog_Trans_ModX2_fp.cg", "main", eGpuProgramType_Fragment);
- else
- mpFogFragProg = NULL;
+ _fogShader = mpProgramManager->CreateProgram("Fog_Trans", "Fog_Trans_ModX2");
}
//-----------------------------------------------------------------------
cMaterial_ModulativeX2::~cMaterial_ModulativeX2() {
- if (mpFogVtxProg)
- mpProgramManager->Destroy(mpFogVtxProg);
- if (mpFogFragProg)
- mpProgramManager->Destroy(mpFogFragProg);
+ if (_fogShader)
+ mpProgramManager->Destroy(_fogShader);
}
//-----------------------------------------------------------------------
@@ -132,18 +87,16 @@ cMaterial_ModulativeX2::~cMaterial_ModulativeX2() {
//-----------------------------------------------------------------------
-iGpuProgram *cMaterial_ModulativeX2::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+iGpuProgram *cMaterial_ModulativeX2::getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
if (mpRenderSettings->mbFogActive)
- return mpFogVtxProg;
- else
- return NULL;
+ return _fogShader;
+ return nullptr;
}
-iMaterialProgramSetup *cMaterial_ModulativeX2::GetVertexProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+iMaterialProgramSetup *cMaterial_ModulativeX2::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
if (mpRenderSettings->mbFogActive)
return &gFogProgramSetup;
- else
- return NULL;
+ return nullptr;
}
bool cMaterial_ModulativeX2::VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
@@ -154,16 +107,6 @@ bool cMaterial_ModulativeX2::VertexProgramUsesEye(eMaterialRenderType aType, int
return false;
}
-iGpuProgram *cMaterial_ModulativeX2::GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (mpRenderSettings->mbFogActive) {
- if (mpFogFragProg)
- return mpFogFragProg;
- else
- return &gModulateX2Fog;
- } else
- return NULL;
-}
-
eMaterialAlphaMode cMaterial_ModulativeX2::GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
return eMaterialAlphaMode_Solid;
}
diff --git a/engines/hpl1/engine/graphics/Material_ModulativeX2.h b/engines/hpl1/engine/graphics/Material_ModulativeX2.h
index 79ee6bedbae..3e551426522 100644
--- a/engines/hpl1/engine/graphics/Material_ModulativeX2.h
+++ b/engines/hpl1/engine/graphics/Material_ModulativeX2.h
@@ -28,6 +28,7 @@
#ifndef HPL_MATERIAL_MODULATIVE_X_2_H
#define HPL_MATERIAL_MODULATIVE_X_2_H
+#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Material.h"
namespace hpl {
@@ -45,13 +46,12 @@ public:
bool UsesType(eMaterialRenderType aType);
- iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iMaterialProgramSetup *GetVertexProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight);
+ iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+ iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iGpuProgram *GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
-
eMaterialAlphaMode GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialBlendMode GetBlendMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialChannelMode GetChannelMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
@@ -74,8 +74,7 @@ public:
tVertexVec *apVtxVec, cVector3f *apTransform, unsigned int alIndexAdd) {}
private:
- iGpuProgram *mpFogVtxProg;
- iGpuProgram *mpFogFragProg;
+ iGpuProgram *_fogShader;
};
class cMaterialType_ModulativeX2 : public iMaterialType {
diff --git a/engines/hpl1/engine/graphics/Material_Water.cpp b/engines/hpl1/engine/graphics/Material_Water.cpp
index 9e2218e695e..420a76a5c53 100644
--- a/engines/hpl1/engine/graphics/Material_Water.cpp
+++ b/engines/hpl1/engine/graphics/Material_Water.cpp
@@ -87,14 +87,13 @@ cMaterial_Water::cMaterial_Water(const tString &asName, iLowLevelGraphics *apLow
// gModulateFog.SetUp(apLowLevelGraphics);
- mpFogVtxProg = mpProgramManager->CreateProgram("Water_Fog_vp.cg", "main",
- eGpuProgramType_Vertex);
+ //mpFogVtxProg = mpProgramManager->CreateProgram("Water_Fog_vp.cg", "main",
+ // eGpuProgramType_Vertex);
- mpRefractVtxProg = mpProgramManager->CreateProgram("refract_water_vp.cg", "main", eGpuProgramType_Vertex);
- mpRefractFragProg = mpProgramManager->CreateProgram("refract_water_fp.cg", "main", eGpuProgramType_Fragment);
+ _refractShader = mpProgramManager->CreateProgram("refract_water", "refract_water");
- iGpuProgram *pVtxProg = mpProgramManager->CreateProgram("Water_Diffuse_vp.cg", "main", eGpuProgramType_Vertex);
- SetProgram(pVtxProg, eGpuProgramType_Vertex, 0);
+ // iGpuProgram *pVtxProg = mpProgramManager->CreateProgram("Water_Diffuse_vp.cg", "main", eGpuProgramType_Vertex);
+ // SetProgram(pVtxProg, eGpuProgramType_Vertex, 0);
mfTime = 0;
}
@@ -102,8 +101,8 @@ cMaterial_Water::cMaterial_Water(const tString &asName, iLowLevelGraphics *apLow
//-----------------------------------------------------------------------
cMaterial_Water::~cMaterial_Water() {
- if (mpFogVtxProg)
- mpProgramManager->Destroy(mpFogVtxProg);
+ if (_refractShader)
+ mpProgramManager->Destroy(_refractShader);
}
//-----------------------------------------------------------------------
@@ -122,18 +121,22 @@ void cMaterial_Water::Update(float afTimeStep) {
//-----------------------------------------------------------------------
-iGpuProgram *cMaterial_Water::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (mpRenderSettings->mbFogActive)
- return mpFogVtxProg;
- else
- return mpProgram[eGpuProgramType_Vertex][0];
+iGpuProgram *cMaterial_Water::getGpuProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+ return _refractShader;
}
-iMaterialProgramSetup *cMaterial_Water::GetVertexProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+iMaterialProgramSetup *cMaterial_Water::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
if (mpRenderSettings->mbFogActive)
return &gFogWaterProgramSetup;
+ return &gWaterProgramSetup;
+}
+
+
+iGpuProgram *cMaterial_Water::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+ if (mpRenderSettings->mbFogActive)
+ return mpFogVtxProg;
else
- return &gWaterProgramSetup;
+ return mpProgram[eGpuProgramType_Vertex][0];
}
bool cMaterial_Water::VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
@@ -144,10 +147,6 @@ bool cMaterial_Water::VertexProgramUsesEye(eMaterialRenderType aType, int alPass
return false;
}
-iGpuProgram *cMaterial_Water::GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- return NULL;
-}
-
eMaterialAlphaMode cMaterial_Water::GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
return eMaterialAlphaMode_Solid;
}
diff --git a/engines/hpl1/engine/graphics/Material_Water.h b/engines/hpl1/engine/graphics/Material_Water.h
index 4ca01c781fa..eafbbc2837c 100644
--- a/engines/hpl1/engine/graphics/Material_Water.h
+++ b/engines/hpl1/engine/graphics/Material_Water.h
@@ -28,6 +28,7 @@
#ifndef HPL_MATERIAL_WATER_H
#define HPL_MATERIAL_WATER_H
+#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Material.h"
namespace hpl {
@@ -47,13 +48,13 @@ public:
void Update(float afTimeStep);
+ iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+ iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+
iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iMaterialProgramSetup *GetVertexProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iGpuProgram *GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
-
eMaterialAlphaMode GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialBlendMode GetBlendMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialChannelMode GetChannelMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
@@ -63,8 +64,7 @@ public:
int GetNumOfPasses(eMaterialRenderType aType, iLight3D *apLight) { return 1; }
- iGpuProgram *GetRefractionVertexProgam() { return mpRefractVtxProg; }
- iGpuProgram *GetRefractionFragmentProgam() { return mpRefractFragProg; }
+ iGpuProgram * getRefractionProgram() { return _refractShader; }
bool GetRefractionUsesDiffuse() { return true; }
eMaterialTexture GetRefractionDiffuseTexture() { return eMaterialTexture_Specular; }
bool GetRefractionUsesEye() { return true; }
@@ -86,6 +86,7 @@ public:
private:
iGpuProgram *mpFogVtxProg;
+ iGpuProgram *_refractShader;
iGpuProgram *mpRefractVtxProg;
iGpuProgram *mpRefractFragProg;
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index a20ce82f199..e9b131e3678 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -1146,8 +1146,8 @@ void cRenderer3D::RenderTrans(cCamera3D *apCamera) {
Log(" Special = true\n");
}
- iGpuProgram *pRefractVtxProgram = pMaterial->GetRefractionVertexProgam();
- iGpuProgram *pRefractFragProgram = pMaterial->GetRefractionFragmentProgam();
+ iGpuProgram *pRefractVtxProgram = nullptr; //pMaterial->GetRefractionVertexProgam();
+ iGpuProgram *pRefractFragProgram = nullptr; //pMaterial->GetRefractionFragmentProgam();
if (pRefractFragProgram == NULL) {
if (bSpecial)
diff --git a/engines/hpl1/engine/impl/CGProgram.cpp b/engines/hpl1/engine/impl/CGProgram.cpp
index 769ddab24e4..ceb4f65ad9e 100644
--- a/engines/hpl1/engine/impl/CGProgram.cpp
+++ b/engines/hpl1/engine/impl/CGProgram.cpp
@@ -31,83 +31,37 @@
#include "hpl1/engine/system/String.h"
-namespace hpl {
-
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-tString cCGProgram::msForceFP = "AUTO";
-tString cCGProgram::msForceVP = "AUTO";
+#include "hpl1/opengl.h"
+#include "graphics/opengl/shader.h"
+#include "hpl1/debug.h"
+#include "common/array.h"
+#include "common/str.h"
+#include "math/matrix4.h"
-cCGProgram::cCGProgram(tString asName, CGcontext aContext, eGpuProgramType aType)
- : iGpuProgram(asName, aType) {
-#if 0
- mContext = aContext;
-
- mProgram = NULL;
-
-#define CG_CHECK(type, p) \
- else if (msForce##type == #p) { \
- mProfile = cgGLIsProfileSupported(CG_PROFILE_##p) ? CG_PROFILE_##p : CG_PROFILE_UNKNOWN; \
- }
- if(mProgramType == eGpuProgramType_Vertex)
- {
- if (msForceVP == "AUTO") {
- mProfile = cgGLGetLatestProfile(CG_GL_VERTEX);
- } CG_CHECK(VP,ARBVP1)
- CG_CHECK(VP,VP40)
- CG_CHECK(VP,VP30)
- CG_CHECK(VP,VP20)
- CG_CHECK(VP,GLSLV) else {
- Log("Forced VP %s unknown\n",msForceVP.c_str());
- mProfile = CG_PROFILE_UNKNOWN;
- }
- }
- else
- {
- if (msForceFP == "AUTO") {
- mProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
- } CG_CHECK(FP,ARBFP1)
- CG_CHECK(FP,FP40)
- CG_CHECK(FP,FP30)
- CG_CHECK(FP,FP20)
- CG_CHECK(FP,GLSLF) else {
- Log("Forced FP %s unknown\n",msForceFP.c_str());
- mProfile = CG_PROFILE_UNKNOWN;
- }
- }
-#undef CG_CHECK
- if(mbDebugInfo)
- {
- if(mProfile == CG_PROFILE_UNKNOWN)
- Log("CG: '%s' using profile: UKNOWN\n",asName.c_str());
- else
- Log("CG: '%s' using profile: '%s'\n",asName.c_str(),cgGetProfileString(mProfile));
- }
-
- for(int i=0; i< MAX_TEXTUREUNITS; ++i)
- {
- mvTexUnitParam[i] = NULL;
- }
+namespace hpl {
- cgGLSetOptimalOptions(mProfile);
-#endif
+static OpenGL::Shader *createShader(const char *vertex, const char *fragment) {
+ const char *attributes[] = {nullptr};
+ return OpenGL::Shader::fromFiles(vertex, fragment, attributes);
}
-cCGProgram::~cCGProgram() {
-#if 0
- if(mProgram) cgDestroyProgram(mProgram);
-#endif
+static void setSamplers(OpenGL::Shader *shader) {
+ shader->use();
+ shader->setUniform("tex0", 0);
+ shader->setUniform("tex1", 1);
+ shader->setUniform("tex2", 2);
+ shader->setUniform("tex3", 3);
+ shader->setUniform("tex4", 4);
+ shader->setUniform("tex5", 5);
+ shader->setUniform("tex6", 6);
+ shader->unbind();
}
-//-----------------------------------------------------------------------
+cCGProgram::cCGProgram(const tString &vertex, const tString &fragment)
+ : iGpuProgram(vertex + " " + fragment), _shader(createShader(vertex.c_str(), fragment.c_str())) {
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
+ setSamplers(_shader);
+}
//-----------------------------------------------------------------------
@@ -123,308 +77,68 @@ void cCGProgram::unload() {
//-----------------------------------------------------------------------
void cCGProgram::destroy() {
-}
-
-//-----------------------------------------------------------------------
-
-bool cCGProgram::CreateFromFile(const tString &asFile, const tString &asEntry) {
-#if 0
- if(mProfile == CG_PROFILE_UNKNOWN)
- {
- CGerror err = cgGetError();
- Log("Could not find a working profile for cg file '%s'!\n",msName.c_str());
- if (err != CG_NO_ERROR)Log(" %s\n", cgGetErrorString(err));
- return false;
- }
-
- //Log("Creating CG prog\n");
-
- mProgram = cgCreateProgramFromFile(mContext, CG_SOURCE, asFile.c_str(),mProfile,
- asEntry.c_str(),NULL);
-
- //Log("getting CG errors\n");
-
- CGerror err = cgGetError();
- if (err != CG_NO_ERROR)
- {
- Log(" %s\n", cgGetErrorString(err));
- const char* pString = cgGetLastListing(mContext);
- int lIdx=0;
- int lLastNewLine=0;
-
- Log(" -----------------------------------\n");
- while(pString[lIdx]!=0)//true)
- {
- Log("%c",pString[lIdx]);
- /*if(pString[lIdx]==0)
- {
- tString sStr = cString::Sub(pString, lLastNewLine,(lIdx-lLastNewLine));
- Log(" %s",sStr.c_str());
- break;
- }
- else if(pString[lIdx]=='\n')
- {
- tString sStr = cString::Sub(pString, lLastNewLine,(lIdx-lLastNewLine));
- Log(" %s\n",sStr.c_str());
- lLastNewLine = lIdx+1;
- }*/
- lIdx++;
- }
- Log(" -----------------------------------\n");
-
- Log("CG: Error loading: '%s'!\n",asFile.c_str());
- return false;
- }
-
- if(mProgram==NULL){
- Log("Error loading: '%s'!\n",asFile.c_str());
- return false;
- }
-
- //Log("Loading CG program\n");
-
- cgGLLoadProgram(mProgram);
-
- err = cgGetError();
- if (err != CG_NO_ERROR)
- {
- Log(" %s\n", cgGetErrorString(err));
-
- cgDestroyProgram(mProgram);
- mProgram = NULL;
-
- return false;
- }
-
-
- msFile = asFile;
- msEntry = asEntry;
-
- ///////////////////////////////
- //Look for texture units.
- //Log("File: %s\n", msFile.c_str());
- int lCount =0;
- CGparameter Param = cgGetFirstParameter(mProgram, CG_PROGRAM);
- for(; Param != NULL; Param = cgGetNextParameter(Param))
- {
- //Check if it is a texture type
- CGparameterclass paramClass = cgGetParameterClass(Param);
- if( paramClass != CG_PARAMETERCLASS_SAMPLER)
- {
- continue;
- }
-
- //Get the unit number
- int lUnit = lCount;
- const char *pSemantic = cgGetParameterSemantic(Param);
- if(pSemantic)
- {
- lUnit = cString::ToInt(cString::Sub(pSemantic,7).c_str(),0);
- }
- tString sName = cgGetParameterName(Param);
- //Log(" Texture %d: %s\n",lUnit,sName.c_str());
-
- mvTexUnitParam[lUnit] = Param;
-
- ++lCount;
- }
-#endif
-
- return true;
+ delete _shader;
}
//-----------------------------------------------------------------------
void cCGProgram::Bind() {
-#if 0
- cgGLBindProgram(mProgram);
- cgGLEnableProfile(mProfile);
-#endif
+ _shader->use();
}
//-----------------------------------------------------------------------
void cCGProgram::UnBind() {
-#if 0
- cgGLDisableProfile(mProfile);
-#endif
+ _shader->unbind();
}
//-----------------------------------------------------------------------
bool cCGProgram::SetFloat(const tString &asName, float afX) {
-#if 0
- CGparameter Param = GetParam(asName, CG_FLOAT);
- if(Param==NULL)return false;
-
- cgGLSetParameter1f(Param, afX);
-#endif
+ _shader->setUniform1f(asName.c_str(), afX);
return true;
}
//-----------------------------------------------------------------------
bool cCGProgram::SetVec2f(const tString &asName, float afX, float afY) {
-#if 0
- CGparameter Param = GetParam(asName, CG_FLOAT2);
- if(Param==NULL)return false;
-
- cgGLSetParameter2f(Param, afX, afY);
-#endif
-
+ _shader->setUniform(asName.c_str(), {afX, afY});
return true;
}
//-----------------------------------------------------------------------
bool cCGProgram::SetVec3f(const tString &asName, float afX, float afY, float afZ) {
-#if 0
- CGparameter Param = GetParam(asName, CG_FLOAT3);
- if(Param==NULL)return false;
-
- cgGLSetParameter3f(Param, afX, afY, afZ);
-#endif
-
+ _shader->setUniform(asName.c_str(), {afX, afY, afZ});
return true;
}
//-----------------------------------------------------------------------
bool cCGProgram::SetVec4f(const tString &asName, float afX, float afY, float afZ, float afW) {
-#if 0
- CGparameter Param = GetParam(asName, CG_FLOAT4);
- if(Param==NULL)return false;
-
- cgGLSetParameter4f(Param, afX, afY, afZ, afW);
-#endif
-
+ _shader->setUniform(asName.c_str(), {afX, afY, afZ});
return true;
}
//-----------------------------------------------------------------------
bool cCGProgram::SetMatrixf(const tString &asName, const cMatrixf &mMtx) {
-#if 0
- CGparameter Param = GetParam(asName, CG_FLOAT4x4);
- if(Param==NULL)return false;
-
- cgGLSetMatrixParameterfr(Param,&mMtx.m[0][0]);
-#endif
-
+ Math::Matrix4 mat4;
+ float *vals = mat4.getData();
+ for(int i = 0; i < 16; ++i)
+ vals[i] = mMtx.v[i];
+ _shader->setUniform(asName.c_str(), mat4);
return true;
}
//-----------------------------------------------------------------------
-
+//TODO: replace with normal setmatrix
bool cCGProgram::SetMatrixf(const tString &asName, eGpuProgramMatrix mType,
eGpuProgramMatrixOp mOp) {
-#if 0
- CGparameter Param = GetParam(asName, CG_FLOAT4x4);
- if(Param==NULL)return false;
-
- CGGLenum MtxType;
- CGGLenum OpType;
- switch(mType){
- case eGpuProgramMatrix_View: MtxType=CG_GL_MODELVIEW_MATRIX;break;
- case eGpuProgramMatrix_Projection: MtxType=CG_GL_PROJECTION_MATRIX;break;
- case eGpuProgramMatrix_Texture: MtxType=CG_GL_TEXTURE_MATRIX;break;
- case eGpuProgramMatrix_ViewProjection: MtxType=CG_GL_MODELVIEW_PROJECTION_MATRIX;break;
- }
- switch(mOp){
- case eGpuProgramMatrixOp_Identity: OpType=CG_GL_MATRIX_IDENTITY; break;
- case eGpuProgramMatrixOp_Inverse: OpType=CG_GL_MATRIX_INVERSE; break;
- case eGpuProgramMatrixOp_Transpose: OpType=CG_GL_MATRIX_TRANSPOSE; break;
- case eGpuProgramMatrixOp_InverseTranspose:OpType=CG_GL_MATRIX_INVERSE_TRANSPOSE; break;
- }
-
- cgGLSetStateMatrixParameter(Param,MtxType, OpType);
-#endif
-
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cCGProgram::SetTexture(const tString &asName, iTexture *apTexture, bool abAutoDisable) {
-#if 0
- CGtype textureType;
-
- if(apTexture)
- {
- switch(apTexture->GetTarget())
- {
- case eTextureTarget_1D: textureType = CG_SAMPLER1D; break;
- case eTextureTarget_2D: textureType = CG_SAMPLER2D; break;
- case eTextureTarget_CubeMap: textureType = CG_SAMPLERCUBE; break;
- case eTextureTarget_Rect: textureType = CG_SAMPLERRECT; break;
- }
-
- CGparameter Param = GetParam(asName, textureType);
- if(Param==NULL)return false;
-
- cSDLTexture* pSDLTex = static_cast<cSDLTexture*>(apTexture);
-
- //Log("Intializing Tex %s(%d): %d\n",cgGetParameterName(Param),
- // Param,pSDLTex->GetTextureHandle());
- cgGLSetTextureParameter(Param, pSDLTex->GetTextureHandle());
- cgGLEnableTextureParameter(Param);
- }
- else
- {
- CGparameter Param = GetParam(asName, CG_SAMPLER2D);
- if(Param==NULL)return false;
-
- cgGLDisableTextureParameter(Param);
- }
-#endif
-
+ if (mOp != eGpuProgramMatrixOp_Identity)
+ Hpl1::logError(Hpl1::kDebugOpenGL, "unsupported shader matrix %d", mOp);
+ SetMatrixf(asName, cMatrixf::Identity);
return true;
}
-//-----------------------------------------------------------------------
-
-bool cCGProgram::SetTextureToUnit(int alUnit, iTexture *apTexture) {
-#if 0
- if(mvTexUnitParam[alUnit]==NULL || alUnit >= MAX_TEXTUREUNITS) return false;
-
- cSDLTexture* pSDLTex = static_cast<cSDLTexture*>(apTexture);
-
- if(apTexture)
- {
- //Log("Intializing TexUnit %s(%d): %d\n",cgGetParameterName(mvTexUnitParam[alUnit]),
- // mvTexUnitParam[alUnit],pSDLTex->GetTextureHandle());
- cgGLSetTextureParameter(mvTexUnitParam[alUnit], pSDLTex->GetTextureHandle());
- cgGLEnableTextureParameter(mvTexUnitParam[alUnit]);
- }
- else
- {
- cgGLDisableTextureParameter(mvTexUnitParam[alUnit]);
- }
-#endif
-
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PROTECTED METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-CGparameter cCGProgram::GetParam(const tString &asName, CGtype aType) {
-#if 0
- CGparameter Param = cgGetNamedParameter(mProgram, asName.c_str());
- if(Param==NULL)return NULL;
-
- CGtype type= cgGetParameterType(Param);
- if(type!=aType)return NULL;
-
-#endif
- return 0;
-}
-
-//-----------------------------------------------------------------------
-
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/CGProgram.h b/engines/hpl1/engine/impl/CGProgram.h
index 5c90465dd6f..3fc0c99ff27 100644
--- a/engines/hpl1/engine/impl/CGProgram.h
+++ b/engines/hpl1/engine/impl/CGProgram.h
@@ -28,25 +28,19 @@
#ifndef HPL_CGPROGRAM_H
#define HPL_CGPROGRAM_H
-//#include <windows.h>
-#if 0
-#include <Cg/cg.h>
-#include <Cg/cgGL.h>
-#include <GL/GLee.h>
-#endif
-
#include "temp-types.h"
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "graphics/opengl/shader.h"
namespace hpl {
class cCGProgram : public iGpuProgram {
public:
- cCGProgram(tString asName, CGcontext aContext, eGpuProgramType aType);
- ~cCGProgram();
+ cCGProgram(const tString &vertex, const tString &fragment);
+ ~cCGProgram() = default;
bool reload();
void unload();
@@ -54,8 +48,6 @@ public:
tString GetProgramName() { return msName; }
- bool CreateFromFile(const tString &asFile, const tString &asEntry = "main");
-
void Bind();
void UnBind();
@@ -67,39 +59,12 @@ public:
bool SetMatrixf(const tString &asName, const cMatrixf &mMtx);
bool SetMatrixf(const tString &asName, eGpuProgramMatrix mType,
eGpuProgramMatrixOp mOp);
-
- bool SetTexture(const tString &asName, iTexture *apTexture, bool abAutoDisable = true);
- bool SetTextureToUnit(int alUnit, iTexture *apTexture);
-
- /// CG SPECIFIC //////////////////////
-
- CGprogram GetProgram() { return mProgram; }
- CGprofile GetProfile() { return mProfile; }
-
- static void SetVProfile(tString asProfile) {
- msForceVP = asProfile;
- }
- static void SetFProfile(tString asProfile) {
- msForceFP = asProfile;
- }
- static tString &GetVProfile() { return msForceVP; }
- static tString &GetFProfile() { return msForceFP; }
-
-protected:
- CGcontext mContext;
+private:
+ OpenGL::Shader *_shader;
tString msName;
tString msFile;
tString msEntry;
- CGprogram mProgram;
- CGprofile mProfile;
-
- CGparameter mvTexUnitParam[MAX_TEXTUREUNITS];
-
- CGparameter GetParam(const tString &asName, CGtype aType);
-
- static tString msForceFP;
- static tString msForceVP;
};
}; // namespace hpl
#endif // HPL_CGPROGRAM_H
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index f63d2dbe7bb..4374eba172b 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -355,8 +355,8 @@ FontData *cLowLevelGraphicsSDL::CreateFontData(const tString &asName) {
//-----------------------------------------------------------------------
-iGpuProgram *cLowLevelGraphicsSDL::CreateGpuProgram(const tString &asName, eGpuProgramType aType) {
- return hplNew(cCGProgram, (asName, 0, aType));
+iGpuProgram *cLowLevelGraphicsSDL::CreateGpuProgram(const tString &vertex, const tString &fragment) {
+ return hplNew(cCGProgram, (vertex, fragment));
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
index eb069021f19..c9ac621c7e3 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
@@ -95,7 +95,7 @@ public:
Graphics::PixelFormat *GetPixelFormat();
- iGpuProgram *CreateGpuProgram(const tString &asName, eGpuProgramType aType);
+ iGpuProgram *CreateGpuProgram(const tString &vertex, const tString &fragment);
void SaveScreenToBMP(const tString &asFile);
diff --git a/engines/hpl1/engine/resources/GpuProgramManager.cpp b/engines/hpl1/engine/resources/GpuProgramManager.cpp
index 8fd2ffaa696..9edfe515240 100644
--- a/engines/hpl1/engine/resources/GpuProgramManager.cpp
+++ b/engines/hpl1/engine/resources/GpuProgramManager.cpp
@@ -26,10 +26,12 @@
*/
#include "hpl1/engine/resources/GpuProgramManager.h"
+#include "hpl1/debug.h"
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/system/low_level_system.h"
+#include <cstddef>
namespace hpl {
@@ -71,37 +73,22 @@ iResourceBase *cGpuProgramManager::Create(const tString &asName) {
//-----------------------------------------------------------------------
-iGpuProgram *cGpuProgramManager::CreateProgram(const tString &asName, const tString &asEntry,
+iGpuProgram *cGpuProgramManager::CreateProgram(const tString &vertex, const tString &fragment,
eGpuProgramType aType) {
- return nullptr;
-#if 0
+ if (!mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_FragmentProgram))
+ return nullptr;
+
tString sPath;
iGpuProgram *pProgram;
- pProgram = static_cast<iGpuProgram *>(FindLoadedResource(asName, sPath));
-
- BeginLoad(asName);
-
- if (pProgram == NULL && sPath != "") {
- pProgram = mpLowLevelGraphics->CreateGpuProgram(asName, aType);
-
- if (pProgram->CreateFromFile(sPath, asEntry) == false) {
- Error("Couldn't create program '%s'\n", asName.c_str());
- hplDelete(pProgram);
- EndLoad();
- return NULL;
- }
-
+ pProgram = static_cast<iGpuProgram *>(FindLoadedResource(vertex + " " + fragment, sPath));
+ if (pProgram == nullptr) {
+ pProgram = mpLowLevelGraphics->CreateGpuProgram(vertex, fragment);
AddResource(pProgram);
}
- if (pProgram)
- pProgram->IncUserCount();
- else
- Error("Couldn't load program '%s'\n", asName.c_str());
+ pProgram->IncUserCount();
- EndLoad();
return pProgram;
-#endif
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/resources/GpuProgramManager.h b/engines/hpl1/engine/resources/GpuProgramManager.h
index 6407fc1adf5..765039c3c6c 100644
--- a/engines/hpl1/engine/resources/GpuProgramManager.h
+++ b/engines/hpl1/engine/resources/GpuProgramManager.h
@@ -50,7 +50,7 @@ public:
* \param aType type of the program
* \return
*/
- iGpuProgram *CreateProgram(const tString &asName, const tString &asEntry, eGpuProgramType aType);
+ iGpuProgram *CreateProgram(const tString &vertex, const tString &fragment, eGpuProgramType aType = eGpuProgramType_LastEnum);
void Destroy(iResourceBase *apResource);
void Unload(iResourceBase *apResource);
@@ -59,5 +59,7 @@ private:
iLowLevelGraphics *mpLowLevelGraphics;
};
+
+
}; // namespace hpl
#endif // HPL_GPU_PROGRAM_MANAGER_H
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index ef5363ef26b..537ccb163db 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -151,6 +151,7 @@ bool CheckSupport(cInit *apInit) {
#undef CG_CHECK
#endif
// Try compiling vertex shader
+#if 0
Log("Trying to load vertex program!\n");
iGpuProgram *pTestVtxProg = pLowLevelGraphics->CreateGpuProgram("Test", eGpuProgramType_Vertex);
if (pTestVtxProg->CreateFromFile("core/programs/Fallback01_Diffuse_Light_p1_vp.cg", "main") == false) {
@@ -171,7 +172,7 @@ bool CheckSupport(cInit *apInit) {
}
Log("Success!\n");
hplDelete(pTestVtxProg);
-
+#endif
return true;
}
@@ -394,8 +395,8 @@ bool cInit::Init(tString asCommandLine) {
Vars.AddBool("LowLevelSoundLogging", mpConfig->GetBool("Sound", "LowLevelLogging", false));
// Set CG Options
- cCGProgram::SetFProfile(mpConfig->GetString("Graphics", "ForceFP", "AUTO"));
- cCGProgram::SetVProfile(mpConfig->GetString("Graphics", "ForceVP", "AUTO"));
+ //cCGProgram::SetFProfile(mpConfig->GetString("Graphics", "ForceFP", "AUTO"));
+ //cCGProgram::SetVProfile(mpConfig->GetString("Graphics", "ForceVP", "AUTO"));
LowLevelGameSetup *pSetUp = NULL;
Commit: a8b8b5263fc15e319a4a4c613bf7e2f34f6be828
https://github.com/scummvm/scummvm/commit/a8b8b5263fc15e319a4a4c613bf7e2f34f6be828
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:40+01:00
Commit Message:
OPENGL: add hpl1 shaders directory in shader class
Changed paths:
graphics/opengl/shader.cpp
diff --git a/graphics/opengl/shader.cpp b/graphics/opengl/shader.cpp
index df8c99a5c92..e1031b71a80 100644
--- a/graphics/opengl/shader.cpp
+++ b/graphics/opengl/shader.cpp
@@ -91,6 +91,7 @@ static const GLchar *readFile(const Common::String &filename) {
SearchMan.addDirectory("STARK_SHADERS", "engines/stark", 0, 2);
SearchMan.addDirectory("WINTERMUTE_SHADERS", "engines/wintermute/base/gfx/opengl", 0, 2);
SearchMan.addDirectory("PLAYGROUND3D_SHADERS", "engines/playground3d", 0, 2);
+ SearchMan.addDirectory("HPL1_SHADERS", "engines/hpl1/engine/impl", 0, 2);
if (ConfMan.hasKey("extrapath")) {
SearchMan.addDirectory("EXTRA_PATH", Common::FSNode(ConfMan.get("extrapath")), 0, 2);
}
@@ -106,6 +107,7 @@ static const GLchar *readFile(const Common::String &filename) {
SearchMan.remove("WINTERMUTE_SHADERS");
SearchMan.remove("PLAYGROUND3D_SHADERS");
SearchMan.remove("EXTRA_PATH");
+ SearchMan.remove("HPL1_SHADERS");
const int32 size = file.size();
GLchar *shaderSource = new GLchar[size + 1];
Commit: 73bb027ee17a4439f1387f0ba069bb2a61554bdd
https://github.com/scummvm/scummvm/commit/73bb027ee17a4439f1387f0ba069bb2a61554bdd
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:03:40+01:00
Commit Message:
HPL1: Ported fix from HPL1R project. Don't scale refs.
This fixes a game breaking bug where scaled references would create
completely broken colliders and either disappear
or otherwise create⦠impossible geometry
Changed paths:
engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
index af3dedb838d..17552ef3f75 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
@@ -797,7 +797,8 @@ void cMeshLoaderCollada::LoadColladaScene(TiXmlElement *apRootElem, cColladaNode
if (apColladaLightVec && GetLight(pNode->msSource, *apColladaLightVec)) {
}
// Colliders do not use scale.
- else if (cString::ToLowerCase(cString::Sub(pNode->msName, 1, 8)) == "collider" || cString::ToLowerCase(cString::Sub(pNode->msName, 1, 12)) == "charcollider" || cString::ToLowerCase(cString::Sub(pNode->msName, 1, 4)) == "area") {
+ // Don't scale refs - ported from HPL1R project authored by zenmumbler
+ else if (cString::ToLowerCase(cString::Sub(pNode->msName, 1, 8)) == "collider" || cString::ToLowerCase(cString::Sub(pNode->msName, 1, 12)) == "charcollider" || cString::ToLowerCase(cString::Sub(pNode->msName, 1, 4)) == "area" || cString::ToLowerCase(cString::Sub(pNode->msName, 1, 3)) == "ref") {
}
// This a geometry node (or something else..). Apply scale as normal
Commit: cdfd9643d60297acf99666ceaf6f10dfeea20a6d
https://github.com/scummvm/scummvm/commit/cdfd9643d60297acf99666ceaf6f10dfeea20a6d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:41+01:00
Commit Message:
HPL1: move and fix game shaders
Changed paths:
A engines/hpl1/engine/impl/shaders/Ambient_Color.fragment
A engines/hpl1/engine/impl/shaders/Bump2D_Light.fragment
A engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
A engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
A engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
A engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.fragment
A engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
A engines/hpl1/engine/impl/shaders/BumpSpec_Light.fragment
A engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
A engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot_pass2.fragment
A engines/hpl1/engine/impl/shaders/Bump_Light.fragment
A engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
A engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
A engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
A engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
A engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
A engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
A engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
A engines/hpl1/engine/impl/shaders/Diffuse_Color.fragment
A engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
A engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
A engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
A engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
A engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
A engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
A engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
A engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass1.fragment
A engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
A engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
A engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
A engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
A engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
A engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
A engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
A engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
A engines/hpl1/engine/impl/shaders/Fog_Solid.fragment
A engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
A engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
A engines/hpl1/engine/impl/shaders/Fog_Trans_Alpha.fragment
A engines/hpl1/engine/impl/shaders/Fog_Trans_Mod.fragment
A engines/hpl1/engine/impl/shaders/Fog_Trans_ModX2.fragment
A engines/hpl1/engine/impl/shaders/PostEffect_Bloom.fragment
A engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
A engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
A engines/hpl1/engine/impl/shaders/PostEffect_Blur_2D.fragment
A engines/hpl1/engine/impl/shaders/PostEffect_Blur_Rect.fragment
A engines/hpl1/engine/impl/shaders/PostEffect_DoF.fragment
A engines/hpl1/engine/impl/shaders/PostEffect_DoF.vertex
A engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_2D.fragment
A engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_Rect.fragment
A engines/hpl1/engine/impl/shaders/PostEffect_Motion.fragment
A engines/hpl1/engine/impl/shaders/PostEffect_Motion.vertex
A engines/hpl1/engine/impl/shaders/PostEffect_Motion_staticloop.fragment
A engines/hpl1/engine/impl/shaders/PostEffect_Offset.fragment
A engines/hpl1/engine/impl/shaders/PostEffect_Offset.vertex
A engines/hpl1/engine/impl/shaders/ShadowExtrude.fragment
A engines/hpl1/engine/impl/shaders/ShadowExtrude.vertex
A engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
A engines/hpl1/engine/impl/shaders/Water_Fog.vertex
A engines/hpl1/engine/impl/shaders/refract.fragment
A engines/hpl1/engine/impl/shaders/refract.vertex
A engines/hpl1/engine/impl/shaders/refract_special.fragment
A engines/hpl1/engine/impl/shaders/refract_water.fragment
A engines/hpl1/engine/impl/shaders/refract_water.vertex
R engines/hpl1/engine/impl/glsl_shaders/Ambient_Color.fragment
R engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.fragment
R engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.vertex
R engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light.fragment
R engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light_Spot.fragment
R engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.fragment
R engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.vertex
R engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light.fragment
R engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot.fragment
R engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot_pass2.fragment
R engines/hpl1/engine/impl/glsl_shaders/Bump_Light.fragment
R engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot.fragment
R engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot_pass2.fragment
R engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.fragment
R engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.vertex
R engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.fragment
R engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.vertex
R engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot_pass2.fragment
R engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.fragment
R engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.vertex
R engines/hpl1/engine/impl/glsl_shaders/Diffuse_ColorMul.vertex
R engines/hpl1/engine/impl/glsl_shaders/Diffuse_EnvMap_Reflect.vertex
R engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.fragment
R engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.vertex
R engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.fragment
R engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.vertex
R engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass1.fragment
R engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass2.fragment
R engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
R engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p1.vertex
R engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p2.vertex
R engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
R engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
R engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p1.vertex
R engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p2.vertex
R engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.fragment
R engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.vertex
R engines/hpl1/engine/impl/glsl_shaders/Fog_Trans.vertex
R engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Alpha.fragment
R engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Mod.fragment
R engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_ModX2.fragment
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.fragment
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.vertex
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur.vertex
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_2D.fragment
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_Rect.fragment
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.fragment
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.vertex
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_2D.fragment
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_Rect.fragment
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.fragment
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.vertex
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion_staticloop.fragment
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.fragment
R engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.vertex
R engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.fragment
R engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.vertex
R engines/hpl1/engine/impl/glsl_shaders/Water_Diffuse.vertex
R engines/hpl1/engine/impl/glsl_shaders/Water_Fog.vertex
R engines/hpl1/engine/impl/glsl_shaders/refract.fragment
R engines/hpl1/engine/impl/glsl_shaders/refract.vertex
R engines/hpl1/engine/impl/glsl_shaders/refract_special.fragment
R engines/hpl1/engine/impl/glsl_shaders/refract_water.fragment
R engines/hpl1/engine/impl/glsl_shaders/refract_water.vertex
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Bump_Light.fragment b/engines/hpl1/engine/impl/glsl_shaders/Bump_Light.fragment
deleted file mode 100644
index 83e22791b95..00000000000
--- a/engines/hpl1/engine/impl/glsl_shaders/Bump_Light.fragment
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2006-2010 (C) - Frictional Games
-//
-// This file is part of HPL1 Engine
-//
-// For conditions of distribution and use, see copyright notice in LICENSE-shaders
-//
-
-///////////////////////////////////////////////////////
-/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
-///////////////////////////////////////////////////////
-
-in vec4 vPos; //in projection space
-in vec4 vLightColor;
-in vec2 vUv;
-in vec3 vLightDir;
-
-OUTPUT
-
-uniform sampler2D diffuseMap = 0;
-uniform sampler2D normalMap = 1;
-uniform samplerCube normalCubeMap = 2;
-uniform sampler1D falloffMap = 3;
-
-void main()
-{
- float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
-
- vec4 bumpVec = (2*texture(normalMap, vUv)-1);
- vec4 lightVec = (2.0*textureCube(normalCubeMap,vLightDir)-1.0);
-
- outColor.xyz = texture(diffuseMap, vUv).xyz * vLightColor.xyz * attenuation * dot(lightVec.xyz,bumpVec.xyz);
- outColor.w = 0;
-}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot.fragment b/engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot.fragment
deleted file mode 100644
index a66710eec26..00000000000
--- a/engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot.fragment
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2006-2010 (C) - Frictional Games
-//
-// This file is part of HPL1 Engine
-//
-// For conditions of distribution and use, see copyright notice in
-// LICENSE-shaders
-//
-
-///////////////////////////////////////////////////////
-/// BUMP SPOTLIGHTING FRAGMENT PROGRAM /////////////
-///////////////////////////////////////////////////////
-
-in vec4 vPos; // in projection space
-in vec4 vLightColor;
-in vec2 vUv;
-in vec3 vLightDir;
-in vec3 vSpotlightUv;
-
-OUTPUT
-
-uniform sampler2D diffuseMap;
-uniform sampler2D normalMap;
-uniform samplerCube normalCubeMap;
-uniform sampler1D falloffMap;
-uniform sampler2D spotlightMap;
-uniform sampler1D spotNegRejectMap;
-
-void main() {
- vec3 diffuse = texture(diffuseMap, vUv).xyz;
-
- vec3 bumpVec = (2 * texture(normalMap, vUv) - 1).xyz;
- vec3 lightVec = (2.0 * textureCube(normalCubeMap, vLightDir) - 1.0).xyz;
-
- float attenuation = texture1D(falloffMap, dot(vLightDir, vLightDir)).x;
- vec3 spotColor =
- texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z).xyz; // CHECK
- float rejectNeg = texture1D(spotNegRejectMap, vSpotlightUv.z + 0.5).x;
- outColor.xyz = diffuse * dot(lightVec, bumpVec) * attenuation *
- vLightColor.xyz * spotColor * rejectNeg;
-}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.fragment b/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.fragment
deleted file mode 100644
index d1ce26c5255..00000000000
--- a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.fragment
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2006-2010 (C) - Frictional Games
-//
-// This file is part of HPL1 Engine
-//
-// For conditions of distribution and use, see copyright notice in LICENSE-shaders
-//
-
-///////////////////////////////////////////////////////
-/// DIFFUSE SPOT LIGHTING FRAGMENT PROGRAM /////////////
-///////////////////////////////////////////////////////
-
-in vec4 vPos; //in projection space
-in vec4 vLightColor;
-in vec2 vUv;
-in vec3 vLightDir;
-in vec3 vSpotlightUv;
-
-OUTPUT
-
-uniform sampler2D diffuseMap = 0;
-uniform samplerCube normalCubeMap = 2;
-uniform sampler1D falloffMap = 3;
-uniform sampler2D spotlightMap = 4;
-uniform sampler1D spotNegRejectMap = 5;
-
-void main()
-{
- vec3 diffuse = texture(diffuseMap, vUv).xyz;
- vec3 lightNormal = (2.0*textureCube(normalCubeMap,vLightDir)-vec3(1.0)).xyz;
- float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
- vec3 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z).xyz;
- float rejectNeg = texture1D(spotNegRejectMap,vSpotlightUv.z + 0.5).x;
-
- outColor.xyz = diffuse * dot(lightNormal, vec3(0,0,1)) * attenuation *
- vLightColor.xyz * spotColor * rejectNeg;
-}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Ambient_Color.fragment b/engines/hpl1/engine/impl/shaders/Ambient_Color.fragment
similarity index 84%
rename from engines/hpl1/engine/impl/glsl_shaders/Ambient_Color.fragment
rename to engines/hpl1/engine/impl/shaders/Ambient_Color.fragment
index 03bdbfbe4ca..107911d776c 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Ambient_Color.fragment
+++ b/engines/hpl1/engine/impl/shaders/Ambient_Color.fragment
@@ -9,17 +9,16 @@
/// AMBIENT DIFFUSE COLOR FRAG PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 vPos;
in vec4 vLightColor;
in vec2 vUv;
OUTPUT
-uniform sampler2D diffuseMap;
+uniform sampler2D tex0; //diffuseMap
uniform vec3 ambientColor;
void main()
{
- outColor = texture(diffuseMap, vUv);
+ outColor = texture(tex0, vUv);
outColor.xyz *= ambientColor;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.fragment b/engines/hpl1/engine/impl/shaders/Bump2D_Light.fragment
similarity index 73%
rename from engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.fragment
rename to engines/hpl1/engine/impl/shaders/Bump2D_Light.fragment
index 2f7b66774f4..7c9fa21a563 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/Bump2D_Light.fragment
@@ -9,7 +9,6 @@
/// SPECULAR BUMPMAPPING 2D FRAGMENT PROGRAM //////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vColor;
in vec3 vUv; //in object space
in vec3 vLightDir;
@@ -17,13 +16,13 @@ in vec2 vScreenPos;
OUTPUT
-uniform sampler2D NormalMap = 0;
-uniform sampler2D LightMap = 1;
+uniform sampler2D tex0; //NormalMap
+uniform sampler2D tex1; //LightMap
void main()
{
- vec4 BumpVec = (1 - 2*texture(NormalMap, vUv));
- vec4 LightCol = texture(LightMap,vScreenPos);
+ vec4 BumpVec = (1 - 2*texture(tex0, vUv));
+ vec4 LightCol = texture(tex1,vScreenPos);
float Diffuse = dot(vLightDir,BumpVec.xyz)*LightCol.x;
outColor.xyz = Diffuse*vColor.xyz;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.vertex b/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
similarity index 89%
rename from engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.vertex
rename to engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
index 4e99aa38976..d15d72b2b79 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Bump2D_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
@@ -9,11 +9,11 @@
/// BUMPMAPPING 2D VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 uv;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 uv = gl_TexCoord[0].xyz;
+
-out vec4 vPos;
out vec4 vColor;
out vec3 vUv;
out vec3 vLighDir;
@@ -41,7 +41,7 @@ void main()
vLighDir.z = -LightPos.z;
vLighDir = normalize(vLighDir);
- vPos = worldViewProj * position;
+ gl_Position = worldViewProj * position;
vColor = LightColor;
vUv = uv;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light.fragment b/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
similarity index 59%
rename from engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light.fragment
rename to engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
index 63a01b24ed8..4040200f4e1 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
@@ -9,7 +9,6 @@
/// BUMP COLOR SPECULAR LIGHTING FRAGMENT PROGRAM ///////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
@@ -17,17 +16,17 @@ in vec3 vHalfVec;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform sampler2D normalMap = 1;
-uniform samplerCube normalCubeMap = 2;
-uniform sampler1D falloffMap = 3;
-uniform sampler2D specularMap = 6;
+uniform sampler2D tex0; //diffuseMap
+uniform sampler2D tex1; //normalMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler1D tex3; //falloffMap
+uniform sampler2D tex4; //specularMap
void main()
{
- float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
+ float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
- vec3 bumpVec = texture(normalMap, vUv).xyz;
+ vec3 bumpVec = texture(tex1, vUv).xyz;
bumpVec.xyz = (2.0*bumpVec.xyz)-vec3(1.0);
vLightDir = normalize(vLightDir);
@@ -36,7 +35,7 @@ void main()
float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w;
- outColor.xyz = texture(diffuseMap, vUv).xyz * vLightColor.xyz * dot(vLightDir, bumpVec.xyz)
- + (specular * texture(specularMap, vUv).xyz);
+ outColor.xyz = texture(tex0, vUv).xyz * vLightColor.xyz * dot(vLightDir, bumpVec.xyz)
+ + (specular * texture(tex4, vUv).xyz);
outColor.xyz *= attenuation;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
similarity index 54%
rename from engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light_Spot.fragment
rename to engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
index e4d84f254ff..23ab725071e 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/BumpColorSpec_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE COLOR SPOTLIGHTING FRAGMENT PROGRAM /////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
@@ -18,30 +17,30 @@ in vec3 vSpotlightUv;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform sampler2D normalMap = 1;
-uniform samplerCube normalCubeMap = 2;
-uniform sampler1D falloffMap = 3;
-uniform sampler2D spotlightMap = 4;
-uniform sampler1D spotNegRejectMap = 5;
-uniform sampler2D specularMap = 6;
+uniform sampler2D tex0; //diffuseMap
+uniform sampler2D tex1; //normalMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler1D tex3; //falloffMap
+uniform sampler2D tex4; //spotlightMap
+uniform sampler1D tex5; //spotNegRejectMap
+uniform sampler2D tex6; //specularMap
void main()
{
- vec3 diffuse = texture(diffuseMap, vUv).xyz;
+ vec3 diffuse = texture(tex0, vUv).xyz;
- vec3 bumpVec = (2.0*texture(normalMap, vUv)-vec3(1.0)).xyz;
+ vec3 bumpVec = (2.0*texture(normalMap, vUv)-vec4(1.0)).xyz;
vec3 lightVec = normalize(vLightDir);
vHalfVec = normalize(vHalfVec);
- float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
- vec4 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z); // CHECK
- float rejectNeg = texture1D(spotNegRejectMap,vSpotlightUv.z + 0.5).x;
+ float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
+ vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.z); // CHECK
+ float rejectNeg = texture1D(tex5,vSpotlightUv.z + 0.5).x;
float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
specular = pow(specular, 16.0)* vLightColor.w * spotColor.w;
outColor.xyz = diffuse * dot(lightVec, bumpVec.xyz) * vLightColor.xyz * spotColor.xyz
- + (specular * texture(specularMap, vUv).xyz);
+ + (specular * texture(tex6, vUv).xyz);
outColor.xyz *= attenuation * rejectNeg;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.fragment b/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.fragment
similarity index 78%
rename from engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.fragment
rename to engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.fragment
index 7aff349fde4..3548d4d44bf 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.fragment
@@ -10,7 +10,6 @@
/// SPECULAR BUMPMAPPING 2D FRAGMENT PROGRAM //////////
///////////////////////////////////////////////////////
-in vec4 vPos; // in projection space
in vec4 vColor;
in vec3 vUv; // in object space
in vec3 vLightDir;
@@ -19,13 +18,13 @@ in vec2 vScreenPos;
OUTPUT
-uniform sampler2D NormalMap = 0;
-uniform sampler2D LightMap = 1;
+uniform sampler2D tex0; //NormalMap
+uniform sampler2D tex1; //LightMap
void main() {
- vec4 BumpVec = (vec3(1.0) - 2.0 * texture(NormalMap, uv));
+ vec4 BumpVec = (vec4(1.0) - 2.0 * texture(tex0, uv));
- vec4 LightCol = texture(LightMap, vScreenPos);
+ vec4 LightCol = texture(tex1, vScreenPos);
BumpVec.xyz = normalize(BumpVec.xyz);
float Diffuse = dot(normalize(vLightDir), BumpVec.xyz) * LightCol.x;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.vertex b/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
similarity index 92%
rename from engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.vertex
rename to engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
index b8947429304..eb8c917d09b 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec2D_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
@@ -9,11 +9,11 @@
/// SPECULAR BUMPMAPPING 2D VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 uv;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 uv = gl_TexCoord[0].xyz;
+
-out vec4 vPos;
out vec4 vColor
out vec3 vUv;
out vec3 vLighDir;
@@ -59,7 +59,7 @@ void main()
vHalfVec = normalize(vHalfVec);
vHalfVec = normalize(vHalfVec + vLighDir);
- vPos = worldViewProj * position;
+ gl_Position = worldViewProj * position;
vColor = LightColor;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light.fragment b/engines/hpl1/engine/impl/shaders/BumpSpec_Light.fragment
similarity index 65%
rename from engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light.fragment
rename to engines/hpl1/engine/impl/shaders/BumpSpec_Light.fragment
index ea188f88a82..30365246455 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec_Light.fragment
@@ -9,7 +9,6 @@
/// BUMP SPECULAR LIGHTING FRAGMENT PROGRAM ///////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
@@ -17,16 +16,16 @@ in vec3 vHalfVec;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform sampler2D normalMap = 1;
-uniform samplerCube normalCubeMap = 2;
-uniform sampler1D falloffMap = 3;
+uniform sampler2D tex0; //diffuseMap
+uniform sampler2D tex1; //normalMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler1D tex3; //falloffMap
void main()
{
- float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
+ float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
- vec4 bumpVec = texture(normalMap, vUv);
+ vec4 bumpVec = texture(tex1, vUv);
bumpVec.xyz = (2.0*bumpVec.xyz)-vec3(1.0);
vLightDir = normalize(vLightDir);
@@ -35,7 +34,7 @@ void main()
float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w * clamp(bumpVec.w, 0.0, 1.0);
- outColor.xyz = texture(diffuseMap, vUv).xyz * vLightColor.xyz * dot(vLightDir, bumpVec.xyz) +
+ outColor.xyz = texture(tex0, vUv).xyz * vLightColor.xyz * dot(vLightDir, bumpVec.xyz) +
specular;
outColor.xyz *= attenuation;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
similarity index 52%
rename from engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot.fragment
rename to engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
index d1949196815..659349d62ee 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE SPOTLIGHTING FRAGMENT PROGRAM /////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
@@ -18,30 +17,30 @@ in vec3 vSpotlightUv;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform sampler2D normalMap = 1;
-uniform samplerCube normalCubeMap = 2;
-uniform sampler1D falloffMap = 3;
-uniform sampler2D spotlightMap = 4;
-uniform sampler1D spotNegRejectMap = 5;
+uniform sampler2D tex0; //diffuseMap
+uniform sampler2D tex1; //normalMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler1D tex3; //falloffMap
+uniform sampler2D tex4; //spotlightMap
+uniform sampler1D tex5; //spotNegRejectMap
void main()
{
- vec3 diffuse = texture(diffuseMap, vUv).xyz;
-
- vec4 bumpVec = texture(normalMap, vUv);
+ vec3 diffuse = texture(tex0, vUv).xyz;
+
+ vec4 bumpVec = texture(tex1, vUv);
bumpVec.xyz = (2.0*bumpVec.xyz)-vec3(1.0);
- vec3 lightVec = normalize(vLightDir);//(2*textureCube(normalCubeMap,vLightDir)-1).xyz;
- vHalfVec = normalize(vHalfVec);//(2*textureCube(normalCubeMap,vHalfVec)-1).xyz;
-
- float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
- vec4 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z);
- float rejectNeg = texture1D(spotNegRejectMap,vSpotlightUv.z + 0.5).x;
+ vec3 lightVec = normalize(vLightDir);//(2*textureCube(tex2,vLightDir)-1).xyz;
+ vHalfVec = normalize(vHalfVec);//(2*textureCube(tex2,vHalfVec)-1).xyz;
+
+ float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
+ vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.z);
+ float rejectNeg = texture1D(tex5,vSpotlightUv.z + 0.5).x;
float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w * clamp(bumpVec.w, 0.0, 1.0) * clamp(spotColor.w, 0.0, 1.0);
-
+
outColor.xyz = diffuse * dot(lightVec, bumpVec.xyz) * vLightColor.xyz * spotColor.xyz +
specular;
outColor.xyz *= attenuation * rejectNeg;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot_pass2.fragment
similarity index 61%
rename from engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot_pass2.fragment
rename to engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot_pass2.fragment
index dd361193d73..771da361b1f 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/BumpSpec_Light_Spot_pass2.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot_pass2.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE SPOTLIGHTING FRAGMENT PROGRAM /////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
@@ -18,22 +17,22 @@ in vec3 vSpotlightUv;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform sampler2D normalMap = 1;
-uniform samplerCube normalCubeMap = 2;
-uniform sampler2D spotlightMap = 3;
+uniform sampler2D tex0; //diffuseMap
+uniform sampler2D tex1; //normalMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler2D tex3; //spotlightMap
void main()
{
- vec3 diffuse = texture(diffuseMap, vUv).xyz;
+ vec3 diffuse = texture(tex0, vUv).xyz;
- vec4 bumpVec = texture(normalMap, vUv);
+ vec4 bumpVec = texture(tex1, vUv);
bumpVec.xyz = (2.0*bumpVec.xyz)-vec3(1.0);
- vec3 lightVec = (2.0*textureCube(normalCubeMap,vLightDir)-vec3(1.0)).xyz;
- vHalfVec = (2.0*textureCube(normalCubeMap,vHalfVec)-vec3(1.0)).xyz;
+ vec3 lightVec = (2.0*textureCube(tex2,vLightDir)-vec4(1.0)).xyz;
+ vHalfVec = (2.0*textureCube(tex2,vHalfVec)-vec4(1.0)).xyz;
- vec4 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z); // CHECK
+ vec4 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.z); // CHECK
float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w * clamp(bumpVec.w, 0.0, 1.0) * clamp(spotColor.w, 0.0, 1.0);
diff --git a/engines/hpl1/engine/impl/shaders/Bump_Light.fragment b/engines/hpl1/engine/impl/shaders/Bump_Light.fragment
new file mode 100644
index 00000000000..67e8972ccfe
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Bump_Light.fragment
@@ -0,0 +1,32 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
+///////////////////////////////////////////////////////
+
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+
+OUTPUT
+
+uniform sampler2D tex0; //diffuseMap
+uniform sampler2D tex1; //normalMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler1D tex3; //falloffMap
+
+void main()
+{
+ float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
+
+ vec4 bumpVec = (2*texture(tex1, vUv)-1);
+ vec4 lightVec = (2.0*textureCube(tex2,vLightDir)-1.0);
+
+ outColor.xyz = texture(tex0, vUv).xyz * vLightColor.xyz * attenuation * dot(lightVec.xyz,bumpVec.xyz);
+ outColor.w = 0;
+}
diff --git a/engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
new file mode 100644
index 00000000000..9c423ccaae7
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
@@ -0,0 +1,39 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in
+// LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// BUMP SPOTLIGHTING FRAGMENT PROGRAM /////////////
+///////////////////////////////////////////////////////
+
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler2D tex0; //diffuseMap
+uniform sampler2D tex1; //normalMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler1D tex3; //falloffMap
+uniform sampler2D tex4; //spotlightMap
+uniform sampler1D tex5; //spotNegRejectMap
+
+void main() {
+ vec3 diffuse = texture(tex0, vUv).xyz;
+
+ vec3 bumpVec = (2 * texture(tex1, vUv) - 1).xyz;
+ vec3 lightVec = (2.0 * textureCube(tex2, vLightDir) - 1.0).xyz;
+
+ float attenuation = texture1D(tex3, dot(vLightDir, vLightDir)).x;
+ vec3 spotColor =
+ texture(tex4, vSpotlightUv.xy / vSpotlightUv.z).xyz; // CHECK
+ float rejectNeg = texture1D(tex5, vSpotlightUv.z + 0.5).x;
+ outColor.xyz = diffuse * dot(lightVec, bumpVec) * attenuation *
+ vLightColor.xyz * spotColor * rejectNeg;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
similarity index 51%
rename from engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot_pass2.fragment
rename to engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
index 9f7f3c1c0fa..9cac7c0bd93 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Bump_Light_Spot_pass2.fragment
+++ b/engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
@@ -10,7 +10,6 @@
/// BUMP SPOTLIGHTING FRAGMENT PROGRAM /////////////
///////////////////////////////////////////////////////
-in vec4 vPos; // in projection space
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
@@ -18,16 +17,16 @@ in vec3 vSpotlightUv;
OUTPUT
-uniform sampler2D diffuseMap = 0; //: TEXUNIT0,
-uniform sampler2D normalMap = 1; //: TEXUNIT1,
-uniform samplerCube normalCubeMap = 2; //: TEXUNIT2,
-uniform sampler2D spotlightMap = 3; //: TEXUNIT3
+uniform sampler2D tex0; //diffuseMap
+uniform sampler2D tex1; //normalMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler2D tex3; //spotlightMap
void main() {
- vec3 diffuse = texture(diffuseMap, vUv).xyz;
- vec3 bumpVec = (2.0 * texture(normalMap, vUv) - vec3(1.0)).xyz;
- vec3 lightVec = (2.0 * textureCube(normalCubeMap, vLightDir) - vec3(1.0)).xyz;
+ vec3 diffuse = texture(tex0, vUv).xyz;
+ vec3 bumpVec = (2.0 * texture(tex1, vUv) - vec4(1.0)).xyz;
+ vec3 lightVec = (2.0 * textureCube(tex2, vLightDir) - vec4(1.0)).xyz;
vec3 spotColor =
- texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z).xyz; // CHECK
+ texture(tex3, vSpotlightUv.xy / vSpotlightUv.z).xyz; // CHECK
outColor.xyz = diffuse * dot(lightVec, bumpVec) * vLightColor.xyz * spotColor;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.fragment b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
similarity index 54%
rename from engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.fragment
rename to engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
index b085fda352d..95c1e9feef1 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE SPECULAR LIGHTING FRAGMENT PROGRAM ////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
@@ -17,20 +16,20 @@ in vec3 vHalfVec;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform samplerCube normalCubeMap = 2;
-uniform sampler1D falloffMap = 3;
+uniform sampler2D tex0; //diffuseMap
+uniform samplerCube tex1; //normalCubeMap
+uniform sampler1D tex2; //falloffMap
void main()
{
- float attenuation = texture1D(falloffMap, dot(vLightDir,vLightDir)).x;
+ float attenuation = texture1D(tex2, dot(vLightDir,vLightDir)).x;
- vLightDir = normalize(vLightDir);//(2*textureCube(normalCubeMap,vLightDir)-1).xyz;
- vHalfVec = normalize(vHalfVec);//(2*textureCube(normalCubeMap,vHalfVec)-1).xyz;
+ vLightDir = normalize(vLightDir);//(2*textureCube(tex1,vLightDir)-1).xyz;
+ vHalfVec = normalize(vHalfVec);//(2*textureCube(tex1,vHalfVec)-1).xyz;
float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w;
- outColor.xyz = specular + texture(diffuseMap, vUv).xyz * vLightColor.xyz * dot(normalize(vLightDir), vec3(0,0,1));
+ outColor.xyz = specular + texture(tex0, vUv).xyz * vLightColor.xyz * dot(normalize(vLightDir), vec3(0,0,1));
outColor.xyz = outColor.xyz * attenuation;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
similarity index 88%
rename from engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.vertex
rename to engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
index 5a523a39dcc..5ea4fd6858b 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
@@ -9,12 +9,12 @@
/// DIFFUSE SPECULAR LIGHTING VERTEX PROGRAM //////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 uv;
-in vec4 tangent;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 uv = gl_TexCoord[0].xyz;
+vec4 tangent = gl_TexCoord[1];
+
-out vec4 vPos;
out vec4 vLightColor;
out vec3 vUv;
out vec3 vLighDir;
@@ -28,7 +28,7 @@ uniform vec3 LightDirMul;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vUv = uv;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
similarity index 53%
rename from engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.fragment
rename to engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
index 09503d56a00..659fc90f0cb 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE SPECULAR SPOTLIGHTING FRAGMENT PROGRAM /////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
@@ -18,22 +17,22 @@ in vec3 vSpotlightUv;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform samplerCube normalCubeMap = 2;
-uniform sampler1D falloffMap = 3;
-uniform sampler2D spotlightMap = 4;
-uniform sampler1D spotNegRejectMap = 5;
+uniform sampler2D tex0; //diffuseMap
+uniform samplerCube tex1; //normalCubeMap
+uniform sampler1D tex2; //falloffMap
+uniform sampler2D tex3; //spotlightMap
+uniform sampler1D tex4; //spotNegRejectMap
void main()
{
- vec3 diffuse = texture(diffuseMap, vUv).xyz;
+ vec3 diffuse = texture(tex0, vUv).xyz;
- vec3 lightNormal = normalize(vLightDir);//(2*textureCube(normalCubeMap,vLightDir)-1).xyz;
- vHalfVec = normalize(vHalfVec);//(2*textureCube(normalCubeMap,vHalfVec)-1).xyz;
+ vec3 lightNormal = normalize(vLightDir);//(2*textureCube(tex1,vLightDir)-1).xyz;
+ vHalfVec = normalize(vHalfVec);//(2*textureCube(tex1,vHalfVec)-1).xyz;
- float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
- vec4 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z);
- float rejectNeg = texture1D(spotNegRejectMap,vSpotlightUv.z + 0.5).x;
+ float attenuation = texture1D(tex2,dot(vLightDir,vLightDir)).x;
+ vec4 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.z);
+ float rejectNeg = texture1D(tex4,vSpotlightUv.z + 0.5).x;
float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w * spotColor.w;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
similarity index 88%
rename from engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.vertex
rename to engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
index 1fbc4eaf236..53456a12c5e 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
@@ -9,12 +9,12 @@
/// DIFFUSE SPECUALR SPOT LIGHTING VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 uv;
-in vec4 tangent;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 uv = gl_TexCoord[0].xyz;
+vec4 tangent = gl_TexCoord[1];
+
-out vec4 vPos;
out vec4 vLightColor;
out vec3 vUv;
out vec3 vLighDir;
@@ -31,7 +31,7 @@ uniform vec3 LightDirMul;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vUv = uv;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
similarity index 63%
rename from engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot_pass2.fragment
rename to engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
index ead14f6b5f6..b3af568da45 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/DiffuseSpec_Light_Spot_pass2.fragment
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE SPECULAR SPOTLIGHTING FRAGMENT PROGRAM /////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
@@ -18,18 +17,18 @@ in vec3 vSpotlightUv;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform samplerCube normalCubeMap = 2;
-uniform sampler2D spotlightMap = 3;
+uniform sampler2D tex0; //diffuseMap
+uniform samplerCube tex1; //normalCubeMap
+uniform sampler2D tex2; //spotlightMap
void main()
{
- vec3 diffuse = texture(diffuseMap, vUv).xyz;
+ vec3 diffuse = texture(tex0, vUv).xyz;
- vec3 lightNormal = (2.0*textureCube(normalCubeMap,vLightDir)-vec3(1.0)).xyz;
- vHalfVec = (2.0*textureCube(normalCubeMap,vHalfVec)-vec3(1.0)).xyz;
+ vec3 lightNormal = (2.0*textureCube(tex1,vLightDir)-vec4(1.0)).xyz;
+ vHalfVec = (2.0*textureCube(tex1,vHalfVec)-vec4(1.0)).xyz;
- vec4 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z);
+ vec4 spotColor = texture(tex2, vSpotlightUv.xy / vSpotlightUv.z);
float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w * spotColor.w;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Color.fragment
similarity index 77%
rename from engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.fragment
rename to engines/hpl1/engine/impl/shaders/Diffuse_Color.fragment
index 5d267c71c42..64363a8a4b7 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.fragment
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Color.fragment
@@ -9,15 +9,14 @@
/// SIMPLE DIFFUSE COLOR FRAGMENT PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vColor;
in vec2 vUv;
OUTPUT
-uniform sampler2D diffuseMap = 0;
+uniform sampler2D tex0; //diffuseMap;
void main()
{
- outColor = texture(diffuseMap, vUv) * vColor;
+ outColor = texture(tex0, vUv) * vColor;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
similarity index 78%
rename from engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.vertex
rename to engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
index 8790f5cb89e..02bbf93646e 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Color.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
@@ -9,11 +9,10 @@
/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec4 color;
-in vec2 uv;
+vec4 position = gl_Vertex;
+vec4 color = gl_Color;
+vec2 uv = gl_TexCoord[0].xy;
-out vec4 vPos;
out vec4 vColor;
out vec2 vUv;
@@ -21,7 +20,7 @@ uniform mat4 worldViewProj;
void main()
{
- vPos = worldViewProj * position;
+ gl_Position = worldViewProj * position;
vColor = color;
vUv = uv;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_ColorMul.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
similarity index 78%
rename from engines/hpl1/engine/impl/glsl_shaders/Diffuse_ColorMul.vertex
rename to engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
index 50b1fd4dca6..ac7679232cf 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_ColorMul.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
@@ -9,11 +9,11 @@
/// DIFFUSE COLOR MUL VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 color;
-in vec3 uv;
+vec4 position = gl_Vertex;
+vec3 color = gl_Color.xyz;
+vec3 uv = gl_TexCoord[0].xyz;
+
-out vec4 vPos;
out vec3 vColor;
out vec3 vUv;
@@ -22,7 +22,7 @@ uniform vec4 colorMul;
void main()
{
- vPos = worldViewProj * position;
+ gl_Position = worldViewProj * position;
vColor = color * colorMul;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_EnvMap_Reflect.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
similarity index 82%
rename from engines/hpl1/engine/impl/glsl_shaders/Diffuse_EnvMap_Reflect.vertex
rename to engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
index dbbabe363a9..f61c2e94dc8 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_EnvMap_Reflect.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
@@ -9,12 +9,11 @@
/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 color;
-in vec3 uv;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 color = gl_Color.xyz;
+vec3 uv = gl_TexCoord[0].xyz;
-out vec4 vPos;
out vec3 vColor;
out vec3 vUv;
out vec3 vUv2;
@@ -25,7 +24,7 @@ uniform vec3 eyeWorldPos;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vColor = color;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
similarity index 52%
rename from engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.fragment
rename to engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
index a2fae530110..8e910508d8e 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
@@ -9,23 +9,22 @@
/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-vec4 vPos; //in projection space
vec4 vLightColor;
vec2 vUv;
vec3 vLightDir;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform samplerCube normalCubeMap = 2;
-uniform sampler1D falloffMap = 3;
+uniform sampler2D tex0; //diffuseMap
+uniform samplerCube tex1; //normalCubeMap
+uniform sampler1D tex2; //falloffMap
void main()
{
- float attenuation = texture1D(falloffMap,dot(vLightDir,vLightDir)).x;
+ float attenuation = texture1D(tex2,dot(vLightDir,vLightDir)).x;
- vLightDir = (2.0*textureCube(normalCubeMap,vLightDir)-vec3(1.0)).xyz;
+ vLightDir = (2.0*textureCube(tex1,vLightDir)-vec4(1.0)).xyz;
- outColor.xyz = attenuation * texture(diffuseMap, vUv).xyz * vLightColor.xyz * dot(vLightDir, vec3(0,0,1));
+ outColor.xyz = attenuation * texture(tex0, vUv).xyz * vLightColor.xyz * dot(vLightDir, vec3(0,0,1));
outColor.w = 0.0;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
similarity index 84%
rename from engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.vertex
rename to engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
index b789bbfb347..e6d69566bc7 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
@@ -9,12 +9,12 @@
/// DIFFUSE LIGHTING VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 uv;
-in vec4 tangent;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 uv = gl_TexCoord[0].xyz;
+vec4 tangent = gl_TexCoord[1];
+
-out vec4 vPos;
out vec4 vLightColor;
out vec3 vUv;
out vec3 vLighDir;
@@ -26,7 +26,7 @@ uniform vec3 LightDirMul;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vUv = uv;
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
new file mode 100644
index 00000000000..dbc62ceec73
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
@@ -0,0 +1,35 @@
+// Copyright 2006-2010 (C) - Frictional Games
+//
+// This file is part of HPL1 Engine
+//
+// For conditions of distribution and use, see copyright notice in LICENSE-shaders
+//
+
+///////////////////////////////////////////////////////
+/// DIFFUSE SPOT LIGHTING FRAGMENT PROGRAM /////////////
+///////////////////////////////////////////////////////
+
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
+in vec3 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler2D tex0; //diffuseMap
+uniform samplerCube tex1; //normalCubeMap
+uniform sampler1D tex2; //falloffMap
+uniform sampler2D tex3; //spotlightMap
+uniform sampler1D tex4; //spotNegRejectMap
+
+void main()
+{
+ vec3 diffuse = texture(tex0, vUv).xyz;
+ vec3 lightNormal = (2.0*textureCube(tex1,vLightDir)-vec4(1.0)).xyz;
+ float attenuation = texture1D(tex2,dot(vLightDir,vLightDir)).x;
+ vec3 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.z).xyz;
+ float rejectNeg = texture1D(tex4,vSpotlightUv.z + 0.5).x;
+
+ outColor.xyz = diffuse * dot(lightNormal, vec3(0,0,1)) * attenuation *
+ vLightColor.xyz * spotColor * rejectNeg;
+}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
similarity index 86%
rename from engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.vertex
rename to engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
index c100e62ca8c..c4d29d32a6f 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
@@ -9,12 +9,12 @@
/// DIFFUSE SPOT LIGHTING VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 uv;
-in vec4 tangent;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 uv = gl_TexCoord[0].xyz;
+vec4 tangent = gl_TexCoord[1];
+
-out vec4 vPos;
out vec4 vLightColor;
out vec3 vUv;
out vec3 vLighDir;
@@ -28,7 +28,7 @@ uniform vec3 LightDirMul;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vUv = uv;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass1.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass1.fragment
similarity index 66%
rename from engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass1.fragment
rename to engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass1.fragment
index 0a02994ad44..dca5955c0f8 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass1.fragment
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass1.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE SPOT LIGHTING FRAGMENT PROGRAM /////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
@@ -17,13 +16,13 @@ in vec3 vSpotlightUv;
OUTPUT
-uniform sampler1D falloffMap = 0;
-uniform sampler1D spotNegRejectMap = 1;
+uniform sampler1D tex0; //falloffMap
+uniform sampler1D tex1; //spotNegRejectMap
void main()
{
- float attenuation = texture1D(falloffMap, dot(vLightDir,vLightDir)).x;
- float rejectNeg = texture1D(spotNegRejectMap, vSpotlightUv.z + 0.5).x;
+ float attenuation = texture1D(tex0, dot(vLightDir,vLightDir)).x;
+ float rejectNeg = texture1D(tex1, vSpotlightUv.z + 0.5).x;
outColor.w = attenuation * rejectNeg;
outColor.xyz = vec3(0.0);
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
similarity index 60%
rename from engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass2.fragment
rename to engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
index e76f95a963d..c9bebf00308 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Diffuse_Light_Spot_pass2.fragment
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE SPOT LIGHTING FRAGMENT PROGRAM /////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
@@ -17,15 +16,15 @@ in vec3 vSpotlightUv;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform samplerCube normalCubeMap = 2;
-uniform sampler2D spotlightMap = 3;
+uniform sampler2D tex0; //diffuseMap
+uniform samplerCube tex1; //normalCubeMap
+uniform sampler2D tex2; //spotlightMap
void main()
{
- vec3 diffuse = texture(diffuseMap, vUv).xyz;
- vec3 lightNormal = (2.0*textureCube(normalCubeMap,vLightDir)-vec3(1.0)).xyz;
- vec3 spotColor = texture(spotlightMap, vSpotlightUv.xy / vSpotlightUv.z).xyz;
+ vec3 diffuse = texture(tex0, vUv).xyz;
+ vec3 lightNormal = (2.0*textureCube(tex1,vLightDir)-vec4(1.0)).xyz;
+ vec3 spotColor = texture(tex2, vSpotlightUv.xy / vSpotlightUv.z).xyz;
outColor.xyz = diffuse * dot(lightNormal, vec3(0,0,1)) * vLightColor.xyz * spotColor;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_Spot_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
similarity index 81%
rename from engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
rename to engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
index 77fb14bbbb6..2bd5f6df5e7 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
@@ -9,12 +9,12 @@
/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 uv;
-in vec4 tangent;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 uv = gl_TexCoord[0].xyz;
+vec4 tangent = gl_TexCoord[1];
+
-out vec4 vPos;
out vec4 vLightColor;
out vec3 vUv;
out vec4 vSpotlightUv;
@@ -28,7 +28,7 @@ uniform vec3 LightDirMul;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vUv = uv;
vSpotlightUv = (spotViewProj * position);
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
similarity index 82%
rename from engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p1.vertex
rename to engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
index 8139390b076..99b50e78b4d 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p1.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
@@ -9,12 +9,12 @@
/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 uv;
-in vec4 tangent;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 uv = gl_TexCoord[0].xyz;
+vec4 tangent = gl_TexCoord[1];
+
-out vec4 vPos;
out vec4 vColor
out vec3 vLighDir;
out vec3 vUv;
@@ -27,7 +27,7 @@ uniform vec3 LightDirMul;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vUv = uv;
@@ -42,5 +42,5 @@ void main()
//Transform the lightdir
vLighDir = (rotation * vLighDir);
- outColor = vec3(1.0);
+ outColor = vec4(1.0);
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
similarity index 77%
rename from engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p2.vertex
rename to engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
index 66366bf419f..4f716878954 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fallback01_Diffuse_Light_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
@@ -9,12 +9,12 @@
/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 uv;
-in vec4 tangent;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 uv = gl_TexCoord[0].xyz;
+vec4 tangent = gl_TexCoord[1];
+
-out vec4 vPos;
out vec4 vLightColor;
out vec3 vUv;
@@ -25,7 +25,7 @@ uniform vec3 LightDirMul;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vUv = uv;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
similarity index 80%
rename from engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
rename to engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
index 9cfc58e5ac7..a5d847424f0 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
@@ -9,12 +9,12 @@
/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 uv;
-in vec4 tangent;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 uv = gl_TexCoord[0].xyz;
+vec4 tangent = gl_TexCoord[1];
+
-out vec4 vPos;
out vec4 vLightColor;
out float vRejectUv;
@@ -26,7 +26,7 @@ uniform vec3 LightDirMul;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
//vUv = uv;
vec4 spotlightUv = (spotViewProj * position);
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p3.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
similarity index 79%
rename from engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
rename to engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
index 58cb8eeba7a..bf4248a4ddc 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
@@ -9,12 +9,12 @@
/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 uv;
-in vec4 tangent;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 uv = gl_TexCoord[0].xyz;
+vec4 tangent = gl_TexCoord[1];
+
-out vec4 vPos;
out vec4 vLightColor;
out vec3 vUv;
out vec4 vSpotlightUv;
@@ -27,7 +27,7 @@ uniform vec3 LightDirMul;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vUv = uv;
vSpotlightUv = (spotViewProj * position);
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
similarity index 87%
rename from engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p1.vertex
rename to engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
index 5b00b4008a6..4200f03c37a 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p1.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
@@ -9,11 +9,11 @@
/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec4 tangent;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec4 tangent = gl_TexCoord[1];
+
-out vec4 vPos;
out vec4 vColor
out vec3 vLighDir;
out vec3 vLightPos;
@@ -25,7 +25,7 @@ uniform vec3 LightDirMul;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vec3 lightDir = LightPos - position.xyz;
vLighDir = lightDir * LightDirMul;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
similarity index 77%
rename from engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p2.vertex
rename to engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
index 66366bf419f..4f716878954 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fallback02_Diffuse_Light_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
@@ -9,12 +9,12 @@
/// DIFFUSE LIGHTING VERTEX PROGRAM //////////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 uv;
-in vec4 tangent;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 uv = gl_TexCoord[0].xyz;
+vec4 tangent = gl_TexCoord[1];
+
-out vec4 vPos;
out vec4 vLightColor;
out vec3 vUv;
@@ -25,7 +25,7 @@ uniform vec3 LightDirMul;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vUv = uv;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.fragment b/engines/hpl1/engine/impl/shaders/Fog_Solid.fragment
similarity index 76%
rename from engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.fragment
rename to engines/hpl1/engine/impl/shaders/Fog_Solid.fragment
index 1c9f5cc47ee..bcc512ab654 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.fragment
+++ b/engines/hpl1/engine/impl/shaders/Fog_Solid.fragment
@@ -9,15 +9,14 @@
/// SOLID FOG FRAGMENT PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vColor;
in float vUv;
OUTPUT
-uniform sampler1D diffuseMap = 0;
+uniform sampler1D tex0; //diffuseMap;
void main()
{
- outColor = texture1D(diffuseMap, uv) * vColor;
+ outColor = texture1D(tex0, vUv) * vColor;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.vertex b/engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
similarity index 63%
rename from engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.vertex
rename to engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
index ba4c04c29ee..6048550efb8 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fog_Solid.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
@@ -9,10 +9,10 @@
/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 color;
+vec4 position = gl_Vertex;
+vec3 color = gl_Color.xyz;
+
-out vec4 vPos;
out vec4 vColor;
out float vUv;
@@ -23,14 +23,14 @@ uniform float fogEnd;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
/*vUv.x =0;
- outColor.xyz = (fogEnd - vPos.z)/(fogEnd - fogStart);*/
- vUv = (fogEnd - vPos.z)/(fogEnd - fogStart);
- outColor.xyz = fogColor;
- outColor.w = 1;
+ vColor.xyz = (fogEnd - gl_Position.z)/(fogEnd - fogStart);*/
+ vUv = (fogEnd - gl_Position.z)/(fogEnd - fogStart);
+ vColor.xyz = fogColor;
+ vColor.w = 1;
/*outColor = 1;
vUv = uv;
- //vUv = (fogEnd - vPos.z)/(fogEnd - fogStart);*/
+ //vUv = (fogEnd - gl_Position.z)/(fogEnd - fogStart);*/
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans.vertex b/engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
similarity index 67%
rename from engines/hpl1/engine/impl/glsl_shaders/Fog_Trans.vertex
rename to engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
index d81b390f3a6..a824f6d59f5 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
@@ -9,13 +9,12 @@
/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec4 color;
-in vec3 uv;
+vec4 position = gl_Vertex;
+vec4 color = gl_Color;
+vec3 uv = gl_TexCoord[0].xyz;
-out vec4 vPos;
-out vec4 vColor
-out vec3 vUv;
+out vec4 vColor;
+out vec2 vUv;
out float vFogUv;
uniform mat4 worldViewProj;
@@ -24,9 +23,9 @@ uniform float fogEnd;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
- vUv = uv;
- vFogUv = (fogEnd - vPos.z)/(fogEnd - fogStart);
+ vUv = uv.xy;
+ vFogUv = (fogEnd - gl_Position.z)/(fogEnd - fogStart);
vColor = color;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Alpha.fragment b/engines/hpl1/engine/impl/shaders/Fog_Trans_Alpha.fragment
similarity index 70%
rename from engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Alpha.fragment
rename to engines/hpl1/engine/impl/shaders/Fog_Trans_Alpha.fragment
index 2f4942546b9..87de3a01b01 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Alpha.fragment
+++ b/engines/hpl1/engine/impl/shaders/Fog_Trans_Alpha.fragment
@@ -9,17 +9,16 @@
/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vColor;
in vec2 vUv;
in float vFogUv;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform sampler1D fogMap = 1;
+uniform sampler2D tex0; //diffuseMap
+uniform sampler1D tex1; //fogMap
void main()
{
- outColor = texture(diffuseMap, vUv) * texture1D(fogMap, vFogUv) * vColor;
+ outColor = texture(tex0, vUv) * texture1D(tex1, vFogUv) * vColor;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Mod.fragment b/engines/hpl1/engine/impl/shaders/Fog_Trans_Mod.fragment
similarity index 72%
rename from engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Mod.fragment
rename to engines/hpl1/engine/impl/shaders/Fog_Trans_Mod.fragment
index 959f85c69f6..5647cbbecf9 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_Mod.fragment
+++ b/engines/hpl1/engine/impl/shaders/Fog_Trans_Mod.fragment
@@ -9,20 +9,19 @@
/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vColor;
in vec2 vUv;
in float vFogUv;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform sampler1D fogMap = 1;
+uniform sampler2D tex0; //diffuseMap
+uniform sampler1D tex1; //fogMap
void main()
{
- vec4 diffuse = texture(diffuseMap, vUv);
- float alpha = texture1D(fogMap, vFogUv).w;
+ vec4 diffuse = texture(tex0, vUv);
+ float alpha = texture1D(tex1, vFogUv).w;
outColor.xyz = diffuse.xyz * alpha + vec3(1.0 - alpha);
outColor.w = diffuse.w;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_ModX2.fragment b/engines/hpl1/engine/impl/shaders/Fog_Trans_ModX2.fragment
similarity index 72%
rename from engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_ModX2.fragment
rename to engines/hpl1/engine/impl/shaders/Fog_Trans_ModX2.fragment
index 6458ded6a93..64cbab404d3 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Fog_Trans_ModX2.fragment
+++ b/engines/hpl1/engine/impl/shaders/Fog_Trans_ModX2.fragment
@@ -9,20 +9,19 @@
/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vColor;
in vec2 vUv;
in float vFogUv;
OUTPUT
-uniform sampler2D diffuseMap = 0;
-uniform sampler1D fogMap = 1;
+uniform sampler2D tex0; //diffuseMap
+uniform sampler1D tex1; //fogMap
void main()
{
- vec4 diffuse = texture(diffuseMap, vUv);
- float alpha = texture1D(fogMap, vFogUv).w;
+ vec4 diffuse = texture(tex0, vUv);
+ float alpha = texture1D(tex1, vFogUv).w;
outColor.xyz = diffuse.xyz * alpha + vec3(0.5,0.5,0.5)*(1 - alpha);
outColor.w = diffuse.w;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.fragment b/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.fragment
similarity index 72%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.fragment
rename to engines/hpl1/engine/impl/shaders/PostEffect_Bloom.fragment
index b197ce1402e..6f392459927 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.fragment
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.fragment
@@ -9,20 +9,19 @@
/// BLOOOM FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vColor;
in vec2 vUv0;
in vec2 vUv1;
OUTPUT
-uniform sampler2D blurTex = 0;
-uniform sampler2DRect screenTex = 1;
+uniform sampler2D tex0; //blurTex
+uniform sampler2DRect tex1; //screenTex
void main()
{
- vec4 blurCol = texture(blurTex, vUv0);
- vec4 screenCol = texture2DRect(screenTex, vUv1);
+ vec4 blurCol = texture(tex0, vUv0);
+ vec4 screenCol = texture2DRect(tex1, vUv1);
blurCol *= blurCol;
outColor.xyz = blurCol.xyz * dot(blurCol.xyz,vec3(0.3, 0.58, 0.12)) + screenCol.xyz;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.vertex b/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
similarity index 74%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.vertex
rename to engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
index 85330a746bf..56858697bb4 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Bloom.vertex
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
@@ -9,12 +9,11 @@
/// BLOOM VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 color;
-in vec2 uv0;
-in vec2 uv1;
+vec4 position = gl_Vertex;
+vec3 color = gl_Color.xyz;
+vec2 uv0 = gl_TexCoord[0].xy;
+vec2 uv1 = gl_TexCoord[1].xy;
-out vec4 vPos;
out vec3 vColor;
out vec2 vUv0;
out vec2 vUv1;
@@ -23,7 +22,7 @@ uniform mat4 worldViewProj;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vColor = color;
vUv0 = uv0;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur.vertex b/engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
similarity index 85%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur.vertex
rename to engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
index 60922f9d886..296fec58a22 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur.vertex
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
@@ -9,11 +9,11 @@
/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 color;
-in vec2 uv;
+vec4 position = gl_Vertex;
+vec3 color = gl_Color.xyz;
+vec2 uv = gl_TexCoord[0].xy;
+
-out vec4 vPos;
out vec3 vColor;
out vec2 vUv0;
out vec2 vUv1;
@@ -27,7 +27,7 @@ uniform float amount;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vColor = color;
vUv0 = uv + vec2(xOffset, yOffset) * amount;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_2D.fragment b/engines/hpl1/engine/impl/shaders/PostEffect_Blur_2D.fragment
similarity index 57%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_2D.fragment
rename to engines/hpl1/engine/impl/shaders/PostEffect_Blur_2D.fragment
index f75af26bc99..7224cbb925e 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_2D.fragment
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Blur_2D.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vColor;
in vec2 vUv0;
in vec2 vUv1;
@@ -18,21 +17,21 @@ in vec2 vUv3;
OUTPUT
-uniform sampler2D tex = 0;
+uniform sampler2D tex0;
void main()
{
//Samples
- vec4 col5 = texture(tex, (vUv0 + vUv2)/2.0 ) * 0.35;
+ vec4 col5 = texture(tex0, (vUv0 + vUv2)/2.0 ) * 0.35;
- vec4 col1 = texture(tex, vUv0) * 0.15;
- vec4 col3 = texture(tex, vUv2) * 0.15;
+ vec4 col1 = texture(tex0, vUv0) * 0.15;
+ vec4 col3 = texture(tex0, vUv2) * 0.15;
- vec4 col6 = texture(tex, (vUv2 + vUv3)/2.0 ) * 0.1;
- vec4 col7 = texture(tex, (vUv0 + vUv1)/2.0 ) * 0.1;
+ vec4 col6 = texture(tex0, (vUv2 + vUv3)/2.0 ) * 0.1;
+ vec4 col7 = texture(tex0, (vUv0 + vUv1)/2.0 ) * 0.1;
- vec4 col2 = texture(tex, vUv1) * 0.075;
- vec4 col4 = texture(tex, vUv3) * 0.075;
+ vec4 col2 = texture(tex0, vUv1) * 0.075;
+ vec4 col4 = texture(tex0, vUv3) * 0.075;
outColor = col1 + col2 + col3 + col4 + col5 + col6 + col7;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_Rect.fragment b/engines/hpl1/engine/impl/shaders/PostEffect_Blur_Rect.fragment
similarity index 54%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_Rect.fragment
rename to engines/hpl1/engine/impl/shaders/PostEffect_Blur_Rect.fragment
index 9464030d89f..53e944f4b98 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Blur_Rect.fragment
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Blur_Rect.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-vec4 vPos; //in projection space
vec4 vColor;
vec2 vUv0;
vec2 vUv1;
@@ -18,21 +17,21 @@ vec2 vUv3;
OUTPUT
-uniform sampler2DRect tex = 0;
+uniform sampler2DRect tex0;
void main()
{
//Samples
- vec4 col5 = texture2DRect(tex, (vUv0 + vUv2)/2.0 ) * 0.35;
+ vec4 col5 = texture2DRect(tex0, (vUv0 + vUv2)/2.0 ) * 0.35;
- vec4 col1 = texture2DRect(tex, vUv0) * 0.15;
- vec4 col3 = texture2DRect(tex, vUv2) * 0.15;
+ vec4 col1 = texture2DRect(tex0, vUv0) * 0.15;
+ vec4 col3 = texture2DRect(tex0, vUv2) * 0.15;
- vec4 col6 = texture2DRect(tex, (vUv2 + vUv3)/2.0 ) * 0.1;
- vec4 col7 = texture2DRect(tex, (vUv0 + vUv1)/2.0 ) * 0.1;
+ vec4 col6 = texture2DRect(tex0, (vUv2 + vUv3)/2.0 ) * 0.1;
+ vec4 col7 = texture2DRect(tex0, (vUv0 + vUv1)/2.0 ) * 0.1;
- vec4 col2 = texture2DRect(tex, vUv1) * 0.075;
- vec4 col4 = texture2DRect(tex, vUv3) * 0.075;
+ vec4 col2 = texture2DRect(tex0, vUv1) * 0.075;
+ vec4 col4 = texture2DRect(tex0, vUv3) * 0.075;
outColor = col1 + col2 + col3 + col4 + col5 + col6 + col7;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.fragment b/engines/hpl1/engine/impl/shaders/PostEffect_DoF.fragment
similarity index 74%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.fragment
rename to engines/hpl1/engine/impl/shaders/PostEffect_DoF.fragment
index 082889f6ab2..e78dce43d6c 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.fragment
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_DoF.fragment
@@ -9,20 +9,19 @@
/// DEPTH OF FIELD FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in float vDepth;
OUTPUT
-uniform sampler2DRect screenMap = 0;
-uniform sampler2D blurMap = 1;
+uniform sampler2DRect tex0; //screenMap
+uniform sampler2D tex1; //blurMap
uniform vec3 planes;
uniform float maxBlur;
uniform vec2 screenSize;
void main()
{
- float blur =0;
+ float blur = 0.0;
if(vDepth < planes.y) {
blur = (planes.y - vDepth) / (planes.y - planes.x);
@@ -33,6 +32,6 @@ void main()
blur = clamp(blur, 0.0, maxBlur);
- outColor = texture2DRect(screenMap,vPos.xy) * (1-blur) + texture(blurMap,vPos.xy/screenSize) *blur;
+ outColor = texture2DRect(tex0,gl_FragCoord.xy) * (1.0-blur) + texture(tex1,gl_FragCoord.xy/screenSize) *blur;
//outColor = 1 - blur;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.vertex b/engines/hpl1/engine/impl/shaders/PostEffect_DoF.vertex
similarity index 81%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.vertex
rename to engines/hpl1/engine/impl/shaders/PostEffect_DoF.vertex
index 134421655d1..77f237f3339 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_DoF.vertex
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_DoF.vertex
@@ -9,9 +9,9 @@
///DEPTH OF FIELD VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
+vec4 position = gl_Vertex;
+
-out vec4 vPos;
out float vDepth;
uniform mat4 worldViewProj;
@@ -19,7 +19,7 @@ uniform mat4 worldViewProj;
void main()
{
//Get the positions in window space.
- vPos = (worldViewProj * position);
- vDepth = vPos.z;
+ gl_Position = (worldViewProj * position);
+ vDepth = gl_Position.z;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_2D.fragment b/engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_2D.fragment
similarity index 62%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_2D.fragment
rename to engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_2D.fragment
index 9113ca050d4..712fe3feb37 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_2D.fragment
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_2D.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vColor;
in vec2 vUv0;
in vec2 vUv1;
@@ -18,17 +17,17 @@ in vec2 vUv3;
OUTPUT
-uniform sampler2D texture0 = 0;
-uniform sampler2D texture1 = 1;
-uniform sampler2D texture2 = 2;
+uniform sampler2D tex0;
+uniform sampler2D tex1;
+uniform sampler2D tex2;
void main()
{
//Samples
- vec4 col1 = texture(texture0, (vUv0 + vUv1)/2) * 0.3;
- vec4 col3 = texture(texture1, (vUv2 + vUv3)/2) * 0.3;
+ vec4 col1 = texture(tex0, (vUv0 + vUv1)/2) * 0.3;
+ vec4 col3 = texture(tex1, (vUv2 + vUv3)/2) * 0.3;
- vec4 col2 = texture(texture2, (vUv0 + vUv2)/2 ) * 0.4;
+ vec4 col2 = texture(tex2, (vUv0 + vUv2)/2 ) * 0.4;
outColor = col1 + col2 + col3;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_Rect.fragment b/engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_Rect.fragment
similarity index 59%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_Rect.fragment
rename to engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_Rect.fragment
index 51140a3a5d2..25514a37623 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Fallback01_Blur_Rect.fragment
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_Rect.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 color;
in vec2 vUv0;
in vec2 vUv1;
@@ -18,17 +17,17 @@ in vec2 vUv3;
OUTPUT
-uniform sampler2DRect texture0 = 0;
-uniform sampler2DRect texture1 = 1;
-uniform sampler2DRect texture2 = 2;
+uniform sampler2DRect tex0;
+uniform sampler2DRect tex1;
+uniform sampler2DRect tex2;
void main()
{
//Samples
- vec4 col1 = texture2DRect(texture0, (vUv0 + vUv1)/2.0) * 0.3;
- vec4 col3 = texture2DRect(texture1, (vUv2 + vUv3)/2.0) * 0.3;
+ vec4 col1 = texture2DRect(tex0, (vUv0 + vUv1)/2.0) * 0.3;
+ vec4 col3 = texture2DRect(tex1, (vUv2 + vUv3)/2.0) * 0.3;
- vec4 col2 = texture2DRect(texture2, (vUv0 + vUv2)/2.0) * 0.4;
+ vec4 col2 = texture2DRect(tex2, (vUv0 + vUv2)/2.0) * 0.4;
outColor = col1 + col2 + col3;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.fragment b/engines/hpl1/engine/impl/shaders/PostEffect_Motion.fragment
similarity index 67%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.fragment
rename to engines/hpl1/engine/impl/shaders/PostEffect_Motion.fragment
index f5eef9ad88d..3dc341aba0c 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.fragment
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Motion.fragment
@@ -10,32 +10,31 @@
// Credits to jonathan for optimization
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vVtxPos;
in vec4 vPrevVtxPos;
OUTPUT
-uniform sampler2DRect screenTex = 0;
+uniform sampler2DRect tex0; //screenTex
uniform vec2 halfScreenSize;
void main()
{
- vec2 wpos = vPos.xy;
+ vec2 wpos = gl_FragCoord.xy;
vec2 p1 = vVtxPos.xy / vVtxPos.w;
vec2 p2 = vPrevVtxPos.xy / vPrevVtxPos.w;
vec2 velocity = (p2 - p1) * halfScreenSize;
//Sample into scene texture along motion vector
- const float samples = min( max( 1.0, ceil( max( abs( velocity.x ), abs( velocity.y ) ) / 2.0 ) ), 16.0 );
- const float w = 1.0 / samples; // weight
- const vec2 s = velocity / samples; // step
+ float samples = min( max( 1.0, ceil( max( abs( velocity.x ), abs( velocity.y ) ) / 2.0 ) ), 16.0 );
+ float w = 1.0 / samples; // weight
+ vec2 s = velocity / samples; // step
vec4 a = vec4(0.0);
for(float i=0.0; i<samples; i+=1.0)
{
- a += texture2DRect(screenTex, wpos) * w;
+ a += texture2DRect(tex0, wpos) * w;
wpos += s;
}
@@ -45,5 +44,5 @@ void main()
//outColor.xyz = (1 + velocity) *0.5;
- //outColor = texture2DRect(screenTex, wpos + velocity);
+ //outColor = texture2DRect(tex0, wpos + velocity);
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.vertex b/engines/hpl1/engine/impl/shaders/PostEffect_Motion.vertex
similarity index 94%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.vertex
rename to engines/hpl1/engine/impl/shaders/PostEffect_Motion.vertex
index f4a77d28762..9880edb0606 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion.vertex
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Motion.vertex
@@ -9,11 +9,11 @@
/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 normal;
-in vec3 color;
+vec4 position = gl_Vertex;
+vec3 normal = gl_Normal;
+vec3 color = gl_Color.xyz;
+
-out vec4 vPos;
out vec3 vColor;
//out float oVelocity :TEX0
out vec4 vVtxPos;
@@ -48,7 +48,7 @@ void main()
//float flag = dot(motionVector, eyeNormal) > 0;
//vec4 Pstretch = flag ? pos : prevPos;
//vPos = Pstretch;
- vPos = pos;
+ gl_Position = pos;
//Divide by W -> NDC coordinates
//pos.xyz = pos.xyz / pos.w;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion_staticloop.fragment b/engines/hpl1/engine/impl/shaders/PostEffect_Motion_staticloop.fragment
similarity index 86%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion_staticloop.fragment
rename to engines/hpl1/engine/impl/shaders/PostEffect_Motion_staticloop.fragment
index ce9bb13ff59..180c55a7caf 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Motion_staticloop.fragment
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Motion_staticloop.fragment
@@ -10,18 +10,17 @@
// Credits to jonathan for optimization
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec4 vVtxPos;
in vec4 vPrevVtxPos;
OUTPUT
-uniform sampler2DRect screenTex = 0;
+uniform sampler2DRect tex0; //screenTex
uniform vec2 halfScreenSize;
void main()
{
- vec2 wpos = vPos.xy;
+ vec2 wpos = gl_FragCoord.xy;
vec2 p1 = vVtxPos.xy / vVtxPos.w;
vec2 p2 = vPrevVtxPos.xy / vPrevVtxPos.w;
@@ -35,7 +34,7 @@ void main()
for(float i=0.0; i<samples; i+=1.0)
{
- a += texture2DRect(screenTex, wpos) * w;
+ a += texture2DRect(tex0, wpos) * w;
wpos += s;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.fragment b/engines/hpl1/engine/impl/shaders/PostEffect_Offset.fragment
similarity index 78%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.fragment
rename to engines/hpl1/engine/impl/shaders/PostEffect_Offset.fragment
index 5826a1ecca1..48c2c9af61f 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.fragment
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Offset.fragment
@@ -9,16 +9,15 @@
/// SPECULAR BUMPMAPPING 2D FRAGMENT PROGRAM //////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec3 vUv; //in object space
OUTPUT
-uniform sampler2D ScreenBuffer = 0;
+uniform sampler2D tex0; //ScreenBuffer
void main()
{
- vec4 Col = texture(ScreenBuffer, vUv);
+ vec4 Col = texture(tex0, vUv);
outColor = Col;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.vertex b/engines/hpl1/engine/impl/shaders/PostEffect_Offset.vertex
similarity index 80%
rename from engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.vertex
rename to engines/hpl1/engine/impl/shaders/PostEffect_Offset.vertex
index a801c00daa7..9a24d706698 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/PostEffect_Offset.vertex
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Offset.vertex
@@ -9,16 +9,16 @@
/// SPECULAR BUMPMAPPING 2D VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 uv;
+vec4 position = gl_Vertex;
+vec3 uv = gl_TexCoord[0].xyz;
+
-out vec4 vPos;
out vec3 vUv;
uniform mat4 worldViewProj;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
vUv = uv;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.fragment b/engines/hpl1/engine/impl/shaders/ShadowExtrude.fragment
similarity index 91%
rename from engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.fragment
rename to engines/hpl1/engine/impl/shaders/ShadowExtrude.fragment
index 161c700fe84..5c2e89bf568 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.fragment
+++ b/engines/hpl1/engine/impl/shaders/ShadowExtrude.fragment
@@ -9,8 +9,6 @@
/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
-
OUTPUT
void main()
diff --git a/engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.vertex b/engines/hpl1/engine/impl/shaders/ShadowExtrude.vertex
similarity index 78%
rename from engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.vertex
rename to engines/hpl1/engine/impl/shaders/ShadowExtrude.vertex
index f622bde574e..bc18f42f827 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/ShadowExtrude.vertex
+++ b/engines/hpl1/engine/impl/shaders/ShadowExtrude.vertex
@@ -9,9 +9,8 @@
/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
+vec4 position = gl_Vertex;
-out vec4 vPos;
//out vec3 outColor;
uniform mat4 worldViewProj;
@@ -19,6 +18,6 @@ uniform vec3 lightPosition;
void main()
{
- vPos = (worldViewProj * vec4((position.xyz - lightPosition*(1.0-position.w)), position.w));
+ gl_Position = (worldViewProj * vec4((position.xyz - lightPosition*(1.0-position.w)), position.w));
//outColor = vec3(0.1,0,0.1);
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Water_Diffuse.vertex b/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
similarity index 66%
rename from engines/hpl1/engine/impl/glsl_shaders/Water_Diffuse.vertex
rename to engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
index 319aabe58f0..77c94c36a12 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Water_Diffuse.vertex
+++ b/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
@@ -9,11 +9,11 @@
/// WATER FOG VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec3 color;
-in vec3 uv;
+vec4 position = gl_Vertex;
+vec3 color = gl_Color.xyz;
+vec3 uv = gl_TexCoord[0].xyz;
+
-out vec4 vPos;
out vec3 vColor;
out vec3 vUv;
@@ -26,9 +26,9 @@ void main()
float freq = 15.0;
float speed = 3.0;
- vPos = (worldViewProj * position);
- vPos.y += sin(timeCount*speed + (position.x)*freq)*amp;
- vPos.y += sin(timeCount*speed + (position.z)*freq)*amp;
+ gl_Position = (worldViewProj * position);
+ gl_Position.y += sin(timeCount*speed + (position.x)*freq)*amp;
+ gl_Position.y += sin(timeCount*speed + (position.z)*freq)*amp;
vColor = color;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/Water_Fog.vertex b/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
similarity index 65%
rename from engines/hpl1/engine/impl/glsl_shaders/Water_Fog.vertex
rename to engines/hpl1/engine/impl/shaders/Water_Fog.vertex
index 5f4a6f971ad..679fca1877e 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/Water_Fog.vertex
+++ b/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
@@ -9,11 +9,11 @@
/// WATER FOG VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec4 color;
-in vec3 uv;
+vec4 position = gl_Vertex;
+vec4 color = gl_Color;
+vec3 uv = gl_TexCoord[0].xyz;
+
-out vec4 vPos;
out vec4 vColor
out vec3 vUv;
out float vFogUv;
@@ -29,12 +29,12 @@ void main()
float freq = 15.0;
float speed = 3.0;
- vPos = (worldViewProj * position);
- vPos.y += sin(timeCount*speed + (position.x)*freq)*amp;
- vPos.y += sin(timeCount*speed + (position.z)*freq)*amp;
+ gl_Position = (worldViewProj * position);
+ gl_Position.y += sin(timeCount*speed + (position.x)*freq)*amp;
+ gl_Position.y += sin(timeCount*speed + (position.z)*freq)*amp;
vUv = uv;
- vFogUv = (fogEnd - vPos.z)/(fogEnd - fogStart);
+ vFogUv = (fogEnd - gl_Position.z)/(fogEnd - fogStart);
vColor = color;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/refract.fragment b/engines/hpl1/engine/impl/shaders/refract.fragment
similarity index 54%
rename from engines/hpl1/engine/impl/glsl_shaders/refract.fragment
rename to engines/hpl1/engine/impl/shaders/refract.fragment
index bb28df141f4..dfcf790625e 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/refract.fragment
+++ b/engines/hpl1/engine/impl/shaders/refract.fragment
@@ -9,21 +9,20 @@
/// REFRACTION FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-in vec4 inPos; //in projection space
-in vec2 uv; //in object space
-in vec4 color;
+in vec2 vUv; //in object space
+in vec4 vColor;
OUTPUT
-uniform sampler2DRect screenMap = 0;
-uniform sampler2D refractMap = 1;
+uniform sampler2DRect tex0; //screenMap
+uniform sampler2D tex1; //refractMap
uniform vec2 screenSize;
-uniform float scale
+uniform float scale;
void main()
{
- vec3 offset = ((texture(refractMap, uv)*2.0) - vec3(1.0)) * color.w;
+ vec3 offset = vec3(((texture(tex1, vUv)*2.0) - vec4(1.0)) * vColor.w);
- outColor = texture2DRect(screenMap,inPos.xy - (offset.xy*scale) / inPos.z);
+ outColor = texture2DRect(tex0, gl_FragCoord.xy - (offset.xy*scale) / gl_FragCoord.z);
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/refract.vertex b/engines/hpl1/engine/impl/shaders/refract.vertex
similarity index 71%
rename from engines/hpl1/engine/impl/glsl_shaders/refract.vertex
rename to engines/hpl1/engine/impl/shaders/refract.vertex
index 427adb12823..abcaf81a19d 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/refract.vertex
+++ b/engines/hpl1/engine/impl/shaders/refract.vertex
@@ -9,21 +9,20 @@
/// REFRACTION VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec4 color;
-in vec2 uv;
+vec4 position = gl_Vertex;
+vec4 color = gl_Color;
+vec2 uv = gl_TexCoord[0].xy;
-out vec4 vPos;
-out vec4 vColor
+out vec4 vColor;
out vec2 vUv;
uniform mat4 worldViewProj;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
- outColor = color;
+ vColor = color;
vUv = uv;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/glsl_shaders/refract_special.fragment b/engines/hpl1/engine/impl/shaders/refract_special.fragment
similarity index 59%
rename from engines/hpl1/engine/impl/glsl_shaders/refract_special.fragment
rename to engines/hpl1/engine/impl/shaders/refract_special.fragment
index bbe2d32079a..e14686ece9c 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/refract_special.fragment
+++ b/engines/hpl1/engine/impl/shaders/refract_special.fragment
@@ -9,27 +9,26 @@
/// REFRACTION SPECIAL FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec2 vUv; //in object space
in vec4 vColor;
OUTPUT
-uniform sampler2DRect screenMap = 0;
-uniform sampler2D refractMap = 1;
-uniform sampler2D alphaMap = 2;
+uniform sampler2DRect tex0; //screenMap
+uniform sampler2D tex1; //refractMap
+uniform sampler2D tex2; //alphaMap
uniform vec2 screenSize;
uniform float t;
-uniform float scale
+uniform float scale;
void main()
{
- float alpha = texture(alphaMap, vUv).x;
- vec2 uv2 = (vPos.xy / screenSize);
+ float alpha = texture(tex2, vUv).x;
+ vec2 uv2 = (gl_FragCoord.xy / screenSize);
uv2.x += sin(t + uv2.y*10) * 0.001 * scale;
uv2.y += sin(t + uv2.x*10) * 0.001 * scale;
- vec3 offset = ((texture(refractMap, uv2)*2.0) - vec3(1.0)) * alpha * vColor.w;
+ vec3 offset = vec3(((texture(tex1, uv2)*2.0) - vec4(1.0)) * alpha * vColor.w);
- outColor.xyz = texture2DRect(screenMap,vPos.xy - offset.xy*scale);
+ outColor.xyz = (texture2DRect(tex0,gl_FragCoord.xy - offset.xy*scale)).xyz;
}
diff --git a/engines/hpl1/engine/impl/glsl_shaders/refract_water.fragment b/engines/hpl1/engine/impl/shaders/refract_water.fragment
similarity index 71%
rename from engines/hpl1/engine/impl/glsl_shaders/refract_water.fragment
rename to engines/hpl1/engine/impl/shaders/refract_water.fragment
index 005d75511fd..ec529c57e43 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/refract_water.fragment
+++ b/engines/hpl1/engine/impl/shaders/refract_water.fragment
@@ -9,7 +9,6 @@
/// REFRACTION FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-in vec4 vPos; //in projection space
in vec2 vUv; //in object space
in vec3 vNormal;
in vec3 vEyePos;
@@ -17,9 +16,9 @@ in vec4 vColor;
OUTPUT
-uniform sampler2DRect screenMap = 0;
-uniform sampler2D refractMap = 1;
-uniform sampler2D diffuseMap = 2;
+uniform sampler2DRect tex0; //screenMap
+uniform sampler2D tex1; //refractMap
+uniform sampler2D tex2; //diffuseMap
uniform vec2 screenSize;
uniform float scale;
@@ -32,13 +31,13 @@ void main()
uv_offset1.x += sin(t*0.8 + vUv.y*10.0)*0.04;
uv_offset1.y += sin(t*0.8 + uv_offset1.x*10.0)*0.04;
- vec3 offset1 = ((texture(refractMap, uv_offset1)*2.0) - vec3(1.0));
+ vec3 offset1 = ((texture(tex1, uv_offset1)*2.0) - vec4(1.0)).xyz;
vec2 uv_offset2 = vUv;
uv_offset2.x += sin(t*-2.6 + vUv.y*12.0)*0.03;
uv_offset2.y += sin(t*-2.6 + uv_offset2.x*12.0)*0.03;
- vec3 offset2 = ((texture(refractMap, uv_offset2)*2.0) - vec3(1.0));
+ vec3 offset2 = ((texture(tex1, uv_offset2)*2.0) - vec4(1.0)).xyz;
offset2.xy = -offset2.xy;
vec3 offset = normalize(offset1*0.7 + offset2*0.3);
@@ -46,10 +45,10 @@ void main()
//float fresnel = saturate(dot(normalize(vEyePos), normalize(vNormal)));
//fresnel = (fresnel + 0.2)*0.8;
- vec3 waterColor = texture(diffuseMap, uv_offset1).xyz;
+ vec3 waterColor = texture(tex2, uv_offset1).xyz;
- vec4 screenColor = texture2DRect(screenMap,vPos.xy + offset.xy * -scale);
- if(screenColor.w < 0.5) screenColor = texture2DRect(screenMap,vPos.xy);
+ vec4 screenColor = texture2DRect(tex0, gl_FragCoord.xy + offset.xy * -scale);
+ if(screenColor.w < 0.5) screenColor = texture2DRect(tex0, gl_FragCoord.xy);
outColor.xyz = screenColor.xyz * waterColor;
diff --git a/engines/hpl1/engine/impl/glsl_shaders/refract_water.vertex b/engines/hpl1/engine/impl/shaders/refract_water.vertex
similarity index 79%
rename from engines/hpl1/engine/impl/glsl_shaders/refract_water.vertex
rename to engines/hpl1/engine/impl/shaders/refract_water.vertex
index 16ac7ed7560..a940b1fd566 100644
--- a/engines/hpl1/engine/impl/glsl_shaders/refract_water.vertex
+++ b/engines/hpl1/engine/impl/shaders/refract_water.vertex
@@ -9,12 +9,12 @@
/// REFRACTION VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////
-in vec4 position;
-in vec4 color;
-in vec2 uv;
-in vec3 normal;
+vec4 position = gl_Vertex;
+vec4 color = gl_Color;
+vec2 uv = gl_TexCoord[0].xy;
+vec3 normal = gl_Normal;
+
-out vec4 vPos;
out vec4 vColor
out vec2 vUv;
out vec3 vNormal;
@@ -25,7 +25,7 @@ uniform mat4 worldViewProj;
void main()
{
- vPos = (worldViewProj * position);
+ gl_Position = (worldViewProj * position);
outColor = color;
Commit: 1111f305945294e4b77f703cd89081934fbad5e2
https://github.com/scummvm/scummvm/commit/1111f305945294e4b77f703cd89081934fbad5e2
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:41+01:00
Commit Message:
HPL1: fix bug with shader name concatenation
Changed paths:
engines/hpl1/engine/graphics/Material_BaseLight.cpp
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
index ede44eddbc5..e650d8a461c 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
@@ -90,22 +90,19 @@ iMaterial_BaseLight::iMaterial_BaseLight(const tString &asLightVertexProgram,
////////////////////////////////////////
// Get names for other light programs
- tString sSpotVtxProgram = cString::Sub(asLightVertexProgram, 0, (int)asLightVertexProgram.size() - 5) +
- "Spot";
+ tString sSpotVtxProgram = asLightVertexProgram + "_Spot";
//////////////////////////////////////////////////////
// Check if there is enough texture units for 1 pass spot
if (mpLowLevelGraphics->GetCaps(eGraphicCaps_MaxTextureImageUnits) > 4) {
mbUsesTwoPassSpot = false;
- tString sSpotFragProgram = cString::Sub(asLightFragmentProgram, 0, (int)asLightFragmentProgram.size() - 5) +
- "Spot";
+ tString sSpotFragProgram = asLightFragmentProgram + "_Spot";
_shaders[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram(sSpotVtxProgram, sSpotFragProgram);
} else {
mbUsesTwoPassSpot = true;
tString sSpotFragProgram1 = "Diffuse_Light_Spot_pass1"; // cString::Sub(asLightFragmentProgram,0, (int)asLightFragmentProgram.size() - 5) +
// "Spot_fp_pass1.cg";
- tString sSpotFragProgram2 = cString::Sub(asLightFragmentProgram, 0, (int)asLightFragmentProgram.size() - 5) +
- "Spot_pass2";
+ tString sSpotFragProgram2 = asLightFragmentProgram + "_Spot_pass2";
_shaders[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram(sSpotVtxProgram, sSpotFragProgram1);
_shaders[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram(sSpotVtxProgram, sSpotFragProgram2);
}
Commit: 520817276ea6dd314841c59b2efa3685a88a2a58
https://github.com/scummvm/scummvm/commit/520817276ea6dd314841c59b2efa3685a88a2a58
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:41+01:00
Commit Message:
HPL1: fix uniform setter for vec4f in shader class
Changed paths:
engines/hpl1/engine/impl/CGProgram.cpp
diff --git a/engines/hpl1/engine/impl/CGProgram.cpp b/engines/hpl1/engine/impl/CGProgram.cpp
index ceb4f65ad9e..01104f2b8f4 100644
--- a/engines/hpl1/engine/impl/CGProgram.cpp
+++ b/engines/hpl1/engine/impl/CGProgram.cpp
@@ -116,7 +116,7 @@ bool cCGProgram::SetVec3f(const tString &asName, float afX, float afY, float afZ
//-----------------------------------------------------------------------
bool cCGProgram::SetVec4f(const tString &asName, float afX, float afY, float afZ, float afW) {
- _shader->setUniform(asName.c_str(), {afX, afY, afZ});
+ _shader->setUniform(asName.c_str(), {afX, afY, afZ, afW});
return true;
}
Commit: 001a8c7879b591f16b552b55d5b28f6f5c779563
https://github.com/scummvm/scummvm/commit/001a8c7879b591f16b552b55d5b28f6f5c779563
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:41+01:00
Commit Message:
HPL1: remove separate shader usage
Changed paths:
engines/hpl1/engine/game/Game.cpp
engines/hpl1/engine/graphics/RenderList.cpp
engines/hpl1/engine/graphics/RenderState.cpp
engines/hpl1/engine/graphics/RenderState.h
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/engine/graphics/Renderer3D.h
engines/hpl1/engine/graphics/RendererPostEffects.cpp
engines/hpl1/engine/graphics/RendererPostEffects.h
engines/hpl1/engine/scene/Light3D.cpp
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index e7db07e504e..5df35536a8e 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -436,7 +436,7 @@ void cGame::Run() {
// Log("----\nCreations made: %d\n------\n",cMemoryManager::GetCreationCount());
//}
- g_system->delayMillis(10);
+ //g_system->delayMillis(10);
}
Log("--------------------------------------------------------\n\n");
diff --git a/engines/hpl1/engine/graphics/RenderList.cpp b/engines/hpl1/engine/graphics/RenderList.cpp
index 148b5b09b32..23aebfc4af6 100644
--- a/engines/hpl1/engine/graphics/RenderList.cpp
+++ b/engines/hpl1/engine/graphics/RenderList.cpp
@@ -562,6 +562,19 @@ void cRenderList::AddToTree(iRenderable *apObject, eRenderListDrawType aObjectTy
pNode = InsertNode(pNode, pTempNode);
}
+ /////// GPU PROGRAM //////////////
+ {
+ pTempState->mType = eRenderStateType_GpuProgram;
+
+ pTempState->gpuProgram = pMaterial->getGpuProgram(aPassType, alPass, apLight);
+ pTempState->gpuProgramSetup = pMaterial->getGpuProgramSetup(aPassType, alPass, apLight);
+ pTempState->mbUsesLight = pMaterial->VertexProgramUsesLight(aPassType, alPass, apLight);
+ pTempState->mbUsesEye = pMaterial->VertexProgramUsesEye(aPassType, alPass, apLight);
+ pTempState->mpLight = apLight;
+
+ pNode = InsertNode(pNode, pTempNode);
+ }
+#if 0
/////// VERTEX PROGRAM //////////////
{
// Log("\nVertex program level\n");
@@ -594,7 +607,7 @@ void cRenderList::AddToTree(iRenderable *apObject, eRenderListDrawType aObjectTy
pNode = InsertNode(pNode, pTempNode);
}
-
+#endif
/////// TEXTURE //////////////
{
// Log("\nTexture level\n");
diff --git a/engines/hpl1/engine/graphics/RenderState.cpp b/engines/hpl1/engine/graphics/RenderState.cpp
index 3c5b5c688bd..b1a00031293 100644
--- a/engines/hpl1/engine/graphics/RenderState.cpp
+++ b/engines/hpl1/engine/graphics/RenderState.cpp
@@ -80,6 +80,8 @@ int iRenderState::Compare(const iRenderState *apState) const {
return CompareMatrix(apState);
case eRenderStateType_Render:
return CompareRender(apState);
+ case eRenderStateType_GpuProgram:
+ return compareGpuProgram(apState);
default:
break;
}
@@ -127,6 +129,8 @@ void iRenderState::SetMode(cRenderSettings *apSettings) {
case eRenderStateType_Render:
SetRenderMode(apSettings);
break;
+ case eRenderStateType_GpuProgram:
+ setGpuProgMode(apSettings);
default:
break;
}
@@ -190,6 +194,14 @@ void iRenderState::Set(const iRenderState *apState) {
case eRenderStateType_Render:
mpObject = apState->mpObject;
break;
+
+ case eRenderStateType_GpuProgram:
+ gpuProgram = apState->gpuProgram;
+ gpuProgramSetup = apState->gpuProgramSetup;
+ mbUsesEye = apState->mbUsesEye;
+ mbUsesLight = apState->mbUsesLight;
+ mpLight = apState->mpLight;
+
default:
break;
}
@@ -362,43 +374,43 @@ void iRenderState::SetBlendMode(cRenderSettings *apSettings) {
//-----------------------------------------------------------------------
void iRenderState::SetVtxProgMode(cRenderSettings *apSettings) {
- if (mpVtxProgram != apSettings->mpVertexProgram) {
+ if (gpuProgram != apSettings->gpuProgram) {
if (apSettings->mbLog) {
- if (mpVtxProgram)
- Log("Setting vertex program: '%s'/%d ", mpVtxProgram->GetName().c_str(),
- (size_t)mpVtxProgram);
+ if (gpuProgram)
+ Log("Setting vertex program: '%s'/%d ", gpuProgram->GetName().c_str(),
+ (size_t)gpuProgram);
else
- Log("Setting vertex program: NULL ");
+ Log("Setting vertex program: NULL");
}
- if (mpVtxProgram == NULL && apSettings->mpVertexProgram) {
- apSettings->mpVertexProgram->UnBind();
+ if (gpuProgram == NULL && apSettings->gpuProgram) {
+ apSettings->gpuProgram->UnBind();
if (apSettings->mbLog)
- Log("Unbinding old ");
+ Log("Unbinding old");
}
- apSettings->mpVertexProgram = mpVtxProgram;
+ apSettings->gpuProgram = gpuProgram;
- if (mpVtxProgram) {
+ if (gpuProgram) {
if (apSettings->mbLog)
- Log("Binding new ");
- mpVtxProgram->Bind();
+ Log("Binding new");
+ gpuProgram->Bind();
- if (mpVtxProgramSetup) {
+ if (gpuProgramSetup) {
if (apSettings->mbLog)
- Log("Custom setup %d ", mpVtxProgram);
- mpVtxProgramSetup->Setup(mpVtxProgram, apSettings);
+ Log("Custom setup %d ", gpuProgram);
+ gpuProgramSetup->Setup(gpuProgram, apSettings);
}
- apSettings->mpVtxProgramSetup = mpVtxProgramSetup;
+ apSettings->gpuProgramSetup = gpuProgramSetup;
// reset this so all matrix setting are set to vertex program.
apSettings->mbMatrixWasNULL = false;
if (mbUsesLight) {
if (apSettings->mbLog)
- Log("Setting light properites ");
+ Log("Setting light properites");
- // mpVtxProgram->SetFloat("LightRadius",mpLight->GetFarAttenuation());
- mpVtxProgram->SetColor4f("LightColor", mpLight->GetDiffuseColor());
+ // gpuProgram->SetFloat("LightRadius",mpLight->GetFarAttenuation());
+ gpuProgram->SetColor4f("LightColor", mpLight->GetDiffuseColor());
apSettings->mpLight = mpLight;
} else {
@@ -411,42 +423,47 @@ void iRenderState::SetVtxProgMode(cRenderSettings *apSettings) {
if (apSettings->mbLog)
Log("\n");
} else {
- if (apSettings->mpVertexProgram && mbUsesLight && mpLight != apSettings->mpLight) {
+ if (apSettings->gpuProgram && mbUsesLight && mpLight != apSettings->mpLight) {
if (apSettings->mbLog)
Log("Setting new light properites\n");
- // mpVtxProgram->SetFloat("LightRadius",mpLight->GetFarAttenuation());
- mpVtxProgram->SetColor4f("LightColor", mpLight->GetDiffuseColor());
+ // gpuProgram->SetFloat("LightRadius",mpLight->GetFarAttenuation());
+ gpuProgram->SetColor4f("LightColor", mpLight->GetDiffuseColor());
apSettings->mpLight = mpLight;
}
}
}
+void iRenderState::setGpuProgMode(cRenderSettings *settings) {
+ SetVtxProgMode(settings);
+ SetFragProgMode(settings);
+}
+
//-----------------------------------------------------------------------
void iRenderState::SetFragProgMode(cRenderSettings *apSettings) {
- if (mpFragProgram != apSettings->mpFragmentProgram) {
+ if (gpuProgram != apSettings->gpuProgram) {
if (apSettings->mbLog) {
- if (mpFragProgram)
- Log("Setting fragment program: '%s' /%d ", mpFragProgram->GetName().c_str(),
- (size_t)mpFragProgram);
+ if (gpuProgram)
+ Log("Setting fragment program: '%s' /%d ", gpuProgram->GetName().c_str(),
+ (size_t)gpuProgram);
else
Log("Setting fragment program: NULL");
}
- // if(mpFragProgram==NULL && apSettings->mpFragmentProgram) apSettings->mpFragmentProgram->UnBind();
- if (apSettings->mpFragmentProgram)
- apSettings->mpFragmentProgram->UnBind();
+ // if(gpuProgram==NULL && apSettings->mpFragmentProgram) apSettings->mpFragmentProgram->UnBind();
+ if (apSettings->gpuProgram)
+ apSettings->gpuProgram->UnBind();
- apSettings->mpFragmentProgram = mpFragProgram;
+ apSettings->gpuProgram = gpuProgram;
- if (mpFragProgram) {
+ if (gpuProgram) {
if (apSettings->mbLog)
Log("Binding new ");
- mpFragProgram->Bind();
+ gpuProgram->Bind();
- if (mpFragProgramSetup)
- mpFragProgramSetup->Setup(mpFragProgram, apSettings);
+ if (gpuProgramSetup)
+ gpuProgramSetup->Setup(gpuProgram, apSettings);
}
if (apSettings->mbLog)
@@ -518,13 +535,13 @@ void iRenderState::SetMatrixMode(cRenderSettings *apSettings) {
apSettings->mbMatrixWasNULL = true;
}
- if (apSettings->mpVertexProgram) {
+ if (apSettings->gpuProgram) {
// Might be quicker if this is set directly
- apSettings->mpVertexProgram->SetMatrixf("worldViewProj",
+ apSettings->gpuProgram->SetMatrixf("worldViewProj",
eGpuProgramMatrix_ViewProjection,
eGpuProgramMatrixOp_Identity);
- if (apSettings->mpVtxProgramSetup) {
- apSettings->mpVtxProgramSetup->SetupMatrix(mpModelMatrix, apSettings);
+ if (apSettings->gpuProgramSetup) {
+ apSettings->gpuProgramSetup->SetupMatrix(mpModelMatrix, apSettings);
}
if (apSettings->mbUsesLight) {
@@ -534,11 +551,11 @@ void iRenderState::SetMatrixMode(cRenderSettings *apSettings) {
// Light position
cVector3f vLocalLight = cMath::MatrixMul(*mpInvModelMatrix,
apSettings->mpLight->GetLightPosition());
- apSettings->mpVertexProgram->SetVec3f("LightPos", vLocalLight);
+ apSettings->gpuProgram->SetVec3f("LightPos", vLocalLight);
// LightDir Div, use scale to make attenuation correct!
cVector3f vLightDirDiv = mvScale / apSettings->mpLight->GetFarAttenuation();
- apSettings->mpVertexProgram->SetVec3f("LightDirMul", vLightDirDiv);
+ apSettings->gpuProgram->SetVec3f("LightDirMul", vLightDirDiv);
if (apSettings->mbLog)
Log("(%s) LightDirMul (%s) ", vLocalLight.ToString().c_str(), vLightDirDiv.ToString().c_str());
@@ -548,22 +565,22 @@ void iRenderState::SetMatrixMode(cRenderSettings *apSettings) {
if (apSettings->mbLog)
Log("SpotLightViewProj ");
cLight3DSpot *pSpotLight = static_cast<cLight3DSpot *>(apSettings->mpLight);
- apSettings->mpVertexProgram->SetMatrixf("spotViewProj",
+ apSettings->gpuProgram->SetMatrixf("spotViewProj",
cMath::MatrixMul(pSpotLight->GetViewProjMatrix(), *mpModelMatrix));
}
} else {
// Light position
- apSettings->mpVertexProgram->SetVec3f("LightPos", apSettings->mpLight->GetLightPosition());
+ apSettings->gpuProgram->SetVec3f("LightPos", apSettings->mpLight->GetLightPosition());
// LightDir Div
- apSettings->mpVertexProgram->SetVec3f("LightDirMul", 1.0f / apSettings->mpLight->GetFarAttenuation());
+ apSettings->gpuProgram->SetVec3f("LightDirMul", 1.0f / apSettings->mpLight->GetFarAttenuation());
// Light view projection
if (apSettings->mpLight->GetLightType() == eLight3DType_Spot) {
if (apSettings->mbLog)
Log("SpotLightViewProj ");
cLight3DSpot *pSpotLight = static_cast<cLight3DSpot *>(apSettings->mpLight);
- apSettings->mpVertexProgram->SetMatrixf("spotViewProj", pSpotLight->GetViewProjMatrix());
+ apSettings->gpuProgram->SetMatrixf("spotViewProj", pSpotLight->GetViewProjMatrix());
}
}
}
@@ -574,9 +591,9 @@ void iRenderState::SetMatrixMode(cRenderSettings *apSettings) {
if (mpModelMatrix) {
cVector3f vLocalEye = cMath::MatrixMul(*mpInvModelMatrix,
apSettings->mpCamera->GetEyePosition());
- apSettings->mpVertexProgram->SetVec3f("EyePos", vLocalEye);
+ apSettings->gpuProgram->SetVec3f("EyePos", vLocalEye);
} else {
- apSettings->mpVertexProgram->SetVec3f("EyePos", apSettings->mpCamera->GetEyePosition());
+ apSettings->gpuProgram->SetVec3f("EyePos", apSettings->mpCamera->GetEyePosition());
}
}
}
@@ -683,6 +700,10 @@ int iRenderState::CompareRender(const iRenderState *apState) const {
return GetCompareVal(mpObject, apState->mpObject);
}
+int iRenderState::compareGpuProgram(const iRenderState *state) const {
+ return GetCompareVal(gpuProgram, state->gpuProgram);
+}
+
//-----------------------------------------------------------------------
} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/RenderState.h b/engines/hpl1/engine/graphics/RenderState.h
index 0ae71023266..6c62ecbb30a 100644
--- a/engines/hpl1/engine/graphics/RenderState.h
+++ b/engines/hpl1/engine/graphics/RenderState.h
@@ -28,6 +28,7 @@
#ifndef HPL_RENDER_SET_H
#define HPL_RENDER_SET_H
+#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/Material.h"
#include "hpl1/engine/math/MathTypes.h"
@@ -53,7 +54,8 @@ enum eRenderStateType {
eRenderStateType_VertexBuffer = 9,
eRenderStateType_Matrix = 10,
eRenderStateType_Render = 11,
- eRenderStateType_LastEnum = 12
+ eRenderStateType_GpuProgram = 12,
+ eRenderStateType_LastEnum = 13
};
///////////// INTERFACE ////////////////////
@@ -88,6 +90,9 @@ public:
eMaterialBlendMode mBlendMode;
eMaterialChannelMode mChannelMode;
+ iGpuProgram *gpuProgram;
+ iMaterialProgramSetup *gpuProgramSetup;
+
// Vertex program
iGpuProgram *mpVtxProgram;
iMaterialProgramSetup *mpVtxProgramSetup;
@@ -130,6 +135,7 @@ private:
int CompareVtxBuff(const iRenderState *apState) const;
int CompareMatrix(const iRenderState *apState) const;
int CompareRender(const iRenderState *apState) const;
+ int compareGpuProgram(const iRenderState *state) const;
// Set mode
void SetSectorMode(cRenderSettings *apSettings);
void SetPassMode(cRenderSettings *apSettings);
@@ -139,6 +145,7 @@ private:
void SetAlphaMode(cRenderSettings *apSettings);
void SetVtxProgMode(cRenderSettings *apSettings);
void SetFragProgMode(cRenderSettings *apSettings);
+ void setGpuProgMode(cRenderSettings *settings);
void SetTextureMode(cRenderSettings *apSettings);
void SetVtxBuffMode(cRenderSettings *apSettings);
void SetMatrixMode(cRenderSettings *apSettings);
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index e9b131e3678..565081bcb1a 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -27,6 +27,7 @@
#include "hpl1/engine/graphics/Renderer3D.h"
+#include "hpl1/debug.h"
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/graphics/MeshCreator.h"
@@ -47,6 +48,8 @@
#include "hpl1/engine/scene/RenderableContainer.h"
#include "hpl1/engine/scene/World3D.h"
#include "hpl1/engine/system/low_level_system.h"
+#include <cstddef>
+#include <sys/types.h>
namespace hpl {
@@ -72,9 +75,11 @@ cRenderSettings::cRenderSettings() {
//-----------------------------------------------------------------------
+
+
cRenderer3D::cRenderer3D(iLowLevelGraphics *apLowLevelGraphics, cResources *apResources,
cMeshCreator *apMeshCreator, cRenderList *apRenderList) {
- Log(" Creating Renderer3D\n");
+ Hpl1::logInfo(Hpl1::kDebugGraphics, "Creating Renderer3D\n");
mpLowLevelGraphics = apLowLevelGraphics;
mpLowLevelResources = apResources->GetLowLevel();
@@ -110,52 +115,26 @@ cRenderer3D::cRenderer3D(iLowLevelGraphics *apLowLevelGraphics, cResources *apRe
mRenderSettings.mShowShadows = eRendererShowShadows_All;
mRenderSettings.mpTempIndexArray = hplNewArray(unsigned int, 60000);
- Log(" Load Renderer3D gpu programs:\n");
-
- Log(" Extrude\n");
-
+ Hpl1::logInfo(Hpl1::kDebugGraphics, "Load Renderer3D gpu programs:\n");
cGpuProgramManager *pProgramManager = apResources->GetGpuProgramManager();
- mRenderSettings.mpVtxExtrudeProgram = pProgramManager->CreateProgram("ShadowExtrude_vp.cg", "main", eGpuProgramType_Vertex);
- if (mRenderSettings.mpVtxExtrudeProgram == NULL) {
- Error("Couldn't load 'ShadowExtrude_vp.cg' program! Shadows will be disabled.\n");
- }
- if (mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_FragmentProgram))
- mRenderSettings.mpFragExtrudeProgram = pProgramManager->CreateProgram("ShadowExtrude_fp.cg", "main", eGpuProgramType_Fragment);
- else
- mRenderSettings.mpFragExtrudeProgram = NULL;
+ mRenderSettings.extrudeProgram = pProgramManager->CreateProgram("ShadowExtrude", "ShadowExtrude");
///////////////////////////////////
// Load diffuse program, for stuff like query rendering
- Log(" Diffuse Vertex\n");
- mpDiffuseVtxProgram = pProgramManager->CreateProgram("Diffuse_Color_vp.cg", "main",
- eGpuProgramType_Vertex);
- if (mpDiffuseVtxProgram == NULL) {
- Error("Couldn't load 'Diffuse_Color_vp.cg'\n");
- }
-
- ///////////////////////////////////
- // Load diffuse frag program, used where possible. Else fixed funcion.
- Log(" Diffuse Fragment\n");
- mpDiffuseFragProgram = pProgramManager->CreateProgram("Diffuse_Color_fp.cg", "main", eGpuProgramType_Fragment);
+ _diffuseProgram = pProgramManager->CreateProgram("Diffuse_Color", "Diffuse_Color");
///////////////////////////////////
// Fog Vertex Program Init
- Log(" Fog\n");
- mpSolidFogVtxProgram = pProgramManager->CreateProgram("Fog_Solid_vp.cg", "main", eGpuProgramType_Vertex);
- if (mpSolidFogVtxProgram == NULL)
- Error("Couldn't load 'Fog_Solid_vp.cg'\n");
-
- mpSolidFogFragProgram = pProgramManager->CreateProgram("Fog_Solid_fp.cg", "main", eGpuProgramType_Fragment);
+ _solidFogProgram = pProgramManager->CreateProgram("Fog_Solid", "Fog_Solid");
///////////////////////////////////
// Fog Texture Init
-
- Log(" Creating fog textures: ");
+ Log("Creating fog textures:");
unsigned char *pFogArray = hplNewArray(unsigned char, 256 * 2);
// Solid
- Log("Solid ");
+ Log("Solid");
iTexture *pTex = mpLowLevelGraphics->CreateTexture("FogLinearSolid",
false, eTextureType_Normal, eTextureTarget_1D);
@@ -209,23 +188,20 @@ cRenderer3D::cRenderer3D(iLowLevelGraphics *apLowLevelGraphics, cResources *apRe
/////////////////////////////////////////////
// Create Refraction programs
mbRefractionAvailable = true;
-
- mpRefractVtxProgram = pProgramManager->CreateProgram("refract_vp.cg", "main", eGpuProgramType_Vertex);
- mpRefractFragProgram = pProgramManager->CreateProgram("refract_fp.cg", "main", eGpuProgramType_Fragment);
- mpRefractSpecFragProgram = pProgramManager->CreateProgram("refract_special_fp.cg", "main", eGpuProgramType_Fragment);
-
- if (mpRefractFragProgram == NULL || mpRefractVtxProgram == NULL || mpRefractSpecFragProgram == NULL) {
+ _refractProgram = pProgramManager->CreateProgram("refract", "refract");
+ _refractSpecProgram = pProgramManager->CreateProgram("refract", "refract_special");
+ if (!_refractProgram || !_refractSpecProgram) {
mbRefractionAvailable = false;
- Log(" Refraction will not be supported!\n");
+ Hpl1::logInfo(Hpl1::kDebugGraphics, "refraction will not be supported");
}
/////////////////////////////////////////////
// Create sky box graphics.
- Log(" init sky box\n");
+ Log("init sky box\n");
InitSkyBox();
- Log(" Renderer3D created\n");
+ Log("Renderer3D created\n");
}
//-----------------------------------------------------------------------
@@ -233,27 +209,19 @@ cRenderer3D::cRenderer3D(iLowLevelGraphics *apLowLevelGraphics, cResources *apRe
cRenderer3D::~cRenderer3D() {
hplDeleteArray(mRenderSettings.mpTempIndexArray);
- if (mRenderSettings.mpVtxExtrudeProgram)
- mpResources->GetGpuProgramManager()->Destroy(mRenderSettings.mpVtxExtrudeProgram);
- if (mRenderSettings.mpFragExtrudeProgram)
- mpResources->GetGpuProgramManager()->Destroy(mRenderSettings.mpFragExtrudeProgram);
+ if (mRenderSettings.extrudeProgram)
+ mpResources->GetGpuProgramManager()->Destroy(mRenderSettings.extrudeProgram);
- if (mpDiffuseVtxProgram)
- mpResources->GetGpuProgramManager()->Destroy(mpDiffuseVtxProgram);
- if (mpDiffuseFragProgram)
- mpResources->GetGpuProgramManager()->Destroy(mpDiffuseFragProgram);
+ if (_diffuseProgram)
+ mpResources->GetGpuProgramManager()->Destroy(_diffuseProgram);
- if (mpSolidFogVtxProgram)
- mpResources->GetGpuProgramManager()->Destroy(mpSolidFogVtxProgram);
- if (mpSolidFogFragProgram)
- mpResources->GetGpuProgramManager()->Destroy(mpSolidFogFragProgram);
+ if (_solidFogProgram)
+ mpResources->GetGpuProgramManager()->Destroy(_solidFogProgram);
- if (mpRefractVtxProgram)
- mpResources->GetGpuProgramManager()->Destroy(mpRefractVtxProgram);
- if (mpRefractFragProgram)
- mpResources->GetGpuProgramManager()->Destroy(mpRefractFragProgram);
- if (mpRefractSpecFragProgram)
- mpResources->GetGpuProgramManager()->Destroy(mpRefractSpecFragProgram);
+ if (_refractProgram)
+ mpResources->GetGpuProgramManager()->Destroy(_refractProgram);
+ if (_refractSpecProgram)
+ mpResources->GetGpuProgramManager()->Destroy(_refractSpecProgram);
if (mpSkyBox)
hplDelete(mpSkyBox);
@@ -286,9 +254,8 @@ void cRenderSettings::Clear() {
mBlendMode = eMaterialBlendMode_None;
mChannelMode = eMaterialChannelMode_RGBA;
- mpVertexProgram = NULL;
+ gpuProgram = nullptr;
mbVertexUseLight = false;
- mpFragmentProgram = NULL;
mpSector = NULL;
@@ -306,10 +273,8 @@ void cRenderSettings::Clear() {
}
void cRenderSettings::Reset(iLowLevelGraphics *apLowLevel) {
- if (mpVertexProgram)
- mpVertexProgram->UnBind();
- if (mpFragmentProgram)
- mpFragmentProgram->UnBind();
+ if (gpuProgram)
+ gpuProgram->UnBind();
if (mpVtxBuffer)
mpVtxBuffer->UnBind();
@@ -510,7 +475,7 @@ void cRenderer3D::SetSkyBoxColor(const cColor &aColor) {
//-----------------------------------------------------------------------
void cRenderer3D::SetFogActive(bool abX) {
- if (mpSolidFogVtxProgram)
+ if (_solidFogProgram)
mRenderSettings.mbFogActive = abX;
}
void cRenderer3D::SetFogStart(float afX) {
@@ -595,7 +560,7 @@ void cRenderer3D::InitSkyBox() {
//-----------------------------------------------------------------------
void cRenderer3D::RenderFog(cCamera3D *apCamera) {
- if (mRenderSettings.mbFogActive == false || mpSolidFogVtxProgram == NULL)
+ if (mRenderSettings.mbFogActive == false || !_solidFogProgram)
return;
int i;
//////////////////////////////////
@@ -608,23 +573,15 @@ void cRenderer3D::RenderFog(cCamera3D *apCamera) {
}
//////////////////////////////////
- // Set vertex program
- if (mRenderSettings.mpVertexProgram)
- mRenderSettings.mpVertexProgram->UnBind();
- mRenderSettings.mpVertexProgram = NULL;
- mpSolidFogVtxProgram->Bind();
+ // Set fog program
+ if (mRenderSettings.gpuProgram)
+ mRenderSettings.gpuProgram->UnBind();
+ mRenderSettings.gpuProgram = nullptr;
+ _solidFogProgram->Bind();
+ _solidFogProgram->SetColor3f("fogColor", mRenderSettings.mFogColor);
+ _solidFogProgram->SetFloat("fogStart", mRenderSettings.mfFogStart);
+ _solidFogProgram->SetFloat("fogEnd", mRenderSettings.mfFogEnd);
- mpSolidFogVtxProgram->SetColor3f("fogColor", mRenderSettings.mFogColor);
- mpSolidFogVtxProgram->SetFloat("fogStart", mRenderSettings.mfFogStart);
- mpSolidFogVtxProgram->SetFloat("fogEnd", mRenderSettings.mfFogEnd);
-
- //////////////////////////////////
- // Set fragment program
- if (mRenderSettings.mpFragmentProgram)
- mRenderSettings.mpFragmentProgram->UnBind();
- if (mpSolidFogFragProgram)
- mpSolidFogFragProgram->Bind();
- mRenderSettings.mpFragmentProgram = NULL;
//////////////////////////////////
// Blend mode
@@ -652,7 +609,7 @@ void cRenderer3D::RenderFog(cCamera3D *apCamera) {
mpLowLevelGraphics->SetMatrix(eMatrix_ModelView, cMath::MatrixMul(apCamera->GetViewMatrix(),
*pMtx));
- mpSolidFogVtxProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
+ _solidFogProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
eGpuProgramMatrixOp_Identity);
}
//////////////////
@@ -660,7 +617,7 @@ void cRenderer3D::RenderFog(cCamera3D *apCamera) {
else {
mpLowLevelGraphics->SetMatrix(eMatrix_ModelView, apCamera->GetViewMatrix());
- mpSolidFogVtxProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
+ _solidFogProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
eGpuProgramMatrixOp_Identity);
}
@@ -669,9 +626,7 @@ void cRenderer3D::RenderFog(cCamera3D *apCamera) {
pObject->GetVertexBuffer()->UnBind();
}
- mpSolidFogVtxProgram->UnBind();
- if (mpSolidFogFragProgram)
- mpSolidFogFragProgram->UnBind();
+ _solidFogProgram->UnBind();
}
//-----------------------------------------------------------------------
@@ -680,21 +635,15 @@ void cRenderer3D::RenderSkyBox(cCamera3D *apCamera) {
if (mbSkyBoxActive == false)
return;
- if (mbLog)
- Log(" Drawing skybox\n");
+ Hpl1::logInfo(Hpl1::kDebugRenderer, "Drawing skybox");
- if (mRenderSettings.mpVertexProgram) {
- mRenderSettings.mpVertexProgram->UnBind();
- mRenderSettings.mpVertexProgram = NULL;
+ if (mRenderSettings.gpuProgram) {
+ mRenderSettings.gpuProgram->UnBind();
+ mRenderSettings.gpuProgram = nullptr;
if (mbLog)
Log(" Setting Vertex program: NULL\n");
}
- if (mRenderSettings.mpFragmentProgram) {
- mRenderSettings.mpFragmentProgram->UnBind();
- mRenderSettings.mpFragmentProgram = NULL;
- if (mbLog)
- Log(" Setting Fragment program: NULL\n");
- }
+
if (mRenderSettings.mpVtxBuffer) {
mRenderSettings.mpVtxBuffer->UnBind();
mRenderSettings.mpVtxBuffer = NULL;
@@ -751,23 +700,23 @@ void cRenderer3D::RenderZ(cCamera3D *apCamera) {
//-----------------------------------------------------------------------
void cRenderer3D::RenderOcclusionQueries(cCamera3D *apCamera) {
+#if 0
//////////////////////////////////////////////////
// Reset any vertex buffers,fragment or vertex programs.
if (mRenderSettings.mpFragmentProgram)
mRenderSettings.mpFragmentProgram->UnBind();
mRenderSettings.mpFragmentProgram = NULL;
+#endif
////////////////////////////
// Vertex program
- if (mRenderSettings.mpVertexProgram != mpDiffuseVtxProgram) {
- if (mRenderSettings.mpVertexProgram)
- mRenderSettings.mpVertexProgram->UnBind();
- mRenderSettings.mpVertexProgram = mpDiffuseVtxProgram;
-
- mpDiffuseVtxProgram->Bind();
- if (mbLog)
- Log(" Binding vertex program %d\n", mpDiffuseVtxProgram);
+ if (mRenderSettings.gpuProgram != _diffuseProgram) {
+ if (mRenderSettings.gpuProgram)
+ mRenderSettings.gpuProgram->UnBind();
+ mRenderSettings.gpuProgram = _diffuseProgram;
+ _diffuseProgram->Bind();
+ Hpl1::logInfo(Hpl1::kDebugGraphics, "binding Rendered3D::_diffuseProgram");
}
////////////////////////
@@ -821,8 +770,8 @@ void cRenderer3D::RenderOcclusionQueries(cCamera3D *apCamera) {
}
pPrevMatrix = pObject->mpMatrix;
// Set the vertex program matrix.
- if (mpDiffuseVtxProgram)
- mpDiffuseVtxProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
+ if (_diffuseProgram)
+ _diffuseProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
eGpuProgramMatrixOp_Identity);
if (mbLog)
@@ -967,11 +916,6 @@ void cRenderer3D::RenderTrans(cCamera3D *apCamera) {
eMaterialBlendMode blendMode = pMaterial->GetBlendMode(eMaterialRenderType_Diffuse, 0, NULL);
- iGpuProgram *pVtxProgram = pMaterial->GetVertexProgram(eMaterialRenderType_Diffuse, 0, NULL);
- iMaterialProgramSetup *pVtxProgramSetup = pMaterial->GetVertexProgramSetup(eMaterialRenderType_Diffuse, 0, NULL);
-
- iGpuProgram *pFragProgram = pMaterial->GetFragmentProgram(eMaterialRenderType_Diffuse, 0, NULL);
-
for (int i = 0; i < MAX_TEXTUREUNITS; ++i)
vTextures[i] = pMaterial->GetTexture(i, eMaterialRenderType_Diffuse, 0, NULL);
@@ -1000,10 +944,8 @@ void cRenderer3D::RenderTrans(cCamera3D *apCamera) {
Log(" Unbind vtx buffer, vtx program and frag program\n");
if (mRenderSettings.mpVtxBuffer)
mRenderSettings.mpVtxBuffer->UnBind();
- if (mRenderSettings.mpVertexProgram)
- mRenderSettings.mpVertexProgram->UnBind();
- if (mRenderSettings.mpFragmentProgram)
- mRenderSettings.mpFragmentProgram->UnBind();
+ if (mRenderSettings.gpuProgram)
+ mRenderSettings.gpuProgram->UnBind();
/////////////////////////////////////
// Alpha and blend mode
@@ -1146,24 +1088,20 @@ void cRenderer3D::RenderTrans(cCamera3D *apCamera) {
Log(" Special = true\n");
}
- iGpuProgram *pRefractVtxProgram = nullptr; //pMaterial->GetRefractionVertexProgam();
- iGpuProgram *pRefractFragProgram = nullptr; //pMaterial->GetRefractionFragmentProgam();
-
- if (pRefractFragProgram == NULL) {
+ iGpuProgram *refractProgram = pMaterial->getRefractionProgram();
+ if (!refractProgram) {
if (bSpecial)
- pRefractFragProgram = mpRefractSpecFragProgram;
+ refractProgram = _refractSpecProgram;
else
- pRefractFragProgram = mpRefractFragProgram;
+ refractProgram = _refractProgram;
}
- if (pRefractVtxProgram == NULL)
- pRefractVtxProgram = mpRefractVtxProgram;
+
+ mRenderSettings.gpuProgram = refractProgram;
+ refractProgram->Bind();
+ Hpl1::logInfo(Hpl1::kDebugRenderer, "Binding gpu program '%s'", refractProgram->GetName().c_str());
/////////////////////////////////////
- // Vertex program
- mRenderSettings.mpVertexProgram = pRefractVtxProgram;
- pRefractVtxProgram->Bind();
- if (bLog)
- Log(" Binding vtx program '%s' (%d)\n", pRefractVtxProgram->GetName().c_str(), pRefractVtxProgram);
+ // Vertex shader
mRenderSettings.mbMatrixWasNULL = false;
// Model matrix
@@ -1175,8 +1113,7 @@ void cRenderer3D::RenderTrans(cCamera3D *apCamera) {
mpLowLevelGraphics->SetMatrix(eMatrix_ModelView, apCamera->GetViewMatrix());
mRenderSettings.mbMatrixWasNULL = true;
}
-
- pRefractVtxProgram->SetMatrixf("worldViewProj",
+ refractProgram->SetMatrixf("worldViewProj",
eGpuProgramMatrix_ViewProjection,
eGpuProgramMatrixOp_Identity);
@@ -1184,29 +1121,23 @@ void cRenderer3D::RenderTrans(cCamera3D *apCamera) {
if (pMaterial->GetRefractionUsesEye()) {
if (pModelMatrix) {
cVector3f vLocalEye = cMath::MatrixMul(*pInvModelMatrix, apCamera->GetEyePosition());
- pRefractVtxProgram->SetVec3f("EyePos", vLocalEye);
+ refractProgram->SetVec3f("EyePos", vLocalEye);
} else {
- pRefractVtxProgram->SetVec3f("EyePos", apCamera->GetEyePosition());
+ refractProgram->SetVec3f("EyePos", apCamera->GetEyePosition());
}
}
/////////////////////////////////////
- // Fragment program
- if (bLog)
- Log(" Binding frag program '%s' (%d)\n", pRefractFragProgram->GetName().c_str(), pRefractFragProgram);
- pRefractFragProgram->Bind();
-
- mRenderSettings.mpFragmentProgram = pRefractFragProgram;
-
- pRefractFragProgram->SetVec2f("screenSize", mpLowLevelGraphics->GetScreenSize());
+ // Fragment shader
+ refractProgram->SetVec2f("screenSize", mpLowLevelGraphics->GetScreenSize());
if (bSpecial) {
- pRefractFragProgram->SetFloat("t", mfRenderTime * pRefraction->GetFrameTime());
+ refractProgram->SetFloat("t", mfRenderTime * pRefraction->GetFrameTime());
} else if (pMaterial->GetRefractionUsesTime()) {
- pRefractFragProgram->SetFloat("t", mfRenderTime);
+ refractProgram->SetFloat("t", mfRenderTime);
}
- pRefractFragProgram->SetFloat("scale", pMaterial->GetValue());
+ refractProgram->SetFloat("scale", pMaterial->GetValue());
////////////////////////////////////
// Textures
@@ -1326,53 +1257,22 @@ void cRenderer3D::RenderTrans(cCamera3D *apCamera) {
}
}
- /////////////////////////////////////////////////
- // Vertex program
- if (pVtxProgram != mRenderSettings.mpVertexProgram) {
- if (bLog) {
- if (pVtxProgram)
- Log(" Set vtx program '%s' (%d)\n", pVtxProgram->GetName().c_str(), pVtxProgram);
- else
- Log(" Set vtx program NULL\n");
- }
- if (mRenderSettings.mpVertexProgram) // && pVtxProgram==NULL) //Why null??
- {
- mRenderSettings.mpVertexProgram->UnBind();
- }
- mRenderSettings.mpVertexProgram = pVtxProgram;
-
- if (pVtxProgram) {
- pVtxProgram->Bind();
-
- if (pVtxProgramSetup) {
- pVtxProgramSetup->Setup(pVtxProgram, &mRenderSettings);
- }
- mRenderSettings.mpVtxProgramSetup = pVtxProgramSetup;
-
- // reset this so all matrix setting are set to vertex program.
+ iGpuProgram *gpuProgram = pMaterial->getGpuProgram(eMaterialRenderType_Diffuse, 0, nullptr);
+ iMaterialProgramSetup *gpuProgramSetup = pMaterial->getGpuProgramSetup(eMaterialRenderType_Diffuse, 0, NULL);
+
+ if (gpuProgram != mRenderSettings.gpuProgram) {
+ if (mRenderSettings.gpuProgram)
+ mRenderSettings.gpuProgram->UnBind();
+ mRenderSettings.gpuProgram = gpuProgram;
+ if (gpuProgram) {
+ gpuProgram->Bind();
+ if (gpuProgramSetup)
+ gpuProgramSetup->Setup(gpuProgram, &mRenderSettings);
+ mRenderSettings.gpuProgramSetup = gpuProgramSetup;
mRenderSettings.mbMatrixWasNULL = false;
}
}
- /////////////////////////////////////////////////
- // Fragment program
- if (pFragProgram != mRenderSettings.mpFragmentProgram) {
- if (bLog) {
- if (pFragProgram)
- Log(" Set frag program '%s' (%d)\n", pFragProgram->GetName().c_str(), pFragProgram);
- else
- Log(" Set frag program NULL\n");
- }
- if (mRenderSettings.mpFragmentProgram)
- mRenderSettings.mpFragmentProgram->UnBind();
-
- mRenderSettings.mpFragmentProgram = pFragProgram;
-
- if (pFragProgram) {
- pFragProgram->Bind();
- }
- }
-
/////////////////////////////////////////////////
// Texture
for (int i = 0; i < MAX_TEXTUREUNITS; i++) {
@@ -1423,29 +1323,27 @@ void cRenderer3D::RenderTrans(cCamera3D *apCamera) {
bSetVtxProgMatrix = true;
}
- if (mRenderSettings.mpVertexProgram && bSetVtxProgMatrix) {
+ if (mRenderSettings.gpuProgram && bSetVtxProgMatrix) {
// Might be quicker if this is set directly
- mRenderSettings.mpVertexProgram->SetMatrixf("worldViewProj",
+ mRenderSettings.gpuProgram->SetMatrixf("worldViewProj",
eGpuProgramMatrix_ViewProjection,
eGpuProgramMatrixOp_Identity);
- if (mRenderSettings.mpVtxProgramSetup) {
- mRenderSettings.mpVtxProgramSetup->SetupMatrix(pModelMatrix, &mRenderSettings);
+ if (mRenderSettings.gpuProgramSetup) {
+ mRenderSettings.gpuProgramSetup->SetupMatrix(pModelMatrix, &mRenderSettings);
}
}
///////////////////////////////////////////
/// Draw
if (bLog)
- Log(" Draw\n");
+ Log("Draw\n");
pVtxBuffer->Draw();
}
if (mRenderSettings.mpVtxBuffer)
mRenderSettings.mpVtxBuffer->UnBind();
- if (mRenderSettings.mpVertexProgram)
- mRenderSettings.mpVertexProgram->UnBind();
- if (mRenderSettings.mpFragmentProgram)
- mRenderSettings.mpFragmentProgram->UnBind();
+ if (mRenderSettings.gpuProgram)
+ mRenderSettings.gpuProgram->UnBind();
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/graphics/Renderer3D.h b/engines/hpl1/engine/graphics/Renderer3D.h
index ceb33857803..64052bd925a 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.h
+++ b/engines/hpl1/engine/graphics/Renderer3D.h
@@ -28,6 +28,7 @@
#ifndef HPL_RENDERER3D_H
#define HPL_RENDERER3D_H
+#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/Material.h"
#include "hpl1/engine/math/Frustum.h"
@@ -81,8 +82,7 @@ public:
void Reset(iLowLevelGraphics *apLowLevel);
// Setings that doesn't change:
- iGpuProgram *mpVtxExtrudeProgram;
- iGpuProgram *mpFragExtrudeProgram;
+ iGpuProgram *extrudeProgram;
iLowLevelGraphics *mpLowLevel;
unsigned int *mpTempIndexArray;
@@ -113,6 +113,8 @@ public:
eMaterialBlendMode mBlendMode;
eMaterialChannelMode mChannelMode;
+ iGpuProgram *gpuProgram;
+ iMaterialProgramSetup *gpuProgramSetup;
iGpuProgram *mpVertexProgram;
bool mbVertexUseLight;
iMaterialProgramSetup *mpVtxProgramSetup;
@@ -226,19 +228,16 @@ private:
float mfRenderTime;
- iGpuProgram *mpDiffuseVtxProgram;
- iGpuProgram *mpDiffuseFragProgram;
- iGpuProgram *mpSolidFogVtxProgram;
- iGpuProgram *mpSolidFogFragProgram;
+ iGpuProgram *_diffuseProgram;
+ iGpuProgram *_solidFogProgram;
iTexture *mpFogLinearSolidTexture;
iTexture *mpFogLinearAddTexture;
iTexture *mpFogLinearAlphaTexture;
- iGpuProgram *mpRefractVtxProgram;
- iGpuProgram *mpRefractFragProgram;
- iGpuProgram *mpRefractSpecFragProgram;
+ iGpuProgram *_refractProgram;
+ iGpuProgram *_refractSpecProgram;
bool mbRefractionAvailable;
bool mbRefractionUsed;
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.cpp b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
index 6ff62a5fc6e..bd6e3458659 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.cpp
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
@@ -26,6 +26,7 @@
*/
#include "hpl1/engine/graphics/RendererPostEffects.h"
+#include "hpl1/debug.h"
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/graphics/RenderList.h"
@@ -86,44 +87,17 @@ cRendererPostEffects::cRendererPostEffects(iLowLevelGraphics *apLowLevelGraphics
///////////////////////////////////////////
// Create programs
-
- Log(" Creating programs\n");
+ Hpl1::logInfo(Hpl1::kDebugRenderer,"Creating RendererPostEffects programs");
/////////////////
// Blur programs
mbBlurFallback = false; // Set to true if the fallbacks are used.
-
- mpBlurVP = mpGpuManager->CreateProgram("PostEffect_Blur_vp.cg", "main", eGpuProgramType_Vertex);
- if (!mpBlurVP)
- Error("Couldn't load 'PostEffect_Blur_vp.cg'!\n");
-
- mpBlurRectFP = mpGpuManager->CreateProgram("PostEffect_Blur_Rect_fp.cg", "main", eGpuProgramType_Fragment);
- /*if(!mpBlurRectFP)
- {
- mbBlurFallback = true;
- Log(" Using Blur Rect FP fallback\n");
- mpBlurRectFP = mpGpuManager->CreateProgram("PostEffect_Fallback01_Blur_Rect_fp.cg","main",eGpuProgramType_Fragment);
- if(!mpBlurRectFP) Error("Couldn't load 'PostEffect_Blur_Rect_fp.cg'!\n");
- }*/
-
- mpBlur2dFP = mpGpuManager->CreateProgram("PostEffect_Blur_2D_fp.cg", "main", eGpuProgramType_Fragment);
- /*if(!mpBlur2dFP)
- {
- mbBlurFallback = true;
- Log(" Using Blur 2D FP fallback\n");
- mpBlur2dFP = mpGpuManager->CreateProgram("PostEffect_Fallback01_Blur_2D_fp.cg","main",eGpuProgramType_Fragment);
- if(!mpBlur2dFP) Error("Couldn't load 'PostEffect_Blur_2D_fp.cg'!\n");
- }*/
+ _blur2DProgram = mpGpuManager->CreateProgram("PostEffect_Blur", "PostEffect_Blur_2D");
+ _blurRectProgram = mpGpuManager->CreateProgram("PostEffect_Blur", "PostEffect_Blur_Rect");
/////////////////
// Bloom programs
- mpBloomVP = mpGpuManager->CreateProgram("PostEffect_Bloom_vp.cg", "main", eGpuProgramType_Vertex);
- if (!mpBloomVP)
- Error("Couldn't load 'PostEffect_Bloom_vp.cg'!\n");
-
- mpBloomFP = mpGpuManager->CreateProgram("PostEffect_Bloom_fp.cg", "main", eGpuProgramType_Fragment);
- if (!mpBloomFP)
- Error("Couldn't load 'PostEffect_Bloom_fp.cg'!\n");
+ _bloomProgram = mpGpuManager->CreateProgram("PostEffect_Bloom", "PostEffect_Bloom");
// Bloom blur textures
mpBloomBlurTexture = mpLowLevelGraphics->CreateTexture(
@@ -140,31 +114,11 @@ cRendererPostEffects::cRendererPostEffects(iLowLevelGraphics *apLowLevelGraphics
/////////////////
// MotionBlur programs
- mpMotionBlurVP = mpGpuManager->CreateProgram("PostEffect_Motion_vp.cg", "main", eGpuProgramType_Vertex);
- if (!mpMotionBlurVP)
- Error("Couldn't load 'PostEffect_Motion_vp.cg'!\n");
-
- // Disable the dynamic loop version on Mac OS X until we figure why it doesn't work
- mpMotionBlurFP = NULL;
-#ifndef __APPLE__
- mpMotionBlurFP = mpGpuManager->CreateProgram("PostEffect_Motion_fp.cg", "main", eGpuProgramType_Fragment);
-#endif
- if (!mpMotionBlurFP) {
- Log("Dynamic loops in motion blur fp not supported, loading static instead.\n");
- mpMotionBlurFP = mpGpuManager->CreateProgram("PostEffect_Motion_staticloop_fp.cg", "main", eGpuProgramType_Fragment);
- if (!mpMotionBlurFP)
- Error("Couldn't load 'PostEffect_Motion_fp.cg'!\n");
- }
+ _motionBlurProgram = mpGpuManager->CreateProgram("PostEffect_Motion", "PostEffect_Motion"); // CHECK APPLE
/////////////////
// Depth of Field programs
- mpDepthOfFieldVP = mpGpuManager->CreateProgram("PostEffect_DoF_vp.cg", "main", eGpuProgramType_Vertex);
- if (!mpDepthOfFieldVP)
- Error("Couldn't load 'PostEffect_DoF_vp.cg'!\n");
-
- mpDepthOfFieldFP = mpGpuManager->CreateProgram("PostEffect_DoF_fp.cg", "main", eGpuProgramType_Fragment);
- if (!mpDepthOfFieldFP)
- Error("Couldn't load 'PostEffect_DoF_fp.cg'!\n");
+ _depthOfFieldProgram = mpGpuManager->CreateProgram("PostEffect_DoF", "PostEffect_DoF");
// Depth of Field blur textures
mpDofBlurTexture = mpLowLevelGraphics->CreateTexture(cVector2l(256, 256),
@@ -178,7 +132,7 @@ cRendererPostEffects::cRendererPostEffects(iLowLevelGraphics *apLowLevelGraphics
mpDofBlurTexture->SetWrapT(eTextureWrap_ClampToEdge);
}
- Log(" RendererPostEffects created\n");
+ Log("RendererPostEffects created\n");
////////////////////////////////////
// Variable setup
@@ -211,27 +165,19 @@ cRendererPostEffects::~cRendererPostEffects() {
if (mpScreenBuffer[i])
hplDelete(mpScreenBuffer[i]);
- if (mpBlurVP)
- mpGpuManager->Destroy(mpBlurVP);
- if (mpBlur2dFP)
- mpGpuManager->Destroy(mpBlur2dFP);
- if (mpBlurRectFP)
- mpGpuManager->Destroy(mpBlurRectFP);
+ if (_blur2DProgram)
+ mpGpuManager->Destroy(_blur2DProgram);
+ if (_blurRectProgram)
+ mpGpuManager->Destroy(_blurRectProgram);
- if (mpBloomVP)
- mpGpuManager->Destroy(mpBloomVP);
- if (mpBloomFP)
- mpGpuManager->Destroy(mpBloomFP);
+ if (_bloomProgram)
+ mpGpuManager->Destroy(_bloomProgram);
- if (mpMotionBlurVP)
- mpGpuManager->Destroy(mpMotionBlurVP);
- if (mpMotionBlurFP)
- mpGpuManager->Destroy(mpMotionBlurFP);
+ if (_motionBlurProgram)
+ mpGpuManager->Destroy(_motionBlurProgram);
- if (mpDepthOfFieldVP)
- mpGpuManager->Destroy(mpDepthOfFieldVP);
- if (mpDepthOfFieldFP)
- mpGpuManager->Destroy(mpDepthOfFieldFP);
+ if (_depthOfFieldProgram)
+ mpGpuManager->Destroy(_depthOfFieldProgram);
if (mpBloomBlurTexture)
hplDelete(mpBloomBlurTexture);
@@ -296,7 +242,7 @@ void cRendererPostEffects::Render() {
void cRendererPostEffects::RenderBlurTexture(iTexture *apDestination, iTexture *apSource,
float afBlurAmount) {
bool bProgramsLoaded = false;
- if (mpBlurRectFP && mpBlur2dFP && mpBlurVP)
+ if (_blur2DProgram && _blurRectProgram)
bProgramsLoaded = true;
iLowLevelGraphics *pLowLevel = mpLowLevelGraphics;
@@ -313,14 +259,11 @@ void cRendererPostEffects::RenderBlurTexture(iTexture *apDestination, iTexture *
// Shader setup
if (bProgramsLoaded) {
// Setup vertex program
- mpBlurVP->Bind();
- mpBlurVP->SetFloat("xOffset", 1);
- mpBlurVP->SetFloat("yOffset", 0);
- mpBlurVP->SetFloat("amount", afBlurAmount);
- mpBlurVP->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection, eGpuProgramMatrixOp_Identity);
-
- // Setup fragment program
- mpBlurRectFP->Bind();
+ _blurRectProgram->Bind();
+ _blurRectProgram->SetFloat("xOffset", 1);
+ _blurRectProgram->SetFloat("yOffset", 0);
+ _blurRectProgram->SetFloat("amount", afBlurAmount);
+ _blurRectProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection, eGpuProgramMatrixOp_Identity);
}
// Draw the screen texture with blur
@@ -347,12 +290,10 @@ void cRendererPostEffects::RenderBlurTexture(iTexture *apDestination, iTexture *
// Setup shaders
// Shader setup
if (bProgramsLoaded) {
- mpBlurVP->SetFloat("xOffset", 0);
- mpBlurVP->SetFloat("yOffset", 1);
- mpBlurVP->SetFloat("amount", (1 / pLowLevel->GetScreenSize().x) * afBlurAmount);
-
- mpBlurRectFP->UnBind();
- mpBlur2dFP->Bind();
+ _blur2DProgram->Bind();
+ _blur2DProgram->SetFloat("xOffset", 0);
+ _blur2DProgram->SetFloat("yOffset", 1);
+ _blur2DProgram->SetFloat("amount", (1 / pLowLevel->GetScreenSize().x) * afBlurAmount);
}
// Set texture and draw
@@ -373,8 +314,7 @@ void cRendererPostEffects::RenderBlurTexture(iTexture *apDestination, iTexture *
// Shader setup
if (bProgramsLoaded) {
- mpBlur2dFP->UnBind();
- mpBlurVP->UnBind();
+ _blur2DProgram->UnBind();
}
pLowLevel->CopyContextToTexure(apDestination, 0, vBlurSize);
@@ -397,7 +337,7 @@ void cRendererPostEffects::RenderDepthOfField() {
if (mbDofActive == false)
return;
- if (mpDepthOfFieldFP == NULL || mpDepthOfFieldVP == NULL)
+ if (!_depthOfFieldProgram)
return;
//////////////////////////////
@@ -463,12 +403,10 @@ void cRendererPostEffects::RenderDepthOfField() {
mpLowLevelGraphics->SetBlendActive(false);
// Setup
- mpDepthOfFieldVP->Bind();
-
- mpDepthOfFieldFP->Bind();
- mpDepthOfFieldFP->SetVec3f("planes", cVector3f(mfDofNearPlane, mfDofFocalPlane, mfDofFarPlane));
- mpDepthOfFieldFP->SetFloat("maxBlur", mfDofMaxBlur);
- mpDepthOfFieldFP->SetVec2f("screenSize", mvScreenSize);
+ _depthOfFieldProgram->Bind();
+ _depthOfFieldProgram->SetVec3f("planes", cVector3f(mfDofNearPlane, mfDofFocalPlane, mfDofFarPlane));
+ _depthOfFieldProgram->SetFloat("maxBlur", mfDofMaxBlur);
+ _depthOfFieldProgram->SetVec2f("screenSize", mvScreenSize);
//////////////////
// Render objects
@@ -482,7 +420,7 @@ void cRendererPostEffects::RenderDepthOfField() {
if (pMtx) {
mpLowLevelGraphics->SetMatrix(eMatrix_ModelView, cMath::MatrixMul(pCam->GetViewMatrix(), *pMtx));
- mpDepthOfFieldVP->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
+ _depthOfFieldProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
eGpuProgramMatrixOp_Identity);
}
//////////////////
@@ -490,7 +428,7 @@ void cRendererPostEffects::RenderDepthOfField() {
else {
mpLowLevelGraphics->SetMatrix(eMatrix_ModelView, pCam->GetViewMatrix());
- mpDepthOfFieldVP->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
+ _depthOfFieldProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
eGpuProgramMatrixOp_Identity);
}
@@ -509,8 +447,7 @@ void cRendererPostEffects::RenderDepthOfField() {
mpLowLevelGraphics->SetDepthWriteActive(true);
// Reset stuff
- mpDepthOfFieldFP->UnBind();
- mpDepthOfFieldVP->UnBind();
+ _depthOfFieldProgram->UnBind();
mpLowLevelGraphics->SetTexture(0, NULL);
mpLowLevelGraphics->SetTexture(1, NULL);
}
@@ -521,7 +458,7 @@ void cRendererPostEffects::RenderMotionBlur() {
if (mbMotionBlurActive == false)
return;
- if (mpMotionBlurFP == NULL || mpMotionBlurVP == NULL)
+ if (!_motionBlurProgram)
return;
//////////////////////////////
@@ -549,11 +486,9 @@ void cRendererPostEffects::RenderMotionBlur() {
cMotionBlurObjectIterator it = mpRenderList->GetMotionBlurIterator();
// Setup
- mpMotionBlurVP->Bind();
- mpMotionBlurVP->SetFloat("blurScale", mfMotionBlurAmount);
-
- mpMotionBlurFP->Bind();
- mpMotionBlurFP->SetVec2f("halfScreenSize",
+ _motionBlurProgram->Bind();
+ _motionBlurProgram->SetFloat("blurScale", mfMotionBlurAmount);
+ _motionBlurProgram->SetVec2f("halfScreenSize",
cVector2f((float)pScreenTexture->getWidth() / 2.0f,
(float)pScreenTexture->getHeight() / 2.0f));
@@ -572,7 +507,7 @@ void cRendererPostEffects::RenderMotionBlur() {
mpLowLevelGraphics->SetMatrix(eMatrix_ModelView, cMath::MatrixMul(pCam->GetViewMatrix(), *pMtx));
- mpMotionBlurVP->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
+ _motionBlurProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
eGpuProgramMatrixOp_Identity);
cMatrixf mtxModelView = cMath::MatrixMul(pCam->GetViewMatrix(), *pMtx);
@@ -580,16 +515,16 @@ void cRendererPostEffects::RenderMotionBlur() {
cMatrixf mtxPrevViewProj = cMath::MatrixMul(pCam->GetPrevProjection(), mtxPrevModelView);
- mpMotionBlurVP->SetMatrixf("prevWorldViewProj", mtxPrevViewProj);
- mpMotionBlurVP->SetMatrixf("modelView", mtxModelView);
- mpMotionBlurVP->SetMatrixf("prevModelView", mtxPrevModelView);
+ _motionBlurProgram->SetMatrixf("prevWorldViewProj", mtxPrevViewProj);
+ _motionBlurProgram->SetMatrixf("modelView", mtxModelView);
+ _motionBlurProgram->SetMatrixf("prevModelView", mtxPrevModelView);
}
//////////////////
// NULL Model view matrix (static)
else {
mpLowLevelGraphics->SetMatrix(eMatrix_ModelView, pCam->GetViewMatrix());
- mpMotionBlurVP->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
+ _motionBlurProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection,
eGpuProgramMatrixOp_Identity);
const cMatrixf &mtxModelView = pCam->GetViewMatrix();
@@ -597,9 +532,9 @@ void cRendererPostEffects::RenderMotionBlur() {
cMatrixf mtxPrevViewProj = cMath::MatrixMul(pCam->GetPrevProjection(), mtxPrevModelView);
- mpMotionBlurVP->SetMatrixf("prevWorldViewProj", mtxPrevViewProj);
- mpMotionBlurVP->SetMatrixf("modelView", mtxModelView);
- mpMotionBlurVP->SetMatrixf("prevModelView", mtxPrevModelView);
+ _motionBlurProgram->SetMatrixf("prevWorldViewProj", mtxPrevViewProj);
+ _motionBlurProgram->SetMatrixf("modelView", mtxModelView);
+ _motionBlurProgram->SetMatrixf("prevModelView", mtxPrevModelView);
}
pObject->GetVertexBuffer()->Bind();
@@ -614,8 +549,7 @@ void cRendererPostEffects::RenderMotionBlur() {
}
// Reset stuff
- mpMotionBlurFP->UnBind();
- mpMotionBlurVP->UnBind();
+ _motionBlurProgram->UnBind();
mpLowLevelGraphics->SetTexture(0, NULL);
mpLowLevelGraphics->SetTexture(1, NULL);
@@ -630,7 +564,7 @@ void cRendererPostEffects::RenderBloom() {
if (mbBloomActive == false)
return;
- if (mpBloomFP == NULL || mpBloomVP == NULL)
+ if (!_bloomProgram)
return;
//////////////////////////////
@@ -654,12 +588,9 @@ void cRendererPostEffects::RenderBloom() {
///////////////////////////////////////////
// Draw Bloom
- // Setup vertex program
- mpBloomVP->Bind();
- mpBloomVP->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection, eGpuProgramMatrixOp_Identity);
-
- // Setup fragment program
- mpBloomFP->Bind();
+ // Setup bloom program
+ _bloomProgram->Bind();
+ _bloomProgram->SetMatrixf("worldViewProj", eGpuProgramMatrix_ViewProjection, eGpuProgramMatrixOp_Identity);
mpLowLevelGraphics->SetTexture(0, mpBloomBlurTexture);
mpLowLevelGraphics->SetTexture(1, pScreenTexture);
@@ -682,8 +613,7 @@ void cRendererPostEffects::RenderBloom() {
mpLowLevelGraphics->DrawQuadMultiTex(mvTexRectVtx, vUvVec);
}
- mpBloomVP->UnBind();
- mpBloomFP->UnBind();
+ _bloomProgram->UnBind();
mpLowLevelGraphics->SetTexture(0, NULL);
mpLowLevelGraphics->SetTexture(1, NULL);
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.h b/engines/hpl1/engine/graphics/RendererPostEffects.h
index 579ee178175..4379f01d46e 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.h
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.h
@@ -149,21 +149,17 @@ private:
cImageTrailEffect mImageTrailData;
- iGpuProgram *mpBlurVP;
- iGpuProgram *mpBlur2dFP;
- iGpuProgram *mpBlurRectFP;
+ iGpuProgram *_blur2DProgram;
+ iGpuProgram *_blurRectProgram;
bool mbBlurFallback;
- iGpuProgram *mpBloomVP;
- iGpuProgram *mpBloomFP;
+ iGpuProgram *_bloomProgram;
iTexture *mpBloomBlurTexture;
- iGpuProgram *mpMotionBlurVP;
- iGpuProgram *mpMotionBlurFP;
+ iGpuProgram *_motionBlurProgram;
- iGpuProgram *mpDepthOfFieldVP;
- iGpuProgram *mpDepthOfFieldFP;
+ iGpuProgram *_depthOfFieldProgram;
iTexture *mpDofBlurTexture;
tVertexVec mvTexRectVtx;
diff --git a/engines/hpl1/engine/scene/Light3D.cpp b/engines/hpl1/engine/scene/Light3D.cpp
index 396979ef672..f94abe9ba44 100644
--- a/engines/hpl1/engine/scene/Light3D.cpp
+++ b/engines/hpl1/engine/scene/Light3D.cpp
@@ -302,7 +302,7 @@ bool iLight3D::BeginDraw(cRenderSettings *apRenderSettings, iLowLevelGraphics *a
//////////////////////////////////////////////////////////
// Cast shadows
- if (mbCastShadows && apRenderSettings->mShowShadows != eRendererShowShadows_None && apRenderSettings->mpVtxExtrudeProgram != NULL) {
+ if (mbCastShadows && apRenderSettings->mShowShadows != eRendererShowShadows_None && apRenderSettings->extrudeProgram) {
// Get temp index array. (Remove this when the index pool
// is implemented.).
mpIndexArray = apRenderSettings->mpTempIndexArray;
@@ -343,21 +343,14 @@ bool iLight3D::BeginDraw(cRenderSettings *apRenderSettings, iLowLevelGraphics *a
apRenderSettings->mbMatrixWasNULL = false;
// Set the fragment program.
- if (apRenderSettings->mpFragExtrudeProgram) {
+ if (apRenderSettings->extrudeProgram) {
if (apRenderSettings->mbLog)
Log("Setting fragment program: '%s'\n",
- apRenderSettings->mpFragExtrudeProgram->GetName().c_str());
- apRenderSettings->mpFragExtrudeProgram->Bind();
- apRenderSettings->mpFragmentProgram = apRenderSettings->mpFragExtrudeProgram;
+ apRenderSettings->extrudeProgram->GetName().c_str());
+ apRenderSettings->extrudeProgram->Bind();
+ apRenderSettings->gpuProgram = apRenderSettings->extrudeProgram;
}
- // Set the vertex program.
- if (apRenderSettings->mbLog)
- Log("Setting vertex program: '%s'\n",
- apRenderSettings->mpVtxExtrudeProgram->GetName().c_str());
- apRenderSettings->mpVtxExtrudeProgram->Bind();
- apRenderSettings->mpVertexProgram = apRenderSettings->mpVtxExtrudeProgram;
-
// Render shadows
tCasterCacheSetIt it = m_setDynamicCasters.begin();
@@ -756,8 +749,8 @@ void iLight3D::RenderShadow(iRenderable *apObject, cRenderSettings *apRenderSett
// Set light position and model view matrix, this does not have to be set if last
// object was static.
if (pModelMtx || apRenderSettings->mbMatrixWasNULL == false) {
- apRenderSettings->mpVtxExtrudeProgram->SetVec3f("lightPosition", vLocalLight);
- apRenderSettings->mpVtxExtrudeProgram->SetMatrixf("worldViewProj",
+ apRenderSettings->extrudeProgram->SetVec3f("lightPosition", vLocalLight);
+ apRenderSettings->extrudeProgram->SetMatrixf("worldViewProj",
eGpuProgramMatrix_ViewProjection,
eGpuProgramMatrixOp_Identity);
Commit: ff521fce432907104cb0f9afebf6f274aa017d4d
https://github.com/scummvm/scummvm/commit/ff521fce432907104cb0f9afebf6f274aa017d4d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:41+01:00
Commit Message:
HPL1: fix shader code
Changed paths:
engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
engines/hpl1/engine/impl/shaders/BumpSpec_Light.fragment
engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
diff --git a/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment b/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
index 4040200f4e1..f61a042256b 100644
--- a/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
@@ -29,13 +29,13 @@ void main()
vec3 bumpVec = texture(tex1, vUv).xyz;
bumpVec.xyz = (2.0*bumpVec.xyz)-vec3(1.0);
- vLightDir = normalize(vLightDir);
- vHalfVec = normalize(vHalfVec);
+ vec3 normLightDir = normalize(vLightDir);
+ vec3 normHalfVec = normalize(vHalfVec);
- float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
+ float specular = clamp(dot(normHalfVec, bumpVec.xyz), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w;
- outColor.xyz = texture(tex0, vUv).xyz * vLightColor.xyz * dot(vLightDir, bumpVec.xyz)
+ outColor.xyz = texture(tex0, vUv).xyz * vLightColor.xyz * dot(normLightDir, bumpVec.xyz)
+ (specular * texture(tex4, vUv).xyz);
outColor.xyz *= attenuation;
}
diff --git a/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
index 23ab725071e..18b23629c1c 100644
--- a/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
@@ -13,7 +13,7 @@ in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
in vec3 vHalfVec;
-in vec3 vSpotlightUv;
+in vec4 vSpotlightUv;
OUTPUT
@@ -29,15 +29,15 @@ void main()
{
vec3 diffuse = texture(tex0, vUv).xyz;
- vec3 bumpVec = (2.0*texture(normalMap, vUv)-vec4(1.0)).xyz;
+ vec3 bumpVec = (2.0*texture(tex1, vUv)-vec4(1.0)).xyz;
vec3 lightVec = normalize(vLightDir);
- vHalfVec = normalize(vHalfVec);
+ vec3 normHalfVec = normalize(vHalfVec);
float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.z); // CHECK
float rejectNeg = texture1D(tex5,vSpotlightUv.z + 0.5).x;
- float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
+ float specular = clamp(dot(normHalfVec, bumpVec.xyz), 0.0, 1.0);
specular = pow(specular, 16.0)* vLightColor.w * spotColor.w;
outColor.xyz = diffuse * dot(lightVec, bumpVec.xyz) * vLightColor.xyz * spotColor.xyz
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex b/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
index eb8c917d09b..7053f47f4d6 100644
--- a/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
@@ -11,11 +11,11 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec3 uv = gl_TexCoord[0].xyz;
+vec2 uv = gl_TexCoord[0].xy;
out vec4 vColor
-out vec3 vUv;
+out vec2 vUv;
out vec3 vLighDir;
out vec3 vHalfVec;
out vec2 vScreenPos;
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec_Light.fragment b/engines/hpl1/engine/impl/shaders/BumpSpec_Light.fragment
index 30365246455..271222f3092 100644
--- a/engines/hpl1/engine/impl/shaders/BumpSpec_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec_Light.fragment
@@ -28,13 +28,13 @@ void main()
vec4 bumpVec = texture(tex1, vUv);
bumpVec.xyz = (2.0*bumpVec.xyz)-vec3(1.0);
- vLightDir = normalize(vLightDir);
- vHalfVec = normalize(vHalfVec);
+ vec3 normLightDir = normalize(vLightDir);
+ vec3 normHalfVec = normalize(vHalfVec);
- float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
+ float specular = clamp(dot(normHalfVec, bumpVec.xyz), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w * clamp(bumpVec.w, 0.0, 1.0);
- outColor.xyz = texture(tex0, vUv).xyz * vLightColor.xyz * dot(vLightDir, bumpVec.xyz) +
+ outColor.xyz = texture(tex0, vUv).xyz * vLightColor.xyz * dot(normLightDir, bumpVec.xyz) +
specular;
outColor.xyz *= attenuation;
}
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
index 659349d62ee..5e4d70dc1bd 100644
--- a/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
@@ -13,7 +13,7 @@ in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
in vec3 vHalfVec;
-in vec3 vSpotlightUv;
+in vec4 vSpotlightUv;
OUTPUT
@@ -32,13 +32,13 @@ void main()
bumpVec.xyz = (2.0*bumpVec.xyz)-vec3(1.0);
vec3 lightVec = normalize(vLightDir);//(2*textureCube(tex2,vLightDir)-1).xyz;
- vHalfVec = normalize(vHalfVec);//(2*textureCube(tex2,vHalfVec)-1).xyz;
+ vec3 normHalfVec = normalize(vHalfVec);//(2*textureCube(tex2,vHalfVec)-1).xyz;
float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.z);
float rejectNeg = texture1D(tex5,vSpotlightUv.z + 0.5).x;
- float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
+ float specular = clamp(dot(normHalfVec, bumpVec.xyz), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w * clamp(bumpVec.w, 0.0, 1.0) * clamp(spotColor.w, 0.0, 1.0);
outColor.xyz = diffuse * dot(lightVec, bumpVec.xyz) * vLightColor.xyz * spotColor.xyz +
diff --git a/engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
index 9c423ccaae7..4d08527ce56 100644
--- a/engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
@@ -13,7 +13,7 @@
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
-in vec3 vSpotlightUv;
+in vec4 vSpotlightUv;
OUTPUT
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
index 5ea4fd6858b..f7c10f5bbbb 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
@@ -11,12 +11,12 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec3 uv = gl_TexCoord[0].xyz;
+vec2 uv = gl_TexCoord[0].xy;
vec4 tangent = gl_TexCoord[1];
out vec4 vLightColor;
-out vec3 vUv;
+out vec2 vUv;
out vec3 vLighDir;
out vec3 vHalfVec;
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
index 53456a12c5e..9667961e078 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
@@ -11,12 +11,12 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec3 uv = gl_TexCoord[0].xyz;
+vec2 uv = gl_TexCoord[0].xy;
vec4 tangent = gl_TexCoord[1];
out vec4 vLightColor;
-out vec3 vUv;
+out vec2 vUv;
out vec3 vLighDir;
out vec3 vHalfVec;
out vec4 vSpotlightUv;
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
index e6d69566bc7..8f3aa6acf4e 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
@@ -11,12 +11,12 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec3 uv = gl_TexCoord[0].xyz;
+vec2 uv = gl_TexCoord[0].xy;
vec4 tangent = gl_TexCoord[1];
out vec4 vLightColor;
-out vec3 vUv;
+out vec2 vUv;
out vec3 vLighDir;
uniform mat4 worldViewProj;
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
index dbc62ceec73..212fddaa2a3 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
@@ -12,7 +12,7 @@
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
-in vec3 vSpotlightUv;
+in vec4 vSpotlightUv;
OUTPUT
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
index c4d29d32a6f..9eeb4f3ad5c 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
@@ -11,12 +11,11 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec3 uv = gl_TexCoord[0].xyz;
+vec2 uv = gl_TexCoord[0].xy;
vec4 tangent = gl_TexCoord[1];
-
out vec4 vLightColor;
-out vec3 vUv;
+out vec2 vUv;
out vec3 vLighDir;
out vec4 vSpotlightUv;
Commit: 7df36793ca1ec7bcf1ddd3dc07a250623044ffb6
https://github.com/scummvm/scummvm/commit/7df36793ca1ec7bcf1ddd3dc07a250623044ffb6
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:41+01:00
Commit Message:
HPL1: fix SetMatrixf method in shader class
Changed paths:
engines/hpl1/engine/impl/CGProgram.cpp
diff --git a/engines/hpl1/engine/impl/CGProgram.cpp b/engines/hpl1/engine/impl/CGProgram.cpp
index 01104f2b8f4..f1114295687 100644
--- a/engines/hpl1/engine/impl/CGProgram.cpp
+++ b/engines/hpl1/engine/impl/CGProgram.cpp
@@ -30,6 +30,7 @@
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/math/Math.h"
#include "hpl1/opengl.h"
#include "graphics/opengl/shader.h"
@@ -135,9 +136,12 @@ bool cCGProgram::SetMatrixf(const tString &asName, const cMatrixf &mMtx) {
//TODO: replace with normal setmatrix
bool cCGProgram::SetMatrixf(const tString &asName, eGpuProgramMatrix mType,
eGpuProgramMatrixOp mOp) {
- if (mOp != eGpuProgramMatrixOp_Identity)
- Hpl1::logError(Hpl1::kDebugOpenGL, "unsupported shader matrix %d", mOp);
- SetMatrixf(asName, cMatrixf::Identity);
+ if (mType != eGpuProgramMatrix_ViewProjection)
+ error("unsupported shader matrix %d", mOp);
+ cMatrixf modelView, projection;
+ glGetFloatv(GL_PROJECTION_MATRIX, projection.v);
+ glGetFloatv(GL_MODELVIEW_MATRIX, modelView.v);
+ SetMatrixf(asName, cMath::MatrixMul(modelView, projection));
return true;
}
Commit: 7488c386445b060a77632bf147395f0cd2a56979
https://github.com/scummvm/scummvm/commit/7488c386445b060a77632bf147395f0cd2a56979
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:41+01:00
Commit Message:
HPL1: fix texture coordinate inputs in shaders
Changed paths:
engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
engines/hpl1/engine/impl/shaders/Bump_Light.fragment
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
engines/hpl1/engine/impl/shaders/PostEffect_Blur_Rect.fragment
engines/hpl1/engine/impl/shaders/PostEffect_Offset.vertex
engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
engines/hpl1/engine/impl/shaders/Water_Fog.vertex
engines/hpl1/engine/impl/shaders/refract.vertex
engines/hpl1/engine/impl/shaders/refract_water.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex b/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
index d15d72b2b79..b9407ee4416 100644
--- a/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
@@ -11,7 +11,7 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec3 uv = gl_TexCoord[0].xyz;
+vec3 uv = gl_MultiTexCoord0.xyz;
out vec4 vColor;
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex b/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
index 7053f47f4d6..ccd1cd0988d 100644
--- a/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
@@ -11,7 +11,7 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec2 uv = gl_TexCoord[0].xy;
+vec2 uv = gl_MultiTexCoord0.xy;
out vec4 vColor
diff --git a/engines/hpl1/engine/impl/shaders/Bump_Light.fragment b/engines/hpl1/engine/impl/shaders/Bump_Light.fragment
index 67e8972ccfe..69b056536db 100644
--- a/engines/hpl1/engine/impl/shaders/Bump_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/Bump_Light.fragment
@@ -24,8 +24,8 @@ void main()
{
float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
- vec4 bumpVec = (2*texture(tex1, vUv)-1);
- vec4 lightVec = (2.0*textureCube(tex2,vLightDir)-1.0);
+ vec4 bumpVec = (2.0*texture(tex1, vUv)-vec4(1.0));
+ vec4 lightVec = (2.0*textureCube(tex2,vLightDir)-vec4(1.0));
outColor.xyz = texture(tex0, vUv).xyz * vLightColor.xyz * attenuation * dot(lightVec.xyz,bumpVec.xyz);
outColor.w = 0;
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
index f7c10f5bbbb..56234917033 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
@@ -11,9 +11,8 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec2 uv = gl_TexCoord[0].xy;
-vec4 tangent = gl_TexCoord[1];
-
+vec2 uv = gl_MultiTexCoord0.xy;
+vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
out vec2 vUv;
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
index 9667961e078..3231ec9e3a9 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
@@ -11,8 +11,8 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec2 uv = gl_TexCoord[0].xy;
-vec4 tangent = gl_TexCoord[1];
+vec2 uv = gl_MultiTexCoord0.xy;
+vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
index 02bbf93646e..24ed7690ff7 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
@@ -11,7 +11,7 @@
vec4 position = gl_Vertex;
vec4 color = gl_Color;
-vec2 uv = gl_TexCoord[0].xy;
+vec2 uv = gl_MultiTexCoord0.xy;
out vec4 vColor;
out vec2 vUv;
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
index ac7679232cf..15d2e0139cf 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
@@ -11,7 +11,7 @@
vec4 position = gl_Vertex;
vec3 color = gl_Color.xyz;
-vec3 uv = gl_TexCoord[0].xyz;
+vec3 uv = gl_MultiTexCoord0.xyz;
out vec3 vColor;
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
index f61c2e94dc8..2e4f3ecb359 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
@@ -12,7 +12,7 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
vec3 color = gl_Color.xyz;
-vec3 uv = gl_TexCoord[0].xyz;
+vec3 uv = gl_MultiTexCoord0.xyz;
out vec3 vColor;
out vec3 vUv;
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
index 8e910508d8e..9626f769357 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
@@ -9,9 +9,9 @@
/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-vec4 vLightColor;
-vec2 vUv;
-vec3 vLightDir;
+in vec4 vLightColor;
+in vec2 vUv;
+in vec3 vLightDir;
OUTPUT
@@ -23,8 +23,8 @@ void main()
{
float attenuation = texture1D(tex2,dot(vLightDir,vLightDir)).x;
- vLightDir = (2.0*textureCube(tex1,vLightDir)-vec4(1.0)).xyz;
+ vec3 lightDir = (2.0*textureCube(tex1,vLightDir)-vec4(1.0)).xyz;
- outColor.xyz = attenuation * texture(tex0, vUv).xyz * vLightColor.xyz * dot(vLightDir, vec3(0,0,1));
+ outColor.xyz = attenuation * texture(tex0, vUv).xyz * vLightColor.xyz * dot(lightDir, vec3(0,0,1));
outColor.w = 0.0;
}
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
index 8f3aa6acf4e..05b2ad3f3c8 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
@@ -11,9 +11,8 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec2 uv = gl_TexCoord[0].xy;
-vec4 tangent = gl_TexCoord[1];
-
+vec2 uv = gl_MultiTexCoord0.xy;
+vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
out vec2 vUv;
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
index 9eeb4f3ad5c..c4c6081d9d9 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
@@ -11,8 +11,8 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec2 uv = gl_TexCoord[0].xy;
-vec4 tangent = gl_TexCoord[1];
+vec2 uv = gl_MultiTexCoord0.xy;
+vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
out vec2 vUv;
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
index 2bd5f6df5e7..be2774f3159 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
@@ -11,8 +11,8 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec3 uv = gl_TexCoord[0].xyz;
-vec4 tangent = gl_TexCoord[1];
+vec3 uv = gl_MultiTexCoord0.xyz;
+vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
index 99b50e78b4d..7ddd5480595 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
@@ -11,8 +11,8 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec3 uv = gl_TexCoord[0].xyz;
-vec4 tangent = gl_TexCoord[1];
+vec3 uv = gl_MultiTexCoord0.xyz;
+vec4 tangent = gl_MultiTexCoord1;
out vec4 vColor
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
index 4f716878954..519fc832286 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
@@ -11,8 +11,8 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec3 uv = gl_TexCoord[0].xyz;
-vec4 tangent = gl_TexCoord[1];
+vec3 uv = gl_MultiTexCoord0.xyz;
+vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
index a5d847424f0..7cc7f49638c 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
@@ -11,8 +11,8 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec3 uv = gl_TexCoord[0].xyz;
-vec4 tangent = gl_TexCoord[1];
+vec3 uv = gl_MultiTexCoord0.xyz;
+vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
index bf4248a4ddc..c48840213d1 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
@@ -11,8 +11,8 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec3 uv = gl_TexCoord[0].xyz;
-vec4 tangent = gl_TexCoord[1];
+vec3 uv = gl_MultiTexCoord0.xyz;
+vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
index 4200f03c37a..4568a1463bd 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
@@ -11,7 +11,7 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec4 tangent = gl_TexCoord[1];
+vec4 tangent = gl_MultiTexCoord1;
out vec4 vColor
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
index 4f716878954..519fc832286 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
@@ -11,8 +11,8 @@
vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
-vec3 uv = gl_TexCoord[0].xyz;
-vec4 tangent = gl_TexCoord[1];
+vec3 uv = gl_MultiTexCoord0.xyz;
+vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Trans.vertex b/engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
index a824f6d59f5..8cf8f510de8 100644
--- a/engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
@@ -11,7 +11,7 @@
vec4 position = gl_Vertex;
vec4 color = gl_Color;
-vec3 uv = gl_TexCoord[0].xyz;
+vec3 uv = gl_MultiTexCoord0.xyz;
out vec4 vColor;
out vec2 vUv;
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex b/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
index 56858697bb4..487d55324d2 100644
--- a/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
@@ -11,8 +11,8 @@
vec4 position = gl_Vertex;
vec3 color = gl_Color.xyz;
-vec2 uv0 = gl_TexCoord[0].xy;
-vec2 uv1 = gl_TexCoord[1].xy;
+vec2 uv0 = gl_MultiTexCoord0.xy;
+vec2 uv1 = gl_MultiTexCoord1.xy;
out vec3 vColor;
out vec2 vUv0;
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex b/engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
index 296fec58a22..a39f2f9135c 100644
--- a/engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
@@ -11,8 +11,7 @@
vec4 position = gl_Vertex;
vec3 color = gl_Color.xyz;
-vec2 uv = gl_TexCoord[0].xy;
-
+vec2 uv = gl_MultiTexCoord0.xy;
out vec3 vColor;
out vec2 vUv0;
@@ -29,7 +28,6 @@ void main()
{
gl_Position = (worldViewProj * position);
vColor = color;
-
vUv0 = uv + vec2(xOffset, yOffset) * amount;
vUv1 = uv + vec2(xOffset, yOffset) * 2.0 * amount;
vUv2 = uv - vec2(xOffset, yOffset) * amount;
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Blur_Rect.fragment b/engines/hpl1/engine/impl/shaders/PostEffect_Blur_Rect.fragment
index 53e944f4b98..a14bc97ffbc 100644
--- a/engines/hpl1/engine/impl/shaders/PostEffect_Blur_Rect.fragment
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Blur_Rect.fragment
@@ -9,11 +9,11 @@
/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-vec4 vColor;
-vec2 vUv0;
-vec2 vUv1;
-vec2 vUv2;
-vec2 vUv3;
+in vec4 vColor;
+in vec2 vUv0;
+in vec2 vUv1;
+in vec2 vUv2;
+in vec2 vUv3;
OUTPUT
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Offset.vertex b/engines/hpl1/engine/impl/shaders/PostEffect_Offset.vertex
index 9a24d706698..581a06f4d3f 100644
--- a/engines/hpl1/engine/impl/shaders/PostEffect_Offset.vertex
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Offset.vertex
@@ -10,7 +10,7 @@
///////////////////////////////////////////////////////
vec4 position = gl_Vertex;
-vec3 uv = gl_TexCoord[0].xyz;
+vec3 uv = gl_MultiTexCoord0.xyz;
out vec3 vUv;
diff --git a/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex b/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
index 77c94c36a12..54fdc4c72f2 100644
--- a/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
+++ b/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
@@ -11,7 +11,7 @@
vec4 position = gl_Vertex;
vec3 color = gl_Color.xyz;
-vec3 uv = gl_TexCoord[0].xyz;
+vec3 uv = gl_MultiTexCoord0.xyz;
out vec3 vColor;
diff --git a/engines/hpl1/engine/impl/shaders/Water_Fog.vertex b/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
index 679fca1877e..bccc905375d 100644
--- a/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
+++ b/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
@@ -11,7 +11,7 @@
vec4 position = gl_Vertex;
vec4 color = gl_Color;
-vec3 uv = gl_TexCoord[0].xyz;
+vec3 uv = gl_MultiTexCoord0.xyz;
out vec4 vColor
diff --git a/engines/hpl1/engine/impl/shaders/refract.vertex b/engines/hpl1/engine/impl/shaders/refract.vertex
index abcaf81a19d..ac45f65db33 100644
--- a/engines/hpl1/engine/impl/shaders/refract.vertex
+++ b/engines/hpl1/engine/impl/shaders/refract.vertex
@@ -11,7 +11,7 @@
vec4 position = gl_Vertex;
vec4 color = gl_Color;
-vec2 uv = gl_TexCoord[0].xy;
+vec2 uv = gl_MultiTexCoord0.xy;
out vec4 vColor;
out vec2 vUv;
diff --git a/engines/hpl1/engine/impl/shaders/refract_water.vertex b/engines/hpl1/engine/impl/shaders/refract_water.vertex
index a940b1fd566..7456ae26168 100644
--- a/engines/hpl1/engine/impl/shaders/refract_water.vertex
+++ b/engines/hpl1/engine/impl/shaders/refract_water.vertex
@@ -11,7 +11,7 @@
vec4 position = gl_Vertex;
vec4 color = gl_Color;
-vec2 uv = gl_TexCoord[0].xy;
+vec2 uv = gl_MultiTexCoord0.xy;
vec3 normal = gl_Normal;
Commit: b3804858e11d6e1e145bc0045a205fca51f05d7c
https://github.com/scummvm/scummvm/commit/b3804858e11d6e1e145bc0045a205fca51f05d7c
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:03:42+01:00
Commit Message:
HPL1: Fixed typo in shader vLightDir vs vLighDir
Changed paths:
engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex b/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
index b9407ee4416..c320f952e0b 100644
--- a/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
@@ -16,7 +16,7 @@ vec3 uv = gl_MultiTexCoord0.xyz;
out vec4 vColor;
out vec3 vUv;
-out vec3 vLighDir;
+out vec3 vLightDir;
out vec2 vScreenPos;
uniform mat4 worldViewProj;
@@ -29,17 +29,17 @@ void main()
vec3 L;
//Get the direction of the light and normalize it
- vLighDir.xy = position.xy - LightPos.xy;
- vScreenPos = (vLighDir.xy + (LightRadius) )/ (LightRadius*2.0);
+ vLightDir.xy = position.xy - LightPos.xy;
+ vScreenPos = (vLightDir.xy + (LightRadius) )/ (LightRadius*2.0);
//rotate the light to texture (tangent) space. Normal x=cos(angle) y = sin(angle)
- vec2 TempLight = vLighDir.xy;
- vLighDir.x = normal.x*TempLight.x + normal.y*TempLight.y;
- vLighDir.y = normal.x*TempLight.y - normal.y*TempLight.x;
- vLighDir.x *= normal.z/abs(normal.z);
- vLighDir.y *= abs(normal.z)-2.0;
-
- vLighDir.z = -LightPos.z;
- vLighDir = normalize(vLighDir);
+ vec2 TempLight = vLightDir.xy;
+ vLightDir.x = normal.x*TempLight.x + normal.y*TempLight.y;
+ vLightDir.y = normal.x*TempLight.y - normal.y*TempLight.x;
+ vLightDir.x *= normal.z/abs(normal.z);
+ vLightDir.y *= abs(normal.z)-2.0;
+
+ vLightDir.z = -LightPos.z;
+ vLightDir = normalize(vLightDir);
gl_Position = worldViewProj * position;
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex b/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
index ccd1cd0988d..645a607da8e 100644
--- a/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
@@ -16,7 +16,7 @@ vec2 uv = gl_MultiTexCoord0.xy;
out vec4 vColor
out vec2 vUv;
-out vec3 vLighDir;
+out vec3 vLightDir;
out vec3 vHalfVec;
out vec2 vScreenPos;
@@ -31,25 +31,25 @@ void main()
vec3 L;
//Get the direction of the light and normalize it
- vLighDir.xy = position.xy - LightPos.xy;
+ vLightDir.xy = position.xy - LightPos.xy;
- vScreenPos = (vLighDir.xy + (LightRadius)) / (LightRadius * 2.0);
+ vScreenPos = (vLightDir.xy + (LightRadius)) / (LightRadius * 2.0);
//rotate the light to texture (tangent) space. Normal x=cos(angle) y = sin(angle)
- vec2 TempLight = vLighDir.xy;
- vLighDir.x = normal.x*TempLight.x + normal.y*TempLight.y;
- vLighDir.y = normal.x*TempLight.y - normal.y*TempLight.x;
- vLighDir.x *= normal.z / abs(normal.z);
- vLighDir.y *= abs(normal.z)-2.0;
+ vec2 TempLight = vLightDir.xy;
+ vLighttDir.x = normal.x*TempLight.x + normal.y*TempLight.y;
+ vLighttDir.y = normal.x*TempLight.y - normal.y*TempLight.x;
+ vLighttDir.x *= normal.z / abs(normal.z);
+ vLighttDir.y *= abs(normal.z)-2.0;
- vLighDir.z = -LightPos.z;
- vLighDir = normalize(vLighDir);
+ vLighttDir.z = -LightPos.z;
+ vLighttDir = normalize(vLightDir);
//Get the halfangle and normalize it
vHalfVec.xy = position.xy - EyePos.xy;
vHalfVec.z = -EyePos.y;
- ///rotate halfvec aswell NOTE: Not sure you need this...
+ ///rotate halfvec aswell NOTE: Not sure you need this...
vec2 TempHalfVec = vHalfVec.xy;
vHalfVec.x = normal.x*TempHalfVec.x + normal.y*TempHalfVec.y;
vHalfVec.y = normal.x*TempHalfVec.y - normal.y*TempHalfVec.x;
@@ -57,7 +57,7 @@ void main()
vHalfVec.y *= abs(normal.z) - 2.0;
vHalfVec = normalize(vHalfVec);
- vHalfVec = normalize(vHalfVec + vLighDir);
+ vHalfVec = normalize(vHalfVec + vLightDir);
gl_Position = worldViewProj * position;
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
index 56234917033..2bfa8402848 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
@@ -16,7 +16,7 @@ vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
out vec2 vUv;
-out vec3 vLighDir;
+out vec3 vLightDir;
out vec3 vHalfVec;
uniform mat4 worldViewProj;
@@ -32,21 +32,21 @@ void main()
vUv = uv;
vec3 lightDir = LightPos - position.xyz;
- vLighDir = lightDir * LightDirMul;
+ vLightDir = lightDir * LightDirMul;
//Calculate rotation for light to get it to tangent space.
vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
mat3 rotation = mat3(tangent.xyz, binormal, normal);
//Transform the lightdir
- vLighDir = (rotation * vLighDir);
+ vLightDir = (rotation * vLightDir);
//Get the halfvector for the specular term
vHalfVec = normalize(EyePos - position.xyz);
//vHalfVec = normalize( normalize(EyePos) + normalize(lightDir));
//transform to tangent space
- vHalfVec = (rotation * vHalfVec);
- vHalfVec = normalize(vLighDir)+vHalfVec;//normalize(vHalfVec + normalize(vLighDir));
+ vHalfVec = (rotation * vHalfVec);
+ vHalfVec = normalize(vLightDir)+vHalfVec;//normalize(vHalfVec + normalize(vLightDir));
- vLightColor = LightColor;
+ vLightColor = LightColor;
}
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
index 3231ec9e3a9..84a517a8b76 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
@@ -17,7 +17,7 @@ vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
out vec2 vUv;
-out vec3 vLighDir;
+out vec3 vLightDir;
out vec3 vHalfVec;
out vec4 vSpotlightUv;
@@ -38,20 +38,20 @@ void main()
vSpotlightUv = (spotViewProj * position);
vec3 lightDir = LightPos - position.xyz;
- vLighDir = lightDir * LightDirMul;
+ vLightDir = lightDir * LightDirMul;
//Calculate rotation for light to get it to tangent space.
vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
mat3 rotation = mat3(tangent.xyz, binormal, normal);
//Transform the lightdir
- vLighDir = (rotation * vLighDir);
+ vLightDir = (rotation * vLightDir);
//Get the halfvector for the specular term
vHalfVec = normalize(EyePos - position.xyz);
//transform to tangent space
- vHalfVec = (rotation * vHalfVec);
- vHalfVec = normalize(vLighDir)+vHalfVec;
+ vHalfVec = (rotation * vHalfVec);
+ vHalfVec = normalize(vLightDir)+vHalfVec;
- vLightColor = LightColor;
+ vLightColor = LightColor;
}
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
index 05b2ad3f3c8..79b7f5b3dfe 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
@@ -16,7 +16,7 @@ vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
out vec2 vUv;
-out vec3 vLighDir;
+out vec3 vLightDir;
uniform mat4 worldViewProj;
uniform vec3 LightPos;
@@ -30,14 +30,14 @@ void main()
vUv = uv;
vec3 lightDir = LightPos - position.xyz;
- vLighDir = lightDir * LightDirMul;
+ vLightDir = lightDir * LightDirMul;
//Calculate rotation for light to get it to tangent space.
vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
mat3 rotation = mat3(tangent.xyz, binormal, normal);
//Transform the lightdir
- vLighDir = (rotation * vLighDir);
+ vLightDir = (rotation * vLightDir);
- vLightColor = LightColor;
+ vLightColor = LightColor;
}
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
index c4c6081d9d9..246da047acb 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
@@ -16,7 +16,7 @@ vec4 tangent = gl_MultiTexCoord1;
out vec4 vLightColor;
out vec2 vUv;
-out vec3 vLighDir;
+out vec3 vLightDir;
out vec4 vSpotlightUv;
uniform mat4 worldViewProj;
@@ -34,14 +34,14 @@ void main()
vSpotlightUv = (spotViewProj * position);
vec3 lightDir = LightPos - position.xyz;
- vLighDir = lightDir * LightDirMul;
+ vLightDir = lightDir * LightDirMul;
//Calculate rotation for light to get it to tangent space.
vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
mat3 rotation = mat3(tangent.xyz, binormal, normal);
//Transform the lightdir
- vLighDir = (rotation * vLighDir);
+ vLightDir = (rotation * vLightDir);
- vLightColor = LightColor;
+ vLightColor = LightColor;
}
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
index 7ddd5480595..127b08d0c1d 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
@@ -16,7 +16,7 @@ vec4 tangent = gl_MultiTexCoord1;
out vec4 vColor
-out vec3 vLighDir;
+out vec3 vLightDir;
out vec3 vUv;
out vec3 vLightPos;
@@ -32,15 +32,15 @@ void main()
vUv = uv;
vec3 lightDir = LightPos - position.xyz;
- vLighDir = lightDir * LightDirMul;
- vLightPos = vLighDir *0.5 + 0.5;
+ vLightDir = lightDir * LightDirMul;
+ vLightPos = vLightDir *0.5 + 0.5;
//Calculate rotation for light to get it to tangent space.
vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
mat3 rotation = mat3(tangent.xyz, binormal, normal);
//Transform the lightdir
- vLighDir = (rotation * vLighDir);
+ vLightDir = (rotation * vLightDir);
- outColor = vec4(1.0);
+ outColor = vec4(1.0);
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
index 4568a1463bd..33626f9d25e 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
@@ -15,7 +15,7 @@ vec4 tangent = gl_MultiTexCoord1;
out vec4 vColor
-out vec3 vLighDir;
+out vec3 vLightDir;
out vec3 vLightPos;
uniform mat4 worldViewProj;
@@ -28,15 +28,15 @@ void main()
gl_Position = (worldViewProj * position);
vec3 lightDir = LightPos - position.xyz;
- vLighDir = lightDir * LightDirMul;
- vLightPos = vLighDir *0.5 + 0.5;
+ vLightDir = lightDir * LightDirMul;
+ vLightPos = vLightDir *0.5 + 0.5;
//Calculate rotation for light to get it to tangent space.
vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
mat3 rotation = mat3(tangent.xyz, binormal, normal);
//Transform the lightdir
- vLighDir = (rotation * vLighDir);
+ vLightDir = (rotation * vLightDir);
- vColor = 1;
+ vColor = 1;
}
\ No newline at end of file
Commit: bf97e541c7f21b58522618202b3128acea7d7256
https://github.com/scummvm/scummvm/commit/bf97e541c7f21b58522618202b3128acea7d7256
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:42+01:00
Commit Message:
HPL1: fix diffuse light shader
Changed paths:
engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
index 9626f769357..e2cfb0ca7f8 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
@@ -16,14 +16,14 @@ in vec3 vLightDir;
OUTPUT
uniform sampler2D tex0; //diffuseMap
-uniform samplerCube tex1; //normalCubeMap
-uniform sampler1D tex2; //falloffMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler1D tex3; //falloffMap
void main()
{
- float attenuation = texture1D(tex2,dot(vLightDir,vLightDir)).x;
+ float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
- vec3 lightDir = (2.0*textureCube(tex1,vLightDir)-vec4(1.0)).xyz;
+ vec3 lightDir = (2.0*textureCube(tex2,vLightDir)-vec4(1.0)).xyz;
outColor.xyz = attenuation * texture(tex0, vUv).xyz * vLightColor.xyz * dot(lightDir, vec3(0,0,1));
outColor.w = 0.0;
Commit: c7c923d21ed653b929bda4b885af85b107e0e31d
https://github.com/scummvm/scummvm/commit/c7c923d21ed653b929bda4b885af85b107e0e31d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:42+01:00
Commit Message:
HPL1: fix wrong texture units
Changed paths:
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
index 659fc90f0cb..4de51f3c225 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
@@ -18,21 +18,21 @@ in vec3 vSpotlightUv;
OUTPUT
uniform sampler2D tex0; //diffuseMap
-uniform samplerCube tex1; //normalCubeMap
-uniform sampler1D tex2; //falloffMap
-uniform sampler2D tex3; //spotlightMap
-uniform sampler1D tex4; //spotNegRejectMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler1D tex3; //falloffMap
+uniform sampler2D tex4; //spotlightMap
+uniform sampler1D tex5; //spotNegRejectMap
void main()
{
vec3 diffuse = texture(tex0, vUv).xyz;
- vec3 lightNormal = normalize(vLightDir);//(2*textureCube(tex1,vLightDir)-1).xyz;
- vHalfVec = normalize(vHalfVec);//(2*textureCube(tex1,vHalfVec)-1).xyz;
+ vec3 lightNormal = normalize(vLightDir);//(2*textureCube(tex2,vLightDir)-1).xyz;
+ vHalfVec = normalize(vHalfVec);//(2*textureCube(tex2,vHalfVec)-1).xyz;
- float attenuation = texture1D(tex2,dot(vLightDir,vLightDir)).x;
- vec4 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.z);
- float rejectNeg = texture1D(tex4,vSpotlightUv.z + 0.5).x;
+ float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
+ vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.z);
+ float rejectNeg = texture1D(tex5,vSpotlightUv.z + 0.5).x;
float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w * spotColor.w;
Commit: b63ed0b5376f74abc3b9ed21148f7ac3afdb4206
https://github.com/scummvm/scummvm/commit/b63ed0b5376f74abc3b9ed21148f7ac3afdb4206
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:42+01:00
Commit Message:
HPL1: fix replacement for tex2Dproj
Changed paths:
engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
engines/hpl1/engine/impl/shaders/Fog_Trans_ModX2.fragment
diff --git a/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
index 18b23629c1c..388dfaf366b 100644
--- a/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
@@ -34,7 +34,7 @@ void main()
vec3 normHalfVec = normalize(vHalfVec);
float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
- vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.z); // CHECK
+ vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.w);
float rejectNeg = texture1D(tex5,vSpotlightUv.z + 0.5).x;
float specular = clamp(dot(normHalfVec, bumpVec.xyz), 0.0, 1.0);
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
index 5e4d70dc1bd..6bf4ee1a068 100644
--- a/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
@@ -35,7 +35,7 @@ void main()
vec3 normHalfVec = normalize(vHalfVec);//(2*textureCube(tex2,vHalfVec)-1).xyz;
float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
- vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.z);
+ vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.w);
float rejectNeg = texture1D(tex5,vSpotlightUv.z + 0.5).x;
float specular = clamp(dot(normHalfVec, bumpVec.xyz), 0.0, 1.0);
diff --git a/engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
index 4d08527ce56..6081dcf90e4 100644
--- a/engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
@@ -32,7 +32,7 @@ void main() {
float attenuation = texture1D(tex3, dot(vLightDir, vLightDir)).x;
vec3 spotColor =
- texture(tex4, vSpotlightUv.xy / vSpotlightUv.z).xyz; // CHECK
+ texture(tex4, vSpotlightUv.xy / vSpotlightUv.w).xyz;
float rejectNeg = texture1D(tex5, vSpotlightUv.z + 0.5).x;
outColor.xyz = diffuse * dot(lightVec, bumpVec) * attenuation *
vLightColor.xyz * spotColor * rejectNeg;
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
index 212fddaa2a3..6f0b4859d54 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
@@ -27,7 +27,7 @@ void main()
vec3 diffuse = texture(tex0, vUv).xyz;
vec3 lightNormal = (2.0*textureCube(tex1,vLightDir)-vec4(1.0)).xyz;
float attenuation = texture1D(tex2,dot(vLightDir,vLightDir)).x;
- vec3 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.z).xyz;
+ vec3 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.w).xyz;
float rejectNeg = texture1D(tex4,vSpotlightUv.z + 0.5).x;
outColor.xyz = diffuse * dot(lightNormal, vec3(0,0,1)) * attenuation *
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Trans_ModX2.fragment b/engines/hpl1/engine/impl/shaders/Fog_Trans_ModX2.fragment
index 64cbab404d3..efeea81b0c8 100644
--- a/engines/hpl1/engine/impl/shaders/Fog_Trans_ModX2.fragment
+++ b/engines/hpl1/engine/impl/shaders/Fog_Trans_ModX2.fragment
@@ -21,7 +21,7 @@ uniform sampler1D tex1; //fogMap
void main()
{
vec4 diffuse = texture(tex0, vUv);
- float alpha = texture1D(tex1, vFogUv).w;
+ float alpha = texture1D(tex1, vFogUv).g;
outColor.xyz = diffuse.xyz * alpha + vec3(0.5,0.5,0.5)*(1 - alpha);
outColor.w = diffuse.w;
}
\ No newline at end of file
Commit: f30a1e139cc2400f09a56966bd706f60f0a2b78a
https://github.com/scummvm/scummvm/commit/f30a1e139cc2400f09a56966bd706f60f0a2b78a
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:42+01:00
Commit Message:
HPL1: replace std::sort usage
Changed paths:
engines/hpl1/engine/ai/AINodeContainer.cpp
engines/hpl1/engine/resources/ResourceManager.cpp
diff --git a/engines/hpl1/engine/ai/AINodeContainer.cpp b/engines/hpl1/engine/ai/AINodeContainer.cpp
index 1a7b13bfbf5..460dd70c7c0 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.cpp
+++ b/engines/hpl1/engine/ai/AINodeContainer.cpp
@@ -36,7 +36,7 @@
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
-//#include <algorithm>
+#include "common/algorithm.h"
namespace hpl {
@@ -359,9 +359,9 @@ void cAINodeContainer::Compile() {
///////////////////////////////////////
// Sort nodes and remove unwanted ones.
- #if 0
- std::sort(pNode->mvEdges.begin(), pNode->mvEdges.end(), cSortEndNodes());
- #endif
+
+ Common::sort(pNode->mvEdges.data(), pNode->mvEdges.data() + pNode->mvEdges.size(), cSortEndNodes());
+
// Resize if to too large
if (mlMaxNodeEnds > 0 && (int)pNode->mvEdges.size() > mlMaxNodeEnds) {
pNode->mvEdges.resize(mlMaxNodeEnds);
diff --git a/engines/hpl1/engine/resources/ResourceManager.cpp b/engines/hpl1/engine/resources/ResourceManager.cpp
index bd59ac65166..aa5589decbc 100644
--- a/engines/hpl1/engine/resources/ResourceManager.cpp
+++ b/engines/hpl1/engine/resources/ResourceManager.cpp
@@ -34,7 +34,7 @@
#include "hpl1/engine/system/low_level_system.h"
-//#include <algorithm>
+#include "common/algorithm.h"
namespace hpl {
@@ -133,9 +133,7 @@ void iResourceManager::DestroyUnused(int alMaxToKeep) {
}
// Sort the sounds according to num of users and then time.
- #if 0
- std::sort(vResources.begin(), vResources.end(), cSortResources());
- #endif
+ Common::sort(vResources.data(), vResources.data() + vResources.size(), cSortResources());
// Log("-------------Num: %d-----------------\n",vResources.size());
for (size_t i = alMaxToKeep; i < vResources.size(); ++i) {
iResourceBase *pRes = vResources[i];
Commit: d3cb9949bfa31a84f82ead27e474ec7aa03cf348
https://github.com/scummvm/scummvm/commit/d3cb9949bfa31a84f82ead27e474ec7aa03cf348
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:42+01:00
Commit Message:
HPL1: fix textures in shaders
Changed paths:
engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
diff --git a/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment b/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
index f61a042256b..9ce87ff1f1e 100644
--- a/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
@@ -20,7 +20,7 @@ uniform sampler2D tex0; //diffuseMap
uniform sampler2D tex1; //normalMap
uniform samplerCube tex2; //normalCubeMap
uniform sampler1D tex3; //falloffMap
-uniform sampler2D tex4; //specularMap
+uniform sampler2D tex6; //specularMap
void main()
{
@@ -36,6 +36,6 @@ void main()
specular = pow(specular, 16.0) * vLightColor.w;
outColor.xyz = texture(tex0, vUv).xyz * vLightColor.xyz * dot(normLightDir, bumpVec.xyz)
- + (specular * texture(tex4, vUv).xyz);
+ + (specular * texture(tex6, vUv).xyz);
outColor.xyz *= attenuation;
}
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
index 95c1e9feef1..47565445ff8 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
@@ -17,15 +17,15 @@ in vec3 vHalfVec;
OUTPUT
uniform sampler2D tex0; //diffuseMap
-uniform samplerCube tex1; //normalCubeMap
-uniform sampler1D tex2; //falloffMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler1D tex3; //falloffMap
void main()
{
- float attenuation = texture1D(tex2, dot(vLightDir,vLightDir)).x;
+ float attenuation = texture1D(tex3, dot(vLightDir,vLightDir)).x;
- vLightDir = normalize(vLightDir);//(2*textureCube(tex1,vLightDir)-1).xyz;
- vHalfVec = normalize(vHalfVec);//(2*textureCube(tex1,vHalfVec)-1).xyz;
+ vLightDir = normalize(vLightDir);//(2*textureCube(tex2,vLightDir)-1).xyz;
+ vHalfVec = normalize(vHalfVec);//(2*textureCube(tex2,vHalfVec)-1).xyz;
float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w;
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
index b3af568da45..34f50579276 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
@@ -18,17 +18,17 @@ in vec3 vSpotlightUv;
OUTPUT
uniform sampler2D tex0; //diffuseMap
-uniform samplerCube tex1; //normalCubeMap
-uniform sampler2D tex2; //spotlightMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler2D tex3; //spotlightMap
void main()
{
vec3 diffuse = texture(tex0, vUv).xyz;
- vec3 lightNormal = (2.0*textureCube(tex1,vLightDir)-vec4(1.0)).xyz;
- vHalfVec = (2.0*textureCube(tex1,vHalfVec)-vec4(1.0)).xyz;
+ vec3 lightNormal = (2.0*textureCube(tex2,vLightDir)-vec4(1.0)).xyz;
+ vHalfVec = (2.0*textureCube(tex2,vHalfVec)-vec4(1.0)).xyz;
- vec4 spotColor = texture(tex2, vSpotlightUv.xy / vSpotlightUv.z);
+ vec4 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.z);
float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w * spotColor.w;
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
index 6f0b4859d54..0ec1a1d65a6 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
@@ -17,18 +17,18 @@ in vec4 vSpotlightUv;
OUTPUT
uniform sampler2D tex0; //diffuseMap
-uniform samplerCube tex1; //normalCubeMap
-uniform sampler1D tex2; //falloffMap
-uniform sampler2D tex3; //spotlightMap
-uniform sampler1D tex4; //spotNegRejectMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler1D tex3; //falloffMap
+uniform sampler2D tex4; //spotlightMap
+uniform sampler1D tex5; //spotNegRejectMap
void main()
{
vec3 diffuse = texture(tex0, vUv).xyz;
- vec3 lightNormal = (2.0*textureCube(tex1,vLightDir)-vec4(1.0)).xyz;
- float attenuation = texture1D(tex2,dot(vLightDir,vLightDir)).x;
- vec3 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.w).xyz;
- float rejectNeg = texture1D(tex4,vSpotlightUv.z + 0.5).x;
+ vec3 lightNormal = (2.0*textureCube(tex2,vLightDir)-vec4(1.0)).xyz;
+ float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
+ vec3 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.w).xyz;
+ float rejectNeg = texture1D(tex5,vSpotlightUv.z + 0.5).x;
outColor.xyz = diffuse * dot(lightNormal, vec3(0,0,1)) * attenuation *
vLightColor.xyz * spotColor * rejectNeg;
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
index c9bebf00308..69fb89bcf3a 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
@@ -17,14 +17,14 @@ in vec3 vSpotlightUv;
OUTPUT
uniform sampler2D tex0; //diffuseMap
-uniform samplerCube tex1; //normalCubeMap
-uniform sampler2D tex2; //spotlightMap
+uniform samplerCube tex2; //normalCubeMap
+uniform sampler2D tex3; //spotlightMap
void main()
{
vec3 diffuse = texture(tex0, vUv).xyz;
- vec3 lightNormal = (2.0*textureCube(tex1,vLightDir)-vec4(1.0)).xyz;
- vec3 spotColor = texture(tex2, vSpotlightUv.xy / vSpotlightUv.z).xyz;
+ vec3 lightNormal = (2.0*textureCube(tex2,vLightDir)-vec4(1.0)).xyz;
+ vec3 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.z).xyz;
outColor.xyz = diffuse * dot(lightNormal, vec3(0,0,1)) * vLightColor.xyz * spotColor;
}
Commit: cdd329a91550adf50a7d8373309a8f1abd8d84ff
https://github.com/scummvm/scummvm/commit/cdd329a91550adf50a7d8373309a8f1abd8d84ff
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:42+01:00
Commit Message:
HPL1: fix shader
Changed paths:
engines/hpl1/engine/impl/shaders/Fog_Trans_Alpha.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Trans_Alpha.fragment b/engines/hpl1/engine/impl/shaders/Fog_Trans_Alpha.fragment
index 87de3a01b01..abd4b89c450 100644
--- a/engines/hpl1/engine/impl/shaders/Fog_Trans_Alpha.fragment
+++ b/engines/hpl1/engine/impl/shaders/Fog_Trans_Alpha.fragment
@@ -20,5 +20,5 @@ uniform sampler1D tex1; //fogMap
void main()
{
- outColor = texture(tex0, vUv) * texture1D(tex1, vFogUv) * vColor;
+ outColor = texture(tex0, vUv) * texture1D(tex1, vFogUv).r * vColor;
}
\ No newline at end of file
Commit: c5bd9a9586b994b749bcb0c5c92422380282db01
https://github.com/scummvm/scummvm/commit/c5bd9a9586b994b749bcb0c5c92422380282db01
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:42+01:00
Commit Message:
HPL1: cleanup shader SetMatrixf
Changed paths:
engines/hpl1/engine/impl/CGProgram.cpp
diff --git a/engines/hpl1/engine/impl/CGProgram.cpp b/engines/hpl1/engine/impl/CGProgram.cpp
index f1114295687..34e9d922ecf 100644
--- a/engines/hpl1/engine/impl/CGProgram.cpp
+++ b/engines/hpl1/engine/impl/CGProgram.cpp
@@ -125,9 +125,7 @@ bool cCGProgram::SetVec4f(const tString &asName, float afX, float afY, float afZ
bool cCGProgram::SetMatrixf(const tString &asName, const cMatrixf &mMtx) {
Math::Matrix4 mat4;
- float *vals = mat4.getData();
- for(int i = 0; i < 16; ++i)
- vals[i] = mMtx.v[i];
+ mat4.setData(mMtx.v);
_shader->setUniform(asName.c_str(), mat4);
return true;
}
Commit: 1a8d5f167fcd547b9ec90d6e731befed6051655a
https://github.com/scummvm/scummvm/commit/1a8d5f167fcd547b9ec90d6e731befed6051655a
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:43+01:00
Commit Message:
HPL1: fix bug in physics library's r-b tree
fixes an earlier commit to prevent ubsan from crashing the program.
The program previously relied on a call to member function from a null pointer.
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgTree.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgTree.cpp b/engines/hpl1/engine/libraries/newton/core/dgTree.cpp
index 9420789d20a..2db0bb39337 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgTree.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgTree.cpp
@@ -396,9 +396,12 @@ void dgRedBackNode::Unlink(dgRedBackNode ** const head)
*head = child;
}
- if (endNode->GetColor() == BLACK && endNode->m_parent)
+ if (endNode->GetColor() == BLACK)
{
- endNode->m_parent->RemoveFixup(child, head);
+ if (endNode->m_parent)
+ endNode->m_parent->RemoveFixup(child, head);
+ else if (*head)
+ (*head)->SetColor(BLACK);
}
// endNode->Release();
// delete endNode;
Commit: e79425c75efd18c1e34fad1764aa000775db1e96
https://github.com/scummvm/scummvm/commit/e79425c75efd18c1e34fad1764aa000775db1e96
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:43+01:00
Commit Message:
HPL1: fix shader destruction in Material_Alpha
Changed paths:
engines/hpl1/engine/graphics/Material_Alpha.cpp
diff --git a/engines/hpl1/engine/graphics/Material_Alpha.cpp b/engines/hpl1/engine/graphics/Material_Alpha.cpp
index fa61e711314..bc1effb8100 100644
--- a/engines/hpl1/engine/graphics/Material_Alpha.cpp
+++ b/engines/hpl1/engine/graphics/Material_Alpha.cpp
@@ -76,7 +76,8 @@ cMaterial_Alpha::cMaterial_Alpha(const tString &asName, iLowLevelGraphics *apLow
//-----------------------------------------------------------------------
cMaterial_Alpha::~cMaterial_Alpha() {
- mpProgramManager->Destroy(_fogShader);
+ if (_fogShader)
+ mpProgramManager->Destroy(_fogShader);
}
//-----------------------------------------------------------------------
Commit: 8a229f29b33178575cd464b08642c3d7011331a5
https://github.com/scummvm/scummvm/commit/8a229f29b33178575cd464b08642c3d7011331a5
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:43+01:00
Commit Message:
HPL1: add audio debug channel and update flag list
Changed paths:
engines/hpl1/debug.h
engines/hpl1/detection.cpp
diff --git a/engines/hpl1/debug.h b/engines/hpl1/debug.h
index 4011871489b..292cdc9a2aa 100644
--- a/engines/hpl1/debug.h
+++ b/engines/hpl1/debug.h
@@ -31,7 +31,8 @@ enum DebugChannels {
kDebugResourceLoading = 1 << 1,
kDebugFilePath = 1 << 2,
kDebugOpenGL = 1 << 3,
- kDebugRenderer = 1 << 4
+ kDebugRenderer = 1 << 4,
+ kDebugAudio = 1 << 5
};
enum DebugLevels {
diff --git a/engines/hpl1/detection.cpp b/engines/hpl1/detection.cpp
index 84328a8e8e2..cacab2fff0e 100644
--- a/engines/hpl1/detection.cpp
+++ b/engines/hpl1/detection.cpp
@@ -31,9 +31,12 @@
#include "hpl1/debug.h"
const DebugChannelDef Hpl1MetaEngineDetection::debugFlagList[] = {
- { Hpl1::kDebugGraphics, "Graphics", "Graphics debug level" },
- { Hpl1::kDebugResourceLoading, "ResourceLoading", "Resource loading debug level" },
- { Hpl1::kDebugFilePath, "FilePath", "File path debug level" },
+ { Hpl1::kDebugGraphics, "Graphics", "Graphics debug channel" },
+ { Hpl1::kDebugResourceLoading, "ResourceLoading", "Resource loading debug channel" },
+ { Hpl1::kDebugFilePath, "FilePath", "File path debug channel" },
+ { Hpl1::kDebugOpenGL, "OpenGL", "OpenGL debug channel"},
+ { Hpl1::kDebugRenderer, "Renderer", "Rederer debug channel"},
+ { Hpl1::kDebugAudio, "Audio", "Audio debug channel"},
DEBUG_CHANNEL_END
};
Commit: fffb1152122b8735a9fd5ca926f5e2b99fc101e9
https://github.com/scummvm/scummvm/commit/fffb1152122b8735a9fd5ca926f5e2b99fc101e9
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:43+01:00
Commit Message:
HPL1: cleanup automatically added headers
Changed paths:
engines/hpl1/engine/graphics/Renderer3D.cpp
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index 565081bcb1a..edf2aa163bb 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -48,8 +48,6 @@
#include "hpl1/engine/scene/RenderableContainer.h"
#include "hpl1/engine/scene/World3D.h"
#include "hpl1/engine/system/low_level_system.h"
-#include <cstddef>
-#include <sys/types.h>
namespace hpl {
Commit: 1f96617cf21e38e28783418ce7929d645a7d2db5
https://github.com/scummvm/scummvm/commit/1f96617cf21e38e28783418ce7929d645a7d2db5
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:43+01:00
Commit Message:
HPL1: implement sound data class
Changed paths:
engines/hpl1/engine/impl/OpenALSoundData.cpp
engines/hpl1/engine/impl/OpenALSoundData.h
engines/hpl1/engine/sound/SoundData.h
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.cpp b/engines/hpl1/engine/impl/OpenALSoundData.cpp
index a375fd56133..ee050b68d9d 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundData.cpp
@@ -26,8 +26,15 @@
*/
#include "hpl1/engine/impl/OpenALSoundData.h"
+#include "audio/mixer.h"
+#include "common/file.h"
+#include "common/stream.h"
+#include "common/system.h"
+#include "common/types.h"
+#include "hpl1/debug.h"
#include "hpl1/engine/impl/OpenALSoundChannel.h"
#include "hpl1/engine/system/low_level_system.h"
+#include "audio/decoders/vorbis.h"
namespace hpl {
//////////////////////////////////////////////////////////////////////////
@@ -36,27 +43,13 @@ namespace hpl {
//-----------------------------------------------------------------------
-cOpenALSoundData::cOpenALSoundData(tString asName, bool abStream) : iSoundData(asName, abStream) {
- mpSample = NULL;
- mpStream = NULL;
- // mpSoundData = NULL;
+cOpenALSoundData::cOpenALSoundData(tString asName, bool abStream) : iSoundData(asName, abStream), _stream(nullptr) {
}
//-----------------------------------------------------------------------
cOpenALSoundData::~cOpenALSoundData() {
-#if 0
- if (mbStream)
- {
- if(mpStream)
- OAL_Stream_Unload ( mpStream );//static_cast<cOAL_Stream*>(mpSoundData) );
- }
- else
- {
- if(mpSample)
- OAL_Sample_Unload ( mpSample );//static_cast<cOAL_Sample*>(mpSoundData) );
- }
-#endif
+
}
//-----------------------------------------------------------------------
@@ -67,52 +60,20 @@ cOpenALSoundData::~cOpenALSoundData() {
//-----------------------------------------------------------------------
-bool cOpenALSoundData::CreateFromFile(const tString &asFile) {
-#if 0
- int lFlags=0;
-
- unsigned int lCaps = 0;
-// FSOUND_GetDriverCaps(0, &lCaps);//Current driver here instead of 0
-
- //Get the load flags
-// if(lCaps & FSOUND_CAPS_HARDWARE) lFlags |= FSOUND_HW3D;
- //if(mbStream) lFlags |= FSOUND_STREAMABLE;
-
- if(mbStream)
- {
- //mpSoundData
- mpStream = OAL_Stream_Load ( asFile.c_str() );
-
-
-
- if(mpStream == NULL )//mpSoundData==NULL){
- {
- Error("Couldn't load sound stream '%s'\n", asFile.c_str());
- return false;
- }
- else
- OAL_Stream_SetLoop(mpStream,mbLoopStream);
- //mpStream->SetLoop(mbLoopStream);
- //mpSoundData->SetLoop(mbLoopStream);
-
- }
- else
- {
- mpSample = OAL_Sample_Load ( asFile.c_str() );
-// mpSoundData = OAL_Sample_Load ( asFile.c_str() );
- if(mpSample == NULL)//mpSoundData==NULL){
- {
- Error("Couldn't load sound data '%s'\n", asFile.c_str());
- return false;
- }
- else
- OAL_Sample_SetLoop(mpSample,true);
- //mpSample->SetLoop ( true );
-
- }
-
-#endif
- return true;
+bool cOpenALSoundData::CreateFromFile(const tString &filename) {
+ Hpl1::logInfo(Hpl1::kDebugResourceLoading | Hpl1::kDebugAudio,
+ "loading audio file %s\n", filename.c_str());
+ // FIXME: string types
+ Common::File soundFile;
+ if (_stream)
+ error("trying to load a sample"); // FIXME: remove this if its not needed
+ if (!soundFile.open(filename.c_str())) {
+ Hpl1::logError(Hpl1::kDebugAudio,
+ "audio file %s could not be loaded", filename.c_str());
+ return false;
+ }
+ _stream = Audio::makeVorbisStream(&soundFile, DisposeAfterUse::NO);
+ return static_cast<bool>(_stream);
}
//-----------------------------------------------------------------------
@@ -146,19 +107,4 @@ iSoundChannel *cOpenALSoundData::CreateChannel(int alPriority) {
return NULL;
}
-//-----------------------------------------------------------------------
-
-bool cOpenALSoundData::IsStereo() {
-#if 0
- if (mbStream)
- return (OAL_Stream_GetChannels(mpStream)==2);
- if (mpSample)
- return (OAL_Sample_GetChannels(mpSample)==2);
-
-#endif
- return false;
-}
-
-//-----------------------------------------------------------------------
-
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.h b/engines/hpl1/engine/impl/OpenALSoundData.h
index 8e307c84512..9fe63a7886e 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.h
+++ b/engines/hpl1/engine/impl/OpenALSoundData.h
@@ -30,8 +30,7 @@
#include "hpl1/engine/sound/SoundData.h"
-//#include "OALWrapper/OAL_Funcs.h"
-#include "temp-types.h"
+#include "audio/audiostream.h"
namespace hpl {
@@ -46,14 +45,13 @@ public:
bool IsStream() { return mbStream; }
- bool IsStereo();
-
- cOAL_Sample *GetSample() { return (mpSample); } // static_cast<cOAL_Sample*> (mpSoundData));}
- cOAL_Stream *GetStream() { return (mpStream); } // static_cast<cOAL_Stream*> (mpSoundData));}
+ //cOAL_Sample *GetSample() { return (mpSample); } // static_cast<cOAL_Sample*> (mpSoundData));}
+ //cOAL_Stream *GetStream() { return (mpStream); } // static_cast<cOAL_Stream*> (mpSoundData));}
private:
- cOAL_Sample *mpSample;
- cOAL_Stream *mpStream;
+ //cOAL_Sample *mpSample;
+ //cOAL_Stream *mpStream;
+ Audio::SeekableAudioStream* _stream;
// iOAL_Loadable* mpSoundData;
};
diff --git a/engines/hpl1/engine/sound/SoundData.h b/engines/hpl1/engine/sound/SoundData.h
index a16f3712607..ed31c993b34 100644
--- a/engines/hpl1/engine/sound/SoundData.h
+++ b/engines/hpl1/engine/sound/SoundData.h
@@ -47,8 +47,6 @@ public:
virtual iSoundChannel *CreateChannel(int alPriority) = 0;
- virtual bool IsStereo() = 0;
-
bool IsStream() { return mbStream; }
void SetLoopStream(bool abX) { mbLoopStream = abX; }
bool GetLoopStream() { return mbLoopStream; }
Commit: a0fb2759a7c223450c660bde5fb8336e6e541295
https://github.com/scummvm/scummvm/commit/a0fb2759a7c223450c660bde5fb8336e6e541295
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:43+01:00
Commit Message:
HPL1: implement minimal sound channel class
Changed paths:
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
engines/hpl1/engine/impl/OpenALSoundChannel.h
engines/hpl1/engine/impl/OpenALSoundData.cpp
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index 0647b55d8e6..5f1263b1917 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -30,6 +30,11 @@
#include "hpl1/engine/resources/SoundManager.h"
#include "hpl1/engine/math/Math.h"
+#include "audio/mixer.h"
+#include "common/system.h"
+#include "common/debug.h"
+
+#define mixer g_system->getMixer()
namespace hpl {
@@ -39,8 +44,8 @@ namespace hpl {
//-----------------------------------------------------------------------
-cOpenALSoundChannel::cOpenALSoundChannel(iSoundData *apData, int alChannel, cSoundManager *apSoundManger)
- : iSoundChannel(apData, apSoundManger) {
+cOpenALSoundChannel::cOpenALSoundChannel(iSoundData *apData, Audio::SoundHandle handle, cSoundManager *apSoundManger)
+ : iSoundChannel(apData, apSoundManger), _handle(handle), _playing(true) {
#if 0
mlChannel = alChannel;
@@ -65,6 +70,9 @@ cOpenALSoundChannel::cOpenALSoundChannel(iSoundData *apData, int alChannel, cSou
//-----------------------------------------------------------------------
cOpenALSoundChannel::~cOpenALSoundChannel() {
+ mixer->stopHandle(_handle);
+ if (mpSoundManger)
+ mpSoundManger->Destroy(mpData);
#if 0
if(mlChannel>=0)
OAL_Source_Stop ( mlChannel );
@@ -92,6 +100,8 @@ void cOpenALSoundChannel::Play() {
//-----------------------------------------------------------------------
void cOpenALSoundChannel::Stop() {
+ mixer->stopHandle(_handle);
+ mbStopUsed = true;
#if 0
//Log("Stopping %s - Source %d Ref %d\n",mpData->GetName().c_str(), mlChannel & 0xFFF, (mlChannel & 0x7ffff000) >> 12);
OAL_Source_Stop ( mlChannel );
@@ -103,7 +113,9 @@ void cOpenALSoundChannel::Stop() {
//-----------------------------------------------------------------------
-void cOpenALSoundChannel::SetPaused(bool abX) {
+void cOpenALSoundChannel::SetPaused(bool toggle) {
+ mixer->pauseHandle(_handle, toggle);
+ _playing = toggle;
#if 0
// Log("Setting %s %spaused! - Source %d\n",mpData->GetName().c_str(),abX?"":"un", mlChannel);
@@ -129,7 +141,9 @@ void cOpenALSoundChannel::SetSpeed(float afSpeed) {
//-----------------------------------------------------------------------
-void cOpenALSoundChannel::SetVolume(float afVolume) {
+void cOpenALSoundChannel::SetVolume(float volume) {
+ assert(0.f <= volume && volume <= 1.f);
+ mixer->setChannelVolume(_handle, static_cast<byte>(volume * 255.f));
#if 0
mfVolume = afVolume;
@@ -140,6 +154,8 @@ void cOpenALSoundChannel::SetVolume(float afVolume) {
//-----------------------------------------------------------------------
void cOpenALSoundChannel::SetLooping(bool abLoop) {
+ mbLooping = abLoop;
+ mixer->loopChannel(_handle);
#if 0
mbLooping = abLoop;
@@ -204,10 +220,7 @@ void cOpenALSoundChannel::SetMaxDistance(float afMax) {
//-----------------------------------------------------------------------
bool cOpenALSoundChannel::IsPlaying() {
-#if 0
- return OAL_Source_IsPlaying( mlChannel );
-#endif
- return false;
+ return _playing;
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.h b/engines/hpl1/engine/impl/OpenALSoundChannel.h
index e6789e44c6f..f874dda8891 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.h
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.h
@@ -30,6 +30,7 @@
#include "hpl1/engine/sound/SoundChannel.h"
#include "hpl1/engine/sound/SoundData.h"
+#include "audio/mixer.h"
//#include "OALWrapper/OAL_Funcs.h"
@@ -37,7 +38,7 @@ namespace hpl {
class cOpenALSoundChannel : public iSoundChannel {
public:
- cOpenALSoundChannel(iSoundData *apData, int alChannel, cSoundManager *apSoundManger);
+ cOpenALSoundChannel(iSoundData *apData, Audio::SoundHandle handle, cSoundManager *apSoundManger);
~cOpenALSoundChannel();
void Play();
@@ -72,7 +73,8 @@ public:
void SetFilterGainHF(float afGainHF);
private:
- int mlChannel;
+ Audio::SoundHandle _handle;
+ bool _playing;
int mlDefaultFreq;
float mfPosition[3];
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.cpp b/engines/hpl1/engine/impl/OpenALSoundData.cpp
index ee050b68d9d..e5c0c89acbc 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundData.cpp
@@ -79,32 +79,13 @@ bool cOpenALSoundData::CreateFromFile(const tString &filename) {
//-----------------------------------------------------------------------
iSoundChannel *cOpenALSoundData::CreateChannel(int alPriority) {
-#if 0
- //if(mpSoundData==NULL)return NULL;
- if ( (mpSample == NULL) && (mpStream == NULL) ) return NULL;
-
- int lHandle;
- iSoundChannel *pSoundChannel=NULL;
- if(mbStream)
- {
- lHandle = OAL_Stream_Play ( OAL_FREE, GetStream(), 1.0f, true );
- if(lHandle==-1)return NULL;
-
- pSoundChannel = hplNew( cOpenALSoundChannel, (this,lHandle, mpSoundManger) );
- IncUserCount();
- }
- else
- {
- lHandle = OAL_Sample_Play ( OAL_FREE, GetSample(), 1.0f, true, alPriority);
- if(lHandle==-1)return NULL;
-
- pSoundChannel = hplNew( cOpenALSoundChannel, (this,lHandle, mpSoundManger) );
- IncUserCount();
- }
-
- return pSoundChannel;
-#endif
- return NULL;
+ if (!_stream)
+ return nullptr;
+
+ Audio::SoundHandle handle;
+ g_system->getMixer()->playStream(Audio::Mixer::SoundType::kPlainSoundType, &handle, _stream);
+ IncUserCount();
+ return hplNew(cOpenALSoundChannel, (this, handle, mpSoundManger));
}
} // namespace hpl
Commit: 60828f7bbb43b4649bb8f4ea8310d65d3ae0cd76
https://github.com/scummvm/scummvm/commit/60828f7bbb43b4649bb8f4ea8310d65d3ae0cd76
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:43+01:00
Commit Message:
HPL1: enable sound loading and add error logging
Changed paths:
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
engines/hpl1/engine/resources/SoundManager.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
index e6bafd7089e..47776210bbc 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
@@ -33,6 +33,9 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
+#include "common/system.h"
+#include "audio/mixer.h"
+
//#include "OALWrapper/OAL_Funcs.h"
//#include "OALWrapper/OAL_Effect_Reverb.h"
@@ -46,9 +49,8 @@ namespace hpl {
//-----------------------------------------------------------------------
cLowLevelSoundOpenAL::cLowLevelSoundOpenAL() {
- mvFormats[0] = "WAV";
- mvFormats[1] = "OGG";
- mvFormats[2] = "";
+ mvFormats[0] = "OGG";
+ mvFormats[1] = "";
mbInitialized = false;
mbEnvAudioEnabled = false;
mbNullEffectAttached = false;
@@ -73,7 +75,6 @@ cLowLevelSoundOpenAL::~cLowLevelSoundOpenAL() {
iSoundData *cLowLevelSoundOpenAL::LoadSoundData(const tString &asName, const tString &asFilePath,
const tString &asType, bool abStream, bool abLoopStream) {
-#if 0
cOpenALSoundData *pSoundData = hplNew(cOpenALSoundData, (asName, abStream));
pSoundData->SetLoopStream(abLoopStream);
@@ -84,8 +85,6 @@ iSoundData *cLowLevelSoundOpenAL::LoadSoundData(const tString &asName, const tSt
}
return pSoundData;
-#endif
- return nullptr;
}
//-----------------------------------------------------------------------
@@ -162,7 +161,9 @@ void cLowLevelSoundOpenAL::SetSetRolloffFactor(float afFactor) {
//-----------------------------------------------------------------------
-void cLowLevelSoundOpenAL::SetVolume(float afVolume) {
+void cLowLevelSoundOpenAL::SetVolume(float volume) {
+ g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, static_cast<byte>(volume * 255.f));
+ mfVolume = volume;
#if 0
mfVolume = afVolume;
@@ -323,8 +324,8 @@ void cLowLevelSoundOpenAL::Init(bool abUseHardware, bool abForceGeneric, bool ab
OAL_Listener_SetAttributes ( Pos, Vel, mvListenerForward.v, mvListenerUp.v );
//Default volume:
- SetVolume(1.0f);
#endif
+ SetVolume(1.0f);
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/resources/SoundManager.cpp b/engines/hpl1/engine/resources/SoundManager.cpp
index d654122aafd..091eb56d853 100644
--- a/engines/hpl1/engine/resources/SoundManager.cpp
+++ b/engines/hpl1/engine/resources/SoundManager.cpp
@@ -33,6 +33,8 @@
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
+#include "hpl1/debug.h"
+
namespace hpl {
//////////////////////////////////////////////////////////////////////////
@@ -47,7 +49,7 @@ cSoundManager::cSoundManager(cSound *apSound, cResources *apResources)
mpSound = apSound;
mpResources = apResources;
- //mpSound->GetLowLevel()->GetSupportedFormats(mlstFileFormats);
+ mpSound->GetLowLevel()->GetSupportedFormats(mlstFileFormats);
}
cSoundManager::~cSoundManager() {
@@ -77,6 +79,8 @@ iSoundData *cSoundManager::CreateSoundData(const tString &asName, bool abStream,
if (pSound) {
AddResource(pSound);
pSound->SetSoundManager(mpResources->GetSoundManager());
+ } else {
+ Hpl1::logError(Hpl1::kDebugAudio, "sound data %s could not be loaded\n", asName.c_str());
}
} else {
Commit: 5525f8e59da7d85c1cf49d2e920b2f70a95f4242
https://github.com/scummvm/scummvm/commit/5525f8e59da7d85c1cf49d2e920b2f70a95f4242
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:44+01:00
Commit Message:
HPL1: fix audio classes
Changed paths:
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
engines/hpl1/engine/impl/OpenALSoundChannel.h
engines/hpl1/engine/impl/OpenALSoundData.cpp
engines/hpl1/engine/impl/OpenALSoundData.h
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index 5f1263b1917..c652e03b6f6 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -30,6 +30,7 @@
#include "hpl1/engine/resources/SoundManager.h"
#include "hpl1/engine/math/Math.h"
+#include "hpl1/debug.h"
#include "audio/mixer.h"
#include "common/system.h"
#include "common/debug.h"
@@ -44,8 +45,9 @@ namespace hpl {
//-----------------------------------------------------------------------
-cOpenALSoundChannel::cOpenALSoundChannel(iSoundData *apData, Audio::SoundHandle handle, cSoundManager *apSoundManger)
- : iSoundChannel(apData, apSoundManger), _handle(handle), _playing(true) {
+cOpenALSoundChannel::cOpenALSoundChannel(cOpenALSoundData *soundData, cSoundManager *apSoundManger)
+ : iSoundChannel(soundData, apSoundManger), _playing(false), _soundData(soundData) {
+ Play();
#if 0
mlChannel = alChannel;
@@ -90,10 +92,13 @@ cOpenALSoundChannel::~cOpenALSoundChannel() {
//-----------------------------------------------------------------------
void cOpenALSoundChannel::Play() {
- // Log("Playing %s - Source %d Ref %d\n",mpData->GetName().c_str(), mlChannel & 0xFFF, (mlChannel & 0x7ffff000) >> 12);
-
- SetPaused(false);
-
+ Hpl1::logInfo(Hpl1::kDebugAudio, "playing sound channel from data %s", mpData->GetName().c_str());
+ mixer->stopHandle(_handle);
+ _soundData->start(&_handle);
+ SetVolume(mfVolume);
+ if (mbLooping)
+ mixer->loopChannel(_handle);
+ _playing = true;
mbStopUsed = false;
}
@@ -102,31 +107,16 @@ void cOpenALSoundChannel::Play() {
void cOpenALSoundChannel::Stop() {
mixer->stopHandle(_handle);
mbStopUsed = true;
-#if 0
- //Log("Stopping %s - Source %d Ref %d\n",mpData->GetName().c_str(), mlChannel & 0xFFF, (mlChannel & 0x7ffff000) >> 12);
- OAL_Source_Stop ( mlChannel );
- mlChannel = -1;
-
- mbStopUsed = true;
-#endif
+ _playing = false;
}
//-----------------------------------------------------------------------
-void cOpenALSoundChannel::SetPaused(bool toggle) {
- mixer->pauseHandle(_handle, toggle);
- _playing = toggle;
-#if 0
- // Log("Setting %s %spaused! - Source %d\n",mpData->GetName().c_str(),abX?"":"un", mlChannel);
-
- mbPaused = abX;
- OAL_Source_SetPaused ( mlChannel, abX );
-
-// if(mbPaused)
-// {
- //Log("Setting %s paused!\n",mpData->GetName().c_str());
-// }
-#endif
+void cOpenALSoundChannel::SetPaused(bool pause) {
+ Hpl1::logInfo(Hpl1::kDebugAudio, "%spausing sound channel from data %s", pause ? "" : "un",
+ mpData->GetName().c_str());
+ mixer->pauseHandle(_handle, pause);
+ mbPaused = pause;
}
//-----------------------------------------------------------------------
@@ -142,25 +132,18 @@ void cOpenALSoundChannel::SetSpeed(float afSpeed) {
//-----------------------------------------------------------------------
void cOpenALSoundChannel::SetVolume(float volume) {
- assert(0.f <= volume && volume <= 1.f);
- mixer->setChannelVolume(_handle, static_cast<byte>(volume * 255.f));
-#if 0
- mfVolume = afVolume;
-
- OAL_Source_SetVolume(mlChannel, mfVolume);
-#endif
+ mfVolume = cMath::Clamp(volume, 0.0, 1.0);
+ mixer->setChannelVolume(_handle, static_cast<byte>(mfVolume * 255.f));
}
//-----------------------------------------------------------------------
void cOpenALSoundChannel::SetLooping(bool abLoop) {
mbLooping = abLoop;
- mixer->loopChannel(_handle);
-#if 0
- mbLooping = abLoop;
-
- OAL_Source_SetLoop ( mlChannel, abLoop );
-#endif
+ if (abLoop)
+ mixer->loopChannel(_handle);
+ else if (_playing)
+ restart();
}
//-----------------------------------------------------------------------
@@ -285,4 +268,10 @@ void cOpenALSoundChannel::SetFilterGainHF(float afGainHF) {
#endif
}
+void cOpenALSoundChannel::restart() {
+ mixer->stopHandle(_handle);
+ _soundData->start(&_handle);
+ SetVolume(mfVolume);
+}
+
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.h b/engines/hpl1/engine/impl/OpenALSoundChannel.h
index f874dda8891..174f9be5ab1 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.h
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.h
@@ -28,6 +28,7 @@
#ifndef HPL_OPENAL_SOUND_CHANNEL_H
#define HPL_OPENAL_SOUND_CHANNEL_H
+#include "hpl1/engine/impl/OpenALSoundData.h"
#include "hpl1/engine/sound/SoundChannel.h"
#include "hpl1/engine/sound/SoundData.h"
#include "audio/mixer.h"
@@ -38,7 +39,7 @@ namespace hpl {
class cOpenALSoundChannel : public iSoundChannel {
public:
- cOpenALSoundChannel(iSoundData *apData, Audio::SoundHandle handle, cSoundManager *apSoundManger);
+ cOpenALSoundChannel(cOpenALSoundData *soundData, cSoundManager *apSoundManger);
~cOpenALSoundChannel();
void Play();
@@ -73,8 +74,11 @@ public:
void SetFilterGainHF(float afGainHF);
private:
+ void restart();
+
Audio::SoundHandle _handle;
bool _playing;
+ cOpenALSoundData* _soundData;
int mlDefaultFreq;
float mfPosition[3];
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.cpp b/engines/hpl1/engine/impl/OpenALSoundData.cpp
index e5c0c89acbc..d6926b07528 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundData.cpp
@@ -43,13 +43,14 @@ namespace hpl {
//-----------------------------------------------------------------------
-cOpenALSoundData::cOpenALSoundData(tString asName, bool abStream) : iSoundData(asName, abStream), _stream(nullptr) {
+cOpenALSoundData::cOpenALSoundData(tString asName, bool abStream) : iSoundData(asName, abStream), _audioStream(nullptr) {
}
//-----------------------------------------------------------------------
cOpenALSoundData::~cOpenALSoundData() {
-
+ delete _audioStream;
+ _soundFile.close();
}
//-----------------------------------------------------------------------
@@ -64,28 +65,31 @@ bool cOpenALSoundData::CreateFromFile(const tString &filename) {
Hpl1::logInfo(Hpl1::kDebugResourceLoading | Hpl1::kDebugAudio,
"loading audio file %s\n", filename.c_str());
// FIXME: string types
- Common::File soundFile;
- if (_stream)
+ if (_audioStream)
error("trying to load a sample"); // FIXME: remove this if its not needed
- if (!soundFile.open(filename.c_str())) {
+ if (!_soundFile.open(filename.c_str())) {
Hpl1::logError(Hpl1::kDebugAudio,
"audio file %s could not be loaded", filename.c_str());
return false;
}
- _stream = Audio::makeVorbisStream(&soundFile, DisposeAfterUse::NO);
- return static_cast<bool>(_stream);
+ _audioStream = Audio::makeVorbisStream(&_soundFile, DisposeAfterUse::NO);
+ return static_cast<bool>(_audioStream);
}
//-----------------------------------------------------------------------
iSoundChannel *cOpenALSoundData::CreateChannel(int alPriority) {
- if (!_stream)
+ if (!_audioStream)
return nullptr;
- Audio::SoundHandle handle;
- g_system->getMixer()->playStream(Audio::Mixer::SoundType::kPlainSoundType, &handle, _stream);
IncUserCount();
- return hplNew(cOpenALSoundChannel, (this, handle, mpSoundManger));
+ return hplNew(cOpenALSoundChannel, (this, mpSoundManger));
+}
+
+void cOpenALSoundData::start(Audio::SoundHandle *handle) {
+ _audioStream->rewind();
+ g_system->getMixer()->playStream(Audio::Mixer::SoundType::kPlainSoundType, handle, _audioStream,
+ -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
}
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.h b/engines/hpl1/engine/impl/OpenALSoundData.h
index 9fe63a7886e..668153e65a0 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.h
+++ b/engines/hpl1/engine/impl/OpenALSoundData.h
@@ -30,11 +30,14 @@
#include "hpl1/engine/sound/SoundData.h"
+#include "audio/mixer.h"
#include "audio/audiostream.h"
+#include "common/file.h"
namespace hpl {
class cOpenALSoundData : public iSoundData {
+ friend class cOpenALSoundChannel;
public:
cOpenALSoundData(tString asName, bool abStream);
~cOpenALSoundData();
@@ -49,11 +52,10 @@ public:
//cOAL_Stream *GetStream() { return (mpStream); } // static_cast<cOAL_Stream*> (mpSoundData));}
private:
- //cOAL_Sample *mpSample;
- //cOAL_Stream *mpStream;
- Audio::SeekableAudioStream* _stream;
+ void start(Audio::SoundHandle *handle);
- // iOAL_Loadable* mpSoundData;
+ Audio::SeekableAudioStream* _audioStream;
+ Common::File _soundFile;
};
}; // namespace hpl
#endif // HPL_OPENAL_SOUND_DATA_H
Commit: e0253d2db1027a00047825fdd8f1fa96637d5381
https://github.com/scummvm/scummvm/commit/e0253d2db1027a00047825fdd8f1fa96637d5381
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:44+01:00
Commit Message:
HPL1: add newline in log messages
Changed paths:
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index c652e03b6f6..ea6e2677720 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -92,7 +92,7 @@ cOpenALSoundChannel::~cOpenALSoundChannel() {
//-----------------------------------------------------------------------
void cOpenALSoundChannel::Play() {
- Hpl1::logInfo(Hpl1::kDebugAudio, "playing sound channel from data %s", mpData->GetName().c_str());
+ Hpl1::logInfo(Hpl1::kDebugAudio, "playing sound channel from data %s\n", mpData->GetName().c_str());
mixer->stopHandle(_handle);
_soundData->start(&_handle);
SetVolume(mfVolume);
@@ -113,7 +113,7 @@ void cOpenALSoundChannel::Stop() {
//-----------------------------------------------------------------------
void cOpenALSoundChannel::SetPaused(bool pause) {
- Hpl1::logInfo(Hpl1::kDebugAudio, "%spausing sound channel from data %s", pause ? "" : "un",
+ Hpl1::logInfo(Hpl1::kDebugAudio, "%spausing sound channel from data %s\n", pause ? "" : "un",
mpData->GetName().c_str());
mixer->pauseHandle(_handle, pause);
mbPaused = pause;
Commit: cf0bb2ad12c66983f5fbfafa3399e3fa53032059
https://github.com/scummvm/scummvm/commit/cf0bb2ad12c66983f5fbfafa3399e3fa53032059
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:44+01:00
Commit Message:
HPL1: fix audio bug
Changed paths:
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
engines/hpl1/engine/impl/OpenALSoundChannel.h
engines/hpl1/engine/impl/OpenALSoundData.cpp
engines/hpl1/engine/impl/OpenALSoundData.h
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index ea6e2677720..80ad838c08c 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -29,11 +29,10 @@
#include "hpl1/engine/impl/OpenALSoundData.h"
#include "hpl1/engine/resources/SoundManager.h"
-#include "hpl1/engine/math/Math.h"
-#include "hpl1/debug.h"
#include "audio/mixer.h"
#include "common/system.h"
-#include "common/debug.h"
+#include "hpl1/debug.h"
+#include "hpl1/engine/math/Math.h"
#define mixer g_system->getMixer()
@@ -45,9 +44,11 @@ namespace hpl {
//-----------------------------------------------------------------------
-cOpenALSoundChannel::cOpenALSoundChannel(cOpenALSoundData *soundData, cSoundManager *apSoundManger)
- : iSoundChannel(soundData, apSoundManger), _playing(false), _soundData(soundData) {
- Play();
+cOpenALSoundChannel::cOpenALSoundChannel(cOpenALSoundData *soundData, Audio::SeekableAudioStream *audioStream, cSoundManager *apSoundManger)
+ : iSoundChannel(soundData, apSoundManger), _playing(false), _audioStream(audioStream) {
+ Hpl1::logInfo(Hpl1::kDebugAudio, "creating sound channel form file %s\n", mpData->GetName().c_str());
+ if (!_audioStream)
+ Hpl1::logError(Hpl1::kDebugAudio, "sound channel created with null audio stream\n");
#if 0
mlChannel = alChannel;
@@ -73,14 +74,10 @@ cOpenALSoundChannel::cOpenALSoundChannel(cOpenALSoundData *soundData, cSoundMana
cOpenALSoundChannel::~cOpenALSoundChannel() {
mixer->stopHandle(_handle);
+ if (_audioStream)
+ delete _audioStream;
if (mpSoundManger)
mpSoundManger->Destroy(mpData);
-#if 0
- if(mlChannel>=0)
- OAL_Source_Stop ( mlChannel );
-
- if(mpSoundManger)mpSoundManger->Destroy(mpData);
-#endif
}
//-----------------------------------------------------------------------
@@ -93,9 +90,7 @@ cOpenALSoundChannel::~cOpenALSoundChannel() {
void cOpenALSoundChannel::Play() {
Hpl1::logInfo(Hpl1::kDebugAudio, "playing sound channel from data %s\n", mpData->GetName().c_str());
- mixer->stopHandle(_handle);
- _soundData->start(&_handle);
- SetVolume(mfVolume);
+ restart();
if (mbLooping)
mixer->loopChannel(_handle);
_playing = true;
@@ -114,8 +109,10 @@ void cOpenALSoundChannel::Stop() {
void cOpenALSoundChannel::SetPaused(bool pause) {
Hpl1::logInfo(Hpl1::kDebugAudio, "%spausing sound channel from data %s\n", pause ? "" : "un",
- mpData->GetName().c_str());
+ mpData->GetName().c_str());
mixer->pauseHandle(_handle, pause);
+ if (!_playing && !pause)
+ Play();
mbPaused = pause;
}
@@ -270,7 +267,8 @@ void cOpenALSoundChannel::SetFilterGainHF(float afGainHF) {
void cOpenALSoundChannel::restart() {
mixer->stopHandle(_handle);
- _soundData->start(&_handle);
+ _audioStream->rewind();
+ mixer->playStream(Audio::Mixer::SoundType::kPlainSoundType, &_handle, _audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
SetVolume(mfVolume);
}
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.h b/engines/hpl1/engine/impl/OpenALSoundChannel.h
index 174f9be5ab1..ce6ba67608a 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.h
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.h
@@ -32,6 +32,9 @@
#include "hpl1/engine/sound/SoundChannel.h"
#include "hpl1/engine/sound/SoundData.h"
#include "audio/mixer.h"
+#include "common/file.h"
+#include "common/str.h"
+#include "audio/audiostream.h"
//#include "OALWrapper/OAL_Funcs.h"
@@ -39,7 +42,7 @@ namespace hpl {
class cOpenALSoundChannel : public iSoundChannel {
public:
- cOpenALSoundChannel(cOpenALSoundData *soundData, cSoundManager *apSoundManger);
+ cOpenALSoundChannel(cOpenALSoundData *soundData, Audio::SeekableAudioStream* audioStream, cSoundManager *apSoundManger);
~cOpenALSoundChannel();
void Play();
@@ -78,7 +81,7 @@ private:
Audio::SoundHandle _handle;
bool _playing;
- cOpenALSoundData* _soundData;
+ Audio::SeekableAudioStream* _audioStream;
int mlDefaultFreq;
float mfPosition[3];
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.cpp b/engines/hpl1/engine/impl/OpenALSoundData.cpp
index d6926b07528..65997df74cc 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundData.cpp
@@ -26,15 +26,11 @@
*/
#include "hpl1/engine/impl/OpenALSoundData.h"
-#include "audio/mixer.h"
-#include "common/file.h"
-#include "common/stream.h"
-#include "common/system.h"
-#include "common/types.h"
+#include "audio/audiostream.h"
#include "hpl1/debug.h"
#include "hpl1/engine/impl/OpenALSoundChannel.h"
+#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/system/low_level_system.h"
-#include "audio/decoders/vorbis.h"
namespace hpl {
//////////////////////////////////////////////////////////////////////////
@@ -43,14 +39,13 @@ namespace hpl {
//-----------------------------------------------------------------------
-cOpenALSoundData::cOpenALSoundData(tString asName, bool abStream) : iSoundData(asName, abStream), _audioStream(nullptr) {
+cOpenALSoundData::cOpenALSoundData(tString asName, bool abStream)
+ : iSoundData(asName, abStream) {
}
//-----------------------------------------------------------------------
cOpenALSoundData::~cOpenALSoundData() {
- delete _audioStream;
- _soundFile.close();
}
//-----------------------------------------------------------------------
@@ -62,34 +57,17 @@ cOpenALSoundData::~cOpenALSoundData() {
//-----------------------------------------------------------------------
bool cOpenALSoundData::CreateFromFile(const tString &filename) {
- Hpl1::logInfo(Hpl1::kDebugResourceLoading | Hpl1::kDebugAudio,
- "loading audio file %s\n", filename.c_str());
- // FIXME: string types
- if (_audioStream)
+ if (_filename != "")
error("trying to load a sample"); // FIXME: remove this if its not needed
- if (!_soundFile.open(filename.c_str())) {
- Hpl1::logError(Hpl1::kDebugAudio,
- "audio file %s could not be loaded", filename.c_str());
- return false;
- }
- _audioStream = Audio::makeVorbisStream(&_soundFile, DisposeAfterUse::NO);
- return static_cast<bool>(_audioStream);
+ // FIXME: string types
+ _filename = filename.c_str();
}
//-----------------------------------------------------------------------
iSoundChannel *cOpenALSoundData::CreateChannel(int alPriority) {
- if (!_audioStream)
- return nullptr;
-
IncUserCount();
- return hplNew(cOpenALSoundChannel, (this, mpSoundManger));
-}
-
-void cOpenALSoundData::start(Audio::SoundHandle *handle) {
- _audioStream->rewind();
- g_system->getMixer()->playStream(Audio::Mixer::SoundType::kPlainSoundType, handle, _audioStream,
- -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+ return hplNew(cOpenALSoundChannel, (this, Audio::SeekableAudioStream::openStreamFile(_filename.substr(0, _filename.size() - 4)), mpSoundManger));
}
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.h b/engines/hpl1/engine/impl/OpenALSoundData.h
index 668153e65a0..a9c2109e950 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.h
+++ b/engines/hpl1/engine/impl/OpenALSoundData.h
@@ -29,15 +29,12 @@
#define HPL_OPENAL_SOUND_DATA_H
#include "hpl1/engine/sound/SoundData.h"
+#include "hpl1/engine/system/SystemTypes.h"
-#include "audio/mixer.h"
-#include "audio/audiostream.h"
-#include "common/file.h"
-
+#include "common/str.h"
namespace hpl {
class cOpenALSoundData : public iSoundData {
- friend class cOpenALSoundChannel;
public:
cOpenALSoundData(tString asName, bool abStream);
~cOpenALSoundData();
@@ -48,14 +45,8 @@ public:
bool IsStream() { return mbStream; }
- //cOAL_Sample *GetSample() { return (mpSample); } // static_cast<cOAL_Sample*> (mpSoundData));}
- //cOAL_Stream *GetStream() { return (mpStream); } // static_cast<cOAL_Stream*> (mpSoundData));}
-
private:
- void start(Audio::SoundHandle *handle);
-
- Audio::SeekableAudioStream* _audioStream;
- Common::File _soundFile;
+ Common::String _filename;
};
}; // namespace hpl
#endif // HPL_OPENAL_SOUND_DATA_H
Commit: 6a97b0bd24892f99cca9f4f1c02c8a34c3b9f3a5
https://github.com/scummvm/scummvm/commit/6a97b0bd24892f99cca9f4f1c02c8a34c3b9f3a5
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:44+01:00
Commit Message:
HPL1: fix missing return value
Changed paths:
engines/hpl1/engine/impl/OpenALSoundData.cpp
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.cpp b/engines/hpl1/engine/impl/OpenALSoundData.cpp
index 65997df74cc..26f801d3f08 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundData.cpp
@@ -61,6 +61,7 @@ bool cOpenALSoundData::CreateFromFile(const tString &filename) {
error("trying to load a sample"); // FIXME: remove this if its not needed
// FIXME: string types
_filename = filename.c_str();
+ return true;
}
//-----------------------------------------------------------------------
Commit: 96fbd51deef4bde469cf7270acc1c4ed6061941e
https://github.com/scummvm/scummvm/commit/96fbd51deef4bde469cf7270acc1c4ed6061941e
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:44+01:00
Commit Message:
HPL1: add wav as a supported format
Changed paths:
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
index 47776210bbc..37bba6d2f6c 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
@@ -50,7 +50,8 @@ namespace hpl {
cLowLevelSoundOpenAL::cLowLevelSoundOpenAL() {
mvFormats[0] = "OGG";
- mvFormats[1] = "";
+ mvFormats[1] = "WAV";
+ mvFormats[2] = "";
mbInitialized = false;
mbEnvAudioEnabled = false;
mbNullEffectAttached = false;
Commit: a1562f0a29e435341dd5829215fab1236fba13cd
https://github.com/scummvm/scummvm/commit/a1562f0a29e435341dd5829215fab1236fba13cd
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:44+01:00
Commit Message:
HPL1: enable functionality in LowLevelSound
Changed paths:
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
index 37bba6d2f6c..f8b11513d32 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
@@ -110,7 +110,6 @@ void cLowLevelSoundOpenAL::UpdateSound(float afTimeStep) {
void cLowLevelSoundOpenAL::SetListenerAttributes(const cVector3f &avPos, const cVector3f &avVel,
const cVector3f &avForward, const cVector3f &avUp) {
-#if 0
mvListenerPosition = avPos;
mvListenerVelocity = avVel;
mvListenerForward = avForward;
@@ -130,20 +129,12 @@ void cLowLevelSoundOpenAL::SetListenerAttributes(const cVector3f &avPos, const c
m_mtxListener.SetForward(mvListenerForward * -1);
m_mtxListener = cMath::MatrixInverse(m_mtxListener);
m_mtxListener.SetTranslation(mvListenerPosition);
-
- float fVel[3] = {0, 0, 0};
- OAL_Listener_SetAttributes ( avPos.v, avVel.v, (avForward*(-1)).v, avUp.v );
-#endif
}
//-----------------------------------------------------------------------
void cLowLevelSoundOpenAL::SetListenerPosition(const cVector3f &avPos) {
-#if 0
- mvListenerPosition = avPos;
-
- OAL_Listener_SetAttributes ( avPos.v, mvListenerVelocity.v, (mvListenerForward*(-1)).v, mvListenerUp.v );
-#endif
+ mvListenerPosition = avPos;
}
//-----------------------------------------------------------------------
@@ -165,11 +156,6 @@ void cLowLevelSoundOpenAL::SetSetRolloffFactor(float afFactor) {
void cLowLevelSoundOpenAL::SetVolume(float volume) {
g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, static_cast<byte>(volume * 255.f));
mfVolume = volume;
-#if 0
- mfVolume = afVolume;
-
- OAL_Listener_SetMasterVolume ( afVolume );
-#endif
}
//-----------------------------------------------------------------------
@@ -314,18 +300,14 @@ void cLowLevelSoundOpenAL::Init(bool abUseHardware, bool abForceGeneric, bool ab
Log(" Setting up Environmental Audio...Failed.\n");
}
#endif
-
- //Default listener settings.
- float Pos[3] = {0,0,0};
- float Vel[3] = {0,0,0};
-
- mvListenerForward = cVector3f(0,0,1);
- mvListenerUp = cVector3f(0,1,0);
-
OAL_Listener_SetAttributes ( Pos, Vel, mvListenerForward.v, mvListenerUp.v );
//Default volume:
#endif
+ //Default listener settings.
+ mvListenerForward = cVector3f(0,0,1);
+ mvListenerUp = cVector3f(0,1,0);
+
SetVolume(1.0f);
}
Commit: ac049c0e30c949f7d1f690c9787b7aef214927dd
https://github.com/scummvm/scummvm/commit/ac049c0e30c949f7d1f690c9787b7aef214927dd
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:44+01:00
Commit Message:
HPL1: implement disabled SoundChannel methods
Changed paths:
engines/hpl1/engine/impl/OpenALSoundChannel.h
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.h b/engines/hpl1/engine/impl/OpenALSoundChannel.h
index ce6ba67608a..3ae36b7320d 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.h
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.h
@@ -67,9 +67,9 @@ public:
bool IsPlaying();
- bool IsBufferUnderrun() { return true; /*#if 0 return OAL_Source_IsBufferUnderrun(mlChannel);*/ }
- double GetElapsedTime() { return 0.0; /*#if 0 return OAL_Source_GetElapsedTime(mlChannel);*/ }
- double GetTotalTime() { return 0.0; /*#if 0 return OAL_Source_GetTotalTime(mlChannel);*/ }
+ bool IsBufferUnderrun() { return false; }
+ double GetElapsedTime() { return g_system->getMixer()->getElapsedTime(_handle).secs(); }
+ double GetTotalTime() { return _audioStream->getLength().secs(); }
void SetAffectedByEnv(bool abAffected);
void SetFiltering(bool abEnabled, int alFlags);
Commit: 0b8b6289c0e2b54ec0a7fb5c40fdc7cd3c6ea83b
https://github.com/scummvm/scummvm/commit/0b8b6289c0e2b54ec0a7fb5c40fdc7cd3c6ea83b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:44+01:00
Commit Message:
HPL1: add unimplemented macro
Changed paths:
engines/hpl1/debug.h
diff --git a/engines/hpl1/debug.h b/engines/hpl1/debug.h
index 292cdc9a2aa..07718a69d84 100644
--- a/engines/hpl1/debug.h
+++ b/engines/hpl1/debug.h
@@ -24,6 +24,8 @@
#include "common/debug.h"
+#define HPL1_UNIMPLEMENTED(fnName) error("call to unimplemented function " #fnName)
+
namespace Hpl1 {
enum DebugChannels {
Commit: 66c4f7dbdf990f84bc95f8e745a4daebf0595451
https://github.com/scummvm/scummvm/commit/66c4f7dbdf990f84bc95f8e745a4daebf0595451
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:45+01:00
Commit Message:
HPL1: cleanup low level sound class
Changed paths:
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
index f8b11513d32..28ab156c9a7 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
@@ -35,10 +35,7 @@
#include "hpl1/engine/system/low_level_system.h"
#include "common/system.h"
#include "audio/mixer.h"
-
-
-//#include "OALWrapper/OAL_Funcs.h"
-//#include "OALWrapper/OAL_Effect_Reverb.h"
+#include "hpl1/debug.h"
namespace hpl {
@@ -60,10 +57,6 @@ cLowLevelSoundOpenAL::cLowLevelSoundOpenAL() {
//-----------------------------------------------------------------------
cLowLevelSoundOpenAL::~cLowLevelSoundOpenAL() {
-#if 0
- if (mbInitialized)
- OAL_Close();
-#endif
}
//-----------------------------------------------------------------------
@@ -101,9 +94,6 @@ void cLowLevelSoundOpenAL::GetSupportedFormats(tStringList &alstFormats) {
//-----------------------------------------------------------------------
void cLowLevelSoundOpenAL::UpdateSound(float afTimeStep) {
-#if 0
- OAL_Update();
-#endif
}
//-----------------------------------------------------------------------
@@ -146,9 +136,7 @@ void cLowLevelSoundOpenAL::SetListenerAttenuation(bool abEnabled) {
//-----------------------------------------------------------------------
void cLowLevelSoundOpenAL::SetSetRolloffFactor(float afFactor) {
-#if 0
- OAL_SetRollOffFactor ( afFactor );
-#endif
+ HPL1_UNIMPLEMENTED(cLowLevelSoundOpenAL::SetSetRolloffFactor);
}
//-----------------------------------------------------------------------
@@ -160,150 +148,11 @@ void cLowLevelSoundOpenAL::SetVolume(float volume) {
//-----------------------------------------------------------------------
-/*void cLowLevelSoundOpenAL::LogSoundStatus()
-{
- //mbLogSounds = !mbLogSounds;
- //OAL_SetLoggingEnabled ( mbLogSounds );
-}
-*/
-//-----------------------------------------------------------------------
-
void cLowLevelSoundOpenAL::Init(bool abUseHardware, bool abForceGeneric, bool abUseEnvAudio, int alMaxChannels,
int alStreamUpdateFreq, bool abUseThreading, bool abUseVoiceManagement,
int alMaxMonoSourceHint, int alMaxStereoSourceHint,
int alStreamingBufferSize, int alStreamingBufferCount, bool abEnableLowLevelLog, tString asDeviceName) {
-#if 0
-
- cOpenALSoundEnvironment* pEnv = hplNew(cOpenALSoundEnvironment,());
-
-
-
- mbLogSounds = abEnableLowLevelLog;
-
- Log(" Initializing OpenAL.\n");
-
- cOAL_Init_Params cInitParams;
- cInitParams.mbVoiceManagement = abUseVoiceManagement;
- cInitParams.mlNumSourcesHint = alMaxChannels;
- cInitParams.mlUpdateFreq = alStreamUpdateFreq;
- cInitParams.mlStreamingBufferCount = alStreamingBufferCount;
- cInitParams.mlStreamingBufferSize = alStreamingBufferSize;
- cInitParams.mlMinMonoSourcesHint = alMaxMonoSourceHint;
- cInitParams.mlMinStereoSourcesHint = alMaxStereoSourceHint;
- cInitParams.mbUseThread = abUseThreading;
- cInitParams.mlOutputFreq = 44100;
- cInitParams.msDeviceName = asDeviceName;
-
- if (mbLogSounds)
- Log(" Sound logging enabled\n");
-
-#ifdef WIN32
-
- cInitParams.mbUseEFX = abUseEnvAudio;
-
- if ( abUseHardware )
- {
- Log(" Trying to open hardware device...%s ",abForceGeneric ? "(Generic forced)" : "" );
-
- OAL_SetupLogging(mbLogSounds, eOAL_LogOutput_File, eOAL_LogVerbose_High, "HPL_OpenAL_HWDevice");
-
- if (abForceGeneric)
- cInitParams.msDeviceName = "Generic Hardware";
- }
- else
- {
- Log(" Trying to open software device... ");
-
- OAL_SetupLogging(mbLogSounds, eOAL_LogOutput_File, eOAL_LogVerbose_High, "HPL_OpenAL_SWDevice");
-
- cInitParams.msDeviceName = "Generic Software";
- }
-
-#else
-
- cInitParams.mbUseEFX = false;
-
- Log(" Trying to open audio device... ");
-
- OAL_SetupLogging(mbLogSounds, eOAL_LogOutput_File, eOAL_LogVerbose_High, "HPL_OpenAL");
-
-#endif
-
- mbInitialized = OAL_Init(cInitParams);
-
- if (!mbInitialized)
- {
- Error("Failed to inialize Audio Trying fallback driver\n");
- cInitParams.msDeviceName = "NULL";
- mbInitialized = OAL_Init(cInitParams);
- }
- if (!mbInitialized)
- {
- error("Failed! Check your OpenAL installation");
- return;
- }
-
-#ifdef WIN32
-
- mbHardwareAcc = (strcmp(OAL_Info_GetDeviceName(),"Generic Software") != 0);
-
- if (abUseHardware)
- {
- if (mbHardwareAcc)
- Log("Success!\n");
- else
- Log("Failed opening hardware device, using software\n");
- }
- else
- Log("Success!\n");
-
-#else
-
- Log("Success!\n");
-#endif
-
- OAL_SetDistanceModel ( eOAL_DistanceModel_None );
-
-
- Log(" Device name: %s\n", OAL_Info_GetDeviceName() );
- Log(" Number of mono sources: %d\n", OAL_Info_GetNumSources());
- Log(" Vendor name: %s\n", OAL_Info_GetVendorName());
- Log(" Renderer: %s\n", OAL_Info_GetRendererName());
- Log(" OpenAL Version Supported: %d.%d\n", OAL_Info_GetMajorVersion(), OAL_Info_GetMinorVersion() );
- Log(" EFX: %d\n", OAL_Info_IsEFXActive() );
- Log(" Output Devices: \n");
- tStringVec llDevices = OAL_Info_GetOutputDevices();
- tStringVecIt it;
- for (it = llDevices.begin(); it != llDevices.end(); ++it) {
- Log(" %s\n", (*it).c_str());
- }
-// Log(" Available extensions:\n");
-// for ( int i = 0; i < OAL_ gpDevice->GetExtensions->size(); ++i )
-// Log(" \t%s\n", (*pDeviceInfo->vsExtensions)[i].c_str());
-
-#ifdef WIN32
- if (abUseEnvAudio)
- {
- mbEnvAudioEnabled = OAL_Info_IsEFXActive();
- mpEffect = OAL_Effect_Reverb_Create();
- if (mbEnvAudioEnabled && (mpEffect != NULL))
- {
- //SetSoundEnvironment(NULL);
- OAL_EffectSlot_AttachEffect(0, (cOAL_Effect*)mpEffect);
- OAL_EffectSlot_SetAutoAdjust(0, false);
-
- SetEnvVolume(1.0f);
- Log(" Setting up Environmental Audio...Success.\n");
- }
- else
- Log(" Setting up Environmental Audio...Failed.\n");
- }
-#endif
- OAL_Listener_SetAttributes ( Pos, Vel, mvListenerForward.v, mvListenerUp.v );
-
- //Default volume:
-#endif
//Default listener settings.
mvListenerForward = cVector3f(0,0,1);
mvListenerUp = cVector3f(0,1,0);
@@ -314,247 +163,25 @@ void cLowLevelSoundOpenAL::Init(bool abUseHardware, bool abForceGeneric, bool ab
//-----------------------------------------------------------------------
void cLowLevelSoundOpenAL::SetEnvVolume(float afEnvVolume) {
-#if 0
- if (!mbEnvAudioEnabled)
- return;
-
- if (afEnvVolume <0)
- afEnvVolume = 0;
- if (afEnvVolume >1)
- afEnvVolume = 1;
- mfEnvVolume = afEnvVolume;
- OAL_EffectSlot_SetGain(0, mfEnvVolume);
-#endif
+ HPL1_UNIMPLEMENTED(cLowLevelSoundOpenAL::SetEnvVolume);
}
//-----------------------------------------------------------------------
iSoundEnvironment *cLowLevelSoundOpenAL::LoadSoundEnvironment(const tString &asFilePath) {
-#if 0
- if (!mbEnvAudioEnabled)
- return NULL;
-
- /////////////////////////////////////////////
- /// Check if sound already exist
- iSoundEnvironment *pSE = GetSoundEnvironmentFromFileName(asFilePath);
- if (pSE)
- return pSE;
-
- /////////////////////////////////////////////
- /// Create new and load from file
- cOpenALSoundEnvironment *pSoundEnv = hplNew(cOpenALSoundEnvironment, ());
-
- if (pSoundEnv->CreateFromFile(asFilePath) == false) {
- hplDelete(pSoundEnv);
- return NULL;
- }
-
- pSoundEnv->SetFileName(cString::ToLowerCase(asFilePath));
-
- mlstSoundEnv.push_back(pSoundEnv);
-
- // Log(" Created %d '%s'\n",pSoundEnv, pSoundEnv->GetName().c_str());
-
- return pSoundEnv;
-#endif
- return nullptr;
+ HPL1_UNIMPLEMENTED(cLowLevelSoundOpenAL::LoadSoundEnvironment);
}
//-----------------------------------------------------------------------
void cLowLevelSoundOpenAL::SetSoundEnvironment(iSoundEnvironment *apSoundEnv) {
-#if 0
- if (!mbEnvAudioEnabled)
- return;
-
- if (apSoundEnv == NULL)
- {
- //Log(" Setting null env\n");
- //if (mbNullEffectAttached == false)
- //{
- // mbNullEffectAttached = true;
-
- OAL_Effect_Reverb_SetDensity(mpEffect, 0);
- OAL_Effect_Reverb_SetDiffusion(mpEffect, 0);
- OAL_Effect_Reverb_SetEchoTime (mpEffect, 0);
- OAL_Effect_Reverb_SetEchoDepth (mpEffect,0);
- OAL_Effect_Reverb_SetModulationTime(mpEffect,0);
- OAL_Effect_Reverb_SetModulationDepth(mpEffect,0);
- OAL_Effect_Reverb_SetGain(mpEffect,0);
- OAL_Effect_Reverb_SetGainHF(mpEffect,0);
- OAL_Effect_Reverb_SetGainLF(mpEffect,0);
- OAL_Effect_Reverb_SetReflectionsDelay(mpEffect,0);
- OAL_Effect_Reverb_SetReflectionsGain(mpEffect, 0);
- OAL_Effect_Reverb_SetLateReverbGain(mpEffect, 0);
- OAL_Effect_Reverb_SetLateReverbDelay( mpEffect, 0);
- OAL_Effect_Reverb_SetHFReference(mpEffect, 0);
- OAL_Effect_Reverb_SetLFReference(mpEffect, 0);
- OAL_Effect_Reverb_SetAirAbsorptionGainHF(mpEffect, 0);
- OAL_Effect_Reverb_SetDecayTime( mpEffect,0);
- OAL_Effect_Reverb_SetDecayHFRatio (mpEffect, 0);
- OAL_Effect_Reverb_SetDecayLFRatio (mpEffect, 0);
- OAL_Effect_Reverb_SetDecayHFLimit(mpEffect, 0);
- OAL_Effect_Reverb_SetRoomRolloffFactor(mpEffect, 0);
- //}
- return;
- }
- //Log(" Setting non-null env\n");
-
- cOpenALSoundEnvironment* pEnv = (cOpenALSoundEnvironment*) apSoundEnv;
-
- OAL_Effect_Reverb_SetDensity(mpEffect, pEnv->GetDensity());
- OAL_Effect_Reverb_SetDiffusion(mpEffect, pEnv->GetDiffusion());
- OAL_Effect_Reverb_SetEchoTime (mpEffect, pEnv->GetEchoTime());
- OAL_Effect_Reverb_SetEchoDepth (mpEffect, pEnv->GetEchoDepth());
- OAL_Effect_Reverb_SetModulationTime(mpEffect,pEnv->GetModulationTime());
- OAL_Effect_Reverb_SetModulationDepth(mpEffect,pEnv->GetModulationDepth());
- OAL_Effect_Reverb_SetGain(mpEffect,pEnv->GetGain());
- OAL_Effect_Reverb_SetGainHF(mpEffect,pEnv->GetGainHF());
- OAL_Effect_Reverb_SetGainLF(mpEffect,pEnv->GetGainLF());
- OAL_Effect_Reverb_SetReflectionsDelay(mpEffect, pEnv->GetReflectionsDelay());
- OAL_Effect_Reverb_SetReflectionsGain(mpEffect, pEnv->GetReflectionsGain());
- OAL_Effect_Reverb_SetLateReverbGain(mpEffect, pEnv->GetLateReverbGain());
- OAL_Effect_Reverb_SetLateReverbDelay( mpEffect, pEnv->GetLateReverbDelay());
- OAL_Effect_Reverb_SetHFReference(mpEffect, pEnv->GetHFReference());
- OAL_Effect_Reverb_SetLFReference(mpEffect, pEnv->GetLFReference());
- OAL_Effect_Reverb_SetAirAbsorptionGainHF(mpEffect, pEnv->GetAirAbsorptionGainHF());
- OAL_Effect_Reverb_SetDecayTime( mpEffect, pEnv->GetDecayTime());
- OAL_Effect_Reverb_SetDecayHFRatio (mpEffect, pEnv->GetDecayHFRatio());
- OAL_Effect_Reverb_SetDecayLFRatio (mpEffect, pEnv->GetDecayLFRatio());
- OAL_Effect_Reverb_SetDecayHFLimit(mpEffect, pEnv->GetDecayHFLimit());
- OAL_Effect_Reverb_SetRoomRolloffFactor(mpEffect, pEnv->GetRoomRolloffFactor());
-
- /*Log(" %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f\n",
- mpEffect->GetDensity(),
- mpEffect->GetDiffusion(),
- mpEffect->GetEchoTime(),
- mpEffect->GetEchoDepth(),
- mpEffect->GetModulationTime(),
- mpEffect->GetModulationDepth(),
- mpEffect->GetGain(),
- mpEffect->GetGainHF(),
- mpEffect->GetGainLF(),
- mpEffect->GetReflectionsDelay(),
- mpEffect->GetReflectionsGain(),
- mpEffect->GetLateReverbGain(),
- mpEffect->GetLateReverbDelay(),
- mpEffect->GetHFReference(),
- mpEffect->GetLFReference(),
- mpEffect->GetAirAbsorptionGainHF(),
- mpEffect->GetDecayTime(),
- mpEffect->GetDecayHFRatio(),
- mpEffect->GetDecayLFRatio(),
- mpEffect->GetRoomRolloffFactor());*/
-
-// if (mbNullEffectAttached)
-// mbNullEffectAttached = false;
-
- //OAL_UpdateEffectSlots();
- OAL_EffectSlot_AttachEffect(0, (cOAL_Effect*)mpEffect);
-
-#endif
+ HPL1_UNIMPLEMENTED(cLowLevelSoundOpenAL::SetSoundEnvironment);
}
//-----------------------------------------------------------------------
void cLowLevelSoundOpenAL::FadeSoundEnvironment(iSoundEnvironment *apSourceSoundEnv, iSoundEnvironment *apDestSoundEnv, float afT) {
-#if 0
- if (!mbEnvAudioEnabled)
- return;
-
- if (afT < 0)
- afT = 0;
- if (afT > 1)
- afT = 1;
-
- float fOneMinusT = 1 - afT;
-
- if ((apSourceSoundEnv == NULL) && (apDestSoundEnv == NULL))
- return;
-
- cOpenALSoundEnvironment pEnv;
-
- cOpenALSoundEnvironment *pSrcEnv = (cOpenALSoundEnvironment *)apSourceSoundEnv;
- cOpenALSoundEnvironment *pDstEnv = (cOpenALSoundEnvironment *)apDestSoundEnv;
-
- if (pSrcEnv == NULL) {
- /*
- SetSoundEnvironment(apDestSoundEnv);
- OAL_EffectSlot_SetGain(0, afT * mfEnvVolume);
- return;
- */
- pEnv.SetDensity(pDstEnv->GetDensity() * afT);
- pEnv.SetDiffusion(pDstEnv->GetDiffusion() * afT);
- pEnv.SetGain(pDstEnv->GetGain() * afT);
- pEnv.SetGainHF(pDstEnv->GetGainHF() * afT);
- pEnv.SetGainLF(pDstEnv->GetGainLF() * afT);
- pEnv.SetDecayTime(pDstEnv->GetDecayTime() * afT);
- pEnv.SetDecayLFRatio(pDstEnv->GetDecayLFRatio() * afT);
- pEnv.SetReflectionsGain(pDstEnv->GetReflectionsGain() * afT);
- pEnv.SetReflectionsDelay(pDstEnv->GetReflectionsDelay() * afT);
- pEnv.SetLateReverbGain(pDstEnv->GetLateReverbGain() * afT);
- pEnv.SetLateReverbDelay(pDstEnv->GetLateReverbDelay() * afT);
- pEnv.SetEchoTime(pDstEnv->GetEchoTime() * afT);
- pEnv.SetEchoDepth(pDstEnv->GetEchoDepth() * afT);
- pEnv.SetModulationTime(pDstEnv->GetModulationTime() * afT);
- pEnv.SetModulationDepth(pDstEnv->GetModulationDepth() * afT);
- pEnv.SetAirAbsorptionGainHF(pDstEnv->GetAirAbsorptionGainHF() * afT);
- pEnv.SetHFReference(pDstEnv->GetHFReference() * afT);
- pEnv.SetLFReference(pDstEnv->GetLFReference() * afT);
- pEnv.SetRoomRolloffFactor(pDstEnv->GetRoomRolloffFactor() * afT);
- pEnv.SetDecayHFLimit(pDstEnv->GetDecayHFLimit());
-
- } else if (pDstEnv == NULL) {
- /*SetSoundEnvironment( apDestSoundEnv);//((*apSourceSoundEnv)*afT));
- OAL_EffectSlot_SetGain(0, fOneMinusT * mfEnvVolume);
- return;*/
- pEnv.SetDensity(pSrcEnv->GetDensity() * fOneMinusT);
- pEnv.SetDiffusion(pSrcEnv->GetDiffusion() * fOneMinusT);
- pEnv.SetGain(pSrcEnv->GetGain() * fOneMinusT);
- pEnv.SetGainHF(pSrcEnv->GetGainHF() * fOneMinusT);
- pEnv.SetGainLF(pSrcEnv->GetGainLF() * fOneMinusT);
- pEnv.SetDecayTime(pSrcEnv->GetDecayTime() * fOneMinusT);
- pEnv.SetDecayLFRatio(pSrcEnv->GetDecayLFRatio() * fOneMinusT);
- pEnv.SetReflectionsGain(pSrcEnv->GetReflectionsGain() * fOneMinusT);
- pEnv.SetReflectionsDelay(pSrcEnv->GetReflectionsDelay() * fOneMinusT);
- pEnv.SetLateReverbGain(pSrcEnv->GetLateReverbGain() * fOneMinusT);
- pEnv.SetLateReverbDelay(pSrcEnv->GetLateReverbDelay() * fOneMinusT);
- pEnv.SetEchoTime(pSrcEnv->GetEchoTime() * fOneMinusT);
- pEnv.SetEchoDepth(pSrcEnv->GetEchoDepth() * fOneMinusT);
- pEnv.SetModulationTime(pSrcEnv->GetModulationTime() * fOneMinusT);
- pEnv.SetModulationDepth(pSrcEnv->GetModulationDepth() * fOneMinusT);
- pEnv.SetAirAbsorptionGainHF(pSrcEnv->GetAirAbsorptionGainHF() * fOneMinusT);
- pEnv.SetHFReference(pSrcEnv->GetHFReference() * fOneMinusT);
- pEnv.SetLFReference(pSrcEnv->GetLFReference() * fOneMinusT);
- pEnv.SetRoomRolloffFactor(pSrcEnv->GetRoomRolloffFactor() * fOneMinusT);
- pEnv.SetDecayHFLimit(pSrcEnv->GetDecayHFLimit());
-
- } else {
- pEnv.SetDensity(pSrcEnv->GetDensity() * fOneMinusT + pDstEnv->GetDensity() * afT);
- pEnv.SetDiffusion(pSrcEnv->GetDiffusion() * fOneMinusT + pDstEnv->GetDiffusion() * afT);
- pEnv.SetGain(pSrcEnv->GetGain() * fOneMinusT + pDstEnv->GetGain() * afT);
- pEnv.SetGainHF(pSrcEnv->GetGainHF() * fOneMinusT + pDstEnv->GetGainHF() * afT);
- pEnv.SetGainLF(pSrcEnv->GetGainLF() * fOneMinusT + pDstEnv->GetGainLF() * afT);
- pEnv.SetDecayTime(pSrcEnv->GetDecayTime() * fOneMinusT + pDstEnv->GetDecayTime() * afT);
- pEnv.SetDecayLFRatio(pSrcEnv->GetDecayLFRatio() * fOneMinusT + pDstEnv->GetDecayLFRatio() * afT);
- pEnv.SetReflectionsGain(pSrcEnv->GetReflectionsGain() * fOneMinusT + pDstEnv->GetReflectionsGain() * afT);
- pEnv.SetReflectionsDelay(pSrcEnv->GetReflectionsDelay() * fOneMinusT + pDstEnv->GetReflectionsDelay() * afT);
- pEnv.SetLateReverbGain(pSrcEnv->GetLateReverbGain() * fOneMinusT + pDstEnv->GetLateReverbGain() * afT);
- pEnv.SetLateReverbDelay(pSrcEnv->GetLateReverbDelay() * fOneMinusT + pDstEnv->GetLateReverbDelay() * afT);
- pEnv.SetEchoTime(pSrcEnv->GetEchoTime() * fOneMinusT + pDstEnv->GetEchoTime() * afT);
- pEnv.SetEchoDepth(pSrcEnv->GetEchoDepth() * fOneMinusT + pDstEnv->GetEchoDepth() * afT);
- pEnv.SetModulationTime(pSrcEnv->GetModulationTime() * fOneMinusT + pDstEnv->GetModulationTime() * afT);
- pEnv.SetModulationDepth(pSrcEnv->GetModulationDepth() * fOneMinusT + pDstEnv->GetModulationDepth() * afT);
- pEnv.SetAirAbsorptionGainHF(pSrcEnv->GetAirAbsorptionGainHF() * fOneMinusT + pDstEnv->GetAirAbsorptionGainHF() * afT);
- pEnv.SetHFReference(pSrcEnv->GetHFReference() * fOneMinusT + pDstEnv->GetHFReference() * afT);
- pEnv.SetLFReference(pSrcEnv->GetLFReference() * fOneMinusT + pDstEnv->GetLFReference() * afT);
- pEnv.SetRoomRolloffFactor(pSrcEnv->GetRoomRolloffFactor() * fOneMinusT + pDstEnv->GetRoomRolloffFactor() * afT);
- pEnv.SetDecayHFLimit(pDstEnv->GetDecayHFLimit());
- }
-
- SetSoundEnvironment(&pEnv);
-#endif
-
+ HPL1_UNIMPLEMENTED(cLowLevelSoundOpenAL::FadeSoundEnvironment);
}
} // namespace hpl
Commit: 53c28a16865cce3abe97a747da98b3ff3b857d59
https://github.com/scummvm/scummvm/commit/53c28a16865cce3abe97a747da98b3ff3b857d59
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:45+01:00
Commit Message:
HPL1: cleanup sound channel class
Changed paths:
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index 80ad838c08c..179547f2b5d 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -248,21 +248,11 @@ void cOpenALSoundChannel::SetFiltering(bool abEnabled, int alFlags) {
}
void cOpenALSoundChannel::SetFilterGain(float afGain) {
-#if 0
- // if (!(gpGame->GetSound()->GetLowLevel()->IsEnvAudioAvailable()))
-// return;
-
- OAL_Source_SetFilterGain(mlChannel, afGain);
-#endif
+ HPL1_UNIMPLEMENTED(cOpenALSoundChannel::SetFilterGain);
}
void cOpenALSoundChannel::SetFilterGainHF(float afGainHF) {
-#if 0
- // if (!(gpGame->GetSound()->GetLowLevel()->IsEnvAudioAvailable()))
-// return;
-
- OAL_Source_SetFilterGainHF(mlChannel, afGainHF);
-#endif
+ HPL1_UNIMPLEMENTED(cOpenALSoundChannel::SetFilterGainHF);
}
void cOpenALSoundChannel::restart() {
Commit: 2080b8b502490bc25fe791d98e37e1e9c938f6a4
https://github.com/scummvm/scummvm/commit/2080b8b502490bc25fe791d98e37e1e9c938f6a4
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:45+01:00
Commit Message:
HPL1: fix possible use of uninitialised variable
Changed paths:
engines/hpl1/engine/impl/MeshLoaderCollada.h
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.h b/engines/hpl1/engine/impl/MeshLoaderCollada.h
index 59a8a60648e..33afe21a76b 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.h
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.h
@@ -317,7 +317,7 @@ typedef tColladaNodeList::iterator tColladaNodeListIt;
class cColladaNode {
public:
- cColladaNode() : mlCount(0), pParent(NULL), mvScale(1, 1, 1) {}
+ cColladaNode() : mlCount(0), pParent(NULL), mvScale(1, 1, 1), mbSourceIsFile(false) {}
tString msId;
tString msName;
Commit: 2b089fb89f4601ea97204f90ee9af3ca98498343
https://github.com/scummvm/scummvm/commit/2b089fb89f4601ea97204f90ee9af3ca98498343
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:45+01:00
Commit Message:
HPL1: rename engine's matrix header
On windows this caused conflicts with ScummVM's matrix header.
Changed paths:
A engines/hpl1/engine/math/hplMatrix.h
R engines/hpl1/engine/math/Matrix.h
engines/hpl1/engine/engine.h
engines/hpl1/engine/math/MathTypes.h
engines/hpl1/engine/math/Quaternion.h
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index d8d81da433e..54f4381bbc4 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -170,7 +170,7 @@
#include "hpl1/engine/math/Frustum.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/math/MathTypes.h"
-#include "hpl1/engine/math/Matrix.h"
+#include "hpl1/engine/math/hplMatrix.h"
#include "hpl1/engine/math/MeshTypes.h"
#include "hpl1/engine/math/PidController.h"
#include "hpl1/engine/math/Quaternion.h"
diff --git a/engines/hpl1/engine/math/MathTypes.h b/engines/hpl1/engine/math/MathTypes.h
index 496b0cd99a0..90778cc1546 100644
--- a/engines/hpl1/engine/math/MathTypes.h
+++ b/engines/hpl1/engine/math/MathTypes.h
@@ -28,7 +28,7 @@
#ifndef HPL_MATHTYPES_H
#define HPL_MATHTYPES_H
-#include "hpl1/engine/math/Matrix.h"
+#include "hpl1/engine/math/hplMatrix.h"
#include "hpl1/engine/math/Vector2.h"
#include "hpl1/engine/math/Vector3.h"
#include "hpl1/engine/system/SystemTypes.h"
diff --git a/engines/hpl1/engine/math/Quaternion.h b/engines/hpl1/engine/math/Quaternion.h
index dd73b941650..36f34dce172 100644
--- a/engines/hpl1/engine/math/Quaternion.h
+++ b/engines/hpl1/engine/math/Quaternion.h
@@ -28,7 +28,7 @@
#ifndef HPL_QUATERNION_H
#define HPL_QUATERNION_H
-#include "hpl1/engine/math/Matrix.h"
+#include "hpl1/engine/math/hplMatrix.h"
#include "hpl1/engine/math/Vector3.h"
namespace hpl {
diff --git a/engines/hpl1/engine/math/Matrix.h b/engines/hpl1/engine/math/hplMatrix.h
similarity index 100%
rename from engines/hpl1/engine/math/Matrix.h
rename to engines/hpl1/engine/math/hplMatrix.h
Commit: c051f506fcacd65262e6921d63c60bc424a58e15
https://github.com/scummvm/scummvm/commit/c051f506fcacd65262e6921d63c60bc424a58e15
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:45+01:00
Commit Message:
HPL1: remove unneeded pragma
Changed paths:
engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
index e966972b9cc..5b8ee16d9dd 100644
--- a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
+++ b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.cpp
@@ -25,8 +25,6 @@
* This file is part of HPL1 Engine.
*/
-#pragma comment(lib, "newton.lib")
-
#include "hpl1/engine/impl/LowLevelPhysicsNewton.h"
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
Commit: 0a33c0ba44f92064730826004d1e2f21bcce0433
https://github.com/scummvm/scummvm/commit/0a33c0ba44f92064730826004d1e2f21bcce0433
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:45+01:00
Commit Message:
HPL1: fix physics library for windows build
Changed paths:
engines/hpl1/engine/libraries/newton/Newton.cpp
engines/hpl1/engine/libraries/newton/Newton.h
engines/hpl1/engine/libraries/newton/core/dgDebug.cpp
engines/hpl1/engine/libraries/newton/core/dgThreads.cpp
engines/hpl1/engine/libraries/newton/core/dgThreads.h
engines/hpl1/engine/libraries/newton/core/dgTypes.h
diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
index fb2b40c2ae8..70db196c510 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.cpp
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -44,20 +44,6 @@ void TraceFuntionName(const char *name) {
#define TRACE_FUNTION(name)
#endif // _DEBUG
-#ifndef _NEWTON_STATIC_LIB
-#ifdef __MINGW32__
-int main(int argc, char *argv[]) {
- return 0;
-}
-#endif // _MINGW32__
-
-#ifdef _MSC_VER
-BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
- return TRUE;
-}
-#endif
-#endif // _NEWTON_STATIC_LIB
-
//#define SAVE_COLLISION
#ifdef SAVE_COLLISION
diff --git a/engines/hpl1/engine/libraries/newton/Newton.h b/engines/hpl1/engine/libraries/newton/Newton.h
index f953e09034f..bfb73dfd12e 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.h
+++ b/engines/hpl1/engine/libraries/newton/Newton.h
@@ -26,25 +26,7 @@
#define NEWTON_MAJOR_VERSION 2
#define NEWTON_MINOR_VERSION 36
-
-#ifdef _NEWTON_STATIC_LIB
- #define NEWTON_API
-#else
- #ifdef _NEWTON_BUILD_DLL
- #ifdef _WIN32
- #define NEWTON_API __declspec (dllexport)
- #else
- #define NEWTON_API __attribute__ ((visibility("default")))
- #endif
- #else
- #ifdef _WIN32
- #define NEWTON_API __declspec (dllimport)
- #else
- #define NEWTON_API
- #endif
- #endif
-#endif
-
+#define NEWTON_API
#ifdef __USE_DOUBLE_PRECISION__
#define dFloat double
diff --git a/engines/hpl1/engine/libraries/newton/core/dgDebug.cpp b/engines/hpl1/engine/libraries/newton/core/dgDebug.cpp
index 6b60aec3bec..3aa25462374 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgDebug.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgDebug.cpp
@@ -33,11 +33,7 @@ void dgApi dgExpandTraceMessage(const char *fmt, ...)
va_start(v_args, fmt);
vsprintf(text, fmt, v_args);
va_end(v_args);
+ printf ("%s\n", text);
- #ifdef _WIN32
- OutputDebugStringA(text);
- #else
- printf ("%s\n", text);
- #endif
}
#endif
diff --git a/engines/hpl1/engine/libraries/newton/core/dgThreads.cpp b/engines/hpl1/engine/libraries/newton/core/dgThreads.cpp
index 7db1ef6d7ec..898617d00e4 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgThreads.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgThreads.cpp
@@ -23,119 +23,23 @@
#include "dgTypes.h"
#include "dgThreads.h"
-static inline void dgThreadYield()
-{
-#ifdef _WIN32
- Sleep(0);
-#else
-#ifndef TARGET_OS_IPHONE
- sched_yield();
-#endif
-#endif
-}
-
-static inline void dgSpinLock(dgInt32 *spin)
-{
-#ifdef _WIN32
- while (InterlockedExchange((long*) spin, 1))
- {
- Sleep(0);
- }
-#elif defined (__APPLE__)
-#ifndef TARGET_OS_IPHONE
- while( ! OSAtomicCompareAndSwap32(0, 1, (int32_t*) spin) )
- {
- sched_yield();
- }
-#endif
-#else
- while(! __sync_bool_compare_and_swap((int32_t*)spin, 0, 1) )
- {
- sched_yield();
- }
-#endif
-}
-
inline void dgSpinUnlock(dgInt32 *spin)
{
*spin = 0;
}
-static inline void dgInterlockedIncrement(dgInt32* Addend)
-{
-#ifdef _WIN32
- InterlockedIncrement((long*) Addend);
-#elif defined (__APPLE__)
- OSAtomicAdd32 (1, (int32_t*)Addend);
-#else
- __sync_fetch_and_add ((int32_t*)Addend, 1 );
-#endif
-}
-
-static inline void dgInterlockedDecrement(dgInt32* Addend)
-{
-#ifdef _WIN32
- InterlockedDecrement((long*) Addend);
-#elif defined (__APPLE__)
- OSAtomicAdd32 (-1, (int32_t*)Addend);
-#else
- __sync_fetch_and_sub ((int32_t*)Addend, 1 );
-#endif
-}
-
dgThreads::dgThreads()
{
-#ifdef _WIN32
- SYSTEM_INFO sysInfo;
- GetSystemInfo(&sysInfo);
- m_numberOfCPUCores = dgInt32(sysInfo.dwNumberOfProcessors);
-
- m_numOfThreads = 0;
- m_exit = NULL;
- m_workToDo = NULL;
- m_emptySlot = NULL;
-
- m_topIndex = 0;
- m_bottomIndex = 0;
- m_workInProgress = 0;
- m_globalSpinLock = 0;
-
- memset(m_threadhandles, 0, sizeof(m_threadhandles));
-#elif defined (__APPLE__)
- int mib[2];
- size_t len;
- int procesorcount;
-
- mib[0] = CTL_HW;
- mib[1] = HW_NCPU;
- len = sizeof (procesorcount);
- procesorcount = 0;
- m_numberOfCPUCores = sysctl(mib, 2, &procesorcount, &len, NULL, 0);
- m_numberOfCPUCores = procesorcount;
+ m_numberOfCPUCores = 0;
m_numOfThreads = 0;
m_exit = false;
- memset (m_threadhandles, 0, sizeof (m_threadhandles));
-
m_topIndex = 0;
m_bottomIndex = 0;
m_workInProgress = 0;
m_globalSpinLock = 0;
m_workToDoSpinLock = 0;
-#else
- m_numberOfCPUCores = sysconf(_SC_NPROCESSORS_ONLN);
-
- m_numOfThreads = 0;
- m_exit = false;
-
- memset (m_threadhandles, 0, sizeof (m_threadhandles));
- m_topIndex = 0;
- m_bottomIndex = 0;
- m_workInProgress = 0;
- m_globalSpinLock = 0;
- m_workToDoSpinLock = 0;
-#endif
m_getPerformanceCount = NULL;
for (dgInt32 i = 0; i < DG_MAXIMUN_THREADS; i++)
@@ -148,10 +52,7 @@ dgThreads::dgThreads()
dgThreads::~dgThreads()
{
- if (m_numOfThreads)
- {
- DestroydgThreads();
- }
+
}
dgInt32 dgThreads::GetThreadCount() const
@@ -161,10 +62,7 @@ dgInt32 dgThreads::GetThreadCount() const
void dgThreads::ClearTimers()
{
- for (dgInt32 i = 0; i < m_numOfThreads; i++)
- {
- m_localData[i].m_ticks = 0;
- }
+
}
void dgThreads::SetPerfomanceCounter(OnGetPerformanceCountCallback callback)
@@ -187,171 +85,23 @@ dgUnsigned32 dgThreads::GetPerfomanceTicks(dgUnsigned32 threadIndex) const
void dgThreads::CreateThreaded(dgInt32 threads)
{
- if (m_numOfThreads)
- {
- DestroydgThreads();
- }
-
-#ifdef _WIN32
- if ((threads > 1) && (m_numberOfCPUCores > 1))
- {
- m_numOfThreads = GetMin(threads, m_numberOfCPUCores);
-
- m_emptySlot = CreateSemaphoreA(NULL, DG_MAXQUEUE, DG_MAXQUEUE, NULL);
- m_workToDo = CreateSemaphoreA(NULL, 0, DG_MAXQUEUE, NULL);
- m_exit = CreateEventA(NULL, TRUE, FALSE, NULL);
- InitializeCriticalSection(&m_criticalSection);
-
- m_topIndex = 0;
- m_bottomIndex = 0;
- m_workInProgress = 0;
- for (dgInt32 i = 0; i < m_numOfThreads; i++)
- {
- m_threadhandles[i] = (HANDLE) _beginthreadex(NULL, 0, ThreadExecute,
- &m_localData[i], 0, NULL);
- }
- }
-#else
- if ((threads > 1) && (m_numberOfCPUCores > 1))
- {
-#ifdef TARGET_OS_IPHONE
- m_numOfThreads = 0;
-#else
- m_numOfThreads = (threads<m_numberOfCPUCores ? threads : m_numberOfCPUCores);
-#endif
-
- m_emptySlot = DG_MAXQUEUE;
- m_workToDo = 0;
- m_workToDoSpinLock = 0;
- m_exit = false;
- m_criticalSection = 0;
-
- m_topIndex = 0;
- m_bottomIndex = 0;
- m_workInProgress = 0;
-
-#ifndef TARGET_OS_IPHONE
- for(dgInt32 i=0; i < m_numOfThreads; i++)
- {
- pthread_create( &m_threadhandles[i], NULL, ThreadExecute, &m_localData[i]);
- }
-#endif
- }
-#endif
}
void dgThreads::DestroydgThreads()
{
-#ifdef _WIN32
- _ASSERTE(m_workInProgress == 0);
-
- while (m_workInProgress > 0)
- {
- Sleep(10);
- }
- SetEvent(m_exit);
- DeleteCriticalSection(&m_criticalSection);
- WaitForMultipleObjects(DWORD(m_numOfThreads), m_threadhandles, TRUE,
- INFINITE);
-
- for (dgInt32 i = 0; i < m_numOfThreads; i++)
- {
- CloseHandle(m_threadhandles[i]);
- }
-
- CloseHandle(m_exit);
- CloseHandle(m_emptySlot);
- CloseHandle(m_workToDo);
- m_exit = NULL;
- m_emptySlot = NULL;
- m_workToDo = NULL;
- memset(&m_criticalSection, 0, sizeof(CRITICAL_SECTION));
- for (dgInt32 i = 0; i < m_numOfThreads; i++)
- {
- m_threadhandles[i] = NULL;
- }
-
- m_topIndex = 0;
- m_bottomIndex = 0;
- m_workInProgress = 0;
- m_numOfThreads = 0;
-#else
- while(m_workInProgress > 0)
- {
- usleep(100000);
- }
- dgSpinLock( &m_criticalSection );
- m_exit = true;
- m_workToDo = DG_MAXQUEUE+1;
- dgSpinUnlock( &m_criticalSection );
-
-#ifndef TARGET_OS_IPHONE
- for(dgInt32 i=0; i<m_numOfThreads; i++ )
- {
- pthread_join( m_threadhandles[i], NULL );
- }
-#endif
-
- m_exit = false;
- m_emptySlot = 0;
- m_workToDo = 0;
- m_workToDoSpinLock = 0;
-
- m_topIndex = 0;
- m_bottomIndex = 0;
- m_workInProgress = 0;
- m_numOfThreads = 0;
-#endif
}
//Queues up another to work
dgInt32 dgThreads::SubmitJob(dgWorkerThread* const job)
{
- if (!m_numOfThreads)
- {
- _ASSERTE(job->m_threadIndex != -1);
- job->ThreadExecute();
- }
- else
- {
-
-#ifdef _WIN32
- dgInterlockedIncrement(&m_workInProgress);
- if (WaitForSingleObject(m_emptySlot, INFINITE) != WAIT_OBJECT_0)
- {
- return (0);
- }
-
- EnterCriticalSection(&m_criticalSection);
- m_queue[m_topIndex] = job;
- m_topIndex = (m_topIndex + 1) % DG_MAXQUEUE;
- ReleaseSemaphore(m_workToDo, 1, NULL);
- LeaveCriticalSection(&m_criticalSection);
-#else
- dgInterlockedIncrement(&m_workInProgress);
- while ( m_emptySlot == 0 )
- {
- dgThreadYield();
- }
- dgInterlockedDecrement( &m_emptySlot );
-
- dgSpinLock(&m_criticalSection);
- m_queue[m_topIndex] = job;
- m_topIndex = (m_topIndex + 1) % DG_MAXQUEUE;
- dgInterlockedIncrement( &m_workToDo );
- dgSpinUnlock( &m_criticalSection );
-#endif
- }
- return 1;
+ _ASSERTE(job->m_threadIndex != -1);
+ job->ThreadExecute();
+ return 1;
}
-#ifdef _WIN32
-dgUnsigned32 _stdcall dgThreads::ThreadExecute(void *param)
-#else
void* dgThreads::ThreadExecute(void *param)
-#endif
{
dgLocadData& data = *(dgLocadData*) param;
data.m_manager->DoWork(data.m_threadIndex);
@@ -360,52 +110,8 @@ void* dgThreads::ThreadExecute(void *param)
dgInt32 dgThreads::GetWork(dgWorkerThread** job)
{
-#ifdef _WIN32
- HANDLE hWaitHandles[2];
- hWaitHandles[0] = m_workToDo;
- hWaitHandles[1] = m_exit;
-
- if ((WaitForMultipleObjects(2, hWaitHandles, FALSE, INFINITE) - WAIT_OBJECT_0)
- == 1)
- {
- return 0;
- }
-
- EnterCriticalSection(&m_criticalSection);
- *job = m_queue[m_bottomIndex];
- m_bottomIndex = (m_bottomIndex + 1) % DG_MAXQUEUE;
- ReleaseSemaphore(m_emptySlot, 1, NULL);
- LeaveCriticalSection(&m_criticalSection);
-#else
- for (;;)
- {
- while ( m_workToDo == 0 )
- {
- dgThreadYield();
- }
- dgSpinLock( &m_workToDoSpinLock );
- if ( m_workToDo > 0 )
- {
- break;
- }
- dgSpinUnlock( &m_workToDoSpinLock );
- }
- dgInterlockedDecrement( &m_workToDo );
- dgSpinUnlock( &m_workToDoSpinLock );
- if ( m_exit )
- {
- return 0;
- }
-
- dgSpinLock( &m_criticalSection );
dgWorkerThread* cWorker = m_queue[m_bottomIndex];
*job = cWorker;
-
- m_bottomIndex = (m_bottomIndex+1) % (DG_MAXQUEUE);
- dgInterlockedIncrement( &m_emptySlot );
- dgSpinUnlock( &m_criticalSection );
-#endif
-
return 1;
}
@@ -413,49 +119,12 @@ void dgThreads::DoWork(dgInt32 mythreadIndex)
{
dgWorkerThread* job;
-#ifdef _WIN32
-#ifndef __USE_DOUBLE_PRECISION__
- dgUnsigned32 controlWorld;
- controlWorld = dgControlFP (0xffffffff, 0);
- dgControlFP(_PC_53, _MCW_PC);
-#endif
-#endif
-
- if (!m_getPerformanceCount)
- {
- while (GetWork(&job))
- {
- job->ThreadExecute();
- dgInterlockedDecrement(&m_workInProgress);
- }
- }
- else
- {
- while (GetWork(&job))
- {
- dgUnsigned32 ticks = m_getPerformanceCount();
-
job->ThreadExecute();
- dgInterlockedDecrement(&m_workInProgress);
-
- m_localData[mythreadIndex].m_ticks += (m_getPerformanceCount() - ticks);
- }
- }
-
-#ifdef _WIN32
-#ifndef __USE_DOUBLE_PRECISION__
- dgControlFP(controlWorld, _MCW_PC);
-#endif
-#endif
-
}
void dgThreads::SynchronizationBarrier()
{
- while (m_workInProgress)
- {
- dgThreadYield();
- }
+
}
void dgThreads::CalculateChunkSizes(dgInt32 elements,
@@ -483,7 +152,6 @@ void dgThreads::CalculateChunkSizes(dgInt32 elements,
void dgThreads::dgGetLock() const
{
_ASSERTE(sizeof (dgInt32) == sizeof (long));
- dgSpinLock(&m_globalSpinLock);
//spinLock( &m_globalSpinLock );
// linux and mac may need to yeald time
@@ -500,7 +168,6 @@ void dgThreads::dgReleaseLock() const
void dgThreads::dgGetIndirectLock(dgInt32* lockVar)
{
_ASSERTE(sizeof (dgInt32) == sizeof (long));
- dgSpinLock(lockVar);
}
void dgThreads::dgReleaseIndirectLock(dgInt32* lockVar)
diff --git a/engines/hpl1/engine/libraries/newton/core/dgThreads.h b/engines/hpl1/engine/libraries/newton/core/dgThreads.h
index 05b4f447e74..65dbe19ca99 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgThreads.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgThreads.h
@@ -71,11 +71,8 @@ private:
void DoWork(dgInt32 threadIndex);
dgInt32 GetWork(dgWorkerThread** cWork);
-#ifdef _WIN32
- static dgUnsigned32 _stdcall ThreadExecute(void *Param);
-#else
+
static void* ThreadExecute(void *Param);
-#endif
dgInt32 m_numOfThreads;
dgInt32 m_numberOfCPUCores;
@@ -84,22 +81,13 @@ private:
dgInt32 m_workInProgress;
mutable dgInt32 m_globalSpinLock;
-#ifdef _WIN32
- HANDLE m_exit;
- HANDLE m_workToDo;
- HANDLE m_emptySlot;
- CRITICAL_SECTION m_criticalSection;
- dgWorkerThread* m_queue[DG_MAXQUEUE];
- HANDLE m_threadhandles[DG_MAXIMUN_THREADS];
-#else
bool m_exit;
dgInt32 m_emptySlot;
dgInt32 m_workToDo;
dgInt32 m_criticalSection;
dgInt32 m_workToDoSpinLock;
dgWorkerThread* m_queue[DG_MAXQUEUE];
- pthread_t m_threadhandles[DG_MAXIMUN_THREADS];
-#endif
+ //pthread_t m_threadhandles[DG_MAXIMUN_THREADS];
OnGetPerformanceCountCallback m_getPerformanceCount;
dgLocadData m_localData[DG_MAXIMUN_THREADS];
diff --git a/engines/hpl1/engine/libraries/newton/core/dgTypes.h b/engines/hpl1/engine/libraries/newton/core/dgTypes.h
index e3aaa7285ff..9c71b379f3a 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgTypes.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgTypes.h
@@ -64,7 +64,6 @@
#endif
#include <crtdbg.h>
-#include <windows.h>
// #include <mmsystem.h>
@@ -729,15 +728,7 @@ typedef dgUnsigned32(dgApi *OnGetPerformanceCountCallback)();
dgCpuClass dgApi dgGetCpuType();
inline dgInt32 dgAtomicAdd(dgInt32 *const addend, dgInt32 amount) {
-#ifdef _WIN32
- return InterlockedExchangeAdd((long *)addend, long(amount));
-#elif defined(__APPLE__)
- dgInt32 count = OSAtomicAdd32(amount, (int32_t *)addend);
-
- return count - (*addend);
-#else
- return __sync_fetch_and_add((int32_t *)addend, amount);
-#endif
+ return *addend += amount;
}
#endif
Commit: 4c723d5938eda196719c02acb154ef273d372b56
https://github.com/scummvm/scummvm/commit/4c723d5938eda196719c02acb154ef273d372b56
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:45+01:00
Commit Message:
HPL1: fix memory leak and warning in bitmap2D
Changed paths:
engines/hpl1/engine/graphics/bitmap2D.cpp
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
index 31c59566474..c0a4f0ee3b1 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.cpp
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -154,9 +154,9 @@ static uint32 alphaToRed(const uint32 pixel, const Graphics::PixelFormat &format
void Bitmap2D::copyRedToAlpha() {
if (!_isSurfaceActive)
copyDecoder();
- for (uint y = 0; y < _surface.h; y++) {
+ for (int16 y = 0; y < _surface.h; y++) {
uint32 *rowPtr = (uint32 *)_surface.getBasePtr(0, y);
- for (uint x = 0; x < _surface.w; ++x, ++rowPtr) {
+ for (int16 x = 0; x < _surface.w; ++x, ++rowPtr) {
*rowPtr = alphaToRed(*rowPtr, _surface.format);
}
}
@@ -167,7 +167,7 @@ void Bitmap2D::copyDecoder(const Graphics::PixelFormat &format) {
if (format.bytesPerPixel != 0)
_surface.convertToInPlace(format);
_isSurfaceActive = true;
- _decoder.release();
+ _decoder.reset(nullptr);
}
const Graphics::Surface &Bitmap2D::activeSurface() const {
Commit: 26493e473831cad3c4cb10422163dfc7f650ab32
https://github.com/scummvm/scummvm/commit/26493e473831cad3c4cb10422163dfc7f650ab32
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:45+01:00
Commit Message:
HPL1: fix incorrect file handeling code
Changed paths:
engines/hpl1/engine/resources/ConfigFile.cpp
diff --git a/engines/hpl1/engine/resources/ConfigFile.cpp b/engines/hpl1/engine/resources/ConfigFile.cpp
index cf9b58babe1..84cd1650517 100644
--- a/engines/hpl1/engine/resources/ConfigFile.cpp
+++ b/engines/hpl1/engine/resources/ConfigFile.cpp
@@ -72,10 +72,8 @@ bool cConfigFile::Load() {
//-----------------------------------------------------------------------
bool cConfigFile::Save() {
- Common::DumpFile cf;
//FIXME: use proper string types
- cf.open(cString::To8Char(msFile).c_str());
- return mpXmlDoc->SaveFile(cf);
+ return mpXmlDoc->SaveFile(cString::To8Char(msFile).c_str());
}
//-----------------------------------------------------------------------
Commit: 3a7f09fa34b879be39f3ed9dd8f06d6610df50a7
https://github.com/scummvm/scummvm/commit/3a7f09fa34b879be39f3ed9dd8f06d6610df50a7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:46+01:00
Commit Message:
HPL1: fix possible use of uninitialised variables
Changed paths:
engines/hpl1/engine/physics/CharacterBody.cpp
engines/hpl1/engine/physics/PhysicsWorld.cpp
engines/hpl1/engine/sound/SoundChannel.h
engines/hpl1/engine/sound/SoundHandler.cpp
engines/hpl1/engine/sound/SoundHandler.h
diff --git a/engines/hpl1/engine/physics/CharacterBody.cpp b/engines/hpl1/engine/physics/CharacterBody.cpp
index 4b488762b50..39ddbb38ca7 100644
--- a/engines/hpl1/engine/physics/CharacterBody.cpp
+++ b/engines/hpl1/engine/physics/CharacterBody.cpp
@@ -60,6 +60,8 @@ iCharacterBody::iCharacterBody(const tString &asName, iPhysicsWorld *apWorld, co
mbTestCollision = true;
+ mbOnGround = false;
+
float fRadius = cMath::Max(avSize.x, avSize.z) * 0.5f;
cMatrixf mtxOffset = cMath::MatrixRotateZ(kPi2f);
iCollideShape *pCollider = NULL;
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.cpp b/engines/hpl1/engine/physics/PhysicsWorld.cpp
index 7b61157d17f..64caf6d2154 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.cpp
+++ b/engines/hpl1/engine/physics/PhysicsWorld.cpp
@@ -51,6 +51,7 @@ namespace hpl {
iPhysicsWorld::iPhysicsWorld() {
mbLogDebug = false;
+ mbSaveContactPoints = false;
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/sound/SoundChannel.h b/engines/hpl1/engine/sound/SoundChannel.h
index 29797b033f3..a5b38de2d7a 100644
--- a/engines/hpl1/engine/sound/SoundChannel.h
+++ b/engines/hpl1/engine/sound/SoundChannel.h
@@ -71,6 +71,8 @@ public:
mbStopUsed = false;
mpCallback = NULL;
+
+ mlId = 0;
}
virtual ~iSoundChannel() {}
diff --git a/engines/hpl1/engine/sound/SoundHandler.cpp b/engines/hpl1/engine/sound/SoundHandler.cpp
index e32af5be330..3a7f35a4d05 100644
--- a/engines/hpl1/engine/sound/SoundHandler.cpp
+++ b/engines/hpl1/engine/sound/SoundHandler.cpp
@@ -439,8 +439,7 @@ bool cSoundHandler::IsValidId(iSoundChannel *apChannel, int alId) {
if (apChannel == NULL)
return false;
- tSoundEntryListIt it;
- it = mlstWorldSounds.begin();
+ tSoundEntryListIt it = mlstWorldSounds.begin();
while (it != mlstWorldSounds.end()) {
if (it->mpSound == apChannel && it->mpSound->GetId() == alId)
return true;
diff --git a/engines/hpl1/engine/sound/SoundHandler.h b/engines/hpl1/engine/sound/SoundHandler.h
index 68ac605f72b..b4eee9021f7 100644
--- a/engines/hpl1/engine/sound/SoundHandler.h
+++ b/engines/hpl1/engine/sound/SoundHandler.h
@@ -72,7 +72,7 @@ class cSoundEntry {
public:
cSoundEntry() : mfNormalVolume(1), mfNormalVolumeFadeDest(1),
mfNormalVolumeMul(1), mfNormalVolumeFadeSpeed(0), mbStream(false),
- mlCount(0) {}
+ mlCount(0), mpSound(nullptr) {}
void Update(float afTimeStep);
Commit: 1562494f384c2a0d91448ef0fc3da706a8cecd84
https://github.com/scummvm/scummvm/commit/1562494f384c2a0d91448ef0fc3da706a8cecd84
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:46+01:00
Commit Message:
HPL1: fix incorrect delete
Changed paths:
engines/hpl1/engine/game/low_level_game_setup.cpp
diff --git a/engines/hpl1/engine/game/low_level_game_setup.cpp b/engines/hpl1/engine/game/low_level_game_setup.cpp
index 1b8d5bdf516..0c0c8a77abd 100644
--- a/engines/hpl1/engine/game/low_level_game_setup.cpp
+++ b/engines/hpl1/engine/game/low_level_game_setup.cpp
@@ -45,7 +45,7 @@ LowLevelGameSetup::~LowLevelGameSetup() {
Log("Deleting lowlevel stuff.\n");
Log("Physics\n");
- hplDelete(_lowLevelSystem);
+ hplDelete(_lowLevelPhysics);
Log("Sound\n");
hplDelete(_lowLevelSound);
Log("Input\n");
Commit: 9931ba94582d2ab11cea6b980cb40446a0295457
https://github.com/scummvm/scummvm/commit/9931ba94582d2ab11cea6b980cb40446a0295457
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:46+01:00
Commit Message:
HPL1: fix deletion of invalid shader
Changed paths:
engines/hpl1/engine/graphics/Material_Additive.cpp
diff --git a/engines/hpl1/engine/graphics/Material_Additive.cpp b/engines/hpl1/engine/graphics/Material_Additive.cpp
index 8dc5fc89d65..fe5e5b9e9d2 100644
--- a/engines/hpl1/engine/graphics/Material_Additive.cpp
+++ b/engines/hpl1/engine/graphics/Material_Additive.cpp
@@ -78,7 +78,8 @@ cMaterial_Additive::cMaterial_Additive(const tString &asName, iLowLevelGraphics
//-----------------------------------------------------------------------
cMaterial_Additive::~cMaterial_Additive() {
- mpProgramManager->Destroy(_fogShader);
+ if (_fogShader)
+ mpProgramManager->Destroy(_fogShader);
}
//-----------------------------------------------------------------------
Commit: 0bd8a3dac4b1779e7bcde76201cc674b1e5b4d1e
https://github.com/scummvm/scummvm/commit/0bd8a3dac4b1779e7bcde76201cc674b1e5b4d1e
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:46+01:00
Commit Message:
HPL1: remove unused code from engine skeleton
Changed paths:
engines/hpl1/hpl1.cpp
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index f352304e343..a88b0abd057 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -56,43 +56,6 @@ Common::String Hpl1Engine::getGameId() const {
Common::Error Hpl1Engine::run() {
hplMain("");
-
- _screen = new Graphics::Screen();
-
- // Set the engine's debugger console
- setDebugger(new Console());
-
- // If a savegame was selected from the launcher, load it
- int saveSlot = ConfMan.getInt("save_slot");
- if (saveSlot != -1)
- (void)loadGameState(saveSlot);
-
- // Draw a series of boxes on screen as a sample
- for (int i = 0; i < 100; ++i)
- _screen->frameRect(Common::Rect(i, i, 320 - i, 200 - i), i);
- _screen->update();
-
- // Simple event handling loop
- byte pal[256 * 3] = {0};
- Common::Event e;
- int offset = 0;
-
- while (!shouldQuit()) {
- while (g_system->getEventManager()->pollEvent(e)) {
- }
-
- // Cycle through a simple palette
- ++offset;
- for (int i = 0; i < 256; ++i)
- pal[i * 3 + 1] = (i + offset) % 256;
- g_system->getPaletteManager()->setPalette(pal, 0, 256);
- _screen->update();
-
- // Delay for a bit. All events loops should have a delay
- // to prevent the system being unduly loaded
- g_system->delayMillis(10);
- }
-
return Common::kNoError;
}
Commit: 267f57750157a2b1b260e62537c90814f3bae827
https://github.com/scummvm/scummvm/commit/267f57750157a2b1b260e62537c90814f3bae827
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:03:46+01:00
Commit Message:
HPL1: Fixed uninitialaized variable reported by valgrind
Changed paths:
engines/hpl1/engine/sound/SoundHandler.cpp
diff --git a/engines/hpl1/engine/sound/SoundHandler.cpp b/engines/hpl1/engine/sound/SoundHandler.cpp
index 3a7f35a4d05..2cc5faa03f9 100644
--- a/engines/hpl1/engine/sound/SoundHandler.cpp
+++ b/engines/hpl1/engine/sound/SoundHandler.cpp
@@ -61,6 +61,7 @@ cSoundHandler::cSoundHandler(iLowLevelSound *apLowLevelSound, cResources *apReso
mpWorld3D = NULL;
mlCount = 0;
+ mlIdCount = 0;
mbSilent = false;
Commit: 96768dcde7c86be2490d00598c44a63cc54fed69
https://github.com/scummvm/scummvm/commit/96768dcde7c86be2490d00598c44a63cc54fed69
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:46+01:00
Commit Message:
JANITORIAL: Fix line endings
Changed paths:
engines/hpl1/module.mk
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 1137b4ad506..4866914b501 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -1,404 +1,404 @@
-MODULE := engines/hpl1
-
-MODULE_OBJS := \
- console.o \
- detection.o \
- string.o \
- opengl.o \
- engine/ai/AI.o \
- engine/ai/AINodeContainer.o \
- engine/ai/AINodeGenerator.o \
- engine/ai/AStar.o \
- engine/ai/StateMachine.o \
- engine/game/Game.o \
- engine/game/GameTypes.o \
- engine/game/SaveGame.o \
- engine/game/ScriptFuncs.o \
- engine/game/Updater.o \
- engine/game/low_level_game_setup.o \
- engine/graphics/Animation.o \
- engine/graphics/AnimationTrack.o \
- engine/graphics/BackgroundImage.o \
- engine/graphics/Beam.o \
- engine/graphics/BillBoard.o \
- engine/graphics/Bone.o \
- engine/graphics/BoneState.o \
- engine/graphics/Color.o \
- engine/graphics/font_data.o \
- engine/graphics/GPUProgram.o \
- engine/graphics/GfxObject.o \
- engine/graphics/Graphics.o \
- engine/graphics/GraphicsDrawer.o \
- engine/graphics/ImageEntityData.o \
- engine/graphics/Material.o \
- engine/graphics/MaterialHandler.o \
- engine/graphics/Material_Additive.o \
- engine/graphics/Material_Alpha.o \
- engine/graphics/Material_BaseLight.o \
- engine/graphics/Material_Bump.o \
- engine/graphics/Material_BumpColorSpec.o \
- engine/graphics/Material_BumpSpec.o \
- engine/graphics/Material_BumpSpec2D.o \
- engine/graphics/Material_Diffuse.o \
- engine/graphics/Material_Diffuse2D.o \
- engine/graphics/Material_DiffuseAdditive2D.o \
- engine/graphics/Material_DiffuseAlpha2D.o \
- engine/graphics/Material_DiffuseSpec.o \
- engine/graphics/Material_EnvMap_Reflect.o \
- engine/graphics/Material_Fallback01_BaseLight.o \
- engine/graphics/Material_Fallback02_BaseLight.o \
- engine/graphics/Material_Flat.o \
- engine/graphics/Material_FontNormal.o \
- engine/graphics/Material_Modulative.o \
- engine/graphics/Material_ModulativeX2.o \
- engine/graphics/Material_Smoke2D.o \
- engine/graphics/Material_Water.o \
- engine/graphics/Mesh.o \
- engine/graphics/Mesh2d.o \
- engine/graphics/MeshCreator.o \
- engine/graphics/ParticleEmitter.o \
- engine/graphics/ParticleEmitter2D.o \
- engine/graphics/ParticleEmitter3D.o \
- engine/graphics/ParticleEmitter3D_UserData.o \
- engine/graphics/ParticleSystem3D.o \
- engine/graphics/RenderList.o \
- engine/graphics/RenderObject2D.o \
- engine/graphics/RenderState.o \
- engine/graphics/Renderable.o \
- engine/graphics/Renderer2D.o \
- engine/graphics/Renderer3D.o \
- engine/graphics/RendererPostEffects.o \
- engine/graphics/Skeleton.o \
- engine/graphics/SubMesh.o \
- engine/graphics/bitmap2D.o \
- engine/gui/Gui.o \
- engine/gui/GuiGfxElement.o \
- engine/gui/GuiMaterialBasicTypes.o \
- engine/gui/GuiPopUp.o \
- engine/gui/GuiPopUpMessageBox.o \
- engine/gui/GuiSet.o \
- engine/gui/GuiSkin.o \
- engine/gui/Widget.o \
- engine/gui/WidgetBaseClasses.o \
- engine/gui/WidgetButton.o \
- engine/gui/WidgetCheckBox.o \
- engine/gui/WidgetComboBox.o \
- engine/gui/WidgetFrame.o \
- engine/gui/WidgetImage.o \
- engine/gui/WidgetLabel.o \
- engine/gui/WidgetListBox.o \
- engine/gui/WidgetSlider.o \
- engine/gui/WidgetTextBox.o \
- engine/gui/WidgetWindow.o \
- engine/haptic/Haptic.o \
- engine/haptic/LowLevelHaptic.o \
- engine/impl/CGProgram.o \
- engine/impl/CharacterBodyNewton.o \
- engine/impl/CollideShapeNewton.o \
- engine/impl/KeyboardSDL.o \
- engine/impl/LowLevelGraphicsSDL.o \
- engine/impl/LowLevelInputSDL.o \
- engine/impl/LowLevelPhysicsNewton.o \
- engine/impl/LowLevelSoundOpenAL.o \
- engine/impl/MeshLoaderCollada.o \
- engine/impl/MeshLoaderColladaHelpers.o \
- engine/impl/MeshLoaderColladaLoader.o \
- engine/impl/MeshLoaderMSH.o \
- engine/impl/MouseSDL.o \
- engine/impl/OcclusionQueryOGL.o \
- engine/impl/OpenALSoundChannel.o \
- engine/impl/OpenALSoundData.o \
- engine/impl/OpenALSoundEnvironment.o \
- engine/impl/PBuffer.o \
- engine/impl/PhysicsBodyNewton.o \
- engine/impl/PhysicsControllerNewton.o \
- engine/impl/PhysicsJointBallNewton.o \
- engine/impl/PhysicsJointHingeNewton.o \
- engine/impl/PhysicsJointScrewNewton.o \
- engine/impl/PhysicsJointSliderNewton.o \
- engine/impl/PhysicsMaterialNewton.o \
- engine/impl/PhysicsWorldNewton.o \
- engine/impl/SDLTexture.o \
- engine/impl/SqScript.o \
- engine/impl/VertexBufferOGL.o \
- engine/impl/VertexBufferVBO.o \
- engine/impl/VideoStreamTheora.o \
- engine/libraries/angelscript/add-ons/scriptstdstring.o \
- engine/libraries/angelscript/add-ons/scripthelper.o \
- engine/impl/tinyXML/tinyxml.o \
- engine/impl/tinyXML/tinyxmlerror.o \
- engine/impl/tinyXML/tinyxmlparser.o \
- engine/input/Action.o \
- engine/input/ActionHaptic.o \
- engine/input/ActionKeyboard.o \
- engine/input/ActionMouseButton.o \
- engine/input/Input.o \
- engine/input/InputDevice.o \
- engine/input/Keyboard.o \
- engine/input/Mouse.o \
- engine/math/BoundingVolume.o \
- engine/math/CRC.o \
- engine/math/Frustum.o \
- engine/math/Math.o \
- engine/math/MathTypes.o \
- engine/math/MeshTypes.o \
- engine/math/Quaternion.o \
- engine/math/Spring.o \
- engine/physics/Body2D.o \
- engine/physics/CharacterBody.o \
- engine/physics/Collider2D.o \
- engine/physics/Physics.o \
- engine/physics/PhysicsBody.o \
- engine/physics/PhysicsController.o \
- engine/physics/PhysicsJoint.o \
- engine/physics/PhysicsJointBall.o \
- engine/physics/PhysicsJointHinge.o \
- engine/physics/PhysicsJointScrew.o \
- engine/physics/PhysicsJointSlider.o \
- engine/physics/PhysicsWorld.o \
- engine/physics/SurfaceData.o \
- engine/resources/AnimationManager.o \
- engine/resources/ConfigFile.o \
- engine/resources/EntityLoader_Object.o \
- engine/resources/FileSearcher.o \
- engine/resources/FontManager.o \
- engine/resources/FrameBitmap.o \
- engine/resources/FrameTexture.o \
- engine/resources/GpuProgramManager.o \
- engine/resources/ImageEntityManager.o \
- engine/resources/ImageManager.o \
- engine/resources/LanguageFile.o \
- engine/resources/MaterialManager.o \
- engine/resources/MeshLoaderHandler.o \
- engine/resources/MeshManager.o \
- engine/resources/ParticleManager.o \
- engine/resources/ResourceBase.o \
- engine/resources/ResourceImage.o \
- engine/resources/ResourceManager.o \
- engine/resources/Resources.o \
- engine/resources/ScriptManager.o \
- engine/resources/SoundEntityManager.o \
- engine/resources/SoundManager.o \
- engine/resources/TextureManager.o \
- engine/resources/TileSetManager.o \
- engine/resources/VideoManager.o \
- engine/resources/low_level_resources.o \
- engine/scene/AnimationState.o \
- engine/scene/Area2D.o \
- engine/scene/Camera2D.o \
- engine/scene/Camera3D.o \
- engine/scene/ColliderEntity.o \
- engine/scene/Entity.o \
- engine/scene/Entity2D.o \
- engine/scene/Entity3D.o \
- engine/scene/GridMap2D.o \
- engine/scene/ImageEntity.o \
- engine/scene/Light.o \
- engine/scene/Light2D.o \
- engine/scene/Light2DPoint.o \
- engine/scene/Light3D.o \
- engine/scene/Light3DPoint.o \
- engine/scene/Light3DSpot.o \
- engine/scene/MeshEntity.o \
- engine/scene/MultiImageEntity.o \
- engine/scene/Node.o \
- engine/scene/Node2D.o \
- engine/scene/Node3D.o \
- engine/scene/NodeState.o \
- engine/scene/PortalContainer.o \
- engine/scene/Scene.o \
- engine/scene/SectorVisibility.o \
- engine/scene/SoundEntity.o \
- engine/scene/SoundSource.o \
- engine/scene/SubMeshEntity.o \
- engine/scene/Tile.o \
- engine/scene/TileData.o \
- engine/scene/TileLayer.o \
- engine/scene/TileMap.o \
- engine/scene/TileMapLineIt.o \
- engine/scene/TileMapRectIt.o \
- engine/scene/TileSet.o \
- engine/scene/World2D.o \
- engine/scene/World3D.o \
- engine/sound/LowLevelSound.o \
- engine/sound/MusicHandler.o \
- engine/sound/Sound.o \
- engine/sound/SoundEntityData.o \
- engine/sound/SoundHandler.o \
- engine/system/Container.o \
- engine/system/LogicTimer.o \
- engine/system/low_level_system.o \
- engine/system/MemoryManager.o \
- engine/system/SerializeClass.o \
- engine/system/String.o \
- engine/system/System.o \
- hpl1.o \
- metaengine.o \
- penumbra-overture/AttackHandler.o \
- penumbra-overture/ButtonHandler.o \
- penumbra-overture/CharacterMove.o \
- penumbra-overture/Credits.o \
- penumbra-overture/DeathMenu.o \
- penumbra-overture/DemoEndText.o \
- penumbra-overture/EffectHandler.o \
- penumbra-overture/FadeHandler.o \
- penumbra-overture/GameArea.o \
- penumbra-overture/GameDamageArea.o \
- penumbra-overture/GameEnemy.o \
- penumbra-overture/GameEnemy_Dog.o \
- penumbra-overture/GameEnemy_Spider.o \
- penumbra-overture/GameEnemy_Worm.o \
- penumbra-overture/GameEntity.o \
- penumbra-overture/GameForceArea.o \
- penumbra-overture/GameItem.o \
- penumbra-overture/GameItemType.o \
- penumbra-overture/GameLadder.o \
- penumbra-overture/GameLamp.o \
- penumbra-overture/GameLink.o \
- penumbra-overture/GameLiquidArea.o \
- penumbra-overture/GameMessageHandler.o \
- penumbra-overture/GameMusicHandler.o \
- penumbra-overture/GameObject.o \
- penumbra-overture/GameSaveArea.o \
- penumbra-overture/GameScripts.o \
- penumbra-overture/GameStickArea.o \
- penumbra-overture/GameSwingDoor.o \
- penumbra-overture/GameTypes.o \
- penumbra-overture/GraphicsHelper.o \
- penumbra-overture/HapticGameCamera.o \
- penumbra-overture/HudModel_Throw.o \
- penumbra-overture/HudModel_Weapon.o \
- penumbra-overture/Init.o \
- penumbra-overture/IntroStory.o \
- penumbra-overture/Inventory.o \
- penumbra-overture/Main.o \
- penumbra-overture/MainMenu.o \
- penumbra-overture/MapHandler.o \
- penumbra-overture/MapLoadText.o \
- penumbra-overture/Notebook.o \
- penumbra-overture/NumericalPanel.o \
- penumbra-overture/Player.o \
- penumbra-overture/PlayerHands.o \
- penumbra-overture/PlayerHelper.o \
- penumbra-overture/PlayerState_Interact.o \
- penumbra-overture/PlayerState_InteractHaptX.o \
- penumbra-overture/PlayerState_Misc.o \
- penumbra-overture/PlayerState_MiscHaptX.o \
- penumbra-overture/PlayerState_Weapon.o \
- penumbra-overture/PlayerState_WeaponHaptX.o \
- penumbra-overture/PreMenu.o \
- penumbra-overture/RadioHandler.o \
- penumbra-overture/SaveHandler.o \
- penumbra-overture/SaveTypes.o \
- penumbra-overture/TriggerHandler.o \
- penumbra-overture/Triggers.o \
- engine/libraries/newton/core/dg.o \
- engine/libraries/newton/core/dgAABBPolygonSoup.o \
- engine/libraries/newton/core/dgCRC.o \
- engine/libraries/newton/core/dgConvexHull3d.o \
- engine/libraries/newton/core/dgConvexHull4d.o \
- engine/libraries/newton/core/dgDebug.o \
- engine/libraries/newton/core/dgDelaunayTetrahedralization.o \
- engine/libraries/newton/core/dgGeneralMatrix.o \
- engine/libraries/newton/core/dgGeneralVector.o \
- engine/libraries/newton/core/dgGoogol.o \
- engine/libraries/newton/core/dgIntersections.o \
- engine/libraries/newton/core/dgMatrix.o \
- engine/libraries/newton/core/dgMemory.o \
- engine/libraries/newton/core/dgNode.o \
- engine/libraries/newton/core/dgPolygonSoupBuilder.o \
- engine/libraries/newton/core/dgPolyhedra.o \
- engine/libraries/newton/core/dgPolyhedraMassProperties.o \
- engine/libraries/newton/core/dgQuaternion.o \
- engine/libraries/newton/core/dgRandom.o \
- engine/libraries/newton/core/dgRef.o \
- engine/libraries/newton/core/dgRefCounter.o \
- engine/libraries/newton/core/dgSPDMatrix.o \
- engine/libraries/newton/core/dgSmallDeterminant.o \
- engine/libraries/newton/core/dgSphere.o \
- engine/libraries/newton/core/dgThreads.o \
- engine/libraries/newton/core/dgTree.o \
- engine/libraries/newton/core/dgTypes.o \
- engine/libraries/newton/Newton.o \
- engine/libraries/newton/NewtonClass.o \
- engine/libraries/newton/physics/dgBallConstraint.o \
- engine/libraries/newton/physics/dgBilateralConstraint.o \
- engine/libraries/newton/physics/dgBody.o \
- engine/libraries/newton/physics/dgBodyMasterList.o \
- engine/libraries/newton/physics/dgBroadPhaseCollision.o \
- engine/libraries/newton/physics/dgCollision.o \
- engine/libraries/newton/physics/dgCollisionBVH.o \
- engine/libraries/newton/physics/dgCollisionBox.o \
- engine/libraries/newton/physics/dgCollisionCapsule.o \
- engine/libraries/newton/physics/dgCollisionChamferCylinder.o \
- engine/libraries/newton/physics/dgCollisionCompound.o \
- engine/libraries/newton/physics/dgCollisionCompoundBreakable.o \
- engine/libraries/newton/physics/dgCollisionCone.o \
- engine/libraries/newton/physics/dgCollisionConvex.o \
- engine/libraries/newton/physics/dgCollisionConvexHull.o \
- engine/libraries/newton/physics/dgCollisionConvexModifier.o \
- engine/libraries/newton/physics/dgCollisionCylinder.o \
- engine/libraries/newton/physics/dgCollisionEllipse.o \
- engine/libraries/newton/physics/dgCollisionHeightField.o \
- engine/libraries/newton/physics/dgCollisionMesh.o \
- engine/libraries/newton/physics/dgCollisionNull.o \
- engine/libraries/newton/physics/dgCollisionScene.o \
- engine/libraries/newton/physics/dgCollisionSphere.o \
- engine/libraries/newton/physics/dgCollisionUserMesh.o \
- engine/libraries/newton/physics/dgConnectorConstraint.o \
- engine/libraries/newton/physics/dgConstraint.o \
- engine/libraries/newton/physics/dgContact.o \
- engine/libraries/newton/physics/dgCorkscrewConstraint.o \
- engine/libraries/newton/physics/dgHingeConstraint.o \
- engine/libraries/newton/physics/dgMeshEffect.o \
- engine/libraries/newton/physics/dgMeshEffect2.o \
- engine/libraries/newton/physics/dgMeshEffect3.o \
- engine/libraries/newton/physics/dgMeshEffectSolidTree.o \
- engine/libraries/newton/physics/dgMinkowskiConv.o \
- engine/libraries/newton/physics/dgNarrowPhaseCollision.o \
- engine/libraries/newton/physics/dgPointToCurveConstraint.o \
- engine/libraries/newton/physics/dgSlidingConstraint.o \
- engine/libraries/newton/physics/dgUniversalConstraint.o \
- engine/libraries/newton/physics/dgUpVectorConstraint.o \
- engine/libraries/newton/physics/dgUserConstraint.o \
- engine/libraries/newton/physics/dgWorld.o \
- engine/libraries/newton/physics/dgWorldDynamicUpdate.o \
- engine/libraries/angelscript/sources/as_atomic.o \
- engine/libraries/angelscript/sources/as_builder.o \
- engine/libraries/angelscript/sources/as_bytecode.o \
- engine/libraries/angelscript/sources/as_callfunc.o \
- engine/libraries/angelscript/sources/as_compiler.o \
- engine/libraries/angelscript/sources/as_configgroup.o \
- engine/libraries/angelscript/sources/as_context.o \
- engine/libraries/angelscript/sources/as_datatype.o \
- engine/libraries/angelscript/sources/as_gc.o \
- engine/libraries/angelscript/sources/as_generic.o \
- engine/libraries/angelscript/sources/as_globalproperty.o \
- engine/libraries/angelscript/sources/as_memory.o \
- engine/libraries/angelscript/sources/as_module.o \
- engine/libraries/angelscript/sources/as_objecttype.o \
- engine/libraries/angelscript/sources/as_outputbuffer.o \
- engine/libraries/angelscript/sources/as_parser.o \
- engine/libraries/angelscript/sources/as_restore.o \
- engine/libraries/angelscript/sources/as_scriptcode.o \
- engine/libraries/angelscript/sources/as_scriptengine.o \
- engine/libraries/angelscript/sources/as_scriptfunction.o \
- engine/libraries/angelscript/sources/as_scriptnode.o \
- engine/libraries/angelscript/sources/as_scriptobject.o \
- engine/libraries/angelscript/sources/as_string.o \
- engine/libraries/angelscript/sources/as_string_util.o \
- engine/libraries/angelscript/sources/as_thread.o \
- engine/libraries/angelscript/sources/as_tokenizer.o \
- engine/libraries/angelscript/sources/as_typeinfo.o \
- engine/libraries/angelscript/sources/as_variablescope.o
-
-# This module can be built as a plugin
-ifeq ($(ENABLE_HPL1), DYNAMIC_PLUGIN)
-PLUGIN := 1
-endif
-
-# Include common rules
-include $(srcdir)/rules.mk
-
-# Detection objects
-DETECT_OBJS += $(MODULE)/detection.o
+MODULE := engines/hpl1
+
+MODULE_OBJS := \
+ console.o \
+ detection.o \
+ string.o \
+ opengl.o \
+ engine/ai/AI.o \
+ engine/ai/AINodeContainer.o \
+ engine/ai/AINodeGenerator.o \
+ engine/ai/AStar.o \
+ engine/ai/StateMachine.o \
+ engine/game/Game.o \
+ engine/game/GameTypes.o \
+ engine/game/SaveGame.o \
+ engine/game/ScriptFuncs.o \
+ engine/game/Updater.o \
+ engine/game/low_level_game_setup.o \
+ engine/graphics/Animation.o \
+ engine/graphics/AnimationTrack.o \
+ engine/graphics/BackgroundImage.o \
+ engine/graphics/Beam.o \
+ engine/graphics/BillBoard.o \
+ engine/graphics/Bone.o \
+ engine/graphics/BoneState.o \
+ engine/graphics/Color.o \
+ engine/graphics/font_data.o \
+ engine/graphics/GPUProgram.o \
+ engine/graphics/GfxObject.o \
+ engine/graphics/Graphics.o \
+ engine/graphics/GraphicsDrawer.o \
+ engine/graphics/ImageEntityData.o \
+ engine/graphics/Material.o \
+ engine/graphics/MaterialHandler.o \
+ engine/graphics/Material_Additive.o \
+ engine/graphics/Material_Alpha.o \
+ engine/graphics/Material_BaseLight.o \
+ engine/graphics/Material_Bump.o \
+ engine/graphics/Material_BumpColorSpec.o \
+ engine/graphics/Material_BumpSpec.o \
+ engine/graphics/Material_BumpSpec2D.o \
+ engine/graphics/Material_Diffuse.o \
+ engine/graphics/Material_Diffuse2D.o \
+ engine/graphics/Material_DiffuseAdditive2D.o \
+ engine/graphics/Material_DiffuseAlpha2D.o \
+ engine/graphics/Material_DiffuseSpec.o \
+ engine/graphics/Material_EnvMap_Reflect.o \
+ engine/graphics/Material_Fallback01_BaseLight.o \
+ engine/graphics/Material_Fallback02_BaseLight.o \
+ engine/graphics/Material_Flat.o \
+ engine/graphics/Material_FontNormal.o \
+ engine/graphics/Material_Modulative.o \
+ engine/graphics/Material_ModulativeX2.o \
+ engine/graphics/Material_Smoke2D.o \
+ engine/graphics/Material_Water.o \
+ engine/graphics/Mesh.o \
+ engine/graphics/Mesh2d.o \
+ engine/graphics/MeshCreator.o \
+ engine/graphics/ParticleEmitter.o \
+ engine/graphics/ParticleEmitter2D.o \
+ engine/graphics/ParticleEmitter3D.o \
+ engine/graphics/ParticleEmitter3D_UserData.o \
+ engine/graphics/ParticleSystem3D.o \
+ engine/graphics/RenderList.o \
+ engine/graphics/RenderObject2D.o \
+ engine/graphics/RenderState.o \
+ engine/graphics/Renderable.o \
+ engine/graphics/Renderer2D.o \
+ engine/graphics/Renderer3D.o \
+ engine/graphics/RendererPostEffects.o \
+ engine/graphics/Skeleton.o \
+ engine/graphics/SubMesh.o \
+ engine/graphics/bitmap2D.o \
+ engine/gui/Gui.o \
+ engine/gui/GuiGfxElement.o \
+ engine/gui/GuiMaterialBasicTypes.o \
+ engine/gui/GuiPopUp.o \
+ engine/gui/GuiPopUpMessageBox.o \
+ engine/gui/GuiSet.o \
+ engine/gui/GuiSkin.o \
+ engine/gui/Widget.o \
+ engine/gui/WidgetBaseClasses.o \
+ engine/gui/WidgetButton.o \
+ engine/gui/WidgetCheckBox.o \
+ engine/gui/WidgetComboBox.o \
+ engine/gui/WidgetFrame.o \
+ engine/gui/WidgetImage.o \
+ engine/gui/WidgetLabel.o \
+ engine/gui/WidgetListBox.o \
+ engine/gui/WidgetSlider.o \
+ engine/gui/WidgetTextBox.o \
+ engine/gui/WidgetWindow.o \
+ engine/haptic/Haptic.o \
+ engine/haptic/LowLevelHaptic.o \
+ engine/impl/CGProgram.o \
+ engine/impl/CharacterBodyNewton.o \
+ engine/impl/CollideShapeNewton.o \
+ engine/impl/KeyboardSDL.o \
+ engine/impl/LowLevelGraphicsSDL.o \
+ engine/impl/LowLevelInputSDL.o \
+ engine/impl/LowLevelPhysicsNewton.o \
+ engine/impl/LowLevelSoundOpenAL.o \
+ engine/impl/MeshLoaderCollada.o \
+ engine/impl/MeshLoaderColladaHelpers.o \
+ engine/impl/MeshLoaderColladaLoader.o \
+ engine/impl/MeshLoaderMSH.o \
+ engine/impl/MouseSDL.o \
+ engine/impl/OcclusionQueryOGL.o \
+ engine/impl/OpenALSoundChannel.o \
+ engine/impl/OpenALSoundData.o \
+ engine/impl/OpenALSoundEnvironment.o \
+ engine/impl/PBuffer.o \
+ engine/impl/PhysicsBodyNewton.o \
+ engine/impl/PhysicsControllerNewton.o \
+ engine/impl/PhysicsJointBallNewton.o \
+ engine/impl/PhysicsJointHingeNewton.o \
+ engine/impl/PhysicsJointScrewNewton.o \
+ engine/impl/PhysicsJointSliderNewton.o \
+ engine/impl/PhysicsMaterialNewton.o \
+ engine/impl/PhysicsWorldNewton.o \
+ engine/impl/SDLTexture.o \
+ engine/impl/SqScript.o \
+ engine/impl/VertexBufferOGL.o \
+ engine/impl/VertexBufferVBO.o \
+ engine/impl/VideoStreamTheora.o \
+ engine/libraries/angelscript/add-ons/scriptstdstring.o \
+ engine/libraries/angelscript/add-ons/scripthelper.o \
+ engine/impl/tinyXML/tinyxml.o \
+ engine/impl/tinyXML/tinyxmlerror.o \
+ engine/impl/tinyXML/tinyxmlparser.o \
+ engine/input/Action.o \
+ engine/input/ActionHaptic.o \
+ engine/input/ActionKeyboard.o \
+ engine/input/ActionMouseButton.o \
+ engine/input/Input.o \
+ engine/input/InputDevice.o \
+ engine/input/Keyboard.o \
+ engine/input/Mouse.o \
+ engine/math/BoundingVolume.o \
+ engine/math/CRC.o \
+ engine/math/Frustum.o \
+ engine/math/Math.o \
+ engine/math/MathTypes.o \
+ engine/math/MeshTypes.o \
+ engine/math/Quaternion.o \
+ engine/math/Spring.o \
+ engine/physics/Body2D.o \
+ engine/physics/CharacterBody.o \
+ engine/physics/Collider2D.o \
+ engine/physics/Physics.o \
+ engine/physics/PhysicsBody.o \
+ engine/physics/PhysicsController.o \
+ engine/physics/PhysicsJoint.o \
+ engine/physics/PhysicsJointBall.o \
+ engine/physics/PhysicsJointHinge.o \
+ engine/physics/PhysicsJointScrew.o \
+ engine/physics/PhysicsJointSlider.o \
+ engine/physics/PhysicsWorld.o \
+ engine/physics/SurfaceData.o \
+ engine/resources/AnimationManager.o \
+ engine/resources/ConfigFile.o \
+ engine/resources/EntityLoader_Object.o \
+ engine/resources/FileSearcher.o \
+ engine/resources/FontManager.o \
+ engine/resources/FrameBitmap.o \
+ engine/resources/FrameTexture.o \
+ engine/resources/GpuProgramManager.o \
+ engine/resources/ImageEntityManager.o \
+ engine/resources/ImageManager.o \
+ engine/resources/LanguageFile.o \
+ engine/resources/MaterialManager.o \
+ engine/resources/MeshLoaderHandler.o \
+ engine/resources/MeshManager.o \
+ engine/resources/ParticleManager.o \
+ engine/resources/ResourceBase.o \
+ engine/resources/ResourceImage.o \
+ engine/resources/ResourceManager.o \
+ engine/resources/Resources.o \
+ engine/resources/ScriptManager.o \
+ engine/resources/SoundEntityManager.o \
+ engine/resources/SoundManager.o \
+ engine/resources/TextureManager.o \
+ engine/resources/TileSetManager.o \
+ engine/resources/VideoManager.o \
+ engine/resources/low_level_resources.o \
+ engine/scene/AnimationState.o \
+ engine/scene/Area2D.o \
+ engine/scene/Camera2D.o \
+ engine/scene/Camera3D.o \
+ engine/scene/ColliderEntity.o \
+ engine/scene/Entity.o \
+ engine/scene/Entity2D.o \
+ engine/scene/Entity3D.o \
+ engine/scene/GridMap2D.o \
+ engine/scene/ImageEntity.o \
+ engine/scene/Light.o \
+ engine/scene/Light2D.o \
+ engine/scene/Light2DPoint.o \
+ engine/scene/Light3D.o \
+ engine/scene/Light3DPoint.o \
+ engine/scene/Light3DSpot.o \
+ engine/scene/MeshEntity.o \
+ engine/scene/MultiImageEntity.o \
+ engine/scene/Node.o \
+ engine/scene/Node2D.o \
+ engine/scene/Node3D.o \
+ engine/scene/NodeState.o \
+ engine/scene/PortalContainer.o \
+ engine/scene/Scene.o \
+ engine/scene/SectorVisibility.o \
+ engine/scene/SoundEntity.o \
+ engine/scene/SoundSource.o \
+ engine/scene/SubMeshEntity.o \
+ engine/scene/Tile.o \
+ engine/scene/TileData.o \
+ engine/scene/TileLayer.o \
+ engine/scene/TileMap.o \
+ engine/scene/TileMapLineIt.o \
+ engine/scene/TileMapRectIt.o \
+ engine/scene/TileSet.o \
+ engine/scene/World2D.o \
+ engine/scene/World3D.o \
+ engine/sound/LowLevelSound.o \
+ engine/sound/MusicHandler.o \
+ engine/sound/Sound.o \
+ engine/sound/SoundEntityData.o \
+ engine/sound/SoundHandler.o \
+ engine/system/Container.o \
+ engine/system/LogicTimer.o \
+ engine/system/low_level_system.o \
+ engine/system/MemoryManager.o \
+ engine/system/SerializeClass.o \
+ engine/system/String.o \
+ engine/system/System.o \
+ hpl1.o \
+ metaengine.o \
+ penumbra-overture/AttackHandler.o \
+ penumbra-overture/ButtonHandler.o \
+ penumbra-overture/CharacterMove.o \
+ penumbra-overture/Credits.o \
+ penumbra-overture/DeathMenu.o \
+ penumbra-overture/DemoEndText.o \
+ penumbra-overture/EffectHandler.o \
+ penumbra-overture/FadeHandler.o \
+ penumbra-overture/GameArea.o \
+ penumbra-overture/GameDamageArea.o \
+ penumbra-overture/GameEnemy.o \
+ penumbra-overture/GameEnemy_Dog.o \
+ penumbra-overture/GameEnemy_Spider.o \
+ penumbra-overture/GameEnemy_Worm.o \
+ penumbra-overture/GameEntity.o \
+ penumbra-overture/GameForceArea.o \
+ penumbra-overture/GameItem.o \
+ penumbra-overture/GameItemType.o \
+ penumbra-overture/GameLadder.o \
+ penumbra-overture/GameLamp.o \
+ penumbra-overture/GameLink.o \
+ penumbra-overture/GameLiquidArea.o \
+ penumbra-overture/GameMessageHandler.o \
+ penumbra-overture/GameMusicHandler.o \
+ penumbra-overture/GameObject.o \
+ penumbra-overture/GameSaveArea.o \
+ penumbra-overture/GameScripts.o \
+ penumbra-overture/GameStickArea.o \
+ penumbra-overture/GameSwingDoor.o \
+ penumbra-overture/GameTypes.o \
+ penumbra-overture/GraphicsHelper.o \
+ penumbra-overture/HapticGameCamera.o \
+ penumbra-overture/HudModel_Throw.o \
+ penumbra-overture/HudModel_Weapon.o \
+ penumbra-overture/Init.o \
+ penumbra-overture/IntroStory.o \
+ penumbra-overture/Inventory.o \
+ penumbra-overture/Main.o \
+ penumbra-overture/MainMenu.o \
+ penumbra-overture/MapHandler.o \
+ penumbra-overture/MapLoadText.o \
+ penumbra-overture/Notebook.o \
+ penumbra-overture/NumericalPanel.o \
+ penumbra-overture/Player.o \
+ penumbra-overture/PlayerHands.o \
+ penumbra-overture/PlayerHelper.o \
+ penumbra-overture/PlayerState_Interact.o \
+ penumbra-overture/PlayerState_InteractHaptX.o \
+ penumbra-overture/PlayerState_Misc.o \
+ penumbra-overture/PlayerState_MiscHaptX.o \
+ penumbra-overture/PlayerState_Weapon.o \
+ penumbra-overture/PlayerState_WeaponHaptX.o \
+ penumbra-overture/PreMenu.o \
+ penumbra-overture/RadioHandler.o \
+ penumbra-overture/SaveHandler.o \
+ penumbra-overture/SaveTypes.o \
+ penumbra-overture/TriggerHandler.o \
+ penumbra-overture/Triggers.o \
+ engine/libraries/newton/core/dg.o \
+ engine/libraries/newton/core/dgAABBPolygonSoup.o \
+ engine/libraries/newton/core/dgCRC.o \
+ engine/libraries/newton/core/dgConvexHull3d.o \
+ engine/libraries/newton/core/dgConvexHull4d.o \
+ engine/libraries/newton/core/dgDebug.o \
+ engine/libraries/newton/core/dgDelaunayTetrahedralization.o \
+ engine/libraries/newton/core/dgGeneralMatrix.o \
+ engine/libraries/newton/core/dgGeneralVector.o \
+ engine/libraries/newton/core/dgGoogol.o \
+ engine/libraries/newton/core/dgIntersections.o \
+ engine/libraries/newton/core/dgMatrix.o \
+ engine/libraries/newton/core/dgMemory.o \
+ engine/libraries/newton/core/dgNode.o \
+ engine/libraries/newton/core/dgPolygonSoupBuilder.o \
+ engine/libraries/newton/core/dgPolyhedra.o \
+ engine/libraries/newton/core/dgPolyhedraMassProperties.o \
+ engine/libraries/newton/core/dgQuaternion.o \
+ engine/libraries/newton/core/dgRandom.o \
+ engine/libraries/newton/core/dgRef.o \
+ engine/libraries/newton/core/dgRefCounter.o \
+ engine/libraries/newton/core/dgSPDMatrix.o \
+ engine/libraries/newton/core/dgSmallDeterminant.o \
+ engine/libraries/newton/core/dgSphere.o \
+ engine/libraries/newton/core/dgThreads.o \
+ engine/libraries/newton/core/dgTree.o \
+ engine/libraries/newton/core/dgTypes.o \
+ engine/libraries/newton/Newton.o \
+ engine/libraries/newton/NewtonClass.o \
+ engine/libraries/newton/physics/dgBallConstraint.o \
+ engine/libraries/newton/physics/dgBilateralConstraint.o \
+ engine/libraries/newton/physics/dgBody.o \
+ engine/libraries/newton/physics/dgBodyMasterList.o \
+ engine/libraries/newton/physics/dgBroadPhaseCollision.o \
+ engine/libraries/newton/physics/dgCollision.o \
+ engine/libraries/newton/physics/dgCollisionBVH.o \
+ engine/libraries/newton/physics/dgCollisionBox.o \
+ engine/libraries/newton/physics/dgCollisionCapsule.o \
+ engine/libraries/newton/physics/dgCollisionChamferCylinder.o \
+ engine/libraries/newton/physics/dgCollisionCompound.o \
+ engine/libraries/newton/physics/dgCollisionCompoundBreakable.o \
+ engine/libraries/newton/physics/dgCollisionCone.o \
+ engine/libraries/newton/physics/dgCollisionConvex.o \
+ engine/libraries/newton/physics/dgCollisionConvexHull.o \
+ engine/libraries/newton/physics/dgCollisionConvexModifier.o \
+ engine/libraries/newton/physics/dgCollisionCylinder.o \
+ engine/libraries/newton/physics/dgCollisionEllipse.o \
+ engine/libraries/newton/physics/dgCollisionHeightField.o \
+ engine/libraries/newton/physics/dgCollisionMesh.o \
+ engine/libraries/newton/physics/dgCollisionNull.o \
+ engine/libraries/newton/physics/dgCollisionScene.o \
+ engine/libraries/newton/physics/dgCollisionSphere.o \
+ engine/libraries/newton/physics/dgCollisionUserMesh.o \
+ engine/libraries/newton/physics/dgConnectorConstraint.o \
+ engine/libraries/newton/physics/dgConstraint.o \
+ engine/libraries/newton/physics/dgContact.o \
+ engine/libraries/newton/physics/dgCorkscrewConstraint.o \
+ engine/libraries/newton/physics/dgHingeConstraint.o \
+ engine/libraries/newton/physics/dgMeshEffect.o \
+ engine/libraries/newton/physics/dgMeshEffect2.o \
+ engine/libraries/newton/physics/dgMeshEffect3.o \
+ engine/libraries/newton/physics/dgMeshEffectSolidTree.o \
+ engine/libraries/newton/physics/dgMinkowskiConv.o \
+ engine/libraries/newton/physics/dgNarrowPhaseCollision.o \
+ engine/libraries/newton/physics/dgPointToCurveConstraint.o \
+ engine/libraries/newton/physics/dgSlidingConstraint.o \
+ engine/libraries/newton/physics/dgUniversalConstraint.o \
+ engine/libraries/newton/physics/dgUpVectorConstraint.o \
+ engine/libraries/newton/physics/dgUserConstraint.o \
+ engine/libraries/newton/physics/dgWorld.o \
+ engine/libraries/newton/physics/dgWorldDynamicUpdate.o \
+ engine/libraries/angelscript/sources/as_atomic.o \
+ engine/libraries/angelscript/sources/as_builder.o \
+ engine/libraries/angelscript/sources/as_bytecode.o \
+ engine/libraries/angelscript/sources/as_callfunc.o \
+ engine/libraries/angelscript/sources/as_compiler.o \
+ engine/libraries/angelscript/sources/as_configgroup.o \
+ engine/libraries/angelscript/sources/as_context.o \
+ engine/libraries/angelscript/sources/as_datatype.o \
+ engine/libraries/angelscript/sources/as_gc.o \
+ engine/libraries/angelscript/sources/as_generic.o \
+ engine/libraries/angelscript/sources/as_globalproperty.o \
+ engine/libraries/angelscript/sources/as_memory.o \
+ engine/libraries/angelscript/sources/as_module.o \
+ engine/libraries/angelscript/sources/as_objecttype.o \
+ engine/libraries/angelscript/sources/as_outputbuffer.o \
+ engine/libraries/angelscript/sources/as_parser.o \
+ engine/libraries/angelscript/sources/as_restore.o \
+ engine/libraries/angelscript/sources/as_scriptcode.o \
+ engine/libraries/angelscript/sources/as_scriptengine.o \
+ engine/libraries/angelscript/sources/as_scriptfunction.o \
+ engine/libraries/angelscript/sources/as_scriptnode.o \
+ engine/libraries/angelscript/sources/as_scriptobject.o \
+ engine/libraries/angelscript/sources/as_string.o \
+ engine/libraries/angelscript/sources/as_string_util.o \
+ engine/libraries/angelscript/sources/as_thread.o \
+ engine/libraries/angelscript/sources/as_tokenizer.o \
+ engine/libraries/angelscript/sources/as_typeinfo.o \
+ engine/libraries/angelscript/sources/as_variablescope.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_HPL1), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
+
+# Detection objects
+DETECT_OBJS += $(MODULE)/detection.o
Commit: 75ffdcdddea5e5d50b74a52f95e1abe335929e00
https://github.com/scummvm/scummvm/commit/75ffdcdddea5e5d50b74a52f95e1abe335929e00
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:03:46+01:00
Commit Message:
HPL1: Fixed uninitilized variables reported by valgrind
Changed paths:
engines/hpl1/penumbra-overture/Notebook.cpp
engines/hpl1/penumbra-overture/Player.cpp
diff --git a/engines/hpl1/penumbra-overture/Notebook.cpp b/engines/hpl1/penumbra-overture/Notebook.cpp
index 11a0230e908..f6a9c2788e6 100644
--- a/engines/hpl1/penumbra-overture/Notebook.cpp
+++ b/engines/hpl1/penumbra-overture/Notebook.cpp
@@ -802,6 +802,8 @@ cNotebook::cNotebook(cInit *apInit) : iUpdateable("Notebook") {
mpInit = apInit;
mpDrawer = mpInit->mpGame->GetGraphics()->GetDrawer();
+ mbInventoryWasActive = false;
+
Reset();
mpGfxBackground = mpDrawer->CreateGfxObject("notebook_background.bmp", "diffalpha2d");
diff --git a/engines/hpl1/penumbra-overture/Player.cpp b/engines/hpl1/penumbra-overture/Player.cpp
index f884fbbac16..ee534f64733 100644
--- a/engines/hpl1/penumbra-overture/Player.cpp
+++ b/engines/hpl1/penumbra-overture/Player.cpp
@@ -80,6 +80,8 @@ cPlayer::cPlayer(cInit *apInit) : iUpdateable("Player") {
mvSize.y = mpInit->mpGameConfig->GetFloat("Player", "Height", 1);
mvSize.z = mvSize.x;
+ mpPushBody = nullptr;
+
mfCameraHeightAdd = mpInit->mpGameConfig->GetFloat("Player", "CameraHeightAdd", 0);
mfDefaultMass = mpInit->mpGameConfig->GetFloat("Player", "Mass", 1);
Commit: 29b490a6d964f2a40612da10d4455aa6e3368347
https://github.com/scummvm/scummvm/commit/29b490a6d964f2a40612da10d4455aa6e3368347
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:46+01:00
Commit Message:
HPL1: change function implementation in physics library
this soves a bug that prevents interaction with objects in certain situations.
The code is from version 2.31 of the newton-dynamics library.
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgIntersections.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgIntersections.cpp b/engines/hpl1/engine/libraries/newton/core/dgIntersections.cpp
index 954e80dbfab..ac74105d48e 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgIntersections.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgIntersections.cpp
@@ -338,83 +338,41 @@ dgFloat32 dgFastRayTest::PolygonIntersectSimd(const dgVector& normal,
dgFloat32 dgFastRayTest::PolygonIntersect (const dgVector& normal, const dgFloat32* const polygon, dgInt32 strideInBytes, const dgInt32* const indexArray, dgInt32 indexCount) const
{
- _ASSERTE(m_p0.m_w == m_p1.m_w);
-
+ _ASSERTE (m_p0.m_w == m_p1.m_w);
- #ifndef __USE_DOUBLE_PRECISION__
- dgFloat32 unrealible = dgFloat32 (1.0e10f);
- #endif
-
- dgFloat32 dist = normal % m_diff;
+ dgFloat32 dist = normal % m_diff;
if (dist < m_dirError) {
- dgInt32 stride = dgInt32(strideInBytes / sizeof(dgFloat32));
+ dgInt32 stride = dgInt32 (strideInBytes / sizeof (dgFloat32));
- dgVector v0(&polygon[indexArray[indexCount - 1] * stride]);
- dgVector p0v0(v0 - m_p0);
- dgFloat32 tOut = normal % p0v0;
- dgFloat32 tolerance = m_magRayTest * DG_RAY_TOL_ERROR;
- // this only work for convex polygons and for single side faces
- // walk the polygon around the edges and calculate the volume
+ dgVector v0 (&polygon[indexArray[indexCount - 1] * stride]);
+ dgVector p0v0 (v0 - m_p0);
+ dgFloat32 tOut = normal % p0v0;
+ // this only work for convex polygons and for single side faces
+ // walk the polygon around the edges and calculate the volume
if ((tOut < dgFloat32 (0.0f)) && (tOut > dist)) {
for (dgInt32 i = 0; i < indexCount; i ++) {
- dgInt32 i2 = indexArray[i] * stride;
- dgVector v1(&polygon[i2]);
- dgVector p0v1(v1 - m_p0);
- // calculate the volume formed by the line and the edge of the polygon
- dgFloat32 alpha = (m_diff * p0v1) % p0v0;
- // if a least one volume is negative it mean the line cross the polygon outside this edge and do not hit the face
- if (alpha < tolerance) {
- #ifdef __USE_DOUBLE_PRECISION__
- return 1.2f;
- #else
- unrealible = alpha;
- break;
- #endif
- }
- p0v0 = p0v1;
- }
-
- #ifndef __USE_DOUBLE_PRECISION__
- if ((unrealible < dgFloat32 (0.0f)) && (unrealible > (DG_RAY_TOL_ERROR * dgFloat32 (10.0f)))) {
- // the edge is too close to an edge float is not reliable, do the calculation with double
- dgBigVector v0_ (v0);
- dgBigVector m_p0_ (m_p0);
- //dgBigVector m_p1_ (m_p1);
- dgBigVector p0v0_ (v0_ - m_p0_);
- dgBigVector normal_ (normal);
- dgBigVector diff_ (m_diff);
- dgFloat64 tOut_ = normal_ % p0v0_;
- //dgFloat64 dist_ = normal_ % diff_;
- if ((tOut < dgFloat64 (0.0f)) && (tOut > dist)) {
- for (dgInt32 i = 0; i < indexCount; i ++) {
- dgInt32 i2 = indexArray[i] * stride;
- dgBigVector v1 (&polygon[i2]);
- dgBigVector p0v1_ (v1 - m_p0_);
- // calculate the volume formed by the line and the edge of the polygon
- dgFloat64 alpha = (diff_ * p0v1_) % p0v0_;
- // if a least one volume is negative it mean the line cross the polygon outside this edge and do not hit the face
- if (alpha < DG_RAY_TOL_ERROR) {
- return 1.2f;
- }
- p0v0_ = p0v1_;
- }
-
- tOut = dgFloat32 (tOut_);
- }
+ dgInt32 i2 = indexArray[i] * stride;
+ dgVector v1 (&polygon[i2]);
+ dgVector p0v1 (v1 - m_p0);
+ // calculate the volume formed by the line and the edge of the polygon
+ dgFloat32 alpha = (m_diff * p0v1) % p0v0;
+ // if a least one volume is negative it mean the line cross the polygon outside this edge and do not hit the face
+ if (alpha < DG_RAY_TOL_ERROR) {
+ return 1.2f;
}
- #endif
-
- //the line is to the left of all the polygon edges,
- //then the intersection is the point we the line intersect the plane of the polygon
- tOut = tOut / dist;
- _ASSERTE(tOut >= dgFloat32 (0.0f));
- _ASSERTE(tOut <= dgFloat32 (1.0f));
- return tOut;
- }
- }
- return dgFloat32(1.2f);
-
+ p0v0 = p0v1;
+ }
+
+ //the line is to the left of all the polygon edges,
+ //then the intersection is the point we the line intersect the plane of the polygon
+ tOut = tOut / dist;
+ _ASSERTE (tOut >= dgFloat32 (0.0f));
+ _ASSERTE (tOut <= dgFloat32 (1.0f));
+ return tOut;
+ }
+ }
+ return dgFloat32 (1.2f);
}
bool dgApi dgRayBoxClip(dgVector& p0, dgVector& p1, const dgVector& boxP0,
Commit: 0a4d20e13ef8efd9031fa31ca5b96d6bfa24208a
https://github.com/scummvm/scummvm/commit/0a4d20e13ef8efd9031fa31ca5b96d6bfa24208a
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:47+01:00
Commit Message:
HPL1: fix bug in sound channel class
Changed paths:
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index 179547f2b5d..bd92950d784 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -135,12 +135,13 @@ void cOpenALSoundChannel::SetVolume(float volume) {
//-----------------------------------------------------------------------
-void cOpenALSoundChannel::SetLooping(bool abLoop) {
- mbLooping = abLoop;
- if (abLoop)
- mixer->loopChannel(_handle);
- else if (_playing)
+void cOpenALSoundChannel::SetLooping(bool loop) {
+ Hpl1::logInfo(Hpl1::kDebugAudio, "%slooping audio from source %s\n", loop ? "" : "un", mpData->GetName().c_str());
+ mbLooping = loop;
+ if (!_playing)
restart();
+ if (loop)
+ mixer->loopChannel(_handle);
}
//-----------------------------------------------------------------------
Commit: cb27b2a5d9e4009f6dca93f7152efca18e7cc9d8
https://github.com/scummvm/scummvm/commit/cb27b2a5d9e4009f6dca93f7152efca18e7cc9d8
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:47+01:00
Commit Message:
HPL1: fix sound not looping
Changed paths:
engines/hpl1/engine/sound/MusicHandler.cpp
diff --git a/engines/hpl1/engine/sound/MusicHandler.cpp b/engines/hpl1/engine/sound/MusicHandler.cpp
index c296163a9b5..66b1f3396f8 100644
--- a/engines/hpl1/engine/sound/MusicHandler.cpp
+++ b/engines/hpl1/engine/sound/MusicHandler.cpp
@@ -34,6 +34,7 @@
#include "hpl1/engine/sound/SoundData.h"
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
+#include "hpl1/debug.h"
namespace hpl {
@@ -287,13 +288,13 @@ void cMusicHandler::Update(float afTimeStep) {
bool cMusicHandler::LoadAndStart(const tString &asFileName, cMusicEntry *apSong, float afVolume, bool abLoop) {
iSoundData *pData = mpResources->GetSoundManager()->CreateSoundData(asFileName, true, abLoop);
if (pData == NULL) {
- Error("Couldn't load music '%s'\n", asFileName.c_str());
+ Hpl1::logError(Hpl1::kDebugAudio | Hpl1::kDebugResourceLoading, "Couldn't load music '%s'\n", asFileName.c_str());
return false;
}
iSoundChannel *pStream = pData->CreateChannel(256);
if (pStream == NULL) {
- Error("Couldn't stream music '%s'!\n", asFileName.c_str());
+ Hpl1::logError(Hpl1::kDebugAudio, "Couldn't stream music '%s'!\n", asFileName.c_str());
return false;
}
@@ -302,6 +303,7 @@ bool cMusicHandler::LoadAndStart(const tString &asFileName, cMusicEntry *apSong,
apSong->mpStream->SetVolume(afVolume);
apSong->mpStream->Play();
+ apSong->mpStream->SetLooping(abLoop);
return true;
}
Commit: 3364154c65acf9c401201a0c9eb8a87288992bda
https://github.com/scummvm/scummvm/commit/3364154c65acf9c401201a0c9eb8a87288992bda
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:47+01:00
Commit Message:
HPL1: enable sound channel setters
Changed paths:
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index bd92950d784..2b6e5f2e265 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -119,9 +119,8 @@ void cOpenALSoundChannel::SetPaused(bool pause) {
//-----------------------------------------------------------------------
void cOpenALSoundChannel::SetSpeed(float afSpeed) {
-#if 0
mfSpeed = afSpeed;
-
+#if 0
OAL_Source_SetPitch ( mlChannel, afSpeed );
#endif
}
@@ -170,20 +169,18 @@ void cOpenALSoundChannel::SetPositionRelative(bool abRelative) {
//-----------------------------------------------------------------------
void cOpenALSoundChannel::SetPosition(const cVector3f &avPos) {
+ mvPosition = avPos;
#if 0
- mvPosition = avPos;
-
- OAL_Source_SetAttributes ( mlChannel, mvPosition.v, mvVelocity.v );
+ OAL_Source_SetAttributes ( mlChannel, mvPosition.v, mvVelocity.v );
#endif
}
//-----------------------------------------------------------------------
void cOpenALSoundChannel::SetVelocity(const cVector3f &avVel) {
+ mvVelocity = avVel;
#if 0
- mvVelocity = avVel;
-
- OAL_Source_SetAttributes ( mlChannel, mvPosition.v, mvVelocity.v );
+ OAL_Source_SetAttributes ( mlChannel, mvPosition.v, mvVelocity.v );
#endif
}
Commit: d6281dfbb3ff7c77618108a89f991f6aadf9e5a2
https://github.com/scummvm/scummvm/commit/d6281dfbb3ff7c77618108a89f991f6aadf9e5a2
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:47+01:00
Commit Message:
HPL1: fix audio looping forever
Changed paths:
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index 2b6e5f2e265..a508205122c 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -137,8 +137,6 @@ void cOpenALSoundChannel::SetVolume(float volume) {
void cOpenALSoundChannel::SetLooping(bool loop) {
Hpl1::logInfo(Hpl1::kDebugAudio, "%slooping audio from source %s\n", loop ? "" : "un", mpData->GetName().c_str());
mbLooping = loop;
- if (!_playing)
- restart();
if (loop)
mixer->loopChannel(_handle);
}
Commit: c4f8cc612c71c261215a1cf3838986c81e80f8f1
https://github.com/scummvm/scummvm/commit/c4f8cc612c71c261215a1cf3838986c81e80f8f1
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:47+01:00
Commit Message:
HPL1: fix audio pause to better reflect the original
Changed paths:
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index a508205122c..c402da2584b 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -111,7 +111,7 @@ void cOpenALSoundChannel::SetPaused(bool pause) {
Hpl1::logInfo(Hpl1::kDebugAudio, "%spausing sound channel from data %s\n", pause ? "" : "un",
mpData->GetName().c_str());
mixer->pauseHandle(_handle, pause);
- if (!_playing && !pause)
+ if (!_playing && !pause && mbPaused) // corner case of the original implementation
Play();
mbPaused = pause;
}
Commit: fe7ca961613620382ffe0d6b9cf91ae883ad7160
https://github.com/scummvm/scummvm/commit/fe7ca961613620382ffe0d6b9cf91ae883ad7160
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:47+01:00
Commit Message:
HPL1: fix TBN matrix in shaders
The CG matrix constructor used vectors as rows while opengl uses them as columns
Changed paths:
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
index 2bfa8402848..c5d944fef0f 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
@@ -36,7 +36,7 @@ void main()
//Calculate rotation for light to get it to tangent space.
vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
- mat3 rotation = mat3(tangent.xyz, binormal, normal);
+ mat3 rotation = transpose(mat3(tangent.xyz, binormal, normal));
//Transform the lightdir
vLightDir = (rotation * vLightDir);
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
index 84a517a8b76..3def8eb7b85 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
@@ -42,7 +42,7 @@ void main()
//Calculate rotation for light to get it to tangent space.
vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
- mat3 rotation = mat3(tangent.xyz, binormal, normal);
+ mat3 rotation = transpose(mat3(tangent.xyz, binormal, normal));
//Transform the lightdir
vLightDir = (rotation * vLightDir);
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
index 79b7f5b3dfe..c1bf6817ef0 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
@@ -34,7 +34,7 @@ void main()
//Calculate rotation for light to get it to tangent space.
vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
- mat3 rotation = mat3(tangent.xyz, binormal, normal);
+ mat3 rotation = transpose(mat3(tangent.xyz, binormal, normal));
//Transform the lightdir
vLightDir = (rotation * vLightDir);
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
index 246da047acb..9ad03237738 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
@@ -38,7 +38,7 @@ void main()
//Calculate rotation for light to get it to tangent space.
vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
- mat3 rotation = mat3(tangent.xyz, binormal, normal);
+ mat3 rotation = transpose(mat3(tangent.xyz, binormal, normal));
//Transform the lightdir
vLightDir = (rotation * vLightDir);
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
index 127b08d0c1d..7464b0f269e 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
@@ -37,7 +37,7 @@ void main()
//Calculate rotation for light to get it to tangent space.
vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
- mat3 rotation = mat3(tangent.xyz, binormal, normal);
+ mat3 rotation = transpose(mat3(tangent.xyz, binormal, normal));
//Transform the lightdir
vLightDir = (rotation * vLightDir);
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
index 33626f9d25e..38d0c447254 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
@@ -33,7 +33,7 @@ void main()
//Calculate rotation for light to get it to tangent space.
vec3 binormal = cross(normal,tangent.xyz)*tangent.w;
- mat3 rotation = mat3(tangent.xyz, binormal, normal);
+ mat3 rotation = transpose(mat3(tangent.xyz, binormal, normal));
//Transform the lightdir
vLightDir = (rotation * vLightDir);
Commit: 89d73841adc63b0169e454367b484f4f4268cb94
https://github.com/scummvm/scummvm/commit/89d73841adc63b0169e454367b484f4f4268cb94
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:47+01:00
Commit Message:
HPL1: fix memory leak in shader class
Changed paths:
engines/hpl1/engine/impl/CGProgram.cpp
engines/hpl1/engine/impl/CGProgram.h
diff --git a/engines/hpl1/engine/impl/CGProgram.cpp b/engines/hpl1/engine/impl/CGProgram.cpp
index 34e9d922ecf..0532bb7d6f0 100644
--- a/engines/hpl1/engine/impl/CGProgram.cpp
+++ b/engines/hpl1/engine/impl/CGProgram.cpp
@@ -64,6 +64,10 @@ cCGProgram::cCGProgram(const tString &vertex, const tString &fragment)
setSamplers(_shader);
}
+cCGProgram::~cCGProgram() {
+ delete _shader;
+}
+
//-----------------------------------------------------------------------
bool cCGProgram::reload() {
diff --git a/engines/hpl1/engine/impl/CGProgram.h b/engines/hpl1/engine/impl/CGProgram.h
index 3fc0c99ff27..3839211214f 100644
--- a/engines/hpl1/engine/impl/CGProgram.h
+++ b/engines/hpl1/engine/impl/CGProgram.h
@@ -40,7 +40,7 @@ namespace hpl {
class cCGProgram : public iGpuProgram {
public:
cCGProgram(const tString &vertex, const tString &fragment);
- ~cCGProgram() = default;
+ ~cCGProgram();
bool reload();
void unload();
Commit: 5c90f1612f8b296b247994289902b9a5384de141
https://github.com/scummvm/scummvm/commit/5c90f1612f8b296b247994289902b9a5384de141
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:03:47+01:00
Commit Message:
HPL1: Remove trailing semicolons
Changed paths:
engines/hpl1/engine/ai/AI.h
engines/hpl1/engine/ai/AINodeContainer.h
engines/hpl1/engine/ai/AINodeGenerator.h
engines/hpl1/engine/ai/AStar.h
engines/hpl1/engine/ai/StateMachine.h
engines/hpl1/engine/game/Game.h
engines/hpl1/engine/game/SaveGame.h
engines/hpl1/engine/game/ScriptFuncs.h
engines/hpl1/engine/game/Updater.h
engines/hpl1/engine/game/low_level_game_setup.h
engines/hpl1/engine/graphics/Animation.h
engines/hpl1/engine/graphics/AnimationTrack.h
engines/hpl1/engine/graphics/BackgroundImage.h
engines/hpl1/engine/graphics/Beam.h
engines/hpl1/engine/graphics/BillBoard.h
engines/hpl1/engine/graphics/Bone.h
engines/hpl1/engine/graphics/BoneState.h
engines/hpl1/engine/graphics/Color.h
engines/hpl1/engine/graphics/GPUProgram.h
engines/hpl1/engine/graphics/GfxObject.h
engines/hpl1/engine/graphics/Graphics.h
engines/hpl1/engine/graphics/GraphicsDrawer.h
engines/hpl1/engine/graphics/ImageEntityData.h
engines/hpl1/engine/graphics/LowLevelGraphics.h
engines/hpl1/engine/graphics/LowLevelPicture.h
engines/hpl1/engine/graphics/Material.h
engines/hpl1/engine/graphics/MaterialHandler.h
engines/hpl1/engine/graphics/Material_Additive.h
engines/hpl1/engine/graphics/Material_Alpha.h
engines/hpl1/engine/graphics/Material_BaseLight.h
engines/hpl1/engine/graphics/Material_Bump.h
engines/hpl1/engine/graphics/Material_BumpSpec.h
engines/hpl1/engine/graphics/Material_BumpSpec2D.h
engines/hpl1/engine/graphics/Material_Diffuse.h
engines/hpl1/engine/graphics/Material_Diffuse2D.h
engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
engines/hpl1/engine/graphics/Material_DiffuseSpec.h
engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
engines/hpl1/engine/graphics/Material_Flat.h
engines/hpl1/engine/graphics/Material_FontNormal.h
engines/hpl1/engine/graphics/Material_Modulative.h
engines/hpl1/engine/graphics/Material_ModulativeX2.h
engines/hpl1/engine/graphics/Material_Smoke2D.h
engines/hpl1/engine/graphics/Material_Water.h
engines/hpl1/engine/graphics/Mesh.h
engines/hpl1/engine/graphics/Mesh2d.h
engines/hpl1/engine/graphics/MeshCreator.h
engines/hpl1/engine/graphics/OcclusionQuery.h
engines/hpl1/engine/graphics/ParticleEmitter.h
engines/hpl1/engine/graphics/ParticleSystem3D.h
engines/hpl1/engine/graphics/RenderList.h
engines/hpl1/engine/graphics/RenderObject2D.h
engines/hpl1/engine/graphics/RenderState.h
engines/hpl1/engine/graphics/Renderable.h
engines/hpl1/engine/graphics/Renderer2D.h
engines/hpl1/engine/graphics/Renderer3D.h
engines/hpl1/engine/graphics/RendererPostEffects.h
engines/hpl1/engine/graphics/Skeleton.h
engines/hpl1/engine/graphics/SubMesh.h
engines/hpl1/engine/graphics/Texture.h
engines/hpl1/engine/graphics/VertexBuffer.h
engines/hpl1/engine/graphics/VideoStream.h
engines/hpl1/engine/graphics/bitmap2D.h
engines/hpl1/engine/graphics/font_data.h
engines/hpl1/engine/gui/Gui.h
engines/hpl1/engine/gui/GuiGfxElement.h
engines/hpl1/engine/gui/GuiMaterial.h
engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
engines/hpl1/engine/gui/GuiPopUp.h
engines/hpl1/engine/gui/GuiPopUpMessageBox.h
engines/hpl1/engine/gui/GuiSet.h
engines/hpl1/engine/gui/GuiSkin.h
engines/hpl1/engine/gui/Widget.h
engines/hpl1/engine/gui/WidgetBaseClasses.h
engines/hpl1/engine/gui/WidgetButton.h
engines/hpl1/engine/gui/WidgetCheckBox.h
engines/hpl1/engine/gui/WidgetComboBox.h
engines/hpl1/engine/gui/WidgetFrame.h
engines/hpl1/engine/gui/WidgetImage.h
engines/hpl1/engine/gui/WidgetLabel.h
engines/hpl1/engine/gui/WidgetListBox.h
engines/hpl1/engine/gui/WidgetSlider.h
engines/hpl1/engine/gui/WidgetTextBox.h
engines/hpl1/engine/gui/WidgetWindow.h
engines/hpl1/engine/haptic/Haptic.h
engines/hpl1/engine/haptic/HapticForce.h
engines/hpl1/engine/haptic/HapticShape.h
engines/hpl1/engine/haptic/HapticSurface.h
engines/hpl1/engine/haptic/HapticTypes.h
engines/hpl1/engine/haptic/LowLevelHaptic.h
engines/hpl1/engine/impl/CGProgram.h
engines/hpl1/engine/impl/CharacterBodyNewton.h
engines/hpl1/engine/impl/CollideShapeNewton.h
engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
engines/hpl1/engine/impl/LowLevelInputSDL.h
engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
engines/hpl1/engine/impl/MeshLoaderCollada.h
engines/hpl1/engine/impl/MeshLoaderMSH.h
engines/hpl1/engine/impl/OcclusionQueryOGL.h
engines/hpl1/engine/impl/OpenALSoundChannel.h
engines/hpl1/engine/impl/OpenALSoundData.h
engines/hpl1/engine/impl/PhysicsBodyNewton.h
engines/hpl1/engine/impl/PhysicsControllerNewton.h
engines/hpl1/engine/impl/PhysicsJointBallNewton.h
engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
engines/hpl1/engine/impl/PhysicsJointNewton.h
engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
engines/hpl1/engine/impl/PhysicsMaterialNewton.h
engines/hpl1/engine/impl/PhysicsWorldNewton.h
engines/hpl1/engine/impl/SDLTexture.h
engines/hpl1/engine/impl/SqScript.h
engines/hpl1/engine/impl/VertexBufferOGL.h
engines/hpl1/engine/impl/VertexBufferVBO.h
engines/hpl1/engine/input/Action.h
engines/hpl1/engine/input/ActionHaptic.h
engines/hpl1/engine/input/ActionKeyboard.h
engines/hpl1/engine/input/ActionMouseButton.h
engines/hpl1/engine/input/InputDevice.h
engines/hpl1/engine/input/LowLevelInput.h
engines/hpl1/engine/math/BoundingVolume.h
engines/hpl1/engine/math/Frustum.h
engines/hpl1/engine/math/Math.h
engines/hpl1/engine/math/MeshTypes.h
engines/hpl1/engine/math/PidController.h
engines/hpl1/engine/math/Quaternion.h
engines/hpl1/engine/math/Spring.h
engines/hpl1/engine/math/Vector2.h
engines/hpl1/engine/math/Vector3.h
engines/hpl1/engine/physics/Body2D.h
engines/hpl1/engine/physics/CharacterBody.h
engines/hpl1/engine/physics/CollideData.h
engines/hpl1/engine/physics/CollideData2D.h
engines/hpl1/engine/physics/CollideShape.h
engines/hpl1/engine/physics/Collider2D.h
engines/hpl1/engine/physics/LowLevelPhysics.h
engines/hpl1/engine/physics/Physics.h
engines/hpl1/engine/physics/PhysicsBody.h
engines/hpl1/engine/physics/PhysicsController.h
engines/hpl1/engine/physics/PhysicsJoint.h
engines/hpl1/engine/physics/PhysicsJointBall.h
engines/hpl1/engine/physics/PhysicsJointHinge.h
engines/hpl1/engine/physics/PhysicsJointScrew.h
engines/hpl1/engine/physics/PhysicsJointSlider.h
engines/hpl1/engine/physics/PhysicsMaterial.h
engines/hpl1/engine/physics/PhysicsWorld.h
engines/hpl1/engine/physics/SurfaceData.h
engines/hpl1/engine/resources/AnimationManager.h
engines/hpl1/engine/resources/ConfigFile.h
engines/hpl1/engine/resources/EntityLoader_Object.h
engines/hpl1/engine/resources/FileSearcher.h
engines/hpl1/engine/resources/FontManager.h
engines/hpl1/engine/resources/FrameBase.h
engines/hpl1/engine/resources/FrameBitmap.h
engines/hpl1/engine/resources/FrameTexture.h
engines/hpl1/engine/resources/GpuProgramManager.h
engines/hpl1/engine/resources/ImageEntityManager.h
engines/hpl1/engine/resources/ImageManager.h
engines/hpl1/engine/resources/LanguageFile.h
engines/hpl1/engine/resources/MaterialManager.h
engines/hpl1/engine/resources/MeshLoader.h
engines/hpl1/engine/resources/MeshLoaderHandler.h
engines/hpl1/engine/resources/MeshManager.h
engines/hpl1/engine/resources/ParticleManager.h
engines/hpl1/engine/resources/ResourceBase.h
engines/hpl1/engine/resources/ResourceManager.h
engines/hpl1/engine/resources/Resources.h
engines/hpl1/engine/resources/ResourcesTypes.h
engines/hpl1/engine/resources/ScriptManager.h
engines/hpl1/engine/resources/SoundEntityManager.h
engines/hpl1/engine/resources/SoundManager.h
engines/hpl1/engine/resources/TextureManager.h
engines/hpl1/engine/resources/TileSetManager.h
engines/hpl1/engine/resources/VideoManager.h
engines/hpl1/engine/resources/low_level_resources.h
engines/hpl1/engine/scene/AnimationState.h
engines/hpl1/engine/scene/Area2D.h
engines/hpl1/engine/scene/Camera.h
engines/hpl1/engine/scene/Camera2D.h
engines/hpl1/engine/scene/Camera3D.h
engines/hpl1/engine/scene/ColliderEntity.h
engines/hpl1/engine/scene/Entity.h
engines/hpl1/engine/scene/Entity2D.h
engines/hpl1/engine/scene/Entity3D.h
engines/hpl1/engine/scene/GridMap2D.h
engines/hpl1/engine/scene/ImageEntity.h
engines/hpl1/engine/scene/Light.h
engines/hpl1/engine/scene/Light2D.h
engines/hpl1/engine/scene/Light2DPoint.h
engines/hpl1/engine/scene/Light3D.h
engines/hpl1/engine/scene/Light3DPoint.h
engines/hpl1/engine/scene/Light3DSpot.h
engines/hpl1/engine/scene/MeshEntity.h
engines/hpl1/engine/scene/MultiImageEntity.h
engines/hpl1/engine/scene/Node.h
engines/hpl1/engine/scene/Node2D.h
engines/hpl1/engine/scene/Node3D.h
engines/hpl1/engine/scene/NodeState.h
engines/hpl1/engine/scene/PortalContainer.h
engines/hpl1/engine/scene/RenderableContainer.h
engines/hpl1/engine/scene/Scene.h
engines/hpl1/engine/scene/SectorVisibility.h
engines/hpl1/engine/scene/SoundEntity.h
engines/hpl1/engine/scene/SoundSource.h
engines/hpl1/engine/scene/SubMeshEntity.h
engines/hpl1/engine/scene/Tile.h
engines/hpl1/engine/scene/TileData.h
engines/hpl1/engine/scene/TileLayer.h
engines/hpl1/engine/scene/TileMap.h
engines/hpl1/engine/scene/TileMapIt.h
engines/hpl1/engine/scene/TileMapLineIt.h
engines/hpl1/engine/scene/TileMapRectIt.h
engines/hpl1/engine/scene/TileSet.h
engines/hpl1/engine/scene/World2D.h
engines/hpl1/engine/scene/World3D.h
engines/hpl1/engine/sound/LowLevelSound.h
engines/hpl1/engine/sound/MusicHandler.h
engines/hpl1/engine/sound/Sound.h
engines/hpl1/engine/sound/SoundChannel.h
engines/hpl1/engine/sound/SoundData.h
engines/hpl1/engine/sound/SoundEntityData.h
engines/hpl1/engine/sound/SoundHandler.h
engines/hpl1/engine/system/BinTree.h
engines/hpl1/engine/system/Container.h
engines/hpl1/engine/system/LogicTimer.h
engines/hpl1/engine/system/MemoryManager.h
engines/hpl1/engine/system/Script.h
engines/hpl1/engine/system/String.h
engines/hpl1/engine/system/System.h
engines/hpl1/engine/system/SystemTypes.h
engines/hpl1/engine/system/low_level_system.h
diff --git a/engines/hpl1/engine/ai/AI.h b/engines/hpl1/engine/ai/AI.h
index 4c4d9fe0440..ed9b9595728 100644
--- a/engines/hpl1/engine/ai/AI.h
+++ b/engines/hpl1/engine/ai/AI.h
@@ -53,5 +53,6 @@ private:
cAINodeGenerator *mpAINodeGenerator;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_AI_H
diff --git a/engines/hpl1/engine/ai/AINodeContainer.h b/engines/hpl1/engine/ai/AINodeContainer.h
index 531dd8075d8..cd504fec678 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.h
+++ b/engines/hpl1/engine/ai/AINodeContainer.h
@@ -296,5 +296,6 @@ private:
float mfMaxHeight;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_AI_NODE_CONTAINER_H
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.h b/engines/hpl1/engine/ai/AINodeGenerator.h
index b122f3f674f..74ac55ac536 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.h
+++ b/engines/hpl1/engine/ai/AINodeGenerator.h
@@ -75,5 +75,6 @@ private:
tTempAiNodeList *mpNodeList;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_AI_NODE_GENERATOR_H
diff --git a/engines/hpl1/engine/ai/AStar.h b/engines/hpl1/engine/ai/AStar.h
index 26233f8e65b..2ab857e3712 100644
--- a/engines/hpl1/engine/ai/AStar.h
+++ b/engines/hpl1/engine/ai/AStar.h
@@ -122,5 +122,6 @@ private:
tAStarNodeSet m_setClosedList;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_A_STAR_H
diff --git a/engines/hpl1/engine/ai/StateMachine.h b/engines/hpl1/engine/ai/StateMachine.h
index b94beb9f18c..f65a9d8fab6 100644
--- a/engines/hpl1/engine/ai/StateMachine.h
+++ b/engines/hpl1/engine/ai/StateMachine.h
@@ -103,5 +103,6 @@ private:
iAIState *mpCurrentState;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_STATE_MACHINE_H
diff --git a/engines/hpl1/engine/game/Game.h b/engines/hpl1/engine/game/Game.h
index da83065fc1c..4b2a068165d 100644
--- a/engines/hpl1/engine/game/Game.h
+++ b/engines/hpl1/engine/game/Game.h
@@ -228,5 +228,6 @@ private:
cGui *mpGui;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_GAME_H
diff --git a/engines/hpl1/engine/game/SaveGame.h b/engines/hpl1/engine/game/SaveGame.h
index 14aa75f22db..8e709386e58 100644
--- a/engines/hpl1/engine/game/SaveGame.h
+++ b/engines/hpl1/engine/game/SaveGame.h
@@ -232,5 +232,6 @@ private:
//---------------------------------------------------------
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SAVE_GAME_H
diff --git a/engines/hpl1/engine/game/ScriptFuncs.h b/engines/hpl1/engine/game/ScriptFuncs.h
index 8b54c9f94f5..c64e73411cf 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.h
+++ b/engines/hpl1/engine/game/ScriptFuncs.h
@@ -70,5 +70,6 @@ public:
cGame *apGame);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SCRIPT_FUNCS_H
diff --git a/engines/hpl1/engine/game/Updater.h b/engines/hpl1/engine/game/Updater.h
index 90e07ea821b..2fa9c1862aa 100644
--- a/engines/hpl1/engine/game/Updater.h
+++ b/engines/hpl1/engine/game/Updater.h
@@ -105,5 +105,7 @@ private:
tUpdateableList *mpCurrentUpdates;
tUpdateableList mlstGlobalUpdateableList;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_UPDATER_H
diff --git a/engines/hpl1/engine/game/low_level_game_setup.h b/engines/hpl1/engine/game/low_level_game_setup.h
index a0837fbb708..c2144c26e5d 100644
--- a/engines/hpl1/engine/game/low_level_game_setup.h
+++ b/engines/hpl1/engine/game/low_level_game_setup.h
@@ -64,5 +64,7 @@ private:
iLowLevelPhysics *_lowLevelPhysics;
iLowLevelHaptic *_lowLevelHaptic;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LOWLEVELGAMESETUP_H
diff --git a/engines/hpl1/engine/graphics/Animation.h b/engines/hpl1/engine/graphics/Animation.h
index d617bbd5fa9..ec394a4522e 100644
--- a/engines/hpl1/engine/graphics/Animation.h
+++ b/engines/hpl1/engine/graphics/Animation.h
@@ -73,5 +73,6 @@ private:
tAnimationTrackVec mvTracks;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_ANIMATION_H
diff --git a/engines/hpl1/engine/graphics/AnimationTrack.h b/engines/hpl1/engine/graphics/AnimationTrack.h
index bdb9a27273c..8b346cf5fba 100644
--- a/engines/hpl1/engine/graphics/AnimationTrack.h
+++ b/engines/hpl1/engine/graphics/AnimationTrack.h
@@ -97,5 +97,6 @@ private:
cAnimation *mpParent;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_ANIMATION_TRACK_H
diff --git a/engines/hpl1/engine/graphics/BackgroundImage.h b/engines/hpl1/engine/graphics/BackgroundImage.h
index 36ef38bf78d..7b42a8b8cdd 100644
--- a/engines/hpl1/engine/graphics/BackgroundImage.h
+++ b/engines/hpl1/engine/graphics/BackgroundImage.h
@@ -59,5 +59,7 @@ private:
typedef std::map<float, cBackgroundImage *> tBackgroundImageMap;
typedef tBackgroundImageMap::iterator tBackgroundImageMapIt;
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_BACKGROUND_IMAGE_H
diff --git a/engines/hpl1/engine/graphics/Beam.h b/engines/hpl1/engine/graphics/Beam.h
index 5c49e172c69..6042fa4fb52 100644
--- a/engines/hpl1/engine/graphics/Beam.h
+++ b/engines/hpl1/engine/graphics/Beam.h
@@ -167,5 +167,6 @@ private:
cColor mColor;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_BEAM_H
diff --git a/engines/hpl1/engine/graphics/BillBoard.h b/engines/hpl1/engine/graphics/BillBoard.h
index 09c64a1f81d..a0c46ea52aa 100644
--- a/engines/hpl1/engine/graphics/BillBoard.h
+++ b/engines/hpl1/engine/graphics/BillBoard.h
@@ -182,5 +182,6 @@ private:
float mfHaloAlpha;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_BILLBOARD_H
diff --git a/engines/hpl1/engine/graphics/Bone.h b/engines/hpl1/engine/graphics/Bone.h
index 9d67757fde0..7f0cf5f05f1 100644
--- a/engines/hpl1/engine/graphics/Bone.h
+++ b/engines/hpl1/engine/graphics/Bone.h
@@ -92,5 +92,6 @@ private:
int mlValue;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_BONE_H
diff --git a/engines/hpl1/engine/graphics/BoneState.h b/engines/hpl1/engine/graphics/BoneState.h
index 4118d39f771..d1d914c5bad 100644
--- a/engines/hpl1/engine/graphics/BoneState.h
+++ b/engines/hpl1/engine/graphics/BoneState.h
@@ -56,5 +56,6 @@ private:
iPhysicsBody *mpColliderBody;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_BONE_STATE_H
diff --git a/engines/hpl1/engine/graphics/Color.h b/engines/hpl1/engine/graphics/Color.h
index f2ade5e39d1..32aec36a8c1 100644
--- a/engines/hpl1/engine/graphics/Color.h
+++ b/engines/hpl1/engine/graphics/Color.h
@@ -68,5 +68,6 @@ typedef tColorList::iterator tColorListIt;
typedef std::vector<cColor> tColorVec;
typedef tColorVec::iterator tColorVecIt;
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_COLOR_H
diff --git a/engines/hpl1/engine/graphics/GPUProgram.h b/engines/hpl1/engine/graphics/GPUProgram.h
index 005165d8ea4..42d9cad10f5 100644
--- a/engines/hpl1/engine/graphics/GPUProgram.h
+++ b/engines/hpl1/engine/graphics/GPUProgram.h
@@ -102,5 +102,7 @@ public:
protected:
static bool mbDebugInfo;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_GPU_PROGRAM_H
diff --git a/engines/hpl1/engine/graphics/GfxObject.h b/engines/hpl1/engine/graphics/GfxObject.h
index d125137ee5c..a850c4b6208 100644
--- a/engines/hpl1/engine/graphics/GfxObject.h
+++ b/engines/hpl1/engine/graphics/GfxObject.h
@@ -59,5 +59,7 @@ private:
typedef std::vector<cGfxObject> tGfxObjectVec;
typedef tGfxObjectVec::iterator tGfxObjectVecIt;
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_GFX_OBJECT_H
diff --git a/engines/hpl1/engine/graphics/Graphics.h b/engines/hpl1/engine/graphics/Graphics.h
index 0e3213972f8..3aede921b43 100644
--- a/engines/hpl1/engine/graphics/Graphics.h
+++ b/engines/hpl1/engine/graphics/Graphics.h
@@ -81,5 +81,6 @@ private:
cRenderList *mpRenderList;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_GRAPHICS_H
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.h b/engines/hpl1/engine/graphics/GraphicsDrawer.h
index f384ac9d4c9..5aa243a7a1c 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.h
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.h
@@ -149,5 +149,6 @@ private:
tBackgroundImageMap m_mapBackgroundImages;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_GRAPHICSDRAWER_H
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.h b/engines/hpl1/engine/graphics/ImageEntityData.h
index ba237413fa0..814b4929359 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.h
+++ b/engines/hpl1/engine/graphics/ImageEntityData.h
@@ -125,5 +125,6 @@ private:
void GetFrameNum(TiXmlElement *apElement);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_IMAGE_ENTITY_DATA_H
diff --git a/engines/hpl1/engine/graphics/LowLevelGraphics.h b/engines/hpl1/engine/graphics/LowLevelGraphics.h
index 1f13ba52e83..bfb0884d1c0 100644
--- a/engines/hpl1/engine/graphics/LowLevelGraphics.h
+++ b/engines/hpl1/engine/graphics/LowLevelGraphics.h
@@ -428,5 +428,7 @@ public:
virtual void FlushRendering() = 0;
virtual void SwapBuffers() = 0;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LOWLEVELGRAPHICS_H
diff --git a/engines/hpl1/engine/graphics/LowLevelPicture.h b/engines/hpl1/engine/graphics/LowLevelPicture.h
index 1e21ce20e7d..2f555f4df18 100644
--- a/engines/hpl1/engine/graphics/LowLevelPicture.h
+++ b/engines/hpl1/engine/graphics/LowLevelPicture.h
@@ -61,5 +61,6 @@ private:
tString _path;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_LOWLEVEL_PICTURE_H
diff --git a/engines/hpl1/engine/graphics/Material.h b/engines/hpl1/engine/graphics/Material.h
index d03de340866..2dc6dd0bb33 100644
--- a/engines/hpl1/engine/graphics/Material.h
+++ b/engines/hpl1/engine/graphics/Material.h
@@ -399,5 +399,6 @@ public:
typedef std::list<iMaterialType *> tMaterialTypeList;
typedef tMaterialTypeList::iterator tMaterialTypeListIt;
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_H
diff --git a/engines/hpl1/engine/graphics/MaterialHandler.h b/engines/hpl1/engine/graphics/MaterialHandler.h
index 200ba86f5b4..826749dfa0e 100644
--- a/engines/hpl1/engine/graphics/MaterialHandler.h
+++ b/engines/hpl1/engine/graphics/MaterialHandler.h
@@ -61,5 +61,6 @@ private:
cGraphics *mpGraphics;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIALHANDLER_H
diff --git a/engines/hpl1/engine/graphics/Material_Additive.h b/engines/hpl1/engine/graphics/Material_Additive.h
index 501adf09db4..d5a466baaa5 100644
--- a/engines/hpl1/engine/graphics/Material_Additive.h
+++ b/engines/hpl1/engine/graphics/Material_Additive.h
@@ -93,5 +93,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_ADDITIVE_H
diff --git a/engines/hpl1/engine/graphics/Material_Alpha.h b/engines/hpl1/engine/graphics/Material_Alpha.h
index 3a7df303a35..d5dc267d8fb 100644
--- a/engines/hpl1/engine/graphics/Material_Alpha.h
+++ b/engines/hpl1/engine/graphics/Material_Alpha.h
@@ -93,5 +93,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_ALPHA_H
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.h b/engines/hpl1/engine/graphics/Material_BaseLight.h
index 5ffa9dc9097..a4e1d9a0ca4 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.h
@@ -104,5 +104,6 @@ protected:
iGpuProgram *_shaders[eBaseLightProgram_LastEnum];
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_BASE_LIGHT_H
diff --git a/engines/hpl1/engine/graphics/Material_Bump.h b/engines/hpl1/engine/graphics/Material_Bump.h
index 02a009604b8..0ead729e070 100644
--- a/engines/hpl1/engine/graphics/Material_Bump.h
+++ b/engines/hpl1/engine/graphics/Material_Bump.h
@@ -55,5 +55,6 @@ public:
eMaterialPicture aPicture, cRenderer3D *apRenderer3D);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_BUMPE_H
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec.h b/engines/hpl1/engine/graphics/Material_BumpSpec.h
index 30cd4e9a1e2..f03f2f0d0f7 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec.h
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec.h
@@ -55,5 +55,6 @@ public:
eMaterialPicture aPicture, cRenderer3D *apRenderer3D);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_BUMP_SPEC_H
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec2D.h b/engines/hpl1/engine/graphics/Material_BumpSpec2D.h
index 44d518dacfa..d1d89ce16c5 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec2D.h
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec2D.h
@@ -75,5 +75,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_BUMP_SPEC2D_H
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse.h b/engines/hpl1/engine/graphics/Material_Diffuse.h
index c0bdcb13464..cde715fae8f 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse.h
+++ b/engines/hpl1/engine/graphics/Material_Diffuse.h
@@ -60,5 +60,6 @@ private:
int mlTechLevel;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_DIFFUSE_H
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse2D.h b/engines/hpl1/engine/graphics/Material_Diffuse2D.h
index e1bf65e4fe7..b5b3c3153d9 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse2D.h
+++ b/engines/hpl1/engine/graphics/Material_Diffuse2D.h
@@ -70,5 +70,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_DIFFUSE2D_H
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h b/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
index bcf5b292227..3fcfd086143 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
+++ b/engines/hpl1/engine/graphics/Material_DiffuseAdditive2D.h
@@ -74,5 +74,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_DIFFUSE_ADDITIVE_H
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h b/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
index c7da246069d..c44ebaefc90 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
+++ b/engines/hpl1/engine/graphics/Material_DiffuseAlpha2D.h
@@ -70,5 +70,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_DIFFUSE_ALPHA2D_H
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseSpec.h b/engines/hpl1/engine/graphics/Material_DiffuseSpec.h
index d8be8af996c..03a7ba1f848 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseSpec.h
+++ b/engines/hpl1/engine/graphics/Material_DiffuseSpec.h
@@ -55,5 +55,6 @@ public:
eMaterialPicture aPicture, cRenderer3D *apRenderer3D);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_DIFFUSE_SPEC_H
diff --git a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
index 308e80ec63c..4ff9246a3fa 100644
--- a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
+++ b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
@@ -114,5 +114,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_ENVMAP_REFLECT_H
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
index 8708a8caa5a..299d6face92 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
@@ -220,5 +220,6 @@ public:
//---------------------------------------------------------------
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_FALLBACK01_BASE_LIGHT_H
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
index 460619b425b..7530b31701f 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
@@ -151,5 +151,6 @@ public:
//---------------------------------------------------------------
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_FALLBACK02_BASE_LIGHT_H
diff --git a/engines/hpl1/engine/graphics/Material_Flat.h b/engines/hpl1/engine/graphics/Material_Flat.h
index 228a916d91b..1cdd73b0329 100644
--- a/engines/hpl1/engine/graphics/Material_Flat.h
+++ b/engines/hpl1/engine/graphics/Material_Flat.h
@@ -87,5 +87,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_FLAT_H
diff --git a/engines/hpl1/engine/graphics/Material_FontNormal.h b/engines/hpl1/engine/graphics/Material_FontNormal.h
index 533c7c7d419..64ca399334e 100644
--- a/engines/hpl1/engine/graphics/Material_FontNormal.h
+++ b/engines/hpl1/engine/graphics/Material_FontNormal.h
@@ -70,5 +70,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_FONTNORMAL_H
diff --git a/engines/hpl1/engine/graphics/Material_Modulative.h b/engines/hpl1/engine/graphics/Material_Modulative.h
index 256c3871775..04a0e78b1d8 100644
--- a/engines/hpl1/engine/graphics/Material_Modulative.h
+++ b/engines/hpl1/engine/graphics/Material_Modulative.h
@@ -93,5 +93,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_MODULATIVE_H
diff --git a/engines/hpl1/engine/graphics/Material_ModulativeX2.h b/engines/hpl1/engine/graphics/Material_ModulativeX2.h
index 3e551426522..a5c120287ff 100644
--- a/engines/hpl1/engine/graphics/Material_ModulativeX2.h
+++ b/engines/hpl1/engine/graphics/Material_ModulativeX2.h
@@ -93,5 +93,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_MODULATIVE_X_2_H
diff --git a/engines/hpl1/engine/graphics/Material_Smoke2D.h b/engines/hpl1/engine/graphics/Material_Smoke2D.h
index 25abeef8042..3e2797650a3 100644
--- a/engines/hpl1/engine/graphics/Material_Smoke2D.h
+++ b/engines/hpl1/engine/graphics/Material_Smoke2D.h
@@ -70,5 +70,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_SMOKE2D_H
diff --git a/engines/hpl1/engine/graphics/Material_Water.h b/engines/hpl1/engine/graphics/Material_Water.h
index eafbbc2837c..163a933c35e 100644
--- a/engines/hpl1/engine/graphics/Material_Water.h
+++ b/engines/hpl1/engine/graphics/Material_Water.h
@@ -109,5 +109,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_WATER_H
diff --git a/engines/hpl1/engine/graphics/Mesh.h b/engines/hpl1/engine/graphics/Mesh.h
index 6d083ae32ca..2c420d2410f 100644
--- a/engines/hpl1/engine/graphics/Mesh.h
+++ b/engines/hpl1/engine/graphics/Mesh.h
@@ -349,5 +349,6 @@ private:
tMeshReferenceVec mvReferences;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MESH_H
diff --git a/engines/hpl1/engine/graphics/Mesh2d.h b/engines/hpl1/engine/graphics/Mesh2d.h
index 92a26b0ddf2..7fd1bb98e91 100644
--- a/engines/hpl1/engine/graphics/Mesh2d.h
+++ b/engines/hpl1/engine/graphics/Mesh2d.h
@@ -108,5 +108,6 @@ private:
void CalculateEdges(eTileRotation aRotation, tVertexVec &aVtx, tUIntVec &aIdx);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MESH2D_H
diff --git a/engines/hpl1/engine/graphics/MeshCreator.h b/engines/hpl1/engine/graphics/MeshCreator.h
index 5df9574d8c5..646b6b9742b 100644
--- a/engines/hpl1/engine/graphics/MeshCreator.h
+++ b/engines/hpl1/engine/graphics/MeshCreator.h
@@ -60,5 +60,6 @@ private:
cResources *mpResources;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MESHCREATOR_H
diff --git a/engines/hpl1/engine/graphics/OcclusionQuery.h b/engines/hpl1/engine/graphics/OcclusionQuery.h
index d684968ccfe..cdf6f69551b 100644
--- a/engines/hpl1/engine/graphics/OcclusionQuery.h
+++ b/engines/hpl1/engine/graphics/OcclusionQuery.h
@@ -54,5 +54,6 @@ public:
virtual unsigned int GetSampleCount() = 0;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_OCCLUSION_QUERY_H
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter.h b/engines/hpl1/engine/graphics/ParticleEmitter.h
index 7bec1947953..2ca95f72758 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter.h
@@ -236,5 +236,6 @@ protected:
typedef std::map<tString, iParticleEmitterData *> tParticleEmitterDataMap;
typedef tParticleEmitterDataMap::iterator tParticleEmitterDataMapIt;
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_PARTICLE_EMITTER_H
diff --git a/engines/hpl1/engine/graphics/ParticleSystem3D.h b/engines/hpl1/engine/graphics/ParticleSystem3D.h
index caf95e3e950..45810003a60 100644
--- a/engines/hpl1/engine/graphics/ParticleSystem3D.h
+++ b/engines/hpl1/engine/graphics/ParticleSystem3D.h
@@ -143,5 +143,6 @@ private:
bool mbFirstUpdate;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_PARTICLE_SYSTEM_3D_H
diff --git a/engines/hpl1/engine/graphics/RenderList.h b/engines/hpl1/engine/graphics/RenderList.h
index 69425caa6b4..473a5f56797 100644
--- a/engines/hpl1/engine/graphics/RenderList.h
+++ b/engines/hpl1/engine/graphics/RenderList.h
@@ -218,5 +218,7 @@ private:
cGraphics *mpGraphics;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_RENDER_LIST_H
diff --git a/engines/hpl1/engine/graphics/RenderObject2D.h b/engines/hpl1/engine/graphics/RenderObject2D.h
index e12a3983245..ee0282d1ab1 100644
--- a/engines/hpl1/engine/graphics/RenderObject2D.h
+++ b/engines/hpl1/engine/graphics/RenderObject2D.h
@@ -72,5 +72,6 @@ private:
iRenderObject2DRenderer *mpCustomRenderer;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_RENDEROBJECT2D_H
diff --git a/engines/hpl1/engine/graphics/RenderState.h b/engines/hpl1/engine/graphics/RenderState.h
index 6c62ecbb30a..cdc8eba81da 100644
--- a/engines/hpl1/engine/graphics/RenderState.h
+++ b/engines/hpl1/engine/graphics/RenderState.h
@@ -281,5 +281,7 @@ public:
//Properties:
iRenderable *mpObject;
};*/
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_RENDER_SET_H
diff --git a/engines/hpl1/engine/graphics/Renderable.h b/engines/hpl1/engine/graphics/Renderable.h
index 1ecaac7d213..56c411b8f9d 100644
--- a/engines/hpl1/engine/graphics/Renderable.h
+++ b/engines/hpl1/engine/graphics/Renderable.h
@@ -148,5 +148,7 @@ protected:
bool mbRendered;
float mfZ;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_RENDERABLE_H
diff --git a/engines/hpl1/engine/graphics/Renderer2D.h b/engines/hpl1/engine/graphics/Renderer2D.h
index 2beb8a1b6a6..b0019cbf97d 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.h
+++ b/engines/hpl1/engine/graphics/Renderer2D.h
@@ -141,5 +141,6 @@ private:
inline bool ClipPoints(cVector3f *avPoint, cRect2f aRect, cVector2f avPos, float afSize);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_RENDERER2D_H
diff --git a/engines/hpl1/engine/graphics/Renderer3D.h b/engines/hpl1/engine/graphics/Renderer3D.h
index 64052bd925a..cfb80e0719e 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.h
+++ b/engines/hpl1/engine/graphics/Renderer3D.h
@@ -261,5 +261,6 @@ private:
tRendererDebugFlag mDebugFlags;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_RENDERER3D_H
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.h b/engines/hpl1/engine/graphics/RendererPostEffects.h
index 4379f01d46e..9cd34c93cc7 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.h
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.h
@@ -180,5 +180,6 @@ private:
bool mbActive;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_RENDERER_POST_EFFECTS_H
diff --git a/engines/hpl1/engine/graphics/Skeleton.h b/engines/hpl1/engine/graphics/Skeleton.h
index 5c1b9b8e920..41f9b63f6e3 100644
--- a/engines/hpl1/engine/graphics/Skeleton.h
+++ b/engines/hpl1/engine/graphics/Skeleton.h
@@ -66,5 +66,6 @@ private:
tBoneIdxNameMap m_mapBonesIdxByName;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SKELETON_H
diff --git a/engines/hpl1/engine/graphics/SubMesh.h b/engines/hpl1/engine/graphics/SubMesh.h
index 43327bc1c6b..9e8452e3b08 100644
--- a/engines/hpl1/engine/graphics/SubMesh.h
+++ b/engines/hpl1/engine/graphics/SubMesh.h
@@ -129,5 +129,6 @@ private:
cMesh *mpParent;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SUB_MESH_H
diff --git a/engines/hpl1/engine/graphics/Texture.h b/engines/hpl1/engine/graphics/Texture.h
index c7fb0efaaa7..e4a52354e1f 100644
--- a/engines/hpl1/engine/graphics/Texture.h
+++ b/engines/hpl1/engine/graphics/Texture.h
@@ -198,5 +198,7 @@ protected:
typedef std::vector<iTexture *> tTextureVec;
typedef tTextureVec::iterator tTextureVecIt;
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_TEXTURE_H
diff --git a/engines/hpl1/engine/graphics/VertexBuffer.h b/engines/hpl1/engine/graphics/VertexBuffer.h
index 5f79d52e8b9..33a8b07e913 100644
--- a/engines/hpl1/engine/graphics/VertexBuffer.h
+++ b/engines/hpl1/engine/graphics/VertexBuffer.h
@@ -169,5 +169,6 @@ protected:
bool mbTangents;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_RENDERER3D_H
diff --git a/engines/hpl1/engine/graphics/VideoStream.h b/engines/hpl1/engine/graphics/VideoStream.h
index 55cce5504f3..5de68d026f3 100644
--- a/engines/hpl1/engine/graphics/VideoStream.h
+++ b/engines/hpl1/engine/graphics/VideoStream.h
@@ -88,5 +88,7 @@ protected:
tString msFilePath;
cVector2l mvSize;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_VIDEO_STREAM_H
diff --git a/engines/hpl1/engine/graphics/bitmap2D.h b/engines/hpl1/engine/graphics/bitmap2D.h
index 5d65521b514..4ef51e7d611 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.h
+++ b/engines/hpl1/engine/graphics/bitmap2D.h
@@ -76,5 +76,6 @@ private:
typedef std::vector<Bitmap2D *> tBitmap2DVec;
typedef std::vector<Bitmap2D *>::iterator tBitmap2DVecIt;
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_BITMAP2D_H
diff --git a/engines/hpl1/engine/graphics/font_data.h b/engines/hpl1/engine/graphics/font_data.h
index 182c3944299..9250ad88716 100644
--- a/engines/hpl1/engine/graphics/font_data.h
+++ b/engines/hpl1/engine/graphics/font_data.h
@@ -172,5 +172,6 @@ private:
void loadNextGlyph(const TiXmlElement *charIt, Common::Array<Common::SharedPtr<Bitmap2D>> &bitmaps, const cVector2l &fontSize);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_FONTDATA_H
diff --git a/engines/hpl1/engine/gui/Gui.h b/engines/hpl1/engine/gui/Gui.h
index 20bc16967c3..9606fa3b17c 100644
--- a/engines/hpl1/engine/gui/Gui.h
+++ b/engines/hpl1/engine/gui/Gui.h
@@ -161,5 +161,6 @@ private:
unsigned long mlLastRenderTime;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_GUI_H
diff --git a/engines/hpl1/engine/gui/GuiGfxElement.h b/engines/hpl1/engine/gui/GuiGfxElement.h
index 587f0de07f6..f7e895429e8 100644
--- a/engines/hpl1/engine/gui/GuiGfxElement.h
+++ b/engines/hpl1/engine/gui/GuiGfxElement.h
@@ -133,5 +133,7 @@ private:
bool mbFlushed;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_GUI_GFX_ELEMENT_H
diff --git a/engines/hpl1/engine/gui/GuiMaterial.h b/engines/hpl1/engine/gui/GuiMaterial.h
index b20ed673a5d..0f1090837db 100644
--- a/engines/hpl1/engine/gui/GuiMaterial.h
+++ b/engines/hpl1/engine/gui/GuiMaterial.h
@@ -48,5 +48,6 @@ protected:
iLowLevelGraphics *mpLowLevelGraphics;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_GUI_MATERIAL_H
diff --git a/engines/hpl1/engine/gui/GuiMaterialBasicTypes.h b/engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
index 908e12a7ca3..c9ef9eb547a 100644
--- a/engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
+++ b/engines/hpl1/engine/gui/GuiMaterialBasicTypes.h
@@ -89,5 +89,6 @@ public:
//-----------------------------------------
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_GUI_MATERIAL_BASIC_TYPES_H
diff --git a/engines/hpl1/engine/gui/GuiPopUp.h b/engines/hpl1/engine/gui/GuiPopUp.h
index 964d5bc5163..ddebf8de5ca 100644
--- a/engines/hpl1/engine/gui/GuiPopUp.h
+++ b/engines/hpl1/engine/gui/GuiPopUp.h
@@ -47,5 +47,6 @@ protected:
cGuiSkin *mpSkin;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_FRAME_H
diff --git a/engines/hpl1/engine/gui/GuiPopUpMessageBox.h b/engines/hpl1/engine/gui/GuiPopUpMessageBox.h
index f239a4504d0..70fba6c01fa 100644
--- a/engines/hpl1/engine/gui/GuiPopUpMessageBox.h
+++ b/engines/hpl1/engine/gui/GuiPopUpMessageBox.h
@@ -58,5 +58,6 @@ protected:
tGuiCallbackFunc mpCallback;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_GUI_POP_UP_MESSAGE_BOX_H
diff --git a/engines/hpl1/engine/gui/GuiSet.h b/engines/hpl1/engine/gui/GuiSet.h
index 8bc36050e62..88dfb3f10f0 100644
--- a/engines/hpl1/engine/gui/GuiSet.h
+++ b/engines/hpl1/engine/gui/GuiSet.h
@@ -331,5 +331,6 @@ private:
bool mbDestroyingSet;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_GUI_SET_H
diff --git a/engines/hpl1/engine/gui/GuiSkin.h b/engines/hpl1/engine/gui/GuiSkin.h
index 99489d58e95..cfa01dd259e 100644
--- a/engines/hpl1/engine/gui/GuiSkin.h
+++ b/engines/hpl1/engine/gui/GuiSkin.h
@@ -79,5 +79,6 @@ private:
std::vector<cVector3f> mvAttributes;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_GUI_SKIN_H
diff --git a/engines/hpl1/engine/gui/Widget.h b/engines/hpl1/engine/gui/Widget.h
index c663c9f7961..4c90a4d2399 100644
--- a/engines/hpl1/engine/gui/Widget.h
+++ b/engines/hpl1/engine/gui/Widget.h
@@ -238,5 +238,6 @@ private:
bool mbPositionIsUpdated;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_H
diff --git a/engines/hpl1/engine/gui/WidgetBaseClasses.h b/engines/hpl1/engine/gui/WidgetBaseClasses.h
index d3d6e433f3b..a7cac7e23e4 100644
--- a/engines/hpl1/engine/gui/WidgetBaseClasses.h
+++ b/engines/hpl1/engine/gui/WidgetBaseClasses.h
@@ -54,5 +54,6 @@ protected:
//--------------------------------------
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_BASE_CLASSES_H
diff --git a/engines/hpl1/engine/gui/WidgetButton.h b/engines/hpl1/engine/gui/WidgetButton.h
index df3e6f0a2dc..64d66593947 100644
--- a/engines/hpl1/engine/gui/WidgetButton.h
+++ b/engines/hpl1/engine/gui/WidgetButton.h
@@ -71,5 +71,6 @@ protected:
cGuiGfxElement *mvGfxCornersDown[4];
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_BUTTON_H
diff --git a/engines/hpl1/engine/gui/WidgetCheckBox.h b/engines/hpl1/engine/gui/WidgetCheckBox.h
index ba86393ed98..db8a9194eb8 100644
--- a/engines/hpl1/engine/gui/WidgetCheckBox.h
+++ b/engines/hpl1/engine/gui/WidgetCheckBox.h
@@ -64,5 +64,6 @@ protected:
cGuiGfxElement *mvGfxBox[2][2];
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_CHECK_BOX_H
diff --git a/engines/hpl1/engine/gui/WidgetComboBox.h b/engines/hpl1/engine/gui/WidgetComboBox.h
index 9dd66f605ef..ed778572457 100644
--- a/engines/hpl1/engine/gui/WidgetComboBox.h
+++ b/engines/hpl1/engine/gui/WidgetComboBox.h
@@ -116,5 +116,6 @@ protected:
cGuiGfxElement *mvGfxCorners[4];
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_COMBO_BOX_H
diff --git a/engines/hpl1/engine/gui/WidgetFrame.h b/engines/hpl1/engine/gui/WidgetFrame.h
index 1ae08f2523f..905477baaab 100644
--- a/engines/hpl1/engine/gui/WidgetFrame.h
+++ b/engines/hpl1/engine/gui/WidgetFrame.h
@@ -78,5 +78,6 @@ protected:
cGuiGfxElement *mvGfxCorners[4];
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_FRAME_H
diff --git a/engines/hpl1/engine/gui/WidgetImage.h b/engines/hpl1/engine/gui/WidgetImage.h
index 52de304f54a..0aede07b53c 100644
--- a/engines/hpl1/engine/gui/WidgetImage.h
+++ b/engines/hpl1/engine/gui/WidgetImage.h
@@ -62,5 +62,6 @@ protected:
cColor mColor;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_IMAGE_H
diff --git a/engines/hpl1/engine/gui/WidgetLabel.h b/engines/hpl1/engine/gui/WidgetLabel.h
index 400ef3e08b9..fcbd551b291 100644
--- a/engines/hpl1/engine/gui/WidgetLabel.h
+++ b/engines/hpl1/engine/gui/WidgetLabel.h
@@ -69,5 +69,6 @@ protected:
int mlMaxCharacters;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_LABEL_H
diff --git a/engines/hpl1/engine/gui/WidgetListBox.h b/engines/hpl1/engine/gui/WidgetListBox.h
index a93afc666e4..e3e8220ee8d 100644
--- a/engines/hpl1/engine/gui/WidgetListBox.h
+++ b/engines/hpl1/engine/gui/WidgetListBox.h
@@ -95,5 +95,6 @@ protected:
cWidgetSlider *mpSlider;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_LIST_BOX_H
diff --git a/engines/hpl1/engine/gui/WidgetSlider.h b/engines/hpl1/engine/gui/WidgetSlider.h
index a79bd22c03d..db5e5a6c05c 100644
--- a/engines/hpl1/engine/gui/WidgetSlider.h
+++ b/engines/hpl1/engine/gui/WidgetSlider.h
@@ -115,5 +115,6 @@ protected:
cGuiGfxElement *mpGfxBackground;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_SLIDER_H
diff --git a/engines/hpl1/engine/gui/WidgetTextBox.h b/engines/hpl1/engine/gui/WidgetTextBox.h
index 5e774b8d9bb..330d13afc47 100644
--- a/engines/hpl1/engine/gui/WidgetTextBox.h
+++ b/engines/hpl1/engine/gui/WidgetTextBox.h
@@ -101,5 +101,6 @@ protected:
cGuiGfxElement *mvGfxCorners[4];
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_TEXT_BOX_H
diff --git a/engines/hpl1/engine/gui/WidgetWindow.h b/engines/hpl1/engine/gui/WidgetWindow.h
index dee0691260e..0864e421799 100644
--- a/engines/hpl1/engine/gui/WidgetWindow.h
+++ b/engines/hpl1/engine/gui/WidgetWindow.h
@@ -76,5 +76,6 @@ protected:
bool mbMoving;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WIDGET_H
diff --git a/engines/hpl1/engine/haptic/Haptic.h b/engines/hpl1/engine/haptic/Haptic.h
index a612e2a7efa..246ae8cae84 100644
--- a/engines/hpl1/engine/haptic/Haptic.h
+++ b/engines/hpl1/engine/haptic/Haptic.h
@@ -56,5 +56,6 @@ private:
static bool mbIsUsed;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_HAPTIC_H
diff --git a/engines/hpl1/engine/haptic/HapticForce.h b/engines/hpl1/engine/haptic/HapticForce.h
index 745a30b662b..4944577084f 100644
--- a/engines/hpl1/engine/haptic/HapticForce.h
+++ b/engines/hpl1/engine/haptic/HapticForce.h
@@ -57,5 +57,6 @@ protected:
eHapticForceType mType;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_HAPTIC_FORCE_H
diff --git a/engines/hpl1/engine/haptic/HapticShape.h b/engines/hpl1/engine/haptic/HapticShape.h
index 7acd6c5b9e9..93d7053be8e 100644
--- a/engines/hpl1/engine/haptic/HapticShape.h
+++ b/engines/hpl1/engine/haptic/HapticShape.h
@@ -84,5 +84,6 @@ protected:
int mlTransformCount;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_HAPTIC_SHAPE_H
diff --git a/engines/hpl1/engine/haptic/HapticSurface.h b/engines/hpl1/engine/haptic/HapticSurface.h
index 4f9e9664c46..9d850005409 100644
--- a/engines/hpl1/engine/haptic/HapticSurface.h
+++ b/engines/hpl1/engine/haptic/HapticSurface.h
@@ -47,5 +47,6 @@ private:
tString msName;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_HAPTIC_SURFACE_H
diff --git a/engines/hpl1/engine/haptic/HapticTypes.h b/engines/hpl1/engine/haptic/HapticTypes.h
index 3ce25296943..fd40b74d3b9 100644
--- a/engines/hpl1/engine/haptic/HapticTypes.h
+++ b/engines/hpl1/engine/haptic/HapticTypes.h
@@ -95,5 +95,6 @@ typedef cSTLIterator<iHapticShape *, tHapticShapeList, tHapticShapeListIt> cHapt
//----------------------------------------------
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_HAPTIC_TYPES_H
diff --git a/engines/hpl1/engine/haptic/LowLevelHaptic.h b/engines/hpl1/engine/haptic/LowLevelHaptic.h
index 9c5ebe36e89..641cf7b3a34 100644
--- a/engines/hpl1/engine/haptic/LowLevelHaptic.h
+++ b/engines/hpl1/engine/haptic/LowLevelHaptic.h
@@ -205,5 +205,6 @@ protected:
bool mbUpdateShapes;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_LOW_LEVEL_HAPTIC_H
diff --git a/engines/hpl1/engine/impl/CGProgram.h b/engines/hpl1/engine/impl/CGProgram.h
index 3839211214f..8466a163030 100644
--- a/engines/hpl1/engine/impl/CGProgram.h
+++ b/engines/hpl1/engine/impl/CGProgram.h
@@ -66,5 +66,7 @@ private:
tString msFile;
tString msEntry;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_CGPROGRAM_H
diff --git a/engines/hpl1/engine/impl/CharacterBodyNewton.h b/engines/hpl1/engine/impl/CharacterBodyNewton.h
index b259f0e6a2e..11751f1f359 100644
--- a/engines/hpl1/engine/impl/CharacterBodyNewton.h
+++ b/engines/hpl1/engine/impl/CharacterBodyNewton.h
@@ -42,5 +42,7 @@ public:
private:
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_CHARACTER_BODY_NEWTON_H
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.h b/engines/hpl1/engine/impl/CollideShapeNewton.h
index e5467a1dafb..146053684c4 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.h
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.h
@@ -65,5 +65,7 @@ private:
tCollideShapeVec mvSubShapes;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_COLLIDE_SHAPE_NEWTON_H
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
index c9ac621c7e3..0252fb11628 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
@@ -315,5 +315,7 @@ private:
// Vtx helper
void SetVtxBatchStates(tVtxBatchFlag flags);
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LOWLEVELGRAPHICS_SDL_H
diff --git a/engines/hpl1/engine/impl/LowLevelInputSDL.h b/engines/hpl1/engine/impl/LowLevelInputSDL.h
index 60c585b13fb..c04aaa2635b 100644
--- a/engines/hpl1/engine/impl/LowLevelInputSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelInputSDL.h
@@ -57,5 +57,7 @@ private:
Common::Array<Common::Event> _events;
iLowLevelGraphics *_lowLevelGraphics;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LOWLEVELINPUT_SDL_H
diff --git a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
index fd0ef4c51c7..ee1fa843fa0 100644
--- a/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
+++ b/engines/hpl1/engine/impl/LowLevelPhysicsNewton.h
@@ -40,5 +40,7 @@ public:
iPhysicsWorld *CreateWorld();
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LOWLEVELPHYSICS_NEWTON_H
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
index 02f7df02299..b987d85388d 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
@@ -79,5 +79,7 @@ private:
cOAL_Effect_Reverb *mpEffect;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LOWLEVELSOUND_OPENAL_H
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.h b/engines/hpl1/engine/impl/MeshLoaderCollada.h
index 33afe21a76b..d565f7888cd 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.h
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.h
@@ -552,5 +552,6 @@ private:
cVector3f GetVectorScaleFromPtr(float *apVec);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MESH_LOADER_COLLADA_H
diff --git a/engines/hpl1/engine/impl/MeshLoaderMSH.h b/engines/hpl1/engine/impl/MeshLoaderMSH.h
index 3d2e3096c5c..b4865c20398 100644
--- a/engines/hpl1/engine/impl/MeshLoaderMSH.h
+++ b/engines/hpl1/engine/impl/MeshLoaderMSH.h
@@ -69,5 +69,6 @@ private:
const char *GetVertexName(tVertexFlag aFlag);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MESH_LOADER_MSH_H
diff --git a/engines/hpl1/engine/impl/OcclusionQueryOGL.h b/engines/hpl1/engine/impl/OcclusionQueryOGL.h
index 19f2e2f8428..d2652ee10ab 100644
--- a/engines/hpl1/engine/impl/OcclusionQueryOGL.h
+++ b/engines/hpl1/engine/impl/OcclusionQueryOGL.h
@@ -47,5 +47,6 @@ public:
unsigned int mlQueryId;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_OCCLUSION_QUERY_H
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.h b/engines/hpl1/engine/impl/OpenALSoundChannel.h
index 3ae36b7320d..c7e8330f24b 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.h
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.h
@@ -87,5 +87,7 @@ private:
float mfPosition[3];
float mfVelocity[3];
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_OPENAL_CHANNEL_H
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.h b/engines/hpl1/engine/impl/OpenALSoundData.h
index a9c2109e950..423f8ad6f38 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.h
+++ b/engines/hpl1/engine/impl/OpenALSoundData.h
@@ -48,5 +48,7 @@ public:
private:
Common::String _filename;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_OPENAL_SOUND_DATA_H
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.h b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
index 0b093ae9521..dcad510bb88 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
@@ -126,5 +126,7 @@ private:
cVector3f mvTotalForce;
cVector3f mvTotalTorque;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_BODY_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsControllerNewton.h b/engines/hpl1/engine/impl/PhysicsControllerNewton.h
index 875fb1dfd91..653dd4da413 100644
--- a/engines/hpl1/engine/impl/PhysicsControllerNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsControllerNewton.h
@@ -39,5 +39,7 @@ public:
cPhysicsControllerNewton(const tString &asName, iPhysicsWorld *apWorld);
~cPhysicsControllerNewton();
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_CONTROLLER_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointBallNewton.h b/engines/hpl1/engine/impl/PhysicsJointBallNewton.h
index 4fe160cf847..f1decc69e13 100644
--- a/engines/hpl1/engine/impl/PhysicsJointBallNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointBallNewton.h
@@ -51,5 +51,7 @@ public:
private:
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_JOINT_BALL_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointHingeNewton.h b/engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
index f7964a95960..9593cfcfd0b 100644
--- a/engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointHingeNewton.h
@@ -55,5 +55,7 @@ private:
float mfPreviousAngle;
static unsigned LimitCallback(const NewtonJoint *pHinge, NewtonHingeSliderUpdateDesc *pDesc);
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_JOINT_HINGE_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointNewton.h b/engines/hpl1/engine/impl/PhysicsJointNewton.h
index e8d1ccee1b1..50e3470daa3 100644
--- a/engines/hpl1/engine/impl/PhysicsJointNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointNewton.h
@@ -91,5 +91,7 @@ protected:
NewtonBody *mpNewtonParentBody;
NewtonBody *mpNewtonChildBody;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_JOINT_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointScrewNewton.h b/engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
index 99c8c73c2ac..4bfb4c73d52 100644
--- a/engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointScrewNewton.h
@@ -54,5 +54,7 @@ public:
private:
static unsigned LimitCallback(const NewtonJoint *pSlider, NewtonHingeSliderUpdateDesc *pDesc);
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_JOINT_SCREW_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.h b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
index 01769da7158..8a553c0f7a6 100644
--- a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.h
@@ -54,5 +54,7 @@ public:
private:
static unsigned LimitCallback(const NewtonJoint *pSlider, NewtonHingeSliderUpdateDesc *pDesc);
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_JOINT_SLIDER_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.h b/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
index 552ab93f688..0af55f00409 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
@@ -78,5 +78,7 @@ private:
float mfStaticFriction;
float mfKineticFriction;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_MATERIAL_NEWTON_H
diff --git a/engines/hpl1/engine/impl/PhysicsWorldNewton.h b/engines/hpl1/engine/impl/PhysicsWorldNewton.h
index 84e85a593a7..9a003f10d12 100644
--- a/engines/hpl1/engine/impl/PhysicsWorldNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsWorldNewton.h
@@ -108,5 +108,7 @@ private:
ePhysicsAccuracy mAccuracy;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_WORLD_NEWTON_H
diff --git a/engines/hpl1/engine/impl/SDLTexture.h b/engines/hpl1/engine/impl/SDLTexture.h
index 8e527436e2d..5880b8c91c5 100644
--- a/engines/hpl1/engine/impl/SDLTexture.h
+++ b/engines/hpl1/engine/impl/SDLTexture.h
@@ -101,5 +101,6 @@ private:
cPBuffer *mpPBuffer;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SDL_TEXTURE_H
diff --git a/engines/hpl1/engine/impl/SqScript.h b/engines/hpl1/engine/impl/SqScript.h
index fc1bab36eae..fcffdfb5100 100644
--- a/engines/hpl1/engine/impl/SqScript.h
+++ b/engines/hpl1/engine/impl/SqScript.h
@@ -73,5 +73,7 @@ private:
char *LoadCharBuffer(const tString &asFileName, int &alLength);
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_SCRIPT_H
diff --git a/engines/hpl1/engine/impl/VertexBufferOGL.h b/engines/hpl1/engine/impl/VertexBufferOGL.h
index 3470fabbb36..39006e358ca 100644
--- a/engines/hpl1/engine/impl/VertexBufferOGL.h
+++ b/engines/hpl1/engine/impl/VertexBufferOGL.h
@@ -87,5 +87,6 @@ private:
bool mbHasShadowDouble;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_RENDERER3D_OGL_H
diff --git a/engines/hpl1/engine/impl/VertexBufferVBO.h b/engines/hpl1/engine/impl/VertexBufferVBO.h
index 2842a7b877a..b91216ba76b 100644
--- a/engines/hpl1/engine/impl/VertexBufferVBO.h
+++ b/engines/hpl1/engine/impl/VertexBufferVBO.h
@@ -94,5 +94,6 @@ private:
bool mbCompiled;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_RENDERER3D_VBO_H
diff --git a/engines/hpl1/engine/input/Action.h b/engines/hpl1/engine/input/Action.h
index 877b5c5936f..8945ea82c31 100644
--- a/engines/hpl1/engine/input/Action.h
+++ b/engines/hpl1/engine/input/Action.h
@@ -104,5 +104,6 @@ private:
double mfTimeCount;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_ACTION_H
diff --git a/engines/hpl1/engine/input/ActionHaptic.h b/engines/hpl1/engine/input/ActionHaptic.h
index 7c5931586c0..97dda2f98da 100644
--- a/engines/hpl1/engine/input/ActionHaptic.h
+++ b/engines/hpl1/engine/input/ActionHaptic.h
@@ -54,5 +54,6 @@ private:
cHaptic *mpHaptic;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_ACTIONMOUSEBUTTON_H
diff --git a/engines/hpl1/engine/input/ActionKeyboard.h b/engines/hpl1/engine/input/ActionKeyboard.h
index 1b81be9b8f2..0b3f0e74feb 100644
--- a/engines/hpl1/engine/input/ActionKeyboard.h
+++ b/engines/hpl1/engine/input/ActionKeyboard.h
@@ -55,5 +55,6 @@ private:
cInput *mpInput;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_ACTIONKEYBOARD_H
diff --git a/engines/hpl1/engine/input/ActionMouseButton.h b/engines/hpl1/engine/input/ActionMouseButton.h
index 34706bda324..e9685dd732b 100644
--- a/engines/hpl1/engine/input/ActionMouseButton.h
+++ b/engines/hpl1/engine/input/ActionMouseButton.h
@@ -53,5 +53,6 @@ private:
cInput *mpInput;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_ACTIONMOUSEBUTTON_H
diff --git a/engines/hpl1/engine/input/InputDevice.h b/engines/hpl1/engine/input/InputDevice.h
index 50b0b07ed35..801a7db5d5d 100644
--- a/engines/hpl1/engine/input/InputDevice.h
+++ b/engines/hpl1/engine/input/InputDevice.h
@@ -60,5 +60,6 @@ private:
eInputDeviceType mType;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_INPUTDEVICE_H
diff --git a/engines/hpl1/engine/input/LowLevelInput.h b/engines/hpl1/engine/input/LowLevelInput.h
index 9b592f05ba0..cef4f78d57c 100644
--- a/engines/hpl1/engine/input/LowLevelInput.h
+++ b/engines/hpl1/engine/input/LowLevelInput.h
@@ -55,5 +55,7 @@ public:
virtual iMouse *CreateMouse() = 0;
virtual iKeyboard *CreateKeyboard() = 0;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LOWLEVELINPUT_H
diff --git a/engines/hpl1/engine/math/BoundingVolume.h b/engines/hpl1/engine/math/BoundingVolume.h
index e5c55f0bd5f..db4f58d2f1a 100644
--- a/engines/hpl1/engine/math/BoundingVolume.h
+++ b/engines/hpl1/engine/math/BoundingVolume.h
@@ -129,5 +129,7 @@ private:
cShadowVolumeBV mShadowVolume;
bool mbShadowPlanesNeedUpdate;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_BOUNDING_VOLUME_H
diff --git a/engines/hpl1/engine/math/Frustum.h b/engines/hpl1/engine/math/Frustum.h
index 4680c5c3552..f0770fadcd4 100644
--- a/engines/hpl1/engine/math/Frustum.h
+++ b/engines/hpl1/engine/math/Frustum.h
@@ -119,5 +119,7 @@ private:
cVector3f mvEndPoints[4];
tVector3fVec mvPoints;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_FRUSTUM_H
diff --git a/engines/hpl1/engine/math/Math.h b/engines/hpl1/engine/math/Math.h
index ca13ec56cba..6f3331bd8ba 100644
--- a/engines/hpl1/engine/math/Math.h
+++ b/engines/hpl1/engine/math/Math.h
@@ -496,5 +496,6 @@ public:
bool *apIsDoubleSided);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATH_H
diff --git a/engines/hpl1/engine/math/MeshTypes.h b/engines/hpl1/engine/math/MeshTypes.h
index bdbd4f5973f..5e8fda2b11e 100644
--- a/engines/hpl1/engine/math/MeshTypes.h
+++ b/engines/hpl1/engine/math/MeshTypes.h
@@ -71,5 +71,6 @@ typedef tTriEdgeVec::iterator tTriEdgeVecIt;
//----------------------------------------------
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MESH_TYPES_H
diff --git a/engines/hpl1/engine/math/PidController.h b/engines/hpl1/engine/math/PidController.h
index 674d261f711..334a2cf876c 100644
--- a/engines/hpl1/engine/math/PidController.h
+++ b/engines/hpl1/engine/math/PidController.h
@@ -128,5 +128,7 @@ private:
typedef cPidController<float> cPidControllerf;
typedef cPidController<cVector3f> cPidControllerVec3;
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PID_CONTROLLER_H
diff --git a/engines/hpl1/engine/math/Quaternion.h b/engines/hpl1/engine/math/Quaternion.h
index 36f34dce172..425651a8f47 100644
--- a/engines/hpl1/engine/math/Quaternion.h
+++ b/engines/hpl1/engine/math/Quaternion.h
@@ -62,5 +62,7 @@ public:
private:
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_QUATERNION_H
diff --git a/engines/hpl1/engine/math/Spring.h b/engines/hpl1/engine/math/Spring.h
index b911fd36f76..98bdf654039 100644
--- a/engines/hpl1/engine/math/Spring.h
+++ b/engines/hpl1/engine/math/Spring.h
@@ -61,5 +61,7 @@ public:
typedef cSpring<float> cSpringf;
typedef cSpring<cVector3f> cSpringVec3;
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_SPRING_H
diff --git a/engines/hpl1/engine/math/Vector2.h b/engines/hpl1/engine/math/Vector2.h
index a9d785b83b8..53ec1cca7e8 100644
--- a/engines/hpl1/engine/math/Vector2.h
+++ b/engines/hpl1/engine/math/Vector2.h
@@ -234,5 +234,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_VECTOR2_H
diff --git a/engines/hpl1/engine/math/Vector3.h b/engines/hpl1/engine/math/Vector3.h
index af1fe7a7998..abf106f8785 100644
--- a/engines/hpl1/engine/math/Vector3.h
+++ b/engines/hpl1/engine/math/Vector3.h
@@ -345,5 +345,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_VECTOR3_H
diff --git a/engines/hpl1/engine/physics/Body2D.h b/engines/hpl1/engine/physics/Body2D.h
index 0b49b0007a4..8829c34530a 100644
--- a/engines/hpl1/engine/physics/Body2D.h
+++ b/engines/hpl1/engine/physics/Body2D.h
@@ -179,5 +179,7 @@ private:
void AddPosXY(cVector2f avPosAdd);
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_BODY_H
diff --git a/engines/hpl1/engine/physics/CharacterBody.h b/engines/hpl1/engine/physics/CharacterBody.h
index feefb3b6363..c48cd67f7a5 100644
--- a/engines/hpl1/engine/physics/CharacterBody.h
+++ b/engines/hpl1/engine/physics/CharacterBody.h
@@ -409,5 +409,7 @@ protected:
std::vector<iPhysicsBody *> mvExtraBodies;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_CHARACTER_BODY_H
diff --git a/engines/hpl1/engine/physics/CollideData.h b/engines/hpl1/engine/physics/CollideData.h
index dd17ef3a670..f8884a38ff5 100644
--- a/engines/hpl1/engine/physics/CollideData.h
+++ b/engines/hpl1/engine/physics/CollideData.h
@@ -53,5 +53,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_COLLIDE_DATA_H
diff --git a/engines/hpl1/engine/physics/CollideData2D.h b/engines/hpl1/engine/physics/CollideData2D.h
index 0d56d651ee8..c4aa7e24e18 100644
--- a/engines/hpl1/engine/physics/CollideData2D.h
+++ b/engines/hpl1/engine/physics/CollideData2D.h
@@ -60,5 +60,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_COLLIDE_DATA_2D_H
diff --git a/engines/hpl1/engine/physics/CollideShape.h b/engines/hpl1/engine/physics/CollideShape.h
index 35c0abb6a2a..5d8e6ee6da6 100644
--- a/engines/hpl1/engine/physics/CollideShape.h
+++ b/engines/hpl1/engine/physics/CollideShape.h
@@ -88,5 +88,7 @@ protected:
cBoundingVolume mBoundingVolume;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_COLLIDE_SHAPE_H
diff --git a/engines/hpl1/engine/physics/Collider2D.h b/engines/hpl1/engine/physics/Collider2D.h
index e7d93e28c8f..40e8a60f1a1 100644
--- a/engines/hpl1/engine/physics/Collider2D.h
+++ b/engines/hpl1/engine/physics/Collider2D.h
@@ -84,5 +84,6 @@ private:
float &afMin, float &afMax);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_COLLIDER2D_H
diff --git a/engines/hpl1/engine/physics/LowLevelPhysics.h b/engines/hpl1/engine/physics/LowLevelPhysics.h
index b784e629b1f..0e640ea3a4e 100644
--- a/engines/hpl1/engine/physics/LowLevelPhysics.h
+++ b/engines/hpl1/engine/physics/LowLevelPhysics.h
@@ -41,5 +41,7 @@ public:
virtual iPhysicsWorld *CreateWorld() = 0;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LOWLEVELPHYSICS_H
diff --git a/engines/hpl1/engine/physics/Physics.h b/engines/hpl1/engine/physics/Physics.h
index 0230baa0a80..7b0709a76ff 100644
--- a/engines/hpl1/engine/physics/Physics.h
+++ b/engines/hpl1/engine/physics/Physics.h
@@ -122,5 +122,6 @@ private:
bool mbLog;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_Physics_H
diff --git a/engines/hpl1/engine/physics/PhysicsBody.h b/engines/hpl1/engine/physics/PhysicsBody.h
index 9e4485ed29d..1ee0456447b 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.h
+++ b/engines/hpl1/engine/physics/PhysicsBody.h
@@ -332,5 +332,7 @@ protected:
bool mbCollide;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_BODY_H
diff --git a/engines/hpl1/engine/physics/PhysicsController.h b/engines/hpl1/engine/physics/PhysicsController.h
index 48634fa822d..5351e561f4c 100644
--- a/engines/hpl1/engine/physics/PhysicsController.h
+++ b/engines/hpl1/engine/physics/PhysicsController.h
@@ -228,5 +228,7 @@ protected:
bool mbLogInfo;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_CONTROLLER_H
diff --git a/engines/hpl1/engine/physics/PhysicsJoint.h b/engines/hpl1/engine/physics/PhysicsJoint.h
index 5818bf48d15..0ff1a058182 100644
--- a/engines/hpl1/engine/physics/PhysicsJoint.h
+++ b/engines/hpl1/engine/physics/PhysicsJoint.h
@@ -305,5 +305,7 @@ protected:
void LimitEffect(cJointLimitEffect *pEffect);
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_JOINT_H
diff --git a/engines/hpl1/engine/physics/PhysicsJointBall.h b/engines/hpl1/engine/physics/PhysicsJointBall.h
index 730e6f35dfc..cb2bcfa8659 100644
--- a/engines/hpl1/engine/physics/PhysicsJointBall.h
+++ b/engines/hpl1/engine/physics/PhysicsJointBall.h
@@ -74,5 +74,7 @@ protected:
float mfMaxTwistAngle;
cVector3f mvConePin;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_JOINT_BALL_H
diff --git a/engines/hpl1/engine/physics/PhysicsJointHinge.h b/engines/hpl1/engine/physics/PhysicsJointHinge.h
index b459880a892..13dd004f954 100644
--- a/engines/hpl1/engine/physics/PhysicsJointHinge.h
+++ b/engines/hpl1/engine/physics/PhysicsJointHinge.h
@@ -70,5 +70,7 @@ protected:
float mfMaxAngle;
float mfMinAngle;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_JOINT_HINGE_H
diff --git a/engines/hpl1/engine/physics/PhysicsJointScrew.h b/engines/hpl1/engine/physics/PhysicsJointScrew.h
index c74e3a5d54a..c017602d18e 100644
--- a/engines/hpl1/engine/physics/PhysicsJointScrew.h
+++ b/engines/hpl1/engine/physics/PhysicsJointScrew.h
@@ -79,5 +79,7 @@ protected:
cVector3f mvPin;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_JOINT_SCREW_H
diff --git a/engines/hpl1/engine/physics/PhysicsJointSlider.h b/engines/hpl1/engine/physics/PhysicsJointSlider.h
index 006bcb1ff96..17b9d167c6f 100644
--- a/engines/hpl1/engine/physics/PhysicsJointSlider.h
+++ b/engines/hpl1/engine/physics/PhysicsJointSlider.h
@@ -81,5 +81,7 @@ protected:
float mfMinDistance;
cVector3f mvPin;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_JOINT_SLIDER_H
diff --git a/engines/hpl1/engine/physics/PhysicsMaterial.h b/engines/hpl1/engine/physics/PhysicsMaterial.h
index 448ab073c80..24f7ab72b73 100644
--- a/engines/hpl1/engine/physics/PhysicsMaterial.h
+++ b/engines/hpl1/engine/physics/PhysicsMaterial.h
@@ -109,5 +109,7 @@ protected:
cSurfaceData *mpSurfaceData;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_MATERIAL_H
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.h b/engines/hpl1/engine/physics/PhysicsWorld.h
index 29eb7bfb0b3..4e5dea96296 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.h
+++ b/engines/hpl1/engine/physics/PhysicsWorld.h
@@ -267,5 +267,7 @@ protected:
tCollidePointVec mvContactPoints;
bool mbSaveContactPoints;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PHYSICS_WORLD_H
diff --git a/engines/hpl1/engine/physics/SurfaceData.h b/engines/hpl1/engine/physics/SurfaceData.h
index 36b417ef107..34ec1193eb7 100644
--- a/engines/hpl1/engine/physics/SurfaceData.h
+++ b/engines/hpl1/engine/physics/SurfaceData.h
@@ -202,5 +202,7 @@ protected:
iHapticSurface *mpHapticSurface;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_SURFACE_DATA_H
diff --git a/engines/hpl1/engine/resources/AnimationManager.h b/engines/hpl1/engine/resources/AnimationManager.h
index 810ca7898d3..bb497fcb8dc 100644
--- a/engines/hpl1/engine/resources/AnimationManager.h
+++ b/engines/hpl1/engine/resources/AnimationManager.h
@@ -52,5 +52,6 @@ private:
cResources *mpResources;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_ANIMATION_MANAGER_H
diff --git a/engines/hpl1/engine/resources/ConfigFile.h b/engines/hpl1/engine/resources/ConfigFile.h
index 63e4461b62c..7e4612f19d4 100644
--- a/engines/hpl1/engine/resources/ConfigFile.h
+++ b/engines/hpl1/engine/resources/ConfigFile.h
@@ -70,5 +70,6 @@ private:
const char *GetCharArray(tString asLevel, tString asName);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_CONFIGFILE_H
diff --git a/engines/hpl1/engine/resources/EntityLoader_Object.h b/engines/hpl1/engine/resources/EntityLoader_Object.h
index 2ffe1bbdcfd..5ab9ef919db 100644
--- a/engines/hpl1/engine/resources/EntityLoader_Object.h
+++ b/engines/hpl1/engine/resources/EntityLoader_Object.h
@@ -89,5 +89,6 @@ protected:
cMesh *mpMesh;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_ENTITY_LOADER_OBJECT_H
diff --git a/engines/hpl1/engine/resources/FileSearcher.h b/engines/hpl1/engine/resources/FileSearcher.h
index 5573c1e1476..794ebfcc5cd 100644
--- a/engines/hpl1/engine/resources/FileSearcher.h
+++ b/engines/hpl1/engine/resources/FileSearcher.h
@@ -70,5 +70,6 @@ private:
LowLevelResources *mpLowLevelResources;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_FILESEARCHER_H
diff --git a/engines/hpl1/engine/resources/FontManager.h b/engines/hpl1/engine/resources/FontManager.h
index e6c36b916b5..bb3e0859f55 100644
--- a/engines/hpl1/engine/resources/FontManager.h
+++ b/engines/hpl1/engine/resources/FontManager.h
@@ -63,5 +63,6 @@ private:
cGui *mpGui;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_FONT_MANAGER_H
diff --git a/engines/hpl1/engine/resources/FrameBase.h b/engines/hpl1/engine/resources/FrameBase.h
index 6996b506ddd..05d277c2c32 100644
--- a/engines/hpl1/engine/resources/FrameBase.h
+++ b/engines/hpl1/engine/resources/FrameBase.h
@@ -50,5 +50,6 @@ protected:
int mlPicCount;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_FRAMEBASE_H
diff --git a/engines/hpl1/engine/resources/FrameBitmap.h b/engines/hpl1/engine/resources/FrameBitmap.h
index b2dc0f70d4e..6b3e2f906ad 100644
--- a/engines/hpl1/engine/resources/FrameBitmap.h
+++ b/engines/hpl1/engine/resources/FrameBitmap.h
@@ -86,5 +86,6 @@ private:
bool mbIsLocked;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_FRAMEBITMAP_H
diff --git a/engines/hpl1/engine/resources/FrameTexture.h b/engines/hpl1/engine/resources/FrameTexture.h
index 286c9a930cf..a255fc422b2 100644
--- a/engines/hpl1/engine/resources/FrameTexture.h
+++ b/engines/hpl1/engine/resources/FrameTexture.h
@@ -47,5 +47,6 @@ private:
int mlHandle;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_FRAMETEXTURE_H
diff --git a/engines/hpl1/engine/resources/GpuProgramManager.h b/engines/hpl1/engine/resources/GpuProgramManager.h
index 765039c3c6c..2a6d30088a4 100644
--- a/engines/hpl1/engine/resources/GpuProgramManager.h
+++ b/engines/hpl1/engine/resources/GpuProgramManager.h
@@ -59,7 +59,6 @@ private:
iLowLevelGraphics *mpLowLevelGraphics;
};
+} // namespace hpl
-
-}; // namespace hpl
#endif // HPL_GPU_PROGRAM_MANAGER_H
diff --git a/engines/hpl1/engine/resources/ImageEntityManager.h b/engines/hpl1/engine/resources/ImageEntityManager.h
index 597f83761dc..9b50656c879 100644
--- a/engines/hpl1/engine/resources/ImageEntityManager.h
+++ b/engines/hpl1/engine/resources/ImageEntityManager.h
@@ -55,5 +55,6 @@ private:
tUIntVec mvImageHandle;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_IMAGE_ENTITY_MANAGER_H
diff --git a/engines/hpl1/engine/resources/ImageManager.h b/engines/hpl1/engine/resources/ImageManager.h
index 39d78f220ec..419f9ef373a 100644
--- a/engines/hpl1/engine/resources/ImageManager.h
+++ b/engines/hpl1/engine/resources/ImageManager.h
@@ -88,5 +88,6 @@ private:
cFrameBitmap *CreateBitmapFrame(cVector2l avSize);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_RESOURCEMANAGER_H
diff --git a/engines/hpl1/engine/resources/LanguageFile.h b/engines/hpl1/engine/resources/LanguageFile.h
index 62df9b9e21f..a40af26ee1e 100644
--- a/engines/hpl1/engine/resources/LanguageFile.h
+++ b/engines/hpl1/engine/resources/LanguageFile.h
@@ -77,5 +77,6 @@ private:
cResources *mpResources;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_LANGUAGE_FILE_H
diff --git a/engines/hpl1/engine/resources/MaterialManager.h b/engines/hpl1/engine/resources/MaterialManager.h
index ac61726afeb..f11c48e3f66 100644
--- a/engines/hpl1/engine/resources/MaterialManager.h
+++ b/engines/hpl1/engine/resources/MaterialManager.h
@@ -84,5 +84,6 @@ private:
int mlIdCounter;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MATERIAL_MANAGER_H
diff --git a/engines/hpl1/engine/resources/MeshLoader.h b/engines/hpl1/engine/resources/MeshLoader.h
index a43359e77e8..648fa2acd70 100644
--- a/engines/hpl1/engine/resources/MeshLoader.h
+++ b/engines/hpl1/engine/resources/MeshLoader.h
@@ -94,5 +94,6 @@ protected:
static tString msCacheDir;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MESH_LOADER_H
diff --git a/engines/hpl1/engine/resources/MeshLoaderHandler.h b/engines/hpl1/engine/resources/MeshLoaderHandler.h
index f5437e10feb..e5bea838929 100644
--- a/engines/hpl1/engine/resources/MeshLoaderHandler.h
+++ b/engines/hpl1/engine/resources/MeshLoaderHandler.h
@@ -73,5 +73,6 @@ private:
cScene *mpScene;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MESH_LOADER_HANDLER_H
diff --git a/engines/hpl1/engine/resources/MeshManager.h b/engines/hpl1/engine/resources/MeshManager.h
index bd6ec987540..39f54ebb9b3 100644
--- a/engines/hpl1/engine/resources/MeshManager.h
+++ b/engines/hpl1/engine/resources/MeshManager.h
@@ -52,5 +52,6 @@ private:
cResources *mpResources;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MESH_MANAGER_H
diff --git a/engines/hpl1/engine/resources/ParticleManager.h b/engines/hpl1/engine/resources/ParticleManager.h
index f901092c877..d8cab7290ff 100644
--- a/engines/hpl1/engine/resources/ParticleManager.h
+++ b/engines/hpl1/engine/resources/ParticleManager.h
@@ -81,5 +81,6 @@ private:
// tParticleSystemData3DMap m_mapData3D;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_PARTICLE_SYSTEM_MANAGER_H
diff --git a/engines/hpl1/engine/resources/ResourceBase.h b/engines/hpl1/engine/resources/ResourceBase.h
index 9ab5b23f7b3..9c092991630 100644
--- a/engines/hpl1/engine/resources/ResourceBase.h
+++ b/engines/hpl1/engine/resources/ResourceBase.h
@@ -91,5 +91,6 @@ protected:
bool mbLogDestruction;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_RESOURCEBASE_H
diff --git a/engines/hpl1/engine/resources/ResourceManager.h b/engines/hpl1/engine/resources/ResourceManager.h
index 8a0d56214e8..a9b90277f29 100644
--- a/engines/hpl1/engine/resources/ResourceManager.h
+++ b/engines/hpl1/engine/resources/ResourceManager.h
@@ -101,5 +101,6 @@ protected:
static int mlTabCount;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_RESOURCEMANAGER_H
diff --git a/engines/hpl1/engine/resources/Resources.h b/engines/hpl1/engine/resources/Resources.h
index 33e3d59283b..2661acb0db9 100644
--- a/engines/hpl1/engine/resources/Resources.h
+++ b/engines/hpl1/engine/resources/Resources.h
@@ -245,5 +245,6 @@ private:
tWString mwsEmptyString;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_RESOURCES_H
diff --git a/engines/hpl1/engine/resources/ResourcesTypes.h b/engines/hpl1/engine/resources/ResourcesTypes.h
index a00df275ce9..d2ac4f64fbc 100644
--- a/engines/hpl1/engine/resources/ResourcesTypes.h
+++ b/engines/hpl1/engine/resources/ResourcesTypes.h
@@ -35,5 +35,6 @@ namespace hpl {
// change to own file type?
//typedef FILE tFile;
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_RESOURCES_TYPES_H
diff --git a/engines/hpl1/engine/resources/ScriptManager.h b/engines/hpl1/engine/resources/ScriptManager.h
index c091ddef60a..a3508a4bca3 100644
--- a/engines/hpl1/engine/resources/ScriptManager.h
+++ b/engines/hpl1/engine/resources/ScriptManager.h
@@ -57,5 +57,6 @@ private:
cResources *mpResources;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SCRIPT_MANAGER_H
diff --git a/engines/hpl1/engine/resources/SoundEntityManager.h b/engines/hpl1/engine/resources/SoundEntityManager.h
index 34bdeb1dbe5..24e2a4525de 100644
--- a/engines/hpl1/engine/resources/SoundEntityManager.h
+++ b/engines/hpl1/engine/resources/SoundEntityManager.h
@@ -54,5 +54,6 @@ private:
cResources *mpResources;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SOUND_ENTITY_MANAGER_H
diff --git a/engines/hpl1/engine/resources/SoundManager.h b/engines/hpl1/engine/resources/SoundManager.h
index 18b521519f6..ba1b3015fd2 100644
--- a/engines/hpl1/engine/resources/SoundManager.h
+++ b/engines/hpl1/engine/resources/SoundManager.h
@@ -58,5 +58,6 @@ private:
iSoundData *FindData(const tString &asName, tString &asFilePath);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SOUND_MANAGER_H
diff --git a/engines/hpl1/engine/resources/TextureManager.h b/engines/hpl1/engine/resources/TextureManager.h
index c43fd7c0a49..743e594ad93 100644
--- a/engines/hpl1/engine/resources/TextureManager.h
+++ b/engines/hpl1/engine/resources/TextureManager.h
@@ -95,5 +95,6 @@ private:
cResources *mpResources;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_TEXTURE_MANAGER_H
diff --git a/engines/hpl1/engine/resources/TileSetManager.h b/engines/hpl1/engine/resources/TileSetManager.h
index 0ba33e712a7..73075364d4d 100644
--- a/engines/hpl1/engine/resources/TileSetManager.h
+++ b/engines/hpl1/engine/resources/TileSetManager.h
@@ -52,5 +52,6 @@ private:
cResources *mpResources;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_TILESET_MANAGER_H
diff --git a/engines/hpl1/engine/resources/VideoManager.h b/engines/hpl1/engine/resources/VideoManager.h
index b176335472d..6df2757ae1a 100644
--- a/engines/hpl1/engine/resources/VideoManager.h
+++ b/engines/hpl1/engine/resources/VideoManager.h
@@ -74,5 +74,6 @@ private:
tVideoStreamLoaderList mlstVideoLoaders;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_VIDEO_MANAGER_H
diff --git a/engines/hpl1/engine/resources/low_level_resources.h b/engines/hpl1/engine/resources/low_level_resources.h
index b95326d759e..8fecdb2afff 100644
--- a/engines/hpl1/engine/resources/low_level_resources.h
+++ b/engines/hpl1/engine/resources/low_level_resources.h
@@ -53,5 +53,7 @@ public:
private:
iLowLevelGraphics *_lowLevelGraphics;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LOWLEVELRESOURCES_H
diff --git a/engines/hpl1/engine/scene/AnimationState.h b/engines/hpl1/engine/scene/AnimationState.h
index 3981ea28a93..e83a3c18617 100644
--- a/engines/hpl1/engine/scene/AnimationState.h
+++ b/engines/hpl1/engine/scene/AnimationState.h
@@ -185,5 +185,6 @@ private:
float mfFadeStep;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_ANIMATION_STATE_H
diff --git a/engines/hpl1/engine/scene/Area2D.h b/engines/hpl1/engine/scene/Area2D.h
index deb5b4b7ccf..bf573751b05 100644
--- a/engines/hpl1/engine/scene/Area2D.h
+++ b/engines/hpl1/engine/scene/Area2D.h
@@ -63,5 +63,6 @@ private:
cVector3f mvCustom;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_AREA2D_H
diff --git a/engines/hpl1/engine/scene/Camera.h b/engines/hpl1/engine/scene/Camera.h
index 36c897681d7..0aaedc77fae 100644
--- a/engines/hpl1/engine/scene/Camera.h
+++ b/engines/hpl1/engine/scene/Camera.h
@@ -50,5 +50,6 @@ public:
virtual eCameraType GetType() = 0;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_CAMERA_H
diff --git a/engines/hpl1/engine/scene/Camera2D.h b/engines/hpl1/engine/scene/Camera2D.h
index ddedf0aff68..2bd4b424d80 100644
--- a/engines/hpl1/engine/scene/Camera2D.h
+++ b/engines/hpl1/engine/scene/Camera2D.h
@@ -72,5 +72,6 @@ private:
cVector2l mvClipArea;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_CAMERA2D_H
diff --git a/engines/hpl1/engine/scene/Camera3D.h b/engines/hpl1/engine/scene/Camera3D.h
index 8dcea7db762..a275e49e5c0 100644
--- a/engines/hpl1/engine/scene/Camera3D.h
+++ b/engines/hpl1/engine/scene/Camera3D.h
@@ -238,5 +238,6 @@ private:
bool mbMoveUpdated;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_CAMERA3D_H
diff --git a/engines/hpl1/engine/scene/ColliderEntity.h b/engines/hpl1/engine/scene/ColliderEntity.h
index a1c19035015..2fb64394b7d 100644
--- a/engines/hpl1/engine/scene/ColliderEntity.h
+++ b/engines/hpl1/engine/scene/ColliderEntity.h
@@ -68,5 +68,6 @@ private:
//-----------------------------------------------------------------------
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_COLLIDER_ENTITY_H
diff --git a/engines/hpl1/engine/scene/Entity.h b/engines/hpl1/engine/scene/Entity.h
index 4b5f5a8a904..0cc10e61b0b 100644
--- a/engines/hpl1/engine/scene/Entity.h
+++ b/engines/hpl1/engine/scene/Entity.h
@@ -91,5 +91,6 @@ typedef tEntityList::iterator tEntityListIt;
typedef cSTLIterator<iEntity *, tEntityList, tEntityListIt> cEntityIterator;
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_ENTITY2D_H
diff --git a/engines/hpl1/engine/scene/Entity2D.h b/engines/hpl1/engine/scene/Entity2D.h
index a0034332b44..f3d0ad4208f 100644
--- a/engines/hpl1/engine/scene/Entity2D.h
+++ b/engines/hpl1/engine/scene/Entity2D.h
@@ -77,5 +77,6 @@ protected:
typedef std::list<iEntity2D *> tEntity2DList;
typedef tEntity2DList::iterator tEntity2DListIt;
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_ENTITY2D_H
diff --git a/engines/hpl1/engine/scene/Entity3D.h b/engines/hpl1/engine/scene/Entity3D.h
index 5ab1bab8166..fe142c1db9c 100644
--- a/engines/hpl1/engine/scene/Entity3D.h
+++ b/engines/hpl1/engine/scene/Entity3D.h
@@ -168,5 +168,6 @@ private:
void UpdateWorldTransform();
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_ENTITY3D_H
diff --git a/engines/hpl1/engine/scene/GridMap2D.h b/engines/hpl1/engine/scene/GridMap2D.h
index 2f618ae7766..2e491afe4ab 100644
--- a/engines/hpl1/engine/scene/GridMap2D.h
+++ b/engines/hpl1/engine/scene/GridMap2D.h
@@ -198,5 +198,6 @@ private:
cVector2l mvMaxGridSpan;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_GRIDMAP2D_H
diff --git a/engines/hpl1/engine/scene/ImageEntity.h b/engines/hpl1/engine/scene/ImageEntity.h
index aadf9e38155..a58163c2de9 100644
--- a/engines/hpl1/engine/scene/ImageEntity.h
+++ b/engines/hpl1/engine/scene/ImageEntity.h
@@ -135,5 +135,6 @@ private:
typedef std::vector<cImageEntity *> tImageEntityVec;
typedef tImageEntityVec::iterator tImageEntityVecIt;
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_IMAGE_ENTITY_H
diff --git a/engines/hpl1/engine/scene/Light.h b/engines/hpl1/engine/scene/Light.h
index ad8c7b018cb..7c928359a33 100644
--- a/engines/hpl1/engine/scene/Light.h
+++ b/engines/hpl1/engine/scene/Light.h
@@ -153,5 +153,7 @@ protected:
float mfFlickerTime;
float mfFlickerStateLength;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LIGHT_H
diff --git a/engines/hpl1/engine/scene/Light2D.h b/engines/hpl1/engine/scene/Light2D.h
index ff8f2912534..51b4281523c 100644
--- a/engines/hpl1/engine/scene/Light2D.h
+++ b/engines/hpl1/engine/scene/Light2D.h
@@ -58,5 +58,7 @@ protected:
typedef std::list<iLight2D *> tLightList;
typedef tLightList::iterator tLightListIt;
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LIGHT2D_H
diff --git a/engines/hpl1/engine/scene/Light2DPoint.h b/engines/hpl1/engine/scene/Light2DPoint.h
index 5bbaf568d83..8ed6f52ca11 100644
--- a/engines/hpl1/engine/scene/Light2DPoint.h
+++ b/engines/hpl1/engine/scene/Light2DPoint.h
@@ -43,5 +43,6 @@ public:
int Render(iLowLevelGraphics *apLowLevel, int alFirstIndex);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_LIGHTPOINT2D_H
diff --git a/engines/hpl1/engine/scene/Light3D.h b/engines/hpl1/engine/scene/Light3D.h
index 360760c5d0f..8081c356893 100644
--- a/engines/hpl1/engine/scene/Light3D.h
+++ b/engines/hpl1/engine/scene/Light3D.h
@@ -222,5 +222,7 @@ protected:
typedef std::list<iLight3D *> tLight3DList;
typedef tLight3DList::iterator tLight3DListIt;
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LIGHT3D_H
diff --git a/engines/hpl1/engine/scene/Light3DPoint.h b/engines/hpl1/engine/scene/Light3DPoint.h
index 896699e039a..a214cc9cf95 100644
--- a/engines/hpl1/engine/scene/Light3DPoint.h
+++ b/engines/hpl1/engine/scene/Light3DPoint.h
@@ -62,5 +62,6 @@ private:
bool CreateClipRect(cRect2l &aCliprect, cRenderSettings *apRenderSettings, iLowLevelGraphics *apLowLevelGraphics);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_LIGHT3D_POINT_H
diff --git a/engines/hpl1/engine/scene/Light3DSpot.h b/engines/hpl1/engine/scene/Light3DSpot.h
index 2b21788c438..931e9add575 100644
--- a/engines/hpl1/engine/scene/Light3DSpot.h
+++ b/engines/hpl1/engine/scene/Light3DSpot.h
@@ -123,5 +123,6 @@ private:
int mlFrustumMatrixCount;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_LIGHT3D_SPOT_H
diff --git a/engines/hpl1/engine/scene/MeshEntity.h b/engines/hpl1/engine/scene/MeshEntity.h
index 0e827c0e3d0..eb31761968e 100644
--- a/engines/hpl1/engine/scene/MeshEntity.h
+++ b/engines/hpl1/engine/scene/MeshEntity.h
@@ -283,5 +283,6 @@ private:
//-----------------------------------------------------------------------
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MESH_ENTITY_H
diff --git a/engines/hpl1/engine/scene/MultiImageEntity.h b/engines/hpl1/engine/scene/MultiImageEntity.h
index fcfd4289448..70f91445db0 100644
--- a/engines/hpl1/engine/scene/MultiImageEntity.h
+++ b/engines/hpl1/engine/scene/MultiImageEntity.h
@@ -88,5 +88,6 @@ private:
bool mbFlipH;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MULTI_IMAGE_ENTITY_H
diff --git a/engines/hpl1/engine/scene/Node.h b/engines/hpl1/engine/scene/Node.h
index a78180bdb79..483b80e4f2a 100644
--- a/engines/hpl1/engine/scene/Node.h
+++ b/engines/hpl1/engine/scene/Node.h
@@ -85,5 +85,6 @@ protected:
bool mbActive;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_NODE_H
diff --git a/engines/hpl1/engine/scene/Node2D.h b/engines/hpl1/engine/scene/Node2D.h
index 0965d64c05c..9c020d459b2 100644
--- a/engines/hpl1/engine/scene/Node2D.h
+++ b/engines/hpl1/engine/scene/Node2D.h
@@ -56,5 +56,6 @@ private:
cVector3f mvScale;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_NODE2D_H
diff --git a/engines/hpl1/engine/scene/Node3D.h b/engines/hpl1/engine/scene/Node3D.h
index 75805236525..3d6c09248fb 100644
--- a/engines/hpl1/engine/scene/Node3D.h
+++ b/engines/hpl1/engine/scene/Node3D.h
@@ -123,5 +123,6 @@ private:
cNode3D *mpParent;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_NODE3D_H
diff --git a/engines/hpl1/engine/scene/NodeState.h b/engines/hpl1/engine/scene/NodeState.h
index 35febb34724..e2dcade37e4 100644
--- a/engines/hpl1/engine/scene/NodeState.h
+++ b/engines/hpl1/engine/scene/NodeState.h
@@ -42,5 +42,6 @@ public:
private:
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_NODE_STATE_H
diff --git a/engines/hpl1/engine/scene/PortalContainer.h b/engines/hpl1/engine/scene/PortalContainer.h
index 29865d2fed6..1c5808acabc 100644
--- a/engines/hpl1/engine/scene/PortalContainer.h
+++ b/engines/hpl1/engine/scene/PortalContainer.h
@@ -305,5 +305,7 @@ private:
int mlEntityIterateCount;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_PORTAL_CONTAINER_H
diff --git a/engines/hpl1/engine/scene/RenderableContainer.h b/engines/hpl1/engine/scene/RenderableContainer.h
index 3ed1514b133..bd51d40708e 100644
--- a/engines/hpl1/engine/scene/RenderableContainer.h
+++ b/engines/hpl1/engine/scene/RenderableContainer.h
@@ -67,5 +67,7 @@ public:
*/
virtual void Compile() = 0;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // RENDERABLE_CONTAINER
diff --git a/engines/hpl1/engine/scene/Scene.h b/engines/hpl1/engine/scene/Scene.h
index 93f5b49d483..59d2cfa6fa2 100644
--- a/engines/hpl1/engine/scene/Scene.h
+++ b/engines/hpl1/engine/scene/Scene.h
@@ -163,5 +163,6 @@ private:
tStringSet m_setLoadedMaps;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SCENE_H
diff --git a/engines/hpl1/engine/scene/SectorVisibility.h b/engines/hpl1/engine/scene/SectorVisibility.h
index d34219313c4..268c11c2263 100644
--- a/engines/hpl1/engine/scene/SectorVisibility.h
+++ b/engines/hpl1/engine/scene/SectorVisibility.h
@@ -178,5 +178,6 @@ private:
//----------------------------------------------------
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SECTOR_VISIBILTY_H
diff --git a/engines/hpl1/engine/scene/SoundEntity.h b/engines/hpl1/engine/scene/SoundEntity.h
index 46f50175045..1158fceaafc 100644
--- a/engines/hpl1/engine/scene/SoundEntity.h
+++ b/engines/hpl1/engine/scene/SoundEntity.h
@@ -166,5 +166,6 @@ private:
static tSoundEntityGlobalCallbackList mlstGobalCallbacks;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SOUND_ENTITY_H
diff --git a/engines/hpl1/engine/scene/SoundSource.h b/engines/hpl1/engine/scene/SoundSource.h
index 4ce0c437426..e0564baf055 100644
--- a/engines/hpl1/engine/scene/SoundSource.h
+++ b/engines/hpl1/engine/scene/SoundSource.h
@@ -90,5 +90,7 @@ private:
typedef std::list<cSoundSource *> tSoundSourceList;
typedef tSoundSourceList::iterator tSoundSourceListIt;
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_SOUNDSOURCE_H
diff --git a/engines/hpl1/engine/scene/SubMeshEntity.h b/engines/hpl1/engine/scene/SubMeshEntity.h
index a88ac8fef77..e3a34ba5949 100644
--- a/engines/hpl1/engine/scene/SubMeshEntity.h
+++ b/engines/hpl1/engine/scene/SubMeshEntity.h
@@ -180,5 +180,6 @@ typedef std::vector<cSubMeshEntity *>::iterator tSubMeshEntityVecIt;
typedef std::multimap<tString, cSubMeshEntity *> tSubMeshEntityMap;
typedef tSubMeshEntityMap::iterator tSubMeshEntityMapIt;
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SUB_MESH_ENTITY_H
diff --git a/engines/hpl1/engine/scene/Tile.h b/engines/hpl1/engine/scene/Tile.h
index e53f046b95b..9577652a204 100644
--- a/engines/hpl1/engine/scene/Tile.h
+++ b/engines/hpl1/engine/scene/Tile.h
@@ -74,5 +74,7 @@ private:
typedef std::list<cTile *> tTileList;
typedef tTileList::iterator tTileListIt;
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_TILE_H
diff --git a/engines/hpl1/engine/scene/TileData.h b/engines/hpl1/engine/scene/TileData.h
index 90b8092ba98..13cc2236325 100644
--- a/engines/hpl1/engine/scene/TileData.h
+++ b/engines/hpl1/engine/scene/TileData.h
@@ -111,5 +111,6 @@ private:
void SetMesh(cMesh2D *apMesh);
void SetMaterial(iMaterial *apMaterial);
};
-}; // namespace hpl
+
+} // namespace hpl
#endif // HPL_TILEDATA_H
diff --git a/engines/hpl1/engine/scene/TileLayer.h b/engines/hpl1/engine/scene/TileLayer.h
index 5029e0ef284..02d09999576 100644
--- a/engines/hpl1/engine/scene/TileLayer.h
+++ b/engines/hpl1/engine/scene/TileLayer.h
@@ -70,5 +70,6 @@ private:
eTileLayerType mType;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_TILELAYER_H
diff --git a/engines/hpl1/engine/scene/TileMap.h b/engines/hpl1/engine/scene/TileMap.h
index f043c2b28d4..31e8259e77f 100644
--- a/engines/hpl1/engine/scene/TileMap.h
+++ b/engines/hpl1/engine/scene/TileMap.h
@@ -96,5 +96,6 @@ private:
inline void RenderTileData(cTile *apTile, int alLayer);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_TILEMAP_H
diff --git a/engines/hpl1/engine/scene/TileMapIt.h b/engines/hpl1/engine/scene/TileMapIt.h
index 8ce62b34638..72f2b519170 100644
--- a/engines/hpl1/engine/scene/TileMapIt.h
+++ b/engines/hpl1/engine/scene/TileMapIt.h
@@ -42,5 +42,7 @@ public:
virtual int GetNum() = 0;
virtual int GetCurrentLayer() = 0;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_TILEMAP_IT_H
diff --git a/engines/hpl1/engine/scene/TileMapLineIt.h b/engines/hpl1/engine/scene/TileMapLineIt.h
index ec78f586633..be93dff89e1 100644
--- a/engines/hpl1/engine/scene/TileMapLineIt.h
+++ b/engines/hpl1/engine/scene/TileMapLineIt.h
@@ -78,5 +78,6 @@ private:
void GetXYIntersection(const cVector2f &avPosA, cVector2f *avXIntersect, cVector2f *avYIntersect);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_TILEMAP_LINE_IT_H
diff --git a/engines/hpl1/engine/scene/TileMapRectIt.h b/engines/hpl1/engine/scene/TileMapRectIt.h
index cf2ee5070df..67017ff3e54 100644
--- a/engines/hpl1/engine/scene/TileMapRectIt.h
+++ b/engines/hpl1/engine/scene/TileMapRectIt.h
@@ -73,5 +73,6 @@ private:
void GetTile();
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_TILEMAP_RECT_IT_H
diff --git a/engines/hpl1/engine/scene/TileSet.h b/engines/hpl1/engine/scene/TileSet.h
index 867b04b5467..d2e9f483ec7 100644
--- a/engines/hpl1/engine/scene/TileSet.h
+++ b/engines/hpl1/engine/scene/TileSet.h
@@ -74,5 +74,6 @@ private:
void GetTileNum(TiXmlElement *apElement);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_TILESET_H
diff --git a/engines/hpl1/engine/scene/World2D.h b/engines/hpl1/engine/scene/World2D.h
index bcb8bc351f8..840d8af3599 100644
--- a/engines/hpl1/engine/scene/World2D.h
+++ b/engines/hpl1/engine/scene/World2D.h
@@ -175,5 +175,6 @@ private:
int LoadTileData(cTile *apTile, tString *asData, int alStart);
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WOLRD2D_H
diff --git a/engines/hpl1/engine/scene/World3D.h b/engines/hpl1/engine/scene/World3D.h
index 9d8042d9efa..33113ade678 100644
--- a/engines/hpl1/engine/scene/World3D.h
+++ b/engines/hpl1/engine/scene/World3D.h
@@ -370,5 +370,6 @@ private:
cColor mAmbientColor;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_WOLRD3D_H
diff --git a/engines/hpl1/engine/sound/LowLevelSound.h b/engines/hpl1/engine/sound/LowLevelSound.h
index 33540b93b6e..94e14d452d9 100644
--- a/engines/hpl1/engine/sound/LowLevelSound.h
+++ b/engines/hpl1/engine/sound/LowLevelSound.h
@@ -115,5 +115,7 @@ protected:
tSoundEnvList mlstSoundEnv;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LOWLEVELSOUND_H
diff --git a/engines/hpl1/engine/sound/MusicHandler.h b/engines/hpl1/engine/sound/MusicHandler.h
index 639e09f913f..4a745ecdde7 100644
--- a/engines/hpl1/engine/sound/MusicHandler.h
+++ b/engines/hpl1/engine/sound/MusicHandler.h
@@ -126,5 +126,5 @@ private:
bool LoadAndStart(const tString &asFileName, cMusicEntry *apSong, float afVolume, bool abLoop);
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_MUSICHANDLER_H
diff --git a/engines/hpl1/engine/sound/Sound.h b/engines/hpl1/engine/sound/Sound.h
index 36ae262aa45..939e4043256 100644
--- a/engines/hpl1/engine/sound/Sound.h
+++ b/engines/hpl1/engine/sound/Sound.h
@@ -60,5 +60,5 @@ private:
cMusicHandler *mpMusicHandler;
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_SOUND_H
diff --git a/engines/hpl1/engine/sound/SoundChannel.h b/engines/hpl1/engine/sound/SoundChannel.h
index a5b38de2d7a..9239c3822f1 100644
--- a/engines/hpl1/engine/sound/SoundChannel.h
+++ b/engines/hpl1/engine/sound/SoundChannel.h
@@ -183,5 +183,7 @@ protected:
typedef std::list<iSoundChannel *> tSoundChannelList;
typedef tSoundChannelList::iterator tSoundChannelListIt;
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_SOUND_CHANNEL_H
diff --git a/engines/hpl1/engine/sound/SoundData.h b/engines/hpl1/engine/sound/SoundData.h
index ed31c993b34..3c5797aabff 100644
--- a/engines/hpl1/engine/sound/SoundData.h
+++ b/engines/hpl1/engine/sound/SoundData.h
@@ -64,5 +64,7 @@ protected:
bool mbLoopStream;
cSoundManager *mpSoundManger;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_SOUND_DATA_H
diff --git a/engines/hpl1/engine/sound/SoundEntityData.h b/engines/hpl1/engine/sound/SoundEntityData.h
index 3d6838920b6..e021e45c6ea 100644
--- a/engines/hpl1/engine/sound/SoundEntityData.h
+++ b/engines/hpl1/engine/sound/SoundEntityData.h
@@ -110,5 +110,7 @@ protected:
int mlPriority;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_SOUND_DATA_H
diff --git a/engines/hpl1/engine/sound/SoundHandler.h b/engines/hpl1/engine/sound/SoundHandler.h
index b4eee9021f7..9d34cfc8e64 100644
--- a/engines/hpl1/engine/sound/SoundHandler.h
+++ b/engines/hpl1/engine/sound/SoundHandler.h
@@ -205,5 +205,6 @@ private:
int mlIdCount;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SOUNDHANDLER_H
diff --git a/engines/hpl1/engine/system/BinTree.h b/engines/hpl1/engine/system/BinTree.h
index 09d1909b185..10998bfd652 100644
--- a/engines/hpl1/engine/system/BinTree.h
+++ b/engines/hpl1/engine/system/BinTree.h
@@ -226,5 +226,6 @@ private:
}
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_BINTREE_H
diff --git a/engines/hpl1/engine/system/Container.h b/engines/hpl1/engine/system/Container.h
index 10e258b0c49..3d110008e4a 100644
--- a/engines/hpl1/engine/system/Container.h
+++ b/engines/hpl1/engine/system/Container.h
@@ -260,5 +260,6 @@ public:
//---------------------------------
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_CONTAINER_H
diff --git a/engines/hpl1/engine/system/LogicTimer.h b/engines/hpl1/engine/system/LogicTimer.h
index 751eb27ec29..8c278057aba 100644
--- a/engines/hpl1/engine/system/LogicTimer.h
+++ b/engines/hpl1/engine/system/LogicTimer.h
@@ -91,5 +91,6 @@ private:
LowLevelSystem *mpLowLevelSystem;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_LOGICTIMER_H
diff --git a/engines/hpl1/engine/system/MemoryManager.h b/engines/hpl1/engine/system/MemoryManager.h
index 7b303d50b38..ddc07ee5bba 100644
--- a/engines/hpl1/engine/system/MemoryManager.h
+++ b/engines/hpl1/engine/system/MemoryManager.h
@@ -148,5 +148,6 @@ private:
//------------------------------------
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_MEMORY_MANAGER_H
diff --git a/engines/hpl1/engine/system/Script.h b/engines/hpl1/engine/system/Script.h
index a56730005c6..02d23357925 100644
--- a/engines/hpl1/engine/system/Script.h
+++ b/engines/hpl1/engine/system/Script.h
@@ -252,5 +252,7 @@ public:
virtual bool Run(int alHandle) = 0;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_SCRIPT_H
diff --git a/engines/hpl1/engine/system/String.h b/engines/hpl1/engine/system/String.h
index f31acdb49e3..42c4726685b 100644
--- a/engines/hpl1/engine/system/String.h
+++ b/engines/hpl1/engine/system/String.h
@@ -201,5 +201,6 @@ public:
private:
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_STRING_H
diff --git a/engines/hpl1/engine/system/System.h b/engines/hpl1/engine/system/System.h
index 513b73088a1..35c66397b29 100644
--- a/engines/hpl1/engine/system/System.h
+++ b/engines/hpl1/engine/system/System.h
@@ -51,5 +51,6 @@ private:
LowLevelSystem *mpLowLevelSystem;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SYSTEM_H
diff --git a/engines/hpl1/engine/system/SystemTypes.h b/engines/hpl1/engine/system/SystemTypes.h
index 50d0c12291f..5edb670918f 100644
--- a/engines/hpl1/engine/system/SystemTypes.h
+++ b/engines/hpl1/engine/system/SystemTypes.h
@@ -518,5 +518,6 @@ private:
CONT *mpCont;
};
-}; // namespace hpl
+} // namespace hpl
+
#endif // HPL_SYSTEM_TYPES_H
diff --git a/engines/hpl1/engine/system/low_level_system.h b/engines/hpl1/engine/system/low_level_system.h
index 56aeb9e8e57..52d37b05a36 100644
--- a/engines/hpl1/engine/system/low_level_system.h
+++ b/engines/hpl1/engine/system/low_level_system.h
@@ -142,5 +142,7 @@ private:
cScriptOutput *_scriptOutput;
int _handleCount;
};
-}; // namespace hpl
+
+} // namespace hpl
+
#endif // HPL_LOWLEVELSYSTEM_H
Commit: 28746360b6c81c54f62abf9daf2f668f4eba5aaf
https://github.com/scummvm/scummvm/commit/28746360b6c81c54f62abf9daf2f668f4eba5aaf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:48+01:00
Commit Message:
HPL1: Fix warnings
Changed paths:
engines/hpl1/engine/game/low_level_game_setup.cpp
engines/hpl1/engine/gui/GuiSet.cpp
engines/hpl1/engine/impl/CollideShapeNewton.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
engines/hpl1/engine/impl/MeshLoaderCollada.cpp
diff --git a/engines/hpl1/engine/game/low_level_game_setup.cpp b/engines/hpl1/engine/game/low_level_game_setup.cpp
index 0c0c8a77abd..1e8a92c177e 100644
--- a/engines/hpl1/engine/game/low_level_game_setup.cpp
+++ b/engines/hpl1/engine/game/low_level_game_setup.cpp
@@ -28,6 +28,7 @@
#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
#include "hpl1/engine/impl/MouseSDL.h"
+#include "hpl1/engine/haptic/LowLevelHaptic.h"
namespace hpl {
diff --git a/engines/hpl1/engine/gui/GuiSet.cpp b/engines/hpl1/engine/gui/GuiSet.cpp
index 6904c0fba3d..5989af5d6ac 100644
--- a/engines/hpl1/engine/gui/GuiSet.cpp
+++ b/engines/hpl1/engine/gui/GuiSet.cpp
@@ -377,7 +377,7 @@ void cGuiSet::DrawFont(const tWString &asText,
const cVector2f &avSize, const cColor &aColor,
eFontAlign aAlign, eGuiMaterial aMaterial) {
int lCount = 0;
- float lXAdd = 0;
+ //float lXAdd = 0;
cVector3f vPos = avPos;
if (aAlign == eFontAlign_Center) {
@@ -586,7 +586,7 @@ void cGuiSet::DestroyWidget(iWidget *apWidget) {
void cGuiSet::CreatePopUpMessageBox(const tWString &asLabel, const tWString &asText,
const tWString &asButton1, const tWString &asButton2,
void *apCallbackObject, tGuiCallbackFunc apCallback) {
- cGuiPopUpMessageBox *pMessageBox = hplNew(cGuiPopUpMessageBox, (this, asLabel, asText,
+ /* cGuiPopUpMessageBox *pMessageBox = */(void)hplNew(cGuiPopUpMessageBox, (this, asLabel, asText,
asButton1, asButton2,
apCallbackObject, apCallback));
}
@@ -835,7 +835,7 @@ void cGuiSet::RenderClipRegion() {
// Iterate for all with same texture and material
do {
cGuiRenderObject object = *it;
- cGuiGfxElement *pGfx = object.mpGfx;
+ pGfx = object.mpGfx;
if (kLogRender) {
if (pGfx->mvImages[0])
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.cpp b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
index c0e12d9f9a4..20f844dabe1 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.cpp
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
@@ -62,8 +62,7 @@ cCollideShapeNewton::cCollideShapeNewton(eCollideShapeType aType, const cVector3
////////////////////////////////////////////
// Create Newton collision
- switch(aType)
- {
+ switch(aType) {
case eCollideShapeType_Null: mpNewtonCollision = NewtonCreateNull(apNewtonWorld); break;
case eCollideShapeType_Box: mpNewtonCollision = NewtonCreateBox(apNewtonWorld,
@@ -81,6 +80,8 @@ cCollideShapeNewton::cCollideShapeNewton(eCollideShapeType aType, const cVector3
case eCollideShapeType_Capsule: mpNewtonCollision = NewtonCreateCapsule(apNewtonWorld,
mvSize.x, mvSize.y,
0, pMtx); break;
+ default:
+ break;
}
////////////////////////////////////////////
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 4374eba172b..2cbd4dbe62e 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -63,6 +63,7 @@ GLenum ColorFormatToGL(eColorDataFormat format) {
break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid color format (%d)", format);
+ return GL_RGB;
}
GLenum TextureTargetToGL(eTextureTarget target) {
@@ -81,6 +82,7 @@ GLenum TextureTargetToGL(eTextureTarget target) {
break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture target (%d)", target);
+ return GL_TEXTURE_1D;
}
cLowLevelGraphicsSDL::cLowLevelGraphicsSDL() {
@@ -863,7 +865,7 @@ void cLowLevelGraphicsSDL::SetStencilTwoSide(eStencilFunc aFrontFunc, eStencilFu
void cLowLevelGraphicsSDL::SetStencilTwoSide(bool abX) {
if (GetCaps(eGraphicCaps_TwoSideStencil))
- Hpl1::logError(Hpl1::kDebugOpenGL, "call to setStencilTwoSide with two side stencil enabled");
+ Hpl1::logError(Hpl1::kDebugOpenGL, "call to setStencilTwoSide with two side stencil enabled%c", ".");
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
index 0252fb11628..3fffbd82b9e 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
@@ -245,7 +245,7 @@ private:
int mlBpp;
// Gamma
- uint16 mvStartGammaArray[3][256];
+ //uint16 mvStartGammaArray[3][256];
float mfGammaCorrection;
// Clipping
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
index 88f58034154..fedce9dcca2 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
@@ -1711,8 +1711,8 @@ void cMeshLoaderCollada::AddSceneObjects(cColladaNode *apNode, cWorld3D *apWorld
// If no entity was loaded, try old style.
if (pEntity == NULL) {
- tString sName = vParams[1];
- tString sFile = cString::Sub(apNode->msName, 5 + (int)+sName.size() + 1);
+ sName = vParams[1];
+ sFile = cString::Sub(apNode->msName, 5 + (int)+sName.size() + 1);
sFile = cString::SetFileExt(sFile, "ent");
apWorld->CreateEntity(sName, apNode->m_mtxWorldTransform, sFile, true);
@@ -1827,7 +1827,7 @@ void cMeshLoaderCollada::AddSceneObjects(cColladaNode *apNode, cWorld3D *apWorld
Error("Too few params in billboard entity entity '%s'\n", apNode->msName.c_str());
} else {
tString sName = vParams[vParams.size() - 1];
- tString sType = "";
+ sType = "";
for (size_t i = 1; i < vParams.size() - 1; ++i) {
sType += vParams[i];
if (i != vParams.size() - 2)
@@ -1840,7 +1840,7 @@ void cMeshLoaderCollada::AddSceneObjects(cColladaNode *apNode, cWorld3D *apWorld
if (pPS == NULL) {
sName = vParams[1];
sType = cString::Sub(apNode->msName, 4 + (int)sName.size() + 1);
- cParticleSystem3D *pPS = apWorld->CreateParticleSystem(sName, sType, apNode->mvScale,
+ pPS = apWorld->CreateParticleSystem(sName, sType, apNode->mvScale,
apNode->m_mtxWorldTransform);
if (pPS == NULL) {
@@ -1872,7 +1872,6 @@ void cMeshLoaderCollada::AddSceneObjects(cColladaNode *apNode, cWorld3D *apWorld
TempBV.AddArrayPoints(&vVertexVec[0], (int)vArray.size());
TempBV.CreateFromPoints(3);
- tString sType;
tString sName;
if (vParams.size() < 3 || (mFlags & eWorldLoadFlag_NoGameEntities)) {
sType = "";
Commit: 4ce0626efb730365474dd2ec10a8acca6dca8677
https://github.com/scummvm/scummvm/commit/4ce0626efb730365474dd2ec10a8acca6dca8677
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:48+01:00
Commit Message:
HPL1: Fix more warnings
Changed paths:
engines/hpl1/engine/impl/MeshLoaderCollada.cpp
engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
engines/hpl1/engine/impl/OpenALSoundChannel.h
engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/VertexBufferOGL.cpp
engines/hpl1/engine/impl/VertexBufferVBO.cpp
engines/hpl1/engine/math/BoundingVolume.cpp
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
index fedce9dcca2..1731b78f84f 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
@@ -430,6 +430,8 @@ cMesh *cMeshLoaderCollada::LoadMesh(const tString &asFile, tMeshLoadFlag aFlags)
JointType = ePhysicsJointType_Slider;
else if (sJointType == "screw")
JointType = ePhysicsJointType_Screw;
+ else
+ error("Unknown JointType: %s", sJointType.c_str());
cMeshJoint *pJoint = pMesh->CreatePhysicsJoint(JointType);
@@ -937,7 +939,7 @@ cMesh *cMeshLoaderCollada::LoadMesh(const tString &asFile, tMeshLoadFlag aFlags)
if (pTrack == NULL)
continue;
if (pSkeleton) {
- cBone *pBone = pSkeleton->GetBoneByName(pTrack->GetName());
+ //cBone *pBone = pSkeleton->GetBoneByName(pTrack->GetName());
int lBoneIdx = pSkeleton->GetBoneIndexByName(pTrack->GetName());
pTrack->SetNodeIndex(lBoneIdx);
} else {
@@ -1097,7 +1099,7 @@ cAnimation *cMeshLoaderCollada::LoadAnimation(const tString &asFile) {
if (pTrack == NULL)
continue;
if (pSkeleton) {
- cBone *pBone = pSkeleton->GetBoneByName(pTrack->GetName());
+ //cBone *pBone = pSkeleton->GetBoneByName(pTrack->GetName());
int lBoneIdx = pSkeleton->GetBoneIndexByName(pTrack->GetName());
pTrack->SetNodeIndex(lBoneIdx);
} else {
@@ -1593,7 +1595,7 @@ cColliderEntity *cMeshLoaderCollada::CreateStaticCollider(cColladaNode *apNode,
// Haptic creation
if (cHaptic::GetIsUsed()) {
cHaptic *pHaptic = apWorld->GetHaptic();
- iHapticShape *pHShape = pHaptic->GetLowLevel()->CreateShapeFromPhysicsBody(apNode->msName, pBody);
+ /* iHapticShape *pHShape = */(void)pHaptic->GetLowLevel()->CreateShapeFromPhysicsBody(apNode->msName, pBody);
}
return apWorld->CreateColliderEntity(apNode->msName, pBody);
@@ -1667,8 +1669,8 @@ void cMeshLoaderCollada::AddSceneObjects(cColladaNode *apNode, cWorld3D *apWorld
cSoundEntity *pEntity = apWorld->CreateSoundEntity(sName, sFile, false);
if (pEntity == NULL) {
- tString sName = vParams[1];
- tString sFile = cString::Sub(apNode->msName, 7 + (int)+sName.size() + 1);
+ sName = vParams[1];
+ sFile = cString::Sub(apNode->msName, 7 + (int)+sName.size() + 1);
pEntity = apWorld->CreateSoundEntity(sName, sFile, false);
}
@@ -1728,7 +1730,7 @@ void cMeshLoaderCollada::AddSceneObjects(cColladaNode *apNode, cWorld3D *apWorld
if (vParams.size() < 3) {
Error("Too few params in ref entity '%s'\n", apNode->msName.c_str());
} else {
- tString sType = vParams[1];
+ sType = vParams[1];
tString sName = cString::Sub(apNode->msName, 6 + (int)sType.size() + 1);
apWorld->AddAINode(sName, sType, apNode->m_mtxWorldTransform.GetTranslation());
@@ -1790,7 +1792,7 @@ void cMeshLoaderCollada::AddSceneObjects(cColladaNode *apNode, cWorld3D *apWorld
Error("Too few params in billboard entity entity '%s'\n", apNode->msName.c_str());
} else {
cVector2f vSize(apNode->mvScale.x, apNode->mvScale.y);
- float fOffset = apNode->mvScale.z;
+ //float fOffset = apNode->mvScale.z;
tString sName = vParams[vParams.size() - 1];
tString sFile = "";
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
index 77e6d89e172..5e14ff2aad0 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
@@ -913,10 +913,10 @@ static void LoadControllerVec(TiXmlElement *apRootElem, tColladaControllerVec *a
return;
}
- int lSize = cString::ToInt(pControllerRootElem->Attribute("Size"), 0);
+ int lSize1 = cString::ToInt(pControllerRootElem->Attribute("Size"), 0);
apColladaControllerVec->clear();
- apColladaControllerVec->resize(lSize);
+ apColladaControllerVec->resize(lSize1);
int lCount = 0;
TiXmlElement *pControllerElem = pControllerRootElem->FirstChildElement();
@@ -1057,10 +1057,10 @@ static void LoadAnimationVec(TiXmlElement *apRootElem, tColladaAnimationVec *apC
return;
}
- int lSize = cString::ToInt(pAnimationRootElem->Attribute("Size"), 0);
+ int lSize1 = cString::ToInt(pAnimationRootElem->Attribute("Size"), 0);
apColladaAnimationVec->clear();
- apColladaAnimationVec->resize(lSize);
+ apColladaAnimationVec->resize(lSize1);
int lCount = 0;
TiXmlElement *pAnimationElem = pAnimationRootElem->FirstChildElement();
@@ -1135,10 +1135,10 @@ static void LoadAnimationVec(TiXmlElement *apRootElem, tColladaAnimationVec *apC
static void LoadGeometryVec(TiXmlElement *apRootElem, tColladaGeometryVec *apColladaGeometryVec) {
TiXmlElement *pGeometryRootElem = apRootElem->FirstChildElement("GeometryRoot");
- int lSize = cString::ToInt(pGeometryRootElem->Attribute("Size"), 0);
+ int lSize1 = cString::ToInt(pGeometryRootElem->Attribute("Size"), 0);
apColladaGeometryVec->clear();
- apColladaGeometryVec->resize(lSize);
+ apColladaGeometryVec->resize(lSize1);
int lCount = 0;
TiXmlElement *pGeometryElem = pGeometryRootElem->FirstChildElement();
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index c402da2584b..51e49e03aba 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -48,7 +48,7 @@ cOpenALSoundChannel::cOpenALSoundChannel(cOpenALSoundData *soundData, Audio::See
: iSoundChannel(soundData, apSoundManger), _playing(false), _audioStream(audioStream) {
Hpl1::logInfo(Hpl1::kDebugAudio, "creating sound channel form file %s\n", mpData->GetName().c_str());
if (!_audioStream)
- Hpl1::logError(Hpl1::kDebugAudio, "sound channel created with null audio stream\n");
+ Hpl1::logError(Hpl1::kDebugAudio, "sound channel created with null audio stream%s", ".");
#if 0
mlChannel = alChannel;
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.h b/engines/hpl1/engine/impl/OpenALSoundChannel.h
index c7e8330f24b..8d250471b4c 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.h
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.h
@@ -82,10 +82,10 @@ private:
Audio::SoundHandle _handle;
bool _playing;
Audio::SeekableAudioStream* _audioStream;
- int mlDefaultFreq;
+ //int mlDefaultFreq;
- float mfPosition[3];
- float mfVelocity[3];
+ //float mfPosition[3];
+ //float mfVelocity[3];
};
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
index 573f63d1a4a..f5c0222f762 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
@@ -376,11 +376,11 @@ bool cPhysicsBodyNewton::GetGravity() const {
//-----------------------------------------------------------------------
-static iLowLevelGraphics *gpLowLevelGraphics;
+//static iLowLevelGraphics *gpLowLevelGraphics;
static cColor gDebugColor;
////////////////////////////////////////////
-
+/*
static void RenderDebugPolygon(const NewtonBody *apNewtonBody,
int alVertexCount, const dFloat *apFaceVertex, int alId) {
int i;
@@ -395,7 +395,7 @@ static void RenderDebugPolygon(const NewtonBody *apNewtonBody,
vP0 = vP1;
}
}
-
+*/
////////////////////////////////////////////
void cPhysicsBodyNewton::RenderDebugGeometry(iLowLevelGraphics *apLowLevel, const cColor &aColor) {
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index 8003c72b415..cfdfbad577b 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -79,7 +79,7 @@ cSDLTexture::cSDLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt,
mpPBuffer = NULL;
if (aType == eTextureType_RenderTarget) {
- Hpl1::logError(Hpl1::kDebugGraphics, "use of render target");
+ Hpl1::logError(Hpl1::kDebugGraphics, "use of render target%s", ".");
// mpPBuffer = hplNew( cPBuffer, (mpLowLevelGraphics,true) );
}
@@ -528,7 +528,7 @@ bool cSDLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
// Log("OldSize: %d x %d ",mlWidth,mlHeight);
int lOldW = _width;
- int lOldH = _height;
+ //int lOldH = _height;
int lSizeDiv = (int)pow((float)2, (int)mlSizeLevel);
diff --git a/engines/hpl1/engine/impl/VertexBufferOGL.cpp b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
index 24d8aa45f21..73dfd5a2a0a 100644
--- a/engines/hpl1/engine/impl/VertexBufferOGL.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
@@ -275,9 +275,11 @@ iVertexBuffer *cVertexBufferOGL::CreateCopy(eVertexBufferUsageType aUsageType) {
// Copy the vertices to the new buffer.
for (int i = 0; i < klNumOfVertexFlags; i++) {
if (kvVertexFlags[i] & mVertexFlags) {
+#if 0
int lElements = kvVertexElements[i];
if (mbTangents && kvVertexFlags[i] == eVertexFlag_Texture1)
lElements = 4;
+#endif
pVtxBuff->ResizeArray(kvVertexFlags[i], (int)mvVertexArray[i].size());
diff --git a/engines/hpl1/engine/impl/VertexBufferVBO.cpp b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
index 46bab4aa0b8..dbae87d8740 100644
--- a/engines/hpl1/engine/impl/VertexBufferVBO.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
@@ -410,9 +410,11 @@ iVertexBuffer *cVertexBufferVBO::CreateCopy(eVertexBufferUsageType aUsageType) {
// Copy the vertices to the new buffer.
for (int i = 0; i < klNumOfVertexFlags; i++) {
if (kvVertexFlags[i] & mVertexFlags) {
+#if 0
int lElements = kvVertexElements[i];
if (mbTangents && kvVertexFlags[i] == eVertexFlag_Texture1)
lElements = 4;
+#endif
pVtxBuff->ResizeArray(kvVertexFlags[i], (int)mvVertexArray[i].size());
diff --git a/engines/hpl1/engine/math/BoundingVolume.cpp b/engines/hpl1/engine/math/BoundingVolume.cpp
index e9efbe7999b..4173df593d7 100644
--- a/engines/hpl1/engine/math/BoundingVolume.cpp
+++ b/engines/hpl1/engine/math/BoundingVolume.cpp
@@ -112,13 +112,13 @@ bool cShadowVolumeBV::CollideBVAABB(cBoundingVolume *aBV) {
// Go through all the planes
for (int i = 0; i < mlPlaneCount; i++) {
int lInCount = 9;
- bool bIsIn = true;
+ //bool bIsIn = true;
for (int j = 0; j < 9; j++) {
float fDist = cMath::PlaneToPointDist(mvPlanes[i], vCorners[j]);
if (fDist < 0) {
lInCount--;
- bIsIn = false;
+ //bIsIn = false;
}
}
@@ -286,7 +286,7 @@ cShadowVolumeBV *cBoundingVolume::GetShadowVolume(const cVector3f &avLightPos,
/////////////////////////////////////////////////////////////////////
// Iterate the faces and check which ones are facing the light.
- int lNearPoint = -1;
+ //int lNearPoint = -1;
mShadowVolume.mlPlaneCount = 0;
for (int face = 0; face < 6; face++) {
gvFaces[face].facingLight = cMath::Vector3Dot(gvFaces[face].normal,
Commit: 1b75f03005009c1597113835142743ae960579d5
https://github.com/scummvm/scummvm/commit/1b75f03005009c1597113835142743ae960579d5
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:48+01:00
Commit Message:
HPL1: correct types in fragment shaders
This matches what is used in the game's shaders
Changed paths:
engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot_pass2.fragment
engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass1.fragment
engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot_pass2.fragment
index 771da361b1f..9c6564c779f 100644
--- a/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot_pass2.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot_pass2.fragment
@@ -13,7 +13,7 @@ in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
in vec3 vHalfVec;
-in vec3 vSpotlightUv;
+in vec4 vSpotlightUv;
OUTPUT
@@ -32,7 +32,7 @@ void main()
vec3 lightVec = (2.0*textureCube(tex2,vLightDir)-vec4(1.0)).xyz;
vHalfVec = (2.0*textureCube(tex2,vHalfVec)-vec4(1.0)).xyz;
- vec4 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.z); // CHECK
+ vec4 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.w);
float specular = clamp(dot(vHalfVec, bumpVec.xyz), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w * clamp(bumpVec.w, 0.0, 1.0) * clamp(spotColor.w, 0.0, 1.0);
diff --git a/engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
index 9cac7c0bd93..df761abd756 100644
--- a/engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
+++ b/engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
@@ -13,7 +13,7 @@
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
-in vec3 vSpotlightUv;
+in vec4 vSpotlightUv;
OUTPUT
@@ -27,6 +27,6 @@ void main() {
vec3 bumpVec = (2.0 * texture(tex1, vUv) - vec4(1.0)).xyz;
vec3 lightVec = (2.0 * textureCube(tex2, vLightDir) - vec4(1.0)).xyz;
vec3 spotColor =
- texture(tex3, vSpotlightUv.xy / vSpotlightUv.z).xyz; // CHECK
+ texture(tex3, vSpotlightUv.xy / vSpotlightUv.w).xyz; // CHECK
outColor.xyz = diffuse * dot(lightVec, bumpVec) * vLightColor.xyz * spotColor;
}
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
index 4de51f3c225..173d373e03a 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
@@ -13,7 +13,7 @@ in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
in vec3 vHalfVec;
-in vec3 vSpotlightUv;
+in vec4 vSpotlightUv;
OUTPUT
@@ -31,7 +31,7 @@ void main()
vHalfVec = normalize(vHalfVec);//(2*textureCube(tex2,vHalfVec)-1).xyz;
float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
- vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.z);
+ vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.w);
float rejectNeg = texture1D(tex5,vSpotlightUv.z + 0.5).x;
float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
index 34f50579276..5b01a0caa32 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
@@ -13,7 +13,7 @@ in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
in vec3 vHalfVec;
-in vec3 vSpotlightUv;
+in vec4 vSpotlightUv;
OUTPUT
@@ -28,7 +28,7 @@ void main()
vec3 lightNormal = (2.0*textureCube(tex2,vLightDir)-vec4(1.0)).xyz;
vHalfVec = (2.0*textureCube(tex2,vHalfVec)-vec4(1.0)).xyz;
- vec4 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.z);
+ vec4 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.w);
float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w * spotColor.w;
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass1.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass1.fragment
index dca5955c0f8..c2591f2e239 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass1.fragment
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass1.fragment
@@ -12,7 +12,7 @@
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
-in vec3 vSpotlightUv;
+in vec4 vSpotlightUv;
OUTPUT
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
index 69fb89bcf3a..5b645905b46 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
@@ -12,7 +12,7 @@
in vec4 vLightColor;
in vec2 vUv;
in vec3 vLightDir;
-in vec3 vSpotlightUv;
+in vec4 vSpotlightUv;
OUTPUT
@@ -24,7 +24,7 @@ void main()
{
vec3 diffuse = texture(tex0, vUv).xyz;
vec3 lightNormal = (2.0*textureCube(tex2,vLightDir)-vec4(1.0)).xyz;
- vec3 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.z).xyz;
+ vec3 spotColor = texture(tex3, vSpotlightUv.xy / vSpotlightUv.w).xyz;
outColor.xyz = diffuse * dot(lightNormal, vec3(0,0,1)) * vLightColor.xyz * spotColor;
}
Commit: d62a0bfc3936e334bbe240d862b3d1682b1841c0
https://github.com/scummvm/scummvm/commit/d62a0bfc3936e334bbe240d862b3d1682b1841c0
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:48+01:00
Commit Message:
HPL1: fix setMatrixf method in shader class
Changed paths:
engines/hpl1/engine/impl/CGProgram.cpp
diff --git a/engines/hpl1/engine/impl/CGProgram.cpp b/engines/hpl1/engine/impl/CGProgram.cpp
index 0532bb7d6f0..70c3fbc88c4 100644
--- a/engines/hpl1/engine/impl/CGProgram.cpp
+++ b/engines/hpl1/engine/impl/CGProgram.cpp
@@ -130,20 +130,21 @@ bool cCGProgram::SetVec4f(const tString &asName, float afX, float afY, float afZ
bool cCGProgram::SetMatrixf(const tString &asName, const cMatrixf &mMtx) {
Math::Matrix4 mat4;
mat4.setData(mMtx.v);
+ mat4.transpose();
_shader->setUniform(asName.c_str(), mat4);
return true;
}
//-----------------------------------------------------------------------
-//TODO: replace with normal setmatrix
+
bool cCGProgram::SetMatrixf(const tString &asName, eGpuProgramMatrix mType,
eGpuProgramMatrixOp mOp) {
if (mType != eGpuProgramMatrix_ViewProjection)
error("unsupported shader matrix %d", mOp);
- cMatrixf modelView, projection;
- glGetFloatv(GL_PROJECTION_MATRIX, projection.v);
- glGetFloatv(GL_MODELVIEW_MATRIX, modelView.v);
- SetMatrixf(asName, cMath::MatrixMul(modelView, projection));
+ Math::Matrix4 modelView, projection;
+ glGetFloatv(GL_PROJECTION_MATRIX, projection.getData());
+ glGetFloatv(GL_MODELVIEW_MATRIX, modelView.getData());
+ _shader->setUniform(asName.c_str(), modelView * projection);
return true;
}
Commit: 22186b423bf42b85a0cab9be31f0016087d16972
https://github.com/scummvm/scummvm/commit/22186b423bf42b85a0cab9be31f0016087d16972
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:48+01:00
Commit Message:
HPL1: cleanup shader code
Changed paths:
engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
engines/hpl1/engine/impl/shaders/PostEffect_DoF.fragment
engines/hpl1/engine/impl/shaders/PostEffect_Motion.fragment
engines/hpl1/engine/impl/shaders/ShadowExtrude.vertex
engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
engines/hpl1/engine/impl/shaders/Water_Fog.vertex
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
index 6bf4ee1a068..56b4a2a1596 100644
--- a/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
@@ -19,7 +19,6 @@ OUTPUT
uniform sampler2D tex0; //diffuseMap
uniform sampler2D tex1; //normalMap
-uniform samplerCube tex2; //normalCubeMap
uniform sampler1D tex3; //falloffMap
uniform sampler2D tex4; //spotlightMap
uniform sampler1D tex5; //spotNegRejectMap
@@ -31,8 +30,8 @@ void main()
vec4 bumpVec = texture(tex1, vUv);
bumpVec.xyz = (2.0*bumpVec.xyz)-vec3(1.0);
- vec3 lightVec = normalize(vLightDir);//(2*textureCube(tex2,vLightDir)-1).xyz;
- vec3 normHalfVec = normalize(vHalfVec);//(2*textureCube(tex2,vHalfVec)-1).xyz;
+ vec3 lightVec = normalize(vLightDir);
+ vec3 normHalfVec = normalize(vHalfVec);
float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.w);
diff --git a/engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
index df761abd756..ff781cd92ef 100644
--- a/engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
+++ b/engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
@@ -27,6 +27,6 @@ void main() {
vec3 bumpVec = (2.0 * texture(tex1, vUv) - vec4(1.0)).xyz;
vec3 lightVec = (2.0 * textureCube(tex2, vLightDir) - vec4(1.0)).xyz;
vec3 spotColor =
- texture(tex3, vSpotlightUv.xy / vSpotlightUv.w).xyz; // CHECK
+ texture(tex3, vSpotlightUv.xy / vSpotlightUv.w).xyz;
outColor.xyz = diffuse * dot(lightVec, bumpVec) * vLightColor.xyz * spotColor;
}
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
index 47565445ff8..2634fb9cd79 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
@@ -17,15 +17,14 @@ in vec3 vHalfVec;
OUTPUT
uniform sampler2D tex0; //diffuseMap
-uniform samplerCube tex2; //normalCubeMap
uniform sampler1D tex3; //falloffMap
void main()
{
float attenuation = texture1D(tex3, dot(vLightDir,vLightDir)).x;
- vLightDir = normalize(vLightDir);//(2*textureCube(tex2,vLightDir)-1).xyz;
- vHalfVec = normalize(vHalfVec);//(2*textureCube(tex2,vHalfVec)-1).xyz;
+ vLightDir = normalize(vLightDir);
+ vHalfVec = normalize(vHalfVec);
float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w;
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
index c5d944fef0f..d38d70b51db 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
@@ -43,10 +43,9 @@ void main()
//Get the halfvector for the specular term
vHalfVec = normalize(EyePos - position.xyz);
- //vHalfVec = normalize( normalize(EyePos) + normalize(lightDir));
//transform to tangent space
vHalfVec = (rotation * vHalfVec);
- vHalfVec = normalize(vLightDir)+vHalfVec;//normalize(vHalfVec + normalize(vLightDir));
+ vHalfVec = normalize(vLightDir)+vHalfVec;
vLightColor = LightColor;
}
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
index 173d373e03a..3cc2646af44 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
@@ -18,7 +18,6 @@ in vec4 vSpotlightUv;
OUTPUT
uniform sampler2D tex0; //diffuseMap
-uniform samplerCube tex2; //normalCubeMap
uniform sampler1D tex3; //falloffMap
uniform sampler2D tex4; //spotlightMap
uniform sampler1D tex5; //spotNegRejectMap
@@ -27,8 +26,8 @@ void main()
{
vec3 diffuse = texture(tex0, vUv).xyz;
- vec3 lightNormal = normalize(vLightDir);//(2*textureCube(tex2,vLightDir)-1).xyz;
- vHalfVec = normalize(vHalfVec);//(2*textureCube(tex2,vHalfVec)-1).xyz;
+ vec3 lightNormal = normalize(vLightDir);
+ vHalfVec = normalize(vHalfVec);
float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.w);
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Solid.vertex b/engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
index 6048550efb8..9f8c06ebb4b 100644
--- a/engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
@@ -25,12 +25,7 @@ void main()
{
gl_Position = (worldViewProj * position);
- /*vUv.x =0;
- vColor.xyz = (fogEnd - gl_Position.z)/(fogEnd - fogStart);*/
vUv = (fogEnd - gl_Position.z)/(fogEnd - fogStart);
vColor.xyz = fogColor;
vColor.w = 1;
- /*outColor = 1;
- vUv = uv;
- //vUv = (fogEnd - gl_Position.z)/(fogEnd - fogStart);*/
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_DoF.fragment b/engines/hpl1/engine/impl/shaders/PostEffect_DoF.fragment
index e78dce43d6c..3c75a928b5f 100644
--- a/engines/hpl1/engine/impl/shaders/PostEffect_DoF.fragment
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_DoF.fragment
@@ -33,5 +33,4 @@ void main()
blur = clamp(blur, 0.0, maxBlur);
outColor = texture2DRect(tex0,gl_FragCoord.xy) * (1.0-blur) + texture(tex1,gl_FragCoord.xy/screenSize) *blur;
- //outColor = 1 - blur;
}
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Motion.fragment b/engines/hpl1/engine/impl/shaders/PostEffect_Motion.fragment
index 3dc341aba0c..5289ae8d3c4 100644
--- a/engines/hpl1/engine/impl/shaders/PostEffect_Motion.fragment
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Motion.fragment
@@ -39,10 +39,4 @@ void main()
}
outColor = a;
- //outColor.xy = 0.5 + velocity *0.005;
- //outColor.z = 1;
-
- //outColor.xyz = (1 + velocity) *0.5;
-
- //outColor = texture2DRect(tex0, wpos + velocity);
}
diff --git a/engines/hpl1/engine/impl/shaders/ShadowExtrude.vertex b/engines/hpl1/engine/impl/shaders/ShadowExtrude.vertex
index bc18f42f827..627998c565e 100644
--- a/engines/hpl1/engine/impl/shaders/ShadowExtrude.vertex
+++ b/engines/hpl1/engine/impl/shaders/ShadowExtrude.vertex
@@ -11,13 +11,10 @@
vec4 position = gl_Vertex;
-//out vec3 outColor;
-
uniform mat4 worldViewProj;
uniform vec3 lightPosition;
void main()
{
gl_Position = (worldViewProj * vec4((position.xyz - lightPosition*(1.0-position.w)), position.w));
- //outColor = vec3(0.1,0,0.1);
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex b/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
index 54fdc4c72f2..a9b28a14a74 100644
--- a/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
+++ b/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
@@ -13,7 +13,6 @@ vec4 position = gl_Vertex;
vec3 color = gl_Color.xyz;
vec3 uv = gl_MultiTexCoord0.xyz;
-
out vec3 vColor;
out vec3 vUv;
diff --git a/engines/hpl1/engine/impl/shaders/Water_Fog.vertex b/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
index bccc905375d..32bc86fc465 100644
--- a/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
+++ b/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
@@ -13,7 +13,6 @@ vec4 position = gl_Vertex;
vec4 color = gl_Color;
vec3 uv = gl_MultiTexCoord0.xyz;
-
out vec4 vColor
out vec3 vUv;
out float vFogUv;
Commit: c7301270e5b34d5cbe3cbc73b3cb9d5580fd0d53
https://github.com/scummvm/scummvm/commit/c7301270e5b34d5cbe3cbc73b3cb9d5580fd0d53
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:48+01:00
Commit Message:
HPL1: fix shader getter in material additive
Changed paths:
engines/hpl1/engine/graphics/Material_Additive.cpp
diff --git a/engines/hpl1/engine/graphics/Material_Additive.cpp b/engines/hpl1/engine/graphics/Material_Additive.cpp
index fe5e5b9e9d2..ef79bf32185 100644
--- a/engines/hpl1/engine/graphics/Material_Additive.cpp
+++ b/engines/hpl1/engine/graphics/Material_Additive.cpp
@@ -91,7 +91,9 @@ cMaterial_Additive::~cMaterial_Additive() {
//-----------------------------------------------------------------------
iGpuProgram *cMaterial_Additive::getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
- return _fogShader;
+ if (mpRenderSettings->mbFogActive)
+ return _fogShader;
+ return nullptr;
}
iMaterialProgramSetup *cMaterial_Additive::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
Commit: 6765ad7b767e4cd3fdb9cf56d5ffd48f19c2a6bf
https://github.com/scummvm/scummvm/commit/6765ad7b767e4cd3fdb9cf56d5ffd48f19c2a6bf
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:48+01:00
Commit Message:
HPL1: fix color output in vertex shader
The out variables that were specified as COLOR were implicitly clamped.
Changed paths:
engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
engines/hpl1/engine/impl/shaders/Water_Fog.vertex
engines/hpl1/engine/impl/shaders/refract.vertex
engines/hpl1/engine/impl/shaders/refract_water.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex b/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
index c320f952e0b..0b0f6ee0ceb 100644
--- a/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
@@ -43,6 +43,6 @@ void main()
gl_Position = worldViewProj * position;
- vColor = LightColor;
+ vColor = clamp(LightColor, vec4(0.0), vec4(1.0));
vUv = uv;
}
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex b/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
index 645a607da8e..a97898b0ce3 100644
--- a/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
@@ -61,7 +61,7 @@ void main()
gl_Position = worldViewProj * position;
- vColor = LightColor;
+ vColor = clamp(LightColor, vec4(0.0), vec4(1.0));
vUv = uv;
}
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
index d38d70b51db..dab0117033c 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
@@ -47,5 +47,5 @@ void main()
vHalfVec = (rotation * vHalfVec);
vHalfVec = normalize(vLightDir)+vHalfVec;
- vLightColor = LightColor;
+ vLightColor = clamp(LightColor, vec4(0.0), vec4(1.0));
}
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
index 3def8eb7b85..a6bd3176f73 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
@@ -53,5 +53,5 @@ void main()
vHalfVec = (rotation * vHalfVec);
vHalfVec = normalize(vLightDir)+vHalfVec;
- vLightColor = LightColor;
+ vLightColor = clamp(LightColor, vec4(0.0), vec4(1.0));
}
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
index 24ed7690ff7..7795338f126 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
@@ -21,6 +21,6 @@ uniform mat4 worldViewProj;
void main()
{
gl_Position = worldViewProj * position;
- vColor = color;
+ vColor = clamp(color, vec4(0.0), vec4(1.0));
vUv = uv;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
index 15d2e0139cf..ecf89634cf4 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
@@ -24,7 +24,7 @@ void main()
{
gl_Position = worldViewProj * position;
- vColor = color * colorMul;
+ vColor = clamp(color * colorMul, vec3(0.0), vec3(1.0));
vUv = uv;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
index 2e4f3ecb359..3a98110f9bd 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
@@ -26,7 +26,7 @@ void main()
{
gl_Position = (worldViewProj * position);
- vColor = color;
+ vColor = clamp(color, vec3(0.0), vec3(1.0));
mat3 rotation = mat3(objectWorldMatrix);
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
index c1bf6817ef0..f95192547c0 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
@@ -39,5 +39,5 @@ void main()
//Transform the lightdir
vLightDir = (rotation * vLightDir);
- vLightColor = LightColor;
+ vLightColor = clamp(LightColor, vec4(0.0), vec4(1.0));
}
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
index 9ad03237738..21521bee7fc 100644
--- a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
@@ -43,5 +43,5 @@ void main()
//Transform the lightdir
vLightDir = (rotation * vLightDir);
- vLightColor = LightColor;
+ vLightColor = clamp(LightColor, vec4(0.0), vec4(1.0));
}
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
index be2774f3159..6bf5f1b2e04 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
@@ -34,5 +34,5 @@ void main()
vSpotlightUv = (spotViewProj * position);
vRejectUv.x = vSpotlightUv.z + 0.5;
- vLightColor = LightColor;
+ vLightColor = clamp(LightColor, vec4(0.0), vec4(1.0));
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
index 519fc832286..d5aa381e982 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
@@ -29,5 +29,5 @@ void main()
vUv = uv;
- vLightColor = LightColor;
+ vLightColor = clamp(LightColor, vec4(0.0), vec4(1.0));
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
index 7cc7f49638c..5dbabc78d3d 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
@@ -32,5 +32,5 @@ void main()
vec4 spotlightUv = (spotViewProj * position);
vRejectUv.x = spotlightUv.z + 0.5;
- vLightColor = LightColor;
+ vLightColor = clamp(LightColor, vec4(0.0), vec4(1.0));
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
index c48840213d1..a814f34e1b0 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
@@ -32,5 +32,5 @@ void main()
vUv = uv;
vSpotlightUv = (spotViewProj * position);
- vLightColor = LightColor;
+ vLightColor = clamp(LightColor, vec4(0.0), vec4(1.0));
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
index 38d0c447254..7431d5ceca7 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
@@ -38,5 +38,5 @@ void main()
//Transform the lightdir
vLightDir = (rotation * vLightDir);
- vColor = 1;
+ vColor = vec4(1.0);
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
index 519fc832286..d5aa381e982 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
@@ -29,5 +29,5 @@ void main()
vUv = uv;
- vLightColor = LightColor;
+ vLightColor = clamp(LightColor, vec4(0.0), vec4(1.0));
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Solid.vertex b/engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
index 9f8c06ebb4b..605a02c8e52 100644
--- a/engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
@@ -26,6 +26,6 @@ void main()
gl_Position = (worldViewProj * position);
vUv = (fogEnd - gl_Position.z)/(fogEnd - fogStart);
- vColor.xyz = fogColor;
+ vColor.xyz = clamp(fogColor, vec3(0.0), vec3(1.0));
vColor.w = 1;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Trans.vertex b/engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
index 8cf8f510de8..bcaa1e5f2cf 100644
--- a/engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
@@ -27,5 +27,5 @@ void main()
vUv = uv.xy;
vFogUv = (fogEnd - gl_Position.z)/(fogEnd - fogStart);
- vColor = color;
+ vColor = clamp(color, vec4(0.0), vec4(1.0));
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex b/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
index 487d55324d2..49ee4a111a3 100644
--- a/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
@@ -23,7 +23,7 @@ uniform mat4 worldViewProj;
void main()
{
gl_Position = (worldViewProj * position);
- vColor = color;
+ vColor = clamp(color, vec3(0.0), vec3(1.0));
vUv0 = uv0;
vUv1 = uv1;
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex b/engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
index a39f2f9135c..809add5a6a7 100644
--- a/engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
+++ b/engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
@@ -27,7 +27,7 @@ uniform float amount;
void main()
{
gl_Position = (worldViewProj * position);
- vColor = color;
+ vColor = clamp(color, vec3(0.0), vec3(1.0));
vUv0 = uv + vec2(xOffset, yOffset) * amount;
vUv1 = uv + vec2(xOffset, yOffset) * 2.0 * amount;
vUv2 = uv - vec2(xOffset, yOffset) * amount;
diff --git a/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex b/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
index a9b28a14a74..bed05771b2e 100644
--- a/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
+++ b/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
@@ -29,7 +29,7 @@ void main()
gl_Position.y += sin(timeCount*speed + (position.x)*freq)*amp;
gl_Position.y += sin(timeCount*speed + (position.z)*freq)*amp;
- vColor = color;
+ vColor = clamp(color, vec3(0.0), vec3(1.0));
vUv = uv;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Water_Fog.vertex b/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
index 32bc86fc465..0b042a94798 100644
--- a/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
+++ b/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
@@ -35,5 +35,5 @@ void main()
vUv = uv;
vFogUv = (fogEnd - gl_Position.z)/(fogEnd - fogStart);
- vColor = color;
+ vColor = clamp(color, vec4(0.0), vec4(1.0));
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/refract.vertex b/engines/hpl1/engine/impl/shaders/refract.vertex
index ac45f65db33..4295f670eca 100644
--- a/engines/hpl1/engine/impl/shaders/refract.vertex
+++ b/engines/hpl1/engine/impl/shaders/refract.vertex
@@ -22,7 +22,7 @@ void main()
{
gl_Position = (worldViewProj * position);
- vColor = color;
+ vColor = clamp(color, vec4(0.0), vec4(1.0));
vUv = uv;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/refract_water.vertex b/engines/hpl1/engine/impl/shaders/refract_water.vertex
index 7456ae26168..d9c39e46ed8 100644
--- a/engines/hpl1/engine/impl/shaders/refract_water.vertex
+++ b/engines/hpl1/engine/impl/shaders/refract_water.vertex
@@ -27,7 +27,7 @@ void main()
{
gl_Position = (worldViewProj * position);
- outColor = color;
+ vColor = clamp(color, vec4(0.0), vec4(1.0));
vUv = uv;
Commit: 775f18cfc14a903c88965d41798904b19ac08d75
https://github.com/scummvm/scummvm/commit/775f18cfc14a903c88965d41798904b19ac08d75
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:48+01:00
Commit Message:
HPL1: fix fog shaders
the engine used GL_LUMINANCE and GL_LUMINANCE_ALPHA
this has been changed to GL_R and GL_RG
Changed paths:
engines/hpl1/engine/impl/shaders/Fog_Solid.fragment
engines/hpl1/engine/impl/shaders/Fog_Trans_Mod.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Solid.fragment b/engines/hpl1/engine/impl/shaders/Fog_Solid.fragment
index bcc512ab654..ef7863f6f53 100644
--- a/engines/hpl1/engine/impl/shaders/Fog_Solid.fragment
+++ b/engines/hpl1/engine/impl/shaders/Fog_Solid.fragment
@@ -18,5 +18,5 @@ uniform sampler1D tex0; //diffuseMap;
void main()
{
- outColor = texture1D(tex0, vUv) * vColor;
+ outColor = texture1D(tex0, vUv).rrrg * vColor;
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Trans_Mod.fragment b/engines/hpl1/engine/impl/shaders/Fog_Trans_Mod.fragment
index 5647cbbecf9..3d5743dad2b 100644
--- a/engines/hpl1/engine/impl/shaders/Fog_Trans_Mod.fragment
+++ b/engines/hpl1/engine/impl/shaders/Fog_Trans_Mod.fragment
@@ -21,7 +21,7 @@ uniform sampler1D tex1; //fogMap
void main()
{
vec4 diffuse = texture(tex0, vUv);
- float alpha = texture1D(tex1, vFogUv).w;
+ float alpha = texture1D(tex1, vFogUv).g;
outColor.xyz = diffuse.xyz * alpha + vec3(1.0 - alpha);
outColor.w = diffuse.w;
}
\ No newline at end of file
Commit: b9a3a6bc193d63f05dedeed0561c08097602ea41
https://github.com/scummvm/scummvm/commit/b9a3a6bc193d63f05dedeed0561c08097602ea41
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:49+01:00
Commit Message:
HPL1: fix opengl errors in texture class
Changed paths:
engines/hpl1/engine/impl/SDLTexture.cpp
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index cfdfbad577b..691b878a461 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -620,10 +620,11 @@ void cSDLTexture::PostCreation(GLenum aGLTarget) {
}
GL_CHECK_FN();
GL_CHECK(glTexParameteri(aGLTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
- GL_CHECK(glTexParameteri(aGLTarget, GL_TEXTURE_WRAP_S, GL_REPEAT));
- GL_CHECK(glTexParameteri(aGLTarget, GL_TEXTURE_WRAP_T, GL_REPEAT));
- GL_CHECK(glTexParameteri(aGLTarget, GL_TEXTURE_WRAP_R, GL_REPEAT));
-
+ if (aGLTarget != GL_TEXTURE_RECTANGLE) {
+ GL_CHECK(glTexParameteri(aGLTarget, GL_TEXTURE_WRAP_S, GL_REPEAT));
+ GL_CHECK(glTexParameteri(aGLTarget, GL_TEXTURE_WRAP_T, GL_REPEAT));
+ GL_CHECK(glTexParameteri(aGLTarget, GL_TEXTURE_WRAP_R, GL_REPEAT));
+ }
GL_CHECK(glDisable(aGLTarget));
mbContainsData = true;
Commit: 24eca8b7a1a0072d1ac3e54b20218d747bbf0cce
https://github.com/scummvm/scummvm/commit/24eca8b7a1a0072d1ac3e54b20218d747bbf0cce
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:49+01:00
Commit Message:
HPL1: fix opengl errors and improve formatting
Changed paths:
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 2cbd4dbe62e..f24982f6c0a 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -30,19 +30,19 @@
#include "hpl1/engine/graphics/font_data.h"
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
-#include "hpl1/engine/impl/CGProgram.h"
#include "hpl1/engine/graphics/bitmap2D.h"
#include "hpl1/engine/graphics/font_data.h"
+#include "hpl1/engine/impl/CGProgram.h"
#include "hpl1/engine/impl/SDLTexture.h"
#include "hpl1/engine/impl/VertexBufferOGL.h"
#include "hpl1/engine/impl/VertexBufferVBO.h"
#include "hpl1/engine/system/low_level_system.h"
-#include "hpl1/engine/impl/OcclusionQueryOGL.h"
#include "common/algorithm.h"
-#include "engines/util.h"
#include "common/system.h"
+#include "engines/util.h"
#include "hpl1/debug.h"
+#include "hpl1/engine/impl/OcclusionQueryOGL.h"
#include "hpl1/opengl.h"
namespace hpl {
@@ -62,7 +62,7 @@ GLenum ColorFormatToGL(eColorDataFormat format) {
default:
break;
}
- Hpl1::logError(Hpl1::kDebugOpenGL, "invalid color format (%d)", format);
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid color format (%d)\n", format);
return GL_RGB;
}
@@ -81,15 +81,15 @@ GLenum TextureTargetToGL(eTextureTarget target) {
default:
break;
}
- Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture target (%d)", target);
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture target (%d)\n", target);
return GL_TEXTURE_1D;
}
cLowLevelGraphicsSDL::cLowLevelGraphicsSDL() {
mlBatchArraySize = 20000;
mlVertexCount = 0;
- mlIndexCount =0;
- mlMultisampling =0;
+ mlIndexCount = 0;
+ mlMultisampling = 0;
mvVirtualSize.x = 800;
mvVirtualSize.y = 600;
mfGammaCorrection = 1.0;
@@ -106,21 +106,21 @@ cLowLevelGraphicsSDL::cLowLevelGraphicsSDL() {
mbClearDepth = true;
mbClearStencil = false;
- //Create the batch arrays:
+ // Create the batch arrays:
mlBatchStride = 13;
- //3 Pos floats, 4 color floats, 3 Tex coord floats .
- mpVertexArray = (float*)hplMalloc(sizeof(float) * mlBatchStride * mlBatchArraySize);
- mpIndexArray = (unsigned int*)hplMalloc(sizeof(unsigned int) * mlBatchArraySize); //Index is one int.
+ // 3 Pos floats, 4 color floats, 3 Tex coord floats .
+ mpVertexArray = (float *)hplMalloc(sizeof(float) * mlBatchStride * mlBatchArraySize);
+ mpIndexArray = (unsigned int *)hplMalloc(sizeof(unsigned int) * mlBatchArraySize); // Index is one int.
for (int i = 0; i < MAX_TEXTUREUNITS; i++) {
- mpTexCoordArray[i] = (float*)hplMalloc(sizeof(float) * 3 * mlBatchArraySize);
+ mpTexCoordArray[i] = (float *)hplMalloc(sizeof(float) * 3 * mlBatchArraySize);
mbTexCoordArrayActive[i] = false;
- mlTexCoordArrayCount[i]=0;
+ mlTexCoordArrayCount[i] = 0;
}
}
cLowLevelGraphicsSDL::~cLowLevelGraphicsSDL() {
- //SDL_SetGammaRamp(mvStartGammaArray[0],mvStartGammaArray[1],mvStartGammaArray[2]);
+ // SDL_SetGammaRamp(mvStartGammaArray[0],mvStartGammaArray[1],mvStartGammaArray[2]);
hplFree(mpVertexArray);
hplFree(mpIndexArray);
@@ -138,7 +138,7 @@ bool cLowLevelGraphicsSDL::Init(int alWidth, int alHeight, int alBpp, int abFull
initGraphics3d(alWidth, alHeight);
SetupGL();
ShowCursor(false);
- //CheckMultisampleCaps();
+ // CheckMultisampleCaps();
g_system->updateScreen();
return true;
}
@@ -151,41 +151,41 @@ void cLowLevelGraphicsSDL::CheckMultisampleCaps() {
//-----------------------------------------------------------------------
static void logOGLInfo(const cLowLevelGraphicsSDL &graphics) {
- Hpl1::logInfo(Hpl1::kDebugOpenGL, "Max texture image units: %d",
- graphics.GetCaps(eGraphicCaps_MaxTextureImageUnits));
- Hpl1::logInfo(Hpl1::kDebugOpenGL, "Max texture coord units: %d",
- graphics.GetCaps(eGraphicCaps_MaxTextureCoordUnits));
- Hpl1::logInfo(Hpl1::kDebugOpenGL,"Two sided stencil: %d",
- graphics.GetCaps(eGraphicCaps_TwoSideStencil));
- Hpl1::logInfo(Hpl1::kDebugOpenGL, "Vertex Buffer Object: %d",
- graphics.GetCaps(eGraphicCaps_VertexBufferObject));
- Hpl1::logInfo(Hpl1::kDebugOpenGL, "Anisotropic filtering: %d",
- graphics.GetCaps(eGraphicCaps_AnisotropicFiltering));
- Hpl1::logInfo(Hpl1::kDebugOpenGL, "Max Anisotropic degree: %d",
- graphics.GetCaps(eGraphicCaps_MaxAnisotropicFiltering));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Max texture image units: %d\n",
+ graphics.GetCaps(eGraphicCaps_MaxTextureImageUnits));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Max texture coord units: %d\n",
+ graphics.GetCaps(eGraphicCaps_MaxTextureCoordUnits));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Two sided stencil: %d\n",
+ graphics.GetCaps(eGraphicCaps_TwoSideStencil));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Vertex Buffer Object: %d\n",
+ graphics.GetCaps(eGraphicCaps_VertexBufferObject));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Anisotropic filtering: %d\n",
+ graphics.GetCaps(eGraphicCaps_AnisotropicFiltering));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Max Anisotropic degree: %d\n",
+ graphics.GetCaps(eGraphicCaps_MaxAnisotropicFiltering));
Hpl1::logInfo(Hpl1::kDebugOpenGL, "Multisampling: %d\n",
- graphics.GetCaps(eGraphicCaps_Multisampling));
+ graphics.GetCaps(eGraphicCaps_Multisampling));
}
void cLowLevelGraphicsSDL::SetupGL() {
- //Inits GL stuff
- //Set Shade model and clear color.
+ // Inits GL stuff
+ // Set Shade model and clear color.
GL_CHECK(glShadeModel(GL_SMOOTH));
GL_CHECK(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
- //Depth Test setup
- GL_CHECK(glClearDepth(1.0f));//VAlues buffer is cleared with
- GL_CHECK(glEnable(GL_DEPTH_TEST)); //enable depth testing
- GL_CHECK(glDepthFunc(GL_LEQUAL)); //function to do depth test with
+ // Depth Test setup
+ GL_CHECK(glClearDepth(1.0f)); // VAlues buffer is cleared with
+ GL_CHECK(glEnable(GL_DEPTH_TEST)); // enable depth testing
+ GL_CHECK(glDepthFunc(GL_LEQUAL)); // function to do depth test with
GL_CHECK(glDisable(GL_ALPHA_TEST));
- //Set best perspective correction
+ // Set best perspective correction
GL_CHECK(glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST));
- //Stencil setup
+ // Stencil setup
GL_CHECK(glClearStencil(0));
- //Clear the screen
+ // Clear the screen
GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));
GL_CHECK(glMatrixMode(GL_MODELVIEW));
@@ -195,13 +195,13 @@ void cLowLevelGraphicsSDL::SetupGL() {
///// BEGIN BATCH ARRAY STUFF ///////////////
- //Enable all the vertex arrays that are used:
- GL_CHECK(glEnableClientState(GL_VERTEX_ARRAY)); //The positions
- GL_CHECK(glEnableClientState(GL_COLOR_ARRAY)); //The color
- GL_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); //Tex coords
+ // Enable all the vertex arrays that are used:
+ GL_CHECK(glEnableClientState(GL_VERTEX_ARRAY)); // The positions
+ GL_CHECK(glEnableClientState(GL_COLOR_ARRAY)); // The color
+ GL_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); // Tex coords
GL_CHECK(glDisableClientState(GL_NORMAL_ARRAY));
- //Disable the once not used.
- GL_CHECK(glDisableClientState(GL_INDEX_ARRAY)); //color index
+ // Disable the once not used.
+ GL_CHECK(glDisableClientState(GL_INDEX_ARRAY)); // color index
GL_CHECK(glDisableClientState(GL_EDGE_FLAG_ARRAY));
///// END BATCH ARRAY STUFF ///////////////
@@ -211,66 +211,66 @@ void cLowLevelGraphicsSDL::SetupGL() {
//-----------------------------------------------------------------------
int cLowLevelGraphicsSDL::GetCaps(eGraphicCaps type) const {
- switch(type) {
+ switch (type) {
- //Texture Rectangle
+ // Texture Rectangle
case eGraphicCaps_TextureTargetRectangle:
return 1;
- //Vertex Buffer Object
+ // Vertex Buffer Object
case eGraphicCaps_VertexBufferObject:
- return 1; //gl 2.0
+ return 1; // gl 2.0
- //Two Sided Stencil
+ // Two Sided Stencil
case eGraphicCaps_TwoSideStencil:
- return 1; //gl 2.0
+ return 1; // gl 2.0
- //Max Texture Image Units
+ // Max Texture Image Units
case eGraphicCaps_MaxTextureImageUnits: {
int lUnits;
GL_CHECK(glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint *)&lUnits));
return lUnits;
}
- //Max Texture Coord Units
+ // Max Texture Coord Units
case eGraphicCaps_MaxTextureCoordUnits: {
int lUnits = 0;
GL_CHECK(glGetIntegerv(GL_MAX_TEXTURE_COORDS, (GLint *)&lUnits));
return lUnits;
}
- //Texture Anisotropy
+ // Texture Anisotropy
case eGraphicCaps_AnisotropicFiltering:
- return 0; //gl 4.6
+ return 0; // gl 4.6
- //Texture Anisotropy
+ // Texture Anisotropy
case eGraphicCaps_MaxAnisotropicFiltering:
- return 0; //gl 4.6
+ return 0; // gl 4.6
- //Multisampling
+ // Multisampling
case eGraphicCaps_Multisampling:
- return 1; //gl 1.3
+ return 1; // gl 1.3
- //GL Vertex program
+ // GL Vertex program
case eGraphicCaps_GL_VertexProgram:
- return 0; //gl 2.0
+ return 0; // gl 2.0
- //GL Fragment program
+ // GL Fragment program
case eGraphicCaps_GL_FragmentProgram:
- return 0; //gl 2.0
+ return 0; // gl 2.0
case eGraphicCaps_GL_ATIFragmentShader:
return 0;
- //GL ATI Fragment Shader
+ // GL ATI Fragment Shader
case eGraphicCaps_GL_BlendFunctionSeparate:
- return 1; //gl 1.4
+ return 1; // gl 1.4
case eGraphicCaps_GL_MultiTexture:
- return GLAD_GL_ARB_multitexture; //gl 1.4
+ return GLAD_GL_ARB_multitexture; // gl 1.4
default:
break;
}
- Hpl1::logWarning(Hpl1::kDebugGraphics, "graphic options %d is not supported", type);
+ Hpl1::logWarning(Hpl1::kDebugGraphics, "graphic options %d is not supported\n", type);
return 0;
}
@@ -290,7 +290,7 @@ void cLowLevelGraphicsSDL::SetVsyncActive(bool toggle) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetMultisamplingActive(bool toggle) {
- if (!GetCaps(eGraphicCaps_Multisampling) || mlMultisampling<=0)
+ if (!GetCaps(eGraphicCaps_Multisampling) || mlMultisampling <= 0)
return;
if (toggle)
@@ -313,17 +313,16 @@ float cLowLevelGraphicsSDL::GetGammaCorrection() {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetClipPlane(int alIdx, const cPlanef &aPlane) {
- mvClipPlanes[alIdx] = aPlane;
+ mvClipPlanes[alIdx] = aPlane;
double vPlane[4];
vPlane[0] = aPlane.a;
vPlane[1] = aPlane.b;
vPlane[2] = aPlane.c;
vPlane[3] = aPlane.d;
- GL_CHECK(glClipPlane(GL_CLIP_PLANE0 + alIdx,vPlane));
+ GL_CHECK(glClipPlane(GL_CLIP_PLANE0 + alIdx, vPlane));
}
-
cPlanef cLowLevelGraphicsSDL::GetClipPlane(int alIdx, const cPlanef &aPlane) {
return mvClipPlanes[alIdx];
}
@@ -447,7 +446,7 @@ void cLowLevelGraphicsSDL::SetIdentityMatrix(eMatrix aMtxType) {
void cLowLevelGraphicsSDL::TranslateMatrix(eMatrix aMtxType, const cVector3f &avPos) {
GL_CHECK(SetMatrixMode(aMtxType));
- GL_CHECK(glTranslatef(avPos.x,avPos.y,avPos.z));
+ GL_CHECK(glTranslatef(avPos.x, avPos.y, avPos.z));
}
//-----------------------------------------------------------------------
@@ -459,14 +458,14 @@ void cLowLevelGraphicsSDL::TranslateMatrix(eMatrix aMtxType, const cVector3f &av
*/
void cLowLevelGraphicsSDL::RotateMatrix(eMatrix aMtxType, const cVector3f &avRot) {
SetMatrixMode(aMtxType);
- GL_CHECK(glRotatef(1,avRot.x,avRot.y,avRot.z));
+ GL_CHECK(glRotatef(1, avRot.x, avRot.y, avRot.z));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::ScaleMatrix(eMatrix aMtxType, const cVector3f &avScale) {
SetMatrixMode(aMtxType);
- GL_CHECK(glScalef(avScale.x,avScale.y,avScale.z));
+ GL_CHECK(glScalef(avScale.x, avScale.y, avScale.z));
}
//-----------------------------------------------------------------------
@@ -474,60 +473,48 @@ void cLowLevelGraphicsSDL::ScaleMatrix(eMatrix aMtxType, const cVector3f &avScal
void cLowLevelGraphicsSDL::SetOrthoProjection(const cVector2f &avSize, float afMin, float afMax) {
GL_CHECK(glMatrixMode(GL_PROJECTION));
GL_CHECK(glLoadIdentity());
- GL_CHECK(glOrtho(0,avSize.x,avSize.y,0,afMin,afMax));
+ GL_CHECK(glOrtho(0, avSize.x, avSize.y, 0, afMin, afMax));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetTexture(unsigned int alUnit, iTexture *apTex) {
- if(apTex == mpCurrentTexture[alUnit]) return;
+ if (apTex == mpCurrentTexture[alUnit])
+ return;
- GLenum NewTarget=0;
+ GLenum NewTarget = 0;
if (apTex)
NewTarget = GetGLTextureTargetEnum(apTex->GetTarget());
- GLenum LastTarget=0;
+ GLenum LastTarget = 0;
if (mpCurrentTexture[alUnit])
LastTarget = GetGLTextureTargetEnum(mpCurrentTexture[alUnit]->GetTarget());
- //Check if multi texturing is supported.
+ // Check if multi texturing is supported.
if (GetCaps(eGraphicCaps_GL_MultiTexture)) {
GL_CHECK(glActiveTexture(GL_TEXTURE0 + alUnit));
}
- //If the current texture in this unit is a render target, unbind it.
- if (mpCurrentTexture[alUnit]){
- if(mpCurrentTexture[alUnit]->GetTextureType() == eTextureType_RenderTarget) {
- error("render target not supported");
-#if 0
- cSDLTexture *pSDLTex = static_cast<cSDLTexture *> (mpCurrentTexture[alUnit]);
+ // If the current texture in this unit is a render target, unbind it.
+ if (mpCurrentTexture[alUnit] && mpCurrentTexture[alUnit]->GetTextureType() == eTextureType_RenderTarget)
+ error("render target not supported");
- glBindTexture(LastTarget, pSDLTex->GetTextureHandle());
- cPBuffer* pBuffer = pSDLTex->GetPBuffer();
- pBuffer->UnBind();
-#endif
- }
- }
-
- //Disable this unit if NULL
+ // Disable this unit if NULL
if (apTex == NULL) {
- glDisable(LastTarget);
- //glBindTexture(LastTarget,0);
- //Enable the unit, set the texture handle and bind the pbuffer
+ GL_CHECK(glDisable(LastTarget));
+ // glBindTexture(LastTarget,0);
+ // Enable the unit, set the texture handle and bind the pbuffer
} else {
- if (NewTarget != LastTarget) glDisable(LastTarget);
+ if (NewTarget != LastTarget && LastTarget != 0)
+ GL_CHECK(glDisable(LastTarget));
- cSDLTexture *pSDLTex = static_cast<cSDLTexture*> (apTex);
+ cSDLTexture *pSDLTex = static_cast<cSDLTexture *>(apTex);
- glBindTexture(NewTarget, pSDLTex->GetTextureHandle());
- glEnable(NewTarget);
+ GL_CHECK(glBindTexture(NewTarget, pSDLTex->GetTextureHandle()));
+ GL_CHECK(glEnable(NewTarget));
- //if it is a render target we need to do some more binding.
+ // if it is a render target we need to do some more binding.
if (pSDLTex->GetTextureType() == eTextureType_RenderTarget) {
error("render target not supported");
-#if 0
- cPBuffer* pBuffer = pSDLTex->GetPBuffer();
- pBuffer->Bind();
-#endif
}
}
@@ -537,7 +524,7 @@ void cLowLevelGraphicsSDL::SetTexture(unsigned int alUnit, iTexture *apTex) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetActiveTextureUnit(unsigned int alUnit) {
- GL_CHECK(glActiveTexture(GL_TEXTURE0 + alUnit));
+ GL_CHECK(glActiveTexture(GL_TEXTURE0 + alUnit));
}
//-----------------------------------------------------------------------
@@ -547,16 +534,13 @@ void cLowLevelGraphicsSDL::SetTextureEnv(eTextureParam aParam, int alVal) {
GL_CHECK(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE));
- if(aParam == eTextureParam_ColorFunc || aParam == eTextureParam_AlphaFunc) {
+ if (aParam == eTextureParam_ColorFunc || aParam == eTextureParam_AlphaFunc) {
glTexEnvi(GL_TEXTURE_ENV, lParam, GetGLTextureFuncEnum((eTextureFunc)alVal));
- }
- else if(aParam >= eTextureParam_ColorSource0 && aParam <= eTextureParam_AlphaSource2) {
+ } else if (aParam >= eTextureParam_ColorSource0 && aParam <= eTextureParam_AlphaSource2) {
glTexEnvi(GL_TEXTURE_ENV, lParam, GetGLTextureSourceEnum((eTextureSource)alVal));
- }
- else if(aParam >= eTextureParam_ColorOp0 && aParam <= eTextureParam_AlphaOp2) {
+ } else if (aParam >= eTextureParam_ColorOp0 && aParam <= eTextureParam_AlphaOp2) {
glTexEnvi(GL_TEXTURE_ENV, lParam, GetGLTextureOpEnum((eTextureOp)alVal));
- }
- else {
+ } else {
glTexEnvi(GL_TEXTURE_ENV, lParam, alVal);
}
GL_CHECK_FN();
@@ -565,7 +549,7 @@ void cLowLevelGraphicsSDL::SetTextureEnv(eTextureParam aParam, int alVal) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetTextureConstantColor(const cColor &color) {
- float vColor[] = { color.r, color.g, color.b, color.a };
+ float vColor[] = {color.r, color.g, color.b, color.a};
GL_CHECK(glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &vColor[0]));
}
@@ -579,7 +563,7 @@ void cLowLevelGraphicsSDL::SetColor(const cColor &aColor) {
//-----------------------------------------------------------------------
iVertexBuffer *cLowLevelGraphicsSDL::CreateVertexBuffer(tVertexFlag aFlags,
- eVertexBufferDrawType aDrawType, eVertexBufferUsageType aUsageType, int alReserveVtxSize, int alReserveIdxSize) {
+ eVertexBufferDrawType aDrawType, eVertexBufferUsageType aUsageType, int alReserveVtxSize, int alReserveIdxSize) {
if (GetCaps(eGraphicCaps_VertexBufferObject))
return hplNew(cVertexBufferVBO, (this, aFlags, aDrawType, aUsageType, alReserveVtxSize, alReserveIdxSize));
@@ -589,17 +573,17 @@ iVertexBuffer *cLowLevelGraphicsSDL::CreateVertexBuffer(tVertexFlag aFlags,
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawRect(const cVector2f &avPos, const cVector2f &avSize, float afZ) {
- glColor4f(1,1,1,1);
+ glColor4f(1, 1, 1, 1);
glBegin(GL_QUADS);
{
glTexCoord2f(0.0, 0.0);
- glVertex3f(avPos.x, avPos.y,afZ);
+ glVertex3f(avPos.x, avPos.y, afZ);
glTexCoord2f(1.0, 0.0);
- glVertex3f(avPos.x+avSize.x, avPos.y,afZ);
+ glVertex3f(avPos.x + avSize.x, avPos.y, afZ);
glTexCoord2f(1.0, 1.0);
- glVertex3f(avPos.x+avSize.x, avPos.y+avSize.y,afZ);
+ glVertex3f(avPos.x + avSize.x, avPos.y + avSize.y, afZ);
glTexCoord2f(0.0, 1.0);
- glVertex3f(avPos.x, avPos.y+avSize.y,afZ);
+ glVertex3f(avPos.x, avPos.y + avSize.y, afZ);
}
glEnd();
GL_CHECK_FN();
@@ -608,7 +592,7 @@ void cLowLevelGraphicsSDL::DrawRect(const cVector2f &avPos, const cVector2f &avS
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::FlushRendering() {
- GL_CHECK(glFlush());
+ GL_CHECK(glFlush());
}
void cLowLevelGraphicsSDL::SwapBuffers() {
GL_CHECK(glFlush());
@@ -618,14 +602,14 @@ void cLowLevelGraphicsSDL::SwapBuffers() {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawTri(const tVertexVec &avVtx) {
- assert(avVtx.size()==3);
+ assert(avVtx.size() == 3);
glBegin(GL_TRIANGLES);
{
- for(int i=0;i<3;i++){
+ for (int i = 0; i < 3; i++) {
glTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, avVtx[i].tex.z);
- glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
+ glColor4f(avVtx[i].col.r, avVtx[i].col.g, avVtx[i].col.b, avVtx[i].col.a);
+ glVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
}
}
glEnd();
@@ -637,10 +621,10 @@ void cLowLevelGraphicsSDL::DrawTri(const tVertexVec &avVtx) {
void cLowLevelGraphicsSDL::DrawTri(const cVertex *avVtx) {
glBegin(GL_TRIANGLES);
{
- for(int i=0;i<3;i++) {
- glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
- glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
+ for (int i = 0; i < 3; i++) {
+ glTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, avVtx[i].tex.z);
+ glColor4f(avVtx[i].col.r, avVtx[i].col.g, avVtx[i].col.b, avVtx[i].col.a);
+ glVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
}
}
glEnd();
@@ -650,14 +634,14 @@ void cLowLevelGraphicsSDL::DrawTri(const cVertex *avVtx) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawQuad(const tVertexVec &avVtx) {
- assert(avVtx.size()==4);
+ assert(avVtx.size() == 4);
glBegin(GL_QUADS);
{
- for(int i=0;i<4;i++){
- glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
- glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
+ for (int i = 0; i < 4; i++) {
+ glTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, avVtx[i].tex.z);
+ glColor4f(avVtx[i].col.r, avVtx[i].col.g, avVtx[i].col.b, avVtx[i].col.a);
+ glVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
}
}
glEnd();
@@ -667,21 +651,19 @@ void cLowLevelGraphicsSDL::DrawQuad(const tVertexVec &avVtx) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawQuadMultiTex(const tVertexVec &avVtx, const tVector3fVec &avExtraUvs) {
- int lExtraUnits = (int)avExtraUvs.size()/4;
+ int lExtraUnits = (int)avExtraUvs.size() / 4;
glBegin(GL_QUADS);
{
- for(int i=0;i<4;i++)
- {
- glMultiTexCoord3fARB(GL_TEXTURE0_ARB,avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
+ for (int i = 0; i < 4; i++) {
+ glMultiTexCoord3fARB(GL_TEXTURE0_ARB, avVtx[i].tex.x, avVtx[i].tex.y, avVtx[i].tex.z);
- for(int unit=0; unit<lExtraUnits; ++unit)
- {
+ for (int unit = 0; unit < lExtraUnits; ++unit) {
glMultiTexCoord3fARB(GL_TEXTURE0_ARB + unit + 1,
- avExtraUvs[unit*4 + i].x, avExtraUvs[unit*4 + i].y, avExtraUvs[unit*4 + i].z);
+ avExtraUvs[unit * 4 + i].x, avExtraUvs[unit * 4 + i].y, avExtraUvs[unit * 4 + i].z);
}
- glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
+ glColor4f(avVtx[i].col.r, avVtx[i].col.g, avVtx[i].col.b, avVtx[i].col.a);
+ glVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
}
}
glEnd();
@@ -704,13 +686,13 @@ void cLowLevelGraphicsSDL::DestroyOcclusionQuery(iOcclusionQuery *apQuery) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::ClearScreen() {
- GLbitfield bitmask=0;
+ GLbitfield bitmask = 0;
- if(mbClearColor)
+ if (mbClearColor)
bitmask |= GL_COLOR_BUFFER_BIT;
- if(mbClearDepth)
+ if (mbClearDepth)
bitmask |= GL_DEPTH_BUFFER_BIT;
- if(mbClearStencil)
+ if (mbClearStencil)
bitmask |= GL_STENCIL_BUFFER_BIT;
GL_CHECK(glClear(bitmask));
@@ -743,7 +725,7 @@ void cLowLevelGraphicsSDL::SetClearStencilActive(bool abX) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetColorWriteActive(bool abR, bool abG, bool abB, bool abA) {
- glColorMask(abR,abG,abB,abA);
+ glColorMask(abR, abG, abB, abA);
}
//-----------------------------------------------------------------------
@@ -755,7 +737,7 @@ void cLowLevelGraphicsSDL::SetDepthWriteActive(bool abX) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetDepthTestActive(bool abX) {
- if(abX)
+ if (abX)
glEnable(GL_DEPTH_TEST);
else
glDisable(GL_DEPTH_TEST);
@@ -771,7 +753,7 @@ void cLowLevelGraphicsSDL::SetDepthTestFunc(eDepthTestFunc aFunc) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetAlphaTestActive(bool abX) {
- if(abX)
+ if (abX)
glEnable(GL_ALPHA_TEST);
else
glDisable(GL_ALPHA_TEST);
@@ -781,13 +763,13 @@ void cLowLevelGraphicsSDL::SetAlphaTestActive(bool abX) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetAlphaTestFunc(eAlphaTestFunc aFunc, float afRef) {
- GL_CHECK(glAlphaFunc(GetGLAlphaTestFuncEnum(aFunc),afRef));
+ GL_CHECK(glAlphaFunc(GetGLAlphaTestFuncEnum(aFunc), afRef));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetStencilActive(bool abX) {
- if(abX)
+ if (abX)
glEnable(GL_STENCIL_TEST);
else
glDisable(GL_STENCIL_TEST);
@@ -843,35 +825,34 @@ void cLowLevelGraphicsSDL::SetStencil(eStencilFunc aFunc, int alRef, unsigned in
GL_CHECK(glStencilFunc(GetGLStencilFuncEnum(aFunc), alRef, aMask));
GL_CHECK(glStencilOp(GetGLStencilOpEnum(aFailOp), GetGLStencilOpEnum(aZFailOp),
- GetGLStencilOpEnum(aZPassOp)));
+ GetGLStencilOpEnum(aZPassOp)));
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetStencilTwoSide(eStencilFunc aFrontFunc, eStencilFunc aBackFunc,
- int alRef, unsigned int aMask,eStencilOp aFrontFailOp, eStencilOp aFrontZFailOp, eStencilOp aFrontZPassOp,
- eStencilOp aBackFailOp, eStencilOp aBackZFailOp, eStencilOp aBackZPassOp) {
- if (GetCaps(eGraphicCaps_TwoSideStencil)) {
- GL_CHECK(glStencilFuncSeparate(GL_FRONT, GetGLStencilFuncEnum(aFrontFunc), alRef, aMask));
- GL_CHECK(glStencilOpSeparate(GL_FRONT, GetGLStencilOpEnum(aFrontFailOp), GetGLStencilOpEnum(aFrontZFailOp),
- GetGLStencilOpEnum(aFrontZPassOp)))
- GL_CHECK(glStencilFuncSeparate(GL_BACK, GetGLStencilFuncEnum(aBackFunc), alRef, aMask));
- GL_CHECK(glStencilOpSeparate(GL_BACK, GetGLStencilOpEnum(aBackFailOp), GetGLStencilOpEnum(aBackZFailOp),
- GetGLStencilOpEnum(aBackZPassOp)));
- }
- else
- error("Only single sided stencil supported");
+ int alRef, unsigned int aMask, eStencilOp aFrontFailOp, eStencilOp aFrontZFailOp, eStencilOp aFrontZPassOp,
+ eStencilOp aBackFailOp, eStencilOp aBackZFailOp, eStencilOp aBackZPassOp) {
+ if (GetCaps(eGraphicCaps_TwoSideStencil)) {
+ GL_CHECK(glStencilFuncSeparate(GL_FRONT, GetGLStencilFuncEnum(aFrontFunc), alRef, aMask));
+ GL_CHECK(glStencilOpSeparate(GL_FRONT, GetGLStencilOpEnum(aFrontFailOp), GetGLStencilOpEnum(aFrontZFailOp),
+ GetGLStencilOpEnum(aFrontZPassOp)))
+ GL_CHECK(glStencilFuncSeparate(GL_BACK, GetGLStencilFuncEnum(aBackFunc), alRef, aMask));
+ GL_CHECK(glStencilOpSeparate(GL_BACK, GetGLStencilOpEnum(aBackFailOp), GetGLStencilOpEnum(aBackZFailOp),
+ GetGLStencilOpEnum(aBackZPassOp)));
+ } else
+ error("Only single sided stencil supported");
}
void cLowLevelGraphicsSDL::SetStencilTwoSide(bool abX) {
- if (GetCaps(eGraphicCaps_TwoSideStencil))
- Hpl1::logError(Hpl1::kDebugOpenGL, "call to setStencilTwoSide with two side stencil enabled%c", ".");
+ if (!GetCaps(eGraphicCaps_TwoSideStencil))
+ Hpl1::logError(Hpl1::kDebugOpenGL, "call to setStencilTwoSide with two side stencil disabled%c\n", '.');
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetCullActive(bool abX) {
- if(abX)
+ if (abX)
glEnable(GL_CULL_FACE);
else
glDisable(GL_CULL_FACE);
@@ -880,7 +861,7 @@ void cLowLevelGraphicsSDL::SetCullActive(bool abX) {
}
void cLowLevelGraphicsSDL::SetCullMode(eCullMode aMode) {
GL_CHECK(glCullFace(GL_BACK));
- if(aMode == eCullMode_Clockwise)
+ if (aMode == eCullMode_Clockwise)
glFrontFace(GL_CCW);
else
glFrontFace(GL_CW);
@@ -890,7 +871,7 @@ void cLowLevelGraphicsSDL::SetCullMode(eCullMode aMode) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetScissorActive(bool toggle) {
- if(toggle)
+ if (toggle)
glEnable(GL_SCISSOR_TEST);
else
glDisable(GL_SCISSOR_TEST);
@@ -900,13 +881,13 @@ void cLowLevelGraphicsSDL::SetScissorActive(bool toggle) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetScissorRect(const cRect2l &aRect) {
- glScissor(aRect.x, (mvScreenSize.y - aRect.y - 1)-aRect.h, aRect.w, aRect.h);
+ glScissor(aRect.x, (mvScreenSize.y - aRect.y - 1) - aRect.h, aRect.w, aRect.h);
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetBlendActive(bool abX) {
- if(abX)
+ if (abX)
glEnable(GL_BLEND);
else
glDisable(GL_BLEND);
@@ -922,13 +903,13 @@ void cLowLevelGraphicsSDL::SetBlendFunc(eBlendFunc aSrcFactor, eBlendFunc aDestF
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetBlendFuncSeparate(eBlendFunc aSrcFactorColor, eBlendFunc aDestFactorColor,
- eBlendFunc aSrcFactorAlpha, eBlendFunc aDestFactorAlpha) {
+ eBlendFunc aSrcFactorAlpha, eBlendFunc aDestFactorAlpha) {
if (GetCaps(eGraphicCaps_GL_BlendFunctionSeparate)) {
glBlendFuncSeparate(GetGLBlendEnum(aSrcFactorColor),
- GetGLBlendEnum(aDestFactorColor),
- GetGLBlendEnum(aSrcFactorAlpha),
- GetGLBlendEnum(aDestFactorAlpha));
+ GetGLBlendEnum(aDestFactorColor),
+ GetGLBlendEnum(aSrcFactorAlpha),
+ GetGLBlendEnum(aDestFactorAlpha));
} else {
glBlendFunc(GetGLBlendEnum(aSrcFactorColor), GetGLBlendEnum(aDestFactorColor));
}
@@ -937,15 +918,15 @@ void cLowLevelGraphicsSDL::SetBlendFuncSeparate(eBlendFunc aSrcFactorColor, eBle
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawQuad(const tVertexVec &avVtx, const cColor aCol) {
- assert(avVtx.size()==4);
+ assert(avVtx.size() == 4);
glBegin(GL_QUADS);
{
- //Make all this inline??
- for(int i=0;i<4;i++){
- glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,avVtx[i].tex.z);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
+ // Make all this inline??
+ for (int i = 0; i < 4; i++) {
+ glTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, avVtx[i].tex.z);
+ glColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
+ glVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
}
}
glEnd();
@@ -955,15 +936,15 @@ void cLowLevelGraphicsSDL::DrawQuad(const tVertexVec &avVtx, const cColor aCol)
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawQuad(const tVertexVec &avVtx, const float afZ) {
- assert(avVtx.size()==4);
+ assert(avVtx.size() == 4);
glBegin(GL_QUADS);
{
- //Make all this inline??
- for(int i=0;i<4;i++){
- glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,afZ);
- glColor4f(avVtx[i].col.r,avVtx[i].col.g,avVtx[i].col.b,avVtx[i].col.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
+ // Make all this inline??
+ for (int i = 0; i < 4; i++) {
+ glTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, afZ);
+ glColor4f(avVtx[i].col.r, avVtx[i].col.g, avVtx[i].col.b, avVtx[i].col.a);
+ glVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
}
}
GL_CHECK_FN();
@@ -972,15 +953,15 @@ void cLowLevelGraphicsSDL::DrawQuad(const tVertexVec &avVtx, const float afZ) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawQuad(const tVertexVec &avVtx, const float afZ, const cColor &aCol) {
- assert(avVtx.size()==4);
+ assert(avVtx.size() == 4);
glBegin(GL_QUADS);
{
- //Make all this inline??
- for(int i=0;i<4;i++){
- glTexCoord3f(avVtx[i].tex.x,avVtx[i].tex.y,afZ);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
- glVertex3f(avVtx[i].pos.x,avVtx[i].pos.y,avVtx[i].pos.z);
+ // Make all this inline??
+ for (int i = 0; i < 4; i++) {
+ glTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, afZ);
+ glColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
+ glVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
}
}
glEnd();
@@ -1134,12 +1115,12 @@ void cLowLevelGraphicsSDL::AddTexCoordToBatch(unsigned int alUnit, const cVector
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetBatchTextureUnitActive(unsigned int alUnit, bool active) {
- GL_CHECK(glClientActiveTextureARB(GL_TEXTURE0_ARB+alUnit));
+ GL_CHECK(glClientActiveTextureARB(GL_TEXTURE0_ARB + alUnit));
if (active)
- glTexCoordPointer(3,GL_FLOAT,0, &mpTexCoordArray[alUnit][0]);
+ glTexCoordPointer(3, GL_FLOAT, 0, &mpTexCoordArray[alUnit][0]);
else
- glTexCoordPointer(3,GL_FLOAT,sizeof(float)*mlBatchStride, &mpVertexArray[7]);
+ glTexCoordPointer(3, GL_FLOAT, sizeof(float) * mlBatchStride, &mpVertexArray[7]);
GL_CHECK_FN();
}
@@ -1164,7 +1145,7 @@ void cLowLevelGraphicsSDL::FlushTriBatch(tVtxBatchFlag aTypeFlags, bool abAutoCl
void cLowLevelGraphicsSDL::FlushQuadBatch(tVtxBatchFlag aTypeFlags, bool abAutoClear) {
SetVtxBatchStates(aTypeFlags);
SetUpBatchArrays();
- GL_CHECK(glDrawElements(GL_QUADS,mlIndexCount,GL_UNSIGNED_INT, mpIndexArray));
+ GL_CHECK(glDrawElements(GL_QUADS, mlIndexCount, GL_UNSIGNED_INT, mpIndexArray));
if (abAutoClear)
flushAutoClear(mlIndexCount, mlVertexCount, mlTexCoordArrayCount);
}
@@ -1179,63 +1160,63 @@ void cLowLevelGraphicsSDL::ClearBatch() {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawLine(const cVector3f &avBegin, const cVector3f &avEnd, cColor aCol) {
- SetTexture(0, nullptr);
- //SetBlendActive(false);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ SetTexture(0, nullptr);
+ // SetBlendActive(false);
+ glColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
glBegin(GL_LINES);
{
- glVertex3f(avBegin.x,avBegin.y,avBegin.z);
- glVertex3f(avEnd.x,avEnd.y,avEnd.z);
+ glVertex3f(avBegin.x, avBegin.y, avBegin.z);
+ glVertex3f(avEnd.x, avEnd.y, avEnd.z);
}
glEnd();
GL_CHECK_FN();
}
void cLowLevelGraphicsSDL::DrawBoxMaxMin(const cVector3f &avMax, const cVector3f &avMin, cColor aCol) {
- SetTexture(0,NULL);
+ SetTexture(0, NULL);
SetBlendActive(false);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ glColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
glBegin(GL_LINES);
{
- //Pos Z Quad
- glVertex3f(avMax.x,avMax.y,avMax.z);
- glVertex3f(avMin.x,avMax.y,avMax.z);
+ // Pos Z Quad
+ glVertex3f(avMax.x, avMax.y, avMax.z);
+ glVertex3f(avMin.x, avMax.y, avMax.z);
- glVertex3f(avMax.x,avMax.y,avMax.z);
- glVertex3f(avMax.x,avMin.y,avMax.z);
+ glVertex3f(avMax.x, avMax.y, avMax.z);
+ glVertex3f(avMax.x, avMin.y, avMax.z);
- glVertex3f(avMin.x,avMax.y,avMax.z);
- glVertex3f(avMin.x,avMin.y,avMax.z);
+ glVertex3f(avMin.x, avMax.y, avMax.z);
+ glVertex3f(avMin.x, avMin.y, avMax.z);
- glVertex3f(avMin.x,avMin.y,avMax.z);
- glVertex3f(avMax.x,avMin.y,avMax.z);
+ glVertex3f(avMin.x, avMin.y, avMax.z);
+ glVertex3f(avMax.x, avMin.y, avMax.z);
- //Neg Z Quad
- glVertex3f(avMax.x,avMax.y,avMin.z);
- glVertex3f(avMin.x,avMax.y,avMin.z);
+ // Neg Z Quad
+ glVertex3f(avMax.x, avMax.y, avMin.z);
+ glVertex3f(avMin.x, avMax.y, avMin.z);
- glVertex3f(avMax.x,avMax.y,avMin.z);
- glVertex3f(avMax.x,avMin.y,avMin.z);
+ glVertex3f(avMax.x, avMax.y, avMin.z);
+ glVertex3f(avMax.x, avMin.y, avMin.z);
- glVertex3f(avMin.x,avMax.y,avMin.z);
- glVertex3f(avMin.x,avMin.y,avMin.z);
+ glVertex3f(avMin.x, avMax.y, avMin.z);
+ glVertex3f(avMin.x, avMin.y, avMin.z);
- glVertex3f(avMin.x,avMin.y,avMin.z);
- glVertex3f(avMax.x,avMin.y,avMin.z);
+ glVertex3f(avMin.x, avMin.y, avMin.z);
+ glVertex3f(avMax.x, avMin.y, avMin.z);
- //Lines between
- glVertex3f(avMax.x,avMax.y,avMax.z);
- glVertex3f(avMax.x,avMax.y,avMin.z);
+ // Lines between
+ glVertex3f(avMax.x, avMax.y, avMax.z);
+ glVertex3f(avMax.x, avMax.y, avMin.z);
- glVertex3f(avMin.x,avMax.y,avMax.z);
- glVertex3f(avMin.x,avMax.y,avMin.z);
+ glVertex3f(avMin.x, avMax.y, avMax.z);
+ glVertex3f(avMin.x, avMax.y, avMin.z);
- glVertex3f(avMin.x,avMin.y,avMax.z);
- glVertex3f(avMin.x,avMin.y,avMin.z);
+ glVertex3f(avMin.x, avMin.y, avMax.z);
+ glVertex3f(avMin.x, avMin.y, avMin.z);
- glVertex3f(avMax.x,avMin.y,avMax.z);
- glVertex3f(avMax.x,avMin.y,avMin.z);
+ glVertex3f(avMax.x, avMin.y, avMax.z);
+ glVertex3f(avMax.x, avMin.y, avMin.z);
}
glEnd();
GL_CHECK_FN();
@@ -1245,43 +1226,39 @@ void cLowLevelGraphicsSDL::DrawBoxMaxMin(const cVector3f &avMax, const cVector3f
void cLowLevelGraphicsSDL::DrawSphere(const cVector3f &avPos, float afRadius, cColor aCol) {
int alSegments = 32;
- float afAngleStep = k2Pif /(float)alSegments;
+ float afAngleStep = k2Pif / (float)alSegments;
- SetTexture(0,nullptr);
+ SetTexture(0, nullptr);
SetBlendActive(false);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ glColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
glBegin(GL_LINES);
{
- //X Circle:
- for(float a=0; a< k2Pif; a+= afAngleStep)
- {
- glVertex3f(avPos.x, avPos.y + sin(a)*afRadius,
- avPos.z + cos(a)*afRadius);
+ // X Circle:
+ for (float a = 0; a < k2Pif; a += afAngleStep) {
+ glVertex3f(avPos.x, avPos.y + sin(a) * afRadius,
+ avPos.z + cos(a) * afRadius);
- glVertex3f(avPos.x, avPos.y + sin(a+afAngleStep)*afRadius,
- avPos.z + cos(a+afAngleStep)*afRadius);
+ glVertex3f(avPos.x, avPos.y + sin(a + afAngleStep) * afRadius,
+ avPos.z + cos(a + afAngleStep) * afRadius);
}
- //Y Circle:
- for(float a=0; a< k2Pif; a+= afAngleStep)
- {
- glVertex3f(avPos.x + cos(a)*afRadius, avPos.y,
- avPos.z + sin(a)*afRadius);
+ // Y Circle:
+ for (float a = 0; a < k2Pif; a += afAngleStep) {
+ glVertex3f(avPos.x + cos(a) * afRadius, avPos.y,
+ avPos.z + sin(a) * afRadius);
- glVertex3f(avPos.x + cos(a+afAngleStep)*afRadius, avPos.y ,
- avPos.z+ sin(a+afAngleStep)*afRadius);
+ glVertex3f(avPos.x + cos(a + afAngleStep) * afRadius, avPos.y,
+ avPos.z + sin(a + afAngleStep) * afRadius);
}
- //Z Circle:
- for(float a=0; a< k2Pif; a+= afAngleStep)
- {
- glVertex3f(avPos.x + cos(a)*afRadius, avPos.y + sin(a)*afRadius, avPos.z);
+ // Z Circle:
+ for (float a = 0; a < k2Pif; a += afAngleStep) {
+ glVertex3f(avPos.x + cos(a) * afRadius, avPos.y + sin(a) * afRadius, avPos.z);
- glVertex3f(avPos.x + cos(a+afAngleStep)*afRadius,
- avPos.y + sin(a+afAngleStep)*afRadius,
- avPos.z);
+ glVertex3f(avPos.x + cos(a + afAngleStep) * afRadius,
+ avPos.y + sin(a + afAngleStep) * afRadius,
+ avPos.z);
}
-
}
glEnd();
GL_CHECK_FN();
@@ -1290,13 +1267,13 @@ void cLowLevelGraphicsSDL::DrawSphere(const cVector3f &avPos, float afRadius, cC
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawLine2D(const cVector2f &avBegin, const cVector2f &avEnd, float afZ, cColor aCol) {
- SetTexture(0,NULL);
+ SetTexture(0, NULL);
SetBlendActive(false);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ glColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
glBegin(GL_LINES);
{
- glVertex3f(avBegin.x,avBegin.y,afZ);
- glVertex3f(avEnd.x,avEnd.y,afZ);
+ glVertex3f(avBegin.x, avBegin.y, afZ);
+ glVertex3f(avEnd.x, avEnd.y, afZ);
}
glEnd();
GL_CHECK_FN();
@@ -1305,16 +1282,16 @@ void cLowLevelGraphicsSDL::DrawLine2D(const cVector2f &avBegin, const cVector2f
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::DrawLineRect2D(const cRect2f &aRect, float afZ, cColor aCol) {
- SetTexture(0, nullptr);
+ SetTexture(0, nullptr);
SetBlendActive(false);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ glColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
glBegin(GL_LINE_STRIP);
{
- glVertex3f(aRect.x,aRect.y,afZ);
- glVertex3f(aRect.x+aRect.w,aRect.y,afZ);
- glVertex3f(aRect.x+aRect.w,aRect.y+aRect.h,afZ);
- glVertex3f(aRect.x,aRect.y+aRect.h,afZ);
- glVertex3f(aRect.x,aRect.y,afZ);
+ glVertex3f(aRect.x, aRect.y, afZ);
+ glVertex3f(aRect.x + aRect.w, aRect.y, afZ);
+ glVertex3f(aRect.x + aRect.w, aRect.y + aRect.h, afZ);
+ glVertex3f(aRect.x, aRect.y + aRect.h, afZ);
+ glVertex3f(aRect.x, aRect.y, afZ);
}
glEnd();
GL_CHECK_FN();
@@ -1324,13 +1301,13 @@ void cLowLevelGraphicsSDL::DrawLineRect2D(const cRect2f &aRect, float afZ, cColo
void cLowLevelGraphicsSDL::DrawFilledRect2D(const cRect2f &aRect, float afZ, cColor aCol) {
SetTexture(0, NULL);
- glColor4f(aCol.r,aCol.g,aCol.b,aCol.a);
+ glColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
glBegin(GL_QUADS);
{
- glVertex3f(aRect.x,aRect.y,afZ);
- glVertex3f(aRect.x+aRect.w,aRect.y,afZ);
- glVertex3f(aRect.x+aRect.w,aRect.y+aRect.h,afZ);
- glVertex3f(aRect.x,aRect.y+aRect.h,afZ);
+ glVertex3f(aRect.x, aRect.y, afZ);
+ glVertex3f(aRect.x + aRect.w, aRect.y, afZ);
+ glVertex3f(aRect.x + aRect.w, aRect.y + aRect.h, afZ);
+ glVertex3f(aRect.x, aRect.y + aRect.h, afZ);
}
glEnd();
GL_CHECK_FN();
@@ -1345,20 +1322,20 @@ void cLowLevelGraphicsSDL::DrawLineCircle2D(const cVector2f &avCenter, float afR
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::CopyContextToTexure(iTexture *apTex, const cVector2l &avPos,
- const cVector2l &avSize, const cVector2l &avTexOffset) {
- if(apTex == nullptr)
- return;
+ const cVector2l &avSize, const cVector2l &avTexOffset) {
+ if (apTex == nullptr)
+ return;
- int lScreenY = (mvScreenSize.y - avSize.y) - avPos.y;
- int lTexY = (apTex->getHeight() - avSize.y) - avTexOffset.y;
+ int lScreenY = (mvScreenSize.y - avSize.y) - avPos.y;
+ int lTexY = (apTex->getHeight() - avSize.y) - avTexOffset.y;
- //Log("TExoffset: %d %d\n",avTexOffset.x,lTexY);
- //Log("ScreenOffset: %d %d (h: %d s: %d p: %d)\n",avPos.x,lScreenY,mvScreenSize.y,
- // avSize.y,avPos.y);
+ // Log("TExoffset: %d %d\n",avTexOffset.x,lTexY);
+ // Log("ScreenOffset: %d %d (h: %d s: %d p: %d)\n",avPos.x,lScreenY,mvScreenSize.y,
+ // avSize.y,avPos.y);
- SetTexture(0, apTex);
- GL_CHECK(glCopyTexSubImage2D(GetGLTextureTargetEnum(apTex->GetTarget()),0,
- avTexOffset.x, lTexY, avPos.x, lScreenY, avSize.x, avSize.y));
+ SetTexture(0, apTex);
+ GL_CHECK(glCopyTexSubImage2D(GetGLTextureTargetEnum(apTex->GetTarget()), 0,
+ avTexOffset.x, lTexY, avPos.x, lScreenY, avSize.x, avSize.y));
}
//-----------------------------------------------------------------------
@@ -1456,17 +1433,17 @@ void cLowLevelGraphicsSDL::SetVirtualSize(cVector2f avSize) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetUpBatchArrays() {
- //Set the arrays
- glVertexPointer(3,GL_FLOAT, sizeof(float)*mlBatchStride, mpVertexArray);
- glColorPointer(4,GL_FLOAT, sizeof(float)*mlBatchStride, &mpVertexArray[3]);
- glNormalPointer(GL_FLOAT, sizeof(float)*mlBatchStride, &mpVertexArray[10]);
+ // Set the arrays
+ glVertexPointer(3, GL_FLOAT, sizeof(float) * mlBatchStride, mpVertexArray);
+ glColorPointer(4, GL_FLOAT, sizeof(float) * mlBatchStride, &mpVertexArray[3]);
+ glNormalPointer(GL_FLOAT, sizeof(float) * mlBatchStride, &mpVertexArray[10]);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
- glTexCoordPointer(3,GL_FLOAT, sizeof(float)*mlBatchStride, &mpVertexArray[7]);
+ glTexCoordPointer(3, GL_FLOAT, sizeof(float) * mlBatchStride, &mpVertexArray[7]);
glClientActiveTextureARB(GL_TEXTURE1_ARB);
- glTexCoordPointer(3,GL_FLOAT, sizeof(float)*mlBatchStride, &mpVertexArray[7]);
+ glTexCoordPointer(3, GL_FLOAT, sizeof(float) * mlBatchStride, &mpVertexArray[7]);
glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glTexCoordPointer(3,GL_FLOAT, sizeof(float)*mlBatchStride, &mpVertexArray[7]);
+ glTexCoordPointer(3, GL_FLOAT, sizeof(float) * mlBatchStride, &mpVertexArray[7]);
GL_CHECK_FN();
}
@@ -1726,7 +1703,7 @@ GLenum cLowLevelGraphicsSDL::GetGLAlphaTestFuncEnum(eAlphaTestFunc type) {
default:
break;
}
- Hpl1::logError(Hpl1::kDebugOpenGL ,"invalid alpha test function (%d)", type);
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid alpha test function (%d)", type);
return 0;
}
Commit: 4384e71d43a2dcb366b5dac5f611022b22c79453
https://github.com/scummvm/scummvm/commit/4384e71d43a2dcb366b5dac5f611022b22c79453
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:49+01:00
Commit Message:
HPL1: improve formatting in opengl error messages
Changed paths:
engines/hpl1/opengl.cpp
diff --git a/engines/hpl1/opengl.cpp b/engines/hpl1/opengl.cpp
index cbbf211e6ac..4d1e75cb1ba 100644
--- a/engines/hpl1/opengl.cpp
+++ b/engines/hpl1/opengl.cpp
@@ -38,6 +38,6 @@ namespace Hpl1 {
void checkOGLErrors(const char *function, const int line) {
GLenum code;
while((code = glGetError()) != GL_NO_ERROR)
- logError(kDebugOpenGL, "Opengl error: \'%s\' in function %s - %d", getErrorString(code), function, line);
+ logError(kDebugOpenGL, "Opengl error: \'%s\' in function %s - %d\n", getErrorString(code), function, line);
}
}
\ No newline at end of file
Commit: 0ee8e7e915f40e8ed412934663b81de52bf4c8ed
https://github.com/scummvm/scummvm/commit/0ee8e7e915f40e8ed412934663b81de52bf4c8ed
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:03:49+01:00
Commit Message:
HPL1: Fixed unused or shadow variables compiler warnings
Changed paths:
engines/hpl1/engine/ai/AINodeGenerator.cpp
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/graphics/AnimationTrack.cpp
engines/hpl1/engine/graphics/GfxObject.h
engines/hpl1/engine/graphics/MaterialHandler.cpp
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
engines/hpl1/engine/graphics/Mesh.cpp
engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
engines/hpl1/engine/graphics/Renderer2D.cpp
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/engine/graphics/RendererPostEffects.cpp
engines/hpl1/engine/graphics/font_data.cpp
engines/hpl1/engine/gui/WidgetComboBox.cpp
engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
engines/hpl1/engine/impl/MouseSDL.cpp
engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
engines/hpl1/engine/libraries/newton/core/dgTypes.h
engines/hpl1/engine/math/CRC.h
engines/hpl1/engine/math/Frustum.cpp
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/physics/CharacterBody.cpp
engines/hpl1/engine/physics/Collider2D.cpp
engines/hpl1/engine/physics/Physics.cpp
engines/hpl1/engine/physics/PhysicsBody.cpp
engines/hpl1/engine/physics/PhysicsController.cpp
engines/hpl1/engine/resources/ConfigFile.h
engines/hpl1/engine/resources/EntityLoader_Object.cpp
engines/hpl1/engine/resources/FrameBitmap.cpp
engines/hpl1/engine/resources/ImageManager.cpp
engines/hpl1/engine/resources/MeshManager.cpp
engines/hpl1/engine/resources/TextureManager.cpp
engines/hpl1/engine/scene/GridMap2D.cpp
engines/hpl1/engine/scene/Light3D.cpp
engines/hpl1/engine/scene/MeshEntity.cpp
engines/hpl1/engine/scene/PortalContainer.cpp
engines/hpl1/engine/scene/SectorVisibility.h
engines/hpl1/engine/sound/SoundHandler.cpp
engines/hpl1/engine/sound/SoundHandler.h
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/engine/system/low_level_system.cpp
engines/hpl1/penumbra-overture/AttackHandler.cpp
engines/hpl1/penumbra-overture/ButtonHandler.cpp
engines/hpl1/penumbra-overture/DemoEndText.h
engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
engines/hpl1/penumbra-overture/GameEnemy_Dog.h
engines/hpl1/penumbra-overture/GameEnemy_Spider.cpp
engines/hpl1/penumbra-overture/GameEnemy_Spider.h
engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
engines/hpl1/penumbra-overture/GameEntity.cpp
engines/hpl1/penumbra-overture/GameForceArea.cpp
engines/hpl1/penumbra-overture/GameItem.cpp
engines/hpl1/penumbra-overture/GameItemType.cpp
engines/hpl1/penumbra-overture/GameLadder.cpp
engines/hpl1/penumbra-overture/GameLiquidArea.cpp
engines/hpl1/penumbra-overture/GameObject.cpp
engines/hpl1/penumbra-overture/GameSwingDoor.cpp
engines/hpl1/penumbra-overture/HapticGameCamera.cpp
engines/hpl1/penumbra-overture/HudModel_Throw.cpp
engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
engines/hpl1/penumbra-overture/Inventory.cpp
engines/hpl1/penumbra-overture/Inventory.h
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/MapHandler.cpp
engines/hpl1/penumbra-overture/Player.cpp
engines/hpl1/penumbra-overture/Player.h
engines/hpl1/penumbra-overture/PlayerHands.cpp
engines/hpl1/penumbra-overture/PlayerHelper.cpp
engines/hpl1/penumbra-overture/PlayerHelper.h
engines/hpl1/penumbra-overture/PlayerMoveStates.h
engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
engines/hpl1/penumbra-overture/PlayerState_Misc.cpp
engines/hpl1/penumbra-overture/PlayerState_Misc.h
engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.cpp
engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.h
engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.h
engines/hpl1/penumbra-overture/SaveHandler.cpp
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.cpp b/engines/hpl1/engine/ai/AINodeGenerator.cpp
index fa680b2f8aa..c1b8d46accf 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.cpp
+++ b/engines/hpl1/engine/ai/AINodeGenerator.cpp
@@ -116,9 +116,9 @@ void cAINodeGenerator::Generate(cWorld3D *apWorld, cAINodeGeneratorParams *apPar
iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
- bool mbLoadFromFile = false;
+ //bool mbLoadFromFile = false;
- cSystem *pSystem = apWorld->GetSystem();
+ /*cSystem *pSystem = */apWorld->GetSystem();
cResources *pResources = apWorld->GetResources();
cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
@@ -264,7 +264,7 @@ bool cAINodeGenerator::OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apPar
if (pBody->GetMass() != 0)
return true;
- iPhysicsWorld *pPhysicsWorld = mpWorld->GetPhysicsWorld();
+ /*iPhysicsWorld *pPhysicsWorld = */mpWorld->GetPhysicsWorld();
cVector3f vPosition = apParams->mvPoint + cVector3f(0, mpParams->mfHeightFromGround, 0);
@@ -279,7 +279,7 @@ void cAINodeGenerator::SaveToFile() {
if (mpWorld->GetFileName() == "")
return;
- cSystem *pSystem = mpWorld->GetSystem();
+ /*cSystem *pSystem = */mpWorld->GetSystem();
cResources *pResources = mpWorld->GetResources();
cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
@@ -314,7 +314,7 @@ void cAINodeGenerator::LoadFromFile() {
if (mpWorld->GetFileName() == "")
return;
- cSystem *pSystem = mpWorld->GetSystem();
+ /*cSystem *pSystem = */mpWorld->GetSystem();
cResources *pResources = mpWorld->GetResources();
cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index bdaa56f57b5..d2d23da26ee 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -977,6 +977,10 @@ static float GetJointProperty(std::string asJointName, std::string asProp) {
iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider *>(pJoint);
return pSliderJoint->GetMinDistance();
}
+ case ePhysicsJointType_Ball:
+ break;
+ case ePhysicsJointType_LastEnum:
+ break;
}
}
/////////////////////////////
@@ -995,6 +999,10 @@ static float GetJointProperty(std::string asJointName, std::string asProp) {
iPhysicsJointSlider *pSliderJoint = static_cast<iPhysicsJointSlider *>(pJoint);
return pSliderJoint->GetMaxDistance();
}
+ case ePhysicsJointType_Ball:
+ break;
+ case ePhysicsJointType_LastEnum:
+ break;
}
}
diff --git a/engines/hpl1/engine/graphics/AnimationTrack.cpp b/engines/hpl1/engine/graphics/AnimationTrack.cpp
index 38d25528e1e..725aa044dd5 100644
--- a/engines/hpl1/engine/graphics/AnimationTrack.cpp
+++ b/engines/hpl1/engine/graphics/AnimationTrack.cpp
@@ -159,7 +159,7 @@ float cAnimationTrack::GetKeyFramesAtTime(float afTime, cKeyFrame **apKeyFrameA,
// Get T between end to start again. (the last frame doesn't mean the anim is over.
// In that case wrap to the first frame).
- float fDeltaT = fTotalAnimLength - (*apKeyFrameA)->time;
+ //float fDeltaT = fTotalAnimLength - (*apKeyFrameA)->time;
// If animation time is >= max time might as well just return the last frame.
// Not sure if this is good for some looping anims, in that case check the code.
diff --git a/engines/hpl1/engine/graphics/GfxObject.h b/engines/hpl1/engine/graphics/GfxObject.h
index a850c4b6208..23151baf195 100644
--- a/engines/hpl1/engine/graphics/GfxObject.h
+++ b/engines/hpl1/engine/graphics/GfxObject.h
@@ -51,7 +51,7 @@ public:
private:
tVertexVec mvVtx;
iMaterial *mpMat;
- float mfZ;
+ //float mfZ;
bool mbIsImage;
tString msSourceFile;
diff --git a/engines/hpl1/engine/graphics/MaterialHandler.cpp b/engines/hpl1/engine/graphics/MaterialHandler.cpp
index 6dcfa4f5c92..9e2781decf9 100644
--- a/engines/hpl1/engine/graphics/MaterialHandler.cpp
+++ b/engines/hpl1/engine/graphics/MaterialHandler.cpp
@@ -73,7 +73,7 @@ iMaterial *cMaterialHandler::Create(tString asMatName, eMaterialPicture mPicType
iMaterial *cMaterialHandler::Create(const tString &asName, tString asMatName, eMaterialPicture mPicType) {
iMaterial *pMat = NULL;
- cResourceImage *pImage = NULL;
+ //cResourceImage *pImage = NULL;
unsigned int lIdCount = 1;
for (tMaterialTypeListIt it = mlstMatTypes.begin(); it != mlstMatTypes.end(); it++) {
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
index cea92ad9069..8f6d832935a 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
@@ -67,7 +67,7 @@ void cGLState_Diffuse::UnBind() {
//-----------------------------------------------------------------------
cGLState_ATIDiffuse::cGLState_ATIDiffuse()
- : iGLStateProgram("Internal_ATIDiffuse"), mlBind(0) {
+ : iGLStateProgram("Internal_ATIDiffuse")/*, mlBind(0)*/ {
}
void cGLState_ATIDiffuse::InitData() {
@@ -148,7 +148,7 @@ void cGLState_Bump::UnBind() {
//-----------------------------------------------------------------------
cGLState_ATIBump::cGLState_ATIBump()
- : iGLStateProgram("Internal_ATIBump"), mlBind(0) {
+ : iGLStateProgram("Internal_ATIBump")/*, mlBind(0)*/ {
}
void cGLState_ATIBump::InitData() {
@@ -216,7 +216,7 @@ void cGLState_Spot::UnBind() {
//-----------------------------------------------------------------------
cGLState_ATISpot::cGLState_ATISpot()
- : iGLStateProgram("Internal_ATISpot"), mlBind(0) {
+ : iGLStateProgram("Internal_ATISpot")/*, mlBind(0)*/ {
}
void cGLState_ATISpot::InitData() {
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
index 299d6face92..9a774aea43a 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
@@ -123,7 +123,7 @@ public:
private:
void InitData();
- int mlBind;
+ //int mlBind;
};
//---------------------------------------------------------------
@@ -152,7 +152,7 @@ public:
private:
void InitData();
- int mlBind;
+ //int mlBind;
};
//---------------------------------------------------------------
@@ -181,7 +181,7 @@ public:
private:
void InitData();
- int mlBind;
+ //int mlBind;
};
//---------------------------------------------------------------
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
index 0fc594c4b3a..a48f7a83dfc 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
@@ -67,7 +67,7 @@ void cGLStateTwoUnits_Diffuse::UnBind() {
//-----------------------------------------------------------------------
cGLStateTwoUnits_ATIDiffuse::cGLStateTwoUnits_ATIDiffuse()
- : iGLStateProgram("Internal_TwoUnit_ATIDiffuse"), mlBind(0) {
+ : iGLStateProgram("Internal_TwoUnit_ATIDiffuse")/*, mlBind(0)*/ {
}
void cGLStateTwoUnits_ATIDiffuse::InitData() {
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
index 7530b31701f..274c9565351 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
@@ -115,7 +115,7 @@ public:
private:
void InitData();
- int mlBind;
+ //int mlBind;
};
//---------------------------------------------------------------
diff --git a/engines/hpl1/engine/graphics/Mesh.cpp b/engines/hpl1/engine/graphics/Mesh.cpp
index e20350174e5..af7efe1f720 100644
--- a/engines/hpl1/engine/graphics/Mesh.cpp
+++ b/engines/hpl1/engine/graphics/Mesh.cpp
@@ -367,7 +367,7 @@ void cMesh::CreateNodeBodies(iPhysicsBody **apRootBodyPtr, std::vector<iPhysicsB
iCollideShape *pShape = CreateCollideShapeFromCollider(pColl, apPhysicsWorld);
vShapes.push_back(pShape);
- cMatrixf mtxOffset = pShape->GetOffset();
+ /*cMatrixf mtxOffset = */pShape->GetOffset();
// Log("Created shape size: %s at %s. Mtx: %s\n",pShape->GetSize().ToString().c_str(),
// pShape->GetOffset().GetTranslation().ToString().c_str(),
// mtxOffset.ToString().c_str());
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp b/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
index 096fe6cdc42..aabb146d130 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
@@ -337,11 +337,11 @@ void iParticleEmitter3D::UpdateGraphics(cCamera3D *apCamera, float afFrameTime,
//////////////////////////////////////////////////
// LINE
else if (mDrawType == eParticleEmitter3DType_Line) {
- cVector3f vAdd[4] = {
+ /*cVector3f vAdd[4] = {
cVector3f(mvDrawSize.x, -mvDrawSize.y, 0),
cVector3f(-mvDrawSize.x, -mvDrawSize.y, 0),
cVector3f(-mvDrawSize.x, mvDrawSize.y, 0),
- cVector3f(mvDrawSize.x, mvDrawSize.y, 0)};
+ cVector3f(mvDrawSize.x, mvDrawSize.y, 0)};*/
int lVtxStride = kvVertexElements[cMath::Log2ToInt(eVertexFlag_Position)];
int lVtxQuadSize = lVtxStride * 4;
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
index 8ccf1f58449..1f555b2a154 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
@@ -953,6 +953,8 @@ void cParticleEmitter3D_UserData::UpdateMotion(float afTimeStep) {
break;
}
+ case ePEGravityType_LastEnum:
+ break;
}
if (pParticle->mfMaxSpeed > 0) {
diff --git a/engines/hpl1/engine/graphics/Renderer2D.cpp b/engines/hpl1/engine/graphics/Renderer2D.cpp
index aec4a97ee6b..639fb55efa8 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer2D.cpp
@@ -642,8 +642,8 @@ bool cRenderer2D::RenderShadows(cCamera2D *apCamera, iLight2D *pLight, cWorld2D
// Iterate all tiles
while (pTileIt->HasNext()) {
- cTile *pTile = pTileIt->Next();
- cTileDataNormal *pData = static_cast<cTileDataNormal *>(pTile->GetTileData());
+ cTile *pTile2 = pTileIt->Next();
+ cTileDataNormal *pData = static_cast<cTileDataNormal *>(pTile2->GetTileData());
if (pData->GetCollideMesh() == NULL)
continue;
@@ -659,10 +659,10 @@ bool cRenderer2D::RenderShadows(cCamera2D *apCamera, iLight2D *pLight, cWorld2D
}
}
- tMesh2DEdgeVec *pEdgeVec = pData->GetCollideMesh()->GetEdgeVec(pTile->GetAngle());
- tVertexVec *pVtxVec = pData->GetCollideVertexVec(pTile->GetAngle());
+ tMesh2DEdgeVec *pEdgeVec = pData->GetCollideMesh()->GetEdgeVec(pTile2->GetAngle());
+ tVertexVec *pVtxVec = pData->GetCollideVertexVec(pTile2->GetAngle());
- cVector2f vTilePos = cVector2f(pTile->GetPosition().x, pTile->GetPosition().y);
+ cVector2f vTilePos = cVector2f(pTile2->GetPosition().x, pTile2->GetPosition().y);
cVector2f vLightPos = cVector2f(pLight->GetWorldPosition().x, pLight->GetWorldPosition().y);
float fRadius = pLight->GetFarAttenuation();
bool bNonFit = false;
@@ -752,10 +752,10 @@ void cRenderer2D::FindShadowPoints(tMesh2DEdgeVec *apEdgeVec, cVector2f avLightP
cVector2f vEdgeNormal;
cVector2f vLightNormal;
- int lPrevWasShadow = -1;
- int lFirstWasShadow = -1;
+ //int lPrevWasShadow = -1;
+ //int lFirstWasShadow = -1;
mlShadowPointSize = 0;
- int lMaxEdge = (int)apEdgeVec->size() - 1;
+ //int lMaxEdge = (int)apEdgeVec->size() - 1;
for (int i = 0; i < (int)apEdgeVec->size(); i++) {
int point = (*apEdgeVec)[i].mlStartIndex;
@@ -778,7 +778,7 @@ void cRenderer2D::FindShadowPoints(tMesh2DEdgeVec *apEdgeVec, cVector2f avLightP
int cRenderer2D::CreateVertexes(cVector2f vLightPos, cRect2f LightRect, float fRadius, bool bNonFit,
cVector2f vTilePos, tVertexVec *apVtxVec, cColor ShadowColor, int lFirstIndex, float fSourceSize) {
- int lNum = 0;
+ //int lNum = 0;
// Walk through the edges
for (int idx = 0; idx < mlShadowPointSize; idx++) {
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index edf2aa163bb..3e77706aa38 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -873,7 +873,7 @@ void cRenderer3D::RenderTrans(cCamera3D *apCamera) {
mRenderSettings.mpTexture[i] = NULL;
}*/
- cVector3f vForward = apCamera->GetForward();
+ /*cVector3f vForward = */apCamera->GetForward();
//////////////////////////////////
// Iterate the query objects
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.cpp b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
index bd6e3458659..fe57bd29a09 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.cpp
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
@@ -466,7 +466,7 @@ void cRendererPostEffects::RenderMotionBlur() {
iTexture *pScreenTexture = mpScreenBuffer[mImageTrailData.mlCurrentBuffer == 0 ? 1 : 0];
// Size of the virtual screen
- cVector2f vVirtSize = mpLowLevelGraphics->GetVirtualSize();
+ /*cVector2f vVirtSize = */mpLowLevelGraphics->GetVirtualSize();
// Copy screen to texture
mpLowLevelGraphics->CopyContextToTexure(pScreenTexture, 0, cVector2l((int)mvScreenSize.x, (int)mvScreenSize.y));
@@ -580,7 +580,7 @@ void cRendererPostEffects::RenderBloom() {
RenderBlurTexture(mpBloomBlurTexture, pScreenTexture, mfBloomSpread);
// Size of blur texture
- cVector2f vBlurSize = cVector2f((float)mpBloomBlurTexture->getWidth(), (float)mpBloomBlurTexture->getHeight());
+ /*cVector2f vBlurSize = */cVector2f((float)mpBloomBlurTexture->getWidth(), (float)mpBloomBlurTexture->getHeight());
// Size of the virtual screen
cVector2f vVirtSize = mpLowLevelGraphics->GetVirtualSize();
diff --git a/engines/hpl1/engine/graphics/font_data.cpp b/engines/hpl1/engine/graphics/font_data.cpp
index 4f1974c8248..cc10b632afc 100644
--- a/engines/hpl1/engine/graphics/font_data.cpp
+++ b/engines/hpl1/engine/graphics/font_data.cpp
@@ -179,7 +179,7 @@ void FontData::draw(const cVector3f &avPos, const cVector2f &avSize, const cColo
va_end(ap);
int lCount = 0;
- float lXAdd = 0;
+ //float lXAdd = 0;
cVector3f vPos = avPos;
if (aAlign == eFontAlign_Center) {
@@ -336,7 +336,7 @@ void FontData::getWordWrapRows(float afLength, float afFontHeight, cVector2f avS
float FontData::getLength(const cVector2f &avSize, const wchar_t *sText) {
int lCount = 0;
- float lXAdd = 0;
+ //float lXAdd = 0;
float fLength = 0;
while (sText[lCount] != 0) {
unsigned short lGlyphNum = ((wchar_t)sText[lCount]);
@@ -348,8 +348,8 @@ float FontData::getLength(const cVector2f &avSize, const wchar_t *sText) {
Glyph *pGlyph = _glyphs[lGlyphNum];
if (pGlyph) {
- cVector2f vOffset(pGlyph->_offset * avSize);
- cVector2f vSize(pGlyph->_size * avSize);
+ //cVector2f vOffset(pGlyph->_offset * avSize);
+ //cVector2f vSize(pGlyph->_size * avSize);
fLength += pGlyph->_advance * avSize.x;
}
diff --git a/engines/hpl1/engine/gui/WidgetComboBox.cpp b/engines/hpl1/engine/gui/WidgetComboBox.cpp
index 0d1bb115958..99608c91c64 100644
--- a/engines/hpl1/engine/gui/WidgetComboBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetComboBox.cpp
@@ -418,7 +418,7 @@ bool cWidgetComboBox::OnMouseLeave(cGuiMessageData &aData) {
//-----------------------------------------------------------------------
bool cWidgetComboBox::OnLostFocus(cGuiMessageData &aData) {
- cVector3f vLocal = WorldToLocalPosition(aData.mvPos);
+ /*cVector3f vLocal = */WorldToLocalPosition(aData.mvPos);
if (mbMenuOpen && mpSlider->IsEnabled() == false) {
CloseMenu();
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
index b987d85388d..6fbc298d2b2 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
@@ -72,12 +72,12 @@ public:
private:
tString mvFormats[30];
- bool mbLogSounds;
+ //bool mbLogSounds;
bool mbInitialized;
- int mlEffectSlotId;
+ //int mlEffectSlotId;
bool mbNullEffectAttached;
- cOAL_Effect_Reverb *mpEffect;
+ //cOAL_Effect_Reverb *mpEffect;
};
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
index 17552ef3f75..3651dadef2a 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
@@ -410,7 +410,7 @@ cAnimationTrack *cMeshLoaderCollada::CreateAnimTrack(cAnimation *apAnimation, cS
return pTrack;
}
-static tString gsTemp;
+/*static tString gsTemp;
static const char *GetTabs(int alDepth) {
gsTemp = "";
@@ -418,7 +418,7 @@ static const char *GetTabs(int alDepth) {
gsTemp += "\t";
return gsTemp.c_str();
-}
+}*/
//-----------------------------------------------------------------------
@@ -748,7 +748,7 @@ void cMeshLoaderCollada::LoadColladaScene(TiXmlElement *apRootElem, cColladaNode
// Log("Node. %s, type: %s\n",pNode->msId.c_str(),pNode->msType.c_str());
- cVector3f vTranslation = cVector3f(0, 0, 0);
+ //cVector3f vTranslation = cVector3f(0, 0, 0);
///////////////////////////////////////////////////////////
// Iterate through all of the transforms.
@@ -1290,7 +1290,7 @@ void cMeshLoaderCollada::LoadGeometry(TiXmlElement *apRootElem, tColladaGeometry
}
int lTriElements = 0;
- int lTriCount = cString::ToInt(pTriElem->Attribute("count"), 0);
+ /*int lTriCount = */cString::ToInt(pTriElem->Attribute("count"), 0);
Geometry.msMaterial = cString::ToString(pTriElem->Attribute("material"), "");
GetAdress(Geometry.msMaterial);
diff --git a/engines/hpl1/engine/impl/MouseSDL.cpp b/engines/hpl1/engine/impl/MouseSDL.cpp
index 4206c841cd5..daa032fac25 100644
--- a/engines/hpl1/engine/impl/MouseSDL.cpp
+++ b/engines/hpl1/engine/impl/MouseSDL.cpp
@@ -91,8 +91,8 @@ static void setMouseState(const int state, Common::BitArray &states) {
void cMouseSDL::processEvent(const Common::Event &ev) {
if (!Common::isMouseEvent(ev))
return;
- const cVector2f screenSize = _lowLevelGraphics->GetScreenSize();
- const cVector2f virtualSize = _lowLevelGraphics->GetVirtualSize();
+ //const cVector2f screenSize = _lowLevelGraphics->GetScreenSize();
+ //const cVector2f virtualSize = _lowLevelGraphics->GetVirtualSize();
if (ev.type == Common::EVENT_MOUSEMOVE) {
_absMousePos = cVector2f(ev.mouse.x, ev.mouse.y);
//mvMouseAbsPos = (mvMouseAbsPos / screenSize) * virtualSize;
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp b/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
index c1ef773fc05..f8d81b565f0 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
@@ -317,7 +317,7 @@ const char *TiXmlBase::SkipWhiteSpace(const char *p, TiXmlEncoding encoding) {
break;
}
} else {
- while (*p && IsWhiteSpace(*p) || *p == '\n' || *p == '\r')
+ while ((*p && IsWhiteSpace(*p)) || *p == '\n' || *p == '\r')
++p;
}
diff --git a/engines/hpl1/engine/libraries/newton/core/dgTypes.h b/engines/hpl1/engine/libraries/newton/core/dgTypes.h
index 9c71b379f3a..1093fb1f65f 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgTypes.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgTypes.h
@@ -375,10 +375,10 @@ void dgRadixSort(T *const array,
scanCount[i] = scanCount[i - 1] + histogram[i - 1][radix + 1];
}
- dgInt32 radixShift = (radix + 1) << 3;
+ dgInt32 radixShift2 = (radix + 1) << 3;
for (dgInt32 i = 0; i < elements; i++) {
- dgInt32 key = (getRadixKey(&array[i], context) >> radixShift) & 0xff;
+ dgInt32 key = (getRadixKey(&array[i], context) >> radixShift2) & 0xff;
dgInt32 index = scanCount[key];
array[index] = tmpArray[i];
scanCount[key] = index + 1;
diff --git a/engines/hpl1/engine/math/CRC.h b/engines/hpl1/engine/math/CRC.h
index aa50ba1316e..323f92553f3 100644
--- a/engines/hpl1/engine/math/CRC.h
+++ b/engines/hpl1/engine/math/CRC.h
@@ -52,7 +52,7 @@ private:
class cCRC {
public:
- cCRC(tCRCKey key) : mKey(key), mRegister(0) {
+ cCRC(tCRCKey key) : mRegister(0) {
mTable.Init(key);
}
@@ -66,7 +66,6 @@ public:
private:
static cCRCTable mTable;
- tCRCKey mKey;
tCRCKey mRegister;
};
diff --git a/engines/hpl1/engine/math/Frustum.cpp b/engines/hpl1/engine/math/Frustum.cpp
index 8388eb592cc..d453639fdc2 100644
--- a/engines/hpl1/engine/math/Frustum.cpp
+++ b/engines/hpl1/engine/math/Frustum.cpp
@@ -305,7 +305,7 @@ void cFrustum::UpdateEndPoints() {
float fYAngle = mfFOV * 0.5f * mfAspect;
cVector3f vForward = m_mtxModelView.GetForward();
- cVector3f vUp = m_mtxModelView.GetUp();
+ //cVector3f vUp = m_mtxModelView.GetUp();
cVector3f vRight = m_mtxModelView.GetRight();
// Point the forward vec in different dirs.
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index a3d2b671ecb..c700332a33f 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -1001,6 +1001,8 @@ cMatrixf cMath::MatrixRotate(cVector3f avRot, eEulerRotationOrder aOrder) {
mtxRot = MatrixMul(MatrixRotateY(avRot.y), mtxRot);
mtxRot = MatrixMul(MatrixRotateX(avRot.x), mtxRot);
break;
+ case eEulerRotationOrder_LastEnum:
+ break;
}
return mtxRot;
@@ -1164,12 +1166,12 @@ static inline cVector3f GetVector3(const float *apVertexArray, int alIdx, int al
return cVector3f(apVec[0], apVec[1], apVec[2]);
}
-static inline void AddVector3(float *apArray, int alIdx, const cVector3f &avVec, int alStride) {
+/*static inline void AddVector3(float *apArray, int alIdx, const cVector3f &avVec, int alStride) {
float *apVec = &apArray[alIdx * alStride];
apVec[0] += avVec.x;
apVec[1] += avVec.y;
apVec[2] += avVec.z;
-}
+}*/
static inline void SetVector4(const cVector3f &avVec, float afW, float *apArray, int alIdx) {
float *apVec = &apArray[alIdx * 4];
@@ -1342,8 +1344,7 @@ bool cMath::CreateTriangleData(tTriangleDataVec &avTriangles,
}
//-----------------------------------------------------------------------
-
-static bool EdgePointEqual(const float *apVertexArray,
+/*static bool EdgePointEqual(const float *apVertexArray,
const cTriEdge &edge1, const cTriEdge &edge2, int alStride) {
if (Vector3Equal(apVertexArray, edge1.point1, apVertexArray, edge2.point1, alStride) &&
Vector3Equal(apVertexArray, edge1.point2, apVertexArray, edge2.point2, alStride)) {
@@ -1375,7 +1376,7 @@ static bool EdgeEqual(const float *apVertexArray, const cTriEdge &edge1, const c
return true;
return false;
-}
+}*/
/////////////////////////
diff --git a/engines/hpl1/engine/physics/CharacterBody.cpp b/engines/hpl1/engine/physics/CharacterBody.cpp
index 39ddbb38ca7..b3f35a7dee4 100644
--- a/engines/hpl1/engine/physics/CharacterBody.cpp
+++ b/engines/hpl1/engine/physics/CharacterBody.cpp
@@ -825,7 +825,7 @@ void iCharacterBody::Update(float afTimeStep) {
mvPosition += cVector3f(mvVelolcity.x, 0, mvVelolcity.z) * afTimeStep;
vNewPos = mvPosition;
- bool bCollide = mpWorld->CheckShapeWorldCollision(&vNewPos, mpBody->GetShape(), cMath::MatrixTranslate(mvPosition),
+ /*bool bCollide = */mpWorld->CheckShapeWorldCollision(&vNewPos, mpBody->GetShape(), cMath::MatrixTranslate(mvPosition),
mpBody, false, true, NULL, mbCollideCharacter);
// Set new velocity depending on collisions.
diff --git a/engines/hpl1/engine/physics/Collider2D.cpp b/engines/hpl1/engine/physics/Collider2D.cpp
index 7e5db85abfe..c0c2260fbc3 100644
--- a/engines/hpl1/engine/physics/Collider2D.cpp
+++ b/engines/hpl1/engine/physics/Collider2D.cpp
@@ -309,7 +309,7 @@ tFlag cCollider2D::CollideLine(const cVector2f &avStart, const cVector2f &avEnd,
//// Check for all tiles if the flag is set
if (alCollideFlags & eFlagBit_0) {
- float fTileSize = mpWorld->GetTileMap()->GetTileSize();
+ /*float fTileSize = */mpWorld->GetTileMap()->GetTileSize();
for (int i = 0; i < mpWorld->GetTileMap()->GetTileLayerNum(); i++) {
if (mpWorld->GetTileMap()->GetTileLayer(i)->HasCollision() == false)
diff --git a/engines/hpl1/engine/physics/Physics.cpp b/engines/hpl1/engine/physics/Physics.cpp
index 4cb82d24ad6..6b17b4b5fc3 100644
--- a/engines/hpl1/engine/physics/Physics.cpp
+++ b/engines/hpl1/engine/physics/Physics.cpp
@@ -248,7 +248,7 @@ bool cPhysics::LoadSurfaceData(const tString &asFile, cHaptic *apHaptic) {
float fDeadHeight = cString::ToFloat(pChildElem->Attribute("HapticDeadHeight"), 0.004f);
float fStickyStiffness = cString::ToFloat(pChildElem->Attribute("HapticStickyStiffness"), 0.6f);
- float fDeviation = cString::ToFloat(pChildElem->Attribute("HapticDeviation"), 0.1f);
+ //float fDeviation = cString::ToFloat(pChildElem->Attribute("HapticDeviation"), 0.1f);
float fMean = cString::ToFloat(pChildElem->Attribute("HapticMean"), 0.5f);
float fDamping = cString::ToFloat(pChildElem->Attribute("HapticDamping"), 0.0f);
float fStiffness = cString::ToFloat(pChildElem->Attribute("HapticStiffness"), 0.9f);
diff --git a/engines/hpl1/engine/physics/PhysicsBody.cpp b/engines/hpl1/engine/physics/PhysicsBody.cpp
index 594b4dfd62a..ddbfe9333f5 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.cpp
+++ b/engines/hpl1/engine/physics/PhysicsBody.cpp
@@ -406,6 +406,12 @@ kBeginSerializeBase(cSaveData_iCollideShape)
return apWorld->CreateCylinderShape(apData->mvSize.x, apData->mvSize.y, &apData->m_mtxOffset);
case eCollideShapeType_Capsule:
return apWorld->CreateCapsuleShape(apData->mvSize.x, apData->mvSize.y, &apData->m_mtxOffset);
+ case eCollideShapeType_Null:
+ case eCollideShapeType_ConvexHull:
+ case eCollideShapeType_Mesh:
+ case eCollideShapeType_Compound:
+ case eCollideShapeType_LastEnum:
+ break;
}
Warning("Invalid shape type %d!\n", apData->mType);
diff --git a/engines/hpl1/engine/physics/PhysicsController.cpp b/engines/hpl1/engine/physics/PhysicsController.cpp
index eb7d1c89a46..e93023a91ca 100644
--- a/engines/hpl1/engine/physics/PhysicsController.cpp
+++ b/engines/hpl1/engine/physics/PhysicsController.cpp
@@ -154,6 +154,8 @@ cVector3f iPhysicsController::GetInputValue(ePhysicsControllerInput aInput) {
return mpJoint ? mpJoint->GetAngle() : 0;
case ePhysicsControllerInput_JointDist:
return mpJoint ? mpJoint->GetDistance() : 0;
+ case ePhysicsControllerInput_LastEnum:
+ break;
}
return 0;
}
@@ -191,6 +193,8 @@ void iPhysicsController::AddOutputValue(ePhysicsControllerOutput aOutput,
case ePhysicsControllerAxis_Z:
vVec.z = afVal;
break;
+ case ePhysicsControllerAxis_LastEnum:
+ break;
}
if (mbMulMassWithOutput)
@@ -206,6 +210,8 @@ void iPhysicsController::AddOutputValue(ePhysicsControllerOutput aOutput,
case ePhysicsControllerOutput_Force:
mpBody->AddForce(vVec);
break;
+ case ePhysicsControllerOutput_LastEnum:
+ break;
}
}
@@ -219,6 +225,8 @@ float iPhysicsController::GetAxisValue(ePhysicsControllerAxis aAxis, const cVect
return avVec.y;
case ePhysicsControllerAxis_Z:
return avVec.z;
+ case ePhysicsControllerAxis_LastEnum:
+ break;
}
return 0;
}
diff --git a/engines/hpl1/engine/resources/ConfigFile.h b/engines/hpl1/engine/resources/ConfigFile.h
index 7e4612f19d4..926271b9305 100644
--- a/engines/hpl1/engine/resources/ConfigFile.h
+++ b/engines/hpl1/engine/resources/ConfigFile.h
@@ -63,7 +63,7 @@ public:
private:
tWString msFile;
- cFileSearcher *mpFileSearcher;
+ //cFileSearcher *mpFileSearcher;
TiXmlDocument *mpXmlDoc;
diff --git a/engines/hpl1/engine/resources/EntityLoader_Object.cpp b/engines/hpl1/engine/resources/EntityLoader_Object.cpp
index 3b5f3e5b71f..f465aa826ad 100644
--- a/engines/hpl1/engine/resources/EntityLoader_Object.cpp
+++ b/engines/hpl1/engine/resources/EntityLoader_Object.cpp
@@ -581,7 +581,7 @@ iEntity3D *cEntityLoader_Object::Load(const tString &asName, TiXmlElement *apRoo
cMeshEntity *pEntityCopy = mpEntity;
cMesh *pMeshCopy = mpMesh;
for (int i = 0; i < pMeshCopy->GetReferenceNum(); i++) {
- iEntity3D *pRef = mpMesh->CreateReferenceInWorld(asName, pMeshCopy->GetReference(i), pEntityCopy,
+ /*iEntity3D *pRef = */mpMesh->CreateReferenceInWorld(asName, pMeshCopy->GetReference(i), pEntityCopy,
apWorld, a_mtxTransform);
// if(pPS) mvParticleSystems.push_back(pPS);
}
@@ -612,14 +612,11 @@ void cEntityLoader_Object::SetBodyProperties(iPhysicsBody *apBody, TiXmlElement
bool bContinuousCollision = cString::ToBool(apPhysicsElem->Attribute("ContinuousCollision"), true);
bool bPushedByCharacterGravity = cString::ToBool(apPhysicsElem->Attribute("PushedByCharacterGravity"), false);
-
- float fAutoDisableLinearThreshold = cString::ToFloat(apPhysicsElem->Attribute("AutoDisableLinearThreshold"),
- 0.1f);
- float fAutoDisableAngularThreshold = cString::ToFloat(apPhysicsElem->Attribute("AutoDisableAngularThreshold"),
- 0.1f);
- int lAutoDisableNumSteps = cString::ToInt(apPhysicsElem->Attribute("AutoDisableNumSteps"),
- 10);
-
+#if 0
+ float fAutoDisableLinearThreshold = cString::ToFloat(apPhysicsElem->Attribute("AutoDisableLinearThreshold"), 0.1f);
+ float fAutoDisableAngularThreshold = cString::ToFloat(apPhysicsElem->Attribute("AutoDisableAngularThreshold"), 0.1f);
+ int lAutoDisableNumSteps = cString::ToInt(apPhysicsElem->Attribute("AutoDisableNumSteps"), 10);
+#endif
bool bVolatile = cString::ToBool(apPhysicsElem->Attribute("Volatile"), false);
bool bCanAttachCharacter = cString::ToBool(apPhysicsElem->Attribute("CanAttachCharacter"), false);
diff --git a/engines/hpl1/engine/resources/FrameBitmap.cpp b/engines/hpl1/engine/resources/FrameBitmap.cpp
index 15a8d6037c6..1a5e6011161 100644
--- a/engines/hpl1/engine/resources/FrameBitmap.cpp
+++ b/engines/hpl1/engine/resources/FrameBitmap.cpp
@@ -81,8 +81,8 @@ namespace hpl {
int lSH = apSrc->getHeight()+2;
//destination size
- int lDW = mpBitmap->getWidth();
- int lDH = mpBitmap->getHeight();
+ //int lDW = mpBitmap->getWidth();
+ //int lDH = mpBitmap->getHeight();
cVector2l vPos;
@@ -200,28 +200,28 @@ namespace hpl {
if(DEBUG_BTREE)
{
Log("Current Tree begin:\n");
- tRectTreeNodeList lstNodes = mRects.GetNodeList();
- tRectTreeNodeListIt it;
- int node=0;
- for(it = lstNodes.begin();it!=lstNodes.end();++it)
+ tRectTreeNodeList lstNodes2 = mRects.GetNodeList();
+ tRectTreeNodeListIt it2;
+ int node2=0;
+ for(it2 = lstNodes2.begin();it2!=lstNodes2.end();++it)
{
- cRect2l Rect = (*it)->GetData()->mRect;
+ cRect2l Rect = (*it2)->GetData()->mRect;
int h = (*it)->GetData()->mlHandle;
- Log(" %d: [%d:%d:%d:%d]:%d\n",node,Rect.x,Rect.y,Rect.w,Rect.h,h);
- node++;
+ Log(" %d: [%d:%d:%d:%d]:%d\n",node2,Rect.x,Rect.y,Rect.w,Rect.h,h);
+ node2++;
}
Log("Current Tree end:\n");
Log("-----------------\n");
Log("Current Leaves begin:\n");
- lstNodes = mRects.GetLeafList();
- node=0;
- for(it = lstNodes.begin();it!=lstNodes.end();++it)
+ lstNodes2 = mRects.GetLeafList();
+ node2=0;
+ for(it2 = lstNodes2.begin();it2!=lstNodes2.end();++it)
{
- cRect2l Rect = (*it)->GetData()->mRect;
- int h = (*it)->GetData()->mlHandle;
- Log(" %d: [%d:%d:%d:%d]: %d\n",node,Rect.x,Rect.y,Rect.w,Rect.h,h);
- node++;
+ cRect2l Rect = (*it2)->GetData()->mRect;
+ int h = (*it2)->GetData()->mlHandle;
+ Log(" %d: [%d:%d:%d:%d]: %d\n",node2,Rect.x,Rect.y,Rect.w,Rect.h,h);
+ node2++;
}
Log("Current Tree end:\n");
Log("-----------------\n");
diff --git a/engines/hpl1/engine/resources/ImageManager.cpp b/engines/hpl1/engine/resources/ImageManager.cpp
index 337733ecd79..8db5a28bd1a 100644
--- a/engines/hpl1/engine/resources/ImageManager.cpp
+++ b/engines/hpl1/engine/resources/ImageManager.cpp
@@ -180,10 +180,10 @@ void cImageManager::Destroy(iResourceBase *apResource) {
// Delete the bitmap frame that has this this frame.
for (tFrameBitmapListIt it = mlstBitmapFrames.begin(); it != mlstBitmapFrames.end(); ++it) {
- cFrameBitmap *pBmpFrame = *it;
- if (pBmpFrame->GetFrameTexture() == pFrame) {
+ cFrameBitmap *pBmpFrame2 = *it;
+ if (pBmpFrame2->GetFrameTexture() == pFrame) {
// Log("and bitmap...");
- hplDelete(pBmpFrame);
+ hplDelete(pBmpFrame2);
mlstBitmapFrames.erase(it);
break;
}
diff --git a/engines/hpl1/engine/resources/MeshManager.cpp b/engines/hpl1/engine/resources/MeshManager.cpp
index 0e2ce916096..84075c984c4 100644
--- a/engines/hpl1/engine/resources/MeshManager.cpp
+++ b/engines/hpl1/engine/resources/MeshManager.cpp
@@ -78,8 +78,8 @@ cMesh *cMeshManager::CreateMesh(const tString &asName) {
tStringVec *pTypes = mpResources->GetMeshLoaderHandler()->GetSupportedTypes();
for (size_t i = 0; i < pTypes->size(); i++) {
asNewName = cString::SetFileExt(asNewName, (*pTypes)[i]);
- tString sPath = mpResources->GetFileSearcher()->GetFilePath(asNewName);
- if (sPath != "") {
+ tString sPath2 = mpResources->GetFileSearcher()->GetFilePath(asNewName);
+ if (sPath2 != "") {
bFound = true;
break;
}
diff --git a/engines/hpl1/engine/resources/TextureManager.cpp b/engines/hpl1/engine/resources/TextureManager.cpp
index d8478956a98..1f02cb803ff 100644
--- a/engines/hpl1/engine/resources/TextureManager.cpp
+++ b/engines/hpl1/engine/resources/TextureManager.cpp
@@ -302,8 +302,8 @@ iTexture *cTextureManager::CreateAttenuation(const tString &asFallOffName) {
if (cString::GetFileExt(asFallOffName) != "") {
sPath = mpFileSearcher->GetFilePath(asFallOffName);
} else {
- for (tStringListIt it = mlstFileFormats.begin(); it != mlstFileFormats.end(); ++it) {
- tString sFileName = cString::SetFileExt(asFallOffName, *it);
+ for (tStringListIt it2 = mlstFileFormats.begin(); it2 != mlstFileFormats.end(); ++it2) {
+ tString sFileName = cString::SetFileExt(asFallOffName, *it2);
sPath = mpFileSearcher->GetFilePath(sFileName);
if (sPath != "")
break;
@@ -322,7 +322,7 @@ iTexture *cTextureManager::CreateAttenuation(const tString &asFallOffName) {
int lBmpChannels = pBmp->getNumChannels();
int lWidth = pBmp->getWidth();
- unsigned char *pPixels = (unsigned char *)pBmp->getRawData();
+ unsigned char *pPixels = (unsigned char *)const_cast<void *>(pBmp->getRawData());
iTexture *pTexture = mpGraphics->GetLowLevel()->CreateTexture("Attenuation", false, eTextureType_Normal, eTextureTarget_3D);
int lSize = 16;
diff --git a/engines/hpl1/engine/scene/GridMap2D.cpp b/engines/hpl1/engine/scene/GridMap2D.cpp
index 718e80199f7..c015a791695 100644
--- a/engines/hpl1/engine/scene/GridMap2D.cpp
+++ b/engines/hpl1/engine/scene/GridMap2D.cpp
@@ -213,7 +213,7 @@ iEntity2D *cGridMap2DRectIt::Next() {
//-----------------------------------------------------------------------
void cGridMap2DRectIt::GetGridObject() {
- bool bEnd = false;
+ //bool bEnd = false;
switch (mlType) {
//// GLOBAL OBJECTS //////////////////
diff --git a/engines/hpl1/engine/scene/Light3D.cpp b/engines/hpl1/engine/scene/Light3D.cpp
index f94abe9ba44..b373091737c 100644
--- a/engines/hpl1/engine/scene/Light3D.cpp
+++ b/engines/hpl1/engine/scene/Light3D.cpp
@@ -817,7 +817,7 @@ void iLight3D::RenderShadow(iRenderable *apObject, cRenderSettings *apRenderSett
void iLight3D::OnFlickerOff() {
// Particle system
if (msFlickerOffPS != "") {
- cParticleSystem3D *pPS = mpWorld3D->CreateParticleSystem(GetName() + "_PS",
+ /*cParticleSystem3D *pPS = */mpWorld3D->CreateParticleSystem(GetName() + "_PS",
msFlickerOffPS, cVector3f(1, 1, 1), GetWorldMatrix());
}
}
@@ -827,7 +827,7 @@ void iLight3D::OnFlickerOff() {
void iLight3D::OnFlickerOn() {
// Particle system
if (msFlickerOnPS != "") {
- cParticleSystem3D *pPS = mpWorld3D->CreateParticleSystem(GetName() + "_PS",
+ /*cParticleSystem3D *pPS = */mpWorld3D->CreateParticleSystem(GetName() + "_PS",
msFlickerOnPS, cVector3f(1, 1, 1), GetWorldMatrix());
}
}
diff --git a/engines/hpl1/engine/scene/MeshEntity.cpp b/engines/hpl1/engine/scene/MeshEntity.cpp
index 4ae12c81aac..f3eea405c50 100644
--- a/engines/hpl1/engine/scene/MeshEntity.cpp
+++ b/engines/hpl1/engine/scene/MeshEntity.cpp
@@ -234,7 +234,7 @@ cMeshEntity::cMeshEntity(const tString asName, cMesh *apMesh, cMaterialManager *
// Set the sub entity with the mesh node world matrix
cSubMeshEntity *pSubEntity = GetSubMeshEntityName(pMeshNode->GetSource());
if (pSubEntity) {
- cSubMesh *pSubMesh = pSubEntity->GetSubMesh();
+ /*cSubMesh *pSubMesh = */pSubEntity->GetSubMesh();
cMatrixf mtxSub = pMeshNode->GetWorldMatrix();
pSubEntity->SetMatrix(mtxSub);
@@ -352,8 +352,8 @@ cMeshEntity::cMeshEntity(const tString asName, cMesh *apMesh, cMaterialManager *
cMeshEntity::~cMeshEntity() {
for (tEntity3DListIt it = mlstAttachedEntities.begin(); it != mlstAttachedEntities.end(); ++it) {
- iEntity3D *pEntity = *it;
- // TODOD: if(mpWorld) mpWorld->DestroyUnkownEntity(pEntity);
+ //iEntity3D *pEntity = *it;
+ // TODO: if(mpWorld) mpWorld->DestroyUnkownEntity(pEntity);
}
for (int i = 0; i < (int)mvSubMeshes.size(); i++) {
@@ -566,8 +566,8 @@ void cMeshEntity::UpdateLogic(float afTimeStep) {
cAnimation *pAnim = pAnimState->GetAnimation();
- for (int i = 0; i < pAnim->GetTrackNum(); i++) {
- cAnimationTrack *pTrack = pAnim->GetTrack(i);
+ for (int i2 = 0; i < pAnim->GetTrackNum(); i++) {
+ cAnimationTrack *pTrack = pAnim->GetTrack(i2);
if (pTrack->GetNodeIndex() < 0) {
pTrack->SetNodeIndex(GetNodeStateIndex(pTrack->GetName()));
@@ -677,8 +677,8 @@ void cMeshEntity::UpdateLogic(float afTimeStep) {
if (pAnimState->IsActive()) {
cAnimation *pAnim = pAnimState->GetAnimation();
- for (int i = 0; i < pAnim->GetTrackNum(); i++) {
- cAnimationTrack *pTrack = pAnim->GetTrack(i);
+ for (int i2 = 0; i2 < pAnim->GetTrackNum(); i2++) {
+ cAnimationTrack *pTrack = pAnim->GetTrack(i2);
cNode3D *pState = GetBoneState(pTrack->GetNodeIndex());
@@ -920,7 +920,7 @@ void cMeshEntity::FadeSkeletonPhysicsWeight(float afTime) {
for (int bone = 0; bone < GetBoneStateNum(); ++bone) {
cBoneState *pState = GetBoneState(bone);
iPhysicsBody *pBody = pState->GetBody();
- iPhysicsBody *pColliderBody = pState->GetColliderBody();
+ /*iPhysicsBody *pColliderBody = */pState->GetColliderBody();
if (pBody)
pBody->SetActive(false);
@@ -1285,7 +1285,7 @@ void cMeshEntity::HandleAnimationEvent(cAnimationEvent *apEvent) {
}
break;
}
- defzult:
+ default:
break;
}
}
@@ -1351,9 +1351,9 @@ void cMeshEntity::UpdateBVFromSubs() {
// exported. This to give a working Bounding Volume.
// This fells kind a slow... but might be only way..
- cMatrixf mtxTemp;
+ cMatrixf mtxTemp2;
if (mpRootNode) {
- mtxTemp = mpRootNode->GetWorldMatrix();
+ mtxTemp2 = mpRootNode->GetWorldMatrix();
mpRootNode->SetMatrix(cMatrixf::Identity);
}
@@ -1383,7 +1383,7 @@ void cMeshEntity::UpdateBVFromSubs() {
mBoundingVolume.SetLocalMinMax(vFinalMin, vFinalMax);
if (mpRootNode) {
- mpRootNode->SetMatrix(mtxTemp);
+ mpRootNode->SetMatrix(mtxTemp2);
} else {
}
}
@@ -1413,8 +1413,8 @@ kBeginSerialize(cSaveData_cMeshEntity, cSaveData_iRenderable)
cResources *pResources = apGame->GetResources();
cWorld3D *pWorld = apGame->GetScene()->GetWorld3D();
- cMeshLoaderHandler *pMeshLoadHandler = pResources->GetMeshLoaderHandler();
- cFileSearcher *pFileSearcher = pResources->GetFileSearcher();
+ /*cMeshLoaderHandler *pMeshLoadHandler = */pResources->GetMeshLoaderHandler();
+ /*cFileSearcher *pFileSearcher = */pResources->GetFileSearcher();
///////////////////////////////////
// Load mesh
diff --git a/engines/hpl1/engine/scene/PortalContainer.cpp b/engines/hpl1/engine/scene/PortalContainer.cpp
index 5d7a752aae9..cbe49f29ae2 100644
--- a/engines/hpl1/engine/scene/PortalContainer.cpp
+++ b/engines/hpl1/engine/scene/PortalContainer.cpp
@@ -905,9 +905,9 @@ void cPortalContainer::AddLightShadowCasters(iLight3D *apLight, cFrustum *apFrus
// If the light is static and the static list is not filled yet.
if (!(apLight->IsStatic() && apLight->AllStaticCastersAdded())) {
- tRenderableSetIt it = pSector->m_setStaticObjects.begin();
- for (; it != pSector->m_setStaticObjects.end(); ++it) {
- iRenderable *pR = *it;
+ tRenderableSetIt it2 = pSector->m_setStaticObjects.begin();
+ for (; it2 != pSector->m_setStaticObjects.end(); ++it2) {
+ iRenderable *pR = *it2;
if (bLog)
Log("Adding static '%s' type: %s\n", pR->GetName().c_str(), pR->GetEntityType().c_str());
apLight->AddShadowCaster(pR, apFrustum, true, apRenderList);
@@ -915,9 +915,9 @@ void cPortalContainer::AddLightShadowCasters(iLight3D *apLight, cFrustum *apFrus
}
// Add dynamic objects
- tRenderableSetIt it = pSector->m_setDynamicObjects.begin();
- for (; it != pSector->m_setDynamicObjects.end(); ++it) {
- iRenderable *pR = *it;
+ tRenderableSetIt it2 = pSector->m_setDynamicObjects.begin();
+ for (; it2 != pSector->m_setDynamicObjects.end(); ++it2) {
+ iRenderable *pR = *it2;
if (bLog)
Log("Adding dynamic '%s' type: %s\n", pR->GetName().c_str(), pR->GetEntityType().c_str());
apLight->AddShadowCaster(pR, apFrustum, false, apRenderList);
diff --git a/engines/hpl1/engine/scene/SectorVisibility.h b/engines/hpl1/engine/scene/SectorVisibility.h
index 268c11c2263..52e82c7ed85 100644
--- a/engines/hpl1/engine/scene/SectorVisibility.h
+++ b/engines/hpl1/engine/scene/SectorVisibility.h
@@ -160,7 +160,7 @@ private:
tString GetTabs();
- cPortalContainer *mpContainer;
+ //cPortalContainer *mpContainer;
tSectorSet m_setStartSectors;
diff --git a/engines/hpl1/engine/sound/SoundHandler.cpp b/engines/hpl1/engine/sound/SoundHandler.cpp
index 2cc5faa03f9..c53d58aa14b 100644
--- a/engines/hpl1/engine/sound/SoundHandler.cpp
+++ b/engines/hpl1/engine/sound/SoundHandler.cpp
@@ -877,15 +877,15 @@ iSoundChannel *cSoundHandler::CreateChannel(const tString &asName, int alPriorit
}
if (lCount > 0) {
- int lNum = cMath::RandRectl(1, lCount);
+ int lNum2 = cMath::RandRectl(1, lCount);
if (lCount > 2) {
- while (lLastNum == lNum)
- lNum = cMath::RandRectl(1, lCount);
+ while (lLastNum == lNum2)
+ lNum2 = cMath::RandRectl(1, lCount);
}
- SoundIt->second = lNum;
+ SoundIt->second = lNum2;
- sName = sBaseName + cString::ToString(lNum);
+ sName = sBaseName + cString::ToString(lNum2);
pData = mpResources->GetSoundManager()->CreateSoundData(sName, false);
diff --git a/engines/hpl1/engine/sound/SoundHandler.h b/engines/hpl1/engine/sound/SoundHandler.h
index 9d34cfc8e64..8857f777148 100644
--- a/engines/hpl1/engine/sound/SoundHandler.h
+++ b/engines/hpl1/engine/sound/SoundHandler.h
@@ -59,7 +59,7 @@ public:
private:
bool mbHasCollided;
- int mlCount;
+ //int mlCount;
};
//----------------------------------------
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index c480ecd9af6..4c36ebaf08a 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -812,7 +812,7 @@ void cSerializeClass::LoadArray(TiXmlElement *apElement, iSerializable *apData,
tString sName = cString::ToString(apElement->Attribute("name"), "");
tString sClassType = cString::ToString(apElement->Attribute("class_type"), "");
eSerializeType type = cString::ToInt(apElement->Attribute("type"), eSerializeMainType_NULL);
- size_t lSize = cString::ToInt(apElement->Attribute("size"), 0);
+ //size_t lSize = cString::ToInt(apElement->Attribute("size"), 0);
if (gbLog) {
Log("%s Begin Saving array: '%s' classtype: %s type %d\n", GetTabs(), sName.c_str(), sClassType.c_str(), type);
@@ -846,13 +846,13 @@ void cSerializeClass::LoadArray(TiXmlElement *apElement, iSerializable *apData,
size_t lOffset = sizeof(void *) * lCount;
iSerializable **pValuePtr = (iSerializable **)ValuePointer(pArrayData, lOffset);
- tString sClassType = cString::ToString(pVarElem->Attribute("type"), "");
- cSerializeSavedClass *pSavedClass = GetClass(sClassType);
+ tString sClassType2 = cString::ToString(pVarElem->Attribute("type"), "");
+ cSerializeSavedClass *pSavedClass = GetClass(sClassType2);
if (pSavedClass == NULL)
continue;
if (gbLog)
- Log("%s Element Class pointer: %s\n", GetTabs(), sClassType.c_str());
+ Log("%s Element Class pointer: %s\n", GetTabs(), sClassType2.c_str());
// If NULL, then just create else delete and then create-
// virtual pointers here...yes yes...
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index a04fbea7d90..5268b1096d7 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -127,7 +127,7 @@ void CreateMessageBoxW(const wchar_t *caption, const wchar_t *fmt, ...) {
//-----------------------------------------------------------------------
-static cDate DateFromGMTIme(struct tm *apClock) {
+/*static cDate DateFromGMTIme(struct tm *apClock) {
cDate date;
date.seconds = apClock->tm_sec;
@@ -140,7 +140,7 @@ static cDate DateFromGMTIme(struct tm *apClock) {
date.year_day = apClock->tm_yday;
return date;
-}
+}*/
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/AttackHandler.cpp b/engines/hpl1/penumbra-overture/AttackHandler.cpp
index 4f496f7ab34..b0482c0ce76 100644
--- a/engines/hpl1/penumbra-overture/AttackHandler.cpp
+++ b/engines/hpl1/penumbra-overture/AttackHandler.cpp
@@ -210,7 +210,7 @@ bool cAttackHandler::CreateShapeAttack(iCollideShape *apShape, const cMatrixf &a
std::list<iPhysicsBody *>::iterator it = lstTempBodies.begin();
for (; it != lstTempBodies.end(); ++it) {
iPhysicsBody *pBody = *it;
- float fMass = pBody->GetMass();
+ /*float fMass = */pBody->GetMass();
if (pBody->IsActive() == false)
continue;
@@ -247,14 +247,14 @@ bool cAttackHandler::CreateShapeAttack(iCollideShape *apShape, const cMatrixf &a
}
// Impulse
- float fMass = mpInit->mpPlayer->GetCharacterBody()->GetMass();
+ float fMass2 = mpInit->mpPlayer->GetCharacterBody()->GetMass();
float fForceSize = 0;
- if (fMass > afMaxMass * 10)
+ if (fMass2 > afMaxMass * 10)
fForceSize = 0;
- else if (fMass <= afMinMass * 10)
+ else if (fMass2 <= afMinMass * 10)
fForceSize = afMaxImpulse * 10;
else {
- float fT = (fMass - afMinMass * 10) / (afMaxMass * 10 - afMinMass * 10);
+ float fT = (fMass2 - afMinMass * 10) / (afMaxMass * 10 - afMinMass * 10);
fForceSize = afMinImpulse * 10 * fT + afMaxImpulse * 10 * (1 - fT);
}
@@ -298,8 +298,8 @@ bool cAttackHandler::CreateShapeAttack(iCollideShape *apShape, const cMatrixf &a
// Iterate bodies hit, this to
// spread out the impulse.
float fAmount = (float)lstBodies.size();
- for (tPhysicsBodyListIt it = lstBodies.begin(); it != lstBodies.end(); ++it) {
- iPhysicsBody *pBody = *it;
+ for (tPhysicsBodyListIt it2 = lstBodies.begin(); it2 != lstBodies.end(); ++it2) {
+ iPhysicsBody *pBody = *it2;
// Calculate force
float fMass = pBody->GetMass();
diff --git a/engines/hpl1/penumbra-overture/ButtonHandler.cpp b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
index 7d8e8aff7c2..56d3d7124c4 100644
--- a/engines/hpl1/penumbra-overture/ButtonHandler.cpp
+++ b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
@@ -115,7 +115,8 @@ static cButtonHandlerAction gvDefaultActions[] = {
//{"Taunt","Keyboard",eKey_t,false},
{"PrintLog", "Keyboard", eKey_l, false},
- {"", "", 0}};
+ {"", "", 0, false}
+};
//////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
diff --git a/engines/hpl1/penumbra-overture/DemoEndText.h b/engines/hpl1/penumbra-overture/DemoEndText.h
index 6873b6b1366..e717a707eaf 100644
--- a/engines/hpl1/penumbra-overture/DemoEndText.h
+++ b/engines/hpl1/penumbra-overture/DemoEndText.h
@@ -61,7 +61,7 @@ private:
cInit *mpInit;
cGraphicsDrawer *mpDrawer;
- FontData *mpFont;
+ //FontData *mpFont;
bool mbActive;
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp b/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
index 36268e06a48..fb4638458f5 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
@@ -723,7 +723,7 @@ void cGameEnemyState_Dog_Hunt::OnUpdate(float afTimeStep) {
// mpInit->mpEffectHandler->GetSubTitle()->Add("Update Path!",1.0f,true);
mfUpdatePathCount = mfUpdateFreq;
- cAINodeContainer *pNodeCont = mpEnemy->GetMover()->GetNodeContainer();
+ /*cAINodeContainer *pNodeCont = */mpEnemy->GetMover()->GetNodeContainer();
// Log("%s: Checking free path\n",mpEnemy->GetName().c_str());
@@ -857,7 +857,7 @@ bool cGameEnemyState_Dog_Hunt::OnHearNoise(const cVector3f &avPosition, float af
//-----------------------------------------------------------------------
void cGameEnemyState_Dog_Hunt::OnDraw() {
- float fWantedSpeed = mpMover->GetCharBody()->GetMoveSpeed(eCharDir_Forward);
+ /*float fWantedSpeed = */mpMover->GetCharBody()->GetMoveSpeed(eCharDir_Forward);
float fRealSpeed = cMath::Vector3Dist(mpMover->GetCharBody()->GetPosition(),
mpMover->GetCharBody()->GetLastPosition());
fRealSpeed = fRealSpeed / (1.0f / 60.0f);
@@ -1490,13 +1490,13 @@ void cGameEnemyState_Dog_KnockDown::OnUpdate(float afTimeStep) {
// Calculate values
cVector3f vPosition;
cVector3f vAngles;
- cMatrixf mtxTransform = mpEnemy->GetMeshEntity()->CalculateTransformFromSkeleton(&vPosition, &vAngles);
+ /*cMatrixf mtxTransform = */mpEnemy->GetMeshEntity()->CalculateTransformFromSkeleton(&vPosition, &vAngles);
// Seems to work better...
vPosition = mpEnemy->GetMeshEntity()->GetBoundingVolume()->GetWorldCenter();
cVector3f vGroundPos = vPosition;
- bool bFoundGround = mpEnemy->GetGroundFinder()->GetGround(vPosition, cVector3f(0, -1, 0), &vGroundPos, NULL);
+ /*bool bFoundGround = */mpEnemy->GetGroundFinder()->GetGround(vPosition, cVector3f(0, -1, 0), &vGroundPos, NULL);
// Log("Found ground: %d | %s -> %s\n",bFoundGround,vPosition.ToString().c_str(),
// vGroundPos.ToString().c_str());
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Dog.h b/engines/hpl1/penumbra-overture/GameEnemy_Dog.h
index 2b622501dc7..bdc49fd183a 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Dog.h
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Dog.h
@@ -225,7 +225,7 @@ public:
void OnAnimationOver(const tString &asName);
private:
- bool mbCheckAnim;
+ //bool mbCheckAnim;
};
//-----------------------------------------
@@ -252,7 +252,7 @@ private:
bool mbCheckAnim;
int mlPrevToughness;
- int mlStuckAtMaxCount;
+ //int mlStuckAtMaxCount;
};
//-----------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Spider.cpp b/engines/hpl1/penumbra-overture/GameEnemy_Spider.cpp
index d3fc47bb7d2..ad7c9d43377 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Spider.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Spider.cpp
@@ -236,7 +236,7 @@ void cGameEnemyState_Spider_Hunt::OnUpdate(float afTimeStep) {
if (mfUpdatePathCount <= 0) {
mfUpdatePathCount = mfUpdateFreq;
- cAINodeContainer *pNodeCont = mpEnemy->GetMover()->GetNodeContainer();
+ /*cAINodeContainer *pNodeCont = */mpEnemy->GetMover()->GetNodeContainer();
// Check if there is a free path to the player
if (mbLostPlayer == false && mpMover->FreeDirectPathToChar(mpPlayer->GetCharacterBody())) {
@@ -561,7 +561,7 @@ void cGameEnemyState_Spider_KnockDown::OnUpdate(float afTimeStep) {
if (mfTimer <= 0) {
// Get the forward vector from root bone (the right vector)
cNodeIterator StateIt = mpEnemy->GetMeshEntity()->GetRootNode()->GetChildIterator();
- cBoneState *pBoneState = static_cast<cBoneState *>(StateIt.Next());
+ //cBoneState *pBoneState = static_cast<cBoneState *>(StateIt.Next());
// Play animation and fade physics
float fFadeTime = 0.7f;
@@ -578,10 +578,10 @@ void cGameEnemyState_Spider_KnockDown::OnUpdate(float afTimeStep) {
// Calculate values
cVector3f vPosition;
cVector3f vAngles;
- cMatrixf mtxTransform = mpEnemy->GetMeshEntity()->CalculateTransformFromSkeleton(&vPosition, &vAngles);
+ /*cMatrixf mtxTransform = */mpEnemy->GetMeshEntity()->CalculateTransformFromSkeleton(&vPosition, &vAngles);
cVector3f vGroundPos = vPosition;
- bool bFoundGround = mpEnemy->GetGroundFinder()->GetGround(vPosition, cVector3f(0, -1, 0), &vGroundPos, NULL);
+ /*bool bFoundGround = */mpEnemy->GetGroundFinder()->GetGround(vPosition, cVector3f(0, -1, 0), &vGroundPos, NULL);
// Set body
iCharacterBody *pCharBody = mpEnemy->GetMover()->GetCharBody();
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Spider.h b/engines/hpl1/penumbra-overture/GameEnemy_Spider.h
index bdb986756cc..359e5875620 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Spider.h
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Spider.h
@@ -144,9 +144,9 @@ public:
void OnFlashlight(const cVector3f &avPosition) {}
private:
- float mfTimer;
- float mfBackAngle;
- bool mbBackwards;
+ //float mfTimer;
+ //float mfBackAngle;
+ //bool mbBackwards;
};
//-----------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp b/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
index a6b4a139975..8195ef30dae 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
@@ -286,7 +286,7 @@ void cGameEnemyState_Worm_Hunt::OnUpdate(float afTimeStep) {
if (mfUpdatePathCount <= 0) {
mfUpdatePathCount = mfUpdateFreq;
- cAINodeContainer *pNodeCont = mpEnemy->GetMover()->GetNodeContainer();
+ /*cAINodeContainer *pNodeCont = */mpEnemy->GetMover()->GetNodeContainer();
// Check if there is a free path to the player
if (mbLostPlayer == false && mpMover->FreeDirectPathToChar(mpPlayer->GetCharacterBody())) {
@@ -502,7 +502,7 @@ cGameEnemy_Worm_MeshCallback::cGameEnemy_Worm_MeshCallback(cGameEnemy_Worm *apWo
/*OLD CALC MATRIX VERSION:
cMatrixf mtxRot = cMatrixf::Identity;
-mtxRot.SetRight(mpWorm->mvRootRight*-1); //*-1 = straange
+mtxRot.SetRight(mpWorm->mvRootRight*-1); // *-1 = straange
mtxRot.SetUp(mpWorm->mvRootUp);
mtxRot.SetForward(mpWorm->mvRootForward);
@@ -550,7 +550,7 @@ void cGameEnemy_Worm_MeshCallback::AfterAnimationUpdate(cMeshEntity *apMeshEntit
// Change orientation according to forward
cMatrixf mtxTrans = cMatrixf::Identity;
{
- /*mtxTrans.SetRight(pSegment->mvRight*-1); //*-1 = straaange
+ /*mtxTrans.SetRight(pSegment->mvRight*-1); // *-1 = straaange
mtxTrans.SetUp(pSegment->mvUp);
mtxTrans.SetForward(pSegment->mvForward);
@@ -746,9 +746,9 @@ void cGameEnemy_Worm::OnUpdate(float afTimeStep) {
pSegment->mlstPositions.pop_front();
}
pSegment->mvPostion = 0;
- std::list<cVector3f>::iterator posIt = pSegment->mlstPositions.begin();
- for (; posIt != pSegment->mlstPositions.end(); ++posIt) {
- pSegment->mvPostion += *posIt;
+ std::list<cVector3f>::iterator posIt2 = pSegment->mlstPositions.begin();
+ for (; posIt2 != pSegment->mlstPositions.end(); ++posIt2) {
+ pSegment->mvPostion += *posIt2;
}
pSegment->mvPostion = pSegment->mvPostion / (float)pSegment->mlstPositions.size();
diff --git a/engines/hpl1/penumbra-overture/GameEntity.cpp b/engines/hpl1/penumbra-overture/GameEntity.cpp
index 132273234d1..e3fbc5629d3 100644
--- a/engines/hpl1/penumbra-overture/GameEntity.cpp
+++ b/engines/hpl1/penumbra-overture/GameEntity.cpp
@@ -306,7 +306,7 @@ void iGameEntity::SetSoundEntity(cSoundEntity *apSound) {
void iGameEntity::PlayerPick() {
//////////////////////
// Script stuff
- cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
+ /*cWorld3D *pWorld = */mpInit->mpGame->GetScene()->GetWorld3D();
if (mvCallbackScripts[eGameEntityScriptType_PlayerPick]) {
tString sCommand = GetScriptCommand(eGameEntityScriptType_PlayerPick);
mpInit->RunScriptCommand(sCommand);
@@ -321,7 +321,7 @@ void iGameEntity::PlayerInteract() {
if (GetPickedDistance() <= mfMaxInteractDist &&
(mpInit->mbHasHaptics == false || mpInit->mpPlayer->mbProxyTouching ||
mType == eGameEntityType_Area)) {
- cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
+ /*cWorld3D *pWorld = */mpInit->mpGame->GetScene()->GetWorld3D();
if (mvCallbackScripts[eGameEntityScriptType_PlayerInteract]) {
tString sCommand = GetScriptCommand(eGameEntityScriptType_PlayerInteract);
mpInit->RunScriptCommand(sCommand);
@@ -335,7 +335,7 @@ void iGameEntity::PlayerExamine() {
//////////////////////
// Script stuff
if (GetPickedDistance() <= mfMaxExamineDist) {
- cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
+ /*cWorld3D *pWorld = */mpInit->mpGame->GetScene()->GetWorld3D();
if (mvCallbackScripts[eGameEntityScriptType_PlayerExamine]) {
tString sCommand = GetScriptCommand(eGameEntityScriptType_PlayerExamine);
mpInit->RunScriptCommand(sCommand);
@@ -479,7 +479,7 @@ void iGameEntity::OnUpdate(float afTimeStep) {
////////////////////////////////////////////
/// Script Collide test stuff
iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
- cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
+ /*cWorld3D *pWorld = */mpInit->mpGame->GetScene()->GetWorld3D();
////////////////
// If entity has character body add it to the array and then remove.
diff --git a/engines/hpl1/penumbra-overture/GameForceArea.cpp b/engines/hpl1/penumbra-overture/GameForceArea.cpp
index 228396a1b73..189d51c3222 100644
--- a/engines/hpl1/penumbra-overture/GameForceArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameForceArea.cpp
@@ -158,7 +158,7 @@ void cGameForceArea::Update(float afTimeStep) {
///////////////////////////////
// Check for collision
- int lCollideNum = mbForceAtPoint ? 4 : 1;
+ //int lCollideNum = mbForceAtPoint ? 4 : 1;
if (pPhysicsWorld->CheckShapeCollision(pBody->GetShape(), pBody->GetLocalMatrix(),
pAreaBody->GetShape(), pAreaBody->GetLocalMatrix(), collideData, 1) == false) {
diff --git a/engines/hpl1/penumbra-overture/GameItem.cpp b/engines/hpl1/penumbra-overture/GameItem.cpp
index c083a972584..6f62ec966ec 100644
--- a/engines/hpl1/penumbra-overture/GameItem.cpp
+++ b/engines/hpl1/penumbra-overture/GameItem.cpp
@@ -48,7 +48,7 @@ void cGameItem_InViewRay::SetUp(iPhysicsBody *apSkipBody) {
}
bool cGameItem_InViewRay::OnIntersect(iPhysicsBody *apBody, cPhysicsRayParams *apParams) {
- float &fDist = apParams->mfDist;
+ //float &fDist = apParams->mfDist;
// Must be positive
if (apParams->mfT < 0 || apParams->mfT > 1)
diff --git a/engines/hpl1/penumbra-overture/GameItemType.cpp b/engines/hpl1/penumbra-overture/GameItemType.cpp
index 720a7a3a2b2..983b1c4be40 100644
--- a/engines/hpl1/penumbra-overture/GameItemType.cpp
+++ b/engines/hpl1/penumbra-overture/GameItemType.cpp
@@ -411,10 +411,10 @@ bool cGameItemType_WeaponMeleeHaptX::OnAction(cInventoryItem *apItem, int alActi
//////////////////////////
// Set up the melee state
- iPlayerState *pState = mpInit->mpPlayer->GetStateData(ePlayerState_WeaponMelee);
+ iPlayerState *pState2 = mpInit->mpPlayer->GetStateData(ePlayerState_WeaponMelee);
- cPlayerState_WeaponMeleeHaptX *pMeleeState = static_cast<cPlayerState_WeaponMeleeHaptX *>(pState);
- pMeleeState->SetHudWeapon(pMeleeHud);
+ cPlayerState_WeaponMeleeHaptX *pMeleeState2 = static_cast<cPlayerState_WeaponMeleeHaptX *>(pState2);
+ pMeleeState2->SetHudWeapon(pMeleeHud);
// change state to melee
mpInit->mpPlayer->ChangeState(ePlayerState_WeaponMelee);
diff --git a/engines/hpl1/penumbra-overture/GameLadder.cpp b/engines/hpl1/penumbra-overture/GameLadder.cpp
index e4069c89ee7..87fb64f3005 100644
--- a/engines/hpl1/penumbra-overture/GameLadder.cpp
+++ b/engines/hpl1/penumbra-overture/GameLadder.cpp
@@ -195,7 +195,7 @@ float cGameLadder::GetHeight() {
//-----------------------------------------------------------------------
cVector3f cGameLadder::GetStartRotation() {
- iCharacterBody *pCharBody = mpInit->mpPlayer->GetCharacterBody();
+ /*iCharacterBody *pCharBody = */mpInit->mpPlayer->GetCharacterBody();
return cMath::GetAngleFromPoints3D(cVector3f(0, 0, 0), GetForward() * -1);
}
diff --git a/engines/hpl1/penumbra-overture/GameLiquidArea.cpp b/engines/hpl1/penumbra-overture/GameLiquidArea.cpp
index 2255eca77d0..ad931112649 100644
--- a/engines/hpl1/penumbra-overture/GameLiquidArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameLiquidArea.cpp
@@ -172,7 +172,7 @@ void cGameLiquidArea::Update(float afTimeStep) {
while (bodyIt.HasNext()) {
iPhysicsBody *pBody = static_cast<iPhysicsBody *>(bodyIt.Next());
- iGameEntity *pEntity = (iGameEntity *)pBody->GetUserData();
+ /*iGameEntity *pEntity = */(iGameEntity *)pBody->GetUserData();
if (pBody->GetCollide() && pBody->IsActive()) {
if (pBody->GetMass() == 0 && pBody->IsCharacter() == false)
diff --git a/engines/hpl1/penumbra-overture/GameObject.cpp b/engines/hpl1/penumbra-overture/GameObject.cpp
index dc661471381..ec06b451af6 100644
--- a/engines/hpl1/penumbra-overture/GameObject.cpp
+++ b/engines/hpl1/penumbra-overture/GameObject.cpp
@@ -486,6 +486,10 @@ void cGameObject::OnPlayerInteract() {
case eObjectInteractMode_Grab:
GrabObject();
break;
+ case eObjectInteractMode_Static:
+ break;
+ case eObjectInteractMode_LastEnum:
+ break;
}
}
@@ -658,7 +662,7 @@ void cGameObject::BreakAction() {
//////////////////
// Particle System
if (mBreakProps.msPS != "") {
- cParticleSystem3D *pPS = pWorld->CreateParticleSystem("Break", mBreakProps.msPS, cVector3f(1, 1, 1),
+ /*cParticleSystem3D *pPS = */pWorld->CreateParticleSystem("Break", mBreakProps.msPS, cVector3f(1, 1, 1),
pParentBody->GetWorldMatrix());
}
diff --git a/engines/hpl1/penumbra-overture/GameSwingDoor.cpp b/engines/hpl1/penumbra-overture/GameSwingDoor.cpp
index 269a08cc07a..0aad2466e23 100644
--- a/engines/hpl1/penumbra-overture/GameSwingDoor.cpp
+++ b/engines/hpl1/penumbra-overture/GameSwingDoor.cpp
@@ -124,7 +124,7 @@ cGameSwingDoor::cGameSwingDoor(cInit *apInit, const tString &asName) : iGameEnti
//-----------------------------------------------------------------------
cGameSwingDoor::~cGameSwingDoor(void) {
- iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
+ /*iPhysicsWorld *pPhysicsWorld = */mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
// for(size_t i=0; i<mvStopControllers.size(); ++i)
//{
@@ -323,12 +323,12 @@ void cGameSwingDoor::BreakAction() {
mpInit->mpPlayer->ChangeState(ePlayerState_Normal);
}
- cBoundingVolume *pBV = mpMeshEntity->GetBoundingVolume();
+ /*cBoundingVolume *pBV = */mpMeshEntity->GetBoundingVolume();
//////////////////
// Particle System
if (msBreakPS != "") {
- cParticleSystem3D *pPS = pWorld->CreateParticleSystem("Break", msBreakPS, cVector3f(1, 1, 1),
+ /*cParticleSystem3D *pPS = */pWorld->CreateParticleSystem("Break", msBreakPS, cVector3f(1, 1, 1),
pDynBody->GetWorldMatrix());
}
diff --git a/engines/hpl1/penumbra-overture/HapticGameCamera.cpp b/engines/hpl1/penumbra-overture/HapticGameCamera.cpp
index 0fd98fcc9ff..3bcaff804b5 100644
--- a/engines/hpl1/penumbra-overture/HapticGameCamera.cpp
+++ b/engines/hpl1/penumbra-overture/HapticGameCamera.cpp
@@ -447,9 +447,9 @@ void cHapticGameCamera::UpdateCameraOrientation(float afTimeStep)
cVector3f vDir = cMath::Vector3Normalize(vDeltaPos);
//Force
- cVector3f vForce = vDir * fLength * 0.012f;
+ cVector3f vForce2 = vDir * fLength * 0.012f;
mpForce->SetActive(true);
- mpForce->SetForce(vForce);
+ mpForce->SetForce(vForce2);
//Movement
if(mbCamMove)
diff --git a/engines/hpl1/penumbra-overture/HudModel_Throw.cpp b/engines/hpl1/penumbra-overture/HudModel_Throw.cpp
index dad288d0408..1ff3c813783 100644
--- a/engines/hpl1/penumbra-overture/HudModel_Throw.cpp
+++ b/engines/hpl1/penumbra-overture/HudModel_Throw.cpp
@@ -160,17 +160,17 @@ void cHudModel_Throw::OnAttackUp()
msThrowEntity, true);
if(pEntity)
{
- iGameEntity *pEntity = mpInit->mpMapHandler->GetLatestEntity();
+ iGameEntity *pEntity2 = mpInit->mpMapHandler->GetLatestEntity();
float fImpulse = mfMinImpulse * (1 - mfChargeCount) + mfMaxImpulse * mfChargeCount;
- cVector3f vRot =cMath::MatrixMul(mtxStart.GetRotation(),mvTorque);
+ cVector3f vRot2 =cMath::MatrixMul(mtxStart.GetRotation(),mvTorque);
- for(int i=0; i< pEntity->GetBodyNum(); ++i)
+ for(int i=0; i< pEntity2->GetBodyNum(); ++i)
{
- iPhysicsBody *pBody = pEntity->GetBody(i);
+ iPhysicsBody *pBody = pEntity2->GetBody(i);
pBody->AddImpulse(pCam->GetForward() * fImpulse);
- pBody->AddTorque(vRot);
+ pBody->AddTorque(vRot2);
}
}
diff --git a/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp b/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
index 470b9c6a655..03cc5a3c532 100644
--- a/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
+++ b/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
@@ -540,12 +540,12 @@ void cHudModel_WeaponMelee::Attack() {
// Add force to bodies
for (int i = 0; i < pEnemy->GetBodyNum(); ++i) {
- iPhysicsBody *pBody = pEnemy->GetBody(i);
+ iPhysicsBody *pBody2 = pEnemy->GetBody(i);
- pBody->AddImpulse(vForceDir * fForceSize * 0.5f);
+ pBody2->AddImpulse(vForceDir * fForceSize * 0.5f);
cVector3f vTorque = vSpinMul * fMass * fForceSize * 0.5f;
- pBody->AddTorque(vTorque);
+ pBody2->AddTorque(vTorque);
}
// Calculate damage
@@ -590,7 +590,7 @@ void cHudModel_WeaponMelee::Attack() {
while (it.HasNext()) {
iPhysicsBody *pBody = it.Next();
- float fMass = pBody->GetMass();
+ /*float fMass = */pBody->GetMass();
if (pBody->IsActive() == false)
continue;
diff --git a/engines/hpl1/penumbra-overture/Inventory.cpp b/engines/hpl1/penumbra-overture/Inventory.cpp
index 6e035b4088c..461f08f41f8 100644
--- a/engines/hpl1/penumbra-overture/Inventory.cpp
+++ b/engines/hpl1/penumbra-overture/Inventory.cpp
@@ -731,7 +731,7 @@ void cInventoryContext::Draw() {
cVector2f(mvSize.x, vCornerSize.y), cColor(1, fTotalAlpha));
for (int i = 0; i < (int)mpActionVec->size(); i++) {
- cColor Col = mlSelectedRow == i ? cColor(0.2f, 1.0f, 0.2f, mfAlpha) : cColor(0.65f, 0.65f, 0.65f, fTotalAlpha);
+ /*cColor Col = */mlSelectedRow == i ? cColor(0.2f, 1.0f, 0.2f, mfAlpha) : cColor(0.65f, 0.65f, 0.65f, fTotalAlpha);
// mpFont->Draw(mvPos + cVector3f(2.0f,(float)i*mfRowSize,1),14,Col,
// eFontAlign_Left,(*mpActionVec)[i].c_str());
@@ -1183,7 +1183,7 @@ void cInventory::AddItemFromFile(const tString &asName, const tString &asFile, i
m_mapItems.insert(tInventoryItemMap::value_type(pItem->GetName(), pItem));
int lCount = 0;
- int lCurrentSlot = -1;
+ //int lCurrentSlot = -1;
tInventorySlotListIt it = mlstSlots.begin();
for (; it != mlstSlots.end(); ++it) {
diff --git a/engines/hpl1/penumbra-overture/Inventory.h b/engines/hpl1/penumbra-overture/Inventory.h
index deee0a59beb..68af81d2543 100644
--- a/engines/hpl1/penumbra-overture/Inventory.h
+++ b/engines/hpl1/penumbra-overture/Inventory.h
@@ -177,7 +177,7 @@ private:
cGfxObject *mpGfxObjectAdditive;
cGraphicsDrawer *mpDrawer;
- cInventoryItem *mpItem;
+ //cInventoryItem *mpItem;
bool mbCanBeDropped;
bool mbHasCount;
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index e62ae1f1630..46c0543e4d2 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -1775,7 +1775,7 @@ public:
}
private:
- cMainMenuWidget_Text *mpKeyWidget;
+ //cMainMenuWidget_Text *mpKeyWidget;
tString msActionName;
};
@@ -2612,7 +2612,7 @@ void cMainMenu::CreateWidgets() {
AddWidgetToState(state, gpSaveGameList[i]);
LowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
- LowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
+ /*LowLevelSystem *pLowLevelSystem = */mpInit->mpGame->GetSystem()->GetLowLevel();
tStringList lstFiles;
tTempFileAndDataSet setTempFiles;
@@ -2711,34 +2711,34 @@ void cMainMenu::CreateWidgets() {
if (mpInit->mbHapticsAvailable) {
vPos.y += 5;
// Use haptics
- tWString sText = kTranslate("MainMenu", "Use Haptics:");
- if (sText == _W(""))
- sText = _W("Use Haptics:");
- pWidgetUseHaptics = hplNew(cMainMenuWidget_UseHaptics, (mpInit, vPos, sText, 20, eFontAlign_Right));
+ tWString sText2 = kTranslate("MainMenu", "Use Haptics:");
+ if (sText2 == _W(""))
+ sText2 = _W("Use Haptics:");
+ pWidgetUseHaptics = hplNew(cMainMenuWidget_UseHaptics, (mpInit, vPos, sText2, 20, eFontAlign_Right));
AddWidgetToState(eMainMenuState_OptionsControls, pWidgetUseHaptics);
vPos.y += 29;
// Weight Force Scale
- sText = kTranslate("MainMenu", "Weight Force Scale:");
- if (sText == _W(""))
- sText = _W("Weight Force Scale:");
- pWidgetWeightForceScale = hplNew(cMainMenuWidget_WeightForceScale, (mpInit, vPos, sText, 20, eFontAlign_Right));
+ sText2 = kTranslate("MainMenu", "Weight Force Scale:");
+ if (sText2 == _W(""))
+ sText2 = _W("Weight Force Scale:");
+ pWidgetWeightForceScale = hplNew(cMainMenuWidget_WeightForceScale, (mpInit, vPos, sText2, 20, eFontAlign_Right));
AddWidgetToState(eMainMenuState_OptionsControls, pWidgetWeightForceScale);
vPos.y += 29;
// InteractMode camera speed
- sText = kTranslate("MainMenu", "InteractMode Camera Speed:");
- if (sText == _W(""))
- sText = _W("InteractMode Camera Speed:");
- pWidgetInteractModeCameraSpeed = hplNew(cMainMenuWidget_InteractModeCameraSpeed, (mpInit, vPos, sText, 20, eFontAlign_Right));
+ sText2 = kTranslate("MainMenu", "InteractMode Camera Speed:");
+ if (sText2 == _W(""))
+ sText2 = _W("InteractMode Camera Speed:");
+ pWidgetInteractModeCameraSpeed = hplNew(cMainMenuWidget_InteractModeCameraSpeed, (mpInit, vPos, sText2, 20, eFontAlign_Right));
AddWidgetToState(eMainMenuState_OptionsControls, pWidgetInteractModeCameraSpeed);
vPos.y += 29;
// ActionMode camera speed
- sText = kTranslate("MainMenu", "ActionMode Camera Speed:");
- if (sText == _W(""))
- sText = _W("ActionMode Camera Speed:");
- pWidgetActionModeCameraSpeed = hplNew(cMainMenuWidget_ActionModeCameraSpeed, (mpInit, vPos, sText, 20, eFontAlign_Right));
+ sText2 = kTranslate("MainMenu", "ActionMode Camera Speed:");
+ if (sText2 == _W(""))
+ sText2 = _W("ActionMode Camera Speed:");
+ pWidgetActionModeCameraSpeed = hplNew(cMainMenuWidget_ActionModeCameraSpeed, (mpInit, vPos, sText2, 20, eFontAlign_Right));
AddWidgetToState(eMainMenuState_OptionsControls, pWidgetActionModeCameraSpeed);
vPos.y += 29;
@@ -2799,23 +2799,23 @@ void cMainMenu::CreateWidgets() {
///////////////////////////////////
for (int i = 0; i < 3; ++i) {
eMainMenuState state = (eMainMenuState)(i + eMainMenuState_OptionsKeySetupMove);
- cVector3f vPos = vTextStart; // cVector3f(400, 260, 40);
+ cVector3f vPos2 = vTextStart; // cVector3f(400, 260, 40);
// Head
- AddWidgetToState(state, hplNew(cMainMenuWidget_Text, (mpInit, vPos, kTranslate("MainMenu", "Configure Keys"), 25, eFontAlign_Center)));
- vPos.y += 42;
- vPos.x -= 110;
+ AddWidgetToState(state, hplNew(cMainMenuWidget_Text, (mpInit, vPos2, kTranslate("MainMenu", "Configure Keys"), 25, eFontAlign_Center)));
+ vPos2.y += 42;
+ vPos2.x -= 110;
// Buttons
- AddWidgetToState(state, hplNew(cMainMenuWidget_Button, (mpInit, vPos, kTranslate("MainMenu", "Movement"), eMainMenuState_OptionsKeySetupMove, 25, eFontAlign_Center)));
- vPos.y += 32;
- AddWidgetToState(state, hplNew(cMainMenuWidget_Button, (mpInit, vPos, kTranslate("MainMenu", "Actions"), eMainMenuState_OptionsKeySetupAction, 25, eFontAlign_Center)));
- vPos.y += 32;
- AddWidgetToState(state, hplNew(cMainMenuWidget_Button, (mpInit, vPos, kTranslate("MainMenu", "Misc"), eMainMenuState_OptionsKeySetupMisc, 25, eFontAlign_Center)));
+ AddWidgetToState(state, hplNew(cMainMenuWidget_Button, (mpInit, vPos2, kTranslate("MainMenu", "Movement"), eMainMenuState_OptionsKeySetupMove, 25, eFontAlign_Center)));
+ vPos2.y += 32;
+ AddWidgetToState(state, hplNew(cMainMenuWidget_Button, (mpInit, vPos2, kTranslate("MainMenu", "Actions"), eMainMenuState_OptionsKeySetupAction, 25, eFontAlign_Center)));
+ vPos2.y += 32;
+ AddWidgetToState(state, hplNew(cMainMenuWidget_Button, (mpInit, vPos2, kTranslate("MainMenu", "Misc"), eMainMenuState_OptionsKeySetupMisc, 25, eFontAlign_Center)));
// Back
- vPos.y += 150;
- vPos.x += 130;
- AddWidgetToState(state, hplNew(cMainMenuWidget_KeyReset, (mpInit, vPos, kTranslate("MainMenu", "Reset to defaults"), 23, eFontAlign_Center)));
- vPos.y += 32;
- AddWidgetToState(state, hplNew(cMainMenuWidget_Button, (mpInit, vPos, kTranslate("MainMenu", "Back"), eMainMenuState_OptionsControls, 23, eFontAlign_Center)));
+ vPos2.y += 150;
+ vPos2.x += 130;
+ AddWidgetToState(state, hplNew(cMainMenuWidget_KeyReset, (mpInit, vPos2, kTranslate("MainMenu", "Reset to defaults"), 23, eFontAlign_Center)));
+ vPos2.y += 32;
+ AddWidgetToState(state, hplNew(cMainMenuWidget_Button, (mpInit, vPos2, kTranslate("MainMenu", "Back"), eMainMenuState_OptionsControls, 23, eFontAlign_Center)));
}
///////////////////////////////////
@@ -2826,7 +2826,7 @@ void cMainMenu::CreateWidgets() {
float fKeyTextXAdd = 195;
// Key buttons
- cInput *pInput = mpInit->mpGame->GetInput();
+ /*cInput *pInput = */mpInit->mpGame->GetInput();
vPos = vTextStart; // cVector3f(400, 260, 40);
vPos.y += 46;
vPos.x += 15;
diff --git a/engines/hpl1/penumbra-overture/MapHandler.cpp b/engines/hpl1/penumbra-overture/MapHandler.cpp
index 76df9d98f43..fa965efbda3 100644
--- a/engines/hpl1/penumbra-overture/MapHandler.cpp
+++ b/engines/hpl1/penumbra-overture/MapHandler.cpp
@@ -241,7 +241,7 @@ cEffectLightFlash::~cEffectLightFlash() {
//-----------------------------------------------------------------------
void cEffectLightFlash::Update(float afTimeStep) {
- cColor Col = mpLight->GetDiffuseColor();
+ /*cColor Col = */mpLight->GetDiffuseColor();
// Log("Update...\n");
if (mbIsDying == false) {
if (mpLight->IsFading() == false) {
@@ -974,9 +974,9 @@ void cMapHandler::LoadSaveData(cSavedWorld *apSavedWorld) {
}
}
// Set data to map Joint entities
- cContainerListIterator<cEngineJoint_SaveData> it = apSavedWorld->mlstJoints.GetIterator();
- while (it.HasNext()) {
- cEngineJoint_SaveData &saveJoint = it.Next();
+ cContainerListIterator<cEngineJoint_SaveData> it2 = apSavedWorld->mlstJoints.GetIterator();
+ while (it2.HasNext()) {
+ cEngineJoint_SaveData &saveJoint = it2.Next();
iPhysicsJoint *pJoint = pPhysicsWorld->GetJoint(saveJoint.msName);
if (pJoint) {
@@ -1054,7 +1054,7 @@ void cMapHandler::RenderItemEffect() {
pMeshEntity->GetWorldMatrix()));
for (int i = 0; i < pMeshEntity->GetMesh()->GetSubMeshNum(); i++) {
cSubMeshEntity *pSubEntity = pMeshEntity->GetSubMeshEntity(i);
- cSubMesh *pSubMesh = pMeshEntity->GetMesh()->GetSubMesh(i);
+ /*cSubMesh *pSubMesh = */pMeshEntity->GetMesh()->GetSubMesh(i);
iVertexBuffer *pVtxBuffer = pSubEntity->GetVertexBuffer();
iMaterial *pMaterial = pSubEntity->GetMaterial();
@@ -1150,8 +1150,8 @@ void cMapHandler::OnPostSceneDraw() {
mpInit->mpGame->GetGraphics()->GetLowLevel()->SetDepthTestActive(false);
- cVector3f vMin = mpScene->GetWorld3D()->GetPhysicsWorld()->GetWorldSizeMin();
- cVector3f vMax = mpScene->GetWorld3D()->GetPhysicsWorld()->GetWorldSizeMax();
+ /*cVector3f vMin = */mpScene->GetWorld3D()->GetPhysicsWorld()->GetWorldSizeMin();
+ /*cVector3f vMax = */mpScene->GetWorld3D()->GetPhysicsWorld()->GetWorldSizeMax();
// mpInit->mpGame->GetGraphics()->GetLowLevel()->DrawBoxMaxMin(vMax,vMin,cColor(1,0,1));
@@ -1186,7 +1186,7 @@ void cMapHandler::OnPostSceneDraw() {
GIt = m_mapGameEntities.begin();
for (; GIt != m_mapGameEntities.end(); ++GIt) {
- iGameEntity *pEntity = GIt->second;
+ //iGameEntity *pEntity = GIt->second;
// if(pEntity->GetBodyNum()<=0) continue;
@@ -1644,7 +1644,7 @@ void cMapHandler::PreUpdate(double afTimeSinceVisit) {
mbPreUpdating = true;
- unsigned long lStart = mpInit->mpGame->GetSystem()->GetLowLevel()->getTime();
+ //unsigned long lStart = mpInit->mpGame->GetSystem()->GetLowLevel()->getTime();
// Enable all physic bodies
cPhysicsBodyIterator bodyIt = pPhysicsWorld->GetBodyIterator();
@@ -1682,7 +1682,7 @@ void cMapHandler::PreUpdate(double afTimeSinceVisit) {
mpInit->mpGame->GetSound()->GetSoundHandler()->SetSilent(false);
}
- unsigned long lTime = mpInit->mpGame->GetSystem()->GetLowLevel()->getTime() - lStart;
+ //unsigned long lTime = mpInit->mpGame->GetSystem()->GetLowLevel()->getTime() - lStart;
// Log("PREUPDATE time: %d\n",lTime);
diff --git a/engines/hpl1/penumbra-overture/Player.cpp b/engines/hpl1/penumbra-overture/Player.cpp
index ee534f64733..6082d80589f 100644
--- a/engines/hpl1/penumbra-overture/Player.cpp
+++ b/engines/hpl1/penumbra-overture/Player.cpp
@@ -1093,7 +1093,7 @@ void cPlayer::Update(float afTimeStep) {
/////////////////////////////////////////////////
// Collide script
pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
- cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
+ /*cWorld3D *pWorld = */mpInit->mpGame->GetScene()->GetWorld3D();
cCollideData collideData;
collideData.SetMaxSize(1);
diff --git a/engines/hpl1/penumbra-overture/Player.h b/engines/hpl1/penumbra-overture/Player.h
index cc285377d9f..9d513a53d1f 100644
--- a/engines/hpl1/penumbra-overture/Player.h
+++ b/engines/hpl1/penumbra-overture/Player.h
@@ -416,7 +416,7 @@ private:
float mfMaxMoveDist;
float mfMaxGrabDist;
- float mfMaxGrabForce;
+ //float mfMaxGrabForce;
float mfMaxUseItemDist;
diff --git a/engines/hpl1/penumbra-overture/PlayerHands.cpp b/engines/hpl1/penumbra-overture/PlayerHands.cpp
index de5781904c4..f67e1ee5bbe 100644
--- a/engines/hpl1/penumbra-overture/PlayerHands.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerHands.cpp
@@ -495,7 +495,7 @@ void cPlayerHands::SetCurrentModel(int alNum, const tString &asName) {
iHudModel *pHandModel = it->second;
- cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
+ /*cWorld3D *pWorld = */mpInit->mpGame->GetScene()->GetWorld3D();
if (mvCurrentHudModels[alNum]) {
if (mvCurrentHudModels[alNum] != pHandModel) {
@@ -612,10 +612,10 @@ void cPlayerHands::UpdatePrevPostions() {
float fRotNum = 0;
float fPosNum = 0;
- float fRotMulStart = 1.0f;
- float fRotMulEnd = 0.1f;
- float fSize = (float)mlstRotations.size();
- // float fD = (fRotMulStart - fRotMulEnd) / fSize;
+ //float fRotMulStart = 1.0f;
+ //float fRotMulEnd = 0.1f;
+ //float fSize = (float)mlstRotations.size();
+ //float fD = (fRotMulStart - fRotMulEnd) / fSize;
float fMul = 1.0f; // fRotMulEnd;
for (tVector3fListIt it = mlstRotations.begin(); it != mlstRotations.end(); ++it) {
diff --git a/engines/hpl1/penumbra-overture/PlayerHelper.cpp b/engines/hpl1/penumbra-overture/PlayerHelper.cpp
index c2277a70025..d9dffc4f721 100644
--- a/engines/hpl1/penumbra-overture/PlayerHelper.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerHelper.cpp
@@ -335,7 +335,7 @@ void cPlayerPickRayCallback::CalculateResults() {
if (mpPickedBody) {
iGameEntity *pEntity = (iGameEntity *)mpPickedBody->GetUserData();
- cGameArea *pArea = (cGameArea *)mpPickedAreaBody->GetUserData();
+ //cGameArea *pArea = (cGameArea *)mpPickedAreaBody->GetUserData();
if (pEntity) {
// Too for from object
@@ -584,6 +584,8 @@ void cPlayerHealth::Update(float afTimeStep) {
case eGameDifficulty_Hard:
pPlayer->AddHealth(afTimeStep * 0.14f);
break;
+ case eGameDifficulty_LastEnum:
+ break;
}
////////////////////////////
@@ -1495,7 +1497,7 @@ void cPlayerGlowStick::SetActive(bool abX) {
return;
mbActive = abX;
- cSoundHandler *pSoundHanlder = mpInit->mpGame->GetSound()->GetSoundHandler();
+ /*cSoundHandler *pSoundHanlder = */mpInit->mpGame->GetSound()->GetSoundHandler();
if (mbActive) {
// Log("Setting the glowstick to TRUE\n");
@@ -1617,7 +1619,7 @@ void cPlayerFlare::SetActive(bool abX) {
return;
mbActive = abX;
- cSoundHandler *pSoundHanlder = mpInit->mpGame->GetSound()->GetSoundHandler();
+ /*cSoundHandler *pSoundHanlder = */mpInit->mpGame->GetSound()->GetSoundHandler();
if (mbActive) {
mpInit->mpPlayerHands->SetCurrentModel(0, "Flare");
@@ -1651,14 +1653,14 @@ void cPlayerFlare::SetActive(bool abX) {
iEntity3D *pEntity = mpInit->mpGame->GetScene()->GetWorld3D()->CreateEntity("Throw", mtxStart,
"items_flare_thrown.ent", true);
if (pEntity) {
- iGameEntity *pEntity = mpInit->mpMapHandler->GetLatestEntity();
+ iGameEntity *pEntity2 = mpInit->mpMapHandler->GetLatestEntity();
- cVector3f vRot = cMath::MatrixMul(mtxStart.GetRotation(), cVector3f(1, 0.3f, 0));
+ cVector3f vRot2 = cMath::MatrixMul(mtxStart.GetRotation(), cVector3f(1, 0.3f, 0));
- for (int i = 0; i < pEntity->GetBodyNum(); ++i) {
- iPhysicsBody *pBody = pEntity->GetBody(i);
+ for (int i = 0; i < pEntity2->GetBodyNum(); ++i) {
+ iPhysicsBody *pBody = pEntity2->GetBody(i);
pBody->AddImpulse(pCam->GetForward() * 3.0f);
- pBody->AddTorque(vRot);
+ pBody->AddTorque(vRot2);
}
// setup light
@@ -1667,8 +1669,8 @@ void cPlayerFlare::SetActive(bool abX) {
if (fRadius < 0)
fRadius = 0;
- for (int i = 0; i < pEntity->GetLightNum(); ++i) {
- iLight3D *pLight = pEntity->GetLight(i);
+ for (int i = 0; i < pEntity2->GetLightNum(); ++i) {
+ iLight3D *pLight = pEntity2->GetLight(i);
pLight->SetFarAttenuation(pLight->GetFarAttenuation() * fRadius);
}
}
diff --git a/engines/hpl1/penumbra-overture/PlayerHelper.h b/engines/hpl1/penumbra-overture/PlayerHelper.h
index 6d0d44e58ff..394332fe3f5 100644
--- a/engines/hpl1/penumbra-overture/PlayerHelper.h
+++ b/engines/hpl1/penumbra-overture/PlayerHelper.h
@@ -332,7 +332,7 @@ private:
float mfClosestDist;
iPhysicsBody *mpClosestBody;
- iTexture *mpTextureCache;
+ //iTexture *mpTextureCache;
cInit *mpInit;
@@ -421,8 +421,8 @@ private:
int mlAmount;
- cLight3DPoint *mpLight;
- cMeshEntity *mpMeshEntity;
+ //cLight3DPoint *mpLight;
+ //cMeshEntity *mpMeshEntity;
cInit *mpInit;
cGraphicsDrawer *mpDrawer;
diff --git a/engines/hpl1/penumbra-overture/PlayerMoveStates.h b/engines/hpl1/penumbra-overture/PlayerMoveStates.h
index 203657e2def..e7266d2b35a 100644
--- a/engines/hpl1/penumbra-overture/PlayerMoveStates.h
+++ b/engines/hpl1/penumbra-overture/PlayerMoveStates.h
@@ -368,7 +368,7 @@ public:
float fSpeed = vForceVel.Length();
if (fSpeed > mfMaxForward) {
- float fNeg = fSpeed - mfMaxForward;
+ //float fNeg = fSpeed - mfMaxForward;
float fForwardSpeed = pBody->GetMoveSpeed(eCharDir_Forward);
/*if(fForwardSpeed>0){
@@ -468,7 +468,7 @@ public:
iCollideShape *pShape = pBody->GetExtraBody(i)->GetShape();
cVector3f vNewPos = pBody->GetPosition();
- bool bCollide = pWorld->CheckShapeWorldCollision(&vNewPos, pShape,
+ /*bool bCollide = */pWorld->CheckShapeWorldCollision(&vNewPos, pShape,
cMath::MatrixTranslate(pBody->GetPosition()),
pBody->GetBody(), false, true);
diff --git a/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp b/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
index 9943a7f2fd9..31d4074face 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
@@ -198,9 +198,9 @@ void cPlayerState_Grab::OnDraw() {
//-----------------------------------------------------------------------
void cPlayerState_Grab::OnPostSceneDraw() {
- iLowLevelGraphics *pLowGfx = mpInit->mpGame->GetGraphics()->GetLowLevel();
+ /*iLowLevelGraphics *pLowGfx = */mpInit->mpGame->GetGraphics()->GetLowLevel();
- cVector3f vPickPoint = cMath::MatrixMul(mpPushBody->GetWorldMatrix(), mvRelPickPoint);
+ /*cVector3f vPickPoint = */cMath::MatrixMul(mpPushBody->GetWorldMatrix(), mvRelPickPoint);
// pLowGfx->DrawSphere(vPickPoint, 0.2f, cColor(1,1,1,1));
// pLowGfx->DrawSphere(mvCurrentDisered, 0.2f, cColor(1,1,1,1));
diff --git a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp b/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
index c6fd7df0fba..7faf3234313 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
@@ -77,7 +77,7 @@ void cPlayerState_GrabHaptX::OnUpdate(float afTimeStep) {
// Get needed varaibles
cCamera3D *pCamera = mpPlayer->GetCamera();
iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
- cInput *pInput = mpInit->mpGame->GetInput();
+ /*cInput *pInput = */mpInit->mpGame->GetInput();
cVector3f vProxyPos = mpLowLevelHaptic->GetProxyPosition();
@@ -139,7 +139,7 @@ void cPlayerState_GrabHaptX::OnUpdate(float afTimeStep) {
///////////////////////////////////////
// Get the desired position
- cVector3f vForward = cMath::Vector3Normalize(vProxyPos - pCamera->GetPosition());
+ /*cVector3f vForward = */cMath::Vector3Normalize(vProxyPos - pCamera->GetPosition());
/*pCamera->UnProject(mpPlayer->GetCrossHairPos(),
mpInit->mpGame->GetGraphics()->GetLowLevel());*/
@@ -239,9 +239,9 @@ void cPlayerState_GrabHaptX::OnDraw() {
//-----------------------------------------------------------------------
void cPlayerState_GrabHaptX::OnPostSceneDraw() {
- iLowLevelGraphics *pLowGfx = mpInit->mpGame->GetGraphics()->GetLowLevel();
+ /*iLowLevelGraphics *pLowGfx = */mpInit->mpGame->GetGraphics()->GetLowLevel();
- cVector3f vPickPoint = cMath::MatrixMul(mpPushBody->GetWorldMatrix(), mvRelPickPoint);
+ /*cVector3f vPickPoint = */cMath::MatrixMul(mpPushBody->GetWorldMatrix(), mvRelPickPoint);
// pLowGfx->DrawSphere(vPickPoint, 0.2f, cColor(1,1,1,1));
// pLowGfx->DrawSphere(mvCurrentDisered, 0.2f, cColor(1,1,1,1));
diff --git a/engines/hpl1/penumbra-overture/PlayerState_Misc.cpp b/engines/hpl1/penumbra-overture/PlayerState_Misc.cpp
index c61bca0300d..139ea6866be 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_Misc.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_Misc.cpp
@@ -423,7 +423,7 @@ void cPlayerState_UseItem::OnStartInteract() {
if (pEntity && mpPlayer->GetPickedDist() <= pEntity->GetMaxExamineDist()) {
if (mpPlayer->GetPickedDist() <= pEntity->GetMaxInteractDist()) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
+ iGameEntity *pEntity2 = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
cGameItemType *pType = mpInit->mpInventory->GetItemType(mpPlayer->GetCurrentItem()->GetItemType());
if (mPrevState == ePlayerState_WeaponMelee ||
@@ -433,7 +433,7 @@ void cPlayerState_UseItem::OnStartInteract() {
mpPlayer->ChangeState(mPrevState);
}
- pType->OnUse(mpPlayer->GetCurrentItem(), pEntity);
+ pType->OnUse(mpPlayer->GetCurrentItem(), pEntity2);
} else {
mpInit->mpEffectHandler->GetSubTitle()->Add(kTranslate("Player", "UseItemTooFar"), 2.0f, true);
return;
@@ -864,7 +864,7 @@ bool cPlayerState_Climb::OnMoveForwards(float afMul, float afTimeStep) {
return false;
}
bool cPlayerState_Climb::OnMoveSideways(float afMul, float afTimeStep) {
- iCharacterBody *pCharBody = mpPlayer->GetCharacterBody();
+ /*iCharacterBody *pCharBody = */mpPlayer->GetCharacterBody();
return false;
}
diff --git a/engines/hpl1/penumbra-overture/PlayerState_Misc.h b/engines/hpl1/penumbra-overture/PlayerState_Misc.h
index 27a93106dbc..1643cb50ec5 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_Misc.h
+++ b/engines/hpl1/penumbra-overture/PlayerState_Misc.h
@@ -123,7 +123,7 @@ public:
class cPlayerState_Message : public iPlayerState {
private:
ePlayerMoveState mPrevMoveState;
- ePlayerState mPrevState;
+ //ePlayerState mPrevState;
public:
cPlayerState_Message(cInit *apInit, cPlayer *apPlayer);
diff --git a/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.cpp b/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.cpp
index 11d8c6c49b7..f45c1abdb9b 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.cpp
@@ -79,7 +79,7 @@ void cPlayerState_NormalHaptX::OnUpdate(float afTimeStep) {
collideData.SetMaxSize(1);
cPortalContainerEntityIterator it = pCont->GetEntityIterator(&bv);
- iGameEntity *pPickedEntity = NULL;
+ //iGameEntity *pPickedEntity = NULL;
eGameEntityType pickedType = eGameEntityType_LastEnum;
while (it.HasNext()) {
@@ -545,7 +545,7 @@ void cPlayerState_UseItemHaptX::OnStartInteract() {
if (pEntity && mpPlayer->GetPickedDist() <= pEntity->GetMaxExamineDist()) {
if (mpPlayer->GetPickedDist() <= pEntity->GetMaxInteractDist()) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
+ iGameEntity *pEntity2 = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
cGameItemType *pType = mpInit->mpInventory->GetItemType(mpPlayer->GetCurrentItem()->GetItemType());
if (mPrevState == ePlayerState_WeaponMelee ||
@@ -555,7 +555,7 @@ void cPlayerState_UseItemHaptX::OnStartInteract() {
mpPlayer->ChangeState(mPrevState);
}
- pType->OnUse(mpPlayer->GetCurrentItem(), pEntity);
+ pType->OnUse(mpPlayer->GetCurrentItem(), pEntity2);
} else {
mpInit->mpEffectHandler->GetSubTitle()->Add(kTranslate("Player", "UseItemTooFar"), 2.0f, true);
return;
@@ -1004,7 +1004,7 @@ bool cPlayerState_ClimbHaptX::OnMoveForwards(float afMul, float afTimeStep) {
return false;
}
bool cPlayerState_ClimbHaptX::OnMoveSideways(float afMul, float afTimeStep) {
- iCharacterBody *pCharBody = mpPlayer->GetCharacterBody();
+ /*iCharacterBody *pCharBody = */mpPlayer->GetCharacterBody();
return false;
}
diff --git a/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.h b/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.h
index 19938165a99..dc027074fc7 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.h
+++ b/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.h
@@ -129,7 +129,7 @@ public:
class cPlayerState_MessageHaptX : public iPlayerState {
private:
ePlayerMoveState mPrevMoveState;
- ePlayerState mPrevState;
+ //ePlayerState mPrevState;
public:
cPlayerState_MessageHaptX(cInit *apInit, cPlayer *apPlayer);
diff --git a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp b/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
index 042e9c74148..d448425d0f0 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
@@ -804,12 +804,12 @@ bool cPlayerState_WeaponMeleeHaptX::CheckAttack(const cMatrixf &a_mtxTransform,
// Add force to bodies
for (int i = 0; i < pEnemy->GetBodyNum(); ++i) {
- iPhysicsBody *pBody = pEnemy->GetBody(i);
+ iPhysicsBody *pBody2 = pEnemy->GetBody(i);
- pBody->AddImpulse(vForceDir * fForceSize * 0.5f);
+ pBody2->AddImpulse(vForceDir * fForceSize * 0.5f);
cVector3f vTorque = cVector3f(0, 1, 0) * fMass * fForceSize * 0.5f;
- pBody->AddTorque(vTorque);
+ pBody2->AddTorque(vTorque);
}
// Calculate damage
@@ -852,7 +852,7 @@ bool cPlayerState_WeaponMeleeHaptX::CheckAttack(const cMatrixf &a_mtxTransform,
while (it.HasNext()) {
iPhysicsBody *pBody = it.Next();
- float fMass = pBody->GetMass();
+ /*float fMass = */pBody->GetMass();
if (pBody->IsActive() == false)
continue;
diff --git a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.h b/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.h
index 512191a6c90..961f9915a09 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.h
+++ b/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.h
@@ -160,7 +160,7 @@ private:
float mfAttackCount;
bool mbInteractDown;
- int mlInteractCount;
+ //int mlInteractCount;
cVector3f mvRotation;
cVector3f mvGoalRotation;
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index 906548529c9..f0e7df02b3d 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -218,7 +218,7 @@ cSaveHandler::cSaveHandler(cInit *apInit) : iUpdateable("SaveHandler") {
//////////////////////////////////////////////
// Create directories
msSaveDir = _W("");
- LowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
+ /*LowLevelSystem *pLowLevelSystem = */mpInit->mpGame->GetSystem()->GetLowLevel();
tWString sPeronalDir = GetSystemSpecialPath(eSystemPath_Personal);
@@ -350,7 +350,7 @@ void cSaveHandler::SaveData(const tString &asName) {
//-----------------------------------------------------------------------
void cSaveHandler::LoadData(const tString &asName) {
- cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
+ /*cWorld3D *pWorld = */mpInit->mpGame->GetScene()->GetWorld3D();
cSavedWorld *pSavedWorld = mpSavedGame->GetSavedWorld(asName);
///////////////////////
@@ -378,7 +378,7 @@ void cSaveHandler::LoadData(const tString &asName) {
///////////////////////
// Inventory callbacks
- cInventory *pInventory = mpInit->mpInventory;
+ //cInventory *pInventory = mpInit->mpInventory;
///////////////////////
// Use callbacks
@@ -669,7 +669,7 @@ void cSaveHandler::OnExit() {
void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMask, int alMaxFiles) {
LowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
- LowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
+ /*LowLevelSystem *pLowLevelSystem = */mpInit->mpGame->GetSystem()->GetLowLevel();
tWString sPath = msSaveDir + asDir;
@@ -698,7 +698,7 @@ void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMa
tWString cSaveHandler::GetLatest(const tWString &asDir, const tWString &asMask) {
LowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
- LowLevelSystem *pLowLevelSystem = mpInit->mpGame->GetSystem()->GetLowLevel();
+ /*LowLevelSystem *pLowLevelSystem = */mpInit->mpGame->GetSystem()->GetLowLevel();
tWString sPath = msSaveDir + asDir;
Commit: a726df6451884f38fbd202a4c1f18c62ef1d7611
https://github.com/scummvm/scummvm/commit/a726df6451884f38fbd202a4c1f18c62ef1d7611
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:03:49+01:00
Commit Message:
HPL1: Put assert on unhandled case in iMaterial_BaseLight::getGpuProgram()
Changed paths:
engines/hpl1/engine/graphics/Material_BaseLight.cpp
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
index e650d8a461c..93299105e2b 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
@@ -168,6 +168,8 @@ iGpuProgram *iMaterial_BaseLight::getGpuProgram(const eMaterialRenderType aType,
program = eBaseLightProgram_Point1;
else if (apLight->GetLightType() == eLight3DType_Spot)
program = eBaseLightProgram_Spot1;
+ else
+ assert(false);
}
return _shaders[program];
} else if (aType == eMaterialRenderType_Diffuse) {
Commit: 18e46c2d6ecbf48c552e0e5c01d351f10f400bc4
https://github.com/scummvm/scummvm/commit/18e46c2d6ecbf48c552e0e5c01d351f10f400bc4
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:49+01:00
Commit Message:
HPL1: remove separate shader usage
Changed paths:
engines/hpl1/penumbra-overture/MapHandler.cpp
diff --git a/engines/hpl1/penumbra-overture/MapHandler.cpp b/engines/hpl1/penumbra-overture/MapHandler.cpp
index fa965efbda3..60cb5e31593 100644
--- a/engines/hpl1/penumbra-overture/MapHandler.cpp
+++ b/engines/hpl1/penumbra-overture/MapHandler.cpp
@@ -1054,23 +1054,16 @@ void cMapHandler::RenderItemEffect() {
pMeshEntity->GetWorldMatrix()));
for (int i = 0; i < pMeshEntity->GetMesh()->GetSubMeshNum(); i++) {
cSubMeshEntity *pSubEntity = pMeshEntity->GetSubMeshEntity(i);
- /*cSubMesh *pSubMesh = */pMeshEntity->GetMesh()->GetSubMesh(i);
iVertexBuffer *pVtxBuffer = pSubEntity->GetVertexBuffer();
iMaterial *pMaterial = pSubEntity->GetMaterial();
- iGpuProgram *pVtxProg = pMaterial->GetVertexProgram(eMaterialRenderType_Z, 0, NULL);
-
- if (pVtxProg) {
- pVtxProg->Bind();
- pVtxProg->SetMatrixf("worldViewProj",
- eGpuProgramMatrix_ViewProjection,
- eGpuProgramMatrixOp_Identity);
- }
-
- iGpuProgram *pFragProg = pMaterial->GetFragmentProgram(eMaterialRenderType_Z, 0, NULL);
- if (pFragProg) {
- pFragProg->SetColor3f("ambientColor", pItem->GetFlashAlpha());
- pFragProg->Bind();
+ iGpuProgram *gpuProgram = pMaterial->getGpuProgram(eMaterialRenderType_Z, 0, NULL);
+ if (gpuProgram) {
+ gpuProgram->Bind();
+ gpuProgram->SetMatrixf("worldViewProj",
+ eGpuProgramMatrix_ViewProjection,
+ eGpuProgramMatrixOp_Identity);
+ gpuProgram->SetColor3f("ambientColor", pItem->GetFlashAlpha());
}
pLowGfx->SetTexture(0, pMaterial->GetTexture(eMaterialTexture_Diffuse));
@@ -1079,10 +1072,8 @@ void cMapHandler::RenderItemEffect() {
pVtxBuffer->Draw();
pVtxBuffer->UnBind();
- if (pFragProg)
- pFragProg->UnBind();
- if (pVtxProg)
- pVtxProg->UnBind();
+ if (gpuProgram)
+ gpuProgram->UnBind();
}
}
Commit: df5cbb7cf184bed0fb7939cbc663798ebc693388
https://github.com/scummvm/scummvm/commit/df5cbb7cf184bed0fb7939cbc663798ebc693388
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:03:49+01:00
Commit Message:
HPL1: Fixed previous warning fix. Based on few lines above parethness suppose to be different.
Changed paths:
engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp b/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
index f8d81b565f0..c1ef773fc05 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
@@ -317,7 +317,7 @@ const char *TiXmlBase::SkipWhiteSpace(const char *p, TiXmlEncoding encoding) {
break;
}
} else {
- while ((*p && IsWhiteSpace(*p)) || *p == '\n' || *p == '\r')
+ while (*p && IsWhiteSpace(*p) || *p == '\n' || *p == '\r')
++p;
}
Commit: 02285e0198c767d3e79ff1f1a61cd34329a0515a
https://github.com/scummvm/scummvm/commit/02285e0198c767d3e79ff1f1a61cd34329a0515a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:03:50+01:00
Commit Message:
HPL1: Fix warning
Changed paths:
engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp b/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
index c1ef773fc05..6629e31ada0 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
@@ -317,7 +317,7 @@ const char *TiXmlBase::SkipWhiteSpace(const char *p, TiXmlEncoding encoding) {
break;
}
} else {
- while (*p && IsWhiteSpace(*p) || *p == '\n' || *p == '\r')
+ while (*p && (IsWhiteSpace(*p) || *p == '\n' || *p == '\r'))
++p;
}
Commit: 6fc11767adad59b0100906586ee3cc73ada0c266
https://github.com/scummvm/scummvm/commit/6fc11767adad59b0100906586ee3cc73ada0c266
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:50+01:00
Commit Message:
HPL1: add error message in unimplemented class
Changed paths:
engines/hpl1/engine/impl/VertexBufferOGL.cpp
diff --git a/engines/hpl1/engine/impl/VertexBufferOGL.cpp b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
index 73dfd5a2a0a..165bff41cf2 100644
--- a/engines/hpl1/engine/impl/VertexBufferOGL.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
@@ -26,6 +26,7 @@
*/
#include "hpl1/engine/impl/VertexBufferOGL.h"
+#include "hpl1/debug.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
@@ -44,6 +45,9 @@ namespace hpl {
cVertexBufferOGL::cVertexBufferOGL(iLowLevelGraphics *apLowLevelGraphics, tVertexFlag aFlags,
eVertexBufferDrawType aDrawType, eVertexBufferUsageType aUsageType,
int alReserveVtxSize, int alReserveIdxSize) : iVertexBuffer(apLowLevelGraphics, aFlags, aDrawType, aUsageType, alReserveVtxSize, alReserveIdxSize) {
+
+ error("trying to create VertexBufferOGL");
+
if (alReserveVtxSize > 0) {
for (int i = 0; i < klNumOfVertexFlags; i++) {
if (aFlags & kvVertexFlags[i]) {
Commit: 00cfff44960a9b3bf34f64da4ddccbbbf1301c88
https://github.com/scummvm/scummvm/commit/00cfff44960a9b3bf34f64da4ddccbbbf1301c88
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:50+01:00
Commit Message:
HPL1: fix and add fallback01 shaders
Changed paths:
A engines/hpl1/engine/impl/shaders/Fallback01_Bump_Light.fragment
A engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot.fragment
A engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.fragment
A engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.fragment
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Bump_Light.fragment b/engines/hpl1/engine/impl/shaders/Fallback01_Bump_Light.fragment
new file mode 100644
index 00000000000..ea2374f1810
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Bump_Light.fragment
@@ -0,0 +1,22 @@
+//FallBack01_Bump_Light.fragment
+
+in vec4 vColor;
+in vec3 vLightDir;
+in vec3 vUv;
+in vec3 vLightPos;
+
+OUTPUT
+
+uniform samplerCube tex0; //normalizedVecMap
+uniform sampler2D tex1; //normalMap
+uniform sampler3D tex2; //attenuation
+
+void main() {
+ vec4 nv = texture(tex0, vLightDir)
+ vec4 norm = texture(tex1, vUv.st);
+ vec4 attenuation = texture3D(tex2, vLightPos);
+
+ outColor = vec4((nv.r - 0.5)*(norm.r - 0.5) + (nv.g - 0.5)*(norm.g - 0.5) + (nv.b - 0.5)*(norm.b - 0.5));
+ outColor.a *= attenuation.g;
+}
+
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot.fragment
new file mode 100644
index 00000000000..18b775e55bd
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot.fragment
@@ -0,0 +1,17 @@
+//FallBack01_Diffuse_Light_Spot.fragment
+
+in vec4 vLightColor;
+in vec3 vUv;
+in vec4 vSpotlightUv;
+in float vRejectUv;
+
+uniform sampler2D tex0; //diffuseMap
+uniform sampler2D tex1; //normalMap
+uniform sampler1D tex2; //spotNegRejectMap
+
+void main() {
+ vec4 diffuse = texture(tex0, vUv.xy);
+ vec4 spot = texture(tex1, vSpotlightUv.xy / vSpotlightUv.w);
+ float spotNegReject = texture1D(tex2, vSpotlightUv.z).r;
+ outColor = diffuse * spot * spotNegReject * vLightColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
index 6bf5f1b2e04..7b6232e2eb1 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
@@ -14,7 +14,6 @@ vec3 normal = gl_Normal;
vec3 uv = gl_MultiTexCoord0.xyz;
vec4 tangent = gl_MultiTexCoord1;
-
out vec4 vLightColor;
out vec3 vUv;
out vec4 vSpotlightUv;
@@ -32,7 +31,7 @@ void main()
vUv = uv;
vSpotlightUv = (spotViewProj * position);
- vRejectUv.x = vSpotlightUv.z + 0.5;
+ vRejectUv = vSpotlightUv.z + 0.5;
vLightColor = clamp(LightColor, vec4(0.0), vec4(1.0));
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.fragment b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.fragment
new file mode 100644
index 00000000000..556adf0d4cc
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.fragment
@@ -0,0 +1,19 @@
+//Fallback01_Diffuse_Light.fragment
+
+in vec4 vLightColor;
+in vec3 vUv;
+in vec3 vLightPos;
+in vec3 vLightDir;
+
+OUTPUT
+
+uniform samplerCube tex0; //normalMap
+uniform sampler3D tex2; //attenuation
+
+void main() {
+ vec4 normalizedVec = textureCube(tex0, vLightDir);
+ vec4 attenuation = texture3D(tex2, vLightPos);
+ outColor = vec4(2.0*(normalizedVec.b - 0.5));
+ outColor.a *= attenuation.g;
+}
+
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
index 7464b0f269e..73371b197db 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
@@ -14,8 +14,7 @@ vec3 normal = gl_Normal;
vec3 uv = gl_MultiTexCoord0.xyz;
vec4 tangent = gl_MultiTexCoord1;
-
-out vec4 vColor
+out vec4 vLightColor;
out vec3 vLightDir;
out vec3 vUv;
out vec3 vLightPos;
@@ -42,5 +41,5 @@ void main()
//Transform the lightdir
vLightDir = (rotation * vLightDir);
- outColor = vec4(1.0);
+ vLightColor = vec4(1.0);
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.fragment b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.fragment
new file mode 100644
index 00000000000..7918f521e2b
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.fragment
@@ -0,0 +1,14 @@
+//Fallback01_Diffuse_Light.fragment
+
+in vec4 vLightColor;
+in vec3 vUv;
+in vec3 vLightPos;
+in vec3 vLightDir;
+
+OUTPUT
+
+uniform sampler2D tex0; //diffuseMap
+
+void main() {
+ outColor = texture(tex0, vUv.xy) * vLightColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
index d5aa381e982..8d7a80a8566 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
@@ -14,7 +14,6 @@ vec3 normal = gl_Normal;
vec3 uv = gl_MultiTexCoord0.xyz;
vec4 tangent = gl_MultiTexCoord1;
-
out vec4 vLightColor;
out vec3 vUv;
Commit: a16a4aa8f7c74490df568f52b009983f6be79335
https://github.com/scummvm/scummvm/commit/a16a4aa8f7c74490df568f52b009983f6be79335
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:50+01:00
Commit Message:
HPL1: implement material class for medium graphics
Changed paths:
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
index 8f6d832935a..38d61a4a3e6 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
@@ -26,7 +26,7 @@
*/
#include "hpl1/engine/graphics/Material_Fallback01_BaseLight.h"
-#include "common/textconsole.h"
+#include "hpl1/engine/graphics/Renderer3D.h"
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/math/Math.h"
@@ -36,251 +36,13 @@
#include "hpl1/engine/scene/Light.h"
#include "hpl1/engine/scene/Light3DSpot.h"
#include "hpl1/engine/system/String.h"
+#include "hpl1/engine/scene/PortalContainer.h"
+#include "common/algorithm.h"
//#include <GL/GLee.h>
namespace hpl {
-//////////////////////////////////////////////////////////////////////////
-// FRAGMENT PROGRAMS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cGLState_Diffuse::cGLState_Diffuse()
- : iGLStateProgram("Internal_Diffuse") {
-}
-
-void cGLState_Diffuse::Bind() {
- mpLowGfx->SetActiveTextureUnit(0);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Dot3RGBA);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource1, eTextureSource_Constant);
- mpLowGfx->SetTextureConstantColor(cColor(0.5f, 0.5f, 1, 0));
-}
-
-void cGLState_Diffuse::UnBind() {
- mpLowGfx->SetActiveTextureUnit(0);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Modulate);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource1, eTextureSource_Previous);
-}
-
-//-----------------------------------------------------------------------
-
-cGLState_ATIDiffuse::cGLState_ATIDiffuse()
- : iGLStateProgram("Internal_ATIDiffuse")/*, mlBind(0)*/ {
-}
-
-void cGLState_ATIDiffuse::InitData() {
-#if 0
- mlBind = glGenFragmentShadersATI(1);
-
- Log("Creating and binding ATI diffuse shader to %d\n",mlBind);
- glBindFragmentShaderATI(mlBind);
-
- glBeginFragmentShaderATI();
-
- glSampleMapATI(GL_REG_0_ATI, GL_TEXTURE0_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_2_ATI, GL_TEXTURE2_ARB, GL_SWIZZLE_STR_ATI);
-
- //Reg0 = NormlizedVec dot3 Vector(0,0,1)
- float vConst[4] = {0,0,1,0};
- glSetFragmentShaderConstantATI( GL_CON_0_ATI,vConst);
- glColorFragmentOp2ATI( GL_DOT3_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_0_ATI, GL_NONE, GL_2X_BIT_ATI|GL_BIAS_BIT_ATI,
- GL_CON_0_ATI, GL_NONE, GL_NONE);
- glAlphaFragmentOp2ATI( GL_DOT3_ATI, GL_REG_0_ATI, GL_NONE,
- GL_REG_0_ATI, GL_NONE, GL_2X_BIT_ATI|GL_BIAS_BIT_ATI,
- GL_CON_0_ATI, GL_NONE, GL_NONE);
-
- //Reg0 = Light * Attenuation
- glAlphaFragmentOp2ATI( GL_MUL_ATI, GL_REG_0_ATI, GL_NONE,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_2_ATI, GL_NONE, GL_NONE);
-
- glEndFragmentShaderATI();
-#endif
-}
-
-cGLState_ATIDiffuse::~cGLState_ATIDiffuse() {
-#if 0
- Log("Deleting ATI shader to %d\n",mlBind);
- if (mlBind) glDeleteFragmentShaderATI(mlBind);
-#endif
-}
-
-void cGLState_ATIDiffuse::Bind() {
-#if 0
- glEnable(GL_FRAGMENT_SHADER_ATI);
- glBindFragmentShaderATI(mlBind);
-#endif
-}
-
-void cGLState_ATIDiffuse::UnBind() {
-#if 0
- glDisable(GL_FRAGMENT_SHADER_ATI);
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-cGLState_Bump::cGLState_Bump()
- : iGLStateProgram("Internal_Bump") {
-}
-
-void cGLState_Bump::Bind() {
- mpLowGfx->SetActiveTextureUnit(0);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Replace);
- mpLowGfx->SetActiveTextureUnit(1);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Dot3RGBA);
- mpLowGfx->SetActiveTextureUnit(2);
- mpLowGfx->SetTextureEnv(eTextureParam_AlphaFunc, eTextureFunc_Modulate);
-}
-
-void cGLState_Bump::UnBind() {
- mpLowGfx->SetActiveTextureUnit(0);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Modulate);
- mpLowGfx->SetActiveTextureUnit(1);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Modulate);
- mpLowGfx->SetActiveTextureUnit(2);
- mpLowGfx->SetTextureEnv(eTextureParam_AlphaFunc, eTextureFunc_Modulate);
-}
-
-//-----------------------------------------------------------------------
-
-cGLState_ATIBump::cGLState_ATIBump()
- : iGLStateProgram("Internal_ATIBump")/*, mlBind(0)*/ {
-}
-
-void cGLState_ATIBump::InitData() {
-#if 0
- mlBind = glGenFragmentShadersATI(1);
-
- Log("Creating and binding ATI bump shader to %d\n",mlBind);
- glBindFragmentShaderATI(mlBind);
-
- glBeginFragmentShaderATI();
-
- glSampleMapATI(GL_REG_0_ATI, GL_TEXTURE0_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_1_ATI, GL_TEXTURE1_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_2_ATI, GL_TEXTURE2_ARB, GL_SWIZZLE_STR_ATI);
-
- //Reg0 = NormlizedVec dot3 NormalMap
- glColorFragmentOp2ATI( GL_DOT3_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_1_ATI, GL_NONE, GL_2X_BIT_ATI|GL_BIAS_BIT_ATI,
- GL_REG_0_ATI, GL_NONE, GL_2X_BIT_ATI|GL_BIAS_BIT_ATI);
- glAlphaFragmentOp2ATI( GL_DOT3_ATI, GL_REG_0_ATI, GL_NONE,
- GL_REG_1_ATI, GL_NONE, GL_2X_BIT_ATI|GL_BIAS_BIT_ATI,
- GL_REG_0_ATI, GL_NONE, GL_2X_BIT_ATI|GL_BIAS_BIT_ATI);
-
- //Reg0 = Light * Attenuation
- glAlphaFragmentOp2ATI( GL_MUL_ATI, GL_REG_0_ATI, GL_NONE,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_2_ATI, GL_NONE, GL_NONE);
-
- glEndFragmentShaderATI();
-#endif
-}
-
-cGLState_ATIBump::~cGLState_ATIBump() {
-#if 0
- Log("Deleting ATI shader to %d\n",mlBind);
- if (mlBind) glDeleteFragmentShaderATI(mlBind);
-#endif
-}
-
-void cGLState_ATIBump::Bind() {
-#if 0
- glEnable(GL_FRAGMENT_SHADER_ATI);
- glBindFragmentShaderATI(mlBind);
-#endif
-}
-
-void cGLState_ATIBump::UnBind() {
-#if 0
- glDisable(GL_FRAGMENT_SHADER_ATI);
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-cGLState_Spot::cGLState_Spot()
- : iGLStateProgram("Internal_Spot") {
-}
-
-void cGLState_Spot::Bind() {
-}
-
-void cGLState_Spot::UnBind() {
-}
-
-//-----------------------------------------------------------------------
-
-cGLState_ATISpot::cGLState_ATISpot()
- : iGLStateProgram("Internal_ATISpot")/*, mlBind(0)*/ {
-}
-
-void cGLState_ATISpot::InitData() {
-#if 0
- mlBind = glGenFragmentShadersATI(1);
-
- Log("Creating and binding ATI spot shader to %d\n",mlBind);
- glBindFragmentShaderATI(mlBind);
-
- glBeginFragmentShaderATI();
-
- glSampleMapATI(GL_REG_0_ATI, GL_TEXTURE0_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_1_ATI, GL_TEXTURE1_ARB, GL_SWIZZLE_STR_DR_ATI);
- glSampleMapATI(GL_REG_2_ATI, GL_TEXTURE2_ARB, GL_SWIZZLE_STR_ATI);
-
- //Reg0 = Diffuse * Spot
- glColorFragmentOp2ATI(GL_MUL_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_1_ATI, GL_NONE, GL_NONE);
-
- //Reg0 = NegRejection * Reg0
- glColorFragmentOp2ATI(GL_MUL_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_2_ATI, GL_NONE, GL_NONE);
-
- //Reg0 = LightColor * Reg0
- glColorFragmentOp2ATI(GL_MUL_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_PRIMARY_COLOR_ARB, GL_NONE, GL_NONE);
-
- glEndFragmentShaderATI();
-#endif
-}
-
-cGLState_ATISpot::~cGLState_ATISpot() {
-#if 0
- Log("Deleting ATI shader to %d\n",mlBind);
- if (mlBind) glDeleteFragmentShaderATI(mlBind);
-#endif
-}
-
-void cGLState_ATISpot::Bind() {
-#if 0
- glEnable(GL_FRAGMENT_SHADER_ATI);
- glBindFragmentShaderATI(mlBind);
-#endif
-}
-
-void cGLState_ATISpot::UnBind() {
-#if 0
- glDisable(GL_FRAGMENT_SHADER_ATI);
-#endif
-}
-
-//-----------------------------------------------------------------------
-static cGLState_Diffuse gDiffuseGLState;
-static cGLState_ATIDiffuse gATIDiffuseGLState;
-static cGLState_Bump gBumpGLState;
-static cGLState_ATIBump gATIBumpGLState;
-static cGLState_ATISpot gATISpotGLState;
-static cGLState_Spot gSpotGLState;
-
-//-----------------------------------------------------------------------
-
iMaterial_Fallback01_BaseLight::iMaterial_Fallback01_BaseLight(
bool abNormalMap, bool abSpecular,
const tString &asName, iLowLevelGraphics *apLowLevelGraphics,
@@ -289,16 +51,8 @@ iMaterial_Fallback01_BaseLight::iMaterial_Fallback01_BaseLight(
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
: iMaterial(asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
- error("iMaterial_Fallback01_BaseLight not yet implemented");
-
- gDiffuseGLState.SetUp(mpLowLevelGraphics);
- gBumpGLState.SetUp(mpLowLevelGraphics);
- gSpotGLState.SetUp(mpLowLevelGraphics);
- if (mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_ATIFragmentShader)) {
- gATISpotGLState.SetUp(mpLowLevelGraphics);
- gATIBumpGLState.SetUp(mpLowLevelGraphics);
- gATIDiffuseGLState.SetUp(mpLowLevelGraphics);
- }
+
+ Common::fill(_programs, _programs + eBaseLightProgram_LastEnum, nullptr);
mbUseNormalMap = abNormalMap;
mbUseSpecular = abSpecular;
@@ -307,74 +61,19 @@ iMaterial_Fallback01_BaseLight::iMaterial_Fallback01_BaseLight(
mbIsGlowing = false;
mbUsesLights = true;
- tString asLightVertexProgram1 = "Fallback01_Diffuse_Light_p1_vp.cg";
- tString asLightVertexProgram2 = "Fallback01_Diffuse_Light_p2_vp.cg";
+ const char *firstPassFragment = "";
+ if (abSpecular)
+ firstPassFragment = "Fallback01_Bump_Light";
+ else
+ firstPassFragment = "Fallback01_Diffuse_Light_p1";
- tString asLightSpotVertexProgram1 = "Fallback01_Diffuse_Light_p1_vp.cg";
- tString asLightSpotVertexProgram2 = "Fallback01_Diffuse_Light_Spot_p2_vp.cg";
+ _programs[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram("Fallback01_Diffuse_Light_p1", firstPassFragment);
+ _programs[eBaseLightProgram_Point2] = mpProgramManager->CreateProgram("Fallback01_Diffuse_Light_p2", "Fallback01_Diffuse_Light_p2");
+ _programs[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram("Fallback01_Diffuse_Light_p1", firstPassFragment);
+ _programs[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram("Fallback01_Diffuse_Light_Spot_p2", "Fallback01_Diffuse_Light_Spot");
- for (int i = 0; i < eBaseLightProgram_LastEnum; i++) {
- mvVtxPrograms[i] = NULL;
- mvFragPrograms[i] = NULL;
- }
-
- ///////////////////////////////////////////
- // Load the light pass vertex program
- // Point
- mvVtxPrograms[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram(asLightVertexProgram1,
- "main", eGpuProgramType_Vertex);
- mvVtxPrograms[eBaseLightProgram_Point2] = mpProgramManager->CreateProgram(asLightVertexProgram2,
- "main", eGpuProgramType_Vertex);
- mvVtxPrograms[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram(asLightSpotVertexProgram1,
- "main", eGpuProgramType_Vertex);
- mvVtxPrograms[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram(asLightSpotVertexProgram2,
- "main", eGpuProgramType_Vertex);
-
- ///////////////////////////////////////////
- // Load the light pass fragment program
- // Point
- // mvFragPrograms[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram("_Test_Diffuse_Light_fp.cg",
- // "main", eGpuProgramType_Fragment);
- if (mbUseNormalMap) {
- if (mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_ATIFragmentShader)) {
- mvFragPrograms[eBaseLightProgram_Point1] = &gATIBumpGLState;
- mvFragPrograms[eBaseLightProgram_Spot1] = &gATIBumpGLState;
-
- mvFragPrograms[eBaseLightProgram_Spot2] = &gATISpotGLState;
- } else {
- mvFragPrograms[eBaseLightProgram_Point1] = &gBumpGLState;
- mvFragPrograms[eBaseLightProgram_Spot1] = &gBumpGLState;
-
- mvFragPrograms[eBaseLightProgram_Spot2] = NULL; // hplNew( cGLState_Spot,(mpLowLevelGraphics) );
- }
-
- // mvFragPrograms[eBaseLightProgram_Spot2] = hplNew( cGLState_Spot,(mpLowLevelGraphics) );
- // mvFragPrograms[eBaseLightProgram_Spot2] = hplNew( cGLState_ATISpot, (mpLowLevelGraphics) );
- // mvFragPrograms[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram(
- // "_Test_Diffuse_Light_fp.cg",
- // "main", eGpuProgramType_Fragment);
- } else {
- if (mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_ATIFragmentShader)) {
- mvFragPrograms[eBaseLightProgram_Point1] = &gATIDiffuseGLState;
- mvFragPrograms[eBaseLightProgram_Spot1] = &gATIDiffuseGLState;
-
- mvFragPrograms[eBaseLightProgram_Spot2] = &gATISpotGLState;
- } else {
- mvFragPrograms[eBaseLightProgram_Point1] = &gDiffuseGLState;
- mvFragPrograms[eBaseLightProgram_Spot1] = &gDiffuseGLState;
-
- mvFragPrograms[eBaseLightProgram_Spot2] = NULL; // hplNew( cGLState_Spot, (mpLowLevelGraphics) );
- }
-
- // mvFragPrograms[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram(
- // "_Test_Diffuse_Light_fp.cg",
- // "main", eGpuProgramType_Fragment);
- }
-
- ///////////////////////////////////////////
- // Load the Z pass vertex program
- iGpuProgram *pVtxProg = mpProgramManager->CreateProgram("Diffuse_Color_vp.cg", "main", eGpuProgramType_Vertex);
- SetProgram(pVtxProg, eGpuProgramType_Vertex, 1);
+ _diffuseShader = mpProgramManager->CreateProgram("Diffuse_Color", "Diffuse_Color");
+ _ambientShader = mpProgramManager->CreateProgram("Diffuse_Color", "Ambient_Color");
mpNormalizationMap = mpTextureManager->CreateCubeMap("Normalization", false);
mpNormalizationMap->SetWrapS(eTextureWrap_ClampToEdge);
@@ -396,10 +95,11 @@ iMaterial_Fallback01_BaseLight::~iMaterial_Fallback01_BaseLight() {
mpTextureManager->Destroy(mpSpotNegativeRejectMap);
for (int i = 0; i < eBaseLightProgram_LastEnum; i++) {
- if (mvVtxPrograms[i])
- mpProgramManager->Destroy(mvVtxPrograms[i]);
- // if(mvFragPrograms[i]) mpProgramManager->Destroy(mvFragPrograms[i]);
+ if (_programs[i])
+ mpProgramManager->Destroy(_programs[i]);
}
+ if (_diffuseShader)
+ mpProgramManager->Destroy(_diffuseShader);
}
//-----------------------------------------------------------------------
@@ -410,7 +110,7 @@ iMaterial_Fallback01_BaseLight::~iMaterial_Fallback01_BaseLight() {
//-----------------------------------------------------------------------
-iGpuProgram *iMaterial_Fallback01_BaseLight::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+iGpuProgram *iMaterial_Fallback01_BaseLight::getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
eBaseLightProgram program;
if (apLight) {
if (apLight->GetLightType() == eLight3DType_Point)
@@ -420,14 +120,35 @@ iGpuProgram *iMaterial_Fallback01_BaseLight::GetVertexProgram(eMaterialRenderTyp
}
if (aType == eMaterialRenderType_Light) {
- return mvVtxPrograms[program + alPass];
+ return _programs[program + alPass];
}
if (aType == eMaterialRenderType_Z)
- return mpProgram[eGpuProgramType_Vertex][1];
+ return _ambientShader;
if (aType == eMaterialRenderType_Diffuse)
- return mpProgram[eGpuProgramType_Vertex][1];
+ return _diffuseShader;
- return NULL;
+ return nullptr;
+}
+
+class cAmbProgramSetup : public iMaterialProgramSetup {
+public:
+ void Setup(iGpuProgram *apProgram, cRenderSettings *apRenderSettings) {
+ if (apRenderSettings->mpSector)
+ apProgram->SetColor3f("ambientColor", apRenderSettings->mAmbientColor * apRenderSettings->mpSector->GetAmbientColor());
+ else
+ apProgram->SetColor3f("ambientColor", apRenderSettings->mAmbientColor);
+ }
+};
+
+iMaterialProgramSetup *iMaterial_Fallback01_BaseLight::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
+ static cAmbProgramSetup ambProgramSetup;
+ if (aType == eMaterialRenderType_Z)
+ return &ambProgramSetup;
+ return nullptr;
+}
+
+iGpuProgram *iMaterial_Fallback01_BaseLight::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+ return nullptr;
}
//------------------------------------------------------------------------------------
@@ -450,17 +171,7 @@ bool iMaterial_Fallback01_BaseLight::VertexProgramUsesEye(eMaterialRenderType aT
//------------------------------------------------------------------------------------
iGpuProgram *iMaterial_Fallback01_BaseLight::GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (aType == eMaterialRenderType_Light) {
- eBaseLightProgram program = eBaseLightProgram_Point1;
-
- if (apLight->GetLightType() == eLight3DType_Point)
- program = eBaseLightProgram_Point1;
- else if (apLight->GetLightType() == eLight3DType_Spot)
- program = eBaseLightProgram_Spot1;
-
- return mvFragPrograms[program + alPass];
- }
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------------------------
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
index 9a774aea43a..28ee3ba9ed9 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
@@ -53,6 +53,9 @@ public:
bool UsesType(eMaterialRenderType aType);
+ iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+ iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+
iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
@@ -92,100 +95,11 @@ protected:
iTexture *mpAttenuationMap;
- iGpuProgram *_shaders[eBaseLightProgram_LastEnum];
- iGpuProgram *mvVtxPrograms[eBaseLightProgram_LastEnum];
- iGpuProgram *mvFragPrograms[eBaseLightProgram_LastEnum];
-};
-
-//---------------------------------------------------------------
-
-class cGLState_Diffuse : public iGLStateProgram {
-public:
- cGLState_Diffuse();
-
- void Bind();
- void UnBind();
-
-private:
- void InitData() {}
-};
-
-//---------------------------------------------------------------
-
-class cGLState_ATIDiffuse : public iGLStateProgram {
-public:
- cGLState_ATIDiffuse();
- ~cGLState_ATIDiffuse();
-
- void Bind();
- void UnBind();
-
-private:
- void InitData();
-
- //int mlBind;
-};
-
-//---------------------------------------------------------------
-
-class cGLState_Bump : public iGLStateProgram {
-public:
- cGLState_Bump();
-
- void Bind();
- void UnBind();
-
-private:
- void InitData() {}
-};
-
-//---------------------------------------------------------------
-
-class cGLState_ATIBump : public iGLStateProgram {
-public:
- cGLState_ATIBump();
- ~cGLState_ATIBump();
-
- void Bind();
- void UnBind();
-
-private:
- void InitData();
-
- //int mlBind;
-};
-
-//---------------------------------------------------------------
-
-class cGLState_Spot : public iGLStateProgram {
-public:
- cGLState_Spot();
-
- void Bind();
- void UnBind();
-
-private:
- void InitData() {}
-};
-
-//---------------------------------------------------------------
-
-class cGLState_ATISpot : public iGLStateProgram {
-public:
- cGLState_ATISpot();
- ~cGLState_ATISpot();
-
- void Bind();
- void UnBind();
-
-private:
- void InitData();
-
- //int mlBind;
+ iGpuProgram *_programs[eBaseLightProgram_LastEnum];
+ iGpuProgram *_diffuseShader;
+ iGpuProgram *_ambientShader;
};
-//---------------------------------------------------------------
-
///////////////////////////////////////////
// Diffuse
///////////////////////////////////////////
Commit: 3666b1b73dcaeab1f03fa116ee2cd6eb7e5cee40
https://github.com/scummvm/scummvm/commit/3666b1b73dcaeab1f03fa116ee2cd6eb7e5cee40
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:50+01:00
Commit Message:
HPL1: replace const_cast
Changed paths:
engines/hpl1/engine/resources/TextureManager.cpp
diff --git a/engines/hpl1/engine/resources/TextureManager.cpp b/engines/hpl1/engine/resources/TextureManager.cpp
index 1f02cb803ff..9b76600c5ce 100644
--- a/engines/hpl1/engine/resources/TextureManager.cpp
+++ b/engines/hpl1/engine/resources/TextureManager.cpp
@@ -322,7 +322,7 @@ iTexture *cTextureManager::CreateAttenuation(const tString &asFallOffName) {
int lBmpChannels = pBmp->getNumChannels();
int lWidth = pBmp->getWidth();
- unsigned char *pPixels = (unsigned char *)const_cast<void *>(pBmp->getRawData());
+ const unsigned char *pPixels = static_cast<const unsigned char *>(pBmp->getRawData());
iTexture *pTexture = mpGraphics->GetLowLevel()->CreateTexture("Attenuation", false, eTextureType_Normal, eTextureTarget_3D);
int lSize = 16;
Commit: e5a768fa5a80cbfce72e5a8608a47fd5011c18fe
https://github.com/scummvm/scummvm/commit/e5a768fa5a80cbfce72e5a8608a47fd5011c18fe
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:50+01:00
Commit Message:
HPL1: fix shader
Changed paths:
engines/hpl1/engine/impl/shaders/Fallback01_Bump_Light.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Bump_Light.fragment b/engines/hpl1/engine/impl/shaders/Fallback01_Bump_Light.fragment
index ea2374f1810..5555a7efd10 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Bump_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Bump_Light.fragment
@@ -12,11 +12,11 @@ uniform sampler2D tex1; //normalMap
uniform sampler3D tex2; //attenuation
void main() {
- vec4 nv = texture(tex0, vLightDir)
+ vec4 nv = textureCube(tex0, vLightDir);
vec4 norm = texture(tex1, vUv.st);
vec4 attenuation = texture3D(tex2, vLightPos);
- outColor = vec4((nv.r - 0.5)*(norm.r - 0.5) + (nv.g - 0.5)*(norm.g - 0.5) + (nv.b - 0.5)*(norm.b - 0.5));
+ outColor = vec4(4*((nv.r - 0.5)*(norm.r - 0.5) + (nv.g - 0.5)*(norm.g - 0.5) + (nv.b - 0.5)*(norm.b - 0.5)));
outColor.a *= attenuation.g;
}
Commit: 0d8ac87aca5d937245d6f9bfb561603f7a3f08d1
https://github.com/scummvm/scummvm/commit/0d8ac87aca5d937245d6f9bfb561603f7a3f08d1
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:50+01:00
Commit Message:
HPL1: fix wrong conditional
Changed paths:
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
index 38d61a4a3e6..7e794761b42 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
@@ -62,7 +62,7 @@ iMaterial_Fallback01_BaseLight::iMaterial_Fallback01_BaseLight(
mbUsesLights = true;
const char *firstPassFragment = "";
- if (abSpecular)
+ if (abNormalMap)
firstPassFragment = "Fallback01_Bump_Light";
else
firstPassFragment = "Fallback01_Diffuse_Light_p1";
Commit: 729522a7647f0415080d1fc1a3cefb052e697302
https://github.com/scummvm/scummvm/commit/729522a7647f0415080d1fc1a3cefb052e697302
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:50+01:00
Commit Message:
HPL1: fix file name comment in shader code
Changed paths:
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.fragment
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.fragment b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.fragment
index 556adf0d4cc..81f4692d865 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.fragment
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.fragment
@@ -1,4 +1,4 @@
-//Fallback01_Diffuse_Light.fragment
+//Fallback01_Diffuse_Light_p1.fragment
in vec4 vLightColor;
in vec3 vUv;
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.fragment b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.fragment
index 7918f521e2b..e20f01adc60 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.fragment
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.fragment
@@ -1,4 +1,4 @@
-//Fallback01_Diffuse_Light.fragment
+//Fallback01_Diffuse_Light_p2.fragment
in vec4 vLightColor;
in vec3 vUv;
Commit: daa34d1ffbcee04ce1133238e0279007b19a57b1
https://github.com/scummvm/scummvm/commit/daa34d1ffbcee04ce1133238e0279007b19a57b1
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:51+01:00
Commit Message:
HPL1: fix fallback01 shader
Changed paths:
engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot.fragment
index 18b775e55bd..5666eb3ad40 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot.fragment
@@ -1,4 +1,4 @@
-//FallBack01_Diffuse_Light_Spot.fragment
+//Fallback01_Diffuse_Light_Spot.fragment
in vec4 vLightColor;
in vec3 vUv;
@@ -12,6 +12,6 @@ uniform sampler1D tex2; //spotNegRejectMap
void main() {
vec4 diffuse = texture(tex0, vUv.xy);
vec4 spot = texture(tex1, vSpotlightUv.xy / vSpotlightUv.w);
- float spotNegReject = texture1D(tex2, vSpotlightUv.z).r;
+ float spotNegReject = texture1D(tex2, vSpotlightUv.w).r;
outColor = diffuse * spot * spotNegReject * vLightColor;
}
\ No newline at end of file
Commit: 8ed22968fc4a34eb8fca372348bd347004a5a1dc
https://github.com/scummvm/scummvm/commit/8ed22968fc4a34eb8fca372348bd347004a5a1dc
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:51+01:00
Commit Message:
HPL1: move ambient shader setup and remove duplicate
Changed paths:
engines/hpl1/engine/graphics/Material_BaseLight.cpp
engines/hpl1/engine/graphics/Material_BaseLight.h
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
index 93299105e2b..3d6ac015bea 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
@@ -48,17 +48,12 @@ namespace hpl {
//-----------------------------------------------------------------------
-class cAmbProgramSetup : public iMaterialProgramSetup {
-public:
- void Setup(iGpuProgram *apProgram, cRenderSettings *apRenderSettings) {
- if (apRenderSettings->mpSector)
- apProgram->SetColor3f("ambientColor", apRenderSettings->mAmbientColor * apRenderSettings->mpSector->GetAmbientColor());
- else
- apProgram->SetColor3f("ambientColor", apRenderSettings->mAmbientColor);
- }
-};
-
-static cAmbProgramSetup gAmbProgramSetup;
+void cAmbProgramSetup::Setup(iGpuProgram *apProgram, cRenderSettings *apRenderSettings) {
+ if (apRenderSettings->mpSector)
+ apProgram->SetColor3f("ambientColor", apRenderSettings->mAmbientColor * apRenderSettings->mpSector->GetAmbientColor());
+ else
+ apProgram->SetColor3f("ambientColor", apRenderSettings->mAmbientColor);
+}
//-----------------------------------------------------------------------
@@ -181,8 +176,9 @@ iGpuProgram *iMaterial_BaseLight::getGpuProgram(const eMaterialRenderType aType,
}
iMaterialProgramSetup *iMaterial_BaseLight::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
+ static cAmbProgramSetup ambProgramSetup;
if (aType == eMaterialRenderType_Z)
- return &gAmbProgramSetup;
+ return &ambProgramSetup;
return nullptr;
}
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.h b/engines/hpl1/engine/graphics/Material_BaseLight.h
index a4e1d9a0ca4..b9d55802fe2 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.h
@@ -44,6 +44,11 @@ enum eBaseLightProgram {
namespace hpl {
+class cAmbProgramSetup : public iMaterialProgramSetup {
+public:
+ void Setup(iGpuProgram *apProgram, cRenderSettings *apRenderSettings);
+};
+
class iMaterial_BaseLight : public iMaterial {
public:
iMaterial_BaseLight(const tString &asLightVertexProgram,
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
index 7e794761b42..13386b4a6a8 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
@@ -130,16 +130,6 @@ iGpuProgram *iMaterial_Fallback01_BaseLight::getGpuProgram(const eMaterialRender
return nullptr;
}
-class cAmbProgramSetup : public iMaterialProgramSetup {
-public:
- void Setup(iGpuProgram *apProgram, cRenderSettings *apRenderSettings) {
- if (apRenderSettings->mpSector)
- apProgram->SetColor3f("ambientColor", apRenderSettings->mAmbientColor * apRenderSettings->mpSector->GetAmbientColor());
- else
- apProgram->SetColor3f("ambientColor", apRenderSettings->mAmbientColor);
- }
-};
-
iMaterialProgramSetup *iMaterial_Fallback01_BaseLight::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
static cAmbProgramSetup ambProgramSetup;
if (aType == eMaterialRenderType_Z)
Commit: e01139bbfcd2c0537605f2118a395f8dc39b806e
https://github.com/scummvm/scummvm/commit/e01139bbfcd2c0537605f2118a395f8dc39b806e
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:51+01:00
Commit Message:
HPL1: enable class used for low graphics setting
Changed paths:
A engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p2.fragment
A engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p3.fragment
A engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.fragment
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
index a48f7a83dfc..20c3d7eb353 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
@@ -26,6 +26,7 @@
*/
#include "hpl1/engine/graphics/Material_Fallback02_BaseLight.h"
+#include "hpl1/engine/graphics/Material_BaseLight.h"
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Renderer2D.h"
#include "hpl1/engine/math/Math.h"
@@ -36,110 +37,12 @@
#include "hpl1/engine/scene/Light3DSpot.h"
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
+#include "common/algorithm.h"
//#include <GL/GLee.h>
namespace hpl {
-//////////////////////////////////////////////////////////////////////////
-// FRAGMENT PROGRAMS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cGLStateTwoUnits_Diffuse::cGLStateTwoUnits_Diffuse()
- : iGLStateProgram("Internal_TwoUnit_Diffuse") {
-}
-
-void cGLStateTwoUnits_Diffuse::Bind() {
- mpLowGfx->SetActiveTextureUnit(0);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Dot3RGBA);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource1, eTextureSource_Constant);
- mpLowGfx->SetTextureConstantColor(cColor(0.5f, 0.5f, 1, 0));
-}
-
-void cGLStateTwoUnits_Diffuse::UnBind() {
- mpLowGfx->SetActiveTextureUnit(0);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Modulate);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource1, eTextureSource_Previous);
-}
-
-//-----------------------------------------------------------------------
-
-cGLStateTwoUnits_ATIDiffuse::cGLStateTwoUnits_ATIDiffuse()
- : iGLStateProgram("Internal_TwoUnit_ATIDiffuse")/*, mlBind(0)*/ {
-}
-
-void cGLStateTwoUnits_ATIDiffuse::InitData() {
-#if 0
- mlBind = glGenFragmentShadersATI(1);
-
- Log("Creating and binding ATI two unit diffuse shader to %d\n",mlBind);
- glBindFragmentShaderATI(mlBind);
-
- glBeginFragmentShaderATI();
-
- glSampleMapATI(GL_REG_0_ATI, GL_TEXTURE0_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_1_ATI, GL_TEXTURE1_ARB, GL_SWIZZLE_STR_ATI);
-
- //Reg0 = NormlizedVec dot3 Vector(0,0,1)
- float vConst[4] = {0,0,1,0};
- glSetFragmentShaderConstantATI( GL_CON_0_ATI,vConst);
- glColorFragmentOp2ATI( GL_DOT3_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_0_ATI, GL_NONE, GL_2X_BIT_ATI|GL_BIAS_BIT_ATI,
- GL_CON_0_ATI, GL_NONE, GL_NONE);
- glAlphaFragmentOp2ATI( GL_DOT3_ATI, GL_REG_0_ATI, GL_NONE,
- GL_REG_0_ATI, GL_NONE, GL_2X_BIT_ATI|GL_BIAS_BIT_ATI,
- GL_CON_0_ATI, GL_NONE, GL_NONE);
-
- //Reg0 = Light * Attenuation
- glAlphaFragmentOp2ATI( GL_MUL_ATI, GL_REG_0_ATI, GL_NONE,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_1_ATI, GL_NONE, GL_NONE);
-
- glEndFragmentShaderATI();
-#endif
-}
-
-cGLStateTwoUnits_ATIDiffuse::~cGLStateTwoUnits_ATIDiffuse() {
-#if 0
- Log("Deleting ATI shader to %d\n",mlBind);
- if (mlBind) glDeleteFragmentShaderATI(mlBind);
-#endif
-}
-
-void cGLStateTwoUnits_ATIDiffuse::Bind() {
-#if 0
- glEnable(GL_FRAGMENT_SHADER_ATI);
- glBindFragmentShaderATI(mlBind);
-#endif
-}
-
-void cGLStateTwoUnits_ATIDiffuse::UnBind() {
-#if 0
- glDisable(GL_FRAGMENT_SHADER_ATI);
-#endif
-}
-
-//-----------------------------------------------------------------------
-
-cGLStateTwoUnits_Spot::cGLStateTwoUnits_Spot()
- : iGLStateProgram("Internal_TwoUnit_Spot") {
-}
-
-void cGLStateTwoUnits_Spot::Bind() {
-}
-
-void cGLStateTwoUnits_Spot::UnBind() {
-}
-
-//-----------------------------------------------------------------------
-static cGLStateTwoUnits_Diffuse gDiffuseGLState;
-static cGLStateTwoUnits_ATIDiffuse gATIDiffuseGLState;
-static cGLStateTwoUnits_Spot gSpotGLState;
-
-//-----------------------------------------------------------------------
-
iMaterial_Fallback02_BaseLight::iMaterial_Fallback02_BaseLight(
const tString &asName, iLowLevelGraphics *apLowLevelGraphics,
cImageManager *apImageManager, cTextureManager *apTextureManager,
@@ -147,65 +50,22 @@ iMaterial_Fallback02_BaseLight::iMaterial_Fallback02_BaseLight(
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
: iMaterial(asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
- error("iMaterial_Fallback02_BaseLight not yet implemented");
-
- gDiffuseGLState.SetUp(mpLowLevelGraphics);
- gSpotGLState.SetUp(mpLowLevelGraphics);
-
- if (mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_ATIFragmentShader)) {
- gATIDiffuseGLState.SetUp(mpLowLevelGraphics);
- }
mbIsTransperant = false;
mbIsGlowing = false;
mbUsesLights = true;
- tString asLightVertexProgram1 = "Fallback02_Diffuse_Light_p1_vp.cg";
- tString asLightVertexProgram2 = "Fallback02_Diffuse_Light_p2_vp.cg";
-
- tString asLightSpotVertexProgram1 = "Fallback02_Diffuse_Light_p1_vp.cg";
- tString asLightSpotVertexProgram2 = "Fallback02_Diffuse_Light_Spot_p2_vp.cg";
- tString asLightSpotVertexProgram3 = "Fallback02_Diffuse_Light_Spot_p3_vp.cg";
-
- for (int i = 0; i < eBaseLightProgram_LastEnum; i++) {
- mvVtxPrograms[i] = NULL;
- mvFragPrograms[i] = NULL;
- }
+ Common::fill(_gpuPrograms, _gpuPrograms + eBaseLightProgram_LastEnum, nullptr);
- ///////////////////////////////////////////
- // Load the light pass vertex program
- // Point
- mvVtxPrograms[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram(asLightVertexProgram1,
- "main", eGpuProgramType_Vertex);
- mvVtxPrograms[eBaseLightProgram_Point2] = mpProgramManager->CreateProgram(asLightVertexProgram2,
- "main", eGpuProgramType_Vertex);
- mvVtxPrograms[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram(asLightSpotVertexProgram1,
- "main", eGpuProgramType_Vertex);
- mvVtxPrograms[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram(asLightSpotVertexProgram2,
- "main", eGpuProgramType_Vertex);
- mvVtxPrograms[eBaseLightProgram_Spot3] = mpProgramManager->CreateProgram(asLightSpotVertexProgram3,
- "main", eGpuProgramType_Vertex);
-
- ///////////////////////////////////////////
- // Load the light pass fragment program
- // Point
-
- if (mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_ATIFragmentShader)) {
- mvFragPrograms[eBaseLightProgram_Point1] = &gATIDiffuseGLState;
- mvFragPrograms[eBaseLightProgram_Spot1] = &gATIDiffuseGLState;
-
- mvFragPrograms[eBaseLightProgram_Spot2] = NULL; // hplNew( cGLStateTwoUnits_Spot, (mpLowLevelGraphics) );
- } else {
- mvFragPrograms[eBaseLightProgram_Point1] = &gDiffuseGLState;
- mvFragPrograms[eBaseLightProgram_Spot1] = &gDiffuseGLState;
-
- mvFragPrograms[eBaseLightProgram_Spot2] = NULL; // hplNew( cGLStateTwoUnits_Spot, (mpLowLevelGraphics) );
- }
+ _gpuPrograms[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_p1", "Fallback02_Diffuse_Light_p1");
+ //the second pass is the same as the second pass of fallback01
+ _gpuPrograms[eBaseLightProgram_Point2] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_p2", "Fallback01_Diffuse_Light_p2");
+ _gpuPrograms[eBaseLightProgram_Spot1] =mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_p1", "Fallback02_Diffuse_Light_p1");
+ _gpuPrograms[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_Spot_p2", "Fallback02_Diffuse_Light_Spot_p2");
+ _gpuPrograms[eBaseLightProgram_Spot3] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_Spot_p3", "Fallback02_Diffuse_Light_Spot_p3");
- ///////////////////////////////////////////
- // Load the Z pass vertex program
- iGpuProgram *pVtxProg = mpProgramManager->CreateProgram("Diffuse_Color_vp.cg", "main", eGpuProgramType_Vertex);
- SetProgram(pVtxProg, eGpuProgramType_Vertex, 1);
+ _diffuseGpuProgram = mpProgramManager->CreateProgram("Diffuse_Color", "Diffuse_Color");
+ _ambientGpuProgram = mpProgramManager->CreateProgram("Diffuse_Color", "Ambient_Color");
mpNormalizationMap = mpTextureManager->CreateCubeMap("Normalization", false);
mpNormalizationMap->SetWrapS(eTextureWrap_ClampToEdge);
@@ -227,10 +87,13 @@ iMaterial_Fallback02_BaseLight::~iMaterial_Fallback02_BaseLight() {
mpTextureManager->Destroy(mpSpotNegativeRejectMap);
for (int i = 0; i < eBaseLightProgram_LastEnum; i++) {
- if (mvVtxPrograms[i])
- mpProgramManager->Destroy(mvVtxPrograms[i]);
- // if(mvFragPrograms[i]) mpProgramManager->Destroy(mvFragPrograms[i]);
+ if (_gpuPrograms[i])
+ mpProgramManager->Destroy(_gpuPrograms[i]);
}
+ if (_diffuseGpuProgram)
+ mpProgramManager->Destroy(_diffuseGpuProgram);
+ if (_ambientGpuProgram)
+ mpProgramManager->Destroy(_ambientGpuProgram);
}
//-----------------------------------------------------------------------
@@ -241,7 +104,7 @@ iMaterial_Fallback02_BaseLight::~iMaterial_Fallback02_BaseLight() {
//-----------------------------------------------------------------------
-iGpuProgram *iMaterial_Fallback02_BaseLight::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+iGpuProgram *iMaterial_Fallback02_BaseLight::getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
eBaseLightProgram program;
if (apLight) {
if (apLight->GetLightType() == eLight3DType_Point)
@@ -250,15 +113,25 @@ iGpuProgram *iMaterial_Fallback02_BaseLight::GetVertexProgram(eMaterialRenderTyp
program = eBaseLightProgram_Spot1;
}
- if (aType == eMaterialRenderType_Light) {
- return mvVtxPrograms[program + alPass];
- }
+ if (aType == eMaterialRenderType_Light)
+ return _gpuPrograms[program + alPass];
if (aType == eMaterialRenderType_Z)
- return mpProgram[eGpuProgramType_Vertex][1];
+ return _ambientGpuProgram;
if (aType == eMaterialRenderType_Diffuse)
- return mpProgram[eGpuProgramType_Vertex][1];
+ return _diffuseGpuProgram;
- return NULL;
+ return nullptr;
+}
+
+iMaterialProgramSetup *iMaterial_Fallback02_BaseLight::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
+ static cAmbProgramSetup ambProgramSetup;
+ if (aType == eMaterialRenderType_Z)
+ return &ambProgramSetup;
+ return nullptr;
+}
+
+iGpuProgram *iMaterial_Fallback02_BaseLight::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+ return nullptr;
}
//------------------------------------------------------------------------------------
@@ -279,17 +152,7 @@ bool iMaterial_Fallback02_BaseLight::VertexProgramUsesEye(eMaterialRenderType aT
//------------------------------------------------------------------------------------
iGpuProgram *iMaterial_Fallback02_BaseLight::GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (aType == eMaterialRenderType_Light) {
- eBaseLightProgram program = eBaseLightProgram_Point1;
-
- if (apLight->GetLightType() == eLight3DType_Point)
- program = eBaseLightProgram_Point1;
- else if (apLight->GetLightType() == eLight3DType_Spot)
- program = eBaseLightProgram_Spot1;
-
- return mvFragPrograms[program + alPass];
- }
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------------------------
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
index 274c9565351..0463e8ad796 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
@@ -52,6 +52,8 @@ public:
bool UsesType(eMaterialRenderType aType);
+ iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+ iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
@@ -85,50 +87,9 @@ protected:
iTexture *mpAttenuationMap;
- iGpuProgram *mvVtxPrograms[eBaseLightProgram_LastEnum];
- iGpuProgram *mvFragPrograms[eBaseLightProgram_LastEnum];
-};
-
-//---------------------------------------------------------------
-
-class cGLStateTwoUnits_Diffuse : public iGLStateProgram {
-public:
- cGLStateTwoUnits_Diffuse();
-
- void Bind();
- void UnBind();
-
-private:
- void InitData() {}
-};
-
-//---------------------------------------------------------------
-
-class cGLStateTwoUnits_ATIDiffuse : public iGLStateProgram {
-public:
- cGLStateTwoUnits_ATIDiffuse();
- ~cGLStateTwoUnits_ATIDiffuse();
-
- void Bind();
- void UnBind();
-
-private:
- void InitData();
-
- //int mlBind;
-};
-
-//---------------------------------------------------------------
-
-class cGLStateTwoUnits_Spot : public iGLStateProgram {
-public:
- cGLStateTwoUnits_Spot();
-
- void Bind();
- void UnBind();
-
-private:
- void InitData() {}
+ iGpuProgram *_gpuPrograms[eBaseLightProgram_LastEnum];
+ iGpuProgram *_diffuseGpuProgram;
+ iGpuProgram *_ambientGpuProgram;
};
//---------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p2.fragment b/engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p2.fragment
new file mode 100644
index 00000000000..9c4f1808f5a
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p2.fragment
@@ -0,0 +1,12 @@
+//Fallback02_Diffuse_Light_Spot_p2.fragment
+
+in vec4 vLightColor;
+in float vRejectUv;
+
+OUTPUT
+
+uniform sampler1D tex0; //spotNegRejectMap
+
+void main() {
+ outColor = texture1D(tex0, vRejectUv).r * vLightColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p3.fragment b/engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p3.fragment
new file mode 100644
index 00000000000..e35c42fe2aa
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p3.fragment
@@ -0,0 +1,17 @@
+//Fallback02_Diffuse_Light_Spot_p3.fragment
+
+in vec4 vLightColor;
+in vec3 vUv;
+in vec4 vSpotlightUv;
+
+OUTPUT
+
+uniform sampler2D tex0; //diffuse
+uniform sampler2D tex1; //spotlight
+
+void main() {
+ vec4 diffuse = texture(tex0, vUv.xy);
+ vec4 spot = texture(tex1, vSpotlightUv.xy / vSpotlightUv.w);
+ outColor = diffuse * spot * vLightColor;
+}
+
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
index 5dbabc78d3d..c09d3ced9d9 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
@@ -14,7 +14,6 @@ vec3 normal = gl_Normal;
vec3 uv = gl_MultiTexCoord0.xyz;
vec4 tangent = gl_MultiTexCoord1;
-
out vec4 vLightColor;
out float vRejectUv;
@@ -30,7 +29,7 @@ void main()
//vUv = uv;
vec4 spotlightUv = (spotViewProj * position);
- vRejectUv.x = spotlightUv.z + 0.5;
+ vRejectUv = spotlightUv.z + 0.5;
vLightColor = clamp(LightColor, vec4(0.0), vec4(1.0));
}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.fragment b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.fragment
new file mode 100644
index 00000000000..3619a5f7f6d
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.fragment
@@ -0,0 +1,16 @@
+//Fallback02_Diffuse_Light_p1.fragment
+
+in vec3 vLightDir;
+in vec3 vLightPos;
+
+OUTPUT
+
+uniform samplerCube tex0;
+uniform sampler3D tex1;
+
+void main() {
+ vec4 normalizedVec = textureCube(tex0, vLightDir);
+ vec4 attenuation = texture3D(tex1, vLightPos);
+ outColor = vec4(2.0*(normalizedVec.b - 0.5));
+ outColor.a *= attenuation.g;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
index 7431d5ceca7..45c8f7a64cb 100644
--- a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
+++ b/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
@@ -13,8 +13,7 @@ vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
vec4 tangent = gl_MultiTexCoord1;
-
-out vec4 vColor
+out vec4 vColor;
out vec3 vLightDir;
out vec3 vLightPos;
Commit: 808f6c68a248f75d7d8ea78d7558c738cbc164b7
https://github.com/scummvm/scummvm/commit/808f6c68a248f75d7d8ea78d7558c738cbc164b7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:51+01:00
Commit Message:
HPL1: cleanup material fallback classes
Changed paths:
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
index 13386b4a6a8..1a85a295c30 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
@@ -136,11 +136,6 @@ iMaterialProgramSetup *iMaterial_Fallback01_BaseLight::getGpuProgramSetup(const
return &ambProgramSetup;
return nullptr;
}
-
-iGpuProgram *iMaterial_Fallback01_BaseLight::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- return nullptr;
-}
-
//------------------------------------------------------------------------------------
bool iMaterial_Fallback01_BaseLight::VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
@@ -160,12 +155,6 @@ bool iMaterial_Fallback01_BaseLight::VertexProgramUsesEye(eMaterialRenderType aT
//------------------------------------------------------------------------------------
-iGpuProgram *iMaterial_Fallback01_BaseLight::GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- return nullptr;
-}
-
-//------------------------------------------------------------------------------------
-
eMaterialAlphaMode iMaterial_Fallback01_BaseLight::GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
if (aType == eMaterialRenderType_Z && mbHasAlpha)
return eMaterialAlphaMode_Trans;
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
index 28ee3ba9ed9..dea2beca6d3 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.h
@@ -31,7 +31,6 @@
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/graphics/Material.h"
#include "hpl1/engine/scene/Light3D.h"
-#include <vector>
#include "hpl1/engine/graphics/Material_BaseLight.h"
@@ -56,12 +55,9 @@ public:
iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
- iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iGpuProgram *GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
-
eMaterialAlphaMode GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialBlendMode GetBlendMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialChannelMode GetChannelMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
index 20c3d7eb353..325b72f7d77 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
@@ -39,8 +39,6 @@
#include "hpl1/engine/system/String.h"
#include "common/algorithm.h"
-//#include <GL/GLee.h>
-
namespace hpl {
iMaterial_Fallback02_BaseLight::iMaterial_Fallback02_BaseLight(
@@ -60,7 +58,7 @@ iMaterial_Fallback02_BaseLight::iMaterial_Fallback02_BaseLight(
_gpuPrograms[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_p1", "Fallback02_Diffuse_Light_p1");
//the second pass is the same as the second pass of fallback01
_gpuPrograms[eBaseLightProgram_Point2] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_p2", "Fallback01_Diffuse_Light_p2");
- _gpuPrograms[eBaseLightProgram_Spot1] =mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_p1", "Fallback02_Diffuse_Light_p1");
+ _gpuPrograms[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_p1", "Fallback02_Diffuse_Light_p1");
_gpuPrograms[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_Spot_p2", "Fallback02_Diffuse_Light_Spot_p2");
_gpuPrograms[eBaseLightProgram_Spot3] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_Spot_p3", "Fallback02_Diffuse_Light_Spot_p3");
@@ -130,10 +128,6 @@ iMaterialProgramSetup *iMaterial_Fallback02_BaseLight::getGpuProgramSetup(const
return nullptr;
}
-iGpuProgram *iMaterial_Fallback02_BaseLight::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- return nullptr;
-}
-
//------------------------------------------------------------------------------------
bool iMaterial_Fallback02_BaseLight::VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
@@ -151,12 +145,6 @@ bool iMaterial_Fallback02_BaseLight::VertexProgramUsesEye(eMaterialRenderType aT
//------------------------------------------------------------------------------------
-iGpuProgram *iMaterial_Fallback02_BaseLight::GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- return nullptr;
-}
-
-//------------------------------------------------------------------------------------
-
eMaterialAlphaMode iMaterial_Fallback02_BaseLight::GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
if (aType == eMaterialRenderType_Z && mbHasAlpha)
return eMaterialAlphaMode_Trans;
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
index 0463e8ad796..7703b67c475 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.h
@@ -30,7 +30,6 @@
#include "hpl1/engine/graphics/Material.h"
#include "hpl1/engine/scene/Light3D.h"
-#include <vector>
#include "hpl1/engine/graphics/Material_BaseLight.h"
@@ -54,12 +53,10 @@ public:
iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
- iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
+
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iGpuProgram *GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
-
eMaterialAlphaMode GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialBlendMode GetBlendMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialChannelMode GetChannelMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
Commit: 00ea41f318d4ea611d8f5d6d5351756b04a394ff
https://github.com/scummvm/scummvm/commit/00ea41f318d4ea611d8f5d6d5351756b04a394ff
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:51+01:00
Commit Message:
HPL1: remove impl files from engine header
Changed paths:
engines/hpl1/engine/engine.h
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index 54f4381bbc4..44fb1f19000 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -123,37 +123,6 @@
#include "hpl1/engine/haptic/HapticSurface.h"
#include "hpl1/engine/haptic/HapticTypes.h"
#include "hpl1/engine/haptic/LowLevelHaptic.h"
-#include "hpl1/engine/impl/CGProgram.h"
-#include "hpl1/engine/impl/CharacterBodyNewton.h"
-#include "hpl1/engine/impl/CollideShapeNewton.h"
-#include "hpl1/engine/impl/KeyboardSDL.h"
-#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
-#include "hpl1/engine/impl/LowLevelInputSDL.h"
-#include "hpl1/engine/impl/LowLevelPhysicsNewton.h"
-#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
-#include "hpl1/engine/impl/MeshLoaderCollada.h"
-#include "hpl1/engine/impl/MeshLoaderMSH.h"
-#include "hpl1/engine/impl/MouseSDL.h"
-#include "hpl1/engine/impl/OcclusionQueryOGL.h"
-#include "hpl1/engine/impl/OpenALSoundChannel.h"
-#include "hpl1/engine/impl/OpenALSoundData.h"
-#include "hpl1/engine/impl/OpenALSoundEnvironment.h"
-#include "hpl1/engine/impl/PBuffer.h"
-#include "hpl1/engine/impl/PhysicsBodyNewton.h"
-#include "hpl1/engine/impl/PhysicsControllerNewton.h"
-#include "hpl1/engine/impl/PhysicsJointBallNewton.h"
-#include "hpl1/engine/impl/PhysicsJointHingeNewton.h"
-#include "hpl1/engine/impl/PhysicsJointNewton.h"
-#include "hpl1/engine/impl/PhysicsJointScrewNewton.h"
-#include "hpl1/engine/impl/PhysicsJointSliderNewton.h"
-#include "hpl1/engine/impl/PhysicsMaterialNewton.h"
-#include "hpl1/engine/impl/PhysicsWorldNewton.h"
-#include "hpl1/engine/impl/SDLTexture.h"
-#include "hpl1/engine/impl/SqScript.h"
-#include "hpl1/engine/impl/VertexBufferOGL.h"
-#include "hpl1/engine/impl/VertexBufferVBO.h"
-#include "hpl1/engine/impl/VideoStreamTheora.h"
-#include "hpl1/engine/impl/temp-types.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/input/Action.h"
#include "hpl1/engine/input/ActionHaptic.h"
Commit: 570c30ade0c8878d929420fb9b45485c07af95b5
https://github.com/scummvm/scummvm/commit/570c30ade0c8878d929420fb9b45485c07af95b5
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:51+01:00
Commit Message:
HPL1: implement limits on playing sound channels
Changed paths:
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
engines/hpl1/engine/impl/OpenALSoundChannel.h
engines/hpl1/engine/impl/OpenALSoundData.cpp
engines/hpl1/engine/impl/OpenALSoundData.h
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
index 28ab156c9a7..1bb01ef56b8 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
@@ -26,15 +26,15 @@
*/
#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
+#include "hpl1/engine/impl/OpenALSoundChannel.h"
#include "hpl1/engine/impl/OpenALSoundData.h"
#include "hpl1/engine/impl/OpenALSoundEnvironment.h"
#include "hpl1/engine/system/String.h"
-
+#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/low_level_system.h"
-#include "common/system.h"
#include "audio/mixer.h"
+#include "common/system.h"
#include "hpl1/debug.h"
namespace hpl {
@@ -45,13 +45,15 @@ namespace hpl {
//-----------------------------------------------------------------------
-cLowLevelSoundOpenAL::cLowLevelSoundOpenAL() {
+cLowLevelSoundOpenAL::cLowLevelSoundOpenAL() :
+ _activeChannels(MAX_ACTIVE_CHANNELS, nullptr) {
mvFormats[0] = "OGG";
mvFormats[1] = "WAV";
mvFormats[2] = "";
mbInitialized = false;
mbEnvAudioEnabled = false;
mbNullEffectAttached = false;
+ _mixer = g_system->getMixer();
}
//-----------------------------------------------------------------------
@@ -69,7 +71,7 @@ cLowLevelSoundOpenAL::~cLowLevelSoundOpenAL() {
iSoundData *cLowLevelSoundOpenAL::LoadSoundData(const tString &asName, const tString &asFilePath,
const tString &asType, bool abStream, bool abLoopStream) {
- cOpenALSoundData *pSoundData = hplNew(cOpenALSoundData, (asName, abStream));
+ cOpenALSoundData *pSoundData = hplNew(cOpenALSoundData, (asName, abStream, this));
pSoundData->SetLoopStream(abLoopStream);
@@ -124,7 +126,7 @@ void cLowLevelSoundOpenAL::SetListenerAttributes(const cVector3f &avPos, const c
//-----------------------------------------------------------------------
void cLowLevelSoundOpenAL::SetListenerPosition(const cVector3f &avPos) {
- mvListenerPosition = avPos;
+ mvListenerPosition = avPos;
}
//-----------------------------------------------------------------------
@@ -153,9 +155,9 @@ void cLowLevelSoundOpenAL::Init(bool abUseHardware, bool abForceGeneric, bool ab
int alMaxMonoSourceHint, int alMaxStereoSourceHint,
int alStreamingBufferSize, int alStreamingBufferCount, bool abEnableLowLevelLog, tString asDeviceName) {
- //Default listener settings.
- mvListenerForward = cVector3f(0,0,1);
- mvListenerUp = cVector3f(0,1,0);
+ // Default listener settings.
+ mvListenerForward = cVector3f(0, 0, 1);
+ mvListenerUp = cVector3f(0, 1, 0);
SetVolume(1.0f);
}
@@ -184,4 +186,40 @@ void cLowLevelSoundOpenAL::FadeSoundEnvironment(iSoundEnvironment *apSourceSound
HPL1_UNIMPLEMENTED(cLowLevelSoundOpenAL::FadeSoundEnvironment);
}
+static cOpenALSoundChannel **findBestSlot(Common::Array<cOpenALSoundChannel *> &slots, int priority) {
+ cOpenALSoundChannel **best = slots.end();
+ for(auto it = slots.begin(); it != slots.end(); ++it) {
+ if (*it == nullptr || !(*it)->IsPlaying())
+ return it;
+ if ((*it)->GetPriority() < priority)
+ best = it;
+ }
+ return best;
+}
+
+bool cLowLevelSoundOpenAL::playChannel(cOpenALSoundChannel *channel) {
+ auto slot = findBestSlot(_activeChannels, channel->GetPriority());
+ if (slot != _activeChannels.end()) {
+ if (*slot != nullptr) {
+ _mixer->stopHandle((*slot)->_handle);
+ (*slot)->mbStopUsed = true;
+ (*slot)->_playing = false;
+ }
+ *slot = channel;
+ _mixer->stopHandle(channel->_handle);
+ channel->_audioStream->rewind();
+ _mixer->playStream(Audio::Mixer::SoundType::kPlainSoundType, &channel->_handle, channel->_audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+ return true;
+ }
+ return false;
+}
+
+void cLowLevelSoundOpenAL::closeChannel(cOpenALSoundChannel *channel) {
+ auto slot = Common::find(_activeChannels.begin(), _activeChannels.end(), channel);
+ if (slot != _activeChannels.end()) {
+ _mixer->stopHandle((*slot)->_handle);
+ *slot = nullptr;
+ }
+}
+
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
index 6fbc298d2b2..87a77ab2256 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.h
@@ -29,11 +29,17 @@
#define HPL_LOWLEVELSOUND_OPENAL_H
#include "hpl1/engine/sound/LowLevelSound.h"
+#include "common/array.h"
-class cOAL_Effect_Reverb;
+namespace Audio {
+class Mixer;
+
+}
namespace hpl {
+class cOpenALSoundChannel;
+
class cLowLevelSoundOpenAL : public iLowLevelSound {
public:
cLowLevelSoundOpenAL();
@@ -54,8 +60,6 @@ public:
void SetListenerAttenuation(bool abEnabled);
- // void LogSoundStatus();
-
void Init(bool abUseHardware, bool abForceGeneric, bool abUseEnvAudio, int alMaxChannels,
int alStreamUpdateFreq, bool abUseThreading, bool abUseVoiceManagement,
int alMaxMonoSourceHint, int alMaxStereoSourceHint,
@@ -70,14 +74,16 @@ public:
void SetSoundEnvironment(iSoundEnvironment *apSoundEnv);
void FadeSoundEnvironment(iSoundEnvironment *apSourceSoundEnv, iSoundEnvironment *apDestSoundEnv, float afT);
+ bool playChannel(cOpenALSoundChannel *channel);
+ void closeChannel(cOpenALSoundChannel *channel);
+
private:
+ static const int MAX_ACTIVE_CHANNELS = 32;
+ Common::Array<cOpenALSoundChannel *> _activeChannels;
+ Audio::Mixer *_mixer;
tString mvFormats[30];
- //bool mbLogSounds;
bool mbInitialized;
- //int mlEffectSlotId;
bool mbNullEffectAttached;
-
- //cOAL_Effect_Reverb *mpEffect;
};
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index 51e49e03aba..f084fcdb4a0 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -28,6 +28,7 @@
#include "hpl1/engine/impl/OpenALSoundChannel.h"
#include "hpl1/engine/impl/OpenALSoundData.h"
#include "hpl1/engine/resources/SoundManager.h"
+#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
#include "audio/mixer.h"
#include "common/system.h"
@@ -44,8 +45,8 @@ namespace hpl {
//-----------------------------------------------------------------------
-cOpenALSoundChannel::cOpenALSoundChannel(cOpenALSoundData *soundData, Audio::SeekableAudioStream *audioStream, cSoundManager *apSoundManger)
- : iSoundChannel(soundData, apSoundManger), _playing(false), _audioStream(audioStream) {
+cOpenALSoundChannel::cOpenALSoundChannel(cOpenALSoundData *soundData, Audio::SeekableAudioStream *audioStream, cSoundManager *apSoundManger, cLowLevelSoundOpenAL *lowLevelSound, int priority)
+ : iSoundChannel(soundData, apSoundManger), _playing(false), _audioStream(audioStream), _lowLevelSound(lowLevelSound), _priority(priority) {
Hpl1::logInfo(Hpl1::kDebugAudio, "creating sound channel form file %s\n", mpData->GetName().c_str());
if (!_audioStream)
Hpl1::logError(Hpl1::kDebugAudio, "sound channel created with null audio stream%s", ".");
@@ -73,7 +74,7 @@ cOpenALSoundChannel::cOpenALSoundChannel(cOpenALSoundData *soundData, Audio::See
//-----------------------------------------------------------------------
cOpenALSoundChannel::~cOpenALSoundChannel() {
- mixer->stopHandle(_handle);
+ _lowLevelSound->closeChannel(this);
if (_audioStream)
delete _audioStream;
if (mpSoundManger)
@@ -89,8 +90,13 @@ cOpenALSoundChannel::~cOpenALSoundChannel() {
//-----------------------------------------------------------------------
void cOpenALSoundChannel::Play() {
+ if (!_audioStream) {
+ Hpl1::logWarning(Hpl1::kDebugAudio, "trying to play an empty audio stream%c", '\n');
+ return;
+ }
Hpl1::logInfo(Hpl1::kDebugAudio, "playing sound channel from data %s\n", mpData->GetName().c_str());
- restart();
+ _lowLevelSound->playChannel(this);
+ SetVolume(mfVolume);
if (mbLooping)
mixer->loopChannel(_handle);
_playing = true;
@@ -111,15 +117,13 @@ void cOpenALSoundChannel::SetPaused(bool pause) {
Hpl1::logInfo(Hpl1::kDebugAudio, "%spausing sound channel from data %s\n", pause ? "" : "un",
mpData->GetName().c_str());
mixer->pauseHandle(_handle, pause);
- if (!_playing && !pause && mbPaused) // corner case of the original implementation
- Play();
mbPaused = pause;
}
//-----------------------------------------------------------------------
void cOpenALSoundChannel::SetSpeed(float afSpeed) {
- mfSpeed = afSpeed;
+ mfSpeed = afSpeed;
#if 0
OAL_Source_SetPitch ( mlChannel, afSpeed );
#endif
@@ -136,9 +140,14 @@ void cOpenALSoundChannel::SetVolume(float volume) {
void cOpenALSoundChannel::SetLooping(bool loop) {
Hpl1::logInfo(Hpl1::kDebugAudio, "%slooping audio from source %s\n", loop ? "" : "un", mpData->GetName().c_str());
+ const bool previousState = mbLooping;
mbLooping = loop;
- if (loop)
+ if (_playing && loop) // it has already started
mixer->loopChannel(_handle);
+ if (previousState && !loop && _playing) { // unlooped while playing
+ _lowLevelSound->closeChannel(this);
+ Play();
+ }
}
//-----------------------------------------------------------------------
@@ -167,7 +176,7 @@ void cOpenALSoundChannel::SetPositionRelative(bool abRelative) {
//-----------------------------------------------------------------------
void cOpenALSoundChannel::SetPosition(const cVector3f &avPos) {
- mvPosition = avPos;
+ mvPosition = avPos;
#if 0
OAL_Source_SetAttributes ( mlChannel, mvPosition.v, mvVelocity.v );
#endif
@@ -196,26 +205,18 @@ void cOpenALSoundChannel::SetMaxDistance(float afMax) {
//-----------------------------------------------------------------------
bool cOpenALSoundChannel::IsPlaying() {
- return _playing;
+ return _playing && (mbLooping || !_audioStream->endOfStream());
}
//-----------------------------------------------------------------------
void cOpenALSoundChannel::SetPriority(int alX) {
-#if 0
- int lPrio = alX+mlPriorityModifier;
- if(lPrio>255)lPrio = 255;
-
- OAL_Source_SetPriority ( mlChannel, lPrio );
-#endif
+ _priority = MAX(alX, 255);
}
//-----------------------------------------------------------------------
int cOpenALSoundChannel::GetPriority() {
-#if 0
- return OAL_Source_GetPriority ( mlChannel );
-#endif
- return 0;
+ return _priority;
}
//-----------------------------------------------------------------------
@@ -251,11 +252,4 @@ void cOpenALSoundChannel::SetFilterGainHF(float afGainHF) {
HPL1_UNIMPLEMENTED(cOpenALSoundChannel::SetFilterGainHF);
}
-void cOpenALSoundChannel::restart() {
- mixer->stopHandle(_handle);
- _audioStream->rewind();
- mixer->playStream(Audio::Mixer::SoundType::kPlainSoundType, &_handle, _audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
- SetVolume(mfVolume);
-}
-
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.h b/engines/hpl1/engine/impl/OpenALSoundChannel.h
index 8d250471b4c..0fe0a85f7ec 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.h
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.h
@@ -40,9 +40,12 @@
namespace hpl {
+class cLowLevelSoundOpenAL;
+
class cOpenALSoundChannel : public iSoundChannel {
+ friend class cLowLevelSoundOpenAL;
public:
- cOpenALSoundChannel(cOpenALSoundData *soundData, Audio::SeekableAudioStream* audioStream, cSoundManager *apSoundManger);
+ cOpenALSoundChannel(cOpenALSoundData *soundData, Audio::SeekableAudioStream* audioStream, cSoundManager *apSoundManger, cLowLevelSoundOpenAL *lowLevelSound, int priority);
~cOpenALSoundChannel();
void Play();
@@ -81,7 +84,9 @@ private:
Audio::SoundHandle _handle;
bool _playing;
- Audio::SeekableAudioStream* _audioStream;
+ Audio::SeekableAudioStream *_audioStream;
+ cLowLevelSoundOpenAL *_lowLevelSound;
+ int _priority;
//int mlDefaultFreq;
//float mfPosition[3];
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.cpp b/engines/hpl1/engine/impl/OpenALSoundData.cpp
index 26f801d3f08..be672e0d17b 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundData.cpp
@@ -39,8 +39,8 @@ namespace hpl {
//-----------------------------------------------------------------------
-cOpenALSoundData::cOpenALSoundData(tString asName, bool abStream)
- : iSoundData(asName, abStream) {
+cOpenALSoundData::cOpenALSoundData(tString asName, bool abStream, cLowLevelSoundOpenAL *lowLevelSound)
+ : iSoundData(asName, abStream), _lowLevelSound(lowLevelSound) {
}
//-----------------------------------------------------------------------
@@ -66,9 +66,9 @@ bool cOpenALSoundData::CreateFromFile(const tString &filename) {
//-----------------------------------------------------------------------
-iSoundChannel *cOpenALSoundData::CreateChannel(int alPriority) {
+iSoundChannel *cOpenALSoundData::CreateChannel(int priority) {
IncUserCount();
- return hplNew(cOpenALSoundChannel, (this, Audio::SeekableAudioStream::openStreamFile(_filename.substr(0, _filename.size() - 4)), mpSoundManger));
+ return hplNew(cOpenALSoundChannel, (this, Audio::SeekableAudioStream::openStreamFile(_filename.substr(0, _filename.size() - 4)), mpSoundManger, _lowLevelSound, priority));
}
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.h b/engines/hpl1/engine/impl/OpenALSoundData.h
index 423f8ad6f38..36ce95e26c6 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.h
+++ b/engines/hpl1/engine/impl/OpenALSoundData.h
@@ -34,9 +34,11 @@
#include "common/str.h"
namespace hpl {
+class cLowLevelSoundOpenAL;
+
class cOpenALSoundData : public iSoundData {
public:
- cOpenALSoundData(tString asName, bool abStream);
+ cOpenALSoundData(tString asName, bool abStream, cLowLevelSoundOpenAL* lowLevelSound);
~cOpenALSoundData();
bool CreateFromFile(const tString &asFile);
@@ -47,6 +49,7 @@ public:
private:
Common::String _filename;
+ cLowLevelSoundOpenAL *_lowLevelSound;
};
} // namespace hpl
Commit: 584f1aaf4e70204a2bf65d7c43677e770fe76f93
https://github.com/scummvm/scummvm/commit/584f1aaf4e70204a2bf65d7c43677e770fe76f93
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:51+01:00
Commit Message:
HPL1: unify checks for shaders
Changed paths:
engines/hpl1/engine/graphics/LowLevelGraphics.h
engines/hpl1/engine/graphics/Material_Bump.cpp
engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
engines/hpl1/engine/graphics/Material_BumpSpec.cpp
engines/hpl1/engine/graphics/Material_Diffuse.cpp
engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/resources/GpuProgramManager.cpp
engines/hpl1/penumbra-overture/Init.cpp
diff --git a/engines/hpl1/engine/graphics/LowLevelGraphics.h b/engines/hpl1/engine/graphics/LowLevelGraphics.h
index bfb0884d1c0..0929acc19e3 100644
--- a/engines/hpl1/engine/graphics/LowLevelGraphics.h
+++ b/engines/hpl1/engine/graphics/LowLevelGraphics.h
@@ -174,8 +174,7 @@ enum eGraphicCaps {
eGraphicCaps_Multisampling,
- eGraphicCaps_GL_VertexProgram,
- eGraphicCaps_GL_FragmentProgram,
+ eGraphicCaps_GL_GpuPrograms,
eGraphicCaps_GL_NVRegisterCombiners,
eGraphicCaps_GL_NVRegisterCombiners_MaxStages,
eGraphicCaps_GL_ATIFragmentShader,
diff --git a/engines/hpl1/engine/graphics/Material_Bump.cpp b/engines/hpl1/engine/graphics/Material_Bump.cpp
index f55aa251f69..62afee474a8 100644
--- a/engines/hpl1/engine/graphics/Material_Bump.cpp
+++ b/engines/hpl1/engine/graphics/Material_Bump.cpp
@@ -69,8 +69,13 @@ iMaterial *cMaterialType_Bump::Create(const tString &asName, iLowLevelGraphics *
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D) {
- if (apLowLevelGraphics->GetCaps(eGraphicCaps_GL_FragmentProgram) &&
- iMaterial::GetQuality() >= eMaterialQuality_High) {
+
+ if (!apLowLevelGraphics->GetCaps(eGraphicCaps_GL_GpuPrograms) || iMaterial::GetQuality() == eMaterialQuality_VeryLow) {
+ return hplNew(cMaterial_Flat, (asName, apLowLevelGraphics,
+ apImageManager, apTextureManager, apRenderer,
+ apProgramManager, aPicture, apRenderer3D));
+ }
+ if (iMaterial::GetQuality() >= eMaterialQuality_High) {
return hplNew(cMaterial_Bump, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
@@ -79,8 +84,7 @@ iMaterial *cMaterialType_Bump::Create(const tString &asName, iLowLevelGraphics *
return hplNew(cMaterial_Fallback01_Bump, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
- } else if (apLowLevelGraphics->GetCaps(eGraphicCaps_GL_VertexProgram) &&
- iMaterial::GetQuality() >= eMaterialQuality_Low) {
+ } else if (iMaterial::GetQuality() >= eMaterialQuality_Low) {
return hplNew(cMaterial_Fallback02_Diffuse, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
diff --git a/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp b/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
index 748611ddf30..f2f8b955e20 100644
--- a/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
@@ -71,8 +71,13 @@ iMaterial *cMaterialType_BumpColorSpec::Create(const tString &asName, iLowLevelG
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D) {
- if (apLowLevelGraphics->GetCaps(eGraphicCaps_GL_FragmentProgram) &&
- iMaterial::GetQuality() >= eMaterialQuality_High) {
+
+ if (!apLowLevelGraphics->GetCaps(eGraphicCaps_GL_GpuPrograms) || iMaterial::GetQuality() == eMaterialQuality_VeryLow) {
+ return hplNew(cMaterial_Flat, (asName, apLowLevelGraphics,
+ apImageManager, apTextureManager, apRenderer,
+ apProgramManager, aPicture, apRenderer3D));
+ }
+ if (iMaterial::GetQuality() >= eMaterialQuality_High) {
if (apLowLevelGraphics->GetCaps(eGraphicCaps_MaxTextureImageUnits) >= 7) {
return hplNew(cMaterial_BumpColorSpec, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
@@ -87,8 +92,7 @@ iMaterial *cMaterialType_BumpColorSpec::Create(const tString &asName, iLowLevelG
return hplNew(cMaterial_Fallback01_Bump, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
- } else if (apLowLevelGraphics->GetCaps(eGraphicCaps_GL_VertexProgram) &&
- iMaterial::GetQuality() >= eMaterialQuality_Low) {
+ } else if (iMaterial::GetQuality() >= eMaterialQuality_Low) {
return hplNew(cMaterial_Fallback02_Diffuse, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec.cpp b/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
index 7ab5ef41ffc..b0a9fa5d8e6 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
@@ -69,8 +69,13 @@ iMaterial *cMaterialType_BumpSpec::Create(const tString &asName, iLowLevelGraphi
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D) {
- if (apLowLevelGraphics->GetCaps(eGraphicCaps_GL_FragmentProgram) &&
- iMaterial::GetQuality() >= eMaterialQuality_High) {
+
+ if (!apLowLevelGraphics->GetCaps(eGraphicCaps_GL_GpuPrograms) || iMaterial::GetQuality() == eMaterialQuality_VeryLow) {
+ return hplNew(cMaterial_Flat, (asName, apLowLevelGraphics,
+ apImageManager, apTextureManager, apRenderer,
+ apProgramManager, aPicture, apRenderer3D));
+ }
+ if (iMaterial::GetQuality() >= eMaterialQuality_High) {
return hplNew(cMaterial_BumpSpec, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
@@ -79,8 +84,7 @@ iMaterial *cMaterialType_BumpSpec::Create(const tString &asName, iLowLevelGraphi
return hplNew(cMaterial_Fallback01_Bump, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
- } else if (apLowLevelGraphics->GetCaps(eGraphicCaps_GL_VertexProgram) &&
- iMaterial::GetQuality() >= eMaterialQuality_Low) {
+ } else if (iMaterial::GetQuality() >= eMaterialQuality_Low) {
return hplNew(cMaterial_Fallback02_Diffuse, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse.cpp b/engines/hpl1/engine/graphics/Material_Diffuse.cpp
index 5b86e21011c..f73b7deb2a1 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse.cpp
+++ b/engines/hpl1/engine/graphics/Material_Diffuse.cpp
@@ -72,8 +72,13 @@ iMaterial *cMaterialType_Diffuse::Create(const tString &asName, iLowLevelGraphic
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D) {
- if (apLowLevelGraphics->GetCaps(eGraphicCaps_GL_FragmentProgram) &&
- iMaterial::GetQuality() >= eMaterialQuality_High) {
+
+ if (!apLowLevelGraphics->GetCaps(eGraphicCaps_GL_GpuPrograms) || iMaterial::GetQuality() == eMaterialQuality_VeryLow) {
+ return hplNew(cMaterial_Flat, (asName, apLowLevelGraphics,
+ apImageManager, apTextureManager, apRenderer,
+ apProgramManager, aPicture, apRenderer3D));
+ }
+ if (iMaterial::GetQuality() >= eMaterialQuality_High) {
return hplNew(cMaterial_Diffuse, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
@@ -82,8 +87,7 @@ iMaterial *cMaterialType_Diffuse::Create(const tString &asName, iLowLevelGraphic
return hplNew(cMaterial_Fallback01_Diffuse, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
- } else if (apLowLevelGraphics->GetCaps(eGraphicCaps_GL_VertexProgram) &&
- iMaterial::GetQuality() >= eMaterialQuality_Low) {
+ } else if (iMaterial::GetQuality() >= eMaterialQuality_Low) {
return hplNew(cMaterial_Fallback02_Diffuse, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp b/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
index 726e0eac9a1..8ade50b2280 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
@@ -68,8 +68,13 @@ iMaterial *cMaterialType_DiffuseSpec::Create(const tString &asName, iLowLevelGra
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D) {
- if (apLowLevelGraphics->GetCaps(eGraphicCaps_GL_FragmentProgram) &&
- iMaterial::GetQuality() >= eMaterialQuality_High) {
+
+ if (!apLowLevelGraphics->GetCaps(eGraphicCaps_GL_GpuPrograms) || iMaterial::GetQuality() == eMaterialQuality_VeryLow) {
+ return hplNew(cMaterial_Flat, (asName, apLowLevelGraphics,
+ apImageManager, apTextureManager, apRenderer,
+ apProgramManager, aPicture, apRenderer3D));
+ }
+ if (iMaterial::GetQuality() >= eMaterialQuality_High) {
return hplNew(cMaterial_DiffuseSpec, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
@@ -78,8 +83,7 @@ iMaterial *cMaterialType_DiffuseSpec::Create(const tString &asName, iLowLevelGra
return hplNew(cMaterial_Fallback01_Diffuse, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
- } else if (apLowLevelGraphics->GetCaps(eGraphicCaps_GL_VertexProgram) &&
- iMaterial::GetQuality() >= eMaterialQuality_Low) {
+ } else if (iMaterial::GetQuality() >= eMaterialQuality_Low) {
return hplNew(cMaterial_Fallback02_Diffuse, (asName, apLowLevelGraphics,
apImageManager, apTextureManager, apRenderer,
apProgramManager, aPicture, apRenderer3D));
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index f24982f6c0a..c721e17cded 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -249,12 +249,8 @@ int cLowLevelGraphicsSDL::GetCaps(eGraphicCaps type) const {
case eGraphicCaps_Multisampling:
return 1; // gl 1.3
- // GL Vertex program
- case eGraphicCaps_GL_VertexProgram:
- return 0; // gl 2.0
-
// GL Fragment program
- case eGraphicCaps_GL_FragmentProgram:
+ case eGraphicCaps_GL_GpuPrograms:
return 0; // gl 2.0
case eGraphicCaps_GL_ATIFragmentShader:
diff --git a/engines/hpl1/engine/resources/GpuProgramManager.cpp b/engines/hpl1/engine/resources/GpuProgramManager.cpp
index 9edfe515240..6115619b6aa 100644
--- a/engines/hpl1/engine/resources/GpuProgramManager.cpp
+++ b/engines/hpl1/engine/resources/GpuProgramManager.cpp
@@ -75,7 +75,7 @@ iResourceBase *cGpuProgramManager::Create(const tString &asName) {
iGpuProgram *cGpuProgramManager::CreateProgram(const tString &vertex, const tString &fragment,
eGpuProgramType aType) {
- if (!mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_FragmentProgram))
+ if (!mpLowLevelGraphics->GetCaps(eGraphicCaps_GL_GpuPrograms))
return nullptr;
tString sPath;
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 537ccb163db..8e6cb72c545 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -111,9 +111,10 @@ void CheckTimeLimit() {
// BEGIN CHECK SUPPORT
bool CheckSupport(cInit *apInit) {
+ return true;
+#if 0
iLowLevelGraphics *pLowLevelGraphics = apInit->mpGame->GetGraphics()->GetLowLevel();
cInit *mpInit = apInit;
- return true;
// Vertex shader support.
if (pLowLevelGraphics->GetCaps(eGraphicCaps_GL_VertexProgram) == 0) {
apInit->msErrorMessage = kTranslate("StartUp", "Error_NoVertexShader") + _W("\n") +
@@ -128,7 +129,7 @@ bool CheckSupport(cInit *apInit) {
kTranslate("StartUp", "ErrorAdd02");
return false;
}
-#if 0
+
Log("Checking Supported Profiles\n");
#define CG_CHECK(p) \
if (cgGLIsProfileSupported(p)) \
Commit: 39a545f740cb1061fa0a2234a382b823302cdca9
https://github.com/scummvm/scummvm/commit/39a545f740cb1061fa0a2234a382b823302cdca9
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:51+01:00
Commit Message:
HPL1: remove ATI fragment shader enum and fix comments
Changed paths:
engines/hpl1/engine/graphics/LowLevelGraphics.h
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
diff --git a/engines/hpl1/engine/graphics/LowLevelGraphics.h b/engines/hpl1/engine/graphics/LowLevelGraphics.h
index 0929acc19e3..6933bbfc624 100644
--- a/engines/hpl1/engine/graphics/LowLevelGraphics.h
+++ b/engines/hpl1/engine/graphics/LowLevelGraphics.h
@@ -177,7 +177,6 @@ enum eGraphicCaps {
eGraphicCaps_GL_GpuPrograms,
eGraphicCaps_GL_NVRegisterCombiners,
eGraphicCaps_GL_NVRegisterCombiners_MaxStages,
- eGraphicCaps_GL_ATIFragmentShader,
eGraphicCaps_GL_BlendFunctionSeparate,
eGraphicCaps_GL_MultiTexture,
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index c721e17cded..08494bc27fe 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -249,14 +249,10 @@ int cLowLevelGraphicsSDL::GetCaps(eGraphicCaps type) const {
case eGraphicCaps_Multisampling:
return 1; // gl 1.3
- // GL Fragment program
+ // GL shaders
case eGraphicCaps_GL_GpuPrograms:
return 0; // gl 2.0
- case eGraphicCaps_GL_ATIFragmentShader:
- return 0;
-
- // GL ATI Fragment Shader
case eGraphicCaps_GL_BlendFunctionSeparate:
return 1; // gl 1.4
Commit: 2521f684104e593779ec9893943e96267fa934fe
https://github.com/scummvm/scummvm/commit/2521f684104e593779ec9893943e96267fa934fe
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:52+01:00
Commit Message:
HPL1: enable shaders by default
Changed paths:
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/penumbra-overture/Init.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 08494bc27fe..850e6a827b0 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -251,7 +251,7 @@ int cLowLevelGraphicsSDL::GetCaps(eGraphicCaps type) const {
// GL shaders
case eGraphicCaps_GL_GpuPrograms:
- return 0; // gl 2.0
+ return 1; // gl 2.0
case eGraphicCaps_GL_BlendFunctionSeparate:
return 1; // gl 1.4
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 8e6cb72c545..58532120ab8 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -353,7 +353,7 @@ bool cInit::Init(tString asCommandLine) {
mlFSAA = mpConfig->GetInt("Graphics", "FSAA", 0);
mbPostEffects = mpConfig->GetBool("Graphics", "PostEffects", true);
- iMaterial::SetQuality((eMaterialQuality)mpConfig->GetInt("Graphics", "ShaderQuality", eMaterialQuality_VeryLow));
+ iMaterial::SetQuality((eMaterialQuality)mpConfig->GetInt("Graphics", "ShaderQuality", eMaterialQuality_High));
mPhysicsAccuracy = (ePhysicsAccuracy)mpConfig->GetInt("Physics", "Accuracy", ePhysicsAccuracy_High);
mfPhysicsUpdatesPerSec = mpConfig->GetFloat("Physics", "UpdatesPerSec", 60.0f);
Commit: f58839ad47d2c8b76f865f4db7bcc39d7a7438aa
https://github.com/scummvm/scummvm/commit/f58839ad47d2c8b76f865f4db7bcc39d7a7438aa
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:52+01:00
Commit Message:
HPL1: remove unneeded opengl error check
Changed paths:
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 850e6a827b0..e105b3d4893 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -409,14 +409,14 @@ iTexture *cLowLevelGraphicsSDL::CreateTexture(const cVector2l &avSize, int alBpp
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::PushMatrix(eMatrix aMtxType) {
- GL_CHECK(SetMatrixMode(aMtxType));
+ SetMatrixMode(aMtxType);
GL_CHECK(glPushMatrix());
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::PopMatrix(eMatrix aMtxType) {
- GL_CHECK(SetMatrixMode(aMtxType));
+ SetMatrixMode(aMtxType);
GL_CHECK(glPopMatrix());
}
//-----------------------------------------------------------------------
@@ -430,14 +430,14 @@ void cLowLevelGraphicsSDL::SetMatrix(eMatrix aMtxType, const cMatrixf &a_mtxA) {
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::SetIdentityMatrix(eMatrix aMtxType) {
- GL_CHECK(SetMatrixMode(aMtxType));
+ SetMatrixMode(aMtxType);
GL_CHECK(glLoadIdentity());
}
//-----------------------------------------------------------------------
void cLowLevelGraphicsSDL::TranslateMatrix(eMatrix aMtxType, const cVector3f &avPos) {
- GL_CHECK(SetMatrixMode(aMtxType));
+ SetMatrixMode(aMtxType);
GL_CHECK(glTranslatef(avPos.x, avPos.y, avPos.z));
}
Commit: e499aa7a4c58652ba794c6c41bb1262d47139979
https://github.com/scummvm/scummvm/commit/e499aa7a4c58652ba794c6c41bb1262d47139979
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:52+01:00
Commit Message:
HPL1: cleanup playChannel implementation
Changed paths:
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
index 1bb01ef56b8..64f49864332 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
@@ -200,11 +200,8 @@ static cOpenALSoundChannel **findBestSlot(Common::Array<cOpenALSoundChannel *> &
bool cLowLevelSoundOpenAL::playChannel(cOpenALSoundChannel *channel) {
auto slot = findBestSlot(_activeChannels, channel->GetPriority());
if (slot != _activeChannels.end()) {
- if (*slot != nullptr) {
- _mixer->stopHandle((*slot)->_handle);
- (*slot)->mbStopUsed = true;
- (*slot)->_playing = false;
- }
+ if (*slot != nullptr)
+ (*slot)->Stop();
*slot = channel;
_mixer->stopHandle(channel->_handle);
channel->_audioStream->rewind();
Commit: 4851b7d6bd8acce961fd7532c5074fe43eda160b
https://github.com/scummvm/scummvm/commit/4851b7d6bd8acce961fd7532c5074fe43eda160b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:52+01:00
Commit Message:
HPL1: remove useless check
this was the result of an incorrect interpretation of the original code
Changed paths:
engines/hpl1/engine/impl/OpenALSoundData.cpp
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.cpp b/engines/hpl1/engine/impl/OpenALSoundData.cpp
index be672e0d17b..2234570f8be 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundData.cpp
@@ -57,8 +57,6 @@ cOpenALSoundData::~cOpenALSoundData() {
//-----------------------------------------------------------------------
bool cOpenALSoundData::CreateFromFile(const tString &filename) {
- if (_filename != "")
- error("trying to load a sample"); // FIXME: remove this if its not needed
// FIXME: string types
_filename = filename.c_str();
return true;
Commit: e647ce5f40c83d6a52d47302d910d8fd7a7eca7b
https://github.com/scummvm/scummvm/commit/e647ce5f40c83d6a52d47302d910d8fd7a7eca7b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:52+01:00
Commit Message:
HPL1: cleanup and improve logging in LowLevelSound
Changed paths:
engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
index 64f49864332..fcd09d4f57b 100644
--- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp
@@ -200,8 +200,13 @@ static cOpenALSoundChannel **findBestSlot(Common::Array<cOpenALSoundChannel *> &
bool cLowLevelSoundOpenAL::playChannel(cOpenALSoundChannel *channel) {
auto slot = findBestSlot(_activeChannels, channel->GetPriority());
if (slot != _activeChannels.end()) {
- if (*slot != nullptr)
+ if (*slot != nullptr) {
+ if ((*slot)->IsPlaying()) {
+ Hpl1::logInfo(Hpl1::kDebugAudio, "evicting sound from data %s from mixer slot\n",
+ (*slot)->mpData->GetName().c_str());
+ }
(*slot)->Stop();
+ }
*slot = channel;
_mixer->stopHandle(channel->_handle);
channel->_audioStream->rewind();
@@ -214,7 +219,7 @@ bool cLowLevelSoundOpenAL::playChannel(cOpenALSoundChannel *channel) {
void cLowLevelSoundOpenAL::closeChannel(cOpenALSoundChannel *channel) {
auto slot = Common::find(_activeChannels.begin(), _activeChannels.end(), channel);
if (slot != _activeChannels.end()) {
- _mixer->stopHandle((*slot)->_handle);
+ (*slot)->Stop();
*slot = nullptr;
}
}
Commit: c2c1726d418f3b8eae6b3b9335b075ba910add31
https://github.com/scummvm/scummvm/commit/c2c1726d418f3b8eae6b3b9335b075ba910add31
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:52+01:00
Commit Message:
HPL1: improve logging in sound channel class
Changed paths:
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index f084fcdb4a0..419790741b0 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -95,7 +95,10 @@ void cOpenALSoundChannel::Play() {
return;
}
Hpl1::logInfo(Hpl1::kDebugAudio, "playing sound channel from data %s\n", mpData->GetName().c_str());
- _lowLevelSound->playChannel(this);
+ if (!_lowLevelSound->playChannel(this)) {
+ Hpl1::logWarning(Hpl1::kDebugAudio, "sound channel from data %s could not be played\n",
+ mpData->GetName().c_str());
+ }
SetVolume(mfVolume);
if (mbLooping)
mixer->loopChannel(_handle);
@@ -106,6 +109,7 @@ void cOpenALSoundChannel::Play() {
//-----------------------------------------------------------------------
void cOpenALSoundChannel::Stop() {
+ Hpl1::logInfo(Hpl1::kDebugAudio, "stopping audio channel from data %s\n", mpData->GetName().c_str());
mixer->stopHandle(_handle);
mbStopUsed = true;
_playing = false;
Commit: 87656fbe557dc2c9485fdefb42c1c84f0974d13b
https://github.com/scummvm/scummvm/commit/87656fbe557dc2c9485fdefb42c1c84f0974d13b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:52+01:00
Commit Message:
HPL1: fix bugs in sound channel class
Changed paths:
engines/hpl1/engine/impl/OpenALSoundChannel.cpp
engines/hpl1/engine/impl/OpenALSoundChannel.h
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
index 419790741b0..10fc7d9a045 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.cpp
@@ -46,7 +46,7 @@ namespace hpl {
//-----------------------------------------------------------------------
cOpenALSoundChannel::cOpenALSoundChannel(cOpenALSoundData *soundData, Audio::SeekableAudioStream *audioStream, cSoundManager *apSoundManger, cLowLevelSoundOpenAL *lowLevelSound, int priority)
- : iSoundChannel(soundData, apSoundManger), _playing(false), _audioStream(audioStream), _lowLevelSound(lowLevelSound), _priority(priority) {
+ : iSoundChannel(soundData, apSoundManger), _audioStream(audioStream), _lowLevelSound(lowLevelSound), _priority(priority) {
Hpl1::logInfo(Hpl1::kDebugAudio, "creating sound channel form file %s\n", mpData->GetName().c_str());
if (!_audioStream)
Hpl1::logError(Hpl1::kDebugAudio, "sound channel created with null audio stream%s", ".");
@@ -102,8 +102,8 @@ void cOpenALSoundChannel::Play() {
SetVolume(mfVolume);
if (mbLooping)
mixer->loopChannel(_handle);
- _playing = true;
mbStopUsed = false;
+ mbPaused = false;
}
//-----------------------------------------------------------------------
@@ -112,7 +112,7 @@ void cOpenALSoundChannel::Stop() {
Hpl1::logInfo(Hpl1::kDebugAudio, "stopping audio channel from data %s\n", mpData->GetName().c_str());
mixer->stopHandle(_handle);
mbStopUsed = true;
- _playing = false;
+ mbLooping = false;
}
//-----------------------------------------------------------------------
@@ -146,9 +146,9 @@ void cOpenALSoundChannel::SetLooping(bool loop) {
Hpl1::logInfo(Hpl1::kDebugAudio, "%slooping audio from source %s\n", loop ? "" : "un", mpData->GetName().c_str());
const bool previousState = mbLooping;
mbLooping = loop;
- if (_playing && loop) // it has already started
+ if (IsPlaying() && loop) // it has already started
mixer->loopChannel(_handle);
- if (previousState && !loop && _playing) { // unlooped while playing
+ else if (previousState && !loop && IsPlaying()) { // unlooped while playing
_lowLevelSound->closeChannel(this);
Play();
}
@@ -209,7 +209,7 @@ void cOpenALSoundChannel::SetMaxDistance(float afMax) {
//-----------------------------------------------------------------------
bool cOpenALSoundChannel::IsPlaying() {
- return _playing && (mbLooping || !_audioStream->endOfStream());
+ return mixer->isSoundHandleActive(_handle);
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/OpenALSoundChannel.h b/engines/hpl1/engine/impl/OpenALSoundChannel.h
index 0fe0a85f7ec..a38e8ea2194 100644
--- a/engines/hpl1/engine/impl/OpenALSoundChannel.h
+++ b/engines/hpl1/engine/impl/OpenALSoundChannel.h
@@ -83,7 +83,6 @@ private:
void restart();
Audio::SoundHandle _handle;
- bool _playing;
Audio::SeekableAudioStream *_audioStream;
cLowLevelSoundOpenAL *_lowLevelSound;
int _priority;
Commit: ee8f35ba22f770cb2aa97b1f1096e40b51006a85
https://github.com/scummvm/scummvm/commit/ee8f35ba22f770cb2aa97b1f1096e40b51006a85
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:52+01:00
Commit Message:
HPL1: disable loading files from the cache folder
Changed paths:
engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
index 5e14ff2aad0..0458c56e578 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
@@ -66,6 +66,7 @@ bool cMeshLoaderCollada::FillStructures(const tString &asFile,
tColladaControllerVec *apColladaControllerVec,
tColladaAnimationVec *apColladaAnimVec,
cColladaScene *apColladaScene, bool abCache) {
+ abCache = false; // FIXME: find a way to enable the use of cache files
bool bLoadCache = false;
// abCache = false;
// Log("Loading %s\n",asFile.c_str());
@@ -96,10 +97,10 @@ bool cMeshLoaderCollada::FillStructures(const tString &asFile,
apColladaControllerVec,
apColladaAnimVec,
apColladaScene);
+ } else if (abCache) {
+ Log("Cache out of date! Reloading collada file '%s'\n and generating cache files", asFile.c_str());
}
- Log("Cache out of date! Reloading collada file '%s'\n", asFile.c_str());
-
/////////////////////////////////////////////////
// LOAD THE DOCUMENT
// unsigned long lStartTime = mpSystem->GetLowLevel()->GetTime();
Commit: 2bf971bef986069c3fa59802e701b5f5303f3503
https://github.com/scummvm/scummvm/commit/2bf971bef986069c3fa59802e701b5f5303f3503
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:52+01:00
Commit Message:
HPL1: add debug channel for game saves
Changed paths:
engines/hpl1/debug.h
engines/hpl1/detection.cpp
diff --git a/engines/hpl1/debug.h b/engines/hpl1/debug.h
index 07718a69d84..1819dd744e6 100644
--- a/engines/hpl1/debug.h
+++ b/engines/hpl1/debug.h
@@ -34,7 +34,8 @@ enum DebugChannels {
kDebugFilePath = 1 << 2,
kDebugOpenGL = 1 << 3,
kDebugRenderer = 1 << 4,
- kDebugAudio = 1 << 5
+ kDebugAudio = 1 << 5,
+ kDebugSaves = 1 << 6
};
enum DebugLevels {
diff --git a/engines/hpl1/detection.cpp b/engines/hpl1/detection.cpp
index cacab2fff0e..1041596909b 100644
--- a/engines/hpl1/detection.cpp
+++ b/engines/hpl1/detection.cpp
@@ -37,6 +37,7 @@ const DebugChannelDef Hpl1MetaEngineDetection::debugFlagList[] = {
{ Hpl1::kDebugOpenGL, "OpenGL", "OpenGL debug channel"},
{ Hpl1::kDebugRenderer, "Renderer", "Rederer debug channel"},
{ Hpl1::kDebugAudio, "Audio", "Audio debug channel"},
+ { Hpl1::kDebugSaves, "Saves", "Channel for debugging game saving and loading"},
DEBUG_CHANNEL_END
};
Commit: a41b8d026c1391446a7beb3f81250341f434138e
https://github.com/scummvm/scummvm/commit/a41b8d026c1391446a7beb3f81250341f434138e
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:53+01:00
Commit Message:
HPL1: replace files with generic streams in tinyxml
Changed paths:
engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
engines/hpl1/engine/impl/tinyXML/tinyxml.h
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp b/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
index 52e4a875b74..5af3ffbe926 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
@@ -580,7 +580,7 @@ void TiXmlElement::SetAttribute(const std::string &name, const std::string &_val
}
#endif
-void TiXmlElement::Print(Common::DumpFile &file, int depth) const {
+void TiXmlElement::Print(Common::WriteStream &file, int depth) const {
int i;
for (i = 0; i < depth; i++) {
file.writeString(" ");
@@ -731,22 +731,22 @@ bool TiXmlDocument::LoadFile(const char *filename, TiXmlEncoding encoding) {
value = filename;
// reading in binary mode so that tinyxml can normalize the EOL
- Common::File file;
- file.open(value);
-
+ Common::File file;
+ file.open(value);
+
if (file.isOpen()) {
bool result = LoadFile(file, encoding);
return result;
} else {
- debugC(Hpl1::kDebugFilePath, "file %s not found", value.c_str());
+ debugC(Hpl1::kDebugFilePath, "file %s not found", value.c_str());
SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN);
return false;
}
}
-bool TiXmlDocument::LoadFile(Common::File &file, TiXmlEncoding encoding) {
+bool TiXmlDocument::LoadFile(Common::SeekableReadStream &file, TiXmlEncoding encoding) {
if (file.err()) {
- debugC(Hpl1::kDebugResourceLoading, "file %s could not be read", file.getName());
+ Hpl1::logError(Hpl1::kDebugResourceLoading, "xml file could not be read%c", '\n');
SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN);
return false;
}
@@ -792,9 +792,9 @@ bool TiXmlDocument::LoadFile(Common::File &file, TiXmlEncoding encoding) {
char *buf = new char[length + 1];
buf[0] = 0;
- file.read(buf, length);
+ file.read(buf, length);
if (file.err()) {
- debugC(Hpl1::kDebugResourceLoading, "file read for %s failed", file.getName());
+ Hpl1::logError(Hpl1::kDebugResourceLoading, "xml file read for failed%c", '\n');
delete[] buf;
SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN);
return false;
@@ -863,7 +863,7 @@ bool TiXmlDocument::SaveFile(const char *filename) const {
return false;
}
-bool TiXmlDocument::SaveFile(Common::DumpFile &fp) const {
+bool TiXmlDocument::SaveFile(Common::WriteStream &fp) const {
if (useMicrosoftBOM) {
const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
@@ -897,7 +897,7 @@ TiXmlNode *TiXmlDocument::Clone() const {
return clone;
}
-void TiXmlDocument::Print(Common::DumpFile &cfile, int depth) const {
+void TiXmlDocument::Print(Common::WriteStream &cfile, int depth) const {
for (const TiXmlNode *node = FirstChild(); node; node = node->NextSibling()) {
node->Print(cfile, depth);
cfile.writeString("\n");
@@ -952,7 +952,7 @@ TiXmlAttribute* TiXmlAttribute::Previous()
}
*/
-void TiXmlAttribute::Print(Common::DumpFile *cfile, int /*depth*/, TIXML_STRING *str) const {
+void TiXmlAttribute::Print(Common::WriteStream *cfile, int /*depth*/, TIXML_STRING *str) const {
TIXML_STRING n, v;
PutString(name, &n);
@@ -1020,7 +1020,7 @@ void TiXmlComment::operator=(const TiXmlComment &base) {
base.CopyTo(this);
}
-void TiXmlComment::Print(Common::DumpFile &cfile, int depth) const {
+void TiXmlComment::Print(Common::WriteStream &cfile, int depth) const {
for (int i = 0; i < depth; i++) {
cfile.writeString(" ");
}
@@ -1045,7 +1045,7 @@ TiXmlNode *TiXmlComment::Clone() const {
return clone;
}
-void TiXmlText::Print(Common::DumpFile &cfile, int depth) const {
+void TiXmlText::Print(Common::WriteStream &cfile, int depth) const {
if (cdata) {
int i;
cfile.writeString("\n");
@@ -1110,7 +1110,7 @@ void TiXmlDeclaration::operator=(const TiXmlDeclaration ©) {
copy.CopyTo(this);
}
-void TiXmlDeclaration::Print(Common::DumpFile *cfile, int /*depth*/, TIXML_STRING *str) const {
+void TiXmlDeclaration::Print(Common::WriteStream *cfile, int /*depth*/, TIXML_STRING *str) const {
if (cfile)
cfile->writeString("<?xml ");
if (str)
@@ -1171,7 +1171,7 @@ TiXmlNode *TiXmlDeclaration::Clone() const {
return clone;
}
-void TiXmlUnknown::Print(Common::DumpFile &cfile, int depth) const {
+void TiXmlUnknown::Print(Common::WriteStream &cfile, int depth) const {
for (int i = 0; i < depth; i++)
cfile.writeString(" ");
cfile.writeString("<" + value + ">");
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxml.h b/engines/hpl1/engine/impl/tinyXML/tinyxml.h
index f6fcfcde324..95bdb481746 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxml.h
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxml.h
@@ -165,7 +165,7 @@ public:
(For an unformatted stream, use the << operator.)
*/
- virtual void Print(Common::DumpFile &file, int depth) const = 0;
+ virtual void Print(Common::WriteStream &file, int depth) const = 0;
/** The world does not agree on whether white space should be kept or
not. In order to make everyone happy, these global, static functions
@@ -792,10 +792,10 @@ public:
virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
// Prints this Attribute to a FILE stream.
- virtual void Print(Common::DumpFile &file, int depth) const {
+ virtual void Print(Common::WriteStream &file, int depth) const {
Print(&file, depth, 0);
}
- void Print(Common::DumpFile *cfile, int depth, TIXML_STRING *str) const;
+ void Print(Common::WriteStream *cfile, int depth, TIXML_STRING *str) const;
// [internal use]
// Set the document pointer so the attribute can report errors.
@@ -1016,7 +1016,7 @@ public:
/// Creates a new Element and returns it - the returned element is a copy.
virtual TiXmlNode *Clone() const;
// Print the Element to a FILE stream.
- virtual void Print(Common::DumpFile &cfile, int depth) const;
+ virtual void Print(Common::WriteStream &cfile, int depth) const;
/* Attribtue parsing starts: next char past '<'
returns: next char past '>'
@@ -1066,7 +1066,7 @@ public:
/// Returns a copy of this Comment.
virtual TiXmlNode *Clone() const;
// Write this Comment to a FILE stream.
- virtual void Print(Common::DumpFile &cfile, int depth) const;
+ virtual void Print(Common::WriteStream &cfile, int depth) const;
/* Attribtue parsing starts: at the ! of the !--
returns: next char past '>'
@@ -1123,7 +1123,7 @@ public:
void operator=(const TiXmlText &base) { base.CopyTo(this); }
// Write this text object to a FILE stream.
- virtual void Print(Common::DumpFile &cfile, int depth) const;
+ virtual void Print(Common::WriteStream &cfile, int depth) const;
/// Queries whether this represents text using a CDATA section.
bool CDATA() const { return cdata; }
@@ -1199,8 +1199,8 @@ public:
/// Creates a copy of this Declaration and returns it.
virtual TiXmlNode *Clone() const;
// Print this declaration to a FILE stream.
- virtual void Print(Common::DumpFile *cfile, int depth, TIXML_STRING *str) const;
- virtual void Print(Common::DumpFile &cfile, int depth) const {
+ virtual void Print(Common::WriteStream *cfile, int depth, TIXML_STRING *str) const;
+ virtual void Print(Common::WriteStream &cfile, int depth) const {
Print(&cfile, depth, 0);
}
@@ -1244,7 +1244,7 @@ public:
/// Creates a copy of this Unknown and returns it.
virtual TiXmlNode *Clone() const;
// Print this Unknown to a FILE stream.
- virtual void Print(Common::DumpFile &cfile, int depth) const;
+ virtual void Print(Common::WriteStream &cfile, int depth) const;
virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
@@ -1302,9 +1302,9 @@ public:
will be interpreted as an XML file. TinyXML doesn't stream in XML from the current
file location. Streaming may be added in the future.
*/
- bool LoadFile(Common::File &file, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
+ bool LoadFile(Common::SeekableReadStream &file, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
/// Save a file using the given FILE*. Returns true if successful.
- bool SaveFile(Common::DumpFile &) const;
+ bool SaveFile(Common::WriteStream &) const;
#ifdef TIXML_USE_STL
bool LoadFile(const std::string &filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING) ///< STL std::string version.
@@ -1408,7 +1408,7 @@ public:
// char* PrintToMemory() const;
/// Print this Document to file
- virtual void Print(Common::DumpFile &file, int depth = 0) const;
+ virtual void Print(Common::WriteStream &file, int depth = 0) const;
// [internal use]
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding);
Commit: b29fa18e846cd00ff4c7b8958e3226b8ccb0bbd0
https://github.com/scummvm/scummvm/commit/b29fa18e846cd00ff4c7b8958e3226b8ccb0bbd0
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:53+01:00
Commit Message:
HPL1: replace stoi input type
Changed paths:
engines/hpl1/string.cpp
engines/hpl1/string.h
diff --git a/engines/hpl1/string.cpp b/engines/hpl1/string.cpp
index 75250269169..d701a3349be 100644
--- a/engines/hpl1/string.cpp
+++ b/engines/hpl1/string.cpp
@@ -24,10 +24,10 @@
namespace Hpl1 {
-int stoi(const char *str, int emptyResult) {
- if (str == nullptr)
- return emptyResult;
- return atoi(str);
+int stoi(const Common::String &str, int resultWhenEmpty) {
+ if (str == "")
+ return resultWhenEmpty;
+ return atoi(str.c_str());
}
Common::String fileDir(const Common::String &path) {
diff --git a/engines/hpl1/string.h b/engines/hpl1/string.h
index 4ad65ac932b..bec856749fc 100644
--- a/engines/hpl1/string.h
+++ b/engines/hpl1/string.h
@@ -26,7 +26,7 @@
namespace Hpl1 {
-int stoi(const char *str, int emptyResult = 0);
+int stoi(const Common::String &str, int resultWhenEmpty = 0);
Common::String fileDir(const Common::String &path);
Commit: 6893577defc43af36ea8d7e0dc0cebc3594457ed
https://github.com/scummvm/scummvm/commit/6893577defc43af36ea8d7e0dc0cebc3594457ed
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:53+01:00
Commit Message:
HPL1: implement getDate
Changed paths:
engines/hpl1/engine/system/low_level_system.cpp
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index 5268b1096d7..f960b4dac5e 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -366,7 +366,9 @@ unsigned long LowLevelSystem::getTime() {
}
cDate LowLevelSystem::getDate() {
- return {};
+ TimeDate td;
+ g_system->getTimeAndDate(td);
+ return {td.tm_sec, td.tm_min, td.tm_hour, td.tm_mday, td.tm_mon, td.tm_year - 100, td.tm_wday, 0};
}
iScript *LowLevelSystem::createScript(const tString &name) {
Commit: 75c6146843b64c5074031886f3b6cc8415076e1f
https://github.com/scummvm/scummvm/commit/75c6146843b64c5074031886f3b6cc8415076e1f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:53+01:00
Commit Message:
HPL1: implement saves
Changed paths:
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/penumbra-overture/DeathMenu.cpp
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/SaveHandler.cpp
engines/hpl1/penumbra-overture/SaveHandler.h
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index 4c36ebaf08a..ccc0a4062e2 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -36,8 +36,9 @@
#include "hpl1/engine/system/Container.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
-
-#include <stdio.h>
+#include "hpl1/hpl1.h"
+#include "hpl1/debug.h"
+#include "common/savefile.h"
namespace hpl {
@@ -190,37 +191,26 @@ void cSerializeClass::PrintMembers(iSerializable *apData) {
//-----------------------------------------------------------------------
bool cSerializeClass::SaveToFile(iSerializable *apData, const tWString &asFile, const tString &asRoot) {
-#if 0
SetUpData();
glTabs = 0;
-
- TiXmlDocument *pXmlDoc = hplNew(TiXmlDocument, ());
-
+ // FIXME: string types
+ Common::String filename(cString::To8Char(asFile).c_str());
+ TiXmlDocument pXmlDoc;
// Create root
TiXmlElement XmlRoot(asRoot.c_str());
- TiXmlElement *pRootElem = static_cast<TiXmlElement *>(pXmlDoc->InsertEndChild(XmlRoot));
-
+ TiXmlElement *pRootElem = static_cast<TiXmlElement *>(pXmlDoc.InsertEndChild(XmlRoot));
+ Common::ScopedPtr<Common::OutSaveFile> savefile(g_engine->getSaveFileManager()->openForSaving(filename));
+ if (!savefile) {
+ Hpl1::logError(Hpl1::kDebugSaves, "could't open file %s for saving\n", asFile.c_str());
+ return false;
+ }
SaveToElement(apData, "", pRootElem);
-
-// Save
-#ifdef WIN32
- FILE *pFile = _wfopen(asFile.c_str(), _W("w+"));
-#else
- FILE *pFile = fopen(cString::To8Char(asFile).c_str(), "w+");
-#endif
-
- bool bRet = pXmlDoc->SaveFile(pFile);
- if (bRet == false)
- Error("Couldn't save class to '%s'\n", asFile.c_str());
-
- if (pFile)
- fclose(pFile);
-
- hplDelete(pXmlDoc);
- return bRet;
-#endif
- return false;
+ if (!pXmlDoc.SaveFile(*savefile)) {
+ Hpl1::logError(Hpl1::kDebugSaves, "couldn't save to file '%s'\n", asFile.c_str());
+ return false;
+ }
+ return true;
}
//-----------------------------------------------------------------------
@@ -281,43 +271,34 @@ void cSerializeClass::SaveToElement(iSerializable *apData, const tString &asName
//-----------------------------------------------------------------------
bool cSerializeClass::LoadFromFile(iSerializable *apData, const tWString &asFile) {
-#if 0
SetUpData();
glTabs = 0;
// Load document
- TiXmlDocument *pXmlDoc = hplNew(TiXmlDocument, ());
-#ifdef WIN32
- FILE *pFile = _wfopen(asFile.c_str(), _W("rb"));
-#else
- FILE *pFile = fopen(cString::To8Char(asFile).c_str(), "rb");
-#endif
-
- if (pXmlDoc->LoadFile(pFile) == false) {
- Error("Couldn't load saved class file '%s' from %s!\n",
- cString::To8Char(asFile).c_str(),
- pXmlDoc->ErrorDesc());
- if (pFile)
- fclose(pFile);
- hplDelete(pXmlDoc);
+ TiXmlDocument pXmlDoc;
+ // FIXME: string types
+ Common::String filename(cString::To8Char(asFile).c_str());
+ Common::ScopedPtr<Common::InSaveFile> saveFile(g_engine->getSaveFileManager()->openForLoading(filename));
+ if (!saveFile) {
+ Hpl1::logError(Hpl1::kDebugSaves | Hpl1::kDebugResourceLoading, "save file %s could not be opened\n", filename.c_str());
+ return false;
+ }
+ if (pXmlDoc.LoadFile(*saveFile) == false) {
+ Hpl1::logError(Hpl1::kDebugResourceLoading | Hpl1::kDebugSaves,
+ "Couldn't load saved class file '%s' from %s!\n", cString::To8Char(asFile).c_str(),
+ pXmlDoc.ErrorDesc());
return false;
}
- if (pFile)
- fclose(pFile);
// Get root
- TiXmlElement *pRootElem = pXmlDoc->RootElement();
+ TiXmlElement *pRootElem = pXmlDoc.RootElement();
// Get first, there should only be ONE class at the root.
TiXmlElement *pClassElem = pRootElem->FirstChildElement("class");
LoadFromElement(apData, pClassElem);
-
- hplDelete(pXmlDoc);
return true;
-#endif
- return false;
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/DeathMenu.cpp b/engines/hpl1/penumbra-overture/DeathMenu.cpp
index be3384e4568..6f6bf99d361 100644
--- a/engines/hpl1/penumbra-overture/DeathMenu.cpp
+++ b/engines/hpl1/penumbra-overture/DeathMenu.cpp
@@ -104,28 +104,9 @@ void cDeathMenuButton::OnMouseOver(bool abOver) {
//-----------------------------------------------------------------------
void cDeathMenuButton_Continue::OnMouseDown() {
- tWString sAuto = _W("save/auto/") + mpInit->mpSaveHandler->GetLatest(_W("save/auto/"), _W("*.sav"));
- tWString sSpot = _W("save/spot/") + mpInit->mpSaveHandler->GetLatest(_W("save/spot/"), _W("*.sav"));
-
- tWString sFile = _W("");
-
- if (sAuto == _W("save/auto/")) {
- sFile = sSpot;
- } else if (sSpot == _W("save/spot/")) {
- sFile = sAuto;
- } else {
- tWString sSaveDir = mpInit->mpSaveHandler->GetSaveDir();
- cDate dateAuto = FileModifiedDate(sSaveDir + sAuto);
- cDate dateSpot = FileModifiedDate(sSaveDir + sSpot);
-
- if (dateAuto > dateSpot)
- sFile = sAuto;
- else
- sFile = sSpot;
- }
-
- if (sFile != _W(""))
- mpInit->mpSaveHandler->LoadGameFromFile(sFile);
+ tWString save = mpInit->mpSaveHandler->GetLatest(_W("save-????.*.sav"));
+ if (save != _W(""))
+ mpInit->mpSaveHandler->LoadGameFromFile(save);
}
//-----------------------------------------------------------------------
@@ -320,9 +301,8 @@ void cDeathMenu::SetActive(bool abX) {
STLDeleteAll(mlstButtons);
// Continue
- tWString sAuto = mpInit->mpSaveHandler->GetLatest(_W("save/auto/"), _W("*.sav"));
- tWString sSpot = mpInit->mpSaveHandler->GetLatest(_W("save/spot/"), _W("*.sav"));
- if (sAuto != _W("") || sSpot != _W("")) {
+ tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("save-????.*.sav"));
+ if (latestSave != _W("")) {
mlstButtons.push_back(hplNew(cDeathMenuButton_Continue, (mpInit, cVector2f(400, 290), kTranslate("DeathMenu", "Continue"))));
}
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 46c0543e4d2..0e50eaf07cb 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -37,6 +37,8 @@
#include "hpl1/penumbra-overture/Player.h"
#include "hpl1/penumbra-overture/PlayerHelper.h"
#include "hpl1/penumbra-overture/SaveHandler.h"
+#include "hpl1/hpl1.h"
+#include "common/savefile.h"
float gfMenuFadeAmount;
@@ -631,29 +633,9 @@ void cMainMenuWidget_Continue::OnMouseDown(eMButton aButton) {
mpInit->mpMainMenu->SetActive(false);
- tWString sAuto = _W("save/auto/") + mpInit->mpSaveHandler->GetLatest(_W("save/auto/"), _W("*.sav"));
- tWString sSpot = _W("save/spot/") + mpInit->mpSaveHandler->GetLatest(_W("save/spot/"), _W("*.sav"));
-
- tWString sFile = _W("");
-
- if (sAuto == _W("save/auto/")) {
- sFile = sSpot;
- } else if (sSpot == _W("save/spot/")) {
- sFile = sAuto;
- } else {
- tWString sSaveDir = mpInit->mpSaveHandler->GetSaveDir();
- cDate dateAuto = FileModifiedDate(sSaveDir + sAuto);
- cDate dateSpot = FileModifiedDate(sSaveDir + sSpot);
-
- if (dateAuto > dateSpot) {
- sFile = sAuto;
- } else {
- sFile = sSpot;
- }
- }
-
- if (sFile != _W(""))
- mpInit->mpSaveHandler->LoadGameFromFile(sFile);
+ tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("save-????.*.sav"));
+ if (latestSave != _W(""))
+ mpInit->mpSaveHandler->LoadGameFromFile(latestSave);
}
//-----------------------------------------------------------------------
@@ -719,7 +701,7 @@ public:
if (mlSelected < 0)
return;
- tWString sFile = msDir + _W("/") + gvSaveGameFileVec[mlNum][mlSelected];
+ tWString sFile = gvSaveGameFileVec[mlNum][mlSelected];
mpInit->mpMainMenu->SetActive(false);
mpInit->ResetGame(true);
@@ -805,7 +787,7 @@ public:
tWString sFile = mpInit->mpSaveHandler->GetSaveDir() + msDir +
_W("/") + gvSaveGameFileVec[mlNum][lSelected];
- tWString sDest = mpInit->mpSaveHandler->GetSaveDir() + _W("save/favorite/") +
+ tWString sDest = mpInit->mpSaveHandler->GetSaveDir() + _W("save-favorite.") +
gvSaveGameFileVec[mlNum][lSelected];
CloneFile(sFile, sDest, true);
@@ -2503,10 +2485,9 @@ void cMainMenu::CreateWidgets() {
AddWidgetToState(eMainMenuState_Start, hplNew(cMainMenuWidget_Resume, (mpInit, vPos, kTranslate("MainMenu", "Resume"))));
vPos.y += 60;
} else {
- tWString sAuto = mpInit->mpSaveHandler->GetLatest(_W("save/auto/"), _W("*.sav"));
- tWString sSpot = mpInit->mpSaveHandler->GetLatest(_W("save/spot/"), _W("*.sav"));
+ tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("save-????.*.sav"));
- if (sAuto != _W("") || sSpot != _W("")) {
+ if (latestSave != _W("")) {
AddWidgetToState(eMainMenuState_Start, hplNew(cMainMenuWidget_MainButton, (mpInit, vPos, kTranslate("MainMenu", "Continue"), eMainMenuState_Continue)));
vPos.y += 51;
}
@@ -2601,30 +2582,21 @@ void cMainMenu::CreateWidgets() {
vPos.y += 46 + 30;
vPos.x += 15;
- tWString sDir = _W("save/spot");
+ tWString sDir = _W("save-spot");
if (i == 1)
- sDir = _W("save/auto");
+ sDir = _W("save-auto");
else if (i == 2)
- sDir = _W("save/favorite");
+ sDir = _W("save-favorite");
gpSaveGameList[i] = hplNew(cMainMenuWidget_SaveGameList, (
mpInit, vPos, cVector2f(355, 170), 15, sDir, (int)i));
AddWidgetToState(state, gpSaveGameList[i]);
- LowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
- /*LowLevelSystem *pLowLevelSystem = */mpInit->mpGame->GetSystem()->GetLowLevel();
-
- tStringList lstFiles;
tTempFileAndDataSet setTempFiles;
-
- tWString sFullPath = mpInit->mpSaveHandler->GetSaveDir() + sDir;
- pLowLevelResources->findFilesInDir(lstFiles, cString::To8Char(sFullPath), "*.sav");
-
- tStringListIt fileIt = lstFiles.begin();
- for (; fileIt != lstFiles.end(); ++fileIt) {
- tWString sFile = cString::To16Char(* fileIt);
- cDate date = FileModifiedDate(sFullPath + _W("/") + sFile);
-
+ Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles( cString::To8Char(sDir).c_str() + Common::String("*.sav"));
+ for (auto &s : saves) {
+ tWString sFile = cString::To16Char(s.c_str());
+ cDate date = cSaveHandler::parseDate(s);
setTempFiles.insert(cTempFileAndData(sFile, date));
}
@@ -2639,6 +2611,7 @@ void cMainMenu::CreateWidgets() {
gvSaveGameFileVec[i].push_back(sFile);
sFile = cString::SetFileExtW(sFile, _W(""));
+ sFile = cString::SubW(sFile, sFile.find_first_of(_W(".")) + 1);
sFile = cString::SubW(sFile, 0, (int)sFile.length() - 3);
sFile = cString::ReplaceCharToW(sFile, _W("_"), _W(" "));
sFile = cString::ReplaceCharToW(sFile, _W("."), _W(":"));
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index f0e7df02b3d..9309adeaaeb 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -36,6 +36,10 @@
#include "hpl1/penumbra-overture/Notebook.h"
#include "hpl1/penumbra-overture/Player.h"
#include "hpl1/penumbra-overture/RadioHandler.h"
+#include "hpl1/hpl1.h"
+#include "hpl1/string.h"
+#include "common/savefile.h"
+#include <stdio.h>
//////////////////////////////////////////////////////////////////////////
// SAVED WORLD
@@ -606,7 +610,7 @@ void cSaveHandler::AutoSave(const tWString &asDir, int alMaxSaves) {
sMapName = cString::ReplaceCharToW(sMapName, _W(":"), _W(" "));
cDate date = mpInit->mpGame->GetSystem()->GetLowLevel()->getDate();
wchar_t sTemp[512];
- swprintf(sTemp, 512, _W("save/%ls/%ls %d-%02d-%02d_%02d.%02d.%02d_%02d.sav"),
+ swprintf(sTemp, 512, _W("save-%ls.%ls %d-%02d-%02d_%02d.%02d.%02d_%02d.sav"),
asDir.c_str(),
sMapName.c_str(),
date.year,
@@ -625,10 +629,8 @@ void cSaveHandler::AutoSave(const tWString &asDir, int alMaxSaves) {
//-----------------------------------------------------------------------
void cSaveHandler::AutoLoad(const tWString &asDir) {
- tWString sFile = GetLatest(_W("save/") + asDir, _W("*.sav"));
-
- LoadGameFromFile(_W("save/") + asDir + _W("/") + sFile);
-
+ tWString latestSave = GetLatest(_W("save-") + asDir + _W(".*.sav"));
+ LoadGameFromFile(latestSave);
mpInit->mpGame->ResetLogicTimer();
}
@@ -696,29 +698,28 @@ void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMa
//-----------------------------------------------------------------------
-tWString cSaveHandler::GetLatest(const tWString &asDir, const tWString &asMask) {
- LowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
- /*LowLevelSystem *pLowLevelSystem = */mpInit->mpGame->GetSystem()->GetLowLevel();
-
- tWString sPath = msSaveDir + asDir;
-
- tStringList lstFiles;
- pLowLevelResources->findFilesInDir(lstFiles, cString::To8Char(sPath), cString::To8Char(asMask));
-
- tWString sNewest = _W("");
- cDate newestDate;
+cDate cSaveHandler::parseDate(const Common::String &saveFile) {
+ cDate date;
+ Common::String strDate = saveFile.substr(saveFile.findLastOf(" "));
+ sscanf(strDate.c_str(), "%d-%d-%d_%d.%d.%d.sav", &date.year, &date.month, &date.month_day, &date.hours, &date.minutes, &date.seconds);
+ return date;
+}
- tStringListIt it = lstFiles.begin();
- for (; it != lstFiles.end(); ++it) {
- tWString sFile = cString::To16Char(*it);
- cDate date = FileModifiedDate(sPath + _W("/") + sFile);
- if (sNewest == _W("") || newestDate < date) {
- sNewest = sFile;
- newestDate = date;
+tWString cSaveHandler::GetLatest(const tWString &asMask) {
+ // FIXME: string types
+ Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles(cString::To8Char(asMask).c_str());
+ if (saves.empty())
+ return _W("");
+ cDate latestDate = parseDate(saves.front());
+ const Common::String* latestSave = &saves.front();
+ for (auto it = saves.begin() + 1; it != saves.end(); ++it) {
+ cDate d = parseDate(*it);
+ if (d > latestDate) {
+ d = latestDate;
+ latestSave = it;
}
}
-
- return sNewest;
+ return cString::To16Char(latestSave->c_str());
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.h b/engines/hpl1/penumbra-overture/SaveHandler.h
index 415136a5a6b..d11cd7fdaea 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.h
+++ b/engines/hpl1/penumbra-overture/SaveHandler.h
@@ -325,6 +325,8 @@ public:
cSaveHandler(cInit *apInit);
~cSaveHandler();
+ static cDate parseDate(const Common::String &saveFile);
+
void SaveData(const tString &asName);
void LoadData(const tString &asName);
@@ -345,7 +347,7 @@ public:
const tWString &GetSaveDir() { return msSaveDir; }
void DeleteOldestIfMax(const tWString &asDir, const tWString &asMask, int alMaxFiles);
- tWString GetLatest(const tWString &asDir, const tWString &asMask);
+ tWString GetLatest(const tWString &asMask);
private:
cInit *mpInit;
Commit: 12fcee8864e46081c522776d211c3423af679d54
https://github.com/scummvm/scummvm/commit/12fcee8864e46081c522776d211c3423af679d54
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:53+01:00
Commit Message:
HPL1: implement favourite saves
Changed paths:
engines/hpl1/penumbra-overture/MainMenu.cpp
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 0e50eaf07cb..b9e78a274b3 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -38,6 +38,7 @@
#include "hpl1/penumbra-overture/PlayerHelper.h"
#include "hpl1/penumbra-overture/SaveHandler.h"
#include "hpl1/hpl1.h"
+#include "hpl1/debug.h"
#include "common/savefile.h"
@@ -772,10 +773,8 @@ public:
class cMainMenuWidget_FavoriteSaveGame : public cMainMenuWidget_Button {
public:
cMainMenuWidget_FavoriteSaveGame(cInit *apInit, const cVector3f &avPos, const tWString &asText,
- cVector2f avFontSize, eFontAlign aAlignment,
- tWString asDir, int alNum)
+ cVector2f avFontSize, eFontAlign aAlignment, int alNum)
: cMainMenuWidget_Button(apInit, avPos, asText, eMainMenuState_LastEnum, avFontSize, aAlignment) {
- msDir = asDir;
mlNum = alNum;
}
@@ -784,17 +783,13 @@ public:
if (lSelected < 0)
return;
- tWString sFile = mpInit->mpSaveHandler->GetSaveDir() + msDir +
- _W("/") + gvSaveGameFileVec[mlNum][lSelected];
-
- tWString sDest = mpInit->mpSaveHandler->GetSaveDir() + _W("save-favorite.") +
- gvSaveGameFileVec[mlNum][lSelected];
-
- CloneFile(sFile, sDest, true);
+ tWString originalName = gvSaveGameFileVec[mlNum][lSelected];
+ tWString newName = _W("save-favorite.") + cString::SubW(originalName, originalName.find_first_of('.') + 1);
+ Hpl1::logInfo(Hpl1::kDebugSaves, "adding save %s to favourites\n", cString::To8Char(newName).c_str());
+ g_engine->getSaveFileManager()->copySavefile(cString::To8Char(originalName).c_str(), cString::To8Char(newName).c_str());
mpInit->mpMainMenu->UpdateWidgets();
}
- tWString msDir;
int mlNum;
};
@@ -2630,7 +2625,7 @@ void cMainMenu::CreateWidgets() {
vPos.x += 70;
if (i != 2)
- AddWidgetToState(state, hplNew(cMainMenuWidget_FavoriteSaveGame, (mpInit, vPos, kTranslate("MainMenu", "Add To Favorites"), 17, eFontAlign_Left, sDir, (int)i)));
+ AddWidgetToState(state, hplNew(cMainMenuWidget_FavoriteSaveGame, (mpInit, vPos, kTranslate("MainMenu", "Add To Favorites"), 17, eFontAlign_Left, (int)i)));
vPos.x += 205;
AddWidgetToState(state, hplNew(cMainMenuWidget_RemoveSaveGame, (mpInit, vPos, kTranslate("MainMenu", "Remove"), 17, eFontAlign_Left, sDir, (int)i)));
Commit: 3e02539687dd30ef00b2648318998b6bc12ae8fa
https://github.com/scummvm/scummvm/commit/3e02539687dd30ef00b2648318998b6bc12ae8fa
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:53+01:00
Commit Message:
HPL1: add exit condition
Changed paths:
engines/hpl1/engine/game/Game.cpp
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index 5df35536a8e..c4f137ce8db 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -45,6 +45,7 @@
#include "hpl1/engine/system/low_level_system.h"
#include "common/events.h"
+#include "hpl1/hpl1.h"
namespace hpl {
@@ -360,7 +361,7 @@ void cGame::Run() {
// cMemoryManager::SetLogCreation(true);
- while (!mbGameIsDone) {
+ while (!mbGameIsDone && !g_engine->shouldQuit()) {
// Log("-----------------\n");
//////////////////////////
// Update logic.
Commit: 76fc90745779a8d78214ff5fbe5fe80467522285
https://github.com/scummvm/scummvm/commit/76fc90745779a8d78214ff5fbe5fe80467522285
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:53+01:00
Commit Message:
HPL1: implement keymap support
Changed paths:
engines/hpl1/metaengine.cpp
engines/hpl1/metaengine.h
diff --git a/engines/hpl1/metaengine.cpp b/engines/hpl1/metaengine.cpp
index 07b6ba65a77..91483994bb8 100644
--- a/engines/hpl1/metaengine.cpp
+++ b/engines/hpl1/metaengine.cpp
@@ -20,6 +20,9 @@
*/
#include "hpl1/metaengine.h"
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/keymap.h"
+#include "common/translation.h"
#include "hpl1/detection.h"
#include "hpl1/hpl1.h"
@@ -42,6 +45,56 @@ bool Hpl1MetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSupportsLoadingDuringStartup);
}
+Common::Action *createKeyBoardAction(const char *id, const Common::U32String &desc, const char *defaultMap, const Common::KeyState &key) {
+ Common::Action *act = new Common::Action(id, desc);
+ act->setKeyEvent(key);
+ act->addDefaultInputMapping(defaultMap);
+ return act;
+}
+
+Common::Action *createMouseAction(const char *id, const Common::U32String &desc, const char *defaultMap, const Common::EventType type) {
+ Common::Action *act = new Common::Action(id, desc);
+ act->setEvent(type);
+ act->addDefaultInputMapping(defaultMap);
+ return act;
+}
+
+Common::Array<Common::Keymap *> Hpl1MetaEngine::initKeymaps(const char *target) const {
+ using Common::Keymap;
+ using namespace Hpl1;
+
+ Keymap *movement = new Keymap(Keymap::kKeymapTypeGame, "HPL1_MOVEMENT", "Movement");
+ movement->addAction(createKeyBoardAction("FORWARD", _("Forward"), "w", Common::KEYCODE_w));
+ movement->addAction(createKeyBoardAction("BACKWARD", _("Backward"), "s", Common::KEYCODE_s));
+ movement->addAction(createKeyBoardAction("LEFT", _("Strafe Left"), "a", Common::KEYCODE_a));
+ movement->addAction(createKeyBoardAction("RIGHT", _("Strafe Right"), "d", Common::KEYCODE_d));
+ movement->addAction(createKeyBoardAction("LEAN_LEFT", _("Lean Left"), "q", Common::KEYCODE_q));
+ movement->addAction(createKeyBoardAction("LEAN_RIGHT", _("Lean Right"), "e", Common::KEYCODE_e));
+ movement->addAction(createKeyBoardAction("RUN", _("Run"), "LSHIFT", Common::KEYCODE_LSHIFT));
+ movement->addAction(createKeyBoardAction("JUMP", _("Jump"), "SPACE", Common::KEYCODE_SPACE));
+ movement->addAction(createKeyBoardAction("CROUCH", _("Crouch"), "LCTRL", Common::KEYCODE_LCTRL));
+
+ Keymap *actions = new Keymap(Keymap::kKeymapTypeGame, "HPL1_ACTIONS", "Actions");
+ actions->addAction(createKeyBoardAction("INTERACTMODE", _("Interact Mode"), "r", Common::KEYCODE_r));
+ actions->addAction(createMouseAction("LOOK_MODE", _("Look Mode"), "MOUSE_MIDDLE", Common::EVENT_MBUTTONDOWN));
+ actions->addAction(createKeyBoardAction("HOLSTER", _("Holster"), "x", Common::KEYCODE_x));
+ actions->addAction(createMouseAction("EXAMINE", _("Examine"), "MOUSE_LEFT", Common::EVENT_LBUTTONDOWN));
+ actions->addAction(createMouseAction("INTERACT", _("Interact"), "MOUSE_RIGHT", Common::EVENT_RBUTTONDOWN));
+
+ Keymap *misc = new Keymap(Keymap::kKeymapTypeGame, "HPL1_MISC", "Misc");
+ misc->addAction(createKeyBoardAction("INVENTORY", _("Inventory"), "TAB", Common::KEYCODE_TAB));
+ misc->addAction(createKeyBoardAction("NOTEBOOK", _("Notebook"), "n", Common::KEYCODE_n));
+ misc->addAction(createKeyBoardAction("PERSONAL_NOTES", _("Personal Notes"), "p", Common::KEYCODE_p));
+ misc->addAction(createKeyBoardAction("FLASHLIGHT", _("Flashlight"), "f", Common::KEYCODE_f));
+ misc->addAction(createKeyBoardAction("GLOWSTICK", _("Glowstick"), "g", Common::KEYCODE_f));
+
+ Common::Array<Common::Keymap *> keymaps(3);
+ keymaps[0] = movement;
+ keymaps[1] = actions;
+ keymaps[2] = misc;
+ return keymaps;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(HPL1)
REGISTER_PLUGIN_DYNAMIC(HPL1, PLUGIN_TYPE_ENGINE, Hpl1MetaEngine);
#else
diff --git a/engines/hpl1/metaengine.h b/engines/hpl1/metaengine.h
index 4156502d681..0c0aae36e75 100644
--- a/engines/hpl1/metaengine.h
+++ b/engines/hpl1/metaengine.h
@@ -36,6 +36,8 @@ public:
* Used by e.g. the launcher to determine whether to enable the Load button.
*/
bool hasFeature(MetaEngineFeature f) const override;
+
+ Common::Array<Common::Keymap *> initKeymaps(const char *target) const override;
};
#endif
Commit: e3bd86aaa47782e7261d37cb8f3963b2bd9ec182
https://github.com/scummvm/scummvm/commit/e3bd86aaa47782e7261d37cb8f3963b2bd9ec182
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:53+01:00
Commit Message:
HPL1: fix function to get the latest save
Changed paths:
engines/hpl1/penumbra-overture/SaveHandler.cpp
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index 9309adeaaeb..e0e18517cc6 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -715,7 +715,7 @@ tWString cSaveHandler::GetLatest(const tWString &asMask) {
for (auto it = saves.begin() + 1; it != saves.end(); ++it) {
cDate d = parseDate(*it);
if (d > latestDate) {
- d = latestDate;
+ latestDate = d;
latestSave = it;
}
}
Commit: 02caa68e7962a76f18e0d9cefc7990b37bd9179e
https://github.com/scummvm/scummvm/commit/02caa68e7962a76f18e0d9cefc7990b37bd9179e
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:54+01:00
Commit Message:
HPL1: disable menu to change key mapping in the game
Changed paths:
engines/hpl1/penumbra-overture/MainMenu.cpp
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index b9e78a274b3..c88d535c596 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -2712,9 +2712,9 @@ void cMainMenu::CreateWidgets() {
vPos.y += 5;
}
- cMainMenuWidget *pWidgetChangeKeyConf = hplNew(cMainMenuWidget_Button, (mpInit, vPos, kTranslate("MainMenu", "Change Key Mapping"), eMainMenuState_OptionsKeySetupMove, 20, eFontAlign_Center));
- AddWidgetToState(eMainMenuState_OptionsControls, pWidgetChangeKeyConf);
- vPos.y += 35;
+ // cMainMenuWidget *pWidgetChangeKeyConf = hplNew(cMainMenuWidget_Button, (mpInit, vPos, kTranslate("MainMenu", "Change Key Mapping"), eMainMenuState_OptionsKeySetupMove, 20, eFontAlign_Center));
+ // AddWidgetToState(eMainMenuState_OptionsControls, pWidgetChangeKeyConf);
+ // vPos.y += 35;
AddWidgetToState(eMainMenuState_OptionsControls, hplNew(cMainMenuWidget_Button, (mpInit, vPos, kTranslate("MainMenu", "Back"), eMainMenuState_Options, 23, eFontAlign_Center)));
// Text
Commit: 7c80f99276dc21f80bbb908549c20daef52689ca
https://github.com/scummvm/scummvm/commit/7c80f99276dc21f80bbb908549c20daef52689ca
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:54+01:00
Commit Message:
HPL1: change save file name pattern
Changed paths:
engines/hpl1/penumbra-overture/DeathMenu.cpp
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/SaveHandler.cpp
diff --git a/engines/hpl1/penumbra-overture/DeathMenu.cpp b/engines/hpl1/penumbra-overture/DeathMenu.cpp
index 6f6bf99d361..d0b5160d76a 100644
--- a/engines/hpl1/penumbra-overture/DeathMenu.cpp
+++ b/engines/hpl1/penumbra-overture/DeathMenu.cpp
@@ -104,7 +104,7 @@ void cDeathMenuButton::OnMouseOver(bool abOver) {
//-----------------------------------------------------------------------
void cDeathMenuButton_Continue::OnMouseDown() {
- tWString save = mpInit->mpSaveHandler->GetLatest(_W("save-????.*.sav"));
+ tWString save = mpInit->mpSaveHandler->GetLatest(_W("hpl1-po-????.*.sav"));
if (save != _W(""))
mpInit->mpSaveHandler->LoadGameFromFile(save);
}
@@ -301,7 +301,7 @@ void cDeathMenu::SetActive(bool abX) {
STLDeleteAll(mlstButtons);
// Continue
- tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("save-????.*.sav"));
+ tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("hpl1-po-????.*.sav"));
if (latestSave != _W("")) {
mlstButtons.push_back(hplNew(cDeathMenuButton_Continue, (mpInit, cVector2f(400, 290), kTranslate("DeathMenu", "Continue"))));
}
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index c88d535c596..37cc3a2aeb1 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -634,7 +634,7 @@ void cMainMenuWidget_Continue::OnMouseDown(eMButton aButton) {
mpInit->mpMainMenu->SetActive(false);
- tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("save-????.*.sav"));
+ tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("hpl1-po-????.*.sav"));
if (latestSave != _W(""))
mpInit->mpSaveHandler->LoadGameFromFile(latestSave);
}
@@ -2480,7 +2480,7 @@ void cMainMenu::CreateWidgets() {
AddWidgetToState(eMainMenuState_Start, hplNew(cMainMenuWidget_Resume, (mpInit, vPos, kTranslate("MainMenu", "Resume"))));
vPos.y += 60;
} else {
- tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("save-????.*.sav"));
+ tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("hpl1-po-????.*.sav"));
if (latestSave != _W("")) {
AddWidgetToState(eMainMenuState_Start, hplNew(cMainMenuWidget_MainButton, (mpInit, vPos, kTranslate("MainMenu", "Continue"), eMainMenuState_Continue)));
@@ -2577,11 +2577,11 @@ void cMainMenu::CreateWidgets() {
vPos.y += 46 + 30;
vPos.x += 15;
- tWString sDir = _W("save-spot");
+ tWString sDir = _W("hpl1-po-spot");
if (i == 1)
- sDir = _W("save-auto");
+ sDir = _W("hpl1-po-auto");
else if (i == 2)
- sDir = _W("save-favorite");
+ sDir = _W("hpl1-po-favorite");
gpSaveGameList[i] = hplNew(cMainMenuWidget_SaveGameList, (
mpInit, vPos, cVector2f(355, 170), 15, sDir, (int)i));
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index e0e18517cc6..eba9743f91a 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -610,7 +610,7 @@ void cSaveHandler::AutoSave(const tWString &asDir, int alMaxSaves) {
sMapName = cString::ReplaceCharToW(sMapName, _W(":"), _W(" "));
cDate date = mpInit->mpGame->GetSystem()->GetLowLevel()->getDate();
wchar_t sTemp[512];
- swprintf(sTemp, 512, _W("save-%ls.%ls %d-%02d-%02d_%02d.%02d.%02d_%02d.sav"),
+ swprintf(sTemp, 512, _W("hpl1-po-%ls.%ls %d-%02d-%02d_%02d.%02d.%02d_%02d.sav"),
asDir.c_str(),
sMapName.c_str(),
date.year,
@@ -629,7 +629,7 @@ void cSaveHandler::AutoSave(const tWString &asDir, int alMaxSaves) {
//-----------------------------------------------------------------------
void cSaveHandler::AutoLoad(const tWString &asDir) {
- tWString latestSave = GetLatest(_W("save-") + asDir + _W(".*.sav"));
+ tWString latestSave = GetLatest(_W("hpl1-po-") + asDir + _W(".*.sav"));
LoadGameFromFile(latestSave);
mpInit->mpGame->ResetLogicTimer();
}
Commit: a50e2e14eedfd4047e7a453b257c35296e1a54a7
https://github.com/scummvm/scummvm/commit/a50e2e14eedfd4047e7a453b257c35296e1a54a7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:54+01:00
Commit Message:
HPL1: fix error in xml library
Changed paths:
engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp b/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
index 5af3ffbe926..c631e0e37ec 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxml.cpp
@@ -873,7 +873,7 @@ bool TiXmlDocument::SaveFile(Common::WriteStream &fp) const {
fp.writeByte(TIXML_UTF_LEAD_2);
}
Print(fp, 0);
- return fp.err();
+ return !fp.err();
}
void TiXmlDocument::CopyTo(TiXmlDocument *target) const {
Commit: 3b8760966654c43c39dfd332bba81e4feee37a8d
https://github.com/scummvm/scummvm/commit/3b8760966654c43c39dfd332bba81e4feee37a8d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:54+01:00
Commit Message:
HPL1: implement save detection
Changed paths:
engines/hpl1/metaengine.cpp
engines/hpl1/metaengine.h
diff --git a/engines/hpl1/metaengine.cpp b/engines/hpl1/metaengine.cpp
index 91483994bb8..fa9f69fc780 100644
--- a/engines/hpl1/metaengine.cpp
+++ b/engines/hpl1/metaengine.cpp
@@ -25,6 +25,8 @@
#include "common/translation.h"
#include "hpl1/detection.h"
#include "hpl1/hpl1.h"
+#include "common/savefile.h"
+#include "common/system.h"
const char *Hpl1MetaEngine::getName() const {
return "hpl1";
@@ -45,6 +47,26 @@ bool Hpl1MetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSupportsLoadingDuringStartup);
}
+static Common::U32String formatSave(const Common::String &filename) {
+ const int begin = filename.findFirstOf('.') + 1;
+ const int len = filename.findLastOf('_') - begin;
+ Common::String name = filename.substr(begin, len);
+ Common::replace(name.begin(), name.end(), '.', ':');
+ Common::replace(name.begin(), name.end(), '_', ' ');
+ return name;
+}
+
+SaveStateList Hpl1MetaEngine::listSaves(const char *target) const {
+ SaveStateList saveList;
+ Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles("hpl1-po-????.*");
+ int i = 0;
+ for (auto &save : filenames) {
+ if (!save.contains("favourite"))
+ saveList.push_back(SaveStateDescriptor(this, ++i, formatSave(save)));
+ }
+ return saveList;
+}
+
Common::Action *createKeyBoardAction(const char *id, const Common::U32String &desc, const char *defaultMap, const Common::KeyState &key) {
Common::Action *act = new Common::Action(id, desc);
act->setKeyEvent(key);
diff --git a/engines/hpl1/metaengine.h b/engines/hpl1/metaengine.h
index 0c0aae36e75..bb16de0d636 100644
--- a/engines/hpl1/metaengine.h
+++ b/engines/hpl1/metaengine.h
@@ -37,6 +37,8 @@ public:
*/
bool hasFeature(MetaEngineFeature f) const override;
+ SaveStateList listSaves(const char *target) const override;
+
Common::Array<Common::Keymap *> initKeymaps(const char *target) const override;
};
Commit: 7fac2674d73fa4cf89493d158385635d286a2223
https://github.com/scummvm/scummvm/commit/7fac2674d73fa4cf89493d158385635d286a2223
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:54+01:00
Commit Message:
HPL1: add basic support for extended save format
Changed paths:
engines/hpl1/engine/system/SerializeClass.cpp
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index ccc0a4062e2..eb1fe29a138 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -210,6 +210,7 @@ bool cSerializeClass::SaveToFile(iSerializable *apData, const tWString &asFile,
Hpl1::logError(Hpl1::kDebugSaves, "couldn't save to file '%s'\n", asFile.c_str());
return false;
}
+ g_engine->getMetaEngine()->appendExtendedSave(savefile.get(), g_engine->getTotalPlayTime(), "", filename.contains("auto"));
return true;
}
@@ -284,6 +285,12 @@ bool cSerializeClass::LoadFromFile(iSerializable *apData, const tWString &asFile
Hpl1::logError(Hpl1::kDebugSaves | Hpl1::kDebugResourceLoading, "save file %s could not be opened\n", filename.c_str());
return false;
}
+ ExtendedSavegameHeader header;
+ if (MetaEngine::readSavegameHeader(saveFile.get(), &header)) {
+ Hpl1::logError(Hpl1::kDebugResourceLoading | Hpl1::kDebugSaves, "couldn't load heaer from save file %s\n", filename.c_str());
+ return false;
+ }
+ g_engine->setTotalPlayTime(header.playtime);
if (pXmlDoc.LoadFile(*saveFile) == false) {
Hpl1::logError(Hpl1::kDebugResourceLoading | Hpl1::kDebugSaves,
"Couldn't load saved class file '%s' from %s!\n", cString::To8Char(asFile).c_str(),
Commit: 8f8617a5d770d1c2c482ebfc57149dc0d535d8d3
https://github.com/scummvm/scummvm/commit/8f8617a5d770d1c2c482ebfc57149dc0d535d8d3
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:54+01:00
Commit Message:
HPL1: format opengl files
Changed paths:
engines/hpl1/opengl.cpp
engines/hpl1/opengl.h
diff --git a/engines/hpl1/opengl.cpp b/engines/hpl1/opengl.cpp
index 4d1e75cb1ba..6d5ab49fe25 100644
--- a/engines/hpl1/opengl.cpp
+++ b/engines/hpl1/opengl.cpp
@@ -23,21 +23,23 @@
#include "hpl1/debug.h"
namespace Hpl1 {
- static const char* getErrorString(const GLenum code) {
- switch (code) {
- case GL_INVALID_ENUM:
- return "invalid enum";
- case GL_INVALID_VALUE:
- return "invalid value";
- case GL_INVALID_OPERATION:
- return "invalid operation";
- }
- return "unrecognized error";
- }
- void checkOGLErrors(const char *function, const int line) {
- GLenum code;
- while((code = glGetError()) != GL_NO_ERROR)
- logError(kDebugOpenGL, "Opengl error: \'%s\' in function %s - %d\n", getErrorString(code), function, line);
+static const char* getErrorString(const GLenum code) {
+ switch (code) {
+ case GL_INVALID_ENUM:
+ return "invalid enum";
+ case GL_INVALID_VALUE:
+ return "invalid value";
+ case GL_INVALID_OPERATION:
+ return "invalid operation";
}
-}
\ No newline at end of file
+ return "unrecognized error";
+}
+
+void checkOGLErrors(const char *function, const int line) {
+ GLenum code;
+ while((code = glGetError()) != GL_NO_ERROR)
+ logError(kDebugOpenGL, "Opengl error: \'%s\' in function %s - %d\n", getErrorString(code), function, line);
+}
+
+} // End of namespace Hpl1
\ No newline at end of file
diff --git a/engines/hpl1/opengl.h b/engines/hpl1/opengl.h
index 8e6c6444cc4..d2fe5075819 100644
--- a/engines/hpl1/opengl.h
+++ b/engines/hpl1/opengl.h
@@ -28,7 +28,9 @@
#include "graphics/opengl/context.h"
namespace Hpl1 {
- void checkOGLErrors(const char *function, int line);
+
+void checkOGLErrors(const char *function, int line);
+
}
#define GL_CHECK(x) {x; ::Hpl1::checkOGLErrors(__func__, __LINE__);}
Commit: fa822ef0c250413a704905648fa8d6b1c0d6c169
https://github.com/scummvm/scummvm/commit/fa822ef0c250413a704905648fa8d6b1c0d6c169
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:54+01:00
Commit Message:
HPL1: implement thumbnail method in metaengine
Changed paths:
engines/hpl1/metaengine.cpp
engines/hpl1/metaengine.h
engines/hpl1/opengl.cpp
engines/hpl1/opengl.h
diff --git a/engines/hpl1/metaengine.cpp b/engines/hpl1/metaengine.cpp
index fa9f69fc780..6e529acc96c 100644
--- a/engines/hpl1/metaengine.cpp
+++ b/engines/hpl1/metaengine.cpp
@@ -25,6 +25,9 @@
#include "common/translation.h"
#include "hpl1/detection.h"
#include "hpl1/hpl1.h"
+#include "hpl1/opengl.h"
+#include "graphics/scaler.h"
+#include "graphics/thumbnail.h"
#include "common/savefile.h"
#include "common/system.h"
@@ -47,6 +50,15 @@ bool Hpl1MetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSupportsLoadingDuringStartup);
}
+void Hpl1MetaEngine::getSavegameThumbnail(Graphics::Surface &thumbnail) {
+ Common::ScopedPtr<Graphics::Surface> screen = Hpl1::createViewportScreenshot();
+ Common::ScopedPtr<Graphics::Surface> scaledScreen(screen->scale( kThumbnailWidth, kThumbnailHeight2));
+ scaledScreen->convertToInPlace(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
+ thumbnail.copyFrom(*scaledScreen);
+ screen->free();
+ scaledScreen->free();
+}
+
static Common::U32String formatSave(const Common::String &filename) {
const int begin = filename.findFirstOf('.') + 1;
const int len = filename.findLastOf('_') - begin;
diff --git a/engines/hpl1/metaengine.h b/engines/hpl1/metaengine.h
index bb16de0d636..39fe205a3c6 100644
--- a/engines/hpl1/metaengine.h
+++ b/engines/hpl1/metaengine.h
@@ -39,6 +39,8 @@ public:
SaveStateList listSaves(const char *target) const override;
+ void getSavegameThumbnail(Graphics::Surface &thumbnail) override;
+
Common::Array<Common::Keymap *> initKeymaps(const char *target) const override;
};
diff --git a/engines/hpl1/opengl.cpp b/engines/hpl1/opengl.cpp
index 6d5ab49fe25..151fc9bf01a 100644
--- a/engines/hpl1/opengl.cpp
+++ b/engines/hpl1/opengl.cpp
@@ -21,6 +21,9 @@
#include "hpl1/opengl.h"
#include "hpl1/debug.h"
+#include "common/rect.h"
+#include "graphics/surface.h"
+#include "common/system.h"
namespace Hpl1 {
@@ -42,4 +45,28 @@ void checkOGLErrors(const char *function, const int line) {
logError(kDebugOpenGL, "Opengl error: \'%s\' in function %s - %d\n", getErrorString(code), function, line);
}
+
+static Common::Rect getGLViewport() {
+ int viewportSize[4];
+ GL_CHECK(glGetIntegerv(GL_VIEWPORT, viewportSize));
+ return Common::Rect(viewportSize[0], viewportSize[1], viewportSize[2], viewportSize[3]);
+}
+
+static Graphics::PixelFormat getRGBAPixelFormat() {
+#ifdef SCUMM_BIG_ENDIAN
+ return Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+#else
+ return Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
+#endif
+}
+
+Common::ScopedPtr<Graphics::Surface> createViewportScreenshot() {
+ Common::ScopedPtr<Graphics::Surface> screen(new Graphics::Surface());
+ Common::Rect viewportSize = getGLViewport();
+ screen->create(viewportSize.width(), viewportSize.height(), getRGBAPixelFormat());
+ GL_CHECK(glReadPixels(viewportSize.left, g_system->getHeight() - viewportSize.bottom, viewportSize.width(), viewportSize.height(), GL_RGBA, GL_UNSIGNED_BYTE, screen->getPixels()));
+ screen->flipVertical(Common::Rect(screen->w, screen->h));
+ return screen;
+}
+
} // End of namespace Hpl1
\ No newline at end of file
diff --git a/engines/hpl1/opengl.h b/engines/hpl1/opengl.h
index d2fe5075819..0f65156d153 100644
--- a/engines/hpl1/opengl.h
+++ b/engines/hpl1/opengl.h
@@ -26,11 +26,20 @@
#define USE_GLAD
#include "graphics/opengl/system_headers.h"
#include "graphics/opengl/context.h"
+#include "common/ptr.h"
+
+namespace Graphics {
+
+class Surface;
+
+}
namespace Hpl1 {
void checkOGLErrors(const char *function, int line);
+Common::ScopedPtr<Graphics::Surface> createViewportScreenshot();
+
}
#define GL_CHECK(x) {x; ::Hpl1::checkOGLErrors(__func__, __LINE__);}
Commit: 630623c997038989089ed29b08062767ef5748e7
https://github.com/scummvm/scummvm/commit/630623c997038989089ed29b08062767ef5748e7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:54+01:00
Commit Message:
HPL1: use standard naming scheme for saves
Changed paths:
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/hpl1.cpp
engines/hpl1/hpl1.h
engines/hpl1/metaengine.cpp
engines/hpl1/metaengine.h
engines/hpl1/penumbra-overture/DeathMenu.cpp
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/SaveHandler.cpp
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index eb1fe29a138..822b82b46fb 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -195,22 +195,23 @@ bool cSerializeClass::SaveToFile(iSerializable *apData, const tWString &asFile,
glTabs = 0;
// FIXME: string types
- Common::String filename(cString::To8Char(asFile).c_str());
+ Common::String saveDesc(cString::To8Char(asFile).c_str());
+ Common::String filename(Hpl1::g_engine->createSaveFile(saveDesc));
TiXmlDocument pXmlDoc;
// Create root
TiXmlElement XmlRoot(asRoot.c_str());
TiXmlElement *pRootElem = static_cast<TiXmlElement *>(pXmlDoc.InsertEndChild(XmlRoot));
Common::ScopedPtr<Common::OutSaveFile> savefile(g_engine->getSaveFileManager()->openForSaving(filename));
if (!savefile) {
- Hpl1::logError(Hpl1::kDebugSaves, "could't open file %s for saving\n", asFile.c_str());
+ Hpl1::logError(Hpl1::kDebugSaves, "could't open file %s for saving\n", filename.c_str());
return false;
}
SaveToElement(apData, "", pRootElem);
if (!pXmlDoc.SaveFile(*savefile)) {
- Hpl1::logError(Hpl1::kDebugSaves, "couldn't save to file '%s'\n", asFile.c_str());
+ Hpl1::logError(Hpl1::kDebugSaves, "couldn't save to file '%s'\n", filename.c_str());
return false;
}
- g_engine->getMetaEngine()->appendExtendedSave(savefile.get(), g_engine->getTotalPlayTime(), "", filename.contains("auto"));
+ g_engine->getMetaEngine()->appendExtendedSave(savefile.get(), g_engine->getTotalPlayTime(), saveDesc, filename.contains("auto"));
return true;
}
@@ -279,15 +280,15 @@ bool cSerializeClass::LoadFromFile(iSerializable *apData, const tWString &asFile
// Load document
TiXmlDocument pXmlDoc;
// FIXME: string types
- Common::String filename(cString::To8Char(asFile).c_str());
+ Common::String filename(Hpl1::g_engine->mapInternalSaveToFile(cString::To8Char(asFile).c_str()));
Common::ScopedPtr<Common::InSaveFile> saveFile(g_engine->getSaveFileManager()->openForLoading(filename));
if (!saveFile) {
Hpl1::logError(Hpl1::kDebugSaves | Hpl1::kDebugResourceLoading, "save file %s could not be opened\n", filename.c_str());
return false;
}
ExtendedSavegameHeader header;
- if (MetaEngine::readSavegameHeader(saveFile.get(), &header)) {
- Hpl1::logError(Hpl1::kDebugResourceLoading | Hpl1::kDebugSaves, "couldn't load heaer from save file %s\n", filename.c_str());
+ if (!MetaEngine::readSavegameHeader(saveFile.get(), &header)) {
+ Hpl1::logError(Hpl1::kDebugResourceLoading | Hpl1::kDebugSaves, "couldn't load header from save file %s\n", filename.c_str());
return false;
}
g_engine->setTotalPlayTime(header.playtime);
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index a88b0abd057..00d09cdfe31 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -30,6 +30,7 @@
#include "graphics/palette.h"
#include "hpl1/console.h"
#include "hpl1/detection.h"
+#include "hpl1/debug.h"
extern int hplMain(const hpl::tString &asCommandLine);
@@ -54,11 +55,58 @@ Common::String Hpl1Engine::getGameId() const {
return _gameDescription->gameId;
}
+static void initSaves(const char *target, Common::BitArray &slots, Common::HashMap<Common::String, int> &savemap) {
+ slots.set_size(g_engine->getMetaEngine()->getMaximumSaveSlot());
+ SaveStateList saves = g_engine->getMetaEngine()->listSaves(target);
+ for (auto &s : saves) {
+ savemap.setVal(s.getDescription(), s.getSaveSlot());
+ slots.set(s.getSaveSlot());
+ }
+}
+
Common::Error Hpl1Engine::run() {
+ initSaves(_targetName.c_str(), _saveSlots, _internalSaves);
hplMain("");
return Common::kNoError;
}
+static int freeSaveSlot(Common::BitArray &slots, const int size) {
+ for (int i = 0; i < size; ++i) {
+ if (!slots.get(i))
+ return i;
+ }
+ return -1;
+}
+
+Common::String Hpl1Engine::createSaveFile(const Common::String &internalName) {
+ const int freeSlot = freeSaveSlot(_saveSlots, getMetaEngine()->getMaximumSaveSlot());
+ if (freeSlot == -1) {
+ warning("game out of save slots");
+ return "";
+ }
+ _saveSlots.set(freeSlot);
+ _internalSaves.setVal(internalName, freeSlot);
+ return getSaveStateName(freeSlot);
+}
+
+Common::String Hpl1Engine::mapInternalSaveToFile(const Common::String &internalName) {
+ const int slot = _internalSaves.getValOrDefault(internalName, -1);
+ if (slot == -1) {
+ logError(Hpl1::kDebugLevelError, "trying to map invalid save name: %s\n", internalName.c_str());
+ return "";
+ }
+ return getSaveStateName(slot);
+}
+
+Common::StringArray Hpl1Engine::listInternalSaves(const Common::String &pattern) {
+ Common::StringArray saves;
+ for(auto &kv : _internalSaves) {
+ if (kv._key.matchString(pattern))
+ saves.push_back(kv._key);
+ }
+ return saves;
+}
+
Common::Error Hpl1Engine::syncGame(Common::Serializer &s) {
// The Serializer has methods isLoading() and isSaving()
// if you need to specific steps; for example setting
diff --git a/engines/hpl1/hpl1.h b/engines/hpl1/hpl1.h
index 5fbaf15e7bf..7c30b7d14c4 100644
--- a/engines/hpl1/hpl1.h
+++ b/engines/hpl1/hpl1.h
@@ -33,6 +33,7 @@
#include "engines/engine.h"
#include "engines/savestate.h"
#include "graphics/screen.h"
+#include "common/bitarray.h"
#include "hpl1/detection.h"
@@ -44,6 +45,8 @@ class Hpl1Engine : public Engine {
private:
const ADGameDescription *_gameDescription;
Common::RandomSource _randomSource;
+ Common::HashMap<Common::String, int> _internalSaves;
+ Common::BitArray _saveSlots;
protected:
// Engine APIs
@@ -84,6 +87,12 @@ public:
return true;
}
+ Common::String createSaveFile(const Common::String &internalName);
+
+ Common::String mapInternalSaveToFile(const Common::String &internalName);
+
+ Common::StringArray listInternalSaves(const Common::String &pattern);
+
/**
* Uses a serializer to allow implementing savegame
* loading and saving using a single method
diff --git a/engines/hpl1/metaengine.cpp b/engines/hpl1/metaengine.cpp
index 6e529acc96c..7510071b30b 100644
--- a/engines/hpl1/metaengine.cpp
+++ b/engines/hpl1/metaengine.cpp
@@ -59,26 +59,6 @@ void Hpl1MetaEngine::getSavegameThumbnail(Graphics::Surface &thumbnail) {
scaledScreen->free();
}
-static Common::U32String formatSave(const Common::String &filename) {
- const int begin = filename.findFirstOf('.') + 1;
- const int len = filename.findLastOf('_') - begin;
- Common::String name = filename.substr(begin, len);
- Common::replace(name.begin(), name.end(), '.', ':');
- Common::replace(name.begin(), name.end(), '_', ' ');
- return name;
-}
-
-SaveStateList Hpl1MetaEngine::listSaves(const char *target) const {
- SaveStateList saveList;
- Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles("hpl1-po-????.*");
- int i = 0;
- for (auto &save : filenames) {
- if (!save.contains("favourite"))
- saveList.push_back(SaveStateDescriptor(this, ++i, formatSave(save)));
- }
- return saveList;
-}
-
Common::Action *createKeyBoardAction(const char *id, const Common::U32String &desc, const char *defaultMap, const Common::KeyState &key) {
Common::Action *act = new Common::Action(id, desc);
act->setKeyEvent(key);
diff --git a/engines/hpl1/metaengine.h b/engines/hpl1/metaengine.h
index 39fe205a3c6..bb90ddbfa00 100644
--- a/engines/hpl1/metaengine.h
+++ b/engines/hpl1/metaengine.h
@@ -37,8 +37,6 @@ public:
*/
bool hasFeature(MetaEngineFeature f) const override;
- SaveStateList listSaves(const char *target) const override;
-
void getSavegameThumbnail(Graphics::Surface &thumbnail) override;
Common::Array<Common::Keymap *> initKeymaps(const char *target) const override;
diff --git a/engines/hpl1/penumbra-overture/DeathMenu.cpp b/engines/hpl1/penumbra-overture/DeathMenu.cpp
index d0b5160d76a..5eaf2ed04f7 100644
--- a/engines/hpl1/penumbra-overture/DeathMenu.cpp
+++ b/engines/hpl1/penumbra-overture/DeathMenu.cpp
@@ -104,7 +104,7 @@ void cDeathMenuButton::OnMouseOver(bool abOver) {
//-----------------------------------------------------------------------
void cDeathMenuButton_Continue::OnMouseDown() {
- tWString save = mpInit->mpSaveHandler->GetLatest(_W("hpl1-po-????.*.sav"));
+ tWString save = mpInit->mpSaveHandler->GetLatest(_W("????:*"));
if (save != _W(""))
mpInit->mpSaveHandler->LoadGameFromFile(save);
}
@@ -301,7 +301,7 @@ void cDeathMenu::SetActive(bool abX) {
STLDeleteAll(mlstButtons);
// Continue
- tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("hpl1-po-????.*.sav"));
+ tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("????:*"));
if (latestSave != _W("")) {
mlstButtons.push_back(hplNew(cDeathMenuButton_Continue, (mpInit, cVector2f(400, 290), kTranslate("DeathMenu", "Continue"))));
}
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 37cc3a2aeb1..bcd4885e453 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -634,7 +634,7 @@ void cMainMenuWidget_Continue::OnMouseDown(eMButton aButton) {
mpInit->mpMainMenu->SetActive(false);
- tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("hpl1-po-????.*.sav"));
+ tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("????:*"));
if (latestSave != _W(""))
mpInit->mpSaveHandler->LoadGameFromFile(latestSave);
}
@@ -784,9 +784,11 @@ public:
return;
tWString originalName = gvSaveGameFileVec[mlNum][lSelected];
- tWString newName = _W("save-favorite.") + cString::SubW(originalName, originalName.find_first_of('.') + 1);
+ tWString newName = _W("favorite-") + cString::SubW(originalName, originalName.find_first_of('.') + 1);
Hpl1::logInfo(Hpl1::kDebugSaves, "adding save %s to favourites\n", cString::To8Char(newName).c_str());
- g_engine->getSaveFileManager()->copySavefile(cString::To8Char(originalName).c_str(), cString::To8Char(newName).c_str());
+ Common::String originalFile(Hpl1::g_engine->mapInternalSaveToFile(cString::To8Char(originalName).c_str()));
+ Common::String newFile(Hpl1::g_engine->createSaveFile(cString::To8Char(newName).c_str()));
+ g_engine->getSaveFileManager()->copySavefile(originalFile, newFile);
mpInit->mpMainMenu->UpdateWidgets();
}
@@ -2480,7 +2482,7 @@ void cMainMenu::CreateWidgets() {
AddWidgetToState(eMainMenuState_Start, hplNew(cMainMenuWidget_Resume, (mpInit, vPos, kTranslate("MainMenu", "Resume"))));
vPos.y += 60;
} else {
- tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("hpl1-po-????.*.sav"));
+ tWString latestSave = mpInit->mpSaveHandler->GetLatest(_W("????:*"));
if (latestSave != _W("")) {
AddWidgetToState(eMainMenuState_Start, hplNew(cMainMenuWidget_MainButton, (mpInit, vPos, kTranslate("MainMenu", "Continue"), eMainMenuState_Continue)));
@@ -2577,18 +2579,18 @@ void cMainMenu::CreateWidgets() {
vPos.y += 46 + 30;
vPos.x += 15;
- tWString sDir = _W("hpl1-po-spot");
+ tWString sDir = _W("spot:");
if (i == 1)
- sDir = _W("hpl1-po-auto");
+ sDir = _W("auto:");
else if (i == 2)
- sDir = _W("hpl1-po-favorite");
+ sDir = _W("favorite:");
gpSaveGameList[i] = hplNew(cMainMenuWidget_SaveGameList, (
mpInit, vPos, cVector2f(355, 170), 15, sDir, (int)i));
AddWidgetToState(state, gpSaveGameList[i]);
tTempFileAndDataSet setTempFiles;
- Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles( cString::To8Char(sDir).c_str() + Common::String("*.sav"));
+ Common::StringArray saves = Hpl1::g_engine->listInternalSaves(cString::To8Char(sDir).c_str() + Common::String("*"));
for (auto &s : saves) {
tWString sFile = cString::To16Char(s.c_str());
cDate date = cSaveHandler::parseDate(s);
@@ -2605,13 +2607,7 @@ void cMainMenu::CreateWidgets() {
gvSaveGameFileVec[i].push_back(sFile);
- sFile = cString::SetFileExtW(sFile, _W(""));
- sFile = cString::SubW(sFile, sFile.find_first_of(_W(".")) + 1);
- sFile = cString::SubW(sFile, 0, (int)sFile.length() - 3);
- sFile = cString::ReplaceCharToW(sFile, _W("_"), _W(" "));
- sFile = cString::ReplaceCharToW(sFile, _W("."), _W(":"));
-
- // TODO: PROBLEM!!!
+ sFile = cString::SubW(sFile, sFile.find_first_of(_W(":")) + 1);
gpSaveGameList[i]->AddEntry(sFile);
// gpSaveGameList[i]->AddEntry(sFile);
}
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index eba9743f91a..5acfa5e3b82 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -610,7 +610,7 @@ void cSaveHandler::AutoSave(const tWString &asDir, int alMaxSaves) {
sMapName = cString::ReplaceCharToW(sMapName, _W(":"), _W(" "));
cDate date = mpInit->mpGame->GetSystem()->GetLowLevel()->getDate();
wchar_t sTemp[512];
- swprintf(sTemp, 512, _W("hpl1-po-%ls.%ls %d-%02d-%02d_%02d.%02d.%02d_%02d.sav"),
+ swprintf(sTemp, 512, _W("%ls: %ls %d-%02d-%02d %02d:%02d:%02d"),
asDir.c_str(),
sMapName.c_str(),
date.year,
@@ -618,8 +618,7 @@ void cSaveHandler::AutoSave(const tWString &asDir, int alMaxSaves) {
date.month_day,
date.hours,
date.minutes,
- date.seconds,
- cMath::RandRectl(0, 99));
+ date.seconds);
tWString sFile = sTemp;
SaveGameToFile(sFile);
@@ -629,7 +628,7 @@ void cSaveHandler::AutoSave(const tWString &asDir, int alMaxSaves) {
//-----------------------------------------------------------------------
void cSaveHandler::AutoLoad(const tWString &asDir) {
- tWString latestSave = GetLatest(_W("hpl1-po-") + asDir + _W(".*.sav"));
+ tWString latestSave = GetLatest( asDir + _W(":*"));
LoadGameFromFile(latestSave);
mpInit->mpGame->ResetLogicTimer();
}
@@ -700,14 +699,15 @@ void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMa
cDate cSaveHandler::parseDate(const Common::String &saveFile) {
cDate date;
- Common::String strDate = saveFile.substr(saveFile.findLastOf(" "));
- sscanf(strDate.c_str(), "%d-%d-%d_%d.%d.%d.sav", &date.year, &date.month, &date.month_day, &date.hours, &date.minutes, &date.seconds);
+ auto firstDigit = Common::find_if(saveFile.begin(), saveFile.end(), Common::isDigit);
+ Common::String strDate = saveFile.substr(Common::distance(saveFile.begin(), firstDigit));
+ sscanf(strDate.c_str(), "%d-%d-%d %d:%d:%d", &date.year, &date.month, &date.month_day, &date.hours, &date.minutes, &date.seconds);
return date;
}
tWString cSaveHandler::GetLatest(const tWString &asMask) {
// FIXME: string types
- Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles(cString::To8Char(asMask).c_str());
+ Common::StringArray saves = Hpl1::g_engine->listInternalSaves(cString::To8Char(asMask).c_str());
if (saves.empty())
return _W("");
cDate latestDate = parseDate(saves.front());
Commit: f02bc0929adbb4f4256252e6b8e2a29876c0125c
https://github.com/scummvm/scummvm/commit/f02bc0929adbb4f4256252e6b8e2a29876c0125c
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:55+01:00
Commit Message:
HPL1: move saves after save effects
this improves the quality of the save screenshot taken for auto and spot saves.
Changed paths:
engines/hpl1/penumbra-overture/EffectHandler.cpp
diff --git a/engines/hpl1/penumbra-overture/EffectHandler.cpp b/engines/hpl1/penumbra-overture/EffectHandler.cpp
index 64e92669a9a..da3a77374da 100644
--- a/engines/hpl1/penumbra-overture/EffectHandler.cpp
+++ b/engines/hpl1/penumbra-overture/EffectHandler.cpp
@@ -292,8 +292,6 @@ void cEffect_SaveEffect::NormalSaveUpdate(float afTimeStep) {
if (mfTime > 3.0f) {
mlState++;
mpInit->mpPlayer->GetCamera()->SetFOV(mfStartFov);
-
- mpInit->mpSaveHandler->AutoSave(_W("spot"), 10);
}
break;
}
@@ -327,9 +325,13 @@ void cEffect_SaveEffect::NormalSaveUpdate(float afTimeStep) {
break;
}
- ///////////////////////
- // State4
case 4: {
+ mfFlashAlpha = 0.f;
+ mFlashColor = cColor(0.f, 0.f);
+ mlState++;
+ break;
+ }
+ case 5: {
/////////////
// Reset all
mbActive = false;
@@ -368,8 +370,10 @@ void cEffect_SaveEffect::NormalSaveUpdate(float afTimeStep) {
mpInit->mpGameMessageHandler->SetBlackText(false);
mpInit->mpGameMessageHandler->Add(kTranslate("Save", sEntry));
+ mpInit->mpSaveHandler->AutoSave(_W("spot"), 10);
break;
}
+
}
}
@@ -385,7 +389,6 @@ void cEffect_SaveEffect::AutoSaveUpdate(float afTimeStep) {
if (mfFlashAlpha > 0.75f) {
mfFlashAlpha = 0.75f;
mlState++;
- mpInit->mpSaveHandler->AutoSave(_W("auto"), 5);
mpInit->mpPlayer->SetActive(true);
}
break;
@@ -405,9 +408,13 @@ void cEffect_SaveEffect::AutoSaveUpdate(float afTimeStep) {
///////////////////////
// State2
case 2: {
- /////////////
- // Reset all
- mbActive = false;
+ mlState++;
+ mFlashColor = cColor(0.0, 0.0);
+ mfFlashAlpha = 0.f;
+ }
+ case 3: {
+ Reset();
+ mpInit->mpSaveHandler->AutoSave(_W("auto"), 5);
break;
}
}
Commit: 0942081ad00980cc6686bf7f7b910efc5bbec257
https://github.com/scummvm/scummvm/commit/0942081ad00980cc6686bf7f7b910efc5bbec257
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:55+01:00
Commit Message:
HPL1: override engine pause method
Changed paths:
engines/hpl1/hpl1.cpp
engines/hpl1/hpl1.h
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index 00d09cdfe31..3c28fb4603b 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -31,6 +31,7 @@
#include "hpl1/console.h"
#include "hpl1/detection.h"
#include "hpl1/debug.h"
+#include "audio/mixer.h"
extern int hplMain(const hpl::tString &asCommandLine);
@@ -70,6 +71,11 @@ Common::Error Hpl1Engine::run() {
return Common::kNoError;
}
+void Hpl1Engine::pauseEngineIntern(bool pause) {
+ _mixer->pauseAll(pause);
+ g_system->lockMouse(!pause);
+}
+
static int freeSaveSlot(Common::BitArray &slots, const int size) {
for (int i = 0; i < size; ++i) {
if (!slots.get(i))
diff --git a/engines/hpl1/hpl1.h b/engines/hpl1/hpl1.h
index 7c30b7d14c4..625f89f3c01 100644
--- a/engines/hpl1/hpl1.h
+++ b/engines/hpl1/hpl1.h
@@ -52,6 +52,8 @@ protected:
// Engine APIs
Common::Error run() override;
+ void pauseEngineIntern(bool pause) override;
+
public:
Graphics::Screen *_screen = nullptr;
Commit: f0fdb51fafe4107642ca2cb881589ad9afdbd5b2
https://github.com/scummvm/scummvm/commit/f0fdb51fafe4107642ca2cb881589ad9afdbd5b2
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:55+01:00
Commit Message:
HPL1: implement save deletion in the game
Changed paths:
engines/hpl1/hpl1.cpp
engines/hpl1/hpl1.h
engines/hpl1/penumbra-overture/MainMenu.cpp
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index 3c28fb4603b..05a7fd80e47 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -32,6 +32,7 @@
#include "hpl1/detection.h"
#include "hpl1/debug.h"
#include "audio/mixer.h"
+#include "common/savefile.h"
extern int hplMain(const hpl::tString &asCommandLine);
@@ -56,17 +57,7 @@ Common::String Hpl1Engine::getGameId() const {
return _gameDescription->gameId;
}
-static void initSaves(const char *target, Common::BitArray &slots, Common::HashMap<Common::String, int> &savemap) {
- slots.set_size(g_engine->getMetaEngine()->getMaximumSaveSlot());
- SaveStateList saves = g_engine->getMetaEngine()->listSaves(target);
- for (auto &s : saves) {
- savemap.setVal(s.getDescription(), s.getSaveSlot());
- slots.set(s.getSaveSlot());
- }
-}
-
Common::Error Hpl1Engine::run() {
- initSaves(_targetName.c_str(), _saveSlots, _internalSaves);
hplMain("");
return Common::kNoError;
}
@@ -76,41 +67,50 @@ void Hpl1Engine::pauseEngineIntern(bool pause) {
g_system->lockMouse(!pause);
}
-static int freeSaveSlot(Common::BitArray &slots, const int size) {
- for (int i = 0; i < size; ++i) {
- if (!slots.get(i))
- return i;
+static Common::String freeSaveSlot(const Engine *engine, const int maxSaves) {
+ for (int i = 0; i < maxSaves; ++i) {
+ const Common::String name = engine->getSaveStateName(i);
+ if (g_system->getSavefileManager()->exists(name))
+ return name;
}
- return -1;
+ return "";
}
Common::String Hpl1Engine::createSaveFile(const Common::String &internalName) {
- const int freeSlot = freeSaveSlot(_saveSlots, getMetaEngine()->getMaximumSaveSlot());
- if (freeSlot == -1) {
+ const Common::String freeSlot = freeSaveSlot(this, getMetaEngine()->getMaximumSaveSlot());
+ if (freeSlot == "")
warning("game out of save slots");
- return "";
+ return freeSlot;
+}
+
+static Common::String findSaveFile(const SaveStateList &saves, const Common::String &internalName) {
+ for (auto &s : saves) {
+ if(s.getDescription() == internalName)
+ return g_engine->getSaveStateName(s.getSaveSlot());
}
- _saveSlots.set(freeSlot);
- _internalSaves.setVal(internalName, freeSlot);
- return getSaveStateName(freeSlot);
+ logWarning(kDebugSaves | kDebugFilePath, "save file for save %s does not exist", internalName.c_str());
+ return "";
+}
+
+void Hpl1Engine::removeSaveFile(const Common::String &internalName) {
+ Common::String filename = findSaveFile(g_engine->getMetaEngine()->listSaves(_targetName.c_str()), internalName);
+ if (filename != "")
+ _saveFileMan->removeSavefile(filename);
}
Common::String Hpl1Engine::mapInternalSaveToFile(const Common::String &internalName) {
- const int slot = _internalSaves.getValOrDefault(internalName, -1);
- if (slot == -1) {
- logError(Hpl1::kDebugLevelError, "trying to map invalid save name: %s\n", internalName.c_str());
- return "";
- }
- return getSaveStateName(slot);
+ return findSaveFile(g_engine->getMetaEngine()->listSaves(_targetName.c_str()), internalName);
}
Common::StringArray Hpl1Engine::listInternalSaves(const Common::String &pattern) {
- Common::StringArray saves;
- for(auto &kv : _internalSaves) {
- if (kv._key.matchString(pattern))
- saves.push_back(kv._key);
+ Common::StringArray internalSaves;
+ SaveStateList saves = g_engine->getMetaEngine()->listSaves(_targetName.c_str());
+ for (auto &save : saves) {
+ const Common::String saveDesc = save.getDescription();
+ if (saveDesc.matchString(pattern))
+ internalSaves.push_back(saveDesc);
}
- return saves;
+ return internalSaves;
}
Common::Error Hpl1Engine::syncGame(Common::Serializer &s) {
diff --git a/engines/hpl1/hpl1.h b/engines/hpl1/hpl1.h
index 625f89f3c01..0eb5ab08537 100644
--- a/engines/hpl1/hpl1.h
+++ b/engines/hpl1/hpl1.h
@@ -45,8 +45,6 @@ class Hpl1Engine : public Engine {
private:
const ADGameDescription *_gameDescription;
Common::RandomSource _randomSource;
- Common::HashMap<Common::String, int> _internalSaves;
- Common::BitArray _saveSlots;
protected:
// Engine APIs
@@ -93,6 +91,8 @@ public:
Common::String mapInternalSaveToFile(const Common::String &internalName);
+ void removeSaveFile(const Common::String &internalName);
+
Common::StringArray listInternalSaves(const Common::String &pattern);
/**
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index bcd4885e453..ba2220346d6 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -759,10 +759,8 @@ public:
if (lSelected < 0)
return;
- tWString sFile = mpInit->mpSaveHandler->GetSaveDir() + msDir +
- _W("/") + gvSaveGameFileVec[mlNum][lSelected];
-
- RemoveFile(sFile);
+ tWString sFile = gvSaveGameFileVec[mlNum][lSelected];
+ Hpl1::g_engine->removeSaveFile(cString::To8Char(sFile).c_str());
mpInit->mpMainMenu->UpdateWidgets();
}
Commit: ceeb9105cb270c0fa01312eedb557ecb7c55fb84
https://github.com/scummvm/scummvm/commit/ceeb9105cb270c0fa01312eedb557ecb7c55fb84
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:55+01:00
Commit Message:
HPL1: fix bug in function that returns free save slot
Changed paths:
engines/hpl1/hpl1.cpp
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index 05a7fd80e47..87640f93ee9 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -70,7 +70,7 @@ void Hpl1Engine::pauseEngineIntern(bool pause) {
static Common::String freeSaveSlot(const Engine *engine, const int maxSaves) {
for (int i = 0; i < maxSaves; ++i) {
const Common::String name = engine->getSaveStateName(i);
- if (g_system->getSavefileManager()->exists(name))
+ if (!g_system->getSavefileManager()->exists(name))
return name;
}
return "";
Commit: 3c005d841e4160fb5546e8b8a4cabf00b07f0498
https://github.com/scummvm/scummvm/commit/3c005d841e4160fb5546e8b8a4cabf00b07f0498
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:55+01:00
Commit Message:
HPL1: implement removal of old save files
Changed paths:
engines/hpl1/penumbra-overture/SaveHandler.cpp
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index 5acfa5e3b82..68dc5d16b08 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -39,6 +39,7 @@
#include "hpl1/hpl1.h"
#include "hpl1/string.h"
#include "common/savefile.h"
+#include "hpl1/debug.h"
#include <stdio.h>
//////////////////////////////////////////////////////////////////////////
@@ -601,7 +602,7 @@ void cSaveHandler::LoadGameFromFile(const tWString &asFile) {
void cSaveHandler::AutoSave(const tWString &asDir, int alMaxSaves) {
//////////////////////
// Check the available autosaves
- DeleteOldestIfMax(_W("save/") + asDir, _W("*.sav"), alMaxSaves);
+ DeleteOldestIfMax(asDir, _W(":*"), alMaxSaves);
//////////////////////
// Save the autosave
@@ -668,35 +669,6 @@ void cSaveHandler::OnExit() {
//-----------------------------------------------------------------------
-void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMask, int alMaxFiles) {
- LowLevelResources *pLowLevelResources = mpInit->mpGame->GetResources()->GetLowLevel();
- /*LowLevelSystem *pLowLevelSystem = */mpInit->mpGame->GetSystem()->GetLowLevel();
-
- tWString sPath = msSaveDir + asDir;
-
- tStringList lstFiles;
- pLowLevelResources->findFilesInDir(lstFiles, cString::To8Char(sPath), cString::To8Char(asMask));
-
- // If there are too many files, remove oldest.
- if ((int)lstFiles.size() >= alMaxFiles) {
- tString sOldest = "";
- cDate oldestDate;
-
- tStringListIt it = lstFiles.begin();
- for (; it != lstFiles.end(); ++it) {
- cDate date = FileModifiedDate(sPath + _W("/") + cString::To16Char(*it));
- if (sOldest == "" || oldestDate > date) {
- sOldest = *it;
- oldestDate = date;
- }
- }
-
- RemoveFile(sPath + _W("/") + cString::To16Char(sOldest));
- }
-}
-
-//-----------------------------------------------------------------------
-
cDate cSaveHandler::parseDate(const Common::String &saveFile) {
cDate date;
auto firstDigit = Common::find_if(saveFile.begin(), saveFile.end(), Common::isDigit);
@@ -705,21 +677,37 @@ cDate cSaveHandler::parseDate(const Common::String &saveFile) {
return date;
}
-tWString cSaveHandler::GetLatest(const tWString &asMask) {
- // FIXME: string types
- Common::StringArray saves = Hpl1::g_engine->listInternalSaves(cString::To8Char(asMask).c_str());
+template<typename DateCmp>
+Common::String firstSave(const Common::StringArray &saves, DateCmp cmp) {
if (saves.empty())
- return _W("");
- cDate latestDate = parseDate(saves.front());
+ return "";
+ cDate latestDate = cSaveHandler::parseDate(saves.front());
const Common::String* latestSave = &saves.front();
for (auto it = saves.begin() + 1; it != saves.end(); ++it) {
- cDate d = parseDate(*it);
- if (d > latestDate) {
+ cDate d = cSaveHandler::parseDate(*it);
+ if (cmp(d, latestDate)) {
latestDate = d;
latestSave = it;
}
}
- return cString::To16Char(latestSave->c_str());
+ return *latestSave;
+}
+
+void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMask, int alMaxFiles) {
+ const Common::StringArray saves = Hpl1::g_engine->listInternalSaves(cString::To8Char(asDir + asMask).c_str());
+ if (static_cast<int>(saves.size()) > alMaxFiles) {
+ const Common::String oldest = firstSave(saves, [](const cDate& a, const cDate &b){return a < b;});
+ Hpl1::logInfo(Hpl1::kDebugSaves, "removing save %s\n", oldest.c_str());
+ Hpl1::g_engine->removeSaveFile(oldest);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+tWString cSaveHandler::GetLatest(const tWString &asMask) {
+ // FIXME: string types
+ Common::StringArray saves = Hpl1::g_engine->listInternalSaves(cString::To8Char(asMask).c_str());
+ return cString::To16Char(firstSave(saves, [](const cDate& a, const cDate &b){return a > b;}).c_str());
}
//-----------------------------------------------------------------------
Commit: 8a85e1c2b9773c198eae5645c0a7577b7e29b566
https://github.com/scummvm/scummvm/commit/8a85e1c2b9773c198eae5645c0a7577b7e29b566
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:55+01:00
Commit Message:
HPL1: move hplMain to engine run
Changed paths:
R engines/hpl1/penumbra-overture/Main.cpp
engines/hpl1/hpl1.cpp
engines/hpl1/hpl1.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index 87640f93ee9..c01484d7984 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "hpl1/penumbra-overture/Init.h"
#include "engine/engine.h"
#include "hpl1/hpl1.h"
#include "common/config-manager.h"
@@ -34,8 +35,6 @@
#include "audio/mixer.h"
#include "common/savefile.h"
-extern int hplMain(const hpl::tString &asCommandLine);
-
namespace Hpl1 {
Hpl1Engine *g_engine;
@@ -58,7 +57,14 @@ Common::String Hpl1Engine::getGameId() const {
}
Common::Error Hpl1Engine::run() {
- hplMain("");
+ _gameInit = new cInit(); // TODO: remove allocation
+ if (!_gameInit->Init("")) {
+ delete _gameInit;
+ return Common::kUnknownError; // TODO: better errors
+ };
+ _gameInit->Run();
+ _gameInit->Exit();
+ delete _gameInit;
return Common::kNoError;
}
diff --git a/engines/hpl1/hpl1.h b/engines/hpl1/hpl1.h
index 0eb5ab08537..f0493ff0678 100644
--- a/engines/hpl1/hpl1.h
+++ b/engines/hpl1/hpl1.h
@@ -37,6 +37,8 @@
#include "hpl1/detection.h"
+class cInit;
+
namespace Hpl1 {
struct Hpl1GameDescription;
@@ -45,6 +47,7 @@ class Hpl1Engine : public Engine {
private:
const ADGameDescription *_gameDescription;
Common::RandomSource _randomSource;
+ cInit* _gameInit;
protected:
// Engine APIs
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 4866914b501..90396a81978 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -271,7 +271,6 @@ MODULE_OBJS := \
penumbra-overture/Init.o \
penumbra-overture/IntroStory.o \
penumbra-overture/Inventory.o \
- penumbra-overture/Main.o \
penumbra-overture/MainMenu.o \
penumbra-overture/MapHandler.o \
penumbra-overture/MapLoadText.o \
diff --git a/engines/hpl1/penumbra-overture/Main.cpp b/engines/hpl1/penumbra-overture/Main.cpp
deleted file mode 100644
index 101249a366c..00000000000
--- a/engines/hpl1/penumbra-overture/Main.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of Penumbra Overture.
- */
-
-//#include <vld.h>
-
-#include "hpl1/penumbra-overture/Init.h"
-
-#if 0//def WIN32
-#include <windows.h>
-#endif
-
-int hplMain(const tString &asCommandLine) {
- cInit *pInit = hplNew(cInit, ());
-
- bool bRet = pInit->Init(asCommandLine);
-
- if (bRet == false) {
- hplDelete(pInit->mpGame);
- CreateMessageBoxW(_W("Error!"), pInit->msErrorMessage.c_str());
- OpenBrowserWindow(_W("http://support.frictionalgames.com"));
- return 1;
- }
-
- pInit->Run();
-
- pInit->Exit();
-
- hplDelete(pInit);
-
- cMemoryManager::LogResults();
-
- return 0;
-}
Commit: eabf877903eac0b292e4d20e4f2516f81906730d
https://github.com/scummvm/scummvm/commit/eabf877903eac0b292e4d20e4f2516f81906730d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:55+01:00
Commit Message:
HPL1: update game's menu after pause
Changed paths:
engines/hpl1/hpl1.cpp
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index c01484d7984..104107eadaf 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -20,6 +20,7 @@
*/
#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/penumbra-overture/MainMenu.h"
#include "engine/engine.h"
#include "hpl1/hpl1.h"
#include "common/config-manager.h"
@@ -71,6 +72,10 @@ Common::Error Hpl1Engine::run() {
void Hpl1Engine::pauseEngineIntern(bool pause) {
_mixer->pauseAll(pause);
g_system->lockMouse(!pause);
+ // if a save is deleted from the global main menu,
+ // it would still appear on the game's menu
+ if (!pause)
+ _gameInit->mpMainMenu->UpdateWidgets();
}
static Common::String freeSaveSlot(const Engine *engine, const int maxSaves) {
Commit: c9e0b7733cf09936f5e1641776a86f4bf423a7ca
https://github.com/scummvm/scummvm/commit/c9e0b7733cf09936f5e1641776a86f4bf423a7ca
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:55+01:00
Commit Message:
HPL1: implement save loading method
Changed paths:
engines/hpl1/hpl1.cpp
engines/hpl1/hpl1.h
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index 104107eadaf..b9c04ec4dfa 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -21,6 +21,8 @@
#include "hpl1/penumbra-overture/Init.h"
#include "hpl1/penumbra-overture/MainMenu.h"
+#include "hpl1/penumbra-overture/SaveHandler.h"
+#include "hpl1/engine/system/String.h"
#include "engine/engine.h"
#include "hpl1/hpl1.h"
#include "common/config-manager.h"
@@ -124,6 +126,14 @@ Common::StringArray Hpl1Engine::listInternalSaves(const Common::String &pattern)
return internalSaves;
}
+Common::Error Hpl1Engine::loadGameState(int slot) {
+ SaveStateDescriptor a = getMetaEngine()->querySaveMetaInfos(_targetName.c_str(), slot);
+ _gameInit->mpMainMenu->SetActive(false);
+ // FIXME: strings
+ _gameInit->mpSaveHandler->LoadGameFromFile(cString::To16Char(Common::String(a.getDescription()).c_str()));
+ return Common::kNoError;
+}
+
Common::Error Hpl1Engine::syncGame(Common::Serializer &s) {
// The Serializer has methods isLoading() and isSaving()
// if you need to specific steps; for example setting
diff --git a/engines/hpl1/hpl1.h b/engines/hpl1/hpl1.h
index f0493ff0678..cceddd8e00e 100644
--- a/engines/hpl1/hpl1.h
+++ b/engines/hpl1/hpl1.h
@@ -98,6 +98,8 @@ public:
Common::StringArray listInternalSaves(const Common::String &pattern);
+ Common::Error loadGameState(int slot) override;
+
/**
* Uses a serializer to allow implementing savegame
* loading and saving using a single method
Commit: 10f2042131c11f0ffaceba80629ec81bf18b9949
https://github.com/scummvm/scummvm/commit/10f2042131c11f0ffaceba80629ec81bf18b9949
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:56+01:00
Commit Message:
HPL1: implement loading from the launcher
Changed paths:
engines/hpl1/hpl1.cpp
engines/hpl1/penumbra-overture/Init.cpp
engines/hpl1/penumbra-overture/Init.h
engines/hpl1/penumbra-overture/SaveHandler.cpp
engines/hpl1/penumbra-overture/SaveHandler.h
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index b9c04ec4dfa..d2122cd4586 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -59,9 +59,18 @@ Common::String Hpl1Engine::getGameId() const {
return _gameDescription->gameId;
}
+static Common::String getStartupSave(MetaEngine *meta, const char* target) {
+ if (ConfMan.hasKey("save_slot")) {
+ const int saveSlot = ConfMan.getInt("save_slot");
+ const SaveStateDescriptor saveInfo = meta->querySaveMetaInfos(target, saveSlot);
+ return saveInfo.getDescription();
+ }
+ return "";
+}
+
Common::Error Hpl1Engine::run() {
_gameInit = new cInit(); // TODO: remove allocation
- if (!_gameInit->Init("")) {
+ if (!_gameInit->Init(getStartupSave(getMetaEngine(), _targetName.c_str()).c_str())) {
delete _gameInit;
return Common::kUnknownError; // TODO: better errors
};
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 58532120ab8..8ca0f671426 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -224,7 +224,7 @@ void cInit::CreateHardCodedPS(iParticleEmitterData *apPE) {
//-----------------------------------------------------------------------
-bool cInit::Init(tString asCommandLine) {
+bool cInit::Init(tString saveToLoad) {
/*if(asCommandLine != "")
{
Log("CommandLine: %s\n",asCommandLine.c_str());
@@ -597,12 +597,12 @@ bool cInit::Init(tString asCommandLine) {
// mpGame->SetRenderOnce(true);
// mpGame->GetGraphics()->GetRenderer3D()->SetDebugFlags(eRendererDebugFlag_LogRendering);
- if (mbShowPreMenu) {
+ if (saveToLoad == "")
mpPreMenu->SetActive(true);
- } else if (mbShowMenu) {
- mpMainMenu->SetActive(true);
- } else {
- mpMapHandler->Load(msStartMap, msStartLink);
+ else {
+ mpGame->GetInput()->GetLowLevel()->BeginInputUpdate(); // prevents the game from becoming unresponsive
+ mpSaveHandler->LoadGameFromFile(cString::To16Char(saveToLoad), false);
+ mpGame->GetInput()->GetLowLevel()->EndInputUpdate(); // clears the event queue
}
if (gbUsingUserSettings) {
diff --git a/engines/hpl1/penumbra-overture/Init.h b/engines/hpl1/penumbra-overture/Init.h
index 62a17f1190d..09359e65a74 100644
--- a/engines/hpl1/penumbra-overture/Init.h
+++ b/engines/hpl1/penumbra-overture/Init.h
@@ -92,7 +92,7 @@ public:
cInit();
~cInit();
- bool Init(tString asCommandLine);
+ bool Init(tString saveToLoad);
void Run();
void Exit();
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index 68dc5d16b08..463fd0a1635 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -506,10 +506,11 @@ void cSaveHandler::SaveGameToFile(const tWString &asFile) {
//-----------------------------------------------------------------------
-void cSaveHandler::LoadGameFromFile(const tWString &asFile) {
+void cSaveHandler::LoadGameFromFile(const tWString &asFile, bool drawLoadingScreen) {
///////////////////////////////
// Draw loading screen.
- mpInit->mpGraphicsHelper->DrawLoadingScreen("");
+ if (drawLoadingScreen) // if the loading screen has already been drawn, drawing it twice causes bugs
+ mpInit->mpGraphicsHelper->DrawLoadingScreen("");
// 1. Reset everything
// 2. Load all data from file
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.h b/engines/hpl1/penumbra-overture/SaveHandler.h
index d11cd7fdaea..97d6117e28e 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.h
+++ b/engines/hpl1/penumbra-overture/SaveHandler.h
@@ -331,7 +331,7 @@ public:
void LoadData(const tString &asName);
void SaveGameToFile(const tWString &asFile);
- void LoadGameFromFile(const tWString &asFile);
+ void LoadGameFromFile(const tWString &asFile, bool drawLoadingScreen = true);
void AutoSave(const tWString &asDir, int alMaxSaves);
void AutoLoad(const tWString &asDir);
Commit: 63669c95521f91e428592bfa73347fc2afd4d8db
https://github.com/scummvm/scummvm/commit/63669c95521f91e428592bfa73347fc2afd4d8db
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:56+01:00
Commit Message:
HPL1: fix crash in language selection
Changed paths:
engines/hpl1/penumbra-overture/MainMenu.cpp
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index ba2220346d6..979965fb05b 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -1183,7 +1183,7 @@ public:
cMainMenuWidget_Language(cInit *apInit, const cVector3f &avPos, const tWString &asText, cVector2f avFontSize, eFontAlign aAlignment)
: cMainMenuWidget_Button(apInit, avPos, asText, eMainMenuState_LastEnum, avFontSize, aAlignment) {
tStringList lstStrings;
- apInit->mpGame->GetResources()->GetLowLevel()->findFilesInDir(lstStrings, "config/", "*.lang");
+ apInit->mpGame->GetResources()->GetLowLevel()->findFilesInDir(lstStrings, "config", "*.lang");
mlCurrentFile = 0;
int lIdx = 0;
Commit: e3b4ac75b3a7432bb58303f9205b7ad3a6733d93
https://github.com/scummvm/scummvm/commit/e3b4ac75b3a7432bb58303f9205b7ad3a6733d93
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:56+01:00
Commit Message:
HPL1: remove audio section from the game's menu
Changed paths:
engines/hpl1/penumbra-overture/MainMenu.cpp
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 979965fb05b..6271e62d2f3 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -962,99 +962,6 @@ public:
}
};
-//////////////////////////////////////////////////////////////////////////
-// OPTIONS SOUND
-//////////////////////////////////////////////////////////////////////////
-
-cMainMenuWidget_Text *gpSoundVolumeText = NULL;
-cMainMenuWidget_Text *gpSoundHardwareText = NULL;
-cMainMenuWidget_Text *gpSoundOutputDevice = NULL;
-
-class cMainMenuWidget_SoundVolume : public cMainMenuWidget_Button {
-public:
- cMainMenuWidget_SoundVolume(cInit *apInit, const cVector3f &avPos, const tWString &asText, cVector2f avFontSize, eFontAlign aAlignment)
- : cMainMenuWidget_Button(apInit, avPos, asText, eMainMenuState_LastEnum, avFontSize, aAlignment) {
- msTip = kTranslate("MainMenu", "TipSoundVolume");
- }
-
- void OnMouseDown(eMButton aButton) {
- float fVolume = mpInit->mpGame->GetSound()->GetLowLevel()->GetVolume();
-
- if (aButton == eMButton_Left) {
- fVolume += 0.1f;
- if (fVolume > 1.0f)
- fVolume = 1.0f;
- } else if (aButton == eMButton_Right) {
- fVolume -= 0.1f;
- if (fVolume < 0.0f)
- fVolume = 0.0f;
- }
-
- mpInit->mpGame->GetSound()->GetLowLevel()->SetVolume(fVolume);
-
- char sTempVec[256];
- sprintf(sTempVec, "%.0f", mpInit->mpGame->GetSound()->GetLowLevel()->GetVolume() * 100);
- gpSoundVolumeText->msText = cString::To16Char(sTempVec);
- }
-};
-
-class cMainMenuWidget_SoundHardware : public cMainMenuWidget_Button {
-public:
- cMainMenuWidget_SoundHardware(cInit *apInit, const cVector3f &avPos, const tWString &asText, cVector2f avFontSize, eFontAlign aAlignment)
- : cMainMenuWidget_Button(apInit, avPos, asText, eMainMenuState_LastEnum, avFontSize, aAlignment) {
- msTip = kTranslate("MainMenu", "TipSoundHardware");
- }
-
- void OnMouseDown(eMButton aButton) {
- mpInit->mbUseSoundHardware = !mpInit->mbUseSoundHardware;
-
- gpSoundHardwareText->msText = mpInit->mbUseSoundHardware ? kTranslate("MainMenu", "On") : kTranslate("MainMenu", "Off");
-
- gbMustRestart = true;
- }
-};
-
-class cMainMenuWidget_SoundOutputDevice : public cMainMenuWidget_Button {
-public:
- tStringVec mlDevices;
-
- cMainMenuWidget_SoundOutputDevice(cInit *apInit, const cVector3f &avPos, const tWString &asText, cVector2f avFontSize, eFontAlign aAlignment)
- : cMainMenuWidget_Button(apInit, avPos, asText, eMainMenuState_LastEnum, avFontSize, aAlignment) {
- msTip = kTranslate("MainMenu", "TipSoundOutputDevice");
-#if 0
- mlDevices = OAL_Info_GetOutputDevices();
-#endif
- }
-
- void OnMouseDown(eMButton aButton) {
- int lCurrentNum = 0;
-
- // get current num
- for (int i = 0; i < mlDevices.size(); ++i) {
- if (mlDevices[i] == mpInit->msDeviceName) {
- lCurrentNum = i;
- break;
- }
- }
-
- if (aButton == eMButton_Left) {
- lCurrentNum++;
- if (lCurrentNum >= mlDevices.size())
- lCurrentNum = 0;
- } else if (aButton == eMButton_Right) {
- lCurrentNum--;
- if (lCurrentNum < 0)
- lCurrentNum = mlDevices.size() - 1;
- }
-
- mpInit->msDeviceName = mlDevices[lCurrentNum];
-
- gpSoundOutputDevice->msText = cString::To16Char(mpInit->msDeviceName);
-
- gbMustRestart = true;
- }
-};
-
//////////////////////////////////////////////////////////////////////////
// OPTIONS GAME
//////////////////////////////////////////////////////////////////////////
@@ -2643,8 +2550,6 @@ void cMainMenu::CreateWidgets() {
vPos.y += 37;
AddWidgetToState(eMainMenuState_Options, hplNew(cMainMenuWidget_Button, (mpInit, vPos, kTranslate("MainMenu", "Game"), eMainMenuState_OptionsGame, 25, eFontAlign_Center)));
vPos.y += 37;
- AddWidgetToState(eMainMenuState_Options, hplNew(cMainMenuWidget_Button, (mpInit, vPos, kTranslate("MainMenu", "Sound"), eMainMenuState_OptionsSound, 25, eFontAlign_Center)));
- vPos.y += 37;
AddWidgetToState(eMainMenuState_Options, hplNew(cMainMenuWidget_Button, (mpInit, vPos, kTranslate("MainMenu", "Graphics"), eMainMenuState_OptionsGraphics, 25, eFontAlign_Center)));
vPos.y += 37;
AddWidgetToState(eMainMenuState_Options, hplNew(cMainMenuWidget_Button, (mpInit, vPos, kTranslate("MainMenu", "Back"), eMainMenuState_Start, 25, eFontAlign_Center)));
@@ -3023,52 +2928,6 @@ void cMainMenu::CreateWidgets() {
AddWidgetToState(eMainMenuState_OptionsGame, gpDisablePersonalText);
gpDisablePersonalText->SetExtraWidget(pWidgetDisablePersonal);
- ///////////////////////////////////
- // Options Sound
- ///////////////////////////////////
- vPos = vTextStart; // cVector3f(400, 230, 40);
- // Head
- AddWidgetToState(eMainMenuState_OptionsSound, hplNew(cMainMenuWidget_Text, (mpInit, vPos, kTranslate("MainMenu", "Sound"), 25, eFontAlign_Center)));
- vPos.y += 37;
-
- // Buttons
- cMainMenuWidget *pWidgetSoundVolume = hplNew(cMainMenuWidget_SoundVolume, (mpInit, vPos, kTranslate("MainMenu", "Sound Volume:"), 20, eFontAlign_Right));
- AddWidgetToState(eMainMenuState_OptionsSound, pWidgetSoundVolume);
- vPos.y += 29;
- cMainMenuWidget *pWidgetSoundHardware = hplNew(cMainMenuWidget_SoundHardware, (mpInit, vPos, kTranslate("MainMenu", "Use Hardware:"), 20, eFontAlign_Right));
- AddWidgetToState(eMainMenuState_OptionsSound, pWidgetSoundHardware);
- vPos.y += 29;
- cMainMenuWidget *pWidgetSoundOutputDevice = hplNew(cMainMenuWidget_SoundOutputDevice, (mpInit, vPos, kTranslate("MainMenu", "Output Device:"), 20, eFontAlign_Right));
- AddWidgetToState(eMainMenuState_OptionsSound, pWidgetSoundOutputDevice);
- vPos.y += 35;
- AddWidgetToState(eMainMenuState_OptionsSound, hplNew(cMainMenuWidget_GfxBack, (mpInit, vPos, kTranslate("MainMenu", "Back"), 23, eFontAlign_Center)));
-
- // Text
- vPos = cVector3f(vTextStart.x + 12, vTextStart.y + 37, vTextStart.z);
-
- sprintf(sTempVec, "%.0f", mpInit->mpGame->GetSound()->GetLowLevel()->GetVolume() * 100);
- sText = cString::To16Char(sTempVec);
- gpSoundVolumeText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left));
- AddWidgetToState(eMainMenuState_OptionsSound, gpSoundVolumeText);
- gpSoundVolumeText->SetExtraWidget(pWidgetSoundVolume);
-
- vPos.y += 29;
- sText = mpInit->mbUseSoundHardware ? kTranslate("MainMenu", "On") : kTranslate("MainMenu", "Off");
- gpSoundHardwareText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left));
- AddWidgetToState(eMainMenuState_OptionsSound, gpSoundHardwareText);
- gpSoundHardwareText->SetExtraWidget(pWidgetSoundHardware);
-
- vPos.y += 29;
- // Set the default to what's really being used
-#if 0
- mpInit->msDeviceName = tString(OAL_Info_GetDeviceName());
-#endif
-
- sText = cString::To16Char(mpInit->msDeviceName);
- gpSoundOutputDevice = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left));
- AddWidgetToState(eMainMenuState_OptionsSound, gpSoundOutputDevice);
- gpSoundOutputDevice->SetExtraWidget(pWidgetSoundOutputDevice);
-
///////////////////////////////////
// Options Graphics
///////////////////////////////////
Commit: a47377eeaf350f68c49a35bb3b0fad8d8825ff57
https://github.com/scummvm/scummvm/commit/a47377eeaf350f68c49a35bb3b0fad8d8825ff57
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:56+01:00
Commit Message:
HPL1: replace user config file usage
Changed paths:
engines/hpl1/penumbra-overture/Init.cpp
engines/hpl1/penumbra-overture/Init.h
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 8ca0f671426..c73010f298c 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -71,6 +71,8 @@
#include "hpl1/penumbra-overture/Version.h" // cool version .h that uses SVN revision #s
+#include "common/config-manager.h"
+
// Global init...
cInit *gpInit;
@@ -190,7 +192,7 @@ bool gbUsingUserSettings = false;
//-----------------------------------------------------------------------
-cInit::cInit(void) : iUpdateable("Init") {
+cInit::cInit() : iUpdateable("Init") {
mbDestroyGraphics = true;
mbWeaponAttacking = false;
mbResetCache = true;
@@ -205,7 +207,7 @@ cInit::cInit(void) : iUpdateable("Init") {
//-----------------------------------------------------------------------
-cInit::~cInit(void) {
+cInit::~cInit() {
}
//-----------------------------------------------------------------------
@@ -224,17 +226,25 @@ void cInit::CreateHardCodedPS(iParticleEmitterData *apPE) {
//-----------------------------------------------------------------------
-bool cInit::Init(tString saveToLoad) {
- /*if(asCommandLine != "")
- {
- Log("CommandLine: %s\n",asCommandLine.c_str());
- if(cSerialChecker::Validate(asCommandLine)<=0)
- {
- FatalError("Invalid serial number!\n");
- }
- }*/
+static int getIntConfig(const char *name, const int defaultVal) {
+ if (ConfMan.hasKey(name))
+ return ConfMan.getInt(name);
+ return defaultVal;
+}
- // iResourceBase::SetLogCreateAndDelete(true);
+static bool getBoolConfig(const char *name, const bool defaultVal) {
+ if (ConfMan.hasKey(name))
+ return ConfMan.getBool(name);
+ return defaultVal;
+}
+
+static tString getStringConfig(const char *name, const tString &defaultVal) {
+ if (ConfMan.hasKey(name))
+ return ConfMan.get(name).c_str(); // FIXME: strings
+ return defaultVal;
+}
+
+bool cInit::Init(tString saveToLoad) {
SetWindowCaption("Penumbra Loading...");
// PERSONAL DIR /////////////////////
@@ -310,21 +320,19 @@ bool cInit::Init(tString saveToLoad) {
mpGameConfig = hplNew(cConfigFile, (_W("config/game.cfg")));
mpGameConfig->Load();
- mvScreenSize.x = mpConfig->GetInt("Screen", "Width", 800);
- mvScreenSize.y = mpConfig->GetInt("Screen", "Height", 600);
- mbFullScreen = mpConfig->GetBool("Screen", "FullScreen", true);
- mbVsync = mpConfig->GetBool("Screen", "Vsync", false);
- mbLogResources = mpConfig->GetBool("Debug", "LogResources", false);
- mbDebugInteraction = mpConfig->GetBool("Debug", "DebugInteraction", false);
-
- msWebPageOnExit = mpConfig->GetString("Demo", "WebPageOnExit", "http://www.Penumbra-Overture.com");
+ mvScreenSize.x = getIntConfig("screen-width", 800);
+ mvScreenSize.y = getIntConfig("screen-height", 600);
+ mbFullScreen = ConfMan.getBool("fullscreen");
+ mbVsync = ConfMan.getBool("vsync");
+ mbLogResources = false;
+ mbDebugInteraction = false;
- mbSubtitles = mpConfig->GetBool("Game", "Subtitles", true);
- mbSimpleWeaponSwing = mpConfig->GetBool("Game", "SimpleWeaponSwing", false);
- mbDisablePersonalNotes = mpConfig->GetBool("Game", "DisablePersonalNotes", false);
- mbAllowQuickSave = mpConfig->GetBool("Game", "AllowQuickSave", false);
- mbFlashItems = mpConfig->GetBool("Game", "FlashItems", true);
- mbShowCrossHair = mpConfig->GetBool("Game", "ShowCrossHair", false);
+ mbSubtitles = ConfMan.getBool("subtitles");
+ mbSimpleWeaponSwing = getBoolConfig("simple_weapon_swing", false);
+ mbDisablePersonalNotes = getBoolConfig("disable_personal_notes", false);
+ mbAllowQuickSave = getBoolConfig("allow_quick_save", false);
+ mbFlashItems = getBoolConfig("flash_items", true);
+ mbShowCrossHair = getBoolConfig("show_crosshair", false);
mbHapticsAvailable = mpConfig->GetBool("Haptics", "Available", false);
if (mbHapticsAvailable) {
@@ -343,20 +351,18 @@ bool cInit::Init(tString saveToLoad) {
mbSimpleSwingInOptions = mpConfig->GetBool("Game", "SimpleSwingInOptions", mbHapticsAvailable ? true : false);
- msGlobalScriptFile = mpConfig->GetString("Map", "GlobalScript", "global_script.hps");
- msLanguageFile = mpConfig->GetString("Game", "LanguageFile", "english.lang");
- msCurrentUser = mpConfig->GetString("Game", "CurrentUser", "default");
- mDifficulty = (eGameDifficulty)mpConfig->GetInt("Game", "Difficulty", 1);
+ msGlobalScriptFile = getStringConfig("global_script", "global_script.hps");
+ msLanguageFile = "English.lang"; // TODO: replace with proper language support
+ mDifficulty = static_cast<eGameDifficulty>(getIntConfig("difficulty", eGameDifficulty_Normal));
- msStartMap = mpConfig->GetString("Map", "File", "level00_01_boat_cabin.dae");
- msStartLink = mpConfig->GetString("Map", "StartPos", "link01");
+ msStartMap = getStringConfig("starting_map", "level00_01_boat_cabin.dae");
+ msStartLink = getStringConfig("starting_map_position", "link01");
+ mlFSAA = getIntConfig("fsaa", 0);
+ mbPostEffects = getBoolConfig("post_effects", true);
+ iMaterial::SetQuality(static_cast<eMaterialQuality>(getIntConfig("shader_quality", eMaterialQuality_High)));
- mlFSAA = mpConfig->GetInt("Graphics", "FSAA", 0);
- mbPostEffects = mpConfig->GetBool("Graphics", "PostEffects", true);
- iMaterial::SetQuality((eMaterialQuality)mpConfig->GetInt("Graphics", "ShaderQuality", eMaterialQuality_High));
-
- mPhysicsAccuracy = (ePhysicsAccuracy)mpConfig->GetInt("Physics", "Accuracy", ePhysicsAccuracy_High);
- mfPhysicsUpdatesPerSec = mpConfig->GetFloat("Physics", "UpdatesPerSec", 60.0f);
+ mPhysicsAccuracy = static_cast<ePhysicsAccuracy>(getIntConfig("physics_accuracy", ePhysicsAccuracy_High));
+ mfPhysicsUpdatesPerSec = static_cast<float>(getIntConfig("physics_updates_per_second", 60));
mlMaxSoundChannels = mpConfig->GetInt("Sound", "MaxSoundChannels", 32);
mbUseSoundHardware = mpConfig->GetBool("Sound", "UseSoundHardware", false);
@@ -395,10 +401,6 @@ bool cInit::Init(tString saveToLoad) {
Vars.AddBool("LowLevelSoundLogging", mpConfig->GetBool("Sound", "LowLevelLogging", false));
- // Set CG Options
- //cCGProgram::SetFProfile(mpConfig->GetString("Graphics", "ForceFP", "AUTO"));
- //cCGProgram::SetVProfile(mpConfig->GetString("Graphics", "ForceVP", "AUTO"));
-
LowLevelGameSetup *pSetUp = NULL;
pSetUp = hplNew(LowLevelGameSetup, ());
@@ -419,9 +421,9 @@ bool cInit::Init(tString saveToLoad) {
mpGame->GetGraphics()->GetLowLevel()->SetVsyncActive(mbVsync);
- mbShowPreMenu = mpConfig->GetBool("Game", "ShowPreMenu", true);
- mbShowMenu = mpConfig->GetBool("Game", "ShowMenu", true);
- mbShowIntro = mpConfig->GetBool("Game", "ShowIntro", true);
+ mbShowPreMenu = getBoolConfig("show_pre_menu", true);
+ mbShowIntro = getBoolConfig("show_intro", true);
+ mbShowMenu = getBoolConfig("show_menu", true);
mfMaxPhysicsTimeStep = 1.0f / mfPhysicsUpdatesPerSec;
@@ -464,7 +466,7 @@ bool cInit::Init(tString saveToLoad) {
mpGraphicsHelper->DrawLoadingScreen("");
// SOUND ////////////////////////////////
- mpGame->GetSound()->GetLowLevel()->SetVolume(mpConfig->GetFloat("Sound", "Volume", 1));
+ mpGame->GetSound()->GetLowLevel()->SetVolume(1);
// PHYSICS INIT /////////////////////
mpGame->GetPhysics()->LoadSurfaceData("materials.cfg", mpGame->GetHaptic());
@@ -474,25 +476,25 @@ bool cInit::Init(tString saveToLoad) {
// GRAPHICS INIT ////////////////////
mpGame->GetGraphics()->GetRendererPostEffects()->SetActive(mbPostEffects);
- mpGame->GetGraphics()->GetRendererPostEffects()->SetBloomActive(mpConfig->GetBool("Graphics", "Bloom", true));
+ mpGame->GetGraphics()->GetRendererPostEffects()->SetBloomActive(getBoolConfig("bloom", true));
mpGame->GetGraphics()->GetRendererPostEffects()->SetBloomSpread(6);
- mpGame->GetGraphics()->GetRendererPostEffects()->SetMotionBlurActive(mpConfig->GetBool("Graphics", "MotionBlur", false));
- mpGame->GetGraphics()->GetRendererPostEffects()->SetMotionBlurAmount(mpConfig->GetFloat("Graphics", "MotionBlurAmount", 0.3f));
+ mpGame->GetGraphics()->GetRendererPostEffects()->SetMotionBlurActive(getBoolConfig("motion_blur", false));
+ mpGame->GetGraphics()->GetRendererPostEffects()->SetMotionBlurAmount(static_cast<float>(getIntConfig("motion_blur_amount", 300)) / 1000.f);
- mpGame->GetGraphics()->GetRenderer3D()->SetRefractionUsed(mpConfig->GetBool("Graphics", "Refractions", false));
+ mpGame->GetGraphics()->GetRenderer3D()->SetRefractionUsed(getBoolConfig("refractions", false));
- mpEffectHandler->GetDepthOfField()->SetDisabled(!mpConfig->GetBool("Graphics", "DepthOfField", true));
+ mpEffectHandler->GetDepthOfField()->SetDisabled(!getBoolConfig("depth_of_field", true));
- mpGame->GetResources()->GetMaterialManager()->SetTextureSizeLevel(mpConfig->GetInt("Graphics", "TextureSizeLevel", 0));
- mpGame->GetResources()->GetMaterialManager()->SetTextureFilter((eTextureFilter)mpConfig->GetInt("Graphics", "TextureFilter", 0));
+ mpGame->GetResources()->GetMaterialManager()->SetTextureSizeLevel(getIntConfig("texture_size_level", 0));
+ mpGame->GetResources()->GetMaterialManager()->SetTextureFilter(static_cast<eTextureFilter>(getIntConfig("texture_filter", eTextureFilter_Bilinear)));
mpGame->GetResources()->GetMaterialManager()->SetTextureAnisotropy(mpConfig->GetFloat("Graphics", "TextureAnisotropy", 1.0f));
- mpGame->GetGraphics()->GetLowLevel()->SetGammaCorrection(mpConfig->GetFloat("Graphics", "Gamma", 1.0f));
+ mpGame->GetGraphics()->GetLowLevel()->SetGammaCorrection(static_cast<float>(getIntConfig("gamma", 1000)) / 1000.f);
- mpGame->GetGraphics()->GetRenderer3D()->SetShowShadows((eRendererShowShadows)mpConfig->GetInt("Graphics", "Shadows", 0));
+ mpGame->GetGraphics()->GetRenderer3D()->SetShowShadows(static_cast<eRendererShowShadows>(getIntConfig("shadows", eRendererShowShadows_All)));
- mpGame->SetLimitFPS(mpConfig->GetBool("Graphics", "LimitFPS", true));
+ mpGame->SetLimitFPS(getBoolConfig("limit_fps", true));
// HAPTIC INIT ////////////////////
if (mbHasHaptics) {
@@ -588,18 +590,15 @@ bool cInit::Init(tString saveToLoad) {
mpGlobalScript->Run("OnInit()");
}
- // mpGraphicsHelper->DrawLoadingScreen("");
-
- // mpIntroStory->SetActive(true);
- // mpCredits->SetActive(true);
- // mpDemoEndText->SetActive(true);
-
- // mpGame->SetRenderOnce(true);
- // mpGame->GetGraphics()->GetRenderer3D()->SetDebugFlags(eRendererDebugFlag_LogRendering);
-
- if (saveToLoad == "")
- mpPreMenu->SetActive(true);
- else {
+ if (saveToLoad == "") {
+ if (mbShowPreMenu) {
+ mpPreMenu->SetActive(true);
+ } else if (mbShowMenu) {
+ mpMainMenu->SetActive(true);
+ } else {
+ mpMapHandler->Load(msStartMap, msStartLink);
+ }
+ } else {
mpGame->GetInput()->GetLowLevel()->BeginInputUpdate(); // prevents the game from becoming unresponsive
mpSaveHandler->LoadGameFromFile(cString::To16Char(saveToLoad), false);
mpGame->GetInput()->GetLowLevel()->EndInputUpdate(); // clears the event queue
@@ -740,13 +739,12 @@ void cInit::Exit() {
Log(" Saving config\n");
// Save engine stuff.
- mpConfig->SetBool("Graphics", "Bloom", mpGame->GetGraphics()->GetRendererPostEffects()->GetBloomActive());
- mpConfig->SetBool("Graphics", "MotionBlur", mpGame->GetGraphics()->GetRendererPostEffects()->GetMotionBlurActive());
- mpConfig->SetFloat("Graphics", "MotionBlurAmount", mpGame->GetGraphics()->GetRendererPostEffects()->GetMotionBlurAmount());
- mpConfig->SetBool("Graphics", "DepthOfField", !mpEffectHandler->GetDepthOfField()->IsDisabled());
- mpConfig->GetBool("Graphics", "Refractions", mpGame->GetGraphics()->GetRenderer3D()->GetRefractionUsed());
+ ConfMan.setBool("bloom", mpGame->GetGraphics()->GetRendererPostEffects()->GetBloomActive());
+ ConfMan.setBool("motion_blur", mpGame->GetGraphics()->GetRendererPostEffects()->GetMotionBlurActive());
+ ConfMan.setBool("depth_of_field", !mpEffectHandler->GetDepthOfField()->IsDisabled());
+ ConfMan.setInt("motion_blur_amount", static_cast<int>(mpGame->GetGraphics()->GetRendererPostEffects()->GetMotionBlurAmount() * 1000.f));
+ ConfMan.setBool("refractions", mpGame->GetGraphics()->GetRenderer3D()->GetRefractionUsed());
- mpConfig->SetFloat("Sound", "Volume", mpGame->GetSound()->GetLowLevel()->GetVolume());
mpConfig->SetBool("Sound", "UseSoundHardware", mbUseSoundHardware);
mpConfig->SetInt("Sound", "MaxSoundChannels", mlMaxSoundChannels);
mpConfig->SetInt("Sound", "StreamUpdateFreq", mlStreamUpdateFreq);
@@ -755,18 +753,18 @@ void cInit::Exit() {
mpConfig->SetInt("Sound", "MaxStereoChannelsHint", mlMaxStereoChannelsHint);
mpConfig->SetString("Sound", "DeviceName", msDeviceName);
- mpConfig->SetInt("Graphics", "TextureSizeLevel", mpGame->GetResources()->GetMaterialManager()->GetTextureSizeLevel());
- mpConfig->SetInt("Graphics", "TextureFilter", mpGame->GetResources()->GetMaterialManager()->GetTextureFilter());
- mpConfig->SetFloat("Graphics", "TextureAnisotropy", mpGame->GetResources()->GetMaterialManager()->GetTextureAnisotropy());
+ ConfMan.setInt("texture_size_level", mpGame->GetResources()->GetMaterialManager()->GetTextureSizeLevel());
+ ConfMan.setInt("texture_filter", mpGame->GetResources()->GetMaterialManager()->GetTextureFilter());
+ // mpConfig->SetFloat("Graphics", "TextureAnisotropy", mpGame->GetResources()->GetMaterialManager()->GetTextureAnisotropy());
- mpConfig->SetFloat("Graphics", "Gamma", mpGame->GetGraphics()->GetLowLevel()->GetGammaCorrection());
+ ConfMan.setInt("gamma", mpGame->GetGraphics()->GetLowLevel()->GetGammaCorrection() * 1000.f);
- mpConfig->SetInt("Graphics", "FSAA", mlFSAA);
- mpConfig->SetBool("Graphics", "PostEffects", mbPostEffects);
- mpConfig->SetInt("Graphics", "ShaderQuality", iMaterial::GetQuality());
- mpConfig->SetBool("Graphics", "LimitFPS", mpGame->GetLimitFPS());
+ ConfMan.setInt("fsaa", mlFSAA);
+ ConfMan.setBool("post_effects", mbPostEffects);
+ ConfMan.setInt("shader_quality", iMaterial::GetQuality());
+ ConfMan.setBool("limit_fps", mpGame->GetLimitFPS());
- mpConfig->SetInt("Graphics", "Shadows", mpGame->GetGraphics()->GetRenderer3D()->GetShowShadows());
+ ConfMan.setInt("shadows", mpGame->GetGraphics()->GetRenderer3D()->GetShowShadows());
Log(" Exit Effect Handler\n");
hplDelete(mpEffectHandler);
@@ -779,48 +777,33 @@ void cInit::Exit() {
Log(" Saving last config\n");
// Save the stuff to the config file
- mpConfig->SetInt("Screen", "Width", mvScreenSize.x);
- mpConfig->SetInt("Screen", "Height", mvScreenSize.y);
- mpConfig->SetBool("Screen", "FullScreen", mbFullScreen);
- mpConfig->SetBool("Screen", "Vsync", mbVsync);
-
- mpConfig->SetString("Demo", "WebPageOnExit", msWebPageOnExit);
-
- mpConfig->SetString("Map", "GlobalScript", msGlobalScriptFile);
+ ConfMan.setInt("screen-width", mvScreenSize.x);
+ ConfMan.setInt("screen-height", mvScreenSize.y);
- mpConfig->SetBool("Game", "Subtitles", mbSubtitles);
- mpConfig->SetBool("Game", "SimpleWeaponSwing", mbSimpleWeaponSwing);
- mpConfig->SetBool("Game", "DisablePersonalNotes", mbDisablePersonalNotes);
- mpConfig->SetBool("Game", "AllowQuickSave", mbAllowQuickSave);
- mpConfig->SetBool("Game", "FlashItems", mbFlashItems);
- mpConfig->SetBool("Game", "ShowCrossHair", mbShowCrossHair);
+ ConfMan.set("global_script", msGlobalScriptFile.c_str()); // FIXME: strings
- mpConfig->SetBool("Game", "SimpleSwingInOptions", mbSimpleSwingInOptions);
+ ConfMan.setBool("simple_weapon_swing", mbSimpleWeaponSwing);
+ ConfMan.setBool("disable_personal_notes", mbDisablePersonalNotes);
+ ConfMan.setBool("allow_quick_save", true);
+ ConfMan.setBool("flash_tems", mbFlashItems);
+ ConfMan.setBool("show_crosshair", mbShowCrossHair);
- mpConfig->SetString("Map", "File", msStartMap);
- mpConfig->SetString("Map", "StartPos", msStartLink);
+ ConfMan.set("starting_map", msStartMap.c_str()); // FIXME: strings
+ ConfMan.set("starting_map_position", msStartLink.c_str()); // FIXME: strings
- mpConfig->SetInt("Game", "Difficulty", mDifficulty);
- mpConfig->SetString("Game", "CurrentUser", msCurrentUser);
- mpConfig->SetString("Game", "LanguageFile", msLanguageFile);
- mpConfig->SetBool("Game", "ShowPreMenu", mbShowPreMenu);
- mpConfig->SetBool("Game", "ShowMenu", mbShowMenu);
- mpConfig->SetBool("Game", "ShowIntro", mbShowIntro);
+ ConfMan.setInt("difficulty", mDifficulty);
- mpConfig->SetInt("Physics", "PhysicsAccuracy", mPhysicsAccuracy);
- mpConfig->SetFloat("Physics", "UpdatesPerSec", mfPhysicsUpdatesPerSec);
+ ConfMan.setInt("physics_accuracy", mPhysicsAccuracy);
+ ConfMan.setInt("physics_updates_per_second", static_cast<int>(mfPhysicsUpdatesPerSec));
- mpConfig->SetBool("Debug", "LogResources", mbLogResources);
+ ConfMan.setBool("show_pre_menu", mbShowPreMenu);
+ ConfMan.setBool("show_menu", mbShowMenu);
+ ConfMan.setBool("show_intro", mbShowIntro);
- mpConfig->Save();
hplDelete(mpConfig);
hplDelete(mpGameConfig);
-
-#ifdef DEMO_VERSION
- if (msWebPageOnExit != "")
- OpenBrowserWindow(cString::To16Char(msWebPageOnExit));
-#endif
+ ConfMan.flushToDisk();
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/Init.h b/engines/hpl1/penumbra-overture/Init.h
index 09359e65a74..4fa489999b6 100644
--- a/engines/hpl1/penumbra-overture/Init.h
+++ b/engines/hpl1/penumbra-overture/Init.h
@@ -164,8 +164,6 @@ public:
tWString msErrorMessage;
- tString msWebPageOnExit;
-
bool mbDebugInteraction;
float mfMaxPhysicsTimeStep;
bool mbDestroyGraphics; // If graphics should be destroyed by the entities. Set to false at map change.
@@ -176,8 +174,6 @@ public:
bool mbWeaponAttacking; // To see if it is a weapon that is dealing the damage.
- tString msCurrentUser;
-
// Game objects
cMapHandler *mpMapHandler;
cButtonHandler *mpButtonHandler;
Commit: 5a6d6cb557d7b922c5d6dbaeed1f51c780aeabf0
https://github.com/scummvm/scummvm/commit/5a6d6cb557d7b922c5d6dbaeed1f51c780aeabf0
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:56+01:00
Commit Message:
HPL1: fix string comparison
Changed paths:
engines/hpl1/engine/system/SerializeClass.cpp
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index 822b82b46fb..cb5b691729f 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -78,7 +78,7 @@ cSerializeMemberFieldIterator::cSerializeMemberFieldIterator(cSerializeSavedClas
// Make sure that the first field type is not null
if (mpSavedClass && mpSavedClass->mpMemberFields[mlFieldNum].mType == eSerializeType_NULL) {
- if (mpSavedClass->msParentName != "") {
+ if (mpSavedClass->msParentName[0] != '\0') {
cSerializeSavedClass *pClass = cSerializeClass::GetClass(mpSavedClass->msParentName);
if (pClass) {
mpSavedClass = pClass;
@@ -106,7 +106,7 @@ cSerializeMemberField *cSerializeMemberFieldIterator::GetNext() {
mlFieldNum++;
if (mpSavedClass->mpMemberFields[mlFieldNum].mType == eSerializeType_NULL) {
- if (mpSavedClass->msParentName != "") {
+ if (mpSavedClass->msParentName[0] != '\0') {
cSerializeSavedClass *pClass = cSerializeClass::GetClass(mpSavedClass->msParentName);
if (pClass) {
mpSavedClass = pClass;
Commit: 1257df0654cbba9a5e6eb303d4eebe00481e5ee4
https://github.com/scummvm/scummvm/commit/1257df0654cbba9a5e6eb303d4eebe00481e5ee4
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:56+01:00
Commit Message:
HPL1: add array add-on for the scripting library
Changed paths:
A engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
A engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.h
engines/hpl1/engine/system/low_level_system.cpp
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
new file mode 100644
index 00000000000..169b566ca50
--- /dev/null
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
@@ -0,0 +1,2199 @@
+#include <new>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <stdio.h> // sprintf
+#include <string>
+#include <algorithm> // std::sort
+
+#include "scriptarray.h"
+
+using namespace std;
+
+BEGIN_AS_NAMESPACE
+
+// This macro is used to avoid warnings about unused variables.
+// Usually where the variables are only used in debug mode.
+#define UNUSED_VAR(x) (void)(x)
+
+// Set the default memory routines
+// Use the angelscript engine's memory routines by default
+static asALLOCFUNC_t userAlloc = asAllocMem;
+static asFREEFUNC_t userFree = asFreeMem;
+
+// Allows the application to set which memory routines should be used by the array object
+void CScriptArray::SetMemoryFunctions(asALLOCFUNC_t allocFunc, asFREEFUNC_t freeFunc)
+{
+ userAlloc = allocFunc;
+ userFree = freeFunc;
+}
+
+static void RegisterScriptArray_Native(asIScriptEngine *engine);
+static void RegisterScriptArray_Generic(asIScriptEngine *engine);
+
+struct SArrayBuffer
+{
+ asDWORD maxElements;
+ asDWORD numElements;
+ asBYTE data[1];
+};
+
+struct SArrayCache
+{
+ asIScriptFunction *cmpFunc;
+ asIScriptFunction *eqFunc;
+ int cmpFuncReturnCode; // To allow better error message in case of multiple matches
+ int eqFuncReturnCode;
+};
+
+// We just define a number here that we assume nobody else is using for
+// object type user data. The add-ons have reserved the numbers 1000
+// through 1999 for this purpose, so we should be fine.
+const asPWORD ARRAY_CACHE = 1000;
+
+static void CleanupTypeInfoArrayCache(asITypeInfo *type)
+{
+ SArrayCache *cache = reinterpret_cast<SArrayCache*>(type->GetUserData(ARRAY_CACHE));
+ if( cache )
+ {
+ cache->~SArrayCache();
+ userFree(cache);
+ }
+}
+
+CScriptArray* CScriptArray::Create(asITypeInfo *ti, asUINT length)
+{
+ // Allocate the memory
+ void *mem = userAlloc(sizeof(CScriptArray));
+ if( mem == 0 )
+ {
+ asIScriptContext *ctx = asGetActiveContext();
+ if( ctx )
+ ctx->SetException("Out of memory");
+
+ return 0;
+ }
+
+ // Initialize the object
+ CScriptArray *a = new(mem) CScriptArray(length, ti);
+
+ return a;
+}
+
+CScriptArray* CScriptArray::Create(asITypeInfo *ti, void *initList)
+{
+ // Allocate the memory
+ void *mem = userAlloc(sizeof(CScriptArray));
+ if( mem == 0 )
+ {
+ asIScriptContext *ctx = asGetActiveContext();
+ if( ctx )
+ ctx->SetException("Out of memory");
+
+ return 0;
+ }
+
+ // Initialize the object
+ CScriptArray *a = new(mem) CScriptArray(ti, initList);
+
+ return a;
+}
+
+CScriptArray* CScriptArray::Create(asITypeInfo *ti, asUINT length, void *defVal)
+{
+ // Allocate the memory
+ void *mem = userAlloc(sizeof(CScriptArray));
+ if( mem == 0 )
+ {
+ asIScriptContext *ctx = asGetActiveContext();
+ if( ctx )
+ ctx->SetException("Out of memory");
+
+ return 0;
+ }
+
+ // Initialize the object
+ CScriptArray *a = new(mem) CScriptArray(length, defVal, ti);
+
+ return a;
+}
+
+CScriptArray* CScriptArray::Create(asITypeInfo *ti)
+{
+ return CScriptArray::Create(ti, asUINT(0));
+}
+
+// This optional callback is called when the template type is first used by the compiler.
+// It allows the application to validate if the template can be instantiated for the requested
+// subtype at compile time, instead of at runtime. The output argument dontGarbageCollect
+// allow the callback to tell the engine if the template instance type shouldn't be garbage collected,
+// i.e. no asOBJ_GC flag.
+static bool ScriptArrayTemplateCallback(asITypeInfo *ti, bool &dontGarbageCollect)
+{
+ // Make sure the subtype can be instantiated with a default factory/constructor,
+ // otherwise we won't be able to instantiate the elements.
+ int typeId = ti->GetSubTypeId();
+ if( typeId == asTYPEID_VOID )
+ return false;
+ if( (typeId & asTYPEID_MASK_OBJECT) && !(typeId & asTYPEID_OBJHANDLE) )
+ {
+ asITypeInfo *subtype = ti->GetEngine()->GetTypeInfoById(typeId);
+ asDWORD flags = subtype->GetFlags();
+ if( (flags & asOBJ_VALUE) && !(flags & asOBJ_POD) )
+ {
+ // Verify that there is a default constructor
+ bool found = false;
+ for( asUINT n = 0; n < subtype->GetBehaviourCount(); n++ )
+ {
+ asEBehaviours beh;
+ asIScriptFunction *func = subtype->GetBehaviourByIndex(n, &beh);
+ if( beh != asBEHAVE_CONSTRUCT ) continue;
+
+ if( func->GetParamCount() == 0 )
+ {
+ // Found the default constructor
+ found = true;
+ break;
+ }
+ }
+
+ if( !found )
+ {
+ // There is no default constructor
+ // TODO: Should format the message to give the name of the subtype for better understanding
+ ti->GetEngine()->WriteMessage("array", 0, 0, asMSGTYPE_ERROR, "The subtype has no default constructor");
+ return false;
+ }
+ }
+ else if( (flags & asOBJ_REF) )
+ {
+ bool found = false;
+
+ // If value assignment for ref type has been disabled then the array
+ // can be created if the type has a default factory function
+ if( !ti->GetEngine()->GetEngineProperty(asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE) )
+ {
+ // Verify that there is a default factory
+ for( asUINT n = 0; n < subtype->GetFactoryCount(); n++ )
+ {
+ asIScriptFunction *func = subtype->GetFactoryByIndex(n);
+ if( func->GetParamCount() == 0 )
+ {
+ // Found the default factory
+ found = true;
+ break;
+ }
+ }
+ }
+
+ if( !found )
+ {
+ // No default factory
+ // TODO: Should format the message to give the name of the subtype for better understanding
+ ti->GetEngine()->WriteMessage("array", 0, 0, asMSGTYPE_ERROR, "The subtype has no default factory");
+ return false;
+ }
+ }
+
+ // If the object type is not garbage collected then the array also doesn't need to be
+ if( !(flags & asOBJ_GC) )
+ dontGarbageCollect = true;
+ }
+ else if( !(typeId & asTYPEID_OBJHANDLE) )
+ {
+ // Arrays with primitives cannot form circular references,
+ // thus there is no need to garbage collect them
+ dontGarbageCollect = true;
+ }
+ else
+ {
+ assert( typeId & asTYPEID_OBJHANDLE );
+
+ // It is not necessary to set the array as garbage collected for all handle types.
+ // If it is possible to determine that the handle cannot refer to an object type
+ // that can potentially form a circular reference with the array then it is not
+ // necessary to make the array garbage collected.
+ asITypeInfo *subtype = ti->GetEngine()->GetTypeInfoById(typeId);
+ asDWORD flags = subtype->GetFlags();
+ if( !(flags & asOBJ_GC) )
+ {
+ if( (flags & asOBJ_SCRIPT_OBJECT) )
+ {
+ // Even if a script class is by itself not garbage collected, it is possible
+ // that classes that derive from it may be, so it is not possible to know
+ // that no circular reference can occur.
+ if( (flags & asOBJ_NOINHERIT) )
+ {
+ // A script class declared as final cannot be inherited from, thus
+ // we can be certain that the object cannot be garbage collected.
+ dontGarbageCollect = true;
+ }
+ }
+ else
+ {
+ // For application registered classes we assume the application knows
+ // what it is doing and don't mark the array as garbage collected unless
+ // the type is also garbage collected.
+ dontGarbageCollect = true;
+ }
+ }
+ }
+
+ // The type is ok
+ return true;
+}
+
+// Registers the template array type
+void RegisterScriptArray(asIScriptEngine *engine, bool defaultArray)
+{
+ if( strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY") == 0 )
+ RegisterScriptArray_Native(engine);
+ else
+ RegisterScriptArray_Generic(engine);
+
+ if( defaultArray )
+ {
+ int r = engine->RegisterDefaultArrayType("array<T>"); assert( r >= 0 );
+ UNUSED_VAR(r);
+ }
+}
+
+static void RegisterScriptArray_Native(asIScriptEngine *engine)
+{
+ int r = 0;
+ UNUSED_VAR(r);
+
+ // Register the object type user data clean up
+ engine->SetTypeInfoUserDataCleanupCallback(CleanupTypeInfoArrayCache, ARRAY_CACHE);
+
+ // Register the array type as a template
+ r = engine->RegisterObjectType("array<class T>", 0, asOBJ_REF | asOBJ_GC | asOBJ_TEMPLATE); assert( r >= 0 );
+
+ // Register a callback for validating the subtype before it is used
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_TEMPLATE_CALLBACK, "bool f(int&in, bool&out)", asFUNCTION(ScriptArrayTemplateCallback), asCALL_CDECL); assert( r >= 0 );
+
+ // Templates receive the object type as the first parameter. To the script writer this is hidden
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in)", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo*), CScriptArray*), asCALL_CDECL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in, uint length) explicit", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo*, asUINT), CScriptArray*), asCALL_CDECL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in, uint length, const T &in value)", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo*, asUINT, void *), CScriptArray*), asCALL_CDECL); assert( r >= 0 );
+
+ // Register the factory that will be used for initialization lists
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_LIST_FACTORY, "array<T>@ f(int&in type, int&in list) {repeat T}", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo*, void*), CScriptArray*), asCALL_CDECL); assert( r >= 0 );
+
+ // The memory management methods
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_ADDREF, "void f()", asMETHOD(CScriptArray,AddRef), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_RELEASE, "void f()", asMETHOD(CScriptArray,Release), asCALL_THISCALL); assert( r >= 0 );
+
+ // The index operator returns the template subtype
+ r = engine->RegisterObjectMethod("array<T>", "T &opIndex(uint index)", asMETHODPR(CScriptArray, At, (asUINT), void*), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "const T &opIndex(uint index) const", asMETHODPR(CScriptArray, At, (asUINT) const, const void*), asCALL_THISCALL); assert( r >= 0 );
+
+ // The assignment operator
+ r = engine->RegisterObjectMethod("array<T>", "array<T> &opAssign(const array<T>&in)", asMETHOD(CScriptArray, operator=), asCALL_THISCALL); assert( r >= 0 );
+
+ // Other methods
+ r = engine->RegisterObjectMethod("array<T>", "void insertAt(uint index, const T&in value)", asMETHODPR(CScriptArray, InsertAt, (asUINT, void *), void), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void insertAt(uint index, const array<T>& arr)", asMETHODPR(CScriptArray, InsertAt, (asUINT, const CScriptArray &), void), asCALL_THISCALL); assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void insertLast(const T&in value)", asMETHOD(CScriptArray, InsertLast), asCALL_THISCALL); assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void removeAt(uint index)", asMETHOD(CScriptArray, RemoveAt), asCALL_THISCALL); assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void removeLast()", asMETHOD(CScriptArray, RemoveLast), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void removeRange(uint start, uint count)", asMETHOD(CScriptArray, RemoveRange), asCALL_THISCALL); assert(r >= 0);
+ // TODO: Should length() and resize() be deprecated as the property accessors do the same thing?
+ // TODO: Register as size() for consistency with other types
+#if AS_USE_ACCESSORS != 1
+ r = engine->RegisterObjectMethod("array<T>", "uint length() const", asMETHOD(CScriptArray, GetSize), asCALL_THISCALL); assert( r >= 0 );
+#endif
+ r = engine->RegisterObjectMethod("array<T>", "void reserve(uint length)", asMETHOD(CScriptArray, Reserve), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void resize(uint length)", asMETHODPR(CScriptArray, Resize, (asUINT), void), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void sortAsc()", asMETHODPR(CScriptArray, SortAsc, (), void), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void sortAsc(uint startAt, uint count)", asMETHODPR(CScriptArray, SortAsc, (asUINT, asUINT), void), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void sortDesc()", asMETHODPR(CScriptArray, SortDesc, (), void), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void sortDesc(uint startAt, uint count)", asMETHODPR(CScriptArray, SortDesc, (asUINT, asUINT), void), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void reverse()", asMETHOD(CScriptArray, Reverse), asCALL_THISCALL); assert( r >= 0 );
+ // The token 'if_handle_then_const' tells the engine that if the type T is a handle, then it should refer to a read-only object
+ r = engine->RegisterObjectMethod("array<T>", "int find(const T&in if_handle_then_const value) const", asMETHODPR(CScriptArray, Find, (void*) const, int), asCALL_THISCALL); assert( r >= 0 );
+ // TODO: It should be "int find(const T&in value, uint startAt = 0) const"
+ r = engine->RegisterObjectMethod("array<T>", "int find(uint startAt, const T&in if_handle_then_const value) const", asMETHODPR(CScriptArray, Find, (asUINT, void*) const, int), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "int findByRef(const T&in if_handle_then_const value) const", asMETHODPR(CScriptArray, FindByRef, (void*) const, int), asCALL_THISCALL); assert( r >= 0 );
+ // TODO: It should be "int findByRef(const T&in value, uint startAt = 0) const"
+ r = engine->RegisterObjectMethod("array<T>", "int findByRef(uint startAt, const T&in if_handle_then_const value) const", asMETHODPR(CScriptArray, FindByRef, (asUINT, void*) const, int), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "bool opEquals(const array<T>&in) const", asMETHOD(CScriptArray, operator==), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "bool isEmpty() const", asMETHOD(CScriptArray, IsEmpty), asCALL_THISCALL); assert( r >= 0 );
+
+ // Sort with callback for comparison
+ r = engine->RegisterFuncdef("bool array<T>::less(const T&in if_handle_then_const a, const T&in if_handle_then_const b)");
+ r = engine->RegisterObjectMethod("array<T>", "void sort(const less &in, uint startAt = 0, uint count = uint(-1))", asMETHODPR(CScriptArray, Sort, (asIScriptFunction*, asUINT, asUINT), void), asCALL_THISCALL); assert(r >= 0);
+
+#if AS_USE_STLNAMES != 1 && AS_USE_ACCESSORS == 1
+ // Register virtual properties
+ r = engine->RegisterObjectMethod("array<T>", "uint get_length() const property", asMETHOD(CScriptArray, GetSize), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void set_length(uint) property", asMETHODPR(CScriptArray, Resize, (asUINT), void), asCALL_THISCALL); assert( r >= 0 );
+#endif
+
+ // Register GC behaviours in case the array needs to be garbage collected
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_GETREFCOUNT, "int f()", asMETHOD(CScriptArray, GetRefCount), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_SETGCFLAG, "void f()", asMETHOD(CScriptArray, SetFlag), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_GETGCFLAG, "bool f()", asMETHOD(CScriptArray, GetFlag), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_ENUMREFS, "void f(int&in)", asMETHOD(CScriptArray, EnumReferences), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_RELEASEREFS, "void f(int&in)", asMETHOD(CScriptArray, ReleaseAllHandles), asCALL_THISCALL); assert( r >= 0 );
+
+#if AS_USE_STLNAMES == 1
+ // Same as length
+ r = engine->RegisterObjectMethod("array<T>", "uint size() const", asMETHOD(CScriptArray, GetSize), asCALL_THISCALL); assert( r >= 0 );
+ // Same as isEmpty
+ r = engine->RegisterObjectMethod("array<T>", "bool empty() const", asMETHOD(CScriptArray, IsEmpty), asCALL_THISCALL); assert( r >= 0 );
+ // Same as insertLast
+ r = engine->RegisterObjectMethod("array<T>", "void push_back(const T&in)", asMETHOD(CScriptArray, InsertLast), asCALL_THISCALL); assert( r >= 0 );
+ // Same as removeLast
+ r = engine->RegisterObjectMethod("array<T>", "void pop_back()", asMETHOD(CScriptArray, RemoveLast), asCALL_THISCALL); assert( r >= 0 );
+ // Same as insertAt
+ r = engine->RegisterObjectMethod("array<T>", "void insert(uint index, const T&in value)", asMETHODPR(CScriptArray, InsertAt, (asUINT, void *), void), asCALL_THISCALL); assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void insert(uint index, const array<T>& arr)", asMETHODPR(CScriptArray, InsertAt, (asUINT, const CScriptArray &), void), asCALL_THISCALL); assert(r >= 0);
+ // Same as removeAt
+ r = engine->RegisterObjectMethod("array<T>", "void erase(uint)", asMETHOD(CScriptArray, RemoveAt), asCALL_THISCALL); assert( r >= 0 );
+#endif
+}
+
+CScriptArray &CScriptArray::operator=(const CScriptArray &other)
+{
+ // Only perform the copy if the array types are the same
+ if( &other != this &&
+ other.GetArrayObjectType() == GetArrayObjectType() )
+ {
+ // Make sure the arrays are of the same size
+ Resize(other.buffer->numElements);
+
+ // Copy the value of each element
+ CopyBuffer(buffer, other.buffer);
+ }
+
+ return *this;
+}
+
+CScriptArray::CScriptArray(asITypeInfo *ti, void *buf)
+{
+ // The object type should be the template instance of the array
+ assert( ti && string(ti->GetName()) == "array" );
+
+ refCount = 1;
+ gcFlag = false;
+ objType = ti;
+ objType->AddRef();
+ buffer = 0;
+
+ Precache();
+
+ asIScriptEngine *engine = ti->GetEngine();
+
+ // Determine element size
+ if( subTypeId & asTYPEID_MASK_OBJECT )
+ elementSize = sizeof(asPWORD);
+ else
+ elementSize = engine->GetSizeOfPrimitiveType(subTypeId);
+
+ // Determine the initial size from the buffer
+ asUINT length = *(asUINT*)buf;
+
+ // Make sure the array size isn't too large for us to handle
+ if( !CheckMaxSize(length) )
+ {
+ // Don't continue with the initialization
+ return;
+ }
+
+ // Copy the values of the array elements from the buffer
+ if( (ti->GetSubTypeId() & asTYPEID_MASK_OBJECT) == 0 )
+ {
+ CreateBuffer(&buffer, length);
+
+ // Copy the values of the primitive type into the internal buffer
+ if( length > 0 )
+ memcpy(At(0), (((asUINT*)buf)+1), length * elementSize);
+ }
+ else if( ti->GetSubTypeId() & asTYPEID_OBJHANDLE )
+ {
+ CreateBuffer(&buffer, length);
+
+ // Copy the handles into the internal buffer
+ if( length > 0 )
+ memcpy(At(0), (((asUINT*)buf)+1), length * elementSize);
+
+ // With object handles it is safe to clear the memory in the received buffer
+ // instead of increasing the ref count. It will save time both by avoiding the
+ // call the increase ref, and also relieve the engine from having to release
+ // its references too
+ memset((((asUINT*)buf)+1), 0, length * elementSize);
+ }
+ else if( ti->GetSubType()->GetFlags() & asOBJ_REF )
+ {
+ // Only allocate the buffer, but not the objects
+ subTypeId |= asTYPEID_OBJHANDLE;
+ CreateBuffer(&buffer, length);
+ subTypeId &= ~asTYPEID_OBJHANDLE;
+
+ // Copy the handles into the internal buffer
+ if( length > 0 )
+ memcpy(buffer->data, (((asUINT*)buf)+1), length * elementSize);
+
+ // For ref types we can do the same as for handles, as they are
+ // implicitly stored as handles.
+ memset((((asUINT*)buf)+1), 0, length * elementSize);
+ }
+ else
+ {
+ // TODO: Optimize by calling the copy constructor of the object instead of
+ // constructing with the default constructor and then assigning the value
+ // TODO: With C++11 ideally we should be calling the move constructor, instead
+ // of the copy constructor as the engine will just discard the objects in the
+ // buffer afterwards.
+ CreateBuffer(&buffer, length);
+
+ // For value types we need to call the opAssign for each individual object
+ for( asUINT n = 0; n < length; n++ )
+ {
+ void *obj = At(n);
+ asBYTE *srcObj = (asBYTE*)buf;
+ srcObj += 4 + n*ti->GetSubType()->GetSize();
+ engine->AssignScriptObject(obj, srcObj, ti->GetSubType());
+ }
+ }
+
+ // Notify the GC of the successful creation
+ if( objType->GetFlags() & asOBJ_GC )
+ objType->GetEngine()->NotifyGarbageCollectorOfNewObject(this, objType);
+}
+
+CScriptArray::CScriptArray(asUINT length, asITypeInfo *ti)
+{
+ // The object type should be the template instance of the array
+ assert( ti && string(ti->GetName()) == "array" );
+
+ refCount = 1;
+ gcFlag = false;
+ objType = ti;
+ objType->AddRef();
+ buffer = 0;
+
+ Precache();
+
+ // Determine element size
+ if( subTypeId & asTYPEID_MASK_OBJECT )
+ elementSize = sizeof(asPWORD);
+ else
+ elementSize = objType->GetEngine()->GetSizeOfPrimitiveType(subTypeId);
+
+ // Make sure the array size isn't too large for us to handle
+ if( !CheckMaxSize(length) )
+ {
+ // Don't continue with the initialization
+ return;
+ }
+
+ CreateBuffer(&buffer, length);
+
+ // Notify the GC of the successful creation
+ if( objType->GetFlags() & asOBJ_GC )
+ objType->GetEngine()->NotifyGarbageCollectorOfNewObject(this, objType);
+}
+
+CScriptArray::CScriptArray(const CScriptArray &other)
+{
+ refCount = 1;
+ gcFlag = false;
+ objType = other.objType;
+ objType->AddRef();
+ buffer = 0;
+
+ Precache();
+
+ elementSize = other.elementSize;
+
+ if( objType->GetFlags() & asOBJ_GC )
+ objType->GetEngine()->NotifyGarbageCollectorOfNewObject(this, objType);
+
+ CreateBuffer(&buffer, 0);
+
+ // Copy the content
+ *this = other;
+}
+
+CScriptArray::CScriptArray(asUINT length, void *defVal, asITypeInfo *ti)
+{
+ // The object type should be the template instance of the array
+ assert( ti && string(ti->GetName()) == "array" );
+
+ refCount = 1;
+ gcFlag = false;
+ objType = ti;
+ objType->AddRef();
+ buffer = 0;
+
+ Precache();
+
+ // Determine element size
+ if( subTypeId & asTYPEID_MASK_OBJECT )
+ elementSize = sizeof(asPWORD);
+ else
+ elementSize = objType->GetEngine()->GetSizeOfPrimitiveType(subTypeId);
+
+ // Make sure the array size isn't too large for us to handle
+ if( !CheckMaxSize(length) )
+ {
+ // Don't continue with the initialization
+ return;
+ }
+
+ CreateBuffer(&buffer, length);
+
+ // Notify the GC of the successful creation
+ if( objType->GetFlags() & asOBJ_GC )
+ objType->GetEngine()->NotifyGarbageCollectorOfNewObject(this, objType);
+
+ // Initialize the elements with the default value
+ for( asUINT n = 0; n < GetSize(); n++ )
+ SetValue(n, defVal);
+}
+
+void CScriptArray::SetValue(asUINT index, void *value)
+{
+ // At() will take care of the out-of-bounds checking, though
+ // if called from the application then nothing will be done
+ void *ptr = At(index);
+ if( ptr == 0 ) return;
+
+ if( (subTypeId & ~asTYPEID_MASK_SEQNBR) && !(subTypeId & asTYPEID_OBJHANDLE) )
+ objType->GetEngine()->AssignScriptObject(ptr, value, objType->GetSubType());
+ else if( subTypeId & asTYPEID_OBJHANDLE )
+ {
+ void *tmp = *(void**)ptr;
+ *(void**)ptr = *(void**)value;
+ objType->GetEngine()->AddRefScriptObject(*(void**)value, objType->GetSubType());
+ if( tmp )
+ objType->GetEngine()->ReleaseScriptObject(tmp, objType->GetSubType());
+ }
+ else if( subTypeId == asTYPEID_BOOL ||
+ subTypeId == asTYPEID_INT8 ||
+ subTypeId == asTYPEID_UINT8 )
+ *(char*)ptr = *(char*)value;
+ else if( subTypeId == asTYPEID_INT16 ||
+ subTypeId == asTYPEID_UINT16 )
+ *(short*)ptr = *(short*)value;
+ else if( subTypeId == asTYPEID_INT32 ||
+ subTypeId == asTYPEID_UINT32 ||
+ subTypeId == asTYPEID_FLOAT ||
+ subTypeId > asTYPEID_DOUBLE ) // enums have a type id larger than doubles
+ *(int*)ptr = *(int*)value;
+ else if( subTypeId == asTYPEID_INT64 ||
+ subTypeId == asTYPEID_UINT64 ||
+ subTypeId == asTYPEID_DOUBLE )
+ *(double*)ptr = *(double*)value;
+}
+
+CScriptArray::~CScriptArray()
+{
+ if( buffer )
+ {
+ DeleteBuffer(buffer);
+ buffer = 0;
+ }
+ if( objType ) objType->Release();
+}
+
+asUINT CScriptArray::GetSize() const
+{
+ return buffer->numElements;
+}
+
+bool CScriptArray::IsEmpty() const
+{
+ return buffer->numElements == 0;
+}
+
+void CScriptArray::Reserve(asUINT maxElements)
+{
+ if( maxElements <= buffer->maxElements )
+ return;
+
+ if( !CheckMaxSize(maxElements) )
+ return;
+
+ // Allocate memory for the buffer
+ SArrayBuffer *newBuffer = reinterpret_cast<SArrayBuffer*>(userAlloc(sizeof(SArrayBuffer)-1 + elementSize*maxElements));
+ if( newBuffer )
+ {
+ newBuffer->numElements = buffer->numElements;
+ newBuffer->maxElements = maxElements;
+ }
+ else
+ {
+ // Out of memory
+ asIScriptContext *ctx = asGetActiveContext();
+ if( ctx )
+ ctx->SetException("Out of memory");
+ return;
+ }
+
+ // As objects in arrays of objects are not stored inline, it is safe to use memcpy here
+ // since we're just copying the pointers to objects and not the actual objects.
+ memcpy(newBuffer->data, buffer->data, buffer->numElements*elementSize);
+
+ // Release the old buffer
+ userFree(buffer);
+
+ buffer = newBuffer;
+}
+
+void CScriptArray::Resize(asUINT numElements)
+{
+ if( !CheckMaxSize(numElements) )
+ return;
+
+ Resize((int)numElements - (int)buffer->numElements, (asUINT)-1);
+}
+
+void CScriptArray::RemoveRange(asUINT start, asUINT count)
+{
+ if (count == 0)
+ return;
+
+ if( buffer == 0 || start > buffer->numElements )
+ {
+ // If this is called from a script we raise a script exception
+ asIScriptContext *ctx = asGetActiveContext();
+ if (ctx)
+ ctx->SetException("Index out of bounds");
+ return;
+ }
+
+ // Cap count to the end of the array
+ if (start + count > buffer->numElements)
+ count = buffer->numElements - start;
+
+ // Destroy the elements that are being removed
+ Destruct(buffer, start, start + count);
+
+ // Compact the elements
+ // As objects in arrays of objects are not stored inline, it is safe to use memmove here
+ // since we're just copying the pointers to objects and not the actual objects.
+ memmove(buffer->data + start*elementSize, buffer->data + (start + count)*elementSize, (buffer->numElements - start - count)*elementSize);
+ buffer->numElements -= count;
+}
+
+// Internal
+void CScriptArray::Resize(int delta, asUINT at)
+{
+ if( delta < 0 )
+ {
+ if( -delta > (int)buffer->numElements )
+ delta = -(int)buffer->numElements;
+ if( at > buffer->numElements + delta )
+ at = buffer->numElements + delta;
+ }
+ else if( delta > 0 )
+ {
+ // Make sure the array size isn't too large for us to handle
+ if( delta > 0 && !CheckMaxSize(buffer->numElements + delta) )
+ return;
+
+ if( at > buffer->numElements )
+ at = buffer->numElements;
+ }
+
+ if( delta == 0 ) return;
+
+ if( buffer->maxElements < buffer->numElements + delta )
+ {
+ // Allocate memory for the buffer
+ SArrayBuffer *newBuffer = reinterpret_cast<SArrayBuffer*>(userAlloc(sizeof(SArrayBuffer)-1 + elementSize*(buffer->numElements + delta)));
+ if( newBuffer )
+ {
+ newBuffer->numElements = buffer->numElements + delta;
+ newBuffer->maxElements = newBuffer->numElements;
+ }
+ else
+ {
+ // Out of memory
+ asIScriptContext *ctx = asGetActiveContext();
+ if( ctx )
+ ctx->SetException("Out of memory");
+ return;
+ }
+
+ // As objects in arrays of objects are not stored inline, it is safe to use memcpy here
+ // since we're just copying the pointers to objects and not the actual objects.
+ memcpy(newBuffer->data, buffer->data, at*elementSize);
+ if( at < buffer->numElements )
+ memcpy(newBuffer->data + (at+delta)*elementSize, buffer->data + at*elementSize, (buffer->numElements-at)*elementSize);
+
+ // Initialize the new elements with default values
+ Construct(newBuffer, at, at+delta);
+
+ // Release the old buffer
+ userFree(buffer);
+
+ buffer = newBuffer;
+ }
+ else if( delta < 0 )
+ {
+ Destruct(buffer, at, at-delta);
+ // As objects in arrays of objects are not stored inline, it is safe to use memmove here
+ // since we're just copying the pointers to objects and not the actual objects.
+ memmove(buffer->data + at*elementSize, buffer->data + (at-delta)*elementSize, (buffer->numElements - (at-delta))*elementSize);
+ buffer->numElements += delta;
+ }
+ else
+ {
+ // As objects in arrays of objects are not stored inline, it is safe to use memmove here
+ // since we're just copying the pointers to objects and not the actual objects.
+ memmove(buffer->data + (at+delta)*elementSize, buffer->data + at*elementSize, (buffer->numElements - at)*elementSize);
+ Construct(buffer, at, at+delta);
+ buffer->numElements += delta;
+ }
+}
+
+// internal
+bool CScriptArray::CheckMaxSize(asUINT numElements)
+{
+ // This code makes sure the size of the buffer that is allocated
+ // for the array doesn't overflow and becomes smaller than requested
+
+ asUINT maxSize = 0xFFFFFFFFul - sizeof(SArrayBuffer) + 1;
+ if( elementSize > 0 )
+ maxSize /= elementSize;
+
+ if( numElements > maxSize )
+ {
+ asIScriptContext *ctx = asGetActiveContext();
+ if( ctx )
+ ctx->SetException("Too large array size");
+
+ return false;
+ }
+
+ // OK
+ return true;
+}
+
+asITypeInfo *CScriptArray::GetArrayObjectType() const
+{
+ return objType;
+}
+
+int CScriptArray::GetArrayTypeId() const
+{
+ return objType->GetTypeId();
+}
+
+int CScriptArray::GetElementTypeId() const
+{
+ return subTypeId;
+}
+
+void CScriptArray::InsertAt(asUINT index, void *value)
+{
+ if( index > buffer->numElements )
+ {
+ // If this is called from a script we raise a script exception
+ asIScriptContext *ctx = asGetActiveContext();
+ if( ctx )
+ ctx->SetException("Index out of bounds");
+ return;
+ }
+
+ // Make room for the new element
+ Resize(1, index);
+
+ // Set the value of the new element
+ SetValue(index, value);
+}
+
+void CScriptArray::InsertAt(asUINT index, const CScriptArray &arr)
+{
+ if (index > buffer->numElements)
+ {
+ asIScriptContext *ctx = asGetActiveContext();
+ if (ctx)
+ ctx->SetException("Index out of bounds");
+ return;
+ }
+
+ if (objType != arr.objType)
+ {
+ // This shouldn't really be possible to happen when
+ // called from a script, but let's check for it anyway
+ asIScriptContext *ctx = asGetActiveContext();
+ if (ctx)
+ ctx->SetException("Mismatching array types");
+ return;
+ }
+
+ asUINT elements = arr.GetSize();
+ Resize(elements, index);
+ if (&arr != this)
+ {
+ for (asUINT n = 0; n < arr.GetSize(); n++)
+ {
+ // This const cast is allowed, since we know the
+ // value will only be used to make a copy of it
+ void *value = const_cast<void*>(arr.At(n));
+ SetValue(index + n, value);
+ }
+ }
+ else
+ {
+ // The array that is being inserted is the same as this one.
+ // So we should iterate over the elements before the index,
+ // and then the elements after
+ for (asUINT n = 0; n < index; n++)
+ {
+ // This const cast is allowed, since we know the
+ // value will only be used to make a copy of it
+ void *value = const_cast<void*>(arr.At(n));
+ SetValue(index + n, value);
+ }
+
+ for (asUINT n = index + elements, m = 0; n < arr.GetSize(); n++, m++)
+ {
+ // This const cast is allowed, since we know the
+ // value will only be used to make a copy of it
+ void *value = const_cast<void*>(arr.At(n));
+ SetValue(index + index + m, value);
+ }
+ }
+}
+
+void CScriptArray::InsertLast(void *value)
+{
+ InsertAt(buffer->numElements, value);
+}
+
+void CScriptArray::RemoveAt(asUINT index)
+{
+ if( index >= buffer->numElements )
+ {
+ // If this is called from a script we raise a script exception
+ asIScriptContext *ctx = asGetActiveContext();
+ if( ctx )
+ ctx->SetException("Index out of bounds");
+ return;
+ }
+
+ // Remove the element
+ Resize(-1, index);
+}
+
+void CScriptArray::RemoveLast()
+{
+ RemoveAt(buffer->numElements-1);
+}
+
+// Return a pointer to the array element. Returns 0 if the index is out of bounds
+const void *CScriptArray::At(asUINT index) const
+{
+ if( buffer == 0 || index >= buffer->numElements )
+ {
+ // If this is called from a script we raise a script exception
+ asIScriptContext *ctx = asGetActiveContext();
+ if( ctx )
+ ctx->SetException("Index out of bounds");
+ return 0;
+ }
+
+ if( (subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE) )
+ return *(void**)(buffer->data + elementSize*index);
+ else
+ return buffer->data + elementSize*index;
+}
+void *CScriptArray::At(asUINT index)
+{
+ return const_cast<void*>(const_cast<const CScriptArray *>(this)->At(index));
+}
+
+void *CScriptArray::GetBuffer()
+{
+ return buffer->data;
+}
+
+
+// internal
+void CScriptArray::CreateBuffer(SArrayBuffer **buf, asUINT numElements)
+{
+ *buf = reinterpret_cast<SArrayBuffer*>(userAlloc(sizeof(SArrayBuffer)-1+elementSize*numElements));
+
+ if( *buf )
+ {
+ (*buf)->numElements = numElements;
+ (*buf)->maxElements = numElements;
+ Construct(*buf, 0, numElements);
+ }
+ else
+ {
+ // Oops, out of memory
+ asIScriptContext *ctx = asGetActiveContext();
+ if( ctx )
+ ctx->SetException("Out of memory");
+ }
+}
+
+// internal
+void CScriptArray::DeleteBuffer(SArrayBuffer *buf)
+{
+ Destruct(buf, 0, buf->numElements);
+
+ // Free the buffer
+ userFree(buf);
+}
+
+// internal
+void CScriptArray::Construct(SArrayBuffer *buf, asUINT start, asUINT end)
+{
+ if( (subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE) )
+ {
+ // Create an object using the default constructor/factory for each element
+ void **max = (void**)(buf->data + end * sizeof(void*));
+ void **d = (void**)(buf->data + start * sizeof(void*));
+
+ asIScriptEngine *engine = objType->GetEngine();
+ asITypeInfo *subType = objType->GetSubType();
+
+ for( ; d < max; d++ )
+ {
+ *d = (void*)engine->CreateScriptObject(subType);
+ if( *d == 0 )
+ {
+ // Set the remaining entries to null so the destructor
+ // won't attempt to destroy invalid objects later
+ memset(d, 0, sizeof(void*)*(max-d));
+
+ // There is no need to set an exception on the context,
+ // as CreateScriptObject has already done that
+ return;
+ }
+ }
+ }
+ else
+ {
+ // Set all elements to zero whether they are handles or primitives
+ void *d = (void*)(buf->data + start * elementSize);
+ memset(d, 0, (end-start)*elementSize);
+ }
+}
+
+// internal
+void CScriptArray::Destruct(SArrayBuffer *buf, asUINT start, asUINT end)
+{
+ if( subTypeId & asTYPEID_MASK_OBJECT )
+ {
+ asIScriptEngine *engine = objType->GetEngine();
+
+ void **max = (void**)(buf->data + end * sizeof(void*));
+ void **d = (void**)(buf->data + start * sizeof(void*));
+
+ for( ; d < max; d++ )
+ {
+ if( *d )
+ engine->ReleaseScriptObject(*d, objType->GetSubType());
+ }
+ }
+}
+
+
+// internal
+bool CScriptArray::Less(const void *a, const void *b, bool asc)
+{
+ if( !asc )
+ {
+ // Swap items
+ const void *TEMP = a;
+ a = b;
+ b = TEMP;
+ }
+
+ if( !(subTypeId & ~asTYPEID_MASK_SEQNBR) )
+ {
+ // Simple compare of values
+ switch( subTypeId )
+ {
+ #define COMPARE(T) *((T*)a) < *((T*)b)
+ case asTYPEID_BOOL: return COMPARE(bool);
+ case asTYPEID_INT8: return COMPARE(signed char);
+ case asTYPEID_UINT8: return COMPARE(unsigned char);
+ case asTYPEID_INT16: return COMPARE(signed short);
+ case asTYPEID_UINT16: return COMPARE(unsigned short);
+ case asTYPEID_INT32: return COMPARE(signed int);
+ case asTYPEID_UINT32: return COMPARE(unsigned int);
+ case asTYPEID_FLOAT: return COMPARE(float);
+ case asTYPEID_DOUBLE: return COMPARE(double);
+ default: return COMPARE(signed int); // All enums fall in this case
+ #undef COMPARE
+ }
+ }
+
+ return false;
+}
+
+void CScriptArray::Reverse()
+{
+ asUINT size = GetSize();
+
+ if( size >= 2 )
+ {
+ asBYTE TEMP[16];
+
+ for( asUINT i = 0; i < size / 2; i++ )
+ {
+ Copy(TEMP, GetArrayItemPointer(i));
+ Copy(GetArrayItemPointer(i), GetArrayItemPointer(size - i - 1));
+ Copy(GetArrayItemPointer(size - i - 1), TEMP);
+ }
+ }
+}
+
+bool CScriptArray::operator==(const CScriptArray &other) const
+{
+ if( objType != other.objType )
+ return false;
+
+ if( GetSize() != other.GetSize() )
+ return false;
+
+ asIScriptContext *cmpContext = 0;
+ bool isNested = false;
+
+ if( subTypeId & ~asTYPEID_MASK_SEQNBR )
+ {
+ // Try to reuse the active context
+ cmpContext = asGetActiveContext();
+ if( cmpContext )
+ {
+ if( cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0 )
+ isNested = true;
+ else
+ cmpContext = 0;
+ }
+ if( cmpContext == 0 )
+ {
+ // TODO: Ideally this context would be retrieved from a pool, so we don't have to
+ // create a new one everytime. We could keep a context with the array object
+ // but that would consume a lot of resources as each context is quite heavy.
+ cmpContext = objType->GetEngine()->CreateContext();
+ }
+ }
+
+ // Check if all elements are equal
+ bool isEqual = true;
+ SArrayCache *cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
+ for( asUINT n = 0; n < GetSize(); n++ )
+ if( !Equals(At(n), other.At(n), cmpContext, cache) )
+ {
+ isEqual = false;
+ break;
+ }
+
+ if( cmpContext )
+ {
+ if( isNested )
+ {
+ asEContextState state = cmpContext->GetState();
+ cmpContext->PopState();
+ if( state == asEXECUTION_ABORTED )
+ cmpContext->Abort();
+ }
+ else
+ cmpContext->Release();
+ }
+
+ return isEqual;
+}
+
+// internal
+bool CScriptArray::Equals(const void *a, const void *b, asIScriptContext *ctx, SArrayCache *cache) const
+{
+ if( !(subTypeId & ~asTYPEID_MASK_SEQNBR) )
+ {
+ // Simple compare of values
+ switch( subTypeId )
+ {
+ #define COMPARE(T) *((T*)a) == *((T*)b)
+ case asTYPEID_BOOL: return COMPARE(bool);
+ case asTYPEID_INT8: return COMPARE(signed char);
+ case asTYPEID_UINT8: return COMPARE(unsigned char);
+ case asTYPEID_INT16: return COMPARE(signed short);
+ case asTYPEID_UINT16: return COMPARE(unsigned short);
+ case asTYPEID_INT32: return COMPARE(signed int);
+ case asTYPEID_UINT32: return COMPARE(unsigned int);
+ case asTYPEID_FLOAT: return COMPARE(float);
+ case asTYPEID_DOUBLE: return COMPARE(double);
+ default: return COMPARE(signed int); // All enums fall here
+ #undef COMPARE
+ }
+ }
+ else
+ {
+ int r = 0;
+
+ if( subTypeId & asTYPEID_OBJHANDLE )
+ {
+ // Allow the find to work even if the array contains null handles
+ if( *(void**)a == *(void**)b ) return true;
+ }
+
+ // Execute object opEquals if available
+ if( cache && cache->eqFunc )
+ {
+ // TODO: Add proper error handling
+ r = ctx->Prepare(cache->eqFunc); assert(r >= 0);
+
+ if( subTypeId & asTYPEID_OBJHANDLE )
+ {
+ r = ctx->SetObject(*((void**)a)); assert(r >= 0);
+ r = ctx->SetArgObject(0, *((void**)b)); assert(r >= 0);
+ }
+ else
+ {
+ r = ctx->SetObject((void*)a); assert(r >= 0);
+ r = ctx->SetArgObject(0, (void*)b); assert(r >= 0);
+ }
+
+ r = ctx->Execute();
+
+ if( r == asEXECUTION_FINISHED )
+ return ctx->GetReturnByte() != 0;
+
+ return false;
+ }
+
+ // Execute object opCmp if available
+ if( cache && cache->cmpFunc )
+ {
+ // TODO: Add proper error handling
+ r = ctx->Prepare(cache->cmpFunc); assert(r >= 0);
+
+ if( subTypeId & asTYPEID_OBJHANDLE )
+ {
+ r = ctx->SetObject(*((void**)a)); assert(r >= 0);
+ r = ctx->SetArgObject(0, *((void**)b)); assert(r >= 0);
+ }
+ else
+ {
+ r = ctx->SetObject((void*)a); assert(r >= 0);
+ r = ctx->SetArgObject(0, (void*)b); assert(r >= 0);
+ }
+
+ r = ctx->Execute();
+
+ if( r == asEXECUTION_FINISHED )
+ return (int)ctx->GetReturnDWord() == 0;
+
+ return false;
+ }
+ }
+
+ return false;
+}
+
+int CScriptArray::FindByRef(void *ref) const
+{
+ return FindByRef(0, ref);
+}
+
+int CScriptArray::FindByRef(asUINT startAt, void *ref) const
+{
+ // Find the matching element by its reference
+ asUINT size = GetSize();
+ if( subTypeId & asTYPEID_OBJHANDLE )
+ {
+ // Dereference the pointer
+ ref = *(void**)ref;
+ for( asUINT i = startAt; i < size; i++ )
+ {
+ if( *(void**)At(i) == ref )
+ return i;
+ }
+ }
+ else
+ {
+ // Compare the reference directly
+ for( asUINT i = startAt; i < size; i++ )
+ {
+ if( At(i) == ref )
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+int CScriptArray::Find(void *value) const
+{
+ return Find(0, value);
+}
+
+int CScriptArray::Find(asUINT startAt, void *value) const
+{
+ // Check if the subtype really supports find()
+ // TODO: Can't this be done at compile time too by the template callback
+ SArrayCache *cache = 0;
+ if( subTypeId & ~asTYPEID_MASK_SEQNBR )
+ {
+ cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
+ if( !cache || (cache->cmpFunc == 0 && cache->eqFunc == 0) )
+ {
+ asIScriptContext *ctx = asGetActiveContext();
+ asITypeInfo* subType = objType->GetEngine()->GetTypeInfoById(subTypeId);
+
+ // Throw an exception
+ if( ctx )
+ {
+ char tmp[512];
+
+ if( cache && cache->eqFuncReturnCode == asMULTIPLE_FUNCTIONS )
+#if defined(_MSC_VER) && _MSC_VER >= 1500 && !defined(__S3E__)
+ sprintf_s(tmp, 512, "Type '%s' has multiple matching opEquals or opCmp methods", subType->GetName());
+#else
+ sprintf(tmp, "Type '%s' has multiple matching opEquals or opCmp methods", subType->GetName());
+#endif
+ else
+#if defined(_MSC_VER) && _MSC_VER >= 1500 && !defined(__S3E__)
+ sprintf_s(tmp, 512, "Type '%s' does not have a matching opEquals or opCmp method", subType->GetName());
+#else
+ sprintf(tmp, "Type '%s' does not have a matching opEquals or opCmp method", subType->GetName());
+#endif
+ ctx->SetException(tmp);
+ }
+
+ return -1;
+ }
+ }
+
+ asIScriptContext *cmpContext = 0;
+ bool isNested = false;
+
+ if( subTypeId & ~asTYPEID_MASK_SEQNBR )
+ {
+ // Try to reuse the active context
+ cmpContext = asGetActiveContext();
+ if( cmpContext )
+ {
+ if( cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0 )
+ isNested = true;
+ else
+ cmpContext = 0;
+ }
+ if( cmpContext == 0 )
+ {
+ // TODO: Ideally this context would be retrieved from a pool, so we don't have to
+ // create a new one everytime. We could keep a context with the array object
+ // but that would consume a lot of resources as each context is quite heavy.
+ cmpContext = objType->GetEngine()->CreateContext();
+ }
+ }
+
+ // Find the matching element
+ int ret = -1;
+ asUINT size = GetSize();
+
+ for( asUINT i = startAt; i < size; i++ )
+ {
+ // value passed by reference
+ if( Equals(At(i), value, cmpContext, cache) )
+ {
+ ret = (int)i;
+ break;
+ }
+ }
+
+ if( cmpContext )
+ {
+ if( isNested )
+ {
+ asEContextState state = cmpContext->GetState();
+ cmpContext->PopState();
+ if( state == asEXECUTION_ABORTED )
+ cmpContext->Abort();
+ }
+ else
+ cmpContext->Release();
+ }
+
+ return ret;
+}
+
+
+
+// internal
+// Copy object handle or primitive value
+// Even in arrays of objects the objects are allocated on
+// the heap and the array stores the pointers to the objects
+void CScriptArray::Copy(void *dst, void *src)
+{
+ memcpy(dst, src, elementSize);
+}
+
+
+// internal
+// Swap two elements
+// Even in arrays of objects the objects are allocated on
+// the heap and the array stores the pointers to the objects.
+void CScriptArray::Swap(void* a, void* b)
+{
+ asBYTE tmp[16];
+ Copy(tmp, a);
+ Copy(a, b);
+ Copy(b, tmp);
+}
+
+
+// internal
+// Return pointer to array item (object handle or primitive value)
+void *CScriptArray::GetArrayItemPointer(int index)
+{
+ return buffer->data + index * elementSize;
+}
+
+// internal
+// Return pointer to data in buffer (object or primitive)
+void *CScriptArray::GetDataPointer(void *buf)
+{
+ if ((subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE) )
+ {
+ // Real address of object
+ return reinterpret_cast<void*>(*(size_t*)buf);
+ }
+ else
+ {
+ // Primitive is just a raw data
+ return buf;
+ }
+}
+
+
+// Sort ascending
+void CScriptArray::SortAsc()
+{
+ Sort(0, GetSize(), true);
+}
+
+// Sort ascending
+void CScriptArray::SortAsc(asUINT startAt, asUINT count)
+{
+ Sort(startAt, count, true);
+}
+
+// Sort descending
+void CScriptArray::SortDesc()
+{
+ Sort(0, GetSize(), false);
+}
+
+// Sort descending
+void CScriptArray::SortDesc(asUINT startAt, asUINT count)
+{
+ Sort(startAt, count, false);
+}
+
+
+// internal
+void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
+{
+ // Subtype isn't primitive and doesn't have opCmp
+ SArrayCache *cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
+ if( subTypeId & ~asTYPEID_MASK_SEQNBR )
+ {
+ if( !cache || cache->cmpFunc == 0 )
+ {
+ asIScriptContext *ctx = asGetActiveContext();
+ asITypeInfo* subType = objType->GetEngine()->GetTypeInfoById(subTypeId);
+
+ // Throw an exception
+ if( ctx )
+ {
+ char tmp[512];
+
+ if( cache && cache->cmpFuncReturnCode == asMULTIPLE_FUNCTIONS )
+#if defined(_MSC_VER) && _MSC_VER >= 1500 && !defined(__S3E__)
+ sprintf_s(tmp, 512, "Type '%s' has multiple matching opCmp methods", subType->GetName());
+#else
+ sprintf(tmp, "Type '%s' has multiple matching opCmp methods", subType->GetName());
+#endif
+ else
+#if defined(_MSC_VER) && _MSC_VER >= 1500 && !defined(__S3E__)
+ sprintf_s(tmp, 512, "Type '%s' does not have a matching opCmp method", subType->GetName());
+#else
+ sprintf(tmp, "Type '%s' does not have a matching opCmp method", subType->GetName());
+#endif
+
+ ctx->SetException(tmp);
+ }
+
+ return;
+ }
+ }
+
+ // No need to sort
+ if( count < 2 )
+ {
+ return;
+ }
+
+ int start = startAt;
+ int end = startAt + count;
+
+ // Check if we could access invalid item while sorting
+ if( start >= (int)buffer->numElements || end > (int)buffer->numElements )
+ {
+ asIScriptContext *ctx = asGetActiveContext();
+
+ // Throw an exception
+ if( ctx )
+ {
+ ctx->SetException("Index out of bounds");
+ }
+
+ return;
+ }
+
+ if( subTypeId & ~asTYPEID_MASK_SEQNBR )
+ {
+ asIScriptContext *cmpContext = 0;
+ bool isNested = false;
+
+ // Try to reuse the active context
+ cmpContext = asGetActiveContext();
+ if( cmpContext )
+ {
+ if( cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0 )
+ isNested = true;
+ else
+ cmpContext = 0;
+ }
+ if( cmpContext == 0 )
+ cmpContext = objType->GetEngine()->RequestContext();
+
+ // Do the sorting
+ struct {
+ bool asc;
+ asIScriptContext *cmpContext;
+ asIScriptFunction *cmpFunc;
+ bool operator()(void *a, void *b) const
+ {
+ if( !asc )
+ {
+ // Swap items
+ void *TEMP = a;
+ a = b;
+ b = TEMP;
+ }
+
+ int r = 0;
+
+ // Allow sort to work even if the array contains null handles
+ if( a == 0 ) return true;
+ if( b == 0 ) return false;
+
+ // Execute object opCmp
+ if( cmpFunc )
+ {
+ // TODO: Add proper error handling
+ r = cmpContext->Prepare(cmpFunc); assert(r >= 0);
+ r = cmpContext->SetObject(a); assert(r >= 0);
+ r = cmpContext->SetArgObject(0, b); assert(r >= 0);
+ r = cmpContext->Execute();
+
+ if( r == asEXECUTION_FINISHED )
+ {
+ return (int)cmpContext->GetReturnDWord() < 0;
+ }
+ }
+
+ return false;
+ }
+ } customLess = {asc, cmpContext, cache ? cache->cmpFunc : 0};
+ std::sort((void**)GetArrayItemPointer(start), (void**)GetArrayItemPointer(end), customLess);
+
+ // Clean up
+ if( cmpContext )
+ {
+ if( isNested )
+ {
+ asEContextState state = cmpContext->GetState();
+ cmpContext->PopState();
+ if( state == asEXECUTION_ABORTED )
+ cmpContext->Abort();
+ }
+ else
+ objType->GetEngine()->ReturnContext(cmpContext);
+ }
+ }
+ else
+ {
+ // TODO: Use std::sort for primitive types too
+
+ // Insertion sort
+ asBYTE tmp[16];
+ for( int i = start + 1; i < end; i++ )
+ {
+ Copy(tmp, GetArrayItemPointer(i));
+
+ int j = i - 1;
+
+ while( j >= start && Less(GetDataPointer(tmp), At(j), asc) )
+ {
+ Copy(GetArrayItemPointer(j + 1), GetArrayItemPointer(j));
+ j--;
+ }
+
+ Copy(GetArrayItemPointer(j + 1), tmp);
+ }
+ }
+}
+
+// Sort with script callback for comparing elements
+void CScriptArray::Sort(asIScriptFunction *func, asUINT startAt, asUINT count)
+{
+ // No need to sort
+ if (count < 2)
+ return;
+
+ // Check if we could access invalid item while sorting
+ asUINT start = startAt;
+ asUINT end = asQWORD(startAt) + asQWORD(count) >= (asQWORD(1)<<32) ? 0xFFFFFFFF : startAt + count;
+ if (end > buffer->numElements)
+ end = buffer->numElements;
+
+ if (start >= buffer->numElements)
+ {
+ asIScriptContext *ctx = asGetActiveContext();
+
+ // Throw an exception
+ if (ctx)
+ ctx->SetException("Index out of bounds");
+
+ return;
+ }
+
+ asIScriptContext *cmpContext = 0;
+ bool isNested = false;
+
+ // Try to reuse the active context
+ cmpContext = asGetActiveContext();
+ if (cmpContext)
+ {
+ if (cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0)
+ isNested = true;
+ else
+ cmpContext = 0;
+ }
+ if (cmpContext == 0)
+ cmpContext = objType->GetEngine()->RequestContext();
+
+ // TODO: Security issue: If the array is accessed from the callback while the sort is going on the result may be unpredictable
+ // For example, the callback resizes the array in the middle of the sort
+ // Possible solution: set a lock flag on the array, and prohibit modifications while the lock flag is set
+
+ // Bubble sort
+ // TODO: optimize: Use an efficient sort algorithm
+ for (asUINT i = start; i+1 < end; i++)
+ {
+ asUINT best = i;
+ for (asUINT j = i + 1; j < end; j++)
+ {
+ cmpContext->Prepare(func);
+ cmpContext->SetArgAddress(0, At(j));
+ cmpContext->SetArgAddress(1, At(best));
+ int r = cmpContext->Execute();
+ if (r != asEXECUTION_FINISHED)
+ break;
+ if (*(bool*)(cmpContext->GetAddressOfReturnValue()))
+ best = j;
+ }
+
+ // With Swap we guarantee that the array always sees all references
+ // if the GC calls the EnumReferences in the middle of the sorting
+ if( best != i )
+ Swap(GetArrayItemPointer(i), GetArrayItemPointer(best));
+ }
+
+ if (cmpContext)
+ {
+ if (isNested)
+ {
+ asEContextState state = cmpContext->GetState();
+ cmpContext->PopState();
+ if (state == asEXECUTION_ABORTED)
+ cmpContext->Abort();
+ }
+ else
+ objType->GetEngine()->ReturnContext(cmpContext);
+ }
+}
+
+// internal
+void CScriptArray::CopyBuffer(SArrayBuffer *dst, SArrayBuffer *src)
+{
+ asIScriptEngine *engine = objType->GetEngine();
+ if( subTypeId & asTYPEID_OBJHANDLE )
+ {
+ // Copy the references and increase the reference counters
+ if( dst->numElements > 0 && src->numElements > 0 )
+ {
+ int count = dst->numElements > src->numElements ? src->numElements : dst->numElements;
+
+ void **max = (void**)(dst->data + count * sizeof(void*));
+ void **d = (void**)dst->data;
+ void **s = (void**)src->data;
+
+ for( ; d < max; d++, s++ )
+ {
+ void *tmp = *d;
+ *d = *s;
+ if( *d )
+ engine->AddRefScriptObject(*d, objType->GetSubType());
+ // Release the old ref after incrementing the new to avoid problem incase it is the same ref
+ if( tmp )
+ engine->ReleaseScriptObject(tmp, objType->GetSubType());
+ }
+ }
+ }
+ else
+ {
+ if( dst->numElements > 0 && src->numElements > 0 )
+ {
+ int count = dst->numElements > src->numElements ? src->numElements : dst->numElements;
+ if( subTypeId & asTYPEID_MASK_OBJECT )
+ {
+ // Call the assignment operator on all of the objects
+ void **max = (void**)(dst->data + count * sizeof(void*));
+ void **d = (void**)dst->data;
+ void **s = (void**)src->data;
+
+ asITypeInfo *subType = objType->GetSubType();
+ for( ; d < max; d++, s++ )
+ engine->AssignScriptObject(*d, *s, subType);
+ }
+ else
+ {
+ // Primitives are copied byte for byte
+ memcpy(dst->data, src->data, count*elementSize);
+ }
+ }
+ }
+}
+
+// internal
+// Precache some info
+void CScriptArray::Precache()
+{
+ subTypeId = objType->GetSubTypeId();
+
+ // Check if it is an array of objects. Only for these do we need to cache anything
+ // Type ids for primitives and enums only has the sequence number part
+ if( !(subTypeId & ~asTYPEID_MASK_SEQNBR) )
+ return;
+
+ // The opCmp and opEquals methods are cached because the searching for the
+ // methods is quite time consuming if a lot of array objects are created.
+
+ // First check if a cache already exists for this array type
+ SArrayCache *cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
+ if( cache ) return;
+
+ // We need to make sure the cache is created only once, even
+ // if multiple threads reach the same point at the same time
+ asAcquireExclusiveLock();
+
+ // Now that we got the lock, we need to check again to make sure the
+ // cache wasn't created while we were waiting for the lock
+ cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
+ if( cache )
+ {
+ asReleaseExclusiveLock();
+ return;
+ }
+
+ // Create the cache
+ cache = reinterpret_cast<SArrayCache*>(userAlloc(sizeof(SArrayCache)));
+ if( !cache )
+ {
+ asIScriptContext *ctx = asGetActiveContext();
+ if( ctx )
+ ctx->SetException("Out of memory");
+ asReleaseExclusiveLock();
+ return;
+ }
+ memset(cache, 0, sizeof(SArrayCache));
+
+ // If the sub type is a handle to const, then the methods must be const too
+ bool mustBeConst = (subTypeId & asTYPEID_HANDLETOCONST) ? true : false;
+
+ asITypeInfo *subType = objType->GetEngine()->GetTypeInfoById(subTypeId);
+ if( subType )
+ {
+ for( asUINT i = 0; i < subType->GetMethodCount(); i++ )
+ {
+ asIScriptFunction *func = subType->GetMethodByIndex(i);
+
+ if( func->GetParamCount() == 1 && (!mustBeConst || func->IsReadOnly()) )
+ {
+ asDWORD flags = 0;
+ int returnTypeId = func->GetReturnTypeId(&flags);
+
+ // The method must not return a reference
+ if( flags != asTM_NONE )
+ continue;
+
+ // opCmp returns an int and opEquals returns a bool
+ bool isCmp = false, isEq = false;
+ if( returnTypeId == asTYPEID_INT32 && strcmp(func->GetName(), "opCmp") == 0 )
+ isCmp = true;
+ if( returnTypeId == asTYPEID_BOOL && strcmp(func->GetName(), "opEquals") == 0 )
+ isEq = true;
+
+ if( !isCmp && !isEq )
+ continue;
+
+ // The parameter must either be a reference to the subtype or a handle to the subtype
+ int paramTypeId;
+ func->GetParam(0, ¶mTypeId, &flags);
+
+ if( (paramTypeId & ~(asTYPEID_OBJHANDLE|asTYPEID_HANDLETOCONST)) != (subTypeId & ~(asTYPEID_OBJHANDLE|asTYPEID_HANDLETOCONST)) )
+ continue;
+
+ if( (flags & asTM_INREF) )
+ {
+ if( (paramTypeId & asTYPEID_OBJHANDLE) || (mustBeConst && !(flags & asTM_CONST)) )
+ continue;
+ }
+ else if( paramTypeId & asTYPEID_OBJHANDLE )
+ {
+ if( mustBeConst && !(paramTypeId & asTYPEID_HANDLETOCONST) )
+ continue;
+ }
+ else
+ continue;
+
+ if( isCmp )
+ {
+ if( cache->cmpFunc || cache->cmpFuncReturnCode )
+ {
+ cache->cmpFunc = 0;
+ cache->cmpFuncReturnCode = asMULTIPLE_FUNCTIONS;
+ }
+ else
+ cache->cmpFunc = func;
+ }
+ else if( isEq )
+ {
+ if( cache->eqFunc || cache->eqFuncReturnCode )
+ {
+ cache->eqFunc = 0;
+ cache->eqFuncReturnCode = asMULTIPLE_FUNCTIONS;
+ }
+ else
+ cache->eqFunc = func;
+ }
+ }
+ }
+ }
+
+ if( cache->eqFunc == 0 && cache->eqFuncReturnCode == 0 )
+ cache->eqFuncReturnCode = asNO_FUNCTION;
+ if( cache->cmpFunc == 0 && cache->cmpFuncReturnCode == 0 )
+ cache->cmpFuncReturnCode = asNO_FUNCTION;
+
+ // Set the user data only at the end so others that retrieve it will know it is complete
+ objType->SetUserData(cache, ARRAY_CACHE);
+
+ asReleaseExclusiveLock();
+}
+
+// GC behaviour
+void CScriptArray::EnumReferences(asIScriptEngine *engine)
+{
+ // TODO: If garbage collection can be done from a separate thread, then this method must be
+ // protected so that it doesn't get lost during the iteration if the array is modified
+
+ // If the array is holding handles, then we need to notify the GC of them
+ if( subTypeId & asTYPEID_MASK_OBJECT )
+ {
+ void **d = (void**)buffer->data;
+
+ asITypeInfo *subType = engine->GetTypeInfoById(subTypeId);
+ if ((subType->GetFlags() & asOBJ_REF))
+ {
+ // For reference types we need to notify the GC of each instance
+ for (asUINT n = 0; n < buffer->numElements; n++)
+ {
+ if (d[n])
+ engine->GCEnumCallback(d[n]);
+ }
+ }
+ else if ((subType->GetFlags() & asOBJ_VALUE) && (subType->GetFlags() & asOBJ_GC))
+ {
+ // For value types we need to forward the enum callback
+ // to the object so it can decide what to do
+ for (asUINT n = 0; n < buffer->numElements; n++)
+ {
+ if (d[n])
+ engine->ForwardGCEnumReferences(d[n], subType);
+ }
+ }
+ }
+}
+
+// GC behaviour
+void CScriptArray::ReleaseAllHandles(asIScriptEngine *)
+{
+ // Resizing to zero will release everything
+ Resize(0);
+}
+
+void CScriptArray::AddRef() const
+{
+ // Clear the GC flag then increase the counter
+ gcFlag = false;
+ asAtomicInc(refCount);
+}
+
+void CScriptArray::Release() const
+{
+ // Clearing the GC flag then descrease the counter
+ gcFlag = false;
+ if( asAtomicDec(refCount) == 0 )
+ {
+ // When reaching 0 no more references to this instance
+ // exists and the object should be destroyed
+ this->~CScriptArray();
+ userFree(const_cast<CScriptArray*>(this));
+ }
+}
+
+// GC behaviour
+int CScriptArray::GetRefCount()
+{
+ return refCount;
+}
+
+// GC behaviour
+void CScriptArray::SetFlag()
+{
+ gcFlag = true;
+}
+
+// GC behaviour
+bool CScriptArray::GetFlag()
+{
+ return gcFlag;
+}
+
+//--------------------------------------------
+// Generic calling conventions
+
+static void ScriptArrayFactory_Generic(asIScriptGeneric *gen)
+{
+ asITypeInfo *ti = *(asITypeInfo**)gen->GetAddressOfArg(0);
+
+ *reinterpret_cast<CScriptArray**>(gen->GetAddressOfReturnLocation()) = CScriptArray::Create(ti);
+}
+
+static void ScriptArrayFactory2_Generic(asIScriptGeneric *gen)
+{
+ asITypeInfo *ti = *(asITypeInfo**)gen->GetAddressOfArg(0);
+ asUINT length = gen->GetArgDWord(1);
+
+ *reinterpret_cast<CScriptArray**>(gen->GetAddressOfReturnLocation()) = CScriptArray::Create(ti, length);
+}
+
+static void ScriptArrayListFactory_Generic(asIScriptGeneric *gen)
+{
+ asITypeInfo *ti = *(asITypeInfo**)gen->GetAddressOfArg(0);
+ void *buf = gen->GetArgAddress(1);
+
+ *reinterpret_cast<CScriptArray**>(gen->GetAddressOfReturnLocation()) = CScriptArray::Create(ti, buf);
+}
+
+static void ScriptArrayFactoryDefVal_Generic(asIScriptGeneric *gen)
+{
+ asITypeInfo *ti = *(asITypeInfo**)gen->GetAddressOfArg(0);
+ asUINT length = gen->GetArgDWord(1);
+ void *defVal = gen->GetArgAddress(2);
+
+ *reinterpret_cast<CScriptArray**>(gen->GetAddressOfReturnLocation()) = CScriptArray::Create(ti, length, defVal);
+}
+
+static void ScriptArrayTemplateCallback_Generic(asIScriptGeneric *gen)
+{
+ asITypeInfo *ti = *(asITypeInfo**)gen->GetAddressOfArg(0);
+ bool *dontGarbageCollect = *(bool**)gen->GetAddressOfArg(1);
+ *reinterpret_cast<bool*>(gen->GetAddressOfReturnLocation()) = ScriptArrayTemplateCallback(ti, *dontGarbageCollect);
+}
+
+static void ScriptArrayAssignment_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *other = (CScriptArray*)gen->GetArgObject(0);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ *self = *other;
+ gen->SetReturnObject(self);
+}
+
+static void ScriptArrayEquals_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *other = (CScriptArray*)gen->GetArgObject(0);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ gen->SetReturnByte(self->operator==(*other));
+}
+
+static void ScriptArrayFind_Generic(asIScriptGeneric *gen)
+{
+ void *value = gen->GetArgAddress(0);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ gen->SetReturnDWord(self->Find(value));
+}
+
+static void ScriptArrayFind2_Generic(asIScriptGeneric *gen)
+{
+ asUINT index = gen->GetArgDWord(0);
+ void *value = gen->GetArgAddress(1);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ gen->SetReturnDWord(self->Find(index, value));
+}
+
+static void ScriptArrayFindByRef_Generic(asIScriptGeneric *gen)
+{
+ void *value = gen->GetArgAddress(0);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ gen->SetReturnDWord(self->FindByRef(value));
+}
+
+static void ScriptArrayFindByRef2_Generic(asIScriptGeneric *gen)
+{
+ asUINT index = gen->GetArgDWord(0);
+ void *value = gen->GetArgAddress(1);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ gen->SetReturnDWord(self->FindByRef(index, value));
+}
+
+static void ScriptArrayAt_Generic(asIScriptGeneric *gen)
+{
+ asUINT index = gen->GetArgDWord(0);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+
+ gen->SetReturnAddress(self->At(index));
+}
+
+static void ScriptArrayInsertAt_Generic(asIScriptGeneric *gen)
+{
+ asUINT index = gen->GetArgDWord(0);
+ void *value = gen->GetArgAddress(1);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->InsertAt(index, value);
+}
+
+static void ScriptArrayInsertAtArray_Generic(asIScriptGeneric *gen)
+{
+ asUINT index = gen->GetArgDWord(0);
+ CScriptArray *array = (CScriptArray*)gen->GetArgAddress(1);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->InsertAt(index, *array);
+}
+
+static void ScriptArrayRemoveAt_Generic(asIScriptGeneric *gen)
+{
+ asUINT index = gen->GetArgDWord(0);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->RemoveAt(index);
+}
+
+static void ScriptArrayRemoveRange_Generic(asIScriptGeneric *gen)
+{
+ asUINT start = gen->GetArgDWord(0);
+ asUINT count = gen->GetArgDWord(1);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->RemoveRange(start, count);
+}
+
+static void ScriptArrayInsertLast_Generic(asIScriptGeneric *gen)
+{
+ void *value = gen->GetArgAddress(0);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->InsertLast(value);
+}
+
+static void ScriptArrayRemoveLast_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->RemoveLast();
+}
+
+static void ScriptArrayLength_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+
+ gen->SetReturnDWord(self->GetSize());
+}
+
+static void ScriptArrayResize_Generic(asIScriptGeneric *gen)
+{
+ asUINT size = gen->GetArgDWord(0);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+
+ self->Resize(size);
+}
+
+static void ScriptArrayReserve_Generic(asIScriptGeneric *gen)
+{
+ asUINT size = gen->GetArgDWord(0);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->Reserve(size);
+}
+
+static void ScriptArraySortAsc_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->SortAsc();
+}
+
+static void ScriptArrayReverse_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->Reverse();
+}
+
+static void ScriptArrayIsEmpty_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ *reinterpret_cast<bool*>(gen->GetAddressOfReturnLocation()) = self->IsEmpty();
+}
+
+static void ScriptArraySortAsc2_Generic(asIScriptGeneric *gen)
+{
+ asUINT index = gen->GetArgDWord(0);
+ asUINT count = gen->GetArgDWord(1);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->SortAsc(index, count);
+}
+
+static void ScriptArraySortDesc_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->SortDesc();
+}
+
+static void ScriptArraySortDesc2_Generic(asIScriptGeneric *gen)
+{
+ asUINT index = gen->GetArgDWord(0);
+ asUINT count = gen->GetArgDWord(1);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->SortDesc(index, count);
+}
+
+static void ScriptArraySortCallback_Generic(asIScriptGeneric *gen)
+{
+ asIScriptFunction *callback = (asIScriptFunction*)gen->GetArgAddress(0);
+ asUINT startAt = gen->GetArgDWord(1);
+ asUINT count = gen->GetArgDWord(2);
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->Sort(callback, startAt, count);
+}
+
+static void ScriptArrayAddRef_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->AddRef();
+}
+
+static void ScriptArrayRelease_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->Release();
+}
+
+static void ScriptArrayGetRefCount_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ *reinterpret_cast<int*>(gen->GetAddressOfReturnLocation()) = self->GetRefCount();
+}
+
+static void ScriptArraySetFlag_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ self->SetFlag();
+}
+
+static void ScriptArrayGetFlag_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ *reinterpret_cast<bool*>(gen->GetAddressOfReturnLocation()) = self->GetFlag();
+}
+
+static void ScriptArrayEnumReferences_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ asIScriptEngine *engine = *(asIScriptEngine**)gen->GetAddressOfArg(0);
+ self->EnumReferences(engine);
+}
+
+static void ScriptArrayReleaseAllHandles_Generic(asIScriptGeneric *gen)
+{
+ CScriptArray *self = (CScriptArray*)gen->GetObject();
+ asIScriptEngine *engine = *(asIScriptEngine**)gen->GetAddressOfArg(0);
+ self->ReleaseAllHandles(engine);
+}
+
+static void RegisterScriptArray_Generic(asIScriptEngine *engine)
+{
+ int r = 0;
+ UNUSED_VAR(r);
+
+ engine->SetTypeInfoUserDataCleanupCallback(CleanupTypeInfoArrayCache, ARRAY_CACHE);
+
+ r = engine->RegisterObjectType("array<class T>", 0, asOBJ_REF | asOBJ_GC | asOBJ_TEMPLATE); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_TEMPLATE_CALLBACK, "bool f(int&in, bool&out)", asFUNCTION(ScriptArrayTemplateCallback_Generic), asCALL_GENERIC); assert( r >= 0 );
+
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in)", asFUNCTION(ScriptArrayFactory_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in, uint length) explicit", asFUNCTION(ScriptArrayFactory2_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in, uint length, const T &in value)", asFUNCTION(ScriptArrayFactoryDefVal_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_LIST_FACTORY, "array<T>@ f(int&in, int&in) {repeat T}", asFUNCTION(ScriptArrayListFactory_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_ADDREF, "void f()", asFUNCTION(ScriptArrayAddRef_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_RELEASE, "void f()", asFUNCTION(ScriptArrayRelease_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "T &opIndex(uint index)", asFUNCTION(ScriptArrayAt_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "const T &opIndex(uint index) const", asFUNCTION(ScriptArrayAt_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "array<T> &opAssign(const array<T>&in)", asFUNCTION(ScriptArrayAssignment_Generic), asCALL_GENERIC); assert( r >= 0 );
+
+ r = engine->RegisterObjectMethod("array<T>", "void insertAt(uint index, const T&in value)", asFUNCTION(ScriptArrayInsertAt_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void insertAt(uint index, const array<T>& arr)", asFUNCTION(ScriptArrayInsertAtArray_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void insertLast(const T&in value)", asFUNCTION(ScriptArrayInsertLast_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void removeAt(uint index)", asFUNCTION(ScriptArrayRemoveAt_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void removeLast()", asFUNCTION(ScriptArrayRemoveLast_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void removeRange(uint start, uint count)", asFUNCTION(ScriptArrayRemoveRange_Generic), asCALL_GENERIC); assert(r >= 0);
+#if AS_USE_ACCESSORS != 1
+ r = engine->RegisterObjectMethod("array<T>", "uint length() const", asFUNCTION(ScriptArrayLength_Generic), asCALL_GENERIC); assert( r >= 0 );
+#endif
+ r = engine->RegisterObjectMethod("array<T>", "void reserve(uint length)", asFUNCTION(ScriptArrayReserve_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void resize(uint length)", asFUNCTION(ScriptArrayResize_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void sortAsc()", asFUNCTION(ScriptArraySortAsc_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void sortAsc(uint startAt, uint count)", asFUNCTION(ScriptArraySortAsc2_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void sortDesc()", asFUNCTION(ScriptArraySortDesc_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void sortDesc(uint startAt, uint count)", asFUNCTION(ScriptArraySortDesc2_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void reverse()", asFUNCTION(ScriptArrayReverse_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "int find(const T&in if_handle_then_const value) const", asFUNCTION(ScriptArrayFind_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "int find(uint startAt, const T&in if_handle_then_const value) const", asFUNCTION(ScriptArrayFind2_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "int findByRef(const T&in if_handle_then_const value) const", asFUNCTION(ScriptArrayFindByRef_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "int findByRef(uint startAt, const T&in if_handle_then_const value) const", asFUNCTION(ScriptArrayFindByRef2_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "bool opEquals(const array<T>&in) const", asFUNCTION(ScriptArrayEquals_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "bool isEmpty() const", asFUNCTION(ScriptArrayIsEmpty_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterFuncdef("bool array<T>::less(const T&in if_handle_then_const a, const T&in if_handle_then_const b)");
+ r = engine->RegisterObjectMethod("array<T>", "void sort(const less &in, uint startAt = 0, uint count = uint(-1))", asFUNCTION(ScriptArraySortCallback_Generic), asCALL_GENERIC); assert(r >= 0);
+
+#if AS_USE_STLNAMES != 1 && AS_USE_ACCESSORS == 1
+ r = engine->RegisterObjectMethod("array<T>", "uint get_length() const property", asFUNCTION(ScriptArrayLength_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void set_length(uint) property", asFUNCTION(ScriptArrayResize_Generic), asCALL_GENERIC); assert( r >= 0 );
+#endif
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_GETREFCOUNT, "int f()", asFUNCTION(ScriptArrayGetRefCount_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_SETGCFLAG, "void f()", asFUNCTION(ScriptArraySetFlag_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_GETGCFLAG, "bool f()", asFUNCTION(ScriptArrayGetFlag_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_ENUMREFS, "void f(int&in)", asFUNCTION(ScriptArrayEnumReferences_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_RELEASEREFS, "void f(int&in)", asFUNCTION(ScriptArrayReleaseAllHandles_Generic), asCALL_GENERIC); assert( r >= 0 );
+}
+
+END_AS_NAMESPACE
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.h b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.h
new file mode 100644
index 00000000000..a6e7bbc792a
--- /dev/null
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.h
@@ -0,0 +1,143 @@
+#ifndef SCRIPTARRAY_H
+#define SCRIPTARRAY_H
+
+#ifndef ANGELSCRIPT_H
+// Avoid having to inform include path if header is already include before
+#include "hpl1/engine/libraries/angelscript/angelscript.h"
+#endif
+
+// Sometimes it may be desired to use the same method names as used by C++ STL.
+// This may for example reduce time when converting code from script to C++ or
+// back.
+//
+// 0 = off
+// 1 = on
+#ifndef AS_USE_STLNAMES
+#define AS_USE_STLNAMES 0
+#endif
+
+// Some prefer to use property accessors to get/set the length of the array
+// This option registers the accessors instead of the method length()
+#ifndef AS_USE_ACCESSORS
+#define AS_USE_ACCESSORS 0
+#endif
+
+BEGIN_AS_NAMESPACE
+
+struct SArrayBuffer;
+struct SArrayCache;
+
+class CScriptArray
+{
+public:
+ // Set the memory functions that should be used by all CScriptArrays
+ static void SetMemoryFunctions(asALLOCFUNC_t allocFunc, asFREEFUNC_t freeFunc);
+
+ // Factory functions
+ static CScriptArray *Create(asITypeInfo *ot);
+ static CScriptArray *Create(asITypeInfo *ot, asUINT length);
+ static CScriptArray *Create(asITypeInfo *ot, asUINT length, void *defaultValue);
+ static CScriptArray *Create(asITypeInfo *ot, void *listBuffer);
+
+ // Memory management
+ void AddRef() const;
+ void Release() const;
+
+ // Type information
+ asITypeInfo *GetArrayObjectType() const;
+ int GetArrayTypeId() const;
+ int GetElementTypeId() const;
+
+ // Get the current size
+ asUINT GetSize() const;
+
+ // Returns true if the array is empty
+ bool IsEmpty() const;
+
+ // Pre-allocates memory for elements
+ void Reserve(asUINT maxElements);
+
+ // Resize the array
+ void Resize(asUINT numElements);
+
+ // Get a pointer to an element. Returns 0 if out of bounds
+ void *At(asUINT index);
+ const void *At(asUINT index) const;
+
+ // Set value of an element.
+ // The value arg should be a pointer to the value that will be copied to the element.
+ // Remember, if the array holds handles the value parameter should be the
+ // address of the handle. The refCount of the object will also be incremented
+ void SetValue(asUINT index, void *value);
+
+ // Copy the contents of one array to another (only if the types are the same)
+ CScriptArray &operator=(const CScriptArray&);
+
+ // Compare two arrays
+ bool operator==(const CScriptArray &) const;
+
+ // Array manipulation
+ void InsertAt(asUINT index, void *value);
+ void InsertAt(asUINT index, const CScriptArray &arr);
+ void InsertLast(void *value);
+ void RemoveAt(asUINT index);
+ void RemoveLast();
+ void RemoveRange(asUINT start, asUINT count);
+ void SortAsc();
+ void SortDesc();
+ void SortAsc(asUINT startAt, asUINT count);
+ void SortDesc(asUINT startAt, asUINT count);
+ void Sort(asUINT startAt, asUINT count, bool asc);
+ void Sort(asIScriptFunction *less, asUINT startAt, asUINT count);
+ void Reverse();
+ int Find(void *value) const;
+ int Find(asUINT startAt, void *value) const;
+ int FindByRef(void *ref) const;
+ int FindByRef(asUINT startAt, void *ref) const;
+
+ // Return the address of internal buffer for direct manipulation of elements
+ void *GetBuffer();
+
+ // GC methods
+ int GetRefCount();
+ void SetFlag();
+ bool GetFlag();
+ void EnumReferences(asIScriptEngine *engine);
+ void ReleaseAllHandles(asIScriptEngine *engine);
+
+protected:
+ mutable int refCount;
+ mutable bool gcFlag;
+ asITypeInfo *objType;
+ SArrayBuffer *buffer;
+ int elementSize;
+ int subTypeId;
+
+ // Constructors
+ CScriptArray(asITypeInfo *ot, void *initBuf); // Called from script when initialized with list
+ CScriptArray(asUINT length, asITypeInfo *ot);
+ CScriptArray(asUINT length, void *defVal, asITypeInfo *ot);
+ CScriptArray(const CScriptArray &other);
+ virtual ~CScriptArray();
+
+ bool Less(const void *a, const void *b, bool asc);
+ void *GetArrayItemPointer(int index);
+ void *GetDataPointer(void *buffer);
+ void Copy(void *dst, void *src);
+ void Swap(void *a, void *b);
+ void Precache();
+ bool CheckMaxSize(asUINT numElements);
+ void Resize(int delta, asUINT at);
+ void CreateBuffer(SArrayBuffer **buf, asUINT numElements);
+ void DeleteBuffer(SArrayBuffer *buf);
+ void CopyBuffer(SArrayBuffer *dst, SArrayBuffer *src);
+ void Construct(SArrayBuffer *buf, asUINT start, asUINT end);
+ void Destruct(SArrayBuffer *buf, asUINT start, asUINT end);
+ bool Equals(const void *a, const void *b, asIScriptContext *ctx, SArrayCache *cache) const;
+};
+
+void RegisterScriptArray(asIScriptEngine *engine, bool defaultArray);
+
+END_AS_NAMESPACE
+
+#endif
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index f960b4dac5e..b0ef3fab1c4 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -21,6 +21,7 @@
#include "hpl1/engine/impl/SqScript.h"
#include "hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h"
+#include "hpl1/engine/libraries/angelscript/add-ons/scriptarray.h"
#include "hpl1/engine/libraries/angelscript/angelscript.h"
#include "hpl1/engine/system/String.h"
@@ -33,6 +34,7 @@ namespace hpl {
LowLevelSystem::LowLevelSystem() {
_scriptEngine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
+ RegisterScriptArray(_scriptEngine, true);
_scriptOutput = hplNew(cScriptOutput, ());
_scriptEngine->SetMessageCallback(asMETHOD(cScriptOutput, AddMessage), _scriptOutput, asCALL_THISCALL);
RegisterStdString(_scriptEngine);
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 90396a81978..2f69eb07b4f 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -125,6 +125,7 @@ MODULE_OBJS := \
engine/impl/VideoStreamTheora.o \
engine/libraries/angelscript/add-ons/scriptstdstring.o \
engine/libraries/angelscript/add-ons/scripthelper.o \
+ engine/libraries/angelscript/add-ons/scriptarray.o \
engine/impl/tinyXML/tinyxml.o \
engine/impl/tinyXML/tinyxmlerror.o \
engine/impl/tinyXML/tinyxmlparser.o \
Commit: 22800496153ad895056b5690a44f4766ca084ea9
https://github.com/scummvm/scummvm/commit/22800496153ad895056b5690a44f4766ca084ea9
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:56+01:00
Commit Message:
HPL1: check for equality with 0 on ray intersect
this fixes interactions with objects inside collision boxes
Changed paths:
engines/hpl1/penumbra-overture/PlayerHelper.cpp
diff --git a/engines/hpl1/penumbra-overture/PlayerHelper.cpp b/engines/hpl1/penumbra-overture/PlayerHelper.cpp
index d9dffc4f721..70ebd8c8817 100644
--- a/engines/hpl1/penumbra-overture/PlayerHelper.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerHelper.cpp
@@ -203,7 +203,7 @@ bool cPlayerPickRayCallback::OnIntersect(iPhysicsBody *apBody, cPhysicsRayParams
float &fDist = apParams->mfDist;
// Must be positive
- if (fDist < 0)
+ if (fDist <= 0)
return true;
// Must be below max distance
Commit: 95ccf4fd709769fcbdd0c1fbdb063cd698bf4ff2
https://github.com/scummvm/scummvm/commit/95ccf4fd709769fcbdd0c1fbdb063cd698bf4ff2
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:57+01:00
Commit Message:
HPL1: allow if with empty statements in scripts
without this, 'level01_12_water_cave_tunnels.hps' line 669 failes to compile
Changed paths:
engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
index 1fa38ddde2a..01dfe07c36a 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
@@ -4411,13 +4411,13 @@ void asCCompiler::CompileIfStatement(asCScriptNode *inode, bool *hasReturn, asCB
// Add the byte code
LineInstr(bc, inode->firstChild->next->tokenPos);
bc->AddCode(&ifBC);
-
+#if 0
if( inode->firstChild->next->nodeType == snExpressionStatement && inode->firstChild->next->firstChild == 0 )
{
// Don't allow if( expr );
Error(TXT_IF_WITH_EMPTY_STATEMENT, inode->firstChild->next);
}
-
+#endif
// If one of the statements call the constructor, the other must as well
// otherwise it is possible the constructor is never called
bool constructorCall1 = false;
Commit: 7fd63e902b94a1074d153c1e47c0157cb2249d43
https://github.com/scummvm/scummvm/commit/7fd63e902b94a1074d153c1e47c0157cb2249d43
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:57+01:00
Commit Message:
HPL1: fix material water and implement water shaders
Changed paths:
A engines/hpl1/engine/impl/shaders/Water_Diffuse.fragment
A engines/hpl1/engine/impl/shaders/Water_Fog.fragment
engines/hpl1/engine/graphics/Material_Water.cpp
engines/hpl1/engine/graphics/Material_Water.h
engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
engines/hpl1/engine/impl/shaders/Water_Fog.vertex
engines/hpl1/engine/impl/shaders/refract_water.vertex
diff --git a/engines/hpl1/engine/graphics/Material_Water.cpp b/engines/hpl1/engine/graphics/Material_Water.cpp
index 420a76a5c53..bb58d92c386 100644
--- a/engines/hpl1/engine/graphics/Material_Water.cpp
+++ b/engines/hpl1/engine/graphics/Material_Water.cpp
@@ -85,15 +85,9 @@ cMaterial_Water::cMaterial_Water(const tString &asName, iLowLevelGraphics *apLow
mbIsGlowing = false;
mbUsesLights = false;
- // gModulateFog.SetUp(apLowLevelGraphics);
-
- //mpFogVtxProg = mpProgramManager->CreateProgram("Water_Fog_vp.cg", "main",
- // eGpuProgramType_Vertex);
-
- _refractShader = mpProgramManager->CreateProgram("refract_water", "refract_water");
-
- // iGpuProgram *pVtxProg = mpProgramManager->CreateProgram("Water_Diffuse_vp.cg", "main", eGpuProgramType_Vertex);
- // SetProgram(pVtxProg, eGpuProgramType_Vertex, 0);
+ _fogProgram = mpProgramManager->CreateProgram("Water_Fog", "Water_Fog");
+ _diffuseProgram = mpProgramManager->CreateProgram("Water_Diffuse", "Water_Diffuse");
+ _refractProgram = mpProgramManager->CreateProgram("refract_water", "refract_water");
mfTime = 0;
}
@@ -101,8 +95,12 @@ cMaterial_Water::cMaterial_Water(const tString &asName, iLowLevelGraphics *apLow
//-----------------------------------------------------------------------
cMaterial_Water::~cMaterial_Water() {
- if (_refractShader)
- mpProgramManager->Destroy(_refractShader);
+ if (_fogProgram)
+ mpProgramManager->Destroy(_fogProgram);
+ if (_diffuseProgram)
+ mpProgramManager->Destroy(_diffuseProgram);
+ if (_refractProgram)
+ mpProgramManager->Destroy(_refractProgram);
}
//-----------------------------------------------------------------------
@@ -122,7 +120,9 @@ void cMaterial_Water::Update(float afTimeStep) {
//-----------------------------------------------------------------------
iGpuProgram *cMaterial_Water::getGpuProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- return _refractShader;
+ if (mpRenderSettings->mbFogActive)
+ return _fogProgram;
+ return _diffuseProgram;
}
iMaterialProgramSetup *cMaterial_Water::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
@@ -131,14 +131,6 @@ iMaterialProgramSetup *cMaterial_Water::getGpuProgramSetup(const eMaterialRender
return &gWaterProgramSetup;
}
-
-iGpuProgram *cMaterial_Water::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (mpRenderSettings->mbFogActive)
- return mpFogVtxProg;
- else
- return mpProgram[eGpuProgramType_Vertex][0];
-}
-
bool cMaterial_Water::VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
return false;
}
@@ -194,7 +186,7 @@ tTextureTypeList cMaterial_Water::GetTextureTypes() {
vTypes.push_back(cTextureType("", eMaterialTexture_Diffuse));
vTypes.push_back(cTextureType("", eMaterialTexture_Specular));
- if (mpRefractVtxProg && mpRefractFragProg)
+ if (_refractProgram)
vTypes.push_back(cTextureType("", eMaterialTexture_Refraction));
return vTypes;
diff --git a/engines/hpl1/engine/graphics/Material_Water.h b/engines/hpl1/engine/graphics/Material_Water.h
index 163a933c35e..0311a076ad2 100644
--- a/engines/hpl1/engine/graphics/Material_Water.h
+++ b/engines/hpl1/engine/graphics/Material_Water.h
@@ -51,7 +51,6 @@ public:
iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
- iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
@@ -64,7 +63,7 @@ public:
int GetNumOfPasses(eMaterialRenderType aType, iLight3D *apLight) { return 1; }
- iGpuProgram * getRefractionProgram() { return _refractShader; }
+ iGpuProgram *getRefractionProgram() { return _refractProgram; }
bool GetRefractionUsesDiffuse() { return true; }
eMaterialTexture GetRefractionDiffuseTexture() { return eMaterialTexture_Specular; }
bool GetRefractionUsesEye() { return true; }
@@ -84,11 +83,9 @@ public:
tVertexVec *apVtxVec, cVector3f *apTransform, unsigned int alIndexAdd) {}
private:
- iGpuProgram *mpFogVtxProg;
-
- iGpuProgram *_refractShader;
- iGpuProgram *mpRefractVtxProg;
- iGpuProgram *mpRefractFragProg;
+ iGpuProgram *_fogProgram;
+ iGpuProgram *_diffuseProgram;
+ iGpuProgram *_refractProgram;
float mfTime;
};
diff --git a/engines/hpl1/engine/impl/shaders/Water_Diffuse.fragment b/engines/hpl1/engine/impl/shaders/Water_Diffuse.fragment
new file mode 100644
index 00000000000..6c1e5170ed4
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Water_Diffuse.fragment
@@ -0,0 +1,13 @@
+// Water_Diffuse.fragment
+
+in vec3 vColor;
+in vec2 vUv;
+
+OUTPUT
+
+uniform sampler2D tex0; //diffuse
+
+void main() {
+ outColor = texture(tex0, vUv);
+ outColor.xyz *= vColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex b/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
index bed05771b2e..e7a67e21724 100644
--- a/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
+++ b/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
@@ -11,10 +11,10 @@
vec4 position = gl_Vertex;
vec3 color = gl_Color.xyz;
-vec3 uv = gl_MultiTexCoord0.xyz;
+vec2 uv = gl_MultiTexCoord0.xy;
out vec3 vColor;
-out vec3 vUv;
+out vec2 vUv;
uniform mat4 worldViewProj;
uniform float timeCount;
diff --git a/engines/hpl1/engine/impl/shaders/Water_Fog.fragment b/engines/hpl1/engine/impl/shaders/Water_Fog.fragment
new file mode 100644
index 00000000000..d17ec01bbad
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Water_Fog.fragment
@@ -0,0 +1,14 @@
+// Water_Diffuse.fragment
+
+in vec4 vColor;
+in vec2 vUv;
+in float vFogUv;
+
+OUTPUT
+
+uniform sampler2D tex0; // diffuse
+uniform sampler1D tex1; // fog
+
+void main() {
+ outColor = texture(tex0, vUv) * texture1D(tex1, vFogUv).rrrg * vColor;
+}
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/shaders/Water_Fog.vertex b/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
index 0b042a94798..f8d48c1382f 100644
--- a/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
+++ b/engines/hpl1/engine/impl/shaders/Water_Fog.vertex
@@ -11,10 +11,10 @@
vec4 position = gl_Vertex;
vec4 color = gl_Color;
-vec3 uv = gl_MultiTexCoord0.xyz;
+vec2 uv = gl_MultiTexCoord0.xy;
-out vec4 vColor
-out vec3 vUv;
+out vec4 vColor;
+out vec2 vUv;
out float vFogUv;
uniform mat4 worldViewProj;
diff --git a/engines/hpl1/engine/impl/shaders/refract_water.vertex b/engines/hpl1/engine/impl/shaders/refract_water.vertex
index d9c39e46ed8..b1a14f50f45 100644
--- a/engines/hpl1/engine/impl/shaders/refract_water.vertex
+++ b/engines/hpl1/engine/impl/shaders/refract_water.vertex
@@ -14,8 +14,7 @@ vec4 color = gl_Color;
vec2 uv = gl_MultiTexCoord0.xy;
vec3 normal = gl_Normal;
-
-out vec4 vColor
+out vec4 vColor;
out vec2 vUv;
out vec3 vNormal;
out vec3 vEyePos;
Commit: d0dbf8fb5a1101bf37ab368e348cef40638362bc
https://github.com/scummvm/scummvm/commit/d0dbf8fb5a1101bf37ab368e348cef40638362bc
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:57+01:00
Commit Message:
HPL1: fix issue with crane in level 11 not updating
Changed paths:
engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
diff --git a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
index e966f6041bf..a1b7ba20b96 100644
--- a/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsJointSliderNewton.cpp
@@ -31,6 +31,7 @@
#include "hpl1/engine/impl/PhysicsWorldNewton.h"
#include "hpl1/engine/system/low_level_system.h"
+#include "common/str.h"
namespace hpl {
@@ -76,6 +77,10 @@ cPhysicsJointSliderNewton::~cPhysicsJointSliderNewton() {
void cPhysicsJointSliderNewton::SetMaxDistance(float afX) {
mfMaxDistance = afX;
+ // fixes a problem with the crane in level 11 (new storage room) not updating
+ // after the the limits have been changed, preventing it from moving
+ if (mpChildBody && Common::String(msName.c_str()).contains("crane"))
+ mpChildBody->AddImpulse({0.001f, 0.001f, 0.001f});
}
void cPhysicsJointSliderNewton::SetMinDistance(float afX) {
mfMinDistance = afX;
Commit: 4a52032bdee9e7e36ed1a0aedcbba69482357be5
https://github.com/scummvm/scummvm/commit/4a52032bdee9e7e36ed1a0aedcbba69482357be5
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:03:57+01:00
Commit Message:
HPL1: remove optimisations in collider creation
this fixes a problem with an entrance being blocked by wrong colliders
Changed paths:
engines/hpl1/engine/impl/CollideShapeNewton.cpp
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.cpp b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
index 20f844dabe1..26a3ad0fd5c 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.cpp
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
@@ -257,11 +257,7 @@ void cCollideShapeNewton::CreateFromVertices(const unsigned int *apIndexArray, i
const float *apVertexArray, int alVtxStride, int alVtxNum) {
float vTriVec[9];
- bool bOptimize = false;
- bool bCreatedPlane = false;
- cPlanef plane;
-
- mpNewtonCollision = NewtonCreateTreeCollision(mpNewtonWorld, NULL);
+ mpNewtonCollision = NewtonCreateTreeCollision(mpNewtonWorld, 0);
// Log("-- Creating mesh collision.:\n");
NewtonTreeCollisionBeginBuild(mpNewtonCollision);
for (int tri = 0; tri < alIndexNum; tri += 3) {
@@ -274,34 +270,10 @@ void cCollideShapeNewton::CreateFromVertices(const unsigned int *apIndexArray, i
vTriVec[idx * 3 + 2] = apVertexArray[lVtx + 2];
}
- if (bOptimize == false) {
- cPlanef tempPlane;
- cVector3f vP1(vTriVec[0 + 0], vTriVec[0 + 1], vTriVec[0 + 2]);
- cVector3f vP2(vTriVec[1 * 3 + 0], vTriVec[1 * 3 + 1], vTriVec[1 * 3 + 2]);
- cVector3f vP3(vTriVec[2 * 3 + 0], vTriVec[2 * 3 + 1], vTriVec[2 * 3 + 2]);
-
- tempPlane.FromPoints(vP1, vP2, vP3);
-
- // Log("P1: %s P2: %s P3: %s\n",vP1.ToString().c_str(),vP2.ToString().c_str(),vP3.ToString().c_str());
- // Log("Plane: a: %f b: %f c: %f d: %f\n",tempPlane.a,tempPlane.b,tempPlane.c,tempPlane.d);
-
- if (bCreatedPlane == false) {
- plane = tempPlane;
- bCreatedPlane = true;
- } else {
- if (std::abs(plane.a - tempPlane.a) > 0.001f ||
- std::abs(plane.b - tempPlane.b) > 0.001f ||
- std::abs(plane.c - tempPlane.c) > 0.001f ||
- std::abs(plane.d - tempPlane.d) > 0.001f) {
- bOptimize = true;
- }
- }
- }
-
NewtonTreeCollisionAddFace(mpNewtonCollision, 3, vTriVec, sizeof(float) * 3, 1);
}
- NewtonTreeCollisionEndBuild(mpNewtonCollision, bOptimize ? 1 : 0);
+ NewtonTreeCollisionEndBuild(mpNewtonCollision, false);
// Set bounding box size
mBoundingVolume.AddArrayPoints(apVertexArray, alVtxNum);
Commit: b4af807761368b73e1bab674678bf2ae65ed8907
https://github.com/scummvm/scummvm/commit/b4af807761368b73e1bab674678bf2ae65ed8907
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:57+01:00
Commit Message:
HPL1: Remove Unecessary Semicolons Causing GCC Compiler Warnings
These warnings are emitted when -Wpedantic is passed to GCC.
Changed paths:
engines/hpl1/engine/game/GameTypes.h
engines/hpl1/engine/game/Updateable.h
engines/hpl1/engine/graphics/Material_BumpColorSpec.h
engines/hpl1/engine/graphics/ParticleEmitter3D.h
engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
engines/hpl1/engine/gui/GuiTypes.h
engines/hpl1/engine/impl/KeyboardSDL.h
engines/hpl1/engine/impl/MouseSDL.h
engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
engines/hpl1/engine/input/Input.h
engines/hpl1/engine/input/InputTypes.h
engines/hpl1/engine/input/Keyboard.h
engines/hpl1/engine/input/Mouse.h
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.cpp
engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
engines/hpl1/engine/math/hplMatrix.h
engines/hpl1/engine/resources/ResourceImage.h
engines/hpl1/engine/system/SerializeClass.h
diff --git a/engines/hpl1/engine/game/GameTypes.h b/engines/hpl1/engine/game/GameTypes.h
index ca05e495009..5afbb4ce0a7 100644
--- a/engines/hpl1/engine/game/GameTypes.h
+++ b/engines/hpl1/engine/game/GameTypes.h
@@ -44,6 +44,6 @@ class cScriptVar : public iSerializable {
typedef std::map<tString, cScriptVar> tScriptVarMap;
typedef tScriptVarMap::iterator tScriptVarMapIt;
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_GAME_TYPES_H
diff --git a/engines/hpl1/engine/game/Updateable.h b/engines/hpl1/engine/game/Updateable.h
index f7535b29748..135d89f7ec9 100644
--- a/engines/hpl1/engine/game/Updateable.h
+++ b/engines/hpl1/engine/game/Updateable.h
@@ -58,6 +58,6 @@ public:
private:
tString msName;
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_UPDATEABLE_H
diff --git a/engines/hpl1/engine/graphics/Material_BumpColorSpec.h b/engines/hpl1/engine/graphics/Material_BumpColorSpec.h
index e04d4e24889..0fba4c7eab4 100644
--- a/engines/hpl1/engine/graphics/Material_BumpColorSpec.h
+++ b/engines/hpl1/engine/graphics/Material_BumpColorSpec.h
@@ -55,6 +55,6 @@ public:
eMaterialPicture aPicture, cRenderer3D *apRenderer3D);
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_MATERIAL_BUMP_COLOR_SPEC_H
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D.h b/engines/hpl1/engine/graphics/ParticleEmitter3D.h
index a5874ef9b3d..43ca58d06bb 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D.h
@@ -172,6 +172,6 @@ protected:
// ---
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_PARTICLE_EMITTER_3D_H
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
index 8e801bf8432..7a62bc10dcb 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
@@ -274,6 +274,6 @@ private:
bool mbRespawn;
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_PARTICLE_EMITTER_3D_USER_DATA_H
diff --git a/engines/hpl1/engine/gui/GuiTypes.h b/engines/hpl1/engine/gui/GuiTypes.h
index c874b8b52b7..5d189ff19ab 100644
--- a/engines/hpl1/engine/gui/GuiTypes.h
+++ b/engines/hpl1/engine/gui/GuiTypes.h
@@ -323,6 +323,6 @@ typedef tGuiGfxElementList::iterator tGuiGfxElementListIt;
//--------------------------------
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_GAME_TYPES_H
diff --git a/engines/hpl1/engine/impl/KeyboardSDL.h b/engines/hpl1/engine/impl/KeyboardSDL.h
index bc7beb512f2..6af5a2d6815 100644
--- a/engines/hpl1/engine/impl/KeyboardSDL.h
+++ b/engines/hpl1/engine/impl/KeyboardSDL.h
@@ -69,6 +69,6 @@ private:
cLowLevelInputSDL *_lowLevelSystem;
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_KEYBOARD_SDL_H
diff --git a/engines/hpl1/engine/impl/MouseSDL.h b/engines/hpl1/engine/impl/MouseSDL.h
index 7219c23afb8..6b8069107f1 100644
--- a/engines/hpl1/engine/impl/MouseSDL.h
+++ b/engines/hpl1/engine/impl/MouseSDL.h
@@ -84,6 +84,6 @@ private:
iLowLevelGraphics *_lowLevelGraphics;
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_MOUSE_SDL_H
diff --git a/engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp b/engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
index 9a120874a89..5cc873b1328 100644
--- a/engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundEnvironment.cpp
@@ -120,4 +120,4 @@ bool cOpenALSoundEnvironment::CreateFromFile(const tString &asFile) {
return true;
}
-}; // namespace hpl
+} // namespace hpl
diff --git a/engines/hpl1/engine/input/Input.h b/engines/hpl1/engine/input/Input.h
index ed24c4b1c6c..5e74ec5649f 100644
--- a/engines/hpl1/engine/input/Input.h
+++ b/engines/hpl1/engine/input/Input.h
@@ -144,6 +144,6 @@ private:
iMouse *mpMouse;
iKeyboard *mpKeyboard;
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_INPUT_H
diff --git a/engines/hpl1/engine/input/InputTypes.h b/engines/hpl1/engine/input/InputTypes.h
index 3eb40f1d1e2..5e1d46aee84 100644
--- a/engines/hpl1/engine/input/InputTypes.h
+++ b/engines/hpl1/engine/input/InputTypes.h
@@ -220,6 +220,6 @@ struct cKeyPress {
int mlModifier;
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_INPUT_TYPES_H
diff --git a/engines/hpl1/engine/input/Keyboard.h b/engines/hpl1/engine/input/Keyboard.h
index 4535d581c95..d6f175e8658 100644
--- a/engines/hpl1/engine/input/Keyboard.h
+++ b/engines/hpl1/engine/input/Keyboard.h
@@ -74,6 +74,6 @@ public:
virtual eKey StringToKey(tString) = 0;
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_KEYBOARD_H
diff --git a/engines/hpl1/engine/input/Mouse.h b/engines/hpl1/engine/input/Mouse.h
index 7d98a4a72ac..db71c218872 100644
--- a/engines/hpl1/engine/input/Mouse.h
+++ b/engines/hpl1/engine/input/Mouse.h
@@ -70,6 +70,6 @@ public:
float afMaxPercent, unsigned int alBufferSize) = 0;
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_MOUSE_H
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
index 3aaef2d4bb7..6c54fc0fc01 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
@@ -1134,7 +1134,7 @@ void dgMeshEffect::PackVertexArrays() {
m_attib = attibArray;
m_maxAtribCount = m_atribCount;
}
-};
+}
#ifdef __USE_DOUBLE_PRECISION__
void dgMeshEffect::AddPolygon(dgInt32 count, const dgFloat32 *const vertexList, dgInt32 strideIndBytes, dgInt32 material)
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.cpp
index 047e61ad811..e267f8d3c1f 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.cpp
@@ -85,7 +85,7 @@ bool dgMeshTreeCSGFace::CheckConvex(const dgHugeVector &normal) const {
e0 = e1.Scale(dgGoogol(-1.0f));
}
return true;
-};
+}
void dgMeshTreeCSGFace::MergeMissingVertex(const dgMeshTreeCSGFace *const face) {
for (dgMeshTreeCSGFace::dgListNode *outNode = GetFirst();
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp b/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
index eae91dee928..7c699dbe556 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
@@ -663,7 +663,7 @@ void dgWorld::Update(dgFloat32 timestep) {
OnGetPerformanceCountCallback dgWorld::GetPerformaceFuntion() const {
return m_getPerformanceCount;
-};
+}
void dgWorld::SetPerfomanceCounter(OnGetPerformanceCountCallback callback) {
m_threadsManager.SetPerfomanceCounter(callback);
diff --git a/engines/hpl1/engine/math/hplMatrix.h b/engines/hpl1/engine/math/hplMatrix.h
index b28ce41d1af..b2b67489b17 100644
--- a/engines/hpl1/engine/math/hplMatrix.h
+++ b/engines/hpl1/engine/math/hplMatrix.h
@@ -274,6 +274,6 @@ public:
}
};
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_MATRIX_H
diff --git a/engines/hpl1/engine/resources/ResourceImage.h b/engines/hpl1/engine/resources/ResourceImage.h
index 4e32122341d..78f001449ae 100644
--- a/engines/hpl1/engine/resources/ResourceImage.h
+++ b/engines/hpl1/engine/resources/ResourceImage.h
@@ -87,6 +87,6 @@ private:
typedef std::vector<cResourceImage *> tResourceImageVec;
typedef tResourceImageVec::iterator tResourceImageVecIt;
-}; // namespace hpl
+} // namespace hpl
#endif // HPL_RESOURCE_IMAGE_H
diff --git a/engines/hpl1/engine/system/SerializeClass.h b/engines/hpl1/engine/system/SerializeClass.h
index fda268d35b3..8b0e8bcaf6a 100644
--- a/engines/hpl1/engine/system/SerializeClass.h
+++ b/engines/hpl1/engine/system/SerializeClass.h
@@ -359,5 +359,5 @@ private:
//-------------------------------------------------
-};
+}
#endif // HPL_SERIALIZE_CLASS_H
Commit: 1b4ce6ebadd3b7eb9f69c8b1f7cd9f47e037f098
https://github.com/scummvm/scummvm/commit/1b4ce6ebadd3b7eb9f69c8b1f7cd9f47e037f098
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:57+01:00
Commit Message:
HPL1: Fix Struct vs. Class Mismatch Causing GCC Compiler Warning
This is emitted if -Wmismatched-tags is passed to GCC.
Changed paths:
engines/hpl1/opengl.h
diff --git a/engines/hpl1/opengl.h b/engines/hpl1/opengl.h
index 0f65156d153..f2e6503beb1 100644
--- a/engines/hpl1/opengl.h
+++ b/engines/hpl1/opengl.h
@@ -30,7 +30,7 @@
namespace Graphics {
-class Surface;
+struct Surface;
}
@@ -45,4 +45,4 @@ Common::ScopedPtr<Graphics::Surface> createViewportScreenshot();
#define GL_CHECK(x) {x; ::Hpl1::checkOGLErrors(__func__, __LINE__);}
#define GL_CHECK_FN() GL_CHECK()
-#endif
\ No newline at end of file
+#endif
Commit: 3f040f0bf03807efc3b783509cc688b7f9d59007
https://github.com/scummvm/scummvm/commit/3f040f0bf03807efc3b783509cc688b7f9d59007
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:57+01:00
Commit Message:
HPL1: Fix Various GCC Shadowing Warnings in Angelscript Library
These are emitted if -Wshadow is passed to GCC.
Changed paths:
engines/hpl1/engine/libraries/angelscript/sources/as_bytecode.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_generic.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_parser.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.h
engines/hpl1/engine/libraries/angelscript/sources/as_variablescope.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_bytecode.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_bytecode.cpp
index d006d326a38..d1c78d2f7ae 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_bytecode.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_bytecode.cpp
@@ -50,14 +50,14 @@
BEGIN_AS_NAMESPACE
-asCByteCode::asCByteCode(asCScriptEngine *engine)
+asCByteCode::asCByteCode(asCScriptEngine *_engine)
{
first = 0;
last = 0;
largestStackUsed = -1;
temporaryVariables = 0;
- this->engine = engine;
+ this->engine = _engine;
}
asCByteCode::~asCByteCode()
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
index 01dfe07c36a..ef1029acffd 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
@@ -76,7 +76,7 @@ BEGIN_AS_NAMESPACE
// Instead the compiler should keep track of references in TypeInfo, where it should also state how the reference
// is currently stored, i.e. in variable, in register, on stack, etc.
-asCCompiler::asCCompiler(asCScriptEngine *engine) : byteCode(engine)
+asCCompiler::asCCompiler(asCScriptEngine *_engine) : byteCode(_engine)
{
builder = 0;
script = 0;
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_generic.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_generic.cpp
index 14dd9cb6f62..609d6d9362e 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_generic.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_generic.cpp
@@ -46,12 +46,12 @@ BEGIN_AS_NAMESPACE
// doesn't have to count the position of the argument with every call
// internal
-asCGeneric::asCGeneric(asCScriptEngine *engine, asCScriptFunction *sysFunction, void *currentObject, asDWORD *stackPointer)
+asCGeneric::asCGeneric(asCScriptEngine *_engine, asCScriptFunction *_sysFunction, void *_currentObject, asDWORD *_stackPointer)
{
- this->engine = engine;
- this->sysFunction = sysFunction;
- this->currentObject = currentObject;
- this->stackPointer = stackPointer;
+ this->engine = _engine;
+ this->sysFunction = _sysFunction;
+ this->currentObject = _currentObject;
+ this->stackPointer = _stackPointer;
objectRegister = 0;
returnVal = 0;
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_parser.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_parser.cpp
index db5839e5735..7127c7b9bc9 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_parser.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_parser.cpp
@@ -61,10 +61,10 @@
BEGIN_AS_NAMESPACE
-asCParser::asCParser(asCBuilder *builder)
+asCParser::asCParser(asCBuilder *_builder)
{
- this->builder = builder;
- this->engine = builder->engine;
+ this->builder = _builder;
+ this->engine = _builder->engine;
script = 0;
scriptNode = 0;
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
index 13af3db659a..4c4f14f8d38 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
@@ -341,7 +341,7 @@ int asCScriptFunction::ParseListPattern(asSListPatternNode *&target, const char
}
// internal
-asCScriptFunction::asCScriptFunction(asCScriptEngine *engine, asCModule *mod, asEFuncType _funcType)
+asCScriptFunction::asCScriptFunction(asCScriptEngine *_engine, asCModule *mod, asEFuncType _funcType)
{
funcType = _funcType;
if( funcType == asFUNC_DELEGATE )
@@ -356,7 +356,7 @@ asCScriptFunction::asCScriptFunction(asCScriptEngine *engine, asCModule *mod, as
externalRefCount.set(0);
}
- this->engine = engine;
+ this->engine = _engine;
this->scriptData = 0;
module = mod;
objectType = 0;
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.h b/engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.h
index 744dcba126e..d51bbc55a18 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.h
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.h
@@ -193,7 +193,7 @@ struct asSEnumValue
class asCEnumType : public asCTypeInfo
{
public:
- asCEnumType(asCScriptEngine *engine) : asCTypeInfo(engine) {}
+ asCEnumType(asCScriptEngine *_engine) : asCTypeInfo(_engine) {}
~asCEnumType();
asCArray<asSEnumValue*> enumValues;
@@ -208,7 +208,7 @@ protected:
class asCTypedefType : public asCTypeInfo
{
public:
- asCTypedefType(asCScriptEngine *engine) : asCTypeInfo(engine) {}
+ asCTypedefType(asCScriptEngine *_engine) : asCTypeInfo(_engine) {}
~asCTypedefType();
void DestroyInternal();
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_variablescope.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_variablescope.cpp
index aca36dae165..370c68aae30 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_variablescope.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_variablescope.cpp
@@ -44,9 +44,9 @@
BEGIN_AS_NAMESPACE
-asCVariableScope::asCVariableScope(asCVariableScope *parent)
+asCVariableScope::asCVariableScope(asCVariableScope *_parent)
{
- this->parent = parent;
+ this->parent = _parent;
Reset();
}
Commit: ea4f1c156d3f268754255d58f254a4f109da3248
https://github.com/scummvm/scummvm/commit/ea4f1c156d3f268754255d58f254a4f109da3248
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:58+01:00
Commit Message:
HPL1: Fix GCC Compiler Warnings from Missing Debug Statement Formats
These will be emitted if -Wformat-security is passed to GCC.
Changed paths:
engines/hpl1/debug.h
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/engine/graphics/RendererPostEffects.cpp
engines/hpl1/engine/system/low_level_system.cpp
diff --git a/engines/hpl1/debug.h b/engines/hpl1/debug.h
index 1819dd744e6..f6f52304d7a 100644
--- a/engines/hpl1/debug.h
+++ b/engines/hpl1/debug.h
@@ -45,18 +45,18 @@ enum DebugLevels {
};
template<typename... Args>
-void logError(int channel, const char *fmt, Args... args) {
- debugCN(kDebugLevelError, channel, fmt, args...);
+void logError(uint32 channels, const char *fmt, Args... args) {
+ debugCN(kDebugLevelError, channels, fmt, args...);
}
template<typename... Args>
-void logWarning(int channel, const char *fmt, Args... args) {
- debugCN(kDebugLevelWarning, channel, fmt, args...);
+void logWarning(uint32 channels, const char *fmt, Args... args) {
+ debugCN(kDebugLevelWarning, channels, fmt, args...);
}
template<typename... Args>
-void logInfo(int channel, const char *fmt, Args... args) {
- debugCN(kDebugLevelLog, channel, fmt, args...);
+void logInfo(uint32 channels, const char *fmt, Args... args) {
+ debugCN(kDebugLevelLog, channels, fmt, args...);
}
}
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index 3e77706aa38..3cc3d521da1 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -77,7 +77,7 @@ cRenderSettings::cRenderSettings() {
cRenderer3D::cRenderer3D(iLowLevelGraphics *apLowLevelGraphics, cResources *apResources,
cMeshCreator *apMeshCreator, cRenderList *apRenderList) {
- Hpl1::logInfo(Hpl1::kDebugGraphics, "Creating Renderer3D\n");
+ Hpl1::logInfo(Hpl1::kDebugGraphics, "%s", "Creating Renderer3D\n");
mpLowLevelGraphics = apLowLevelGraphics;
mpLowLevelResources = apResources->GetLowLevel();
@@ -113,7 +113,7 @@ cRenderer3D::cRenderer3D(iLowLevelGraphics *apLowLevelGraphics, cResources *apRe
mRenderSettings.mShowShadows = eRendererShowShadows_All;
mRenderSettings.mpTempIndexArray = hplNewArray(unsigned int, 60000);
- Hpl1::logInfo(Hpl1::kDebugGraphics, "Load Renderer3D gpu programs:\n");
+ Hpl1::logInfo(Hpl1::kDebugGraphics, "%s", "Load Renderer3D gpu programs:\n");
cGpuProgramManager *pProgramManager = apResources->GetGpuProgramManager();
mRenderSettings.extrudeProgram = pProgramManager->CreateProgram("ShadowExtrude", "ShadowExtrude");
@@ -190,7 +190,7 @@ cRenderer3D::cRenderer3D(iLowLevelGraphics *apLowLevelGraphics, cResources *apRe
_refractSpecProgram = pProgramManager->CreateProgram("refract", "refract_special");
if (!_refractProgram || !_refractSpecProgram) {
mbRefractionAvailable = false;
- Hpl1::logInfo(Hpl1::kDebugGraphics, "refraction will not be supported");
+ Hpl1::logInfo(Hpl1::kDebugGraphics, "%s", "refraction will not be supported");
}
/////////////////////////////////////////////
@@ -633,7 +633,7 @@ void cRenderer3D::RenderSkyBox(cCamera3D *apCamera) {
if (mbSkyBoxActive == false)
return;
- Hpl1::logInfo(Hpl1::kDebugRenderer, "Drawing skybox");
+ Hpl1::logInfo(Hpl1::kDebugRenderer, "%s", "Drawing skybox");
if (mRenderSettings.gpuProgram) {
mRenderSettings.gpuProgram->UnBind();
@@ -714,7 +714,7 @@ void cRenderer3D::RenderOcclusionQueries(cCamera3D *apCamera) {
mRenderSettings.gpuProgram->UnBind();
mRenderSettings.gpuProgram = _diffuseProgram;
_diffuseProgram->Bind();
- Hpl1::logInfo(Hpl1::kDebugGraphics, "binding Rendered3D::_diffuseProgram");
+ Hpl1::logInfo(Hpl1::kDebugGraphics, "%s", "binding Rendered3D::_diffuseProgram");
}
////////////////////////
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.cpp b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
index fe57bd29a09..c03ae36f597 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.cpp
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
@@ -87,7 +87,7 @@ cRendererPostEffects::cRendererPostEffects(iLowLevelGraphics *apLowLevelGraphics
///////////////////////////////////////////
// Create programs
- Hpl1::logInfo(Hpl1::kDebugRenderer,"Creating RendererPostEffects programs");
+ Hpl1::logInfo(Hpl1::kDebugRenderer, "%s", "Creating RendererPostEffects programs");
/////////////////
// Blur programs
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index b0ef3fab1c4..77b9a8bd064 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -55,7 +55,7 @@ LowLevelSystem::~LowLevelSystem() {
static void commonLog(int level, const char *fmt, va_list args) {
char buffer[256];
vsnprintf(buffer, 256, fmt, args);
- debugN(level, buffer);
+ debugN(level, "%s", buffer);
}
void Error(const char *fmt, ...) {
Commit: a170c19fb66c8770ed0d17a7bcfee35d88f85e28
https://github.com/scummvm/scummvm/commit/a170c19fb66c8770ed0d17a7bcfee35d88f85e28
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:58+01:00
Commit Message:
HPL1: Fix Bug in Game Script Functions Causing GCC Shadowing Warning
Changed paths:
engines/hpl1/penumbra-overture/GameScripts.cpp
diff --git a/engines/hpl1/penumbra-overture/GameScripts.cpp b/engines/hpl1/penumbra-overture/GameScripts.cpp
index 865a76b7970..5bf3dc117ec 100644
--- a/engines/hpl1/penumbra-overture/GameScripts.cpp
+++ b/engines/hpl1/penumbra-overture/GameScripts.cpp
@@ -754,7 +754,7 @@ static void ReplaceEntity(std::string asName, std::string asBodyName,
return;
}
} else {
- iPhysicsBody *pBody = pEntity->GetBody(0);
+ pBody = pEntity->GetBody(0);
}
cMatrixf mtxTransform = pBody->GetWorldMatrix();
Commit: 3f77311c6eab5171b2fd2edcd3bd1a6fb64df8f4
https://github.com/scummvm/scummvm/commit/3f77311c6eab5171b2fd2edcd3bd1a6fb64df8f4
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:58+01:00
Commit Message:
HPL1: Fix Misleading Indentation in Newton Shape Collision Function
This emits a warning when -Wmisleading-indentation is passed to GCC.
A quick review of the surrounding code suggests that the indentation
is a mistake, rather than missing braces, so no functional change from
this commit.
Changed paths:
engines/hpl1/engine/impl/CollideShapeNewton.cpp
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.cpp b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
index 26a3ad0fd5c..749cf05987e 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.cpp
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
@@ -56,33 +56,34 @@ cCollideShapeNewton::cCollideShapeNewton(eCollideShapeType aType, const cVector3
mtxTranspose = m_mtxOffset.GetTranspose();
pMtx = &(mtxTranspose.m[0][0]);
- } else
+ } else {
m_mtxOffset = cMatrixf::Identity;
+ }
- ////////////////////////////////////////////
- // Create Newton collision
+ ////////////////////////////////////////////
+ // Create Newton collision
- switch(aType) {
- case eCollideShapeType_Null: mpNewtonCollision = NewtonCreateNull(apNewtonWorld); break;
+ switch(aType) {
+ case eCollideShapeType_Null: mpNewtonCollision = NewtonCreateNull(apNewtonWorld); break;
- case eCollideShapeType_Box: mpNewtonCollision = NewtonCreateBox(apNewtonWorld,
- mvSize.x, mvSize.y, mvSize.z,
- 0, pMtx); break;
+ case eCollideShapeType_Box: mpNewtonCollision = NewtonCreateBox(apNewtonWorld,
+ mvSize.x, mvSize.y, mvSize.z,
+ 0, pMtx); break;
- case eCollideShapeType_Sphere: mpNewtonCollision = NewtonCreateSphere(apNewtonWorld,
- mvSize.x, mvSize.y, mvSize.z,
- 0, pMtx); break;
+ case eCollideShapeType_Sphere: mpNewtonCollision = NewtonCreateSphere(apNewtonWorld,
+ mvSize.x, mvSize.y, mvSize.z,
+ 0, pMtx); break;
- case eCollideShapeType_Cylinder: mpNewtonCollision = NewtonCreateCylinder(apNewtonWorld,
- mvSize.x, mvSize.y,
- 0, pMtx); break;
+ case eCollideShapeType_Cylinder: mpNewtonCollision = NewtonCreateCylinder(apNewtonWorld,
+ mvSize.x, mvSize.y,
+ 0, pMtx); break;
- case eCollideShapeType_Capsule: mpNewtonCollision = NewtonCreateCapsule(apNewtonWorld,
- mvSize.x, mvSize.y,
- 0, pMtx); break;
- default:
- break;
- }
+ case eCollideShapeType_Capsule: mpNewtonCollision = NewtonCreateCapsule(apNewtonWorld,
+ mvSize.x, mvSize.y,
+ 0, pMtx); break;
+ default:
+ break;
+ }
////////////////////////////////////////////
// Calculate Bounding volume and volume.
Commit: bec138584c09d6b35e24e894e58668e9f9d36c79
https://github.com/scummvm/scummvm/commit/bec138584c09d6b35e24e894e58668e9f9d36c79
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:58+01:00
Commit Message:
HPL1: Fix Various Cast Qualifier GCC Warnings in Anglescript Array Code
These are emitted when -Wcast-qual is passed to GCC.
Changed paths:
engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
index 169b566ca50..d8bf210f4e3 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
@@ -1014,7 +1014,7 @@ bool CScriptArray::Less(const void *a, const void *b, bool asc)
// Simple compare of values
switch( subTypeId )
{
- #define COMPARE(T) *((T*)a) < *((T*)b)
+ #define COMPARE(T) *((const T*)a) < *((const T*)b)
case asTYPEID_BOOL: return COMPARE(bool);
case asTYPEID_INT8: return COMPARE(signed char);
case asTYPEID_UINT8: return COMPARE(unsigned char);
@@ -1114,7 +1114,7 @@ bool CScriptArray::Equals(const void *a, const void *b, asIScriptContext *ctx, S
// Simple compare of values
switch( subTypeId )
{
- #define COMPARE(T) *((T*)a) == *((T*)b)
+ #define COMPARE(T) *((const T*)a) == *((const T*)b)
case asTYPEID_BOOL: return COMPARE(bool);
case asTYPEID_INT8: return COMPARE(signed char);
case asTYPEID_UINT8: return COMPARE(unsigned char);
@@ -1135,7 +1135,7 @@ bool CScriptArray::Equals(const void *a, const void *b, asIScriptContext *ctx, S
if( subTypeId & asTYPEID_OBJHANDLE )
{
// Allow the find to work even if the array contains null handles
- if( *(void**)a == *(void**)b ) return true;
+ if( *(const void**)a == *(const void**)b ) return true;
}
// Execute object opEquals if available
Commit: 17bb4057dd412805dbe1933bb63962c2b4d17741
https://github.com/scummvm/scummvm/commit/17bb4057dd412805dbe1933bb63962c2b4d17741
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:58+01:00
Commit Message:
HPL1: Fix Shadowing Warning in Engine Sub Mesh Entity Code
This is emitted if -Wshadow is passed to GCC.
Changed paths:
engines/hpl1/engine/scene/SubMeshEntity.cpp
diff --git a/engines/hpl1/engine/scene/SubMeshEntity.cpp b/engines/hpl1/engine/scene/SubMeshEntity.cpp
index 9461f2515eb..4e921cf5b56 100644
--- a/engines/hpl1/engine/scene/SubMeshEntity.cpp
+++ b/engines/hpl1/engine/scene/SubMeshEntity.cpp
@@ -209,25 +209,27 @@ void cSubMeshEntity::UpdateGraphics(cCamera3D *apCamera, float afFrameTime, cRen
const unsigned char *pBoneIdx = &mpSubMesh->mpVertexBones[vtx * 4];
- const cMatrixf &mtxTransform = mpMeshEntity->mvBoneMatrices[*pBoneIdx];
+ {
+ const cMatrixf &mtxTransform = mpMeshEntity->mvBoneMatrices[*pBoneIdx];
- // Log("Vtx: %d\n",vtx);
- // Log("Boneidx: %d Count %d Weight: %f vtx: %d\n",(int)*pBoneIdx,lCount, *pWeight,vtx);
+ // Log("Vtx: %d\n",vtx);
+ // Log("Boneidx: %d Count %d Weight: %f vtx: %d\n",(int)*pBoneIdx,lCount, *pWeight,vtx);
- // ATTENTION: Some optimizing might be done by accumulating the matrix instead.
- // THIS is really unsure since it seems like it will result in more math, matrix mul = 8*4 calc
- // Vertex mul with matrix is 3 * 3 calculations
- // this means: vertex= 9*3 = 27, matrix = 32
+ // ATTENTION: Some optimizing might be done by accumulating the matrix instead.
+ // THIS is really unsure since it seems like it will result in more math, matrix mul = 8*4 calc
+ // Vertex mul with matrix is 3 * 3 calculations
+ // this means: vertex= 9*3 = 27, matrix = 32
- MatrixFloatTransformSet(pSkinPos, mtxTransform, pBindPos, *pWeight);
+ MatrixFloatTransformSet(pSkinPos, mtxTransform, pBindPos, *pWeight);
- MatrixFloatRotateSet(pSkinNormal, mtxTransform, pBindNormal, *pWeight);
+ MatrixFloatRotateSet(pSkinNormal, mtxTransform, pBindNormal, *pWeight);
- MatrixFloatRotateSet(pSkinTangent, mtxTransform, pBindTangent, *pWeight);
+ MatrixFloatRotateSet(pSkinTangent, mtxTransform, pBindTangent, *pWeight);
- ++pWeight;
- ++pBoneIdx;
- ++lCount;
+ ++pWeight;
+ ++pBoneIdx;
+ ++lCount;
+ }
// Iterate weights until 0 is found or count < 4
while (*pWeight != 0 && lCount < 4) {
Commit: 941946918eff50de56745e4003af1a3a31d768e2
https://github.com/scummvm/scummvm/commit/941946918eff50de56745e4003af1a3a31d768e2
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:58+01:00
Commit Message:
HPL1: Remove Dead Code from Engine Math Classes
This generates GCC Compiler Warnings when -Wunused-variable and
-Wunused-but-set-variable are passed to GCC.
Changed paths:
engines/hpl1/engine/math/Math.cpp
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index c700332a33f..5826b84c704 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -1523,7 +1523,6 @@ bool cMath::CreateEdges(tTriEdgeVec &avEdges,
// TODO: iterate the amp here instead.
tVtxIdxMapIt VtxIt = mapVtxIndices.begin();
for (; VtxIt != mapVtxIndices.end(); ++VtxIt) {
- const cVector3f vVtx = VtxIt->first;
cVertexIndices &Data = VtxIt->second;
// Iterate the indices and create edges.
@@ -1580,9 +1579,6 @@ bool cMath::CreateEdges(tTriEdgeVec &avEdges,
for (; EdgeIt != mapTriEdgeLists.end(); ++EdgeIt) {
cTriEdge &Edge = const_cast<cTriEdge &>(*EdgeIt);
const unsigned int *pTri1 = &apIndexArray[Edge.tri1 * 3];
- const unsigned int *pTri2 = NULL;
- if (Edge.tri2 >= 0)
- pTri2 = &apIndexArray[Edge.tri2 * 3];
if (Edge.tri2 == -1) {
Edge.invert_tri2 = true;
Commit: 4f35777b7c1ec55f0c6b9bff3bd5e051134e33f4
https://github.com/scummvm/scummvm/commit/4f35777b7c1ec55f0c6b9bff3bd5e051134e33f4
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:58+01:00
Commit Message:
HPL1: Fix GCC Compiler Fallthrough Warnings in TinyXML Parser Code
These are intended as per the earlier comment.
Changed paths:
engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp b/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
index 6629e31ada0..8496a83930e 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxmlparser.cpp
@@ -107,17 +107,21 @@ void TiXmlBase::ConvertUTF32ToUTF8(unsigned long input, char *output, int *lengt
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
+ // fallthrough
case 3:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
+ // fallthrough
case 2:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
+ // fallthrough
case 1:
--output;
*output = (char)(input | FIRST_BYTE_MARK[*length]);
+ // fallthrough
}
}
Commit: 8e596f595626bbf92f04aa03d9edec70c92b0da7
https://github.com/scummvm/scummvm/commit/8e596f595626bbf92f04aa03d9edec70c92b0da7
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:58+01:00
Commit Message:
HPL1: Remove Set But Unused Variables in Newton Physics World Update Code
GCC emits a warning on these if -Wunused-but-set-variable is passed.
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp b/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
index 014d9913316..cbb803a4c21 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
@@ -4965,8 +4965,6 @@ dgFloat32 dgJacobianMemory::CalculateJointForcesSimd(dgInt32 joint,
dgFloat32 dgJacobianMemory::CalculateJointForces(dgInt32 joint,
dgFloat32 *forceStep, dgFloat32 maxAccNorm) const {
- dgInt32 m0;
- dgInt32 m1;
dgInt32 first;
dgInt32 count;
dgInt32 maxPasses;
@@ -5038,8 +5036,6 @@ dgFloat32 dgJacobianMemory::CalculateJointForces(dgInt32 joint,
}
retAccel = accNorm;
- m0 = constraintArray[joint].m_m0;
- m1 = constraintArray[joint].m_m1;
clampedForceIndexValue = dgFloat32(0.0f);
dgVector zero(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
Commit: ac7ef360b1297259df282426eb0256370fbe02c8
https://github.com/scummvm/scummvm/commit/ac7ef360b1297259df282426eb0256370fbe02c8
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:59+01:00
Commit Message:
HPL1: Remove Set But Unused Variables from Save Effect Handler Code
Changed paths:
engines/hpl1/penumbra-overture/EffectHandler.cpp
diff --git a/engines/hpl1/penumbra-overture/EffectHandler.cpp b/engines/hpl1/penumbra-overture/EffectHandler.cpp
index da3a77374da..36590e0843e 100644
--- a/engines/hpl1/penumbra-overture/EffectHandler.cpp
+++ b/engines/hpl1/penumbra-overture/EffectHandler.cpp
@@ -341,18 +341,6 @@ void cEffect_SaveEffect::NormalSaveUpdate(float afTimeStep) {
/////////////
// Display message
- int lLevel = 0;
- int lMaxRand = 3;
- if (mpInit->mpPlayer->mlStat_NumOfSaves > 0)
- lLevel = 1;
- if (mpInit->mpPlayer->mlStat_NumOfSaves > 5)
- lLevel = 2;
- else if (mpInit->mpPlayer->mlStat_NumOfSaves > 20)
- lLevel = 3;
-
- if (lLevel == 0)
- lMaxRand = 1;
-
tString sEntry = "AfterSave_Default";
if (mpSaveArea->GetHasBeenUsed() == false) {
mpInit->mpPlayer->mlStat_NumOfSaves++;
Commit: 1cc005c871a88ff306fd9098be3b2a3ca5a98b47
https://github.com/scummvm/scummvm/commit/1cc005c871a88ff306fd9098be3b2a3ca5a98b47
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:59+01:00
Commit Message:
HPL1: Fix GCC Fallthrough Warning in Effect Handler Code
It is unclear if this is intentional, so this is marked with a FIXME
comment.
Changed paths:
engines/hpl1/penumbra-overture/EffectHandler.cpp
diff --git a/engines/hpl1/penumbra-overture/EffectHandler.cpp b/engines/hpl1/penumbra-overture/EffectHandler.cpp
index 36590e0843e..a0a38a38b4c 100644
--- a/engines/hpl1/penumbra-overture/EffectHandler.cpp
+++ b/engines/hpl1/penumbra-overture/EffectHandler.cpp
@@ -399,6 +399,8 @@ void cEffect_SaveEffect::AutoSaveUpdate(float afTimeStep) {
mlState++;
mFlashColor = cColor(0.0, 0.0);
mfFlashAlpha = 0.f;
+ // FIXME: Is fallthrough intended?
+ // fallthrough
}
case 3: {
Reset();
Commit: bffe62b1c1df02279b10562b79d599d5b8455194
https://github.com/scummvm/scummvm/commit/bffe62b1c1df02279b10562b79d599d5b8455194
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:59+01:00
Commit Message:
HPL1: Fix Signed vs. Unsigned Comparison GCC Warnings in Text Box Widget
Changed paths:
engines/hpl1/engine/gui/WidgetTextBox.cpp
diff --git a/engines/hpl1/engine/gui/WidgetTextBox.cpp b/engines/hpl1/engine/gui/WidgetTextBox.cpp
index c30ba364a19..a2ad1078b4a 100644
--- a/engines/hpl1/engine/gui/WidgetTextBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetTextBox.cpp
@@ -394,9 +394,9 @@ bool cWidgetTextBox::OnMouseDoubleClick(cGuiMessageData &aData) {
/////////////////////////////
// Get space to the left
- for (size_t i = mlMarkerCharPos + 1; i < (int)msText.size(); ++i) {
- if (msText[i] == _W(' ') || i == (int)msText.size() - 1) {
- if (i == (int)msText.size() - 1)
+ for (size_t i = mlMarkerCharPos + 1; i < (size_t)msText.size(); ++i) {
+ if (msText[i] == _W(' ') || i == (size_t)msText.size() - 1) {
+ if (i == (size_t)msText.size() - 1)
SetMarkerPos((int)msText.size() - 1);
else
SetMarkerPos((int)i);
Commit: c21269a615cb8335b74988d7f469d93a4eb7685d
https://github.com/scummvm/scummvm/commit/c21269a615cb8335b74988d7f469d93a4eb7685d
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:59+01:00
Commit Message:
HPL1: Fix Unused Variable GCC Compiler Warnings in Penumbra Overture Code
Changed paths:
engines/hpl1/penumbra-overture/GameDamageArea.cpp
engines/hpl1/penumbra-overture/GameForceArea.cpp
engines/hpl1/penumbra-overture/GameLiquidArea.cpp
diff --git a/engines/hpl1/penumbra-overture/GameDamageArea.cpp b/engines/hpl1/penumbra-overture/GameDamageArea.cpp
index 5424a5971f7..cfe0e2b89e1 100644
--- a/engines/hpl1/penumbra-overture/GameDamageArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameDamageArea.cpp
@@ -255,6 +255,5 @@ void cGameDamageArea::LoadFromSaveData(iGameEntity_SaveData *apSaveData) {
void cGameDamageArea::SetupSaveData(iGameEntity_SaveData *apSaveData) {
super::SetupSaveData(apSaveData);
- cGameDamageArea_SaveData *pData = static_cast<cGameDamageArea_SaveData *>(apSaveData);
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameForceArea.cpp b/engines/hpl1/penumbra-overture/GameForceArea.cpp
index 189d51c3222..3524ca876d2 100644
--- a/engines/hpl1/penumbra-overture/GameForceArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameForceArea.cpp
@@ -318,7 +318,6 @@ void cGameForceArea::LoadFromSaveData(iGameEntity_SaveData *apSaveData) {
void cGameForceArea::SetupSaveData(iGameEntity_SaveData *apSaveData) {
super::SetupSaveData(apSaveData);
- cGameForceArea_SaveData *pData = static_cast<cGameForceArea_SaveData *>(apSaveData);
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameLiquidArea.cpp b/engines/hpl1/penumbra-overture/GameLiquidArea.cpp
index ad931112649..0074a8190bb 100644
--- a/engines/hpl1/penumbra-overture/GameLiquidArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameLiquidArea.cpp
@@ -381,6 +381,5 @@ void cGameLiquidArea::LoadFromSaveData(iGameEntity_SaveData *apSaveData) {
void cGameLiquidArea::SetupSaveData(iGameEntity_SaveData *apSaveData) {
super::SetupSaveData(apSaveData);
- cGameLiquidArea_SaveData *pData = static_cast<cGameLiquidArea_SaveData *>(apSaveData);
}
//-----------------------------------------------------------------------
Commit: 52a350773d5e91aea052c634280fc4463db6d7e8
https://github.com/scummvm/scummvm/commit/52a350773d5e91aea052c634280fc4463db6d7e8
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:59+01:00
Commit Message:
HPL1: Fix Signed vs. Unsigned Comparison GCC Warning in Engine String Class
Changed paths:
engines/hpl1/engine/system/String.cpp
diff --git a/engines/hpl1/engine/system/String.cpp b/engines/hpl1/engine/system/String.cpp
index 1528c2843b2..292b80d5a12 100644
--- a/engines/hpl1/engine/system/String.cpp
+++ b/engines/hpl1/engine/system/String.cpp
@@ -575,7 +575,7 @@ tStringVec &cString::GetStringVec(const tString &asData, tStringVec &avVec, tStr
} else {
start = true;
str += c;
- if (i == asData.length() - 1)
+ if (i == (int)asData.length() - 1)
avVec.push_back(str);
}
}
Commit: 0bbf3899b287b1b3c8f7fe640abfac96651e39c2
https://github.com/scummvm/scummvm/commit/0bbf3899b287b1b3c8f7fe640abfac96651e39c2
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:59+01:00
Commit Message:
HPL1: Fix Undefined Symbol Warning in Angelscript Compiler Code
This is emitted if -Wundef is passed to GCC.
Changed paths:
engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
index ef1029acffd..34741c2612c 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
@@ -9914,7 +9914,7 @@ int asCCompiler::CompileVariableAccess(const asCString &name, const asCString &s
return -1;
}
-#if AS_DEBUG
+#ifdef AS_DEBUG
// If it is not a property, it may still be the name of a method which can be used to create delegates
asCObjectType *ot = outFunc->objectType;
asCScriptFunction *func = 0;
Commit: 1ef5a8194f13b8e2701217732446833d7eaf9bbc
https://github.com/scummvm/scummvm/commit/1ef5a8194f13b8e2701217732446833d7eaf9bbc
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:59+01:00
Commit Message:
HPL1: Fix Signed vs. Unsigned Comparison GCC Warnings in Overture Code
Changed paths:
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/Notebook.cpp
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 6271e62d2f3..781dae2e3da 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -501,7 +501,7 @@ void cMainMenuWidget_List::OnDraw() {
if ((int)i - mlFirstRow >= mlMaxRows)
break;
- if (mlSelected == i) {
+ if (mlSelected ==(int)i) {
mpFont->draw(vPos, mvFontSize, cColor(0.95f, 1), eFontAlign_Left, mvEntries[i].c_str());
mpDrawer->DrawGfxObject(mpBackGfx, vPos + cVector3f(0, 2, -1),
cVector2f(mvSize.x - 5, mvFontSize.y),
diff --git a/engines/hpl1/penumbra-overture/Notebook.cpp b/engines/hpl1/penumbra-overture/Notebook.cpp
index f6a9c2788e6..d2be710964b 100644
--- a/engines/hpl1/penumbra-overture/Notebook.cpp
+++ b/engines/hpl1/penumbra-overture/Notebook.cpp
@@ -89,7 +89,7 @@ void cNotebookState_Front::OnUpdate(float afTime) {
bool bFound = false;
for (size_t i = 0; i < mvOptions.size(); ++i) {
if (cMath::PointBoxCollision(mpNotebook->GetMousePos(), mvOptions[i].mRect)) {
- if (mlSelected != i) {
+ if (mlSelected != (int)i) {
mlSelected = (int)i;
mvOptions[i].mfAlpha = 0;
}
@@ -260,7 +260,7 @@ void cNotebookState_TaskList::OnUpdate(float afTime) {
bool bFound = false;
for (size_t i = 0; i < mvOptions.size(); ++i) {
if (cMath::PointBoxCollision(mpNotebook->GetMousePos(), mvOptions[i].mRect)) {
- if (mlSelected != i) {
+ if (mlSelected != (int)i) {
mlSelected = (int)i;
mvOptions[i].mfAlpha = 0;
}
@@ -484,7 +484,7 @@ void cNotebookState_NoteList::OnUpdate(float afTime) {
bool bFound = false;
for (size_t i = 0; i < mvOptions.size(); ++i) {
if (cMath::PointBoxCollision(mpNotebook->GetMousePos(), mvOptions[i].mRect)) {
- if (mlSelected != i) {
+ if (mlSelected != (int)i) {
mlSelected = (int)i;
mvOptions[i].mfAlpha = 0;
}
@@ -713,7 +713,7 @@ void cNotebookState_Note::OnUpdate(float afTime) {
bool bFound = false;
for (size_t i = 0; i < mvOptions.size(); ++i) {
if (cMath::PointBoxCollision(mpNotebook->GetMousePos(), mvOptions[i].mRect)) {
- if (mlSelected != i) {
+ if (mlSelected != (int)i) {
mlSelected = (int)i;
mvOptions[i].mfAlpha = 0;
}
@@ -754,7 +754,7 @@ void cNotebookState_Note::OnDraw() {
//////////////////////////////////
// Draw arrows back and forward
for (size_t i = 0; i < mvOptions.size(); ++i) {
- if (i == 0 && mlCurrentPage == mvPages.size() - 1)
+ if (i == 0 && mlCurrentPage == (int)mvPages.size() - 1)
continue;
if (i == 1 && mlCurrentPage == 0)
continue;
Commit: 31a0f13b174c641ef01532398f26c0017a0f9539
https://github.com/scummvm/scummvm/commit/31a0f13b174c641ef01532398f26c0017a0f9539
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:03:59+01:00
Commit Message:
HPL1: Comment Unused Variable Causing Compiler Warning in Overture Code
Changed paths:
engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
diff --git a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp b/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
index 7faf3234313..8933db7fb0a 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
@@ -1013,7 +1013,7 @@ bool cPlayerState_PushHaptX::OnMoveForwards(float afMul, float afTimeStep) {
if (bCollide) {
cVector3f vPos = mpPlayer->GetCharacterBody()->GetPosition();
- cVector3f vOldPos = vPos;
+ //cVector3f vOldPos = vPos;
cVector3f vNewPos;
vPos += mvForward * -1 * (fPosAdd + 0.1f);
mpPlayer->GetCharacterBody()->SetPosition(vPos);
Commit: 93420be1f79c601d92cc5d9490df18467cdccfd5
https://github.com/scummvm/scummvm/commit/93420be1f79c601d92cc5d9490df18467cdccfd5
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:00+01:00
Commit Message:
HPL1: Fix Signed vs. Unsigned Comparison GCC Compiler Warning
Changed paths:
engines/hpl1/engine/graphics/ParticleSystem3D.cpp
diff --git a/engines/hpl1/engine/graphics/ParticleSystem3D.cpp b/engines/hpl1/engine/graphics/ParticleSystem3D.cpp
index d856c285980..255aa093d28 100644
--- a/engines/hpl1/engine/graphics/ParticleSystem3D.cpp
+++ b/engines/hpl1/engine/graphics/ParticleSystem3D.cpp
@@ -347,7 +347,7 @@ void cParticleSystem3D::LoadFromSaveData(iSaveData *apSaveData) {
kSaveData_LoadFrom(msDataName);
kSaveData_LoadFrom(mvDataSize);
- if (GetEmitterNum() != pData->mvEmitters.Size()) {
+ if (GetEmitterNum() != (int)pData->mvEmitters.Size()) {
Error("Saved emitter number in %s/%d does not match loaded, killing system!\n",
GetName().c_str(),
GetSaveObjectId());
Commit: cea34770ba4d9c4764b0df3a0a9250814dd2c133
https://github.com/scummvm/scummvm/commit/cea34770ba4d9c4764b0df3a0a9250814dd2c133
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:00+01:00
Commit Message:
HPL1: Correct Function Call Parameter in 3D Renderer Graphics Code
This parameter is an int, not a pointer hence passing NULL to this
causes a compiler warning.
Changed paths:
engines/hpl1/engine/graphics/Renderer3D.cpp
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index 3cc3d521da1..fa19d16c174 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -1355,7 +1355,7 @@ void cRenderer3D::RenderDebug(cCamera3D *apCamera) {
while (objectIt.HasNext()) {
iRenderable *pObject = objectIt.Next();
- RenderDebugObject(apCamera, pObject, NULL, NULL, NULL, eMaterialRenderType_Diffuse, NULL);
+ RenderDebugObject(apCamera, pObject, NULL, 0, NULL, eMaterialRenderType_Diffuse, NULL);
}
// Render debug for lights.
Commit: d2e0084024f1a896252aa8a2f6ae0df33996fc0a
https://github.com/scummvm/scummvm/commit/d2e0084024f1a896252aa8a2f6ae0df33996fc0a
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:00+01:00
Commit Message:
HPL1: fix fallthrough in case statement
Changed paths:
engines/hpl1/penumbra-overture/EffectHandler.cpp
diff --git a/engines/hpl1/penumbra-overture/EffectHandler.cpp b/engines/hpl1/penumbra-overture/EffectHandler.cpp
index a0a38a38b4c..57ec51761ea 100644
--- a/engines/hpl1/penumbra-overture/EffectHandler.cpp
+++ b/engines/hpl1/penumbra-overture/EffectHandler.cpp
@@ -399,8 +399,7 @@ void cEffect_SaveEffect::AutoSaveUpdate(float afTimeStep) {
mlState++;
mFlashColor = cColor(0.0, 0.0);
mfFlashAlpha = 0.f;
- // FIXME: Is fallthrough intended?
- // fallthrough
+ break;
}
case 3: {
Reset();
Commit: 9088e974fc908191400b9a09fae243a2c9c469c7
https://github.com/scummvm/scummvm/commit/9088e974fc908191400b9a09fae243a2c9c469c7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:00+01:00
Commit Message:
HPL1: fix wrong variables in loop
Changed paths:
engines/hpl1/engine/scene/MeshEntity.cpp
diff --git a/engines/hpl1/engine/scene/MeshEntity.cpp b/engines/hpl1/engine/scene/MeshEntity.cpp
index f3eea405c50..d228d1b65c9 100644
--- a/engines/hpl1/engine/scene/MeshEntity.cpp
+++ b/engines/hpl1/engine/scene/MeshEntity.cpp
@@ -566,8 +566,8 @@ void cMeshEntity::UpdateLogic(float afTimeStep) {
cAnimation *pAnim = pAnimState->GetAnimation();
- for (int i2 = 0; i < pAnim->GetTrackNum(); i++) {
- cAnimationTrack *pTrack = pAnim->GetTrack(i2);
+ for (int j = 0; j < pAnim->GetTrackNum(); j++) {
+ cAnimationTrack *pTrack = pAnim->GetTrack(j);
if (pTrack->GetNodeIndex() < 0) {
pTrack->SetNodeIndex(GetNodeStateIndex(pTrack->GetName()));
Commit: c010a7673120856520e9c29ce84983e32e474246
https://github.com/scummvm/scummvm/commit/c010a7673120856520e9c29ce84983e32e474246
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:00+01:00
Commit Message:
HPL1: fix use of input parametrs in shader code
Changed paths:
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
index 2634fb9cd79..1b70b05a294 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
@@ -23,12 +23,12 @@ void main()
{
float attenuation = texture1D(tex3, dot(vLightDir,vLightDir)).x;
- vLightDir = normalize(vLightDir);
- vHalfVec = normalize(vHalfVec);
+ vec3 lightDir = normalize(vLightDir);
+ vec3 halfVec = normalize(vHalfVec);
- float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
+ float specular = clamp(dot(halfVec, vec3(0,0,1)), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w;
- outColor.xyz = specular + texture(tex0, vUv).xyz * vLightColor.xyz * dot(normalize(vLightDir), vec3(0,0,1));
+ outColor.xyz = specular + texture(tex0, vUv).xyz * vLightColor.xyz * dot(normalize(lightDir), vec3(0,0,1));
outColor.xyz = outColor.xyz * attenuation;
}
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
index 3cc2646af44..3b0fc915a96 100644
--- a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
+++ b/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
@@ -27,13 +27,13 @@ void main()
vec3 diffuse = texture(tex0, vUv).xyz;
vec3 lightNormal = normalize(vLightDir);
- vHalfVec = normalize(vHalfVec);
+ vec3 halfVec = normalize(vHalfVec);
float attenuation = texture1D(tex3,dot(vLightDir,vLightDir)).x;
vec4 spotColor = texture(tex4, vSpotlightUv.xy / vSpotlightUv.w);
float rejectNeg = texture1D(tex5,vSpotlightUv.z + 0.5).x;
- float specular = clamp(dot(vHalfVec, vec3(0,0,1)), 0.0, 1.0);
+ float specular = clamp(dot(halfVec, vec3(0,0,1)), 0.0, 1.0);
specular = pow(specular, 16.0) * vLightColor.w * spotColor.w;
outColor.xyz = specular + diffuse * dot(lightNormal, vec3(0,0,1)) * vLightColor.xyz * spotColor.xyz;
Commit: d1a909d6c9a6ab602e3ff4066a0b9c93f7cdcbeb
https://github.com/scummvm/scummvm/commit/d1a909d6c9a6ab602e3ff4066a0b9c93f7cdcbeb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:00+01:00
Commit Message:
HPL1: Fix warnings
Changed paths:
engines/hpl1/engine/game/SaveGame.h
diff --git a/engines/hpl1/engine/game/SaveGame.h b/engines/hpl1/engine/game/SaveGame.h
index 8e709386e58..daa690d9c66 100644
--- a/engines/hpl1/engine/game/SaveGame.h
+++ b/engines/hpl1/engine/game/SaveGame.h
@@ -46,7 +46,7 @@ class TiXmlElement;
#define kSaveData_SetupBegin(aClass) \
super::SaveDataSetup(apSaveObjectHandler, apGame); \
cSaveData_##aClass *pData = static_cast<cSaveData_##aClass *>(mpSaveData); \
- const char *sClassNameString = #aClass;
+ (void)pData;
#define kSaveData_BaseClass(aClass) class cSaveData_##aClass : public iSaveData
#define kSaveData_ChildClass(aParent, aChild) class cSaveData_##aChild : public cSaveData_##aParent
Commit: 757ed9b60854dd8a3a1cb2a1dd1845928330c1f5
https://github.com/scummvm/scummvm/commit/757ed9b60854dd8a3a1cb2a1dd1845928330c1f5
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:00+01:00
Commit Message:
HPL1: implement Material_EnvMap_Reflect class
Changed paths:
A engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.fragment
engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
diff --git a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
index 2ae2cfae275..770447f33bd 100644
--- a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
+++ b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
@@ -54,42 +54,12 @@ void cEnvMapReflect_SetUp::Setup(iGpuProgram *apProgram, cRenderSettings *apRend
void cEnvMapReflect_SetUp::SetupMatrix(cMatrixf *apModelMatrix, cRenderSettings *apRenderSettings) {
// Put here so it is updated with every matrix, just aswell...
if (apModelMatrix)
- apRenderSettings->mpVertexProgram->SetMatrixf("objectWorldMatrix", *apModelMatrix);
+ apRenderSettings->gpuProgram->SetMatrixf("objectWorldMatrix", *apModelMatrix);
else {
- apRenderSettings->mpVertexProgram->SetMatrixf("objectWorldMatrix", cMatrixf::Identity);
+ apRenderSettings->gpuProgram->SetMatrixf("objectWorldMatrix", cMatrixf::Identity);
}
}
-//-----------------------------------------------------------------------
-
-static cEnvMapReflect_SetUp gEnvMaterialSetup;
-
-//////////////////////////////////////////////////////////////////////////
-// FRAGEMENT SETUP
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cGLState_EnvMapReflect::cGLState_EnvMapReflect()
- : iGLStateProgram("Internal_Diffuse") {
-}
-
-void cGLState_EnvMapReflect::Bind() {
- mpLowGfx->SetActiveTextureUnit(1);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Interpolate);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorSource2, eTextureSource_Previous);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorOp2, eTextureOp_Alpha);
-}
-
-void cGLState_EnvMapReflect::UnBind() {
- mpLowGfx->SetActiveTextureUnit(1);
- mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc, eTextureFunc_Modulate);
-}
-
-//-----------------------------------------------------------------------
-
-cGLState_EnvMapReflect gGLState_EnvMapReflect;
-
//////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
//////////////////////////////////////////////////////////////////////////
@@ -102,27 +72,21 @@ cMaterial_EnvMap_Reflect::cMaterial_EnvMap_Reflect(const tString &asName, iLowLe
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
: iMaterial(asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
- error("cMaterial_EnvMap_Reflect not implemented");
mbIsTransperant = false;
mbIsGlowing = false;
mbUsesLights = false;
- gGLState_EnvMapReflect.SetUp(apLowLevelGraphics);
-
- ///////////////////////////////////////////
- // Load the Z pass vertex program
- iGpuProgram *pVtxProg = mpProgramManager->CreateProgram("Diffuse_Color_vp.cg", "main", eGpuProgramType_Vertex);
- SetProgram(pVtxProg, eGpuProgramType_Vertex, 0);
-
- ///////////////////////////////////////////
- // Load the Z pass vertex program
- pVtxProg = mpProgramManager->CreateProgram("Diffuse_EnvMap_Reflect_vp.cg", "main", eGpuProgramType_Vertex);
- SetProgram(pVtxProg, eGpuProgramType_Vertex, 1);
+ _diffuseProgram = mpProgramManager->CreateProgram("Diffuse_Color", "Diffuse_Color");
+ _diffuseReflectProgram = mpProgramManager->CreateProgram("Diffuse_EnvMap_Reflect", "Diffuse_EnvMap_Reflect");
}
//-----------------------------------------------------------------------
cMaterial_EnvMap_Reflect::~cMaterial_EnvMap_Reflect() {
+ if (_diffuseProgram)
+ mpProgramManager->Destroy(_diffuseProgram);
+ if (_diffuseReflectProgram)
+ mpProgramManager->Destroy(_diffuseReflectProgram);
}
//-----------------------------------------------------------------------
@@ -133,11 +97,17 @@ cMaterial_EnvMap_Reflect::~cMaterial_EnvMap_Reflect() {
//-----------------------------------------------------------------------
-iGpuProgram *cMaterial_EnvMap_Reflect::GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
+iGpuProgram *cMaterial_EnvMap_Reflect::getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
if (aType == eMaterialRenderType_Z)
- return mpProgram[eGpuProgramType_Vertex][0];
- else
- return mpProgram[eGpuProgramType_Vertex][1];
+ return _diffuseProgram;
+ return _diffuseReflectProgram;
+}
+
+iMaterialProgramSetup *cMaterial_EnvMap_Reflect::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
+ static cEnvMapReflect_SetUp envMaterialSetup;
+ if (aType == eMaterialRenderType_Diffuse)
+ return &envMaterialSetup;
+ return nullptr;
}
bool cMaterial_EnvMap_Reflect::VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
@@ -148,19 +118,6 @@ bool cMaterial_EnvMap_Reflect::VertexProgramUsesEye(eMaterialRenderType aType, i
return false;
}
-iMaterialProgramSetup *cMaterial_EnvMap_Reflect::GetVertexProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (aType == eMaterialRenderType_Diffuse)
- return &gEnvMaterialSetup;
-
- return NULL;
-}
-
-iGpuProgram *cMaterial_EnvMap_Reflect::GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
- if (aType == eMaterialRenderType_Diffuse)
- return &gGLState_EnvMapReflect;
- return NULL;
-}
-
eMaterialAlphaMode cMaterial_EnvMap_Reflect::GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
return eMaterialAlphaMode_Solid;
}
diff --git a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
index 4ff9246a3fa..46829692322 100644
--- a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
+++ b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.h
@@ -42,19 +42,6 @@ public:
//----------------------------------------------------
-class cGLState_EnvMapReflect : public iGLStateProgram {
-public:
- cGLState_EnvMapReflect();
-
- void Bind();
- void UnBind();
-
-private:
- void InitData() {}
-};
-
-//----------------------------------------------------
-
class cMaterial_EnvMap_Reflect : public iMaterial {
public:
cMaterial_EnvMap_Reflect(const tString &asName, iLowLevelGraphics *apLowLevelGraphics,
@@ -68,14 +55,12 @@ public:
bool UsesType(eMaterialRenderType aType);
- iGpuProgram *GetVertexProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
+ iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+ iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
+
bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
- iMaterialProgramSetup *GetVertexProgramSetup(eMaterialRenderType aType, int alPass, iLight3D *apLight);
-
- iGpuProgram *GetFragmentProgram(eMaterialRenderType aType, int alPass, iLight3D *apLight);
-
eMaterialAlphaMode GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialBlendMode GetBlendMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
eMaterialChannelMode GetChannelMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
@@ -96,6 +81,11 @@ public:
eMaterialType GetType(eMaterialRenderType aType) { return eMaterialType_Diffuse; }
void EditVertexes(eMaterialRenderType aType, iCamera *apCam, iLight *pLight,
tVertexVec *apVtxVec, cVector3f *apTransform, unsigned int alIndexAdd) {}
+
+private:
+ iGpuProgram *_diffuseProgram;
+ iGpuProgram *_diffuseReflectProgram;
+
};
class cMaterialType_EnvMap_Reflect : public iMaterialType {
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.fragment b/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.fragment
new file mode 100644
index 00000000000..0353622cb3e
--- /dev/null
+++ b/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.fragment
@@ -0,0 +1,16 @@
+// Diffuse_EnvMap_Reflect.fragment
+
+in vec3 vColor;
+in vec3 vUv;
+in vec3 vUv2;
+
+OUTPUT
+
+uniform sampler2D tex0; // diffuse
+uniform samplerCube tex1;
+
+void main() {
+ vec4 diffuseColor = texture(tex0, vUv.st);
+ vec4 col2 = textureCube(tex1, vUv2);
+ outColor = vec4(diffuseColor.xyz, diffuseColor.a * ( 1.0 - col2.a));
+}
\ No newline at end of file
Commit: fdaa24b34bd161c9e9dd1492b2767605803f9c3b
https://github.com/scummvm/scummvm/commit/fdaa24b34bd161c9e9dd1492b2767605803f9c3b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:00+01:00
Commit Message:
HPL1: remove double assignment
Changed paths:
engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
index 1f555b2a154..640cd94535c 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
@@ -771,7 +771,7 @@ void cParticleEmitter3D_UserData::SetParticleDefaults(cParticle *apParticle) {
apParticle->mfSpinFactor = cMath::RandRectf(mpData->mfMinSpinRange, mpData->mfMaxSpinRange);
apParticle->mfSpinVel = 0.0f;
}
- apParticle->mfSpin = apParticle->mfSpin = cMath::RandRectf(0.0f, k2Pif);
+ apParticle->mfSpin = cMath::RandRectf(0.0f, k2Pif);
////////////////////////////////////
// Start Revolution Velocity
Commit: 5c1bcaf01ac4c9c398cf8e99a32a41f492309f8c
https://github.com/scummvm/scummvm/commit/5c1bcaf01ac4c9c398cf8e99a32a41f492309f8c
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:01+01:00
Commit Message:
HPL1: Fix Likely Cut and Paste Code Error Causing GCC Compiler Warning
Changed paths:
engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp b/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
index aabb146d130..a6445bddb27 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D.cpp
@@ -118,7 +118,7 @@ iParticleEmitter3D::~iParticleEmitter3D() {
void iParticleEmitter3D::SetSubDivUV(const cVector2l &avSubDiv) {
// Check so that there is any subdivision and that no sub divison axis is
// equal or below zero
- if ((avSubDiv.x > 1 || avSubDiv.x > 1) && (avSubDiv.x > 0 && avSubDiv.y > 0)) {
+ if ((avSubDiv.x > 1 || avSubDiv.y > 1) && (avSubDiv.x > 0 && avSubDiv.y > 0)) {
int lSubDivNum = avSubDiv.x * avSubDiv.y;
mvSubDivUV.resize(lSubDivNum);
Commit: 10c50494b7f04f09f4096dd73827767ef3447ac3
https://github.com/scummvm/scummvm/commit/10c50494b7f04f09f4096dd73827767ef3447ac3
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:01+01:00
Commit Message:
HPL1: Fix Unused Variables GCC Compiler Warnings in Physics 2D Collision
Changed paths:
engines/hpl1/engine/physics/Collider2D.cpp
diff --git a/engines/hpl1/engine/physics/Collider2D.cpp b/engines/hpl1/engine/physics/Collider2D.cpp
index c0c2260fbc3..c5d5c8f5de2 100644
--- a/engines/hpl1/engine/physics/Collider2D.cpp
+++ b/engines/hpl1/engine/physics/Collider2D.cpp
@@ -73,7 +73,7 @@ tFlag cCollider2D::CollideBody(cBody2D *apBody, cCollideData2D *apData) {
/////// TEST COLLISION WITH TILES
float fTileSize = mpWorld->GetTileMap()->GetTileSize();
- cRect2f TileRect = cRect2f(0, 0, fTileSize, fTileSize);
+ //cRect2f TileRect = cRect2f(0, 0, fTileSize, fTileSize);
for (int i = 0; i < mpWorld->GetTileMap()->GetTileLayerNum(); i++) {
if (mpWorld->GetTileMap()->GetTileLayer(i)->HasCollision() == false)
@@ -83,8 +83,8 @@ tFlag cCollider2D::CollideBody(cBody2D *apBody, cCollideData2D *apData) {
while (pTileIt->HasNext()) {
cTile *pTile = pTileIt->Next();
- TileRect.x = pTile->GetPosition().x - fTileSize / 2;
- TileRect.y = pTile->GetPosition().y - fTileSize / 2;
+ //TileRect.x = pTile->GetPosition().x - fTileSize / 2;
+ //TileRect.y = pTile->GetPosition().y - fTileSize / 2;
// This can be used for material properties.
// cTileDataNormal *pTData = static_cast<cTileDataNormal*>(pTile->GetTileData());
@@ -219,7 +219,7 @@ tFlag cCollider2D::CollideRect(cRect2f &aRect, tFlag alCollideFlags, cCollideDat
//// Check for all tiles if the flag is set
if (alCollideFlags & eFlagBit_0) {
float fTileSize = mpWorld->GetTileMap()->GetTileSize();
- cRect2f TileRect = cRect2f(0, 0, fTileSize, fTileSize);
+ //cRect2f TileRect = cRect2f(0, 0, fTileSize, fTileSize);
for (int i = 0; i < mpWorld->GetTileMap()->GetTileLayerNum(); i++) {
if (mpWorld->GetTileMap()->GetTileLayer(i)->HasCollision() == false)
@@ -229,8 +229,8 @@ tFlag cCollider2D::CollideRect(cRect2f &aRect, tFlag alCollideFlags, cCollideDat
while (pTileIt->HasNext()) {
cTile *pTile = pTileIt->Next();
- TileRect.x = pTile->GetPosition().x - fTileSize / 2;
- TileRect.y = pTile->GetPosition().y - fTileSize / 2;
+ //TileRect.x = pTile->GetPosition().x - fTileSize / 2;
+ //TileRect.y = pTile->GetPosition().y - fTileSize / 2;
if (pTile->GetCollisionMesh() == NULL)
continue;
Commit: b3e6c36c28137db995517dba6c9a2a96755b4a51
https://github.com/scummvm/scummvm/commit/b3e6c36c28137db995517dba6c9a2a96755b4a51
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:01+01:00
Commit Message:
HPL1: Fix Unused Variable Compiler Warnings in Penumbra Overturn Player Code
Changed paths:
engines/hpl1/penumbra-overture/Player.cpp
diff --git a/engines/hpl1/penumbra-overture/Player.cpp b/engines/hpl1/penumbra-overture/Player.cpp
index 6082d80589f..358ea231492 100644
--- a/engines/hpl1/penumbra-overture/Player.cpp
+++ b/engines/hpl1/penumbra-overture/Player.cpp
@@ -976,7 +976,7 @@ cTempCheckProxy gTempCheckProxy;
void cPlayer::Update(float afTimeStep) {
cSystem *pSystem = mpInit->mpGame->GetSystem();
- unsigned int lTime = pSystem->GetLowLevel()->getTime();
+ //unsigned int lTime = pSystem->GetLowLevel()->getTime();
iPhysicsWorld *pPhysicsWorld = mpScene->GetWorld3D()->GetPhysicsWorld();
/////////////////////////////////////
@@ -1014,7 +1014,7 @@ void cPlayer::Update(float afTimeStep) {
}
//LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);*/
- lTime = pSystem->GetLowLevel()->getTime();
+ //lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" misc\n");
//////////////////////
// Reset roll
@@ -1035,28 +1035,28 @@ void cPlayer::Update(float afTimeStep) {
/////////////////////////////////////////////////
// Flashlight
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->getTime();
+ //lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" flashlight");
mpFlashLight->Update(afTimeStep);
/////////////////////////////////////////////////
// Glowstick
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->getTime();
+ //lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" glowstick\n");
mpGlowStick->Update(afTimeStep);
/////////////////////////////////////////////////
// Flare
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->getTime();
+ //lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" flare\n");
mpFlare->Update(afTimeStep);
/////////////////////////////////////////////////
// Lean
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->getTime();
+ //lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" more misc\n");
mpLean->Update(afTimeStep);
@@ -1083,12 +1083,12 @@ void cPlayer::Update(float afTimeStep) {
////////////////////////////////////////
// Hidden
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->getTime();
+ //lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" hidden\n");
mpHidden->Update(afTimeStep);
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->getTime();
+ //lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" collide scripts\n");
/////////////////////////////////////////////////
// Collide script
@@ -1189,7 +1189,7 @@ void cPlayer::Update(float afTimeStep) {
mlGroundCount--;
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->getTime();
+ //lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" Check For ground\n");
//////////////////////////////
// Cast ray and check for ground.
@@ -1205,7 +1205,7 @@ void cPlayer::Update(float afTimeStep) {
//////////////////////////////
// Update movement
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->getTime();
+ //lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" Movement\n");
if (mbMoving == false)
@@ -1219,7 +1219,7 @@ void cPlayer::Update(float afTimeStep) {
//////////////////////////////
// Update camera pos add
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->getTime();
+ //lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" Camera pos\n");
if (mpCharBody) {
float fYAdd = mfCameraHeightAdd + mpHeadMove->GetPos() + mfHeightAdd + mpDeath->GetHeighAdd() +
@@ -1245,7 +1245,7 @@ void cPlayer::Update(float afTimeStep) {
SetPickedBody(NULL);
// LogUpdate(" took %d ms\n",pSystem->GetLowLevel()->GetTime() - lTime);
- lTime = pSystem->GetLowLevel()->getTime();
+ //lTime = pSystem->GetLowLevel()->getTime();
// LogUpdate(" state %d\n",mState);
if (mpInit->mpInventory->IsActive() == false &&
mpInit->mpNotebook->IsActive() == false) {
Commit: af2a0395b40db13dc9db94255139baa042555a75
https://github.com/scummvm/scummvm/commit/af2a0395b40db13dc9db94255139baa042555a75
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:01+01:00
Commit Message:
HPL1: Fix Unused Variables Compiler Warnings in Physics World Code
Changed paths:
engines/hpl1/engine/physics/PhysicsWorld.cpp
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.cpp b/engines/hpl1/engine/physics/PhysicsWorld.cpp
index 64caf6d2154..c3bc3ffcf9c 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.cpp
+++ b/engines/hpl1/engine/physics/PhysicsWorld.cpp
@@ -82,7 +82,7 @@ void iPhysicsWorld::Update(float afTimeStep) {
////////////////////////////////////
// Update character bodies
- unsigned int lTime = GetApplicationTime();
+ //unsigned int lTime = GetApplicationTime();
tCharacterBodyListIt CharIt = mlstCharBodies.begin();
for (; CharIt != mlstCharBodies.end(); ++CharIt) {
iCharacterBody *pBody = *CharIt;
@@ -105,7 +105,7 @@ void iPhysicsWorld::Update(float afTimeStep) {
////////////////////////////////////
// Simulate the physics
- lTime = GetApplicationTime();
+ //lTime = GetApplicationTime();
Simulate(afTimeStep);
// LogUpdate(" Updating lowlevel physics took %d ms\n",mpWorld3D->GetSystem()->GetLowLevel()->GetTime() - lTime);
Commit: 638edcb72311455f0bca72e1c2066b53d83e08b9
https://github.com/scummvm/scummvm/commit/638edcb72311455f0bca72e1c2066b53d83e08b9
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:01+01:00
Commit Message:
HPL1: Fix Problematic Memset Usage to Clear Class in Newton Physics Code
This generates GCC compiler warnings since using memset to clear non-trivial
classes / structures can be problematic.
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgCollision.h
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollision.h b/engines/hpl1/engine/libraries/newton/physics/dgCollision.h
index 3eadf879a19..0b9e0f5c4f6 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollision.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollision.h
@@ -176,7 +176,7 @@ typedef void(dgApi *OnDebugCollisionMeshCallback)(void *userData, int vertexCoun
class dgCollisionBoundPlaneCache {
public:
dgCollisionBoundPlaneCache() {
- memset(m_planes, 0, sizeof(m_planes));
+ for (uint i = 0; i < sizeof(m_planes)/sizeof(m_planes[0]); i++) m_planes[i] = dgPlane(0.0, 0.0, 0.0, 0.0);
}
dgPlane m_planes[2];
};
Commit: 4b6eca00247d2a5faa2a3aa65a25d3b488e20b77
https://github.com/scummvm/scummvm/commit/4b6eca00247d2a5faa2a3aa65a25d3b488e20b77
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:01+01:00
Commit Message:
HPL1: Avoid Unused Variable GCC Warnings From Savegame Header Macros
This works assuming that none of the data pointers will be nullptr
which should be reasonable and replaces an earlier solution for this.
Changed paths:
engines/hpl1/engine/game/SaveGame.h
diff --git a/engines/hpl1/engine/game/SaveGame.h b/engines/hpl1/engine/game/SaveGame.h
index daa690d9c66..4736f116b24 100644
--- a/engines/hpl1/engine/game/SaveGame.h
+++ b/engines/hpl1/engine/game/SaveGame.h
@@ -28,6 +28,7 @@
#ifndef HPL_SAVE_GAME_H
#define HPL_SAVE_GAME_H
+#include <cassert>
#include <map>
#include "hpl1/engine/system/SerializeClass.h"
@@ -37,16 +38,18 @@ class TiXmlElement;
#define kSaveData_LoadFromBegin(aClass) \
super::LoadFromSaveData(apSaveData); \
- cSaveData_##aClass *pData = static_cast<cSaveData_##aClass *>(apSaveData);
+ cSaveData_##aClass *pData = static_cast<cSaveData_##aClass *>(apSaveData); \
+ assert(pData != nullptr);
#define kSaveData_SaveToBegin(aClass) \
super::SaveToSaveData(apSaveData); \
- cSaveData_##aClass *pData = static_cast<cSaveData_##aClass *>(apSaveData);
+ cSaveData_##aClass *pData = static_cast<cSaveData_##aClass *>(apSaveData); \
+ assert(pData != nullptr);
#define kSaveData_SetupBegin(aClass) \
super::SaveDataSetup(apSaveObjectHandler, apGame); \
cSaveData_##aClass *pData = static_cast<cSaveData_##aClass *>(mpSaveData); \
- (void)pData;
+ assert(pData != nullptr);
#define kSaveData_BaseClass(aClass) class cSaveData_##aClass : public iSaveData
#define kSaveData_ChildClass(aParent, aChild) class cSaveData_##aChild : public cSaveData_##aParent
Commit: 47ffd3f4184bfccbc75bdb414cd7932e9e18b6ab
https://github.com/scummvm/scummvm/commit/47ffd3f4184bfccbc75bdb414cd7932e9e18b6ab
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:01+01:00
Commit Message:
HPL1: save sound fading speed
this prevents the sound from playing on loop when loading from a save done after fading has started but before it has ended
Changed paths:
engines/hpl1/engine/scene/SoundEntity.cpp
engines/hpl1/engine/scene/SoundEntity.h
engines/hpl1/penumbra-overture/SaveTypes.cpp
engines/hpl1/penumbra-overture/SaveTypes.h
diff --git a/engines/hpl1/engine/scene/SoundEntity.cpp b/engines/hpl1/engine/scene/SoundEntity.cpp
index f0917f8d0e5..2ad7c052b54 100644
--- a/engines/hpl1/engine/scene/SoundEntity.cpp
+++ b/engines/hpl1/engine/scene/SoundEntity.cpp
@@ -254,6 +254,7 @@ void cSoundEntity::FadeIn(float afSpeed) {
void cSoundEntity::FadeOut(float afSpeed) {
mbFadingOut = true;
+ _fadeSpeed = afSpeed;
if (mpSoundHandler->GetSilent())
return;
diff --git a/engines/hpl1/engine/scene/SoundEntity.h b/engines/hpl1/engine/scene/SoundEntity.h
index 1158fceaafc..a508d498c9a 100644
--- a/engines/hpl1/engine/scene/SoundEntity.h
+++ b/engines/hpl1/engine/scene/SoundEntity.h
@@ -102,6 +102,7 @@ public:
bool IsStopped();
bool IsFadingOut();
+ float getFadingSpeed() {return _fadeSpeed;}
bool GetRemoveWhenOver();
void SetVolume(float afX) { mfVolume = afX; }
@@ -163,6 +164,8 @@ private:
float mfSleepCount;
+ float _fadeSpeed;
+
static tSoundEntityGlobalCallbackList mlstGobalCallbacks;
};
diff --git a/engines/hpl1/penumbra-overture/SaveTypes.cpp b/engines/hpl1/penumbra-overture/SaveTypes.cpp
index f221909d465..6acb1359dbd 100644
--- a/engines/hpl1/penumbra-overture/SaveTypes.cpp
+++ b/engines/hpl1/penumbra-overture/SaveTypes.cpp
@@ -314,13 +314,17 @@ void cEngineSound_SaveData::ToSound(cSoundEntity *apSound) {
apSound->SetActive(mbActive);
if (mbStopped)
apSound->Stop(false);
+ if (_fading)
+ apSound->FadeOut(_fadeSpeed);
}
kBeginSerializeBase(cEngineSound_SaveData)
kSerializeVar(msName, eSerializeType_String)
kSerializeVar(mbActive, eSerializeType_Bool)
kSerializeVar(mbStopped, eSerializeType_Bool)
- kEndSerialize()
+ kSerializeVar(_fading, eSerializeType_Bool)
+ kSerializeVar(_fadeSpeed, eSerializeType_Float32)
+ kEndSerialize()
//////////////////////////////////////////////////////////////////////////
// LIGHT
diff --git a/engines/hpl1/penumbra-overture/SaveTypes.h b/engines/hpl1/penumbra-overture/SaveTypes.h
index 0d30bb9dccf..26b466874f9 100644
--- a/engines/hpl1/penumbra-overture/SaveTypes.h
+++ b/engines/hpl1/penumbra-overture/SaveTypes.h
@@ -111,6 +111,8 @@ class cEngineSound_SaveData : public iSerializable {
tString msName;
bool mbActive;
bool mbStopped;
+ bool _fading;
+ float _fadeSpeed;
};
//------------------------------------------
Commit: 28bbd7124ba357c93d522f37d4e5622a9cc5d5d8
https://github.com/scummvm/scummvm/commit/28bbd7124ba357c93d522f37d4e5622a9cc5d5d8
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:01+01:00
Commit Message:
HPL1: stop sound if out of range and fading
Changed paths:
engines/hpl1/engine/scene/SoundEntity.cpp
diff --git a/engines/hpl1/engine/scene/SoundEntity.cpp b/engines/hpl1/engine/scene/SoundEntity.cpp
index 2ad7c052b54..3bf3cc82a88 100644
--- a/engines/hpl1/engine/scene/SoundEntity.cpp
+++ b/engines/hpl1/engine/scene/SoundEntity.cpp
@@ -421,6 +421,8 @@ void cSoundEntity::UpdateLogic(float afTimeStep) {
}
mvSounds[eSoundEntityType_Main] = NULL;
+ if (mbFadingOut)
+ mbStopped = true;
}
mbOutOfRange = true;
Commit: 84a35b37eec9e57e78c6064402dd403695173277
https://github.com/scummvm/scummvm/commit/84a35b37eec9e57e78c6064402dd403695173277
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:02+01:00
Commit Message:
HPL1: implement check for shaders
Changed paths:
A engines/hpl1/graphics.cpp
A engines/hpl1/graphics.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/graphics.cpp b/engines/hpl1/graphics.cpp
new file mode 100644
index 00000000000..93a2e95a4b4
--- /dev/null
+++ b/engines/hpl1/graphics.cpp
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "hpl1/graphics.h"
+
+#include "graphics/renderer.h"
+#include "common/config-manager.h"
+
+namespace Hpl1 {
+
+bool areShadersAvailable() {
+ return (Graphics::Renderer::getAvailableTypes() & Graphics::kRendererTypeOpenGLShaders) &&
+ (!ConfMan.hasKey("renderer") || ConfMan.get("renderer") == "opengl_shaders");
+}
+
+}
\ No newline at end of file
diff --git a/engines/hpl1/graphics.h b/engines/hpl1/graphics.h
new file mode 100644
index 00000000000..8b9d12ea86c
--- /dev/null
+++ b/engines/hpl1/graphics.h
@@ -0,0 +1,31 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_GRAPHICS_H
+#define HPL1_GRAPHICS_H
+
+namespace Hpl1 {
+
+bool areShadersAvailable();
+
+}
+
+#endif
\ No newline at end of file
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 2f69eb07b4f..eec7aa2cd57 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS := \
detection.o \
string.o \
opengl.o \
+ graphics.o \
engine/ai/AI.o \
engine/ai/AINodeContainer.o \
engine/ai/AINodeGenerator.o \
Commit: 4adc41c2fab9f52c838c6a74e4271513eacc2f6f
https://github.com/scummvm/scummvm/commit/4adc41c2fab9f52c838c6a74e4271513eacc2f6f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:02+01:00
Commit Message:
HPL1: add check for shaders in low level graphics
Changed paths:
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index e105b3d4893..ffb6c9b9930 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -44,6 +44,7 @@
#include "hpl1/debug.h"
#include "hpl1/engine/impl/OcclusionQueryOGL.h"
#include "hpl1/opengl.h"
+#include "hpl1/graphics.h"
namespace hpl {
@@ -251,7 +252,7 @@ int cLowLevelGraphicsSDL::GetCaps(eGraphicCaps type) const {
// GL shaders
case eGraphicCaps_GL_GpuPrograms:
- return 1; // gl 2.0
+ return Hpl1::areShadersAvailable(); // gl 2.0
case eGraphicCaps_GL_BlendFunctionSeparate:
return 1; // gl 1.4
Commit: 8bee6d12195589fc1359075ad1b1d6d507c59daa
https://github.com/scummvm/scummvm/commit/8bee6d12195589fc1359075ad1b1d6d507c59daa
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:02+01:00
Commit Message:
HPL1: selectively disable shader settings
removes all material settings above very low if shaders are not available.
Changed paths:
engines/hpl1/penumbra-overture/Init.cpp
engines/hpl1/penumbra-overture/MainMenu.cpp
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index c73010f298c..3d5a71708dc 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -72,6 +72,7 @@
#include "hpl1/penumbra-overture/Version.h" // cool version .h that uses SVN revision #s
#include "common/config-manager.h"
+#include "hpl1/graphics.h"
// Global init...
cInit *gpInit;
@@ -359,7 +360,10 @@ bool cInit::Init(tString saveToLoad) {
msStartLink = getStringConfig("starting_map_position", "link01");
mlFSAA = getIntConfig("fsaa", 0);
mbPostEffects = getBoolConfig("post_effects", true);
- iMaterial::SetQuality(static_cast<eMaterialQuality>(getIntConfig("shader_quality", eMaterialQuality_High)));
+ if (Hpl1::areShadersAvailable())
+ iMaterial::SetQuality(static_cast<eMaterialQuality>(getIntConfig("shader_quality", eMaterialQuality_High)));
+ else
+ iMaterial::SetQuality(eMaterialQuality_VeryLow);
mPhysicsAccuracy = static_cast<ePhysicsAccuracy>(getIntConfig("physics_accuracy", ePhysicsAccuracy_High));
mfPhysicsUpdatesPerSec = static_cast<float>(getIntConfig("physics_updates_per_second", 60));
@@ -761,7 +765,8 @@ void cInit::Exit() {
ConfMan.setInt("fsaa", mlFSAA);
ConfMan.setBool("post_effects", mbPostEffects);
- ConfMan.setInt("shader_quality", iMaterial::GetQuality());
+ if (Hpl1::areShadersAvailable())
+ ConfMan.setInt("shader_quality", iMaterial::GetQuality());
ConfMan.setBool("limit_fps", mpGame->GetLimitFPS());
ConfMan.setInt("shadows", mpGame->GetGraphics()->GetRenderer3D()->GetShowShadows());
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 781dae2e3da..232b0900537 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -40,6 +40,7 @@
#include "hpl1/hpl1.h"
#include "hpl1/debug.h"
#include "common/savefile.h"
+#include "hpl1/graphics.h"
float gfMenuFadeAmount;
@@ -1406,6 +1407,8 @@ public:
}
void OnMouseDown(eMButton aButton) {
+ if (!Hpl1::areShadersAvailable())
+ return;
int lCurrent = iMaterial::GetQuality();
if (aButton == eMButton_Left) {
lCurrent++;
Commit: 0791019e23d7284017a37de88d254881d5f5b353
https://github.com/scummvm/scummvm/commit/0791019e23d7284017a37de88d254881d5f5b353
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:02+01:00
Commit Message:
HPL1: remove header for temporary types
Changed paths:
R engines/hpl1/engine/impl/temp-types.h
engines/hpl1/engine/impl/CGProgram.h
engines/hpl1/engine/impl/PhysicsMaterialNewton.h
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/SDLTexture.h
diff --git a/engines/hpl1/engine/impl/CGProgram.h b/engines/hpl1/engine/impl/CGProgram.h
index 8466a163030..8bd36606feb 100644
--- a/engines/hpl1/engine/impl/CGProgram.h
+++ b/engines/hpl1/engine/impl/CGProgram.h
@@ -28,8 +28,6 @@
#ifndef HPL_CGPROGRAM_H
#define HPL_CGPROGRAM_H
-#include "temp-types.h"
-
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.h b/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
index 0af55f00409..4eec8511960 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.h
@@ -32,8 +32,6 @@
#include "hpl1/engine/physics/PhysicsMaterial.h"
-#include "temp-types.h"
-
namespace hpl {
class iPhysicsBody;
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index 691b878a461..de24fc43972 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -76,8 +76,6 @@ cSDLTexture::cSDLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt,
: iTexture(asName, "OGL", apPxlFmt, apLowLevelGraphics, aType, abUseMipMaps, aTarget, abCompress) {
mbContainsData = false;
- mpPBuffer = NULL;
-
if (aType == eTextureType_RenderTarget) {
Hpl1::logError(Hpl1::kDebugGraphics, "use of render target%s", ".");
// mpPBuffer = hplNew( cPBuffer, (mpLowLevelGraphics,true) );
@@ -96,9 +94,6 @@ cSDLTexture::cSDLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt,
}
cSDLTexture::~cSDLTexture() {
- if (mpPBuffer)
- hplDelete(mpPBuffer);
-
for (unsigned int &mvTextureHandle : mvTextureHandles) {
GL_CHECK(glDeleteTextures(1, (GLuint *)&mvTextureHandle));
}
diff --git a/engines/hpl1/engine/impl/SDLTexture.h b/engines/hpl1/engine/impl/SDLTexture.h
index 5880b8c91c5..dadcbad68df 100644
--- a/engines/hpl1/engine/impl/SDLTexture.h
+++ b/engines/hpl1/engine/impl/SDLTexture.h
@@ -33,8 +33,6 @@
#include "hpl1/engine/impl/PBuffer.h"
#include "hpl1/engine/graphics/bitmap2D.h"
-#include "temp-types.h"
-
namespace hpl {
class cSDLTexture : public iTexture {
@@ -97,8 +95,6 @@ private:
float mfTimeCount;
int mlTextureIndex;
float mfTimeDir;
-
- cPBuffer *mpPBuffer;
};
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/temp-types.h b/engines/hpl1/engine/impl/temp-types.h
deleted file mode 100644
index e23581bf25b..00000000000
--- a/engines/hpl1/engine/impl/temp-types.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef TEMP_TYPES_H
-#define TEMP_TYPES_H
-
-using CGcontext = int;
-using CGprogram = int;
-using CGprofile = int;
-using CGparameter = int;
-using CGtype = int;
-using Uint16 = int;
-using CGcontext = int;
-using SDL_Event = int;
-using cOAL_Sample = int;
-using cOAL_Stream = int;
-using NewtonContact = int;
-using TTF_Font = int;
-using cPBuffer = int;
-
-#endif
Commit: 33bd657cbc97facce3fcebcf0057d41b81039122
https://github.com/scummvm/scummvm/commit/33bd657cbc97facce3fcebcf0057d41b81039122
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:02+01:00
Commit Message:
HPL1: fix shader check
Changed paths:
engines/hpl1/graphics.cpp
diff --git a/engines/hpl1/graphics.cpp b/engines/hpl1/graphics.cpp
index 93a2e95a4b4..04ecf127685 100644
--- a/engines/hpl1/graphics.cpp
+++ b/engines/hpl1/graphics.cpp
@@ -21,13 +21,13 @@
#include "hpl1/graphics.h"
-#include "graphics/renderer.h"
+#include "graphics/opengl/context.h"
#include "common/config-manager.h"
namespace Hpl1 {
bool areShadersAvailable() {
- return (Graphics::Renderer::getAvailableTypes() & Graphics::kRendererTypeOpenGLShaders) &&
+ return OpenGLContext.enginesShadersSupported &&
(!ConfMan.hasKey("renderer") || ConfMan.get("renderer") == "opengl_shaders");
}
Commit: e60398f271b7134c75fd9b26958c30b2c4dffddd
https://github.com/scummvm/scummvm/commit/e60398f271b7134c75fd9b26958c30b2c4dffddd
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:02+01:00
Commit Message:
HPL1: add compile time opengl checks
Changed paths:
engines/hpl1/engine/game/low_level_game_setup.cpp
engines/hpl1/engine/impl/CGProgram.cpp
engines/hpl1/engine/impl/CGProgram.h
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
engines/hpl1/engine/impl/OcclusionQueryOGL.h
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/SDLTexture.h
engines/hpl1/engine/impl/VertexBufferOGL.cpp
engines/hpl1/engine/impl/VertexBufferOGL.h
engines/hpl1/engine/impl/VertexBufferVBO.cpp
engines/hpl1/engine/impl/VertexBufferVBO.h
engines/hpl1/graphics.cpp
engines/hpl1/graphics.h
engines/hpl1/metaengine.cpp
engines/hpl1/opengl.cpp
engines/hpl1/opengl.h
diff --git a/engines/hpl1/engine/game/low_level_game_setup.cpp b/engines/hpl1/engine/game/low_level_game_setup.cpp
index 1e8a92c177e..6be8749f814 100644
--- a/engines/hpl1/engine/game/low_level_game_setup.cpp
+++ b/engines/hpl1/engine/game/low_level_game_setup.cpp
@@ -29,12 +29,22 @@
#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
#include "hpl1/engine/impl/MouseSDL.h"
#include "hpl1/engine/haptic/LowLevelHaptic.h"
+#include "hpl1/graphics.h"
namespace hpl {
+static iLowLevelGraphics *createLowLevelGfx()
+{
+#ifdef USE_OPENGL
+ if (Hpl1::useOpenGL())
+ return hplNew(cLowLevelGraphicsSDL, ());
+#endif
+ error("only opengl graphics are supported");
+}
+
LowLevelGameSetup::LowLevelGameSetup() {
_lowLevelSystem = hplNew(LowLevelSystem, ());
- _lowLevelGraphics = hplNew(cLowLevelGraphicsSDL, ());
+ _lowLevelGraphics = createLowLevelGfx();
_lowLevelInput = hplNew(cLowLevelInputSDL, (_lowLevelGraphics));
_lowLevelResources = hplNew(LowLevelResources, (_lowLevelGraphics));
_lowLevelSound = hplNew(cLowLevelSoundOpenAL, ());
diff --git a/engines/hpl1/engine/impl/CGProgram.cpp b/engines/hpl1/engine/impl/CGProgram.cpp
index 70c3fbc88c4..33d8e7db799 100644
--- a/engines/hpl1/engine/impl/CGProgram.cpp
+++ b/engines/hpl1/engine/impl/CGProgram.cpp
@@ -26,6 +26,9 @@
*/
#include "hpl1/engine/impl/CGProgram.h"
+
+#ifdef USE_OPENGL
+
#include "hpl1/engine/impl/SDLTexture.h"
#include "hpl1/engine/system/low_level_system.h"
@@ -33,7 +36,6 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/opengl.h"
-#include "graphics/opengl/shader.h"
#include "hpl1/debug.h"
#include "common/array.h"
#include "common/str.h"
@@ -149,3 +151,5 @@ bool cCGProgram::SetMatrixf(const tString &asName, eGpuProgramMatrix mType,
}
} // namespace hpl
+
+#endif // USE_OPENGL
diff --git a/engines/hpl1/engine/impl/CGProgram.h b/engines/hpl1/engine/impl/CGProgram.h
index 8bd36606feb..e3336589389 100644
--- a/engines/hpl1/engine/impl/CGProgram.h
+++ b/engines/hpl1/engine/impl/CGProgram.h
@@ -31,6 +31,10 @@
#include "hpl1/engine/graphics/GPUProgram.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "common/scummsys.h"
+
+#ifdef USE_OPENGL
+
#include "graphics/opengl/shader.h"
namespace hpl {
@@ -67,4 +71,5 @@ private:
} // namespace hpl
+#endif // USE_OPENGL
#endif // HPL_CGPROGRAM_H
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index ffb6c9b9930..054b800dbd9 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -46,6 +46,9 @@
#include "hpl1/opengl.h"
#include "hpl1/graphics.h"
+
+#ifdef USE_OPENGL
+
namespace hpl {
GLenum ColorFormatToGL(eColorDataFormat format) {
@@ -1775,3 +1778,5 @@ void cLowLevelGraphicsSDL::SetMatrixMode(eMatrix type) {
//-----------------------------------------------------------------------
} // namespace hpl
+
+#endif //USE_OPENGL
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
index 3fffbd82b9e..1a9f34a5dd6 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.h
@@ -28,16 +28,6 @@
#ifndef HPL_LOWLEVELGRAPHICS_SDL_H
#define HPL_LOWLEVELGRAPHICS_SDL_H
-// #include <GL/GLee.h>
-//
-// #include <Cg/cg.h>
-// #include <Cg/cgGL.h>
-//
-// #include <SDL/SDL.h>
-// #include <SDL/SDL_ttf.h>
-// Unix's X11 Defines DestoryAll which collides with methods
-#undef DestroyAll
-
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "graphics/pixelformat.h"
#include "hpl1/engine/math/MathTypes.h"
@@ -45,6 +35,8 @@
#include "common/ptr.h"
#include "hpl1/opengl.h"
+#ifdef USE_OPENGL
+
namespace hpl {
//-------------------------------------------------
@@ -318,4 +310,5 @@ private:
} // namespace hpl
+#endif // USE_OPENGL
#endif // HPL_LOWLEVELGRAPHICS_SDL_H
diff --git a/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp b/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
index 10f8bf87d4f..79457e5a86d 100644
--- a/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
+++ b/engines/hpl1/engine/impl/OcclusionQueryOGL.cpp
@@ -28,7 +28,8 @@
#include "hpl1/engine/impl/OcclusionQueryOGL.h"
#include "hpl1/opengl.h"
-//#include <GL/GLee.h>
+#ifdef USE_OPENGL
+
namespace hpl {
@@ -81,3 +82,5 @@ unsigned int cOcclusionQueryOGL::GetSampleCount() {
//-----------------------------------------------------------------------
} // namespace hpl
+
+#endif // USE_OPENGL
diff --git a/engines/hpl1/engine/impl/OcclusionQueryOGL.h b/engines/hpl1/engine/impl/OcclusionQueryOGL.h
index d2652ee10ab..be2b8480872 100644
--- a/engines/hpl1/engine/impl/OcclusionQueryOGL.h
+++ b/engines/hpl1/engine/impl/OcclusionQueryOGL.h
@@ -29,6 +29,9 @@
#define HPL_OCCLUSION_QUERY_OGL_H
#include "hpl1/engine/graphics/OcclusionQuery.h"
+#include "common/scummsys.h"
+
+#ifdef USE_OPENGL
namespace hpl {
@@ -49,4 +52,5 @@ public:
} // namespace hpl
+#endif // USE_OPENGL
#endif // HPL_OCCLUSION_QUERY_H
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index de24fc43972..87502489580 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -35,6 +35,8 @@
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/opengl.h"
+#ifdef USE_OPENGL
+
namespace hpl {
static void getSettings(Bitmap2D *apSrc, int &alChannels, GLint &internalFormat, GLenum &format) {
@@ -647,3 +649,5 @@ GLenum cSDLTexture::GetGLWrap(eTextureWrap aMode) {
//-----------------------------------------------------------------------
} // namespace hpl
+
+#endif //USE_OPENGL
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/SDLTexture.h b/engines/hpl1/engine/impl/SDLTexture.h
index dadcbad68df..94d2561ab20 100644
--- a/engines/hpl1/engine/impl/SDLTexture.h
+++ b/engines/hpl1/engine/impl/SDLTexture.h
@@ -32,6 +32,9 @@
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
#include "hpl1/engine/impl/PBuffer.h"
#include "hpl1/engine/graphics/bitmap2D.h"
+#include "common/scummsys.h"
+
+#ifdef USE_OPENGL
namespace hpl {
@@ -99,4 +102,5 @@ private:
} // namespace hpl
+#endif // USE_OPENGL
#endif // HPL_SDL_TEXTURE_H
diff --git a/engines/hpl1/engine/impl/VertexBufferOGL.cpp b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
index 165bff41cf2..d39384c31ae 100644
--- a/engines/hpl1/engine/impl/VertexBufferOGL.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
@@ -29,11 +29,10 @@
#include "hpl1/debug.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
-
-//#include <GL/GLee.h>
-
#include <string.h>
+#ifdef USE_OPENGL
+
namespace hpl {
//////////////////////////////////////////////////////////////////////////
@@ -508,3 +507,5 @@ void cVertexBufferOGL::SetVertexStates(tVertexFlag aFlags) {
//-----------------------------------------------------------------------
} // namespace hpl
+
+#endif // USE_OPENGL
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/VertexBufferOGL.h b/engines/hpl1/engine/impl/VertexBufferOGL.h
index 39006e358ca..8f56735c048 100644
--- a/engines/hpl1/engine/impl/VertexBufferOGL.h
+++ b/engines/hpl1/engine/impl/VertexBufferOGL.h
@@ -29,6 +29,10 @@
#define HPL_VERTEXBUFFER_OGL_H
#include "hpl1/engine/graphics/VertexBuffer.h"
+#include "common/scummsys.h"
+
+#ifdef USE_OPENGL
+
namespace hpl {
@@ -89,4 +93,5 @@ private:
} // namespace hpl
+#endif // USE_OPENGL
#endif // HPL_RENDERER3D_OGL_H
diff --git a/engines/hpl1/engine/impl/VertexBufferVBO.cpp b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
index dbae87d8740..474994d4022 100644
--- a/engines/hpl1/engine/impl/VertexBufferVBO.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
@@ -29,10 +29,10 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/opengl.h"
-
#include <memory.h>
-//#include <GL/GLee.h>
+#ifdef USE_OPENGL
+
namespace hpl {
@@ -684,3 +684,5 @@ Log(") ");
Log("\n");
}
}*/
+
+#endif // USE_OPENGL
diff --git a/engines/hpl1/engine/impl/VertexBufferVBO.h b/engines/hpl1/engine/impl/VertexBufferVBO.h
index b91216ba76b..140164e2509 100644
--- a/engines/hpl1/engine/impl/VertexBufferVBO.h
+++ b/engines/hpl1/engine/impl/VertexBufferVBO.h
@@ -29,6 +29,9 @@
#define HPL_VERTEXBUFFER_VBO_H
#include "hpl1/engine/graphics/VertexBuffer.h"
+#include "common/scummsys.h"
+
+#ifdef USE_OPENGL
namespace hpl {
@@ -96,4 +99,5 @@ private:
} // namespace hpl
+#endif // USE_OPENGL
#endif // HPL_RENDERER3D_VBO_H
diff --git a/engines/hpl1/graphics.cpp b/engines/hpl1/graphics.cpp
index 04ecf127685..6168b38188b 100644
--- a/engines/hpl1/graphics.cpp
+++ b/engines/hpl1/graphics.cpp
@@ -23,12 +23,31 @@
#include "graphics/opengl/context.h"
#include "common/config-manager.h"
+#include "graphics/surface.h"
+#include "hpl1/opengl.h"
namespace Hpl1 {
bool areShadersAvailable() {
- return OpenGLContext.enginesShadersSupported &&
+#ifdef USE_OPENGL
+ return useOpenGL() && OpenGLContext.enginesShadersSupported &&
(!ConfMan.hasKey("renderer") || ConfMan.get("renderer") == "opengl_shaders");
+#endif
+ return false;
+}
+
+Common::ScopedPtr<Graphics::Surface> createViewportScreenshot() {
+#ifdef USE_OPENGL
+ return createGLViewportScreenshot();
+#endif
+ return nullptr;
+}
+
+bool useOpenGL() {
+#ifdef USE_OPENGL
+ return (!ConfMan.hasKey("renderer") || ConfMan.get("renderer").contains("opengl"));
+#endif
+ return false;
}
}
\ No newline at end of file
diff --git a/engines/hpl1/graphics.h b/engines/hpl1/graphics.h
index 8b9d12ea86c..465eca4b293 100644
--- a/engines/hpl1/graphics.h
+++ b/engines/hpl1/graphics.h
@@ -22,10 +22,20 @@
#ifndef HPL1_GRAPHICS_H
#define HPL1_GRAPHICS_H
+#include "common/ptr.h"
+
+namespace Graphics {
+struct Surface;
+}
+
namespace Hpl1 {
bool areShadersAvailable();
+Common::ScopedPtr<Graphics::Surface> createViewportScreenshot();
+
+bool useOpenGL();
+
}
#endif
\ No newline at end of file
diff --git a/engines/hpl1/metaengine.cpp b/engines/hpl1/metaengine.cpp
index 7510071b30b..8c9a1fefac8 100644
--- a/engines/hpl1/metaengine.cpp
+++ b/engines/hpl1/metaengine.cpp
@@ -25,7 +25,7 @@
#include "common/translation.h"
#include "hpl1/detection.h"
#include "hpl1/hpl1.h"
-#include "hpl1/opengl.h"
+#include "hpl1/graphics.h"
#include "graphics/scaler.h"
#include "graphics/thumbnail.h"
#include "common/savefile.h"
diff --git a/engines/hpl1/opengl.cpp b/engines/hpl1/opengl.cpp
index 151fc9bf01a..ebb540bd54a 100644
--- a/engines/hpl1/opengl.cpp
+++ b/engines/hpl1/opengl.cpp
@@ -25,6 +25,8 @@
#include "graphics/surface.h"
#include "common/system.h"
+#ifdef USE_OPENGL
+
namespace Hpl1 {
static const char* getErrorString(const GLenum code) {
@@ -60,7 +62,7 @@ static Graphics::PixelFormat getRGBAPixelFormat() {
#endif
}
-Common::ScopedPtr<Graphics::Surface> createViewportScreenshot() {
+Common::ScopedPtr<Graphics::Surface> createGLViewportScreenshot() {
Common::ScopedPtr<Graphics::Surface> screen(new Graphics::Surface());
Common::Rect viewportSize = getGLViewport();
screen->create(viewportSize.width(), viewportSize.height(), getRGBAPixelFormat());
@@ -69,4 +71,6 @@ Common::ScopedPtr<Graphics::Surface> createViewportScreenshot() {
return screen;
}
-} // End of namespace Hpl1
\ No newline at end of file
+} // End of namespace Hpl1
+
+#endif // USE_OPENGL
diff --git a/engines/hpl1/opengl.h b/engines/hpl1/opengl.h
index f2e6503beb1..99a6593d706 100644
--- a/engines/hpl1/opengl.h
+++ b/engines/hpl1/opengl.h
@@ -22,11 +22,12 @@
#ifndef HPL1_OPENGL_H
#define HPL1_OPENGL_H
-#define USE_OPENGL
-#define USE_GLAD
#include "graphics/opengl/system_headers.h"
#include "graphics/opengl/context.h"
#include "common/ptr.h"
+#include "common/scummsys.h"
+
+#ifdef USE_OPENGL
namespace Graphics {
@@ -38,11 +39,12 @@ namespace Hpl1 {
void checkOGLErrors(const char *function, int line);
-Common::ScopedPtr<Graphics::Surface> createViewportScreenshot();
+Common::ScopedPtr<Graphics::Surface> createGLViewportScreenshot();
}
#define GL_CHECK(x) {x; ::Hpl1::checkOGLErrors(__func__, __LINE__);}
#define GL_CHECK_FN() GL_CHECK()
-#endif
+#endif // USE_OPENGL
+#endif // HPL1_OPENGL_H
Commit: 95791efb816798cd24415da310a0914202b9bdd1
https://github.com/scummvm/scummvm/commit/95791efb816798cd24415da310a0914202b9bdd1
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:02+01:00
Commit Message:
HPL1: rename shaders
Changed paths:
A engines/hpl1/engine/impl/shaders/hpl1_Ambient_Color.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Bump2D_Light.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Bump2D_Light.vertex
A engines/hpl1/engine/impl/shaders/hpl1_BumpColorSpec_Light.fragment
A engines/hpl1/engine/impl/shaders/hpl1_BumpColorSpec_Light_Spot.fragment
A engines/hpl1/engine/impl/shaders/hpl1_BumpSpec2D_Light.fragment
A engines/hpl1/engine/impl/shaders/hpl1_BumpSpec2D_Light.vertex
A engines/hpl1/engine/impl/shaders/hpl1_BumpSpec_Light.fragment
A engines/hpl1/engine/impl/shaders/hpl1_BumpSpec_Light_Spot.fragment
A engines/hpl1/engine/impl/shaders/hpl1_BumpSpec_Light_Spot_pass2.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Bump_Light.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Bump_Light_Spot.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Bump_Light_Spot_pass2.fragment
A engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light.fragment
A engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light.vertex
A engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light_Spot.fragment
A engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light_Spot.vertex
A engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light_Spot_pass2.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Color.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Color.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Diffuse_ColorMul.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Diffuse_EnvMap_Reflect.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Diffuse_EnvMap_Reflect.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot_pass1.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot_pass2.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Bump_Light.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_Spot.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_Spot_p2.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p1.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p1.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p2.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p2.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Fallback02_DIffuse_Light_Spot_p2.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Fallback02_DIffuse_Light_Spot_p3.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_Spot_p2.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_Spot_p3.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_p1.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_p1.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_p2.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Fog_Solid.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Fog_Solid.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans_Alpha.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans_Mod.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans_ModX2.fragment
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.fragment
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.vertex
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur.vertex
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_2D.fragment
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_Rect.fragment
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_DoF.fragment
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_DoF.vertex
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_2D.fragment
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_Rect.fragment
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.fragment
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion_staticloop.fragment
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Offset.fragment
A engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Offset.vertex
A engines/hpl1/engine/impl/shaders/hpl1_ShadowExtrude.fragment
A engines/hpl1/engine/impl/shaders/hpl1_ShadowExtrude.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Water_Diffuse.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Water_Diffuse.vertex
A engines/hpl1/engine/impl/shaders/hpl1_Water_Fog.fragment
A engines/hpl1/engine/impl/shaders/hpl1_Water_Fog.vertex
A engines/hpl1/engine/impl/shaders/hpl1_refract.fragment
A engines/hpl1/engine/impl/shaders/hpl1_refract.vertex
A engines/hpl1/engine/impl/shaders/hpl1_refract_special.fragment
A engines/hpl1/engine/impl/shaders/hpl1_refract_water.fragment
A engines/hpl1/engine/impl/shaders/hpl1_refract_water.vertex
R engines/hpl1/engine/impl/shaders/Ambient_Color.fragment
R engines/hpl1/engine/impl/shaders/Bump2D_Light.fragment
R engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
R engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
R engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
R engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.fragment
R engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
R engines/hpl1/engine/impl/shaders/BumpSpec_Light.fragment
R engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
R engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot_pass2.fragment
R engines/hpl1/engine/impl/shaders/Bump_Light.fragment
R engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
R engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
R engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
R engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
R engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
R engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
R engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
R engines/hpl1/engine/impl/shaders/Diffuse_Color.fragment
R engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
R engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
R engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.fragment
R engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
R engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
R engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
R engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
R engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
R engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass1.fragment
R engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
R engines/hpl1/engine/impl/shaders/Fallback01_Bump_Light.fragment
R engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot.fragment
R engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
R engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.fragment
R engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
R engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.fragment
R engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
R engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p2.fragment
R engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p3.fragment
R engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
R engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
R engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.fragment
R engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
R engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
R engines/hpl1/engine/impl/shaders/Fog_Solid.fragment
R engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
R engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
R engines/hpl1/engine/impl/shaders/Fog_Trans_Alpha.fragment
R engines/hpl1/engine/impl/shaders/Fog_Trans_Mod.fragment
R engines/hpl1/engine/impl/shaders/Fog_Trans_ModX2.fragment
R engines/hpl1/engine/impl/shaders/PostEffect_Bloom.fragment
R engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
R engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
R engines/hpl1/engine/impl/shaders/PostEffect_Blur_2D.fragment
R engines/hpl1/engine/impl/shaders/PostEffect_Blur_Rect.fragment
R engines/hpl1/engine/impl/shaders/PostEffect_DoF.fragment
R engines/hpl1/engine/impl/shaders/PostEffect_DoF.vertex
R engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_2D.fragment
R engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_Rect.fragment
R engines/hpl1/engine/impl/shaders/PostEffect_Motion.fragment
R engines/hpl1/engine/impl/shaders/PostEffect_Motion.vertex
R engines/hpl1/engine/impl/shaders/PostEffect_Motion_staticloop.fragment
R engines/hpl1/engine/impl/shaders/PostEffect_Offset.fragment
R engines/hpl1/engine/impl/shaders/PostEffect_Offset.vertex
R engines/hpl1/engine/impl/shaders/ShadowExtrude.fragment
R engines/hpl1/engine/impl/shaders/ShadowExtrude.vertex
R engines/hpl1/engine/impl/shaders/Water_Diffuse.fragment
R engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
R engines/hpl1/engine/impl/shaders/Water_Fog.fragment
R engines/hpl1/engine/impl/shaders/Water_Fog.vertex
R engines/hpl1/engine/impl/shaders/refract.fragment
R engines/hpl1/engine/impl/shaders/refract.vertex
R engines/hpl1/engine/impl/shaders/refract_special.fragment
R engines/hpl1/engine/impl/shaders/refract_water.fragment
R engines/hpl1/engine/impl/shaders/refract_water.vertex
engines/hpl1/engine/graphics/Material_Additive.cpp
engines/hpl1/engine/graphics/Material_Alpha.cpp
engines/hpl1/engine/graphics/Material_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Bump.cpp
engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
engines/hpl1/engine/graphics/Material_BumpSpec.cpp
engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
engines/hpl1/engine/graphics/Material_Diffuse.cpp
engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
engines/hpl1/engine/graphics/Material_Modulative.cpp
engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
engines/hpl1/engine/graphics/Material_Water.cpp
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/engine/graphics/RendererPostEffects.cpp
diff --git a/engines/hpl1/engine/graphics/Material_Additive.cpp b/engines/hpl1/engine/graphics/Material_Additive.cpp
index ef79bf32185..55992bf9e89 100644
--- a/engines/hpl1/engine/graphics/Material_Additive.cpp
+++ b/engines/hpl1/engine/graphics/Material_Additive.cpp
@@ -72,7 +72,7 @@ cMaterial_Additive::cMaterial_Additive(const tString &asName, iLowLevelGraphics
mbIsGlowing = false;
mbUsesLights = false;
- _fogShader = mpProgramManager->CreateProgram("Fog_Trans", "Fog_Trans_Alpha");
+ _fogShader = mpProgramManager->CreateProgram("hpl1_Fog_Trans", "hpl1_Fog_Trans_Alpha");
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/graphics/Material_Alpha.cpp b/engines/hpl1/engine/graphics/Material_Alpha.cpp
index bc1effb8100..c7a2eb16c2e 100644
--- a/engines/hpl1/engine/graphics/Material_Alpha.cpp
+++ b/engines/hpl1/engine/graphics/Material_Alpha.cpp
@@ -70,7 +70,7 @@ cMaterial_Alpha::cMaterial_Alpha(const tString &asName, iLowLevelGraphics *apLow
mbIsGlowing = false;
mbUsesLights = false;
- _fogShader = mpProgramManager->CreateProgram("Fog_Trans", "Fog_Trans_Alpha");
+ _fogShader = mpProgramManager->CreateProgram("hpl1_Fog_Trans", "hpl1_Fog_Trans_Alpha");
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
index 3d6ac015bea..5accb192e34 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
@@ -102,8 +102,8 @@ iMaterial_BaseLight::iMaterial_BaseLight(const tString &asLightVertexProgram,
_shaders[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram(sSpotVtxProgram, sSpotFragProgram2);
}
- _diffuseShader = mpProgramManager->CreateProgram("Diffuse_Color", "Diffuse_Color");
- _ambientShader = mpProgramManager->CreateProgram("Diffuse_Color", "Ambient_Color");
+ _diffuseShader = mpProgramManager->CreateProgram("hpl1_Diffuse_Color", "hpl1_Diffuse_Color");
+ _ambientShader = mpProgramManager->CreateProgram("hpl1_Diffuse_Color", "hpl1_Ambient_Color");
///////////////////////////////////////////
// Normalization map
diff --git a/engines/hpl1/engine/graphics/Material_Bump.cpp b/engines/hpl1/engine/graphics/Material_Bump.cpp
index 62afee474a8..6e0850f2731 100644
--- a/engines/hpl1/engine/graphics/Material_Bump.cpp
+++ b/engines/hpl1/engine/graphics/Material_Bump.cpp
@@ -44,8 +44,8 @@ cMaterial_Bump::cMaterial_Bump(const tString &asName, iLowLevelGraphics *apLowLe
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
- : iMaterial_BaseLight("Diffuse_Light",
- "Bump_Light",
+ : iMaterial_BaseLight("hpl1_Diffuse_Light",
+ "hpl1_Bump_Light",
asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
mbUseSpecular = false;
diff --git a/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp b/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
index f2f8b955e20..bab217c1a48 100644
--- a/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpColorSpec.cpp
@@ -45,8 +45,8 @@ cMaterial_BumpColorSpec::cMaterial_BumpColorSpec(const tString &asName, iLowLeve
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
- : iMaterial_BaseLight("DiffuseSpec_Light",
- "BumpColorSpec_Light",
+ : iMaterial_BaseLight("hpl1_DiffuseSpec_Light",
+ "hpl1_BumpColorSpec_Light",
asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
mbUseSpecular = true;
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec.cpp b/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
index b0a9fa5d8e6..50f83099c55 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec.cpp
@@ -44,8 +44,8 @@ cMaterial_BumpSpec::cMaterial_BumpSpec(const tString &asName, iLowLevelGraphics
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
- : iMaterial_BaseLight("DiffuseSpec_Light",
- "BumpSpec_Light",
+ : iMaterial_BaseLight("hpl1_DiffuseSpec_Light",
+ "hpl1_BumpSpec_Light",
asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
mbUseSpecular = true;
diff --git a/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp b/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
index 20d07a28e24..c92515b1749 100644
--- a/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
+++ b/engines/hpl1/engine/graphics/Material_BumpSpec2D.cpp
@@ -52,7 +52,7 @@ cMaterial_BumpSpec2D::cMaterial_BumpSpec2D(const tString &asName, iLowLevelGraph
mbHasSpecular = true;
mType = eMaterialType_BumpSpec;
- _shader = mpProgramManager->CreateProgram("BumpSpec2D_Light", "BumpSpec2D_Light");
+ _shader = mpProgramManager->CreateProgram("hpl1_BumpSpec2D_Light", "hpl1_BumpSpec2D_Light");
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/graphics/Material_Diffuse.cpp b/engines/hpl1/engine/graphics/Material_Diffuse.cpp
index f73b7deb2a1..72e8e3c0bbe 100644
--- a/engines/hpl1/engine/graphics/Material_Diffuse.cpp
+++ b/engines/hpl1/engine/graphics/Material_Diffuse.cpp
@@ -43,8 +43,8 @@ cMaterial_Diffuse::cMaterial_Diffuse(const tString &asName, iLowLevelGraphics *a
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
- : iMaterial_BaseLight("Diffuse_Light",
- "Diffuse_Light",
+ : iMaterial_BaseLight("hpl1_Diffuse_Light",
+ "hpl1_Diffuse_Light",
asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
mbUseSpecular = false;
diff --git a/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp b/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
index 8ade50b2280..24c1c9f851e 100644
--- a/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
+++ b/engines/hpl1/engine/graphics/Material_DiffuseSpec.cpp
@@ -43,8 +43,8 @@ cMaterial_DiffuseSpec::cMaterial_DiffuseSpec(const tString &asName, iLowLevelGra
cImageManager *apImageManager, cTextureManager *apTextureManager,
cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
- : iMaterial_BaseLight("DiffuseSpec_Light",
- "DiffuseSpec_Light",
+ : iMaterial_BaseLight("hpl1_DiffuseSpec_Light",
+ "hpl1_DiffuseSpec_Light",
asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
aPicture, apRenderer3D) {
mbUseSpecular = true;
diff --git a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
index 770447f33bd..e893dcb0364 100644
--- a/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
+++ b/engines/hpl1/engine/graphics/Material_EnvMap_Reflect.cpp
@@ -76,8 +76,8 @@ cMaterial_EnvMap_Reflect::cMaterial_EnvMap_Reflect(const tString &asName, iLowLe
mbIsGlowing = false;
mbUsesLights = false;
- _diffuseProgram = mpProgramManager->CreateProgram("Diffuse_Color", "Diffuse_Color");
- _diffuseReflectProgram = mpProgramManager->CreateProgram("Diffuse_EnvMap_Reflect", "Diffuse_EnvMap_Reflect");
+ _diffuseProgram = mpProgramManager->CreateProgram("hpl1_Diffuse_Color", "hpl1_Diffuse_Color");
+ _diffuseReflectProgram = mpProgramManager->CreateProgram("hpl1_Diffuse_EnvMap_Reflect", "hpl1_Diffuse_EnvMap_Reflect");
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
index 1a85a295c30..d4881aed065 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback01_BaseLight.cpp
@@ -63,17 +63,17 @@ iMaterial_Fallback01_BaseLight::iMaterial_Fallback01_BaseLight(
const char *firstPassFragment = "";
if (abNormalMap)
- firstPassFragment = "Fallback01_Bump_Light";
+ firstPassFragment = "hpl1_Fallback01_Bump_Light";
else
- firstPassFragment = "Fallback01_Diffuse_Light_p1";
+ firstPassFragment = "hpl1_Fallback01_Diffuse_Light_p1";
- _programs[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram("Fallback01_Diffuse_Light_p1", firstPassFragment);
- _programs[eBaseLightProgram_Point2] = mpProgramManager->CreateProgram("Fallback01_Diffuse_Light_p2", "Fallback01_Diffuse_Light_p2");
- _programs[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram("Fallback01_Diffuse_Light_p1", firstPassFragment);
- _programs[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram("Fallback01_Diffuse_Light_Spot_p2", "Fallback01_Diffuse_Light_Spot");
+ _programs[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram("hpl1_Fallback01_Diffuse_Light_p1", firstPassFragment);
+ _programs[eBaseLightProgram_Point2] = mpProgramManager->CreateProgram("hpl1_Fallback01_Diffuse_Light_p2", "hpl1_Fallback01_Diffuse_Light_p2");
+ _programs[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram("hpl1_Fallback01_Diffuse_Light_p1", firstPassFragment);
+ _programs[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram("hpl1_Fallback01_Diffuse_Light_Spot_p2", "hpl1_Fallback01_Diffuse_Light_Spot");
- _diffuseShader = mpProgramManager->CreateProgram("Diffuse_Color", "Diffuse_Color");
- _ambientShader = mpProgramManager->CreateProgram("Diffuse_Color", "Ambient_Color");
+ _diffuseShader = mpProgramManager->CreateProgram("hpl1_Diffuse_Color", "hpl1_Diffuse_Color");
+ _ambientShader = mpProgramManager->CreateProgram("hpl1_Diffuse_Color", "hpl1_Ambient_Color");
mpNormalizationMap = mpTextureManager->CreateCubeMap("Normalization", false);
mpNormalizationMap->SetWrapS(eTextureWrap_ClampToEdge);
diff --git a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
index 325b72f7d77..3ac7f3d3a8f 100644
--- a/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_Fallback02_BaseLight.cpp
@@ -55,15 +55,15 @@ iMaterial_Fallback02_BaseLight::iMaterial_Fallback02_BaseLight(
Common::fill(_gpuPrograms, _gpuPrograms + eBaseLightProgram_LastEnum, nullptr);
- _gpuPrograms[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_p1", "Fallback02_Diffuse_Light_p1");
+ _gpuPrograms[eBaseLightProgram_Point1] = mpProgramManager->CreateProgram("hpl1_Fallback02_Diffuse_Light_p1", "hpl1_Fallback02_Diffuse_Light_p1");
//the second pass is the same as the second pass of fallback01
- _gpuPrograms[eBaseLightProgram_Point2] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_p2", "Fallback01_Diffuse_Light_p2");
- _gpuPrograms[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_p1", "Fallback02_Diffuse_Light_p1");
- _gpuPrograms[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_Spot_p2", "Fallback02_Diffuse_Light_Spot_p2");
- _gpuPrograms[eBaseLightProgram_Spot3] = mpProgramManager->CreateProgram("Fallback02_Diffuse_Light_Spot_p3", "Fallback02_Diffuse_Light_Spot_p3");
+ _gpuPrograms[eBaseLightProgram_Point2] = mpProgramManager->CreateProgram("hpl1_Fallback02_Diffuse_Light_p2", "hpl1_Fallback01_Diffuse_Light_p2");
+ _gpuPrograms[eBaseLightProgram_Spot1] = mpProgramManager->CreateProgram("hpl1_Fallback02_Diffuse_Light_p1", "hpl1_Fallback02_Diffuse_Light_p1");
+ _gpuPrograms[eBaseLightProgram_Spot2] = mpProgramManager->CreateProgram("hpl1_Fallback02_Diffuse_Light_Spot_p2", "hpl1_Fallback02_Diffuse_Light_Spot_p2");
+ _gpuPrograms[eBaseLightProgram_Spot3] = mpProgramManager->CreateProgram("hpl1_Fallback02_Diffuse_Light_Spot_p3", "hpl1_Fallback02_Diffuse_Light_Spot_p3");
- _diffuseGpuProgram = mpProgramManager->CreateProgram("Diffuse_Color", "Diffuse_Color");
- _ambientGpuProgram = mpProgramManager->CreateProgram("Diffuse_Color", "Ambient_Color");
+ _diffuseGpuProgram = mpProgramManager->CreateProgram("hpl1_Diffuse_Color", "hpl1_Diffuse_Color");
+ _ambientGpuProgram = mpProgramManager->CreateProgram("hpl1_Diffuse_Color", "hpl1_Ambient_Color");
mpNormalizationMap = mpTextureManager->CreateCubeMap("Normalization", false);
mpNormalizationMap->SetWrapS(eTextureWrap_ClampToEdge);
diff --git a/engines/hpl1/engine/graphics/Material_Modulative.cpp b/engines/hpl1/engine/graphics/Material_Modulative.cpp
index 8ea5df1cb03..65e5e963bba 100644
--- a/engines/hpl1/engine/graphics/Material_Modulative.cpp
+++ b/engines/hpl1/engine/graphics/Material_Modulative.cpp
@@ -71,7 +71,7 @@ cMaterial_Modulative::cMaterial_Modulative(const tString &asName, iLowLevelGraph
mbIsGlowing = false;
mbUsesLights = false;
- _fogShader = mpProgramManager->CreateProgram("Fog_Trans", "Fog_Trans_Mod");
+ _fogShader = mpProgramManager->CreateProgram("hpl1_Fog_Trans", "hpl1_Fog_Trans_Mod");
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp b/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
index 9f057a4eac7..0ff453b61ce 100644
--- a/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
+++ b/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
@@ -69,7 +69,7 @@ cMaterial_ModulativeX2::cMaterial_ModulativeX2(const tString &asName, iLowLevelG
mbIsTransperant = true;
mbIsGlowing = false;
mbUsesLights = false;
- _fogShader = mpProgramManager->CreateProgram("Fog_Trans", "Fog_Trans_ModX2");
+ _fogShader = mpProgramManager->CreateProgram("hpl1_Fog_Trans", "hpl1_Fog_Trans_ModX2");
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/graphics/Material_Water.cpp b/engines/hpl1/engine/graphics/Material_Water.cpp
index bb58d92c386..e36cb34199f 100644
--- a/engines/hpl1/engine/graphics/Material_Water.cpp
+++ b/engines/hpl1/engine/graphics/Material_Water.cpp
@@ -85,9 +85,9 @@ cMaterial_Water::cMaterial_Water(const tString &asName, iLowLevelGraphics *apLow
mbIsGlowing = false;
mbUsesLights = false;
- _fogProgram = mpProgramManager->CreateProgram("Water_Fog", "Water_Fog");
- _diffuseProgram = mpProgramManager->CreateProgram("Water_Diffuse", "Water_Diffuse");
- _refractProgram = mpProgramManager->CreateProgram("refract_water", "refract_water");
+ _fogProgram = mpProgramManager->CreateProgram("hpl1_Water_Fog", "hpl1_Water_Fog");
+ _diffuseProgram = mpProgramManager->CreateProgram("hpl1_Water_Diffuse", "hpl1_Water_Diffuse");
+ _refractProgram = mpProgramManager->CreateProgram("hpl1_refract_water", "hpl1_refract_water");
mfTime = 0;
}
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index fa19d16c174..ec26968c967 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -116,15 +116,15 @@ cRenderer3D::cRenderer3D(iLowLevelGraphics *apLowLevelGraphics, cResources *apRe
Hpl1::logInfo(Hpl1::kDebugGraphics, "%s", "Load Renderer3D gpu programs:\n");
cGpuProgramManager *pProgramManager = apResources->GetGpuProgramManager();
- mRenderSettings.extrudeProgram = pProgramManager->CreateProgram("ShadowExtrude", "ShadowExtrude");
+ mRenderSettings.extrudeProgram = pProgramManager->CreateProgram("hpl1_ShadowExtrude", "hpl1_ShadowExtrude");
///////////////////////////////////
// Load diffuse program, for stuff like query rendering
- _diffuseProgram = pProgramManager->CreateProgram("Diffuse_Color", "Diffuse_Color");
+ _diffuseProgram = pProgramManager->CreateProgram("hpl1_Diffuse_Color", "hpl1_Diffuse_Color");
///////////////////////////////////
// Fog Vertex Program Init
- _solidFogProgram = pProgramManager->CreateProgram("Fog_Solid", "Fog_Solid");
+ _solidFogProgram = pProgramManager->CreateProgram("hpl1_Fog_Solid", "hpl1_Fog_Solid");
///////////////////////////////////
// Fog Texture Init
@@ -186,8 +186,8 @@ cRenderer3D::cRenderer3D(iLowLevelGraphics *apLowLevelGraphics, cResources *apRe
/////////////////////////////////////////////
// Create Refraction programs
mbRefractionAvailable = true;
- _refractProgram = pProgramManager->CreateProgram("refract", "refract");
- _refractSpecProgram = pProgramManager->CreateProgram("refract", "refract_special");
+ _refractProgram = pProgramManager->CreateProgram("hpl1_refract", "hpl1_refract");
+ _refractSpecProgram = pProgramManager->CreateProgram("hpl1_refract", "hpl1_refract_special");
if (!_refractProgram || !_refractSpecProgram) {
mbRefractionAvailable = false;
Hpl1::logInfo(Hpl1::kDebugGraphics, "%s", "refraction will not be supported");
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.cpp b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
index c03ae36f597..3f30d8cb26d 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.cpp
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.cpp
@@ -92,12 +92,12 @@ cRendererPostEffects::cRendererPostEffects(iLowLevelGraphics *apLowLevelGraphics
/////////////////
// Blur programs
mbBlurFallback = false; // Set to true if the fallbacks are used.
- _blur2DProgram = mpGpuManager->CreateProgram("PostEffect_Blur", "PostEffect_Blur_2D");
- _blurRectProgram = mpGpuManager->CreateProgram("PostEffect_Blur", "PostEffect_Blur_Rect");
+ _blur2DProgram = mpGpuManager->CreateProgram("hpl1_PostEffect_Blur", "hpl1_PostEffect_Blur_2D");
+ _blurRectProgram = mpGpuManager->CreateProgram("hpl1_PostEffect_Blur", "hpl1_PostEffect_Blur_Rect");
/////////////////
// Bloom programs
- _bloomProgram = mpGpuManager->CreateProgram("PostEffect_Bloom", "PostEffect_Bloom");
+ _bloomProgram = mpGpuManager->CreateProgram("hpl1_PostEffect_Bloom", "hpl1_PostEffect_Bloom");
// Bloom blur textures
mpBloomBlurTexture = mpLowLevelGraphics->CreateTexture(
@@ -114,11 +114,11 @@ cRendererPostEffects::cRendererPostEffects(iLowLevelGraphics *apLowLevelGraphics
/////////////////
// MotionBlur programs
- _motionBlurProgram = mpGpuManager->CreateProgram("PostEffect_Motion", "PostEffect_Motion"); // CHECK APPLE
+ _motionBlurProgram = mpGpuManager->CreateProgram("hpl1_PostEffect_Motion", "hpl1_PostEffect_Motion"); // CHECK APPLE
/////////////////
// Depth of Field programs
- _depthOfFieldProgram = mpGpuManager->CreateProgram("PostEffect_DoF", "PostEffect_DoF");
+ _depthOfFieldProgram = mpGpuManager->CreateProgram("hpl1_PostEffect_DoF", "hpl1_PostEffect_DoF");
// Depth of Field blur textures
mpDofBlurTexture = mpLowLevelGraphics->CreateTexture(cVector2l(256, 256),
diff --git a/engines/hpl1/engine/impl/shaders/Ambient_Color.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Ambient_Color.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Ambient_Color.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Ambient_Color.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Bump2D_Light.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Bump2D_Light.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Bump2D_Light.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Bump2D_Light.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Bump2D_Light.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Bump2D_Light.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Bump2D_Light.vertex
diff --git a/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment b/engines/hpl1/engine/impl/shaders/hpl1_BumpColorSpec_Light.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/BumpColorSpec_Light.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_BumpColorSpec_Light.fragment
diff --git a/engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/hpl1_BumpColorSpec_Light_Spot.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/BumpColorSpec_Light_Spot.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_BumpColorSpec_Light_Spot.fragment
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.fragment b/engines/hpl1/engine/impl/shaders/hpl1_BumpSpec2D_Light.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_BumpSpec2D_Light.fragment
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex b/engines/hpl1/engine/impl/shaders/hpl1_BumpSpec2D_Light.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/BumpSpec2D_Light.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_BumpSpec2D_Light.vertex
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec_Light.fragment b/engines/hpl1/engine/impl/shaders/hpl1_BumpSpec_Light.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/BumpSpec_Light.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_BumpSpec_Light.fragment
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/hpl1_BumpSpec_Light_Spot.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_BumpSpec_Light_Spot.fragment
diff --git a/engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/hpl1_BumpSpec_Light_Spot_pass2.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/BumpSpec_Light_Spot_pass2.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_BumpSpec_Light_Spot_pass2.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Bump_Light.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Bump_Light.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Bump_Light.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Bump_Light.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Bump_Light_Spot.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Bump_Light_Spot.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Bump_Light_Spot.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Bump_Light_Spot_pass2.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Bump_Light_Spot_pass2.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Bump_Light_Spot_pass2.fragment
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment b/engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light.fragment
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex b/engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/DiffuseSpec_Light.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light.vertex
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light_Spot.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light_Spot.fragment
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light_Spot.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light_Spot.vertex
diff --git a/engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light_Spot_pass2.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/DiffuseSpec_Light_Spot_pass2.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light_Spot_pass2.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Color.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Color.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Diffuse_Color.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Color.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Color.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Diffuse_Color.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Color.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Diffuse_ColorMul.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Diffuse_ColorMul.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Diffuse_ColorMul.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Diffuse_EnvMap_Reflect.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Diffuse_EnvMap_Reflect.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Diffuse_EnvMap_Reflect.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Diffuse_EnvMap_Reflect.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Diffuse_EnvMap_Reflect.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Diffuse_Light.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Diffuse_Light.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass1.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot_pass1.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass1.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot_pass1.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot_pass2.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Diffuse_Light_Spot_pass2.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot_pass2.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Bump_Light.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Bump_Light.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback01_Bump_Light.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Bump_Light.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_Spot.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_Spot.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_Spot_p2.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_Spot_p2.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_Spot_p2.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p1.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p1.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p1.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p1.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p1.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p2.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p2.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p2.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback01_Diffuse_Light_p2.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p2.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p2.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Fallback02_DIffuse_Light_Spot_p2.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p2.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback02_DIffuse_Light_Spot_p2.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p3.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Fallback02_DIffuse_Light_Spot_p3.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback02_DIffuse_Light_Spot_p3.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback02_DIffuse_Light_Spot_p3.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_Spot_p2.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p2.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_Spot_p2.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_Spot_p3.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_Spot_p3.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_Spot_p3.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_p1.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_p1.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_p1.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p1.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_p1.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_p2.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fallback02_Diffuse_Light_p2.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_p2.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Solid.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Fog_Solid.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fog_Solid.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Fog_Solid.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Solid.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Fog_Solid.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fog_Solid.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Fog_Solid.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Trans.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fog_Trans.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Trans_Alpha.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans_Alpha.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fog_Trans_Alpha.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans_Alpha.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Trans_Mod.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans_Mod.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fog_Trans_Mod.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans_Mod.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Fog_Trans_ModX2.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans_ModX2.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Fog_Trans_ModX2.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans_ModX2.fragment
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_Bloom.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.fragment
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_Bloom.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.vertex
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_Blur.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur.vertex
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Blur_2D.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_2D.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_Blur_2D.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_2D.fragment
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Blur_Rect.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_Rect.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_Blur_Rect.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_Rect.fragment
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_DoF.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_DoF.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_DoF.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_DoF.fragment
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_DoF.vertex b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_DoF.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_DoF.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_DoF.vertex
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_2D.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_2D.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_2D.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_2D.fragment
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_Rect.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_Rect.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_Fallback01_Blur_Rect.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_Rect.fragment
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Motion.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_Motion.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.fragment
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Motion.vertex b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_Motion.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Motion_staticloop.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion_staticloop.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_Motion_staticloop.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion_staticloop.fragment
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Offset.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Offset.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_Offset.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Offset.fragment
diff --git a/engines/hpl1/engine/impl/shaders/PostEffect_Offset.vertex b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Offset.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/PostEffect_Offset.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Offset.vertex
diff --git a/engines/hpl1/engine/impl/shaders/ShadowExtrude.fragment b/engines/hpl1/engine/impl/shaders/hpl1_ShadowExtrude.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/ShadowExtrude.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_ShadowExtrude.fragment
diff --git a/engines/hpl1/engine/impl/shaders/ShadowExtrude.vertex b/engines/hpl1/engine/impl/shaders/hpl1_ShadowExtrude.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/ShadowExtrude.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_ShadowExtrude.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Water_Diffuse.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Water_Diffuse.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Water_Diffuse.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Water_Diffuse.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Water_Diffuse.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Water_Diffuse.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Water_Diffuse.vertex
diff --git a/engines/hpl1/engine/impl/shaders/Water_Fog.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Water_Fog.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Water_Fog.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_Water_Fog.fragment
diff --git a/engines/hpl1/engine/impl/shaders/Water_Fog.vertex b/engines/hpl1/engine/impl/shaders/hpl1_Water_Fog.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/Water_Fog.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_Water_Fog.vertex
diff --git a/engines/hpl1/engine/impl/shaders/refract.fragment b/engines/hpl1/engine/impl/shaders/hpl1_refract.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/refract.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_refract.fragment
diff --git a/engines/hpl1/engine/impl/shaders/refract.vertex b/engines/hpl1/engine/impl/shaders/hpl1_refract.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/refract.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_refract.vertex
diff --git a/engines/hpl1/engine/impl/shaders/refract_special.fragment b/engines/hpl1/engine/impl/shaders/hpl1_refract_special.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/refract_special.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_refract_special.fragment
diff --git a/engines/hpl1/engine/impl/shaders/refract_water.fragment b/engines/hpl1/engine/impl/shaders/hpl1_refract_water.fragment
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/refract_water.fragment
rename to engines/hpl1/engine/impl/shaders/hpl1_refract_water.fragment
diff --git a/engines/hpl1/engine/impl/shaders/refract_water.vertex b/engines/hpl1/engine/impl/shaders/hpl1_refract_water.vertex
similarity index 100%
rename from engines/hpl1/engine/impl/shaders/refract_water.vertex
rename to engines/hpl1/engine/impl/shaders/hpl1_refract_water.vertex
Commit: 18d97d1053c342ee4bfa684cc1a2674559963128
https://github.com/scummvm/scummvm/commit/18d97d1053c342ee4bfa684cc1a2674559963128
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:03+01:00
Commit Message:
HPL1: remove commented out code in shader
Changed paths:
engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex
diff --git a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex
index 9880edb0606..ece30406933 100644
--- a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex
+++ b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex
@@ -13,9 +13,7 @@ vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
vec3 color = gl_Color.xyz;
-
out vec3 vColor;
-//out float oVelocity :TEX0
out vec4 vVtxPos;
out vec4 vPrevVtxPos;
@@ -44,24 +42,10 @@ void main()
//Interpolate the previous according to blurscale
prevPos = mix(pos, prevPos, blurScale);
- //Choose previous or current position based on dot product between motion vector and normal
- //float flag = dot(motionVector, eyeNormal) > 0;
- //vec4 Pstretch = flag ? pos : prevPos;
- //vPos = Pstretch;
gl_Position = pos;
- //Divide by W -> NDC coordinates
- //pos.xyz = pos.xyz / pos.w;
- //prevPos.xyz = prevPos.xyz / prevPos.w;
- //Calculate window space velocity
- //vec3 windowVel = (prevPos.xyz - pos.xyz);// * vec3(400,300,1);
- //oVelocity = windowVel * blurScale;
-
vVtxPos = pos;
vPrevVtxPos = prevPos;
- //vColor.xy = 0.5 + (windowVel.xy * 0.005);
- //vColor.z = 1;
- //vColor = (1 + eyeNormal)*0.5;
vColor = vec3(0.5);
}
\ No newline at end of file
Commit: 5e300864a32e33acd7ba70ddeb37ed4bd6075f40
https://github.com/scummvm/scummvm/commit/5e300864a32e33acd7ba70ddeb37ed4bd6075f40
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:03+01:00
Commit Message:
HPL1: remove unused vColor shader input/output
Changed paths:
engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Bump_Light.fragment
engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.fragment
engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.vertex
engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur.vertex
engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_2D.fragment
engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_Rect.fragment
engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_2D.fragment
engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex
diff --git a/engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Bump_Light.fragment b/engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Bump_Light.fragment
index 5555a7efd10..ba9fc48ea40 100644
--- a/engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Bump_Light.fragment
+++ b/engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Bump_Light.fragment
@@ -1,6 +1,5 @@
//FallBack01_Bump_Light.fragment
-in vec4 vColor;
in vec3 vLightDir;
in vec3 vUv;
in vec3 vLightPos;
diff --git a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.fragment
index 6f392459927..740c156781f 100644
--- a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.fragment
+++ b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.fragment
@@ -9,7 +9,6 @@
/// BLOOOM FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-in vec4 vColor;
in vec2 vUv0;
in vec2 vUv1;
diff --git a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.vertex b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.vertex
index 49ee4a111a3..95ef075ab60 100644
--- a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.vertex
+++ b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.vertex
@@ -14,7 +14,6 @@ vec3 color = gl_Color.xyz;
vec2 uv0 = gl_MultiTexCoord0.xy;
vec2 uv1 = gl_MultiTexCoord1.xy;
-out vec3 vColor;
out vec2 vUv0;
out vec2 vUv1;
@@ -23,7 +22,6 @@ uniform mat4 worldViewProj;
void main()
{
gl_Position = (worldViewProj * position);
- vColor = clamp(color, vec3(0.0), vec3(1.0));
vUv0 = uv0;
vUv1 = uv1;
diff --git a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur.vertex b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur.vertex
index 809add5a6a7..c014c25a58f 100644
--- a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur.vertex
+++ b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur.vertex
@@ -13,7 +13,6 @@ vec4 position = gl_Vertex;
vec3 color = gl_Color.xyz;
vec2 uv = gl_MultiTexCoord0.xy;
-out vec3 vColor;
out vec2 vUv0;
out vec2 vUv1;
out vec2 vUv2;
@@ -27,7 +26,6 @@ uniform float amount;
void main()
{
gl_Position = (worldViewProj * position);
- vColor = clamp(color, vec3(0.0), vec3(1.0));
vUv0 = uv + vec2(xOffset, yOffset) * amount;
vUv1 = uv + vec2(xOffset, yOffset) * 2.0 * amount;
vUv2 = uv - vec2(xOffset, yOffset) * amount;
diff --git a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_2D.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_2D.fragment
index 7224cbb925e..b16065e5d29 100644
--- a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_2D.fragment
+++ b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_2D.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-in vec4 vColor;
in vec2 vUv0;
in vec2 vUv1;
in vec2 vUv2;
diff --git a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_Rect.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_Rect.fragment
index a14bc97ffbc..6584e375756 100644
--- a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_Rect.fragment
+++ b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_Rect.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-in vec4 vColor;
in vec2 vUv0;
in vec2 vUv1;
in vec2 vUv2;
diff --git a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_2D.fragment b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_2D.fragment
index 712fe3feb37..fdc942dbef4 100644
--- a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_2D.fragment
+++ b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_2D.fragment
@@ -9,7 +9,6 @@
/// DIFFUSE LIGHTING FRAGMENT PROGRAM /////////////////
///////////////////////////////////////////////////////
-in vec4 vColor;
in vec2 vUv0;
in vec2 vUv1;
in vec2 vUv2;
diff --git a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex
index ece30406933..8a439d03cd5 100644
--- a/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex
+++ b/engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex
@@ -13,7 +13,6 @@ vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
vec3 color = gl_Color.xyz;
-out vec3 vColor;
out vec4 vVtxPos;
out vec4 vPrevVtxPos;
@@ -46,6 +45,4 @@ void main()
vVtxPos = pos;
vPrevVtxPos = prevPos;
-
- vColor = vec3(0.5);
}
\ No newline at end of file
Commit: 0f4923309c8ed94ec7412b284b31073be2fb0b98
https://github.com/scummvm/scummvm/commit/0f4923309c8ed94ec7412b284b31073be2fb0b98
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:03+01:00
Commit Message:
HPL1: Fix Remaining Unused Variable GCC Compiler Warnings
These were emitted when -Wunused-variable is passed to GCC.
Changed paths:
engines/hpl1/engine/physics/Collider2D.cpp
engines/hpl1/penumbra-overture/Player.cpp
diff --git a/engines/hpl1/engine/physics/Collider2D.cpp b/engines/hpl1/engine/physics/Collider2D.cpp
index c5d5c8f5de2..fd7bf00733b 100644
--- a/engines/hpl1/engine/physics/Collider2D.cpp
+++ b/engines/hpl1/engine/physics/Collider2D.cpp
@@ -72,7 +72,7 @@ tFlag cCollider2D::CollideBody(cBody2D *apBody, cCollideData2D *apData) {
cVector2f vLastPushVector;
/////// TEST COLLISION WITH TILES
- float fTileSize = mpWorld->GetTileMap()->GetTileSize();
+ //float fTileSize = mpWorld->GetTileMap()->GetTileSize();
//cRect2f TileRect = cRect2f(0, 0, fTileSize, fTileSize);
for (int i = 0; i < mpWorld->GetTileMap()->GetTileLayerNum(); i++) {
@@ -218,7 +218,7 @@ tFlag cCollider2D::CollideRect(cRect2f &aRect, tFlag alCollideFlags, cCollideDat
//// Check for all tiles if the flag is set
if (alCollideFlags & eFlagBit_0) {
- float fTileSize = mpWorld->GetTileMap()->GetTileSize();
+ //float fTileSize = mpWorld->GetTileMap()->GetTileSize();
//cRect2f TileRect = cRect2f(0, 0, fTileSize, fTileSize);
for (int i = 0; i < mpWorld->GetTileMap()->GetTileLayerNum(); i++) {
diff --git a/engines/hpl1/penumbra-overture/Player.cpp b/engines/hpl1/penumbra-overture/Player.cpp
index 358ea231492..83d655b3c8e 100644
--- a/engines/hpl1/penumbra-overture/Player.cpp
+++ b/engines/hpl1/penumbra-overture/Player.cpp
@@ -975,7 +975,7 @@ public:
cTempCheckProxy gTempCheckProxy;
void cPlayer::Update(float afTimeStep) {
- cSystem *pSystem = mpInit->mpGame->GetSystem();
+ //cSystem *pSystem = mpInit->mpGame->GetSystem();
//unsigned int lTime = pSystem->GetLowLevel()->getTime();
iPhysicsWorld *pPhysicsWorld = mpScene->GetWorld3D()->GetPhysicsWorld();
Commit: cbf5acb05762b139ea0f9b7dde40a31a8792ddeb
https://github.com/scummvm/scummvm/commit/cbf5acb05762b139ea0f9b7dde40a31a8792ddeb
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:03+01:00
Commit Message:
HPL1: Fix Unused Variable GCC Compiler Warning in Engine Sound Handler
Changed paths:
engines/hpl1/engine/sound/SoundHandler.cpp
diff --git a/engines/hpl1/engine/sound/SoundHandler.cpp b/engines/hpl1/engine/sound/SoundHandler.cpp
index c53d58aa14b..afe0e26b9e5 100644
--- a/engines/hpl1/engine/sound/SoundHandler.cpp
+++ b/engines/hpl1/engine/sound/SoundHandler.cpp
@@ -732,7 +732,7 @@ void cSoundHandler::UpdateDistanceVolume3D(cSoundEntry *apEntry, float afTimeSte
// Log(" max distance ");
} else {
float fVolume = 0;
- bool bBlocked = false;
+ //bool bBlocked = false;
////////////////////////////////////////
// Check if sound is blocked.
@@ -759,7 +759,7 @@ void cSoundHandler::UpdateDistanceVolume3D(cSoundEntry *apEntry, float afTimeSte
}
pSound->SetFiltering(true, 0xF);
- bBlocked = true;
+ //bBlocked = true;
} else {
// pSound->SetFiltering(false, 0xF);
Commit: 43c7f23891e782d4b0218cadfee168d486c44eb5
https://github.com/scummvm/scummvm/commit/43c7f23891e782d4b0218cadfee168d486c44eb5
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:03+01:00
Commit Message:
HPL1: Fix Unused Variable GCC Compiler Warning in Penumbra Player Interact
Changed paths:
engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
diff --git a/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp b/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
index 31d4074face..1ea707f1a8b 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
@@ -895,8 +895,8 @@ bool cPlayerState_Push::OnMoveForwards(float afMul, float afTimeStep) {
if (bCollide) {
cVector3f vPos = mpPlayer->GetCharacterBody()->GetPosition();
- cVector3f vOldPos = vPos;
- cVector3f vNewPos;
+ //cVector3f vOldPos = vPos;
+ //cVector3f vNewPos;
vPos += mvForward * -1 * (fPosAdd + 0.1f);
mpPlayer->GetCharacterBody()->SetPosition(vPos);
Commit: 029fcb96bf67fb4323721ce124b9c65c4d20f2dd
https://github.com/scummvm/scummvm/commit/029fcb96bf67fb4323721ce124b9c65c4d20f2dd
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:03+01:00
Commit Message:
HPL1: Fix GCC Set But Unused Variable Warnings in Newton Physics Code
Changed paths:
engines/hpl1/engine/libraries/newton/Newton.cpp
engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
index 70db196c510..738981bf84c 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.cpp
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -2889,12 +2889,10 @@ NewtonbreakableComponentMesh *NewtonBreakableGetMainMesh(
void NewtonBreakableBeginDelete(const NewtonCollision *const compoundBreakable) {
dgCollision *collision;
- NewtonbreakableComponentMesh *mesh;
TRACE_FUNTION(__FUNCTION__);
collision = (dgCollision *)compoundBreakable;
- mesh = NULL;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
dgCollisionCompoundBreakable *compound;
compound = (dgCollisionCompoundBreakable *)collision;
@@ -2907,12 +2905,10 @@ NewtonBody *NewtonBreakableCreateDebrieBody(
const NewtonbreakableComponentMesh *const component) {
dgBody *body;
dgCollision *collision;
- NewtonbreakableComponentMesh *mesh;
TRACE_FUNTION(__FUNCTION__);
collision = (dgCollision *)compoundBreakable;
- mesh = NULL;
body = NULL;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
dgCollisionCompoundBreakable *compound;
@@ -2928,12 +2924,10 @@ void NewtonBreakableDeleteComponent(
const NewtonCollision *const compoundBreakable,
const NewtonbreakableComponentMesh *const component) {
dgCollision *collision;
- NewtonbreakableComponentMesh *mesh;
TRACE_FUNTION(__FUNCTION__);
collision = (dgCollision *)compoundBreakable;
- mesh = NULL;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
dgCollisionCompoundBreakable *compound;
compound = (dgCollisionCompoundBreakable *)collision;
@@ -2944,12 +2938,10 @@ void NewtonBreakableDeleteComponent(
void NewtonBreakableEndDelete(const NewtonCollision *const compoundBreakable) {
dgCollision *collision;
- NewtonbreakableComponentMesh *mesh;
TRACE_FUNTION(__FUNCTION__);
collision = (dgCollision *)compoundBreakable;
- mesh = NULL;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
dgCollisionCompoundBreakable *compound;
compound = (dgCollisionCompoundBreakable *)collision;
diff --git a/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp b/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
index e861440596b..e8bdfcb8062 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
@@ -3166,6 +3166,7 @@ dgEdge* dgPolyhedra::TriangulateFace(dgEdge* face, const dgFloat64* const pool,
dgInt32 stride, dgDownHeap<dgEdge*, dgFloat64>& heap
, dgBigVector* const faceNormalOut)
{
+#if 0
dgEdge* perimeter[1024 * 16];
dgEdge* ptr = face;
dgInt32 perimeterCount = 0;
@@ -3178,6 +3179,7 @@ dgEdge* dgPolyhedra::TriangulateFace(dgEdge* face, const dgFloat64* const pool,
} while (ptr != face);
perimeter[perimeterCount] = face;
_ASSERTE((perimeterCount + 1) < dgInt32 (sizeof (perimeter) / sizeof (perimeter[0])));
+#endif
dgBigVector normal(
FaceNormal(face, pool, dgInt32(stride * sizeof(dgFloat64))));
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.cpp
index 774e51262bb..3589a23d6df 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.cpp
@@ -184,12 +184,10 @@ void dgCollisionChamferCylinder::DebugCollision(const dgMatrix &matrixPtr,
dgFloat32 sliceStep;
dgFloat32 sliceAngle;
dgFloat32 breakStep;
- dgFloat32 breakAngle;
slices = 12;
brakes = 24;
sliceAngle = dgFloat32(0.0f);
- breakAngle = dgFloat32(0.0f);
sliceStep = dgPI / slices;
breakStep = dgPI2 / brakes;
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
index d044ee46f0a..34d33e937de 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
@@ -467,12 +467,10 @@ dgCollisionCompoundBreakable::dgDebriGraph::~dgDebriGraph() {
void dgCollisionCompoundBreakable::dgDebriGraph::Serialize(dgSerialize callback,
void *const userData) const {
- dgInt32 lru;
dgInt32 index;
dgInt32 count;
dgTree<dgInt32, dgListNode *> enumerator(GetAllocator());
- lru = 0;
index = 1;
count = GetCount();
callback(userData, &count, dgInt32(sizeof(dgInt32)));
@@ -612,9 +610,9 @@ void dgCollisionCompoundBreakable::dgDebriGraph::AddMeshes(
dgFloat32 padding) {
// padding = 0.0f;
- dgGraph<dgDebriNodeInfo, dgSharedNodeMesh>::dgListNode *fixNode;
+ //dgGraph<dgDebriNodeInfo, dgSharedNodeMesh>::dgListNode *fixNode;
- fixNode = dgGraph<dgDebriNodeInfo, dgSharedNodeMesh>::AddNode();
+ /*fixNode =*/ dgGraph<dgDebriNodeInfo, dgSharedNodeMesh>::AddNode();
for (dgInt32 i = 0; i < count; i++) {
AddNode(vertexArray, (dgMeshEffect *)solidArray[i], internalFaceMaterial[i],
idArray[i], densities[i], padding);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
index eae47302979..f08760183b5 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
@@ -4018,7 +4018,6 @@ class dgContactSolver {
dgFloat32 dist;
dgFloat32 minValue;
- dgFloat32 penetration;
dgFloat32 ciclingMem[4];
dgMinkFace *face;
dgMinkFace *adjacent;
@@ -4039,7 +4038,6 @@ class dgContactSolver {
m_planeIndex = 4;
closestFace = NULL;
m_facePurge = NULL;
- penetration = dgFloat32(0.0f);
_ASSERTE(m_vertexIndex == 4);
for (i = 0; i < 4; i++) {
@@ -4330,7 +4328,6 @@ class dgContactSolver {
dgFloat64 dist;
dgFloat64 minValue;
- dgFloat64 penetration;
dgFloat64 ciclingMem[4];
dgMinkFace *face;
dgMinkFace *adjacent;
@@ -4351,7 +4348,6 @@ class dgContactSolver {
m_planeIndex = 4;
closestFace = NULL;
m_facePurge = NULL;
- penetration = dgFloat64(0.0f);
_ASSERTE(m_vertexIndex == 4);
for (i = 0; i < 4; i++) {
@@ -7012,21 +7008,15 @@ dgInt32 dgWorld::CalculatePolySoupToSphereContactsDescrete(
dgInt32 indexCount;
dgInt32 reduceContactCountLimit;
dgFloat32 radius;
- dgBody *soupBody;
- dgBody *spheBody;
dgCollisionSphere *sphere;
dgCollisionMesh *polysoup;
dgCollisionMesh::dgCollisionConvexPolygon *polygon;
dgVector point;
count = 0;
- _ASSERTE(
- proxy.m_referenceCollision->IsType(dgCollision::dgCollisionSphere_RTTI));
- _ASSERTE(
- proxy.m_floatingCollision->IsType(dgCollision::dgCollisionMesh_RTTI));
+ _ASSERTE(proxy.m_referenceCollision->IsType(dgCollision::dgCollisionSphere_RTTI));
+ _ASSERTE(proxy.m_floatingCollision->IsType(dgCollision::dgCollisionMesh_RTTI));
- spheBody = proxy.m_referenceBody;
- soupBody = proxy.m_floatingBody;
sphere = (dgCollisionSphere *)proxy.m_referenceCollision;
polysoup = (dgCollisionMesh *)proxy.m_floatingCollision;
@@ -7129,21 +7119,15 @@ dgInt32 dgWorld::CalculatePolySoupToElipseContactsDescrete(
dgInt32 indexCount;
dgInt32 reduceContactCountLimit;
dgFloat32 radius;
- dgBody *soupBody;
- dgBody *spheBody;
dgCollisionEllipse *sphere;
dgCollisionMesh *polysoup;
dgCollisionMesh::dgCollisionConvexPolygon *polygon;
dgVector point;
count = 0;
- _ASSERTE(
- proxy.m_referenceCollision->IsType(dgCollision::dgCollisionEllipse_RTTI));
- _ASSERTE(
- proxy.m_floatingCollision->IsType(dgCollision::dgCollisionMesh_RTTI));
+ _ASSERTE(proxy.m_referenceCollision->IsType(dgCollision::dgCollisionEllipse_RTTI));
+ _ASSERTE(proxy.m_floatingCollision->IsType(dgCollision::dgCollisionMesh_RTTI));
- spheBody = proxy.m_referenceBody;
- soupBody = proxy.m_floatingBody;
sphere = (dgCollisionEllipse *)proxy.m_referenceCollision;
polysoup = (dgCollisionMesh *)proxy.m_floatingCollision;
@@ -7259,8 +7243,6 @@ dgInt32 dgWorld::CalculatePolySoupToSphereContactsContinue (dgCollisionParamProx
dgFloat32 radius;
dgInt32* indexArray;
dgInt32* idArray;
- dgBody* soupBody;
- dgBody* spheBody;
dgCollisionSphere *sphere;
dgContactPoint* contactOut;
dgCollisionMesh *polysoup;
@@ -7268,13 +7250,9 @@ dgInt32 dgWorld::CalculatePolySoupToSphereContactsContinue (dgCollisionParamProx
count = 0;
- _ASSERTE(
- proxy.m_referenceCollision->IsType (dgCollision::dgCollisionSphere_RTTI));
- _ASSERTE(
- proxy.m_floatingCollision->IsType (dgCollision::dgCollisionMesh_RTTI));
+ _ASSERTE(proxy.m_referenceCollision->IsType (dgCollision::dgCollisionSphere_RTTI));
+ _ASSERTE(proxy.m_floatingCollision->IsType (dgCollision::dgCollisionMesh_RTTI));
- spheBody = proxy.m_referenceBody;
- soupBody = proxy.m_floatingBody;
sphere = (dgCollisionSphere*) proxy.m_referenceCollision;
polysoup = (dgCollisionMesh *) proxy.m_floatingCollision;
Commit: 304a2df1659b6b3bae46852147caa8188bebd23b
https://github.com/scummvm/scummvm/commit/304a2df1659b6b3bae46852147caa8188bebd23b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:03+01:00
Commit Message:
HPL1: add basic tinygl impl classes
Changed paths:
A engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
A engines/hpl1/engine/impl/low_level_graphics_tgl.h
A engines/hpl1/engine/impl/texture_tgl.cpp
A engines/hpl1/engine/impl/texture_tgl.h
A engines/hpl1/engine/impl/vertex_buffer_tgl.cpp
A engines/hpl1/engine/impl/vertex_buffer_tgl.h
engines/hpl1/engine/graphics/Renderer3D.cpp
engines/hpl1/module.mk
graphics/tinygl/init.cpp
diff --git a/engines/hpl1/engine/graphics/Renderer3D.cpp b/engines/hpl1/engine/graphics/Renderer3D.cpp
index ec26968c967..ff608ed043a 100644
--- a/engines/hpl1/engine/graphics/Renderer3D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer3D.cpp
@@ -142,10 +142,12 @@ cRenderer3D::cRenderer3D(iLowLevelGraphics *apLowLevelGraphics, cResources *apRe
pFogArray[i * 2 + 1] = 255 - (unsigned char)i;
}
- pTex->CreateFromArray(pFogArray, 2, cVector3l(256, 1, 1));
- pTex->SetWrapR(eTextureWrap_ClampToEdge);
- pTex->SetWrapS(eTextureWrap_ClampToEdge);
- pTex->SetWrapT(eTextureWrap_ClampToEdge);
+ if (pTex) {
+ pTex->CreateFromArray(pFogArray, 2, cVector3l(256, 1, 1));
+ pTex->SetWrapR(eTextureWrap_ClampToEdge);
+ pTex->SetWrapS(eTextureWrap_ClampToEdge);
+ pTex->SetWrapT(eTextureWrap_ClampToEdge);
+ }
mpFogLinearSolidTexture = pTex;
@@ -158,9 +160,11 @@ cRenderer3D::cRenderer3D(iLowLevelGraphics *apLowLevelGraphics, cResources *apRe
pFogArray[i * 2 + 1] = (unsigned char)i;
}
- pTex->CreateFromArray(pFogArray, 2, cVector3l(256, 1, 1));
- pTex->SetWrapR(eTextureWrap_ClampToEdge);
- pTex->SetWrapS(eTextureWrap_ClampToEdge);
+ if (pTex) {
+ pTex->CreateFromArray(pFogArray, 2, cVector3l(256, 1, 1));
+ pTex->SetWrapR(eTextureWrap_ClampToEdge);
+ pTex->SetWrapS(eTextureWrap_ClampToEdge);
+ }
mpFogLinearAddTexture = pTex;
@@ -173,9 +177,11 @@ cRenderer3D::cRenderer3D(iLowLevelGraphics *apLowLevelGraphics, cResources *apRe
pFogArray[i * 2 + 1] = (unsigned char)i;
}
- pTex->CreateFromArray(pFogArray, 2, cVector3l(256, 1, 1));
- pTex->SetWrapR(eTextureWrap_ClampToEdge);
- pTex->SetWrapS(eTextureWrap_ClampToEdge);
+ if (pTex) {
+ pTex->CreateFromArray(pFogArray, 2, cVector3l(256, 1, 1));
+ pTex->SetWrapR(eTextureWrap_ClampToEdge);
+ pTex->SetWrapS(eTextureWrap_ClampToEdge);
+ }
mpFogLinearAlphaTexture = pTex;
diff --git a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
new file mode 100644
index 00000000000..9d517fd907a
--- /dev/null
+++ b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
@@ -0,0 +1,1519 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <assert.h>
+
+#include "hpl1/engine/graphics/font_data.h"
+#include "hpl1/engine/impl/low_level_graphics_tgl.h"
+
+#include "hpl1/engine/graphics/bitmap2D.h"
+#include "hpl1/engine/graphics/font_data.h"
+#include "hpl1/engine/impl/vertex_buffer_tgl.h"
+#include "hpl1/engine/system/low_level_system.h"
+#include "hpl1/engine/impl/texture_tgl.h"
+
+#include "common/algorithm.h"
+#include "common/system.h"
+#include "engines/util.h"
+#include "hpl1/debug.h"
+#include "hpl1/engine/impl/OcclusionQueryOGL.h"
+#include "graphics/tinygl/tinygl.h"
+#include "hpl1/graphics.h"
+
+namespace hpl {
+
+TGLenum ColorFormatToTGL(eColorDataFormat format) {
+ switch (format) {
+ case eColorDataFormat_RGB:
+ return TGL_RGB;
+ case eColorDataFormat_RGBA:
+ return TGL_RGBA;
+ case eColorDataFormat_ALPHA:
+ return TGL_ALPHA;
+ case eColorDataFormat_BGR:
+ return TGL_BGR;
+ case eColorDataFormat_BGRA:
+ return TGL_BGRA;
+ default:
+ break;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid color format (%d)\n", format);
+ return 0;
+}
+
+TGLenum TextureTargetToTGL(eTextureTarget target) {
+ switch (target) {
+ case eTextureTarget_1D:
+ case eTextureTarget_2D:
+ return TGL_TEXTURE_2D;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture target (%d)\n", target);
+ return 0;
+}
+
+TGLenum GetGLBlendEnum(eBlendFunc type) {
+ switch (type) {
+ case eBlendFunc_Zero:
+ return TGL_ZERO;
+ case eBlendFunc_One:
+ return TGL_ONE;
+ case eBlendFunc_SrcColor:
+ return TGL_SRC_COLOR;
+ case eBlendFunc_OneMinusSrcColor:
+ return TGL_ONE_MINUS_SRC_COLOR;
+ case eBlendFunc_DestColor:
+ return TGL_DST_COLOR;
+ case eBlendFunc_OneMinusDestColor:
+ return TGL_ONE_MINUS_DST_COLOR;
+ case eBlendFunc_SrcAlpha:
+ return TGL_SRC_ALPHA;
+ case eBlendFunc_OneMinusSrcAlpha:
+ return TGL_ONE_MINUS_SRC_ALPHA;
+ case eBlendFunc_DestAlpha:
+ return TGL_DST_ALPHA;
+ case eBlendFunc_OneMinusDestAlpha:
+ return TGL_ONE_MINUS_DST_ALPHA;
+ case eBlendFunc_SrcAlphaSaturate:
+ return TGL_SRC_ALPHA_SATURATE;
+ default:
+ break;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid blend op (%d)", type);
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+TGLenum GetGLTextureParamEnum(eTextureParam type) {
+ switch (type) {
+ case eTextureParam_AlphaScale:
+ return TGL_ALPHA_SCALE;
+ default:
+ break;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture parameter (%d)", type);
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+TGLenum GetGLTextureOpEnum(eTextureOp type) {
+ switch (type) {
+ case eTextureOp_Color:
+ return TGL_SRC_COLOR;
+ case eTextureOp_OneMinusColor:
+ return TGL_ONE_MINUS_SRC_COLOR;
+ case eTextureOp_Alpha:
+ return TGL_SRC_ALPHA;
+ case eTextureOp_OneMinusAlpha:
+ return TGL_ONE_MINUS_SRC_ALPHA;
+ default:
+ break;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture op (%d)", type);
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+TGLenum GetGLTextureSourceEnum(eTextureSource type) {
+ switch (type) {
+ case eTextureSource_Texture:
+ return TGL_TEXTURE;
+ default:
+ break;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture source (%d)", type);
+ return 0;
+}
+//-----------------------------------------------------------------------
+
+TGLenum GetTGLTextureTargetEnum(eTextureTarget type) {
+ return TGL_TEXTURE_2D;
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture target (%d)", type);
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+TGLenum GetGLTextureFuncEnum(eTextureFunc type) {
+ switch (type) {
+ case eTextureFunc_Modulate:
+ return TGL_MODULATE;
+ case eTextureFunc_Replace:
+ return TGL_REPLACE;
+ case eTextureFunc_Add:
+ return TGL_ADD;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture function (%d)", type);
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+TGLenum GetGLDepthTestFuncEnum(eDepthTestFunc type) {
+ switch (type) {
+ case eDepthTestFunc_Never:
+ return TGL_NEVER;
+ case eDepthTestFunc_Less:
+ return TGL_LESS;
+ case eDepthTestFunc_LessOrEqual:
+ return TGL_LEQUAL;
+ case eDepthTestFunc_Greater:
+ return TGL_GREATER;
+ case eDepthTestFunc_GreaterOrEqual:
+ return TGL_GEQUAL;
+ case eDepthTestFunc_Equal:
+ return TGL_EQUAL;
+ case eDepthTestFunc_NotEqual:
+ return TGL_NOTEQUAL;
+ case eDepthTestFunc_Always:
+ return TGL_ALWAYS;
+ default:
+ break;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid depth test function (%d)", type);
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+TGLenum GetGLAlphaTestFuncEnum(eAlphaTestFunc type) {
+ switch (type) {
+ case eAlphaTestFunc_Never:
+ return TGL_NEVER;
+ case eAlphaTestFunc_Less:
+ return TGL_LESS;
+ case eAlphaTestFunc_LessOrEqual:
+ return TGL_LEQUAL;
+ case eAlphaTestFunc_Greater:
+ return TGL_GREATER;
+ case eAlphaTestFunc_GreaterOrEqual:
+ return TGL_GEQUAL;
+ case eAlphaTestFunc_Equal:
+ return TGL_EQUAL;
+ case eAlphaTestFunc_NotEqual:
+ return TGL_NOTEQUAL;
+ case eAlphaTestFunc_Always:
+ return TGL_ALWAYS;
+ default:
+ break;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid alpha test function (%d)", type);
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+TGLenum GetGLStencilFuncEnum(eStencilFunc type) {
+ switch (type) {
+ case eStencilFunc_Never:
+ return TGL_NEVER;
+ case eStencilFunc_Less:
+ return TGL_LESS;
+ case eStencilFunc_LessOrEqual:
+ return TGL_LEQUAL;
+ case eStencilFunc_Greater:
+ return TGL_GREATER;
+ case eStencilFunc_GreaterOrEqual:
+ return TGL_GEQUAL;
+ case eStencilFunc_Equal:
+ return TGL_EQUAL;
+ case eStencilFunc_NotEqual:
+ return TGL_NOTEQUAL;
+ case eStencilFunc_Always:
+ return TGL_ALWAYS;
+ default:
+ break;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid stencil function (%d)", type);
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+TGLenum GetGLStencilOpEnum(eStencilOp type) {
+ switch (type) {
+ case eStencilOp_Keep:
+ return TGL_KEEP;
+ case eStencilOp_Zero:
+ return TGL_ZERO;
+ case eStencilOp_Replace:
+ return TGL_REPLACE;
+ case eStencilOp_Increment:
+ return TGL_INCR;
+ case eStencilOp_Decrement:
+ return TGL_DECR;
+ case eStencilOp_Invert:
+ return TGL_INVERT;
+ case eStencilOp_IncrementWrap:
+ return TGL_INCR_WRAP;
+ case eStencilOp_DecrementWrap:
+ return TGL_DECR_WRAP;
+ default:
+ break;
+ }
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid stencil op (%d)", type);
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetMatrixMode(eMatrix type) {
+ switch (type) {
+ case eMatrix_ModelView:
+ tglMatrixMode(TGL_MODELVIEW);
+ break;
+ case eMatrix_Projection:
+ tglMatrixMode(TGL_PROJECTION);
+ break;
+ case eMatrix_Texture:
+ tglMatrixMode(TGL_TEXTURE);
+ break;
+ default:
+ Hpl1::logError(Hpl1::kDebugOpenGL, "invalid matrix mode (%d)", type);
+ }
+}
+
+LowLevelGraphicsTGL::LowLevelGraphicsTGL() {
+ mlBatchArraySize = 20000;
+ mlVertexCount = 0;
+ mlIndexCount = 0;
+ mlMultisampling = 0;
+ mvVirtualSize.x = 800;
+ mvVirtualSize.y = 600;
+ mfGammaCorrection = 1.0;
+ mpRenderTarget = nullptr;
+#ifdef SCUMM_BIG_ENDIAN
+ mpPixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+#else
+ mpPixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
+#endif
+
+ Common::fill(mpCurrentTexture, mpCurrentTexture + MAX_TEXTUREUNITS, nullptr);
+
+ mbClearColor = true;
+ mbClearDepth = true;
+ mbClearStencil = false;
+
+ // Create the batch arrays:
+ mlBatchStride = 13;
+ // 3 Pos floats, 4 color floats, 3 Tex coord floats .
+ mpVertexArray = (float *)hplMalloc(sizeof(float) * mlBatchStride * mlBatchArraySize);
+ mpIndexArray = (unsigned int *)hplMalloc(sizeof(unsigned int) * mlBatchArraySize); // Index is one int.
+
+ for (int i = 0; i < MAX_TEXTUREUNITS; i++) {
+ mpTexCoordArray[i] = (float *)hplMalloc(sizeof(float) * 3 * mlBatchArraySize);
+ mbTexCoordArrayActive[i] = false;
+ mlTexCoordArrayCount[i] = 0;
+ }
+}
+
+LowLevelGraphicsTGL::~LowLevelGraphicsTGL() {
+ // SDL_SetGammaRamp(mvStartGammaArray[0],mvStartGammaArray[1],mvStartGammaArray[2]);
+
+ hplFree(mpVertexArray);
+ hplFree(mpIndexArray);
+ for (int i = 0; i < MAX_TEXTUREUNITS; i++)
+ hplFree(mpTexCoordArray[i]);
+}
+
+bool LowLevelGraphicsTGL::Init(int alWidth, int alHeight, int alBpp, int abFullscreen,
+ int alMultisampling, const tString &asWindowCaption) {
+ mvScreenSize.x = alWidth;
+ mvScreenSize.y = alHeight;
+ mlBpp = alBpp;
+
+ mlMultisampling = alMultisampling;
+ initGraphics(alWidth, alHeight);
+ TinyGL::createContext(alWidth, alHeight, mpPixelFormat, 256, false);
+ SetupGL();
+ ShowCursor(false);
+ g_system->updateScreen();
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::CheckMultisampleCaps() {
+}
+
+//-----------------------------------------------------------------------
+
+static void logOGLInfo(const LowLevelGraphicsTGL &graphics) {
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Max texture image units: %d\n",
+ graphics.GetCaps(eGraphicCaps_MaxTextureImageUnits));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Max texture coord units: %d\n",
+ graphics.GetCaps(eGraphicCaps_MaxTextureCoordUnits));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Two sided stencil: %d\n",
+ graphics.GetCaps(eGraphicCaps_TwoSideStencil));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Vertex Buffer Object: %d\n",
+ graphics.GetCaps(eGraphicCaps_VertexBufferObject));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Anisotropic filtering: %d\n",
+ graphics.GetCaps(eGraphicCaps_AnisotropicFiltering));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Max Anisotropic degree: %d\n",
+ graphics.GetCaps(eGraphicCaps_MaxAnisotropicFiltering));
+ Hpl1::logInfo(Hpl1::kDebugOpenGL, "Multisampling: %d\n",
+ graphics.GetCaps(eGraphicCaps_Multisampling));
+}
+
+void LowLevelGraphicsTGL::SetupGL() {
+ // Inits GL stuff
+ // Set Shade model and clear color.
+ tglShadeModel(TGL_SMOOTH);
+ tglClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ tglViewport(0, 0, 800, 600);
+
+ // Depth Test setup
+ tglClearDepth(1.0f); // VAlues buffer is cleared with
+ tglEnable(TGL_DEPTH_TEST); // enable depth testing
+ tglDepthFunc(TGL_LEQUAL); // function to do depth test with
+ tglDisable(TGL_ALPHA_TEST);
+
+ // Set best perspective correction
+ tglHint(TGL_PERSPECTIVE_CORRECTION_HINT, TGL_NICEST);
+
+ // Stencil setup
+ tglClearStencil(0);
+
+ // Clear the screen
+ tglClear(TGL_COLOR_BUFFER_BIT | TGL_DEPTH_BUFFER_BIT /*| TGL_STENCIL_BUFFER_BIT*/);
+
+ tglMatrixMode(TGL_MODELVIEW);
+ tglLoadIdentity();
+ tglMatrixMode(TGL_PROJECTION);
+ tglLoadIdentity();
+
+ ///// BEGIN BATCH ARRAY STUFF ///////////////
+
+ // Enable all the vertex arrays that are used:
+ tglEnableClientState(TGL_VERTEX_ARRAY); // The positions
+ tglEnableClientState(TGL_COLOR_ARRAY); // The color
+ tglEnableClientState(TGL_TEXTURE_COORD_ARRAY); // Tex coords
+ tglDisableClientState(TGL_NORMAL_ARRAY);
+ // Disable the once not used.
+ //tglDisableClientState(TGL_INDEX_ARRAY); // color index
+ //tglDisableClientState(TGL_EDGE_FLAG_ARRAY);
+
+ ///// END BATCH ARRAY STUFF ///////////////
+
+ logOGLInfo(*this);
+}
+//-----------------------------------------------------------------------
+
+int LowLevelGraphicsTGL::GetCaps(eGraphicCaps type) const {
+ switch (type) {
+
+ // Texture Rectangle
+ case eGraphicCaps_TextureTargetRectangle:
+ return 1;
+
+ // Vertex Buffer Object
+ case eGraphicCaps_VertexBufferObject:
+ return 1; // gl 2.0
+
+ // Two Sided Stencil
+ case eGraphicCaps_TwoSideStencil:
+ return 1; // gl 2.0
+
+ // Max Texture Image Units
+ case eGraphicCaps_MaxTextureImageUnits:
+ return 0;
+ // Max Texture Coord Units
+ case eGraphicCaps_MaxTextureCoordUnits:
+ return 0;
+ // Texture Anisotropy
+ case eGraphicCaps_AnisotropicFiltering:
+ return 0; // gl 4.6
+
+ // Texture Anisotropy
+ case eGraphicCaps_MaxAnisotropicFiltering:
+ return 0; // gl 4.6
+
+ // Multisampling
+ case eGraphicCaps_Multisampling:
+ return 1; // gl 1.3
+
+ // GL shaders
+ case eGraphicCaps_GL_GpuPrograms:
+ return 0; // gl 2.0
+
+ case eGraphicCaps_GL_BlendFunctionSeparate:
+ return 1; // gl 1.4
+
+ case eGraphicCaps_GL_MultiTexture:
+ return 0; // gl 1.4
+
+ default:
+ break;
+ }
+ Hpl1::logWarning(Hpl1::kDebugGraphics, "graphic options %d is not supported\n", type);
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::ShowCursor(bool toggle) {
+ g_system->showMouse(toggle);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetVsyncActive(bool toggle) {
+ if (g_system->hasFeature(OSystem::kFeatureVSync))
+ g_system->setFeatureState(OSystem::kFeatureVSync, toggle);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetMultisamplingActive(bool toggle) {
+ return;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetGammaCorrection(float afX) {
+ mfGammaCorrection = afX;
+}
+
+float LowLevelGraphicsTGL::GetGammaCorrection() {
+ return mfGammaCorrection;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetClipPlane(int alIdx, const cPlanef &aPlane) {
+ HPL1_UNIMPLEMENTED(LowLevelGraphicsTGL::SetClipPlane);
+}
+
+cPlanef LowLevelGraphicsTGL::GetClipPlane(int alIdx, const cPlanef &aPlane) {
+ return mvClipPlanes[alIdx];
+}
+
+void LowLevelGraphicsTGL::SetClipPlaneActive(int alIdx, bool toggle) {
+ if (toggle)
+ tglEnable(TGL_CLIP_PLANE0 + alIdx);
+ else
+ tglDisable(TGL_CLIP_PLANE0 + alIdx);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SaveScreenToBMP(const tString &asFile) {
+ g_system->saveScreenshot();
+}
+
+//-----------------------------------------------------------------------
+
+Bitmap2D *LowLevelGraphicsTGL::CreateBitmap2D(const cVector2l &size) {
+ return hplNew(Bitmap2D, (size, mpPixelFormat));
+}
+
+//-----------------------------------------------------------------------
+
+FontData *LowLevelGraphicsTGL::CreateFontData(const tString &asName) {
+ return hplNew(FontData, (asName, this));
+}
+
+//-----------------------------------------------------------------------
+
+iGpuProgram *LowLevelGraphicsTGL::CreateGpuProgram(const tString &vertex, const tString &fragment) {
+ HPL1_UNIMPLEMENTED(LowLevelGraphicsTGL::CreateGpuProgram);
+}
+
+//-----------------------------------------------------------------------
+
+Graphics::PixelFormat *LowLevelGraphicsTGL::GetPixelFormat() {
+ return &mpPixelFormat;
+}
+
+//-----------------------------------------------------------------------
+
+iTexture *LowLevelGraphicsTGL::CreateTexture(bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) {
+ if (aTarget != eTextureTarget_2D)
+ return nullptr;
+ return hplNew(TGLTexture, ("", &mpPixelFormat, this, aType, abUseMipMaps, aTarget));
+}
+
+//-----------------------------------------------------------------------
+
+iTexture *LowLevelGraphicsTGL::CreateTexture(const tString &asName, bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) {
+ if (aTarget != eTextureTarget_2D)
+ return nullptr;
+ return hplNew(TGLTexture, (asName, &mpPixelFormat, this, aType, abUseMipMaps, aTarget));
+}
+
+//-----------------------------------------------------------------------
+
+iTexture *LowLevelGraphicsTGL::CreateTexture(Bitmap2D *apBmp, bool abUseMipMaps, eTextureType aType,
+ eTextureTarget aTarget) {
+ if (aTarget != eTextureTarget_2D)
+ return nullptr;
+ TGLTexture *pTex = hplNew(TGLTexture, ("", &mpPixelFormat, this, aType, abUseMipMaps, aTarget));
+ pTex->CreateFromBitmap(apBmp);
+ return pTex;
+}
+
+//-----------------------------------------------------------------------
+
+iTexture *LowLevelGraphicsTGL::CreateTexture(const cVector2l &avSize, int alBpp, cColor aFillCol,
+ bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) {
+ if (aTarget != eTextureTarget_2D)
+ return nullptr;
+
+ TGLTexture *pTex = NULL;
+
+ if (aType == eTextureType_RenderTarget) {
+ pTex = hplNew(TGLTexture, ("", &mpPixelFormat, this, aType, abUseMipMaps, aTarget));
+ pTex->Create(avSize.x, avSize.y, aFillCol);
+ } else {
+ Bitmap2D *pBmp = CreateBitmap2D(avSize);
+ pBmp->fillRect(cRect2l(0, 0, 0, 0), aFillCol);
+
+ pTex = hplNew(TGLTexture, ("", &mpPixelFormat, this, aType, abUseMipMaps, aTarget));
+ bool bRet = pTex->CreateFromBitmap(pBmp);
+
+ hplDelete(pBmp);
+
+ if (bRet == false) {
+ hplDelete(pTex);
+ return NULL;
+ }
+ }
+ return pTex;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::PushMatrix(eMatrix aMtxType) {
+ SetMatrixMode(aMtxType);
+ tglPushMatrix();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::PopMatrix(eMatrix aMtxType) {
+ SetMatrixMode(aMtxType);
+ tglPopMatrix();
+}
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetMatrix(eMatrix aMtxType, const cMatrixf &a_mtxA) {
+ SetMatrixMode(aMtxType);
+ cMatrixf mtxTranpose = a_mtxA.GetTranspose();
+ tglLoadMatrixf(mtxTranpose.v);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetIdentityMatrix(eMatrix aMtxType) {
+ SetMatrixMode(aMtxType);
+ tglLoadIdentity();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::TranslateMatrix(eMatrix aMtxType, const cVector3f &avPos) {
+ SetMatrixMode(aMtxType);
+ tglTranslatef(avPos.x, avPos.y, avPos.z);
+}
+
+//-----------------------------------------------------------------------
+
+/**
+ * \todo fix so that there are X, Y , Z versions of this one.
+ * \param aMtxType
+ * \param &avRot
+ */
+void LowLevelGraphicsTGL::RotateMatrix(eMatrix aMtxType, const cVector3f &avRot) {
+ SetMatrixMode(aMtxType);
+ tglRotatef(1, avRot.x, avRot.y, avRot.z);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::ScaleMatrix(eMatrix aMtxType, const cVector3f &avScale) {
+ SetMatrixMode(aMtxType);
+ tglScalef(avScale.x, avScale.y, avScale.z);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetOrthoProjection(const cVector2f &avSize, float afMin, float afMax) {
+ tglMatrixMode(TGL_PROJECTION);
+ tglLoadIdentity();
+ tglOrtho(0, avSize.x, avSize.y, 0, afMin, afMax);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetTexture(unsigned int alUnit, iTexture *apTex) {
+ if (apTex == mpCurrentTexture[alUnit])
+ return;
+
+ TGLenum NewTarget = 0;
+ if (apTex)
+ NewTarget = GetTGLTextureTargetEnum(apTex->GetTarget());
+ TGLenum LastTarget = 0;
+ if (mpCurrentTexture[alUnit])
+ LastTarget = GetTGLTextureTargetEnum(mpCurrentTexture[alUnit]->GetTarget());
+
+ // If the current texture in this unit is a render target, unbind it.
+ if (mpCurrentTexture[alUnit] && mpCurrentTexture[alUnit]->GetTextureType() == eTextureType_RenderTarget)
+ error("render target not supported");
+
+ // Disable this unit if NULL
+ if (apTex == NULL) {
+ tglDisable(LastTarget);
+ // tglBindTexture(LastTarget,0);
+ // Enable the unit, set the texture handle and bind the pbuffer
+ } else {
+ if (NewTarget != LastTarget && LastTarget != 0)
+ tglDisable(LastTarget);
+
+ TGLTexture *pSDLTex = static_cast<TGLTexture *>(apTex);
+
+ tglBindTexture(NewTarget, pSDLTex->GetTextureHandle());
+ tglEnable(NewTarget);
+
+ // if it is a render target we need to do some more binding.
+ if (pSDLTex->GetTextureType() == eTextureType_RenderTarget) {
+ error("render target not supported");
+ }
+ }
+
+ mpCurrentTexture[alUnit] = apTex;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetActiveTextureUnit(unsigned int alUnit) {
+ //tglActiveTexture(GL_TEXTURE0 + alUnit);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetTextureEnv(eTextureParam aParam, int alVal) {
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetTextureConstantColor(const cColor &color) {
+ float vColor[] = {color.r, color.g, color.b, color.a};
+
+ //tglTexEnvfv(TGL_TEXTURE_ENV, TGL_TEXTURE_ENV_COLOR, &vColor[0]);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetColor(const cColor &aColor) {
+ tglColor4f(aColor.r, aColor.g, aColor.b, aColor.a);
+}
+
+//-----------------------------------------------------------------------
+
+iVertexBuffer *LowLevelGraphicsTGL::CreateVertexBuffer(tVertexFlag aFlags,
+ eVertexBufferDrawType aDrawType, eVertexBufferUsageType aUsageType, int alReserveVtxSize, int alReserveIdxSize) {
+
+ return hplNew(VertexBufferTGL, (this, aFlags, aDrawType, aUsageType, alReserveVtxSize, alReserveIdxSize));
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawRect(const cVector2f &avPos, const cVector2f &avSize, float afZ) {
+ tglColor4f(1, 1, 1, 1);
+ tglBegin(TGL_QUADS);
+ {
+ tglTexCoord2f(0.0, 0.0);
+ tglVertex3f(avPos.x, avPos.y, afZ);
+ tglTexCoord2f(1.0, 0.0);
+ tglVertex3f(avPos.x + avSize.x, avPos.y, afZ);
+ tglTexCoord2f(1.0, 1.0);
+ tglVertex3f(avPos.x + avSize.x, avPos.y + avSize.y, afZ);
+ tglTexCoord2f(0.0, 1.0);
+ tglVertex3f(avPos.x, avPos.y + avSize.y, afZ);
+ }
+ tglEnd();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::FlushRendering() {
+ tglFlush();
+}
+void LowLevelGraphicsTGL::SwapBuffers() {
+ tglFlush();
+ TinyGL::presentBuffer();
+ Graphics::Surface glBuffer;
+ TinyGL::getSurfaceRef(glBuffer);
+ glBuffer.debugPrint();
+ g_system->copyRectToScreen(glBuffer.getPixels(), glBuffer.pitch,
+ 0, 0, mvScreenSize.x, mvScreenSize.y);
+ g_system->updateScreen();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawTri(const tVertexVec &avVtx) {
+ assert(avVtx.size() == 3);
+
+ tglBegin(TGL_TRIANGLES);
+ {
+ for (int i = 0; i < 3; i++) {
+ tglTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, avVtx[i].tex.z);
+ tglColor4f(avVtx[i].col.r, avVtx[i].col.g, avVtx[i].col.b, avVtx[i].col.a);
+ tglVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
+ }
+ }
+ tglEnd();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawTri(const cVertex *avVtx) {
+ tglBegin(TGL_TRIANGLES);
+ {
+ for (int i = 0; i < 3; i++) {
+ tglTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, avVtx[i].tex.z);
+ tglColor4f(avVtx[i].col.r, avVtx[i].col.g, avVtx[i].col.b, avVtx[i].col.a);
+ tglVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
+ }
+ }
+ tglEnd();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawQuad(const tVertexVec &avVtx) {
+ assert(avVtx.size() == 4);
+
+ tglBegin(TGL_QUADS);
+ {
+ for (int i = 0; i < 4; i++) {
+ tglTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, avVtx[i].tex.z);
+ tglColor4f(avVtx[i].col.r, avVtx[i].col.g, avVtx[i].col.b, avVtx[i].col.a);
+ tglVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
+ }
+ }
+ tglEnd();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawQuadMultiTex(const tVertexVec &avVtx, const tVector3fVec &avExtraUvs) {
+ return;
+}
+
+//-----------------------------------------------------------------------
+
+iOcclusionQuery *LowLevelGraphicsTGL::CreateOcclusionQuery() {
+ //return hplNew(cOcclusionQueryOGL, ());
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DestroyOcclusionQuery(iOcclusionQuery *apQuery) {
+ if (apQuery)
+ hplDelete(apQuery);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::ClearScreen() {
+ TGLbitfield bitmask = 0;
+
+ if (mbClearColor)
+ bitmask |= TGL_COLOR_BUFFER_BIT;
+ if (mbClearDepth)
+ bitmask |= TGL_DEPTH_BUFFER_BIT;
+ //if (mbClearStencil)
+ // bitmask |= TGL_STENCIL_BUFFER_BIT;
+
+ tglClear(bitmask);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetClearColor(const cColor &aCol) {
+ tglClearColor(aCol.r, aCol.g, aCol.b, aCol.a);
+}
+void LowLevelGraphicsTGL::SetClearDepth(float afDepth) {
+ tglClearDepth(afDepth);
+}
+void LowLevelGraphicsTGL::SetClearStencil(int alVal) {
+ tglClearStencil(alVal);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetClearColorActive(bool abX) {
+ mbClearColor = abX;
+}
+void LowLevelGraphicsTGL::SetClearDepthActive(bool abX) {
+ mbClearDepth = abX;
+}
+void LowLevelGraphicsTGL::SetClearStencilActive(bool abX) {
+ mbClearStencil = abX;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetColorWriteActive(bool abR, bool abG, bool abB, bool abA) {
+ tglColorMask(abR, abG, abB, abA);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetDepthWriteActive(bool abX) {
+ tglDepthMask(abX);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetDepthTestActive(bool abX) {
+ if (abX)
+ tglEnable(TGL_DEPTH_TEST);
+ else
+ tglDisable(TGL_DEPTH_TEST);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetDepthTestFunc(eDepthTestFunc aFunc) {
+ tglDepthFunc(GetGLDepthTestFuncEnum(aFunc));
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetAlphaTestActive(bool abX) {
+ if (abX)
+ tglEnable(TGL_ALPHA_TEST);
+ else
+ tglDisable(TGL_ALPHA_TEST);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetAlphaTestFunc(eAlphaTestFunc aFunc, float afRef) {
+ tglAlphaFunc(GetGLAlphaTestFuncEnum(aFunc), afRef);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetStencilActive(bool abX) {
+ if (abX)
+ tglEnable(TGL_STENCIL_TEST);
+ else
+ tglDisable(TGL_STENCIL_TEST);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetStencil(eStencilFunc aFunc, int alRef, unsigned int aMask,
+ eStencilOp aFailOp, eStencilOp aZFailOp, eStencilOp aZPassOp) {
+ tglStencilFunc(GetGLStencilFuncEnum(aFunc), alRef, aMask);
+
+ tglStencilOp(GetGLStencilOpEnum(aFailOp), GetGLStencilOpEnum(aZFailOp),
+ GetGLStencilOpEnum(aZPassOp));
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetStencilTwoSide(eStencilFunc aFrontFunc, eStencilFunc aBackFunc,
+ int alRef, unsigned int aMask, eStencilOp aFrontFailOp, eStencilOp aFrontZFailOp, eStencilOp aFrontZPassOp,
+ eStencilOp aBackFailOp, eStencilOp aBackZFailOp, eStencilOp aBackZPassOp) {
+ error("Only single sided stencil supported");
+}
+
+void LowLevelGraphicsTGL::SetStencilTwoSide(bool abX) {
+ if (!GetCaps(eGraphicCaps_TwoSideStencil))
+ Hpl1::logError(Hpl1::kDebugOpenGL, "call to setStencilTwoSide with two side stencil disabled%c\n", '.');
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetCullActive(bool abX) {
+ if (abX)
+ tglEnable(TGL_CULL_FACE);
+ else
+ tglDisable(TGL_CULL_FACE);
+ tglCullFace(TGL_BACK);
+}
+void LowLevelGraphicsTGL::SetCullMode(eCullMode aMode) {
+ tglCullFace(TGL_BACK);
+ if (aMode == eCullMode_Clockwise)
+ tglFrontFace(TGL_CCW);
+ else
+ tglFrontFace(TGL_CW);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetScissorActive(bool toggle) {
+ if (toggle)
+ tglEnable(TGL_SCISSOR_TEST);
+ else
+ tglDisable(TGL_SCISSOR_TEST);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetScissorRect(const cRect2l &aRect) {
+ //tglScissor(aRect.x, (mvScreenSize.y - aRect.y - 1) - aRect.h, aRect.w, aRect.h);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetBlendActive(bool abX) {
+ if (abX)
+ tglEnable(TGL_BLEND);
+ else
+ tglDisable(TGL_BLEND);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetBlendFunc(eBlendFunc aSrcFactor, eBlendFunc aDestFactor) {
+ tglBlendFunc(GetGLBlendEnum(aSrcFactor), GetGLBlendEnum(aDestFactor));
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetBlendFuncSeparate(eBlendFunc aSrcFactorColor, eBlendFunc aDestFactorColor,
+ eBlendFunc aSrcFactorAlpha, eBlendFunc aDestFactorAlpha) {
+ HPL1_UNIMPLEMENTED(LowLevelGraphicsTGL::SetBlendFuncSeparate);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawQuad(const tVertexVec &avVtx, const cColor aCol) {
+ assert(avVtx.size() == 4);
+
+ tglBegin(TGL_QUADS);
+ {
+ // Make all this inline??
+ for (int i = 0; i < 4; i++) {
+ tglTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, avVtx[i].tex.z);
+ tglColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
+ tglVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
+ }
+ }
+ tglEnd();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawQuad(const tVertexVec &avVtx, const float afZ) {
+ assert(avVtx.size() == 4);
+
+ tglBegin(TGL_QUADS);
+ {
+ // Make all this inline??
+ for (int i = 0; i < 4; i++) {
+ tglTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, afZ);
+ tglColor4f(avVtx[i].col.r, avVtx[i].col.g, avVtx[i].col.b, avVtx[i].col.a);
+ tglVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawQuad(const tVertexVec &avVtx, const float afZ, const cColor &aCol) {
+ assert(avVtx.size() == 4);
+
+ tglBegin(TGL_QUADS);
+ {
+ // Make all this inline??
+ for (int i = 0; i < 4; i++) {
+ tglTexCoord3f(avVtx[i].tex.x, avVtx[i].tex.y, afZ);
+ tglColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
+ tglVertex3f(avVtx[i].pos.x, avVtx[i].pos.y, avVtx[i].pos.z);
+ }
+ }
+ tglEnd();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::AddVertexToBatch(const cVertex &apVtx) {
+ // Coord
+ mpVertexArray[mlVertexCount + 0] = apVtx.pos.x;
+ mpVertexArray[mlVertexCount + 1] = apVtx.pos.y;
+ mpVertexArray[mlVertexCount + 2] = apVtx.pos.z;
+ // Color
+ mpVertexArray[mlVertexCount + 3] = apVtx.col.r;
+ mpVertexArray[mlVertexCount + 4] = apVtx.col.g;
+ mpVertexArray[mlVertexCount + 5] = apVtx.col.b;
+ mpVertexArray[mlVertexCount + 6] = apVtx.col.a;
+ // Texture coord
+ mpVertexArray[mlVertexCount + 7] = apVtx.tex.x;
+ mpVertexArray[mlVertexCount + 8] = apVtx.tex.y;
+ mpVertexArray[mlVertexCount + 9] = apVtx.tex.z;
+ // Normal coord
+ mpVertexArray[mlVertexCount + 10] = apVtx.norm.x;
+ mpVertexArray[mlVertexCount + 11] = apVtx.norm.y;
+ mpVertexArray[mlVertexCount + 12] = apVtx.norm.z;
+
+ mlVertexCount = mlVertexCount + mlBatchStride;
+
+ if (mlVertexCount / mlBatchStride >= mlBatchArraySize) {
+ // Make the array larger.
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::AddVertexToBatch(const cVertex *apVtx, const cVector3f *avTransform) {
+ // Coord
+ mpVertexArray[mlVertexCount + 0] = apVtx->pos.x + avTransform->x;
+ mpVertexArray[mlVertexCount + 1] = apVtx->pos.y + avTransform->y;
+ mpVertexArray[mlVertexCount + 2] = apVtx->pos.z + avTransform->z;
+
+ /*Log("Trans: %s\n",avTransform->ToString().c_str());
+ Log("Adding: %f:%f:%f\n",mpVertexArray[mlVertexCount + 0],
+ mpVertexArray[mlVertexCount + 1],
+ mpVertexArray[mlVertexCount + 2]);*/
+ // Color
+ mpVertexArray[mlVertexCount + 3] = apVtx->col.r;
+ mpVertexArray[mlVertexCount + 4] = apVtx->col.g;
+ mpVertexArray[mlVertexCount + 5] = apVtx->col.b;
+ mpVertexArray[mlVertexCount + 6] = apVtx->col.a;
+ // Texture coord
+ mpVertexArray[mlVertexCount + 7] = apVtx->tex.x;
+ mpVertexArray[mlVertexCount + 8] = apVtx->tex.y;
+ mpVertexArray[mlVertexCount + 9] = apVtx->tex.z;
+
+ /*Log("Tex: %f:%f:%f\n",mpVertexArray[mlVertexCount + 7],
+ mpVertexArray[mlVertexCount + 8],
+ mpVertexArray[mlVertexCount + 9]);*/
+
+ // Normal coord
+ mpVertexArray[mlVertexCount + 10] = apVtx->norm.x;
+ mpVertexArray[mlVertexCount + 11] = apVtx->norm.y;
+ mpVertexArray[mlVertexCount + 12] = apVtx->norm.z;
+
+ mlVertexCount = mlVertexCount + mlBatchStride;
+
+ if (mlVertexCount / mlBatchStride >= mlBatchArraySize) {
+ // Make the array larger.
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::AddVertexToBatch(const cVertex *apVtx, const cMatrixf *aMtx) {
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::AddVertexToBatch_Size2D(const cVertex *apVtx, const cVector3f *avTransform,
+ const cColor *apCol, const float &mfW, const float &mfH) {
+ // Coord
+ mpVertexArray[mlVertexCount + 0] = avTransform->x + mfW;
+ mpVertexArray[mlVertexCount + 1] = avTransform->y + mfH;
+ mpVertexArray[mlVertexCount + 2] = avTransform->z;
+
+ // Color
+ mpVertexArray[mlVertexCount + 3] = apCol->r;
+ mpVertexArray[mlVertexCount + 4] = apCol->g;
+ mpVertexArray[mlVertexCount + 5] = apCol->b;
+ mpVertexArray[mlVertexCount + 6] = apCol->a;
+
+ // Texture coord
+ mpVertexArray[mlVertexCount + 7] = apVtx->tex.x;
+ mpVertexArray[mlVertexCount + 8] = apVtx->tex.y;
+ mpVertexArray[mlVertexCount + 9] = apVtx->tex.z;
+
+ mlVertexCount = mlVertexCount + mlBatchStride;
+
+ if (mlVertexCount / mlBatchStride >= mlBatchArraySize) {
+ // Make the array larger.
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::AddVertexToBatch_Raw(const cVector3f &avPos, const cColor &aColor,
+ const cVector3f &avTex) {
+ // Coord
+ mpVertexArray[mlVertexCount + 0] = avPos.x;
+ mpVertexArray[mlVertexCount + 1] = avPos.y;
+ mpVertexArray[mlVertexCount + 2] = avPos.z;
+
+ // Color
+ mpVertexArray[mlVertexCount + 3] = aColor.r;
+ mpVertexArray[mlVertexCount + 4] = aColor.g;
+ mpVertexArray[mlVertexCount + 5] = aColor.b;
+ mpVertexArray[mlVertexCount + 6] = aColor.a;
+
+ // Texture coord
+ mpVertexArray[mlVertexCount + 7] = avTex.x;
+ mpVertexArray[mlVertexCount + 8] = avTex.y;
+ mpVertexArray[mlVertexCount + 9] = avTex.z;
+
+ mlVertexCount = mlVertexCount + mlBatchStride;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::AddIndexToBatch(int alIndex) {
+ mpIndexArray[mlIndexCount] = alIndex;
+ mlIndexCount++;
+
+ if (mlIndexCount >= mlBatchArraySize) {
+ // Make the array larger.
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::AddTexCoordToBatch(unsigned int alUnit, const cVector3f *apCoord) {
+ unsigned int lCount = mlTexCoordArrayCount[alUnit];
+
+ mpTexCoordArray[alUnit][lCount + 0] = apCoord->x;
+ mpTexCoordArray[alUnit][lCount + 1] = apCoord->y;
+ mpTexCoordArray[alUnit][lCount + 2] = apCoord->z;
+
+ mlTexCoordArrayCount[alUnit] += 3;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetBatchTextureUnitActive(unsigned int alUnit, bool active) {
+ return;
+}
+
+//-----------------------------------------------------------------------
+
+static void flushAutoClear(unsigned &indexCount, unsigned &vertexCount, unsigned *texCoordArray) {
+ indexCount = 0;
+ vertexCount = 0;
+ Common::fill(texCoordArray, texCoordArray + MAX_TEXTUREUNITS, 0);
+}
+
+void LowLevelGraphicsTGL::FlushTriBatch(tVtxBatchFlag aTypeFlags, bool abAutoClear) {
+ SetVtxBatchStates(aTypeFlags);
+ SetUpBatchArrays();
+ tglDrawElements(TGL_TRIANGLES, mlIndexCount, TGL_UNSIGNED_INT, mpIndexArray);
+ if (abAutoClear)
+ flushAutoClear(mlIndexCount, mlVertexCount, mlTexCoordArrayCount);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::FlushQuadBatch(tVtxBatchFlag aTypeFlags, bool abAutoClear) {
+ SetVtxBatchStates(aTypeFlags);
+ SetUpBatchArrays();
+ tglDrawElements(TGL_QUADS, mlIndexCount, TGL_UNSIGNED_INT, mpIndexArray);
+ if (abAutoClear)
+ flushAutoClear(mlIndexCount, mlVertexCount, mlTexCoordArrayCount);
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::ClearBatch() {
+ mlIndexCount = 0;
+ mlVertexCount = 0;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawLine(const cVector3f &avBegin, const cVector3f &avEnd, cColor aCol) {
+ SetTexture(0, nullptr);
+ // SetBlendActive(false);
+ tglColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
+ tglBegin(TGL_LINES);
+ {
+ tglVertex3f(avBegin.x, avBegin.y, avBegin.z);
+ tglVertex3f(avEnd.x, avEnd.y, avEnd.z);
+ }
+ tglEnd();
+}
+
+void LowLevelGraphicsTGL::DrawBoxMaxMin(const cVector3f &avMax, const cVector3f &avMin, cColor aCol) {
+ SetTexture(0, NULL);
+ SetBlendActive(false);
+ tglColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
+
+ tglBegin(TGL_LINES);
+ {
+ // Pos Z Quad
+ tglVertex3f(avMax.x, avMax.y, avMax.z);
+ tglVertex3f(avMin.x, avMax.y, avMax.z);
+
+ tglVertex3f(avMax.x, avMax.y, avMax.z);
+ tglVertex3f(avMax.x, avMin.y, avMax.z);
+
+ tglVertex3f(avMin.x, avMax.y, avMax.z);
+ tglVertex3f(avMin.x, avMin.y, avMax.z);
+
+ tglVertex3f(avMin.x, avMin.y, avMax.z);
+ tglVertex3f(avMax.x, avMin.y, avMax.z);
+
+ // Neg Z Quad
+ tglVertex3f(avMax.x, avMax.y, avMin.z);
+ tglVertex3f(avMin.x, avMax.y, avMin.z);
+
+ tglVertex3f(avMax.x, avMax.y, avMin.z);
+ tglVertex3f(avMax.x, avMin.y, avMin.z);
+
+ tglVertex3f(avMin.x, avMax.y, avMin.z);
+ tglVertex3f(avMin.x, avMin.y, avMin.z);
+
+ tglVertex3f(avMin.x, avMin.y, avMin.z);
+ tglVertex3f(avMax.x, avMin.y, avMin.z);
+
+ // Lines between
+ tglVertex3f(avMax.x, avMax.y, avMax.z);
+ tglVertex3f(avMax.x, avMax.y, avMin.z);
+
+ tglVertex3f(avMin.x, avMax.y, avMax.z);
+ tglVertex3f(avMin.x, avMax.y, avMin.z);
+
+ tglVertex3f(avMin.x, avMin.y, avMax.z);
+ tglVertex3f(avMin.x, avMin.y, avMin.z);
+
+ tglVertex3f(avMax.x, avMin.y, avMax.z);
+ tglVertex3f(avMax.x, avMin.y, avMin.z);
+ }
+ tglEnd();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawSphere(const cVector3f &avPos, float afRadius, cColor aCol) {
+ int alSegments = 32;
+ float afAngleStep = k2Pif / (float)alSegments;
+
+ SetTexture(0, nullptr);
+ SetBlendActive(false);
+ tglColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
+ tglBegin(TGL_LINES);
+ {
+ // X Circle:
+ for (float a = 0; a < k2Pif; a += afAngleStep) {
+ tglVertex3f(avPos.x, avPos.y + sin(a) * afRadius,
+ avPos.z + cos(a) * afRadius);
+
+ tglVertex3f(avPos.x, avPos.y + sin(a + afAngleStep) * afRadius,
+ avPos.z + cos(a + afAngleStep) * afRadius);
+ }
+
+ // Y Circle:
+ for (float a = 0; a < k2Pif; a += afAngleStep) {
+ tglVertex3f(avPos.x + cos(a) * afRadius, avPos.y,
+ avPos.z + sin(a) * afRadius);
+
+ tglVertex3f(avPos.x + cos(a + afAngleStep) * afRadius, avPos.y,
+ avPos.z + sin(a + afAngleStep) * afRadius);
+ }
+
+ // Z Circle:
+ for (float a = 0; a < k2Pif; a += afAngleStep) {
+ tglVertex3f(avPos.x + cos(a) * afRadius, avPos.y + sin(a) * afRadius, avPos.z);
+
+ tglVertex3f(avPos.x + cos(a + afAngleStep) * afRadius,
+ avPos.y + sin(a + afAngleStep) * afRadius,
+ avPos.z);
+ }
+ }
+ tglEnd();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawLine2D(const cVector2f &avBegin, const cVector2f &avEnd, float afZ, cColor aCol) {
+ SetTexture(0, NULL);
+ SetBlendActive(false);
+ tglColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
+ tglBegin(TGL_LINES);
+ {
+ tglVertex3f(avBegin.x, avBegin.y, afZ);
+ tglVertex3f(avEnd.x, avEnd.y, afZ);
+ }
+ tglEnd();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawLineRect2D(const cRect2f &aRect, float afZ, cColor aCol) {
+ SetTexture(0, nullptr);
+ SetBlendActive(false);
+ tglColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
+ tglBegin(TGL_LINE_STRIP);
+ {
+ tglVertex3f(aRect.x, aRect.y, afZ);
+ tglVertex3f(aRect.x + aRect.w, aRect.y, afZ);
+ tglVertex3f(aRect.x + aRect.w, aRect.y + aRect.h, afZ);
+ tglVertex3f(aRect.x, aRect.y + aRect.h, afZ);
+ tglVertex3f(aRect.x, aRect.y, afZ);
+ }
+ tglEnd();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawFilledRect2D(const cRect2f &aRect, float afZ, cColor aCol) {
+ SetTexture(0, NULL);
+ tglColor4f(aCol.r, aCol.g, aCol.b, aCol.a);
+ tglBegin(TGL_QUADS);
+ {
+ tglVertex3f(aRect.x, aRect.y, afZ);
+ tglVertex3f(aRect.x + aRect.w, aRect.y, afZ);
+ tglVertex3f(aRect.x + aRect.w, aRect.y + aRect.h, afZ);
+ tglVertex3f(aRect.x, aRect.y + aRect.h, afZ);
+ }
+ tglEnd();
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::DrawLineCircle2D(const cVector2f &avCenter, float afRadius, float afZ, cColor aCol) {
+ // Implement later
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::CopyContextToTexure(iTexture *apTex, const cVector2l &avPos,
+ const cVector2l &avSize, const cVector2l &avTexOffset) {
+#if 0
+ if (apTex == nullptr)
+ return;
+
+ int lScreenY = (mvScreenSize.y - avSize.y) - avPos.y;
+ int lTexY = (apTex->getHeight() - avSize.y) - avTexOffset.y;
+
+ // Log("TExoffset: %d %d\n",avTexOffset.x,lTexY);
+ // Log("ScreenOffset: %d %d (h: %d s: %d p: %d)\n",avPos.x,lScreenY,mvScreenSize.y,
+ // avSize.y,avPos.y);
+
+ SetTexture(0, apTex);
+ tglCopyTexSubImage2D(GetGLTextureTargetEnum(apTex->GetTarget(), 0,
+ avTexOffset.x, lTexY, avPos.x, lScreenY, avSize.x, avSize.y));
+#endif
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetRenderTarget(iTexture *pTex) {
+ HPL1_UNIMPLEMENTED(LowLevelGraphicsTGL::SetRenderTarget);
+}
+
+//-----------------------------------------------------------------------
+
+bool LowLevelGraphicsTGL::RenderTargetHasZBuffer() {
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::FlushRenderTarget() {
+ HPL1_UNIMPLEMENTED(LowLevelGraphicsTGL::FlushRenderTarget);
+}
+
+//-----------------------------------------------------------------------
+
+cVector2f LowLevelGraphicsTGL::GetScreenSize() {
+ return cVector2f((float)mvScreenSize.x, (float)mvScreenSize.y);
+}
+
+//-----------------------------------------------------------------------
+
+cVector2f LowLevelGraphicsTGL::GetVirtualSize() {
+ return mvVirtualSize;
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetVirtualSize(cVector2f avSize) {
+ mvVirtualSize = avSize;
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetUpBatchArrays() {
+ // Set the arrays
+ tglVertexPointer(3, TGL_FLOAT, sizeof(float) * mlBatchStride, mpVertexArray);
+ tglColorPointer(4, TGL_FLOAT, sizeof(float) * mlBatchStride, &mpVertexArray[3]);
+ tglNormalPointer(TGL_FLOAT, sizeof(float) * mlBatchStride, &mpVertexArray[10]);
+ tglTexCoordPointer(3, TGL_FLOAT, sizeof(float) * mlBatchStride, &mpVertexArray[7]);
+#if 0
+ tglClientActiveTextureARB(GL_TEXTURE1_ARB);
+ tglTexCoordPointer(3, TGL_FLOAT, sizeof(float) * mlBatchStride, &mpVertexArray[7]);
+ tglClientActiveTextureARB(GL_TEXTURE2_ARB);
+ tglTexCoordPointer(3, TGL_FLOAT, sizeof(float) * mlBatchStride, &mpVertexArray[7]);
+#endif
+}
+
+//-----------------------------------------------------------------------
+
+void LowLevelGraphicsTGL::SetVtxBatchStates(tVtxBatchFlag flags) {
+ if (flags & eVtxBatchFlag_Position) {
+ tglEnableClientState(TGL_VERTEX_ARRAY);
+ } else {
+ tglDisableClientState(TGL_VERTEX_ARRAY);
+ }
+
+ if (flags & eVtxBatchFlag_Color0) {
+ tglEnableClientState(TGL_COLOR_ARRAY);
+ } else {
+ tglDisableClientState(TGL_COLOR_ARRAY);
+ }
+
+ if (flags & eVtxBatchFlag_Normal) {
+ tglEnableClientState(TGL_NORMAL_ARRAY);
+ } else {
+ tglDisableClientState(TGL_NORMAL_ARRAY);
+ }
+
+ if (flags & eVtxBatchFlag_Texture0) {
+ //tglClientActiveTexture(TGL_TEXTURE);
+ tglEnableClientState(TGL_TEXTURE_COORD_ARRAY);
+ } else {
+ //tglClientActiveTextureARB(TGL_TEXTURE0_ARB);
+ tglDisableClientState(TGL_TEXTURE_COORD_ARRAY);
+ }
+#if 0
+ if (flags & eVtxBatchFlag_Texture1) {
+ GL_CHECK(glClientActiveTextureARB(TGL_TEXTURE1_ARB));
+ tglEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ } else {
+ tglClientActiveTextureARB(GL_TEXTURE1_ARB);
+ tglDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ }
+
+ if (flags & eVtxBatchFlag_Texture2) {
+ tglClientActiveTextureARB(GL_TEXTURE2_ARB);
+ tglEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ } else {
+ tglClientActiveTextureARB(GL_TEXTURE2_ARB);
+ tglDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ }
+#endif
+}
+
+} // namespace hpl
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/low_level_graphics_tgl.h b/engines/hpl1/engine/impl/low_level_graphics_tgl.h
new file mode 100644
index 00000000000..09f160fd4ff
--- /dev/null
+++ b/engines/hpl1/engine/impl/low_level_graphics_tgl.h
@@ -0,0 +1,280 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL_LOW_LEVEL_GRAPHICS_TGL_H
+#define HPL_LOW_LEVEL_GRAPHICS_TGL_H
+
+#include "hpl1/engine/graphics/LowLevelGraphics.h"
+#include "graphics/pixelformat.h"
+#include "hpl1/engine/math/MathTypes.h"
+#include "graphics/surface.h"
+#include "common/ptr.h"
+#include "graphics/tinygl/tinygl.h"
+
+namespace hpl {
+
+TGLenum ColorFormatToTGL(eColorDataFormat format);
+
+TGLenum TextureTargetToTGL(eTextureTarget target);
+
+TGLenum GetTGLTextureTargetEnum(eTextureTarget type);
+
+//-------------------------------------------------
+
+class LowLevelGraphicsTGL : public iLowLevelGraphics {
+public:
+ LowLevelGraphicsTGL();
+ ~LowLevelGraphicsTGL();
+
+ bool Init(int alWidth, int alHeight, int alBpp, int abFullscreen, int alMultisampling,
+ const tString &asWindowCaption);
+
+ int GetCaps(eGraphicCaps aType) const;
+
+ void ShowCursor(bool abX);
+
+ void SetVsyncActive(bool abX);
+
+ void SetMultisamplingActive(bool abX);
+
+ void SetGammaCorrection(float afX);
+ float GetGammaCorrection();
+
+ int GetMultisampling() { return mlMultisampling; }
+
+ void SetClipPlane(int alIdx, const cPlanef &aPlane);
+ cPlanef GetClipPlane(int alIdx, const cPlanef &aPlane);
+ void SetClipPlaneActive(int alIdx, bool abX);
+
+ cVector2f GetScreenSize();
+ cVector2f GetVirtualSize();
+ void SetVirtualSize(cVector2f avSize);
+
+ Bitmap2D *CreateBitmap2D(const cVector2l &avSize);
+ FontData *CreateFontData(const tString &asName);
+
+ iTexture *CreateTexture(bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
+ iTexture *CreateTexture(const tString &asName, bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
+ iTexture *CreateTexture(Bitmap2D *apBmp, bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
+ iTexture *CreateTexture(const cVector2l &avSize, int alBpp, cColor aFillCol,
+ bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget);
+
+ Graphics::PixelFormat *GetPixelFormat();
+
+ iGpuProgram *CreateGpuProgram(const tString &vertex, const tString &fragment);
+
+ void SaveScreenToBMP(const tString &asFile);
+
+ /////////// MATRIX METHODS /////////////////////////
+
+ void PushMatrix(eMatrix aMtxType);
+ void PopMatrix(eMatrix aMtxType);
+ void SetIdentityMatrix(eMatrix aMtxType);
+
+ void SetMatrix(eMatrix aMtxType, const cMatrixf &a_mtxA);
+
+ void TranslateMatrix(eMatrix aMtxType, const cVector3f &avPos);
+ void RotateMatrix(eMatrix aMtxType, const cVector3f &avRot);
+ void ScaleMatrix(eMatrix aMtxType, const cVector3f &avScale);
+
+ void SetOrthoProjection(const cVector2f &avSize, float afMin, float afMax);
+
+ /////////// DRAWING METHODS /////////////////////////
+
+ // OCCLUSION
+ iOcclusionQuery *CreateOcclusionQuery();
+ void DestroyOcclusionQuery(iOcclusionQuery *apQuery);
+
+ // CLEARING THE FRAMEBUFFER
+ void ClearScreen();
+
+ void SetClearColor(const cColor &aCol);
+ void SetClearDepth(float afDepth);
+ void SetClearStencil(int alVal);
+
+ void SetClearColorActive(bool abX);
+ void SetClearDepthActive(bool abX);
+ void SetClearStencilActive(bool abX);
+
+ void SetColorWriteActive(bool abR, bool abG, bool abB, bool abA);
+ void SetDepthWriteActive(bool abX);
+
+ void SetCullActive(bool abX);
+ void SetCullMode(eCullMode aMode);
+
+ // DEPTH
+ void SetDepthTestActive(bool abX);
+ void SetDepthTestFunc(eDepthTestFunc aFunc);
+
+ // ALPHA
+ void SetAlphaTestActive(bool abX);
+ void SetAlphaTestFunc(eAlphaTestFunc aFunc, float afRef);
+
+ // STENCIL
+ void SetStencilActive(bool abX);
+ void SetStencil(eStencilFunc aFunc, int alRef, unsigned int aMask,
+ eStencilOp aFailOp, eStencilOp aZFailOp, eStencilOp aZPassOp);
+ void SetStencilTwoSide(eStencilFunc aFrontFunc, eStencilFunc aBackFunc,
+ int alRef, unsigned int aMask,
+ eStencilOp aFrontFailOp, eStencilOp aFrontZFailOp, eStencilOp aFrontZPassOp,
+ eStencilOp aBackFailOp, eStencilOp aBackZFailOp, eStencilOp aBackZPassOp);
+ void SetStencilTwoSide(bool abX);
+
+ // SCISSOR
+ void SetScissorActive(bool abX);
+ void SetScissorRect(const cRect2l &aRect);
+
+ // BLENDING
+ void SetBlendActive(bool abX);
+ void SetBlendFunc(eBlendFunc aSrcFactor, eBlendFunc aDestFactor);
+ void SetBlendFuncSeparate(eBlendFunc aSrcFactorColor, eBlendFunc aDestFactorColor,
+ eBlendFunc aSrcFactorAlpha, eBlendFunc aDestFactorAlpha);
+
+ // TEXTURE
+ void SetTexture(unsigned int alUnit, iTexture *apTex);
+ void SetActiveTextureUnit(unsigned int alUnit);
+ void SetTextureEnv(eTextureParam aParam, int alVal);
+ void SetTextureConstantColor(const cColor &color);
+
+ void SetColor(const cColor &aColor);
+
+ // POLYGONS
+ iVertexBuffer *CreateVertexBuffer(tVertexFlag aFlags, eVertexBufferDrawType aDrawType,
+ eVertexBufferUsageType aUsageType,
+ int alReserveVtxSize = 0, int alReserveIdxSize = 0);
+
+ void DrawRect(const cVector2f &avPos, const cVector2f &avSize, float afZ);
+
+ void DrawTri(const tVertexVec &avVtx);
+ void DrawTri(const cVertex *avVtx);
+
+ void DrawQuad(const tVertexVec &avVtx);
+ void DrawQuad(const tVertexVec &avVtx, const cColor aCol);
+ void DrawQuad(const tVertexVec &avVtx, const float afZ);
+ void DrawQuad(const tVertexVec &avVtx, const float afZ, const cColor &aCol);
+ void DrawQuadMultiTex(const tVertexVec &avVtx, const tVector3fVec &avExtraUvs);
+
+ void AddVertexToBatch(const cVertex &apVtx);
+ void AddVertexToBatch(const cVertex *apVtx, const cVector3f *avTransform);
+ void AddVertexToBatch(const cVertex *apVtx, const cMatrixf *aMtx);
+
+ void AddVertexToBatch_Size2D(const cVertex *apVtx, const cVector3f *avTransform,
+ const cColor *apCol, const float &mfW, const float &mfH);
+
+ void AddVertexToBatch_Raw(const cVector3f &avPos, const cColor &aColor,
+ const cVector3f &avTex);
+
+ void AddTexCoordToBatch(unsigned int alUnit, const cVector3f *apCoord);
+ void SetBatchTextureUnitActive(unsigned int alUnit, bool abActive);
+
+ void AddIndexToBatch(int alIndex);
+
+ void FlushTriBatch(tVtxBatchFlag aTypeFlags, bool abAutoClear = true);
+ void FlushQuadBatch(tVtxBatchFlag aTypeFlags, bool abAutoClear = true);
+ void ClearBatch();
+
+ // PRIMITIVES
+ void DrawLine(const cVector3f &avBegin, const cVector3f &avEnd, cColor aCol);
+ void DrawBoxMaxMin(const cVector3f &avMax, const cVector3f &avMin, cColor aCol);
+ void DrawSphere(const cVector3f &avPos, float afRadius, cColor aCol);
+
+ void DrawLine2D(const cVector2f &avBegin, const cVector2f &avEnd, float afZ, cColor aCol);
+ void DrawLineRect2D(const cRect2f &aRect, float afZ, cColor aCol);
+ void DrawLineCircle2D(const cVector2f &avCenter, float afRadius, float afZ, cColor aCol);
+
+ void DrawFilledRect2D(const cRect2f &aRect, float afZ, cColor aCol);
+
+ // FRAMEBUFFER
+ void CopyContextToTexure(iTexture *apTex, const cVector2l &avPos,
+ const cVector2l &avSize, const cVector2l &avTexOffset = 0);
+ void SetRenderTarget(iTexture *pTex);
+ bool RenderTargetHasZBuffer();
+ void FlushRenderTarget();
+
+ void FlushRendering();
+ void SwapBuffers();
+
+ ///// SDL Specific ////////////////////////////
+
+ void SetupGL();
+
+private:
+ cVector2l mvScreenSize;
+ cVector2f mvVirtualSize;
+ int mlMultisampling;
+ int mlBpp;
+
+ // Gamma
+ //uint16 mvStartGammaArray[3][256];
+ float mfGammaCorrection;
+
+ // Clipping
+ cPlanef mvClipPlanes[kMaxClipPlanes];
+
+ // SDL Variables
+ //SDL_Surface *mpScreen;
+ Graphics::PixelFormat mpPixelFormat;
+
+ // Vertex Array variables
+ // The vertex arrays used:
+ float *mpVertexArray;
+ unsigned int mlVertexCount;
+ unsigned int *mpIndexArray;
+ unsigned int mlIndexCount;
+
+ unsigned int mlBatchStride;
+
+ float *mpTexCoordArray[MAX_TEXTUREUNITS];
+ bool mbTexCoordArrayActive[MAX_TEXTUREUNITS];
+ unsigned int mlTexCoordArrayCount[MAX_TEXTUREUNITS];
+
+ unsigned int mlBatchArraySize;
+
+ // Clearing
+ bool mbClearColor;
+ bool mbClearDepth;
+ bool mbClearStencil;
+
+ // Rendertarget variables
+ iTexture *mpRenderTarget;
+
+ // Texture
+ iTexture *mpCurrentTexture[MAX_TEXTUREUNITS];
+
+ // CG Compiler Variables
+ //CGcontext mCG_Context;
+
+ // Multisample
+ void CheckMultisampleCaps();
+
+ // Batch helper
+ void SetUpBatchArrays();
+
+ // Matrix Helper
+ void SetMatrixMode(eMatrix mType);
+
+ // Vtx helper
+ void SetVtxBatchStates(tVtxBatchFlag flags);
+};
+
+} // namespace hpl
+
+#endif // HPL_LOWLEVELGRAPHICS_TGL_H
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/texture_tgl.cpp b/engines/hpl1/engine/impl/texture_tgl.cpp
new file mode 100644
index 00000000000..8db6222c672
--- /dev/null
+++ b/engines/hpl1/engine/impl/texture_tgl.cpp
@@ -0,0 +1,541 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "hpl1/engine/impl/texture_tgl.h"
+#include "common/str.h"
+#include "graphics/pixelformat.h"
+#include "hpl1/engine/graphics/bitmap2D.h"
+
+#include "hpl1/debug.h"
+#include "hpl1/engine/math/Math.h"
+#include "hpl1/engine/system/low_level_system.h"
+
+namespace hpl {
+
+static void getSettings(Bitmap2D *apSrc, int &alChannels, TGLint &internalFormat, TGLenum &format) {
+ alChannels = apSrc->getNumChannels();
+ tString sType = cString::ToLowerCase(apSrc->getType());
+ const Common::String bmpFormat = apSrc->format().toString();
+
+ if (alChannels == 4) {
+ internalFormat = TGL_RGBA;
+ if (bmpFormat.contains("BGRA")) {
+ format = TGL_BGRA;
+ } else {
+ format = TGL_RGBA;
+ }
+ }
+ if (alChannels == 3) {
+ internalFormat = TGL_RGB;
+ if (bmpFormat.contains("BGR")) {
+ format = TGL_BGR;
+ } else {
+ format = TGL_RGB;
+ }
+ }
+ if (alChannels == 1) {
+ format = TGL_RED;
+ internalFormat = TGL_RED;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+TGLTexture::TGLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
+ eTextureType aType, bool abUseMipMaps, eTextureTarget aTarget,
+ bool abCompress)
+ : iTexture(asName, "OGL", apPxlFmt, apLowLevelGraphics, aType, abUseMipMaps, aTarget, abCompress) {
+ mbContainsData = false;
+
+ if (aType == eTextureType_RenderTarget) {
+ Hpl1::logError(Hpl1::kDebugGraphics, "use of render target%s", ".");
+ // mpPBuffer = hplNew( cPBuffer, (mpLowLevelGraphics,true) );
+ }
+
+ // Cubemap does not like mipmaps
+ if (aTarget == eTextureTarget_CubeMap)
+ mbUseMipMaps = false;
+
+ mpGfxSDL = static_cast<LowLevelGraphicsTGL *>(mpLowLevelGraphics);
+
+ mlTextureIndex = 0;
+ mfTimeCount = 0;
+
+ mfTimeDir = 1;
+}
+
+TGLTexture::~TGLTexture() {
+ for (unsigned int &mvTextureHandle : mvTextureHandles) {
+ tglDeleteTextures(1, &mvTextureHandle);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+bool TGLTexture::CreateFromBitmap(Bitmap2D *pBmp) {
+ // Generate handles
+ if (mvTextureHandles.empty()) {
+ mvTextureHandles.resize(1);
+ tglGenTextures(1, &mvTextureHandles[0]);
+ } else {
+ // Log("Delete + Generate!\n");
+ // glDeleteTextures(1,(GLuint *)&mvTextureHandles[0]);
+ // glGenTextures(1,(GLuint *)&mvTextureHandles[0]);
+ }
+
+ return CreateFromBitmapToHandle(pBmp, 0);
+}
+
+//-----------------------------------------------------------------------
+
+bool TGLTexture::CreateAnimFromBitmapVec(tBitmap2DVec *avBitmaps) {
+ mvTextureHandles.resize(avBitmaps->size());
+
+ for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
+ tglGenTextures(1, &mvTextureHandles[i]);
+ if (CreateFromBitmapToHandle((*avBitmaps)[i], (int)i) == false) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+bool TGLTexture::CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps) {
+ HPL1_UNIMPLEMENTED(TGLTexture::CreateCubeFromBitmapVec);
+}
+
+//-----------------------------------------------------------------------
+
+bool TGLTexture::Create(unsigned int alWidth, unsigned int alHeight, cColor aCol) {
+ HPL1_UNIMPLEMENTED(TGLTexture::Create);
+}
+
+//-----------------------------------------------------------------------
+
+static void generateMipmaps(eTextureTarget target) {
+
+}
+
+bool TGLTexture::CreateFromArray(unsigned char *apPixelData, int alChannels, const cVector3l &avSize) {
+ if (mvTextureHandles.empty()) {
+ mvTextureHandles.resize(1);
+ tglGenTextures(1, &mvTextureHandles[0]);
+ }
+
+ TGLenum GLTarget = InitCreation(0);
+
+ int lChannels = alChannels;
+ TGLenum format = 0;
+ switch (lChannels) {
+ case 1:
+ case 2:
+ case 3:
+ format = TGL_RGB;
+ break;
+ case 4:
+ format = TGL_RGBA;
+ break;
+ }
+
+ _width = avSize.x;
+ _height = avSize.y;
+ _bpp = lChannels * 8;
+
+ if (!cMath::IsPow2(_height) || !cMath::IsPow2(_width) || !cMath::IsPow2(avSize.z)) {
+ Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
+ }
+
+ if (mTarget == eTextureTarget_1D) {
+ tglTexImage2D(GLTarget, 0, format, _width, 1, 0, format,
+ TGL_UNSIGNED_BYTE, apPixelData);
+ } else if (mTarget == eTextureTarget_2D) {
+ tglTexImage2D(GLTarget, 0, format, _width, _height,
+ 0, format, TGL_UNSIGNED_BYTE, apPixelData);
+ } else if (mTarget == eTextureTarget_3D) {
+ error("trying to create a texture 3D in TGLTexture");
+ }
+
+ if (mbUseMipMaps && mTarget != eTextureTarget_Rect && mTarget != eTextureTarget_3D)
+ generateMipmaps(mTarget);
+
+ PostCreation(GLTarget);
+
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+void TGLTexture::SetPixels2D(int alLevel, const cVector2l &avOffset, const cVector2l &avSize,
+ eColorDataFormat aDataFormat, void *apPixelData) {
+ HPL1_UNIMPLEMENTED(TGLTexture::SetPixels2D);
+}
+
+//-----------------------------------------------------------------------
+
+void TGLTexture::Update(float afTimeStep) {
+ if (mvTextureHandles.size() > 1) {
+ float fMax = (float)(mvTextureHandles.size());
+ mfTimeCount += afTimeStep * (1.0f / mfFrameTime) * mfTimeDir;
+
+ if (mfTimeDir > 0) {
+ if (mfTimeCount >= fMax) {
+ if (mAnimMode == eTextureAnimMode_Loop) {
+ mfTimeCount = 0;
+ } else {
+ mfTimeCount = fMax - 1.0f;
+ mfTimeDir = -1.0f;
+ }
+ }
+ } else {
+ if (mfTimeCount < 0) {
+ mfTimeCount = 1;
+ mfTimeDir = 1.0f;
+ }
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+
+bool TGLTexture::HasAnimation() {
+ return mvTextureHandles.size() > 1;
+}
+
+void TGLTexture::NextFrame() {
+ mfTimeCount += mfTimeDir;
+
+ if (mfTimeDir > 0) {
+ float fMax = (float)(mvTextureHandles.size());
+ if (mfTimeCount >= fMax) {
+ if (mAnimMode == eTextureAnimMode_Loop) {
+ mfTimeCount = 0;
+ } else {
+ mfTimeCount = fMax - 1.0f;
+ mfTimeDir = -1.0f;
+ }
+ }
+ } else {
+ if (mfTimeCount < 0) {
+ mfTimeCount = 1;
+ mfTimeDir = 1.0f;
+ }
+ }
+}
+
+void TGLTexture::PrevFrame() {
+ mfTimeCount -= mfTimeDir;
+
+ if (mfTimeDir < 0) {
+ float fMax = (float)(mvTextureHandles.size());
+ if (mfTimeCount >= fMax) {
+ if (mAnimMode == eTextureAnimMode_Loop) {
+ mfTimeCount = 0;
+ } else {
+ mfTimeCount = fMax - 1.0f;
+ mfTimeDir = -1.0f;
+ }
+ }
+ } else {
+ if (mfTimeCount < 0) {
+ mfTimeCount = 1;
+ mfTimeDir = 1.0f;
+ }
+ }
+}
+
+float TGLTexture::GetT() {
+ return cMath::Modulus(mfTimeCount, 1.0f);
+}
+
+float TGLTexture::GetTimeCount() {
+ return mfTimeCount;
+}
+void TGLTexture::SetTimeCount(float afX) {
+ mfTimeCount = afX;
+}
+int TGLTexture::GetCurrentLowlevelHandle() {
+ return GetTextureHandle();
+}
+
+//-----------------------------------------------------------------------
+
+void TGLTexture::SetFilter(eTextureFilter aFilter) {
+ if (mFilter == aFilter)
+ return;
+
+ mFilter = aFilter;
+ if (mbContainsData) {
+ TGLenum GLTarget =GetTGLTextureTargetEnum(mTarget);
+
+ tglEnable(GLTarget);
+ for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
+ tglBindTexture(GLTarget, mvTextureHandles[i]);
+
+ if (mbUseMipMaps && mTarget != eTextureTarget_Rect) {
+ if (mFilter == eTextureFilter_Bilinear)
+ tglTexParameteri(GLTarget, TGL_TEXTURE_MIN_FILTER, TGL_LINEAR_MIPMAP_NEAREST);
+ else
+ tglTexParameteri(GLTarget, TGL_TEXTURE_MIN_FILTER, TGL_LINEAR_MIPMAP_LINEAR);
+ } else {
+ tglTexParameteri(GLTarget, TGL_TEXTURE_MIN_FILTER, TGL_LINEAR);
+ }
+ }
+ tglDisable(GLTarget);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void TGLTexture::SetAnisotropyDegree(float afX) {
+}
+
+//-----------------------------------------------------------------------
+
+void TGLTexture::SetWrapS(eTextureWrap aMode) {
+ if (mbContainsData) {
+ TGLenum GLTarget = GetTGLTextureTargetEnum(mTarget);
+
+ tglEnable(GLTarget);
+ for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
+ tglBindTexture(GLTarget, mvTextureHandles[i]);
+
+ tglTexParameteri(GLTarget, TGL_TEXTURE_WRAP_S, GetGLWrap(aMode));
+ }
+ tglDisable(GLTarget);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void TGLTexture::SetWrapT(eTextureWrap aMode) {
+ if (mbContainsData) {
+ TGLenum GLTarget = GetTGLTextureTargetEnum(mTarget);
+
+ tglEnable(GLTarget);
+ for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
+ tglBindTexture(GLTarget, mvTextureHandles[i]);
+
+ tglTexParameteri(GLTarget, TGL_TEXTURE_WRAP_T, GetGLWrap(aMode));
+ }
+ tglDisable(GLTarget);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void TGLTexture::SetWrapR(eTextureWrap aMode) {
+ if (mbContainsData) {
+ TGLenum GLTarget = GetTGLTextureTargetEnum(mTarget);
+
+ tglEnable(GLTarget);
+ tglEnable(GLTarget);
+ for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
+ tglBindTexture(GLTarget, mvTextureHandles[i]);
+
+ //tglTexParameteri(GLTarget, TGL_TEXTURE_WRAP_R, GetGLWrap(aMode));
+ }
+ tglDisable(GLTarget);
+
+ tglDisable(GLTarget);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+unsigned int TGLTexture::GetTextureHandle() {
+ if (mvTextureHandles.size() > 1) {
+ int lFrame = (int)mfTimeCount;
+ return mvTextureHandles[lFrame];
+ } else {
+ return mvTextureHandles[0];
+ }
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+bool TGLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
+ if (mType == eTextureType_RenderTarget)
+ error("trying to create a rendertarget in SDLTexture::CreateBitmapToHandle");
+
+ // For some reason checking for ARB texture is not working on radeon cards.
+ /*if(mTarget == eTextureTarget_Rect && !GLEE_ARB_texture_rectangle)
+ {
+ Error("Rectangle texture target not supported\n");
+ return false;
+ }*/
+
+ TGLenum GLTarget = InitCreation(alHandleIdx);
+
+ Bitmap2D *pBitmapSrc = pBmp;
+
+ _width = pBitmapSrc->getWidth();
+ _height = pBitmapSrc->getHeight();
+
+ if ((!cMath::IsPow2(_height) || !cMath::IsPow2(_width)) && mTarget != eTextureTarget_Rect)
+ Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
+
+ int lChannels = 0;
+ TGLint internalFormat = 0;
+ TGLenum format = 0;
+ getSettings(pBitmapSrc, lChannels, internalFormat, format);
+
+ _bpp = lChannels * 8;
+
+ const unsigned char *pPixelSrc = (const unsigned char *)pBitmapSrc->getRawData();
+
+ unsigned char *pNewSrc = nullptr;
+ if (mlSizeLevel > 0 && (int)_width > mvMinLevelSize.x * 2) {
+ // Log("OldSize: %d x %d ",mlWidth,mlHeight);
+
+ int lOldW = _width;
+ //int lOldH = _height;
+
+ int lSizeDiv = (int)pow((float)2, (int)mlSizeLevel);
+
+ _width /= lSizeDiv;
+ _height /= lSizeDiv;
+
+ while (_width < (unsigned int)mvMinLevelSize.x) {
+ _width *= 2;
+ _height *= 2;
+ lSizeDiv /= 2;
+ }
+
+ // Log("NewSize: %d x %d SizeDiv: %d\n",mlWidth,mlHeight,lSizeDiv);
+
+ pNewSrc = hplNewArray(unsigned char, lChannels *_width *_height);
+
+ int lWidthCount = _width;
+ int lHeightCount = _height;
+ int lOldAdd = lChannels * lSizeDiv;
+ int lOldHeightAdd = lChannels * lOldW * (lSizeDiv - 1);
+
+ const unsigned char *pOldPixel = pPixelSrc;
+ unsigned char *pNewPixel = pNewSrc;
+
+ while (lHeightCount) {
+ memcpy(pNewPixel, pOldPixel, lChannels);
+
+ pOldPixel += lOldAdd;
+ pNewPixel += lChannels;
+
+ lWidthCount--;
+ if (!lWidthCount) {
+ lWidthCount = _width;
+ lHeightCount--;
+ pOldPixel += lOldHeightAdd;
+ }
+ }
+
+ pPixelSrc = pNewSrc;
+ }
+
+ // Log("Loading %s %d x %d\n",msName.c_str(), pSrc->GetWidth(), pSrc->GetHeight());
+ // Log("Channels: %d Format: %x\n",lChannels, format);
+
+ if (mTarget == eTextureTarget_1D)
+ tglTexImage2D(GLTarget, 0, internalFormat, _width, 1, 0, format,
+ TGL_UNSIGNED_BYTE, pPixelSrc);
+ else
+ tglTexImage2D(GLTarget, 0, internalFormat, _width, _height,
+ 0, format, TGL_UNSIGNED_BYTE, pPixelSrc);
+
+ //if (tglGetError() != TGL_NO_ERROR)
+ // return false;
+
+ if (mbUseMipMaps && mTarget != eTextureTarget_Rect)
+ generateMipmaps(mTarget);
+
+ PostCreation(GLTarget);
+ if (mlSizeLevel > 0 && pNewSrc)
+ hplDeleteArray(pNewSrc);
+
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+TGLenum TGLTexture::InitCreation(int alHandleIdx) {
+ TGLenum GLTarget = GetTGLTextureTargetEnum(mTarget);
+
+ tglEnable(GLTarget);
+ tglBindTexture(GLTarget, mvTextureHandles[alHandleIdx]);
+
+ return GLTarget;
+}
+
+//-----------------------------------------------------------------------
+
+void TGLTexture::PostCreation(TGLenum aGLTarget) {
+ if (mbUseMipMaps && mTarget != eTextureTarget_Rect) {
+ if (mFilter == eTextureFilter_Bilinear)
+ tglTexParameteri(aGLTarget, TGL_TEXTURE_MIN_FILTER, TGL_LINEAR_MIPMAP_NEAREST);
+ else
+ tglTexParameteri(aGLTarget, TGL_TEXTURE_MIN_FILTER, TGL_LINEAR_MIPMAP_LINEAR);
+ } else {
+ tglTexParameteri(aGLTarget, TGL_TEXTURE_MIN_FILTER, TGL_LINEAR);
+ }
+ tglTexParameteri(aGLTarget, TGL_TEXTURE_MAG_FILTER, TGL_LINEAR);
+ tglDisable(aGLTarget);
+
+ mbContainsData = true;
+}
+
+//-----------------------------------------------------------------------
+
+TGLenum TGLTexture::GetGLWrap(eTextureWrap aMode) {
+ switch (aMode) {
+ case eTextureWrap_Clamp:
+ return TGL_CLAMP;
+ case eTextureWrap_Repeat:
+ return TGL_REPEAT;
+ case eTextureWrap_ClampToEdge:
+ return TGL_CLAMP_TO_EDGE;
+ case eTextureWrap_ClampToBorder:
+ return TGL_CLAMP_TO_EDGE;//TGL_CLAMP_TO_BORDER;
+ default:
+ break;
+ }
+
+ return TGL_REPEAT;
+}
+
+}
+//-----------------------------------------------------------------------
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/texture_tgl.h b/engines/hpl1/engine/impl/texture_tgl.h
new file mode 100644
index 00000000000..6fcd90ead30
--- /dev/null
+++ b/engines/hpl1/engine/impl/texture_tgl.h
@@ -0,0 +1,95 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL_TEXTURE_TGL_H
+#define HPL_TEXTURE_TGL_H
+
+#include "hpl1/engine/graphics/Texture.h"
+#include "hpl1/engine/impl/low_level_graphics_tgl.h"
+#include "hpl1/engine/graphics/bitmap2D.h"
+
+namespace hpl {
+
+class TGLTexture : public iTexture {
+public:
+ TGLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
+ eTextureType aType, bool abUseMipMaps, eTextureTarget aTarget,
+ bool abCompress = false);
+ ~TGLTexture();
+
+ bool CreateFromBitmap(Bitmap2D *pBmp);
+
+ bool CreateAnimFromBitmapVec(tBitmap2DVec *avBitmaps);
+
+ bool CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps);
+ bool Create(unsigned int alWidth, unsigned int alHeight, cColor aCol);
+
+ bool CreateFromArray(unsigned char *apPixelData, int alChannels, const cVector3l &avSize);
+
+ void SetPixels2D(int alLevel, const cVector2l &avOffset, const cVector2l &avSize,
+ eColorDataFormat aDataFormat, void *apPixelData);
+
+ float GetGamma() { return 0; }
+ void SetGamma(float afGamma) {}
+ int GetHandle() { return (int)mvTextureHandles[0]; }
+
+ void SetFilter(eTextureFilter aFilter);
+ void SetAnisotropyDegree(float afX);
+
+ void SetWrapS(eTextureWrap aMode);
+ void SetWrapT(eTextureWrap aMode);
+ void SetWrapR(eTextureWrap aMode);
+
+ void Update(float afTimeStep);
+
+ bool HasAnimation();
+ void NextFrame();
+ void PrevFrame();
+ float GetT();
+ float GetTimeCount();
+ void SetTimeCount(float afX);
+ int GetCurrentLowlevelHandle();
+
+ /// SDL / OGL Specific ///////////
+
+ unsigned int GetTextureHandle();
+ //cPBuffer *GetPBuffer() { return mpPBuffer; }
+
+private:
+ bool CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx);
+
+ TGLenum InitCreation(int alHandleIdx);
+ void PostCreation(TGLenum aGLTarget);
+
+ TGLenum GetGLWrap(eTextureWrap aMode);
+
+ tUIntVec mvTextureHandles;
+ bool mbContainsData;
+ LowLevelGraphicsTGL *mpGfxSDL;
+
+ float mfTimeCount;
+ int mlTextureIndex;
+ float mfTimeDir;
+};
+
+} // namespace hpl
+
+#endif // HPL_TEXTURE_TGL_H
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/vertex_buffer_tgl.cpp b/engines/hpl1/engine/impl/vertex_buffer_tgl.cpp
new file mode 100644
index 00000000000..e7fbbf8c952
--- /dev/null
+++ b/engines/hpl1/engine/impl/vertex_buffer_tgl.cpp
@@ -0,0 +1,492 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "hpl1/engine/impl/vertex_buffer_tgl.h"
+#include "hpl1/engine/math/Math.h"
+#include "hpl1/engine/system/low_level_system.h"
+
+#include "hpl1/debug.h"
+#include "graphics/tinygl/tinygl.h"
+
+namespace hpl {
+
+//////////////////////////////////////////////////////////////////////////
+// CONSTRUCTORS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+VertexBufferTGL::VertexBufferTGL(iLowLevelGraphics *apLowLevelGraphics, tVertexFlag aFlags,
+ eVertexBufferDrawType aDrawType, eVertexBufferUsageType aUsageType,
+ int alReserveVtxSize, int alReserveIdxSize) : iVertexBuffer(apLowLevelGraphics, aFlags, aDrawType, aUsageType, alReserveVtxSize, alReserveIdxSize) {
+ if (alReserveVtxSize > 0) {
+ for (int i = 0; i < klNumOfVertexFlags; i++) {
+ if (aFlags & kvVertexFlags[i]) {
+ mvVertexArray[i].reserve(alReserveVtxSize * kvVertexElements[i]);
+ }
+ }
+ }
+
+ if (alReserveIdxSize > 0)
+ mvIndexArray.reserve(alReserveIdxSize);
+
+ mbTangents = false;
+
+ mbHasShadowDouble = false;
+
+ mpLowLevelGraphics = apLowLevelGraphics;
+}
+
+VertexBufferTGL::~VertexBufferTGL() {
+ for (int i = 0; i < klNumOfVertexFlags; i++)
+ mvVertexArray[i].clear();
+
+ mvIndexArray.clear();
+}
+
+//-----------------------------------------------------------------------
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void VertexBufferTGL::AddVertex(tVertexFlag aType, const cVector3f &avVtx) {
+ int idx = cMath::Log2ToInt((int)aType);
+
+ mvVertexArray[idx].push_back(avVtx.x);
+ mvVertexArray[idx].push_back(avVtx.y);
+ mvVertexArray[idx].push_back(avVtx.z);
+ if (kvVertexElements[idx] == 4)
+ mvVertexArray[idx].push_back(1);
+}
+
+//-----------------------------------------------------------------------
+
+void VertexBufferTGL::AddColor(tVertexFlag aType, const cColor &aColor) {
+ int idx = cMath::Log2ToInt((int)aType);
+
+ mvVertexArray[idx].push_back(aColor.r);
+ mvVertexArray[idx].push_back(aColor.g);
+ mvVertexArray[idx].push_back(aColor.b);
+ mvVertexArray[idx].push_back(aColor.a);
+}
+
+//-----------------------------------------------------------------------
+
+void VertexBufferTGL::AddIndex(unsigned int alIndex) {
+ mvIndexArray.push_back(alIndex);
+}
+
+//-----------------------------------------------------------------------
+
+bool VertexBufferTGL::Compile(tVertexCompileFlag aFlags) {
+ if (aFlags & eVertexCompileFlag_CreateTangents) {
+ mbTangents = true;
+
+ mVertexFlags |= eVertexFlag_Texture1;
+
+ int idx = cMath::Log2ToInt((int)eVertexFlag_Texture1);
+
+ int lSize = GetVertexNum() * 4;
+ mvVertexArray[idx].resize(lSize);
+
+ cMath::CreateTriTangentVectors(&(mvVertexArray[cMath::Log2ToInt((int)eVertexFlag_Texture1)][0]),
+ &mvIndexArray[0], GetIndexNum(),
+
+ &(mvVertexArray[cMath::Log2ToInt((int)eVertexFlag_Position)][0]),
+ kvVertexElements[cMath::Log2ToInt((int)eVertexFlag_Position)],
+
+ &(mvVertexArray[cMath::Log2ToInt((int)eVertexFlag_Texture0)][0]),
+ &(mvVertexArray[cMath::Log2ToInt((int)eVertexFlag_Normal)][0]),
+ GetVertexNum());
+ }
+
+ return true;
+}
+
+//-----------------------------------------------------------------------
+
+void VertexBufferTGL::UpdateData(tVertexFlag aTypes, bool abIndices) {
+}
+
+//-----------------------------------------------------------------------
+
+void VertexBufferTGL::CreateShadowDouble(bool abUpdateData) {
+ int lIdx = cMath::Log2ToInt(eVertexFlag_Position);
+
+ // Set to new size.
+ int lSize = (int)mvVertexArray[lIdx].size();
+ mvVertexArray[lIdx].reserve(lSize * 2);
+
+ int lCount = lSize / 4;
+ for (int i = 0; i < lCount; i++) {
+ mvVertexArray[lIdx].push_back(mvVertexArray[lIdx][i * 4 + 0]);
+ mvVertexArray[lIdx].push_back(mvVertexArray[lIdx][i * 4 + 1]);
+ mvVertexArray[lIdx].push_back(mvVertexArray[lIdx][i * 4 + 2]);
+ mvVertexArray[lIdx].push_back(0); // 0);
+ }
+
+ mbHasShadowDouble = true;
+
+ if (abUpdateData) {
+ UpdateData(eVertexFlag_Position, false);
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void VertexBufferTGL::Transform(const cMatrixf &a_mtxTransform) {
+ float *pPosArray = GetArray(eVertexFlag_Position);
+ float *pNormalArray = GetArray(eVertexFlag_Normal);
+ float *pTangentArray = NULL;
+ if (mbTangents)
+ pTangentArray = GetArray(eVertexFlag_Texture1);
+
+ int lVtxNum = GetVertexNum();
+
+ cMatrixf mtxRot = a_mtxTransform.GetRotation();
+
+ int lVtxStride = kvVertexElements[cMath::Log2ToInt(eVertexFlag_Position)];
+
+ int lOffset = GetVertexNum() * 4;
+
+ for (int i = 0; i < lVtxNum; i++) {
+ float *pPos = &pPosArray[i * lVtxStride];
+ float *pNorm = &pNormalArray[i * 3];
+ float *pTan = NULL;
+ if (mbTangents)
+ pTan = &pTangentArray[i * 4];
+
+ cVector3f vPos = cMath::MatrixMul(a_mtxTransform, cVector3f(pPos[0], pPos[1], pPos[2]));
+ pPos[0] = vPos.x;
+ pPos[1] = vPos.y;
+ pPos[2] = vPos.z;
+
+ if (mbHasShadowDouble) {
+ float *pExtraPos = &pPosArray[i * lVtxStride + lOffset];
+ pExtraPos[0] = vPos.x;
+ pExtraPos[1] = vPos.y;
+ pExtraPos[2] = vPos.z;
+ }
+
+ cVector3f vNorm = cMath::MatrixMul(mtxRot, cVector3f(pNorm[0], pNorm[1], pNorm[2]));
+ vNorm.Normalise();
+ pNorm[0] = vNorm.x;
+ pNorm[1] = vNorm.y;
+ pNorm[2] = vNorm.z;
+
+ if (mbTangents) {
+ cVector3f vTan = cMath::MatrixMul(mtxRot, cVector3f(pTan[0], pTan[1], pTan[2]));
+ vTan.Normalise();
+ pTan[0] = vTan.x;
+ pTan[1] = vTan.y;
+ pTan[2] = vTan.z;
+ }
+ }
+
+ if (mbTangents)
+ UpdateData(eVertexFlag_Position | eVertexFlag_Normal | eVertexFlag_Texture1, false);
+ else
+ UpdateData(eVertexFlag_Position | eVertexFlag_Normal, false);
+}
+
+//-----------------------------------------------------------------------
+
+void VertexBufferTGL::Draw(eVertexBufferDrawType aDrawType) {
+ eVertexBufferDrawType drawType = aDrawType == eVertexBufferDrawType_LastEnum ? mDrawType : aDrawType;
+
+ ///////////////////////////////
+ //Get the draw type
+ TGLenum mode = TGL_TRIANGLES;
+ if(drawType==eVertexBufferDrawType_Quad) mode = TGL_QUADS;
+ else if(drawType==eVertexBufferDrawType_Lines) mode = TGL_LINE_STRIP;
+
+
+ int lSize = mlElementNum;
+ if(mlElementNum<0) lSize = GetIndexNum();
+
+ tglDrawElements(mode,lSize,TGL_UNSIGNED_INT, &mvIndexArray[0]);
+}
+
+void VertexBufferTGL::DrawIndices(unsigned int *apIndices, int alCount,
+ eVertexBufferDrawType aDrawType) {
+ eVertexBufferDrawType drawType = aDrawType == eVertexBufferDrawType_LastEnum ? mDrawType : aDrawType;
+
+ ///////////////////////////////
+ //Get the draw type
+ TGLenum mode = TGL_TRIANGLES;
+ if(drawType==eVertexBufferDrawType_Quad) mode = TGL_QUADS;
+ else if(drawType==eVertexBufferDrawType_Lines) mode = TGL_LINE_STRIP;
+
+ //////////////////////////////////
+ //Bind and draw the buffer
+ tglDrawElements(mode, alCount, TGL_UNSIGNED_INT, apIndices);
+}
+
+//-----------------------------------------------------------------------
+
+void VertexBufferTGL::Bind() {
+ SetVertexStates(mVertexFlags);
+}
+
+//-----------------------------------------------------------------------
+
+void VertexBufferTGL::UnBind() {
+}
+
+//-----------------------------------------------------------------------
+
+iVertexBuffer *VertexBufferTGL::CreateCopy(eVertexBufferUsageType aUsageType) {
+ VertexBufferTGL *pVtxBuff = hplNew(VertexBufferTGL, (mpLowLevelGraphics,
+ mVertexFlags, mDrawType, aUsageType,
+ GetVertexNum(), GetIndexNum()));
+
+ // Copy the vertices to the new buffer.
+ for (int i = 0; i < klNumOfVertexFlags; i++) {
+ if (kvVertexFlags[i] & mVertexFlags) {
+#if 0
+ int lElements = kvVertexElements[i];
+ if (mbTangents && kvVertexFlags[i] == eVertexFlag_Texture1)
+ lElements = 4;
+#endif
+
+ pVtxBuff->ResizeArray(kvVertexFlags[i], (int)mvVertexArray[i].size());
+
+ memcpy(pVtxBuff->GetArray(kvVertexFlags[i]),
+ &mvVertexArray[i][0], mvVertexArray[i].size() * sizeof(float));
+ }
+ }
+
+ // Copy indices to the new buffer
+ pVtxBuff->ResizeIndices(GetIndexNum());
+ memcpy(pVtxBuff->GetIndices(), GetIndices(), GetIndexNum() * sizeof(unsigned int));
+
+ pVtxBuff->mbTangents = mbTangents;
+ pVtxBuff->mbHasShadowDouble = mbHasShadowDouble;
+
+ pVtxBuff->Compile(0);
+
+ return pVtxBuff;
+}
+
+//-----------------------------------------------------------------------
+
+cBoundingVolume VertexBufferTGL::CreateBoundingVolume() {
+ cBoundingVolume bv;
+
+ int lNum = cMath::Log2ToInt((int)eVertexFlag_Position);
+
+ bv.AddArrayPoints(&(mvVertexArray[lNum][0]), GetVertexNum());
+ bv.CreateFromPoints(kvVertexElements[cMath::Log2ToInt(eVertexFlag_Position)]);
+
+ return bv;
+}
+
+float *VertexBufferTGL::GetArray(tVertexFlag aType) {
+ int idx = cMath::Log2ToInt((int)aType);
+
+ return &mvVertexArray[idx][0];
+}
+
+//-----------------------------------------------------------------------
+
+unsigned int *VertexBufferTGL::GetIndices() {
+ return &mvIndexArray[0];
+}
+
+//-----------------------------------------------------------------------
+
+void VertexBufferTGL::ResizeArray(tVertexFlag aType, int alSize) {
+ int idx = cMath::Log2ToInt((int)aType);
+
+ mvVertexArray[idx].resize(alSize);
+}
+
+//-----------------------------------------------------------------------
+
+void VertexBufferTGL::ResizeIndices(int alSize) {
+ mvIndexArray.resize(alSize);
+}
+
+//-----------------------------------------------------------------------
+
+int VertexBufferTGL::GetVertexNum() {
+ int idx = cMath::Log2ToInt((int)eVertexFlag_Position);
+ int lSize = (int)mvVertexArray[idx].size() / kvVertexElements[idx];
+
+ // If there is a shadow double, just return the length of the first half.
+ if (mbHasShadowDouble)
+ return lSize / 2;
+ else
+ return lSize;
+}
+
+int VertexBufferTGL::GetIndexNum() {
+ return (int)mvIndexArray.size();
+}
+
+cVector3f VertexBufferTGL::GetVector3(tVertexFlag aType, unsigned alIdx) {
+ if (!(aType & mVertexFlags))
+ return cVector3f(0, 0, 0);
+
+ int idx = cMath::Log2ToInt((int)aType);
+ int pos = alIdx * kvVertexElements[idx];
+
+ return cVector3f(mvVertexArray[idx][pos + 0], mvVertexArray[idx][pos + 1],
+ mvVertexArray[idx][pos + 2]);
+}
+cVector3f VertexBufferTGL::GetVector4(tVertexFlag aType, unsigned alIdx) {
+ if (!(aType & mVertexFlags))
+ return cVector3f(0, 0, 0);
+
+ int idx = cMath::Log2ToInt((int)aType);
+ int pos = alIdx * 4; // kvVertexElements[idx];
+
+ return cVector3f(mvVertexArray[idx][pos + 0], mvVertexArray[idx][pos + 1],
+ mvVertexArray[idx][pos + 2]);
+}
+cColor VertexBufferTGL::GetColor(tVertexFlag aType, unsigned alIdx) {
+ if (!(aType & mVertexFlags))
+ return cColor();
+
+ int idx = cMath::Log2ToInt((int)aType);
+ int pos = alIdx * kvVertexElements[idx];
+
+ return cColor(mvVertexArray[idx][pos + 0], mvVertexArray[idx][pos + 1],
+ mvVertexArray[idx][pos + 2], mvVertexArray[idx][pos + 3]);
+}
+unsigned int VertexBufferTGL::GetIndex(tVertexFlag aType, unsigned alIdx) {
+ return mvIndexArray[alIdx];
+}
+
+//-----------------------------------------------------------------------
+
+/////////////////////////////////////////////////////////////////////////
+// PRIVATE METHODS
+/////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------
+
+void VertexBufferTGL::SetVertexStates(tVertexFlag aFlags) {
+ /// POSITION /////////////////////////
+ if(aFlags & eVertexFlag_Position){
+ tglEnableClientState(TGL_VERTEX_ARRAY);
+ int idx = cMath::Log2ToInt(eVertexFlag_Position);
+ tglVertexPointer(kvVertexElements[idx],TGL_FLOAT, sizeof(float)*kvVertexElements[idx], &mvVertexArray[idx][0]);
+ }
+ else
+ {
+ tglDisableClientState(TGL_VERTEX_ARRAY);
+ }
+
+ /// COLOR 0 /////////////////////////
+ if(aFlags & eVertexFlag_Color0)
+ {
+ tglEnableClientState(TGL_COLOR_ARRAY);
+ int idx = cMath::Log2ToInt(eVertexFlag_Color0);
+ tglColorPointer(kvVertexElements[idx],TGL_FLOAT, sizeof(float)*kvVertexElements[idx], &mvVertexArray[idx][0]);
+ }
+ else
+ {
+ tglDisableClientState(TGL_COLOR_ARRAY);
+ }
+
+ /// NORMAL /////////////////////////
+ if(aFlags & eVertexFlag_Normal)
+ {
+ tglEnableClientState(TGL_NORMAL_ARRAY);
+ tglNormalPointer(TGL_FLOAT, sizeof(float)*3, &mvVertexArray[cMath::Log2ToInt(eVertexFlag_Normal)][0]);
+ }
+ else
+ {
+ tglDisableClientState(TGL_NORMAL_ARRAY);
+ }
+
+ /// TEXTURE 0 /////////////////////////
+ if(aFlags & eVertexFlag_Texture0)
+ {
+ tglEnableClientState(TGL_TEXTURE_COORD_ARRAY);
+ int idx = cMath::Log2ToInt(eVertexFlag_Texture0);
+ tglTexCoordPointer(kvVertexElements[idx],TGL_FLOAT,sizeof(float)*kvVertexElements[idx],&mvVertexArray[idx][0]);
+ }
+ else {
+ tglDisableClientState(TGL_TEXTURE_COORD_ARRAY);
+ }
+#if 0
+ /// TEXTURE 1 /////////////////////////
+ if(aFlags & eVertexFlag_Texture1){
+ tglClientActiveTextureARB(TGL_TEXTURE1_ARB);
+ tglEnableClientState(TGL_TEXTURE_COORD_ARRAY);
+ int idx = cMath::Log2ToInt(eVertexFlag_Texture1);
+
+ if(mbTangents)
+ tglTexCoordPointer(4,TGL_FLOAT,sizeof(float)*4,&mvVertexArray[idx][0]);
+ else
+ tglTexCoordPointer(kvVertexElements[idx],TGL_FLOAT,sizeof(float)*kvVertexElements[idx],&mvVertexArray[idx][0]);
+ }
+ else {
+ //tglClientActiveTextureARB(TGL_TEXTURE1_ARB);
+ //tglDisableClientState(TGL_TEXTURE_COORD_ARRAY);
+ }
+
+ /// TEXTURE 2 /////////////////////////
+ if(aFlags & eVertexFlag_Texture2){
+ tglClientActiveTextureARB(TGL_TEXTURE2_ARB);
+ tglEnableClientState(TGL_TEXTURE_COORD_ARRAY);
+ int idx = cMath::Log2ToInt(eVertexFlag_Texture2);
+ tglTexCoordPointer(kvVertexElements[idx],TGL_FLOAT,sizeof(float)*kvVertexElements[idx],&mvVertexArray[idx][0]);
+ }
+ else {
+ //tglClientActiveTextureARB(TGL_TEXTURE2_ARB);
+ //tglDisableClientState(TGL_TEXTURE_COORD_ARRAY);
+ }
+
+ /// TEXTURE 3 /////////////////////////
+ if(aFlags & eVertexFlag_Texture3){
+ tglClientActiveTextureARB(TGL_TEXTURE3_ARB);
+ tglEnableClientState(TGL_TEXTURE_COORD_ARRAY);
+ int idx = cMath::Log2ToInt(eVertexFlag_Texture3);
+ tglTexCoordPointer(kvVertexElements[idx],TGL_FLOAT,sizeof(float)*kvVertexElements[idx],&mvVertexArray[idx][0]);
+ }
+ else {
+ //tglClientActiveTextureARB(TGL_TEXTURE3_ARB);
+ //tglDisableClientState(TGL_TEXTURE_COORD_ARRAY);
+ }
+
+ /// TEXTURE 4 /////////////////////////
+ if(aFlags & eVertexFlag_Texture4){
+ tglClientActiveTextureARB(TGL_TEXTURE4_ARB);
+ tglEnableClientState(TGL_TEXTURE_COORD_ARRAY);
+ int idx = cMath::Log2ToInt(eVertexFlag_Texture4);
+ tglTexCoordPointer(kvVertexElements[idx],TGL_FLOAT,sizeof(float)*kvVertexElements[idx],&mvVertexArray[idx][0]);
+ }
+ else {
+ //tglClientActiveTextureARB(TGL_TEXTURE4_ARB);
+ //tglDisableClientState(TGL_TEXTURE_COORD_ARRAY);
+ }
+#endif
+}
+
+//-----------------------------------------------------------------------
+
+} // namespace hpl
\ No newline at end of file
diff --git a/engines/hpl1/engine/impl/vertex_buffer_tgl.h b/engines/hpl1/engine/impl/vertex_buffer_tgl.h
new file mode 100644
index 00000000000..e9e31221f6a
--- /dev/null
+++ b/engines/hpl1/engine/impl/vertex_buffer_tgl.h
@@ -0,0 +1,86 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL_VERTEXBUFFER_TGL_H
+#define HPL_VERTEXBUFFER_TGL_H
+
+#include "hpl1/engine/graphics/VertexBuffer.h"
+
+namespace hpl {
+
+class VertexBufferTGL : public iVertexBuffer {
+public:
+ VertexBufferTGL(iLowLevelGraphics *apLowLevelGraphics, tVertexFlag aFlags,
+ eVertexBufferDrawType aDrawType, eVertexBufferUsageType aUsageType,
+ int alReserveVtxSize, int alReserveIdxSize);
+ ~VertexBufferTGL();
+
+ void AddVertex(tVertexFlag aType, const cVector3f &avVtx);
+ void AddColor(tVertexFlag aType, const cColor &aColor);
+ void AddIndex(unsigned int alIndex);
+
+ bool Compile(tVertexCompileFlag aFlags);
+ void UpdateData(tVertexFlag aTypes, bool abIndices);
+
+ void CreateShadowDouble(bool abUpdateData);
+
+ void Transform(const cMatrixf &mtxTransform);
+
+ void Draw(eVertexBufferDrawType aDrawType);
+ void DrawIndices(unsigned int *apIndices, int alCount,
+ eVertexBufferDrawType aDrawType = eVertexBufferDrawType_LastEnum);
+
+ void Bind();
+ void UnBind();
+
+ iVertexBuffer *CreateCopy(eVertexBufferUsageType aUsageType);
+
+ cBoundingVolume CreateBoundingVolume();
+
+ float *GetArray(tVertexFlag aType);
+ unsigned int *GetIndices();
+
+ void ResizeArray(tVertexFlag aType, int alSize);
+ void ResizeIndices(int alSize);
+
+ // For debugging purposes
+ int GetVertexNum();
+ int GetIndexNum();
+
+ cVector3f GetVector3(tVertexFlag aType, unsigned alIdx);
+ cVector3f GetVector4(tVertexFlag aType, unsigned alIdx);
+ cColor GetColor(tVertexFlag aType, unsigned alIdx);
+ unsigned int GetIndex(tVertexFlag aType, unsigned alIdx);
+
+private:
+ void SetVertexStates(tVertexFlag aFlags);
+
+ tFloatVec mvVertexArray[klNumOfVertexFlags];
+ tUIntVec mvIndexArray;
+
+ bool mbTangents;
+
+ bool mbHasShadowDouble;
+};
+
+} // namespace hpl
+
+#endif // HPL_RENDERER3D_OGL_H
\ No newline at end of file
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index eec7aa2cd57..0e730a3307e 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -98,6 +98,9 @@ MODULE_OBJS := \
engine/impl/CollideShapeNewton.o \
engine/impl/KeyboardSDL.o \
engine/impl/LowLevelGraphicsSDL.o \
+ engine/impl/low_level_graphics_tgl.o \
+ engine/impl/texture_tgl.o \
+ engine/impl/vertex_buffer_tgl.o \
engine/impl/LowLevelInputSDL.o \
engine/impl/LowLevelPhysicsNewton.o \
engine/impl/LowLevelSoundOpenAL.o \
diff --git a/graphics/tinygl/init.cpp b/graphics/tinygl/init.cpp
index 6da5037c897..553e7e43ce4 100644
--- a/graphics/tinygl/init.cpp
+++ b/graphics/tinygl/init.cpp
@@ -261,7 +261,7 @@ void GLContext::init(int screenW, int screenH, Graphics::PixelFormat pixelFormat
// color mask
color_mask_red = color_mask_green = color_mask_blue = color_mask_alpha = true;
- const int kDrawCallMemory = 5 * 1024 * 1024;
+ const size_t kDrawCallMemory = 1024 * 1024 * 1024;
_currentAllocatorIndex = 0;
_drawCallAllocator[0].initialize(kDrawCallMemory);
Commit: 6474ec9c6cf3c0fe2ff9b24762cddaeb03f50e1f
https://github.com/scummvm/scummvm/commit/6474ec9c6cf3c0fe2ff9b24762cddaeb03f50e1f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:03+01:00
Commit Message:
HPL1: remove hardcoded screen size values
Changed paths:
engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
diff --git a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
index 9d517fd907a..50c07de62d7 100644
--- a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
+++ b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
@@ -379,7 +379,7 @@ void LowLevelGraphicsTGL::SetupGL() {
// Set Shade model and clear color.
tglShadeModel(TGL_SMOOTH);
tglClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- tglViewport(0, 0, 800, 600);
+ tglViewport(0, 0, mvScreenSize.x, mvScreenSize.y);
// Depth Test setup
tglClearDepth(1.0f); // VAlues buffer is cleared with
Commit: 63aa82a6b2f91c67181d826d2082c54f28ba5c89
https://github.com/scummvm/scummvm/commit/63aa82a6b2f91c67181d826d2082c54f28ba5c89
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:04+01:00
Commit Message:
HPL1: cleanup software low level gfx class
Changed paths:
engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
diff --git a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
index 50c07de62d7..dc36e6515f4 100644
--- a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
+++ b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
@@ -508,10 +508,7 @@ cPlanef LowLevelGraphicsTGL::GetClipPlane(int alIdx, const cPlanef &aPlane) {
}
void LowLevelGraphicsTGL::SetClipPlaneActive(int alIdx, bool toggle) {
- if (toggle)
- tglEnable(TGL_CLIP_PLANE0 + alIdx);
- else
- tglDisable(TGL_CLIP_PLANE0 + alIdx);
+ HPL1_UNIMPLEMENTED(LowLevelGraphicsTGL::SetClipPlaneActive);
}
//-----------------------------------------------------------------------
@@ -763,9 +760,8 @@ void LowLevelGraphicsTGL::SwapBuffers() {
TinyGL::presentBuffer();
Graphics::Surface glBuffer;
TinyGL::getSurfaceRef(glBuffer);
- glBuffer.debugPrint();
g_system->copyRectToScreen(glBuffer.getPixels(), glBuffer.pitch,
- 0, 0, mvScreenSize.x, mvScreenSize.y);
+ 0, 0, glBuffer.w, glBuffer.h);
g_system->updateScreen();
}
Commit: 5b2f89bd0d1d512efb56763c09a92ae799515c30
https://github.com/scummvm/scummvm/commit/5b2f89bd0d1d512efb56763c09a92ae799515c30
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:04+01:00
Commit Message:
HPL1: fix buffer drawing for software renderer
Changed paths:
engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
diff --git a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
index dc36e6515f4..24b41f1e91b 100644
--- a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
+++ b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
@@ -342,7 +342,7 @@ bool LowLevelGraphicsTGL::Init(int alWidth, int alHeight, int alBpp, int abFulls
mlBpp = alBpp;
mlMultisampling = alMultisampling;
- initGraphics(alWidth, alHeight);
+ initGraphics(alWidth, alHeight, nullptr);
TinyGL::createContext(alWidth, alHeight, mpPixelFormat, 256, false);
SetupGL();
ShowCursor(false);
Commit: cdbaf974612c2b1f9b2b182d38e27c663e4b4a2a
https://github.com/scummvm/scummvm/commit/cdbaf974612c2b1f9b2b182d38e27c663e4b4a2a
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:04:04+01:00
Commit Message:
HPL1: Silence compiler warning
Changed paths:
engines/hpl1/penumbra-overture/GameLiquidArea.cpp
diff --git a/engines/hpl1/penumbra-overture/GameLiquidArea.cpp b/engines/hpl1/penumbra-overture/GameLiquidArea.cpp
index 0074a8190bb..99fcfa1f57c 100644
--- a/engines/hpl1/penumbra-overture/GameLiquidArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameLiquidArea.cpp
@@ -172,7 +172,7 @@ void cGameLiquidArea::Update(float afTimeStep) {
while (bodyIt.HasNext()) {
iPhysicsBody *pBody = static_cast<iPhysicsBody *>(bodyIt.Next());
- /*iGameEntity *pEntity = */(iGameEntity *)pBody->GetUserData();
+ /*iGameEntity *pEntity = (iGameEntity *)*/pBody->GetUserData();
if (pBody->GetCollide() && pBody->IsActive()) {
if (pBody->GetMass() == 0 && pBody->IsCharacter() == false)
Commit: 0bcf354fdc6a2ae42831b858b787ab7dbbbf9830
https://github.com/scummvm/scummvm/commit/0bcf354fdc6a2ae42831b858b787ab7dbbbf9830
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-12-23T14:04:04+01:00
Commit Message:
HPL1: Silence warning
Changed paths:
engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
diff --git a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
index 24b41f1e91b..b1c6be6f830 100644
--- a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
+++ b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
@@ -713,7 +713,7 @@ void LowLevelGraphicsTGL::SetTextureEnv(eTextureParam aParam, int alVal) {
//-----------------------------------------------------------------------
void LowLevelGraphicsTGL::SetTextureConstantColor(const cColor &color) {
- float vColor[] = {color.r, color.g, color.b, color.a};
+ //float vColor[] = {color.r, color.g, color.b, color.a};
//tglTexEnvfv(TGL_TEXTURE_ENV, TGL_TEXTURE_ENV_COLOR, &vColor[0]);
}
Commit: 6612ec03a727e877af1e93fe4d18cdc04ca05cb0
https://github.com/scummvm/scummvm/commit/6612ec03a727e877af1e93fe4d18cdc04ca05cb0
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:04+01:00
Commit Message:
HPL1: Fix Some GCC Shadowing Warnings in Newton Physics Library Core Code
These are emitted when -Wshadow is passed to GCC.
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp b/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
index 85f3acc855d..a1f9681f297 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
@@ -1730,9 +1730,11 @@ dgIntersectStatus dgAABBPolygonSoup::CalculateAllFaceEdgeNormals(void *context,
AdjacentdFaces adjacentFaces;
adjacentFaces.m_count = indexCount;
adjacentFaces.m_index = (dgInt32*) indexArray;
- dgVector n(&polygon[indexArray[indexCount] * stride]);
- dgVector p(&polygon[indexArray[0] * stride]);
- adjacentFaces.m_normal = dgPlane(n, -(n % p));
+ {
+ dgVector n(&polygon[indexArray[indexCount] * stride]);
+ dgVector p(&polygon[indexArray[0] * stride]);
+ adjacentFaces.m_normal = dgPlane(n, -(n % p));
+ }
_ASSERTE(indexCount < dgInt32 (sizeof (adjacentFaces.m_edgeMap) / sizeof (adjacentFaces.m_edgeMap[0])));
@@ -1774,12 +1776,12 @@ dgIntersectStatus dgAABBPolygonSoup::CalculateAllFaceEdgeNormals(void *context,
dgFloat32 dgAABBPolygonSoup::CalculateFaceMaxSize(dgTriplex* const vertex, dgInt32 indexCount, const dgInt32* const indexArray) const
{
dgFloat32 maxSize = dgFloat32(0.0f);
- dgInt32 index = indexArray[indexCount - 1];
- dgVector p0(vertex[index].m_x, vertex[index].m_y, vertex[index].m_z, dgFloat32(0.0f));
+ dgInt32 indexPZero = indexArray[indexCount - 1];
+ dgVector p0(vertex[indexPZero].m_x, vertex[indexPZero].m_y, vertex[indexPZero].m_z, dgFloat32(0.0f));
for (dgInt32 i = 0; i < indexCount; i++)
{
- dgInt32 index = indexArray[i];
- dgVector p1(vertex[index].m_x, vertex[index].m_y, vertex[index].m_z, dgFloat32(0.0f));
+ dgInt32 indexPOne = indexArray[i];
+ dgVector p1(vertex[indexPOne].m_x, vertex[indexPOne].m_y, vertex[indexPOne].m_z, dgFloat32(0.0f));
dgVector dir(p1 - p0);
dir = dir.Scale(dgRsqrt (dir % dir));
@@ -1788,8 +1790,8 @@ dgFloat32 dgAABBPolygonSoup::CalculateFaceMaxSize(dgTriplex* const vertex, dgInt
dgFloat32 minVal = dgFloat32(1.0e10f);
for (dgInt32 j = 0; j < indexCount; j++)
{
- dgInt32 index = indexArray[j];
- dgVector q(vertex[index].m_x, vertex[index].m_y, vertex[index].m_z, dgFloat32(0.0f));
+ dgInt32 indexQ = indexArray[j];
+ dgVector q(vertex[indexQ].m_x, vertex[indexQ].m_y, vertex[indexQ].m_z, dgFloat32(0.0f));
dgFloat32 val = dir % q;
minVal = GetMin(minVal, val);
maxVal = GetMax(maxVal, val);
Commit: 5d4819583d4ca7c1181a5748d32c07db6032428d
https://github.com/scummvm/scummvm/commit/5d4819583d4ca7c1181a5748d32c07db6032428d
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:04+01:00
Commit Message:
HPL1: Fixes for Shadowing Warnings in Newton Convex Hull 3D Code
This also has several formatting fixes for the code to avoid misleading
indentation which gives a confusing sense of scope.
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.cpp b/engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.cpp
index 899960e24f1..a623771f01b 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.cpp
@@ -344,14 +344,14 @@ dgInt32 dgConvexHull3d::InitVertexArray(dgHullVertex* const points, const dgFloa
bool validTetrahedrum = false;
dgBigVector e1 (dgFloat64 (0.0f), dgFloat64 (0.0f), dgFloat64 (0.0f), dgFloat64 (0.0f)) ;
for (dgInt32 i = 1; i < normalCount; i ++) {
- dgInt32 index = SupportVertex (&tree, points, normalArray[i]);
- _ASSERTE (index >= 0);
+ dgInt32 indexSV = SupportVertex (&tree, points, normalArray[i]);
+ _ASSERTE (indexSV >= 0);
- e1 = points[index] - m_points[0];
+ e1 = points[indexSV] - m_points[0];
dgFloat64 error2 = e1 % e1;
if (error2 > (dgFloat32 (1.0e-4f) * m_diag * m_diag)) {
- m_points[1] = points[index];
- points[index].m_index = 1;
+ m_points[1] = points[indexSV];
+ points[indexSV].m_index = 1;
validTetrahedrum = true;
break;
}
@@ -366,14 +366,14 @@ dgInt32 dgConvexHull3d::InitVertexArray(dgHullVertex* const points, const dgFloa
dgBigVector e2(dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f));;
dgBigVector normal (dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f));
for (dgInt32 i = 2; i < normalCount; i ++) {
- dgInt32 index = SupportVertex (&tree, points, normalArray[i]);
- _ASSERTE (index >= 0);
- e2 = points[index] - m_points[0];
+ dgInt32 indexSV = SupportVertex (&tree, points, normalArray[i]);
+ _ASSERTE (indexSV >= 0);
+ e2 = points[indexSV] - m_points[0];
normal = e1 * e2;
dgFloat64 error2 = sqrt (normal % normal);
if (error2 > (dgFloat32 (1.0e-4f) * m_diag * m_diag)) {
- m_points[2] = points[index];
- points[index].m_index = 1;
+ m_points[2] = points[indexSV];
+ points[indexSV].m_index = 1;
validTetrahedrum = true;
break;
}
@@ -400,28 +400,28 @@ dgInt32 dgConvexHull3d::InitVertexArray(dgHullVertex* const points, const dgFloa
}
if (!validTetrahedrum) {
dgVector n (normal.Scale(dgFloat64 (-1.0f)));
- dgInt32 index = SupportVertex (&tree, points, n);
- e3 = points[index] - m_points[0];
- dgFloat64 error2 = normal % e3;
- if (fabs (error2) > (dgFloat64 (1.0e-6f) * m_diag * m_diag)) {
+ dgInt32 indexSV = SupportVertex (&tree, points, n);
+ e3 = points[indexSV] - m_points[0];
+ dgFloat64 error2n = normal % e3;
+ if (fabs (error2n) > (dgFloat64 (1.0e-6f) * m_diag * m_diag)) {
// we found a valid tetrahedra, about and start build the hull by adding the rest of the points
- m_points[3] = points[index];
- points[index].m_index = 1;
+ m_points[3] = points[indexSV];
+ points[indexSV].m_index = 1;
validTetrahedrum = true;
}
}
if (!validTetrahedrum) {
for (dgInt32 i = 3; i < normalCount; i ++) {
- dgInt32 index = SupportVertex (&tree, points, normalArray[i]);
- _ASSERTE (index >= 0);
+ dgInt32 indexSV = SupportVertex (&tree, points, normalArray[i]);
+ _ASSERTE (indexSV >= 0);
//make sure the volume of the fist tetrahedral is no negative
- e3 = points[index] - m_points[0];
- dgFloat64 error2 = normal % e3;
- if (fabs (error2) > (dgFloat64 (1.0e-6f) * m_diag * m_diag)) {
+ e3 = points[indexSV] - m_points[0];
+ dgFloat64 error2n = normal % e3;
+ if (fabs (error2n) > (dgFloat64 (1.0e-6f) * m_diag * m_diag)) {
// we found a valid tetrahedra, about and start build the hull by adding the rest of the points
- m_points[3] = points[index];
- points[index].m_index = 1;
+ m_points[3] = points[indexSV];
+ points[indexSV].m_index = 1;
validTetrahedrum = true;
break;
}
@@ -749,22 +749,22 @@ void dgConvexHull3d::CalculateConvexHull (dgAABBPointTree3d* vertexTree, dgHullV
while (stackIndex) {
stackIndex --;
- dgListNode* const node = stack[stackIndex];
- dgConvexHull3DFace* const face = &node->GetInfo();
+ dgListNode* const stackNode = stack[stackIndex];
+ dgConvexHull3DFace* const stackFace = &stackNode->GetInfo();
- if (!face->m_mark && (face->Evalue(&m_points[0], p) > dgFloat64(0.0f))) {
+ if (!stackFace->m_mark && (stackFace->Evalue(&m_points[0], p) > dgFloat64(0.0f))) {
#ifdef _DEBUG
for (dgInt32 i = 0; i < deletedCount; i ++) {
- _ASSERTE (deleteList[i] != node);
+ _ASSERTE (deleteList[i] != stackNode);
}
#endif
- deleteList[deletedCount] = node;
+ deleteList[deletedCount] = stackNode;
deletedCount ++;
_ASSERTE (deletedCount < dgInt32 (deleteListPool.GetElementsCount()));
- face->m_mark = 1;
+ stackFace->m_mark = 1;
for (dgInt32 i = 0; i < 3; i ++) {
- dgListNode* const twinNode = (dgListNode*)face->m_twin[i];
+ dgListNode* const twinNode = (dgListNode*)stackFace->m_twin[i];
_ASSERTE (twinNode);
dgConvexHull3DFace* const twinFace = &twinNode->GetInfo();
if (!twinFace->m_mark) {
@@ -782,21 +782,21 @@ void dgConvexHull3d::CalculateConvexHull (dgAABBPointTree3d* vertexTree, dgHullV
dgInt32 newCount = 0;
for (dgInt32 i = 0; i < deletedCount; i ++) {
- dgListNode* const node = deleteList[i];
- dgConvexHull3DFace* const face = &node->GetInfo();
- _ASSERTE (face->m_mark == 1);
+ dgListNode* const deleteNode = deleteList[i];
+ dgConvexHull3DFace* const deleteFace = &deleteNode->GetInfo();
+ _ASSERTE (deleteFace->m_mark == 1);
for (dgInt32 j0 = 0; j0 < 3; j0 ++) {
- dgListNode* const twinNode = face->m_twin[j0];
+ dgListNode* const twinNode = deleteFace->m_twin[j0];
dgConvexHull3DFace* const twinFace = &twinNode->GetInfo();
if (!twinFace->m_mark) {
dgInt32 j1 = (j0 == 2) ? 0 : j0 + 1;
- dgListNode* const newNode = AddFace (currentIndex, face->m_index[j0], face->m_index[j1]);
+ dgListNode* const newNode = AddFace (currentIndex, deleteFace->m_index[j0], deleteFace->m_index[j1]);
boundaryFaces.Addtop(newNode);
dgConvexHull3DFace* const newFace = &newNode->GetInfo();
newFace->m_twin[1] = twinNode;
for (dgInt32 k = 0; k < 3; k ++) {
- if (twinFace->m_twin[k] == node) {
+ if (twinFace->m_twin[k] == deleteNode) {
twinFace->m_twin[k] = newNode;
}
}
@@ -991,66 +991,67 @@ dgFloat64 dgConvexHull3d::RayCast (const dgBigVector& localP0, const dgBigVector
heap.Push (data, t);
while (heap.GetCount()) {
- const dgConvexHullRayCastData& data = heap[0];
- dgFloat64 t = heap.Value();
- const dgConvexHull3DFace* face = data.m_face;
- dgFloat64 normalDistProjection = data.m_normalProjection;
+ const dgConvexHullRayCastData& heapData = heap[0];
+ dgFloat64 tc = heap.Value();
+ const dgConvexHull3DFace* heapFace = heapData.m_face;
+ dgFloat64 normalDistProjection = heapData.m_normalProjection;
heap.Pop();
bool foundThisBestFace = true;
if (normalDistProjection < dgFloat64 (0.0f)) {
- if (t > t0) {
- t0 = t;
+ if (tc > t0) {
+ t0 = tc;
}
if (t0 > t1) {
- #ifdef DG_SANITY_CHECK_RAYCAST
- dgFloat64 t2 = RayCastBruteForce(localP0, localP1);
- _ASSERTE (fabs (1.2 - t2) < 1.0e-6f);
- #endif
- return dgFloat64 (1.2f);
- }
+#ifdef DG_SANITY_CHECK_RAYCAST
+ dgFloat64 t2 = RayCastBruteForce(localP0, localP1);
+ _ASSERTE (fabs (1.2 - t2) < 1.0e-6f);
+#endif
+ return dgFloat64 (1.2f);
+ }
} else {
foundThisBestFace = false;
}
for (dgInt32 i = 0; i < 3; i ++) {
- const dgConvexHull3DFace* const face1 = &face->m_twin[i]->GetInfo();
+ const dgConvexHull3DFace* const face1 = &heapFace->m_twin[i]->GetInfo();
if (face1->m_mark != m_mark) {
face1->m_mark = m_mark;
- dgConvexHullRayCastData data;
- data.m_face = face1;
- dgFloat64 t = FaceRayCast (face1, localP0, dS, data.m_normalProjection);
- if (data.m_normalProjection >= dgFloat32 (0.0)) {
- t = dgFloat64 (-1.0e30);
- } else if (t >= t0) {
+ dgConvexHullRayCastData newData;
+ newData.m_face = face1;
+ dgFloat64 tn = FaceRayCast (face1, localP0, dS, newData.m_normalProjection);
+ if (newData.m_normalProjection >= dgFloat32 (0.0)) {
+ tn = dgFloat64 (-1.0e30);
+ } else if (tn >= t0) {
foundThisBestFace = false;
- } else if (fabs (t - t0) < dgFloat64 (1.0e-12f)) {
+ } else if (fabs (tn - t0) < dgFloat64 (1.0e-12f)) {
// this convex hull have face that at almost parallel, partial hill climbing will not work
return RayCastBruteForce(localP0, localP1);
+ }
+ heap.Push (newData, tn);
}
- heap.Push (data, t);
}
- }
+
if (foundThisBestFace) {
if ((t0 >= dgFloat64 (0.0f)) && (t0 <= dgFloat64 (1.0f))) {
- #ifdef DG_SANITY_CHECK_RAYCAST
- dgFloat64 t2 = RayCastBruteForce(localP0, localP1);
- _ASSERTE (fabs (t0 - t2) < 1.0e-6f);
- #endif
- if (firstFaceGuess) {
- *firstFaceGuess = face;
- }
+#ifdef DG_SANITY_CHECK_RAYCAST
+ dgFloat64 t2 = RayCastBruteForce(localP0, localP1);
+ _ASSERTE (fabs (t0 - t2) < 1.0e-6f);
+#endif
+ if (firstFaceGuess) {
+ *firstFaceGuess = heapFace;
+ }
return t0;
}
break;
}
}
- #ifdef DG_SANITY_CHECK_RAYCAST
- dgFloat64 t2 = RayCastBruteForce(localP0, localP1);
- _ASSERTE (fabs (1.2f - t2) < 1.0e-6f);
- #endif
+#ifdef DG_SANITY_CHECK_RAYCAST
+ dgFloat64 t2 = RayCastBruteForce(localP0, localP1);
+ _ASSERTE (fabs (1.2f - t2) < 1.0e-6f);
+#endif
return dgFloat64 (1.2f);
}
Commit: c32a471c0c5f22affbde181c43a78dd33a8b6355
https://github.com/scummvm/scummvm/commit/c32a471c0c5f22affbde181c43a78dd33a8b6355
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:04+01:00
Commit Message:
HPL1: Fixes for Shadowing Warnings in Newton Convex Hull 4D Code
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.cpp b/engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.cpp
index f6a3f65701b..eff7908f48f 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.cpp
@@ -219,8 +219,8 @@ dgBigVector dgConvexHull4dTetraherum::CircumSphereCenter(
}
matrix[i][3] = dgGoogol(1.0f);
}
- dgGoogol det(Determinant4x4(matrix));
- dgFloat64 val = det.GetAproximateValue() * sign;
+ dgGoogol detN(Determinant4x4(matrix));
+ dgFloat64 val = detN.GetAproximateValue() * sign;
sign *= dgFloat64(-1.0f);
centerOut[k] = val * invDen;
}
@@ -766,15 +766,15 @@ dgInt32 dgConvexHull4d::InitVertexArray(dgHullVector* const points,
dgFloat64(0.0f));
for (dgInt32 i = 1; i < normalCount; i++)
{
- dgInt32 index = SupportVertex(&tree, points, normalArray[i]);
- _ASSERTE(index >= 0);
- e1 = points[index].Sub4(convexPoints[0]);
+ dgInt32 indexSV = SupportVertex(&tree, points, normalArray[i]);
+ _ASSERTE(indexSV >= 0);
+ e1 = points[indexSV].Sub4(convexPoints[0]);
e1.m_w = dgFloat64(0.0f);
dgFloat64 error2 = e1.DotProduct4(e1);
if (error2 > (dgFloat32(1.0e-4f) * m_diag * m_diag))
{
- convexPoints[1] = points[index];
- points[index].m_mark = 1;
+ convexPoints[1] = points[indexSV];
+ points[indexSV].m_mark = 1;
validTetrahedrum = true;
break;
}
@@ -794,10 +794,10 @@ dgInt32 dgConvexHull4d::InitVertexArray(dgHullVector* const points,
;
for (dgInt32 i = 2; i < normalCount; i++)
{
- dgInt32 index = SupportVertex(&tree, points, normalArray[i]);
- _ASSERTE(index >= 0);
- _ASSERTE(index < count);
- e2 = points[index].Sub4(convexPoints[0]);
+ dgInt32 indexSV = SupportVertex(&tree, points, normalArray[i]);
+ _ASSERTE(indexSV >= 0);
+ _ASSERTE(indexSV < count);
+ e2 = points[indexSV].Sub4(convexPoints[0]);
e2.m_w = dgFloat64(0.0f);
dgFloat64 den = e2.DotProduct4(e2);
if (fabs(den) > (dgFloat64(1.0e-6f) * m_diag))
@@ -808,13 +808,13 @@ dgInt32 dgConvexHull4d::InitVertexArray(dgHullVector* const points,
if (cosAngle < bestValue)
{
bestValue = cosAngle;
- bestIndex = index;
+ bestIndex = indexSV;
}
if (cosAngle < 0.9f)
{
-// convexPoints[2] = points[index];
-// points[index].m_mark = 1;
+// convexPoints[2] = points[indexSV];
+// points[indexSV].m_mark = 1;
// validTetrahedrum = true;
break;
}
@@ -840,17 +840,17 @@ dgInt32 dgConvexHull4d::InitVertexArray(dgHullVector* const points,
;
for (dgInt32 i = 3; i < normalCount; i++)
{
- dgInt32 index = SupportVertex(&tree, points, normalArray[i]);
- _ASSERTE(index >= 0);
- _ASSERTE(index < count);
+ dgInt32 indexSV = SupportVertex(&tree, points, normalArray[i]);
+ _ASSERTE(indexSV >= 0);
+ _ASSERTE(indexSV < count);
- e3 = points[index].Sub4(convexPoints[0]);
+ e3 = points[indexSV].Sub4(convexPoints[0]);
e3.m_w = dgFloat64(0.0f);
dgFloat64 volume = (e1 * e2) % e3;
if (fabs(volume) > (dgFloat64(1.0e-4f) * m_diag * m_diag * m_diag))
{
- convexPoints[3] = points[index];
- points[index].m_mark = 1;
+ convexPoints[3] = points[indexSV];
+ points[indexSV].m_mark = 1;
validTetrahedrum = true;
break;
}
@@ -1195,39 +1195,39 @@ dgConvexHull4d::dgListNode* dgConvexHull4d::FindFacingNode(
while (heap.GetCount())
{
dgListNode* const node = heap[0];
- dgFloat64 dist = heap.Value();
- if (dist > dgFloat64(1.0e-5f))
+ dgFloat64 distN = heap.Value();
+ if (distN > dgFloat64(1.0e-5f))
{
return node;
}
heap.Pop();
- dgConvexHull4dTetraherum* const tetra = &node->GetInfo();
+ dgConvexHull4dTetraherum* const tetraN = &node->GetInfo();
for (dgInt32 i = 0; i < 4; i++)
{
- dgListNode* neigborghNode = tetra->m_faces[i].m_twin;
+ dgListNode* neigborghNode = tetraN->m_faces[i].m_twin;
dgConvexHull4dTetraherum* const neighborgh = &neigborghNode->GetInfo();
if (neighborgh->GetMark() != mark)
{
neighborgh->SetMark(mark);
if (heap.GetCount() >= maxCount)
{
- for (dgInt32 i = 0; i < releafCount; i++)
+ for (dgInt32 j = 0; j < releafCount; j++)
{
heap.Remove(heap.GetCount() - 1);
}
}
- dgConvexHull4dTetraherum::dgTetrahedrumPlane plane(
+ dgConvexHull4dTetraherum::dgTetrahedrumPlane planeN(
neighborgh->GetPlaneEquation(hullVertexArray));
- heap.Push(neigborghNode, plane.Evalue(vertex));
+ heap.Push(neigborghNode, planeN.Evalue(vertex));
}
}
}
for (dgListNode* node = GetFirst(); node; node = node->GetNext())
{
- dgConvexHull4dTetraherum* const tetra = &node->GetInfo();
- dgFloat64 dist = tetra->Evalue(hullVertexArray, vertex);
- if (dist > dgFloat64(0.0f))
+ dgConvexHull4dTetraherum* const tetraN = &node->GetInfo();
+ dgFloat64 distN = tetraN->Evalue(hullVertexArray, vertex);
+ if (distN > dgFloat64(0.0f))
{
return node;
}
Commit: be4e90fa2b61ec814a8700b1dbd1b0831b09bffe
https://github.com/scummvm/scummvm/commit/be4e90fa2b61ec814a8700b1dbd1b0831b09bffe
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:04+01:00
Commit Message:
HPL1: Fix Shadowing GCC Compiler Warnings in Newton Core Matrix Code
This also has some minor fixes to remove trailing whitespace.
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgMatrix.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgMatrix.cpp b/engines/hpl1/engine/libraries/newton/core/dgMatrix.cpp
index d1aed4acc0c..8264e347f25 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgMatrix.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgMatrix.cpp
@@ -645,36 +645,36 @@ void dgMatrix::EigenVectors (dgVector &eigenValues, const dgMatrix& initialGuess
for (dgInt32 j = 0; j <= ip - 1; j ++) {
//ROT (mat, j, ip, j, iq, s, tau);
//ROT(dgMatrix &a, dgInt32 i, dgInt32 j, dgInt32 k, dgInt32 l, dgFloat32 s, dgFloat32 tau)
- dgFloat32 g = mat[j][ip];
- dgFloat32 h = mat[j][iq];
- mat[j][ip] = g - s * (h + g * tau);
- mat[j][iq] = h + s * (g - h * tau);
+ dgFloat32 gg = mat[j][ip];
+ dgFloat32 hh = mat[j][iq];
+ mat[j][ip] = gg - s * (hh + gg * tau);
+ mat[j][iq] = hh + s * (gg - hh * tau);
}
for (dgInt32 j = ip + 1; j <= iq - 1; j ++) {
//ROT (mat, ip, j, j, iq, s, tau);
//ROT(dgMatrix &a, dgInt32 i, dgInt32 j, dgInt32 k, dgInt32 l, dgFloat32 s, dgFloat32 tau)
- dgFloat32 g = mat[ip][j];
- dgFloat32 h = mat[j][iq];
- mat[ip][j] = g - s * (h + g * tau);
- mat[j][iq] = h + s * (g - h * tau);
+ dgFloat32 gg = mat[ip][j];
+ dgFloat32 hh = mat[j][iq];
+ mat[ip][j] = gg - s * (hh + gg * tau);
+ mat[j][iq] = hh + s * (gg - hh * tau);
}
for (dgInt32 j = iq + 1; j < 3; j ++) {
//ROT (mat, ip, j, iq, j, s, tau);
//ROT(dgMatrix &a, dgInt32 i, dgInt32 j, dgInt32 k, dgInt32 l, dgFloat32 s, dgFloat32 tau)
- dgFloat32 g = mat[ip][j];
- dgFloat32 h = mat[iq][j];
- mat[ip][j] = g - s * (h + g * tau);
- mat[iq][j] = h + s * (g - h * tau);
+ dgFloat32 gg = mat[ip][j];
+ dgFloat32 hh = mat[iq][j];
+ mat[ip][j] = gg - s * (hh + gg * tau);
+ mat[iq][j] = hh + s * (gg - hh * tau);
}
for (dgInt32 j = 0; j < 3; j ++) {
//ROT (eigenVectors, j, ip, j, iq, s, tau);
//ROT(dgMatrix &a, dgInt32 i, dgInt32 j, dgInt32 k, dgInt32 l, dgFloat32 s, dgFloat32 tau)
- dgFloat32 g = eigenVectors[j][ip];
- dgFloat32 h = eigenVectors[j][iq];
- eigenVectors[j][ip] = g - s * (h + g * tau);
- eigenVectors[j][iq] = h + s * (g - h * tau);
+ dgFloat32 gg = eigenVectors[j][ip];
+ dgFloat32 hh = eigenVectors[j][iq];
+ eigenVectors[j][ip] = gg - s * (hh + gg * tau);
+ eigenVectors[j][iq] = hh + s * (gg - hh * tau);
}
}
}
Commit: ea7588227db7baf51881ae9e9ca6f06fd543b35a
https://github.com/scummvm/scummvm/commit/ea7588227db7baf51881ae9e9ca6f06fd543b35a
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:05+01:00
Commit Message:
HPL1: Fix Space vs. Tab Indentation Inconsistency in Newton Memory Code
This code and several other parts of the codebase have inconsistency
between two space vs. tab indentation which makes it hard to follow
the code scope.
For now, changing this to the two space indentation which is as per
the majority of code in this file, but the entire engine code should
be changed to the nominal ScummVM standard of tab indentation in future.
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgMemory.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgMemory.cpp b/engines/hpl1/engine/libraries/newton/core/dgMemory.cpp
index 3e06b85f6d6..9a9121541ee 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgMemory.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgMemory.cpp
@@ -27,8 +27,8 @@
class dgGlobalAllocator: public dgMemoryAllocator, public dgList<dgMemoryAllocator*>
{
public:
- dgGlobalAllocator ()
- :dgMemoryAllocator (__malloc__, __free__), dgList<dgMemoryAllocator*> (NULL)
+ dgGlobalAllocator ()
+ :dgMemoryAllocator (__malloc__, __free__), dgList<dgMemoryAllocator*> (NULL)
{
SetAllocator(this);
}
@@ -43,12 +43,12 @@ public:
return malloc(size);
}
- static void dgApi __free__ (void* const ptr, dgUnsigned32 size)
+ static void dgApi __free__ (void* const ptr, dgUnsigned32 size)
{
free(ptr);
}
- void operator delete (void* const ptr)
+ void operator delete (void* const ptr)
{
_ASSERTE(0);
//::delete (ptr);
@@ -59,7 +59,7 @@ public:
dgInt32 GetMemoryUsed() const
{
dgInt32 mem = m_memoryUsed;
- for (dgList<dgMemoryAllocator*>::dgListNode* node = GetFirst(); node; node = node->GetNext()) {
+ for (dgList<dgMemoryAllocator*>::dgListNode* node = GetFirst(); node; node = node->GetNext()) {
mem += node->GetInfo()->GetMemoryUsed();
}
return mem;
@@ -68,17 +68,13 @@ public:
static dgGlobalAllocator m_globalAllocator;
};
-
-
dgGlobalAllocator dgGlobalAllocator::m_globalAllocator;
-
-
dgMemoryAllocator::dgMemoryAllocator()
{
m_memoryUsed = 0;
m_emumerator = 0;
- SetAllocatorsCallback (dgGlobalAllocator::m_globalAllocator.m_malloc, dgGlobalAllocator::m_globalAllocator.m_free);
+ SetAllocatorsCallback (dgGlobalAllocator::m_globalAllocator.m_malloc, dgGlobalAllocator::m_globalAllocator.m_free);
memset(m_memoryDirectory, 0, sizeof(m_memoryDirectory));
dgGlobalAllocator::m_globalAllocator.Append(this);
}
@@ -91,14 +87,12 @@ dgMemoryAllocator::dgMemoryAllocator(dgMemAlloc memAlloc, dgMemFree memFree)
memset(m_memoryDirectory, 0, sizeof(m_memoryDirectory));
}
-
dgMemoryAllocator::~dgMemoryAllocator()
{
dgGlobalAllocator::m_globalAllocator.Remove(this);
_ASSERTE(m_memoryUsed == 0);
}
-
void *dgMemoryAllocator::operator new(size_t size)
{
return dgMallocStack(size);
@@ -109,7 +103,6 @@ void dgMemoryAllocator::operator delete (void* const ptr)
dgFreeStack(ptr);
}
-
dgInt32 dgMemoryAllocator::GetMemoryUsed() const
{
return m_memoryUsed;
@@ -121,8 +114,6 @@ void dgMemoryAllocator::SetAllocatorsCallback (dgMemAlloc memAlloc, dgMemFree me
m_malloc = memAlloc;
}
-
-
void *dgMemoryAllocator::MallocLow(dgInt32 workingSize, dgInt32 alignment)
{
_ASSERTE(alignment >= DG_MEMORY_GRANULARITY);
@@ -159,7 +150,7 @@ void dgMemoryAllocator::FreeLow (void* const retPtr)
// if memory size is larger than DG_MEMORY_BIN_ENTRIES then the memory is not placed into a pool
void *dgMemoryAllocator::Malloc(dgInt32 memsize)
{
- _ASSERTE (dgInt32 (sizeof (dgMemoryCacheEntry) + sizeof (dgInt32) + sizeof(dgInt32)) <= DG_MEMORY_GRANULARITY);
+ _ASSERTE (dgInt32 (sizeof (dgMemoryCacheEntry) + sizeof (dgInt32) + sizeof(dgInt32)) <= DG_MEMORY_GRANULARITY);
dgInt32 size = memsize + DG_MEMORY_GRANULARITY - 1;
size &= (-DG_MEMORY_GRANULARITY);
@@ -168,10 +159,10 @@ void *dgMemoryAllocator::Malloc(dgInt32 memsize)
dgInt32 entry = paddedSize >> DG_MEMORY_GRANULARITY_BITS;
void* ptr;
- if (entry >= DG_MEMORY_BIN_ENTRIES) {
+ if (entry >= DG_MEMORY_BIN_ENTRIES) {
ptr = MallocLow(size);
- } else {
- if (!m_memoryDirectory[entry].m_cache) {
+ } else {
+ if (!m_memoryDirectory[entry].m_cache) {
dgMemoryBin* const bin = (dgMemoryBin*) MallocLow(sizeof(dgMemoryBin));
dgInt32 count = dgInt32(sizeof(bin->m_pool) / paddedSize);
@@ -180,7 +171,7 @@ void *dgMemoryAllocator::Malloc(dgInt32 memsize)
bin->m_info.m_stepInBites = paddedSize;
bin->m_info.m_next = m_memoryDirectory[entry].m_first;
bin->m_info.m_prev = NULL;
- if (bin->m_info.m_next) {
+ if (bin->m_info.m_next) {
bin->m_info.m_next->m_info.m_prev = bin;
}
@@ -189,26 +180,25 @@ void *dgMemoryAllocator::Malloc(dgInt32 memsize)
char* charPtr = bin->m_pool;
m_memoryDirectory[entry].m_cache = (dgMemoryCacheEntry*) charPtr;
-// charPtr = bin->m_pool
- for (dgInt32 i = 0; i < count; i ++) {
+// charPtr = bin->m_pool
+ for (dgInt32 i = 0; i < count; i ++) {
dgMemoryCacheEntry* const cashe = (dgMemoryCacheEntry*) charPtr;
cashe->m_next = (dgMemoryCacheEntry*) (charPtr + paddedSize);
cashe->m_prev = (dgMemoryCacheEntry*) (charPtr - paddedSize);
- dgMemoryInfo* const info = ((dgMemoryInfo*) (charPtr + DG_MEMORY_GRANULARITY)) - 1;
+ dgMemoryInfo* const info = ((dgMemoryInfo*) (charPtr + DG_MEMORY_GRANULARITY)) - 1;
info->SaveInfo(this, bin, entry, m_emumerator, memsize);
charPtr += paddedSize;
}
- dgMemoryCacheEntry* const cashe = (dgMemoryCacheEntry*) (charPtr - paddedSize);
+ dgMemoryCacheEntry* const cashe = (dgMemoryCacheEntry*) (charPtr - paddedSize);
cashe->m_next = NULL;
m_memoryDirectory[entry].m_cache->m_prev = NULL;
}
-
_ASSERTE(m_memoryDirectory[entry].m_cache);
dgMemoryCacheEntry* const cashe = m_memoryDirectory[entry].m_cache;
m_memoryDirectory[entry].m_cache = cashe->m_next;
- if (cashe->m_next) {
+ if (cashe->m_next) {
cashe->m_next->m_prev = NULL;
}
@@ -238,17 +228,17 @@ void dgMemoryAllocator::Free (void* const retPtr)
dgInt32 entry = info->m_size;
- if (entry >= DG_MEMORY_BIN_ENTRIES) {
+ if (entry >= DG_MEMORY_BIN_ENTRIES) {
FreeLow(retPtr);
- } else {
+ } else {
#ifdef __TRACK_MEMORY_LEAKS__
m_leaklTracker.RemoveBlock (retPtr);
#endif
- dgMemoryCacheEntry* const cashe = (dgMemoryCacheEntry*) (((char*)retPtr) - DG_MEMORY_GRANULARITY) ;
+ dgMemoryCacheEntry* const cashe = (dgMemoryCacheEntry*) (((char*)retPtr) - DG_MEMORY_GRANULARITY) ;
dgMemoryCacheEntry* const tmpCashe = m_memoryDirectory[entry].m_cache;
- if (tmpCashe) {
+ if (tmpCashe) {
_ASSERTE(!tmpCashe->m_prev);
tmpCashe->m_prev = cashe;
}
@@ -265,35 +255,35 @@ void dgMemoryAllocator::Free (void* const retPtr)
#endif
bin->m_info.m_count--;
- if (bin->m_info.m_count == 0) {
+ if (bin->m_info.m_count == 0) {
dgInt32 count = bin->m_info.m_totalCount;
dgInt32 sizeInBytes = bin->m_info.m_stepInBites;
char* charPtr = bin->m_pool;
- for (dgInt32 i = 0; i < count; i ++) {
+ for (dgInt32 i = 0; i < count; i ++) {
dgMemoryCacheEntry* const tmpCashe = (dgMemoryCacheEntry*) charPtr;
charPtr += sizeInBytes;
- if (tmpCashe == m_memoryDirectory[entry].m_cache) {
+ if (tmpCashe == m_memoryDirectory[entry].m_cache) {
m_memoryDirectory[entry].m_cache = tmpCashe->m_next;
}
- if (tmpCashe->m_prev) {
+ if (tmpCashe->m_prev) {
tmpCashe->m_prev->m_next = tmpCashe->m_next;
}
- if (tmpCashe->m_next) {
+ if (tmpCashe->m_next) {
tmpCashe->m_next->m_prev = tmpCashe->m_prev;
}
}
- if (m_memoryDirectory[entry].m_first == bin) {
+ if (m_memoryDirectory[entry].m_first == bin) {
m_memoryDirectory[entry].m_first = bin->m_info.m_next;
}
- if (bin->m_info.m_next) {
+ if (bin->m_info.m_next) {
bin->m_info.m_next->m_info.m_prev = bin->m_info.m_prev;
}
- if (bin->m_info.m_prev) {
+ if (bin->m_info.m_prev) {
bin->m_info.m_prev->m_info.m_next = bin->m_info.m_next;
}
@@ -302,8 +292,6 @@ void dgMemoryAllocator::Free (void* const retPtr)
}
}
-
-
// this is a simple memory leak tracker, it uses an flat array of two megabyte indexed by a hatch code
#ifdef __TRACK_MEMORY_LEAKS__
@@ -319,13 +307,13 @@ dgMemoryAllocator::dgMemoryLeaksTracker::dgMemoryLeaksTracker()
dgMemoryAllocator::dgMemoryLeaksTracker::~dgMemoryLeaksTracker ()
{
-// #ifdef _WIN32
-// _CrtDumpMemoryLeaks();
-// #endif
+// #ifdef _WIN32
+// _CrtDumpMemoryLeaks();
+// #endif
- if (m_totalAllocatedBytes) {
- for (dgInt32 i = 0; i < DG_TRACK_MEMORY_LEAKS_ENTRIES; i ++) {
- if (m_pool[i].m_ptr) {
+ if (m_totalAllocatedBytes) {
+ for (dgInt32 i = 0; i < DG_TRACK_MEMORY_LEAKS_ENTRIES; i ++) {
+ if (m_pool[i].m_ptr) {
dgTrace (("MemoryLeak: (0x%08x), size (%d) allocationNumber (%d)\n", m_pool[i].m_ptr, m_pool[i].m_size, m_pool[i].m_allocationNumber));
}
}
@@ -348,7 +336,7 @@ void dgMemoryAllocator::dgMemoryLeaksTracker::InsertBlock (dgInt32 size, void* c
key = dgHash (&ptr, sizeof (void*));
index = key % DG_TRACK_MEMORY_LEAKS_ENTRIES;
- for (i = 0; m_pool[index].m_ptr && (i < DG_TRACK_MEMORY_LEAKS_ENTRIES); i ++) {
+ for (i = 0; m_pool[index].m_ptr && (i < DG_TRACK_MEMORY_LEAKS_ENTRIES); i ++) {
index = ((index + 1) < DG_TRACK_MEMORY_LEAKS_ENTRIES) ? index + 1 : 0;
}
@@ -374,8 +362,8 @@ void dgMemoryAllocator::dgMemoryLeaksTracker::RemoveBlock (void* const ptr)
key = dgHash (&ptr, sizeof (void*));
index = key % DG_TRACK_MEMORY_LEAKS_ENTRIES;
- for (i = 0; i < DG_TRACK_MEMORY_LEAKS_ENTRIES; i ++) {
- if (m_pool[index].m_ptr == ptr) {
+ for (i = 0; i < DG_TRACK_MEMORY_LEAKS_ENTRIES; i ++) {
+ if (m_pool[index].m_ptr == ptr) {
m_density --;
m_totalAllocatedCalls--;
m_totalAllocatedBytes -= m_pool[index].m_size;
@@ -391,8 +379,6 @@ void dgMemoryAllocator::dgMemoryLeaksTracker::RemoveBlock (void* const ptr)
}
#endif
-
-
// Set the pointer of memory allocation functions
void dgSetGlobalAllocators(dgMemAlloc malloc, dgMemFree free)
{
@@ -427,31 +413,24 @@ void dgApi dgFreeStack (void* const ptr)
dgGlobalAllocator::m_globalAllocator.FreeLow(ptr);
}
-
// general memory allocation for all data in the library
void* dgApi dgMalloc(size_t size, dgMemoryAllocator* const allocator)
{
- void* ptr = NULL;
+ void* ptr = NULL;
_ASSERTE(allocator);
- if (size) {
+ if (size) {
ptr = allocator->Malloc(dgInt32(size));
}
return ptr;
}
-
// general deletion allocation for all data in the library
void dgApi dgFree (void* const ptr)
{
- if (ptr) {
+ if (ptr) {
dgMemoryAllocator::dgMemoryInfo* info;
info = ((dgMemoryAllocator::dgMemoryInfo*) ptr) - 1;
_ASSERTE(info->m_allocator);
info->m_allocator->Free(ptr);
}
}
-
-
-
-
-
Commit: d6f8a61503232b2768ab3fd2a47aa9b837dd285c
https://github.com/scummvm/scummvm/commit/d6f8a61503232b2768ab3fd2a47aa9b837dd285c
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:05+01:00
Commit Message:
HPL1: improve null pointer safety in TextureManager
Changed paths:
engines/hpl1/engine/resources/TextureManager.cpp
diff --git a/engines/hpl1/engine/resources/TextureManager.cpp b/engines/hpl1/engine/resources/TextureManager.cpp
index 9b76600c5ce..aa66e2e7982 100644
--- a/engines/hpl1/engine/resources/TextureManager.cpp
+++ b/engines/hpl1/engine/resources/TextureManager.cpp
@@ -35,6 +35,7 @@
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
+#include "hpl1/debug.h"
namespace hpl {
@@ -381,46 +382,43 @@ iTexture *cTextureManager::CreateFlatTexture(const tString &asName, bool abUseMi
bool abCompress, eTextureType aType, eTextureTarget aTarget,
unsigned int alTextureSizeLevel) {
tString sPath;
- iTexture *pTexture;
BeginLoad(asName);
- pTexture = FindTexture2D(asName, sPath);
+ Common::ScopedPtr<iTexture> pTexture(FindTexture2D(asName, sPath));
- if (pTexture == NULL && sPath != "") {
- // Load the bitmap
- Bitmap2D *pBmp;
- pBmp = mpLowLevelResources->loadBitmap2D(sPath);
- if (pBmp == NULL) {
- Error("Texturemanager Couldn't load bitmap '%s'\n", sPath.c_str());
+ if (!pTexture && sPath != "") {
+ // Load the bitmaps
+ Common::ScopedPtr<Bitmap2D> bmp(mpLowLevelResources->loadBitmap2D(sPath));
+ if (!bmp) {
+ Hpl1::logError(Hpl1::kDebugResourceLoading, "Texturemanager Couldn't load bitmap '%s'\n", sPath.c_str());
EndLoad();
- return NULL;
+ return nullptr;
}
// Create the texture and load from bitmap
- pTexture = mpGraphics->GetLowLevel()->CreateTexture(asName, abUseMipMaps, aType,
- aTarget);
+ pTexture.reset(mpGraphics->GetLowLevel()->CreateTexture(asName, abUseMipMaps, aType,
+ aTarget));
+ if (!pTexture) {
+ EndLoad();
+ return nullptr;
+ }
pTexture->SetSizeLevel(alTextureSizeLevel);
- if (pTexture->CreateFromBitmap(pBmp) == false) {
- hplDelete(pTexture);
- hplDelete(pBmp);
+ if (!pTexture->CreateFromBitmap(bmp.get())) {
EndLoad();
- return NULL;
+ return nullptr;
}
- // Bitmap is no longer needed so delete it.
- hplDelete(pBmp);
-
- AddResource(pTexture);
+ AddResource(pTexture.get());
}
if (pTexture)
pTexture->IncUserCount();
else
- Error("Couldn't texture '%s'\n", asName.c_str());
+ Hpl1::logError(Hpl1::kDebugResourceLoading, "texture '%s' is invalid\n", asName.c_str());
EndLoad();
- return pTexture;
+ return pTexture.release();
}
//-----------------------------------------------------------------------
Commit: 60331b024f084f2ebff0009f6be4c958d62e5c34
https://github.com/scummvm/scummvm/commit/60331b024f084f2ebff0009f6be4c958d62e5c34
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:05+01:00
Commit Message:
HPL1: improve null pointer safety in Light3D
Changed paths:
engines/hpl1/engine/scene/Light3D.cpp
diff --git a/engines/hpl1/engine/scene/Light3D.cpp b/engines/hpl1/engine/scene/Light3D.cpp
index b373091737c..6a34c866525 100644
--- a/engines/hpl1/engine/scene/Light3D.cpp
+++ b/engines/hpl1/engine/scene/Light3D.cpp
@@ -65,8 +65,10 @@ iLight3D::iLight3D(tString asName, cResources *apResources) : iLight(), iRendera
mpFileSearcher = apResources->GetFileSearcher();
mpFalloffMap = mpTextureManager->Create1D("core_falloff_linear", false);
- mpFalloffMap->SetWrapS(eTextureWrap_ClampToEdge);
- mpFalloffMap->SetWrapT(eTextureWrap_ClampToEdge);
+ if (mpFalloffMap) {
+ mpFalloffMap->SetWrapS(eTextureWrap_ClampToEdge);
+ mpFalloffMap->SetWrapT(eTextureWrap_ClampToEdge);
+ }
mpVisSectorCont = NULL;
mlSectorVisibilityCount = -1;
@@ -78,7 +80,8 @@ iLight3D::iLight3D(tString asName, cResources *apResources) : iLight(), iRendera
//-----------------------------------------------------------------------
iLight3D::~iLight3D() {
- mpTextureManager->Destroy(mpFalloffMap);
+ if (mpFalloffMap)
+ mpTextureManager->Destroy(mpFalloffMap);
if (mpVisSectorCont)
hplDelete(mpVisSectorCont);
@@ -465,13 +468,15 @@ void iLight3D::SetFalloffMap(iTexture *apTexture) {
if (mpFalloffMap)
mpTextureManager->Destroy(mpFalloffMap);
- mpFalloffMap = apTexture;
- mpFalloffMap->SetWrapS(eTextureWrap_ClampToEdge);
- mpFalloffMap->SetWrapT(eTextureWrap_ClampToEdge);
+ if (apTexture) {
+ mpFalloffMap = apTexture;
+ mpFalloffMap->SetWrapS(eTextureWrap_ClampToEdge);
+ mpFalloffMap->SetWrapT(eTextureWrap_ClampToEdge);
+ } else {
+ mpFalloffMap = nullptr;
+ }
- // reset temp textures.
- for (int i = 0; i < 3; ++i)
- mvTempTextures[i] = NULL;
+ Common::fill(mvTempTextures, mvTempTextures + 3, nullptr);
}
//-----------------------------------------------------------------------
Commit: 158ea72be68441f7536834c0531a9d4aa24943cf
https://github.com/scummvm/scummvm/commit/158ea72be68441f7536834c0531a9d4aa24943cf
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:05+01:00
Commit Message:
HPL1: Fix GCC Compiler Undefined Symbol Warnings in Angelscript String Code
These are emitted if -Wundef is passed to GCC.
Changed paths:
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
index befc4d4b0d5..bf8fb3c31b7 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -491,7 +491,7 @@ static string formatInt(asINT64 value, const string &options, asUINT width)
string buf;
buf.resize(width+30);
-#if _MSC_VER >= 1400 && !defined(__S3E__)
+#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(__S3E__)
// MSVC 8.0 / 2005 or newer
sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, value);
#else
@@ -535,7 +535,7 @@ static string formatUInt(asQWORD value, const string &options, asUINT width)
string buf;
buf.resize(width+30);
-#if _MSC_VER >= 1400 && !defined(__S3E__)
+#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(__S3E__)
// MSVC 8.0 / 2005 or newer
sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, value);
#else
@@ -571,7 +571,7 @@ static string formatFloat(double value, const string &options, asUINT width, asU
string buf;
buf.resize(width+precision+50);
-#if _MSC_VER >= 1400 && !defined(__S3E__)
+#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(__S3E__)
// MSVC 8.0 / 2005 or newer
sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, precision, value);
#else
Commit: 5578b91a1078a3fc35052ce9ee51e8160d0dee99
https://github.com/scummvm/scummvm/commit/5578b91a1078a3fc35052ce9ee51e8160d0dee99
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:05+01:00
Commit Message:
HPL1: Fix GCC Shadowing Warnings in Newton Core Code
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgMemory.cpp
engines/hpl1/engine/libraries/newton/core/dgNode.h
diff --git a/engines/hpl1/engine/libraries/newton/core/dgMemory.cpp b/engines/hpl1/engine/libraries/newton/core/dgMemory.cpp
index 9a9121541ee..5b660831e2c 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgMemory.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgMemory.cpp
@@ -261,19 +261,19 @@ void dgMemoryAllocator::Free (void* const retPtr)
dgInt32 sizeInBytes = bin->m_info.m_stepInBites;
char* charPtr = bin->m_pool;
for (dgInt32 i = 0; i < count; i ++) {
- dgMemoryCacheEntry* const tmpCashe = (dgMemoryCacheEntry*) charPtr;
+ dgMemoryCacheEntry* const tmpCache = (dgMemoryCacheEntry*) charPtr;
charPtr += sizeInBytes;
- if (tmpCashe == m_memoryDirectory[entry].m_cache) {
- m_memoryDirectory[entry].m_cache = tmpCashe->m_next;
+ if (tmpCache == m_memoryDirectory[entry].m_cache) {
+ m_memoryDirectory[entry].m_cache = tmpCache->m_next;
}
- if (tmpCashe->m_prev) {
- tmpCashe->m_prev->m_next = tmpCashe->m_next;
+ if (tmpCache->m_prev) {
+ tmpCache->m_prev->m_next = tmpCache->m_next;
}
- if (tmpCashe->m_next) {
- tmpCashe->m_next->m_prev = tmpCashe->m_prev;
+ if (tmpCache->m_next) {
+ tmpCache->m_next->m_prev = tmpCache->m_prev;
}
}
diff --git a/engines/hpl1/engine/libraries/newton/core/dgNode.h b/engines/hpl1/engine/libraries/newton/core/dgNode.h
index 75e682740a4..dc983c48d96 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgNode.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgNode.h
@@ -80,7 +80,7 @@ class dgNode: public dgBaseNode
public:
dgNode ();
dgNode (const char *name);
- void Attach (T *parent, bool addFirst = false);
+ void Attach (T *parentNode, bool addFirst = false);
void Detach ();
T *GetChild () const;
T *GetSibling () const;
@@ -180,9 +180,9 @@ dgRef *dgNode<T>::CreateClone () const
}
template<class T>
-void dgNode<T>::Attach (T *parent, bool addFirst)
+void dgNode<T>::Attach (T *parentNode, bool addFirst)
{
- dgBaseNode::Attach(parent, addFirst);
+ dgBaseNode::Attach(parentNode, addFirst);
}
template<class T>
Commit: 16a30f82785d1d27940c18fa503399061a2a6b81
https://github.com/scummvm/scummvm/commit/16a30f82785d1d27940c18fa503399061a2a6b81
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:05+01:00
Commit Message:
HPL1: Fix GCC Compiler Warnings in Low Level Graphics TGL Code
Changed paths:
engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
diff --git a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
index b1c6be6f830..1e941b017bd 100644
--- a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
+++ b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
@@ -64,6 +64,12 @@ TGLenum TextureTargetToTGL(eTextureTarget target) {
case eTextureTarget_1D:
case eTextureTarget_2D:
return TGL_TEXTURE_2D;
+
+ case eTextureTarget_Rect:
+ case eTextureTarget_CubeMap:
+ case eTextureTarget_3D:
+ case eTextureTarget_LastEnum:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture target (%d)\n", target);
return 0;
@@ -162,6 +168,14 @@ TGLenum GetGLTextureFuncEnum(eTextureFunc type) {
return TGL_REPLACE;
case eTextureFunc_Add:
return TGL_ADD;
+
+ case eTextureFunc_Substract:
+ case eTextureFunc_AddSigned:
+ case eTextureFunc_Interpolate:
+ case eTextureFunc_Dot3RGB:
+ case eTextureFunc_Dot3RGBA:
+ case eTextureFunc_LastEnum:
+ break;
}
Hpl1::logError(Hpl1::kDebugOpenGL, "invalid texture function (%d)", type);
return 0;
@@ -821,6 +835,7 @@ void LowLevelGraphicsTGL::DrawQuadMultiTex(const tVertexVec &avVtx, const tVecto
iOcclusionQuery *LowLevelGraphicsTGL::CreateOcclusionQuery() {
//return hplNew(cOcclusionQueryOGL, ());
+ return nullptr;
}
//-----------------------------------------------------------------------
@@ -1512,4 +1527,4 @@ void LowLevelGraphicsTGL::SetVtxBatchStates(tVtxBatchFlag flags) {
#endif
}
-} // namespace hpl
\ No newline at end of file
+} // namespace hpl
Commit: feeec55a7c354474c45cefcee427eaa0da9f9ecc
https://github.com/scummvm/scummvm/commit/feeec55a7c354474c45cefcee427eaa0da9f9ecc
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:05+01:00
Commit Message:
HPL1: implement occlusion query tgl stub
Changed paths:
A engines/hpl1/engine/impl/occlusion_query_tgl.h
engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
diff --git a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
index 1e941b017bd..31330d90b39 100644
--- a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
+++ b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
@@ -21,7 +21,6 @@
#include <assert.h>
-#include "hpl1/engine/graphics/font_data.h"
#include "hpl1/engine/impl/low_level_graphics_tgl.h"
#include "hpl1/engine/graphics/bitmap2D.h"
@@ -29,12 +28,12 @@
#include "hpl1/engine/impl/vertex_buffer_tgl.h"
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/impl/texture_tgl.h"
+#include "hpl1/engine/impl/occlusion_query_tgl.h"
#include "common/algorithm.h"
#include "common/system.h"
#include "engines/util.h"
#include "hpl1/debug.h"
-#include "hpl1/engine/impl/OcclusionQueryOGL.h"
#include "graphics/tinygl/tinygl.h"
#include "hpl1/graphics.h"
@@ -834,8 +833,7 @@ void LowLevelGraphicsTGL::DrawQuadMultiTex(const tVertexVec &avVtx, const tVecto
//-----------------------------------------------------------------------
iOcclusionQuery *LowLevelGraphicsTGL::CreateOcclusionQuery() {
- //return hplNew(cOcclusionQueryOGL, ());
- return nullptr;
+ return hplNew(OcclusionQueryTGL, ());
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/occlusion_query_tgl.h b/engines/hpl1/engine/impl/occlusion_query_tgl.h
new file mode 100644
index 00000000000..fd69c0b86be
--- /dev/null
+++ b/engines/hpl1/engine/impl/occlusion_query_tgl.h
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL_OCCLUSION_QUERY_TGL_H
+#define HPL_OCCLUSION_QUERY_TGL_H
+
+#include "hpl1/engine/graphics/OcclusionQuery.h"
+#include "common/scummsys.h"
+
+namespace hpl {
+
+class OcclusionQueryTGL : public iOcclusionQuery {
+public:
+ OcclusionQueryTGL() {}
+ ~OcclusionQueryTGL() {}
+
+ void Begin() override {}
+ void End() override {}
+ bool FetchResults() override {return true;}
+ unsigned int GetSampleCount() override {return 0;}
+};
+
+} // namespace hpl
+
+#endif // HPL_OCCLUSION_QUERY_TGL_H
\ No newline at end of file
Commit: 66e6614db6a0e7774508f47057f5e071a9293ad3
https://github.com/scummvm/scummvm/commit/66e6614db6a0e7774508f47057f5e071a9293ad3
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:05+01:00
Commit Message:
HPL1: remove commented code
Changed paths:
engines/hpl1/penumbra-overture/PlayerHelper.cpp
diff --git a/engines/hpl1/penumbra-overture/PlayerHelper.cpp b/engines/hpl1/penumbra-overture/PlayerHelper.cpp
index 70ebd8c8817..a7e8aaecbfa 100644
--- a/engines/hpl1/penumbra-overture/PlayerHelper.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerHelper.cpp
@@ -260,72 +260,6 @@ bool cPlayerPickRayCallback::OnIntersect(iPhysicsBody *apBody, cPhysicsRayParams
}
return true;
-
- /*float &fDist = apParams->mfDist;
-
- iGameEntity *pEntity = NULL;
- if(apBody->GetUserData()) pEntity = (iGameEntity*)apBody->GetUserData();
-
- //Don't wanna pick characters
- if(apBody->IsCharacter() && apBody->GetUserData()==NULL) return true;
-
- if(pEntity && pEntity->IsActive()==false) return true;
-
- //If it is outside of the examine distance skip
- if(pEntity && pEntity->GetMaxExamineDist() < fDist) return true;
-
- ////////////////////////////
- //Not picked
- bool bStatic = false;
- if(pEntity && pEntity->GetType()== eGameEntityType_Object)
- {
- cGameObject* pObject = static_cast<cGameObject*>(pEntity);
- if(pObject->GetInteractMode() == eObjectInteractMode_Static)
- {
- bStatic = true;
- }
- }
-
- if( pEntity==NULL || bStatic)
- {
- if(fDist < mfPickedDist)
- {
- mfMinStaticDist = fDist;
- mfPickedDist = fDist;
- mpPickedBody = NULL;
- mvPickedPos = apParams->mvPoint;
- mLastEntityType = eGameEntityType_LastEnum;
- }
- }
- ////////////////////////////
- //Picked
- else
- {
- if(pEntity->GetType() == eGameEntityType_Area)
- {
- if(fDist < mfPickedDist)
- {
- mpPickedBody = apBody;
- mLastEntityType = pEntity->GetType();
- mvPickedPos = apParams->mvPoint;
- mfPickedDist = fDist;
- }
- }
- else
- {
- if (fDist < mfPickedDist ||
- (mLastEntityType == eGameEntityType_Area))
- {
- mpPickedBody = apBody;
- mLastEntityType = pEntity->GetType();
- mvPickedPos = apParams->mvPoint;
- mfPickedDist = fDist;
- }
- }
-
- }
-
- return true;*/
}
void cPlayerPickRayCallback::CalculateResults() {
@@ -587,91 +521,6 @@ void cPlayerHealth::Update(float afTimeStep) {
case eGameDifficulty_LastEnum:
break;
}
-
- ////////////////////////////
- // Check for enemies.
- /*if(mfTerrorCheckCount <=0)
- {
- //Check the current terror level.
- int lTerrorLevel =0;
- tGameEnemyIterator it = mpInit->mpMapHandler->GetGameEnemyIterator();
- while(it.HasNext())
- {
- iGameEnemy *pEnemy = it.Next();
-
- if(pEnemy->IsActive()==false || pEnemy->GetHealth() <=0) continue;
-
- int lState = pEnemy->GetStateMachine()->CurrentState()->GetId();
-
- if(lState == eGameEnemyState_Hunt || lState == eGameEnemyState_Attack)
- {
- lTerrorLevel = 3;
- }
- else if(lTerrorLevel < 2 && lState == eGameEnemyState_Investigate)
- {
- lTerrorLevel = 2;
- }
- else if(lTerrorLevel < 1)
- {
- lTerrorLevel = 1;
- }
- }
-
- if(mlTerrorLevel != lTerrorLevel)
- {
- mlTerrorLevel = lTerrorLevel;
-
- cSoundHandler *pSoundHandler = mpInit->mpGame->GetSound()->GetSoundHandler();
-
- //Fade out the current sound if there is any.
- if(mpSoundEntry)
- {
- mpSoundEntry->mfNormalVolumeFadeDest = 0;
- mpSoundEntry->mfNormalVolumeFadeSpeed = -0.25f;
- mpSoundEntry = NULL;
- }
- mpSoundEntry = NULL;
-
- tString sSound="";
- float fVolume;
-
- if(mlTerrorLevel==0)
- {
- }
- else if(mlTerrorLevel==1)
- {
- sSound = "horror_roach_idle";
- fVolume = 0.3f;
- }
- else if(mlTerrorLevel==2)
- {
- sSound = "horror_roach_notice";
- fVolume = 0.45f;
- }
- else if(mlTerrorLevel==3)
- {
- sSound = "horror_roach_attack";
- fVolume = 0.6f;
- }
-
- if(sSound != "")
- {
- iSoundChannel *pChannel = pSoundHandler->PlayGui(sSound, true, fVolume);
- pChannel->SetPriority(200);
- mpSoundEntry = pSoundHandler->GetEntryFromSound(pChannel);
-
- mpSoundEntry->mfNormalVolumeMul =0;
- mpSoundEntry->mfNormalVolumeFadeDest =1;
- mpSoundEntry->mfNormalVolumeFadeSpeed = 0.55f;
- }
- }
-
- mfTerrorCheckCount = 0.2f;
- }
- else
- {
- mfTerrorCheckCount -= afTimeStep;
- }*/
}
void cPlayerHealth::Draw() {
@@ -1305,50 +1154,6 @@ void cPlayerFlashLight::Update(float afTimeStep) {
}
}
}
-
- //////////////////////////////
- // Get forward
- // cVector3f vForward = pCam->GetForward();
-
- /*float fAngleX = cMath::RandRectf(cMath::ToRad(-3),cMath::ToRad(3));
- float fAngleY = cMath::RandRectf(0,k2Pif);
- cVector3f vForward = cMath::MatrixMul(
- cMath::MatrixRotate(cVector3f(fAngleX,fAngleY,0),eEulerRotationOrder_XYZ),
- cVector3f(0,1,0));
-
- vForward = cMath::MatrixMul(
- pHudModel->GetEntity()->GetWorldMatrix().GetRotation(),
- //cMath::MatrixInverse(pCam->GetViewMatrix().GetRotation()),
- //cMath::MatrixRotate(cVector3f(pCam->GetPitch(),pCam->GetYaw(),pCam->GetRoll()),
- // eEulerRotationOrder_YXZ),
- vForward*-1);
-
- //////////////////////////////
- //Get start and end
- cVector3f vStart = pCam->GetPosition();
- cVector3f vEnd = pCam->GetPosition() + vForward* 20.0f;
-
- mvStart =vStart;
- mvEnd = vEnd;
-
- mpClosestBody = NULL; mfClosestDist = 10000.0f;
- pPhysicsWorld->CastRay(this,vStart,vEnd,true,false,false,false);
-
- if(mpClosestBody)
- {
- iGameEntity *pEntity = (iGameEntity*)mpClosestBody->GetUserData();
-
- if( pEntity && pEntity->GetType() == eGameEntityType_Enemy &&
- pEntity->IsActive() && pEntity->GetHealth() >0)
- {
- iGameEnemy *pEnemy = static_cast<iGameEnemy*>(pEntity);
-
- if(pEnemy->GetUsesTriggers())
- pEnemy->OnFlashlight(vStart);
- }
- }*/
-
- // mpInit->mpEffectHandler->GetSubTitle()->Add("Cast rays!\n",0.5f);
}
} else {
mfRayCastTime += afTimeStep;
@@ -1964,39 +1769,6 @@ void cPlayerHidden::OnWorldExit() {
//-----------------------------------------------------------------------
void cPlayerHidden::Draw() {
- /*if(mfLight <= mfMaxLight)
- {
- mpFont->Draw(5,12,cColor(0.3f,1,0.3f),eFontAlign_Left,_W("Light: %f\n"),mfLight);
- if(!mbHidden)
- mpFont->Draw(cVector3f(5,19,5),12,cColor(1,1,1),eFontAlign_Left,_W("Hidden count: %f"),mfHiddenCount);
- }
- else
- {
- mpFont->Draw(5,12,cColor(1,0.3f,0.3f),eFontAlign_Left,_W("Light: %f\n"),mfLight);
- }
-
- if(mbHidden)
- mpFont->Draw(cVector3f(5,19,5),12,cColor(1,1,1),eFontAlign_Left,_W("Hidden\n"));
- */
- /*float fAdd =0;
- if(mfCloseEffectFov >= 0)
- {
- float fT = mfCloseEffectFov / mfCloseEffectFovMax;
- fAdd = sin(fT * kPi2f) * mfCloseEffectFovMax;
- }
- else
- {
- float fT = mfCloseEffectFov / mfCloseEffectFovMin;
- fAdd = sin(fT * kPi2f) * mfCloseEffectFovMin;
- }
-
- mpFont->Draw(5,12,cColor(1,1,1),eFontAlign_Left,"CloseCount: %f TooClose: %d\n",
- mfEnemyTooCloseCount,
- mbEnemyTooClose);
-
- mpFont->Draw(cVector3f(5,19,5),12,cColor(1,1,1),eFontAlign_Left,"Fov: %f Add: %f\n",
- mfCloseEffectFov,fAdd);*/
-
// Draw in shadow effect
if (mfInShadowAlpha > 0) {
float fAlpha = (mfInShadowPulse * 0.5f + 0.5f) * mfInShadowAlpha * 0.85f;
Commit: 1334e8f9016d763da356715adc4d6175e77f0997
https://github.com/scummvm/scummvm/commit/1334e8f9016d763da356715adc4d6175e77f0997
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:06+01:00
Commit Message:
HPL1: Fix Incorrect STL Vector Resize Method Call in GUI Code
The resize() method parameter can not be NULL / nullptr when the value
type is not a pointer type i.e. std::vector<cGuiSkinFont *> mvFonts
is OK, but std::vector<cVector3f> mvAttributes is not.
This generates a GCC Compiler warning.
Changed paths:
engines/hpl1/engine/gui/GuiSkin.cpp
diff --git a/engines/hpl1/engine/gui/GuiSkin.cpp b/engines/hpl1/engine/gui/GuiSkin.cpp
index d8220dcf481..3772aa912ca 100644
--- a/engines/hpl1/engine/gui/GuiSkin.cpp
+++ b/engines/hpl1/engine/gui/GuiSkin.cpp
@@ -69,7 +69,7 @@ cGuiSkin::cGuiSkin(const tString &asName, cGui *apGui) {
mvGfxElements.resize(eGuiSkinGfx_LastEnum, NULL);
mvFonts.resize(eGuiSkinFont_LastEnum, NULL);
- mvAttributes.resize(eGuiSkinAttribute_LastEnum, NULL);
+ mvAttributes.resize(eGuiSkinAttribute_LastEnum);
}
//-----------------------------------------------------------------------
Commit: c91737c5f57f89bb0ce9a8691854d692439d4194
https://github.com/scummvm/scummvm/commit/c91737c5f57f89bb0ce9a8691854d692439d4194
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:06+01:00
Commit Message:
HPL1: Change Image Entity Handle From Unsigned to Signed Vector Type
This should be signed as comparison with -1 is used to check for validity.
This fixes various signed vs. unsigned comparison warnings emitted by
GCC at compilation.
Changed paths:
engines/hpl1/engine/graphics/ImageEntityData.cpp
engines/hpl1/engine/graphics/ImageEntityData.h
engines/hpl1/engine/resources/ImageEntityManager.h
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.cpp b/engines/hpl1/engine/graphics/ImageEntityData.cpp
index 2f058e4179c..53719dc8dda 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.cpp
+++ b/engines/hpl1/engine/graphics/ImageEntityData.cpp
@@ -102,7 +102,7 @@ cImageAnimation *cImageEntityData::GetAnimationByHandle(int alHandle) {
//-----------------------------------------------------------------------
-bool cImageEntityData::CreateFromFile(const tString &asFile, tUIntVec &avImageHandle) {
+bool cImageEntityData::CreateFromFile(const tString &asFile, tIntVec &avImageHandle) {
bool bGotAnim = false;
TiXmlDocument *pDoc = hplNew(TiXmlDocument, (asFile.c_str()));
if (!pDoc->LoadFile()) {
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.h b/engines/hpl1/engine/graphics/ImageEntityData.h
index 814b4929359..c86534262b4 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.h
+++ b/engines/hpl1/engine/graphics/ImageEntityData.h
@@ -77,7 +77,7 @@ public:
void unload() {}
void destroy() {}
- bool CreateFromFile(const tString &asFile, tUIntVec &avImageHandle);
+ bool CreateFromFile(const tString &asFile, tIntVec &avImageHandle);
cImageFrame *GetImageFrame(int alFrame);
tUIntVec *GetIndexVec() { return &mvIdxVec; }
diff --git a/engines/hpl1/engine/resources/ImageEntityManager.h b/engines/hpl1/engine/resources/ImageEntityManager.h
index 9b50656c879..43ee6a4152e 100644
--- a/engines/hpl1/engine/resources/ImageEntityManager.h
+++ b/engines/hpl1/engine/resources/ImageEntityManager.h
@@ -52,7 +52,7 @@ private:
cGraphics *mpGraphics;
cResources *mpResources;
- tUIntVec mvImageHandle;
+ tIntVec mvImageHandle;
};
} // namespace hpl
Commit: 354464ea97a713ce246b5ca918d179a8603fc435
https://github.com/scummvm/scummvm/commit/354464ea97a713ce246b5ca918d179a8603fc435
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:06+01:00
Commit Message:
HPL1: Fix Cut and Paste Error in Engine Material Manager Code
This was generating a Enum used in Boolean Context GCC compiler warning.
Changed paths:
engines/hpl1/engine/resources/MaterialManager.cpp
diff --git a/engines/hpl1/engine/resources/MaterialManager.cpp b/engines/hpl1/engine/resources/MaterialManager.cpp
index 1101ab7fae6..2c4ae445eb7 100644
--- a/engines/hpl1/engine/resources/MaterialManager.cpp
+++ b/engines/hpl1/engine/resources/MaterialManager.cpp
@@ -317,7 +317,7 @@ iMaterial *cMaterialManager::LoadFromFile(const tString &asName, const tString &
pTex = mpResources->GetTextureManager()->Create1D(sFile, bMipMaps, bCompress,
eTextureType_Normal,
mlTextureSizeLevel);
- } else if (eTextureTarget_CubeMap) {
+ } else if (target == eTextureTarget_CubeMap) {
pTex = mpResources->GetTextureManager()->CreateCubeMap(sFile, bMipMaps, bCompress,
eTextureType_Normal,
mlTextureSizeLevel);
Commit: 2c9264070fd3c7058de7bb5c13e34275432d9ec7
https://github.com/scummvm/scummvm/commit/2c9264070fd3c7058de7bb5c13e34275432d9ec7
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:06+01:00
Commit Message:
HPL1: Fix Shadowing Compiler Warnings in Newton Library Polygon Soup Builder
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgPolygonSoupBuilder.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupBuilder.cpp b/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupBuilder.cpp
index 3d327a622a0..eb3cbdd74c5 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupBuilder.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupBuilder.cpp
@@ -151,9 +151,9 @@ void dgPolygonSoupDatabaseBuilder::AddMesh(const dgFloat32* const vertex,
{
convexFaces = 1;
dgBigVector p0(m_vertexPoints[pool[2]]);
- for (dgInt32 i = 0; i < 3; i++)
+ for (dgInt32 m = 0; m < 3; m++)
{
- dgBigVector p1(m_vertexPoints[pool[i]]);
+ dgBigVector p1(m_vertexPoints[pool[m]]);
dgBigVector edge(p1 - p0);
dgFloat64 mag2 = edge % edge;
if (mag2 < dgFloat32(1.0e-6f))
@@ -187,18 +187,18 @@ void dgPolygonSoupDatabaseBuilder::AddMesh(const dgFloat32* const vertex,
}
dgInt32 index = 0;
- for (dgInt32 k = 0; k < convexFaces; k++)
+ for (dgInt32 m = 0; m < convexFaces; m++)
{
- dgInt32 count = faces[k];
+ dgInt32 fcount = faces[m];
m_vertexIndex[m_indexCount] = faceTagsData[i];
m_indexCount++;
- for (dgInt32 j = 0; j < count; j++)
+ for (dgInt32 j = 0; j < fcount; j++)
{
m_vertexIndex[m_indexCount] = pool[index];
index++;
m_indexCount++;
}
- m_faceVertexCount[m_faceCount] = count + 1;
+ m_faceVertexCount[m_faceCount] = fcount + 1;
m_faceCount++;
}
}
@@ -1026,8 +1026,8 @@ dgInt32 dgPolygonSoupDatabaseBuilder::AddConvexFace(dgInt32 count,
e1 = e1.Scale(dgRsqrt (e1 % e1 + dgFloat32(1.0e-10f)));
dgBigVector n(e0 * e1);
- dgFloat64 mag2 = n % normal;
- if (mag2 < dgFloat32(1.0e-5f))
+ dgFloat64 nmag2 = n % normal;
+ if (nmag2 < dgFloat32(1.0e-5f))
{
isconvex = 0;
break;
@@ -1084,17 +1084,17 @@ dgInt32 dgPolygonSoupDatabaseBuilder::AddConvexFace(dgInt32 count,
dgPolyhedra::Iterator iter(polyhedra2);
for (iter.Begin(); iter; iter++)
{
- dgEdge* const edge = &(*iter);
- if (edge->m_incidentFace < 0)
+ dgEdge* const iedge = &(*iter);
+ if (iedge->m_incidentFace < 0)
{
continue;
}
- if (edge->m_mark == mark)
+ if (iedge->m_mark == mark)
{
continue;
}
- ptr = edge;
+ ptr = iedge;
count = 0;
do
{
@@ -1103,7 +1103,7 @@ dgInt32 dgPolygonSoupDatabaseBuilder::AddConvexFace(dgInt32 count,
index++;
count++;
ptr = ptr->m_next;
- } while (ptr != edge);
+ } while (ptr != iedge);
facesArray[facesCount] = count;
facesCount++;
Commit: 2237da1cbf80fbf4784423cf102e6ecd8c395aa7
https://github.com/scummvm/scummvm/commit/2237da1cbf80fbf4784423cf102e6ecd8c395aa7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:06+01:00
Commit Message:
HPL1: partial cleanup of TGLTexture
Changed paths:
engines/hpl1/engine/impl/texture_tgl.cpp
diff --git a/engines/hpl1/engine/impl/texture_tgl.cpp b/engines/hpl1/engine/impl/texture_tgl.cpp
index 8db6222c672..190474c5788 100644
--- a/engines/hpl1/engine/impl/texture_tgl.cpp
+++ b/engines/hpl1/engine/impl/texture_tgl.cpp
@@ -64,19 +64,15 @@ static void getSettings(Bitmap2D *apSrc, int &alChannels, TGLint &internalFormat
//-----------------------------------------------------------------------
TGLTexture::TGLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
- eTextureType aType, bool abUseMipMaps, eTextureTarget aTarget,
- bool abCompress)
+ eTextureType aType, bool abUseMipMaps, eTextureTarget aTarget,
+ bool abCompress)
: iTexture(asName, "OGL", apPxlFmt, apLowLevelGraphics, aType, abUseMipMaps, aTarget, abCompress) {
mbContainsData = false;
- if (aType == eTextureType_RenderTarget) {
- Hpl1::logError(Hpl1::kDebugGraphics, "use of render target%s", ".");
- // mpPBuffer = hplNew( cPBuffer, (mpLowLevelGraphics,true) );
- }
-
- // Cubemap does not like mipmaps
- if (aTarget == eTextureTarget_CubeMap)
- mbUseMipMaps = false;
+ if (aType == eTextureType_RenderTarget)
+ error("texture render target not supported");
+ if (mTarget != eTextureTarget_2D)
+ error("TGLTexture only supports 2D textures");
mpGfxSDL = static_cast<LowLevelGraphicsTGL *>(mpLowLevelGraphics);
@@ -105,10 +101,6 @@ bool TGLTexture::CreateFromBitmap(Bitmap2D *pBmp) {
if (mvTextureHandles.empty()) {
mvTextureHandles.resize(1);
tglGenTextures(1, &mvTextureHandles[0]);
- } else {
- // Log("Delete + Generate!\n");
- // glDeleteTextures(1,(GLuint *)&mvTextureHandles[0]);
- // glGenTextures(1,(GLuint *)&mvTextureHandles[0]);
}
return CreateFromBitmapToHandle(pBmp, 0);
@@ -144,10 +136,12 @@ bool TGLTexture::Create(unsigned int alWidth, unsigned int alHeight, cColor aCol
//-----------------------------------------------------------------------
static void generateMipmaps(eTextureTarget target) {
-
}
bool TGLTexture::CreateFromArray(unsigned char *apPixelData, int alChannels, const cVector3l &avSize) {
+ if (mTarget != eTextureTarget_2D)
+ error("non-2D textures are not supported in TGLTexture");
+
if (mvTextureHandles.empty()) {
mvTextureHandles.resize(1);
tglGenTextures(1, &mvTextureHandles[0]);
@@ -155,36 +149,21 @@ bool TGLTexture::CreateFromArray(unsigned char *apPixelData, int alChannels, con
TGLenum GLTarget = InitCreation(0);
- int lChannels = alChannels;
- TGLenum format = 0;
- switch (lChannels) {
- case 1:
- case 2:
- case 3:
- format = TGL_RGB;
- break;
- case 4:
- format = TGL_RGBA;
- break;
- }
+ if (alChannels == 1 || alChannels == 2)
+ error("TGLTexture only supports RGB and RGBA");
+
+ TGLenum format = alChannels == 3 ? TGL_RGB : TGL_RGBA;
_width = avSize.x;
_height = avSize.y;
- _bpp = lChannels * 8;
+ _bpp = alChannels * 8;
if (!cMath::IsPow2(_height) || !cMath::IsPow2(_width) || !cMath::IsPow2(avSize.z)) {
Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
}
- if (mTarget == eTextureTarget_1D) {
- tglTexImage2D(GLTarget, 0, format, _width, 1, 0, format,
- TGL_UNSIGNED_BYTE, apPixelData);
- } else if (mTarget == eTextureTarget_2D) {
- tglTexImage2D(GLTarget, 0, format, _width, _height,
- 0, format, TGL_UNSIGNED_BYTE, apPixelData);
- } else if (mTarget == eTextureTarget_3D) {
- error("trying to create a texture 3D in TGLTexture");
- }
+ tglTexImage2D(GLTarget, 0, format, _width, _height,
+ 0, format, TGL_UNSIGNED_BYTE, apPixelData);
if (mbUseMipMaps && mTarget != eTextureTarget_Rect && mTarget != eTextureTarget_3D)
generateMipmaps(mTarget);
@@ -197,7 +176,7 @@ bool TGLTexture::CreateFromArray(unsigned char *apPixelData, int alChannels, con
//-----------------------------------------------------------------------
void TGLTexture::SetPixels2D(int alLevel, const cVector2l &avOffset, const cVector2l &avSize,
- eColorDataFormat aDataFormat, void *apPixelData) {
+ eColorDataFormat aDataFormat, void *apPixelData) {
HPL1_UNIMPLEMENTED(TGLTexture::SetPixels2D);
}
@@ -296,7 +275,7 @@ void TGLTexture::SetFilter(eTextureFilter aFilter) {
mFilter = aFilter;
if (mbContainsData) {
- TGLenum GLTarget =GetTGLTextureTargetEnum(mTarget);
+ TGLenum GLTarget = GetTGLTextureTargetEnum(mTarget);
tglEnable(GLTarget);
for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
@@ -355,20 +334,7 @@ void TGLTexture::SetWrapT(eTextureWrap aMode) {
//-----------------------------------------------------------------------
void TGLTexture::SetWrapR(eTextureWrap aMode) {
- if (mbContainsData) {
- TGLenum GLTarget = GetTGLTextureTargetEnum(mTarget);
-
- tglEnable(GLTarget);
- tglEnable(GLTarget);
- for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
- tglBindTexture(GLTarget, mvTextureHandles[i]);
-
- //tglTexParameteri(GLTarget, TGL_TEXTURE_WRAP_R, GetGLWrap(aMode));
- }
- tglDisable(GLTarget);
-
- tglDisable(GLTarget);
- }
+ HPL1_UNIMPLEMENTED(TGLTexture::SetWrapR);
}
//-----------------------------------------------------------------------
@@ -391,16 +357,6 @@ unsigned int TGLTexture::GetTextureHandle() {
//-----------------------------------------------------------------------
bool TGLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
- if (mType == eTextureType_RenderTarget)
- error("trying to create a rendertarget in SDLTexture::CreateBitmapToHandle");
-
- // For some reason checking for ARB texture is not working on radeon cards.
- /*if(mTarget == eTextureTarget_Rect && !GLEE_ARB_texture_rectangle)
- {
- Error("Rectangle texture target not supported\n");
- return false;
- }*/
-
TGLenum GLTarget = InitCreation(alHandleIdx);
Bitmap2D *pBitmapSrc = pBmp;
@@ -425,7 +381,6 @@ bool TGLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
// Log("OldSize: %d x %d ",mlWidth,mlHeight);
int lOldW = _width;
- //int lOldH = _height;
int lSizeDiv = (int)pow((float)2, (int)mlSizeLevel);
@@ -469,12 +424,7 @@ bool TGLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
// Log("Loading %s %d x %d\n",msName.c_str(), pSrc->GetWidth(), pSrc->GetHeight());
// Log("Channels: %d Format: %x\n",lChannels, format);
-
- if (mTarget == eTextureTarget_1D)
- tglTexImage2D(GLTarget, 0, internalFormat, _width, 1, 0, format,
- TGL_UNSIGNED_BYTE, pPixelSrc);
- else
- tglTexImage2D(GLTarget, 0, internalFormat, _width, _height,
+ tglTexImage2D(GLTarget, 0, internalFormat, _width, _height,
0, format, TGL_UNSIGNED_BYTE, pPixelSrc);
//if (tglGetError() != TGL_NO_ERROR)
@@ -529,7 +479,7 @@ TGLenum TGLTexture::GetGLWrap(eTextureWrap aMode) {
case eTextureWrap_ClampToEdge:
return TGL_CLAMP_TO_EDGE;
case eTextureWrap_ClampToBorder:
- return TGL_CLAMP_TO_EDGE;//TGL_CLAMP_TO_BORDER;
+ return TGL_CLAMP_TO_EDGE; // TGL_CLAMP_TO_BORDER;
default:
break;
}
@@ -537,5 +487,5 @@ TGLenum TGLTexture::GetGLWrap(eTextureWrap aMode) {
return TGL_REPEAT;
}
-}
-//-----------------------------------------------------------------------
\ No newline at end of file
+} // namespace hpl
+ //-----------------------------------------------------------------------
\ No newline at end of file
Commit: 152009b18fd089ecc54a9e2370e28f73fef07ac8
https://github.com/scummvm/scummvm/commit/152009b18fd089ecc54a9e2370e28f73fef07ac8
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:06+01:00
Commit Message:
HPL1: enable software renderer usage
Changed paths:
engines/hpl1/engine/game/low_level_game_setup.cpp
diff --git a/engines/hpl1/engine/game/low_level_game_setup.cpp b/engines/hpl1/engine/game/low_level_game_setup.cpp
index 6be8749f814..ee663751f02 100644
--- a/engines/hpl1/engine/game/low_level_game_setup.cpp
+++ b/engines/hpl1/engine/game/low_level_game_setup.cpp
@@ -21,6 +21,7 @@
#include "hpl1/engine/game/low_level_game_setup.h"
#include "hpl1/engine/system/low_level_system.h"
+#include "hpl1/engine/impl/low_level_graphics_tgl.h"
#include "hpl1/engine/impl/KeyboardSDL.h"
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
#include "hpl1/engine/impl/LowLevelInputSDL.h"
@@ -39,7 +40,7 @@ static iLowLevelGraphics *createLowLevelGfx()
if (Hpl1::useOpenGL())
return hplNew(cLowLevelGraphicsSDL, ());
#endif
- error("only opengl graphics are supported");
+ return hplNew(LowLevelGraphicsTGL, ());
}
LowLevelGameSetup::LowLevelGameSetup() {
Commit: 97b0b966dcff90d29facfa329595330fe9e589b8
https://github.com/scummvm/scummvm/commit/97b0b966dcff90d29facfa329595330fe9e589b8
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:06+01:00
Commit Message:
HPL1: Fix Some Shadowing Compiler Warnings in Newton Polyhedra Code
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp b/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
index e8bdfcb8062..467a1260cbc 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
@@ -1904,9 +1904,9 @@ dgEdge* dgPolyhedra::AddFace(dgInt32 count, const dgInt32* const index,
udata0 = udata1;
udata1 = dgUnsigned64(userdata ? userdata[i] : 0);
- dgPairKey code(i0, i1);
- dgEdge tmpEdge(i0, m_faceSecuence, udata0);
- node = Insert(tmpEdge, code.GetVal(), state);
+ dgPairKey codeI(i0, i1);
+ dgEdge tmpEdgeI(i0, m_faceSecuence, udata0);
+ node = Insert(tmpEdgeI, codeI.GetVal(), state);
_ASSERTE(!state);
dgEdge* const edge1 = &node->GetInfo();
@@ -2015,10 +2015,10 @@ void dgPolyhedra::DeleteFace(dgEdge* const face)
for (dgInt32 i = 0; i < count; i++)
{
- dgEdge* const ptr = edgeList[i];
- if (ptr->m_twin->m_incidentFace < 0)
+ dgEdge* const ptrI = edgeList[i];
+ if (ptrI->m_twin->m_incidentFace < 0)
{
- DeleteEdge(ptr);
+ DeleteEdge(ptrI);
}
}
}
@@ -2247,15 +2247,15 @@ bool dgPolyhedra::GetConectedSurface(dgPolyhedra &polyhedra) const
while (index)
{
index--;
- dgEdge* const edge = stack[index];
+ dgEdge* const edgeI = stack[index];
- if (edge->m_mark == mark)
+ if (edgeI->m_mark == mark)
{
continue;
}
dgInt32 count = 0;
- dgEdge* ptr = edge;
+ dgEdge* ptr = edgeI;
do
{
ptr->m_mark = mark;
@@ -2272,7 +2272,7 @@ bool dgPolyhedra::GetConectedSurface(dgPolyhedra &polyhedra) const
}
ptr = ptr->m_next;
- } while (ptr != edge);
+ } while (ptr != edgeI);
polyhedra.AddFace(count, &faceIndex[0], &faceDataIndex[0]);
}
@@ -2576,17 +2576,17 @@ dgFloat64 dgPolyhedra::EdgePenalty(const dgBigVector* const pool,
&& (adj->m_prev->m_incidentFace == face))
{
- dgInt32 i0 = adj->m_next->m_incidentVertex;
- const dgBigVector& p0 = pool[i0];
+ dgInt32 iv0 = adj->m_next->m_incidentVertex;
+ const dgBigVector& pv0 = pool[iv0];
- dgInt32 i1 = adj->m_incidentVertex;
- const dgBigVector& p1 = pool[i1];
+ dgInt32 iv1 = adj->m_incidentVertex;
+ const dgBigVector& pv1 = pool[iv1];
- dgInt32 i2 = adj->m_prev->m_incidentVertex;
- const dgBigVector& p2 = pool[i2];
+ dgInt32 iv2 = adj->m_prev->m_incidentVertex;
+ const dgBigVector& pv2 = pool[iv2];
- dgBigVector n0((p1 - p0) * (p2 - p0));
- dgBigVector n1((p1 - p) * (p2 - p));
+ dgBigVector n0((pv1 - pv0) * (pv2 - pv0));
+ dgBigVector n1((pv1 - p) * (pv2 - p));
// dgFloat64 mag0 = n0 % n0;
// _ASSERTE (mag0 > dgFloat64(1.0e-16f));
@@ -2595,10 +2595,10 @@ dgFloat64 dgPolyhedra::EdgePenalty(const dgBigVector* const pool,
// dgFloat64 mag1 = n1 % n1;
// mag1 = sqrt (mag1);
- dgFloat64 dot = n0 % n1;
- if (dot < dgFloat64(0.0f))
+ dgFloat64 dotn = n0 % n1;
+ if (dotn < dgFloat64(0.0f))
{
-// if (dot <= (mag0 * mag1 * dgFloat32 (0.707f)) || (mag0 > (dgFloat64(16.0f) * mag1))) {
+// if (dotn <= (mag0 * mag1 * dgFloat32 (0.707f)) || (mag0 > (dgFloat64(16.0f) * mag1))) {
penalty = true;
break;
}
@@ -2610,24 +2610,23 @@ dgFloat64 dgPolyhedra::EdgePenalty(const dgBigVector* const pool,
dgFloat64 aspect = dgFloat32(-1.0f);
if (!penalty)
{
- dgInt32 i0 = edge->m_twin->m_incidentVertex;
- dgBigVector p0(pool[i0]);
+ dgInt32 iv0 = edge->m_twin->m_incidentVertex;
+ dgBigVector pv0(pool[iv0]);
aspect = dgFloat32(1.0f);
- for (dgEdge* ptr = edge->m_twin->m_next->m_twin->m_next; ptr != edge; ptr =
- ptr->m_twin->m_next)
+ for (dgEdge* ptrn = edge->m_twin->m_next->m_twin->m_next; ptrn != edge; ptrn = ptr->m_twin->m_next)
{
- if (ptr->m_incidentFace > 0)
+ if (ptrn->m_incidentFace > 0)
{
- dgInt32 i0 = ptr->m_next->m_incidentVertex;
- const dgBigVector& p1 = pool[i0];
+ dgInt32 iv1 = ptrn->m_next->m_incidentVertex;
+ const dgBigVector& pv1 = pool[iv1];
- dgInt32 i1 = ptr->m_prev->m_incidentVertex;
- const dgBigVector& p2 = pool[i1];
+ dgInt32 iv2 = ptrn->m_prev->m_incidentVertex;
+ const dgBigVector& pv2 = pool[iv2];
- dgBigVector e0(p1 - p0);
- dgBigVector e1(p2 - p1);
- dgBigVector e2(p0 - p2);
+ dgBigVector e0(pv1 - pv0);
+ dgBigVector e1(pv2 - pv1);
+ dgBigVector e2(pv0 - pv2);
dgFloat64 mag0 = e0 % e0;
dgFloat64 mag1 = e1 % e1;
Commit: 19d952f3b0596a07596d15587ba452e254cce42a
https://github.com/scummvm/scummvm/commit/19d952f3b0596a07596d15587ba452e254cce42a
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:07+01:00
Commit Message:
HPL1: Further Shadowing Compiler Warning Fixes in Newton Polyhedra Code
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp b/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
index 467a1260cbc..ae297accce8 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
@@ -2945,11 +2945,11 @@ void dgPolyhedra::Optimize(const dgFloat64* const array, dgInt32 strideInBytes,
index0 = ptr->m_incidentVertex;
index1 = ptr->m_twin->m_incidentVertex;
- dgVertexCollapseVertexMetric &metric = vertexMetrics[index0];
- dgBigVector p(vertexPool[index1]);
+ dgVertexCollapseVertexMetric &metricZero = vertexMetrics[index0];
+ dgBigVector pv(vertexPool[index1]);
dgFloat64 cost = dgFloat32(-1.0f);
- if (metric.Evalue(p) < tol2)
+ if (metricZero.Evalue(pv) < tol2)
{
cost = EdgePenalty(&vertexPool[0], ptr);
}
@@ -2990,11 +2990,11 @@ void dgPolyhedra::Optimize(const dgFloat64* const array, dgInt32 strideInBytes,
if (ptr1->m_mark != mark)
{
ptr1->m_mark = mark;
- dgVertexCollapseVertexMetric &metric = vertexMetrics[index0];
- dgBigVector p(vertexPool[index1]);
+ dgVertexCollapseVertexMetric &metricZero = vertexMetrics[index0];
+ dgBigVector pv(vertexPool[index1]);
dgFloat64 cost = dgFloat32(-1.0f);
- if (metric.Evalue(p) < tol2)
+ if (metricZero.Evalue(pv) < tol2)
{
cost = EdgePenalty(&vertexPool[0], ptr1);
}
@@ -3023,11 +3023,11 @@ void dgPolyhedra::Optimize(const dgFloat64* const array, dgInt32 strideInBytes,
if (ptr1->m_twin->m_mark != mark)
{
ptr1->m_twin->m_mark = mark;
- dgVertexCollapseVertexMetric &metric = vertexMetrics[index1];
- dgBigVector p(vertexPool[index0]);
+ dgVertexCollapseVertexMetric &metricOne = vertexMetrics[index1];
+ dgBigVector pv(vertexPool[index0]);
dgFloat64 cost = dgFloat32(-1.0f);
- if (metric.Evalue(p) < tol2)
+ if (metricOne.Evalue(pv) < tol2)
{
cost = EdgePenalty(&vertexPool[0], ptr1->m_twin);
}
@@ -3072,24 +3072,24 @@ dgEdge* dgPolyhedra::FindEarTip(dgEdge* const face, const dgFloat64* const pool,
dgBigVector p0(&pool[ptr->m_prev->m_incidentVertex * stride]);
dgBigVector p1(&pool[ptr->m_incidentVertex * stride]);
dgBigVector d0(p1 - p0);
- dgFloat64 f = sqrt(d0 % d0);
- if (f < dgFloat64(1.0e-10f))
+ dgFloat64 f0 = sqrt(d0 % d0);
+ if (f0 < dgFloat64(1.0e-10f))
{
- f = dgFloat64(1.0e-10f);
+ f0 = dgFloat64(1.0e-10f);
}
- d0 = d0.Scale(dgFloat64(1.0f) / f);
+ d0 = d0.Scale(dgFloat64(1.0f) / f0);
dgFloat64 minAngle = dgFloat32(10.0f);
do
{
dgBigVector p2(&pool[ptr->m_next->m_incidentVertex * stride]);
dgBigVector d1(p2 - p1);
- dgFloat32 f = dgSqrt (d1 % d1);
- if (f < dgFloat32(1.0e-10f))
+ dgFloat32 f1 = dgSqrt (d1 % d1);
+ if (f1 < dgFloat32(1.0e-10f))
{
- f = dgFloat32(1.0e-10f);
+ f1 = dgFloat32(1.0e-10f);
}
- d1 = d1.Scale(dgFloat32(1.0f) / f);
+ d1 = d1.Scale(dgFloat32(1.0f) / f1);
dgBigVector n(d0 * d1);
dgFloat64 angle = normal % n;
@@ -3124,25 +3124,25 @@ dgEdge* dgPolyhedra::FindEarTip(dgEdge* const face, const dgFloat64* const pool,
continue;
}
- dgBigVector p0(&pool[ear->m_prev->m_incidentVertex * stride]);
- dgBigVector p1(&pool[ear->m_incidentVertex * stride]);
- dgBigVector p2(&pool[ear->m_next->m_incidentVertex * stride]);
+ dgBigVector pv0(&pool[ear->m_prev->m_incidentVertex * stride]);
+ dgBigVector pv1(&pool[ear->m_incidentVertex * stride]);
+ dgBigVector pv2(&pool[ear->m_next->m_incidentVertex * stride]);
- dgBigVector p10(p1 - p0);
- dgBigVector p21(p2 - p1);
- dgBigVector p02(p0 - p2);
+ dgBigVector pv10(pv1 - pv0);
+ dgBigVector pv21(pv2 - pv1);
+ dgBigVector pv02(pv0 - pv2);
for (ptr = ear->m_next->m_next; ptr != ear->m_prev; ptr = ptr->m_next)
{
dgBigVector p(&pool[ptr->m_incidentVertex * stride]);
- dgFloat64 side = ((p - p0) * p10) % normal;
+ dgFloat64 side = ((p - pv0) * pv10) % normal;
if (side < dgFloat64(0.05f))
{
- side = ((p - p1) * p21) % normal;
+ side = ((p - pv1) * pv21) % normal;
if (side < dgFloat64(0.05f))
{
- side = ((p - p2) * p02) % normal;
+ side = ((p - pv2) * pv02) % normal;
if (side < dgFloat32(0.05f))
{
break;
@@ -3299,13 +3299,13 @@ void dgPolyhedra::MarkAdjacentCoplanarFaces(dgPolyhedra& polyhedraOut,
while (index)
{
index--;
- dgEdge* const face = stack[index];
- deleteEdge[deleteCount] = face;
+ dgEdge* const stackFace = stack[index];
+ deleteEdge[deleteCount] = stackFace;
deleteCount++;
_ASSERTE(deleteCount < dgInt32 (sizeof (deleteEdge) / sizeof (deleteEdge[0])));
- _ASSERTE(face->m_next->m_next->m_next == face);
+ _ASSERTE(stackFace->m_next->m_next->m_next == stackFace);
- dgEdge* edge = face;
+ dgEdge* edge = stackFace;
do
{
dgEdge* const ptr = edge->m_twin;
@@ -3370,7 +3370,7 @@ void dgPolyhedra::MarkAdjacentCoplanarFaces(dgPolyhedra& polyhedraOut,
}
edge = edge->m_next;
- } while (edge != face);
+ } while (edge != stackFace);
}
polyhedraOut.EndFace();
}
Commit: 605756f515e788d2a78f622b09590c16d76600a2
https://github.com/scummvm/scummvm/commit/605756f515e788d2a78f622b09590c16d76600a2
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:07+01:00
Commit Message:
HPL1: Fix Enumerated vs. Non-Enumerated Conditional GCC Compiler Warning
Changed paths:
engines/hpl1/engine/libraries/angelscript/angelscript.h
engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/angelscript.h b/engines/hpl1/engine/libraries/angelscript/angelscript.h
index 268d8dedd7a..74a52c6a53e 100644
--- a/engines/hpl1/engine/libraries/angelscript/angelscript.h
+++ b/engines/hpl1/engine/libraries/angelscript/angelscript.h
@@ -167,6 +167,7 @@ enum asECallConvTypes
// Object type flags
enum asEObjTypeFlags
{
+ asOBJ_NULL = 0,
asOBJ_REF = (1<<0),
asOBJ_VALUE = (1<<1),
asOBJ_GC = (1<<2),
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.cpp
index 04f240d9e9b..944b88c30f0 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.cpp
@@ -417,7 +417,7 @@ asCFuncdefType::asCFuncdefType(asCScriptEngine *en, asCScriptFunction *func) : a
// A function pointer is special kind of reference type
// It must be possible to garbage collect, as funcdefs can form circular references if used as delegates
- flags = asOBJ_REF | asOBJ_GC | asOBJ_FUNCDEF | (func->IsShared() ? asOBJ_SHARED : 0);
+ flags = asOBJ_REF | asOBJ_GC | asOBJ_FUNCDEF | (func->IsShared() ? asOBJ_SHARED : asOBJ_NULL);
name = func->name;
nameSpace = func->nameSpace;
module = func->module;
Commit: 4d140170ea8debc81c29bdd3535fd6dfbdda8ba4
https://github.com/scummvm/scummvm/commit/4d140170ea8debc81c29bdd3535fd6dfbdda8ba4
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:07+01:00
Commit Message:
HPL1: add debug channel for textures
Changed paths:
engines/hpl1/debug.h
engines/hpl1/detection.cpp
diff --git a/engines/hpl1/debug.h b/engines/hpl1/debug.h
index f6f52304d7a..2864847fbf5 100644
--- a/engines/hpl1/debug.h
+++ b/engines/hpl1/debug.h
@@ -35,7 +35,8 @@ enum DebugChannels {
kDebugOpenGL = 1 << 3,
kDebugRenderer = 1 << 4,
kDebugAudio = 1 << 5,
- kDebugSaves = 1 << 6
+ kDebugSaves = 1 << 6,
+ kDebugTextures = 1 << 7
};
enum DebugLevels {
diff --git a/engines/hpl1/detection.cpp b/engines/hpl1/detection.cpp
index 1041596909b..873bf26cac5 100644
--- a/engines/hpl1/detection.cpp
+++ b/engines/hpl1/detection.cpp
@@ -38,6 +38,7 @@ const DebugChannelDef Hpl1MetaEngineDetection::debugFlagList[] = {
{ Hpl1::kDebugRenderer, "Renderer", "Rederer debug channel"},
{ Hpl1::kDebugAudio, "Audio", "Audio debug channel"},
{ Hpl1::kDebugSaves, "Saves", "Channel for debugging game saving and loading"},
+ { Hpl1::kDebugTextures, "Textures", "Texture debug channel"},
DEBUG_CHANNEL_END
};
Commit: 43d27c121f16e299467a7d7158f9e37877f6f9e7
https://github.com/scummvm/scummvm/commit/43d27c121f16e299467a7d7158f9e37877f6f9e7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:07+01:00
Commit Message:
HPL1: add logging in texture wrap setters
Changed paths:
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/texture_tgl.cpp
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index 87502489580..b15484456d0 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -425,6 +425,8 @@ void cSDLTexture::SetWrapS(eTextureWrap aMode) {
if (mbContainsData) {
GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
+ Hpl1::logInfo(Hpl1::kDebugTextures, "setting texture '%s' s wrap to %d\n", msName.c_str(), aMode);
+
GL_CHECK(glEnable(GLTarget));
for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
glBindTexture(GLTarget, mvTextureHandles[i]);
@@ -442,6 +444,8 @@ void cSDLTexture::SetWrapT(eTextureWrap aMode) {
if (mbContainsData) {
GLenum GLTarget = mpGfxSDL->GetGLTextureTargetEnum(mTarget);
+ Hpl1::logInfo(Hpl1::kDebugTextures, "setting texture '%s' t wrap to %d\n", msName.c_str(), aMode);
+
GL_CHECK(glEnable(GLTarget));
for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
glBindTexture(GLTarget, mvTextureHandles[i]);
diff --git a/engines/hpl1/engine/impl/texture_tgl.cpp b/engines/hpl1/engine/impl/texture_tgl.cpp
index 190474c5788..d6aebf388fb 100644
--- a/engines/hpl1/engine/impl/texture_tgl.cpp
+++ b/engines/hpl1/engine/impl/texture_tgl.cpp
@@ -305,6 +305,8 @@ void TGLTexture::SetWrapS(eTextureWrap aMode) {
if (mbContainsData) {
TGLenum GLTarget = GetTGLTextureTargetEnum(mTarget);
+ Hpl1::logInfo(Hpl1::kDebugTextures, "setting texture '%s' s wrap to %d\n", msName.c_str(), aMode);
+
tglEnable(GLTarget);
for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
tglBindTexture(GLTarget, mvTextureHandles[i]);
@@ -321,6 +323,8 @@ void TGLTexture::SetWrapT(eTextureWrap aMode) {
if (mbContainsData) {
TGLenum GLTarget = GetTGLTextureTargetEnum(mTarget);
+ Hpl1::logInfo(Hpl1::kDebugTextures, "setting texture '%s' t wrap to %d\n", msName.c_str(), aMode);
+
tglEnable(GLTarget);
for (size_t i = 0; i < mvTextureHandles.size(); ++i) {
tglBindTexture(GLTarget, mvTextureHandles[i]);
Commit: 1ff72fbb06ec88350346dae26318949d27c2dc91
https://github.com/scummvm/scummvm/commit/1ff72fbb06ec88350346dae26318949d27c2dc91
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:07+01:00
Commit Message:
HPL1: use texture debug channel in texture classes
Changed paths:
engines/hpl1/engine/impl/SDLTexture.cpp
engines/hpl1/engine/impl/texture_tgl.cpp
diff --git a/engines/hpl1/engine/impl/SDLTexture.cpp b/engines/hpl1/engine/impl/SDLTexture.cpp
index b15484456d0..261d067f502 100644
--- a/engines/hpl1/engine/impl/SDLTexture.cpp
+++ b/engines/hpl1/engine/impl/SDLTexture.cpp
@@ -79,7 +79,7 @@ cSDLTexture::cSDLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt,
mbContainsData = false;
if (aType == eTextureType_RenderTarget) {
- Hpl1::logError(Hpl1::kDebugGraphics, "use of render target%s", ".");
+ Hpl1::logError(Hpl1::kDebugTextures, "use of render target%s", ".");
// mpPBuffer = hplNew( cPBuffer, (mpLowLevelGraphics,true) );
}
@@ -147,7 +147,7 @@ bool cSDLTexture::CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps) {
}
if (avBitmaps->size() < 6) {
- Hpl1::logError(Hpl1::kDebugOpenGL, "Only %d bitmaps supplied for creation of cube map, 6 needed.", avBitmaps->size());
+ Hpl1::logError(Hpl1::kDebugTextures, "Only %d bitmaps supplied for creation of cube map, 6 needed.", avBitmaps->size());
return false;
}
@@ -188,7 +188,7 @@ bool cSDLTexture::CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps) {
_bpp = lChannels * 8;
if (!cMath::IsPow2(_height) || !cMath::IsPow2(_width)) {
- Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
+ Hpl1::logWarning(Hpl1::kDebugTextures, "Texture '%s' does not have a pow2 size", msName.c_str());
}
}
@@ -244,7 +244,7 @@ bool cSDLTexture::CreateFromArray(unsigned char *apPixelData, int alChannels, co
_bpp = lChannels * 8;
if (!cMath::IsPow2(_height) || !cMath::IsPow2(_width) || !cMath::IsPow2(avSize.z)) {
- Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
+ Hpl1::logWarning(Hpl1::kDebugTextures, "Texture '%s' does not have a pow2 size", msName.c_str());
}
if (mTarget == eTextureTarget_1D) {
@@ -513,7 +513,7 @@ bool cSDLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
_height = pBitmapSrc->getHeight();
if ((!cMath::IsPow2(_height) || !cMath::IsPow2(_width)) && mTarget != eTextureTarget_Rect)
- Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
+ Hpl1::logWarning(Hpl1::kDebugTextures, "Texture '%s' does not have a pow2 size", msName.c_str());
int lChannels = 0;
GLint internalFormat = 0;
diff --git a/engines/hpl1/engine/impl/texture_tgl.cpp b/engines/hpl1/engine/impl/texture_tgl.cpp
index d6aebf388fb..80e04f4a807 100644
--- a/engines/hpl1/engine/impl/texture_tgl.cpp
+++ b/engines/hpl1/engine/impl/texture_tgl.cpp
@@ -159,7 +159,7 @@ bool TGLTexture::CreateFromArray(unsigned char *apPixelData, int alChannels, con
_bpp = alChannels * 8;
if (!cMath::IsPow2(_height) || !cMath::IsPow2(_width) || !cMath::IsPow2(avSize.z)) {
- Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
+ Hpl1::logWarning(Hpl1::kDebugTextures, "texture '%s' does not have a pow2 size", msName.c_str());
}
tglTexImage2D(GLTarget, 0, format, _width, _height,
@@ -369,7 +369,7 @@ bool TGLTexture::CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx) {
_height = pBitmapSrc->getHeight();
if ((!cMath::IsPow2(_height) || !cMath::IsPow2(_width)) && mTarget != eTextureTarget_Rect)
- Hpl1::logWarning(Hpl1::kDebugGraphics, "Texture '%s' does not have a pow2 size", msName.c_str());
+ Hpl1::logWarning(Hpl1::kDebugTextures, "texture '%s' does not have a pow2 size", msName.c_str());
int lChannels = 0;
TGLint internalFormat = 0;
Commit: 3049bb1e01c333cc5fba7ab908ce377f76de365e
https://github.com/scummvm/scummvm/commit/3049bb1e01c333cc5fba7ab908ce377f76de365e
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:07+01:00
Commit Message:
HPL1: Fix Duplicated Branch GCC Compiler Warning in Player Helper Code
Changed paths:
engines/hpl1/penumbra-overture/PlayerHelper.cpp
diff --git a/engines/hpl1/penumbra-overture/PlayerHelper.cpp b/engines/hpl1/penumbra-overture/PlayerHelper.cpp
index a7e8aaecbfa..f819572338a 100644
--- a/engines/hpl1/penumbra-overture/PlayerHelper.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerHelper.cpp
@@ -2173,7 +2173,9 @@ void cPlayerHidden::UpdateEnemyTooClose(float afTimeStep) {
if (InShadows()) // mbHidden)
{
if (mfCheckEnemyCloseCount <= 0) {
- float fMaxDist = mbHidden ? 11.0f : 11.0f;
+ // FIXME: Change value of FMaxDist when hidden?
+ //float fMaxDist = mbHidden ? 11.0f : 11.0f;
+ float fMaxDist = 11.0f;
float fMaxDistSqr = fMaxDist * fMaxDist;
// Reset variables
Commit: 060031ebfff00cbfc941819dfa4293b51a2ef486
https://github.com/scummvm/scummvm/commit/060031ebfff00cbfc941819dfa4293b51a2ef486
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:07+01:00
Commit Message:
HPL1: Fix Signed vs. Unsigned Comparison GCC Compiler Warnings
Changed paths:
engines/hpl1/engine/impl/MeshLoaderCollada.cpp
engines/hpl1/penumbra-overture/GameEntity.cpp
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
index 1731b78f84f..ac7fa2e0951 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
@@ -1911,7 +1911,7 @@ void cMeshLoaderCollada::AddSceneObjects(cColladaNode *apNode, cWorld3D *apWorld
if (apNode->msSource != "") {
// Get number of chars in prefix.
int lPrefixChars = 1;
- while (lPrefixChars < apNode->msName.size() &&
+ while (lPrefixChars < (int)apNode->msName.size() &&
apNode->msName[lPrefixChars] != '_' &&
apNode->msName[lPrefixChars] != '\0') {
lPrefixChars++;
@@ -2119,9 +2119,9 @@ void cMeshLoaderCollada::AddSectorChildren(cColladaNode *apNode, tString asSecto
// Get number of digits
lDigits = 1;
- while (apNode->msName.length() > lStartChar + 4 + lDigits &&
+ while ((int)apNode->msName.length() > lStartChar + 4 + lDigits &&
apNode->msName[lStartChar + 4 + lDigits] != '_' &&
- apNode->msName.length() >= 7 + lDigits &&
+ (int)apNode->msName.length() >= 7 + lDigits &&
apNode->msName[7 + lDigits] != 0) {
lDigits++;
}
diff --git a/engines/hpl1/penumbra-overture/GameEntity.cpp b/engines/hpl1/penumbra-overture/GameEntity.cpp
index e3fbc5629d3..505d2e20c30 100644
--- a/engines/hpl1/penumbra-overture/GameEntity.cpp
+++ b/engines/hpl1/penumbra-overture/GameEntity.cpp
@@ -1039,7 +1039,7 @@ void iGameEntity::LoadFromSaveData(iGameEntity_SaveData *apSaveData) {
// Animations
if (mpMeshEntity) {
- if (mpMeshEntity->GetAnimationStateNum() == apSaveData->mvAnimations.Size()) {
+ if (mpMeshEntity->GetAnimationStateNum() == (int)apSaveData->mvAnimations.Size()) {
for (int i = 0; i < mpMeshEntity->GetAnimationStateNum(); ++i) {
cAnimationState *pAnim = mpMeshEntity->GetAnimationState(i);
cGameEntityAnimation_SaveData &saveAnim = apSaveData->mvAnimations[i];
Commit: 2c2509bcb60ff131714cb630cac5151ce0e898c0
https://github.com/scummvm/scummvm/commit/2c2509bcb60ff131714cb630cac5151ce0e898c0
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:07+01:00
Commit Message:
HPL1: disable texture wrap options in tgl texture
Changed paths:
engines/hpl1/engine/impl/texture_tgl.cpp
diff --git a/engines/hpl1/engine/impl/texture_tgl.cpp b/engines/hpl1/engine/impl/texture_tgl.cpp
index 80e04f4a807..03df9cb3641 100644
--- a/engines/hpl1/engine/impl/texture_tgl.cpp
+++ b/engines/hpl1/engine/impl/texture_tgl.cpp
@@ -475,6 +475,9 @@ void TGLTexture::PostCreation(TGLenum aGLTarget) {
//-----------------------------------------------------------------------
TGLenum TGLTexture::GetGLWrap(eTextureWrap aMode) {
+ // FIXME: enable other modes when related bugs are fixed
+ return TGL_REPEAT;
+#if 0
switch (aMode) {
case eTextureWrap_Clamp:
return TGL_CLAMP;
@@ -489,6 +492,7 @@ TGLenum TGLTexture::GetGLWrap(eTextureWrap aMode) {
}
return TGL_REPEAT;
+#endif
}
} // namespace hpl
Commit: 74cc0517a119b89db5f32a75c616d13832bf722a
https://github.com/scummvm/scummvm/commit/74cc0517a119b89db5f32a75c616d13832bf722a
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:08+01:00
Commit Message:
HPL1: Fix Type Limits GCC Compiler Warnings in Angelscript String Interface
These functions accept the start parameter as an unsigned value and thus
the value can never be less than zero, thus this check is redundant.
There is a later function which does accept a signed value for the start
in the Angelscript interface and this is left intact.
Changed paths:
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
index bf8fb3c31b7..dc7436d8773 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -363,7 +363,7 @@ static int StringCmp(const string &a, const string &b)
static int StringFindFirst(const string &sub, asUINT start, const string &str)
{
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
- return (int)str.find(sub, (size_t)(start < 0 ? string::npos : start));
+ return (int)str.find(sub, (size_t)start);
}
// This function returns the index of the first position where the one of the bytes in substring
@@ -375,7 +375,7 @@ static int StringFindFirst(const string &sub, asUINT start, const string &str)
static int StringFindFirstOf(const string &sub, asUINT start, const string &str)
{
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
- return (int)str.find_first_of(sub, (size_t)(start < 0 ? string::npos : start));
+ return (int)str.find_first_of(sub, (size_t)start);
}
// This function returns the index of the last position where the one of the bytes in substring
@@ -387,7 +387,7 @@ static int StringFindFirstOf(const string &sub, asUINT start, const string &str)
static int StringFindLastOf(const string &sub, asUINT start, const string &str)
{
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
- return (int)str.find_last_of(sub, (size_t)(start < 0 ? string::npos : start));
+ return (int)str.find_last_of(sub, (size_t)start);
}
// This function returns the index of the first position where a byte other than those in substring
@@ -398,7 +398,7 @@ static int StringFindLastOf(const string &sub, asUINT start, const string &str)
static int StringFindFirstNotOf(const string &sub, asUINT start, const string &str)
{
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
- return (int)str.find_first_not_of(sub, (size_t)(start < 0 ? string::npos : start));
+ return (int)str.find_first_not_of(sub, (size_t)start);
}
// This function returns the index of the last position where a byte other than those in substring
@@ -409,7 +409,7 @@ static int StringFindFirstNotOf(const string &sub, asUINT start, const string &s
static int StringFindLastNotOf(const string &sub, asUINT start, const string &str)
{
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
- return (int)str.find_last_not_of(sub, (size_t)(start < 0 ? string::npos : start));
+ return (int)str.find_last_not_of(sub, (size_t)start);
}
// This function returns the index of the last position where the substring
Commit: d0e388671db6ab37b9841647a1153cc56c6625b7
https://github.com/scummvm/scummvm/commit/d0e388671db6ab37b9841647a1153cc56c6625b7
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:08+01:00
Commit Message:
HPL1: Further GCC Compiler Shadowing Warning Fixes
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgCollisionSphere.cpp
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionSphere.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionSphere.cpp
index e5e9ec6f220..b1653575b51 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionSphere.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionSphere.cpp
@@ -98,19 +98,19 @@ void dgCollisionSphere::Init(dgFloat32 radius, dgMemoryAllocator *allocator) {
sizeof(dgVector), 3 * sizeof(dgFloat32), 0, count, indexList, 0.001f);
_ASSERTE(vertexCount == DG_SPHERE_VERTEX_COUNT);
- for (dgInt32 i = 0; i < vertexCount; i++) {
- m_unitSphere[i] = tmpVectex[i];
+ for (dgInt32 j = 0; j < vertexCount; j++) {
+ m_unitSphere[j] = tmpVectex[j];
}
dgPolyhedra polyhedra(m_allocator);
polyhedra.BeginFace();
- for (dgInt32 i = 0; i < count; i += 3) {
+ for (dgInt32 j = 0; j < count; j += 3) {
#ifdef _DEBUG
- dgEdge *const edge = polyhedra.AddFace(indexList[i], indexList[i + 1],
- indexList[i + 2]);
+ dgEdge *const edge = polyhedra.AddFace(indexList[j], indexList[j + 1],
+ indexList[j + 2]);
_ASSERTE(edge);
#else
- polyhedra.AddFace(indexList[i], indexList[i + 1], indexList[i + 2]);
+ polyhedra.AddFace(indexList[j], indexList[j + 1], indexList[j + 2]);
#endif
}
polyhedra.EndFace();
Commit: fb96678f5001772660c30bca0dd2b82b3df3efa1
https://github.com/scummvm/scummvm/commit/fb96678f5001772660c30bca0dd2b82b3df3efa1
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:08+01:00
Commit Message:
HPL1: Further Fixes for GCC Shadowing Compiler Warnings in Newton Library
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp b/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
index ae297accce8..d03184694cb 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
@@ -3282,15 +3282,17 @@ void dgPolyhedra::MarkAdjacentCoplanarFaces(dgPolyhedra& polyhedraOut,
dgInt32 faceMark = IncLRU();
dgInt32 faceIndexCount = 0;
- dgEdge* ptr = face;
- do
{
- ptr->m_mark = faceMark;
- faceIndex[faceIndexCount] = ptr->m_incidentVertex;
- faceIndexCount++;
- _ASSERTE(faceIndexCount < dgInt32(sizeof (faceIndex) / sizeof (faceIndex[0])));
- ptr = ptr->m_next;
- } while (ptr != face);
+ dgEdge* ptr = face;
+ do
+ {
+ ptr->m_mark = faceMark;
+ faceIndex[faceIndexCount] = ptr->m_incidentVertex;
+ faceIndexCount++;
+ _ASSERTE(faceIndexCount < dgInt32(sizeof (faceIndex) / sizeof (faceIndex[0])));
+ ptr = ptr->m_next;
+ } while (ptr != face);
+ }
polyhedraOut.AddFace(faceIndexCount, faceIndex);
dgInt32 index = 1;
@@ -3424,9 +3426,9 @@ void dgPolyhedra::RefineTriangulation(const dgFloat64* const vertex,
for (dgEdge* ptr = face->m_next->m_next; mag2 < dgFloat32(1.0e-12f);
ptr = ptr->m_next)
{
- dgInt32 i1 = ptr->m_incidentVertex * stride;
- dgBigVector p1(vertex[i1], vertex[i1 + 1], vertex[i1 + 2], dgFloat32(0.0f));
- p1p0 = p1 - p0;
+ dgInt32 ii1 = ptr->m_incidentVertex * stride;
+ dgBigVector pp1(vertex[ii1], vertex[ii1 + 1], vertex[ii1 + 2], dgFloat32(0.0f));
+ p1p0 = pp1 - p0;
mag2 = p1p0 % p1p0;
}
@@ -3449,38 +3451,38 @@ void dgPolyhedra::RefineTriangulation(const dgFloat64* const vertex,
dgEdge* const edge = FindEdge(key.m_i0, key.m_i1);
if (edge)
{
- dgInt32 i0 = edge->m_incidentVertex * stride;
- dgInt32 i1 = edge->m_next->m_incidentVertex * stride;
- dgInt32 i2 = edge->m_next->m_next->m_incidentVertex * stride;
- dgInt32 i3 = edge->m_twin->m_prev->m_incidentVertex * stride;
+ dgInt32 ti0 = edge->m_incidentVertex * stride;
+ dgInt32 ti1 = edge->m_next->m_incidentVertex * stride;
+ dgInt32 ti2 = edge->m_next->m_next->m_incidentVertex * stride;
+ dgInt32 ti3 = edge->m_twin->m_prev->m_incidentVertex * stride;
- dgBigVector p0(vertex[i0], vertex[i0 + 1], vertex[i0 + 2],
+ dgBigVector tp0(vertex[ti0], vertex[ti0 + 1], vertex[ti0 + 2],
dgFloat64(0.0f));
- dgBigVector p1(vertex[i1], vertex[i1 + 1], vertex[i1 + 2],
+ dgBigVector tp1(vertex[ti1], vertex[ti1 + 1], vertex[ti1 + 2],
dgFloat64(0.0f));
- dgBigVector p2(vertex[i2], vertex[i2 + 1], vertex[i2 + 2],
+ dgBigVector tp2(vertex[ti2], vertex[ti2 + 1], vertex[ti2 + 2],
dgFloat64(0.0f));
- dgBigVector p3(vertex[i3], vertex[i3 + 1], vertex[i3 + 2],
+ dgBigVector tp3(vertex[ti3], vertex[ti3 + 1], vertex[ti3 + 2],
dgFloat64(0.0f));
- p0 = matrix.TransformVector(p0);
- p1 = matrix.TransformVector(p1);
- p2 = matrix.TransformVector(p2);
- p3 = matrix.TransformVector(p3);
+ tp0 = matrix.TransformVector(tp0);
+ tp1 = matrix.TransformVector(tp1);
+ tp2 = matrix.TransformVector(tp2);
+ tp3 = matrix.TransformVector(tp3);
dgFloat64 circleTest[3][3];
- circleTest[0][0] = p0[0] - p3[0];
- circleTest[0][1] = p0[1] - p3[1];
+ circleTest[0][0] = tp0[0] - tp3[0];
+ circleTest[0][1] = tp0[1] - tp3[1];
circleTest[0][2] = circleTest[0][0] * circleTest[0][0]
+ circleTest[0][1] * circleTest[0][1];
- circleTest[1][0] = p1[0] - p3[0];
- circleTest[1][1] = p1[1] - p3[1];
+ circleTest[1][0] = tp1[0] - tp3[0];
+ circleTest[1][1] = tp1[1] - tp3[1];
circleTest[1][2] = circleTest[1][0] * circleTest[1][0]
+ circleTest[1][1] * circleTest[1][1];
- circleTest[2][0] = p2[0] - p3[0];
- circleTest[2][1] = p2[1] - p3[1];
+ circleTest[2][0] = tp2[0] - tp3[0];
+ circleTest[2][1] = tp2[1] - tp3[1];
circleTest[2][2] = circleTest[2][0] * circleTest[2][0]
+ circleTest[2][1] * circleTest[2][1];
@@ -3521,28 +3523,28 @@ void dgPolyhedra::RefineTriangulation(const dgFloat64* const vertex,
if (backFace0 && (backFace0->m_incidentFace > 0)
&& (backFace0->m_twin->m_incidentFace > 0))
{
- dgDiagonalEdge key(backFace0);
- dignonals.Append(key);
+ dgDiagonalEdge keyb0(backFace0);
+ dignonals.Append(keyb0);
}
if (backFace1 && (backFace1->m_incidentFace > 0)
&& (backFace1->m_twin->m_incidentFace > 0))
{
- dgDiagonalEdge key(backFace1);
- dignonals.Append(key);
+ dgDiagonalEdge keyb1(backFace1);
+ dignonals.Append(keyb1);
}
if (frontFace0 && (frontFace0->m_incidentFace > 0)
&& (frontFace0->m_twin->m_incidentFace > 0))
{
- dgDiagonalEdge key(frontFace0);
- dignonals.Append(key);
+ dgDiagonalEdge keyf0(frontFace0);
+ dignonals.Append(keyf0);
}
if (frontFace1 && (frontFace1->m_incidentFace > 0)
&& (frontFace1->m_twin->m_incidentFace > 0))
{
- dgDiagonalEdge key(frontFace1);
- dignonals.Append(key);
+ dgDiagonalEdge keyf1(frontFace1);
+ dignonals.Append(keyf1);
}
}
}
@@ -3615,15 +3617,15 @@ void dgPolyhedra::OptimizeTriangulation(const dgFloat64* const vertex,
flatFace.RefineTriangulation(vertex, stride);
dgInt32 mark = flatFace.IncLRU();
- dgPolyhedra::Iterator iter(flatFace);
- for (iter.Begin(); iter; iter++)
+ dgPolyhedra::Iterator iterFF(flatFace);
+ for (iterFF.Begin(); iterFF; iterFF++)
{
- dgEdge* const edge = &(*iter);
- if (edge->m_mark != mark)
+ dgEdge* const edgeFF = &(*iterFF);
+ if (edgeFF->m_mark != mark)
{
- if (edge->m_incidentFace > 0)
+ if (edgeFF->m_incidentFace > 0)
{
- dgEdge* ptr = edge;
+ dgEdge* ptr = edgeFF;
dgInt32 vertexCount = 0;
do
{
@@ -3632,7 +3634,7 @@ void dgPolyhedra::OptimizeTriangulation(const dgFloat64* const vertex,
_ASSERTE(vertexCount < dgInt32 (sizeof (polygon) / sizeof (polygon[0])));
ptr->m_mark = mark;
ptr = ptr->m_next;
- } while (ptr != edge);
+ } while (ptr != edgeFF);
if (vertexCount >= 3)
{
buildConvex.AddFace(vertexCount, polygon);
@@ -3698,14 +3700,14 @@ void dgPolyhedra::Triangulate(const dgFloat64* const vertex,
dgInt32* const index = (dgInt32 *) &heap[0];
dgInt64* const data = (dgInt64 *) &index[count];
dgInt32 i = 0;
- dgEdge* ptr = edge;
+ dgEdge* ptrE = edge;
do
{
- index[i] = ptr->m_incidentVertex;
- data[i] = dgInt64(ptr->m_userData);
+ index[i] = ptrE->m_incidentVertex;
+ data[i] = dgInt64(ptrE->m_userData);
i++;
- ptr = ptr->m_next;
- } while (ptr != edge);
+ ptrE = ptrE->m_next;
+ } while (ptrE != edge);
leftOver->AddFace(i, index, data);
}
@@ -3969,10 +3971,10 @@ void dgPolyhedra::ConvexPartition(const dgFloat64* const vertex,
normal = normal.Scale(dgFloat64(1.0f) / sqrt(normal % normal));
edge = NULL;
- dgPolyhedra::Iterator iter(flatFace);
- for (iter.Begin(); iter; iter++)
+ dgPolyhedra::Iterator iterFF(flatFace);
+ for (iterFF.Begin(); iterFF; iterFF++)
{
- edge = &(*iter);
+ edge = &(*iterFF);
if (edge->m_incidentFace < 0)
{
break;
@@ -4009,10 +4011,10 @@ void dgPolyhedra::ConvexPartition(const dgFloat64* const vertex,
if (isConvex)
{
- dgPolyhedra::Iterator iter(flatFace);
- for (iter.Begin(); iter; iter++)
+ dgPolyhedra::Iterator iterF(flatFace);
+ for (iterF.Begin(); iterF; iterF++)
{
- ptr = &(*iter);
+ ptr = &(*iterF);
if (ptr->m_incidentFace < 0)
{
if (ptr->m_mark < mark)
@@ -4077,27 +4079,27 @@ void dgPolyhedra::ConvexPartition(const dgFloat64* const vertex,
}
dgInt32 mark = flatFace.IncLRU();
- dgPolyhedra::Iterator iter(flatFace);
- for (iter.Begin(); iter; iter++)
+ dgPolyhedra::Iterator iterFLF(flatFace);
+ for (iterFLF.Begin(); iterFLF; iterFLF++)
{
- dgEdge* const edge = &(*iter);
- if (edge->m_mark != mark)
+ dgEdge* const edgeFLF = &(*iterFLF);
+ if (edgeFLF->m_mark != mark)
{
- if (edge->m_incidentFace > 0)
+ if (edgeFLF->m_incidentFace > 0)
{
- dgEdge* ptr = edge;
- dgInt32 diagonalCount = 0;
+ dgEdge* ptr = edgeFLF;
+ dgInt32 diagonalCountTemp = 0;
do
{
- polygon[diagonalCount] = ptr->m_incidentVertex;
- diagonalCount++;
- _ASSERTE(diagonalCount < dgInt32 (sizeof (polygon) / sizeof (polygon[0])));
+ polygon[diagonalCountTemp] = ptr->m_incidentVertex;
+ diagonalCountTemp++;
+ _ASSERTE(diagonalCountTemp < dgInt32 (sizeof (polygon) / sizeof (polygon[0])));
ptr->m_mark = mark;
ptr = ptr->m_next;
- } while (ptr != edge);
- if (diagonalCount >= 3)
+ } while (ptr != edgeFLF);
+ if (diagonalCountTemp >= 3)
{
- buildConvex.AddFace(diagonalCount, polygon);
+ buildConvex.AddFace(diagonalCountTemp, polygon);
}
}
}
Commit: 2df505441789c70e7f37a804b9463a8a59406e54
https://github.com/scummvm/scummvm/commit/2df505441789c70e7f37a804b9463a8a59406e54
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:08+01:00
Commit Message:
HPL1: remove rand usage
Changed paths:
engines/hpl1/engine/math/Math.cpp
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index 5826b84c704..d4f6ce6acb8 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -32,7 +32,8 @@
#include <map>
#include <math.h>
#include <stdlib.h>
-//#include <time.h>
+#include <limits>
+#include "hpl1/hpl1.h"
namespace hpl {
@@ -45,13 +46,14 @@ static char mpTempChar[1024];
//-----------------------------------------------------------------------
int cMath::RandRectl(int alMin, int alMax) {
- return (rand() % (alMax - alMin + 1)) + alMin;
+ return Hpl1::g_engine->getRandomNumber(alMax - alMin + 1) + alMin;
}
//-----------------------------------------------------------------------
float cMath::RandRectf(float afMin, float afMax) {
- float fRand = (float)rand() / (float)RAND_MAX;
+ float fRand = static_cast<float>(Hpl1::g_engine->getRandomNumber(std::numeric_limits<uint32>::max()))
+ / static_cast<float>(std::numeric_limits<uint32>::max());
return afMin + fRand * (afMax - afMin);
}
Commit: af0dea70c03f0ed1f7a8b5ca966343d1562ebc7b
https://github.com/scummvm/scummvm/commit/af0dea70c03f0ed1f7a8b5ca966343d1562ebc7b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:08+01:00
Commit Message:
HPL1: fix range in random number generator
Changed paths:
engines/hpl1/engine/math/Math.cpp
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index d4f6ce6acb8..73ab24d360e 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -46,7 +46,7 @@ static char mpTempChar[1024];
//-----------------------------------------------------------------------
int cMath::RandRectl(int alMin, int alMax) {
- return Hpl1::g_engine->getRandomNumber(alMax - alMin + 1) + alMin;
+ return Hpl1::g_engine->getRandomNumber(alMax - alMin) + alMin;
}
//-----------------------------------------------------------------------
Commit: d60d57f86ee0f498cda6974d097798bc22e49adb
https://github.com/scummvm/scummvm/commit/d60d57f86ee0f498cda6974d097798bc22e49adb
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:08+01:00
Commit Message:
HPL1: Further Fixes for GCC Shadowing Warnings in Newton Physics Library
These are emitted if -Wshadow is passed to GCC.
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
engines/hpl1/engine/libraries/newton/physics/dgBallConstraint.cpp
engines/hpl1/engine/libraries/newton/physics/dgBody.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgTypes.cpp b/engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
index 99b61ab2dc0..d8900892414 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
@@ -433,14 +433,14 @@ static dgInt32 SortVertices(dgFloat64* const vertexList, dgInt32 stride,
if (index == dgInt32(0xffffffff))
{
dgFloat64 swept = vertexList[m + firstSortAxis] + sweptWindow;
- dgInt32 k = i * stride + stride;
+ dgInt32 q = i * stride + stride;
for (dgInt32 i1 = i + 1; i1 < vertexCount; i1++)
{
- index = dgInt32(vertexList[k + 0]);
+ index = dgInt32(vertexList[q + 0]);
if (index == dgInt32(0xffffffff))
{
- dgFloat64 val = vertexList[k + firstSortAxis];
+ dgFloat64 val = vertexList[q + firstSortAxis];
if (val >= swept)
{
break;
@@ -448,15 +448,15 @@ static dgInt32 SortVertices(dgFloat64* const vertexList, dgInt32 stride,
bool test = true;
for (dgInt32 t = 0; test && (t < compareCount); t++)
{
- dgFloat64 val = fabs(vertexList[m + t + 2] - vertexList[k + t + 2]);
- test = test && (val <= tol);
+ dgFloat64 v = fabs(vertexList[m + t + 2] - vertexList[k + t + 2]);
+ test = test && (v <= tol);
}
if (test)
{
- vertexList[k + 0] = dgFloat64(count);
+ vertexList[q + 0] = dgFloat64(count);
}
}
- k += stride;
+ q += stride;
}
memcpy(&vertexList[count * stride + 2], &vertexList[m + 2],
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgBallConstraint.cpp b/engines/hpl1/engine/libraries/newton/physics/dgBallConstraint.cpp
index e59bb55b7b6..9e08834dc66 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgBallConstraint.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgBallConstraint.cpp
@@ -245,8 +245,8 @@ dgUnsigned32 dgBallConstraint::JacobianDerivative(dgContraintDescritor ¶ms)
if (limits.s.m_twistLimit) {
if (angle.m_x > m_twistAngle) {
- dgVector p0(matrix0.m_posit + matrix0.m_up.Scale(MIN_JOINT_PIN_LENGTH));
- InitPointParam(pointData, m_stiffness, p0, p0);
+ dgVector pv0(matrix0.m_posit + matrix0.m_up.Scale(MIN_JOINT_PIN_LENGTH));
+ InitPointParam(pointData, m_stiffness, pv0, pv0);
const dgVector &dir = matrix0.m_right;
CalculatePointDerivative(ret, params, dir, pointData, &m_jointForce[ret]);
@@ -268,8 +268,8 @@ dgUnsigned32 dgBallConstraint::JacobianDerivative(dgContraintDescritor ¶ms)
(relVelocErr + penetrationErr) * params.m_invTimestep, params);
ret++;
} else if (angle.m_x < -m_twistAngle) {
- dgVector p0(matrix0.m_posit + matrix0.m_up.Scale(MIN_JOINT_PIN_LENGTH));
- InitPointParam(pointData, m_stiffness, p0, p0);
+ dgVector pv0(matrix0.m_posit + matrix0.m_up.Scale(MIN_JOINT_PIN_LENGTH));
+ InitPointParam(pointData, m_stiffness, pv0, pv0);
dgVector dir(matrix0.m_right.Scale(-dgFloat32(1.0f)));
CalculatePointDerivative(ret, params, dir, pointData, &m_jointForce[ret]);
@@ -297,9 +297,9 @@ dgUnsigned32 dgBallConstraint::JacobianDerivative(dgContraintDescritor ¶ms)
dgFloat32 coneCos;
coneCos = matrix0.m_front % matrix1.m_front;
if (coneCos < m_coneAngleCos) {
- dgVector p0(
+ dgVector pm0(
matrix0.m_posit + matrix0.m_front.Scale(MIN_JOINT_PIN_LENGTH));
- InitPointParam(pointData, m_stiffness, p0, p0);
+ InitPointParam(pointData, m_stiffness, pm0, pm0);
dgVector tangentDir(matrix0.m_front * matrix1.m_front);
tangentDir = tangentDir.Scale(
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgBody.cpp b/engines/hpl1/engine/libraries/newton/physics/dgBody.cpp
index 69086de87ef..2a9af578bf2 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgBody.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgBody.cpp
@@ -296,9 +296,9 @@ void dgBody::UpdateCollisionMatrix(dgFloat32 timestep, dgInt32 threadIndex) {
dgVector &box1Min = compoundCollision->m_root->m_p0;
dgVector &box1Max = compoundCollision->m_root->m_p1;
- dgVector boxSize((box1Max - box1Min).Scale(dgFloat32(0.25f)));
+ dgVector boxSizeC((box1Max - box1Min).Scale(dgFloat32(0.25f)));
for (dgInt32 j = 0; j < 3; j++) {
- if (dgAbsf(step[j]) > boxSize[j]) {
+ if (dgAbsf(step[j]) > boxSizeC[j]) {
if (step[j] > dgFloat32(0.0f)) {
box1Max[j] += step[j];
} else {
@@ -720,10 +720,10 @@ dgConstraint *dgBody::GetNextJoint(dgConstraint *joint) const {
if (node->GetInfo().m_joint == joint) {
for (node = node->GetNext(); node; node = node->GetNext()) {
- dgConstraint *joint;
- joint = node->GetInfo().m_joint;
- if (joint->GetId() >= dgUnknownConstraintId) {
- return joint;
+ dgConstraint *jointT;
+ jointT = node->GetInfo().m_joint;
+ if (jointT->GetId() >= dgUnknownConstraintId) {
+ return jointT;
}
}
}
@@ -754,10 +754,10 @@ dgConstraint *dgBody::GetNextContact(dgConstraint *joint) const {
if (node->GetInfo().m_joint == joint) {
for (node = node->GetNext(); node; node = node->GetNext()) {
- dgConstraint *joint;
- joint = node->GetInfo().m_joint;
- if (joint->GetId() == dgContactConstraintId) {
- return joint;
+ dgConstraint *jointT;
+ jointT = node->GetInfo().m_joint;
+ if (jointT->GetId() == dgContactConstraintId) {
+ return jointT;
}
}
}
Commit: 4cd3902fb015a4ce1a1de054c32af3f5f95bf7f3
https://github.com/scummvm/scummvm/commit/4cd3902fb015a4ce1a1de054c32af3f5f95bf7f3
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:08+01:00
Commit Message:
HPL1: replace std::list with Common::List
Changed paths:
engines/hpl1/engine/ai/AINodeContainer.h
engines/hpl1/engine/ai/AStar.h
engines/hpl1/engine/game/Updater.h
engines/hpl1/engine/graphics/Bone.h
engines/hpl1/engine/graphics/Color.h
engines/hpl1/engine/graphics/GraphicsDrawer.h
engines/hpl1/engine/graphics/GraphicsTypes.h
engines/hpl1/engine/graphics/Material.h
engines/hpl1/engine/graphics/ParticleEmitter.h
engines/hpl1/engine/graphics/Renderer2D.h
engines/hpl1/engine/graphics/RendererPostEffects.h
engines/hpl1/engine/gui/GuiSet.h
engines/hpl1/engine/gui/GuiTypes.h
engines/hpl1/engine/gui/Widget.h
engines/hpl1/engine/gui/WidgetWindow.h
engines/hpl1/engine/haptic/HapticTypes.h
engines/hpl1/engine/impl/LowLevelInputSDL.cpp
engines/hpl1/engine/impl/MeshLoaderCollada.h
engines/hpl1/engine/input/Input.h
engines/hpl1/engine/math/BoundingVolume.h
engines/hpl1/engine/math/MathTypes.h
engines/hpl1/engine/physics/Body2D.h
engines/hpl1/engine/physics/CollideData2D.h
engines/hpl1/engine/physics/Physics.h
engines/hpl1/engine/physics/PhysicsBody.cpp
engines/hpl1/engine/physics/PhysicsBody.h
engines/hpl1/engine/physics/PhysicsWorld.h
engines/hpl1/engine/resources/FrameBitmap.h
engines/hpl1/engine/resources/ImageManager.h
engines/hpl1/engine/resources/MeshLoaderHandler.h
engines/hpl1/engine/resources/ParticleManager.h
engines/hpl1/engine/resources/ResourceManager.h
engines/hpl1/engine/resources/Resources.h
engines/hpl1/engine/resources/VideoManager.h
engines/hpl1/engine/resources/low_level_resources.cpp
engines/hpl1/engine/scene/Entity.h
engines/hpl1/engine/scene/Entity2D.h
engines/hpl1/engine/scene/Entity3D.h
engines/hpl1/engine/scene/Light2D.h
engines/hpl1/engine/scene/Light3D.h
engines/hpl1/engine/scene/Node.h
engines/hpl1/engine/scene/Node2D.h
engines/hpl1/engine/scene/Node3D.h
engines/hpl1/engine/scene/PortalContainer.h
engines/hpl1/engine/scene/Scene.h
engines/hpl1/engine/scene/SectorVisibility.h
engines/hpl1/engine/scene/SoundEntity.h
engines/hpl1/engine/scene/SoundSource.h
engines/hpl1/engine/scene/Tile.h
engines/hpl1/engine/scene/World3D.h
engines/hpl1/engine/sound/LowLevelSound.h
engines/hpl1/engine/sound/MusicHandler.h
engines/hpl1/engine/sound/SoundChannel.h
engines/hpl1/engine/sound/SoundHandler.h
engines/hpl1/engine/system/BinTree.h
engines/hpl1/engine/system/Container.h
engines/hpl1/engine/system/SerializeClass.h
engines/hpl1/engine/system/SystemTypes.h
engines/hpl1/penumbra-overture/AttackHandler.cpp
engines/hpl1/penumbra-overture/CharacterMove.cpp
engines/hpl1/penumbra-overture/CharacterMove.h
engines/hpl1/penumbra-overture/DeathMenu.h
engines/hpl1/penumbra-overture/EffectHandler.cpp
engines/hpl1/penumbra-overture/EffectHandler.h
engines/hpl1/penumbra-overture/GameDamageArea.cpp
engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
engines/hpl1/penumbra-overture/GameEnemy_Worm.h
engines/hpl1/penumbra-overture/GameMessageHandler.h
engines/hpl1/penumbra-overture/GameTypes.h
engines/hpl1/penumbra-overture/HapticGameCamera.cpp
engines/hpl1/penumbra-overture/HapticGameCamera.h
engines/hpl1/penumbra-overture/Inventory.h
engines/hpl1/penumbra-overture/MainMenu.h
engines/hpl1/penumbra-overture/MapHandler.cpp
engines/hpl1/penumbra-overture/MapHandler.h
engines/hpl1/penumbra-overture/Notebook.h
engines/hpl1/penumbra-overture/NumericalPanel.h
engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
engines/hpl1/penumbra-overture/RadioHandler.h
diff --git a/engines/hpl1/engine/ai/AINodeContainer.h b/engines/hpl1/engine/ai/AINodeContainer.h
index cd504fec678..00b48ca9c5e 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.h
+++ b/engines/hpl1/engine/ai/AINodeContainer.h
@@ -32,6 +32,7 @@
#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
+#include "common/list.h"
namespace hpl {
@@ -87,7 +88,7 @@ private:
typedef std::vector<cAINode *> tAINodeVec;
typedef tAINodeVec::iterator tAINodeVecIt;
-typedef std::list<cAINode *> tAINodeList;
+typedef Common::List<cAINode *> tAINodeList;
typedef tAINodeList::iterator tAINodeListIt;
typedef std::map<tString, cAINode *> tAINodeMap;
diff --git a/engines/hpl1/engine/ai/AStar.h b/engines/hpl1/engine/ai/AStar.h
index 2ab857e3712..adaa6a50abf 100644
--- a/engines/hpl1/engine/ai/AStar.h
+++ b/engines/hpl1/engine/ai/AStar.h
@@ -31,6 +31,7 @@
#include "hpl1/engine/game/GameTypes.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "common/list.h"
namespace hpl {
@@ -44,7 +45,7 @@ typedef tAINodeSet::iterator tAINodeSetIt;
//--------------------------------------
-typedef std::list<cAINode *> tAINodeList;
+typedef Common::List<cAINode *> tAINodeList;
typedef tAINodeList::iterator tAINodeListIt;
//--------------------------------------
diff --git a/engines/hpl1/engine/game/Updater.h b/engines/hpl1/engine/game/Updater.h
index 2fa9c1862aa..300c4217f25 100644
--- a/engines/hpl1/engine/game/Updater.h
+++ b/engines/hpl1/engine/game/Updater.h
@@ -28,17 +28,17 @@
#ifndef HPL_UPDATER_H
#define HPL_UPDATER_H
-#include <list>
#include <map>
#include "hpl1/engine/system/SystemTypes.h"
+#include "common/list.h"
namespace hpl {
class iUpdateable;
class LowLevelSystem;
-typedef std::list<iUpdateable *> tUpdateableList;
+typedef Common::List<iUpdateable *> tUpdateableList;
typedef tUpdateableList::iterator tUpdateableListIt;
typedef std::map<tString, tUpdateableList> tUpdateContainerMap;
diff --git a/engines/hpl1/engine/graphics/Bone.h b/engines/hpl1/engine/graphics/Bone.h
index 7f0cf5f05f1..cd89aeb129f 100644
--- a/engines/hpl1/engine/graphics/Bone.h
+++ b/engines/hpl1/engine/graphics/Bone.h
@@ -33,13 +33,14 @@
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "common/list.h"
namespace hpl {
class cSkeleton;
class cBone;
-typedef std::list<cBone *> tBoneList;
+typedef Common::List<cBone *> tBoneList;
typedef tBoneList::iterator tBoneListIt;
typedef cSTLIterator<cBone *, tBoneList, tBoneListIt> cBoneIterator;
diff --git a/engines/hpl1/engine/graphics/Color.h b/engines/hpl1/engine/graphics/Color.h
index 32aec36a8c1..07d60d82bc7 100644
--- a/engines/hpl1/engine/graphics/Color.h
+++ b/engines/hpl1/engine/graphics/Color.h
@@ -28,10 +28,10 @@
#ifndef HPL_COLOR_H
#define HPL_COLOR_H
-#include <list>
#include <vector>
#include "hpl1/engine/system/SystemTypes.h"
+#include "common/list.h"
namespace hpl {
@@ -62,7 +62,7 @@ public:
void FromVec(float *apV);
};
-typedef std::list<cColor> tColorList;
+typedef Common::List<cColor> tColorList;
typedef tColorList::iterator tColorListIt;
typedef std::vector<cColor> tColorVec;
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.h b/engines/hpl1/engine/graphics/GraphicsDrawer.h
index 5aa243a7a1c..85f5bc7364a 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.h
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.h
@@ -30,6 +30,7 @@
#include "hpl1/engine/graphics/BackgroundImage.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
+#include "common/list.h"
#include <vector>
namespace hpl {
@@ -69,7 +70,7 @@ typedef tGfxBufferSet::iterator tGfxBufferSetIt;
class cResources;
-typedef std::list<cGfxObject *> tGfxObjectList;
+typedef Common::List<cGfxObject *> tGfxObjectList;
typedef tGfxObjectList::iterator tGfxObjectListIt;
class cGraphicsDrawer {
diff --git a/engines/hpl1/engine/graphics/GraphicsTypes.h b/engines/hpl1/engine/graphics/GraphicsTypes.h
index d0c78d22fba..2e5bcca7119 100644
--- a/engines/hpl1/engine/graphics/GraphicsTypes.h
+++ b/engines/hpl1/engine/graphics/GraphicsTypes.h
@@ -30,7 +30,7 @@
#include "hpl1/engine/graphics/Color.h"
#include "hpl1/engine/math/MathTypes.h"
-#include <list>
+#include "common/list.h"
#include <vector>
namespace hpl {
@@ -155,7 +155,7 @@ public:
cColor col;
};
-typedef std::list<cVertex> tVertexList;
+typedef Common::List<cVertex> tVertexList;
typedef tVertexList::iterator tVertexListIt;
typedef std::vector<cVertex> tVertexVec;
diff --git a/engines/hpl1/engine/graphics/Material.h b/engines/hpl1/engine/graphics/Material.h
index 2dc6dd0bb33..dc500ce3d04 100644
--- a/engines/hpl1/engine/graphics/Material.h
+++ b/engines/hpl1/engine/graphics/Material.h
@@ -34,6 +34,7 @@
#include "hpl1/engine/resources/ResourceBase.h"
#include "hpl1/engine/resources/ResourceImage.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "common/list.h"
#include <vector>
class TiXmlElement;
@@ -194,7 +195,7 @@ public:
eMaterialTexture mType;
};
-typedef std::list<cTextureType> tTextureTypeList;
+typedef Common::List<cTextureType> tTextureTypeList;
typedef tTextureTypeList::iterator tTextureTypeListIt;
//---------------------------------------------------
@@ -396,7 +397,7 @@ public:
eMaterialPicture aPicture, cRenderer3D *apRenderer3D) = 0;
};
-typedef std::list<iMaterialType *> tMaterialTypeList;
+typedef Common::List<iMaterialType *> tMaterialTypeList;
typedef tMaterialTypeList::iterator tMaterialTypeListIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter.h b/engines/hpl1/engine/graphics/ParticleEmitter.h
index 2ca95f72758..afb1992011c 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter.h
@@ -32,7 +32,7 @@
#include "hpl1/engine/graphics/Material.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <list>
+#include "common/list.h"
#include <map>
#include <vector>
@@ -191,7 +191,7 @@ protected:
cParticle *CreateParticle();
};
-typedef std::list<iParticleEmitter *> tParticleEmitterList;
+typedef Common::List<iParticleEmitter *> tParticleEmitterList;
typedef tParticleEmitterList::iterator tParticleEmitterListIt;
//////////////////////////////////////////////////////
diff --git a/engines/hpl1/engine/graphics/Renderer2D.h b/engines/hpl1/engine/graphics/Renderer2D.h
index b0019cbf97d..54024637823 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.h
+++ b/engines/hpl1/engine/graphics/Renderer2D.h
@@ -28,7 +28,6 @@
#ifndef HPL_RENDERER2D_H
#define HPL_RENDERER2D_H
-#include <list>
#include <math.h>
#include <set>
@@ -37,6 +36,7 @@
#include "hpl1/engine/graphics/Mesh2d.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/scene/Light2D.h"
+#include "common/list.h"
namespace hpl {
@@ -71,7 +71,7 @@ typedef tRenderObjectSet::iterator tRenderObjectSetIt;
typedef std::multiset<cRenderObject2D, cRenderTransObjectCompare> tRenderTransObjectSet;
typedef tRenderTransObjectSet::iterator tRenderTransObjectSetIt;
-typedef std::list<cRenderObject2D> tRenderObjectList;
+typedef Common::List<cRenderObject2D> tRenderObjectList;
typedef tRenderObjectList::iterator tRenderObjectListIt;
class cResources;
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.h b/engines/hpl1/engine/graphics/RendererPostEffects.h
index 9cd34c93cc7..367bd46c25b 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.h
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.h
@@ -28,12 +28,12 @@
#ifndef HPL_RENDERER_POST_EFFECTS_H
#define HPL_RENDERER_POST_EFFECTS_H
-#include <list>
#include <math.h>
#include <set>
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
+#include "common/list.h"
namespace hpl {
diff --git a/engines/hpl1/engine/gui/GuiSet.h b/engines/hpl1/engine/gui/GuiSet.h
index 88dfb3f10f0..2e706497088 100644
--- a/engines/hpl1/engine/gui/GuiSet.h
+++ b/engines/hpl1/engine/gui/GuiSet.h
@@ -30,7 +30,7 @@
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/gui/GuiTypes.h"
-#include <list>
+#include "common/list.h"
namespace hpl {
@@ -62,7 +62,7 @@ class cWidgetComboBox;
//---------------------------------------------
-typedef std::list<iGuiPopUp *> tGuiPopUpList;
+typedef Common::List<iGuiPopUp *> tGuiPopUpList;
typedef tGuiPopUpList::iterator tGuiPopUpListIt;
//---------------------------------------------
@@ -88,7 +88,7 @@ typedef tGuiRenderObjectSet::iterator tGuiRenderObjectSetIt;
//-----------------------------------------------
-typedef std::list<cGuiClipRegion *> tGuiClipRegionList;
+typedef Common::List<cGuiClipRegion *> tGuiClipRegionList;
typedef tGuiClipRegionList::iterator tGuiClipRegionListIt;
class cGuiClipRegion {
diff --git a/engines/hpl1/engine/gui/GuiTypes.h b/engines/hpl1/engine/gui/GuiTypes.h
index 5d189ff19ab..b8d03bf2c78 100644
--- a/engines/hpl1/engine/gui/GuiTypes.h
+++ b/engines/hpl1/engine/gui/GuiTypes.h
@@ -31,6 +31,7 @@
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/input/InputTypes.h"
#include "hpl1/engine/math/MathTypes.h"
+#include "common/list.h"
namespace hpl {
@@ -311,14 +312,14 @@ typedef bool (*tGuiCallbackFunc)(void *, iWidget *, cGuiMessageData &);
//--------------------------------
-typedef std::list<iWidget *> tWidgetList;
+typedef Common::List<iWidget *> tWidgetList;
typedef tWidgetList::iterator tWidgetListIt;
//--------------------------------
class cGuiGfxElement;
-typedef std::list<cGuiGfxElement *> tGuiGfxElementList;
+typedef Common::List<cGuiGfxElement *> tGuiGfxElementList;
typedef tGuiGfxElementList::iterator tGuiGfxElementListIt;
//--------------------------------
diff --git a/engines/hpl1/engine/gui/Widget.h b/engines/hpl1/engine/gui/Widget.h
index 4c90a4d2399..86621866e2e 100644
--- a/engines/hpl1/engine/gui/Widget.h
+++ b/engines/hpl1/engine/gui/Widget.h
@@ -30,7 +30,7 @@
#include "hpl1/engine/gui/GuiTypes.h"
#include "hpl1/engine/system/low_level_system.h"
-#include <list>
+#include "common/list.h"
#include <vector>
namespace hpl {
@@ -57,7 +57,7 @@ struct cWidgetCallback {
tGuiCallbackFunc mpFunc;
};
-typedef std::list<cWidgetCallback> tWidgetCallbackList;
+typedef Common::List<cWidgetCallback> tWidgetCallbackList;
typedef tWidgetCallbackList::iterator tWidgetCallbackListIt;
//--------------------------------
diff --git a/engines/hpl1/engine/gui/WidgetWindow.h b/engines/hpl1/engine/gui/WidgetWindow.h
index 0864e421799..6e9bb03804a 100644
--- a/engines/hpl1/engine/gui/WidgetWindow.h
+++ b/engines/hpl1/engine/gui/WidgetWindow.h
@@ -28,10 +28,11 @@
#ifndef HPL_WIDGET_WINDOW_H
#define HPL_WIDGET_WINDOW_H
-#include <list>
#include <vector>
#include "hpl1/engine/gui/Widget.h"
+#include "common/list.h"
+
namespace hpl {
diff --git a/engines/hpl1/engine/haptic/HapticTypes.h b/engines/hpl1/engine/haptic/HapticTypes.h
index fd40b74d3b9..43e658dc21d 100644
--- a/engines/hpl1/engine/haptic/HapticTypes.h
+++ b/engines/hpl1/engine/haptic/HapticTypes.h
@@ -28,10 +28,10 @@
#ifndef HPL_HAPTIC_TYPES_H
#define HPL_HAPTIC_TYPES_H
-#include <list>
#include <vector>
#include <map>
-#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/engine/system/SystemTypes.h"
+#include "common/list.h"
namespace hpl {
@@ -79,13 +79,13 @@ class iHapticSurface;
typedef std::vector<iHapticShape *> tHapticShapeVec;
typedef tHapticShapeVec::iterator tHapticShapeVecIt;
-typedef std::list<iHapticShape *> tHapticShapeList;
+typedef Common::List<iHapticShape *> tHapticShapeList;
typedef tHapticShapeList::iterator tHapticShapeListIt;
-typedef std::list<iHapticForce *> tHapticForceList;
+typedef Common::List<iHapticForce *> tHapticForceList;
typedef tHapticForceList::iterator tHapticForceListIt;
-typedef std::list<iHapticSurface *> tHapticSurfaceList;
+typedef Common::List<iHapticSurface *> tHapticSurfaceList;
typedef tHapticSurfaceList::iterator tHapticSurfaceListIt;
typedef std::map<tString, iHapticSurface *> tHapticSurfaceMap;
diff --git a/engines/hpl1/engine/impl/LowLevelInputSDL.cpp b/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
index dc4cdecbdf7..5a96cb4ec4a 100644
--- a/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
@@ -49,7 +49,7 @@ cLowLevelInputSDL::~cLowLevelInputSDL() {
//-----------------------------------------------------------------------
void cLowLevelInputSDL::LockInput(bool abX) {
- g_system->lockMouse(abX);
+ //g_system->lockMouse(abX);
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.h b/engines/hpl1/engine/impl/MeshLoaderCollada.h
index d565f7888cd..5e4e5be4ded 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.h
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.h
@@ -33,6 +33,7 @@
#include "hpl1/engine/physics/PhysicsJoint.h"
#include "hpl1/engine/resources/MeshLoader.h"
#include "hpl1/engine/system/MemoryManager.h"
+#include "common/list.h"
class TiXmlElement;
@@ -157,7 +158,7 @@ public:
}
};
-typedef std::list<cColladaExtraVtx> tColladaExtraVtxList;
+typedef Common::List<cColladaExtraVtx> tColladaExtraVtxList;
typedef tColladaExtraVtxList::iterator tColladaExtraVtxListIt;
typedef std::vector<tColladaExtraVtxList> tColladaExtraVtxListVec;
@@ -219,7 +220,7 @@ public:
int mlWeight;
};
-typedef std::list<cColladaJointPair> tColladaJointPairList;
+typedef Common::List<cColladaJointPair> tColladaJointPairList;
typedef tColladaJointPairList::iterator tColladaJointPairListIt;
typedef std::vector<tColladaJointPairList> tColladaJointPairListVec;
@@ -308,11 +309,11 @@ public:
tFloatVec mvValues;
};
-typedef std::list<cColladaTransform> tColladaTransformList;
+typedef Common::List<cColladaTransform> tColladaTransformList;
typedef tColladaTransformList::iterator tColladaTransformListIt;
class cColladaNode;
-typedef std::list<cColladaNode *> tColladaNodeList;
+typedef Common::List<cColladaNode *> tColladaNodeList;
typedef tColladaNodeList::iterator tColladaNodeListIt;
class cColladaNode {
diff --git a/engines/hpl1/engine/input/Input.h b/engines/hpl1/engine/input/Input.h
index 5e74ec5649f..6b2f3ccfd0a 100644
--- a/engines/hpl1/engine/input/Input.h
+++ b/engines/hpl1/engine/input/Input.h
@@ -28,12 +28,12 @@
#ifndef HPL_INPUT_H
#define HPL_INPUT_H
-#include <list>
#include <map>
#include "hpl1/engine/game/Updateable.h"
#include "hpl1/engine/input/InputTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "common/list.h"
namespace hpl {
@@ -49,7 +49,7 @@ typedef tActionMap::iterator tActionMapIt;
typedef std::multimap<tString, iAction *> tActionMultiMap;
typedef tActionMultiMap::iterator tActionMultiMapIt;
-typedef std::list<iInputDevice *> tInputDeviceList;
+typedef Common::List<iInputDevice *> tInputDeviceList;
typedef tInputDeviceList::iterator tInputDeviceListIt;
class cInput : public iUpdateable {
diff --git a/engines/hpl1/engine/math/BoundingVolume.h b/engines/hpl1/engine/math/BoundingVolume.h
index db4f58d2f1a..19e6ee2bd2b 100644
--- a/engines/hpl1/engine/math/BoundingVolume.h
+++ b/engines/hpl1/engine/math/BoundingVolume.h
@@ -51,7 +51,7 @@ enum eBVCollision {
eBVCollision_LastEnum
};
-typedef std::list<cBVTempArray> tBVTempArrayList;
+typedef Common::List<cBVTempArray> tBVTempArrayList;
typedef tBVTempArrayList::iterator tBVTempArrayListIt;
class cShadowVolumeBV {
diff --git a/engines/hpl1/engine/math/MathTypes.h b/engines/hpl1/engine/math/MathTypes.h
index 90778cc1546..e9d77262f96 100644
--- a/engines/hpl1/engine/math/MathTypes.h
+++ b/engines/hpl1/engine/math/MathTypes.h
@@ -34,8 +34,8 @@
#include "hpl1/engine/system/SystemTypes.h"
#include <cmath>
#include <cstdlib>
-#include <list>
#include <vector>
+#include "common/list.h"
namespace hpl {
@@ -262,7 +262,7 @@ public:
typedef cRect2<float> cRect2f;
typedef cRect2<int> cRect2l;
-typedef std::list<cRect2f> tRect2lList;
+typedef Common::List<cRect2f> tRect2lList;
typedef tRect2lList tRect2lListIt;
//-------------------------------------------
@@ -275,16 +275,16 @@ typedef cMatrix<float> cMatrixf;
typedef std::vector<cMatrixf> tMatrixfVec;
typedef tMatrixfVec::iterator tMatrixfVecIt;
-typedef std::list<cMatrixf> tMatrixfList;
+typedef Common::List<cMatrixf> tMatrixfList;
typedef tMatrixfList::iterator tMatrixfListIt;
-typedef std::list<cVector2f> tVector2fList;
+typedef Common::List<cVector2f> tVector2fList;
typedef tVector2fList::iterator tVector2fListIt;
typedef cVector3<float> cVector3f;
typedef cVector3<int> cVector3l;
-typedef std::list<cVector3f> tVector3fList;
+typedef Common::List<cVector3f> tVector3fList;
typedef tVector3fList::iterator tVector3fListIt;
typedef std::vector<cVector2f> tVector2fVec;
diff --git a/engines/hpl1/engine/physics/Body2D.h b/engines/hpl1/engine/physics/Body2D.h
index 8829c34530a..faa2057a0f9 100644
--- a/engines/hpl1/engine/physics/Body2D.h
+++ b/engines/hpl1/engine/physics/Body2D.h
@@ -32,6 +32,7 @@
#include "hpl1/engine/scene/Entity2D.h"
#include <map>
+#include "common/list.h"
namespace hpl {
@@ -42,7 +43,7 @@ class cCollisionMesh2D;
class cBody2D;
-typedef std::list<cBody2D *> tBody2DList;
+typedef Common::List<cBody2D *> tBody2DList;
typedef tBody2DList::iterator tBody2DListIt;
class cBody2D : public iEntity2D {
diff --git a/engines/hpl1/engine/physics/CollideData2D.h b/engines/hpl1/engine/physics/CollideData2D.h
index c4aa7e24e18..5d8632339cb 100644
--- a/engines/hpl1/engine/physics/CollideData2D.h
+++ b/engines/hpl1/engine/physics/CollideData2D.h
@@ -32,7 +32,7 @@
#include "hpl1/engine/physics/Body2D.h"
#include "hpl1/engine/scene/Tile.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <list>
+#include "common/list.h"
namespace hpl {
@@ -43,7 +43,7 @@ public:
int mlLayer;
};
-typedef std::list<cCollidedTile> tCollidedTileList;
+typedef Common::List<cCollidedTile> tCollidedTileList;
typedef tCollidedTileList::iterator tCollidedTileListIt;
class cCollideData2D {
diff --git a/engines/hpl1/engine/physics/Physics.h b/engines/hpl1/engine/physics/Physics.h
index 7b0709a76ff..15596df4fca 100644
--- a/engines/hpl1/engine/physics/Physics.h
+++ b/engines/hpl1/engine/physics/Physics.h
@@ -32,7 +32,7 @@
#include "hpl1/engine/haptic/HapticTypes.h"
#include "hpl1/engine/physics/PhysicsMaterial.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <list>
+#include "common/list.h"
#include <map>
namespace hpl {
@@ -47,7 +47,7 @@ class cHaptic;
//------------------------------------------------
-typedef std::list<iPhysicsWorld *> tPhysicsWorldList;
+typedef Common::List<iPhysicsWorld *> tPhysicsWorldList;
typedef tPhysicsWorldList::iterator tPhysicsWorldListIt;
typedef std::map<tString, cSurfaceData *> tSurfaceDataMap;
@@ -62,7 +62,7 @@ public:
float mfCount;
};
-typedef std::list<cPhysicsImpactCount> tPhysicsImpactCountList;
+typedef Common::List<cPhysicsImpactCount> tPhysicsImpactCountList;
typedef tPhysicsImpactCountList::iterator tPhysicsImpactCountListIt;
//------------------------------------------------
diff --git a/engines/hpl1/engine/physics/PhysicsBody.cpp b/engines/hpl1/engine/physics/PhysicsBody.cpp
index ddbfe9333f5..24768f5946b 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.cpp
+++ b/engines/hpl1/engine/physics/PhysicsBody.cpp
@@ -45,6 +45,7 @@
#include "hpl1/engine/scene/Node3D.h"
#include "hpl1/engine/math/Math.h"
+#include "common/algorithm.h"
namespace hpl {
@@ -342,7 +343,7 @@ void iPhysicsBody::AddAttachedCharacter(iCharacterBody *apChar) {
}
void iPhysicsBody::RemoveAttachedCharacter(iCharacterBody *apChar) {
- std::list<iCharacterBody *>::iterator it = mlstAttachedCharacters.begin();
+ Common::List<iCharacterBody *>::iterator it = mlstAttachedCharacters.begin();
for (; it != mlstAttachedCharacters.end(); ++it) {
if (apChar == *it) {
mlstAttachedCharacters.erase(it);
diff --git a/engines/hpl1/engine/physics/PhysicsBody.h b/engines/hpl1/engine/physics/PhysicsBody.h
index 1ee0456447b..865bf1f88c1 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.h
+++ b/engines/hpl1/engine/physics/PhysicsBody.h
@@ -55,7 +55,7 @@ public:
cPhysicsContactData *apContactData) = 0;
};
-typedef std::list<iPhysicsBodyCallback *> tPhysicsBodyCallbackList;
+typedef Common::List<iPhysicsBodyCallback *> tPhysicsBodyCallbackList;
typedef tPhysicsBodyCallbackList::iterator tPhysicsBodyCallbackListIt;
//------------------------------------------
@@ -294,7 +294,7 @@ protected:
std::vector<iPhysicsJoint *> mvJoints;
- std::list<iCharacterBody *> mlstAttachedCharacters;
+ Common::List<iCharacterBody *> mlstAttachedCharacters;
iPhysicsBody *mpScrapeBody;
cSoundEntity *mpScrapeSoundEntity;
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.h b/engines/hpl1/engine/physics/PhysicsWorld.h
index 4e5dea96296..149580c2143 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.h
+++ b/engines/hpl1/engine/physics/PhysicsWorld.h
@@ -54,22 +54,22 @@ class iPhysicsController;
class cWorld3D;
class cBoundingVolume;
-typedef std::list<iCollideShape *> tCollideShapeList;
+typedef Common::List<iCollideShape *> tCollideShapeList;
typedef tCollideShapeList::iterator tCollideShapeListIt;
typedef std::vector<iCollideShape *> tCollideShapeVec;
typedef tCollideShapeVec::iterator tCollideShapeVecIt;
-typedef std::list<iPhysicsBody *> tPhysicsBodyList;
+typedef Common::List<iPhysicsBody *> tPhysicsBodyList;
typedef tPhysicsBodyList::iterator tPhysicsBodyListIt;
-typedef std::list<iPhysicsJoint *> tPhysicsJointList;
+typedef Common::List<iPhysicsJoint *> tPhysicsJointList;
typedef tPhysicsJointList::iterator tPhysicsJointListIt;
-typedef std::list<iPhysicsController *> tPhysicsControllerList;
+typedef Common::List<iPhysicsController *> tPhysicsControllerList;
typedef tPhysicsControllerList::iterator tPhysicsControllerListIt;
-typedef std::list<iCharacterBody *> tCharacterBodyList;
+typedef Common::List<iCharacterBody *> tCharacterBodyList;
typedef tCharacterBodyList::iterator tCharacterBodyListIt;
typedef std::map<tString, iPhysicsMaterial *> tPhysicsMaterialMap;
diff --git a/engines/hpl1/engine/resources/FrameBitmap.h b/engines/hpl1/engine/resources/FrameBitmap.h
index 6b3e2f906ad..3ad7bf1e52f 100644
--- a/engines/hpl1/engine/resources/FrameBitmap.h
+++ b/engines/hpl1/engine/resources/FrameBitmap.h
@@ -53,7 +53,7 @@ public:
typedef BinTree<cFBitmapRect> tRectTree;
typedef BinTreeNode<cFBitmapRect> tRectTreeNode;
-typedef std::list<tRectTreeNode *> tRectTreeNodeList;
+typedef Common::List<tRectTreeNode *> tRectTreeNodeList;
typedef tRectTreeNodeList::iterator tRectTreeNodeListIt;
class cFrameBitmap : public iFrameBase {
diff --git a/engines/hpl1/engine/resources/ImageManager.h b/engines/hpl1/engine/resources/ImageManager.h
index 419f9ef373a..8626fb51463 100644
--- a/engines/hpl1/engine/resources/ImageManager.h
+++ b/engines/hpl1/engine/resources/ImageManager.h
@@ -39,7 +39,7 @@ class cFrameBitmap;
class iLowLevelGraphics;
class Bitmap2D;
-typedef std::list<cFrameBitmap *> tFrameBitmapList;
+typedef Common::List<cFrameBitmap *> tFrameBitmapList;
typedef tFrameBitmapList::iterator tFrameBitmapListIt;
typedef std::map<int, cFrameTexture *> tFrameTextureMap;
diff --git a/engines/hpl1/engine/resources/MeshLoaderHandler.h b/engines/hpl1/engine/resources/MeshLoaderHandler.h
index e5bea838929..1f5f7460f96 100644
--- a/engines/hpl1/engine/resources/MeshLoaderHandler.h
+++ b/engines/hpl1/engine/resources/MeshLoaderHandler.h
@@ -28,13 +28,12 @@
#ifndef HPL_MESH_LOADER_HANDLER_H
#define HPL_MESH_LOADER_HANDLER_H
-#include <list>
-
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/resources/MeshLoader.h"
+#include "common/list.h"
namespace hpl {
@@ -45,7 +44,7 @@ class cWorld3D;
class cScene;
class cAnimation;
-typedef std::list<iMeshLoader *> tMeshLoaderList;
+typedef Common::List<iMeshLoader *> tMeshLoaderList;
typedef tMeshLoaderList::iterator tMeshLoaderListIt;
class cMeshLoaderHandler {
diff --git a/engines/hpl1/engine/resources/ParticleManager.h b/engines/hpl1/engine/resources/ParticleManager.h
index d8cab7290ff..74525c3435a 100644
--- a/engines/hpl1/engine/resources/ParticleManager.h
+++ b/engines/hpl1/engine/resources/ParticleManager.h
@@ -76,7 +76,7 @@ private:
cGraphics *mpGraphics;
cResources *mpResources;
- std::list<cParticleSystem3D *> mlstSystems;
+ Common::List<cParticleSystem3D *> mlstSystems;
// tParticleSystemData3DMap m_mapData3D;
};
diff --git a/engines/hpl1/engine/resources/ResourceManager.h b/engines/hpl1/engine/resources/ResourceManager.h
index a9b90277f29..4a8be63c20e 100644
--- a/engines/hpl1/engine/resources/ResourceManager.h
+++ b/engines/hpl1/engine/resources/ResourceManager.h
@@ -44,7 +44,7 @@ typedef tResourceHandleMap::iterator tResourceHandleMapIt;
typedef std::map<tString, iResourceBase *> tResourceNameMap;
typedef tResourceNameMap::iterator tResourceNameMapIt;
-typedef std::list<iResourceBase *> tResourceBaseList;
+typedef Common::List<iResourceBase *> tResourceBaseList;
typedef tResourceBaseList::iterator tResourceBaseListIt;
typedef cSTLMapIterator<iResourceBase *, tResourceNameMap, tResourceNameMapIt> cResourceBaseIterator;
diff --git a/engines/hpl1/engine/resources/Resources.h b/engines/hpl1/engine/resources/Resources.h
index 2661acb0db9..202acbadaac 100644
--- a/engines/hpl1/engine/resources/Resources.h
+++ b/engines/hpl1/engine/resources/Resources.h
@@ -152,7 +152,7 @@ typedef tArea3DLoaderMap::iterator tArea3DLoaderMapIt;
// GetManager(tString) when getting a manager?
// This way you would be able to add your own resource types
// easily.
-typedef std::list<iResourceManager *> tResourceManagerList;
+typedef Common::List<iResourceManager *> tResourceManagerList;
typedef tResourceManagerList::iterator tResourceManagerListIt;
//-------------------------------------------------------
diff --git a/engines/hpl1/engine/resources/VideoManager.h b/engines/hpl1/engine/resources/VideoManager.h
index 6df2757ae1a..b6c18294fe3 100644
--- a/engines/hpl1/engine/resources/VideoManager.h
+++ b/engines/hpl1/engine/resources/VideoManager.h
@@ -39,12 +39,12 @@ class iVideoStreamLoader;
//----------------------------------------------------
-typedef std::list<iVideoStreamLoader *> tVideoStreamLoaderList;
+typedef Common::List<iVideoStreamLoader *> tVideoStreamLoaderList;
typedef tVideoStreamLoaderList::iterator tVideoStreamLoaderListIt;
//----------------------------------------------------
-typedef std::list<iVideoStream *> tVideoStreamList;
+typedef Common::List<iVideoStream *> tVideoStreamList;
typedef tVideoStreamList::iterator tVideoStreamListIt;
//----------------------------------------------------
diff --git a/engines/hpl1/engine/resources/low_level_resources.cpp b/engines/hpl1/engine/resources/low_level_resources.cpp
index d4b2df9dc08..9b290da6344 100644
--- a/engines/hpl1/engine/resources/low_level_resources.cpp
+++ b/engines/hpl1/engine/resources/low_level_resources.cpp
@@ -46,8 +46,12 @@ Bitmap2D *LowLevelResources::loadBitmap2D(const tString &filepath) {
}
void LowLevelResources::getSupportedImageFormats(tStringList &formats) {
- formats.insert(formats.end(), {
- "BMP","GIF","JPEG","PNG","JPG","TGA"});
+ formats.push_back("BMP");
+ formats.push_back("GIF");
+ formats.push_back("JPEG");
+ formats.push_back("PNG");
+ formats.push_back("JPG");
+ formats.push_back("TGA");
}
void LowLevelResources::addMeshLoaders(cMeshLoaderHandler *ml) {
diff --git a/engines/hpl1/engine/scene/Entity.h b/engines/hpl1/engine/scene/Entity.h
index 0cc10e61b0b..41f937cfd9c 100644
--- a/engines/hpl1/engine/scene/Entity.h
+++ b/engines/hpl1/engine/scene/Entity.h
@@ -86,7 +86,7 @@ protected:
bool mbIsActive;
};
-typedef std::list<iEntity *> tEntityList;
+typedef Common::List<iEntity *> tEntityList;
typedef tEntityList::iterator tEntityListIt;
typedef cSTLIterator<iEntity *, tEntityList, tEntityListIt> cEntityIterator;
diff --git a/engines/hpl1/engine/scene/Entity2D.h b/engines/hpl1/engine/scene/Entity2D.h
index f3d0ad4208f..e02e17b9203 100644
--- a/engines/hpl1/engine/scene/Entity2D.h
+++ b/engines/hpl1/engine/scene/Entity2D.h
@@ -74,7 +74,7 @@ protected:
cRect2f mBoundingBox;
};
-typedef std::list<iEntity2D *> tEntity2DList;
+typedef Common::List<iEntity2D *> tEntity2DList;
typedef tEntity2DList::iterator tEntity2DListIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/scene/Entity3D.h b/engines/hpl1/engine/scene/Entity3D.h
index fe142c1db9c..4d6188ce928 100644
--- a/engines/hpl1/engine/scene/Entity3D.h
+++ b/engines/hpl1/engine/scene/Entity3D.h
@@ -32,9 +32,9 @@
#include "hpl1/engine/scene/Entity.h"
#include "hpl1/engine/system/Container.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <list>
#include "hpl1/engine/math/BoundingVolume.h"
+#include "common/list.h"
namespace hpl {
@@ -47,7 +47,7 @@ public:
virtual void OnTransformUpdate(iEntity3D *apEntity) = 0;
};
-typedef std::list<iEntityCallback *> tEntityCallbackList;
+typedef Common::List<iEntityCallback *> tEntityCallbackList;
typedef tEntityCallbackList::iterator tEntityCallbackListIt;
//------------------------------------
@@ -57,7 +57,7 @@ typedef tEntityCallbackList::iterator tEntityCallbackListIt;
class iRenderContainerData {
};
-typedef std::list<iRenderContainerData *> tRenderContainerDataList;
+typedef Common::List<iRenderContainerData *> tRenderContainerDataList;
typedef tRenderContainerDataList::iterator tRenderContainerDataListIt;
//------------------------------------
@@ -75,7 +75,7 @@ kSaveData_ChildClass(iEntity, iEntity3D) {
class iEntity3D;
-typedef std::list<iEntity3D *> tEntity3DList;
+typedef Common::List<iEntity3D *> tEntity3DList;
typedef tEntity3DList::iterator tEntity3DListIt;
class iEntity3D : public iEntity {
diff --git a/engines/hpl1/engine/scene/Light2D.h b/engines/hpl1/engine/scene/Light2D.h
index 51b4281523c..b898b8a7d0d 100644
--- a/engines/hpl1/engine/scene/Light2D.h
+++ b/engines/hpl1/engine/scene/Light2D.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/scene/Entity2D.h"
#include "hpl1/engine/scene/Light.h"
-#include <list>
+#include "common/list.h"
namespace hpl {
@@ -56,7 +56,7 @@ public:
protected:
};
-typedef std::list<iLight2D *> tLightList;
+typedef Common::List<iLight2D *> tLightList;
typedef tLightList::iterator tLightListIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/scene/Light3D.h b/engines/hpl1/engine/scene/Light3D.h
index 8081c356893..df15ba69f3a 100644
--- a/engines/hpl1/engine/scene/Light3D.h
+++ b/engines/hpl1/engine/scene/Light3D.h
@@ -32,7 +32,7 @@
#include "hpl1/engine/graphics/Renderable.h"
#include "hpl1/engine/scene/Entity3D.h"
#include "hpl1/engine/scene/Light.h"
-#include <list>
+#include "common/list.h"
#include <set>
class TiXmlElement;
@@ -220,7 +220,7 @@ protected:
unsigned int *mpIndexArray;
};
-typedef std::list<iLight3D *> tLight3DList;
+typedef Common::List<iLight3D *> tLight3DList;
typedef tLight3DList::iterator tLight3DListIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/scene/Node.h b/engines/hpl1/engine/scene/Node.h
index 483b80e4f2a..f877338cc04 100644
--- a/engines/hpl1/engine/scene/Node.h
+++ b/engines/hpl1/engine/scene/Node.h
@@ -32,13 +32,13 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/scene/Entity.h"
#include "hpl1/engine/system/Container.h"
-#include <list>
+#include "common/list.h"
namespace hpl {
class iNode;
-typedef std::list<iNode *> tNodeList;
+typedef Common::List<iNode *> tNodeList;
typedef tNodeList::iterator tNodeListIt;
typedef cSTLIterator<iNode *, tNodeList, tNodeListIt> cNodeIterator;
diff --git a/engines/hpl1/engine/scene/Node2D.h b/engines/hpl1/engine/scene/Node2D.h
index 9c020d459b2..062d2a416ec 100644
--- a/engines/hpl1/engine/scene/Node2D.h
+++ b/engines/hpl1/engine/scene/Node2D.h
@@ -30,7 +30,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/scene/Node.h"
-#include <list>
+#include "common/list.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/Node3D.h b/engines/hpl1/engine/scene/Node3D.h
index 3d6c09248fb..ccc83f63917 100644
--- a/engines/hpl1/engine/scene/Node3D.h
+++ b/engines/hpl1/engine/scene/Node3D.h
@@ -30,7 +30,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/scene/Node.h"
-#include <list>
+#include "common/list.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/PortalContainer.h b/engines/hpl1/engine/scene/PortalContainer.h
index 1c5808acabc..7392a86ee6b 100644
--- a/engines/hpl1/engine/scene/PortalContainer.h
+++ b/engines/hpl1/engine/scene/PortalContainer.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/graphics/Renderable.h"
#include "hpl1/engine/math/BoundingVolume.h"
#include "hpl1/engine/scene/RenderableContainer.h"
-#include <list>
+#include "common/list.h"
#include <map>
#include <set>
@@ -40,8 +40,8 @@ namespace hpl {
class iLight3D;
class cSectorVisibilityContainer;
-typedef std::list<iRenderable *> tRenderableList;
-typedef std::list<iRenderable *>::iterator tRenderableListIt;
+typedef Common::List<iRenderable *> tRenderableList;
+typedef Common::List<iRenderable *>::iterator tRenderableListIt;
typedef std::set<iRenderable *> tRenderableSet;
typedef std::set<iRenderable *>::iterator tRenderableSetIt;
@@ -119,8 +119,8 @@ class cPortal;
typedef std::map<int, cPortal *> tPortalMap;
typedef std::map<int, cPortal *>::iterator tPortalMapIt;
-typedef std::list<cPortal *> tPortalList;
-typedef std::list<cPortal *>::iterator tPortalListIt;
+typedef Common::List<cPortal *> tPortalList;
+typedef Common::List<cPortal *>::iterator tPortalListIt;
class cPortal {
friend class cSector;
diff --git a/engines/hpl1/engine/scene/Scene.h b/engines/hpl1/engine/scene/Scene.h
index 59d2cfa6fa2..581690985b5 100644
--- a/engines/hpl1/engine/scene/Scene.h
+++ b/engines/hpl1/engine/scene/Scene.h
@@ -28,8 +28,6 @@
#ifndef HPL_SCENE_H
#define HPL_SCENE_H
-#include <list>
-
#include "hpl1/engine/game/GameTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
@@ -37,6 +35,7 @@
#include "hpl1/engine/scene/Camera3D.h"
#include "hpl1/engine/resources/MeshLoader.h"
+#include "common/list.h"
namespace hpl {
@@ -54,10 +53,10 @@ class cUpdater;
class cWorld3D;
class cWorld2D;
-typedef std::list<iCamera *> tCameraList;
+typedef Common::List<iCamera *> tCameraList;
typedef tCameraList::iterator tCameraListIt;
-typedef std::list<cWorld3D *> tWorld3DList;
+typedef Common::List<cWorld3D *> tWorld3DList;
typedef tWorld3DList::iterator tWorld3DListIt;
class cScene : public iUpdateable {
diff --git a/engines/hpl1/engine/scene/SectorVisibility.h b/engines/hpl1/engine/scene/SectorVisibility.h
index 52e82c7ed85..c3ba911af74 100644
--- a/engines/hpl1/engine/scene/SectorVisibility.h
+++ b/engines/hpl1/engine/scene/SectorVisibility.h
@@ -122,7 +122,7 @@ typedef tSectorVisibilityMap::iterator tSectorVisibilityMapIt;
//----------------------------------------------------
-typedef std::list<cPortalVisibilitySet *> tPortalVisibilitySetList;
+typedef Common::List<cPortalVisibilitySet *> tPortalVisibilitySetList;
typedef tPortalVisibilitySetList::iterator tPortalVisibilitySetListIt;
typedef std::set<cSector *> tSectorSet;
diff --git a/engines/hpl1/engine/scene/SoundEntity.h b/engines/hpl1/engine/scene/SoundEntity.h
index a508d498c9a..6f7a39e06e9 100644
--- a/engines/hpl1/engine/scene/SoundEntity.h
+++ b/engines/hpl1/engine/scene/SoundEntity.h
@@ -78,7 +78,7 @@ public:
virtual void OnStart(cSoundEntity *apSoundEntity) = 0;
};
-typedef std::list<iSoundEntityGlobalCallback *> tSoundEntityGlobalCallbackList;
+typedef Common::List<iSoundEntityGlobalCallback *> tSoundEntityGlobalCallbackList;
typedef tSoundEntityGlobalCallbackList::iterator tSoundEntityGlobalCallbackListIt;
//------------------------------------------
diff --git a/engines/hpl1/engine/scene/SoundSource.h b/engines/hpl1/engine/scene/SoundSource.h
index e0564baf055..bc745edce3f 100644
--- a/engines/hpl1/engine/scene/SoundSource.h
+++ b/engines/hpl1/engine/scene/SoundSource.h
@@ -30,7 +30,7 @@
#include "hpl1/engine/scene/Entity2D.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <list>
+#include "common/list.h"
class TiXmlElement;
@@ -88,7 +88,7 @@ private:
void Play();
};
-typedef std::list<cSoundSource *> tSoundSourceList;
+typedef Common::List<cSoundSource *> tSoundSourceList;
typedef tSoundSourceList::iterator tSoundSourceListIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/scene/Tile.h b/engines/hpl1/engine/scene/Tile.h
index 9577652a204..717d8c0a359 100644
--- a/engines/hpl1/engine/scene/Tile.h
+++ b/engines/hpl1/engine/scene/Tile.h
@@ -32,7 +32,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/scene/TileData.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <list>
+#include "common/list.h"
namespace hpl {
@@ -72,7 +72,7 @@ private:
// 4: flip horisontally. 5: flip vertically. 6: flip both.
};
-typedef std::list<cTile *> tTileList;
+typedef Common::List<cTile *> tTileList;
typedef tTileList::iterator tTileListIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/scene/World3D.h b/engines/hpl1/engine/scene/World3D.h
index 33113ade678..79cb8e3c001 100644
--- a/engines/hpl1/engine/scene/World3D.h
+++ b/engines/hpl1/engine/scene/World3D.h
@@ -76,32 +76,32 @@ class cAINodeContainer;
class cAStarHandler;
class cAINodeGeneratorParams;
-typedef std::list<iLight3D *> tLight3DList;
-typedef std::list<iLight3D *>::iterator tLight3DListIt;
+typedef Common::List<iLight3D *> tLight3DList;
+typedef Common::List<iLight3D *>::iterator tLight3DListIt;
-typedef std::list<cMeshEntity *> tMeshEntityList;
-typedef std::list<cMeshEntity *>::iterator tMeshEntityListIt;
+typedef Common::List<cMeshEntity *> tMeshEntityList;
+typedef Common::List<cMeshEntity *>::iterator tMeshEntityListIt;
-typedef std::list<cBillboard *> tBillboardList;
-typedef std::list<cBillboard *>::iterator tBillboardListIt;
+typedef Common::List<cBillboard *> tBillboardList;
+typedef Common::List<cBillboard *>::iterator tBillboardListIt;
-typedef std::list<cBeam *> tBeamList;
-typedef std::list<cBeam *>::iterator tBeamListIt;
+typedef Common::List<cBeam *> tBeamList;
+typedef Common::List<cBeam *>::iterator tBeamListIt;
-typedef std::list<cParticleSystem3D *> tParticleSystem3DList;
+typedef Common::List<cParticleSystem3D *> tParticleSystem3DList;
typedef tParticleSystem3DList::iterator tParticleSystem3DListIt;
-typedef std::list<cColliderEntity *> tColliderEntityList;
-typedef std::list<cColliderEntity *>::iterator tColliderEntityListIt;
+typedef Common::List<cColliderEntity *> tColliderEntityList;
+typedef Common::List<cColliderEntity *>::iterator tColliderEntityListIt;
-typedef std::list<cSoundEntity *> tSoundEntityList;
-typedef std::list<cSoundEntity *>::iterator tSoundEntityListIt;
+typedef Common::List<cSoundEntity *> tSoundEntityList;
+typedef Common::List<cSoundEntity *>::iterator tSoundEntityListIt;
-typedef std::list<cAINodeContainer *> tAINodeContainerList;
-typedef std::list<cAINodeContainer *>::iterator tAINodeContainerListIt;
+typedef Common::List<cAINodeContainer *> tAINodeContainerList;
+typedef Common::List<cAINodeContainer *>::iterator tAINodeContainerListIt;
-typedef std::list<cAStarHandler *> tAStarHandlerList;
-typedef std::list<cAStarHandler *>::iterator tAStarHandlerIt;
+typedef Common::List<cAStarHandler *> tAStarHandlerList;
+typedef Common::List<cAStarHandler *>::iterator tAStarHandlerIt;
//-------------------------------------------------------------------
@@ -121,8 +121,8 @@ public:
tString msName;
};
-typedef std::list<cTempAiNode> tTempAiNodeList;
-typedef std::list<cTempAiNode>::iterator tTempAiNodeListIt;
+typedef Common::List<cTempAiNode> tTempAiNodeList;
+typedef Common::List<cTempAiNode>::iterator tTempAiNodeListIt;
class cTempNodeContainer {
public:
@@ -161,8 +161,8 @@ class cStartPosEntity : public iSerializable {
tString msName;
};
-typedef std::list<cStartPosEntity *> tStartPosEntityList;
-typedef std::list<cStartPosEntity *>::iterator tStartPosEntityListIt;
+typedef Common::List<cStartPosEntity *> tStartPosEntityList;
+typedef Common::List<cStartPosEntity *>::iterator tStartPosEntityListIt;
//------------------------------------------
diff --git a/engines/hpl1/engine/sound/LowLevelSound.h b/engines/hpl1/engine/sound/LowLevelSound.h
index 94e14d452d9..74d090f48e5 100644
--- a/engines/hpl1/engine/sound/LowLevelSound.h
+++ b/engines/hpl1/engine/sound/LowLevelSound.h
@@ -39,7 +39,7 @@ class iSoundData;
class iSoundEnvironment;
// class iSoundFilter;
-typedef std::list<iSoundEnvironment *> tSoundEnvList;
+typedef Common::List<iSoundEnvironment *> tSoundEnvList;
typedef tSoundEnvList::iterator tSoundEnvListIt;
class iLowLevelSound {
diff --git a/engines/hpl1/engine/sound/MusicHandler.h b/engines/hpl1/engine/sound/MusicHandler.h
index 4a745ecdde7..ab3aa4fb519 100644
--- a/engines/hpl1/engine/sound/MusicHandler.h
+++ b/engines/hpl1/engine/sound/MusicHandler.h
@@ -29,7 +29,7 @@
#define HPL_MUSICHANDLER_H
#include "hpl1/engine/system/SystemTypes.h"
-#include <list>
+#include "common/list.h"
namespace hpl {
@@ -66,7 +66,7 @@ public:
bool mbLoop;
};
-typedef std::list<cMusicEntry *> tMusicEntryList;
+typedef Common::List<cMusicEntry *> tMusicEntryList;
typedef tMusicEntryList::iterator tMusicEntryListIt;
////////////////////////////////////////////////////
diff --git a/engines/hpl1/engine/sound/SoundChannel.h b/engines/hpl1/engine/sound/SoundChannel.h
index 9239c3822f1..3f4f86ab7d6 100644
--- a/engines/hpl1/engine/sound/SoundChannel.h
+++ b/engines/hpl1/engine/sound/SoundChannel.h
@@ -29,7 +29,7 @@
#define HPL_SOUND_CHANNEL_H
#include "hpl1/engine/math/MathTypes.h"
-#include <list>
+#include "common/list.h"
namespace hpl {
class iSoundData;
@@ -181,7 +181,7 @@ protected:
iSoundChannelCallback *mpCallback;
};
-typedef std::list<iSoundChannel *> tSoundChannelList;
+typedef Common::List<iSoundChannel *> tSoundChannelList;
typedef tSoundChannelList::iterator tSoundChannelListIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/sound/SoundHandler.h b/engines/hpl1/engine/sound/SoundHandler.h
index 8857f777148..432a5bc6df6 100644
--- a/engines/hpl1/engine/sound/SoundHandler.h
+++ b/engines/hpl1/engine/sound/SoundHandler.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/physics/PhysicsWorld.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <list>
+#include "common/list.h"
namespace hpl {
@@ -99,7 +99,7 @@ public:
eSoundDest mEffectType;
};
-typedef std::list<cSoundEntry> tSoundEntryList;
+typedef Common::List<cSoundEntry> tSoundEntryList;
typedef tSoundEntryList::iterator tSoundEntryListIt;
typedef cSTLIterator<cSoundEntry, tSoundEntryList, tSoundEntryListIt> tSoundEntryIterator;
diff --git a/engines/hpl1/engine/system/BinTree.h b/engines/hpl1/engine/system/BinTree.h
index 10998bfd652..18f07fc197a 100644
--- a/engines/hpl1/engine/system/BinTree.h
+++ b/engines/hpl1/engine/system/BinTree.h
@@ -28,7 +28,7 @@
#ifndef HPL_BINTREE_H
#define HPL_BINTREE_H
-#include <list>
+#include "common/list.h"
namespace hpl {
@@ -169,7 +169,7 @@ public:
return mlNumOfNodes;
}
- const std::list<BinTreeNode<T> *> &GetLeafList() {
+ const Common::List<BinTreeNode<T> *> &GetLeafList() {
mlstNodes.clear();
PopulateLeafList(mFirstNode);
return mlstNodes;
@@ -179,7 +179,7 @@ public:
* Get a list of all the nodes in the tree
* \return
*/
- const std::list<BinTreeNode<T> *> &GetNodeList() {
+ const Common::List<BinTreeNode<T> *> &GetNodeList() {
mlstNodes.clear();
PopulateNodeList(mFirstNode);
return mlstNodes;
@@ -190,7 +190,7 @@ private:
BinTreeNode<T> *mFirstNode;
int mlNum;
- std::list<BinTreeNode<T> *> mlstNodes;
+ Common::List<BinTreeNode<T> *> mlstNodes;
void DeleteNode(BinTreeNode<T> *aNode) {
if (aNode == NULL)
diff --git a/engines/hpl1/engine/system/Container.h b/engines/hpl1/engine/system/Container.h
index 3d110008e4a..3190415db96 100644
--- a/engines/hpl1/engine/system/Container.h
+++ b/engines/hpl1/engine/system/Container.h
@@ -28,11 +28,11 @@
#ifndef HPL_CONTAINER_H
#define HPL_CONTAINER_H
-#include <list>
#include <map>
#include <vector>
#include "hpl1/engine/system/MemoryManager.h"
+#include "common/list.h"
namespace hpl {
@@ -183,7 +183,7 @@ class cContainerListIterator : public iContainerIterator {
}
public:
- cContainerListIterator(std::list<T> *apVec) {
+ cContainerListIterator(Common::List<T> *apVec) {
mpVec = apVec;
mIt = apVec->begin();
}
@@ -210,8 +210,8 @@ public:
}
private:
- std::list<T> *mpVec;
- typename std::list<T>::iterator mIt;
+ Common::List<T> *mpVec;
+ typename Common::List<T>::iterator mIt;
};
////////////////////////////
@@ -255,7 +255,7 @@ public:
//////////////////////
- std::list<T> mvVector;
+ Common::List<T> mvVector;
};
//---------------------------------
diff --git a/engines/hpl1/engine/system/SerializeClass.h b/engines/hpl1/engine/system/SerializeClass.h
index 8b0e8bcaf6a..aed7a0f2825 100644
--- a/engines/hpl1/engine/system/SerializeClass.h
+++ b/engines/hpl1/engine/system/SerializeClass.h
@@ -302,7 +302,7 @@ private:
typedef std::map<tString, cSerializeSavedClass> tSerializeSavedClassMap;
typedef tSerializeSavedClassMap::iterator tSerializeSavedClassMapIt;
-typedef std::list<cSerializeSavedClass *> tSerializeSavedClassList;
+typedef Common::List<cSerializeSavedClass *> tSerializeSavedClassList;
typedef tSerializeSavedClassList::iterator tSerializeSavedClassListIt;
class cSerializeClass {
diff --git a/engines/hpl1/engine/system/SystemTypes.h b/engines/hpl1/engine/system/SystemTypes.h
index 5edb670918f..73b81add0e8 100644
--- a/engines/hpl1/engine/system/SystemTypes.h
+++ b/engines/hpl1/engine/system/SystemTypes.h
@@ -28,13 +28,13 @@
#ifndef HPL_SYSTEM_TYPES_H
#define HPL_SYSTEM_TYPES_H
-#include <list>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
#include "hpl1/engine/system/Container.h"
+#include "common/list.h"
namespace hpl {
@@ -77,7 +77,7 @@ typedef unsigned int tFlag;
typedef std::string tString;
-typedef std::list<tString> tStringList;
+typedef Common::List<tString> tStringList;
typedef tStringList::iterator tStringListIt;
typedef std::vector<tString> tStringVec;
@@ -89,7 +89,7 @@ typedef tStringSet::iterator tStringSetIt;
//--------------------------------------------------------
typedef std::wstring tWString;
-typedef std::list<tWString> tWStringList;
+typedef Common::List<tWString> tWStringList;
typedef tWStringList::iterator tWStringListIt;
typedef std::vector<tWString> tWStringVec;
@@ -118,10 +118,10 @@ typedef tFloatVec::iterator tFloatVecIt;
typedef std::vector<float *> tFloatPtrVec;
typedef tFloatPtrVec::iterator tFloatPtrVecIt;
-typedef std::list<float *> tFloatPtrList;
+typedef Common::List<float *> tFloatPtrList;
typedef tFloatPtrList::iterator tFloatPtrListIt;
-typedef std::list<unsigned int> tUIntList;
+typedef Common::List<unsigned int> tUIntList;
typedef tUIntList::iterator tUIntListIt;
typedef enum {
diff --git a/engines/hpl1/penumbra-overture/AttackHandler.cpp b/engines/hpl1/penumbra-overture/AttackHandler.cpp
index b0482c0ce76..d24b172c765 100644
--- a/engines/hpl1/penumbra-overture/AttackHandler.cpp
+++ b/engines/hpl1/penumbra-overture/AttackHandler.cpp
@@ -200,14 +200,14 @@ bool cAttackHandler::CreateShapeAttack(iCollideShape *apShape, const cMatrixf &a
iPhysicsWorld *pPhysicsWorld = pWorld->GetPhysicsWorld();
// Get bodies and add to list, this incase the portal contaniner gets changed.
- std::list<iPhysicsBody *> lstTempBodies;
+ Common::List<iPhysicsBody *> lstTempBodies;
cPhysicsBodyIterator bodyIt = pPhysicsWorld->GetBodyIterator();
while (bodyIt.HasNext()) {
iPhysicsBody *pBody = static_cast<iPhysicsBody *>(bodyIt.Next());
lstTempBodies.push_back(pBody);
}
- std::list<iPhysicsBody *>::iterator it = lstTempBodies.begin();
+ Common::List<iPhysicsBody *>::iterator it = lstTempBodies.begin();
for (; it != lstTempBodies.end(); ++it) {
iPhysicsBody *pBody = *it;
/*float fMass = */pBody->GetMass();
@@ -438,7 +438,7 @@ void cAttackHandler::CreateSplashDamage(const cVector3f &avCenter, float afRadiu
if (aTarget & eAttackTargetFlag_Bodies) {
iPhysicsWorld *pWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
- std::list<iPhysicsBody *> lstBodies;
+ Common::List<iPhysicsBody *> lstBodies;
cPhysicsBodyIterator bodyIt = pWorld->GetBodyIterator();
while (bodyIt.HasNext()) {
lstBodies.push_back(bodyIt.Next());
@@ -446,7 +446,7 @@ void cAttackHandler::CreateSplashDamage(const cVector3f &avCenter, float afRadiu
//////////////////////////
// Damage Iteration
- std::list<iPhysicsBody *>::iterator it = lstBodies.begin();
+ Common::List<iPhysicsBody *>::iterator it = lstBodies.begin();
for (; it != lstBodies.end(); ++it) {
iPhysicsBody *pBody = *it;
diff --git a/engines/hpl1/penumbra-overture/CharacterMove.cpp b/engines/hpl1/penumbra-overture/CharacterMove.cpp
index cf027c6dcf9..3a8c7155a41 100644
--- a/engines/hpl1/penumbra-overture/CharacterMove.cpp
+++ b/engines/hpl1/penumbra-overture/CharacterMove.cpp
@@ -242,7 +242,7 @@ void cCharacterMove::Update(float afTimeStep) {
mlstNodeDistances.pop_front();
mfNodeDistAvg = 0;
- std::list<float>::iterator it = mlstNodeDistances.begin();
+ Common::List<float>::iterator it = mlstNodeDistances.begin();
float fPreviousDistance = *it;
++it;
for (; it != mlstNodeDistances.end(); ++it) {
diff --git a/engines/hpl1/penumbra-overture/CharacterMove.h b/engines/hpl1/penumbra-overture/CharacterMove.h
index e2fc1d06e72..18ff6d47c86 100644
--- a/engines/hpl1/penumbra-overture/CharacterMove.h
+++ b/engines/hpl1/penumbra-overture/CharacterMove.h
@@ -159,7 +159,7 @@ private:
float mfStuckCounter;
float mfStuckLimit;
- std::list<float> mlstNodeDistances;
+ Common::List<float> mlstNodeDistances;
int mlMaxNodeDistances;
float mfNodeDistAvg;
diff --git a/engines/hpl1/penumbra-overture/DeathMenu.h b/engines/hpl1/penumbra-overture/DeathMenu.h
index 3df38c5be40..bb668889425 100644
--- a/engines/hpl1/penumbra-overture/DeathMenu.h
+++ b/engines/hpl1/penumbra-overture/DeathMenu.h
@@ -92,7 +92,7 @@ public:
//---------------------------------------------
-typedef std::list<cDeathMenuButton *> tDeathMenuButtonList;
+typedef Common::List<cDeathMenuButton *> tDeathMenuButtonList;
typedef tDeathMenuButtonList::iterator tDeathMenuButtonListIt;
//---------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/EffectHandler.cpp b/engines/hpl1/penumbra-overture/EffectHandler.cpp
index 57ec51761ea..ea3beab9486 100644
--- a/engines/hpl1/penumbra-overture/EffectHandler.cpp
+++ b/engines/hpl1/penumbra-overture/EffectHandler.cpp
@@ -121,7 +121,7 @@ void cEffect_ShakeScreen::Start(float afAmount, float afTime, float afFadeInTime
void cEffect_ShakeScreen::Update(float afTimeStep) {
float fLargest = 0;
- std::list<cEffect_ShakeScreen_Shake>::iterator it = mlstShakes.begin();
+ Common::List<cEffect_ShakeScreen_Shake>::iterator it = mlstShakes.begin();
for (; it != mlstShakes.end();) {
cEffect_ShakeScreen_Shake &shake = *it;
diff --git a/engines/hpl1/penumbra-overture/EffectHandler.h b/engines/hpl1/penumbra-overture/EffectHandler.h
index 944d5632827..083902de0ab 100644
--- a/engines/hpl1/penumbra-overture/EffectHandler.h
+++ b/engines/hpl1/penumbra-overture/EffectHandler.h
@@ -93,7 +93,7 @@ private:
iHapticForce *mpForce;
- std::list<cEffect_ShakeScreen_Shake> mlstShakes;
+ Common::List<cEffect_ShakeScreen_Shake> mlstShakes;
};
//-----------------------------------------
@@ -214,7 +214,7 @@ public:
bool mbActive;
};
-typedef std::list<cSubTitle> tSubTitleList;
+typedef Common::List<cSubTitle> tSubTitleList;
typedef tSubTitleList::iterator tSubTitleListIt;
class cEffect_SubTitle {
diff --git a/engines/hpl1/penumbra-overture/GameDamageArea.cpp b/engines/hpl1/penumbra-overture/GameDamageArea.cpp
index cfe0e2b89e1..ee1ba56741a 100644
--- a/engines/hpl1/penumbra-overture/GameDamageArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameDamageArea.cpp
@@ -127,7 +127,7 @@ void cGameDamageArea::Update(float afTimeStep) {
collideData.SetMaxSize(1);
// Get bodies and add to list, this incase the portal contaniner gets changed.
- std::list<iPhysicsBody *> lstBodies;
+ Common::List<iPhysicsBody *> lstBodies;
cPortalContainerEntityIterator bodyIt = pWorld->GetPortalContainer()->GetEntityIterator(
pAreaBody->GetBoundingVolume());
while (bodyIt.HasNext()) {
@@ -137,7 +137,7 @@ void cGameDamageArea::Update(float afTimeStep) {
////////////////////////////////////////////////////////
// Iterate all bodies in world and check for intersection
- std::list<iPhysicsBody *>::iterator it = lstBodies.begin();
+ Common::List<iPhysicsBody *>::iterator it = lstBodies.begin();
for (; it != lstBodies.end(); ++it) {
iPhysicsBody *pBody = *it;
iGameEntity *pEntity = (iGameEntity *)pBody->GetUserData();
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp b/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
index fb4638458f5..c8ef11f6d3c 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
@@ -1421,7 +1421,7 @@ void cGameEnemyState_Dog_KnockDown::OnUpdate(float afTimeStep) {
// Add a force to all objects around dog.
iPhysicsWorld *pWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
- std::list<iPhysicsBody *> lstBodies;
+ Common::List<iPhysicsBody *> lstBodies;
cPhysicsBodyIterator bodyIt = pWorld->GetBodyIterator();
while (bodyIt.HasNext()) {
lstBodies.push_back(bodyIt.Next());
@@ -1429,7 +1429,7 @@ void cGameEnemyState_Dog_KnockDown::OnUpdate(float afTimeStep) {
//////////////////////////
// Force Iteration
- std::list<iPhysicsBody *>::iterator it = lstBodies.begin();
+ Common::List<iPhysicsBody *>::iterator it = lstBodies.begin();
for (; it != lstBodies.end(); ++it) {
iPhysicsBody *pBody = *it;
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp b/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
index 8195ef30dae..33697fdd508 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
@@ -589,7 +589,7 @@ void cVector3Smoother::Add(const cVector3f &avVec) {
cVector3f cVector3Smoother::GetAverage() {
cVector3f vAverage = 0;
- std::list<cVector3f>::iterator it = mlstVecs.begin();
+ Common::List<cVector3f>::iterator it = mlstVecs.begin();
for (; it != mlstVecs.end(); ++it) {
vAverage += *it;
}
@@ -681,7 +681,7 @@ void cGameEnemy_Worm::OnUpdate(float afTimeStep) {
// Get smooth position
mvRootPosition = 0;
- std::list<cVector3f>::iterator posIt = mlstRootPositions.begin();
+ Common::List<cVector3f>::iterator posIt = mlstRootPositions.begin();
for (; posIt != mlstRootPositions.end(); ++posIt) {
mvRootPosition += *posIt;
}
@@ -746,7 +746,7 @@ void cGameEnemy_Worm::OnUpdate(float afTimeStep) {
pSegment->mlstPositions.pop_front();
}
pSegment->mvPostion = 0;
- std::list<cVector3f>::iterator posIt2 = pSegment->mlstPositions.begin();
+ Common::List<cVector3f>::iterator posIt2 = pSegment->mlstPositions.begin();
for (; posIt2 != pSegment->mlstPositions.end(); ++posIt2) {
pSegment->mvPostion += *posIt2;
}
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Worm.h b/engines/hpl1/penumbra-overture/GameEnemy_Worm.h
index 56a0a5654d2..58fbf560437 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Worm.h
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Worm.h
@@ -135,7 +135,7 @@ public:
mpChildSegment = NULL;
}
- std::list<cVector3f> mlstPositions;
+ Common::List<cVector3f> mlstPositions;
cVector3f mvPostion;
cVector3f mvGoalForward;
@@ -180,7 +180,7 @@ public:
private:
int mlMaxVecs;
- std::list<cVector3f> mlstVecs;
+ Common::List<cVector3f> mlstVecs;
};
//-----------------------------------------
@@ -247,7 +247,7 @@ private:
iCollideShape *mpAttackShape;
cBoneState *mpRootBone;
- std::list<cVector3f> mlstRootPositions;
+ Common::List<cVector3f> mlstRootPositions;
cVector3Smoother mRootForwards;
cVector3f mvRootPosition;
cVector3f mvRootGoalForward;
diff --git a/engines/hpl1/penumbra-overture/GameMessageHandler.h b/engines/hpl1/penumbra-overture/GameMessageHandler.h
index 161341b232c..afe43be3642 100644
--- a/engines/hpl1/penumbra-overture/GameMessageHandler.h
+++ b/engines/hpl1/penumbra-overture/GameMessageHandler.h
@@ -53,7 +53,7 @@ public:
cGameMessageHandler *mpMessHandler;
};
-typedef std::list<cGameMessage *> tGameMessageList;
+typedef Common::List<cGameMessage *> tGameMessageList;
typedef tGameMessageList::iterator tGameMessageListIt;
//---------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameTypes.h b/engines/hpl1/penumbra-overture/GameTypes.h
index 7546ef13b70..98c67509c89 100644
--- a/engines/hpl1/penumbra-overture/GameTypes.h
+++ b/engines/hpl1/penumbra-overture/GameTypes.h
@@ -264,7 +264,7 @@ class cInventoryCombineCallback : public iSerializable {
bool bKillMe;
};
-typedef std::list<cInventoryCombineCallback *> tInventoryCombineCallbackList;
+typedef Common::List<cInventoryCombineCallback *> tInventoryCombineCallbackList;
typedef tInventoryCombineCallbackList::iterator tInventoryCombineCallbackListIt;
//---------------------------------
diff --git a/engines/hpl1/penumbra-overture/HapticGameCamera.cpp b/engines/hpl1/penumbra-overture/HapticGameCamera.cpp
index 3bcaff804b5..49c1fc5d237 100644
--- a/engines/hpl1/penumbra-overture/HapticGameCamera.cpp
+++ b/engines/hpl1/penumbra-overture/HapticGameCamera.cpp
@@ -477,7 +477,7 @@ void cHapticGameCamera::UpdateHand(float afTimeStep)
if(mlstProxyPos.size() > 8) mlstProxyPos.pop_front();
vProxyPos =0;
- std::list<cVector3f>::iterator it = mlstProxyPos.begin();
+ Common::List<cVector3f>::iterator it = mlstProxyPos.begin();
for(; it != mlstProxyPos.end(); ++it)
{
vProxyPos += *it;
diff --git a/engines/hpl1/penumbra-overture/HapticGameCamera.h b/engines/hpl1/penumbra-overture/HapticGameCamera.h
index a9a44ff63ee..9e39534cf20 100644
--- a/engines/hpl1/penumbra-overture/HapticGameCamera.h
+++ b/engines/hpl1/penumbra-overture/HapticGameCamera.h
@@ -31,8 +31,7 @@
#include "hpl1/engine/engine.h"
#include "hpl1/penumbra-overture/GameTypes.h"
-
-#include <list>
+#include "common/list.h"
using namespace hpl;
@@ -140,7 +139,7 @@ private:
iGpuProgram *mpVtxProgram;
- std::list<cVector3f> mlstProxyPos;
+ Common::List<cVector3f> mlstProxyPos;
};
//----------------------------------------
diff --git a/engines/hpl1/penumbra-overture/Inventory.h b/engines/hpl1/penumbra-overture/Inventory.h
index 68af81d2543..366f83ab2f0 100644
--- a/engines/hpl1/penumbra-overture/Inventory.h
+++ b/engines/hpl1/penumbra-overture/Inventory.h
@@ -72,7 +72,7 @@ protected:
float mfZ;
};
-typedef std::list<iInventoryWidget *> tInventoryWidgetList;
+typedef Common::List<iInventoryWidget *> tInventoryWidgetList;
typedef tInventoryWidgetList::iterator tInventoryWidgetListIt;
//-----------------------------------------
@@ -114,7 +114,7 @@ private:
FontData *mpFont;
};
-typedef std::list<cInventorySlot *> tInventorySlotList;
+typedef Common::List<cInventorySlot *> tInventorySlotList;
typedef tInventorySlotList::iterator tInventorySlotListIt;
//-----------------------------------------
diff --git a/engines/hpl1/penumbra-overture/MainMenu.h b/engines/hpl1/penumbra-overture/MainMenu.h
index 5736e745a94..e7ee19e4076 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.h
+++ b/engines/hpl1/penumbra-overture/MainMenu.h
@@ -331,7 +331,7 @@ public:
//---------------------------------------------
-typedef std::list<cMainMenuWidget *> tMainMenuWidgetList;
+typedef Common::List<cMainMenuWidget *> tMainMenuWidgetList;
typedef tMainMenuWidgetList::iterator tMainMenuWidgetListIt;
//---------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/MapHandler.cpp b/engines/hpl1/penumbra-overture/MapHandler.cpp
index 60cb5e31593..baa493f7f28 100644
--- a/engines/hpl1/penumbra-overture/MapHandler.cpp
+++ b/engines/hpl1/penumbra-overture/MapHandler.cpp
@@ -749,7 +749,7 @@ void cMapHandler::AddSaveData(cSavedWorld *apSavedWorld) {
void cMapHandler::LoadSaveData(cSavedWorld *apSavedWorld) {
cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
iPhysicsWorld *pPhysicsWorld = pWorld->GetPhysicsWorld();
- std::list<iGameEntity *> lstEntities;
+ Common::List<iGameEntity *> lstEntities;
/////////////////////////
// Properties
@@ -953,7 +953,7 @@ void cMapHandler::LoadSaveData(cSavedWorld *apSavedWorld) {
////////////////////////////////
// Setup Entities
- std::list<iGameEntity *>::iterator entIt = lstEntities.begin();
+ Common::List<iGameEntity *>::iterator entIt = lstEntities.begin();
for (; entIt != lstEntities.end(); ++entIt) {
iGameEntity *pEntity = *entIt;
diff --git a/engines/hpl1/penumbra-overture/MapHandler.h b/engines/hpl1/penumbra-overture/MapHandler.h
index c688fc10322..ae152952ebe 100644
--- a/engines/hpl1/penumbra-overture/MapHandler.h
+++ b/engines/hpl1/penumbra-overture/MapHandler.h
@@ -50,13 +50,13 @@ typedef tGameEntityMap::iterator tGameEntityMapIt;
typedef std::vector<iGameEntity *> tGameEntityVec;
typedef tGameEntityVec::iterator tGameEntityVecIt;
-typedef std::list<iGameEnemy *> tGameEnemyList;
+typedef Common::List<iGameEnemy *> tGameEnemyList;
typedef tGameEnemyList::iterator tGameEnemyListIt;
-typedef std::list<cGameItem *> tGameItemList;
+typedef Common::List<cGameItem *> tGameItemList;
typedef tGameItemList::iterator tGameItemListIt;
-typedef std::list<cGameStickArea *> tGameStickAreaList;
+typedef Common::List<cGameStickArea *> tGameStickAreaList;
typedef tGameStickAreaList::iterator tGameStickAreaListIt;
typedef cSTLIterator<iGameEnemy *, tGameEnemyList, tGameEnemyListIt> tGameEnemyIterator;
@@ -108,7 +108,7 @@ public:
//-----------------------------------------
-typedef std::list<cGameTimer *> tGameTimerList;
+typedef Common::List<cGameTimer *> tGameTimerList;
typedef tGameTimerList::iterator tGameTimerListIt;
//-----------------------------------------
@@ -135,7 +135,7 @@ private:
bool mbDead;
};
-typedef std::list<cEffectLightFlash *> tEffectLightFlashList;
+typedef Common::List<cEffectLightFlash *> tEffectLightFlashList;
typedef tEffectLightFlashList::iterator tEffectLightFlashListIt;
//-----------------------------------------
diff --git a/engines/hpl1/penumbra-overture/Notebook.h b/engines/hpl1/penumbra-overture/Notebook.h
index a374377311a..646fc4a5fc5 100644
--- a/engines/hpl1/penumbra-overture/Notebook.h
+++ b/engines/hpl1/penumbra-overture/Notebook.h
@@ -67,7 +67,7 @@ public:
tString msTextEntry;
};
-typedef std::list<cNotebook_Note *> tNotebook_NoteList;
+typedef Common::List<cNotebook_Note *> tNotebook_NoteList;
typedef tNotebook_NoteList::iterator tNotebook_NoteListIt;
typedef cSTLIterator<cNotebook_Note *, tNotebook_NoteList, tNotebook_NoteListIt> tNotebook_NoteList_Iterator;
@@ -253,7 +253,7 @@ public:
tWString msText;
};
-typedef std::list<cNotebook_BookTask *> tNotebook_BookTaskList;
+typedef Common::List<cNotebook_BookTask *> tNotebook_BookTaskList;
typedef tNotebook_BookTaskList::iterator tNotebook_BookTaskListIt;
typedef cSTLIterator<cNotebook_BookTask *, tNotebook_BookTaskList, tNotebook_BookTaskListIt> tNotebook_BookTaskList_Iterator;
diff --git a/engines/hpl1/penumbra-overture/NumericalPanel.h b/engines/hpl1/penumbra-overture/NumericalPanel.h
index 1d8320878ea..b414e933d39 100644
--- a/engines/hpl1/penumbra-overture/NumericalPanel.h
+++ b/engines/hpl1/penumbra-overture/NumericalPanel.h
@@ -71,7 +71,7 @@ private:
int mlNum;
};
-typedef std::list<cNumericalButton *> tNumericalButtonList;
+typedef Common::List<cNumericalButton *> tNumericalButtonList;
typedef tNumericalButtonList::iterator tNumericalButtonListIt;
//---------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp b/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
index d448425d0f0..6ea7c284df9 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
@@ -41,7 +41,7 @@
#include "hpl1/penumbra-overture/GameEntity.h"
#include "hpl1/penumbra-overture/MapHandler.h"
-#include <list>
+#include "common/list.h"
//////////////////////////////////////////////////////////////////////////
// THROW STATE
@@ -291,7 +291,7 @@ cPlayerState_WeaponMeleeHaptX::cPlayerState_WeaponMeleeHaptX(cInit *apInit, cPla
static cVector3f gvPrevPos;
static bool gbFirstTime = true;
-static std::list<cVector3f> glsVelList;
+static Common::List<cVector3f> glsVelList;
void cPlayerState_WeaponMeleeHaptX::OnUpdate(float afTimeStep) {
/////////////////////////////////////
@@ -330,7 +330,7 @@ void cPlayerState_WeaponMeleeHaptX::OnUpdate(float afTimeStep) {
glsVelList.pop_front();
cVector3f vAvg(0);
- for (std::list<cVector3f>::iterator it = glsVelList.begin(); it != glsVelList.end(); ++it) {
+ for (Common::List<cVector3f>::iterator it = glsVelList.begin(); it != glsVelList.end(); ++it) {
vAvg += *it;
}
vAvg = vAvg / (float)glsVelList.size();
diff --git a/engines/hpl1/penumbra-overture/RadioHandler.h b/engines/hpl1/penumbra-overture/RadioHandler.h
index c859c70b456..06966ed6a6f 100644
--- a/engines/hpl1/penumbra-overture/RadioHandler.h
+++ b/engines/hpl1/penumbra-overture/RadioHandler.h
@@ -48,7 +48,7 @@ public:
iSoundChannel *mpChannel;
};
-typedef std::list<cRadioMessage *> tRadioMessageList;
+typedef Common::List<cRadioMessage *> tRadioMessageList;
typedef tRadioMessageList::iterator tRadioMessageListIt;
//---------------------------------------
Commit: 2860ff2c1cf80104c29b9852408287ca532c6466
https://github.com/scummvm/scummvm/commit/2860ff2c1cf80104c29b9852408287ca532c6466
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:08+01:00
Commit Message:
HPL1: Further GCC Compiler Shadowing Warning Fixes for Newton Physics
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionBox.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.cpp
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.cpp b/engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.cpp
index 2301f13034f..3439c861513 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.cpp
@@ -658,15 +658,15 @@ dgInt32 dgBroadPhaseCollision::ConvexCast(dgCollision *const shape,
for (dgInt32 i = 0; i < totalCount; i++) {
// dgFloat32 t;
dgContactPoint contact;
- dgVector p0(info[i].m_point[0], info[i].m_point[1], info[i].m_point[2],
+ dgVector pv0(info[i].m_point[0], info[i].m_point[1], info[i].m_point[2],
dgFloat32(0.0f));
- dgVector p1(p0 + dir);
- p0 -= dir;
+ dgVector pv1(pv0 + dir);
+ pv0 -= dir;
const dgMatrix &matrix = info[i].m_hitBody->m_matrix;
- dgVector l0(matrix.UntransformVector(p0));
- dgVector l1(matrix.UntransformVector(p1));
+ dgVector l0(matrix.UntransformVector(pv0));
+ dgVector l1(matrix.UntransformVector(pv1));
info[i].m_normalOnHitPoint[0] = info[i].m_normal[0];
// bug fixed by thedmd
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionBox.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionBox.cpp
index 07bccd43bd4..1f04033b874 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionBox.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionBox.cpp
@@ -443,14 +443,16 @@ dgInt32 dgCollisionBox::CalculatePlaneIntersection(const dgVector &normal,
dgPlane plane(normal, -(normal % point));
dgConvexSimplexEdge *edge = NULL;
- dgFloat32 side1 = dgFloat32(1.0e20f);
- for (dgInt32 i = 0; i < 8; i++) {
- dgFloat32 side0 = plane.Evalue(m_vertex[i]);
- test[i] = side0;
- if (side0 > dgFloat32(0.0f)) {
- if (side0 < side1) {
- side1 = side0;
- edge = m_supportVertexStarCuadrant[i];
+ {
+ dgFloat32 side1 = dgFloat32(1.0e20f);
+ for (dgInt32 i = 0; i < 8; i++) {
+ dgFloat32 side0 = plane.Evalue(m_vertex[i]);
+ test[i] = side0;
+ if (side0 > dgFloat32(0.0f)) {
+ if (side0 < side1) {
+ side1 = side0;
+ edge = m_supportVertexStarCuadrant[i];
+ }
}
}
}
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.cpp
index 7fbf4c3137a..83b4b01295f 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.cpp
@@ -417,9 +417,9 @@ dgFloat32 dgCollisionCapsule::RayCast(const dgVector &q0, const dgVector &q1, dg
dgVector dqp0(q0 - h);
dgFloat32 a = dq % dq;
dgFloat32 b = dgFloat32(2.0f) * (dqp0 % dq);
- dgFloat32 c = dqp0 % dqp0 - radius * radius;
- if (c > dgFloat32(0.0f)) {
- dgFloat32 desc = b * b - dgFloat32(4.0f) * a * c;
+ dgFloat32 d = dqp0 % dqp0 - radius * radius;
+ if (d > dgFloat32(0.0f)) {
+ dgFloat32 desc = b * b - dgFloat32(4.0f) * a * d;
if (desc > dgFloat32(1.0e-8f)) {
dgFloat32 t1;
desc = dgSqrt(desc);
@@ -440,9 +440,9 @@ dgFloat32 dgCollisionCapsule::RayCast(const dgVector &q0, const dgVector &q1, dg
dgVector dqp0(q0 - h);
dgFloat32 a = dq % dq;
dgFloat32 b = dgFloat32(2.0f) * (dqp0 % dq);
- dgFloat32 c = dqp0 % dqp0 - radius * radius;
- if (c > dgFloat32(0.0f)) {
- dgFloat32 desc = b * b - dgFloat32(4.0f) * a * c;
+ dgFloat32 d = dqp0 % dqp0 - radius * radius;
+ if (d > dgFloat32(0.0f)) {
+ dgFloat32 desc = b * b - dgFloat32(4.0f) * a * d;
if (desc > dgFloat32(1.0e-8f)) {
dgFloat32 t1;
desc = dgSqrt(desc);
@@ -619,12 +619,12 @@ dgInt32 dgCollisionCapsule::CalculatePlaneIntersection(const dgVector &normal,
}
if (count < 2) {
- dgVector dp(m_silhuette[3] - m_silhuette[2]);
- den = normal1 % dp;
+ dgVector dpp(m_silhuette[3] - m_silhuette[2]);
+ den = normal1 % dpp;
if (dgAbsf(den) > dgFloat32(0.0f)) {
test0 = -plane.Evalue(m_silhuette[2]) / den;
if ((test0 <= dgFloat32(1.0)) && (test0 >= dgFloat32(0.0f))) {
- contactsOut[count] = m_silhuette[2] + dp.Scale(test0);
+ contactsOut[count] = m_silhuette[2] + dpp.Scale(test0);
count++;
}
}
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.cpp
index 3589a23d6df..c53a34014ec 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.cpp
@@ -90,14 +90,14 @@ void dgCollisionChamferCylinder::Init(dgFloat32 radius, dgFloat32 height) {
dgFloat32 breakStep = dgPI2 / DG_CHAMFERCYLINDER_BRAKES;
dgMatrix rot(dgPitchMatrix(breakStep));
- dgInt32 index = 0;
+ dgInt32 k = 0;
for (dgInt32 j = 0; j <= DG_CHAMFERCYLINDER_SLICES; j++) {
dgVector p0(-m_height * dgCos(sliceAngle), dgFloat32(0.0f),
m_radius + m_height * dgSin(sliceAngle), dgFloat32(1.0f));
sliceAngle += sliceStep;
for (dgInt32 i = 0; i < DG_CHAMFERCYLINDER_BRAKES; i++) {
- m_vertex[index] = p0;
- index++;
+ m_vertex[k] = p0;
+ k++;
p0 = rot.UnrotateVector(p0);
}
}
@@ -467,12 +467,12 @@ dgInt32 dgCollisionChamferCylinder::CalculatePlaneIntersection(
}
if (count < 2) {
- dgVector dp(m_silhuette[3] - m_silhuette[2]);
- den = normal1 % dp;
+ dgVector dpp(m_silhuette[3] - m_silhuette[2]);
+ den = normal1 % dpp;
_ASSERTE(dgAbsf(den) > dgFloat32(0.0f));
test0 = -plane.Evalue(m_silhuette[2]) / den;
if ((test0 <= dgFloat32(1.0)) && (test0 >= dgFloat32(0.0f))) {
- contactsOut[count] = m_silhuette[2] + dp.Scale(test0);
+ contactsOut[count] = m_silhuette[2] + dpp.Scale(test0);
count++;
}
}
Commit: 7f6929771b6a4b97aefddff002f42b5cc096121d
https://github.com/scummvm/scummvm/commit/7f6929771b6a4b97aefddff002f42b5cc096121d
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:09+01:00
Commit Message:
HPL1: Further Fixes For GCC Compiler Shadowing Warnings in Newton Physics
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexHull.cpp
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
index 34d33e937de..a7237fbe419 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
@@ -389,16 +389,16 @@ dgCollisionCompoundBreakable::dgDebriGraph::dgDebriGraph(
dgMemoryAllocator *const allocator, dgDeserialize callback,
void *const userData) : dgGraph<dgDebriNodeInfo, dgSharedNodeMesh>(allocator) {
dgInt32 count;
- dgGraph<dgDebriNodeInfo, dgSharedNodeMesh>::dgListNode *node;
+ dgGraph<dgDebriNodeInfo, dgSharedNodeMesh>::dgListNode *n;
callback(userData, &count, dgInt32(sizeof(dgInt32)));
dgStack<dgListNode *> nodesMap(count);
- node = dgGraph<dgDebriNodeInfo, dgSharedNodeMesh>::AddNode();
- dgDebriNodeInfo &data = GetFirst()->GetInfo().m_nodeData;
- callback(userData, &data.m_commonData, sizeof(data.m_commonData));
+ n = dgGraph<dgDebriNodeInfo, dgSharedNodeMesh>::AddNode();
+ dgDebriNodeInfo &dataN = GetFirst()->GetInfo().m_nodeData;
+ callback(userData, &dataN.m_commonData, sizeof(dataN.m_commonData));
- nodesMap[0] = node;
+ nodesMap[0] = n;
for (dgInt32 i = 1; i < count; i++) {
dgGraph<dgDebriNodeInfo, dgSharedNodeMesh>::dgListNode *node;
@@ -440,12 +440,12 @@ dgCollisionCompoundBreakable::dgDebriGraph::dgDebriGraph(
{
newNode = dgGraph<dgDebriNodeInfo, dgSharedNodeMesh>::AddNode();
- dgDebriNodeInfo &srcData = node->GetInfo().m_nodeData;
- dgDebriNodeInfo &data = newNode->GetInfo().m_nodeData;
+ dgDebriNodeInfo &sourceData = node->GetInfo().m_nodeData;
+ dgDebriNodeInfo &destData = newNode->GetInfo().m_nodeData;
- data.m_commonData = srcData.m_commonData;
- data.m_mesh = srcData.m_mesh;
- data.m_mesh->AddRef();
+ destData.m_commonData = sourceData.m_commonData;
+ destData.m_mesh = sourceData.m_mesh;
+ destData.m_mesh->AddRef();
filter.Insert(newNode, node);
}
@@ -482,23 +482,23 @@ void dgCollisionCompoundBreakable::dgDebriGraph::Serialize(dgSerialize callback,
enumerator.Insert(0, GetFirst());
for (dgListNode *node = GetFirst()->GetNext(); node; node = node->GetNext()) {
- dgDebriNodeInfo &data = node->GetInfo().m_nodeData;
- dgDebriNodeInfo::PackedSaveData packedData(data.m_commonData);
- packedData.m_lru = 0;
- callback(userData, &packedData, sizeof(packedData));
+ dgDebriNodeInfo &dataN = node->GetInfo().m_nodeData;
+ dgDebriNodeInfo::PackedSaveData packedDataN(dataN.m_commonData);
+ packedDataN.m_lru = 0;
+ callback(userData, &packedDataN, sizeof(packedDataN));
- data.m_mesh->Serialize(callback, userData);
+ dataN.m_mesh->Serialize(callback, userData);
enumerator.Insert(index, node);
index++;
}
for (dgListNode *node = GetFirst(); node != GetLast(); node = node->GetNext()) {
- dgInt32 count;
+ dgInt32 countN;
index = 0;
- count = node->GetInfo().GetCount();
- callback(userData, &count, dgInt32(sizeof(dgInt32)));
- dgStack<dgInt32> buffer(count);
+ countN = node->GetInfo().GetCount();
+ callback(userData, &countN, dgInt32(sizeof(dgInt32)));
+ dgStack<dgInt32> buffer(countN);
dgInt32 *const pool = &buffer[0];
for (dgGraphNode<dgDebriNodeInfo, dgSharedNodeMesh>::dgListNode *edgeNode =
node->GetInfo().GetFirst();
@@ -506,7 +506,7 @@ void dgCollisionCompoundBreakable::dgDebriGraph::Serialize(dgSerialize callback,
pool[index] = enumerator.Find(edgeNode->GetInfo().m_node)->GetInfo();
index++;
}
- callback(userData, &pool[0], size_t(count * sizeof(dgInt32)));
+ callback(userData, &pool[0], size_t(countN * sizeof(dgInt32)));
}
}
@@ -727,12 +727,12 @@ dgCollisionCompoundBreakable::dgCollisionCompoundBreakable(dgInt32 count,
node != m_conectivity.GetLast(); node = node->GetNext()) {
dgDebriNodeInfo &data = node->GetInfo().m_nodeData;
- for (dgMesh::dgListNode *node = data.m_mesh->GetFirst(); node;
- node = node->GetNext()) {
+ for (dgMesh::dgListNode *nodeF = data.m_mesh->GetFirst(); nodeF;
+ nodeF = nodeF->GetNext()) {
dgInt8 visbility;
dgInt32 rootIndexCount;
- dgSubMesh &segment = node->GetInfo();
+ dgSubMesh &segment = nodeF->GetInfo();
dgSubMesh &rootSegment = *mainSegmenst[segment.m_material];
visbility = dgInt8(segment.m_visibleFaces);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.cpp
index 7a999228740..a774e8a2385 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.cpp
@@ -298,12 +298,12 @@ bool dgCollisionConvex::SanityCheck(dgPolyhedra &hull) const {
ptr = edge;
do {
- dgVector p0(m_vertex[ptr->m_twin->m_incidentVertex]);
+ dgVector pp0(m_vertex[ptr->m_twin->m_incidentVertex]);
for (dgEdge *neiborg = ptr->m_twin->m_next->m_next;
neiborg != ptr->m_twin; neiborg = neiborg->m_next) {
- dgVector p1(m_vertex[neiborg->m_incidentVertex]);
- dgVector dp(p1 - p0);
- dgFloat32 project = dp % n0;
+ dgVector pp1(m_vertex[neiborg->m_incidentVertex]);
+ dgVector dpp(pp1 - pp0);
+ dgFloat32 project = dpp % n0;
if (project > dgFloat32(0.0f)) {
return false;
}
@@ -1007,8 +1007,8 @@ bool dgCollisionConvex::SanityCheck(dgInt32 count, const dgVector &normal,
j = count - 1;
for (dgInt32 i = 0; i < count; i++) {
dgVector e1(contactsOut[i] - contactsOut[j]);
- dgVector n(e0 * e1);
- dgFloat32 error = n % normal;
+ dgVector nx(e0 * e1);
+ dgFloat32 error = nx % normal;
_ASSERTE(error >= dgFloat32(-1.0e-4f));
if (error < dgFloat32(-1.0e-4f)) {
return false;
@@ -1050,22 +1050,22 @@ dgInt32 dgCollisionConvex::SimplifyClipPolygon(dgInt32 count,
dgInt32 removeCount = count - DG_MAX_VERTEX_CLIP_FACE;
while (sortHeap.GetCount() && removeCount) {
- dgInt32 i1 = sortHeap[0];
+ dgInt32 ii1 = sortHeap[0];
sortHeap.Pop();
- dgInt32 i0 = (i1 - 1) >= 0 ? i1 - 1 : count - 1;
- dgInt32 i2 = (i1 + 1) < count ? i1 + 1 : 0;
+ dgInt32 ii0 = (ii1 - 1) >= 0 ? ii1 - 1 : count - 1;
+ dgInt32 ii2 = (ii1 + 1) < count ? ii1 + 1 : 0;
- if (!(mark[i0] || mark[i2])) {
- mark[i1] = 1;
+ if (!(mark[ii0] || mark[ii2])) {
+ mark[ii1] = 1;
removeCount--;
}
}
i0 = 0;
- for (dgInt32 i1 = 0; i1 < count; i1++) {
- if (!mark[i1]) {
- polygon[i0] = polygon[i1];
+ for (dgInt32 ii1 = 0; ii1 < count; ii1++) {
+ if (!mark[ii1]) {
+ polygon[i0] = polygon[ii1];
i0++;
}
}
@@ -1765,8 +1765,8 @@ dgFloat32 dgCollisionConvex::RayCast(const dgVector &localP0,
const dgVector &p1 = tetrahedrum[i1];
const dgVector &p2 = tetrahedrum[i2];
dgVector e0(p1 - p0);
- dgVector e1(p2 - p0);
- normal = e0 * e1;
+ dgVector ee1(p2 - p0);
+ normal = e0 * ee1;
face = -1;
error2 = dgFloat32(1.0e10f);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexHull.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexHull.cpp
index 863f7b82f65..ae876331a11 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexHull.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexHull.cpp
@@ -268,19 +268,19 @@ bool dgCollisionConvexHull::RemoveCoplanarEdge(dgPolyhedra &polyhedra,
dgFloat64 projection = n1 % normal0;
if (projection >= DG_MAX_EDGE_ANGLE) {
- dgBigVector e1(
+ dgBigVector ee1(
hullVertexArray[edge0->m_next->m_next->m_incidentVertex] - hullVertexArray[edge0->m_twin->m_incidentVertex]);
- dgBigVector e0(
+ dgBigVector ee0(
hullVertexArray[edge0->m_twin->m_incidentVertex] - hullVertexArray[edge0->m_twin->m_prev->m_incidentVertex]);
- _ASSERTE((e0 % e0) >= dgFloat64(0.0f));
- _ASSERTE((e1 % e1) >= dgFloat64(0.0f));
- // e0 = e0.Scale (dgRsqrt (e0 % e0));
- // e1 = e1.Scale (dgRsqrt (e1 % e1));
- e0 = e0.Scale(dgFloat64(1.0f) / sqrt(e0 % e0));
- e1 = e1.Scale(dgFloat64(1.0f) / sqrt(e1 % e1));
-
- dgBigVector n1(e0 * e1);
- projection = n1 % normal0;
+ _ASSERTE((ee0 % ee0) >= dgFloat64(0.0f));
+ _ASSERTE((ee1 % ee1) >= dgFloat64(0.0f));
+ // ee0 = ee0.Scale (dgRsqrt (ee0 % ee0));
+ // ee1 = ee1.Scale (dgRsqrt (ee1 % ee1));
+ ee0 = ee0.Scale(dgFloat64(1.0f) / sqrt(ee0 % ee0));
+ ee1 = ee1.Scale(dgFloat64(1.0f) / sqrt(ee1 % ee1));
+
+ dgBigVector nn1(ee0 * ee1);
+ projection = nn1 % normal0;
if (projection >= DG_MAX_EDGE_ANGLE) {
_ASSERTE(&(*iter) != edge0);
_ASSERTE(&(*iter) != edge0->m_twin);
@@ -413,19 +413,19 @@ bool dgCollisionConvexHull::Create(dgInt32 count, dgInt32 strideInBytes,
}
}
if (!success) {
- dgInt32 count = 0;
+ dgInt32 cnt = 0;
dgInt32 vertexCount = convexHull->GetVertexCount();
for (dgInt32 i = 0; i < vertexCount; i++) {
if (mask[i]) {
- buffer[count * 3 + 0] = hullVertexArray[i].m_x;
- buffer[count * 3 + 1] = hullVertexArray[i].m_y;
- buffer[count * 3 + 2] = hullVertexArray[i].m_z;
- count++;
+ buffer[cnt * 3 + 0] = hullVertexArray[i].m_x;
+ buffer[cnt * 3 + 1] = hullVertexArray[i].m_y;
+ buffer[cnt * 3 + 2] = hullVertexArray[i].m_z;
+ cnt++;
}
}
delete convexHull;
convexHull = new (GetAllocator()) dgConvexHull3d(GetAllocator(),
- &buffer[0], 3 * sizeof(dgFloat64), count, tolerance);
+ &buffer[0], 3 * sizeof(dgFloat64), cnt, tolerance);
}
}
Commit: 0e3c23fc9d2f0d16bc7450825018614148ef95ee
https://github.com/scummvm/scummvm/commit/0e3c23fc9d2f0d16bc7450825018614148ef95ee
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:09+01:00
Commit Message:
HPL1: Further Fixes for GCC Shadowing Warnings in Newton Physics
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.h
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
index 244c8868a8b..141ef550b26 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
@@ -885,34 +885,34 @@ dgFloat32 dgCollisionMesh::dgCollisionConvexPolygon::MovingPointToPolygonContact
dgVector supportPoint(p - m_normal.Scale(radius));
dgFloat32 timeToImpact = -(m_normal % (supportPoint - m_localPoly[0])) / (m_normal % vdir);
dgVector point(supportPoint + vdir.Scale(timeToImpact));
- dgVector closestPoint(point);
- dgFloat32 minDist = dgFloat32(1.0e20f);
- bool isEdge = true;
+ dgVector closestPointN(point);
+ dgFloat32 minDistance = dgFloat32(1.0e20f);
+ bool isEdgeFlag = true;
for (int i = 2; i < m_count; i++) {
bool tmpIsEdge;
const dgVector q(ClosestDistanceToTriangle(point, m_localPoly[0], m_localPoly[i - 1], m_localPoly[i], tmpIsEdge));
- isEdge &= tmpIsEdge;
+ isEdgeFlag &= tmpIsEdge;
const dgVector error(q - point);
dgFloat32 dist = error % error;
- if (dist < minDist) {
- minDist = dist;
- closestPoint = q;
+ if (dist < minDistance) {
+ minDistance = dist;
+ closestPointN = q;
}
}
- if (!isEdge) {
- _ASSERTE(minDist < dgFloat32(1.0e-3f));
+ if (!isEdgeFlag) {
+ _ASSERTE(minDistance < dgFloat32(1.0e-3f));
timestep = GetMax(timeToImpact, dgFloat32(0.0f));
contact.m_normal = m_normal;
contact.m_penetration = dgFloat32(0.0f);
contact.m_isEdgeContact = 0;
contact.m_point = p - m_normal.Scale(radius);
- contact.m_point = closestPoint;
+ contact.m_point = closestPointN;
} else {
/*
_ASSERTE (isEdge);
- dgVector dp (closestPoint - p);
+ dgVector dp (closestPointN - p);
// this does not really work ( goidnm back to my old method
// has I finally found the bug, when V is very large, then
@@ -935,9 +935,9 @@ dgFloat32 dgCollisionMesh::dgCollisionConvexPolygon::MovingPointToPolygonContact
if (t >= 0.0f) {
timestep = t;
contact.m_penetration = dgFloat32 (0.0f);
- contact.m_isEdgeContact = isEdge ? 1 : 0;
- contact.m_point = closestPoint;
- dgVector n (p - (closestPoint - vdir.Scale (t)));
+ contact.m_isEdgeContact = isEdgeFlag ? 1 : 0;
+ contact.m_point = closestPointN;
+ dgVector n (p - (closestPointN - vdir.Scale (t)));
contact.m_normal = n.Scale (dgRsqrt (n % n));
}
}
@@ -952,7 +952,7 @@ dgFloat32 dgCollisionMesh::dgCollisionConvexPolygon::MovingPointToPolygonContact
if ((t > dgFloat32(0.0f)) && (t < mint)) {
mint = t;
edgefound = true;
- closestPoint = tmp;
+ closestPointN = tmp;
}
i0 = i1;
}
@@ -961,8 +961,8 @@ dgFloat32 dgCollisionMesh::dgCollisionConvexPolygon::MovingPointToPolygonContact
timestep = mint;
contact.m_penetration = dgFloat32(0.0f);
contact.m_isEdgeContact = 1;
- contact.m_point = closestPoint;
- dgVector n(p - (closestPoint - vdir.Scale(mint)));
+ contact.m_point = closestPointN;
+ dgVector n(p - (closestPointN - vdir.Scale(mint)));
contact.m_normal = n.Scale(dgRsqrt(n % n));
}
}
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.cpp
index c3ce32ce1ac..3950c7225d2 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.cpp
@@ -71,11 +71,11 @@ dgCollisionScene::dgNode::~dgNode() {
}
}
-dgCollisionScene::dgProxy::dgProxy(dgCollision *m_shape, const dgMatrix &matrix,
- dgCollisionScene *const owner) : dgNode(), m_matrix(m_shape->GetOffsetMatrix() * matrix), m_userData(NULL), m_shape(m_shape), m_owner(owner), m_myNode(NULL) {
+dgCollisionScene::dgProxy::dgProxy(dgCollision *shape, const dgMatrix &matrix,
+ dgCollisionScene *const owner) : dgNode(), m_matrix(shape->GetOffsetMatrix() * matrix), m_userData(NULL), m_shape(shape), m_owner(owner), m_myNode(NULL) {
dgVector boxP0;
dgVector boxP1;
- m_shape->CalcAABB(m_matrix, boxP0, boxP1);
+ shape->CalcAABB(m_matrix, boxP0, boxP1);
dgVector p0(
boxP0.CompProduct(
@@ -129,15 +129,15 @@ dgCollisionScene::dgCollisionScene(dgWorld *const world,
deserialization(userData, &data, sizeof(data));
for (dgInt32 i = 0; i < data[0]; i++) {
dgMatrix matrix;
- void *data;
+ void *dataNew;
deserialization(userData, &matrix, sizeof(dgMatrix));
- deserialization(userData, &data, sizeof(void *));
+ deserialization(userData, &dataNew, sizeof(void *));
dgCollision *const collision = m_world->CreateFromSerialization(
deserialization, userData);
dgList<dgProxy *>::dgListNode *const proxyNode =
(dgList<dgProxy *>::dgListNode *)AddProxy(collision, matrix);
dgProxy *const proxy = proxyNode->GetInfo();
- proxy->m_userData = data;
+ proxy->m_userData = dataNew;
collision->Release();
}
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.h b/engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.h
index f9b1aca843a..653d10751a0 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.h
@@ -48,7 +48,7 @@ public:
public:
DG_CLASS_ALLOCATOR(allocator)
- dgProxy(dgCollision *m_shape, const dgMatrix &matrix, dgCollisionScene *const owner);
+ dgProxy(dgCollision *shape, const dgMatrix &matrix, dgCollisionScene *const owner);
~dgProxy();
dgMatrix m_matrix;
Commit: ab03db95f737c2cb73e0c928bdfdc97052b84a29
https://github.com/scummvm/scummvm/commit/ab03db95f737c2cb73e0c928bdfdc97052b84a29
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:09+01:00
Commit Message:
HPL1: fix wrong variable use in newton code
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgTypes.cpp b/engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
index d8900892414..4ad4bcfec3e 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
@@ -448,7 +448,7 @@ static dgInt32 SortVertices(dgFloat64* const vertexList, dgInt32 stride,
bool test = true;
for (dgInt32 t = 0; test && (t < compareCount); t++)
{
- dgFloat64 v = fabs(vertexList[m + t + 2] - vertexList[k + t + 2]);
+ dgFloat64 v = fabs(vertexList[m + t + 2] - vertexList[q + t + 2]);
test = test && (v <= tol);
}
if (test)
Commit: 78a528792bcb1073768ce149febf552327889927
https://github.com/scummvm/scummvm/commit/78a528792bcb1073768ce149febf552327889927
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:09+01:00
Commit Message:
HPL1: remove unused code for managing directories
Changed paths:
engines/hpl1/penumbra-overture/Init.cpp
engines/hpl1/penumbra-overture/Init.h
engines/hpl1/penumbra-overture/SaveHandler.cpp
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 3d5a71708dc..6af2fffd22b 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -248,44 +248,6 @@ static tString getStringConfig(const char *name, const tString &defaultVal) {
bool cInit::Init(tString saveToLoad) {
SetWindowCaption("Penumbra Loading...");
- // PERSONAL DIR /////////////////////
- tWString sPersonalDir = GetSystemSpecialPath(eSystemPath_Personal);
- if (cString::GetLastCharW(sPersonalDir) != _W("/") &&
- cString::GetLastCharW(sPersonalDir) != _W("\\")) {
- sPersonalDir += _W("/");
- }
-
- // CREATE NEEDED DIRS /////////////////////
- gsUserSettingsPath = sPersonalDir + PERSONAL_RELATIVEROOT PERSONAL_RELATIVEGAME _W("settings.cfg");
-#ifndef WIN32
- // For Mac OS X and Linux move the OLD Episode 1 folder to Penumbra/Overture and symlink to the old path
- if (FolderExists(sPersonalDir + PERSONAL_RELATIVEROOT _W("Penumbra Overture/Episode1")) && !IsFileLink(sPersonalDir + PERSONAL_RELATIVEROOT _W("Penumbra Overture/Episode1"))) {
- // Create the new folder
- if (!FolderExists(sPersonalDir + PERSONAL_RELATIVEROOT _W("Penumbra")))
- CreateFolder(sPersonalDir + PERSONAL_RELATIVEROOT _W("Penumbra"));
- // Move the Older Episode 1 to the new Overture
- RenameFile(sPersonalDir + PERSONAL_RELATIVEROOT _W("Penumbra Overture/Episode1"),
- sPersonalDir + PERSONAL_RELATIVEROOT _W("Penumbra/Overture"));
- // Link back the old one to the new one
- LinkFile(sPersonalDir + PERSONAL_RELATIVEROOT _W("Penumbra/Overture"),
- sPersonalDir + PERSONAL_RELATIVEROOT _W("Penumbra Overture/Episode1"));
- }
-#endif
-
- tWString vDirs[] = {PERSONAL_RELATIVEPIECES // auto includes ,
- PERSONAL_RELATIVEROOT PERSONAL_RELATIVEGAME_PARENT,
- PERSONAL_RELATIVEROOT PERSONAL_RELATIVEGAME};
- int lDirNum = PERSONAL_RELATIVEPIECES_COUNT + 2;
-
- // Check if directories exist and if not create
- for (int i = 0; i < lDirNum; ++i) {
- tWString sDir = sPersonalDir + vDirs[i];
- if (FolderExists(sDir))
- continue;
-
- CreateFolder(sDir);
- }
-
// MAIN INIT /////////////////////
// Check for what settings file to use.
diff --git a/engines/hpl1/penumbra-overture/Init.h b/engines/hpl1/penumbra-overture/Init.h
index 4fa489999b6..a9cfbf7bb2f 100644
--- a/engines/hpl1/penumbra-overture/Init.h
+++ b/engines/hpl1/penumbra-overture/Init.h
@@ -61,26 +61,6 @@ class cMainMenu;
#include "hpl1/penumbra-overture/GameTypes.h"
-#if defined(WIN32)
-#define PERSONAL_RELATIVEROOT
-#define PERSONAL_RELATIVEPIECES
-#define PERSONAL_RELATIVEPIECES_COUNT 0
-#define PERSONAL_RELATIVEGAME_PARENT _W("Penumbra Overture/")
-#define PERSONAL_RELATIVEGAME _W("Penumbra Overture/Episode1/")
-#elif defined(__linux__)
-#define PERSONAL_RELATIVEROOT _W(".frictionalgames/")
-#define PERSONAL_RELATIVEPIECES _W(".frictionalgames"),
-#define PERSONAL_RELATIVEPIECES_COUNT 1
-#define PERSONAL_RELATIVEGAME_PARENT _W("Penumbra/")
-#define PERSONAL_RELATIVEGAME _W("Penumbra/Overture/")
-#else
-#define PERSONAL_RELATIVEROOT _W("Library/Preferences/Frictional Games/")
-#define PERSONAL_RELATIVEPIECES _W("Library"), _W("Library/Preferences"), _W("Library/Preferences/Frictional Games"),
-#define PERSONAL_RELATIVEPIECES_COUNT 3
-#define PERSONAL_RELATIVEGAME_PARENT _W("Penumbra/")
-#define PERSONAL_RELATIVEGAME _W("Penumbra/Overture/")
-#endif
-
//--------------------------------------------------------
//#define DEMO_VERSION
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index 463fd0a1635..69b8cacffea 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -219,52 +219,6 @@ cSaveHandler::cSaveHandler(cInit *apInit) : iUpdateable("SaveHandler") {
mpSavedGame = hplNew(cSavedGame, ());
Reset();
-
- //////////////////////////////////////////////
- // Create directories
- msSaveDir = _W("");
- /*LowLevelSystem *pLowLevelSystem = */mpInit->mpGame->GetSystem()->GetLowLevel();
-
- tWString sPeronalDir = GetSystemSpecialPath(eSystemPath_Personal);
-
- if (sPeronalDir == _W("")) {
- Warning("Couldn't find a personal folder! Using the local folder instead!\n");
- return;
- }
-
- // Put an "/" at end of needed
- if (cString::GetLastCharW(sPeronalDir) != _W("/") &&
- cString::GetLastCharW(sPeronalDir) != _W("\\")) {
- sPeronalDir += _W("/");
- }
-
- // Set to the name of directory
- msSaveDir = sPeronalDir + PERSONAL_RELATIVEROOT PERSONAL_RELATIVEGAME;
-
- // The directories that should be created
- tWString vDirs[] = {PERSONAL_RELATIVEPIECES
- PERSONAL_RELATIVEROOT PERSONAL_RELATIVEGAME_PARENT,
- PERSONAL_RELATIVEROOT PERSONAL_RELATIVEGAME,
- PERSONAL_RELATIVEROOT PERSONAL_RELATIVEGAME _W("save"),
- PERSONAL_RELATIVEROOT PERSONAL_RELATIVEGAME _W("save/auto"),
- PERSONAL_RELATIVEROOT PERSONAL_RELATIVEGAME _W("save/spot"),
- PERSONAL_RELATIVEROOT PERSONAL_RELATIVEGAME _W("save/favorite")};
- int lDirNum = PERSONAL_RELATIVEPIECES_COUNT + 6;
-
- // Check if directories exist and if not create
- for (int i = 0; i < lDirNum; ++i) {
- tWString sDir = sPeronalDir + vDirs[i];
- if (FolderExists(sDir))
- continue;
-
- if (CreateFolder(sDir) == false) {
- // msSaveDir = _W("");
- Warning("Couldn't create save folder '%s'! Saving to local\n",
- cString::To8Char(sDir).c_str());
- // return;
- continue;
- }
- }
}
//-----------------------------------------------------------------------
Commit: fc5bda73fa287324a4cbf5346c572262a7ae0341
https://github.com/scummvm/scummvm/commit/fc5bda73fa287324a4cbf5346c572262a7ae0341
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:09+01:00
Commit Message:
HPL1: Further Fixes for GCC Shadowing Warnings in Newton Physics
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect2.cpp
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect3.cpp
engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.cpp
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
index 6c54fc0fc01..941363f7bac 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
@@ -1426,26 +1426,26 @@ void dgMeshEffect::BuildFromVertexListIndexList(
if (duplicate) {
dgTree<dgInt32, dgInt32>::dgTreeNode *aliasNode = aliasVertexMap.Find(i0);
if (!aliasNode) {
- dgInt32 index = i0 * vertexStride;
+ dgInt32 nodeIndex = i0 * vertexStride;
aliasNode = aliasVertexMap.Insert(m_pointCount, i0);
- AddVertex(dgBigVector(vertex[index + 0], vertex[index + 1], vertex[index + 2], vertex[index + 3] + 1.0f));
+ AddVertex(dgBigVector(vertex[nodeIndex + 0], vertex[nodeIndex + 1], vertex[nodeIndex + 2], vertex[nodeIndex + 3] + 1.0f));
}
i0 = aliasNode->GetInfo();
newFaceIndex[k ? (k - 1) : (count - 1)] = i0;
aliasNode = aliasVertexMap.Find(i1);
if (!aliasNode) {
- dgInt32 index = i1 * vertexStride;
+ dgInt32 nodeIndex = i1 * vertexStride;
aliasNode = aliasVertexMap.Insert(m_pointCount, i1);
- AddVertex(dgBigVector(vertex[index + 0], vertex[index + 1], vertex[index + 2], vertex[index + 3] + 1.0f));
+ AddVertex(dgBigVector(vertex[nodeIndex + 0], vertex[nodeIndex + 1], vertex[nodeIndex + 2], vertex[nodeIndex + 3] + 1.0f));
}
i1 = aliasNode->GetInfo();
newFaceIndex[k] = i1;
}
i0 = i1;
}
- dgEdge *const edge = AddFace(count, newFaceIndex, userdata);
- if (!edge) {
+ dgEdge *const edgeF = AddFace(count, newFaceIndex, userdata);
+ if (!edgeF) {
faceAdded = false;
memcpy(index, newFaceIndex, count * sizeof(newFaceIndex[0]));
}
@@ -1463,8 +1463,8 @@ void dgMeshEffect::BuildFromVertexListIndexList(
dgTreeNode *const aliasNode = FindGreaterEqual(key.GetVal());
if (aliasNode && (aliasNode->GetInfo().m_incidentVertex == aliasVertex)) {
dgInt32 parentVertex = iter.GetNode()->GetKey();
- dgPolyhedra::dgPairKey key(parentVertex, 0);
- dgTreeNode *const parentNode = FindGreaterEqual(key.GetVal());
+ dgPolyhedra::dgPairKey keyV(parentVertex, 0);
+ dgTreeNode *const parentNode = FindGreaterEqual(keyV.GetVal());
_ASSERTE(parentNode);
dgEdge *const alliasEdge = &aliasNode->GetInfo();
@@ -1730,33 +1730,33 @@ void *dgMeshEffect::GetNextVertex(const void *vertex) {
Iterator iter(*this);
iter.Set(node);
for (iter++; iter; iter++) {
- dgTreeNode *const node = iter.GetNode();
- if (node->GetInfo().m_mark != mark) {
- dgEdge *const edge = &node->GetInfo();
+ dgTreeNode *const nodeI = iter.GetNode();
+ if (nodeI->GetInfo().m_mark != mark) {
+ dgEdge *const edge = &nodeI->GetInfo();
dgEdge *ptr = edge;
do {
ptr->m_mark = mark;
ptr = ptr->m_twin->m_next;
} while (ptr != edge);
- return node;
+ return nodeI;
}
}
return NULL;
}
dgInt32 dgMeshEffect::GetVertexIndex(const void *vertex) const {
- dgTreeNode *const node = (dgTreeNode *)vertex;
- dgEdge *const edge = &node->GetInfo();
+ dgTreeNode *const nodeT = (dgTreeNode *)vertex;
+ dgEdge *const edge = &nodeT->GetInfo();
return edge->m_incidentVertex;
}
void *dgMeshEffect::GetFirstPoint() {
Iterator iter(*this);
for (iter.Begin(); iter; iter++) {
- dgTreeNode *const node = iter.GetNode();
- dgEdge *const edge = &node->GetInfo();
+ dgTreeNode *const nodeI = iter.GetNode();
+ dgEdge *const edge = &nodeI->GetInfo();
if (edge->m_incidentFace > 0) {
- return node;
+ return nodeI;
}
}
return NULL;
@@ -1846,11 +1846,11 @@ void *dgMeshEffect::GetNextEdge(const void *edge) {
Iterator iter(*this);
iter.Set(node);
for (iter++; iter; iter++) {
- dgTreeNode *const node = iter.GetNode();
- if (node->GetInfo().m_mark != mark) {
- node->GetInfo().m_mark = mark;
- node->GetInfo().m_twin->m_mark = mark;
- return node;
+ dgTreeNode *const nodeI = iter.GetNode();
+ if (nodeI->GetInfo().m_mark != mark) {
+ nodeI->GetInfo().m_mark = mark;
+ nodeI->GetInfo().m_twin->m_mark = mark;
+ return nodeI;
}
}
return NULL;
@@ -1897,15 +1897,15 @@ void *dgMeshEffect::GetNextFace(const void *const face) {
Iterator iter(*this);
iter.Set(node);
for (iter++; iter; iter++) {
- dgTreeNode *const node = iter.GetNode();
- if (node->GetInfo().m_mark != mark) {
- dgEdge *const edge = &node->GetInfo();
+ dgTreeNode *const nodeI = iter.GetNode();
+ if (nodeI->GetInfo().m_mark != mark) {
+ dgEdge *const edge = &nodeI->GetInfo();
dgEdge *ptr = edge;
do {
ptr->m_mark = mark;
ptr = ptr->m_next;
} while (ptr != edge);
- return node;
+ return nodeI;
}
}
return NULL;
@@ -2679,16 +2679,16 @@ dgMeshEffect::dgVertexAtribute dgMeshEffect::InterpolateVertex(
dgBigVector p_p1(point - q1);
dgBigVector p_p2(point - q2);
- dgFloat64 alpha1 = p10 % p_p0;
- dgFloat64 alpha2 = p20 % p_p0;
- dgFloat64 alpha3 = p10 % p_p1;
- dgFloat64 alpha4 = p20 % p_p1;
- dgFloat64 alpha5 = p10 % p_p2;
- dgFloat64 alpha6 = p20 % p_p2;
+ dgFloat64 p_alpha1 = p10 % p_p0;
+ dgFloat64 p_alpha2 = p20 % p_p0;
+ dgFloat64 p_alpha3 = p10 % p_p1;
+ dgFloat64 p_alpha4 = p20 % p_p1;
+ dgFloat64 p_alpha5 = p10 % p_p2;
+ dgFloat64 p_alpha6 = p20 % p_p2;
- dgFloat64 vc = alpha1 * alpha4 - alpha3 * alpha2;
- dgFloat64 vb = alpha5 * alpha2 - alpha1 * alpha6;
- dgFloat64 va = alpha3 * alpha6 - alpha5 * alpha4;
+ dgFloat64 vc = p_alpha1 * p_alpha4 - p_alpha3 * p_alpha2;
+ dgFloat64 vb = p_alpha5 * p_alpha2 - p_alpha1 * p_alpha6;
+ dgFloat64 va = p_alpha3 * p_alpha6 - p_alpha5 * p_alpha4;
dgFloat64 den = va + vb + vc;
dgFloat64 minError = den * (-tol);
dgFloat64 maxError = den * (dgFloat32(1.0f) + tol);
@@ -2828,11 +2828,11 @@ void dgMeshEffect::FilterCoplanarFaces(const dgMeshEffect *const coplanarFaces,
for (capIter.Begin(); capIter; capIter++) {
dgEdge *const capFace = &(*capIter);
if ((capFace->m_mark != capMark) && (capFace->m_incidentFace > 0)) {
- dgEdge *ptr = capFace;
+ dgEdge *ptrCF = capFace;
do {
- ptr->m_mark = capMark;
- ptr = ptr->m_next;
- } while (ptr != capFace);
+ ptrCF->m_mark = capMark;
+ ptrCF = ptrCF->m_next;
+ } while (ptrCF != capFace);
dgBigVector capNormal(
coplanarFaces->FaceNormal(capFace,
@@ -3058,12 +3058,12 @@ dgMeshEffectSolidTree *dgMeshEffect::CreateSolidTree() const {
dgVertexAtribute points[256];
flatFace.BeginPolygon();
- dgEdge *ptr = face;
+ dgEdge *ptrF = face;
do {
- points[count] = m_attib[ptr->m_userData];
+ points[count] = m_attib[ptrF->m_userData];
count++;
- ptr = ptr->m_next;
- } while (ptr != face);
+ ptrF = ptrF->m_next;
+ } while (ptrF != face);
flatFace.AddPolygon(count, &points[0].m_vertex.m_x,
sizeof(dgVertexAtribute), 0);
flatFace.EndPolygon(dgFloat64(1.0e-5f));
@@ -3071,25 +3071,25 @@ dgMeshEffectSolidTree *dgMeshEffect::CreateSolidTree() const {
dgInt32 flatMark = flatFace.IncLRU();
dgPolyhedra::Iterator flatIter(flatFace);
for (flatIter.Begin(); flatIter; flatIter++) {
- dgEdge *const face = &(*flatIter);
- if ((face->m_incidentFace > 0) && (face->m_mark != flatMark)) {
- dgEdge *ptr = face;
+ dgEdge *const faceI = &(*flatIter);
+ if ((faceI->m_incidentFace > 0) && (faceI->m_mark != flatMark)) {
+ dgEdge *ptrFI = faceI;
do {
- ptr->m_mark = flatMark;
- ptr = ptr->m_next;
- } while (ptr != face);
+ ptrFI->m_mark = flatMark;
+ ptrFI = ptrFI->m_next;
+ } while (ptrFI != faceI);
if (!tree) {
dgBigVector normal(
- flatFace.FaceNormal(face, &flatFace.m_points[0][0],
+ flatFace.FaceNormal(faceI, &flatFace.m_points[0][0],
sizeof(dgBigVector)));
dgFloat64 mag2 = normal % normal;
if (mag2 > dgFloat32(1.0e-10f)) {
tree = new (GetAllocator()) dgMeshEffectSolidTree(flatFace,
- face);
+ faceI);
}
} else {
- tree->AddFace(flatFace, face);
+ tree->AddFace(flatFace, faceI);
}
}
}
@@ -3783,11 +3783,11 @@ dgMeshEffect *dgMeshEffect::GetNextLayer(dgInt32 mark) {
polyhedra.BeginFace();
for (iter.Begin(); iter; iter++) {
- dgEdge *const edge = &(*iter);
- if ((edge->m_mark < mark) && (edge->m_incidentFace > 0)) {
- dgInt32 thislayer = dgInt32(m_points[edge->m_incidentVertex].m_w);
+ dgEdge *const edgeI = &(*iter);
+ if ((edgeI->m_mark < mark) && (edgeI->m_incidentFace > 0)) {
+ dgInt32 thislayer = dgInt32(m_points[edgeI->m_incidentVertex].m_w);
if (thislayer == layer) {
- dgEdge *ptr = edge;
+ dgEdge *ptr = edgeI;
dgInt32 count = 0;
dgInt32 faceIndex[256];
dgInt64 faceDataIndex[256];
@@ -3798,7 +3798,7 @@ dgMeshEffect *dgMeshEffect::GetNextLayer(dgInt32 mark) {
count++;
_ASSERTE(count < dgInt32(sizeof(faceIndex) / sizeof(faceIndex[0])));
ptr = ptr->m_next;
- } while (ptr != edge);
+ } while (ptr != edgeI);
polyhedra.AddFace(count, &faceIndex[0], &faceDataIndex[0]);
}
}
@@ -4041,8 +4041,8 @@ void dgMeshEffect::ClipMesh(const dgMeshEffectSolidTree *const clipper,
originalFace->Release();
for (dgList<dgMeshTreeCSGFace *>::dgListNode *node = faceList.GetFirst();
node; node = node->GetNext()) {
- dgMeshTreeCSGFace *const face = node->GetInfo();
- face->Release();
+ dgMeshTreeCSGFace *const faceT = node->GetInfo();
+ faceT->Release();
}
}
}
@@ -4156,16 +4156,16 @@ void dgMeshEffect::RepairTJoints(bool triangulate) {
_ASSERTE(lastEdge);
bool isTJoint = true;
- dgBigVector p0(m_points[firstEdge->m_incidentVertex]);
- dgBigVector p1(m_points[lastEdge->m_incidentVertex]);
- dgBigVector p1p0(p1 - p0);
- dgFloat64 den = p1p0 % p1p0;
+ dgBigVector point0(m_points[firstEdge->m_incidentVertex]);
+ dgBigVector point1(m_points[lastEdge->m_incidentVertex]);
+ dgBigVector pnt1pnt0(point1 - point0);
+ dgFloat64 den = pnt1pnt0 % pnt1pnt0;
ptr = firstEdge->m_next;
do {
- dgBigVector p2(m_points[ptr->m_incidentVertex]);
- dgFloat64 num = (p2 - p0) % p1p0;
- dgBigVector q(p0 + p1p0.Scale(num / den));
- dgBigVector dist(p2 - q);
+ dgBigVector point2(m_points[ptr->m_incidentVertex]);
+ dgFloat64 num = (point2 - point0) % pnt1pnt0;
+ dgBigVector q(point0 + pnt1pnt0.Scale(num / den));
+ dgBigVector dist(point2 - q);
dgFloat64 err2 = dist % dist;
isTJoint &= (err2 < (dgFloat64(1.0e-4f) * dgFloat64(1.0e-4f)));
ptr = ptr->m_next;
@@ -4275,11 +4275,11 @@ void dgMeshEffect::RepairTJoints(bool triangulate) {
if (triangulate) {
_ASSERTE(begin);
_ASSERTE(last);
- for (dgEdge *ptr = begin->m_next->m_next; ptr != last;
- ptr = ptr->m_next) {
+ for (dgEdge *ptrI = begin->m_next->m_next; ptrI != last;
+ ptrI = ptrI->m_next) {
dgEdge *const e = AddHalfEdge(begin->m_incidentVertex,
- ptr->m_incidentVertex);
- dgEdge *const t = AddHalfEdge(ptr->m_incidentVertex,
+ ptrI->m_incidentVertex);
+ dgEdge *const t = AddHalfEdge(ptrI->m_incidentVertex,
begin->m_incidentVertex);
if (e && t) {
_ASSERTE(e);
@@ -4287,16 +4287,16 @@ void dgMeshEffect::RepairTJoints(bool triangulate) {
e->m_twin = t;
t->m_twin = e;
- e->m_incidentFace = ptr->m_incidentFace;
- t->m_incidentFace = ptr->m_incidentFace;
+ e->m_incidentFace = ptrI->m_incidentFace;
+ t->m_incidentFace = ptrI->m_incidentFace;
e->m_userData = last->m_next->m_userData;
- t->m_userData = ptr->m_userData;
+ t->m_userData = ptrI->m_userData;
- t->m_prev = ptr->m_prev;
- ptr->m_prev->m_next = t;
- e->m_next = ptr;
- ptr->m_prev = e;
+ t->m_prev = ptrI->m_prev;
+ ptrI->m_prev->m_next = t;
+ e->m_next = ptrI;
+ ptrI->m_prev = e;
t->m_next = last->m_next;
e->m_prev = last;
last->m_next->m_prev = t;
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect2.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect2.cpp
index b2b3618e66b..d76557da620 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect2.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect2.cpp
@@ -2070,7 +2070,7 @@ dgMeshEffect *dgMeshEffect::CreateVoronoiPartition(dgInt32 pointsCount,
dgTree<dgList<dgInt32>, dgInt32>::Iterator iter(delanayNodes);
for (iter.Begin(); iter; iter++) {
- dgInt32 count = 0;
+ dgInt32 countI = 0;
dgBigVector pointArray[256];
dgTree<dgList<dgInt32>, dgInt32>::dgTreeNode *const nodeNode =
iter.GetNode();
@@ -2100,21 +2100,21 @@ dgMeshEffect *dgMeshEffect::CreateVoronoiPartition(dgInt32 pointsCount,
n = n.Scale(dgFloat64(1.0f) / sqrt(n % n));
dgBigVector normal(dgFloat64(n.m_x), dgFloat64(n.m_y),
dgFloat64(n.m_z), dgFloat64(0.0f));
- pointArray[count] = voronoiPoints[i] + normal.Scale(perimeterConvexBound);
+ pointArray[countI] = voronoiPoints[i] + normal.Scale(perimeterConvexBound);
- count++;
- _ASSERTE(count < dgInt32(sizeof(pointArray) / sizeof(pointArray[0])));
+ countI++;
+ _ASSERTE(countI < dgInt32(sizeof(pointArray) / sizeof(pointArray[0])));
}
}
}
- pointArray[count] = voronoiPoints[i];
- count++;
- _ASSERTE(count < dgInt32(sizeof(pointArray) / sizeof(pointArray[0])));
+ pointArray[countI] = voronoiPoints[i];
+ countI++;
+ _ASSERTE(countI < dgInt32(sizeof(pointArray) / sizeof(pointArray[0])));
}
dgMeshEffect *const convexMesh = MakeDelanayIntersection(tree,
- &pointArray[0], count, interiorMaterial, textureProjectionMatrix,
+ &pointArray[0], countI, interiorMaterial, textureProjectionMatrix,
dgFloat64(45.0f * 3.1416f / 180.0f));
if (convexMesh) {
for (dgInt32 i = 0; i < convexMesh->m_pointCount; i++) {
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect3.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect3.cpp
index 7271c63c4e0..06254e14fb1 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect3.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect3.cpp
@@ -463,8 +463,8 @@ dgMeshEffect::dgMeshEffect(const dgMeshEffect &source, dgFloat32 absoluteconcavi
dgEdge *ptr = face.m_edge;
do {
if (ptr->m_userData != dgUnsigned64(-1)) {
- dgList<dgPairProxi>::dgListNode *const pairNode = (dgList<dgPairProxi>::dgListNode *)ptr->m_userData;
- dgPairProxi &pairProxy = pairNode->GetInfo();
+ dgList<dgPairProxi>::dgListNode *const pairNodeT = (dgList<dgPairProxi>::dgListNode *)ptr->m_userData;
+ dgPairProxi &pairProxy = pairNodeT->GetInfo();
pairProxy.m_edgeA = NULL;
pairProxy.m_edgeB = NULL;
}
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.cpp
index e267f8d3c1f..a59b99ee79e 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.cpp
@@ -274,8 +274,8 @@ void dgMeshTreeCSGFace::Clip(const dgHugeVector &plane,
dgInt8 pointSide[256];
dgInt32 count = 0;
- dgInt32 rightCount = 0;
- dgInt32 leftCount = 0;
+ dgInt32 rightPCount = 0;
+ dgInt32 leftPCount = 0;
for (dgMeshTreeCSGFace::dgListNode *ptr = GetFirst(); ptr; ptr =
ptr->GetNext()) {
const dgHugeVector &p = ptr->GetInfo();
@@ -288,10 +288,10 @@ void dgMeshTreeCSGFace::Clip(const dgHugeVector &plane,
if (val > dgFloat64(0.0f)) {
pointSide[count] = 1;
- rightCount++;
+ rightPCount++;
} else if (val < dgFloat64(0.0f)) {
pointSide[count] = -1;
- leftCount++;
+ leftPCount++;
} else {
pointSide[count] = 0;
}
@@ -300,19 +300,19 @@ void dgMeshTreeCSGFace::Clip(const dgHugeVector &plane,
*leftOut = NULL;
*rightOut = NULL;
- if ((leftCount && !rightCount) || (!leftCount && rightCount)) {
- if (leftCount) {
- _ASSERTE(!rightCount);
+ if ((leftPCount && !rightPCount) || (!leftPCount && rightPCount)) {
+ if (leftPCount) {
+ _ASSERTE(!rightPCount);
AddRef();
*leftOut = this;
} else {
- _ASSERTE(!leftCount);
+ _ASSERTE(!leftPCount);
*rightOut = this;
AddRef();
}
- } else if (!(leftCount || rightCount)) {
- _ASSERTE(!leftCount);
- _ASSERTE(!rightCount);
+ } else if (!(leftPCount || rightPCount)) {
+ _ASSERTE(!leftPCount);
+ _ASSERTE(!rightPCount);
AddRef();
// AddRef();
} else {
Commit: 4c6c678769637ebbe31e375b090a3638d6d6e322
https://github.com/scummvm/scummvm/commit/4c6c678769637ebbe31e375b090a3638d6d6e322
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:09+01:00
Commit Message:
HPL1: replace std::(w)string usage in engine code
Changed paths:
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/graphics/font_data.cpp
engines/hpl1/engine/graphics/font_data.h
engines/hpl1/engine/gui/GuiSet.h
engines/hpl1/engine/gui/WidgetComboBox.cpp
engines/hpl1/engine/gui/WidgetLabel.cpp
engines/hpl1/engine/gui/WidgetSlider.cpp
engines/hpl1/engine/gui/WidgetTextBox.cpp
engines/hpl1/engine/impl/MeshLoaderCollada.cpp
engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
engines/hpl1/engine/impl/MeshLoaderMSH.cpp
engines/hpl1/engine/input/ActionKeyboard.cpp
engines/hpl1/engine/resources/LanguageFile.cpp
engines/hpl1/engine/scene/World2D.cpp
engines/hpl1/engine/system/Script.h
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/engine/system/String.cpp
engines/hpl1/engine/system/SystemTypes.h
engines/hpl1/engine/system/low_level_system.cpp
engines/hpl1/penumbra-overture/CharacterMove.cpp
engines/hpl1/penumbra-overture/Credits.cpp
engines/hpl1/penumbra-overture/DeathMenu.cpp
engines/hpl1/penumbra-overture/GameEnemy.cpp
engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
engines/hpl1/penumbra-overture/GameScripts.cpp
engines/hpl1/penumbra-overture/GraphicsHelper.cpp
engines/hpl1/penumbra-overture/Init.cpp
engines/hpl1/penumbra-overture/IntroStory.cpp
engines/hpl1/penumbra-overture/Inventory.cpp
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/MapLoadText.cpp
engines/hpl1/penumbra-overture/Notebook.cpp
engines/hpl1/penumbra-overture/NumericalPanel.cpp
engines/hpl1/penumbra-overture/Player.cpp
engines/hpl1/penumbra-overture/PreMenu.cpp
engines/hpl1/penumbra-overture/SaveHandler.cpp
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index d2d23da26ee..115645c68e5 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -116,22 +116,22 @@ static cGame *gpGame = NULL;
//-----------------------------------------------------------------------
-static void Print(std::string asText) {
+static void Print(tString asText) {
Log(asText.c_str());
}
SCRIPT_DEFINE_FUNC_1(void, Print, string)
-static std::string FloatToString(float afX) {
+static tString FloatToString(float afX) {
char sTemp[30];
sprintf(sTemp, "%f", afX);
- return (std::string)sTemp;
+ return (tString)sTemp;
}
SCRIPT_DEFINE_FUNC_1(string, FloatToString, float)
-static std::string IntToString(int alX) {
+static tString IntToString(int alX) {
char sTemp[30];
sprintf(sTemp, "%d", alX);
- return (std::string)sTemp;
+ return (tString)sTemp;
}
SCRIPT_DEFINE_FUNC_1(string, IntToString, int)
@@ -145,7 +145,7 @@ static int RandInt(int alMin, int alMax) {
}
SCRIPT_DEFINE_FUNC_2(int, RandInt, int, int)
-static bool StringContains(std::string asString, std::string asSubString) {
+static bool StringContains(tString asString, tString asSubString) {
return cString::GetLastStringPos(asString, asSubString) >= 0;
}
SCRIPT_DEFINE_FUNC_2(bool, StringContains, string, string)
@@ -195,7 +195,7 @@ SCRIPT_DEFINE_FUNC_4(void, SetSkyboxColor, float, float, float, float)
* Sets the skybox
* \param asTexture Name of the cube map texture to use
**/
-static void SetSkybox(std::string asTexture) {
+static void SetSkybox(tString asTexture) {
if (asTexture != "") {
iTexture *pTex = gpResources->GetTextureManager()->CreateCubeMap(asTexture, false);
gpGraphics->GetRenderer3D()->SetSkyBox(pTex, true);
@@ -212,7 +212,7 @@ SCRIPT_DEFINE_FUNC_1(void, SetSkybox, string)
* \param asName Name of particle system
* \param asType The type of particle system (file)
**/
-static void CreateParticleSystemOnCamera(std::string asName, std::string asType) {
+static void CreateParticleSystemOnCamera(tString asName, tString asType) {
cParticleSystem3D *pPS = gpScene->GetWorld3D()->CreateParticleSystem(asName, asType,
1, cMatrixf::Identity);
if (pPS) {
@@ -257,7 +257,7 @@ SCRIPT_DEFINE_FUNC_5(void, SetFogProperties, float, float, float, float, float)
//-----------------------------------------------------------------------
-static void SetSectorProperties(std::string asSector, float afAmbR, float afAmbG, float afAmbB) {
+static void SetSectorProperties(tString asSector, float afAmbR, float afAmbG, float afAmbB) {
cPortalContainer *pContainer = gpScene->GetWorld3D()->GetPortalContainer();
cSector *pSector = pContainer->GetSector(asSector);
@@ -272,7 +272,7 @@ SCRIPT_DEFINE_FUNC_4(void, SetSectorProperties, string, float, float, float)
//-----------------------------------------------------------------------
-static void SetSectorPortalActive(std::string asSector, int alPortal, bool abActive) {
+static void SetSectorPortalActive(tString asSector, int alPortal, bool abActive) {
cPortalContainer *pContainer = gpScene->GetWorld3D()->GetPortalContainer();
cSector *pSector = pContainer->GetSector(asSector);
@@ -301,7 +301,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetSectorPortalActive, string, int, bool)
* \param asCat The translation category
* \param asName The name of the category entry.
**/
-static std::string Translate(std::string asCat, std::string asName) {
+static tString Translate(tString asCat, tString asName) {
tWString wsText = gpResources->Translate(asCat, asName);
return cString::To8Char(wsText);
}
@@ -313,7 +313,7 @@ SCRIPT_DEFINE_FUNC_2(string, Translate, string, string)
* Preloads the data for a sound.
* \param asFile This can be a wav, ogg, mp3 or snt file.
**/
-static void PreloadSound(std::string asFile) {
+static void PreloadSound(tString asFile) {
tString sExt = cString::ToLowerCase(cString::GetFileExt(asFile));
if (sExt == "snt") {
cSoundEntityData *pData = gpResources->GetSoundEntityManager()->CreateSoundEntity(asFile);
@@ -351,7 +351,7 @@ SCRIPT_DEFINE_FUNC_1(void, PreloadSound, string)
//-----------------------------------------------------------------------
-static void SetMeshActive(std::string asName, bool abActive) {
+static void SetMeshActive(tString asName, bool abActive) {
cMeshEntity *pEnt = gpScene->GetWorld3D()->GetMeshEntity(asName);
if (pEnt == NULL) {
Warning("Didn't find mesh entity '%s'\n", asName.c_str());
@@ -376,7 +376,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetMeshActive, string, bool)
* \param asName The name of the particle system.
* \param abActive If it should be active or not.
**/
-static void SetParticleSystemActive(std::string asName, bool abActive) {
+static void SetParticleSystemActive(tString asName, bool abActive) {
cParticleSystem3D *pPS = gpScene->GetWorld3D()->GetParticleSystem(asName);
if (pPS == NULL) {
Warning("Didn't find particle system '%s'\n", asName.c_str());
@@ -397,7 +397,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetParticleSystemActive, string, bool)
* \param asArea The name of the area
* \param X Y and Z the variables of the particle system.
**/
-static void CreateParticleSystem(std::string asName, std::string asType, std::string asArea,
+static void CreateParticleSystem(tString asName, tString asType, tString asArea,
float afX, float afY, float afZ) {
cAreaEntity *pArea = gpScene->GetWorld3D()->GetAreaEntity(asArea);
if (pArea == NULL) {
@@ -420,7 +420,7 @@ SCRIPT_DEFINE_FUNC_6(void, CreateParticleSystem, string, string, string, float,
* Kill a particle system
* \param asName The name of the particle system.
**/
-static void KillParticleSystem(std::string asName) {
+static void KillParticleSystem(tString asName) {
/*cParticleSystem3D *pPS = gpScene->GetWorld3D()->GetParticleSystem(asName);
if(pPS==NULL){
Warning("Didn't find particle system '%s'\n",asName.c_str());
@@ -459,8 +459,8 @@ SCRIPT_DEFINE_FUNC_1(void, KillParticleSystem, string)
* \param asStartArea
* \param asEndArea
*/
-static void CreateBeam(std::string asName, std::string asFile,
- std::string asStartArea, std::string asEndArea) {
+static void CreateBeam(tString asName, tString asFile,
+ tString asStartArea, tString asEndArea) {
cAreaEntity *pStartArea = gpScene->GetWorld3D()->GetAreaEntity(asStartArea);
if (pStartArea == NULL) {
Warning("Couldn't find area '%s'\n", asStartArea.c_str());
@@ -492,7 +492,7 @@ SCRIPT_DEFINE_FUNC_4(void, CreateBeam, string, string, string, string)
* Destroys a beam
* \param asName
*/
-static void DestroyBeam(std::string asName) {
+static void DestroyBeam(tString asName) {
cBeam *pBeam = gpScene->GetWorld3D()->GetBeam(asName);
if (pBeam == NULL) {
Warning("Couldn't find beam '%s'\n", asName.c_str());
@@ -521,7 +521,7 @@ SCRIPT_DEFINE_FUNC_1(void, DestroyBeam, string)
* \param afRadius The radius to fade to.
* \param afTime The amount of seconds the fade should last.
**/
-static void FadeLight3D(std::string asName, float afR, float afG, float afB, float afA,
+static void FadeLight3D(tString asName, float afR, float afG, float afB, float afA,
float afRadius, float afTime) {
iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
if (pLight == NULL) {
@@ -543,7 +543,7 @@ SCRIPT_DEFINE_FUNC_7(void, FadeLight3D, string, float, float, float, float, floa
* \param asLightName The light name
* \param abX True if it should be attached, false if you want to remove.
**/
-static void AttachBillboardToLight3D(std::string asBillboardName, std::string asLightName, bool abX) {
+static void AttachBillboardToLight3D(tString asBillboardName, tString asLightName, bool abX) {
iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asLightName);
if (pLight == NULL) {
Warning("Couldn't find light '%s'\n", asLightName.c_str());
@@ -570,7 +570,7 @@ SCRIPT_DEFINE_FUNC_3(void, AttachBillboardToLight3D, string, string, bool)
* \param asName The light name
* \param abX if the light should be on or off.
**/
-static void SetLight3DVisible(std::string asName, bool abX) {
+static void SetLight3DVisible(tString asName, bool abX) {
iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
if (pLight == NULL) {
Warning("Couldn't find light '%s'\n", asName.c_str());
@@ -588,7 +588,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetLight3DVisible, string, bool)
* \param asName The light name
* \param abX if the light should only affects objects in same sector or not.
**/
-static void SetLight3DOnlyAffectInSector(std::string asName, bool abX) {
+static void SetLight3DOnlyAffectInSector(tString asName, bool abX) {
iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
if (pLight == NULL) {
Warning("Couldn't find light '%s'\n", asName.c_str());
@@ -606,7 +606,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetLight3DOnlyAffectInSector, string, bool)
* \param asName The light name
* \param abX if the light flicker should be on or off.
**/
-static void SetLight3DFlickerActive(std::string asName, bool abX) {
+static void SetLight3DFlickerActive(tString asName, bool abX) {
iLight3D *pLight = gpScene->GetWorld3D()->GetLight(asName);
if (pLight == NULL) {
Warning("Couldn't find light '%s'\n", asName.c_str());
@@ -636,15 +636,15 @@ SCRIPT_DEFINE_FUNC_2(void, SetLight3DFlickerActive, string, bool)
* \param afOnFadeLength Fade length from off to on.
* \param afOffFadeLength Fade length from on to off.
**/
-static void SetLight3DFlicker(std::string asName,
+static void SetLight3DFlicker(tString asName,
float afR, float afG, float afB, float afA,
float afRadius,
float afOnMinLength, float afOnMaxLength,
- std::string asOnSound, std::string asOnPS,
+ tString asOnSound, tString asOnPS,
float afOffMinLength, float afOffMaxLength,
- std::string asOffSound, std::string asOffPS,
+ tString asOffSound, tString asOffPS,
bool abFade,
float afOnFadeLength, float afOffFadeLength) {
@@ -677,8 +677,8 @@ SCRIPT_DEFINE_FUNC_17(void, SetLight3DFlicker, string,
* \param asFile The snt file to load.
* \param asArea The area to create at.
*/
-static void CreateSoundEntity(std::string asName, std::string asFile,
- std::string asArea) {
+static void CreateSoundEntity(tString asName, tString asFile,
+ tString asArea) {
cAreaEntity *pArea = gpScene->GetWorld3D()->GetAreaEntity(asArea);
if (pArea == NULL) {
Warning("Couldn't find area '%s'\n", asArea.c_str());
@@ -701,7 +701,7 @@ SCRIPT_DEFINE_FUNC_3(void, CreateSoundEntity, string, string, string)
* \param asName The entity name
* \param abPlayStart If the start sound should be played.
**/
-static void PlaySoundEntity(std::string asName, bool abPlayStart) {
+static void PlaySoundEntity(tString asName, bool abPlayStart) {
cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
if (pSound == NULL) {
Warning("Couldn't find sound entity '%s'\n", asName.c_str());
@@ -717,7 +717,7 @@ SCRIPT_DEFINE_FUNC_2(void, PlaySoundEntity, string, bool)
* \param asName The entity name
* \param abPlayEnd If the end sound should be played.
**/
-static void StopSoundEntity(std::string asName, bool abPlayEnd) {
+static void StopSoundEntity(tString asName, bool abPlayEnd) {
cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
if (pSound == NULL) {
Warning("Couldn't find sound entity '%s'\n", asName.c_str());
@@ -735,7 +735,7 @@ SCRIPT_DEFINE_FUNC_2(void, StopSoundEntity, string, bool)
* \param asName The entity name
* \param afSpeed Volume increase per second.
**/
-static void FadeInSoundEntity(std::string asName, float afSpeed) {
+static void FadeInSoundEntity(tString asName, float afSpeed) {
cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
if (pSound == NULL) {
Warning("Couldn't find sound entity '%s'\n", asName.c_str());
@@ -751,7 +751,7 @@ SCRIPT_DEFINE_FUNC_2(void, FadeInSoundEntity, string, float)
* \param asName The entity name
* \param afSpeed Volume decrease per second.
**/
-static void FadeOutSoundEntity(std::string asName, float afSpeed) {
+static void FadeOutSoundEntity(tString asName, float afSpeed) {
cSoundEntity *pSound = gpScene->GetWorld3D()->GetSoundEntity(asName);
if (pSound == NULL) {
Warning("Couldn't find sound entity '%s'\n", asName.c_str());
@@ -764,7 +764,7 @@ SCRIPT_DEFINE_FUNC_2(void, FadeOutSoundEntity, string, float)
//-----------------------------------------------------------------------
-static void PlayMusic(std::string asName, float afVol, float afStepSize, bool abLoop) {
+static void PlayMusic(tString asName, float afVol, float afStepSize, bool abLoop) {
gpSound->GetMusicHandler()->Play(asName, afVol, afStepSize, abLoop);
}
SCRIPT_DEFINE_FUNC_4(void, PlayMusic, string, float, float, bool)
@@ -783,7 +783,7 @@ SCRIPT_DEFINE_FUNC_1(void, StopMusic, float)
* \param asName The sound name
* \param afVol Volume of the sound
**/
-static void PlayGuiSound(std::string asName, float afVol) {
+static void PlayGuiSound(tString asName, float afVol) {
gpSound->GetSoundHandler()->PlayGui(asName, false, afVol);
}
SCRIPT_DEFINE_FUNC_2(void, PlayGuiSound, string, float)
@@ -801,8 +801,8 @@ SCRIPT_DEFINE_FUNC_2(void, PlayGuiSound, string, float)
* \param asType The type, can be: "OnMax" or "OnMin".
* \param asFunc The script function to be called. Must be in the current script file. "" = disabled.
**/
-static void SetJointCallback(std::string asJointName, std::string asType,
- std::string asFunc) {
+static void SetJointCallback(tString asJointName, tString asType,
+ tString asFunc) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
Warning("Couldn't find joint '%s'\n", asJointName.c_str());
@@ -840,7 +840,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetJointCallback, string, string, string)
* Breaks a joint.
* \param asJointName The joint name
**/
-static void BreakJoint(std::string asJointName) {
+static void BreakJoint(tString asJointName) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
Warning("Couldn't find joint '%s'\n", asJointName.c_str());
@@ -859,7 +859,7 @@ SCRIPT_DEFINE_FUNC_1(void, BreakJoint, string)
* \param asCtrlName The controller name
* \param abActive If the controller is to be active or not.
**/
-static void SetJointControllerActive(std::string asJointName, std::string asCtrlName, bool abActive) {
+static void SetJointControllerActive(tString asJointName, tString asCtrlName, bool abActive) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
Warning("Couldn't find joint '%s'\n", asJointName.c_str());
@@ -883,7 +883,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetJointControllerActive, string, string, bool)
* \param asJointName The joint name
* \param asCtrlName The controller name
**/
-static void ChangeJointController(std::string asJointName, std::string asCtrlName) {
+static void ChangeJointController(tString asJointName, tString asCtrlName) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
Warning("Couldn't find joint '%s'\n", asJointName.c_str());
@@ -906,8 +906,8 @@ SCRIPT_DEFINE_FUNC_2(void, ChangeJointController, string, string)
* \param asProperty Property to change, can be "DestValue"
* \param afValue Value to set it to.
**/
-static void SetJointControllerPropertyFloat(std::string asJointName, std::string asCtrlName,
- std::string asProperty, float afValue) {
+static void SetJointControllerPropertyFloat(tString asJointName, tString asCtrlName,
+ tString asProperty, float afValue) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
Warning("Couldn't find joint '%s'\n", asJointName.c_str());
@@ -941,7 +941,7 @@ SCRIPT_DEFINE_FUNC_4(void, SetJointControllerPropertyFloat, string, string, stri
* \param asJointName The joint name
* \param asProp The property to get
**/
-static float GetJointProperty(std::string asJointName, std::string asProp) {
+static float GetJointProperty(tString asJointName, tString asProp) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
Warning("Couldn't find joint '%s'\n", asJointName.c_str());
@@ -1022,7 +1022,7 @@ SCRIPT_DEFINE_FUNC_2(float, GetJointProperty, string, string)
* \param asBodyName The body name
* \param asProp The property to get
**/
-static float GetBodyProperty(std::string asBodyName, std::string asProp) {
+static float GetBodyProperty(tString asBodyName, tString asProp) {
iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
if (pBody == NULL) {
Warning("Couldn't find Body '%s'\n", asBodyName.c_str());
@@ -1055,7 +1055,7 @@ SCRIPT_DEFINE_FUNC_2(float, GetBodyProperty, string, string)
* \param asProp The property to get
* \param afVal The new value of the property
**/
-static void SetBodyProperty(std::string asBodyName, std::string asProp, float afVal) {
+static void SetBodyProperty(tString asBodyName, tString asProp, float afVal) {
iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
if (pBody == NULL) {
Warning("Couldn't find Body '%s'\n", asBodyName.c_str());
@@ -1088,7 +1088,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetBodyProperty, string, string, float)
//-----------------------------------------------------------------------
-static void AttachBodiesWithJoint(std::string asParentName, std::string asChildName, std::string asJointName) {
+static void AttachBodiesWithJoint(tString asParentName, tString asChildName, tString asJointName) {
iPhysicsBody *pParent = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asParentName);
if (pParent == NULL) {
Warning("Couldn't find Body '%s'\n", asParentName.c_str());
@@ -1124,7 +1124,7 @@ SCRIPT_DEFINE_FUNC_3(void, AttachBodiesWithJoint, string, string, string)
* \param asProp The property to get
* \param afVal The new value of the property
**/
-static void SetJointProperty(std::string asJointName, std::string asProp, float afVal) {
+static void SetJointProperty(tString asJointName, tString asProp, float afVal) {
iPhysicsJoint *pJoint = gpScene->GetWorld3D()->GetPhysicsWorld()->GetJoint(asJointName);
if (pJoint == NULL) {
Warning("Couldn't find joint '%s'\n", asJointName.c_str());
@@ -1200,7 +1200,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetJointProperty, string, string, float)
* \param afY force in the y direction. (in newton, kg*m/s^2)
* \param afZ force in the z direction. (in newton, kg*m/s^2)
**/
-static void AddBodyForce(std::string asBodyName, std::string asCoordType,
+static void AddBodyForce(tString asBodyName, tString asCoordType,
float afX, float afY, float afZ) {
iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
if (pBody == NULL) {
@@ -1241,7 +1241,7 @@ SCRIPT_DEFINE_FUNC_5(void, AddBodyForce, string, string, float, float, float)
* \param afY velocity in the y direction. (in m/s)
* \param afZ velocity in the z direction. (in m/s)
**/
-static void AddBodyImpulse(std::string asBodyName, std::string asCoordType,
+static void AddBodyImpulse(tString asBodyName, tString asCoordType,
float afX, float afY, float afZ) {
iPhysicsBody *pBody = gpScene->GetWorld3D()->GetPhysicsWorld()->GetBody(asBodyName);
if (pBody == NULL) {
@@ -1278,7 +1278,7 @@ SCRIPT_DEFINE_FUNC_5(void, AddBodyImpulse, string, string, float, float, float)
/////// LOCAL VARS //////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
-static void CreateLocalVar(std::string asName, int alVal) {
+static void CreateLocalVar(tString asName, int alVal) {
if (gpScene->GetLocalVar(asName) == NULL) {
cScriptVar *pVar = gpScene->CreateLocalVar(asName);
pVar->mlVal = alVal;
@@ -1286,19 +1286,19 @@ static void CreateLocalVar(std::string asName, int alVal) {
}
SCRIPT_DEFINE_FUNC_2(void, CreateLocalVar, string, int)
-static void SetLocalVar(std::string asName, int alVal) {
+static void SetLocalVar(tString asName, int alVal) {
cScriptVar *pVar = gpScene->CreateLocalVar(asName);
pVar->mlVal = alVal;
}
SCRIPT_DEFINE_FUNC_2(void, SetLocalVar, string, int)
-static void AddLocalVar(std::string asName, int alVal) {
+static void AddLocalVar(tString asName, int alVal) {
cScriptVar *pVar = gpScene->CreateLocalVar(asName);
pVar->mlVal += alVal;
}
SCRIPT_DEFINE_FUNC_2(void, AddLocalVar, string, int)
-static int GetLocalVar(std::string asName) {
+static int GetLocalVar(tString asName) {
cScriptVar *pVar = gpScene->GetLocalVar(asName);
if (pVar == NULL) {
Error("Couldn't find local var '%s'\n", asName.c_str());
@@ -1313,7 +1313,7 @@ SCRIPT_DEFINE_FUNC_1(int, GetLocalVar, string)
/////// GLOBAL VARS //////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
-static void CreateGlobalVar(std::string asName, int alVal) {
+static void CreateGlobalVar(tString asName, int alVal) {
if (gpScene->GetGlobalVar(asName) == NULL) {
cScriptVar *pVar = gpScene->CreateGlobalVar(asName);
pVar->mlVal = alVal;
@@ -1321,19 +1321,19 @@ static void CreateGlobalVar(std::string asName, int alVal) {
}
SCRIPT_DEFINE_FUNC_2(void, CreateGlobalVar, string, int)
-static void SetGlobalVar(std::string asName, int alVal) {
+static void SetGlobalVar(tString asName, int alVal) {
cScriptVar *pVar = gpScene->CreateGlobalVar(asName);
pVar->mlVal = alVal;
}
SCRIPT_DEFINE_FUNC_2(void, SetGlobalVar, string, int)
-static void AddGlobalVar(std::string asName, int alVal) {
+static void AddGlobalVar(tString asName, int alVal) {
cScriptVar *pVar = gpScene->CreateGlobalVar(asName);
pVar->mlVal += alVal;
}
SCRIPT_DEFINE_FUNC_2(void, AddGlobalVar, string, int)
-static int GetGlobalVar(std::string asName) {
+static int GetGlobalVar(tString asName) {
cScriptVar *pVar = gpScene->GetGlobalVar(asName);
if (pVar == NULL) {
Error("Couldn't find global var '%s'\n", asName.c_str());
diff --git a/engines/hpl1/engine/graphics/font_data.cpp b/engines/hpl1/engine/graphics/font_data.cpp
index cc10b632afc..dc43d5f7ec7 100644
--- a/engines/hpl1/engine/graphics/font_data.cpp
+++ b/engines/hpl1/engine/graphics/font_data.cpp
@@ -48,10 +48,10 @@
namespace hpl {
-using BitmapArray = Common::Array<Common::SharedPtr<Bitmap2D>>;
+using BitmapArray = Common::Array<Common::SharedPtr<Bitmap2D> >;
Glyph::Glyph(cGfxObject *apObject, cGuiGfxElement *apGuiGfx, const cVector2f &avOffset,
- const cVector2f &avSize, float afAdvance) {
+ const cVector2f &avSize, float afAdvance) {
_gfxObject = apObject;
_guiGfx = apGuiGfx;
_offset = avOffset;
@@ -82,7 +82,7 @@ static Common::ScopedPtr<TiXmlDocument> loadFontXML(const Common::String &filepa
Common::ScopedPtr<TiXmlDocument> doc(new TiXmlDocument(filepath.c_str()));
if (!doc->LoadFile(filepath.c_str())) {
debugCN(Hpl1::kDebugLevelError, Hpl1::kDebugResourceLoading,
- "Couldn't load font file at: %s", filepath.c_str());
+ "Couldn't load font file at: %s", filepath.c_str());
return nullptr;
}
return doc;
@@ -92,7 +92,7 @@ cVector2l loadXMLCommon(const TiXmlElement *commonElement, uint16 &firstChar, ui
int lineHeight = Hpl1::stoi(commonElement->Attribute("lineHeight"));
int base = Hpl1::stoi(commonElement->Attribute("base"));
firstChar = 0;
- lastchar = 3000; //engine max
+ lastchar = 3000; // engine max
height = static_cast<float>(lineHeight);
sizeRatio.x = static_cast<float>(base) / height;
sizeRatio.y = 1;
@@ -104,7 +104,7 @@ bool loadNextBitmap(BitmapArray &bitmaps, const Common::String &file, const Comm
Common::SharedPtr<Bitmap2D> bitmap(resources->loadBitmap2D(bitmapPath.c_str()));
if (bitmap == nullptr) {
debugCN(Hpl1::kDebugLevelError, Hpl1::kDebugResourceLoading,
- "Couldn't load bitmap %s", file.c_str());
+ "Couldn't load bitmap %s", file.c_str());
return false;
}
bitmaps.push_back(bitmap);
@@ -112,9 +112,9 @@ bool loadNextBitmap(BitmapArray &bitmaps, const Common::String &file, const Comm
}
bool loadBitmaps(BitmapArray &bitmaps, const TiXmlElement *pagesRoot, const Common::String &fontDir, LowLevelResources *resources) {
- bitmaps.reserve(3000); //engine max
+ bitmaps.reserve(3000); // engine max
const TiXmlElement *pageIt = pagesRoot->FirstChildElement("page");
- for(; pageIt != nullptr; pageIt = pageIt->NextSiblingElement("page")) {
+ for (; pageIt != nullptr; pageIt = pageIt->NextSiblingElement("page")) {
if (!loadNextBitmap(bitmaps, pageIt->Attribute("file"), fontDir, resources))
return false;
}
@@ -135,7 +135,7 @@ void FontData::loadNextGlyph(const TiXmlElement *charIt, BitmapArray &bitmaps, c
cVector2l size(w, h);
Bitmap2D &src = *bitmaps[page];
Common::ScopedPtr<Bitmap2D> charBmp(_lowLevelGraphics->CreateBitmap2D(size));
- src.drawToBitmap(*charBmp, {0,0}, Common::Rect(x, y, x + w, y + h));
+ src.drawToBitmap(*charBmp, {0, 0}, Common::Rect(x, y, x + w, y + h));
charBmp->copyRedToAlpha();
_glyphs[id] = createGlyph(charBmp.get(), {xOffset, yOffset}, {w, h}, fontSize, advance);
@@ -144,12 +144,12 @@ void FontData::loadNextGlyph(const TiXmlElement *charIt, BitmapArray &bitmaps, c
void FontData::loadGlyphs(const TiXmlElement *charsRoot, BitmapArray &bitmaps, const cVector2l &fontSize) {
const TiXmlElement *charIt = charsRoot->FirstChildElement("char");
_glyphs.resize(3000, nullptr);
- for(; charIt != nullptr; charIt = charIt->NextSiblingElement("char"))
+ for (; charIt != nullptr; charIt = charIt->NextSiblingElement("char"))
loadNextGlyph(charIt, bitmaps, fontSize);
}
bool FontData::createFromBitmapFile(const tString &file) {
- //FIXME: string types
+ // FIXME: string types
Common::String filename = file.c_str();
Common::ScopedPtr<TiXmlDocument> xmlDoc = loadFontXML(filename);
if (!xmlDoc)
@@ -164,32 +164,24 @@ bool FontData::createFromBitmapFile(const tString &file) {
}
bool FontData::createFromFontFile(const tString &asFileName, int alSize, unsigned short alFirstChar,
- unsigned short alLastChar) {
+ unsigned short alLastChar) {
error("call to unimplemented function FontData::CreateFromFontFile");
}
void FontData::draw(const cVector3f &avPos, const cVector2f &avSize, const cColor &aCol,
- eFontAlign aAlign, const wchar_t *fmt, ...) {
- wchar_t sText[256];
- va_list ap;
- if (fmt == NULL)
- return;
- va_start(ap, fmt);
- vswprintf(sText, 255, fmt, ap);
- va_end(ap);
-
+ eFontAlign aAlign, const tWString &text) {
int lCount = 0;
- //float lXAdd = 0;
+ // float lXAdd = 0;
cVector3f vPos = avPos;
if (aAlign == eFontAlign_Center) {
- vPos.x -= getLength(avSize, sText) / 2;
+ vPos.x -= getLength(avSize, text.c_str()) / 2;
} else if (aAlign == eFontAlign_Right) {
- vPos.x -= getLength(avSize, sText);
+ vPos.x -= getLength(avSize, text.c_str());
}
- while (sText[lCount] != 0) {
- wchar_t lGlyphNum = ((wchar_t)sText[lCount]);
+ while (lCount < static_cast<int>(text.size())) {
+ char32_t lGlyphNum = text[lCount];
if (lGlyphNum < _firstChar || lGlyphNum > _lastChar) {
lCount++;
continue;
@@ -210,7 +202,7 @@ void FontData::draw(const cVector3f &avPos, const cVector2f &avSize, const cColo
}
int FontData::drawWordWrap(cVector3f avPos, float afLength, float afFontHeight, cVector2f avSize, const cColor &aCol,
- eFontAlign aAlign, const tWString &asString) {
+ eFontAlign aAlign, const tWString &asString) {
int rows = 0;
unsigned int pos;
@@ -222,7 +214,7 @@ int FontData::drawWordWrap(cVector3f avPos, float afLength, float afFontHeight,
float fTextLength;
for (pos = 0; pos < asString.size(); pos++) {
- if (asString[pos] == _W(' ') || asString[pos] == _W('\n')) {
+ if (asString[pos] == ' ' || asString[pos] == '\n') {
tWString temp = asString.substr(first_letter, pos - first_letter);
fTextLength = getLength(avSize, temp.c_str());
@@ -234,7 +226,7 @@ int FontData::drawWordWrap(cVector3f avPos, float afLength, float afFontHeight,
last_space = pos;
nothing = false;
}
- if (asString[pos] == _W('\n')) {
+ if (asString[pos] == '\n') {
last_space = pos;
first_letter = last_space + 1;
RowLengthList.push_back(last_space - 1);
@@ -254,26 +246,26 @@ int FontData::drawWordWrap(cVector3f avPos, float afLength, float afFontHeight,
}
if (rows == 0) {
- draw(avPos, avSize, aCol, aAlign, _W("%ls"), asString.c_str());
+ draw(avPos, avSize, aCol, aAlign, asString);
} else {
first_letter = 0;
unsigned int i = 0;
for (tUIntListIt it = RowLengthList.begin(); it != RowLengthList.end(); ++it) {
draw(cVector3f(avPos.x, avPos.y + i * afFontHeight, avPos.z), avSize, aCol, aAlign,
- _W("%ls"), asString.substr(first_letter, *it - first_letter).c_str());
+ asString.substr(first_letter, *it - first_letter));
i++;
first_letter = *it + 1;
}
draw(cVector3f(avPos.x, avPos.y + i * afFontHeight, avPos.z), avSize, aCol, aAlign,
- _W("%ls"), asString.substr(first_letter).c_str());
+ asString.substr(first_letter));
}
return rows;
}
void FontData::getWordWrapRows(float afLength, float afFontHeight, cVector2f avSize,
- const tWString &asString, tWStringVec *apRowVec) {
+ const tWString &asString, tWStringVec *apRowVec) {
int rows = 0;
unsigned int pos;
@@ -286,7 +278,7 @@ void FontData::getWordWrapRows(float afLength, float afFontHeight, cVector2f avS
for (pos = 0; pos < asString.size(); pos++) {
// Log("char: %d\n",(char)asString[pos]);
- if (asString[pos] == _W(' ') || asString[pos] == _W('\n')) {
+ if (asString[pos] == ' ' || asString[pos] == '\n') {
tWString temp = asString.substr(first_letter, pos - first_letter);
fTextLength = getLength(avSize, temp.c_str());
@@ -300,7 +292,7 @@ void FontData::getWordWrapRows(float afLength, float afFontHeight, cVector2f avS
last_space = pos;
nothing = false;
}
- if (asString[pos] == _W('\n')) {
+ if (asString[pos] == '\n') {
last_space = pos;
first_letter = last_space + 1;
RowLengthList.push_back(last_space);
@@ -320,26 +312,26 @@ void FontData::getWordWrapRows(float afLength, float afFontHeight, cVector2f avS
}
if (rows == 0) {
- apRowVec->push_back(asString.c_str());
+ apRowVec->push_back(asString);
} else {
first_letter = 0;
unsigned int i = 0;
for (tUIntListIt it = RowLengthList.begin(); it != RowLengthList.end(); ++it) {
- apRowVec->push_back(asString.substr(first_letter, *it - first_letter).c_str());
+ apRowVec->push_back(asString.substr(first_letter, *it - first_letter));
i++;
first_letter = *it + 1;
}
- apRowVec->push_back(asString.substr(first_letter).c_str());
+ apRowVec->push_back(asString.substr(first_letter));
}
}
-float FontData::getLength(const cVector2f &avSize, const wchar_t *sText) {
+float FontData::getLength(const cVector2f &avSize, const char32_t *sText) {
int lCount = 0;
- //float lXAdd = 0;
+ // float lXAdd = 0;
float fLength = 0;
while (sText[lCount] != 0) {
- unsigned short lGlyphNum = ((wchar_t)sText[lCount]);
+ unsigned short lGlyphNum = (sText[lCount]);
if (lGlyphNum < _firstChar || lGlyphNum > _lastChar) {
lCount++;
continue;
@@ -348,8 +340,8 @@ float FontData::getLength(const cVector2f &avSize, const wchar_t *sText) {
Glyph *pGlyph = _glyphs[lGlyphNum];
if (pGlyph) {
- //cVector2f vOffset(pGlyph->_offset * avSize);
- //cVector2f vSize(pGlyph->_size * avSize);
+ // cVector2f vOffset(pGlyph->_offset * avSize);
+ // cVector2f vSize(pGlyph->_size * avSize);
fLength += pGlyph->_advance * avSize.x;
}
@@ -359,20 +351,8 @@ float FontData::getLength(const cVector2f &avSize, const wchar_t *sText) {
return fLength;
}
-float FontData::getLengthFmt(const cVector2f &avSize, const wchar_t *fmt, ...) {
- wchar_t sText[256];
- va_list ap;
- if (fmt == NULL)
- return 0;
- va_start(ap, fmt);
- vswprintf(sText, 255, fmt, ap);
- va_end(ap);
-
- return getLength(avSize, sText);
-}
-
Glyph *FontData::createGlyph(Bitmap2D *apBmp, const cVector2l &avOffset, const cVector2l &avSize,
- const cVector2l &avFontSize, int alAdvance) {
+ const cVector2l &avFontSize, int alAdvance) {
// Here the bitmap should be saved to diskk for faster loading.
//////////////////////////
diff --git a/engines/hpl1/engine/graphics/font_data.h b/engines/hpl1/engine/graphics/font_data.h
index 9250ad88716..75aacb83a35 100644
--- a/engines/hpl1/engine/graphics/font_data.h
+++ b/engines/hpl1/engine/graphics/font_data.h
@@ -111,7 +111,7 @@ public:
* \param ...
*/
void draw(const cVector3f &avPos, const cVector2f &avSize, const cColor &aCol, eFontAlign mAlign,
- const wchar_t *fmt, ...);
+ const tWString &text);
/**
* Draw a string with word wrap.
* \param avPos Screen pos
@@ -135,21 +135,13 @@ public:
*/
inline float getHeight() const { return _height; }
- /**
- * Get the length in screen size "pixels" of a formated string
- * \param avSize size of the characters
- * \param fmt
- * \param ...
- * \return
- */
- float getLengthFmt(const cVector2f &avSize, const wchar_t *fmt, ...);
/**
* Get the length in screen size "pixels" of a string
* \param avSize size of the characters
* \param sText
* \return
*/
- float getLength(const cVector2f &avSize, const wchar_t *sText);
+ float getLength(const cVector2f &avSize, const char32_t *sText);
private:
iLowLevelGraphics *_lowLevelGraphics;
diff --git a/engines/hpl1/engine/gui/GuiSet.h b/engines/hpl1/engine/gui/GuiSet.h
index 2e706497088..42a9a46fbe2 100644
--- a/engines/hpl1/engine/gui/GuiSet.h
+++ b/engines/hpl1/engine/gui/GuiSet.h
@@ -145,7 +145,7 @@ public:
// Widget Creation
cWidgetWindow *CreateWidgetWindow(const cVector3f &avLocalPos = 0,
const cVector2f &avSize = 0,
- const tWString &asText = _W(""),
+ const tWString &asText = {},
iWidget *apParent = NULL,
const tString &asName = "");
@@ -157,13 +157,13 @@ public:
cWidgetButton *CreateWidgetButton(const cVector3f &avLocalPos = 0,
const cVector2f &avSize = 0,
- const tWString &asText = _W(""),
+ const tWString &asText = {},
iWidget *apParent = NULL,
const tString &asName = "");
cWidgetLabel *CreateWidgetLabel(const cVector3f &avLocalPos = 0,
const cVector2f &avSize = 0,
- const tWString &asText = _W(""),
+ const tWString &asText = {},
iWidget *apParent = NULL,
const tString &asName = "");
@@ -176,13 +176,13 @@ public:
cWidgetTextBox *CreateWidgetTextBox(const cVector3f &avLocalPos = 0,
const cVector2f &avSize = 0,
- const tWString &asText = _W(""),
+ const tWString &asText = {},
iWidget *apParent = NULL,
const tString &asName = "");
cWidgetCheckBox *CreateWidgetCheckBox(const cVector3f &avLocalPos = 0,
const cVector2f &avSize = 0,
- const tWString &asText = _W(""),
+ const tWString &asText = {},
iWidget *apParent = NULL,
const tString &asName = "");
@@ -201,7 +201,7 @@ public:
cWidgetComboBox *CreateWidgetComboBox(const cVector3f &avLocalPos = 0,
const cVector2f &avSize = 0,
- const tWString &asText = _W(""),
+ const tWString &asText = {},
iWidget *apParent = NULL,
const tString &asName = "");
diff --git a/engines/hpl1/engine/gui/WidgetComboBox.cpp b/engines/hpl1/engine/gui/WidgetComboBox.cpp
index 99608c91c64..e67b51f6f50 100644
--- a/engines/hpl1/engine/gui/WidgetComboBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetComboBox.cpp
@@ -238,11 +238,11 @@ kGuiCalllbackDeclaredFuncEnd(cWidgetComboBox, SliderLostFocus)
//-----------------------------------------------------------------------
void cWidgetComboBox::OnInit() {
- mpText = mpSet->CreateWidgetTextBox(0, mvSize, _W(""), this);
+ mpText = mpSet->CreateWidgetTextBox(0, mvSize, Common::U32String(), this);
mpText->SetText(msText);
mpText->SetCanEdit(false);
- mpButton = mpSet->CreateWidgetButton(0, 0, _W(""), this);
+ mpButton = mpSet->CreateWidgetButton(0, 0, Common::U32String(), this);
mpButton->SetImage(mpSkin->GetGfx(eGuiSkinGfx_ComboBoxButtonIcon), false);
mpButton->AddCallback(eGuiMessage_MouseDown, this, kGuiCallback(ButtonPress));
diff --git a/engines/hpl1/engine/gui/WidgetLabel.cpp b/engines/hpl1/engine/gui/WidgetLabel.cpp
index 6a0f0ca940c..11d121d72e9 100644
--- a/engines/hpl1/engine/gui/WidgetLabel.cpp
+++ b/engines/hpl1/engine/gui/WidgetLabel.cpp
@@ -110,11 +110,11 @@ void cWidgetLabel::OnDraw(float afTimeStep, cGuiClipRegion *apClipRegion) {
for (size_t i = 0; i < vRows.size(); ++i) {
bool bBreak = false;
if (mlMaxCharacters >= 0) {
- if (lChars + (int)vRows[i].length() > mlMaxCharacters) {
+ if (lChars + (int)vRows[i].size() > mlMaxCharacters) {
vRows[i] = cString::SubW(vRows[i], 0, mlMaxCharacters - lChars);
bBreak = true;
}
- lChars += (int)vRows[i].length();
+ lChars += (int)vRows[i].size();
}
if (bEnabled)
@@ -127,7 +127,7 @@ void cWidgetLabel::OnDraw(float afTimeStep, cGuiClipRegion *apClipRegion) {
break;
}
} else {
- if (mlMaxCharacters >= 0 && (int)msText.length() > mlMaxCharacters) {
+ if (mlMaxCharacters >= 0 && (int)msText.size() > mlMaxCharacters) {
if (IsEnabled())
DrawDefaultText(cString::SubW(msText, 0, mlMaxCharacters), GetGlobalPosition() + vOffset, mTextAlign);
else
diff --git a/engines/hpl1/engine/gui/WidgetSlider.cpp b/engines/hpl1/engine/gui/WidgetSlider.cpp
index 22b96efe097..39fe1909cc1 100644
--- a/engines/hpl1/engine/gui/WidgetSlider.cpp
+++ b/engines/hpl1/engine/gui/WidgetSlider.cpp
@@ -214,8 +214,8 @@ kGuiCalllbackDeclaredFuncEnd(cWidgetSlider, ArrowButtonDown)
//-----------------------------------------------------------------------
void cWidgetSlider::OnInit() {
- mvButtons[0] = mpSet->CreateWidgetButton(0, 0, _W(""), this);
- mvButtons[1] = mpSet->CreateWidgetButton(0, 0, _W(""), this);
+ mvButtons[0] = mpSet->CreateWidgetButton(0, 0, Common::U32String(""), this);
+ mvButtons[1] = mpSet->CreateWidgetButton(0, 0, Common::U32String(""), this);
for (int i = 0; i < 2; i++) {
mvButtons[i]->SetImage(mvGfxArrow[i], false);
diff --git a/engines/hpl1/engine/gui/WidgetTextBox.cpp b/engines/hpl1/engine/gui/WidgetTextBox.cpp
index a2ad1078b4a..20de28e6281 100644
--- a/engines/hpl1/engine/gui/WidgetTextBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetTextBox.cpp
@@ -379,14 +379,14 @@ bool cWidgetTextBox::OnMouseDoubleClick(cGuiMessageData &aData) {
SetMarkerPos(WorldToCharPos(aData.mvPos));
- if (msText[mlMarkerCharPos] == _W(' '))
+ if (msText[mlMarkerCharPos] == ' ')
return true;
/////////////////////////////
// Get space to the right.
mlSelectedTextEnd = 0;
for (size_t i = mlMarkerCharPos; i > 0; --i) {
- if (msText[i] == _W(' ')) {
+ if (msText[i] == ' ') {
mlSelectedTextEnd = (int)i + 1;
break;
}
@@ -395,7 +395,7 @@ bool cWidgetTextBox::OnMouseDoubleClick(cGuiMessageData &aData) {
/////////////////////////////
// Get space to the left
for (size_t i = mlMarkerCharPos + 1; i < (size_t)msText.size(); ++i) {
- if (msText[i] == _W(' ') || i == (size_t)msText.size() - 1) {
+ if (msText[i] == ' '|| i == (size_t)msText.size() - 1) {
if (i == (size_t)msText.size() - 1)
SetMarkerPos((int)msText.size() - 1);
else
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
index ac7fa2e0951..73f090b1a6f 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
@@ -2119,9 +2119,9 @@ void cMeshLoaderCollada::AddSectorChildren(cColladaNode *apNode, tString asSecto
// Get number of digits
lDigits = 1;
- while ((int)apNode->msName.length() > lStartChar + 4 + lDigits &&
+ while ((int)apNode->msName.size() > lStartChar + 4 + lDigits &&
apNode->msName[lStartChar + 4 + lDigits] != '_' &&
- (int)apNode->msName.length() >= 7 + lDigits &&
+ (int)apNode->msName.size() >= 7 + lDigits &&
apNode->msName[7 + lDigits] != 0) {
lDigits++;
}
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
index 3651dadef2a..ce74df30524 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
@@ -49,7 +49,7 @@
namespace hpl {
#define GetAdress(sStr) \
- if (sStr.length() > 0 && sStr[0] == '#') \
+ if (sStr.size() > 0 && sStr[0] == '#') \
sStr = cString::Sub(sStr, 1);
//////////////////////////////////////////////////////////////////////////
// PRIVATE METHODS
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
index 0458c56e578..b4f593c2f7b 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
@@ -508,8 +508,7 @@ static void SaveControllerVec(TiXmlElement *apRootElem, tColladaControllerVec *a
TiXmlElement *pJointsElem = CreateXMLChild(pControllerElem, "Joints");
pJointsElem->SetAttribute("Size", (int)pController->mvJoints.size());
- tString sData = "";
- sData.reserve(pController->mvJoints.size() * 10);
+ tString sData;
for (size_t idx = 0; idx < pController->mvJoints.size(); ++idx) {
sData += pController->mvJoints[idx] + " ";
}
@@ -522,7 +521,6 @@ static void SaveControllerVec(TiXmlElement *apRootElem, tColladaControllerVec *a
pWeightsElem->SetAttribute("Size", (int)pController->mvWeights.size());
tString sData = "";
- sData.reserve(pController->mvWeights.size() * 5);
for (size_t idx = 0; idx < pController->mvWeights.size(); ++idx) {
sData += cString::ToString(pController->mvWeights[idx]) + " ";
}
@@ -535,7 +533,6 @@ static void SaveControllerVec(TiXmlElement *apRootElem, tColladaControllerVec *a
pMatricesElem->SetAttribute("Size", (int)pController->mvMatrices.size());
tString sData = "";
- sData.reserve(pController->mvMatrices.size() * 5);
for (size_t idx = 0; idx < pController->mvMatrices.size(); ++idx) {
sData += pController->mvMatrices[idx].ToFileString() + " ";
}
@@ -555,7 +552,6 @@ static void SaveControllerVec(TiXmlElement *apRootElem, tColladaControllerVec *a
int lCount = 0;
TiXmlElement *pPairsElem = CreateXMLChild(pPairVecElem, "Pairs");
tString sData = "";
- sData.reserve(pController->mvPairs.size() * 4 * 2);
for (size_t idx = 0; idx < pController->mvPairs.size(); ++idx) {
tColladaJointPairList *pList = &pController->mvPairs[idx];
@@ -573,7 +569,6 @@ static void SaveControllerVec(TiXmlElement *apRootElem, tColladaControllerVec *a
// The pair numbers
TiXmlElement *pPairNumElem = CreateXMLChild(pPairVecElem, "PairNum");
sData = "";
- sData.reserve(pController->mvPairs.size() * 4);
for (size_t idx = 0; idx < pController->mvPairs.size(); ++idx) {
sData += cString::ToString(vPairNumVec[idx]) + " ";
}
@@ -621,7 +616,6 @@ static void SaveGeometryVec(TiXmlElement *apRootElem, tColladaGeometryVec *apCol
TiXmlElement *pIndicesDataElem = CreateXMLChild(pIndexVecElem, "Indices");
tString sIndexVec = "";
- sIndexVec.reserve(pGeometry->mvIndexVec.size() * 5);
for (size_t j = 0; j < pGeometry->mvIndexVec.size(); ++j) {
sIndexVec += cString::ToString((int)pGeometry->mvIndexVec[j]) + " ";
}
@@ -636,7 +630,6 @@ static void SaveGeometryVec(TiXmlElement *apRootElem, tColladaGeometryVec *apCol
/////////////////////////////////
// Positions
tString sData = "";
- sData.reserve(pGeometry->mvVertexVec.size() * 10 * 3);
for (size_t j = 0; j < pGeometry->mvVertexVec.size(); ++j) {
sData += pGeometry->mvVertexVec[j].pos.ToFileString() + " ";
}
@@ -647,7 +640,6 @@ static void SaveGeometryVec(TiXmlElement *apRootElem, tColladaGeometryVec *apCol
/////////////////////////////////
// Normals
sData = "";
- sData.reserve(pGeometry->mvVertexVec.size() * 10 * 3);
for (size_t j = 0; j < pGeometry->mvVertexVec.size(); ++j) {
sData += pGeometry->mvVertexVec[j].norm.ToFileString() + " ";
}
@@ -658,7 +650,6 @@ static void SaveGeometryVec(TiXmlElement *apRootElem, tColladaGeometryVec *apCol
/////////////////////////////////
// UVs
sData = "";
- sData.reserve(pGeometry->mvVertexVec.size() * 10 * 3);
for (size_t j = 0; j < pGeometry->mvVertexVec.size(); ++j) {
sData += pGeometry->mvVertexVec[j].tex.ToFileString() + " ";
}
@@ -670,7 +661,6 @@ static void SaveGeometryVec(TiXmlElement *apRootElem, tColladaGeometryVec *apCol
// Tangents
sData = "";
char sTemp[20];
- sData.reserve(pGeometry->mvVertexVec.size() * 10 * 4);
for (size_t j = 0; j < pGeometry->mvTangents.size(); ++j) {
sprintf(sTemp, "%g ", pGeometry->mvTangents[j]);
sData += sTemp;
@@ -692,7 +682,6 @@ static void SaveGeometryVec(TiXmlElement *apRootElem, tColladaGeometryVec *apCol
////////////////////////////
// Extra vertices
tString sData = "";
- sData.reserve(pGeometry->mvExtraVtxVec.size() * 4 * 4 * 4);
int lExtraCount = 0;
TiXmlElement *pExtraElem = CreateXMLChild(pExtraVertexVecElem, "ExtraVertex");
for (size_t idx = 0; idx < pGeometry->mvExtraVtxVec.size(); ++idx) {
@@ -715,7 +704,6 @@ static void SaveGeometryVec(TiXmlElement *apRootElem, tColladaGeometryVec *apCol
////////////////////////////
// Extra num
sData = "";
- sData.reserve(pGeometry->mvExtraVtxVec.size() * 4 * 4);
TiXmlElement *pExtraNumElem = CreateXMLChild(pExtraVertexVecElem, "ExtraNum");
for (size_t idx = 0; idx < pGeometry->mvExtraVtxVec.size(); ++idx) {
sData += cString::ToString((int)vExtraNum[idx]) + " ";
diff --git a/engines/hpl1/engine/impl/MeshLoaderMSH.cpp b/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
index 19fdd9025b4..bf9751d1902 100644
--- a/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
@@ -289,7 +289,6 @@ void cMeshLoaderMSH::SaveFloatData(TiXmlElement *apRoot, int alSize, const char
TiXmlElement *pElem = static_cast<TiXmlElement *>(apRoot->InsertEndChild(XmlData));
tString sData = "";
- sData.reserve((alSize * 17) + 1);
char sTemp[20];
for (int i = 0; i < alSize; i++) {
@@ -358,7 +357,6 @@ const char *cMeshLoaderMSH::GetVertexName(tVertexFlag aFlag) {
void cMeshLoaderMSH::SaveIntData(TiXmlElement *apElem, int alSize, unsigned int *apData) {
tString sData = "";
- sData.reserve((alSize * 6) + 1);
char sTemp[10];
for (int i = 0; i < alSize; i++) {
diff --git a/engines/hpl1/engine/input/ActionKeyboard.cpp b/engines/hpl1/engine/input/ActionKeyboard.cpp
index f2927539e10..09f9e67c8cf 100644
--- a/engines/hpl1/engine/input/ActionKeyboard.cpp
+++ b/engines/hpl1/engine/input/ActionKeyboard.cpp
@@ -70,424 +70,424 @@ float cActionKeyboard::GetValue() {
tString cActionKeyboard::GetInputName() {
tString tsKey = "";
if (mMod & eKeyModifier_SHIFT) {
- tsKey.append("Shift ");
+ tsKey += "Shift ";
}
if (mMod & eKeyModifier_ALT) {
- tsKey.append("Alt ");
+ tsKey += "Alt ";
}
if (mMod & eKeyModifier_CTRL) {
- tsKey.append("Control ");
+ tsKey += "Control ";
}
if (mMod & eKeyModifier_META) {
#ifdef __APPLE__
- tsKey.append("Command ");
+ tsKey += "Command ";
#else
- tsKey.append("Windows ");
+ tsKey += "Windows ";
#endif
}
switch (mKey) {
case eKey_BACKSPACE:
- tsKey.append("BackSpace");
+ tsKey += "BackSpace";
break;
case eKey_TAB:
- tsKey.append("Tab");
+ tsKey += "Tab";
break;
case eKey_CLEAR:
- tsKey.append("Clear");
+ tsKey += "Clear";
break;
case eKey_RETURN:
- tsKey.append("Return");
+ tsKey += "Return";
break;
case eKey_PAUSE:
- tsKey.append("Pause");
+ tsKey += "Pause";
break;
case eKey_ESCAPE:
- tsKey.append("Escape");
+ tsKey += "Escape";
break;
case eKey_SPACE:
- tsKey.append("Space");
+ tsKey += "Space";
break;
case eKey_EXCLAIM:
- tsKey.append("Exclaim");
+ tsKey += "Exclaim";
break;
case eKey_QUOTEDBL:
- tsKey.append("DblQoute");
+ tsKey += "DblQoute";
break;
case eKey_HASH:
- tsKey.append("Hash");
+ tsKey += "Hash";
break;
case eKey_DOLLAR:
- tsKey.append("Dollar");
+ tsKey += "Dollar";
break;
case eKey_AMPERSAND:
- tsKey.append("Ampersand");
+ tsKey += "Ampersand";
break;
case eKey_QUOTE:
- tsKey.append("Quote");
+ tsKey += "Quote";
break;
case eKey_LEFTPAREN:
- tsKey.append("LeftParent");
+ tsKey += "LeftParent";
break;
case eKey_RIGHTPAREN:
- tsKey.append("RightParent");
+ tsKey += "RightParent";
break;
case eKey_ASTERISK:
- tsKey.append("Asterisk");
+ tsKey += "Asterisk";
break;
case eKey_PLUS:
- tsKey.append("Plus");
+ tsKey += "Plus";
break;
case eKey_COMMA:
- tsKey.append("Comma");
+ tsKey += "Comma";
break;
case eKey_MINUS:
- tsKey.append("Minus");
+ tsKey += "Minus";
break;
case eKey_PERIOD:
- tsKey.append("Period");
+ tsKey += "Period";
break;
case eKey_SLASH:
- tsKey.append("Slash");
+ tsKey += "Slash";
break;
case eKey_0:
- tsKey.append("0");
+ tsKey += "0";
break;
case eKey_1:
- tsKey.append("1");
+ tsKey += "1";
break;
case eKey_2:
- tsKey.append("2");
+ tsKey += "2";
break;
case eKey_3:
- tsKey.append("3");
+ tsKey += "3";
break;
case eKey_4:
- tsKey.append("4");
+ tsKey += "4";
break;
case eKey_5:
- tsKey.append("5");
+ tsKey += "5";
break;
case eKey_6:
- tsKey.append("6");
+ tsKey += "6";
break;
case eKey_7:
- tsKey.append("7");
+ tsKey += "7";
break;
case eKey_8:
- tsKey.append("8");
+ tsKey += "8";
break;
case eKey_9:
- tsKey.append("9");
+ tsKey += "9";
break;
case eKey_COLON:
- tsKey.append("Colon");
+ tsKey += "Colon";
break;
case eKey_SEMICOLON:
- tsKey.append("SemiColon");
+ tsKey += "SemiColon";
break;
case eKey_LESS:
- tsKey.append("Less");
+ tsKey += "Less";
break;
case eKey_EQUALS:
- tsKey.append("Equals");
+ tsKey += "Equals";
break;
case eKey_GREATER:
- tsKey.append("Greater");
+ tsKey += "Greater";
break;
case eKey_QUESTION:
- tsKey.append("Question");
+ tsKey += "Question";
break;
case eKey_AT:
- tsKey.append("At");
+ tsKey += "At";
break;
case eKey_LEFTBRACKET:
- tsKey.append("LeftBracket");
+ tsKey += "LeftBracket";
break;
case eKey_BACKSLASH:
- tsKey.append("BackSlash");
+ tsKey += "BackSlash";
break;
case eKey_RIGHTBRACKET:
- tsKey.append("RightBracket");
+ tsKey += "RightBracket";
break;
case eKey_CARET:
- tsKey.append("Caret");
+ tsKey += "Caret";
break;
case eKey_UNDERSCORE:
- tsKey.append("Underscore");
+ tsKey += "Underscore";
break;
case eKey_BACKQUOTE:
- tsKey.append("BackQuote");
+ tsKey += "BackQuote";
break;
case eKey_a:
- tsKey.append("A");
+ tsKey += "A";
break;
case eKey_b:
- tsKey.append("B");
+ tsKey += "B";
break;
case eKey_c:
- tsKey.append("C");
+ tsKey += "C";
break;
case eKey_d:
- tsKey.append("D");
+ tsKey += "D";
break;
case eKey_e:
- tsKey.append("E");
+ tsKey += "E";
break;
case eKey_f:
- tsKey.append("F");
+ tsKey += "F";
break;
case eKey_g:
- tsKey.append("G");
+ tsKey += "G";
break;
case eKey_h:
- tsKey.append("H");
+ tsKey += "H";
break;
case eKey_i:
- tsKey.append("I");
+ tsKey += "I";
break;
case eKey_j:
- tsKey.append("J");
+ tsKey += "J";
break;
case eKey_k:
- tsKey.append("K");
+ tsKey += "K";
break;
case eKey_l:
- tsKey.append("L");
+ tsKey += "L";
break;
case eKey_m:
- tsKey.append("M");
+ tsKey += "M";
break;
case eKey_n:
- tsKey.append("N");
+ tsKey += "N";
break;
case eKey_o:
- tsKey.append("O");
+ tsKey += "O";
break;
case eKey_p:
- tsKey.append("P");
+ tsKey += "P";
break;
case eKey_q:
- tsKey.append("Q");
+ tsKey += "Q";
break;
case eKey_r:
- tsKey.append("R");
+ tsKey += "R";
break;
case eKey_s:
- tsKey.append("S");
+ tsKey += "S";
break;
case eKey_t:
- tsKey.append("T");
+ tsKey += "T";
break;
case eKey_u:
- tsKey.append("U");
+ tsKey += "U";
break;
case eKey_v:
- tsKey.append("V");
+ tsKey += "V";
break;
case eKey_w:
- tsKey.append("W");
+ tsKey += "W";
break;
case eKey_x:
- tsKey.append("X");
+ tsKey += "X";
break;
case eKey_y:
- tsKey.append("Y");
+ tsKey += "Y";
break;
case eKey_z:
- tsKey.append("Z");
+ tsKey += "Z";
break;
case eKey_DELETE:
- tsKey.append("Delete");
+ tsKey += "Delete";
break;
case eKey_KP0:
- tsKey.append("Kp0");
+ tsKey += "Kp0";
break;
case eKey_KP1:
- tsKey.append("Kp1");
+ tsKey += "Kp1";
break;
case eKey_KP2:
- tsKey.append("Kp2");
+ tsKey += "Kp2";
break;
case eKey_KP3:
- tsKey.append("Kp3");
+ tsKey += "Kp3";
break;
case eKey_KP4:
- tsKey.append("Kp4");
+ tsKey += "Kp4";
break;
case eKey_KP5:
- tsKey.append("Kp5");
+ tsKey += "Kp5";
break;
case eKey_KP6:
- tsKey.append("Kp6");
+ tsKey += "Kp6";
break;
case eKey_KP7:
- tsKey.append("Kp7");
+ tsKey += "Kp7";
break;
case eKey_KP8:
- tsKey.append("Kp8");
+ tsKey += "Kp8";
break;
case eKey_KP9:
- tsKey.append("Kp9");
+ tsKey += "Kp9";
break;
case eKey_KP_PERIOD:
- tsKey.append("Period");
+ tsKey += "Period";
break;
case eKey_KP_DIVIDE:
- tsKey.append("Divide");
+ tsKey += "Divide";
break;
case eKey_KP_MULTIPLY:
- tsKey.append("Multiply");
+ tsKey += "Multiply";
break;
case eKey_KP_MINUS:
- tsKey.append("Minus");
+ tsKey += "Minus";
break;
case eKey_KP_PLUS:
- tsKey.append("Plus");
+ tsKey += "Plus";
break;
case eKey_KP_ENTER:
- tsKey.append("Enter");
+ tsKey += "Enter";
break;
case eKey_KP_EQUALS:
- tsKey.append("Equals");
+ tsKey += "Equals";
break;
case eKey_UP:
- tsKey.append("Up");
+ tsKey += "Up";
break;
case eKey_DOWN:
- tsKey.append("Down");
+ tsKey += "Down";
break;
case eKey_RIGHT:
- tsKey.append("Right");
+ tsKey += "Right";
break;
case eKey_LEFT:
- tsKey.append("Left");
+ tsKey += "Left";
break;
case eKey_INSERT:
- tsKey.append("Insert");
+ tsKey += "Insert";
break;
case eKey_HOME:
- tsKey.append("Home");
+ tsKey += "Home";
break;
case eKey_END:
- tsKey.append("End");
+ tsKey += "End";
break;
case eKey_PAGEUP:
- tsKey.append("PageUp");
+ tsKey += "PageUp";
break;
case eKey_PAGEDOWN:
- tsKey.append("PageDown");
+ tsKey += "PageDown";
break;
case eKey_F1:
- tsKey.append("F1");
+ tsKey += "F1";
break;
case eKey_F2:
- tsKey.append("F2");
+ tsKey += "F2";
break;
case eKey_F3:
- tsKey.append("F3");
+ tsKey += "F3";
break;
case eKey_F4:
- tsKey.append("F4");
+ tsKey += "F4";
break;
case eKey_F5:
- tsKey.append("F5");
+ tsKey += "F5";
break;
case eKey_F6:
- tsKey.append("F6");
+ tsKey += "F6";
break;
case eKey_F7:
- tsKey.append("F7");
+ tsKey += "F7";
break;
case eKey_F8:
- tsKey.append("F8");
+ tsKey += "F8";
break;
case eKey_F9:
- tsKey.append("F9");
+ tsKey += "F9";
break;
case eKey_F10:
- tsKey.append("F10");
+ tsKey += "F10";
break;
case eKey_F11:
- tsKey.append("F11");
+ tsKey += "F11";
break;
case eKey_F12:
- tsKey.append("F12");
+ tsKey += "F12";
break;
case eKey_F13:
- tsKey.append("F13");
+ tsKey += "F13";
break;
case eKey_F14:
- tsKey.append("F14");
+ tsKey += "F14";
break;
case eKey_F15:
- tsKey.append("F15");
+ tsKey += "F15";
break;
case eKey_NUMLOCK:
- tsKey.append("NumLock");
+ tsKey += "NumLock";
break;
case eKey_CAPSLOCK:
- tsKey.append("CapsLock");
+ tsKey += "CapsLock";
break;
case eKey_SCROLLOCK:
- tsKey.append("ScrollLock");
+ tsKey += "ScrollLock";
break;
case eKey_RSHIFT:
- tsKey.append("RightShift");
+ tsKey += "RightShift";
break;
case eKey_LSHIFT:
- tsKey.append("LeftShift");
+ tsKey += "LeftShift";
break;
case eKey_RCTRL:
- tsKey.append("RightControl");
+ tsKey += "RightControl";
break;
case eKey_LCTRL:
- tsKey.append("LeftControl");
+ tsKey += "LeftControl";
break;
case eKey_RALT:
- tsKey.append("RightAlt");
+ tsKey += "RightAlt";
break;
case eKey_LALT:
- tsKey.append("LeftAlt");
+ tsKey += "LeftAlt";
break;
case eKey_RMETA:
- tsKey.append("RightMeta");
+ tsKey += "RightMeta";
break;
case eKey_LMETA:
- tsKey.append("LeftMeta");
+ tsKey += "LeftMeta";
break;
case eKey_LSUPER:
- tsKey.append("LeftSuper");
+ tsKey += "LeftSuper";
break;
case eKey_RSUPER:
- tsKey.append("RightSuper");
+ tsKey += "RightSuper";
break;
case eKey_MODE:
- tsKey.append("Mode");
+ tsKey += "Mode";
break;
case eKey_HELP:
- tsKey.append("Help");
+ tsKey += "Help";
break;
case eKey_PRINT:
- tsKey.append("Print");
+ tsKey += "Print";
break;
case eKey_SYSREQ:
- tsKey.append("SysReq");
+ tsKey += "SysReq";
break;
case eKey_BREAK:
- tsKey.append("Break");
+ tsKey += "Break";
break;
case eKey_MENU:
- tsKey.append("Menu");
+ tsKey += "Menu";
break;
case eKey_POWER:
- tsKey.append("Power");
+ tsKey += "Power";
break;
case eKey_EURO:
- tsKey.append("Euro");
+ tsKey += "Euro";
break;
case eKey_NONE:
- tsKey.append("None");
+ tsKey += "None";
break;
default:
break;
diff --git a/engines/hpl1/engine/resources/LanguageFile.cpp b/engines/hpl1/engine/resources/LanguageFile.cpp
index 8f124548945..43e4d497353 100644
--- a/engines/hpl1/engine/resources/LanguageFile.cpp
+++ b/engines/hpl1/engine/resources/LanguageFile.cpp
@@ -112,14 +112,14 @@ bool cLanguageFile::LoadFromFile(const tString asFile) {
// if(sCatName == "TEST") Log("String: '%s' %d\n",sString.c_str(),sString.size());
- for (size_t i = 0; i < sString.length(); ++i) {
+ for (size_t i = 0; i < sString.size(); ++i) {
unsigned char c = sString[i];
if (c == '[') {
bool bFoundCommand = true;
tString sCommand = "";
int lCount = 1;
- while (sString[i + lCount] != ']' && i + lCount < sString.length() && lCount < 16) {
+ while (sString[i + lCount] != ']' && i + lCount < sString.size() && lCount < 16) {
sCommand += sString[i + lCount];
lCount++;
}
diff --git a/engines/hpl1/engine/scene/World2D.cpp b/engines/hpl1/engine/scene/World2D.cpp
index 9450c54bfef..880107d917a 100644
--- a/engines/hpl1/engine/scene/World2D.cpp
+++ b/engines/hpl1/engine/scene/World2D.cpp
@@ -572,7 +572,7 @@ bool cWorld2D::CreateFromFile(tString asFile) {
int lColCount = 0;
tString sData = pTileRowElem->Attribute("Data");
int lDataCount = 0;
- while (lDataCount < (int)sData.length()) {
+ while (lDataCount < (int)sData.size()) {
cTile *pTile = hplNew(cTile, (NULL, eTileRotation_0,
cVector3f((float)lColCount * fTileSize, (float)lRowCount * fTileSize, fZ),
cVector2f(fTileSize, fTileSize), NULL));
diff --git a/engines/hpl1/engine/system/Script.h b/engines/hpl1/engine/system/Script.h
index 02d23357925..76f664c0605 100644
--- a/engines/hpl1/engine/system/Script.h
+++ b/engines/hpl1/engine/system/Script.h
@@ -185,8 +185,8 @@
#define SCRIPT_FUNC_BEGIN(funcname, return, args) \
namespace GenericScript { \
- static std::string funcname##_return = #return; \
- static std::string funcname##_arg = args; \
+ static tString funcname##_return = #return; \
+ static tString funcname##_arg = args; \
void funcname##_Generic(asIScriptGeneric * gen) { \
SCRIPT_RETURN_##return;
@@ -196,12 +196,13 @@
}
// Parameter Macros
-#define SCRIPT_ARG_string(n) std::string _arg##n = *(std::string *)gen->GetArgObject(n)
+// FIXME: string types
+#define SCRIPT_ARG_string(n) tString _arg##n = (*(std::string *)gen->GetArgObject(n)).c_str()
#define SCRIPT_ARG_float(n) float _arg##n = gen->GetArgFloat(n)
#define SCRIPT_ARG_int(n) int _arg##n = gen->GetArgDWord(n)
#define SCRIPT_ARG_bool(n) bool _arg##n = gen->GetArgByte(n)
// Return Value Macros
-#define SCRIPT_RETURN_string std::string _ret
+#define SCRIPT_RETURN_string tString _ret
#define SCRIPT_RETURN_CALL_string _ret =
#define SCRIPT_SET_RETURN_string gen->SetReturnObject(&_ret)
#define SCRIPT_RETURN_bool bool _ret
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index cb5b691729f..4a2d0e61fb5 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -495,7 +495,7 @@ const char *cSerializeClass::ValueToString(void *apData, size_t alOffset, eSeria
case eSerializeType_WString: {
msTempString = "";
tWString &wsString = PointerValue(pVal, tWString);
- for (size_t i = 0; i < wsString.length(); ++i) {
+ for (size_t i = 0; i < wsString.size(); ++i) {
msTempString += cString::ToString((int)wsString[i]) + " ";
}
return msTempString.c_str();
diff --git a/engines/hpl1/engine/system/String.cpp b/engines/hpl1/engine/system/String.cpp
index 292b80d5a12..b9539d9d4ef 100644
--- a/engines/hpl1/engine/system/String.cpp
+++ b/engines/hpl1/engine/system/String.cpp
@@ -39,23 +39,13 @@ namespace hpl {
//-----------------------------------------------------------------------
tWString cString::To16Char(const tString &asString) {
- tWString wsTemp;
- size_t needed = mbstowcs(NULL, &asString[0], 0);
- wsTemp.resize(needed);
- mbstowcs(&wsTemp[0], &asString[0], needed);
-
- return wsTemp;
+ return asString;
}
//-----------------------------------------------------------------------
tString cString::To8Char(const tWString &awsString) {
- tString sTemp;
- size_t needed = wcstombs(NULL, &awsString[0], 0);
- sTemp.resize(needed);
- wcstombs(&sTemp[0], &awsString[0], needed);
-
- return sTemp;
+ return awsString;
}
//-----------------------------------------------------------------------
@@ -65,13 +55,10 @@ tWString cString::Get16BitFromArray(const tString &asArray) {
tIntVec vVals;
GetIntVec(asArray, vVals, NULL);
- tWString wsString = _W("");
- wsString.resize(vVals.size());
-
- for (size_t i = 0; i < vVals.size(); ++i) {
- wsString[i] = (wchar_t)vVals[i];
+ tWString wsString;
+ for (auto v : vVals) {
+ wsString += static_cast<Common::U32String::value_type>(v);
}
-
return wsString;
}
@@ -92,9 +79,9 @@ tString cString::Sub(const tString &asString, int alStart, int alCount) {
tWString cString::SubW(const tWString &asString, int alStart, int alCount) {
int lStringSize = (int)asString.size();
if (lStringSize == 0)
- return _W("");
+ return Common::U32String("");
if (alStart >= lStringSize)
- return _W("");
+ return Common::U32String("");
if (alStart + alCount > lStringSize)
alCount = lStringSize - alStart;
@@ -117,10 +104,10 @@ tString cString::GetFileExt(tString aString) {
}
tWString cString::GetFileExtW(tWString aString) {
- int pos = GetLastStringPosW(aString, _W("."));
+ int pos = GetLastStringPosW(aString, Common::U32String("."));
if (pos < 0)
- return _W("");
+ return Common::U32String("");
else
return aString.substr(pos + 1);
}
@@ -128,16 +115,12 @@ tWString cString::GetFileExtW(tWString aString) {
//-----------------------------------------------------------------------
tString cString::ToLowerCase(tString aString) {
- for (int i = 0; i < (int)aString.size(); i++) {
- aString[i] = tolower(aString[i]);
- }
+ aString.toLowercase();
return aString;
}
tWString cString::ToLowerCaseW(tWString aString) {
- for (int i = 0; i < (int)aString.size(); i++) {
- aString[i] = tolower(aString[i]);
- }
+ aString.toLowercase();
return aString;
}
@@ -158,13 +141,13 @@ tString cString::SetFileExt(tString aString, tString aExt) {
}
tWString cString::SetFileExtW(tWString aString, tWString aExt) {
- if (aExt.substr(0, 1) == _W("."))
+ if (aExt.substr(0, 1) == Common::U32String("."))
aExt = aExt.substr(1);
- if (GetFileExtW(aString) != _W("")) {
- aString = aString.substr(0, GetLastStringPosW(aString, _W(".")));
+ if (GetFileExtW(aString) != Common::U32String("")) {
+ aString = aString.substr(0, GetLastStringPosW(aString, Common::U32String(".")));
}
- if (aExt != _W(""))
+ if (aExt != Common::U32String(""))
aString = aString + _W(".") + aExt;
return aString;
@@ -250,16 +233,15 @@ tString cString::ReplaceCharTo(tString aString, tString asOldChar, tString asNew
if (asNewChar != "") {
for (int i = 0; i < (int)aString.size(); i++) {
if (aString[i] == asOldChar[0])
- aString[i] = asNewChar[0];
+ aString.setChar(asNewChar[0],i);
}
return aString;
} else {
tString sNewString;
- sNewString.reserve(aString.size());
for (int i = 0; i < (int)aString.size(); i++) {
if (aString[i] != asOldChar[0])
- sNewString.push_back(aString[i]);
+ sNewString += aString[i];
}
return sNewString;
}
@@ -269,16 +251,15 @@ tWString cString::ReplaceCharToW(tWString aString, tWString asOldChar, tWString
if (asNewChar != _W("")) {
for (int i = 0; i < (int)aString.size(); i++) {
if (aString[i] == asOldChar[0])
- aString[i] = asNewChar[0];
+ aString.setChar(asNewChar[0], i);
}
return aString;
} else {
tWString sNewString;
- sNewString.reserve(aString.size());
for (int i = 0; i < (int)aString.size(); i++) {
if (aString[i] != asOldChar[0])
- sNewString.push_back(aString[i]);
+ sNewString += aString[i];
}
return sNewString;
}
@@ -526,19 +507,11 @@ tString cString::ToString(float afX) {
//-----------------------------------------------------------------------
tWString cString::ToStringW(int alX) {
- wchar_t buff[256];
-
- swprintf(buff, 256, _W("%d"), alX);
-
- return buff;
+ return Common::U32String::format("%d", alX);
}
tWString cString::ToStringW(float afX) {
- wchar_t buff[256];
-
- swprintf(buff, 256, _W("%f"), afX);
-
- return buff;
+ return Common::U32String::format("%f", afX);
}
//-----------------------------------------------------------------------
@@ -548,7 +521,7 @@ tStringVec &cString::GetStringVec(const tString &asData, tStringVec &avVec, tStr
bool start = false;
tString c = "";
- for (int i = 0; i < (int)asData.length(); i++) {
+ for (int i = 0; i < (int)asData.size(); i++) {
c = asData.substr(i, 1);
bool bNewWord = false;
@@ -575,7 +548,7 @@ tStringVec &cString::GetStringVec(const tString &asData, tStringVec &avVec, tStr
} else {
start = true;
str += c;
- if (i == (int)asData.length() - 1)
+ if (i == (int)asData.size() - 1)
avVec.push_back(str);
}
}
diff --git a/engines/hpl1/engine/system/SystemTypes.h b/engines/hpl1/engine/system/SystemTypes.h
index 73b81add0e8..c96dfca7db9 100644
--- a/engines/hpl1/engine/system/SystemTypes.h
+++ b/engines/hpl1/engine/system/SystemTypes.h
@@ -35,6 +35,7 @@
#include "hpl1/engine/system/Container.h"
#include "common/list.h"
+#include "common/str.h"
namespace hpl {
@@ -62,7 +63,7 @@ namespace hpl {
#define eFlagBit_14 (0x00004000)
#define eFlagBit_15 (0x00008000)
-#define _W(t) L##t
+#define _W(t) Common::U32String(t)
//--------------------------------------------------------
@@ -75,7 +76,7 @@ enum eSystemPath {
typedef unsigned int tFlag;
-typedef std::string tString;
+typedef Common::String tString;
typedef Common::List<tString> tStringList;
typedef tStringList::iterator tStringListIt;
@@ -88,7 +89,7 @@ typedef tStringSet::iterator tStringSetIt;
//--------------------------------------------------------
-typedef std::wstring tWString;
+typedef Common::U32String tWString;
typedef Common::List<tWString> tWStringList;
typedef tWStringList::iterator tWStringListIt;
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index 77b9a8bd064..6cadcda1cdc 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -106,14 +106,12 @@ void LogUpdate(const char *fmt, ...) {
//-----------------------------------------------------------------------
void CopyTextToClipboard(const tWString &text) {
- // FIXME: string types
- g_system->setTextInClipboard(Common::String(cString::To8Char(text.c_str()).c_str()));
+ g_system->setTextInClipboard(text);
}
tWString LoadTextFromClipboard() {
- // FIXME: string types
Common::U32String text = g_system->getTextFromClipboard();
- return cString::To16Char(Common::String(text).c_str());
+ return text;
}
//-----------------------------------------------------------------------
@@ -187,7 +185,7 @@ tWString GetSystemSpecialPath(eSystemPath aPathType) {
}
#endif
#endif
- return _W("");
+ return Common::U32String("");
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/CharacterMove.cpp b/engines/hpl1/penumbra-overture/CharacterMove.cpp
index 3a8c7155a41..43ef5323f35 100644
--- a/engines/hpl1/penumbra-overture/CharacterMove.cpp
+++ b/engines/hpl1/penumbra-overture/CharacterMove.cpp
@@ -543,7 +543,7 @@ void cCharacterMove::OnDraw(cInit *apInit) {
if (mbMoving)
apInit->mpDefaultFont->draw(cVector3f(5, 79, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
- _W("NodeDistAvg: %f"), mfNodeDistAvg);
+ Common::U32String::format("NodeDistAvg: %f", mfNodeDistAvg));
/*apInit->mpDefaultFont->Draw(cVector3f(5,64,100),14,cColor(1,1,1,1),eFontAlign_Left,
"Yaw: %f Pitch %f",cMath::ToDeg(mpCharBody->GetYaw()), cMath::ToDeg(mpCharBody->GetPitch()));
diff --git a/engines/hpl1/penumbra-overture/Credits.cpp b/engines/hpl1/penumbra-overture/Credits.cpp
index 7c548996563..4642d205276 100644
--- a/engines/hpl1/penumbra-overture/Credits.cpp
+++ b/engines/hpl1/penumbra-overture/Credits.cpp
@@ -92,7 +92,7 @@ void cCredits::OnDraw() {
float fY = mfYPos;
for (size_t i = 0; i < mvTextRows.size(); ++i) {
int lSize = 0;
- if (mvTextRows[i][0] == _W('*')) {
+ if (mvTextRows[i][0] == '*') {
lSize = 1;
}
if (mvTextRows[i].size() <= 1) {
@@ -109,10 +109,10 @@ void cCredits::OnDraw() {
if (lSize == 0)
mpFont->draw(cVector3f(400, fY, 10), fSize[lSize], cColor(1, fAlpha), eFontAlign_Center,
- mvTextRows[i].c_str());
+ mvTextRows[i]);
else
mpFont->draw(cVector3f(400, fY, 10), fSize[lSize], cColor(0.8f, fAlpha), eFontAlign_Center,
- mvTextRows[i].substr(1).c_str());
+ mvTextRows[i].substr(1));
}
fY += fSize[lSize];
}
@@ -134,7 +134,7 @@ void cCredits::Update(float afTimeStep) {
float fY = mfYPos;
for (size_t i = 0; i < mvTextRows.size(); ++i) {
int lSize = 0;
- if (mvTextRows[i][0] == _W('*'))
+ if (mvTextRows[i][0] == '*')
lSize = 1;
if (mvTextRows[i].size() <= 1)
fY += fSize[lSize];
diff --git a/engines/hpl1/penumbra-overture/DeathMenu.cpp b/engines/hpl1/penumbra-overture/DeathMenu.cpp
index 5eaf2ed04f7..2aed88571d6 100644
--- a/engines/hpl1/penumbra-overture/DeathMenu.cpp
+++ b/engines/hpl1/penumbra-overture/DeathMenu.cpp
@@ -84,9 +84,9 @@ void cDeathMenuButton::OnUpdate(float afTimeStep) {
void cDeathMenuButton::OnDraw() {
float fAlpha = mpInit->mpDeathMenu->mfAlpha;
- mpFont->draw(mvPositon, mvFontSize, cColor(0.8f, 0.7f, 0.7f, fAlpha), eFontAlign_Center, msText.c_str());
+ mpFont->draw(mvPositon, mvFontSize, cColor(0.8f, 0.7f, 0.7f, fAlpha), eFontAlign_Center, msText);
- mpFont->draw(mvPositon + cVector3f(0, 0, 1), mvFontSize, cColor(1, 0, 0, fAlpha * mfAlpha), eFontAlign_Center, msText.c_str());
+ mpFont->draw(mvPositon + cVector3f(0, 0, 1), mvFontSize, cColor(1, 0, 0, fAlpha * mfAlpha), eFontAlign_Center, msText);
}
//-----------------------------------------------------------------------
@@ -181,7 +181,7 @@ void cDeathMenu::OnDraw() {
mpDrawer->DrawGfxObject(mpGfxBackground, cVector3f(0, 0, 0), cVector2f(800, 600), cColor(1, mfAlpha));
mpFont->drawWordWrap(cVector3f(400, 210, 40), 500, 25, 24, cColor(0.7f, 0.3f, 0.3f), eFontAlign_Center,
- kTranslate("DeathMenu", "YouAreDead").c_str());
+ kTranslate("DeathMenu", "YouAreDead"));
////////////////////////////////
// Update buttons
diff --git a/engines/hpl1/penumbra-overture/GameEnemy.cpp b/engines/hpl1/penumbra-overture/GameEnemy.cpp
index 489e5428e89..efdc34c88aa 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy.cpp
@@ -609,13 +609,13 @@ void iGameEnemy::OnDraw() {
if (mlCurrentState >= 0)
sStateName = cString::To16Char(gvStateName[mlCurrentState]);
mpInit->mpDefaultFont->draw(cVector3f(5, 48, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
- _W("Health: %f State: %ls Moving: %d Stuck: %f MaxViewDist: %f"), mfHealth,
+ Common::U32String::format("Health: %f State: %S Moving: %d Stuck: %f MaxViewDist: %f", mfHealth,
sStateName.c_str(),
mpMover->IsMoving(),
mpMover->GetStuckCounter(),
- gfCurrentMaxViewDist);
+ gfCurrentMaxViewDist));
mpInit->mpDefaultFont->draw(cVector3f(5, 64, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
- _W("Speed: %f"), mpMover->GetCharBody()->GetMoveSpeed(eCharDir_Forward));
+ Common::U32String::format("Speed: %f", mpMover->GetCharBody()->GetMoveSpeed(eCharDir_Forward)));
mpMover->OnDraw(mpInit);
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp b/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
index c8ef11f6d3c..eb055e14ffe 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
@@ -865,12 +865,12 @@ void cGameEnemyState_Dog_Hunt::OnDraw() {
float fDist = mpMover->DistanceToChar2D(mpPlayer->GetCharacterBody());
mpInit->mpDefaultFont->draw(cVector3f(0, 110, 100), 14, cColor(1, 1, 1, 1), eFontAlign_Left,
- _W("LostPlayerCount: %f FreePath: %d NoPath: %d MaxStuck: %d Dist: %f / %f"),
+ Common::U32String::format("LostPlayerCount: %f FreePath: %d NoPath: %d MaxStuck: %d Dist: %f / %f",
mfLostPlayerCount, mbFreePlayerPath,
mbFoundNoPath,
mlStuckAtMaxCount,
fDist,
- mpEnemyDog->mfAttackDistance);
+ mpEnemyDog->mfAttackDistance));
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameScripts.cpp b/engines/hpl1/penumbra-overture/GameScripts.cpp
index 5bf3dc117ec..ccb0bffe7a0 100644
--- a/engines/hpl1/penumbra-overture/GameScripts.cpp
+++ b/engines/hpl1/penumbra-overture/GameScripts.cpp
@@ -86,18 +86,18 @@ tWString gsTempString = _W("");
//-----------------------------------------------------------------------
-static void AddToTempString(std::string asString) {
+static void AddToTempString(tString asString) {
gsTempString += cString::To16Char(asString);
}
SCRIPT_DEFINE_FUNC_1(void, AddToTempString, string)
-static void AddToTempStringTrans(std::string asCat, std::string asEntry) {
+static void AddToTempStringTrans(tString asCat, tString asEntry) {
cInit *mpInit = gpInit;
gsTempString += kTranslate(asCat, asEntry);
}
SCRIPT_DEFINE_FUNC_2(void, AddToTempStringTrans, string, string)
-static void AddToTempStringAction(std::string asAction) {
+static void AddToTempStringAction(tString asAction) {
cInit *mpInit = gpInit;
iAction *pAction = gpInit->mpGame->GetInput()->GetAction(asAction);
if (pAction) {
@@ -145,7 +145,7 @@ SCRIPT_DEFINE_FUNC(void, ClearSavedMaps)
//-----------------------------------------------------------------------
-static std::string GetActionKeyString(std::string asAction) {
+static tString GetActionKeyString(tString asAction) {
iAction *pAction = gpInit->mpGame->GetInput()->GetAction(asAction);
if (pAction) {
return pAction->GetInputName();
@@ -157,8 +157,8 @@ SCRIPT_DEFINE_FUNC_1(string, GetActionKeyString, string)
//-----------------------------------------------------------------------
-static void AddMessageTrans(std::string asTransCat,
- std::string asTransName) {
+static void AddMessageTrans(tString asTransCat,
+ tString asTransName) {
cInit *mpInit = gpInit;
gpInit->mpGameMessageHandler->Add(kTranslate(asTransCat, asTransName));
}
@@ -166,7 +166,7 @@ SCRIPT_DEFINE_FUNC_2(void, AddMessageTrans, string, string)
//-----------------------------------------------------------------------
-static void AddMessage(std::string asMessage) {
+static void AddMessage(tString asMessage) {
gpInit->mpGameMessageHandler->Add(cString::To16Char(asMessage));
}
SCRIPT_DEFINE_FUNC_1(void, AddMessage, string)
@@ -181,8 +181,8 @@ SCRIPT_DEFINE_FUNC(void, AddMessageTempString)
//-----------------------------------------------------------------------
-static void AddSubTitleTrans(std::string asTransCat,
- std::string asTransName, float afTime) {
+static void AddSubTitleTrans(tString asTransCat,
+ tString asTransName, float afTime) {
cInit *mpInit = gpInit;
gpInit->mpEffectHandler->GetSubTitle()->Add(kTranslate(asTransCat, asTransName), afTime, false);
}
@@ -190,7 +190,7 @@ SCRIPT_DEFINE_FUNC_3(void, AddSubTitleTrans, string, string, float)
//-----------------------------------------------------------------------
-static void AddSubTitle(std::string asMessage, float afTime) {
+static void AddSubTitle(tString asMessage, float afTime) {
gpInit->mpEffectHandler->GetSubTitle()->Add(cString::To16Char(asMessage), afTime, false);
}
SCRIPT_DEFINE_FUNC_2(void, AddSubTitle, string, float)
@@ -205,8 +205,8 @@ SCRIPT_DEFINE_FUNC_1(void, AddSubTitleTempString, float)
//-----------------------------------------------------------------------
-static void AddRadioMessage(std::string asTransCat, std::string asTransName,
- std::string asSound) {
+static void AddRadioMessage(tString asTransCat, tString asTransName,
+ tString asSound) {
cInit *mpInit = gpInit;
gpInit->mpRadioHandler->Add(kTranslate(asTransCat, asTransName), asSound);
}
@@ -214,20 +214,20 @@ SCRIPT_DEFINE_FUNC_3(void, AddRadioMessage, string, string, string)
//-----------------------------------------------------------------------
-static void SetRadioOnEndCallback(std::string asFunc) {
+static void SetRadioOnEndCallback(tString asFunc) {
gpInit->mpRadioHandler->SetOnEndCallback(asFunc);
}
SCRIPT_DEFINE_FUNC_1(void, SetRadioOnEndCallback, string)
//-----------------------------------------------------------------------
-static void SetInventoryMessage(std::string asMessage) {
+static void SetInventoryMessage(tString asMessage) {
gpInit->mpInventory->SetMessage(cString::To16Char(asMessage));
}
SCRIPT_DEFINE_FUNC_1(void, SetInventoryMessage, string)
-static void SetInventoryMessageTrans(std::string asTransCat,
- std::string asTransName) {
+static void SetInventoryMessageTrans(tString asTransCat,
+ tString asTransName) {
cInit *mpInit = gpInit;
gpInit->mpInventory->SetMessage(kTranslate(asTransCat, asTransName));
}
@@ -235,17 +235,17 @@ SCRIPT_DEFINE_FUNC_2(void, SetInventoryMessageTrans, string, string)
//-----------------------------------------------------------------------
-static void SetMessagesOverCallback(std::string asFunction) {
+static void SetMessagesOverCallback(tString asFunction) {
gpInit->mpGameMessageHandler->SetOnMessagesOverCallback(asFunction);
}
SCRIPT_DEFINE_FUNC_1(void, SetMessagesOverCallback, string)
//-----------------------------------------------------------------------
-static void ChangeMap(std::string asMapFile, std::string asMapPos,
- std::string asStartSound, std::string asStopSound,
+static void ChangeMap(tString asMapFile, tString asMapPos,
+ tString asStartSound, tString asStopSound,
float afFadeOutTime, float afFadeInTime,
- std::string asLoadTextCat, std::string asLoadTextEntry) {
+ tString asLoadTextCat, tString asLoadTextEntry) {
// if(gpInit->mpRadioHandler->IsActive()) return;
gpInit->mpMapHandler->ChangeMap(asMapFile, asMapPos, asStartSound, asStopSound,
@@ -256,12 +256,12 @@ SCRIPT_DEFINE_FUNC_8(void, ChangeMap, string, string, string, string, float, flo
//-----------------------------------------------------------------------
-static void SetMapGameName(std::string asName) {
+static void SetMapGameName(tString asName) {
gpInit->mpMapHandler->SetMapGameName(cString::To16Char(asName));
}
SCRIPT_DEFINE_FUNC_1(void, SetMapGameName, string)
-static void SetMapGameNameTrans(std::string asTransCat, std::string asTransEntry) {
+static void SetMapGameNameTrans(tString asTransCat, tString asTransEntry) {
cInit *mpInit = gpInit;
gpInit->mpMapHandler->SetMapGameName(kTranslate(asTransCat, asTransEntry));
}
@@ -269,15 +269,15 @@ SCRIPT_DEFINE_FUNC_2(void, SetMapGameNameTrans, string, string)
//-----------------------------------------------------------------------
-static void AddNotebookTaskText(std::string asName, std::string asText) {
+static void AddNotebookTaskText(tString asName, tString asText) {
gpInit->mpNotebook->AddTask(asName, cString::To16Char(asText));
}
SCRIPT_DEFINE_FUNC_2(void, AddNotebookTaskText, string, string)
//-----------------------------------------------------------------------
-static void AddNotebookTask(std::string asName, std::string asTransCat,
- std::string asTransEntry) {
+static void AddNotebookTask(tString asName, tString asTransCat,
+ tString asTransEntry) {
cInit *mpInit = gpInit;
gpInit->mpNotebook->AddTask(asName, kTranslate(asTransCat, asTransEntry));
}
@@ -285,15 +285,15 @@ SCRIPT_DEFINE_FUNC_3(void, AddNotebookTask, string, string, string)
//-----------------------------------------------------------------------
-static void RemoveNotebookTask(std::string asName) {
+static void RemoveNotebookTask(tString asName) {
gpInit->mpNotebook->RemoveTask(asName);
}
SCRIPT_DEFINE_FUNC_1(void, RemoveNotebookTask, string)
//-----------------------------------------------------------------------
-static void AddNotebookNote(std::string asNameCat, std::string asNameEntry,
- std::string asTextCat, std::string asTextEntry) {
+static void AddNotebookNote(tString asNameCat, tString asNameEntry,
+ tString asTextCat, tString asTextEntry) {
cInit *mpInit = gpInit;
gpInit->mpNotebook->AddNote(kTranslate(asNameCat, asNameEntry), asTextCat, asTextEntry);
}
@@ -301,8 +301,8 @@ SCRIPT_DEFINE_FUNC_4(void, AddNotebookNote, string, string, string, string)
//-----------------------------------------------------------------------
-static void StartNumericalPanel(std::string asName, int alCode1, int alCode2, int alCode3, int alCode4,
- float afDifficulty, std::string asCallback) {
+static void StartNumericalPanel(tString asName, int alCode1, int alCode2, int alCode3, int alCode4,
+ float afDifficulty, tString asCallback) {
gpInit->mpNumericalPanel->SetActive(true);
tIntVec vCode;
vCode.resize(4);
@@ -376,7 +376,7 @@ static void SetWaveGravityActive(bool abX) {
SCRIPT_DEFINE_FUNC_1(void, SetWaveGravityActive, bool)
static void SetupWaveGravity(float afMaxAngle, float afSwingLength,
- float afGravitySize, std::string asAxis) {
+ float afGravitySize, tString asAxis) {
int lDir = cString::ToLowerCase(asAxis) == "x" ? 0 : 1;
gpInit->mpEffectHandler->GetWaveGravity()->Setup(cMath::ToRad(afMaxAngle), afSwingLength, afGravitySize, lDir);
@@ -400,7 +400,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetupDepthOfField, float, float, float)
//-----------------------------------------------------------------------
-static void FocusOnEntity(std::string asEntity) {
+static void FocusOnEntity(tString asEntity) {
GAME_ENTITY_BEGIN(asEntity);
if (pEntity->GetBodyNum() == 0) {
@@ -415,7 +415,7 @@ SCRIPT_DEFINE_FUNC_1(void, FocusOnEntity, string)
//-----------------------------------------------------------------------
-static void SetConstantFocusOnEntity(std::string asEntity) {
+static void SetConstantFocusOnEntity(tString asEntity) {
if (asEntity == "") {
gpInit->mpEffectHandler->GetDepthOfField()->SetFocusBody(NULL);
return;
@@ -434,7 +434,7 @@ SCRIPT_DEFINE_FUNC_1(void, SetConstantFocusOnEntity, string)
//-----------------------------------------------------------------------
-static void PlayGameMusic(std::string asFile, float afVolume, float afFadeStep,
+static void PlayGameMusic(tString asFile, float afVolume, float afFadeStep,
bool abLoop, int alPrio) {
gpInit->mpMusicHandler->Play(asFile, abLoop, afVolume, afFadeStep, alPrio);
}
@@ -456,7 +456,7 @@ SCRIPT_DEFINE_FUNC_4(void, StartScreenShake, float, float, float, float)
//-----------------------------------------------------------------------
-static void CreateLightFlashAtArea(std::string asArea, float afRadius,
+static void CreateLightFlashAtArea(tString asArea, float afRadius,
float afR, float afG, float afB, float afA,
float afAddTime, float afNegTime) {
cAreaEntity *pArea = gpInit->mpGame->GetScene()->GetWorld3D()->GetAreaEntity(asArea);
@@ -476,7 +476,7 @@ SCRIPT_DEFINE_FUNC_8(void, CreateLightFlashAtArea, string, float, float, float,
//-----------------------------------------------------------------------
-static void CreateSplashDamage(std::string asAreaName, float afRadius,
+static void CreateSplashDamage(tString asAreaName, float afRadius,
float afMinDamage, float afMaxDamge,
float afMinForce, float afMaxForce,
float afMaxImpulse, int alStrength) {
@@ -504,12 +504,12 @@ SCRIPT_DEFINE_FUNC_8(void, CreateSplashDamage, string, float, float, float, floa
//-----------------------------------------------------------------------
-static void CreateTimer(std::string asName, float afTime, std::string asCallback, bool abGlobal) {
+static void CreateTimer(tString asName, float afTime, tString asCallback, bool abGlobal) {
gpInit->mpMapHandler->CreateTimer(asName, afTime, asCallback, abGlobal);
}
SCRIPT_DEFINE_FUNC_4(void, CreateTimer, string, float, string, bool)
-static void DestroyTimer(std::string asName) {
+static void DestroyTimer(tString asName) {
cGameTimer *pTimer = gpInit->mpMapHandler->GetTimer(asName);
if (pTimer == NULL) {
Warning("Couldn't find timer '%s'\n", asName.c_str());
@@ -520,7 +520,7 @@ static void DestroyTimer(std::string asName) {
}
SCRIPT_DEFINE_FUNC_1(void, DestroyTimer, string)
-static void SetTimerPaused(std::string asName, bool abPaused) {
+static void SetTimerPaused(tString asName, bool abPaused) {
cGameTimer *pTimer = gpInit->mpMapHandler->GetTimer(asName);
if (pTimer == NULL) {
Warning("Couldn't find timer '%s'\n", asName.c_str());
@@ -531,7 +531,7 @@ static void SetTimerPaused(std::string asName, bool abPaused) {
}
SCRIPT_DEFINE_FUNC_2(void, SetTimerPaused, string, bool)
-static void SetTimerTime(std::string asName, float afTime) {
+static void SetTimerTime(tString asName, float afTime) {
cGameTimer *pTimer = gpInit->mpMapHandler->GetTimer(asName);
if (pTimer == NULL) {
Warning("Couldn't find timer '%s'\n", asName.c_str());
@@ -542,7 +542,7 @@ static void SetTimerTime(std::string asName, float afTime) {
}
SCRIPT_DEFINE_FUNC_2(void, SetTimerTime, string, float)
-static void AddTimerTime(std::string asName, float afTime) {
+static void AddTimerTime(tString asName, float afTime) {
cGameTimer *pTimer = gpInit->mpMapHandler->GetTimer(asName);
if (pTimer == NULL) {
Warning("Couldn't find timer '%s'\n", asName.c_str());
@@ -553,7 +553,7 @@ static void AddTimerTime(std::string asName, float afTime) {
}
SCRIPT_DEFINE_FUNC_2(void, AddTimerTime, string, float)
-static float GetTimerTime(std::string asName) {
+static float GetTimerTime(tString asName) {
cGameTimer *pTimer = gpInit->mpMapHandler->GetTimer(asName);
if (pTimer == NULL) {
Warning("Couldn't find timer '%s'\n", asName.c_str());
@@ -570,7 +570,7 @@ SCRIPT_DEFINE_FUNC_1(float, GetTimerTime, string)
//-----------------------------------------------------------------------
-static void GivePlayerDamage(float afAmount, std::string asType) {
+static void GivePlayerDamage(float afAmount, tString asType) {
ePlayerDamageType type = ePlayerDamageType_BloodSplash;
tString sLowType = cString::ToLowerCase(asType);
@@ -599,7 +599,7 @@ SCRIPT_DEFINE_FUNC(float, GetPlayerHealth)
//-----------------------------------------------------------------------
-static void SetPlayerPose(std::string asPose, bool abChangeDirectly) {
+static void SetPlayerPose(tString asPose, bool abChangeDirectly) {
tString sPose = cString::ToLowerCase(asPose);
if (sPose == "stand") {
@@ -619,7 +619,7 @@ SCRIPT_DEFINE_FUNC_1(void, SetPlayerActive, bool)
//-----------------------------------------------------------------------
-static void StartPlayerLookAt(std::string asEntityName, float afSpeedMul, float afMaxSpeed) {
+static void StartPlayerLookAt(tString asEntityName, float afSpeedMul, float afMaxSpeed) {
///////////////////
// Get entity
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEntityName);
@@ -667,48 +667,48 @@ SCRIPT_DEFINE_FUNC_1(void, SetFlashlightDisabled, bool)
//-----------------------------------------------------------------------
-static void AddPickupCallback(std::string asItem, std::string asFunction) {
+static void AddPickupCallback(tString asItem, tString asFunction) {
gpInit->mpInventory->AddPickupCallback(asItem, asFunction);
}
SCRIPT_DEFINE_FUNC_2(void, AddPickupCallback, string, string)
-static void AddUseCallback(std::string asItem, std::string asEntity, std::string asFunction) {
+static void AddUseCallback(tString asItem, tString asEntity, tString asFunction) {
gpInit->mpInventory->AddUseCallback(asItem, asEntity, asFunction);
}
SCRIPT_DEFINE_FUNC_3(void, AddUseCallback, string, string, string)
-static void AddCombineCallback(std::string asItem1, std::string asItem2, std::string asFunction) {
+static void AddCombineCallback(tString asItem1, tString asItem2, tString asFunction) {
gpInit->mpInventory->AddCombineCallback(asItem1, asItem2, asFunction);
}
SCRIPT_DEFINE_FUNC_3(void, AddCombineCallback, string, string, string)
//-----------------------------------------------------------------------
-static void RemovePickupCallback(std::string asFunction) {
+static void RemovePickupCallback(tString asFunction) {
gpInit->mpInventory->RemovePickupCallback(asFunction);
}
SCRIPT_DEFINE_FUNC_1(void, RemovePickupCallback, string)
-static void RemoveUseCallback(std::string asFunction) {
+static void RemoveUseCallback(tString asFunction) {
gpInit->mpInventory->RemoveUseCallback(asFunction);
}
SCRIPT_DEFINE_FUNC_1(void, RemoveUseCallback, string)
-static void RemoveCombineCallback(std::string asFunction) {
+static void RemoveCombineCallback(tString asFunction) {
gpInit->mpInventory->RemoveCombineCallback(asFunction);
}
SCRIPT_DEFINE_FUNC_1(void, RemoveCombineCallback, string)
//-----------------------------------------------------------------------
-static bool HasItem(std::string asName) {
+static bool HasItem(tString asName) {
// if(cString::ToLowerCase(asName)=="notebook") return gpInit->mpInventory->GetNoteBookActive();
return gpInit->mpInventory->GetItem(asName) != NULL;
}
SCRIPT_DEFINE_FUNC_1(bool, HasItem, string)
-static void RemoveItem(std::string asName) {
+static void RemoveItem(tString asName) {
cInventoryItem *pItem = gpInit->mpInventory->GetItem(asName);
if (pItem) {
gpInit->mpInventory->RemoveItem(pItem);
@@ -718,7 +718,7 @@ static void RemoveItem(std::string asName) {
}
SCRIPT_DEFINE_FUNC_1(void, RemoveItem, string)
-static void GiveItem(std::string asName, std::string asEntityFile, int alSlotIndex) {
+static void GiveItem(tString asName, tString asEntityFile, int alSlotIndex) {
gpInit->mpInventory->AddItemFromFile(asName, asEntityFile, alSlotIndex);
}
SCRIPT_DEFINE_FUNC_3(void, GiveItem, string, string, int)
@@ -729,8 +729,8 @@ SCRIPT_DEFINE_FUNC_3(void, GiveItem, string, string, int)
//-----------------------------------------------------------------------
-static void ReplaceEntity(std::string asName, std::string asBodyName,
- std::string asNewName, std::string asNewFile) {
+static void ReplaceEntity(tString asName, tString asBodyName,
+ tString asNewName, tString asNewFile) {
GAME_ENTITY_BEGIN(asName)
if (pEntity->GetBodyNum() == 0) {
@@ -768,14 +768,14 @@ SCRIPT_DEFINE_FUNC_4(void, ReplaceEntity, string, string, string, string)
//-----------------------------------------------------------------------
-static void SetGameEntityActive(std::string asName, bool abX) {
+static void SetGameEntityActive(tString asName, bool abX) {
GAME_ENTITY_BEGIN(asName)
pEntity->SetActive(abX);
}
SCRIPT_DEFINE_FUNC_2(void, SetGameEntityActive, string, bool)
-static bool GetGameEntityActive(std::string asName) {
+static bool GetGameEntityActive(tString asName) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL) {
Warning("Couldn't find game entity '%s'\n", asName.c_str());
@@ -788,28 +788,28 @@ SCRIPT_DEFINE_FUNC_1(bool, GetGameEntityActive, string)
//-----------------------------------------------------------------------
-static void CreateGameEntityVar(std::string asEntName, std::string asVarName, int alVal) {
+static void CreateGameEntityVar(tString asEntName, tString asVarName, int alVal) {
GAME_ENTITY_BEGIN(asEntName);
pEntity->CreateVar(asVarName, alVal);
}
SCRIPT_DEFINE_FUNC_3(void, CreateGameEntityVar, string, string, int)
-static void SetGameEntityVar(std::string asEntName, std::string asVarName, int alVal) {
+static void SetGameEntityVar(tString asEntName, tString asVarName, int alVal) {
GAME_ENTITY_BEGIN(asEntName);
pEntity->SetVar(asVarName, alVal);
}
SCRIPT_DEFINE_FUNC_3(void, SetGameEntityVar, string, string, int)
-static void AddGameEntityVar(std::string asEntName, std::string asVarName, int alVal) {
+static void AddGameEntityVar(tString asEntName, tString asVarName, int alVal) {
GAME_ENTITY_BEGIN(asEntName);
pEntity->AddVar(asVarName, alVal);
}
SCRIPT_DEFINE_FUNC_3(void, AddGameEntityVar, string, string, int)
-static int GetGameEntityVar(std::string asEntName, std::string asVarName) {
+static int GetGameEntityVar(tString asEntName, tString asVarName) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEntName);
if (pEntity == NULL) {
Warning("Couldn't find game entity '%s'\n", asEntName.c_str());
@@ -822,14 +822,14 @@ SCRIPT_DEFINE_FUNC_2(int, GetGameEntityVar, string, string)
//-----------------------------------------------------------------------
-static void SetGameEntityMaxExamineDist(std::string asName, float afDist) {
+static void SetGameEntityMaxExamineDist(tString asName, float afDist) {
GAME_ENTITY_BEGIN(asName)
pEntity->SetMaxExamineDist(afDist);
}
SCRIPT_DEFINE_FUNC_2(void, SetGameEntityMaxExamineDist, string, float)
-static void SetGameEntityMaxInteractDist(std::string asName, float afDist) {
+static void SetGameEntityMaxInteractDist(tString asName, float afDist) {
GAME_ENTITY_BEGIN(asName)
pEntity->SetMaxInteractDist(afDist);
@@ -838,9 +838,9 @@ SCRIPT_DEFINE_FUNC_2(void, SetGameEntityMaxInteractDist, string, float)
//-----------------------------------------------------------------------
-static void SetGameEntityDescriptionTrans(std::string asName,
- std::string asTransCat,
- std::string asTransName) {
+static void SetGameEntityDescriptionTrans(tString asName,
+ tString asTransCat,
+ tString asTransName) {
cInit *mpInit = gpInit;
GAME_ENTITY_BEGIN(asName)
@@ -851,9 +851,9 @@ SCRIPT_DEFINE_FUNC_3(void, SetGameEntityDescriptionTrans, string, string, string
//-----------------------------------------------------------------------
-static void SetGameEntityDescriptionOnceTrans(std::string asName,
- std::string asTransCat,
- std::string asTransName) {
+static void SetGameEntityDescriptionOnceTrans(tString asName,
+ tString asTransCat,
+ tString asTransName) {
cInit *mpInit = gpInit;
GAME_ENTITY_BEGIN(asName)
@@ -864,7 +864,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetGameEntityDescriptionOnceTrans, string, string, st
//-----------------------------------------------------------------------
-static void SetGameEntityDescription(std::string asName, std::string asMessage) {
+static void SetGameEntityDescription(tString asName, tString asMessage) {
GAME_ENTITY_BEGIN(asName)
pEntity->SetDescription(cString::To16Char(asMessage));
@@ -872,9 +872,9 @@ static void SetGameEntityDescription(std::string asName, std::string asMessage)
}
SCRIPT_DEFINE_FUNC_2(void, SetGameEntityDescription, string, string)
-static void SetGameEntityGameNameTrans(std::string asName,
- std::string asTransCat,
- std::string asTransName) {
+static void SetGameEntityGameNameTrans(tString asName,
+ tString asTransCat,
+ tString asTransName) {
cInit *mpInit = gpInit;
GAME_ENTITY_BEGIN(asName)
@@ -884,8 +884,8 @@ SCRIPT_DEFINE_FUNC_3(void, SetGameEntityGameNameTrans, string, string, string)
//-----------------------------------------------------------------------
-static void ChangeEntityAnimation(std::string asName,
- std::string asAnimation,
+static void ChangeEntityAnimation(tString asName,
+ tString asAnimation,
bool abLoop) {
GAME_ENTITY_BEGIN(asName)
@@ -895,14 +895,14 @@ SCRIPT_DEFINE_FUNC_3(void, ChangeEntityAnimation, string, string, bool)
//-----------------------------------------------------------------------
-static void SetEntityHealth(std::string asName, float afHealth) {
+static void SetEntityHealth(tString asName, float afHealth) {
GAME_ENTITY_BEGIN(asName)
pEntity->SetHealth(afHealth);
}
SCRIPT_DEFINE_FUNC_2(void, SetEntityHealth, string, float)
-static void DamageEntity(std::string asName, float afDamage, int alStrength) {
+static void DamageEntity(tString asName, float afDamage, int alStrength) {
GAME_ENTITY_BEGIN(asName)
pEntity->Damage(afDamage, alStrength);
@@ -911,8 +911,8 @@ SCRIPT_DEFINE_FUNC_3(void, DamageEntity, string, float, int)
//-----------------------------------------------------------------------
-static void SetDoorState(std::string asName,
- std::string asState) {
+static void SetDoorState(tString asName,
+ tString asState) {
/*iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if(pEntity==NULL || pEntity->GetType() != eGameEntityType_Door)
{
@@ -940,7 +940,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetDoorState, string, string)
//-----------------------------------------------------------------------
-static void SetObjectInteractMode(std::string asName, std::string asMode) {
+static void SetObjectInteractMode(tString asName, tString asMode) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Object) {
Warning("Couldn't find object entity '%s'\n", asName.c_str());
@@ -955,9 +955,9 @@ SCRIPT_DEFINE_FUNC_2(void, SetObjectInteractMode, string, string)
//-----------------------------------------------------------------------
-static void SetupLink(std::string asName,
- std::string asMapFile, std::string asMapPos,
- std::string asStartSound, std::string asStopSound,
+static void SetupLink(tString asName,
+ tString asMapFile, tString asMapPos,
+ tString asStartSound, tString asStopSound,
float afFadeOutTime, float afFadeInTime) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Link) {
@@ -980,11 +980,11 @@ SCRIPT_DEFINE_FUNC_7(void, SetupLink, string, string, string, string, string, fl
//-----------------------------------------------------------------------
-static void SetupLinkLoadText(std::string asName,
- std::string asMapFile, std::string asMapPos,
- std::string asStartSound, std::string asStopSound,
+static void SetupLinkLoadText(tString asName,
+ tString asMapFile, tString asMapPos,
+ tString asStartSound, tString asStopSound,
float afFadeOutTime, float afFadeInTime,
- std::string asTextCat, std::string asTextEntry) {
+ tString asTextCat, tString asTextEntry) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Link) {
Warning("Couldn't find object entity '%s'\n", asName.c_str());
@@ -1006,7 +1006,7 @@ SCRIPT_DEFINE_FUNC_9(void, SetupLinkLoadText, string, string, string, string, st
//-----------------------------------------------------------------------
-static void SetAreaCustomIcon(std::string asName, std::string asIcon) {
+static void SetAreaCustomIcon(tString asName, tString asIcon) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Area) {
Warning("Couldn't find area entity '%s'\n", asName.c_str());
@@ -1047,8 +1047,8 @@ SCRIPT_DEFINE_FUNC_2(void, SetAreaCustomIcon, string, string)
//-----------------------------------------------------------------------
-static void AddEnemyPatrolNode(std::string asEnemy, std::string asNode, float afTime,
- std::string asAnimation) {
+static void AddEnemyPatrolNode(tString asEnemy, tString asNode, float afTime,
+ tString asAnimation) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1064,7 +1064,7 @@ SCRIPT_DEFINE_FUNC_4(void, AddEnemyPatrolNode, string, string, float, string)
* Clears all the patrol nodes for the enemy
* \param asEnemy The Name of the enemy.
*/
-static void ClearEnemyPatrolNodes(std::string asEnemy) {
+static void ClearEnemyPatrolNodes(tString asEnemy) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1078,7 +1078,7 @@ SCRIPT_DEFINE_FUNC_1(void, ClearEnemyPatrolNodes, string)
//-----------------------------------------------------------------------
-static void SetEnemyDeathCallback(std::string asEnemy, std::string asFunction) {
+static void SetEnemyDeathCallback(tString asEnemy, tString asFunction) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1092,7 +1092,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetEnemyDeathCallback, string, string)
//-----------------------------------------------------------------------
-static void SetEnemyAttackCallback(std::string asEnemy, std::string asFunction) {
+static void SetEnemyAttackCallback(tString asEnemy, tString asFunction) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1106,7 +1106,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetEnemyAttackCallback, string, string)
//-----------------------------------------------------------------------
-static float GetEnemyHealth(std::string asEnemy) {
+static float GetEnemyHealth(tString asEnemy) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1120,7 +1120,7 @@ SCRIPT_DEFINE_FUNC_1(float, GetEnemyHealth, string)
//-----------------------------------------------------------------------
-static void SetEnemyUseTriggers(std::string asEnemy, bool abUseTriggers) {
+static void SetEnemyUseTriggers(tString asEnemy, bool abUseTriggers) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1134,7 +1134,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetEnemyUseTriggers, string, bool)
//-----------------------------------------------------------------------
-static void ShowEnemyPlayer(std::string asEnemy) {
+static void ShowEnemyPlayer(tString asEnemy) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asEnemy);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Enemy) {
Warning("Couldn't find enemy entity '%s'\n", asEnemy.c_str());
@@ -1150,7 +1150,7 @@ SCRIPT_DEFINE_FUNC_1(void, ShowEnemyPlayer, string)
//-----------------------------------------------------------------------
-static void SetDoorLocked(std::string asDoor, bool abLocked) {
+static void SetDoorLocked(tString asDoor, bool abLocked) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asDoor);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_SwingDoor) {
Warning("Couldn't find swing door entity '%s'\n", asDoor.c_str());
@@ -1164,12 +1164,12 @@ SCRIPT_DEFINE_FUNC_2(void, SetDoorLocked, string, bool)
//-----------------------------------------------------------------------
-static void SetupStickArea(std::string asArea, bool abCanDeatch,
+static void SetupStickArea(tString asArea, bool abCanDeatch,
bool abMoveBody, bool abRotateBody,
bool abCheckCenterInArea, float afPoseTime,
- std::string asAttachSound, std::string asDetachSound,
- std::string asAttachPS, std::string asDetachPS,
- std::string asAttachFunc, std::string asDetachFunc) {
+ tString asAttachSound, tString asDetachSound,
+ tString asAttachPS, tString asDetachPS,
+ tString asAttachFunc, tString asDetachFunc) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asArea);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_StickArea) {
Warning("Couldn't find stick area '%s'\n", asArea.c_str());
@@ -1207,7 +1207,7 @@ SCRIPT_DEFINE_FUNC(void, AllowAttachment)
//-----------------------------------------------------------------------
-static void SetLampLit(std::string asName, bool abLit, bool abFade) {
+static void SetLampLit(tString asName, bool abLit, bool abFade) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Lamp) {
Warning("Couldn't find lamp '%s'\n", asName.c_str());
@@ -1221,7 +1221,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetLampLit, string, bool, bool)
//-----------------------------------------------------------------------
-static void SetLampFlicker(std::string asName, bool abFlicker) {
+static void SetLampFlicker(tString asName, bool abFlicker) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Lamp) {
Warning("Couldn't find lamp '%s'\n", asName.c_str());
@@ -1235,7 +1235,7 @@ SCRIPT_DEFINE_FUNC_2(void, SetLampFlicker, string, bool)
//-----------------------------------------------------------------------
-static void SetLampLitChangeCallback(std::string asName, std::string asCallback) {
+static void SetLampLitChangeCallback(tString asName, tString asCallback) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Lamp) {
Warning("Couldn't find lamp '%s'\n", asName.c_str());
@@ -1249,10 +1249,10 @@ SCRIPT_DEFINE_FUNC_2(void, SetLampLitChangeCallback, string, string)
//-----------------------------------------------------------------------
-static void SetupLadder(std::string asName,
- std::string asAttachSound,
- std::string asClimbUpSound,
- std::string asClimbDownSound) {
+static void SetupLadder(tString asName,
+ tString asAttachSound,
+ tString asClimbUpSound,
+ tString asClimbDownSound) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_Ladder) {
Warning("Couldn't find ladder '%s'\n", asName.c_str());
@@ -1268,7 +1268,7 @@ SCRIPT_DEFINE_FUNC_4(void, SetupLadder, string, string, string, string)
//-----------------------------------------------------------------------
-static void SetupDamageArea(std::string asName, float afDamage,
+static void SetupDamageArea(tString asName, float afDamage,
float afUpdatesPerSec, int alStrength,
bool abDisableObjects, bool abDisableEnemies) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
@@ -1288,7 +1288,7 @@ SCRIPT_DEFINE_FUNC_6(void, SetupDamageArea, string, float, float, int, bool, boo
//-----------------------------------------------------------------------
-static void SetupForceArea(std::string asName,
+static void SetupForceArea(tString asName,
float afMaxForce, float afConstant,
float afDestSpeed, float afMaxMass,
bool abMulWithMass, bool abForceAtPoint,
@@ -1313,10 +1313,10 @@ SCRIPT_DEFINE_FUNC_9(void, SetupForceArea, string, float, float, float, float, b
//-----------------------------------------------------------------------
-static void SetupLiquidArea(std::string asName,
+static void SetupLiquidArea(tString asName,
float afDensity, float afLinearViscosity,
float afAngularViscosity,
- std::string asPhysicsMaterial,
+ tString asPhysicsMaterial,
float fR, float fG, float fB,
bool abHasWaves) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
@@ -1340,9 +1340,9 @@ SCRIPT_DEFINE_FUNC_9(void, SetupLiquidArea, string, float, float, float, string,
//-----------------------------------------------------------------------
-static void SetupSaveArea(std::string asName,
- std::string asMessageCat, std::string asMessageEntry,
- std::string asSound) {
+static void SetupSaveArea(tString asName,
+ tString asMessageCat, tString asMessageEntry,
+ tString asSound) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asName);
if (pEntity == NULL || pEntity->GetType() != eGameEntityType_SaveArea) {
Warning("Couldn't find save area '%s'\n", asName.c_str());
@@ -1379,10 +1379,10 @@ static eGameCollideScriptType GetGameCollideScriptType(const tString &asType) {
//////////////////////////////
-static void AddEntityCollideCallback(std::string asType,
- std::string asDestName,
- std::string asEntityName,
- std::string asFuncName) {
+static void AddEntityCollideCallback(tString asType,
+ tString asDestName,
+ tString asEntityName,
+ tString asFuncName) {
if (cString::ToLowerCase(asDestName) == "player") {
eGameCollideScriptType type = GetGameCollideScriptType(asType);
@@ -1405,9 +1405,9 @@ SCRIPT_DEFINE_FUNC_4(void, AddEntityCollideCallback, string, string, string, str
//////////////////////////////
-static void RemoveEntityCollideCallback(std::string asType,
- std::string asDestName,
- std::string asEntityName) {
+static void RemoveEntityCollideCallback(tString asType,
+ tString asDestName,
+ tString asEntityName) {
if (cString::ToLowerCase(asDestName) == "player") {
eGameCollideScriptType type = GetGameCollideScriptType(asType);
@@ -1452,9 +1452,9 @@ static eGameEntityScriptType GetGameScriptType(const tString &asType) {
/////////////////////
-static void AddEntityCallback(std::string asType,
- std::string asDestName,
- std::string asFuncName) {
+static void AddEntityCallback(tString asType,
+ tString asDestName,
+ tString asFuncName) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asDestName);
if (pEntity == NULL) {
Warning("Couldn't find entity '%s'\n", asDestName.c_str());
@@ -1471,8 +1471,8 @@ SCRIPT_DEFINE_FUNC_3(void, AddEntityCallback, string, string, string)
/////////////////////
-static void RemoveEntityCallback(std::string asType,
- std::string asDestName) {
+static void RemoveEntityCallback(tString asType,
+ tString asDestName) {
iGameEntity *pEntity = gpInit->mpMapHandler->GetGameEntity(asDestName);
if (pEntity == NULL) {
Warning("Couldn't find entity '%s'\n", asDestName.c_str());
@@ -1493,8 +1493,8 @@ SCRIPT_DEFINE_FUNC_2(void, RemoveEntityCallback, string, string)
//-----------------------------------------------------------------------
-static void CreateSoundEntityAt(std::string asType, std::string asDestName,
- std::string asSoundName, std::string asSoundFile) {
+static void CreateSoundEntityAt(tString asType, tString asDestName,
+ tString asSoundName, tString asSoundFile) {
cWorld3D *pWorld = gpInit->mpGame->GetScene()->GetWorld3D();
iPhysicsWorld *pPhysicsWorld = gpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
diff --git a/engines/hpl1/penumbra-overture/GraphicsHelper.cpp b/engines/hpl1/penumbra-overture/GraphicsHelper.cpp
index 5bf60bdfab5..7314caab85c 100644
--- a/engines/hpl1/penumbra-overture/GraphicsHelper.cpp
+++ b/engines/hpl1/penumbra-overture/GraphicsHelper.cpp
@@ -109,7 +109,7 @@ void cGraphicsHelper::DrawLoadingScreen(const tString &asFile) {
DrawTexture(pTex, cVector3f(0, 0, 0), cVector2f(800, 600), cColor(1, 1));
mpFont->draw(cVector3f(400, 300, 50), 22, cColor(1, 1), eFontAlign_Center,
- _W("%ls"), kTranslate("LoadTexts", "Loading").c_str());
+ kTranslate("LoadTexts", "Loading"));
mpDrawer->DrawAll();
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 6af2fffd22b..9db327d9d86 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -378,7 +378,7 @@ bool cInit::Init(tString saveToLoad) {
// Make sure there really is haptic support!
if (mbHasHaptics && cHaptic::GetIsUsed() == false) {
- CreateMessageBoxW(_W("Error!"), _W("No haptic support found. Mouse will be used instead!\n"));
+ //CreateMessageBoxW(_W("Error!"), _W("No haptic support found. Mouse will be used instead!\n"));
mbHasHaptics = false;
}
diff --git a/engines/hpl1/penumbra-overture/IntroStory.cpp b/engines/hpl1/penumbra-overture/IntroStory.cpp
index 29cc92ea844..5bdd31e87ac 100644
--- a/engines/hpl1/penumbra-overture/IntroStory.cpp
+++ b/engines/hpl1/penumbra-overture/IntroStory.cpp
@@ -438,15 +438,15 @@ void cIntroStory::OnDraw() {
if (msCentreText != _W("")) {
float fAlpha = mvImages[5].mfBrightness;
mpFont->draw(cVector3f(400, 300, 2), 18, cColor(1, 1, 1, fAlpha),
- eFontAlign_Center, msCentreText.c_str());
+ eFontAlign_Center, msCentreText);
mpFont->draw(cVector3f(400 + 1, 300 + 1, 1), 18, cColor(0, fAlpha),
- eFontAlign_Center, msCentreText.c_str());
+ eFontAlign_Center, msCentreText);
mpFont->draw(cVector3f(400 - 1, 300 - 1, 1), 18, cColor(0, fAlpha),
- eFontAlign_Center, msCentreText.c_str());
+ eFontAlign_Center, msCentreText);
mpFont->draw(cVector3f(400 - 1, 300 + 1, 1), 18, cColor(0, fAlpha),
- eFontAlign_Center, msCentreText.c_str());
+ eFontAlign_Center, msCentreText);
mpFont->draw(cVector3f(400 + 1, 300 - 1, 1), 18, cColor(0, fAlpha),
- eFontAlign_Center, msCentreText.c_str());
+ eFontAlign_Center, msCentreText);
}
// mpFont->DrawWordWrap(vPos + cVector3f(3,3,-1),760,21,vSize,cColor(1,0),eFontAlign_Left,msMessage);
diff --git a/engines/hpl1/penumbra-overture/Inventory.cpp b/engines/hpl1/penumbra-overture/Inventory.cpp
index 461f08f41f8..4b3dfb3f745 100644
--- a/engines/hpl1/penumbra-overture/Inventory.cpp
+++ b/engines/hpl1/penumbra-overture/Inventory.cpp
@@ -211,10 +211,10 @@ void cInventorySlot::OnDraw() {
if (pType && pType->GetString(mpItem) != _W("")) {
tWString sString = pType->GetString(mpItem);
mpFont->draw(vPos + cVector3f(0, 0, 1), 12, cColor(1, mpInit->mpInventory->GetAlpha()), eFontAlign_Left,
- sString.c_str());
+ sString);
} else if (mpItem->HasCount()) {
mpFont->draw(vPos + cVector3f(0, 0, 1), 12, cColor(1, mpInit->mpInventory->GetAlpha()), eFontAlign_Left,
- _W("%d"), mpItem->GetCount());
+ Common::U32String::format("%d", mpItem->GetCount()));
}
}
@@ -1011,9 +1011,9 @@ void cInventory::OnDraw() {
cVector2f(800, 17 * 4 + 8 * 2), cColor(1, 1, 1, fMessAlpha * 0.92f));
mpFont->drawWordWrap(vMessPos + cVector3f(0, 0, 0), 720, 16, 17, cColor(1, 1, 1, fMessAlpha), eFontAlign_Left,
- msMessage.c_str());
+ msMessage);
mpFont->drawWordWrap(vMessPos + cVector3f(0, 1, -1), 720, 16, 17, cColor(0, 0, 0, fMessAlpha), eFontAlign_Left,
- msMessage.c_str());
+ msMessage);
}
//////////////////////////
@@ -1021,14 +1021,14 @@ void cInventory::OnDraw() {
if (mpInit->mpRadioHandler->IsActive() == false || mpInit->mbSubtitles == false) {
float fTextAlpha = mfAlpha * mfTextAlpha * (1 - mfMessageAlpha);
mpFont->draw(cVector3f(400, 460, 10), 19, cColor(1, 1, 1, fTextAlpha), eFontAlign_Center,
- _W("%ls"), msItemName.c_str());
+ msItemName);
mpFont->draw(cVector3f(400 + 1, 460 + 1, 9), 19, cColor(0, 0, 0, fTextAlpha), eFontAlign_Center,
- _W("%ls"), msItemName.c_str());
+ msItemName);
mpFont->drawWordWrap(cVector3f(80, 480, 10), 640, 16, 17, cColor(1, 1, 1, fTextAlpha), eFontAlign_Left,
- msItemDesc.c_str());
+ msItemDesc);
mpFont->drawWordWrap(cVector3f(80 + 1, 480 + 1, 9), 640, 16, 17, cColor(0, 0, 0, fTextAlpha), eFontAlign_Left,
- msItemDesc.c_str());
+ msItemDesc);
}
}
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 232b0900537..eafb27adfd2 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -162,13 +162,13 @@ void cMainMenuWidget_MainButton::OnMouseDown(eMButton aButton) {
//-----------------------------------------------------------------------
void cMainMenuWidget_MainButton::OnDraw() {
- mpFont->draw(mvPositon, mvFontSize, cColor(0.62f + mfAlpha * 0.3f, 1), eFontAlign_Center, msText.c_str());
+ mpFont->draw(mvPositon, mvFontSize, cColor(0.62f + mfAlpha * 0.3f, 1), eFontAlign_Center, msText);
float fAdd = sin(mfOverTimer) * 16.0f;
if (mfAlpha > 0) {
- mpFont->draw(mvPositon + cVector3f(fAdd, 0, -1), mvFontSize, cColor(0.56f, 0.35f * mfAlpha), eFontAlign_Center, msText.c_str());
- mpFont->draw(mvPositon + cVector3f(-fAdd, 0, -1), mvFontSize, cColor(0.56f, 0.35f * mfAlpha), eFontAlign_Center, msText.c_str());
+ mpFont->draw(mvPositon + cVector3f(fAdd, 0, -1), mvFontSize, cColor(0.56f, 0.35f * mfAlpha), eFontAlign_Center, msText);
+ mpFont->draw(mvPositon + cVector3f(-fAdd, 0, -1), mvFontSize, cColor(0.56f, 0.35f * mfAlpha), eFontAlign_Center, msText);
}
}
@@ -247,16 +247,16 @@ void cMainMenuWidget_Button::OnMouseDown(eMButton aButton) {
//-----------------------------------------------------------------------
void cMainMenuWidget_Button::OnDraw() {
- mpFont->draw(mvPositon, mvFontSize, cColor(0.62f, 1), mAlignment, msText.c_str());
+ mpFont->draw(mvPositon, mvFontSize, cColor(0.62f, 1), mAlignment, msText);
if (mfAlpha > 0) {
float fX = 0.8f + sin(mfOverTimer) * 0.2f;
- mpFont->draw(mvPositon + cVector3f(0, 0, 1), mvFontSize, cColor(0.9f, 0.95f, 1.0f, mfAlpha * fX), mAlignment, msText.c_str());
- mpFont->draw(mvPositon + cVector3f(2, 2, -1), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * fX), mAlignment, msText.c_str());
- mpFont->draw(mvPositon + cVector3f(-2, -2, -1), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * fX), mAlignment, msText.c_str());
- mpFont->draw(mvPositon + cVector3f(3, 3, -2), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * 0.5f * fX), mAlignment, msText.c_str());
- mpFont->draw(mvPositon + cVector3f(-3, -3, -2), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * 0.5f * fX), mAlignment, msText.c_str());
+ mpFont->draw(mvPositon + cVector3f(0, 0, 1), mvFontSize, cColor(0.9f, 0.95f, 1.0f, mfAlpha * fX), mAlignment, msText);
+ mpFont->draw(mvPositon + cVector3f(2, 2, -1), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * fX), mAlignment, msText);
+ mpFont->draw(mvPositon + cVector3f(-2, -2, -1), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * fX), mAlignment, msText);
+ mpFont->draw(mvPositon + cVector3f(3, 3, -2), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * 0.5f * fX), mAlignment, msText);
+ mpFont->draw(mvPositon + cVector3f(-3, -3, -2), mvFontSize, cColor(0.1f, 0.32f, 1.0f, mfAlpha * 0.5f * fX), mAlignment, msText);
}
}
@@ -309,10 +309,10 @@ void cMainMenuWidget_Text::UpdateSize() {
void cMainMenuWidget_Text::OnDraw() {
if (mfMaxWidth <= 0)
- mpFont->draw(mvPositon, mvFontSize, cColor(0.9f, 1), mAlignment, _W("%ls"), msText.c_str());
+ mpFont->draw(mvPositon, mvFontSize, cColor(0.9f, 1), mAlignment, msText);
else
mpFont->drawWordWrap(mvPositon, mfMaxWidth, mvFontSize.y + 1,
- mvFontSize, cColor(0.9f, 1), mAlignment, msText.c_str());
+ mvFontSize, cColor(0.9f, 1), mAlignment, msText);
}
//-----------------------------------------------------------------------
@@ -503,12 +503,12 @@ void cMainMenuWidget_List::OnDraw() {
break;
if (mlSelected ==(int)i) {
- mpFont->draw(vPos, mvFontSize, cColor(0.95f, 1), eFontAlign_Left, mvEntries[i].c_str());
+ mpFont->draw(vPos, mvFontSize, cColor(0.95f, 1), eFontAlign_Left, mvEntries[i]);
mpDrawer->DrawGfxObject(mpBackGfx, vPos + cVector3f(0, 2, -1),
cVector2f(mvSize.x - 5, mvFontSize.y),
cColor(0.0f, 0.0f, 0.73f, 1));
} else
- mpFont->draw(vPos, mvFontSize, cColor(0.7f, 1), eFontAlign_Left, mvEntries[i].c_str());
+ mpFont->draw(vPos, mvFontSize, cColor(0.7f, 1), eFontAlign_Left, mvEntries[i]);
vPos.y += mvFontSize.y + 2;
}
@@ -733,7 +733,7 @@ public:
if (lSelected < 0)
return;
- tWString sFile = msDir + _W("/") + gvSaveGameFileVec[mlNum][lSelected];
+ tWString sFile = msDir + Common::U32String("/") + gvSaveGameFileVec[mlNum][lSelected];
mpInit->mpMainMenu->SetActive(false);
mpInit->ResetGame(true);
@@ -783,7 +783,7 @@ public:
return;
tWString originalName = gvSaveGameFileVec[mlNum][lSelected];
- tWString newName = _W("favorite-") + cString::SubW(originalName, originalName.find_first_of('.') + 1);
+ tWString newName = _W("favorite-") + cString::SubW(originalName, originalName.find('.') + 1);
Hpl1::logInfo(Hpl1::kDebugSaves, "adding save %s to favourites\n", cString::To8Char(newName).c_str());
Common::String originalFile(Hpl1::g_engine->mapInternalSaveToFile(cString::To8Char(originalName).c_str()));
Common::String newFile(Hpl1::g_engine->createSaveFile(cString::To8Char(newName).c_str()));
@@ -1800,7 +1800,7 @@ void cMainMenu::OnDraw() {
// Draw tip
if (msButtonTip != _W("")) {
mpTipFont->drawWordWrap(cVector3f(10, 570, 150), 780, 13, 12, cColor(1, 1),
- eFontAlign_Left, msButtonTip.c_str());
+ eFontAlign_Left, msButtonTip);
}
////////////////////////////////
@@ -2487,7 +2487,7 @@ void cMainMenu::CreateWidgets() {
vPos.y += 46 + 30;
vPos.x += 15;
- tWString sDir = _W("spot:");
+ tWString sDir("spot:");
if (i == 1)
sDir = _W("auto:");
else if (i == 2)
@@ -2515,7 +2515,7 @@ void cMainMenu::CreateWidgets() {
gvSaveGameFileVec[i].push_back(sFile);
- sFile = cString::SubW(sFile, sFile.find_first_of(_W(":")) + 1);
+ sFile = cString::SubW(sFile, sFile.find(':') + 1);
gpSaveGameList[i]->AddEntry(sFile);
// gpSaveGameList[i]->AddEntry(sFile);
}
@@ -2701,63 +2701,63 @@ void cMainMenu::CreateWidgets() {
vPos.y += 46;
vPos.x += 15;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pTempTextWidget);
pWidgetKeyButton = hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Forward:"),
18, eFontAlign_Left, pTempTextWidget, "Forward"));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pWidgetKeyButton);
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pTempTextWidget);
pWidgetKeyButton = hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Backward:"),
18, eFontAlign_Left, pTempTextWidget, "Backward"));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pWidgetKeyButton);
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pTempTextWidget);
pWidgetKeyButton = hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Strafe Left:"),
18, eFontAlign_Left, pTempTextWidget, "Left"));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pWidgetKeyButton);
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pTempTextWidget);
pWidgetKeyButton = hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Strafe Right:"),
18, eFontAlign_Left, pTempTextWidget, "Right"));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pWidgetKeyButton);
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pTempTextWidget);
pWidgetKeyButton = hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Run:"),
18, eFontAlign_Left, pTempTextWidget, "Run"));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pWidgetKeyButton);
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pTempTextWidget);
pWidgetKeyButton = hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Crouch:"),
18, eFontAlign_Left, pTempTextWidget, "Crouch"));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pWidgetKeyButton);
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pTempTextWidget);
pWidgetKeyButton = hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Jump:"),
18, eFontAlign_Left, pTempTextWidget, "Jump"));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pWidgetKeyButton);
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pTempTextWidget);
pWidgetKeyButton = hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Lean Left:"),
18, eFontAlign_Left, pTempTextWidget, "LeanLeft"));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pWidgetKeyButton);
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMove, pTempTextWidget);
pWidgetKeyButton = hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Lean Right:"),
18, eFontAlign_Left, pTempTextWidget, "LeanRight"));
@@ -2771,31 +2771,31 @@ void cMainMenu::CreateWidgets() {
vPos.y += 46;
vPos.x += 15;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupAction, pTempTextWidget);
AddWidgetToState(eMainMenuState_OptionsKeySetupAction, hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Interact:"),
18, eFontAlign_Left, pTempTextWidget, "Interact")));
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupAction, pTempTextWidget);
AddWidgetToState(eMainMenuState_OptionsKeySetupAction, hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Examine:"),
18, eFontAlign_Left, pTempTextWidget, "Examine")));
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupAction, pTempTextWidget);
AddWidgetToState(eMainMenuState_OptionsKeySetupAction, hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "InteractMode:"),
18, eFontAlign_Left, pTempTextWidget, "InteractMode")));
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupAction, pTempTextWidget);
AddWidgetToState(eMainMenuState_OptionsKeySetupAction, hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Holster:"),
18, eFontAlign_Left, pTempTextWidget, "Holster")));
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupAction, pTempTextWidget);
AddWidgetToState(eMainMenuState_OptionsKeySetupAction, hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "LookMode:"),
18, eFontAlign_Left, pTempTextWidget, "LookMode")));
@@ -2808,31 +2808,31 @@ void cMainMenu::CreateWidgets() {
vPos.y += 46;
vPos.x += 15;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMisc, pTempTextWidget);
AddWidgetToState(eMainMenuState_OptionsKeySetupMisc, hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Inventory:"),
18, eFontAlign_Left, pTempTextWidget, "Inventory")));
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMisc, pTempTextWidget);
AddWidgetToState(eMainMenuState_OptionsKeySetupMisc, hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Notebook:"),
18, eFontAlign_Left, pTempTextWidget, "NoteBook")));
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMisc, pTempTextWidget);
AddWidgetToState(eMainMenuState_OptionsKeySetupMisc, hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Pers. Notes:"),
18, eFontAlign_Left, pTempTextWidget, "PersonalNotes")));
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMisc, pTempTextWidget);
AddWidgetToState(eMainMenuState_OptionsKeySetupMisc, hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Flashlight:"),
18, eFontAlign_Left, pTempTextWidget, "Flashlight")));
vPos.y += 23;
- pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), _W(""), 18, eFontAlign_Left));
+ pTempTextWidget = hplNew(cMainMenuWidget_Text, (mpInit, vPos + cVector3f(fKeyTextXAdd, 0, 0), Common::U32String(), 18, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsKeySetupMisc, pTempTextWidget);
AddWidgetToState(eMainMenuState_OptionsKeySetupMisc, hplNew(cMainMenuWidget_KeyButton, (mpInit, vPos, kTranslate("MainMenu", "Glowstick:"),
18, eFontAlign_Left, pTempTextWidget, "GlowStick")));
diff --git a/engines/hpl1/penumbra-overture/MapLoadText.cpp b/engines/hpl1/penumbra-overture/MapLoadText.cpp
index 7280b7b003c..8fdfae8f9e9 100644
--- a/engines/hpl1/penumbra-overture/MapLoadText.cpp
+++ b/engines/hpl1/penumbra-overture/MapLoadText.cpp
@@ -93,25 +93,25 @@ void cMapLoadText::DrawText(bool abLoading) {
cVector3f vStart(25, 250.0f - 17.0f * (float)mvRows.size() / 2.0f, 15);
for (size_t i = 0; i < mvRows.size(); ++i) {
mpTextFont->draw(vStart + cVector3f(0, 17.0f * (float)i, 0), 15, cColor(1, 1), // cColor(0.75f, 1, 0.75f, 1),
- eFontAlign_Left, mvRows[i].c_str());
+ eFontAlign_Left, mvRows[i]);
}
if (abLoading) {
mpTextFont->draw(cVector3f(400, 550, 25), 17, cColor(0.75f, 0.75f, 0.75f, 1),
- eFontAlign_Center, kTranslate("LoadTexts", "Loading").c_str());
+ eFontAlign_Center, kTranslate("LoadTexts", "Loading"));
} else {
tWString wsText = kTranslate("LoadTexts", "ClickToContinue");
mpTextFont->draw(cVector3f(400, 550, 25),
17, cColor(0.75f * mfAlpha, 1, 0.75f * mfAlpha, 1),
- eFontAlign_Center, wsText.c_str());
+ eFontAlign_Center, wsText);
mpTextFont->draw(cVector3f(401 + 10 * sin(mfAlpha * kPi2f), 551, 23),
17, cColor(0.1f, 0.1f, 0.1f, 0.7f),
- eFontAlign_Center, wsText.c_str());
+ eFontAlign_Center, wsText);
mpTextFont->draw(cVector3f(399 + -10 * sin(mfAlpha * kPi2f), 549, 23),
17, cColor(0.1f, 0.1f, 0.1f, 0.7f),
- eFontAlign_Center, wsText.c_str());
+ eFontAlign_Center, wsText);
}
}
diff --git a/engines/hpl1/penumbra-overture/Notebook.cpp b/engines/hpl1/penumbra-overture/Notebook.cpp
index d2be710964b..b77336c6351 100644
--- a/engines/hpl1/penumbra-overture/Notebook.cpp
+++ b/engines/hpl1/penumbra-overture/Notebook.cpp
@@ -116,16 +116,16 @@ void cNotebookState_Front::OnDraw() {
if (mvOptions[i].mfAlpha > 0) {
mpFrontFont->draw(mvOptions[i].mvPos + cVector3f(0, 0, 1), mvFontSize,
cColor(0.9f, 0.9f, 0.9f, 1.0f * mpNotebook->GetAlpha() * mvOptions[i].mfAlpha),
- eFontAlign_Center, mvOptions[i].msText.c_str());
+ eFontAlign_Center, mvOptions[i].msText);
mpDrawer->DrawGfxObject(mpTextBack, mvOptions[i].mvPos + cVector3f(-160, -2, -1),
cVector2f(320, mvFontSize.y + 15), cColor(1, mvOptions[i].mfAlpha * 0.7f));
}
mpFrontFont->draw(mvOptions[i].mvPos, mvFontSize, cColor(0.7f, 0.7f, 0.7f, 0.8f * mpNotebook->GetAlpha()),
- eFontAlign_Center, mvOptions[i].msText.c_str());
+ eFontAlign_Center, mvOptions[i].msText);
mpFrontFont->draw(mvOptions[i].mvPos + cVector3f(1, 1, -1), mvFontSize, cColor(0.0f, 0.0f, 0.0f, 0.8f * mpNotebook->GetAlpha()),
- eFontAlign_Center, mvOptions[i].msText.c_str());
+ eFontAlign_Center, mvOptions[i].msText);
}
}
@@ -299,7 +299,7 @@ void cNotebookState_TaskList::OnDraw() {
mpTextFont->draw(vPos + cVector3f(-12, 0, 0), 14, cColor(0.0f, 0.0f, 0.0f, 0.9f), eFontAlign_Left,
_W("-"));
- int lRows = mpTextFont->drawWordWrap(vPos, 308, 15, 14, cColor(0.0f, 0.0f, 0.0f, 0.9f), eFontAlign_Left, pTask->msText.c_str());
+ int lRows = mpTextFont->drawWordWrap(vPos, 308, 15, 14, cColor(0.0f, 0.0f, 0.0f, 0.9f), eFontAlign_Left, pTask->msText);
vPos.y += 30.0f + (float)lRows * 15.0f;
@@ -309,7 +309,7 @@ void cNotebookState_TaskList::OnDraw() {
//////////////////////////////////
// Page number
mpTextFont->draw(cVector3f(400, 490, 16), 15, cColor(0.05f, mpNotebook->GetAlpha()), eFontAlign_Center,
- _W("%d"), mlCurrentPage + 1);
+ Common::U32String::format("%d", mlCurrentPage + 1));
//////////////////////////////////
// Draw arrows back and forward
@@ -524,7 +524,7 @@ void cNotebookState_NoteList::OnDraw() {
if (pNote->mfAlpha < 1) {
float fAlpha = 0.9f * mpNotebook->GetAlpha() * (1 - pNote->mfAlpha);
- mpTextFont->draw(vTextPos, mvSize, cColor(0, fAlpha), eFontAlign_Left, pNote->msName.c_str());
+ mpTextFont->draw(vTextPos, mvSize, cColor(0, fAlpha), eFontAlign_Left, pNote->msName);
}
if (pNote->mfAlpha > 0) {
@@ -536,7 +536,7 @@ void cNotebookState_NoteList::OnDraw() {
mpDrawer->DrawGfxObject(mpTextBack, vPos, vSize, cColor(1, fAlpha * 0.7f));
- mpTextFont->draw(vTextPos, mvSize, cColor(0.85f, fAlpha), eFontAlign_Left, pNote->msName.c_str());
+ mpTextFont->draw(vTextPos, mvSize, cColor(0.85f, fAlpha), eFontAlign_Left, pNote->msName);
}
lCount++;
@@ -545,7 +545,7 @@ void cNotebookState_NoteList::OnDraw() {
//////////////////////////////////
// Page number
mpTextFont->draw(cVector3f(400, 490, 16), 17, cColor(0.05f, mpNotebook->GetAlpha()), eFontAlign_Center,
- _W("%d"), (mlFirstNote / 11) + 1);
+ Common::U32String::format("%d", (mlFirstNote / 11) + 1));
//////////////////////////////////
// Draw arrows back and forward
@@ -741,7 +741,7 @@ void cNotebookState_Note::OnDraw() {
cVector3f vPos(235, 107, 70);
for (int i = mvPages[mlCurrentPage].mlStart; i < mvPages[mlCurrentPage].mlEnd; ++i) {
mpTextFont->draw(vPos, mvSize, cColor(0, 1.0f * mpNotebook->GetAlpha()),
- eFontAlign_Left, mvRows[i].c_str());
+ eFontAlign_Left, mvRows[i]);
vPos.y += mvSize.y + 2;
}
@@ -749,7 +749,7 @@ void cNotebookState_Note::OnDraw() {
//////////////////////////////////
// Page number
mpTextFont->draw(cVector3f(400, 490, 16), 15, cColor(0.05f, mpNotebook->GetAlpha()), eFontAlign_Center,
- _W("%d"), mlCurrentPage + 1);
+ Common::U32String::format("%d", mlCurrentPage + 1));
//////////////////////////////////
// Draw arrows back and forward
diff --git a/engines/hpl1/penumbra-overture/NumericalPanel.cpp b/engines/hpl1/penumbra-overture/NumericalPanel.cpp
index 766d70a33fc..703fb4529ee 100644
--- a/engines/hpl1/penumbra-overture/NumericalPanel.cpp
+++ b/engines/hpl1/penumbra-overture/NumericalPanel.cpp
@@ -96,10 +96,10 @@ void cNumericalButton::OnDraw() {
if (mbOver && mpPanel->mbMouseIsDown) {
mpInit->mpDefaultFont->draw(vFontPos + cVector3f(1, 1, 0), 17, cColor(0, 0, 0, 0.9f * mpPanel->mfAlpha), eFontAlign_Center,
- sChar.c_str());
+ sChar);
} else {
mpInit->mpDefaultFont->draw(vFontPos, 17, cColor(0, 0, 0, 0.9f * mpPanel->mfAlpha), eFontAlign_Center,
- sChar.c_str());
+ sChar);
}
}
diff --git a/engines/hpl1/penumbra-overture/Player.cpp b/engines/hpl1/penumbra-overture/Player.cpp
index 83d655b3c8e..444a306d1c6 100644
--- a/engines/hpl1/penumbra-overture/Player.cpp
+++ b/engines/hpl1/penumbra-overture/Player.cpp
@@ -1495,8 +1495,8 @@ void cPlayer::OnDraw() {
// DEBUG: health
if (mbShowHealth) {
- mpFont->draw(cVector3f(5, 5, 0), 12, cColor(1, 1, 1, 1), eFontAlign_Left, _W("Health: %.0f"),
- mfHealth);
+ mpFont->draw(cVector3f(5, 5, 0), 12, cColor(1, 1, 1, 1), eFontAlign_Left, Common::U32String::format("Health: %.0f",
+ mfHealth));
}
// DEBUG: misc
@@ -1534,7 +1534,7 @@ void cPlayer::OnDraw() {
vEntries.push_back(&(*it));
}
- mpFont->draw(cVector3f(5, 18, 0), 10, cColor(1, 1, 1, 1), eFontAlign_Left, _W("Num of sounds: %d"), vSoundNames.size() - 1);
+ mpFont->draw(cVector3f(5, 18, 0), 10, cColor(1, 1, 1, 1), eFontAlign_Left, Common::U32String::format("Num of sounds: %d", vSoundNames.size() - 1));
int lRow = 0, lCol = 0;
for (int i = 0; i < (int)vSoundNames.size(); i++) {
@@ -1545,8 +1545,7 @@ void cPlayer::OnDraw() {
continue;
}
mpFont->draw(cVector3f((float)lCol * 250, 26 + (float)lRow * 11, 0), 10, cColor(1, 1, 1, 1), eFontAlign_Left,
- _W("%ls(%.2f (%.2f %.2f)->%.2f"), cString::To16Char(vSoundNames[i]).c_str(),
- //_W("%ls(%.2f (%.2f %.2f)->%.2f %d %.2f/%.2f)"),cString::To16Char(vSoundNames[i]).c_str(),
+ Common::U32String::format("%S(%.2f (%.2f %.2f)->%.2f", cString::To16Char(vSoundNames[i]).c_str(),
pEntry->mpSound->GetVolume(),
pEntry->mfNormalVolumeMul,
pEntry->mfNormalVolumeFadeSpeed,
@@ -1555,7 +1554,7 @@ void cPlayer::OnDraw() {
pEntry->mpSound->GetElapsedTime(),
pEntry->mpSound->GetTotalTime()
- );
+ ));
// pEntry->mpSound->GetPriority(),
// pEntry->mpSound->IsBufferUnderrun()?1:0);
@@ -1572,13 +1571,13 @@ void cPlayer::OnDraw() {
if (pMusic) {
iSoundChannel *pChannel = pMusic->mpStream;
mpFont->draw(cVector3f(5, 18 + 70, 0), 10, cColor(1, 1, 1, 1), eFontAlign_Left,
- _W("Music: '%ls' vol: %.2f playing: %d prio: %d elapsed: %.2f total time: %.2f"),
+ Common::U32String::format("Music: '%S' vol: %.2f playing: %d prio: %d elapsed: %.2f total time: %.2f",
cString::To16Char(pChannel->GetData()->GetName()).c_str(),
pChannel->GetVolume(),
pChannel->IsPlaying(),
pChannel->GetPriority(),
pChannel->GetElapsedTime(),
- pChannel->GetTotalTime());
+ pChannel->GetTotalTime()));
}
}
diff --git a/engines/hpl1/penumbra-overture/PreMenu.cpp b/engines/hpl1/penumbra-overture/PreMenu.cpp
index 4411e5718c2..09fd82a0fc3 100644
--- a/engines/hpl1/penumbra-overture/PreMenu.cpp
+++ b/engines/hpl1/penumbra-overture/PreMenu.cpp
@@ -56,7 +56,7 @@ cPreMenu::cPreMenu(cInit *apInit) : iUpdateable("PreMenu") {
mlMaxChars = 0;
for (size_t i = 0; i < mvTextRows.size(); ++i)
- mlMaxChars += (int)mvTextRows[i].length();
+ mlMaxChars += (int)mvTextRows[i].size();
Reset();
}
@@ -216,22 +216,22 @@ void cPreMenu::OnDraw() {
int lCharCount = 0;
for (size_t i = 0; i < mvTextRows.size(); ++i) {
lPrevStart = lCharCount;
- lCharCount += (int)mvTextRows[i].length();
+ lCharCount += (int)mvTextRows[i].size();
if (lCharCount >= mlCurrentTextChar) {
tWString sText = mvTextRows[i].substr(0, mlCurrentTextChar - lPrevStart);
mpTextFont->draw(cVector3f(25, 90 + 19 * (float)i, 10) + mvecLastTextPos, 17 + mfLastTextSize, cColor(mfLastTextColor, mfFontColor, mfFontColor, 1), // cColor(0.7f,1,0.7f,1),
- eFontAlign_Left, sText.c_str());
+ eFontAlign_Left, sText);
if (mlState == 5) {
// First pair of shadow texts
mpTextFont->draw(cVector3f(25 + mfLastTextSpeed1, 90 + 19 * (float)i, 0) + mvecLastTextPos, 17 + (mfLastTextSize), cColor(mfLastTextColor + 0.5f, 0, 0, 0.25f), // cColor(0.7f,1,0.7f,1),
- eFontAlign_Left, sText.c_str());
+ eFontAlign_Left, sText);
mpTextFont->draw(cVector3f(25 + 1.5f * mfLastTextSpeed1, 90 + 19 * (float)i, 0) + mvecLastTextPos, 17 + (mfLastTextSize), cColor(mfLastTextColor + 0.5f, 0, 0, 0.20f), // cColor(0.7f,1,0.7f,1),
- eFontAlign_Left, sText.c_str());
+ eFontAlign_Left, sText);
// Second pair
mpTextFont->draw(cVector3f(25 + 3 * mfLastTextSpeed1, 90 + 19 * (float)i, 0) + mvecLastTextPos, 17 + (mfLastTextSize), cColor(mfLastTextColor + 0.25f, 0, 0, 0.15f), // cColor(0.7f,1,0.7f,1),
- eFontAlign_Left, sText.c_str());
+ eFontAlign_Left, sText);
mpTextFont->draw(cVector3f(25 + 5 * mfLastTextSpeed1, 90 + 19 * (float)i, 0) + mvecLastTextPos, 17 + (mfLastTextSize), cColor(mfLastTextColor + 0.25f, 0, 0, 0.1f), // cColor(0.7f,1,0.7f,1),
- eFontAlign_Left, sText.c_str());
+ eFontAlign_Left, sText);
// mpTextFont->Draw(cVector3f(25-mfLastTextPos,90+19*(float)i-mfLastTextPos,0),cVector2f(17,17+(mfLastTextSize)),cColor(mfLastTextColor,mfFontColor,mfFontColor,0.25f),//cColor(0.7f,1,0.7f,1),
// eFontAlign_Left,sText.c_str());
@@ -240,7 +240,7 @@ void cPreMenu::OnDraw() {
break;
} else {
mpTextFont->draw(cVector3f(25, 90 + 19 * (float)i, 10), 17, cColor(mfFontColor, mfFontColor), // cColor(0.7f,1,0.7f,1),
- eFontAlign_Left, mvTextRows[i].c_str());
+ eFontAlign_Left, mvTextRows[i]);
}
}
}
@@ -365,7 +365,7 @@ void cPreMenu::Update(float afTimeStep) {
int lCharCount = 0;
for (size_t i = 0; i < mvTextRows.size(); ++i) {
- lCharCount += (int)mvTextRows[i].length();
+ lCharCount += (int)mvTextRows[i].size();
if (lCharCount == mlCurrentTextChar) {
if (i + 1 < mvTextRows.size() && mvTextRows[i + 1].size() == 0) {
mfNewCharCount = 1.0f;
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index 69b8cacffea..37cb22e72e9 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -565,8 +565,7 @@ void cSaveHandler::AutoSave(const tWString &asDir, int alMaxSaves) {
sMapName = cString::ReplaceCharToW(sMapName, _W("\n"), _W(" "));
sMapName = cString::ReplaceCharToW(sMapName, _W(":"), _W(" "));
cDate date = mpInit->mpGame->GetSystem()->GetLowLevel()->getDate();
- wchar_t sTemp[512];
- swprintf(sTemp, 512, _W("%ls: %ls %d-%02d-%02d %02d:%02d:%02d"),
+ tWString sFile = Common::U32String::format("%S: %S %d-%02d-%02d %02d:%02d:%02d",
asDir.c_str(),
sMapName.c_str(),
date.year,
@@ -575,7 +574,6 @@ void cSaveHandler::AutoSave(const tWString &asDir, int alMaxSaves) {
date.hours,
date.minutes,
date.seconds);
- tWString sFile = sTemp;
SaveGameToFile(sFile);
mpInit->mpGame->ResetLogicTimer();
Commit: a4cfa2657f48b2d1467476c5452589e6203b380d
https://github.com/scummvm/scummvm/commit/a4cfa2657f48b2d1467476c5452589e6203b380d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:09+01:00
Commit Message:
HPL1: remove temporary string compatibility fixes
Changed paths:
engines/hpl1/engine/graphics/bitmap2D.cpp
engines/hpl1/engine/graphics/font_data.cpp
engines/hpl1/engine/impl/OpenALSoundData.cpp
engines/hpl1/engine/impl/SqScript.cpp
engines/hpl1/engine/resources/ConfigFile.cpp
engines/hpl1/engine/resources/low_level_resources.cpp
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/engine/system/low_level_system.cpp
engines/hpl1/hpl1.cpp
engines/hpl1/penumbra-overture/Init.cpp
engines/hpl1/penumbra-overture/SaveHandler.cpp
diff --git a/engines/hpl1/engine/graphics/bitmap2D.cpp b/engines/hpl1/engine/graphics/bitmap2D.cpp
index c0a4f0ee3b1..9cf19bb590c 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.cpp
+++ b/engines/hpl1/engine/graphics/bitmap2D.cpp
@@ -32,9 +32,8 @@
namespace hpl {
static Image::ImageDecoder *loadImage(const tString &filepath, Image::ImageDecoder *decoder) {
- //FIXME: string types
Common::File imgFile;
- if (!imgFile.open(filepath.c_str()))
+ if (!imgFile.open(filepath))
error("Could not open file: %s", filepath.c_str());
if (!decoder->loadStream(imgFile))
error("Could not load image at %s", filepath.c_str());
diff --git a/engines/hpl1/engine/graphics/font_data.cpp b/engines/hpl1/engine/graphics/font_data.cpp
index dc43d5f7ec7..bbcb897fd65 100644
--- a/engines/hpl1/engine/graphics/font_data.cpp
+++ b/engines/hpl1/engine/graphics/font_data.cpp
@@ -148,9 +148,7 @@ void FontData::loadGlyphs(const TiXmlElement *charsRoot, BitmapArray &bitmaps, c
loadNextGlyph(charIt, bitmaps, fontSize);
}
-bool FontData::createFromBitmapFile(const tString &file) {
- // FIXME: string types
- Common::String filename = file.c_str();
+bool FontData::createFromBitmapFile(const tString &filename) {
Common::ScopedPtr<TiXmlDocument> xmlDoc = loadFontXML(filename);
if (!xmlDoc)
return false;
diff --git a/engines/hpl1/engine/impl/OpenALSoundData.cpp b/engines/hpl1/engine/impl/OpenALSoundData.cpp
index 2234570f8be..5d84e607f27 100644
--- a/engines/hpl1/engine/impl/OpenALSoundData.cpp
+++ b/engines/hpl1/engine/impl/OpenALSoundData.cpp
@@ -57,8 +57,7 @@ cOpenALSoundData::~cOpenALSoundData() {
//-----------------------------------------------------------------------
bool cOpenALSoundData::CreateFromFile(const tString &filename) {
- // FIXME: string types
- _filename = filename.c_str();
+ _filename = filename;
return true;
}
diff --git a/engines/hpl1/engine/impl/SqScript.cpp b/engines/hpl1/engine/impl/SqScript.cpp
index e571e482e85..3ec89464a33 100644
--- a/engines/hpl1/engine/impl/SqScript.cpp
+++ b/engines/hpl1/engine/impl/SqScript.cpp
@@ -134,8 +134,7 @@ bool cSqScript::Run(int alHandle) {
char *cSqScript::LoadCharBuffer(const tString &asFileName, int &alLength) {
Common::File file;
- // FIXME: use proper string types
- file.open(asFileName.c_str());
+ file.open(asFileName);
if (!file.isOpen()) {
debugCN(Hpl1::kDebugLevelError, Hpl1::kDebugFilePath,
"script file at %s could not be opened", asFileName.c_str());
diff --git a/engines/hpl1/engine/resources/ConfigFile.cpp b/engines/hpl1/engine/resources/ConfigFile.cpp
index 84cd1650517..9d71b300a83 100644
--- a/engines/hpl1/engine/resources/ConfigFile.cpp
+++ b/engines/hpl1/engine/resources/ConfigFile.cpp
@@ -61,10 +61,9 @@ cConfigFile::~cConfigFile() {
bool cConfigFile::Load() {
Common::File cf;
- //FIXME: use proper string types
- if (!cf.open(cString::To8Char(msFile).c_str())) {
- debugCN(Hpl1::kDebugLevelWarning, Hpl1::kDebugFilePath, "file %s could not be opened", cString::To8Char(msFile).c_str());
- return false;
+ if (!cf.open(cString::To8Char(msFile))) {
+ debugCN(Hpl1::kDebugLevelWarning, Hpl1::kDebugFilePath, "file %s could not be opened", cString::To8Char(msFile).c_str());
+ return false;
}
return mpXmlDoc->LoadFile(cf);
}
@@ -72,7 +71,6 @@ bool cConfigFile::Load() {
//-----------------------------------------------------------------------
bool cConfigFile::Save() {
- //FIXME: use proper string types
return mpXmlDoc->SaveFile(cString::To8Char(msFile).c_str());
}
diff --git a/engines/hpl1/engine/resources/low_level_resources.cpp b/engines/hpl1/engine/resources/low_level_resources.cpp
index 9b290da6344..db7297fc853 100644
--- a/engines/hpl1/engine/resources/low_level_resources.cpp
+++ b/engines/hpl1/engine/resources/low_level_resources.cpp
@@ -31,13 +31,11 @@
namespace hpl {
-static tString getImageType(const tString &filepath) {
- //FIXME: use proper string types
- Common::String str(filepath.c_str());
- str.toLowercase();
- size_t pos = str.findLastOf(".");
+static tString getImageType(tString filepath) {
+ filepath.toLowercase();
+ size_t pos = filepath.findLastOf(".");
if (pos != Common::String::npos)
- return str.substr(pos + 1).c_str();
+ return filepath.substr(pos + 1).c_str();
return "";
}
@@ -66,14 +64,13 @@ void LowLevelResources::addVideoLoaders(cVideoManager *vm) {
}
void LowLevelResources::findFilesInDir(tStringList &alstStrings, tString asDir, tString asMask) {
- //FIXME: use consistent string types
- Common::String pattern = Common::String(asDir.c_str()) + '/' + Common::String(asMask.c_str());
- Common::ArchiveMemberList ls;
- if (SearchMan.listMatchingMembers(ls, pattern) == 0)
- debugCN(Hpl1::kDebugLevelWarning, Hpl1::kDebugFilePath, "no files matching pattern %s were found", pattern.c_str());
-
- for (auto f : ls)
- alstStrings.push_back(f->getName().c_str());
+ Common::String pattern = asDir + '/' + asMask;
+ Common::ArchiveMemberList ls;
+ if (SearchMan.listMatchingMembers(ls, pattern) == 0)
+ Hpl1::logWarning(Hpl1::kDebugFilePath, "no files matching pattern %s were found", pattern.c_str());
+
+ for (auto &f : ls)
+ alstStrings.push_back(f->getName());
}
} // namespace hpl
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index 4a2d0e61fb5..0aea72fc0a2 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -190,13 +190,11 @@ void cSerializeClass::PrintMembers(iSerializable *apData) {
//-----------------------------------------------------------------------
-bool cSerializeClass::SaveToFile(iSerializable *apData, const tWString &asFile, const tString &asRoot) {
+bool cSerializeClass::SaveToFile(iSerializable *apData, const tWString &saveFile, const tString &asRoot) {
SetUpData();
glTabs = 0;
- // FIXME: string types
- Common::String saveDesc(cString::To8Char(asFile).c_str());
- Common::String filename(Hpl1::g_engine->createSaveFile(saveDesc));
+ Common::String filename(Hpl1::g_engine->createSaveFile(saveFile));
TiXmlDocument pXmlDoc;
// Create root
TiXmlElement XmlRoot(asRoot.c_str());
@@ -211,7 +209,7 @@ bool cSerializeClass::SaveToFile(iSerializable *apData, const tWString &asFile,
Hpl1::logError(Hpl1::kDebugSaves, "couldn't save to file '%s'\n", filename.c_str());
return false;
}
- g_engine->getMetaEngine()->appendExtendedSave(savefile.get(), g_engine->getTotalPlayTime(), saveDesc, filename.contains("auto"));
+ g_engine->getMetaEngine()->appendExtendedSave(savefile.get(), g_engine->getTotalPlayTime(), saveFile, filename.contains("auto"));
return true;
}
@@ -279,8 +277,7 @@ bool cSerializeClass::LoadFromFile(iSerializable *apData, const tWString &asFile
// Load document
TiXmlDocument pXmlDoc;
- // FIXME: string types
- Common::String filename(Hpl1::g_engine->mapInternalSaveToFile(cString::To8Char(asFile).c_str()));
+ Common::String filename(Hpl1::g_engine->mapInternalSaveToFile(asFile));
Common::ScopedPtr<Common::InSaveFile> saveFile(g_engine->getSaveFileManager()->openForLoading(filename));
if (!saveFile) {
Hpl1::logError(Hpl1::kDebugSaves | Hpl1::kDebugResourceLoading, "save file %s could not be opened\n", filename.c_str());
@@ -294,7 +291,7 @@ bool cSerializeClass::LoadFromFile(iSerializable *apData, const tWString &asFile
g_engine->setTotalPlayTime(header.playtime);
if (pXmlDoc.LoadFile(*saveFile) == false) {
Hpl1::logError(Hpl1::kDebugResourceLoading | Hpl1::kDebugSaves,
- "Couldn't load saved class file '%s' from %s!\n", cString::To8Char(asFile).c_str(),
+ "Couldn't load saved class file '%S' from %s!\n", asFile.c_str(),
pXmlDoc.ErrorDesc());
return false;
}
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index 6cadcda1cdc..68ea8fa7717 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -145,8 +145,7 @@ void CreateMessageBoxW(const wchar_t *caption, const wchar_t *fmt, ...) {
//-----------------------------------------------------------------------
void OpenBrowserWindow(const tWString &URL) {
- // FIXME: use proper string types
- g_system->openUrl(cString::To8Char(URL).c_str());
+ g_system->openUrl(URL);
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index d2122cd4586..76756f191a0 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -138,8 +138,7 @@ Common::StringArray Hpl1Engine::listInternalSaves(const Common::String &pattern)
Common::Error Hpl1Engine::loadGameState(int slot) {
SaveStateDescriptor a = getMetaEngine()->querySaveMetaInfos(_targetName.c_str(), slot);
_gameInit->mpMainMenu->SetActive(false);
- // FIXME: strings
- _gameInit->mpSaveHandler->LoadGameFromFile(cString::To16Char(Common::String(a.getDescription()).c_str()));
+ _gameInit->mpSaveHandler->LoadGameFromFile(a.getDescription());
return Common::kNoError;
}
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 9db327d9d86..378c8def580 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -241,7 +241,7 @@ static bool getBoolConfig(const char *name, const bool defaultVal) {
static tString getStringConfig(const char *name, const tString &defaultVal) {
if (ConfMan.hasKey(name))
- return ConfMan.get(name).c_str(); // FIXME: strings
+ return ConfMan.get(name);
return defaultVal;
}
@@ -747,7 +747,7 @@ void cInit::Exit() {
ConfMan.setInt("screen-width", mvScreenSize.x);
ConfMan.setInt("screen-height", mvScreenSize.y);
- ConfMan.set("global_script", msGlobalScriptFile.c_str()); // FIXME: strings
+ ConfMan.set("global_script", msGlobalScriptFile);
ConfMan.setBool("simple_weapon_swing", mbSimpleWeaponSwing);
ConfMan.setBool("disable_personal_notes", mbDisablePersonalNotes);
@@ -755,8 +755,8 @@ void cInit::Exit() {
ConfMan.setBool("flash_tems", mbFlashItems);
ConfMan.setBool("show_crosshair", mbShowCrossHair);
- ConfMan.set("starting_map", msStartMap.c_str()); // FIXME: strings
- ConfMan.set("starting_map_position", msStartLink.c_str()); // FIXME: strings
+ ConfMan.set("starting_map", msStartMap);
+ ConfMan.set("starting_map_position", msStartLink);
ConfMan.setInt("difficulty", mDifficulty);
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index 37cb22e72e9..cd9f5ca5e7e 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -658,9 +658,8 @@ void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMa
//-----------------------------------------------------------------------
tWString cSaveHandler::GetLatest(const tWString &asMask) {
- // FIXME: string types
- Common::StringArray saves = Hpl1::g_engine->listInternalSaves(cString::To8Char(asMask).c_str());
- return cString::To16Char(firstSave(saves, [](const cDate& a, const cDate &b){return a > b;}).c_str());
+ Common::StringArray saves = Hpl1::g_engine->listInternalSaves(asMask);
+ return firstSave(saves, [](const cDate& a, const cDate &b){return a > b;});
}
//-----------------------------------------------------------------------
Commit: da41603796f67a19c62b78e3a1c5ca298f2296e2
https://github.com/scummvm/scummvm/commit/da41603796f67a19c62b78e3a1c5ca298f2296e2
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:09+01:00
Commit Message:
HPL1: remove explicit string conversions
Changed paths:
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/resources/ConfigFile.cpp
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/SaveHandler.cpp
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index 115645c68e5..98fa69fd7da 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -303,7 +303,7 @@ SCRIPT_DEFINE_FUNC_3(void, SetSectorPortalActive, string, int, bool)
**/
static tString Translate(tString asCat, tString asName) {
tWString wsText = gpResources->Translate(asCat, asName);
- return cString::To8Char(wsText);
+ return wsText;
}
SCRIPT_DEFINE_FUNC_2(string, Translate, string, string)
diff --git a/engines/hpl1/engine/resources/ConfigFile.cpp b/engines/hpl1/engine/resources/ConfigFile.cpp
index 9d71b300a83..0c34e9bc3d9 100644
--- a/engines/hpl1/engine/resources/ConfigFile.cpp
+++ b/engines/hpl1/engine/resources/ConfigFile.cpp
@@ -61,8 +61,8 @@ cConfigFile::~cConfigFile() {
bool cConfigFile::Load() {
Common::File cf;
- if (!cf.open(cString::To8Char(msFile))) {
- debugCN(Hpl1::kDebugLevelWarning, Hpl1::kDebugFilePath, "file %s could not be opened", cString::To8Char(msFile).c_str());
+ if (!cf.open(Common::String(msFile))) {
+ Hpl1::logWarning(Hpl1::kDebugFilePath, "file %S could not be opened", msFile.c_str());
return false;
}
return mpXmlDoc->LoadFile(cf);
@@ -71,7 +71,7 @@ bool cConfigFile::Load() {
//-----------------------------------------------------------------------
bool cConfigFile::Save() {
- return mpXmlDoc->SaveFile(cString::To8Char(msFile).c_str());
+ return mpXmlDoc->SaveFile(Common::String(msFile).c_str());
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index eafb27adfd2..80b613546a0 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -761,7 +761,7 @@ public:
return;
tWString sFile = gvSaveGameFileVec[mlNum][lSelected];
- Hpl1::g_engine->removeSaveFile(cString::To8Char(sFile).c_str());
+ Hpl1::g_engine->removeSaveFile(sFile);
mpInit->mpMainMenu->UpdateWidgets();
}
@@ -784,9 +784,9 @@ public:
tWString originalName = gvSaveGameFileVec[mlNum][lSelected];
tWString newName = _W("favorite-") + cString::SubW(originalName, originalName.find('.') + 1);
- Hpl1::logInfo(Hpl1::kDebugSaves, "adding save %s to favourites\n", cString::To8Char(newName).c_str());
- Common::String originalFile(Hpl1::g_engine->mapInternalSaveToFile(cString::To8Char(originalName).c_str()));
- Common::String newFile(Hpl1::g_engine->createSaveFile(cString::To8Char(newName).c_str()));
+ Hpl1::logInfo(Hpl1::kDebugSaves, "adding save %S to favourites\n", newName);
+ Common::String originalFile(Hpl1::g_engine->mapInternalSaveToFile(originalName));
+ Common::String newFile(Hpl1::g_engine->createSaveFile(newName));
g_engine->getSaveFileManager()->copySavefile(originalFile, newFile);
mpInit->mpMainMenu->UpdateWidgets();
}
@@ -2498,7 +2498,7 @@ void cMainMenu::CreateWidgets() {
AddWidgetToState(state, gpSaveGameList[i]);
tTempFileAndDataSet setTempFiles;
- Common::StringArray saves = Hpl1::g_engine->listInternalSaves(cString::To8Char(sDir).c_str() + Common::String("*"));
+ Common::StringArray saves = Hpl1::g_engine->listInternalSaves(sDir + "*");
for (auto &s : saves) {
tWString sFile = cString::To16Char(s.c_str());
cDate date = cSaveHandler::parseDate(s);
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index cd9f5ca5e7e..d209679dd77 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -647,7 +647,7 @@ Common::String firstSave(const Common::StringArray &saves, DateCmp cmp) {
}
void cSaveHandler::DeleteOldestIfMax(const tWString &asDir, const tWString &asMask, int alMaxFiles) {
- const Common::StringArray saves = Hpl1::g_engine->listInternalSaves(cString::To8Char(asDir + asMask).c_str());
+ const Common::StringArray saves = Hpl1::g_engine->listInternalSaves(asDir + asMask);
if (static_cast<int>(saves.size()) > alMaxFiles) {
const Common::String oldest = firstSave(saves, [](const cDate& a, const cDate &b){return a < b;});
Hpl1::logInfo(Hpl1::kDebugSaves, "removing save %s\n", oldest.c_str());
Commit: d3b09efda9ba57353cd6c4016b04dffee2db2fd4
https://github.com/scummvm/scummvm/commit/d3b09efda9ba57353cd6c4016b04dffee2db2fd4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:10+01:00
Commit Message:
HPL1: Fix compilation
Changed paths:
engines/hpl1/penumbra-overture/MainMenu.cpp
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 80b613546a0..c67e961d18b 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -784,7 +784,7 @@ public:
tWString originalName = gvSaveGameFileVec[mlNum][lSelected];
tWString newName = _W("favorite-") + cString::SubW(originalName, originalName.find('.') + 1);
- Hpl1::logInfo(Hpl1::kDebugSaves, "adding save %S to favourites\n", newName);
+ Hpl1::logInfo(Hpl1::kDebugSaves, "adding save %S to favourites\n", newName.encode().c_str());
Common::String originalFile(Hpl1::g_engine->mapInternalSaveToFile(originalName));
Common::String newFile(Hpl1::g_engine->createSaveFile(newName));
g_engine->getSaveFileManager()->copySavefile(originalFile, newFile);
Commit: 22e9977a658e82ac21d7370daf05e0116a0d653f
https://github.com/scummvm/scummvm/commit/22e9977a658e82ac21d7370daf05e0116a0d653f
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:10+01:00
Commit Message:
HPL1: Fix Implicit Fallthrough GCC Compiler Warnings in Grid Map 2D Code
Changed paths:
engines/hpl1/engine/scene/GridMap2D.cpp
diff --git a/engines/hpl1/engine/scene/GridMap2D.cpp b/engines/hpl1/engine/scene/GridMap2D.cpp
index c015a791695..7d75dce28cf 100644
--- a/engines/hpl1/engine/scene/GridMap2D.cpp
+++ b/engines/hpl1/engine/scene/GridMap2D.cpp
@@ -233,12 +233,17 @@ void cGridMap2DRectIt::GetGridObject() {
// Log("Has NO outer!\n");
mIt = mpGridMap->m_mapOuterObjects.end();
}
+ // FIXME: fallthrough intended from here?
+ // fallthrough
} else {
mpObject = mIt->second;
// Log("Found the object in global!\n");
break;
}
}
+ // FIXME: fallthrough intended?
+ // fallthrough
+
//// OUTER OBJECTS //////////////////
case 1: {
// No need to loop this one, since they only occur once and
@@ -298,6 +303,8 @@ void cGridMap2DRectIt::GetGridObject() {
} else {
mIt = mpGridMap->mvGrids[mlGridNum].m_mapObjects.begin();
}
+ // FIXME: fallthrough intended from here?
+ // fallthrough
} else {
// Log("Found the object in outer!\n");
mpObject = mIt->second;
@@ -307,6 +314,8 @@ void cGridMap2DRectIt::GetGridObject() {
break;
}
}
+ // FIXME: fallthrough intended?
+ // fallthrough
//// GRID OBJECTS //////////////////
case 2: {
Commit: f253aac8f4e49f102bae6ce67fe12e03f6cff4f8
https://github.com/scummvm/scummvm/commit/f253aac8f4e49f102bae6ce67fe12e03f6cff4f8
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:10+01:00
Commit Message:
HPL1: Fix Fallthrough GCC Compiler Warnings in Angelscript Library Code
Changed paths:
engines/hpl1/engine/libraries/angelscript/sources/as_context.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_context.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_context.cpp
index f78677af047..85630b3508c 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_context.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_context.cpp
@@ -5781,20 +5781,25 @@ int as_powi(int base, int exponent, bool& isOverflow)
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 4:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 3:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 2:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 1:
if( exponent ) result *= base;
+ // fallthrough
default:
isOverflow = false;
return result;
@@ -5843,20 +5848,25 @@ asDWORD as_powu(asDWORD base, asDWORD exponent, bool& isOverflow)
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 4:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 3:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 2:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 1:
if( exponent ) result *= base;
+ // fallthrough
default:
isOverflow = false;
return result;
@@ -5919,24 +5929,30 @@ asINT64 as_powi64(asINT64 base, asINT64 exponent, bool& isOverflow)
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 5:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 4:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 3:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 2:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 1:
if( exponent ) result *= base;
+ // fallthrough
default:
isOverflow = false;
return result;
@@ -5985,24 +6001,30 @@ asQWORD as_powu64(asQWORD base, asQWORD exponent, bool& isOverflow)
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 5:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 4:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 3:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 2:
if( exponent & 1 ) result *= base;
exponent >>= 1;
base *= base;
+ // fallthrough
case 1:
if( exponent ) result *= base;
+ // fallthrough
default:
isOverflow = false;
return result;
Commit: f84ac3b4617a0a9989a656ec788561266fc9a915
https://github.com/scummvm/scummvm/commit/f84ac3b4617a0a9989a656ec788561266fc9a915
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:10+01:00
Commit Message:
HPL1: Fix Remaining Fallthrough GCC Compiler Warnings
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
index f08760183b5..8785a33a90e 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
@@ -1906,6 +1906,8 @@ class dgContactSolver {
}
m_vertexIndex = 2;
}
+ // FIXME: fallthrough intended?
+ // fallthrough
case 2: {
dgInt32 best = 0;
@@ -1932,6 +1934,8 @@ class dgContactSolver {
}
m_vertexIndex = 3;
}
+ // FIXME: fallthrough intended?
+ // fallthrough
default: {
const dgVector &p0 = m_hullVertex[0];
@@ -2049,6 +2053,8 @@ class dgContactSolver {
return dgMinkDisjoint;
}
}
+ // FIXME: fallthrough intended?
+ // fallthrough
case 2: {
rotMatrix.m_front = dir;
@@ -2122,10 +2128,14 @@ class dgContactSolver {
dist2 = dist3;
}
}
+ // FIXME: fallthrough intended?
+ // fallthrough
case 3: {
CalcSupportVertex(separatingPlane, 3);
}
+ // FIXME: fallthrough intended?
+ // fallthrough
}
m_vertexIndex = 4;
@@ -2261,6 +2271,8 @@ class dgContactSolver {
}
m_vertexIndex = 2;
}
+ // FIXME: fallthrough intended?
+ // fallthrough
case 2: {
dgInt32 best = 0;
@@ -2288,6 +2300,8 @@ class dgContactSolver {
}
m_vertexIndex = 3;
}
+ // FIXME: fallthrough intended?
+ // fallthrough
default: {
const dgBigVector &p0 = m_hullVertexLarge[0];
@@ -2412,6 +2426,8 @@ class dgContactSolver {
return dgMinkDisjoint;
}
}
+ // FIXME: fallthrough intended?
+ // fallthrough
case 2: {
rotMatrix.m_front = dir32;
@@ -2489,10 +2505,14 @@ class dgContactSolver {
dist2 = dist3;
}
}
+ // FIXME: fallthrough intended?
+ // fallthrough
case 3: {
CalcSupportVertexLarge(separatingPlane, 3);
}
+ // FIXME: fallthrough intended?
+ // fallthrough
}
m_vertexIndex = 4;
Commit: c84c49f8c214d8c3563ca91662fd624ab038a2db
https://github.com/scummvm/scummvm/commit/c84c49f8c214d8c3563ca91662fd624ab038a2db
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:10+01:00
Commit Message:
HPL1: Fix Various Shadowing GCC Compiler Warnings in Newton Physics Code
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
index 8785a33a90e..a2388980a56 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
@@ -585,9 +585,9 @@ class dgContactSolver {
p2 += clipPlane2.Scale(DG_ROBUST_PLANE_CLIP);
dgInt32 count2 = m_floatingcollision->CalculatePlaneIntersection(
clipPlane2, p2, shape2);
- dgVector err(clipPlane2.Scale(clipPlane2 % (point2 - p2)));
+ dgVector err2(clipPlane2.Scale(clipPlane2 % (point2 - p2)));
for (dgInt32 i = 0; i < count2; i++) {
- shape2[i] += err;
+ shape2[i] += err2;
}
if (count2) {
@@ -614,12 +614,12 @@ class dgContactSolver {
} else if ((count1 == 2) && (count2 == 2)) {
const dgMatrix &matrix1 = m_proxy->m_referenceMatrix;
- dgVector p0(shape1[0]);
- dgVector p1(shape1[1]);
- dgVector q0(m_matrix.TransformVector(shape2[0]));
- dgVector q1(m_matrix.TransformVector(shape2[1]));
- dgVector p10(p1 - p0);
- dgVector q10(q1 - q0);
+ dgVector pp0(shape1[0]);
+ dgVector pp1(shape1[1]);
+ dgVector qq0(m_matrix.TransformVector(shape2[0]));
+ dgVector qq1(m_matrix.TransformVector(shape2[1]));
+ dgVector p10(pp1 - pp0);
+ dgVector q10(qq1 - qq0);
p10 = p10.Scale(
dgFloat32(1.0f) / dgSqrt(p10 % p10 + dgFloat32(1.0e-8f)));
q10 = q10.Scale(
@@ -630,13 +630,13 @@ class dgContactSolver {
// dgFloat32 pl1;
// dgFloat32 ql0;
// dgFloat32 ql1;
- dgFloat32 pl0 = p0 % p10;
- dgFloat32 pl1 = p1 % p10;
- dgFloat32 ql0 = q0 % p10;
- dgFloat32 ql1 = q1 % p10;
+ dgFloat32 pl0 = pp0 % p10;
+ dgFloat32 pl1 = pp1 % p10;
+ dgFloat32 ql0 = qq0 % p10;
+ dgFloat32 ql1 = qq1 % p10;
if (pl0 > pl1) {
Swap(pl0, pl1);
- Swap(p0, p1);
+ Swap(pp0, pp1);
p10 = p10.Scale(dgFloat32(-1.0f));
}
if (ql0 > ql1) {
@@ -649,12 +649,12 @@ class dgContactSolver {
dgFloat32 clip1 = (ql1 < pl1) ? ql1 : pl1;
count = 2;
- contactOut[0].m_point = p0 + p10.Scale(clip0 - pl0);
+ contactOut[0].m_point = pp0 + p10.Scale(clip0 - pl0);
contactOut[0].m_normal = matrix1.RotateVector(clipPlane);
contactOut[0].m_userId = contacID;
contactOut[0].m_penetration = dist;
- contactOut[1].m_point = p0 + p10.Scale(clip1 - pl0);
+ contactOut[1].m_point = pp0 + p10.Scale(clip1 - pl0);
contactOut[1].m_normal = matrix1.RotateVector(clipPlane);
contactOut[1].m_userId = contacID;
contactOut[1].m_penetration = dist;
@@ -664,7 +664,7 @@ class dgContactSolver {
dgVector c0;
dgVector c1;
count = 1;
- dgRayToRayDistance(p0, p1, q0, q1, c0, c1);
+ dgRayToRayDistance(pp0, pp1, qq0, qq1, c0, c1);
contactOut[0].m_point = (c0 + c1).Scale(dgFloat32(0.5f));
contactOut[0].m_normal = matrix1.RotateVector(clipPlane);
contactOut[0].m_userId = contacID;
@@ -6447,15 +6447,15 @@ dgInt32 dgWorld::FilterPolygonEdgeContacts(dgInt32 count,
for (dgInt32 i = 0; i < faceCount; i++) {
_ASSERTE(
(contact[i].m_isEdgeContact == 0) || (contact[i].m_isEdgeContact == 1));
- for (dgInt32 j = faceCount; j < count; j++) {
+ for (dgInt32 k = faceCount; k < count; k++) {
dgFloat32 dist;
- dgVector distVector(contact[i].m_point - contact[j].m_point);
+ dgVector distVector(contact[i].m_point - contact[k].m_point);
dist = distVector % distVector;
// if (dist < dgFloat32 (0.04f)) {
if (dist < dgFloat32(1.e-2f)) {
count--;
- contact[j] = contact[count];
- j--;
+ contact[k] = contact[count];
+ k--;
}
}
}
Commit: f84fcd859c1c96f94186e19a09a05ca3c6f2bda2
https://github.com/scummvm/scummvm/commit/f84fcd859c1c96f94186e19a09a05ca3c6f2bda2
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:10+01:00
Commit Message:
HPL1: Further Fixes for GCC Compiler Shadowing Warnings in Newton Physics
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
index a2388980a56..438b79e1aa4 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
@@ -1885,22 +1885,22 @@ class dgContactSolver {
dgInt32 best = 0;
dgFloat32 maxErr = dgFloat32(0.0f);
- dgInt32 i = 0;
- for (; i < dgInt32(sizeof(m_dir) / sizeof(m_dir[0])); i++) {
+ dgInt32 j = 0;
+ for (; j < dgInt32(sizeof(m_dir) / sizeof(m_dir[0])); j++) {
// dgFloat32 error2;
- CalcSupportVertex(m_dir[i], 1);
+ CalcSupportVertex(m_dir[j], 1);
dgVector e(m_hullVertex[1] - m_hullVertex[0]);
dgFloat32 error2 = e % e;
if (error2 > dgFloat32(1.0e-4f)) {
break;
}
if (error2 > maxErr) {
- best = i;
+ best = j;
maxErr = error2;
}
}
- if (i == dgInt32(sizeof(m_dir) / sizeof(m_dir[0]))) {
+ if (j == dgInt32(sizeof(m_dir) / sizeof(m_dir[0]))) {
_ASSERTE(maxErr > dgFloat32(0.0f));
CalcSupportVertex(m_dir[best], 1);
}
@@ -1913,9 +1913,9 @@ class dgContactSolver {
dgInt32 best = 0;
dgFloat32 maxErr = dgFloat32(0.0f);
dgVector e0(m_hullVertex[1] - m_hullVertex[0]);
- dgInt32 i = 0;
- for (; i < dgInt32(sizeof(m_dir) / sizeof(m_dir[0])); i++) {
- CalcSupportVertex(m_dir[i], 2);
+ dgInt32 j = 0;
+ for (; j < dgInt32(sizeof(m_dir) / sizeof(m_dir[0])); j++) {
+ CalcSupportVertex(m_dir[j], 2);
dgVector e1(m_hullVertex[2] - m_hullVertex[0]);
dgVector n(e0 * e1);
dgFloat32 error2 = n % n;
@@ -1923,12 +1923,12 @@ class dgContactSolver {
break;
}
if (error2 > maxErr) {
- best = i;
+ best = j;
maxErr = error2;
}
}
- if (i == dgInt32(sizeof(m_dir) / sizeof(m_dir[0]))) {
+ if (j == dgInt32(sizeof(m_dir) / sizeof(m_dir[0]))) {
_ASSERTE(maxErr > dgFloat32(0.0f));
CalcSupportVertex(m_dir[best], 2);
}
@@ -1991,7 +1991,7 @@ class dgContactSolver {
dgPlane separatingPlane(dir.Scale(dgFloat32(-1.0f)), origin % dir);
switch (m_vertexIndex) {
case 1: {
- dgFloat32 minDist = dgFloat32(1.0e10f);
+ dgFloat32 minDistance = dgFloat32(1.0e10f);
rotMatrix = dgMatrix(dir);
_ASSERTE(rotMatrix.m_front.m_w == dgFloat32(0.0f));
_ASSERTE(rotMatrix.m_up.m_w == dgFloat32(0.0f));
@@ -2021,26 +2021,26 @@ class dgContactSolver {
dir1 = tmp;
dgVector dir2(dir1);
- for (dgInt32 i = 0; i < 8; i++) {
- dgVector tmp(dir2.m_x,
+ for (dgInt32 k = 0; k < 8; k++) {
+ dgVector tmpV(dir2.m_x,
dir2.m_y * yawPitch.m_y - dir2.m_z * yawPitch.m_z,
dir2.m_y * yawPitch.m_z + dir2.m_z * yawPitch.m_y,
dgFloat32(0.0f));
_ASSERTE(
- dgAbsf((tmp % tmp) - dgFloat32(1.0f)) < dgFloat32(1.0e-4f));
+ dgAbsf((tmpV % tmpV) - dgFloat32(1.0f)) < dgFloat32(1.0e-4f));
- dir2 = tmp;
- tmp = rotMatrix.RotateVector(dir2);
- CalcSupportVertex(tmp, 2);
+ dir2 = tmpV;
+ tmpV = rotMatrix.RotateVector(dir2);
+ CalcSupportVertex(tmpV, 2);
dgVector err0(m_hullVertex[2] - m_hullVertex[0]);
val = err0 % err0;
if (val > DG_FALLBACK_SEPARATING_DIST_TOLERANCE) {
val = separatingPlane.Evalue(m_hullVertex[2]);
_ASSERTE(val > dgFloat32(0.0f));
- if (val < minDist) {
+ if (val < minDistance) {
keepSeaching = 0;
- minDist = val;
+ minDistance = val;
m_hullVertex[1] = m_hullVertex[2];
m_averVertex[1] = m_averVertex[2];
}
@@ -2086,8 +2086,8 @@ class dgContactSolver {
dgVector err0(m_hullVertex[2] - m_hullVertex[0]);
val = err0 % err0;
if (val > DG_FALLBACK_SEPARATING_DIST_TOLERANCE) {
- dgVector err0(m_hullVertex[2] - m_hullVertex[1]);
- val = err0 % err0;
+ dgVector err1(m_hullVertex[2] - m_hullVertex[1]);
+ val = err1 % err1;
}
} while (val < DG_FALLBACK_SEPARATING_DIST_TOLERANCE);
#ifdef _DEBUG
@@ -2109,8 +2109,8 @@ class dgContactSolver {
dgVector err0(m_hullVertex[3] - m_hullVertex[0]);
val = err0 % err0;
if (val > DG_FALLBACK_SEPARATING_DIST_TOLERANCE) {
- dgVector err0(m_hullVertex[3] - m_hullVertex[1]);
- val = err0 % err0;
+ dgVector err1(m_hullVertex[3] - m_hullVertex[1]);
+ val = err1 % err1;
}
} while (val < DG_FALLBACK_SEPARATING_DIST_TOLERANCE);
#ifdef _DEBUG
@@ -2174,14 +2174,14 @@ class dgContactSolver {
}
if (m_vertexIndex == 4) {
- dgFloat32 minDist;
+ dgFloat32 minDistance;
if (!CheckTetraHedronVolume()) {
Swap(m_hullVertex[2], m_hullVertex[1]);
Swap(m_averVertex[2], m_averVertex[1]);
_ASSERTE(CheckTetraHedronVolume());
}
- minDist = dgFloat32(1.0e20f);
+ minDistance = dgFloat32(1.0e20f);
for (dgInt32 i = 0; i < 4; i++) {
// dgFloat32 dist;
dgInt32 i0 = m_faceIndex[i][0];
@@ -2204,8 +2204,8 @@ class dgContactSolver {
if (dist > DG_DISTANCE_TOLERANCE_ZERO) {
n = n.Scale(dgRsqrt(dist));
dist = dgAbsf(n % (origin - p0));
- if (dist < minDist) {
- minDist = dist;
+ if (dist < minDistance) {
+ minDistance = dist;
plane = &m_simplex[i];
}
}
@@ -2250,22 +2250,22 @@ class dgContactSolver {
case 1: {
dgInt32 best = 0;
dgFloat64 maxErr = dgFloat64(0.0f);
- dgInt32 i = 0;
- for (; i < dgInt32(sizeof(m_dir) / sizeof(m_dir[0])); i++) {
+ dgInt32 j = 0;
+ for (; j < dgInt32(sizeof(m_dir) / sizeof(m_dir[0])); j++) {
dgFloat64 error2;
- CalcSupportVertexLarge(m_dir[i], 1);
+ CalcSupportVertexLarge(m_dir[j], 1);
dgBigVector e(m_hullVertexLarge[1] - m_hullVertexLarge[0]);
error2 = e % e;
if (error2 > dgFloat64(1.0e-4f)) {
break;
}
if (error2 > maxErr) {
- best = i;
+ best = j;
maxErr = error2;
}
}
- if (i == dgInt32(sizeof(m_dir) / sizeof(m_dir[0]))) {
+ if (j == dgInt32(sizeof(m_dir) / sizeof(m_dir[0]))) {
_ASSERTE(maxErr > dgFloat64(0.0f));
CalcSupportVertexLarge(m_dir[best], 1);
}
@@ -2278,10 +2278,10 @@ class dgContactSolver {
dgInt32 best = 0;
dgFloat64 maxErr = dgFloat64(0.0f);
dgBigVector e0(m_hullVertexLarge[1] - m_hullVertexLarge[0]);
- dgInt32 i = 0;
- for (; i < dgInt32(sizeof(m_dir) / sizeof(m_dir[0])); i++) {
+ dgInt32 j = 0;
+ for (; j < dgInt32(sizeof(m_dir) / sizeof(m_dir[0])); j++) {
dgFloat64 error2;
- CalcSupportVertexLarge(m_dir[i], 2);
+ CalcSupportVertexLarge(m_dir[j], 2);
dgBigVector e1(m_hullVertexLarge[2] - m_hullVertexLarge[0]);
dgBigVector n(e0 * e1);
error2 = n % n;
@@ -2289,12 +2289,12 @@ class dgContactSolver {
break;
}
if (error2 > maxErr) {
- best = i;
+ best = j;
maxErr = error2;
}
}
- if (i == dgInt32(sizeof(m_dir) / sizeof(m_dir[0]))) {
+ if (j == dgInt32(sizeof(m_dir) / sizeof(m_dir[0]))) {
_ASSERTE(maxErr > dgFloat64(0.0f));
CalcSupportVertexLarge(m_dir[best], 2);
}
@@ -2366,7 +2366,7 @@ class dgContactSolver {
switch (m_vertexIndex) {
case 1: {
- dgFloat64 minDist = dgFloat64(1.0e10f);
+ dgFloat64 minDistance = dgFloat64(1.0e10f);
rotMatrix = dgMatrix(dir32);
_ASSERTE(rotMatrix.m_front.m_w == dgFloat64(0.0f));
_ASSERTE(rotMatrix.m_up.m_w == dgFloat64(0.0f));
@@ -2395,26 +2395,26 @@ class dgContactSolver {
dir1 = tmp;
dgVector dir2(dir1);
- for (dgInt32 i = 0; i < 8; i++) {
- dgVector tmp(dir2.m_x,
+ for (dgInt32 k = 0; k < 8; k++) {
+ dgVector tmp2(dir2.m_x,
dir2.m_y * yawPitch.m_y - dir2.m_z * yawPitch.m_z,
dir2.m_y * yawPitch.m_z + dir2.m_z * yawPitch.m_y,
dgFloat64(0.0f));
- // _ASSERTE (dgAbsf ((tmp % tmp) - dgFloat32 (1.0f)) < dgFloat32 (1.0e-4f));
+ // _ASSERTE (dgAbsf ((tmp2 % tmp2) - dgFloat32 (1.0f)) < dgFloat32 (1.0e-4f));
- dir2 = tmp;
- tmp = rotMatrix.RotateVector(dir2);
- CalcSupportVertexLarge(tmp, 2);
+ dir2 = tmp2;
+ tmp2 = rotMatrix.RotateVector(dir2);
+ CalcSupportVertexLarge(tmp2, 2);
dgBigVector err0(m_hullVertex[2] - m_hullVertex[0]);
dgFloat64 val = err0 % err0;
if (val > DG_FALLBACK_SEPARATING_DIST_TOLERANCE) {
// val = separatingPlane.Evalue(m_hullVertex[2]);
val = separatingPlane.m_x * m_hullVertexLarge[2].m_x + separatingPlane.m_y * m_hullVertexLarge[2].m_y + separatingPlane.m_z * m_hullVertexLarge[2].m_z + separatingPlane.m_w;
_ASSERTE(val > dgFloat64(0.0f));
- if (val < minDist) {
+ if (val < minDistance) {
keepSeaching = 0;
- minDist = val;
+ minDistance = val;
m_hullVertexLarge[1] = m_hullVertexLarge[2];
m_averVertexLarge[1] = m_averVertexLarge[2];
}
@@ -2464,8 +2464,8 @@ class dgContactSolver {
dgBigVector err0(m_hullVertexLarge[2] - m_hullVertexLarge[0]);
val = err0 % err0;
if (val > DG_FALLBACK_SEPARATING_DIST_TOLERANCE) {
- dgBigVector err0(m_hullVertexLarge[2] - m_hullVertexLarge[1]);
- val = err0 % err0;
+ dgBigVector err1(m_hullVertexLarge[2] - m_hullVertexLarge[1]);
+ val = err1 % err1;
}
} while (val < DG_FALLBACK_SEPARATING_DIST_TOLERANCE);
_ASSERTE(
@@ -2485,8 +2485,8 @@ class dgContactSolver {
dgBigVector err0(m_hullVertexLarge[3] - m_hullVertexLarge[0]);
val = err0 % err0;
if (val > DG_FALLBACK_SEPARATING_DIST_TOLERANCE) {
- dgBigVector err0(m_hullVertexLarge[3] - m_hullVertexLarge[1]);
- val = err0 % err0;
+ dgBigVector err1(m_hullVertexLarge[3] - m_hullVertexLarge[1]);
+ val = err1 % err1;
}
} while (val < DG_FALLBACK_SEPARATING_DIST_TOLERANCE);
_ASSERTE(
@@ -2557,7 +2557,7 @@ class dgContactSolver {
_ASSERTE(CheckTetraHedronVolumeLarge());
}
- dgFloat64 minDist = dgFloat64(1.0e20f);
+ dgFloat64 minDistance = dgFloat64(1.0e20f);
for (dgInt32 i = 0; i < 4; i++) {
dgInt32 i0 = m_faceIndex[i][0];
dgInt32 i1 = m_faceIndex[i][1];
@@ -2579,8 +2579,8 @@ class dgContactSolver {
if (dist > DG_DISTANCE_TOLERANCE_ZERO) {
n = n.Scale(dgFloat32(1.0f) / sqrt(dist));
dist = fabs(n % (origin - p0));
- if (dist < minDist) {
- minDist = dist;
+ if (dist < minDistance) {
+ minDistance = dist;
plane = &m_simplex[i];
}
}
@@ -3452,22 +3452,22 @@ class dgContactSolver {
CalcSupportVertexLarge(m_dir[0], 0);
dgInt32 i = 1;
for (; i < dgInt32(sizeof(m_dir) / sizeof(m_dir[0])); i++) {
- dgFloat64 error2;
+ dgFloat64 error3;
CalcSupportVertexLarge(m_dir[i], 1);
e1 = m_hullVertexLarge[1] - m_hullVertexLarge[0];
- error2 = e1 % e1;
- if (error2 > DG_CALCULATE_SEPARATING_PLANE_ERROR) {
+ error3 = e1 % e1;
+ if (error3 > DG_CALCULATE_SEPARATING_PLANE_ERROR) {
break;
}
}
for (i++; i < dgInt32(sizeof(m_dir) / sizeof(m_dir[0])); i++) {
- dgFloat64 error2;
+ dgFloat64 error3;
CalcSupportVertexLarge(m_dir[i], 2);
e2 = m_hullVertexLarge[2] - m_hullVertexLarge[0];
normal = e1 * e2;
- error2 = normal % normal;
- if (error2 > DG_CALCULATE_SEPARATING_PLANE_ERROR1) {
+ error3 = normal % normal;
+ if (error3 > DG_CALCULATE_SEPARATING_PLANE_ERROR1) {
break;
}
}
@@ -3504,8 +3504,8 @@ class dgContactSolver {
maxErr = dgFloat32(0.0f);
for (i = 1; i < dgInt32(sizeof(m_dir) / sizeof(m_dir[0])); i++) {
CalcSupportVertexLarge(m_dir[i], 2);
- dgBigVector e2(m_hullVertexLarge[2] - m_hullVertexLarge[0]);
- normal = e1 * e2;
+ dgBigVector e4(m_hullVertexLarge[2] - m_hullVertexLarge[0]);
+ normal = e1 * e4;
error2 = normal % normal;
if (error2 > maxErr) {
best = i;
@@ -3514,16 +3514,16 @@ class dgContactSolver {
}
CalcSupportVertexLarge(m_dir[best], 2);
- dgBigVector e2(m_hullVertexLarge[2] - m_hullVertexLarge[0]);
- normal = e1 * e2;
+ dgBigVector e4(m_hullVertexLarge[2] - m_hullVertexLarge[0]);
+ normal = e1 * e4;
best = 0;
maxErr = dgFloat32(0.0f);
for (i = 1; i < dgInt32(sizeof(m_dir) / sizeof(m_dir[0])); i++) {
CalcSupportVertexLarge(m_dir[i], 3);
- dgBigVector e3(m_hullVertexLarge[3] - m_hullVertexLarge[0]);
- error2 = normal % e3;
+ dgBigVector e5(m_hullVertexLarge[3] - m_hullVertexLarge[0]);
+ error2 = normal % e5;
if (fabs(error2) > fabs(maxErr)) {
best = i;
maxErr = error2;
@@ -4134,8 +4134,8 @@ class dgContactSolver {
// dgTrace (("Max face count overflow, breaking with last best face\n"));
- dgPlane &plane = *face;
- plane = bestPlane;
+ dgPlane &planeF = *face;
+ planeF = bestPlane;
i = face->m_vertex[0];
face->m_vertex[0] = 0;
@@ -4450,8 +4450,8 @@ class dgContactSolver {
// dgTrace (("Max face count overflow, breaking with last best face\n"));
- dgPlane &plane = *face;
- plane = bestPlane;
+ dgPlane &planeF = *face;
+ planeF = bestPlane;
i = face->m_vertex[0];
face->m_vertex[0] = 0;
@@ -5221,12 +5221,12 @@ public:
i0 = face->m_vertex[0];
i1 = face->m_vertex[1];
i2 = face->m_vertex[2];
- // dgPlane plane (m_hullVertex[i0], m_hullVertex[i1], m_hullVertex[i2]);
- dgVector plane(
+ // dgPlane planeTemp (m_hullVertex[i0], m_hullVertex[i1], m_hullVertex[i2]);
+ dgVector planeTemp(
(m_hullVertex[i1] - m_hullVertex[i0]) * (m_hullVertex[i2] - m_hullVertex[i0]));
- _ASSERTE(plane % plane > dgFloat32(0.0f));
+ _ASSERTE(planeTemp % planeTemp > dgFloat32(0.0f));
- den = plane % m_localRelVeloc;
+ den = planeTemp % m_localRelVeloc;
// if (dgAbsf (den) > dgFloat32 (1.0e-24f)) {
if (den >= dgFloat32(-1.0e-24f)) {
code = UpdateSeparatingPlane(tmpFaceface, p1);
@@ -5235,11 +5235,11 @@ public:
i0 = face->m_vertex[0];
i1 = face->m_vertex[1];
i2 = face->m_vertex[2];
- // dgPlane plane (m_hullVertex[i0], m_hullVertex[i1], m_hullVertex[i2]);
- dgVector plane(
+ // dgPlane planeT (m_hullVertex[i0], m_hullVertex[i1], m_hullVertex[i2]);
+ dgVector planeT(
(m_hullVertex[i1] - m_hullVertex[i0]) * (m_hullVertex[i2] - m_hullVertex[i0]));
- _ASSERTE(plane % plane > dgFloat32(-1.0e-24f));
- den = plane % m_localRelVeloc;
+ _ASSERTE(planeT % planeT > dgFloat32(-1.0e-24f));
+ den = planeT % m_localRelVeloc;
if (den >= dgFloat32(0.0f)) {
return 0;
}
@@ -5252,7 +5252,7 @@ public:
saveAver[1] = m_averVertex[i1];
saveAver[2] = m_averVertex[i2];
if (den < dgFloat32(-1.0e-24f)) {
- timeOfImpact = (plane % m_hullVertex[i0]) / den;
+ timeOfImpact = (planeTemp % m_hullVertex[i0]) / den;
if (timeOfImpact < 0.0f) {
return 0;
}
@@ -6464,16 +6464,16 @@ dgInt32 dgWorld::FilterPolygonEdgeContacts(dgInt32 count,
for (dgInt32 i = 0; i < count - 1; i++) {
_ASSERTE(
(contact[i].m_isEdgeContact == 0) || (contact[i].m_isEdgeContact == 1));
- for (dgInt32 j = i + 1; j < count; j++) {
+ for (dgInt32 k = i + 1; k < count; k++) {
dgFloat32 dist;
- dgVector distVector(contact[i].m_point - contact[j].m_point);
+ dgVector distVector(contact[i].m_point - contact[k].m_point);
dist = distVector % distVector;
// if (dist < dgFloat32 (0.04f)) {
- // if ((dist < dgFloat32 (0.001f)) || ((dist < dgFloat32 (0.01f)) && ((contact[i].m_normal % contact[j].m_normal) > dgFloat32 (0.86f)))) {
+ // if ((dist < dgFloat32 (0.001f)) || ((dist < dgFloat32 (0.01f)) && ((contact[i].m_normal % contact[k].m_normal) > dgFloat32 (0.86f)))) {
if (dist < dgFloat32(1.e-3f)) {
count--;
- contact[j] = contact[count];
- j--;
+ contact[k] = contact[count];
+ k--;
}
}
}
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp b/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
index b60ac6ce5c5..3a4ca99be1c 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
@@ -1286,31 +1286,31 @@ void dgWorld::ProcessContacts(dgCollidingPairCollector::dgPair *const pair,
}
} else {
- dgVector vel0(v0 + w0 * (contactMaterial->m_point - matrix0.m_posit));
- dgVector vel1(v1 + w1 * (contactMaterial->m_point - matrix1.m_posit));
- dgVector vRel(vel1 - vel0);
+ dgVector velocity0(v0 + w0 * (contactMaterial->m_point - matrix0.m_posit));
+ dgVector velocity1(v1 + w1 * (contactMaterial->m_point - matrix1.m_posit));
+ dgVector vRelative(velocity1 - velocity0);
- dgFloat32 impulse = vRel % contactMaterial->m_normal;
+ dgFloat32 impulse = vRelative % contactMaterial->m_normal;
if (dgAbsf(impulse) > maxImpulse) {
maxImpulse = dgAbsf(impulse);
breakImpulse0 = contactMaterial->m_collision0->GetBreakImpulse();
breakImpulse1 = contactMaterial->m_collision1->GetBreakImpulse();
}
- dgVector tangDir(vRel - contactMaterial->m_normal.Scale(impulse));
- diff = tangDir % tangDir;
+ dgVector tangDirection(vRelative - contactMaterial->m_normal.Scale(impulse));
+ diff = tangDirection % tangDirection;
if (diff > dgFloat32(1.0e-2f)) {
- contactMaterial->m_dir0 = tangDir.Scale(dgRsqrt(diff));
+ contactMaterial->m_dir0 = tangDirection.Scale(dgRsqrt(diff));
} else {
if (dgAbsf(contactMaterial->m_normal.m_z) > dgFloat32(0.577f)) {
- tangDir = dgVector(-contactMaterial->m_normal.m_y,
+ tangDirection = dgVector(-contactMaterial->m_normal.m_y,
contactMaterial->m_normal.m_z, dgFloat32(0.0f), dgFloat32(0.0f));
} else {
- tangDir = dgVector(-contactMaterial->m_normal.m_y,
+ tangDirection = dgVector(-contactMaterial->m_normal.m_y,
contactMaterial->m_normal.m_x, dgFloat32(0.0f), dgFloat32(0.0f));
}
- contactMaterial->m_dir0 = contactMaterial->m_normal * tangDir;
+ contactMaterial->m_dir0 = contactMaterial->m_normal * tangDirection;
_ASSERTE(
contactMaterial->m_dir0 % contactMaterial->m_dir0 > dgFloat32(1.0e-8f));
contactMaterial->m_dir0 = contactMaterial->m_dir0.Scale(
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp b/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
index 7c699dbe556..6389479bd95 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
@@ -898,38 +898,38 @@ void dgWorld::BodySetMatrix(dgBody *body, const dgMatrix &matrix) {
body->m_genericLRUMark = m_genericLRUMark;
dgMatrix relMatrix(body->GetMatrix().Inverse() * matrix);
while (index) {
- dgBody *body;
+ dgBody *bodyI;
index--;
- body = queue[index];
- _ASSERTE(body != m_sentionelBody);
+ bodyI = queue[index];
+ _ASSERTE(bodyI != m_sentionelBody);
- dgBroadPhaseCollision::Remove(body);
- dgBroadPhaseCollision::Add(body);
+ dgBroadPhaseCollision::Remove(bodyI);
+ dgBroadPhaseCollision::Add(bodyI);
- dgMatrix matrix(body->GetMatrix() * relMatrix);
- body->SetVelocity(
+ dgMatrix matrixI(bodyI->GetMatrix() * relMatrix);
+ bodyI->SetVelocity(
dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
dgFloat32(0.0f)));
- body->SetOmega(
+ bodyI->SetOmega(
dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
dgFloat32(0.0f)));
- body->SetMatrix(matrix);
- body->m_isInWorld = true;
+ bodyI->SetMatrix(matrixI);
+ bodyI->m_isInWorld = true;
for (dgBodyMasterListRow::dgListNode *jointNode =
- body->m_masterNode->GetInfo().GetFirst();
+ bodyI->m_masterNode->GetInfo().GetFirst();
jointNode; jointNode =
jointNode->GetNext()) {
dgBodyMasterListCell &cell = jointNode->GetInfo();
- body = cell.m_bodyNode;
- if (body != m_sentionelBody) {
- if (body->m_genericLRUMark != m_genericLRUMark) {
+ bodyI = cell.m_bodyNode;
+ if (bodyI != m_sentionelBody) {
+ if (bodyI->m_genericLRUMark != m_genericLRUMark) {
dgConstraint *constraint;
constraint = cell.m_joint;
if (constraint->GetId() != dgContactConstraintId) {
- body->m_genericLRUMark = m_genericLRUMark;
- queue[index] = body;
+ bodyI->m_genericLRUMark = m_genericLRUMark;
+ queue[index] = bodyI;
index++;
_ASSERTE(index < DG_RECURSIVE_SIZE);
}
@@ -1138,12 +1138,12 @@ bool dgWorld::AreBodyConnectedByJoints(dgBody *const originSrc,
origin->m_genericLRUMark = m_genericLRUMark;
while (start != end) {
- dgBody *const origin = queue[start];
+ dgBody *const originI = queue[start];
start++;
start &= (DG_QEUEU_SIZE - 1);
for (dgBodyMasterListRow::dgListNode *jointNode =
- origin->m_masterNode->GetInfo().GetFirst();
+ originI->m_masterNode->GetInfo().GetFirst();
jointNode; jointNode =
jointNode->GetNext()) {
dgBodyMasterListCell &cell = jointNode->GetInfo();
Commit: 5fbabcd79dd3d0f42aff1a92f78d03062215b9f2
https://github.com/scummvm/scummvm/commit/5fbabcd79dd3d0f42aff1a92f78d03062215b9f2
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:10+01:00
Commit Message:
HPL1: add static string class
Changed paths:
A engines/hpl1/static_string.h
diff --git a/engines/hpl1/static_string.h b/engines/hpl1/static_string.h
new file mode 100644
index 00000000000..a874dc1414b
--- /dev/null
+++ b/engines/hpl1/static_string.h
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/system.h"
+#include "common/str.h"
+
+namespace Hpl1 {
+
+class StaticString
+{
+public:
+ StaticString(const char *str) : _str(str)
+ {
+ }
+
+ const char *c_str() const
+ {
+ return _str;
+ }
+
+ operator Common::String()
+ {
+ return _str;
+ }
+
+private:
+ const char *_str = "";
+};
+
+inline bool operator==(const StaticString &lhs, const StaticString &rhs)
+{
+ return scumm_stricmp(lhs.c_str(), rhs.c_str()) == 0;
+}
+
+inline bool operator<(const StaticString &lhs, const StaticString &rhs)
+{
+ return scumm_stricmp(lhs.c_str(), rhs.c_str()) < 0;
+}
+
+}
\ No newline at end of file
Commit: e16c50932d23ebc75eb101226067b403e2bcc65b
https://github.com/scummvm/scummvm/commit/e16c50932d23ebc75eb101226067b403e2bcc65b
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:11+01:00
Commit Message:
HPL1: remove static Common::String usage
Changed paths:
engines/hpl1/engine/impl/MeshLoaderCollada.cpp
engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
engines/hpl1/engine/resources/MeshLoader.h
engines/hpl1/engine/resources/MeshLoaderHandler.cpp
engines/hpl1/engine/system/Script.h
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/engine/system/SerializeClass.h
engines/hpl1/penumbra-overture/ButtonHandler.cpp
engines/hpl1/penumbra-overture/MainMenu.cpp
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
index 73f090b1a6f..1a43a431ae2 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
@@ -703,12 +703,7 @@ cMesh *cMeshLoaderCollada::LoadMesh(const tString &asFile, tMeshLoadFlag aFlags)
tString sMatName = GetMaterialTextureFile(Geom.msMaterial, vColladaMaterials, vColladaTextures,
vColladaImages);
// Log("Material name: '%s'\n",sMatName.c_str());
- iMaterial *pMaterial;
- if (mbUseFastMaterial && msFastMaterialFile != "") {
- pMaterial = mpMaterialManager->CreateMaterial(msFastMaterialFile);
- } else {
- pMaterial = mpMaterialManager->CreateMaterial(sMatName);
- }
+ iMaterial *pMaterial = mpMaterialManager->CreateMaterial(sMatName);
if (pMaterial == NULL) {
Error("Couldn't create material '%s' for object '%s'\n", sMatName.c_str(),
Geom.msName.c_str());
@@ -1377,12 +1372,7 @@ cMeshEntity *cMeshLoaderCollada::CreateStaticMeshEntity(cColladaNode *apNode, cW
pSubMesh->Compile();
// Add material
- iMaterial *pMaterial;
- if (mbUseFastMaterial && msFastMaterialFile != "") {
- pMaterial = mpMaterialManager->CreateMaterial(msFastMaterialFile);
- } else {
- pMaterial = mpMaterialManager->CreateMaterial(sMatName);
- }
+ iMaterial *pMaterial = mpMaterialManager->CreateMaterial(sMatName);
if (pMaterial == NULL) {
Error("Couldn't create material '%s' for object '%s'\n", sMatName.c_str(),
apNode->msName.c_str());
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
index b4f593c2f7b..e2f5de9cb3a 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
@@ -72,7 +72,7 @@ bool cMeshLoaderCollada::FillStructures(const tString &asFile,
// Log("Loading %s\n",asFile.c_str());
tString sCacheFile = cString::GetFileName(cString::SetFileExt(asFile, "collcach"));
- sCacheFile = msCacheDir + sCacheFile;
+ sCacheFile = "core/cache/" + sCacheFile;
if (abCache &&
FileExists(cString::To16Char(sCacheFile)) &&
diff --git a/engines/hpl1/engine/resources/MeshLoader.h b/engines/hpl1/engine/resources/MeshLoader.h
index 648fa2acd70..e19215f0b4c 100644
--- a/engines/hpl1/engine/resources/MeshLoader.h
+++ b/engines/hpl1/engine/resources/MeshLoader.h
@@ -78,8 +78,6 @@ public:
static void SetRestricStaticLightToSector(bool abX) { mbRestricStaticLightToSector = abX; }
static void SetUseFastMaterial(bool abX) { mbUseFastMaterial = abX; }
- static void SetFastMaterialFile(const tString &asFile) { msFastMaterialFile = asFile; }
- static void SetCacheDir(const tString &asDir) { msCacheDir = asDir; }
protected:
cMaterialManager *mpMaterialManager;
@@ -90,8 +88,6 @@ protected:
static bool mbRestricStaticLightToSector;
static bool mbUseFastMaterial;
- static tString msFastMaterialFile;
- static tString msCacheDir;
};
} // namespace hpl
diff --git a/engines/hpl1/engine/resources/MeshLoaderHandler.cpp b/engines/hpl1/engine/resources/MeshLoaderHandler.cpp
index 34f1c70f821..43a4765d092 100644
--- a/engines/hpl1/engine/resources/MeshLoaderHandler.cpp
+++ b/engines/hpl1/engine/resources/MeshLoaderHandler.cpp
@@ -37,8 +37,6 @@ namespace hpl {
bool iMeshLoader::mbRestricStaticLightToSector = false;
bool iMeshLoader::mbUseFastMaterial = false;
-tString iMeshLoader::msFastMaterialFile = "";
-tString iMeshLoader::msCacheDir = "core/cache/";
//////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
diff --git a/engines/hpl1/engine/system/Script.h b/engines/hpl1/engine/system/Script.h
index 76f664c0605..7a402be50a3 100644
--- a/engines/hpl1/engine/system/Script.h
+++ b/engines/hpl1/engine/system/Script.h
@@ -185,8 +185,8 @@
#define SCRIPT_FUNC_BEGIN(funcname, return, args) \
namespace GenericScript { \
- static tString funcname##_return = #return; \
- static tString funcname##_arg = args; \
+ static const char *funcname##_return = #return; \
+ static const char *funcname##_arg = args; \
void funcname##_Generic(asIScriptGeneric * gen) { \
SCRIPT_RETURN_##return;
@@ -221,7 +221,7 @@
#define AS_MAX_PORTABILITY
#if defined(AS_MAX_PORTABILITY)
#define SCRIPT_REGISTER_FUNC(funcname) \
- GenericScript::funcname##_return + " " #funcname " (" + GenericScript::funcname##_arg + ")", GenericScript::funcname##_Generic, asCALL_GENERIC
+ Common::String(GenericScript::funcname##_return) + " " + Common::String(#funcname) + " (" + Common::String(GenericScript::funcname##_arg) + ")", GenericScript::funcname##_Generic, asCALL_GENERIC
#else
#define SCRIPT_REGISTER_FUNC(funcname) \
GenericScript::funcname##_return + " " #funcname " (" + GenericScript::funcname##_arg + ")", (void *)funcname, asCALL_STDCALL
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index 0aea72fc0a2..519379f14f8 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -132,7 +132,6 @@ int glSerializeTempClassesNum = 0;
// Define static variables
tSerializeSavedClassMap cSerializeClass::m_mapSavedClasses;
bool cSerializeClass::mbDataSetup = false;
-tString cSerializeClass::msTempString = "";
char cSerializeClass::msTempCharArray[2048];
//-----------------------------------------------------------------------
@@ -143,13 +142,10 @@ char cSerializeClass::msTempCharArray[2048];
static bool gbLog = false;
static int glTabs = 0;
-static tString gsTabString = "";
+static const char* gsTabString = "";
const char *GetTabs() {
- gsTabString = "";
- for (int i = 0; i < glTabs; ++i)
- gsTabString += " ";
- return gsTabString.c_str();
+ return gsTabString;
}
cSerializeClass::cSerializeClass(const char *asName, const char *asParent,
@@ -183,7 +179,7 @@ void cSerializeClass::PrintMembers(iSerializable *apData) {
cSerializeMemberField *pField = classIt.GetNext();
Log(" '%s':'%s' type: %d offset: %d\n", pField->msName.c_str(),
- ValueToString(apData, pField->mlOffset, pField->mType),
+ ValueToString(apData, pField->mlOffset, pField->mType).c_str(),
pField->mType, pField->mlOffset);
}
}
@@ -246,7 +242,7 @@ void cSerializeClass::SaveToElement(iSerializable *apData, const tString &asName
cSerializeMemberField *pField = classIt.GetNext();
if (gbLog)
- Log(" Field : '%s'\n", pField->msName.c_str());
+ Log(" Field : '%s'\n", pField->msName);
switch (pField->mMainType) {
// VARIABLE /////////////////////////////////
@@ -352,7 +348,7 @@ void cSerializeClass::LoadFromElement(iSerializable *apData, TiXmlElement *apEle
cSerializeSavedClass *cSerializeClass::GetClass(const tString &asName) {
SetUpData();
- tSerializeSavedClassMapIt it = m_mapSavedClasses.find(asName);
+ tSerializeSavedClassMapIt it = m_mapSavedClasses.find(asName.c_str());
if (it == m_mapSavedClasses.end()) {
Warning("Serialize class '%s' not found!\n", asName.c_str());
return NULL;
@@ -375,7 +371,7 @@ cSerializeMemberFieldIterator cSerializeClass::GetMemberFieldIterator(iSerializa
#define ValuePointer(aObject, aOffset) (((char *)aObject) + aOffset)
#define PointerValue(aPointer, aType) (*((aType *)aPointer))
-const char *cSerializeClass::ValueToString(void *apData, size_t alOffset, eSerializeType aType) {
+tString cSerializeClass::ValueToString(void *apData, size_t alOffset, eSerializeType aType) {
void *pVal = ValuePointer(apData, alOffset);
switch (aType) {
@@ -490,12 +486,12 @@ const char *cSerializeClass::ValueToString(void *apData, size_t alOffset, eSeria
/////////// WSTRING ////////////////////////////////
case eSerializeType_WString: {
- msTempString = "";
+ tString temp = "";
tWString &wsString = PointerValue(pVal, tWString);
for (size_t i = 0; i < wsString.size(); ++i) {
- msTempString += cString::ToString((int)wsString[i]) + " ";
+ temp += cString::ToString((int)wsString[i]) + " ";
}
- return msTempString.c_str();
+ return temp;
break;
}
}
@@ -653,13 +649,13 @@ void cSerializeClass::SaveVariable(TiXmlElement *apElement, cSerializeMemberFiel
if (apField->mType == eSerializeType_Class) {
void *pClassData = ValuePointer(apData, apField->mlOffset);
- SaveToElement((iSerializable *)pClassData, apField->msName, apElement);
+ SaveToElement((iSerializable *)pClassData, apField->msName.c_str(), apElement);
}
// CLASS POINTER
else if (apField->mType == eSerializeType_ClassPointer) {
iSerializable **pFieldData = (iSerializable **)ValuePointer(apData, apField->mlOffset);
- SaveToElement(*pFieldData, apField->msName, apElement, true);
+ SaveToElement(*pFieldData, apField->msName.c_str(), apElement, true);
}
// NORMAL VAR
else {
@@ -668,7 +664,7 @@ void cSerializeClass::SaveVariable(TiXmlElement *apElement, cSerializeMemberFiel
pVarElem->SetAttribute("type", apField->mType);
pVarElem->SetAttribute("name", apField->msName.c_str());
- pVarElem->SetAttribute("val", ValueToString(apData, apField->mlOffset, apField->mType));
+ pVarElem->SetAttribute("val", ValueToString(apData, apField->mlOffset, apField->mType).c_str());
}
}
@@ -722,7 +718,7 @@ void cSerializeClass::SaveArray(TiXmlElement *apElement, cSerializeMemberField *
TiXmlElement XmlClassElem("var");
TiXmlElement *pVarElem = static_cast<TiXmlElement *>(pArrayElem->InsertEndChild(XmlClassElem));
- pVarElem->SetAttribute("val", ValueToString(pArrayData, lOffset, apField->mType));
+ pVarElem->SetAttribute("val", ValueToString(pArrayData, lOffset, apField->mType).c_str());
}
}
}
@@ -767,7 +763,7 @@ void cSerializeClass::SaveContainer(TiXmlElement *apElement, cSerializeMemberFie
void *pData = const_cast<void *>(pContIt->NextPtr());
- pVarElem->SetAttribute("val", ValueToString(pData, 0, apField->mType));
+ pVarElem->SetAttribute("val", ValueToString(pData, 0, apField->mType).c_str());
}
}
@@ -1079,7 +1075,7 @@ void cSerializeClass::SetUpData() {
for (int i = 0; i < glSerializeTempClassesNum; i++) {
m_mapSavedClasses.insert(tSerializeSavedClassMap::value_type(
- tString(gvSerializeTempClasses[i].msName), gvSerializeTempClasses[i]));
+ gvSerializeTempClasses[i].msName, gvSerializeTempClasses[i]));
}
}
diff --git a/engines/hpl1/engine/system/SerializeClass.h b/engines/hpl1/engine/system/SerializeClass.h
index aed7a0f2825..2554ec4506f 100644
--- a/engines/hpl1/engine/system/SerializeClass.h
+++ b/engines/hpl1/engine/system/SerializeClass.h
@@ -30,6 +30,7 @@
#include "hpl1/engine/system/MemoryManager.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/static_string.h"
#include <map>
class TiXmlElement;
@@ -211,18 +212,16 @@ public: \
class cSerializeMemberField {
public:
- cSerializeMemberField(const tString &asName, size_t alOffset, size_t alSize, eSerializeType alType,
- eSerializeMainType aMainType) {
- msName = asName;
+ cSerializeMemberField(Hpl1::StaticString asName, size_t alOffset, size_t alSize, eSerializeType alType,
+ eSerializeMainType aMainType) : msName(asName), msClassName(""){
mlOffset = alOffset;
mlSize = alSize;
mType = alType;
mMainType = aMainType;
}
- cSerializeMemberField(const tString &asName, size_t alOffset, size_t alSize, eSerializeType alType,
- eSerializeMainType aMainType, size_t alArraySize) {
- msName = asName;
+ cSerializeMemberField(Hpl1::StaticString asName, size_t alOffset, size_t alSize, eSerializeType alType,
+ eSerializeMainType aMainType, size_t alArraySize) : msName(asName), msClassName("") {
mlOffset = alOffset;
mlSize = alSize;
mType = alType;
@@ -230,18 +229,16 @@ public:
mlArraySize = alArraySize;
}
- cSerializeMemberField(const tString &asName, size_t alOffset, size_t alSize, eSerializeType alType,
- eSerializeMainType aMainType, const tString &asClassName) {
- msName = asName;
+ cSerializeMemberField(Hpl1::StaticString asName, size_t alOffset, size_t alSize, eSerializeType alType,
+ eSerializeMainType aMainType, Hpl1::StaticString asClassName) : msName(asName), msClassName(asClassName) {
mlOffset = alOffset;
mlSize = alSize;
mType = alType;
mMainType = aMainType;
- msClassName = asClassName;
}
- tString msName;
- tString msClassName;
+ Hpl1::StaticString msName;
+ Hpl1::StaticString msClassName;
size_t mlOffset;
size_t mlSize;
eSerializeType mType;
@@ -299,7 +296,7 @@ private:
//-------------------------------------------------
-typedef std::map<tString, cSerializeSavedClass> tSerializeSavedClassMap;
+typedef std::map<Hpl1::StaticString, cSerializeSavedClass> tSerializeSavedClassMap;
typedef tSerializeSavedClassMap::iterator tSerializeSavedClassMapIt;
typedef Common::List<cSerializeSavedClass *> tSerializeSavedClassList;
@@ -325,7 +322,7 @@ public:
static cSerializeMemberFieldIterator GetMemberFieldIterator(iSerializable *apData);
- static const char *ValueToString(void *apData, size_t alOffset, eSerializeType aType);
+ static tString ValueToString(void *apData, size_t alOffset, eSerializeType aType);
static void StringToValue(void *apData, size_t alOffset, eSerializeType aType,
const char *asVal);
@@ -349,7 +346,6 @@ private:
static void SetUpData();
- static tString msTempString;
static char msTempCharArray[2048];
static bool mbDataSetup;
diff --git a/engines/hpl1/penumbra-overture/ButtonHandler.cpp b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
index 56d3d7124c4..56a5a6b2680 100644
--- a/engines/hpl1/penumbra-overture/ButtonHandler.cpp
+++ b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
@@ -50,7 +50,7 @@ struct cButtonHandlerAction {
bool mbConfig;
};
-static tString gsLastPlayerAction = "GlowStick";
+static const char* const gsLastPlayerAction = "GlowStick";
static cButtonHandlerAction gvDefaultActions[] = {
{"Forward", "Keyboard", eKey_w, true},
{"Backward", "Keyboard", eKey_s, true},
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index c67e961d18b..aaa49f4b221 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -1727,6 +1727,11 @@ cMainMenu::cMainMenu(cInit *apInit) : iUpdateable("MainMenu") {
cMainMenu::~cMainMenu(void) {
STLDeleteAll(mlstWidgets);
+ // prevents the strings from still staying
+ // around after the game is closed
+ gvSaveGameFileVec[0].clear();
+ gvSaveGameFileVec[1].clear();
+ gvSaveGameFileVec[2].clear();
mpDrawer->DestroyGfxObject(mpGfxBlackQuad);
mpDrawer->DestroyGfxObject(mpGfxMouse);
Commit: fddac1b1badf6e6cd9906f61679d898f599a1735
https://github.com/scummvm/scummvm/commit/fddac1b1badf6e6cd9906f61679d898f599a1735
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:11+01:00
Commit Message:
HPL1: Fix Remaining GCC Shadowing Warnings in Newton Physics Code
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp b/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
index cbb803a4c21..86cd7af3af0 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
@@ -768,7 +768,7 @@ void dgWorldDynamicUpdate::BuildIsland(dgQueue<dgBody *> &queue,
jointNode->GetNext()) {
dgBodyMasterListCell &cell = jointNode->GetInfo();
- dgBody *const body = cell.m_bodyNode;
+ dgBody *const bodyN = cell.m_bodyNode;
dgConstraint *const constraint = cell.m_joint;
if (dgInt32(constraint->m_dynamicsLru) != lruMark) {
constraint->m_dynamicsLru = dgUnsigned32(lruMark);
@@ -793,10 +793,10 @@ void dgWorldDynamicUpdate::BuildIsland(dgQueue<dgBody *> &queue,
_ASSERTE(constraint->m_body1);
}
- if (dgInt32(body->m_dynamicsLru) != lruMark) {
- if (body->m_invMass.m_w > dgFloat32(0.0f)) {
- queue.Insert(body);
- body->m_dynamicsLru = dgUnsigned32(lruMark);
+ if (dgInt32(bodyN->m_dynamicsLru) != lruMark) {
+ if (bodyN->m_invMass.m_w > dgFloat32(0.0f)) {
+ queue.Insert(bodyN);
+ bodyN->m_dynamicsLru = dgUnsigned32(lruMark);
}
}
}
@@ -890,13 +890,13 @@ void dgWorldDynamicUpdate::SpanningTree(dgBody *const body) {
jointNode->GetNext()) {
dgBodyMasterListCell &cell = jointNode->GetInfo();
- dgBody *const body = cell.m_bodyNode;
- if (dgInt32(body->m_dynamicsLru) < lruMark) {
- _ASSERTE(body == cell.m_bodyNode);
- body->m_dynamicsLru = dgUnsigned32(lruMark);
+ dgBody *const bodyN = cell.m_bodyNode;
+ if (dgInt32(bodyN->m_dynamicsLru) < lruMark) {
+ _ASSERTE(bodyN == cell.m_bodyNode);
+ bodyN->m_dynamicsLru = dgUnsigned32(lruMark);
- if (body->m_invMass.m_w > dgFloat32(0.0f)) {
- queue.Insert(body);
+ if (bodyN->m_invMass.m_w > dgFloat32(0.0f)) {
+ queue.Insert(bodyN);
} else {
dgInt32 duplicateBody = 0;
@@ -980,9 +980,9 @@ void dgWorldDynamicUpdate::SpanningTree(dgBody *const body) {
if (isInEquilibrium | !isInWorld) {
for (dgInt32 i = 0; i < bodyCount; i++) {
- dgBody *const body = m_bodyArray[m_bodies + i].m_body;
- body->m_dynamicsLru = dgUnsigned32(m_markLru);
- body->m_sleeping = true;
+ dgBody *const bodyI = m_bodyArray[m_bodies + i].m_body;
+ bodyI->m_dynamicsLru = dgUnsigned32(m_markLru);
+ bodyI->m_sleeping = true;
}
} else {
if (m_world->m_islandUpdate) {
@@ -993,8 +993,8 @@ void dgWorldDynamicUpdate::SpanningTree(dgBody *const body) {
record.m_bodyArray = &m_bodyArray[m_bodies].m_body;
if (!m_world->m_islandUpdate(m_world, &record, bodyCount)) {
for (dgInt32 i = 0; i < bodyCount; i++) {
- dgBody *const body = m_bodyArray[m_bodies + i].m_body;
- body->m_dynamicsLru = dgUnsigned32(m_markLru);
+ dgBody *const bodyI = m_bodyArray[m_bodies + i].m_body;
+ bodyI->m_dynamicsLru = dgUnsigned32(m_markLru);
}
return;
}
@@ -1003,10 +1003,10 @@ void dgWorldDynamicUpdate::SpanningTree(dgBody *const body) {
if (staticCount) {
queue.Reset();
for (dgInt32 i = 0; i < staticCount; i++) {
- dgBody *const body = staticPool[i];
- body->m_dynamicsLru = dgUnsigned32(m_markLru);
- queue.Insert(body);
- _ASSERTE(dgInt32(body->m_dynamicsLru) == m_markLru);
+ dgBody *const bodyI = staticPool[i];
+ bodyI->m_dynamicsLru = dgUnsigned32(m_markLru);
+ queue.Insert(bodyI);
+ _ASSERTE(dgInt32(bodyI->m_dynamicsLru) == m_markLru);
}
for (dgInt32 i = 0; i < jointCount; i++) {
@@ -3831,12 +3831,12 @@ void dgJacobianMemory::CalculateForcesSimulationMode(dgFloat32 maxAccNorm) const
y1.m_linear = zero;
y1.m_angular = zero;
for (dgInt32 i = 0; i < rowsCount; i++) {
- dgFloat32 deltaForce;
- deltaForce = forceStep[i];
- y0.m_linear += Jt[index].m_jacobian_IM0.m_linear.Scale(deltaForce);
- y0.m_angular += Jt[index].m_jacobian_IM0.m_angular.Scale(deltaForce);
- y1.m_linear += Jt[index].m_jacobian_IM1.m_linear.Scale(deltaForce);
- y1.m_angular += Jt[index].m_jacobian_IM1.m_angular.Scale(deltaForce);
+ dgFloat32 deltaForceI;
+ deltaForceI = forceStep[i];
+ y0.m_linear += Jt[index].m_jacobian_IM0.m_linear.Scale(deltaForceI);
+ y0.m_angular += Jt[index].m_jacobian_IM0.m_angular.Scale(deltaForceI);
+ y1.m_linear += Jt[index].m_jacobian_IM1.m_linear.Scale(deltaForceI);
+ y1.m_angular += Jt[index].m_jacobian_IM1.m_angular.Scale(deltaForceI);
index++;
}
internalForces[m0].m_linear += y0.m_linear;
@@ -4028,31 +4028,24 @@ void dgJacobianMemory::CalculateForcesSimulationMode(dgFloat32 maxAccNorm) const
}
for (dgInt32 i = 0; i < m_jointCount; i++) {
- dgInt32 j;
- dgInt32 m0;
- dgInt32 m1;
- dgInt32 first;
- dgInt32 count;
- dgInt32 index;
- dgFloat32 ak;
dgJacobian y0;
dgJacobian y1;
- first = constraintArray[i].m_autoPairstart;
- count = constraintArray[i].m_autoPairActiveCount;
- m0 = constraintArray[i].m_m0;
- m1 = constraintArray[i].m_m1;
+ dgInt32 jfirst = constraintArray[i].m_autoPairstart;
+ dgInt32 jcount = constraintArray[i].m_autoPairActiveCount;
+ dgInt32 m0 = constraintArray[i].m_m0;
+ dgInt32 m1 = constraintArray[i].m_m1;
y0.m_linear = zero;
y0.m_angular = zero;
y1.m_linear = zero;
y1.m_angular = zero;
- for (j = 0; j < count; j++) {
- index = j + first;
- ak = deltaForce[index];
- y0.m_linear += Jt[index].m_jacobian_IM0.m_linear.Scale(ak);
- y0.m_angular += Jt[index].m_jacobian_IM0.m_angular.Scale(ak);
- y1.m_linear += Jt[index].m_jacobian_IM1.m_linear.Scale(ak);
- y1.m_angular += Jt[index].m_jacobian_IM1.m_angular.Scale(ak);
+ for (dgInt32 j = 0; j < jcount; j++) {
+ dgInt32 index = j + jfirst;
+ dgFloat32 jak = deltaForce[index];
+ y0.m_linear += Jt[index].m_jacobian_IM0.m_linear.Scale(jak);
+ y0.m_angular += Jt[index].m_jacobian_IM0.m_angular.Scale(jak);
+ y1.m_linear += Jt[index].m_jacobian_IM1.m_linear.Scale(jak);
+ y1.m_angular += Jt[index].m_jacobian_IM1.m_angular.Scale(jak);
}
internalForces[m0].m_linear += y0.m_linear;
internalForces[m0].m_angular += y0.m_angular;
@@ -4135,16 +4128,12 @@ void dgJacobianMemory::CalculateForcesSimulationMode(dgFloat32 maxAccNorm) const
bool isClamped[DG_CONSTRAINT_MAX_ROWS];
for (dgInt32 i = 0; i < m_jointCount; i++) {
- dgInt32 j;
- dgInt32 first;
- dgInt32 count;
- dgInt32 index;
- first = constraintArray[i].m_autoPairstart;
- count = constraintArray[i].m_autoPairActiveCount;
- for (j = 0; j < count; j++) {
- index = j + first;
- force[index] += ak * deltaForce[index];
- accel[index] -= ak * deltaAccel[index];
+ dgInt32 jfirst = constraintArray[i].m_autoPairstart;
+ dgInt32 jcount = constraintArray[i].m_autoPairActiveCount;
+ for (dgInt32 j = 0; j < jcount; j++) {
+ dgInt32 jindex = j + jfirst;
+ force[jindex] += ak * deltaForce[jindex];
+ accel[jindex] -= ak * deltaAccel[jindex];
}
}
@@ -4200,21 +4189,17 @@ void dgJacobianMemory::CalculateForcesSimulationMode(dgFloat32 maxAccNorm) const
akNum = dgFloat32(0.0f);
accNorm = dgFloat32(0.0f);
for (dgInt32 i = 0; i < m_jointCount; i++) {
- dgInt32 j;
- dgInt32 first;
- dgInt32 count;
- dgInt32 index;
- first = constraintArray[i].m_autoPairstart;
- count = constraintArray[i].m_autoPairActiveCount;
- forceRows += count;
- for (j = 0; j < count; j++) {
- index = first + j;
- _ASSERTE((i != clampedForceJoint) || !((dgAbsf(lowerForceBound[index] - force[index]) < dgFloat32(1.0e-5f)) && (accel[index] < dgFloat32(0.0f))));
- _ASSERTE((i != clampedForceJoint) || !((dgAbsf(upperForceBound[index] - force[index]) < dgFloat32(1.0e-5f)) && (accel[index] > dgFloat32(0.0f))));
- deltaForce[index] = accel[index] * invDJMinvJt[index];
- akNum += deltaForce[index] * accel[index];
- accNorm = GetMax(dgAbsf(accel[index]), accNorm);
- _ASSERTE(dgCheckFloat(deltaForce[index]));
+ dgInt32 jfirst = constraintArray[i].m_autoPairstart;
+ dgInt32 jcount = constraintArray[i].m_autoPairActiveCount;
+ forceRows += jcount;
+ for (dgInt32 j = 0; j < jcount; j++) {
+ dgInt32 jindex = jfirst + j;
+ _ASSERTE((i != clampedForceJoint) || !((dgAbsf(lowerForceBound[jindex] - force[jindex]) < dgFloat32(1.0e-5f)) && (accel[jindex] < dgFloat32(0.0f))));
+ _ASSERTE((i != clampedForceJoint) || !((dgAbsf(upperForceBound[jindex] - force[jindex]) < dgFloat32(1.0e-5f)) && (accel[jindex] > dgFloat32(0.0f))));
+ deltaForce[jindex] = accel[jindex] * invDJMinvJt[jindex];
+ akNum += deltaForce[jindex] * accel[jindex];
+ accNorm = GetMax(dgAbsf(accel[jindex]), accNorm);
+ _ASSERTE(dgCheckFloat(deltaForce[jindex]));
}
}
@@ -5729,10 +5714,10 @@ void dgJacobianMemory::CalculateForcesGameMode(dgInt32 iterations,
for (dgInt32 i = 1; i < m_bodyCount; i++) {
dgBody *const body = bodyArray[i].m_body;
- dgVector force(body->m_accel + internalForces[i].m_linear);
+ dgVector forceTmp(body->m_accel + internalForces[i].m_linear);
dgVector torque(body->m_alpha + internalForces[i].m_angular);
- dgVector accel(force.Scale(body->m_invMass.m_w));
+ dgVector accel(forceTmp.Scale(body->m_invMass.m_w));
dgVector alpha(body->m_invWorldInertiaMatrix.RotateVector(torque));
body->m_veloc += accel.Scale(timeStep);
body->m_omega += alpha.Scale(timeStep);
Commit: 0fdd6cb20acdc629ff599287a1ec3be2549be07d
https://github.com/scummvm/scummvm/commit/0fdd6cb20acdc629ff599287a1ec3be2549be07d
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:11+01:00
Commit Message:
HPL1: Fix GCC Warning for Memset of Non-Trivial Structure
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp b/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
index d03184694cb..5c7e530a854 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
@@ -27,6 +27,8 @@
#include "dgPolyhedra.h"
#include "dgSmallDeterminant.h"
+#include "common/util.h"
+
//#define DG_MIN_EDGE_ASPECT_RATIO dgFloat64 (0.02f)
class dgDiagonalEdge
@@ -102,7 +104,7 @@ public:
void Clear()
{
- memset(elem, 0, 10 * sizeof(dgFloat64));
+ for (uint i = 0; i < ARRAYSIZE(elem); i++) elem[i] = dgFloat64(0.0);
}
void Accumulate(const dgVertexCollapseVertexMetric& p)
@@ -2860,8 +2862,7 @@ void dgPolyhedra::Optimize(const dgFloat64* const array, dgInt32 strideInBytes,
&heapPool[0], heapPool.GetSizeInBytes());
NormalizeVertex(maxVertexIndex, &vertexPool[0], array, stride);
- memset(&vertexMetrics[0], 0,
- maxVertexIndex * sizeof(dgVertexCollapseVertexMetric));
+ for(uint i = 0; i < maxVertexIndex; i++) vertexMetrics[i].Clear();
CalculateAllMetrics(this, &vertexMetrics[0], &vertexPool[0]);
dgFloat64 tol2 = tol * tol;
Commit: 6442dc1c23652237bf62192857380c5348c09d0c
https://github.com/scummvm/scummvm/commit/6442dc1c23652237bf62192857380c5348c09d0c
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:11+01:00
Commit Message:
HPL1: Further Fix For GCC Memset on Non-Trivial Structure Compiler Warning
Changed paths:
engines/hpl1/engine/libraries/newton/NewtonClass.cpp
engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
diff --git a/engines/hpl1/engine/libraries/newton/NewtonClass.cpp b/engines/hpl1/engine/libraries/newton/NewtonClass.cpp
index eb538d758ea..9867dbeb013 100644
--- a/engines/hpl1/engine/libraries/newton/NewtonClass.cpp
+++ b/engines/hpl1/engine/libraries/newton/NewtonClass.cpp
@@ -302,7 +302,7 @@ dgFloat32 NewtonUserJoint::GetRowForce(dgInt32 row) const
void NewtonUserJoint::GetInfo(dgConstraintInfo* const info) const
{
- memset(info, 0, sizeof(dgConstraintInfo));
+ info->clear();
if (m_getInfoCallback)
{
InitInfo(info);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgConstraint.h b/engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
index 2eddf896144..bf8de08e88b 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
@@ -22,6 +22,8 @@
#if !defined(AFX_DGCONSTRAINT_H__F9EC24E0_6E0F_4CD5_909E_A5F5E1AC7C0B__INCLUDED_)
#define AFX_DGCONSTRAINT_H__F9EC24E0_6E0F_4CD5_909E_A5F5E1AC7C0B__INCLUDED_
+#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0])))
+
#include "dgBodyMasterList.h"
#define DG_MAX_BOUND dgFloat32 (1.0e15f)
@@ -58,6 +60,21 @@ class dgConstraintInfo
dgFloat32 m_extraParameters[16];
dgInt32 m_collideCollisionOn;
char m_discriptionType[16];
+
+ void clear()
+ {
+ m_attachMatrix_0 = dgGetZeroMatrix();
+ m_attachMatrix_1 = dgGetZeroMatrix();
+ for (uint i = 0; i < ARRAYSIZE(m_minLinearDof); i++) m_minLinearDof[i] = dgFloat32(0.0);
+ for (uint i = 0; i < ARRAYSIZE(m_maxLinearDof); i++) m_maxLinearDof[i] = dgFloat32(0.0);
+ for (uint i = 0; i < ARRAYSIZE(m_minAngularDof); i++) m_minAngularDof[i] = dgFloat32(0.0);
+ for (uint i = 0; i < ARRAYSIZE(m_maxAngularDof); i++) m_maxAngularDof[i] = dgFloat32(0.0);
+ m_attachBody_0 = nullptr;
+ m_attachBody_1 = nullptr;
+ for (uint i = 0; i < ARRAYSIZE(m_extraParameters); i++) m_extraParameters[i] = dgFloat32(0.0);
+ m_collideCollisionOn = dgInt32(0);
+ for (uint i = 0; i < ARRAYSIZE(m_discriptionType); i++) m_discriptionType[i] = 0;
+ }
};
Commit: 3705c8c5b45cf9d3bc8fef68f17f3d4fb4c42f84
https://github.com/scummvm/scummvm/commit/3705c8c5b45cf9d3bc8fef68f17f3d4fb4c42f84
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:11+01:00
Commit Message:
HPL1: create algorithms header
Changed paths:
A engines/hpl1/algorithms.h
diff --git a/engines/hpl1/algorithms.h b/engines/hpl1/algorithms.h
new file mode 100644
index 00000000000..dc5df5d6fdf
--- /dev/null
+++ b/engines/hpl1/algorithms.h
@@ -0,0 +1,39 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_ALGORITHMS
+#define HPL1_ALGORITHMS
+
+#include "common/array.h"
+
+namespace Hpl1 {
+
+template<typename T, typename V>
+void resizeAndFill(Common::Array<T> &container, const typename Common::Array<T>::size_type newSize, const V &value) {
+ const auto oldSize = container.size();
+ container.resize(newSize);
+ for (auto i = oldSize; i < newSize; ++i)
+ container[i] = value;
+}
+
+}
+
+#endif //HPL1_ALGORITHMS
\ No newline at end of file
Commit: a373f201d5a4c92d3081f4a036b0865ac60b917e
https://github.com/scummvm/scummvm/commit/a373f201d5a4c92d3081f4a036b0865ac60b917e
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:11+01:00
Commit Message:
HPL1: replace std::vector with Common::Array
Changed paths:
engines/hpl1/engine/ai/AINodeContainer.h
engines/hpl1/engine/graphics/Animation.h
engines/hpl1/engine/graphics/Color.h
engines/hpl1/engine/graphics/GfxObject.h
engines/hpl1/engine/graphics/GraphicsDrawer.h
engines/hpl1/engine/graphics/GraphicsTypes.h
engines/hpl1/engine/graphics/ImageEntityData.cpp
engines/hpl1/engine/graphics/ImageEntityData.h
engines/hpl1/engine/graphics/Material.cpp
engines/hpl1/engine/graphics/Material.h
engines/hpl1/engine/graphics/Mesh.cpp
engines/hpl1/engine/graphics/Mesh.h
engines/hpl1/engine/graphics/Mesh2d.h
engines/hpl1/engine/graphics/ParticleEmitter.h
engines/hpl1/engine/graphics/ParticleEmitter3D.h
engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
engines/hpl1/engine/graphics/ParticleSystem3D.h
engines/hpl1/engine/graphics/Skeleton.h
engines/hpl1/engine/graphics/Texture.h
engines/hpl1/engine/graphics/bitmap2D.h
engines/hpl1/engine/graphics/font_data.cpp
engines/hpl1/engine/graphics/font_data.h
engines/hpl1/engine/gui/Gui.cpp
engines/hpl1/engine/gui/GuiGfxElement.h
engines/hpl1/engine/gui/GuiSkin.cpp
engines/hpl1/engine/gui/GuiSkin.h
engines/hpl1/engine/gui/Widget.h
engines/hpl1/engine/gui/WidgetWindow.h
engines/hpl1/engine/haptic/HapticTypes.h
engines/hpl1/engine/impl/CollideShapeNewton.cpp
engines/hpl1/engine/impl/CollideShapeNewton.h
engines/hpl1/engine/impl/MeshLoaderCollada.h
engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
engines/hpl1/engine/impl/PBuffer.h
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/math/MathTypes.h
engines/hpl1/engine/math/MeshTypes.h
engines/hpl1/engine/math/PidController.h
engines/hpl1/engine/physics/CharacterBody.cpp
engines/hpl1/engine/physics/CharacterBody.h
engines/hpl1/engine/physics/CollideData.h
engines/hpl1/engine/physics/PhysicsBody.cpp
engines/hpl1/engine/physics/PhysicsBody.h
engines/hpl1/engine/physics/PhysicsWorld.h
engines/hpl1/engine/physics/SurfaceData.h
engines/hpl1/engine/resources/EntityLoader_Object.h
engines/hpl1/engine/resources/ImageEntityManager.cpp
engines/hpl1/engine/resources/ResourceImage.h
engines/hpl1/engine/resources/ResourceManager.cpp
engines/hpl1/engine/resources/TextureManager.cpp
engines/hpl1/engine/scene/AnimationState.h
engines/hpl1/engine/scene/GridMap2D.h
engines/hpl1/engine/scene/ImageEntity.h
engines/hpl1/engine/scene/Light3D.cpp
engines/hpl1/engine/scene/Light3D.h
engines/hpl1/engine/scene/MeshEntity.h
engines/hpl1/engine/scene/SectorVisibility.h
engines/hpl1/engine/scene/SubMeshEntity.h
engines/hpl1/engine/scene/TileData.cpp
engines/hpl1/engine/scene/TileLayer.cpp
engines/hpl1/engine/scene/TileLayer.h
engines/hpl1/engine/scene/TileMap.h
engines/hpl1/engine/scene/TileSet.h
engines/hpl1/engine/system/Container.h
engines/hpl1/engine/system/SerializeClass.h
engines/hpl1/engine/system/SystemTypes.h
engines/hpl1/penumbra-overture/DemoEndText.h
engines/hpl1/penumbra-overture/GameArea.cpp
engines/hpl1/penumbra-overture/GameDamageArea.cpp
engines/hpl1/penumbra-overture/GameEnemy.h
engines/hpl1/penumbra-overture/GameEnemy_Worm.h
engines/hpl1/penumbra-overture/GameEntity.cpp
engines/hpl1/penumbra-overture/GameEntity.h
engines/hpl1/penumbra-overture/GameForceArea.cpp
engines/hpl1/penumbra-overture/GameLadder.cpp
engines/hpl1/penumbra-overture/GameLamp.h
engines/hpl1/penumbra-overture/GameLink.cpp
engines/hpl1/penumbra-overture/GameLiquidArea.cpp
engines/hpl1/penumbra-overture/GameMusicHandler.h
engines/hpl1/penumbra-overture/GameSaveArea.cpp
engines/hpl1/penumbra-overture/GameStickArea.cpp
engines/hpl1/penumbra-overture/GameSwingDoor.h
engines/hpl1/penumbra-overture/HudModel_Weapon.h
engines/hpl1/penumbra-overture/Inventory.cpp
engines/hpl1/penumbra-overture/Inventory.h
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/MainMenu.h
engines/hpl1/penumbra-overture/MapHandler.h
engines/hpl1/penumbra-overture/Notebook.h
engines/hpl1/penumbra-overture/Player.cpp
engines/hpl1/penumbra-overture/Player.h
engines/hpl1/penumbra-overture/PlayerHands.h
engines/hpl1/penumbra-overture/PlayerHelper.cpp
engines/hpl1/penumbra-overture/PlayerHelper.h
engines/hpl1/penumbra-overture/PreMenu.h
engines/hpl1/penumbra-overture/SaveTypes.cpp
diff --git a/engines/hpl1/engine/ai/AINodeContainer.h b/engines/hpl1/engine/ai/AINodeContainer.h
index 00b48ca9c5e..4cff1c1bffb 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.h
+++ b/engines/hpl1/engine/ai/AINodeContainer.h
@@ -33,6 +33,7 @@
#include "hpl1/engine/physics/PhysicsWorld.h"
#include "common/list.h"
+#include "common/array.h"
namespace hpl {
@@ -56,7 +57,7 @@ public:
cAINode *mpNode;
};
-typedef std::vector<cAINodeEdge> tAINodeEdgeVec;
+typedef Common::Array<cAINodeEdge> tAINodeEdgeVec;
typedef tAINodeEdgeVec::iterator tAINodeEdgeVecIt;
//--------------------------------
@@ -85,7 +86,7 @@ private:
tAINodeEdgeVec mvEdges;
};
-typedef std::vector<cAINode *> tAINodeVec;
+typedef Common::Array<cAINode *> tAINodeVec;
typedef tAINodeVec::iterator tAINodeVecIt;
typedef Common::List<cAINode *> tAINodeList;
@@ -288,7 +289,7 @@ private:
cVector2f mvMaxGridPos;
int mlNodesPerGrid;
- std::vector<cAIGridNode> mvGrids;
+ Common::Array<cAIGridNode> mvGrids;
// properties
int mlMaxNodeEnds;
diff --git a/engines/hpl1/engine/graphics/Animation.h b/engines/hpl1/engine/graphics/Animation.h
index ec394a4522e..5ac18322f1c 100644
--- a/engines/hpl1/engine/graphics/Animation.h
+++ b/engines/hpl1/engine/graphics/Animation.h
@@ -32,12 +32,13 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/resources/ResourceBase.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "common/array.h"
namespace hpl {
class cAnimationTrack;
-typedef std::vector<cAnimationTrack *> tAnimationTrackVec;
+typedef Common::Array<cAnimationTrack *> tAnimationTrackVec;
typedef tAnimationTrackVec::iterator tAnimationTrackVecIt;
class cAnimation : public iResourceBase {
diff --git a/engines/hpl1/engine/graphics/Color.h b/engines/hpl1/engine/graphics/Color.h
index 07d60d82bc7..f176d3b2906 100644
--- a/engines/hpl1/engine/graphics/Color.h
+++ b/engines/hpl1/engine/graphics/Color.h
@@ -28,10 +28,9 @@
#ifndef HPL_COLOR_H
#define HPL_COLOR_H
-#include <vector>
-
#include "hpl1/engine/system/SystemTypes.h"
#include "common/list.h"
+#include "common/array.h"
namespace hpl {
@@ -65,7 +64,7 @@ public:
typedef Common::List<cColor> tColorList;
typedef tColorList::iterator tColorListIt;
-typedef std::vector<cColor> tColorVec;
+typedef Common::Array<cColor> tColorVec;
typedef tColorVec::iterator tColorVecIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/GfxObject.h b/engines/hpl1/engine/graphics/GfxObject.h
index 23151baf195..4292656d850 100644
--- a/engines/hpl1/engine/graphics/GfxObject.h
+++ b/engines/hpl1/engine/graphics/GfxObject.h
@@ -29,7 +29,7 @@
#define HPL_GFX_OBJECT_H
#include "hpl1/engine/graphics/GraphicsTypes.h"
-#include <vector>
+#include "common/array.h"
namespace hpl {
@@ -57,7 +57,7 @@ private:
tString msSourceFile;
};
-typedef std::vector<cGfxObject> tGfxObjectVec;
+typedef Common::Array<cGfxObject> tGfxObjectVec;
typedef tGfxObjectVec::iterator tGfxObjectVecIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.h b/engines/hpl1/engine/graphics/GraphicsDrawer.h
index 85f5bc7364a..649defbe100 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.h
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/graphics/BackgroundImage.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "common/list.h"
-#include <vector>
+#include "common/array.h"
namespace hpl {
@@ -57,7 +57,7 @@ public:
float GetZ() const { return mvTransform.z; }
};
-typedef std::vector<cGfxObject> tGfxObjectVec;
+typedef Common::Array<cGfxObject> tGfxObjectVec;
typedef tGfxObjectVec::iterator tGfxObjectVecIt;
class cGfxBufferCompare {
diff --git a/engines/hpl1/engine/graphics/GraphicsTypes.h b/engines/hpl1/engine/graphics/GraphicsTypes.h
index 2e5bcca7119..9e52ff938e5 100644
--- a/engines/hpl1/engine/graphics/GraphicsTypes.h
+++ b/engines/hpl1/engine/graphics/GraphicsTypes.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/graphics/Color.h"
#include "hpl1/engine/math/MathTypes.h"
#include "common/list.h"
-#include <vector>
+#include "common/array.h"
namespace hpl {
@@ -100,10 +100,10 @@ public:
float time;
};
-typedef std::vector<cKeyFrame *> tKeyFramePtrVec;
+typedef Common::Array<cKeyFrame *> tKeyFramePtrVec;
typedef tKeyFramePtrVec::iterator tKeyFramePtrVecIt;
-typedef std::vector<cKeyFrame> tKeyFrameVec;
+typedef Common::Array<cKeyFrame> tKeyFrameVec;
typedef tKeyFrameVec::iterator tKeyFrameVecIt;
//---------------------------------------
@@ -129,7 +129,7 @@ public:
float weight;
};
-typedef std::vector<cVertexBonePair> tVertexBonePairVec;
+typedef Common::Array<cVertexBonePair> tVertexBonePairVec;
typedef tVertexBonePairVec::iterator tVertexBonePairVecIt;
//---------------------------------------
@@ -158,7 +158,7 @@ public:
typedef Common::List<cVertex> tVertexList;
typedef tVertexList::iterator tVertexListIt;
-typedef std::vector<cVertex> tVertexVec;
+typedef Common::Array<cVertex> tVertexVec;
typedef tVertexVec::iterator tVertexVecIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.cpp b/engines/hpl1/engine/graphics/ImageEntityData.cpp
index 53719dc8dda..a427b10514e 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.cpp
+++ b/engines/hpl1/engine/graphics/ImageEntityData.cpp
@@ -113,7 +113,7 @@ bool cImageEntityData::CreateFromFile(const tString &asFile, tIntVec &avImageHan
TiXmlElement *RootElem = pDoc->RootElement();
// Temp test::
- avImageHandle.assign(avImageHandle.size(), -1);
+ Common::fill(avImageHandle.begin(), avImageHandle.end(), -1);
///////// MAIN ///////////////
TiXmlElement *MainElem = RootElem->FirstChildElement("MAIN");
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.h b/engines/hpl1/engine/graphics/ImageEntityData.h
index c86534262b4..e5c531da4b5 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.h
+++ b/engines/hpl1/engine/graphics/ImageEntityData.h
@@ -51,7 +51,7 @@ public:
tVertexVec mvVtx;
};
-typedef std::vector<cImageFrame> tImageFrameVec;
+typedef Common::Array<cImageFrame> tImageFrameVec;
typedef tImageFrameVec::iterator tImageFrameVecIt;
class cImageAnimation {
diff --git a/engines/hpl1/engine/graphics/Material.cpp b/engines/hpl1/engine/graphics/Material.cpp
index 8d032374251..550c93b7742 100644
--- a/engines/hpl1/engine/graphics/Material.cpp
+++ b/engines/hpl1/engine/graphics/Material.cpp
@@ -53,10 +53,10 @@ iMaterial::iMaterial(const tString &asName, iLowLevelGraphics *apLowLevelGraphic
: iResourceBase(asName, 0) {
if (aPicture == eMaterialPicture_Image) {
mvImage.resize(eMaterialTexture_LastEnum);
- mvImage.assign(mvImage.size(), NULL);
+ Common::fill(mvImage.begin(), mvImage.end(), nullptr);
} else {
mvTexture.resize(eMaterialTexture_LastEnum);
- mvTexture.assign(mvTexture.size(), NULL);
+ Common::fill(mvTexture.begin(), mvTexture.end(), nullptr);
}
mType = eMaterialType_Null;
diff --git a/engines/hpl1/engine/graphics/Material.h b/engines/hpl1/engine/graphics/Material.h
index dc500ce3d04..4b475729fa7 100644
--- a/engines/hpl1/engine/graphics/Material.h
+++ b/engines/hpl1/engine/graphics/Material.h
@@ -35,7 +35,7 @@
#include "hpl1/engine/resources/ResourceImage.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "common/list.h"
-#include <vector>
+#include "common/array.h"
class TiXmlElement;
@@ -384,7 +384,7 @@ protected:
// void Destroy();
};
-typedef std::vector<iMaterial *> tMaterialVec;
+typedef Common::Array<iMaterial *> tMaterialVec;
typedef tMaterialVec::iterator tMaterialVecIt;
class iMaterialType {
diff --git a/engines/hpl1/engine/graphics/Mesh.cpp b/engines/hpl1/engine/graphics/Mesh.cpp
index af7efe1f720..d5911db0605 100644
--- a/engines/hpl1/engine/graphics/Mesh.cpp
+++ b/engines/hpl1/engine/graphics/Mesh.cpp
@@ -293,7 +293,7 @@ iPhysicsJoint *cMesh::CreateJointInWorld(const tString &sNamePrefix, cMeshJoint
//-----------------------------------------------------------------------
-void cMesh::CreateNodeBodies(iPhysicsBody **apRootBodyPtr, std::vector<iPhysicsBody *> *apBodyVec,
+void cMesh::CreateNodeBodies(iPhysicsBody **apRootBodyPtr, Common::Array<iPhysicsBody *> *apBodyVec,
cMeshEntity *apEntity, iPhysicsWorld *apPhysicsWorld,
const cMatrixf &a_mtxTransform) {
cMatrixf mtxOldOffset;
@@ -404,10 +404,10 @@ void cMesh::CreateNodeBodies(iPhysicsBody **apRootBodyPtr, std::vector<iPhysicsB
//-----------------------------------------------------------------------
-void cMesh::CreateJointsAndBodies(std::vector<iPhysicsBody *> *apBodyVec, cMeshEntity *apEntity,
- std::vector<iPhysicsJoint *> *apJointVec,
+void cMesh::CreateJointsAndBodies(Common::Array<iPhysicsBody *> *apBodyVec, cMeshEntity *apEntity,
+ Common::Array<iPhysicsJoint *> *apJointVec,
const cMatrixf &a_mtxOffset, iPhysicsWorld *apPhysicsWorld) {
- std::vector<iPhysicsBody *> vBodies;
+ Common::Array<iPhysicsBody *> vBodies;
//////////////////////////////////
// If the mesh has a skeleton, attach the bodies to the bones
diff --git a/engines/hpl1/engine/graphics/Mesh.h b/engines/hpl1/engine/graphics/Mesh.h
index 2c420d2410f..6f9a4a85a29 100644
--- a/engines/hpl1/engine/graphics/Mesh.h
+++ b/engines/hpl1/engine/graphics/Mesh.h
@@ -29,7 +29,6 @@
#define HPL_MESH_H
#include <map>
-#include <vector>
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
@@ -40,6 +39,7 @@
#include "hpl1/engine/physics/PhysicsJoint.h"
#include "hpl1/engine/scene/Light3D.h"
+#include "common/array.h"
namespace hpl {
@@ -62,19 +62,19 @@ class cWorld3D;
//--------------------------------------------------
-typedef std::vector<cAnimation *> tAnimationVec;
+typedef Common::Array<cAnimation *> tAnimationVec;
typedef tAnimationVec::iterator tAnimationVecIt;
typedef std::map<tString, int> tAnimationIndexMap;
typedef tAnimationIndexMap::iterator tAnimationIndexMapIt;
-typedef std::vector<cSubMesh *> tSubMeshVec;
-typedef std::vector<cSubMesh *>::iterator tSubMeshVecIt;
+typedef Common::Array<cSubMesh *> tSubMeshVec;
+typedef Common::Array<cSubMesh *>::iterator tSubMeshVecIt;
typedef std::multimap<tString, cSubMesh *> tSubMeshMap;
typedef tSubMeshMap::iterator tSubMeshMapIt;
-typedef std::vector<cNode3D *> tNode3DVec;
+typedef Common::Array<cNode3D *> tNode3DVec;
typedef tNode3DVec::iterator tNode3DVecIt;
//--------------------------------------------------
@@ -88,7 +88,7 @@ public:
cMatrixf m_mtxOffset;
};
-typedef std::vector<cMeshCollider *> tMeshColliderVec;
+typedef Common::Array<cMeshCollider *> tMeshColliderVec;
typedef tMeshColliderVec::iterator tMeshColliderVecIt;
//--------------------------------------------------
@@ -111,7 +111,7 @@ public:
tString msParentBody;
};
-typedef std::vector<cMeshJoint *> tMeshJointVec;
+typedef Common::Array<cMeshJoint *> tMeshJointVec;
typedef tMeshJointVec::iterator tMeshJointVecIt;
//--------------------------------------------------
@@ -130,7 +130,7 @@ public:
bool mbCastShadows;
};
-typedef std::vector<cMeshLight *> tMeshLightVec;
+typedef Common::Array<cMeshLight *> tMeshLightVec;
typedef tMeshLightVec::iterator tMeshLightVecIt;
//--------------------------------------------------
@@ -147,7 +147,7 @@ public:
cVector3f mvEndPosition;
};
-typedef std::vector<cMeshBeam *> tMeshBeamVec;
+typedef Common::Array<cMeshBeam *> tMeshBeamVec;
typedef tMeshBeamVec::iterator tMeshBeamVecIt;
//--------------------------------------------------
@@ -164,7 +164,7 @@ public:
float mfOffset;
};
-typedef std::vector<cMeshBillboard *> tMeshBillboardVec;
+typedef Common::Array<cMeshBillboard *> tMeshBillboardVec;
typedef tMeshBillboardVec::iterator tMeshBillboardVecIt;
//--------------------------------------------------
@@ -179,7 +179,7 @@ public:
cVector3f mvSize;
};
-typedef std::vector<cMeshParticleSystem *> tMeshParticleSystemVec;
+typedef Common::Array<cMeshParticleSystem *> tMeshParticleSystemVec;
typedef tMeshParticleSystemVec::iterator tMeshParticleSystemVecIt;
//--------------------------------------------------
@@ -193,7 +193,7 @@ public:
cVector3f mvPosition;
};
-typedef std::vector<cMeshSoundEntity *> tMeshSoundEntityVec;
+typedef Common::Array<cMeshSoundEntity *> tMeshSoundEntityVec;
typedef tMeshSoundEntityVec::iterator tMeshSoundEntityVecIt;
//--------------------------------------------------
@@ -207,7 +207,7 @@ public:
cMatrixf m_mtxTransform;
};
-typedef std::vector<cMeshReference *> tMeshReferenceVec;
+typedef Common::Array<cMeshReference *> tMeshReferenceVec;
typedef tMeshReferenceVec::iterator tMeshReferenceVecIt;
//--------------------------------------------------
@@ -252,12 +252,12 @@ public:
iPhysicsBody *apParentBody, iPhysicsBody *apChildBody,
const cMatrixf &a_mtxOffset, iPhysicsWorld *apWorld);
- void CreateNodeBodies(iPhysicsBody **apRootBodyPtr, std::vector<iPhysicsBody *> *apSubBodyVec,
+ void CreateNodeBodies(iPhysicsBody **apRootBodyPtr, Common::Array<iPhysicsBody *> *apSubBodyVec,
cMeshEntity *apEntity, iPhysicsWorld *apWorld,
const cMatrixf &a_mtxTransform);
- void CreateJointsAndBodies(std::vector<iPhysicsBody *> *apBodyVec, cMeshEntity *apEntity,
- std::vector<iPhysicsJoint *> *apJointVec,
+ void CreateJointsAndBodies(Common::Array<iPhysicsBody *> *apBodyVec, cMeshEntity *apEntity,
+ Common::Array<iPhysicsJoint *> *apJointVec,
const cMatrixf &a_mtxOffset, iPhysicsWorld *apWorld);
bool HasSeveralBodies();
diff --git a/engines/hpl1/engine/graphics/Mesh2d.h b/engines/hpl1/engine/graphics/Mesh2d.h
index 7fd1bb98e91..15be9998a4c 100644
--- a/engines/hpl1/engine/graphics/Mesh2d.h
+++ b/engines/hpl1/engine/graphics/Mesh2d.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <vector>
+#include "common/array.h"
namespace hpl {
class cMesh2DEdge {
@@ -45,7 +45,7 @@ public:
unsigned int mlEndIndex;
};
-typedef std::vector<cMesh2DEdge> tMesh2DEdgeVec;
+typedef Common::Array<cMesh2DEdge> tMesh2DEdgeVec;
typedef tMesh2DEdgeVec::iterator tMesh2DEdgeVecIt;
class cCollisionMesh2D {
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter.h b/engines/hpl1/engine/graphics/ParticleEmitter.h
index afb1992011c..3238b35219a 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter.h
@@ -34,7 +34,7 @@
#include "hpl1/engine/system/SystemTypes.h"
#include "common/list.h"
#include <map>
-#include <vector>
+#include "common/array.h"
namespace hpl {
@@ -115,12 +115,12 @@ public:
int mlLowFreqPoints;
int mlHighFreqPoints;
- std::vector<cVector3f> mvBeamPoints;
+ Common::Array<cVector3f> mvBeamPoints;
// ---
};
-typedef std::vector<cParticle *> tParticleVec;
+typedef Common::Array<cParticle *> tParticleVec;
typedef tParticleVec::iterator tParticleVecIt;
//////////////////////////////////////////////////////
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D.h b/engines/hpl1/engine/graphics/ParticleEmitter3D.h
index 43ca58d06bb..98efaa1331d 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D.h
@@ -141,7 +141,7 @@ protected:
iVertexBuffer *mpVtxBuffer;
- std::vector<cPESubDivision> mvSubDivUV;
+ Common::Array<cPESubDivision> mvSubDivUV;
cVector3f mvDirection;
int mlDirectionUpdateCount;
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
index 7a62bc10dcb..b320655e74f 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.h
@@ -230,7 +230,7 @@ private:
bool mbUseBeamNoise;
int mlLowFreqPoints;
- std::vector<unsigned int> mvLFIndices;
+ Common::Array<unsigned int> mvLFIndices;
cVector3f mvMinLowFreqNoise;
cVector3f mvMaxLowFreqNoise;
@@ -238,7 +238,7 @@ private:
cVector3f mvMinHighFreqNoise;
cVector3f mvMaxHighFreqNoise;
- std::vector<tBeamNoisePoint> mvBeamNoisePoints;
+ Common::Array<tBeamNoisePoint> mvBeamNoisePoints;
// ---
};
diff --git a/engines/hpl1/engine/graphics/ParticleSystem3D.h b/engines/hpl1/engine/graphics/ParticleSystem3D.h
index 45810003a60..c489497b89f 100644
--- a/engines/hpl1/engine/graphics/ParticleSystem3D.h
+++ b/engines/hpl1/engine/graphics/ParticleSystem3D.h
@@ -63,7 +63,7 @@ private:
cResources *mpResources;
cGraphics *mpGraphics;
- std::vector<iParticleEmitterData *> mvEmitterData;
+ Common::Array<iParticleEmitterData *> mvEmitterData;
};
//----------------------------------------------------
@@ -135,7 +135,7 @@ private:
cParticleManager *mpParticleManager;
cParticleSystemData3D *mpData;
- std::vector<iParticleEmitter3D *> mvEmitters;
+ Common::Array<iParticleEmitter3D *> mvEmitters;
tString msDataName;
cVector3f mvDataSize;
diff --git a/engines/hpl1/engine/graphics/Skeleton.h b/engines/hpl1/engine/graphics/Skeleton.h
index 41f9b63f6e3..65de70e88d5 100644
--- a/engines/hpl1/engine/graphics/Skeleton.h
+++ b/engines/hpl1/engine/graphics/Skeleton.h
@@ -38,7 +38,7 @@ namespace hpl {
class cBone;
-typedef std::vector<cBone *> tBoneVec;
+typedef Common::Array<cBone *> tBoneVec;
typedef tBoneVec::iterator tBoneVecIt;
typedef std::map<tString, int> tBoneIdxNameMap;
diff --git a/engines/hpl1/engine/graphics/Texture.h b/engines/hpl1/engine/graphics/Texture.h
index e4a52354e1f..a726484dca2 100644
--- a/engines/hpl1/engine/graphics/Texture.h
+++ b/engines/hpl1/engine/graphics/Texture.h
@@ -33,7 +33,7 @@
#include "hpl1/engine/graphics/LowLevelPicture.h"
#include "hpl1/engine/resources/ResourceBase.h"
#include "graphics/pixelformat.h"
-#include <vector>
+#include "common/array.h"
namespace hpl {
@@ -196,7 +196,7 @@ protected:
cVector2l mvMinLevelSize;
};
-typedef std::vector<iTexture *> tTextureVec;
+typedef Common::Array<iTexture *> tTextureVec;
typedef tTextureVec::iterator tTextureVecIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/bitmap2D.h b/engines/hpl1/engine/graphics/bitmap2D.h
index 4ef51e7d611..004c074d6cb 100644
--- a/engines/hpl1/engine/graphics/bitmap2D.h
+++ b/engines/hpl1/engine/graphics/bitmap2D.h
@@ -73,8 +73,8 @@ private:
bool _isSurfaceActive;
};
-typedef std::vector<Bitmap2D *> tBitmap2DVec;
-typedef std::vector<Bitmap2D *>::iterator tBitmap2DVecIt;
+typedef Common::Array<Bitmap2D *> tBitmap2DVec;
+typedef Common::Array<Bitmap2D *>::iterator tBitmap2DVecIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/font_data.cpp b/engines/hpl1/engine/graphics/font_data.cpp
index bbcb897fd65..f906562a47d 100644
--- a/engines/hpl1/engine/graphics/font_data.cpp
+++ b/engines/hpl1/engine/graphics/font_data.cpp
@@ -44,7 +44,7 @@
#include "common/ptr.h"
#include "common/array.h"
#include "common/rect.h"
-
+#include "hpl1/algorithms.h"
namespace hpl {
@@ -143,8 +143,8 @@ void FontData::loadNextGlyph(const TiXmlElement *charIt, BitmapArray &bitmaps, c
void FontData::loadGlyphs(const TiXmlElement *charsRoot, BitmapArray &bitmaps, const cVector2l &fontSize) {
const TiXmlElement *charIt = charsRoot->FirstChildElement("char");
- _glyphs.resize(3000, nullptr);
- for (; charIt != nullptr; charIt = charIt->NextSiblingElement("char"))
+ Hpl1::resizeAndFill(_glyphs, 3000, nullptr);
+ for(; charIt != nullptr; charIt = charIt->NextSiblingElement("char"))
loadNextGlyph(charIt, bitmaps, fontSize);
}
diff --git a/engines/hpl1/engine/graphics/font_data.h b/engines/hpl1/engine/graphics/font_data.h
index 75aacb83a35..270f736ce37 100644
--- a/engines/hpl1/engine/graphics/font_data.h
+++ b/engines/hpl1/engine/graphics/font_data.h
@@ -35,7 +35,6 @@
#include "hpl1/engine/system/SystemTypes.h"
#include "common/array.h"
#include "common/ptr.h"
-#include <vector>
class TiXmlElement;
@@ -62,7 +61,7 @@ public:
float _advance;
};
-typedef std::vector<Glyph *> tGlyphVec;
+typedef Common::Array<Glyph *> tGlyphVec;
typedef tGlyphVec::iterator tGlyphVecIt;
class FontData : public iResourceBase {
diff --git a/engines/hpl1/engine/gui/Gui.cpp b/engines/hpl1/engine/gui/Gui.cpp
index 60eaa053764..161984b5dc2 100644
--- a/engines/hpl1/engine/gui/Gui.cpp
+++ b/engines/hpl1/engine/gui/Gui.cpp
@@ -363,7 +363,7 @@ cGuiGfxElement *cGui::CreateGfxImageBuffer(const tString &asFile, eGuiMaterial a
tString sName = cString::SetFileExt(asFile, "");
tString sExt = cString::GetFileExt(asFile);
- std::vector<cResourceImage *> vImages;
+ Common::Array<cResourceImage *> vImages;
int lFileNum = 0;
while (true) {
diff --git a/engines/hpl1/engine/gui/GuiGfxElement.h b/engines/hpl1/engine/gui/GuiGfxElement.h
index f7e895429e8..4737596c02d 100644
--- a/engines/hpl1/engine/gui/GuiGfxElement.h
+++ b/engines/hpl1/engine/gui/GuiGfxElement.h
@@ -62,7 +62,7 @@ public:
private:
tString msName;
- std::vector<int> mvFrames;
+ Common::Array<int> mvFrames;
float mfFrameLength;
eGuiGfxAnimationType mType;
};
@@ -120,9 +120,9 @@ private:
iTexture *mvTextures[kMaxGuiTextures];
cResourceImage *mvImages[kMaxGuiTextures];
- std::vector<cResourceImage *> mvImageBufferVec;
+ Common::Array<cResourceImage *> mvImageBufferVec;
- std::vector<cGuiGfxAnimation *> mvAnimations;
+ Common::Array<cGuiGfxAnimation *> mvAnimations;
int mlCurrentAnimation;
float mfCurrentFrame;
int mlActiveImage;
diff --git a/engines/hpl1/engine/gui/GuiSkin.cpp b/engines/hpl1/engine/gui/GuiSkin.cpp
index 3772aa912ca..e684a304838 100644
--- a/engines/hpl1/engine/gui/GuiSkin.cpp
+++ b/engines/hpl1/engine/gui/GuiSkin.cpp
@@ -67,8 +67,8 @@ cGuiSkin::cGuiSkin(const tString &asName, cGui *apGui) {
mpGui = apGui;
msName = asName;
- mvGfxElements.resize(eGuiSkinGfx_LastEnum, NULL);
- mvFonts.resize(eGuiSkinFont_LastEnum, NULL);
+ Hpl1::resizeAndFill(mvGfxElements, eGuiSkinGfx_LastEnum, nullptr);
+ Hpl1::resizeAndFill(mvFonts, eGuiSkinGfx_LastEnum, nullptr);
mvAttributes.resize(eGuiSkinAttribute_LastEnum);
}
diff --git a/engines/hpl1/engine/gui/GuiSkin.h b/engines/hpl1/engine/gui/GuiSkin.h
index cfa01dd259e..f39a5bd3aed 100644
--- a/engines/hpl1/engine/gui/GuiSkin.h
+++ b/engines/hpl1/engine/gui/GuiSkin.h
@@ -74,9 +74,9 @@ private:
tString msName;
cGui *mpGui;
- std::vector<cGuiGfxElement *> mvGfxElements;
- std::vector<cGuiSkinFont *> mvFonts;
- std::vector<cVector3f> mvAttributes;
+ Common::Array<cGuiGfxElement *> mvGfxElements;
+ Common::Array<cGuiSkinFont *> mvFonts;
+ Common::Array<cVector3f> mvAttributes;
};
} // namespace hpl
diff --git a/engines/hpl1/engine/gui/Widget.h b/engines/hpl1/engine/gui/Widget.h
index 86621866e2e..880f5fc08bf 100644
--- a/engines/hpl1/engine/gui/Widget.h
+++ b/engines/hpl1/engine/gui/Widget.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/gui/GuiTypes.h"
#include "hpl1/engine/system/low_level_system.h"
#include "common/list.h"
-#include <vector>
+#include "common/array.h"
namespace hpl {
@@ -233,7 +233,7 @@ private:
void SetMouseIsOver(bool abX) { mbMouseIsOver = abX; }
bool ProcessCallbacks(eGuiMessage aMessage, cGuiMessageData &aData);
- std::vector<tWidgetCallbackList> mvCallbackLists;
+ Common::Array<tWidgetCallbackList> mvCallbackLists;
bool mbPositionIsUpdated;
};
diff --git a/engines/hpl1/engine/gui/WidgetWindow.h b/engines/hpl1/engine/gui/WidgetWindow.h
index 6e9bb03804a..e2859bba57c 100644
--- a/engines/hpl1/engine/gui/WidgetWindow.h
+++ b/engines/hpl1/engine/gui/WidgetWindow.h
@@ -28,10 +28,9 @@
#ifndef HPL_WIDGET_WINDOW_H
#define HPL_WIDGET_WINDOW_H
-#include <vector>
-
#include "hpl1/engine/gui/Widget.h"
#include "common/list.h"
+#include "common/array.h"
namespace hpl {
diff --git a/engines/hpl1/engine/haptic/HapticTypes.h b/engines/hpl1/engine/haptic/HapticTypes.h
index 43e658dc21d..b52a4b6d3ff 100644
--- a/engines/hpl1/engine/haptic/HapticTypes.h
+++ b/engines/hpl1/engine/haptic/HapticTypes.h
@@ -28,10 +28,10 @@
#ifndef HPL_HAPTIC_TYPES_H
#define HPL_HAPTIC_TYPES_H
-#include <vector>
#include <map>
#include "hpl1/engine/system/SystemTypes.h"
#include "common/list.h"
+#include "common/array.h"
namespace hpl {
@@ -76,7 +76,7 @@ class iHapticSurface;
//----------------------------------------------
-typedef std::vector<iHapticShape *> tHapticShapeVec;
+typedef Common::Array<iHapticShape *> tHapticShapeVec;
typedef tHapticShapeVec::iterator tHapticShapeVecIt;
typedef Common::List<iHapticShape *> tHapticShapeList;
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.cpp b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
index 749cf05987e..d639bbc7b5a 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.cpp
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.cpp
@@ -206,7 +206,7 @@ cVector3f cCollideShapeNewton::GetInertia(float afMass) {
//-----------------------------------------------------------------------
void cCollideShapeNewton::CreateFromShapeVec(tCollideShapeVec &avShapes) {
- std::vector<NewtonCollision *> vNewtonColliders;
+ Common::Array<NewtonCollision *> vNewtonColliders;
vNewtonColliders.reserve(avShapes.size());
mvSubShapes.reserve(avShapes.size());
diff --git a/engines/hpl1/engine/impl/CollideShapeNewton.h b/engines/hpl1/engine/impl/CollideShapeNewton.h
index 146053684c4..51813290775 100644
--- a/engines/hpl1/engine/impl/CollideShapeNewton.h
+++ b/engines/hpl1/engine/impl/CollideShapeNewton.h
@@ -38,7 +38,7 @@ namespace hpl {
class iVertexBuffer;
class iCollideShape;
-typedef std::vector<iCollideShape *> tCollideShapeVec;
+typedef Common::Array<iCollideShape *> tCollideShapeVec;
typedef tCollideShapeVec::iterator tCollideShapeVecIt;
class cCollideShapeNewton : public iCollideShape {
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.h b/engines/hpl1/engine/impl/MeshLoaderCollada.h
index 5e4e5be4ded..07652ffc62d 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.h
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.h
@@ -65,7 +65,7 @@ public:
tString msSource;
};
-typedef std::vector<cColladaImage> tColladaImageVec;
+typedef Common::Array<cColladaImage> tColladaImageVec;
//------------------------------------------------
@@ -77,7 +77,7 @@ public:
tString msImage;
};
-typedef std::vector<cColladaTexture> tColladaTextureVec;
+typedef Common::Array<cColladaTexture> tColladaTextureVec;
//------------------------------------------------
@@ -90,7 +90,7 @@ public:
cColor mDiffuseColor;
};
-typedef std::vector<cColladaMaterial> tColladaMaterialVec;
+typedef Common::Array<cColladaMaterial> tColladaMaterialVec;
//------------------------------------------------
@@ -104,7 +104,7 @@ public:
float mfAngle;
};
-typedef std::vector<cColladaLight> tColladaLightVec;
+typedef Common::Array<cColladaLight> tColladaLightVec;
//------------------------------------------------
@@ -119,7 +119,7 @@ public:
tVector3fVec mvArray;
};
-typedef std::vector<cColladaVtxArray> tColladaVtxArrayVec;
+typedef Common::Array<cColladaVtxArray> tColladaVtxArrayVec;
class cColladaVtxIndex {
public:
@@ -128,7 +128,7 @@ public:
int mlTex;
};
-typedef std::vector<cColladaVtxIndex> tColladaVtxIndexVec;
+typedef Common::Array<cColladaVtxIndex> tColladaVtxIndexVec;
//------------------------------------------------
@@ -161,7 +161,7 @@ public:
typedef Common::List<cColladaExtraVtx> tColladaExtraVtxList;
typedef tColladaExtraVtxList::iterator tColladaExtraVtxListIt;
-typedef std::vector<tColladaExtraVtxList> tColladaExtraVtxListVec;
+typedef Common::Array<tColladaExtraVtxList> tColladaExtraVtxListVec;
//------------------------------------------------
@@ -204,7 +204,7 @@ public:
int mlTexArrayIdx; // The index for array containing texcoords
};
-typedef std::vector<cColladaGeometry> tColladaGeometryVec;
+typedef Common::Array<cColladaGeometry> tColladaGeometryVec;
//------------------------------------------------
@@ -223,7 +223,7 @@ public:
typedef Common::List<cColladaJointPair> tColladaJointPairList;
typedef tColladaJointPairList::iterator tColladaJointPairListIt;
-typedef std::vector<tColladaJointPairList> tColladaJointPairListVec;
+typedef Common::Array<tColladaJointPairList> tColladaJointPairListVec;
class cColladaController {
public:
@@ -244,7 +244,7 @@ public:
tColladaJointPairListVec mvPairs;
};
-typedef std::vector<cColladaController> tColladaControllerVec;
+typedef Common::Array<cColladaController> tColladaControllerVec;
//------------------------------------------------
@@ -255,7 +255,7 @@ public:
tString msSource;
};
-typedef std::vector<cColladaChannel> tColladaChannelVec;
+typedef Common::Array<cColladaChannel> tColladaChannelVec;
class cColladaSampler {
public:
@@ -266,7 +266,7 @@ public:
tString msTarget;
};
-typedef std::vector<cColladaSampler> tColladaSamplerVec;
+typedef Common::Array<cColladaSampler> tColladaSamplerVec;
class cColladaAnimSource {
public:
@@ -274,7 +274,7 @@ public:
tFloatVec mvValues;
};
-typedef std::vector<cColladaAnimSource> tColladaAnimSourceVec;
+typedef Common::Array<cColladaAnimSource> tColladaAnimSourceVec;
class cColladaAnimation {
public:
@@ -298,7 +298,7 @@ public:
}
};
-typedef std::vector<cColladaAnimation> tColladaAnimationVec;
+typedef Common::Array<cColladaAnimation> tColladaAnimationVec;
//------------------------------------------------
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
index ce74df30524..dc01e696547 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
@@ -94,7 +94,7 @@ public:
int mlIndex;
};
-typedef std::vector<cTempAnimData> tTempAnimDataVec;
+typedef Common::Array<cTempAnimData> tTempAnimDataVec;
typedef std::set<float> tTempTimesSet;
typedef std::set<float>::iterator tTempTimesSetIt;
@@ -1580,7 +1580,7 @@ public:
tString msData;
};
-tString *GetFinalSource(std::vector<cEffectNewParam> &avParams, tString &asId) {
+tString *GetFinalSource(Common::Array<cEffectNewParam> &avParams, tString &asId) {
for (size_t i = 0; i < avParams.size(); ++i) {
if (asId == avParams[i].msId) {
return GetFinalSource(avParams, avParams[i].msData);
@@ -1602,7 +1602,7 @@ void cMeshLoaderCollada::LoadTextures(TiXmlElement *apRootElem, tColladaTextureV
// COLLADA 1.4
TiXmlElement *pProfileCommon = pTextureElem->FirstChildElement("profile_COMMON");
if (pProfileCommon) {
- std::vector<cEffectNewParam> vNewParams;
+ Common::Array<cEffectNewParam> vNewParams;
//////////////////////////
// Iterate all newparams
TiXmlElement *pNewParamElem = pProfileCommon->FirstChildElement("newparam");
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
index e2f5de9cb3a..6b8a081e344 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
@@ -545,7 +545,7 @@ static void SaveControllerVec(TiXmlElement *apRootElem, tColladaControllerVec *a
pPairVecElem->SetAttribute("Size", (int)pController->mvPairs.size());
tIntVec vPairNumVec;
- vPairNumVec.resize(pController->mvPairs.size(), 0);
+ Hpl1::resizeAndFill(vPairNumVec, pController->mvPairs.size(), 0);
////////////////////////////////
// The pair connections
@@ -677,7 +677,7 @@ static void SaveGeometryVec(TiXmlElement *apRootElem, tColladaGeometryVec *apCol
pExtraVertexVecElem->SetAttribute("Size", (int)pGeometry->mvExtraVtxVec.size());
tUIntVec vExtraNum;
- vExtraNum.resize(pGeometry->mvExtraVtxVec.size(), 0);
+ Hpl1::resizeAndFill(vExtraNum, pGeometry->mvExtraVtxVec.size(), 0);
////////////////////////////
// Extra vertices
diff --git a/engines/hpl1/engine/impl/PBuffer.h b/engines/hpl1/engine/impl/PBuffer.h
index 69d3cc732d9..838a6db71e1 100644
--- a/engines/hpl1/engine/impl/PBuffer.h
+++ b/engines/hpl1/engine/impl/PBuffer.h
@@ -66,8 +66,8 @@ namespace hpl {
bool mbShareObjects;
iLowLevelGraphics* mpLowLevelGraphics;
- std::vector<int> mvAttribBuffer;
- std::vector<int> mvAttribFormat;
+ Common::Array<int> mvAttribBuffer;
+ Common::Array<int> mvAttribFormat;
};
};
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index 73ab24d360e..b3a3ea492b3 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -1208,8 +1208,8 @@ bool cMath::CreateTriTangentVectors(float *apDestArray,
// Log("Num of indices: %d\n",alIndexNum);
// Log("Num of vertrices: %d\n",alVertexNum);
- vTempTangents1.resize(alVertexNum, cVector3f(0, 0, 0));
- vTempTangents2.resize(alVertexNum, cVector3f(0, 0, 0));
+ Hpl1::resizeAndFill(vTempTangents1, alVertexNum, cVector3f(0,0,0));
+ Hpl1::resizeAndFill(vTempTangents2, alVertexNum, cVector3f(0,0,0));
// Iterate through the triangles
for (int triIdx = 0; triIdx < alIndexNum; triIdx += 3) {
diff --git a/engines/hpl1/engine/math/MathTypes.h b/engines/hpl1/engine/math/MathTypes.h
index e9d77262f96..addf3999fde 100644
--- a/engines/hpl1/engine/math/MathTypes.h
+++ b/engines/hpl1/engine/math/MathTypes.h
@@ -34,7 +34,7 @@
#include "hpl1/engine/system/SystemTypes.h"
#include <cmath>
#include <cstdlib>
-#include <vector>
+#include "common/array.h"
#include "common/list.h"
namespace hpl {
@@ -199,7 +199,7 @@ public:
};
typedef cPlane<float> cPlanef;
-typedef std::vector<cPlanef> tPlanefVec;
+typedef Common::Array<cPlanef> tPlanefVec;
typedef tPlanefVec tPlanefVecIt;
//-------------------------------------------
@@ -272,7 +272,7 @@ typedef cVector2<int> cVector2l;
typedef cMatrix<float> cMatrixf;
-typedef std::vector<cMatrixf> tMatrixfVec;
+typedef Common::Array<cMatrixf> tMatrixfVec;
typedef tMatrixfVec::iterator tMatrixfVecIt;
typedef Common::List<cMatrixf> tMatrixfList;
@@ -287,10 +287,10 @@ typedef cVector3<int> cVector3l;
typedef Common::List<cVector3f> tVector3fList;
typedef tVector3fList::iterator tVector3fListIt;
-typedef std::vector<cVector2f> tVector2fVec;
+typedef Common::Array<cVector2f> tVector2fVec;
typedef tVector2fVec::iterator tVector2fVecIt;
-typedef std::vector<cVector3f> tVector3fVec;
+typedef Common::Array<cVector3f> tVector3fVec;
typedef tVector3fList::iterator tVector3fVecIt;
//-------------------------------------------
diff --git a/engines/hpl1/engine/math/MeshTypes.h b/engines/hpl1/engine/math/MeshTypes.h
index 5e8fda2b11e..f9c25b9fa38 100644
--- a/engines/hpl1/engine/math/MeshTypes.h
+++ b/engines/hpl1/engine/math/MeshTypes.h
@@ -46,7 +46,7 @@ public:
}
};
-typedef std::vector<cTriangleData> tTriangleDataVec;
+typedef Common::Array<cTriangleData> tTriangleDataVec;
typedef tTriangleDataVec::iterator tTriangleDataVecIt;
//----------------------------------------------
@@ -66,7 +66,7 @@ public:
}
};
-typedef std::vector<cTriEdge> tTriEdgeVec;
+typedef Common::Array<cTriEdge> tTriEdgeVec;
typedef tTriEdgeVec::iterator tTriEdgeVecIt;
//----------------------------------------------
diff --git a/engines/hpl1/engine/math/PidController.h b/engines/hpl1/engine/math/PidController.h
index 334a2cf876c..6d5b9fb26cf 100644
--- a/engines/hpl1/engine/math/PidController.h
+++ b/engines/hpl1/engine/math/PidController.h
@@ -29,6 +29,7 @@
#define HPL_PID_CONTROLLER_H
#include "hpl1/engine/math/MathTypes.h"
+#include "hpl1/algorithms.h"
namespace hpl {
@@ -82,7 +83,7 @@ public:
void SetErrorNum(int alErrorNum) {
mvErrors.resize(alErrorNum);
- mvTimeSteps.resize(alErrorNum, 0);
+ Hpl1::resizeAndFill(mvTimeSteps, alErrorNum, 0.f);
}
//------------------------------------
@@ -90,7 +91,7 @@ public:
void Reset() {
mlErrorNum = 0;
mlLastNum = -1;
- mvTimeSteps.assign(mvTimeSteps.size(), 0);
+ Common::fill(mvTimeSteps.begin(), mvTimeSteps.end(), 0);
integral = 0;
derivative = 0;
@@ -115,8 +116,8 @@ public:
//------------------------------------
private:
- std::vector<T> mvErrors;
- std::vector<float> mvTimeSteps;
+ Common::Array<T> mvErrors;
+ Common::Array<float> mvTimeSteps;
T integral, derivative;
diff --git a/engines/hpl1/engine/physics/CharacterBody.cpp b/engines/hpl1/engine/physics/CharacterBody.cpp
index b3f35a7dee4..9284bf81031 100644
--- a/engines/hpl1/engine/physics/CharacterBody.cpp
+++ b/engines/hpl1/engine/physics/CharacterBody.cpp
@@ -1292,7 +1292,7 @@ void iCharacterBody::SaveToSaveData(iSaveData *apSaveData) {
// Pointers
kSaveData_SaveObject(mpEntity, mlEntityId);
kSaveData_SaveObject(mpBody, mlBodyId);
- kSaveData_SaveIdList(mvExtraBodies, std::vector<iPhysicsBody *>::iterator, mvExtraBodyIds);
+ kSaveData_SaveIdList(mvExtraBodies, Common::Array<iPhysicsBody *>::iterator, mvExtraBodyIds);
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/physics/CharacterBody.h b/engines/hpl1/engine/physics/CharacterBody.h
index c48cd67f7a5..aa73e3615de 100644
--- a/engines/hpl1/engine/physics/CharacterBody.h
+++ b/engines/hpl1/engine/physics/CharacterBody.h
@@ -407,7 +407,7 @@ protected:
iPhysicsBody *mpBody;
iPhysicsWorld *mpWorld;
- std::vector<iPhysicsBody *> mvExtraBodies;
+ Common::Array<iPhysicsBody *> mvExtraBodies;
};
} // namespace hpl
diff --git a/engines/hpl1/engine/physics/CollideData.h b/engines/hpl1/engine/physics/CollideData.h
index f8884a38ff5..eb74195402c 100644
--- a/engines/hpl1/engine/physics/CollideData.h
+++ b/engines/hpl1/engine/physics/CollideData.h
@@ -40,7 +40,7 @@ public:
float mfDepth;
};
-typedef std::vector<cCollidePoint> tCollidePointVec;
+typedef Common::Array<cCollidePoint> tCollidePointVec;
typedef tCollidePointVec::iterator tCollidePointVecIt;
class cCollideData {
diff --git a/engines/hpl1/engine/physics/PhysicsBody.cpp b/engines/hpl1/engine/physics/PhysicsBody.cpp
index 24768f5946b..94b8a44afed 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.cpp
+++ b/engines/hpl1/engine/physics/PhysicsBody.cpp
@@ -188,7 +188,7 @@ int iPhysicsBody::GetJointNum() {
}
void iPhysicsBody::RemoveJoint(iPhysicsJoint *apJoint) {
- std::vector<iPhysicsJoint *>::iterator it = mvJoints.begin();
+ Common::Array<iPhysicsJoint *>::iterator it = mvJoints.begin();
for (; it != mvJoints.end(); ++it) {
if (*it == apJoint) {
mvJoints.erase(it);
diff --git a/engines/hpl1/engine/physics/PhysicsBody.h b/engines/hpl1/engine/physics/PhysicsBody.h
index 865bf1f88c1..6e2373f0045 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.h
+++ b/engines/hpl1/engine/physics/PhysicsBody.h
@@ -292,7 +292,7 @@ protected:
iCharacterBody *mpCharacterBody;
- std::vector<iPhysicsJoint *> mvJoints;
+ Common::Array<iPhysicsJoint *> mvJoints;
Common::List<iCharacterBody *> mlstAttachedCharacters;
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.h b/engines/hpl1/engine/physics/PhysicsWorld.h
index 149580c2143..a5c865a0ed3 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.h
+++ b/engines/hpl1/engine/physics/PhysicsWorld.h
@@ -57,7 +57,7 @@ class cBoundingVolume;
typedef Common::List<iCollideShape *> tCollideShapeList;
typedef tCollideShapeList::iterator tCollideShapeListIt;
-typedef std::vector<iCollideShape *> tCollideShapeVec;
+typedef Common::Array<iCollideShape *> tCollideShapeVec;
typedef tCollideShapeVec::iterator tCollideShapeVecIt;
typedef Common::List<iPhysicsBody *> tPhysicsBodyList;
diff --git a/engines/hpl1/engine/physics/SurfaceData.h b/engines/hpl1/engine/physics/SurfaceData.h
index 34ec1193eb7..9edcb40ef4b 100644
--- a/engines/hpl1/engine/physics/SurfaceData.h
+++ b/engines/hpl1/engine/physics/SurfaceData.h
@@ -67,7 +67,7 @@ private:
int mlPSPrio;
};
-typedef std::vector<cSurfaceImpactData *> tSurfaceImpactDataVec;
+typedef Common::Array<cSurfaceImpactData *> tSurfaceImpactDataVec;
typedef tSurfaceImpactDataVec::iterator tSurfaceImpactDataVecIt;
//----------------------------------------
diff --git a/engines/hpl1/engine/resources/EntityLoader_Object.h b/engines/hpl1/engine/resources/EntityLoader_Object.h
index 5ab9ef919db..135e4b11eba 100644
--- a/engines/hpl1/engine/resources/EntityLoader_Object.h
+++ b/engines/hpl1/engine/resources/EntityLoader_Object.h
@@ -74,16 +74,16 @@ protected:
tString msFileName;
- std::vector<iPhysicsBody *> mvBodies;
- std::vector<iPhysicsJoint *> mvJoints;
+ Common::Array<iPhysicsBody *> mvBodies;
+ Common::Array<iPhysicsJoint *> mvJoints;
- std::vector<iHapticShape *> mvHapticShapes;
+ Common::Array<iHapticShape *> mvHapticShapes;
- std::vector<iLight3D *> mvLights;
- std::vector<cParticleSystem3D *> mvParticleSystems;
- std::vector<cBillboard *> mvBillboards;
- std::vector<cBeam *> mvBeams;
- std::vector<cSoundEntity *> mvSoundEntities;
+ Common::Array<iLight3D *> mvLights;
+ Common::Array<cParticleSystem3D *> mvParticleSystems;
+ Common::Array<cBillboard *> mvBillboards;
+ Common::Array<cBeam *> mvBeams;
+ Common::Array<cSoundEntity *> mvSoundEntities;
cMeshEntity *mpEntity;
cMesh *mpMesh;
diff --git a/engines/hpl1/engine/resources/ImageEntityManager.cpp b/engines/hpl1/engine/resources/ImageEntityManager.cpp
index a80e5b0a99e..52115881604 100644
--- a/engines/hpl1/engine/resources/ImageEntityManager.cpp
+++ b/engines/hpl1/engine/resources/ImageEntityManager.cpp
@@ -32,6 +32,7 @@
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
+#include "common/algorithm.h"
namespace hpl {
@@ -48,7 +49,7 @@ cImageEntityManager::cImageEntityManager(cGraphics *apGraphics, cResources *apRe
mpResources = apResources;
mvImageHandle.resize(eMaterialTexture_LastEnum);
- mvImageHandle.assign(mvImageHandle.size(), -1);
+ Common::fill(mvImageHandle.begin(), mvImageHandle.end(), -1);
}
cImageEntityManager::~cImageEntityManager() {
diff --git a/engines/hpl1/engine/resources/ResourceImage.h b/engines/hpl1/engine/resources/ResourceImage.h
index 78f001449ae..215e8f7a9dc 100644
--- a/engines/hpl1/engine/resources/ResourceImage.h
+++ b/engines/hpl1/engine/resources/ResourceImage.h
@@ -28,12 +28,11 @@
#ifndef HPL_RESOURCE_IMAGE_H
#define HPL_RESOURCE_IMAGE_H
-#include <vector>
-
#include "hpl1/engine/resources/ResourceBase.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
+#include "common/array.h"
namespace hpl {
@@ -84,7 +83,7 @@ private:
int mlHandle;
};
-typedef std::vector<cResourceImage *> tResourceImageVec;
+typedef Common::Array<cResourceImage *> tResourceImageVec;
typedef tResourceImageVec::iterator tResourceImageVecIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/resources/ResourceManager.cpp b/engines/hpl1/engine/resources/ResourceManager.cpp
index aa5589decbc..d41f9c2d9d6 100644
--- a/engines/hpl1/engine/resources/ResourceManager.cpp
+++ b/engines/hpl1/engine/resources/ResourceManager.cpp
@@ -124,7 +124,7 @@ void iResourceManager::DestroyUnused(int alMaxToKeep) {
return;
// Add resources to a vector
- std::vector<iResourceBase *> vResources;
+ Common::Array<iResourceBase *> vResources;
vResources.reserve(m_mapHandleResources.size());
tResourceHandleMapIt it = m_mapHandleResources.begin();
diff --git a/engines/hpl1/engine/resources/TextureManager.cpp b/engines/hpl1/engine/resources/TextureManager.cpp
index aa66e2e7982..567796dee6d 100644
--- a/engines/hpl1/engine/resources/TextureManager.cpp
+++ b/engines/hpl1/engine/resources/TextureManager.cpp
@@ -332,7 +332,7 @@ iTexture *cTextureManager::CreateAttenuation(const tString &asFallOffName) {
cVector3f vCentre = ((float)lSize) / 2.0f;
float fMaxDist = ((float)lSize) / 2.0f; // radius of sphere
- std::vector<unsigned char> vAttenMap;
+ Common::Array<unsigned char> vAttenMap;
vAttenMap.resize(lSize * lSize * lSize * lAttChannels);
// Log("CREATTING ATTENUTAION MAP\n");
diff --git a/engines/hpl1/engine/scene/AnimationState.h b/engines/hpl1/engine/scene/AnimationState.h
index e83a3c18617..4097afecaad 100644
--- a/engines/hpl1/engine/scene/AnimationState.h
+++ b/engines/hpl1/engine/scene/AnimationState.h
@@ -164,7 +164,7 @@ private:
cAnimation *mpAnimation;
- std::vector<cAnimationEvent *> mvEvents;
+ Common::Array<cAnimationEvent *> mvEvents;
// Properties of the animation
float mfLength;
diff --git a/engines/hpl1/engine/scene/GridMap2D.h b/engines/hpl1/engine/scene/GridMap2D.h
index 2e491afe4ab..202ec689f53 100644
--- a/engines/hpl1/engine/scene/GridMap2D.h
+++ b/engines/hpl1/engine/scene/GridMap2D.h
@@ -29,10 +29,10 @@
#define HPL_GRIDMAP2D_H
#include <map>
-#include <vector>
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
+#include "common/array.h"
namespace hpl {
@@ -43,7 +43,7 @@ class iLowLevelGraphics;
class cGrid2D;
class cGridMap2D;
-typedef std::vector<cGrid2D *> tGrid2DPtrVec;
+typedef Common::Array<cGrid2D *> tGrid2DPtrVec;
typedef tGrid2DPtrVec::iterator tGrid2DPtrVecIt;
class cGrid2DObject {
@@ -142,7 +142,7 @@ private:
/////////// GRID MAP ////////////
-typedef std::vector<cGrid2D> tGrid2DVec;
+typedef Common::Array<cGrid2D> tGrid2DVec;
typedef tGrid2DVec::iterator tGrid2DVecIt;
class cGridMap2D {
diff --git a/engines/hpl1/engine/scene/ImageEntity.h b/engines/hpl1/engine/scene/ImageEntity.h
index a58163c2de9..ec7d801868c 100644
--- a/engines/hpl1/engine/scene/ImageEntity.h
+++ b/engines/hpl1/engine/scene/ImageEntity.h
@@ -30,7 +30,7 @@
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/scene/Entity2D.h"
-#include <vector>
+#include "common/array.h"
class TiXmlElement;
@@ -132,7 +132,7 @@ private:
tString msTempString;
};
-typedef std::vector<cImageEntity *> tImageEntityVec;
+typedef Common::Array<cImageEntity *> tImageEntityVec;
typedef tImageEntityVec::iterator tImageEntityVecIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/scene/Light3D.cpp b/engines/hpl1/engine/scene/Light3D.cpp
index 6a34c866525..83ab9dd57a7 100644
--- a/engines/hpl1/engine/scene/Light3D.cpp
+++ b/engines/hpl1/engine/scene/Light3D.cpp
@@ -521,7 +521,7 @@ void iLight3D::AttachBillboard(cBillboard *apBillboard) {
}
void iLight3D::RemoveBillboard(cBillboard *apBillboard) {
- std::vector<cBillboard *>::iterator it = mvBillboards.begin();
+ Common::Array<cBillboard *>::iterator it = mvBillboards.begin();
for (; it != mvBillboards.end(); ++it) {
if (*it == apBillboard) {
mvBillboards.erase(it);
diff --git a/engines/hpl1/engine/scene/Light3D.h b/engines/hpl1/engine/scene/Light3D.h
index df15ba69f3a..0424bc65faa 100644
--- a/engines/hpl1/engine/scene/Light3D.h
+++ b/engines/hpl1/engine/scene/Light3D.h
@@ -170,7 +170,7 @@ public:
void AttachBillboard(cBillboard *apBillboard);
void RemoveBillboard(cBillboard *apBillboard);
- std::vector<cBillboard *> *GetBillboardVec() { return &mvBillboards; }
+ Common::Array<cBillboard *> *GetBillboardVec() { return &mvBillboards; }
inline iTexture *GetTempTexture(size_t alIdx) { return mvTempTextures[alIdx]; }
inline void SetTempTexture(size_t alIdx, iTexture *apTex) { mvTempTextures[alIdx] = apTex; }
@@ -203,7 +203,7 @@ protected:
iTexture *mvTempTextures[3];
- std::vector<cBillboard *> mvBillboards;
+ Common::Array<cBillboard *> mvBillboards;
cMatrixf mtxTemp;
diff --git a/engines/hpl1/engine/scene/MeshEntity.h b/engines/hpl1/engine/scene/MeshEntity.h
index eb31761968e..87e991b73c2 100644
--- a/engines/hpl1/engine/scene/MeshEntity.h
+++ b/engines/hpl1/engine/scene/MeshEntity.h
@@ -29,7 +29,6 @@
#define HPL_MESH_ENTITY_H
#include <map>
-#include <vector>
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/Renderable.h"
@@ -41,6 +40,7 @@
#include "hpl1/engine/scene/SubMeshEntity.h"
#include "hpl1/engine/scene/AnimationState.h"
+#include "common/array.h"
namespace hpl {
@@ -242,7 +242,7 @@ private:
tNodeStateIndexMap m_mapBoneStateIndices;
tNodeStateVec mvTempBoneStates;
- std::vector<cMatrixf> mvBoneMatrices;
+ Common::Array<cMatrixf> mvBoneMatrices;
bool mbSkeletonPhysics;
bool mbSkeletonPhysicsFading;
diff --git a/engines/hpl1/engine/scene/SectorVisibility.h b/engines/hpl1/engine/scene/SectorVisibility.h
index c3ba911af74..c8ab949be24 100644
--- a/engines/hpl1/engine/scene/SectorVisibility.h
+++ b/engines/hpl1/engine/scene/SectorVisibility.h
@@ -81,7 +81,7 @@ public:
int AddPortalVisibility(cPortal *apPortal);
private:
- std::vector<cPortalVisibility *> mvVisibility;
+ Common::Array<cPortalVisibility *> mvVisibility;
cPortalVisibilitySet *mpParent;
cSectorVisibilityContainer *mpContainer;
@@ -111,7 +111,7 @@ public:
private:
cSector *mpSector;
- std::vector<cPortalVisibilitySet *> mvVisibiltySets;
+ Common::Array<cPortalVisibilitySet *> mvVisibiltySets;
bool bStart;
cSectorVisibilityContainer *mpContainer;
diff --git a/engines/hpl1/engine/scene/SubMeshEntity.h b/engines/hpl1/engine/scene/SubMeshEntity.h
index e3a34ba5949..cd407a787c2 100644
--- a/engines/hpl1/engine/scene/SubMeshEntity.h
+++ b/engines/hpl1/engine/scene/SubMeshEntity.h
@@ -29,7 +29,6 @@
#define HPL_SUB_MESH_ENTITY_H
#include <map>
-#include <vector>
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/Renderable.h"
@@ -38,6 +37,7 @@
#include "hpl1/engine/scene/Entity3D.h"
#include "hpl1/engine/scene/SectorVisibility.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "common/array.h"
namespace hpl {
@@ -56,13 +56,13 @@ class cBoneState;
//-----------------------------------------------------------------------
-typedef std::vector<cAnimationState *> tAnimationStateVec;
+typedef Common::Array<cAnimationState *> tAnimationStateVec;
typedef tAnimationStateVec::iterator tAnimationStateVecIt;
typedef std::map<tString, int> tAnimationStateIndexMap;
typedef tAnimationStateIndexMap::iterator tAnimationStateIndexMapIt;
-typedef std::vector<cBoneState *> tNodeStateVec;
+typedef Common::Array<cBoneState *> tNodeStateVec;
typedef tNodeStateVec::iterator tNodeStateVecIt;
typedef std::map<tString, int> tNodeStateIndexMap;
@@ -174,8 +174,8 @@ private:
iPhysicsBody *mpBody;
};
-typedef std::vector<cSubMeshEntity *> tSubMeshEntityVec;
-typedef std::vector<cSubMeshEntity *>::iterator tSubMeshEntityVecIt;
+typedef Common::Array<cSubMeshEntity *> tSubMeshEntityVec;
+typedef Common::Array<cSubMeshEntity *>::iterator tSubMeshEntityVecIt;
typedef std::multimap<tString, cSubMeshEntity *> tSubMeshEntityMap;
typedef tSubMeshEntityMap::iterator tSubMeshEntityMapIt;
diff --git a/engines/hpl1/engine/scene/TileData.cpp b/engines/hpl1/engine/scene/TileData.cpp
index 49979358768..f6c3026f59c 100644
--- a/engines/hpl1/engine/scene/TileData.cpp
+++ b/engines/hpl1/engine/scene/TileData.cpp
@@ -41,7 +41,7 @@ cTileDataNormal::cTileDataNormal(cImageManager *apImageManager, cVector2f avTile
mpImageManager = apImageManager;
mvImage.resize(eMaterialTexture_LastEnum);
- mvImage.assign(mvImage.size(), NULL);
+ Common::fill(mvImage.begin(), mvImage.end(), nullptr);
mvTileSize = avTileSize;
mCollisionType = eTileCollisionType_Normal;
diff --git a/engines/hpl1/engine/scene/TileLayer.cpp b/engines/hpl1/engine/scene/TileLayer.cpp
index c59f03d7e30..3f077857057 100644
--- a/engines/hpl1/engine/scene/TileLayer.cpp
+++ b/engines/hpl1/engine/scene/TileLayer.cpp
@@ -45,7 +45,7 @@ cTileLayer::cTileLayer(unsigned int alW, unsigned int alH, bool abCollision, boo
mfZ = afZ;
mvTile.resize(alW * alH);
- mvTile.assign(mvTile.size(), NULL);
+ Common::fill(mvTile.begin(), mvTile.end(), nullptr);
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/scene/TileLayer.h b/engines/hpl1/engine/scene/TileLayer.h
index 02d09999576..b3027ebf413 100644
--- a/engines/hpl1/engine/scene/TileLayer.h
+++ b/engines/hpl1/engine/scene/TileLayer.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/scene/Tile.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <vector>
+#include "common/array.h"
namespace hpl {
@@ -40,7 +40,7 @@ enum eTileLayerType {
eTileLayerType_LastEnum
};
-typedef std::vector<cTile *> tTileVec;
+typedef Common::Array<cTile *> tTileVec;
typedef tTileVec::iterator tTileVecIt;
class cTileLayer {
diff --git a/engines/hpl1/engine/scene/TileMap.h b/engines/hpl1/engine/scene/TileMap.h
index 31e8259e77f..af9ceb30df0 100644
--- a/engines/hpl1/engine/scene/TileMap.h
+++ b/engines/hpl1/engine/scene/TileMap.h
@@ -34,14 +34,14 @@
#include "hpl1/engine/scene/TileLayer.h"
#include "hpl1/engine/scene/TileMapIt.h"
#include "hpl1/engine/scene/TileSet.h"
-#include <vector>
+#include "common/array.h"
namespace hpl {
-typedef std::vector<cTileSet *> tTileSetVec;
+typedef Common::Array<cTileSet *> tTileSetVec;
typedef tTileSetVec::iterator tTileSetVecIt;
-typedef std::vector<cTileLayer *> tTileLayerVec;
+typedef Common::Array<cTileLayer *> tTileLayerVec;
typedef tTileLayerVec::iterator tTileLayerVecIt;
class cTileMap {
diff --git a/engines/hpl1/engine/scene/TileSet.h b/engines/hpl1/engine/scene/TileSet.h
index d2e9f483ec7..0b34f686d00 100644
--- a/engines/hpl1/engine/scene/TileSet.h
+++ b/engines/hpl1/engine/scene/TileSet.h
@@ -32,7 +32,7 @@
#include "hpl1/engine/resources/ResourceBase.h"
#include "hpl1/engine/scene/TileData.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <vector>
+#include "common/array.h"
class TiXmlElement;
@@ -40,7 +40,7 @@ namespace hpl {
#define kMaxTileFrameWidth (9)
-typedef std::vector<iTileData *> tTileDataVec;
+typedef Common::Array<iTileData *> tTileDataVec;
typedef tTileDataVec::iterator tTileDataVecIt;
class cResources;
diff --git a/engines/hpl1/engine/system/Container.h b/engines/hpl1/engine/system/Container.h
index 3190415db96..1ff81480113 100644
--- a/engines/hpl1/engine/system/Container.h
+++ b/engines/hpl1/engine/system/Container.h
@@ -29,10 +29,10 @@
#define HPL_CONTAINER_H
#include <map>
-#include <vector>
#include "hpl1/engine/system/MemoryManager.h"
#include "common/list.h"
+#include "common/array.h"
namespace hpl {
@@ -87,7 +87,7 @@ class cContainerVecIterator : public iContainerIterator {
}
public:
- cContainerVecIterator(std::vector<T> *apVec) {
+ cContainerVecIterator(Common::Array<T> *apVec) {
mpVec = apVec;
mIt = apVec->begin();
}
@@ -112,8 +112,8 @@ public:
}
private:
- std::vector<T> *mpVec;
- typename std::vector<T>::iterator mIt;
+ Common::Array<T> *mpVec;
+ typename Common::Array<T>::iterator mIt;
};
////////////////////////////
@@ -171,7 +171,7 @@ public:
//////////////////////
- std::vector<T> mvVector;
+ Common::Array<T> mvVector;
};
//---------------------------------
diff --git a/engines/hpl1/engine/system/SerializeClass.h b/engines/hpl1/engine/system/SerializeClass.h
index 2554ec4506f..af4470cf4f6 100644
--- a/engines/hpl1/engine/system/SerializeClass.h
+++ b/engines/hpl1/engine/system/SerializeClass.h
@@ -350,7 +350,7 @@ private:
static bool mbDataSetup;
static tSerializeSavedClassMap m_mapSavedClasses;
- static std::vector<iSerializableType *> mvValueTypes;
+ static Common::Array<iSerializableType *> mvValueTypes;
};
//-------------------------------------------------
diff --git a/engines/hpl1/engine/system/SystemTypes.h b/engines/hpl1/engine/system/SystemTypes.h
index c96dfca7db9..ad962cafda5 100644
--- a/engines/hpl1/engine/system/SystemTypes.h
+++ b/engines/hpl1/engine/system/SystemTypes.h
@@ -31,11 +31,12 @@
#include <set>
#include <stdio.h>
#include <string>
-#include <vector>
#include "hpl1/engine/system/Container.h"
#include "common/list.h"
#include "common/str.h"
+#include "common/array.h"
+#include "hpl1/algorithms.h"
namespace hpl {
@@ -81,7 +82,7 @@ typedef Common::String tString;
typedef Common::List<tString> tStringList;
typedef tStringList::iterator tStringListIt;
-typedef std::vector<tString> tStringVec;
+typedef Common::Array<tString> tStringVec;
typedef tStringVec::iterator tStringVecIt;
typedef std::set<tString> tStringSet;
@@ -93,7 +94,7 @@ typedef Common::U32String tWString;
typedef Common::List<tWString> tWStringList;
typedef tWStringList::iterator tWStringListIt;
-typedef std::vector<tWString> tWStringVec;
+typedef Common::Array<tWString> tWStringVec;
typedef tWStringVec::iterator tWStringVecIt;
typedef std::set<tWString> tWStringSet;
@@ -101,22 +102,22 @@ typedef tWStringSet::iterator tWStringSetIt;
//--------------------------------------------------------
-typedef std::vector<unsigned char> tByteVec;
+typedef Common::Array<unsigned char> tByteVec;
typedef tByteVec::iterator tByteVecIt;
-typedef std::vector<unsigned int> tUIntVec;
+typedef Common::Array<unsigned int> tUIntVec;
typedef tUIntVec::iterator tUIntVecIt;
-typedef std::vector<int> tIntVec;
+typedef Common::Array<int> tIntVec;
typedef tIntVec::iterator tIntVecIt;
-typedef std::vector<int> tIntList;
+typedef Common::Array<int> tIntList;
typedef tIntVec::iterator tIntListIt;
-typedef std::vector<float> tFloatVec;
+typedef Common::Array<float> tFloatVec;
typedef tFloatVec::iterator tFloatVecIt;
-typedef std::vector<float *> tFloatPtrVec;
+typedef Common::Array<float *> tFloatPtrVec;
typedef tFloatPtrVec::iterator tFloatPtrVecIt;
typedef Common::List<float *> tFloatPtrList;
@@ -266,7 +267,7 @@ public:
//---------------------------------
cMemoryPool(size_t alSize, T *(*apCreateFunc)()) {
- mvData.resize(alSize, NULL);
+ Hpl1::resizeAndFill(mvData, alSize, nullptr);
mlCurrentData = 0;
mpCreateFunc = apCreateFunc;
@@ -333,7 +334,7 @@ public:
//---------------------------------
private:
- std::vector<T *> mvData;
+ Common::Array<T *> mvData;
size_t mlCurrentData;
diff --git a/engines/hpl1/penumbra-overture/DemoEndText.h b/engines/hpl1/penumbra-overture/DemoEndText.h
index e717a707eaf..54fec2b17b5 100644
--- a/engines/hpl1/penumbra-overture/DemoEndText.h
+++ b/engines/hpl1/penumbra-overture/DemoEndText.h
@@ -70,7 +70,7 @@ private:
int mlCurrentImage;
- std::vector<iTexture *> mvTextures;
+ Common::Array<iTexture *> mvTextures;
};
//---------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameArea.cpp b/engines/hpl1/penumbra-overture/GameArea.cpp
index 4fccdda5a7a..950708619c7 100644
--- a/engines/hpl1/penumbra-overture/GameArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameArea.cpp
@@ -59,7 +59,7 @@ iEntity3D *cAreaLoader_GameArea::Load(const tString &asName, const cVector3f &av
// Create physics data
iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
iCollideShape *pShape = pPhysicsWorld->CreateBoxShape(avSize, NULL);
- std::vector<iPhysicsBody *> vBodies;
+ Common::Array<iPhysicsBody *> vBodies;
vBodies.push_back(pPhysicsWorld->CreateBody(asName, pShape));
vBodies[0]->SetCollide(false);
diff --git a/engines/hpl1/penumbra-overture/GameDamageArea.cpp b/engines/hpl1/penumbra-overture/GameDamageArea.cpp
index ee1ba56741a..57babb34e53 100644
--- a/engines/hpl1/penumbra-overture/GameDamageArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameDamageArea.cpp
@@ -61,7 +61,7 @@ iEntity3D *cAreaLoader_GameDamageArea::Load(const tString &asName, const cVector
// Create physics data
iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
iCollideShape *pShape = pPhysicsWorld->CreateBoxShape(avSize, NULL);
- std::vector<iPhysicsBody *> vBodies;
+ Common::Array<iPhysicsBody *> vBodies;
vBodies.push_back(pPhysicsWorld->CreateBody(asName, pShape));
vBodies[0]->SetCollide(false);
diff --git a/engines/hpl1/penumbra-overture/GameEnemy.h b/engines/hpl1/penumbra-overture/GameEnemy.h
index f40258e096e..0ce550f0550 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy.h
+++ b/engines/hpl1/penumbra-overture/GameEnemy.h
@@ -377,7 +377,7 @@ protected:
cLineOfSightRayCallback mRayCallback;
- std::vector<iGameEnemyState *> mvStates;
+ Common::Array<iGameEnemyState *> mvStates;
int mlCurrentState;
cEnemyCheckForDoor mDoorCheck;
@@ -422,7 +422,7 @@ protected:
tString msOnDeathCallback;
tString msOnAttackCallback;
- std::vector<cEnemyPatrolNode> mvPatrolNodes;
+ Common::Array<cEnemyPatrolNode> mvPatrolNodes;
int mlCurrentPatrolNode;
float mfWaitTime;
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Worm.h b/engines/hpl1/penumbra-overture/GameEnemy_Worm.h
index 58fbf560437..f5ac43fa778 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Worm.h
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Worm.h
@@ -268,7 +268,7 @@ private:
cGameEnemy_Worm_MeshCallback *mpMeshCallback;
cWormTailSegment *mpRootSegment;
- std::vector<cWormTailSegment *> mvTailSegments;
+ Common::Array<cWormTailSegment *> mvTailSegments;
};
//-----------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameEntity.cpp b/engines/hpl1/penumbra-overture/GameEntity.cpp
index 505d2e20c30..81c0488b198 100644
--- a/engines/hpl1/penumbra-overture/GameEntity.cpp
+++ b/engines/hpl1/penumbra-overture/GameEntity.cpp
@@ -483,7 +483,7 @@ void iGameEntity::OnUpdate(float afTimeStep) {
////////////////
// If entity has character body add it to the array and then remove.
- std::vector<iPhysicsBody *> vTempBodies;
+ Common::Array<iPhysicsBody *> vTempBodies;
if (mpCharBody) {
for (size_t i = 0; i < mvBodies.size(); ++i) {
vTempBodies.push_back(mvBodies[i]);
@@ -994,7 +994,7 @@ void iGameEntity::LoadFromSaveData(iGameEntity_SaveData *apSaveData) {
// Particle Systems
int lCount = 0;
- for (std::vector<cParticleSystem3D *>::iterator it = mvParticleSystems.begin();
+ for (Common::Array<cParticleSystem3D *>::iterator it = mvParticleSystems.begin();
it != mvParticleSystems.end();) {
cParticleSystem3D *pPS = *it;
@@ -1024,7 +1024,7 @@ void iGameEntity::LoadFromSaveData(iGameEntity_SaveData *apSaveData) {
}
// Sounds
- for (std::vector<cSoundEntity *>::iterator it = mvSoundEntities.begin();
+ for (Common::Array<cSoundEntity *>::iterator it = mvSoundEntities.begin();
it != mvSoundEntities.end();) {
cSoundEntity *pSound = *it;
cEngineSound_SaveData *pSaveSound = apSaveData->GetSoundEntity(pSound);
diff --git a/engines/hpl1/penumbra-overture/GameEntity.h b/engines/hpl1/penumbra-overture/GameEntity.h
index 5d028e85994..24768650e85 100644
--- a/engines/hpl1/penumbra-overture/GameEntity.h
+++ b/engines/hpl1/penumbra-overture/GameEntity.h
@@ -164,24 +164,24 @@ public:
iPhysicsBody *GetBody(int alNum) { return mvBodies[alNum]; }
int GetBodyNum() { return (int)mvBodies.size(); }
- void SetBodies(std::vector<iPhysicsBody *> &avBodies) { mvBodies = avBodies; }
+ void SetBodies(Common::Array<iPhysicsBody *> &avBodies) { mvBodies = avBodies; }
iPhysicsJoint *GetJoint(int alNum) { return mvJoints[alNum]; }
int GetJointNum() { return (int)mvJoints.size(); }
- void SetJoints(std::vector<iPhysicsJoint *> &avJoints) { mvJoints = avJoints; }
+ void SetJoints(Common::Array<iPhysicsJoint *> &avJoints) { mvJoints = avJoints; }
int GetLightNum() { return (int)mvLights.size(); }
iLight3D *GetLight(int alX) { return mvLights[alX]; }
- void SetLights(std::vector<iLight3D *> &avLights) { mvLights = avLights; }
+ void SetLights(Common::Array<iLight3D *> &avLights) { mvLights = avLights; }
- void SetParticleSystems(std::vector<cParticleSystem3D *> &avParticleSystems) { mvParticleSystems = avParticleSystems; }
- void SetBillboards(std::vector<cBillboard *> &avBillboards) { mvBillboards = avBillboards; }
- void SetBeams(std::vector<cBeam *> &avBeams) { mvBeams = avBeams; }
- void SetSoundEntities(std::vector<cSoundEntity *> &avSoundEntities) { mvSoundEntities = avSoundEntities; }
+ void SetParticleSystems(Common::Array<cParticleSystem3D *> &avParticleSystems) { mvParticleSystems = avParticleSystems; }
+ void SetBillboards(Common::Array<cBillboard *> &avBillboards) { mvBillboards = avBillboards; }
+ void SetBeams(Common::Array<cBeam *> &avBeams) { mvBeams = avBeams; }
+ void SetSoundEntities(Common::Array<cSoundEntity *> &avSoundEntities) { mvSoundEntities = avSoundEntities; }
size_t GetHapticShapeNum() { return mvHapticShapes.size(); }
iHapticShape *GetHapticShape(size_t alNum) { return mvHapticShapes[alNum]; }
- void SetHapticShapes(std::vector<iHapticShape *> &avShapes) { mvHapticShapes = avShapes; }
+ void SetHapticShapes(Common::Array<iHapticShape *> &avShapes) { mvHapticShapes = avShapes; }
void DestroyLight(iLight3D *apLight);
void DestroyParticleSystem(cParticleSystem3D *apPS);
@@ -316,29 +316,29 @@ protected:
iGameEntity_SaveData *mpSaveData;
- std::vector<iPhysicsBody *> mvBodies;
- std::vector<iPhysicsJoint *> mvJoints;
+ Common::Array<iPhysicsBody *> mvBodies;
+ Common::Array<iPhysicsJoint *> mvJoints;
- std::vector<iHapticShape *> mvHapticShapes;
+ Common::Array<iHapticShape *> mvHapticShapes;
- std::vector<iLight3D *> mvLights;
- std::vector<cParticleSystem3D *> mvParticleSystems;
- std::vector<cBillboard *> mvBillboards;
- std::vector<cBeam *> mvBeams;
- std::vector<cSoundEntity *> mvSoundEntities;
+ Common::Array<iLight3D *> mvLights;
+ Common::Array<cParticleSystem3D *> mvParticleSystems;
+ Common::Array<cBillboard *> mvBillboards;
+ Common::Array<cBeam *> mvBeams;
+ Common::Array<cSoundEntity *> mvSoundEntities;
bool mbSaveLights;
cMeshEntity *mpMeshEntity;
- std::vector<iMaterial *> mvNormalMaterials;
- std::vector<iMaterial *> mvTransMaterials;
+ Common::Array<iMaterial *> mvNormalMaterials;
+ Common::Array<iMaterial *> mvTransMaterials;
bool mbTransActive;
bool mbTransShadow;
cVector3f mvLastImpulse;
- std::vector<cMesh *> mvPreloadedBreakMeshes;
+ Common::Array<cMesh *> mvPreloadedBreakMeshes;
iCharacterBody *mpCharBody;
diff --git a/engines/hpl1/penumbra-overture/GameForceArea.cpp b/engines/hpl1/penumbra-overture/GameForceArea.cpp
index 3524ca876d2..705c89de8ad 100644
--- a/engines/hpl1/penumbra-overture/GameForceArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameForceArea.cpp
@@ -61,7 +61,7 @@ iEntity3D *cAreaLoader_GameForceArea::Load(const tString &asName, const cVector3
// Create physics data
iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
iCollideShape *pShape = pPhysicsWorld->CreateBoxShape(avSize, NULL);
- std::vector<iPhysicsBody *> vBodies;
+ Common::Array<iPhysicsBody *> vBodies;
vBodies.push_back(pPhysicsWorld->CreateBody(asName, pShape));
vBodies[0]->SetCollide(false);
diff --git a/engines/hpl1/penumbra-overture/GameLadder.cpp b/engines/hpl1/penumbra-overture/GameLadder.cpp
index 87fb64f3005..eb56b029e27 100644
--- a/engines/hpl1/penumbra-overture/GameLadder.cpp
+++ b/engines/hpl1/penumbra-overture/GameLadder.cpp
@@ -60,7 +60,7 @@ iEntity3D *cAreaLoader_GameLadder::Load(const tString &asName, const cVector3f &
// Create physics data
iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
iCollideShape *pShape = pPhysicsWorld->CreateBoxShape(avSize, NULL);
- std::vector<iPhysicsBody *> vBodies;
+ Common::Array<iPhysicsBody *> vBodies;
vBodies.push_back(pPhysicsWorld->CreateBody(asName, pShape));
vBodies[0]->SetCollide(false);
diff --git a/engines/hpl1/penumbra-overture/GameLamp.h b/engines/hpl1/penumbra-overture/GameLamp.h
index 65635d3687d..68223a01cf1 100644
--- a/engines/hpl1/penumbra-overture/GameLamp.h
+++ b/engines/hpl1/penumbra-overture/GameLamp.h
@@ -128,9 +128,9 @@ private:
float mfFlickerOffFadeLength;
// Init data
- std::vector<cColor> mvLightColors;
- std::vector<cColor> mvBBColors;
- std::vector<cGameLamp_PS> mvParticleSystemNames;
+ Common::Array<cColor> mvLightColors;
+ Common::Array<cColor> mvBBColors;
+ Common::Array<cGameLamp_PS> mvParticleSystemNames;
};
//--------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameLink.cpp b/engines/hpl1/penumbra-overture/GameLink.cpp
index 98407374e9b..375a7fc7bc7 100644
--- a/engines/hpl1/penumbra-overture/GameLink.cpp
+++ b/engines/hpl1/penumbra-overture/GameLink.cpp
@@ -60,7 +60,7 @@ iEntity3D *cAreaLoader_GameLink::Load(const tString &asName, const cVector3f &av
// Create physics data
iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
iCollideShape *pShape = pPhysicsWorld->CreateBoxShape(avSize, NULL);
- std::vector<iPhysicsBody *> vBodies;
+ Common::Array<iPhysicsBody *> vBodies;
vBodies.push_back(pPhysicsWorld->CreateBody(asName, pShape));
vBodies[0]->SetCollide(false);
diff --git a/engines/hpl1/penumbra-overture/GameLiquidArea.cpp b/engines/hpl1/penumbra-overture/GameLiquidArea.cpp
index 99fcfa1f57c..d24e2a98b86 100644
--- a/engines/hpl1/penumbra-overture/GameLiquidArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameLiquidArea.cpp
@@ -60,7 +60,7 @@ iEntity3D *cAreaLoader_GameLiquidArea::Load(const tString &asName, const cVector
// Create physics data
iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
iCollideShape *pShape = pPhysicsWorld->CreateBoxShape(avSize, NULL);
- std::vector<iPhysicsBody *> vBodies;
+ Common::Array<iPhysicsBody *> vBodies;
vBodies.push_back(pPhysicsWorld->CreateBody(asName, pShape));
vBodies[0]->SetCollide(false);
diff --git a/engines/hpl1/penumbra-overture/GameMusicHandler.h b/engines/hpl1/penumbra-overture/GameMusicHandler.h
index 8b2db22f408..d20a1ac1943 100644
--- a/engines/hpl1/penumbra-overture/GameMusicHandler.h
+++ b/engines/hpl1/penumbra-overture/GameMusicHandler.h
@@ -89,7 +89,7 @@ private:
cInit *mpInit;
cMusicHandler *mpMusicHandler;
- std::vector<cGameMusic> mvGameMusic;
+ Common::Array<cGameMusic> mvGameMusic;
int mlMaxPrio;
int mlCurrentMaxPrio;
diff --git a/engines/hpl1/penumbra-overture/GameSaveArea.cpp b/engines/hpl1/penumbra-overture/GameSaveArea.cpp
index cf105904061..7773d13f241 100644
--- a/engines/hpl1/penumbra-overture/GameSaveArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameSaveArea.cpp
@@ -60,7 +60,7 @@ iEntity3D *cAreaLoader_GameSaveArea::Load(const tString &asName, const cVector3f
// Create physics data
iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
iCollideShape *pShape = pPhysicsWorld->CreateBoxShape(avSize, NULL);
- std::vector<iPhysicsBody *> vBodies;
+ Common::Array<iPhysicsBody *> vBodies;
vBodies.push_back(pPhysicsWorld->CreateBody(asName, pShape));
vBodies[0]->SetCollide(false);
diff --git a/engines/hpl1/penumbra-overture/GameStickArea.cpp b/engines/hpl1/penumbra-overture/GameStickArea.cpp
index 91ae48f9e20..d35014416be 100644
--- a/engines/hpl1/penumbra-overture/GameStickArea.cpp
+++ b/engines/hpl1/penumbra-overture/GameStickArea.cpp
@@ -60,7 +60,7 @@ iEntity3D *cAreaLoader_GameStickArea::Load(const tString &asName, const cVector3
// Create physics data
iPhysicsWorld *pPhysicsWorld = apWorld->GetPhysicsWorld();
iCollideShape *pShape = pPhysicsWorld->CreateBoxShape(avSize, NULL);
- std::vector<iPhysicsBody *> vBodies;
+ Common::Array<iPhysicsBody *> vBodies;
vBodies.push_back(pPhysicsWorld->CreateBody(asName, pShape));
vBodies[0]->SetCollide(false);
diff --git a/engines/hpl1/penumbra-overture/GameSwingDoor.h b/engines/hpl1/penumbra-overture/GameSwingDoor.h
index 104bd781c89..17ff1b6a299 100644
--- a/engines/hpl1/penumbra-overture/GameSwingDoor.h
+++ b/engines/hpl1/penumbra-overture/GameSwingDoor.h
@@ -87,8 +87,8 @@ public:
void LoadFromSaveData(iGameEntity_SaveData *apSaveData);
private:
- std::vector<iPhysicsController *> mvStopControllers;
- std::vector<cGameSwingJointDefault> mvJointDefaults;
+ Common::Array<iPhysicsController *> mvStopControllers;
+ Common::Array<cGameSwingJointDefault> mvJointDefaults;
bool mbLocked;
diff --git a/engines/hpl1/penumbra-overture/HudModel_Weapon.h b/engines/hpl1/penumbra-overture/HudModel_Weapon.h
index 7e75ea2ee7b..8d1336f9138 100644
--- a/engines/hpl1/penumbra-overture/HudModel_Weapon.h
+++ b/engines/hpl1/penumbra-overture/HudModel_Weapon.h
@@ -145,7 +145,7 @@ private:
cMeleeRayCallback mRayCallback;
- std::vector<cMeleeWeaponAttack> mvAttacks;
+ Common::Array<cMeleeWeaponAttack> mvAttacks;
iLowLevelHaptic *mpLowLevelHaptic;
iHapticForce *mpHHitForce;
diff --git a/engines/hpl1/penumbra-overture/Inventory.cpp b/engines/hpl1/penumbra-overture/Inventory.cpp
index 4b3dfb3f745..deb8f2a195b 100644
--- a/engines/hpl1/penumbra-overture/Inventory.cpp
+++ b/engines/hpl1/penumbra-overture/Inventory.cpp
@@ -115,7 +115,7 @@ cInventory::cInventory(cInit *apInit) : iUpdateable("Inventory") {
///////////////////////////////////
// Init items types
- mvItemTypes.resize(eGameItemType_LastEnum, NULL);
+ Hpl1::resizeAndFill(mvItemTypes, eGameItemType_LastEnum, nullptr);
mvItemTypes[eGameItemType_Normal] = hplNew(cGameItemType_Normal, (mpInit));
mvItemTypes[eGameItemType_Notebook] = hplNew(cGameItemType_Notebook, (mpInit));
@@ -731,7 +731,7 @@ void cInventoryContext::Draw() {
cVector2f(mvSize.x, vCornerSize.y), cColor(1, fTotalAlpha));
for (int i = 0; i < (int)mpActionVec->size(); i++) {
- /*cColor Col = */mlSelectedRow == i ? cColor(0.2f, 1.0f, 0.2f, mfAlpha) : cColor(0.65f, 0.65f, 0.65f, fTotalAlpha);
+ /*cColor Col = */ mlSelectedRow == i ? cColor(0.2f, 1.0f, 0.2f, mfAlpha) : cColor(0.65f, 0.65f, 0.65f, fTotalAlpha);
// mpFont->Draw(mvPos + cVector3f(2.0f,(float)i*mfRowSize,1),14,Col,
// eFontAlign_Left,(*mpActionVec)[i].c_str());
@@ -1023,7 +1023,7 @@ void cInventory::OnDraw() {
mpFont->draw(cVector3f(400, 460, 10), 19, cColor(1, 1, 1, fTextAlpha), eFontAlign_Center,
msItemName);
mpFont->draw(cVector3f(400 + 1, 460 + 1, 9), 19, cColor(0, 0, 0, fTextAlpha), eFontAlign_Center,
- msItemName);
+ msItemName);
mpFont->drawWordWrap(cVector3f(80, 480, 10), 640, 16, 17, cColor(1, 1, 1, fTextAlpha), eFontAlign_Left,
msItemDesc);
@@ -1183,7 +1183,7 @@ void cInventory::AddItemFromFile(const tString &asName, const tString &asFile, i
m_mapItems.insert(tInventoryItemMap::value_type(pItem->GetName(), pItem));
int lCount = 0;
- //int lCurrentSlot = -1;
+ // int lCurrentSlot = -1;
tInventorySlotListIt it = mlstSlots.begin();
for (; it != mlstSlots.end(); ++it) {
diff --git a/engines/hpl1/penumbra-overture/Inventory.h b/engines/hpl1/penumbra-overture/Inventory.h
index 366f83ab2f0..5275cc58cbc 100644
--- a/engines/hpl1/penumbra-overture/Inventory.h
+++ b/engines/hpl1/penumbra-overture/Inventory.h
@@ -38,7 +38,7 @@ class cInit;
class cInventory_GlobalSave;
class cGameItemType;
-typedef std::vector<cGameItemType *> tGameItemTypeVec;
+typedef Common::Array<cGameItemType *> tGameItemTypeVec;
typedef tGameItemTypeVec::iterator tGameItemTypeVecIt;
//--------------------------------------------
@@ -427,7 +427,7 @@ private:
tInventoryWidgetList mlstWidgets;
tInventoryItemMap m_mapItems;
tInventorySlotList mlstSlots;
- std::vector<cInventorySlot *> mvEquipSlots;
+ Common::Array<cInventorySlot *> mvEquipSlots;
tInventoryPickupCallbackMap m_mapPickupCallbacks;
tInventoryUseCallbackMap m_mapUseCallbacks;
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index aaa49f4b221..0911f05555a 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -1136,7 +1136,7 @@ public:
}
}
- std::vector<tString> mvFiles;
+ Common::Array<tString> mvFiles;
int mlCurrentFile;
};
diff --git a/engines/hpl1/penumbra-overture/MainMenu.h b/engines/hpl1/penumbra-overture/MainMenu.h
index e7ee19e4076..30e6e8a98b7 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.h
+++ b/engines/hpl1/penumbra-overture/MainMenu.h
@@ -418,12 +418,12 @@ private:
tWString msButtonTip;
FontData *mpTipFont;
- std::vector<cMainMenuParticle> mvRainDrops;
+ Common::Array<cMainMenuParticle> mvRainDrops;
float mfRainDropCount;
- std::vector<cMainMenuParticle> mvRainSplashes;
+ Common::Array<cMainMenuParticle> mvRainSplashes;
- std::vector<cMainMenuParticle> mvSnowFlakes;
+ Common::Array<cMainMenuParticle> mvSnowFlakes;
bool mbMouseIsDown;
@@ -444,7 +444,7 @@ private:
tMainMenuWidgetList mlstWidgets;
eMainMenuState mState;
- std::vector<tMainMenuWidgetList> mvState;
+ Common::Array<tMainMenuWidgetList> mvState;
bool mbGameActive;
diff --git a/engines/hpl1/penumbra-overture/MapHandler.h b/engines/hpl1/penumbra-overture/MapHandler.h
index ae152952ebe..1c1da6763b2 100644
--- a/engines/hpl1/penumbra-overture/MapHandler.h
+++ b/engines/hpl1/penumbra-overture/MapHandler.h
@@ -47,7 +47,7 @@ class cGameItem;
typedef std::multimap<tString, iGameEntity *> tGameEntityMap;
typedef tGameEntityMap::iterator tGameEntityMapIt;
-typedef std::vector<iGameEntity *> tGameEntityVec;
+typedef Common::Array<iGameEntity *> tGameEntityVec;
typedef tGameEntityVec::iterator tGameEntityVecIt;
typedef Common::List<iGameEnemy *> tGameEnemyList;
@@ -246,7 +246,7 @@ private:
tString msCurrentMap;
tWString msMapGameName;
- std::vector<cLoadedMap> mvLoadedMaps;
+ Common::Array<cLoadedMap> mvLoadedMaps;
tGameTimerList mlstTimers;
diff --git a/engines/hpl1/penumbra-overture/Notebook.h b/engines/hpl1/penumbra-overture/Notebook.h
index 646fc4a5fc5..e59bdad8323 100644
--- a/engines/hpl1/penumbra-overture/Notebook.h
+++ b/engines/hpl1/penumbra-overture/Notebook.h
@@ -125,7 +125,7 @@ public:
cGfxObject *mpTextBack;
FontData *mpFrontFont;
- std::vector<cNoteBook_Option> mvOptions;
+ Common::Array<cNoteBook_Option> mvOptions;
int mlSelected;
cVector2f mvFontSize;
};
@@ -160,10 +160,10 @@ public:
float mfFontSize;
int mlCurrentPage;
- std::vector<cNotebook_TaskPage> mvTaskPages;
+ Common::Array<cNotebook_TaskPage> mvTaskPages;
int mlSelected;
- std::vector<cNoteBook_Option> mvOptions;
+ Common::Array<cNoteBook_Option> mvOptions;
cGraphicsDrawer *mpDrawer;
cGfxObject *mpOptionsImage[2];
};
@@ -196,7 +196,7 @@ public:
cVector2f mvSize;
cNotebook_Note *mpSelectedNote;
- std::vector<cNoteBook_Option> mvOptions;
+ Common::Array<cNoteBook_Option> mvOptions;
cGfxObject *mpOptionsImage[2];
};
@@ -224,14 +224,14 @@ public:
FontData *mpNavigateFont;
tWStringVec mvRows;
- std::vector<cNotePage> mvPages;
+ Common::Array<cNotePage> mvPages;
int mlCurrentPage;
int mlMaxRows;
cVector2f mvSize;
int mlSelected;
- std::vector<cNoteBook_Option> mvOptions;
+ Common::Array<cNoteBook_Option> mvOptions;
cGraphicsDrawer *mpDrawer;
cGfxObject *mpOptionsImage[2];
};
@@ -318,7 +318,7 @@ private:
bool mbActive;
float mfAlpha;
- std::vector<cNotebook_BookType> mvBookTypes;
+ Common::Array<cNotebook_BookType> mvBookTypes;
eNotebookType mBookType;
diff --git a/engines/hpl1/penumbra-overture/Player.cpp b/engines/hpl1/penumbra-overture/Player.cpp
index 444a306d1c6..b0cc30ef7ab 100644
--- a/engines/hpl1/penumbra-overture/Player.cpp
+++ b/engines/hpl1/penumbra-overture/Player.cpp
@@ -1513,7 +1513,7 @@ void cPlayer::OnDraw() {
// DEBUG: sounds playing
if (mbShowSoundsPlaying) {
tStringVec vSoundNames;
- std::vector<cSoundEntry *> vEntries;
+ Common::Array<cSoundEntry *> vEntries;
//////////////////////////////
// Sound channels
diff --git a/engines/hpl1/penumbra-overture/Player.h b/engines/hpl1/penumbra-overture/Player.h
index 9d513a53d1f..e7ed3c363c2 100644
--- a/engines/hpl1/penumbra-overture/Player.h
+++ b/engines/hpl1/penumbra-overture/Player.h
@@ -61,10 +61,10 @@ class cPlayerBodyCallback;
class cHapticGameCamera;
-typedef std::vector<iPlayerState *> tPlayerStateVec;
+typedef Common::Array<iPlayerState *> tPlayerStateVec;
typedef tPlayerStateVec::iterator tPlayerStateVecIt;
-typedef std::vector<iPlayerMoveState *> tPlayerMoveStateVec;
+typedef Common::Array<iPlayerMoveState *> tPlayerMoveStateVec;
typedef tPlayerMoveStateVec::iterator tPlayerMoveStateVecIt;
class cInventoryItem;
@@ -428,7 +428,7 @@ private:
iPhysicsBody *mpPushBody;
- std::vector<cGfxObject *> mvCrossHairs;
+ Common::Array<cGfxObject *> mvCrossHairs;
iHapticForce *mpDamageForce;
iHapticForce *mpDamageDirForce;
diff --git a/engines/hpl1/penumbra-overture/PlayerHands.h b/engines/hpl1/penumbra-overture/PlayerHands.h
index 9fc53644a99..1bd6f36bd93 100644
--- a/engines/hpl1/penumbra-overture/PlayerHands.h
+++ b/engines/hpl1/penumbra-overture/PlayerHands.h
@@ -102,12 +102,12 @@ public:
eHudModelState GetState() { return mState; }
- std::vector<cParticleSystem3D *> mvParticleSystems;
- std::vector<cBillboard *> mvBillboards;
- std::vector<iLight3D *> mvLights;
- std::vector<cColor> mvLightColors;
- std::vector<float> mvLightRadii;
- std::vector<cSoundEntity *> mvSoundEntities;
+ Common::Array<cParticleSystem3D *> mvParticleSystems;
+ Common::Array<cBillboard *> mvBillboards;
+ Common::Array<iLight3D *> mvLights;
+ Common::Array<cColor> mvLightColors;
+ Common::Array<float> mvLightRadii;
+ Common::Array<cSoundEntity *> mvSoundEntities;
virtual void LoadData(TiXmlElement *apRootElem) = 0;
diff --git a/engines/hpl1/penumbra-overture/PlayerHelper.cpp b/engines/hpl1/penumbra-overture/PlayerHelper.cpp
index f819572338a..7d537a65a94 100644
--- a/engines/hpl1/penumbra-overture/PlayerHelper.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerHelper.cpp
@@ -269,7 +269,7 @@ void cPlayerPickRayCallback::CalculateResults() {
if (mpPickedBody) {
iGameEntity *pEntity = (iGameEntity *)mpPickedBody->GetUserData();
- //cGameArea *pArea = (cGameArea *)mpPickedAreaBody->GetUserData();
+ // cGameArea *pArea = (cGameArea *)mpPickedAreaBody->GetUserData();
if (pEntity) {
// Too for from object
@@ -1302,7 +1302,7 @@ void cPlayerGlowStick::SetActive(bool abX) {
return;
mbActive = abX;
- /*cSoundHandler *pSoundHanlder = */mpInit->mpGame->GetSound()->GetSoundHandler();
+ /*cSoundHandler *pSoundHanlder = */ mpInit->mpGame->GetSound()->GetSoundHandler();
if (mbActive) {
// Log("Setting the glowstick to TRUE\n");
@@ -1424,7 +1424,7 @@ void cPlayerFlare::SetActive(bool abX) {
return;
mbActive = abX;
- /*cSoundHandler *pSoundHanlder = */mpInit->mpGame->GetSound()->GetSoundHandler();
+ /*cSoundHandler *pSoundHanlder = */ mpInit->mpGame->GetSound()->GetSoundHandler();
if (mbActive) {
mpInit->mpPlayerHands->SetCurrentModel(0, "Flare");
@@ -1507,7 +1507,7 @@ cPlayerNoiseFilter::cPlayerNoiseFilter(cInit *apInit) {
mvGfxNoise.push_back(pObject);
}
- mvCurrentGfx.resize(20 * 15, cMath::RandRectl(0, mlAmount - 1));
+ Hpl1::resizeAndFill(mvCurrentGfx, 20 * 15, cMath::RandRectl(0, mlAmount - 1));
mfAlpha = 0.3f;
mfTimeCount = 0;
@@ -2174,7 +2174,7 @@ void cPlayerHidden::UpdateEnemyTooClose(float afTimeStep) {
{
if (mfCheckEnemyCloseCount <= 0) {
// FIXME: Change value of FMaxDist when hidden?
- //float fMaxDist = mbHidden ? 11.0f : 11.0f;
+ // float fMaxDist = mbHidden ? 11.0f : 11.0f;
float fMaxDist = 11.0f;
float fMaxDistSqr = fMaxDist * fMaxDist;
diff --git a/engines/hpl1/penumbra-overture/PlayerHelper.h b/engines/hpl1/penumbra-overture/PlayerHelper.h
index 394332fe3f5..bd7c4fdc067 100644
--- a/engines/hpl1/penumbra-overture/PlayerHelper.h
+++ b/engines/hpl1/penumbra-overture/PlayerHelper.h
@@ -427,7 +427,7 @@ private:
cInit *mpInit;
cGraphicsDrawer *mpDrawer;
- std::vector<cGfxObject *> mvGfxNoise;
+ Common::Array<cGfxObject *> mvGfxNoise;
tIntVec mvCurrentGfx;
};
diff --git a/engines/hpl1/penumbra-overture/PreMenu.h b/engines/hpl1/penumbra-overture/PreMenu.h
index 503e89db4c4..b0ec2075f7e 100644
--- a/engines/hpl1/penumbra-overture/PreMenu.h
+++ b/engines/hpl1/penumbra-overture/PreMenu.h
@@ -75,7 +75,7 @@ private:
cInit *mpInit;
cGraphicsDrawer *mpDrawer;
- std::vector<iTexture *> mvTextures;
+ Common::Array<iTexture *> mvTextures;
tStringVec mvTexNames;
iTexture *mpLogoTexture;
@@ -131,7 +131,7 @@ private:
iSoundChannel *mpRainSound;
iSoundChannel *mpWindSound;
- std::vector<cRaindrop> mvRaindropVector;
+ Common::Array<cRaindrop> mvRaindropVector;
cGfxObject *mpRaindropGfx;
cGfxObject *mpFlashGfx;
};
diff --git a/engines/hpl1/penumbra-overture/SaveTypes.cpp b/engines/hpl1/penumbra-overture/SaveTypes.cpp
index 6acb1359dbd..764a1342503 100644
--- a/engines/hpl1/penumbra-overture/SaveTypes.cpp
+++ b/engines/hpl1/penumbra-overture/SaveTypes.cpp
@@ -353,7 +353,7 @@ kBeginSerializeBase(cEngineSound_SaveData)
mfFarAttenuation = apLight->GetFarAttenuation();
}
- std::vector<cBillboard *> *pBillboardVec = apLight->GetBillboardVec();
+ Common::Array<cBillboard *> *pBillboardVec = apLight->GetBillboardVec();
for (size_t i = 0; i < pBillboardVec->size(); ++i) {
cBillboard *pBillboard = (*pBillboardVec)[i];
cEngineLightAttachBB_SaveData attachedBB;
Commit: b4a8a249d16102732d98d51e511c453144904a55
https://github.com/scummvm/scummvm/commit/b4a8a249d16102732d98d51e511c453144904a55
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:11+01:00
Commit Message:
HPL1: Fix Memset on Non-Trivial Structure GCC Compiler Warning
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
index 141ef550b26..2b048f56052 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
@@ -42,7 +42,7 @@ dgCollisionMesh::dgCollisionConvexPolygon::dgCollisionConvexPolygon(dgMemoryAllo
m_isEdgeIntersection = false;
m_rtti |= dgCollisionConvexPolygon_RTTI;
- memset(m_localPoly, 0, sizeof(m_localPoly));
+ for(uint i = 0; i < (sizeof(m_localPoly)/sizeof(m_localPoly[0])); i++) m_localPoly[i] = dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f));
m_normal = dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f));
// m_aabbP0 = dgVector (dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f));
// m_aabbP1 = dgVector (dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f));
Commit: 25ac4c8e4b51437617ce39b0c2026d3419509627
https://github.com/scummvm/scummvm/commit/25ac4c8e4b51437617ce39b0c2026d3419509627
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:11+01:00
Commit Message:
HPL1: add std::set implementation
copied from ags/lib/std.
Includes an additional erase implementation and a different (in)equality check
Changed paths:
A engines/hpl1/std/set.h
diff --git a/engines/hpl1/std/set.h b/engines/hpl1/std/set.h
new file mode 100644
index 00000000000..9bd84f1895d
--- /dev/null
+++ b/engines/hpl1/std/set.h
@@ -0,0 +1,119 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_STD_SET_H
+#define HPL1_STD_SET_H
+
+#include "common/array.h"
+
+namespace Hpl1 {
+namespace std {
+
+/**
+ * Derives the ScummVM SortedArray to match the std::set class
+ */
+template<class T, class Comparitor = Common::Less<T> >
+class set : public Common::SortedArray<T, const T &> {
+private:
+ static int ComparatorFn(const T &a, const T &b) {
+ return Comparitor().operator()(a, b) ? -1 : 0;
+ }
+
+ static bool CompareEq(const T &a, const T &b) {
+ return !ComparatorFn(a, b) && !ComparatorFn(b, a);
+ }
+
+public:
+ struct Entry {
+ const T &_value;
+ Entry(const T &item) : _value(item) {
+ }
+ };
+public:
+ using iterator = typename Common::SortedArray<T, const T &>::iterator;
+ using const_iterator = typename Common::SortedArray<T, const T &>::const_iterator;
+
+ /**
+ * Constructor
+ */
+ set() : Common::SortedArray<T, const T & >(ComparatorFn) {}
+
+ /**
+ * Locate an item in the set
+ */
+ iterator find(const T &item) {
+ iterator it;
+ for (it = this->begin(); it != this->end() && !CompareEq(*it, item); ++it) {
+ }
+
+ return it;
+ }
+
+ /**
+ * Insert an element at the sorted position.
+ */
+ Entry insert(const T &item) {
+ Common::SortedArray<T, const T &>::insert(item);
+ return Entry(item);
+ }
+
+ void erase(iterator item) {
+ Common::SortedArray<T, const T &>::erase(item);
+ }
+
+ void erase(iterator first, iterator last) {
+ Common::SortedArray<T, const T &>::erase(first, last);
+ }
+
+ size_t erase(const T &item) {
+ iterator first = find(item);
+ if (first == this->end())
+ return 0;
+ iterator end = first + 1;
+ while (end != this->end() && CompareEq(*first, *end)) {
+ ++end;
+ }
+ size_t erased = Common::distance(first, end);
+ this->erase(first, end);
+ return erased;
+ }
+
+ /**
+ * Returns the number of keys that match the specified key
+ */
+ size_t count(const T item) const {
+ size_t total = 0;
+ for (const_iterator it = this->begin(); it != this->end(); ++it) {
+ if (CompareEq(*it, item))
+ ++total;
+ else if (!ComparatorFn(item, *it))
+ // Passed beyond possibility of matches
+ break;
+ }
+
+ return total;
+ }
+};
+
+} // namespace std
+} // namespace Hpl1
+
+#endif
\ No newline at end of file
Commit: 4181cc7ae10061ce53e0a9a8cfc7e0fd8bb1dc7f
https://github.com/scummvm/scummvm/commit/4181cc7ae10061ce53e0a9a8cfc7e0fd8bb1dc7f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:12+01:00
Commit Message:
HPL1: replace std::set with Hpl1::std::set
Changed paths:
engines/hpl1/engine/ai/AStar.cpp
engines/hpl1/engine/ai/AStar.h
engines/hpl1/engine/graphics/GraphicsDrawer.h
engines/hpl1/engine/graphics/RenderList.h
engines/hpl1/engine/graphics/Renderer2D.h
engines/hpl1/engine/graphics/RendererPostEffects.h
engines/hpl1/engine/gui/GuiSet.h
engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/resources/FileSearcher.cpp
engines/hpl1/engine/scene/Light3D.h
engines/hpl1/engine/scene/PortalContainer.h
engines/hpl1/engine/scene/SectorVisibility.h
engines/hpl1/engine/system/SystemTypes.h
engines/hpl1/penumbra-overture/GameMusicHandler.h
engines/hpl1/penumbra-overture/GameObject.h
engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
diff --git a/engines/hpl1/engine/ai/AStar.cpp b/engines/hpl1/engine/ai/AStar.cpp
index 1f33f9f41ad..e8675c2bb68 100644
--- a/engines/hpl1/engine/ai/AStar.cpp
+++ b/engines/hpl1/engine/ai/AStar.cpp
@@ -254,11 +254,12 @@ void cAStarHandler::AddOpenNode(cAINode *apAINode, cAStarNode *apParent, float a
}
// Try to add it to the open list
- std::pair<tAStarNodeSetIt, bool> testPair = m_setOpenList.insert(pNode);
- if (testPair.second == false) {
+ const auto test = m_setOpenList.find(pNode);
+ if (test == m_setOpenList.end()) {
hplDelete(pNode);
return;
}
+ m_setOpenList.insert(pNode);
pNode->mfDistance = afDistance;
pNode->mfCost = Cost(afDistance, apAINode, apParent) + Heuristic(pNode->mpAINode->GetPosition(), mvGoal);
diff --git a/engines/hpl1/engine/ai/AStar.h b/engines/hpl1/engine/ai/AStar.h
index adaa6a50abf..d51b770d360 100644
--- a/engines/hpl1/engine/ai/AStar.h
+++ b/engines/hpl1/engine/ai/AStar.h
@@ -40,7 +40,7 @@ class cAINode;
//--------------------------------------
-typedef std::set<cAINode *> tAINodeSet;
+typedef Hpl1::std::set<cAINode *> tAINodeSet;
typedef tAINodeSet::iterator tAINodeSetIt;
//--------------------------------------
@@ -66,7 +66,7 @@ public:
bool operator()(cAStarNode *apNodeA, cAStarNode *apNodeB) const;
};
-typedef std::set<cAStarNode *, cAStarNodeCompare> tAStarNodeSet;
+typedef Hpl1::std::set<cAStarNode *, cAStarNodeCompare> tAStarNodeSet;
typedef tAStarNodeSet::iterator tAStarNodeSetIt;
//--------------------------------------
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.h b/engines/hpl1/engine/graphics/GraphicsDrawer.h
index 649defbe100..e8c170f0697 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.h
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.h
@@ -28,6 +28,7 @@
#ifndef HPL_GRAPHICSDRAWER_H
#define HPL_GRAPHICSDRAWER_H
+#include <set>
#include "hpl1/engine/graphics/BackgroundImage.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "common/list.h"
diff --git a/engines/hpl1/engine/graphics/RenderList.h b/engines/hpl1/engine/graphics/RenderList.h
index 473a5f56797..7ead1598e22 100644
--- a/engines/hpl1/engine/graphics/RenderList.h
+++ b/engines/hpl1/engine/graphics/RenderList.h
@@ -37,6 +37,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/scene/Light3D.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/std/set.h"
namespace hpl {
@@ -64,7 +65,7 @@ public:
bool operator()(cRenderNode *apNodeA, cRenderNode *apNodeB) const;
};
-typedef std::set<cRenderNode *, cRenderNodeCompare> tRenderNodeSet;
+typedef Hpl1::std::set<cRenderNode *, cRenderNodeCompare> tRenderNodeSet;
typedef tRenderNodeSet::iterator tRenderNodeSetIt;
class cRenderNode {
@@ -122,7 +123,7 @@ public:
bool operator()(const cOcclusionQueryObject *pObjectA, const cOcclusionQueryObject *pObjectB) const;
};
-typedef std::set<cOcclusionQueryObject *, cOcclusionQueryObject_Compare> tOcclusionQueryObjectSet;
+typedef Hpl1::std::set<cOcclusionQueryObject *, cOcclusionQueryObject_Compare> tOcclusionQueryObjectSet;
typedef tOcclusionQueryObjectSet::iterator tOcclusionQueryObjectSetIt;
typedef cSTLIterator<cOcclusionQueryObject *, tOcclusionQueryObjectSet,
@@ -131,10 +132,10 @@ typedef cSTLIterator<cOcclusionQueryObject *, tOcclusionQueryObjectSet,
//-------------------------------------------------------------
-typedef std::set<iRenderable *> tRenderableSet;
+typedef Hpl1::std::set<iRenderable *> tRenderableSet;
typedef tRenderableSet::iterator tRenderableSetIt;
-typedef std::set<iLight3D *> tLight3DSet;
+typedef Hpl1::std::set<iLight3D *> tLight3DSet;
typedef tLight3DSet::iterator tLight3DSetIt;
typedef cSTLIterator<iLight3D *, tLight3DSet, tLight3DSetIt> cLight3DIterator;
diff --git a/engines/hpl1/engine/graphics/Renderer2D.h b/engines/hpl1/engine/graphics/Renderer2D.h
index 54024637823..014db27df6a 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.h
+++ b/engines/hpl1/engine/graphics/Renderer2D.h
@@ -37,6 +37,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/scene/Light2D.h"
#include "common/list.h"
+#include "hpl1/std/set.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.h b/engines/hpl1/engine/graphics/RendererPostEffects.h
index 367bd46c25b..95ad26f61b0 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.h
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.h
@@ -29,11 +29,11 @@
#define HPL_RENDERER_POST_EFFECTS_H
#include <math.h>
-#include <set>
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
#include "common/list.h"
+#include "hpl1/std/set.h"
namespace hpl {
diff --git a/engines/hpl1/engine/gui/GuiSet.h b/engines/hpl1/engine/gui/GuiSet.h
index 42a9a46fbe2..f61cb8bf469 100644
--- a/engines/hpl1/engine/gui/GuiSet.h
+++ b/engines/hpl1/engine/gui/GuiSet.h
@@ -28,6 +28,8 @@
#ifndef HPL_GUI_SET_H
#define HPL_GUI_SET_H
+#include <set>
+
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/gui/GuiTypes.h"
#include "common/list.h"
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
index dc01e696547..1e58ea4bdfa 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
@@ -96,8 +96,8 @@ public:
typedef Common::Array<cTempAnimData> tTempAnimDataVec;
-typedef std::set<float> tTempTimesSet;
-typedef std::set<float>::iterator tTempTimesSetIt;
+typedef Hpl1::std::set<float> tTempTimesSet;
+typedef Hpl1::std::set<float>::iterator tTempTimesSetIt;
static cTempAnimData *GetTempAnimData(float afTime, tTempAnimDataVec &avTempData) {
for (size_t i = 0; i < avTempData.size(); ++i) {
@@ -1145,7 +1145,7 @@ public:
///////////////////////////////////////////
-typedef std::set<cColladaTestTri, cColladaTestTriCompare> tColladaTestTriMap;
+typedef Hpl1::std::set<cColladaTestTri, cColladaTestTriCompare> tColladaTestTriMap;
typedef tColladaTestTriMap::iterator tColladaTestTriMapIt;
///////////////////////////////////////////
@@ -1423,8 +1423,9 @@ void cMeshLoaderCollada::LoadGeometry(TiXmlElement *apRootElem, tColladaGeometry
}
}
- std::pair<tColladaTestTriMapIt, bool> TestPair = map_TestTris.insert(DataVec);
- if (TestPair.second) {
+ const auto test = map_TestTris.find(DataVec);
+ if (test == map_TestTris.end()) {
+ map_TestTris.insert(DataVec);
// Add the data to the indices
for (int i = 0; i < 3; i++) {
Geometry.mvIndices.push_back(DataVec[i]);
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
index 118001074e3..460fccacc81 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
@@ -3,9 +3,10 @@
#include <assert.h>
#include <stdio.h>
#include <fstream>
-#include <set>
#include <stdlib.h>
+#include "hpl1/std/set.h"
+
using namespace std;
BEGIN_AS_NAMESPACE
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index b3a3ea492b3..6e0e9617c45 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -1429,7 +1429,7 @@ public:
}
};
-typedef std::set<cTriEdge, cEdgeCompare> tTriEdgeListMap;
+typedef Hpl1::std::set<cTriEdge, cEdgeCompare> tTriEdgeListMap;
typedef tTriEdgeListMap::iterator tTriEdgeListMapIt;
//////////////////////////////////////////////////////
diff --git a/engines/hpl1/engine/resources/FileSearcher.cpp b/engines/hpl1/engine/resources/FileSearcher.cpp
index 4176ef5818e..32538cb0375 100644
--- a/engines/hpl1/engine/resources/FileSearcher.cpp
+++ b/engines/hpl1/engine/resources/FileSearcher.cpp
@@ -57,7 +57,6 @@ cFileSearcher::~cFileSearcher() {
//-----------------------------------------------------------------------
void cFileSearcher::AddDirectory(tString asPath, tString asMask) {
-
tStringList lstFileNames;
// Make the path with only "/" and lower case.
asPath = cString::ToLowerCase(cString::ReplaceCharTo(asPath, "\\", "/"));
diff --git a/engines/hpl1/engine/scene/Light3D.h b/engines/hpl1/engine/scene/Light3D.h
index 0424bc65faa..c8ecd56764e 100644
--- a/engines/hpl1/engine/scene/Light3D.h
+++ b/engines/hpl1/engine/scene/Light3D.h
@@ -33,7 +33,7 @@
#include "hpl1/engine/scene/Entity3D.h"
#include "hpl1/engine/scene/Light.h"
#include "common/list.h"
-#include <set>
+#include "hpl1/std/set.h"
class TiXmlElement;
@@ -64,7 +64,7 @@ class cFileSearcher;
class cBillboard;
class cSectorVisibilityContainer;
-typedef std::set<iRenderable *> tCasterCacheSet;
+typedef Hpl1::std::set<iRenderable *> tCasterCacheSet;
typedef tCasterCacheSet::iterator tCasterCacheSetIt;
//------------------------------------------
diff --git a/engines/hpl1/engine/scene/PortalContainer.h b/engines/hpl1/engine/scene/PortalContainer.h
index 7392a86ee6b..8a8395aea9d 100644
--- a/engines/hpl1/engine/scene/PortalContainer.h
+++ b/engines/hpl1/engine/scene/PortalContainer.h
@@ -33,7 +33,7 @@
#include "hpl1/engine/scene/RenderableContainer.h"
#include "common/list.h"
#include <map>
-#include <set>
+#include "hpl1/std/set.h"
namespace hpl {
@@ -43,11 +43,11 @@ class cSectorVisibilityContainer;
typedef Common::List<iRenderable *> tRenderableList;
typedef Common::List<iRenderable *>::iterator tRenderableListIt;
-typedef std::set<iRenderable *> tRenderableSet;
-typedef std::set<iRenderable *>::iterator tRenderableSetIt;
+typedef Hpl1::std::set<iRenderable *> tRenderableSet;
+typedef Hpl1::std::set<iRenderable *>::iterator tRenderableSetIt;
-typedef std::set<iEntity3D *> tEntity3DSet;
-typedef std::set<iEntity3D *>::iterator tEntity3DSetIt;
+typedef Hpl1::std::set<iEntity3D *> tEntity3DSet;
+typedef Hpl1::std::set<iEntity3D *>::iterator tEntity3DSetIt;
//----------------------------------------------------
diff --git a/engines/hpl1/engine/scene/SectorVisibility.h b/engines/hpl1/engine/scene/SectorVisibility.h
index c8ab949be24..3d158e2df1d 100644
--- a/engines/hpl1/engine/scene/SectorVisibility.h
+++ b/engines/hpl1/engine/scene/SectorVisibility.h
@@ -125,7 +125,7 @@ typedef tSectorVisibilityMap::iterator tSectorVisibilityMapIt;
typedef Common::List<cPortalVisibilitySet *> tPortalVisibilitySetList;
typedef tPortalVisibilitySetList::iterator tPortalVisibilitySetListIt;
-typedef std::set<cSector *> tSectorSet;
+typedef Hpl1::std::set<cSector *> tSectorSet;
typedef tSectorSet::iterator tSectorSetIt;
typedef cSTLMapIterator<cSectorVisibility *, tSectorVisibilityMap, tSectorVisibilityMapIt> tSectorVisibilityIterator;
diff --git a/engines/hpl1/engine/system/SystemTypes.h b/engines/hpl1/engine/system/SystemTypes.h
index ad962cafda5..dd8015ed95f 100644
--- a/engines/hpl1/engine/system/SystemTypes.h
+++ b/engines/hpl1/engine/system/SystemTypes.h
@@ -28,7 +28,6 @@
#ifndef HPL_SYSTEM_TYPES_H
#define HPL_SYSTEM_TYPES_H
-#include <set>
#include <stdio.h>
#include <string>
@@ -37,6 +36,7 @@
#include "common/str.h"
#include "common/array.h"
#include "hpl1/algorithms.h"
+#include "hpl1/std/set.h"
namespace hpl {
@@ -85,7 +85,7 @@ typedef tStringList::iterator tStringListIt;
typedef Common::Array<tString> tStringVec;
typedef tStringVec::iterator tStringVecIt;
-typedef std::set<tString> tStringSet;
+typedef Hpl1::std::set<tString> tStringSet;
typedef tStringSet::iterator tStringSetIt;
//--------------------------------------------------------
@@ -97,7 +97,7 @@ typedef tWStringList::iterator tWStringListIt;
typedef Common::Array<tWString> tWStringVec;
typedef tWStringVec::iterator tWStringVecIt;
-typedef std::set<tWString> tWStringSet;
+typedef Hpl1::std::set<tWString> tWStringSet;
typedef tWStringSet::iterator tWStringSetIt;
//--------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameMusicHandler.h b/engines/hpl1/penumbra-overture/GameMusicHandler.h
index d20a1ac1943..48eb99c62dd 100644
--- a/engines/hpl1/penumbra-overture/GameMusicHandler.h
+++ b/engines/hpl1/penumbra-overture/GameMusicHandler.h
@@ -58,7 +58,7 @@ private:
//----------------------------------------
-typedef std::set<iGameEnemy *> tAttackerSet;
+typedef Hpl1::std::set<iGameEnemy *> tAttackerSet;
typedef tAttackerSet::iterator tAttackerSetIt;
class cGameMusicHandler : public iUpdateable {
diff --git a/engines/hpl1/penumbra-overture/GameObject.h b/engines/hpl1/penumbra-overture/GameObject.h
index 86c47ae8a05..fc521f6d1be 100644
--- a/engines/hpl1/penumbra-overture/GameObject.h
+++ b/engines/hpl1/penumbra-overture/GameObject.h
@@ -212,7 +212,7 @@ private:
float GetPushDist();
void UpdateAttraction(float afTimeStep);
- std::set<iGameEnemy *> m_setAttractedEnemies;
+ Hpl1::std::set<iGameEnemy *> m_setAttractedEnemies;
iGameEnemy *mpCurrentAttraction;
float mfAttractCount;
diff --git a/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp b/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
index 03cc5a3c532..6d1afc94b8f 100644
--- a/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
+++ b/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
@@ -579,7 +579,7 @@ void cHudModel_WeaponMelee::Attack() {
}
}
- std::set<iPhysicsBody *> m_setHitBodies;
+ Hpl1::std::set<iPhysicsBody *> m_setHitBodies;
////////////////////////////////
// Iterate bodies
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 0911f05555a..c73019d848b 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -2328,7 +2328,7 @@ public:
cDate mDate;
};
-typedef std::multiset<cTempFileAndData, std::greater<cTempFileAndData> > tTempFileAndDataSet;
+typedef Hpl1::std::set<cTempFileAndData, std::greater<cTempFileAndData> > tTempFileAndDataSet;
typedef tTempFileAndDataSet::iterator tTempFileAndDataSetIt;
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp b/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
index 6ea7c284df9..6a797f103e8 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
@@ -841,7 +841,7 @@ bool cPlayerState_WeaponMeleeHaptX::CheckAttack(const cMatrixf &a_mtxTransform,
}
}
- std::set<iPhysicsBody *> m_setHitBodies;
+ Hpl1::std::set<iPhysicsBody *> m_setHitBodies;
////////////////////////////////
// Iterate bodies
Commit: 87f4c2a656c1244bfd5e7d489cce26f0fcf8fd8f
https://github.com/scummvm/scummvm/commit/87f4c2a656c1244bfd5e7d489cce26f0fcf8fd8f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:12+01:00
Commit Message:
HPL1: improve search for std::set replacement
Changed paths:
engines/hpl1/std/set.h
diff --git a/engines/hpl1/std/set.h b/engines/hpl1/std/set.h
index 9bd84f1895d..74c6c54a470 100644
--- a/engines/hpl1/std/set.h
+++ b/engines/hpl1/std/set.h
@@ -60,11 +60,18 @@ public:
* Locate an item in the set
*/
iterator find(const T &item) {
- iterator it;
- for (it = this->begin(); it != this->end() && !CompareEq(*it, item); ++it) {
+ iterator begin = this->begin();
+ iterator end = this->end();
+ while (begin < end) {
+ iterator mid = begin + (Common::distance(begin, end) / 2);
+ if (ComparatorFn(item, *mid))
+ end = mid;
+ else if (ComparatorFn(*mid, item))
+ begin = mid + 1;
+ else
+ return mid;
}
-
- return it;
+ return this->end();
}
/**
Commit: fe212f664d34ae6e64581818150486bc3554c8bd
https://github.com/scummvm/scummvm/commit/fe212f664d34ae6e64581818150486bc3554c8bd
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:12+01:00
Commit Message:
HPL1: replace std::multiset with Hpl1::std::multiset
Changed paths:
A engines/hpl1/std/multiset.h
engines/hpl1/engine/graphics/GraphicsDrawer.h
engines/hpl1/engine/graphics/RenderList.h
engines/hpl1/engine/graphics/Renderer2D.h
engines/hpl1/engine/gui/GuiSet.h
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.h b/engines/hpl1/engine/graphics/GraphicsDrawer.h
index e8c170f0697..92f39776b6c 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.h
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.h
@@ -28,11 +28,11 @@
#ifndef HPL_GRAPHICSDRAWER_H
#define HPL_GRAPHICSDRAWER_H
-#include <set>
#include "hpl1/engine/graphics/BackgroundImage.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "common/list.h"
#include "common/array.h"
+#include "hpl1/std/multiset.h"
namespace hpl {
@@ -66,7 +66,7 @@ public:
bool operator()(const cGfxBufferObject &aObjectA, const cGfxBufferObject &aObjectB) const;
};
-typedef std::multiset<cGfxBufferObject, cGfxBufferCompare> tGfxBufferSet;
+typedef Hpl1::std::multiset<cGfxBufferObject, cGfxBufferCompare> tGfxBufferSet;
typedef tGfxBufferSet::iterator tGfxBufferSetIt;
class cResources;
diff --git a/engines/hpl1/engine/graphics/RenderList.h b/engines/hpl1/engine/graphics/RenderList.h
index 7ead1598e22..49104f26978 100644
--- a/engines/hpl1/engine/graphics/RenderList.h
+++ b/engines/hpl1/engine/graphics/RenderList.h
@@ -28,8 +28,6 @@
#ifndef HPL_RENDER_LIST_H
#define HPL_RENDER_LIST_H
-#include <set>
-
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/Material.h"
#include "hpl1/engine/graphics/OcclusionQuery.h"
@@ -38,6 +36,7 @@
#include "hpl1/engine/scene/Light3D.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/std/set.h"
+#include "hpl1/std/multiset.h"
namespace hpl {
@@ -87,7 +86,7 @@ public:
bool operator()(iRenderable *pObjectA, iRenderable *pObjectB) const;
};
-typedef std::multiset<iRenderable *, cMotionBlurObject_Compare> tMotionBlurObjectSet;
+typedef Hpl1::std::multiset<iRenderable *, cMotionBlurObject_Compare> tMotionBlurObjectSet;
typedef tMotionBlurObjectSet::iterator tMotionBlurObjectSetIt;
typedef cSTLIterator<iRenderable *, tMotionBlurObjectSet,
@@ -101,7 +100,7 @@ public:
bool operator()(iRenderable *pObjectA, iRenderable *pObjectB) const;
};
-typedef std::multiset<iRenderable *, cTransperantObject_Compare> tTransperantObjectSet;
+typedef Hpl1::std::multiset<iRenderable *, cTransperantObject_Compare> tTransperantObjectSet;
typedef tTransperantObjectSet::iterator tTransperantObjectSetIt;
typedef cSTLIterator<iRenderable *, tTransperantObjectSet, tTransperantObjectSetIt> cTransperantObjectIterator;
diff --git a/engines/hpl1/engine/graphics/Renderer2D.h b/engines/hpl1/engine/graphics/Renderer2D.h
index 014db27df6a..869d1239b38 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.h
+++ b/engines/hpl1/engine/graphics/Renderer2D.h
@@ -29,7 +29,6 @@
#define HPL_RENDERER2D_H
#include <math.h>
-#include <set>
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/Material.h"
@@ -38,6 +37,7 @@
#include "hpl1/engine/scene/Light2D.h"
#include "common/list.h"
#include "hpl1/std/set.h"
+#include "hpl1/std/multiset.h"
namespace hpl {
@@ -66,10 +66,10 @@ public:
bool operator()(const cRenderObject2D &aObjectA, const cRenderObject2D &aObjectB) const;
};
-typedef std::multiset<cRenderObject2D, cRenderObject2DCompare> tRenderObjectSet;
+typedef Hpl1::std::multiset<cRenderObject2D, cRenderObject2DCompare> tRenderObjectSet;
typedef tRenderObjectSet::iterator tRenderObjectSetIt;
-typedef std::multiset<cRenderObject2D, cRenderTransObjectCompare> tRenderTransObjectSet;
+typedef Hpl1::std::multiset<cRenderObject2D, cRenderTransObjectCompare> tRenderTransObjectSet;
typedef tRenderTransObjectSet::iterator tRenderTransObjectSetIt;
typedef Common::List<cRenderObject2D> tRenderObjectList;
diff --git a/engines/hpl1/engine/gui/GuiSet.h b/engines/hpl1/engine/gui/GuiSet.h
index f61cb8bf469..414911dcb2a 100644
--- a/engines/hpl1/engine/gui/GuiSet.h
+++ b/engines/hpl1/engine/gui/GuiSet.h
@@ -28,11 +28,11 @@
#ifndef HPL_GUI_SET_H
#define HPL_GUI_SET_H
-#include <set>
-
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/gui/GuiTypes.h"
#include "common/list.h"
+#include "hpl1/std/set.h"
+#include "hpl1/std/multiset.h"
namespace hpl {
@@ -85,7 +85,7 @@ public:
bool operator()(const cGuiRenderObject &aObjectA, const cGuiRenderObject &aObjectB) const;
};
-typedef std::multiset<cGuiRenderObject, cGuiRenderObjectCompare> tGuiRenderObjectSet;
+typedef Hpl1::std::multiset<cGuiRenderObject, cGuiRenderObjectCompare> tGuiRenderObjectSet;
typedef tGuiRenderObjectSet::iterator tGuiRenderObjectSetIt;
//-----------------------------------------------
diff --git a/engines/hpl1/std/multiset.h b/engines/hpl1/std/multiset.h
new file mode 100644
index 00000000000..f136ef45467
--- /dev/null
+++ b/engines/hpl1/std/multiset.h
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_STD_MULTISET_H
+#define HPL1_STD_MULTISET_H
+
+#include "set.h"
+
+namespace Hpl1 {
+namespace std {
+
+template<typename T, typename Comp>
+using multiset = set<T, Comp>;
+
+}
+
+}
+
+#endif
\ No newline at end of file
Commit: bdcd3ff81ade32ea4cf036b9e70d71278ed04688
https://github.com/scummvm/scummvm/commit/bdcd3ff81ade32ea4cf036b9e70d71278ed04688
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:12+01:00
Commit Message:
HPL1: Remove <string.h> includes
Changed paths:
engines/hpl1/engine/graphics/SubMesh.cpp
engines/hpl1/engine/impl/VertexBufferOGL.cpp
engines/hpl1/engine/impl/VideoStreamTheora.cpp
engines/hpl1/engine/scene/SubMeshEntity.cpp
diff --git a/engines/hpl1/engine/graphics/SubMesh.cpp b/engines/hpl1/engine/graphics/SubMesh.cpp
index 7106865c57c..68f987850a6 100644
--- a/engines/hpl1/engine/graphics/SubMesh.cpp
+++ b/engines/hpl1/engine/graphics/SubMesh.cpp
@@ -37,8 +37,6 @@
#include "hpl1/engine/system/MemoryManager.h"
-#include <string.h>
-
namespace hpl {
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/hpl1/engine/impl/VertexBufferOGL.cpp b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
index d39384c31ae..0c3ed98f831 100644
--- a/engines/hpl1/engine/impl/VertexBufferOGL.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferOGL.cpp
@@ -29,7 +29,6 @@
#include "hpl1/debug.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
-#include <string.h>
#ifdef USE_OPENGL
@@ -508,4 +507,4 @@ void cVertexBufferOGL::SetVertexStates(tVertexFlag aFlags) {
} // namespace hpl
-#endif // USE_OPENGL
\ No newline at end of file
+#endif // USE_OPENGL
diff --git a/engines/hpl1/engine/impl/VideoStreamTheora.cpp b/engines/hpl1/engine/impl/VideoStreamTheora.cpp
index 641417b42c6..8103d84c363 100644
--- a/engines/hpl1/engine/impl/VideoStreamTheora.cpp
+++ b/engines/hpl1/engine/impl/VideoStreamTheora.cpp
@@ -32,9 +32,6 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/LowLevelSystem.h"
-#include <stdio.h>
-#include <string.h>
-
#pragma comment(lib, "libogg.lib")
#pragma comment(lib, "libtheora.lib")
diff --git a/engines/hpl1/engine/scene/SubMeshEntity.cpp b/engines/hpl1/engine/scene/SubMeshEntity.cpp
index 4e921cf5b56..cf8520ce80d 100644
--- a/engines/hpl1/engine/scene/SubMeshEntity.cpp
+++ b/engines/hpl1/engine/scene/SubMeshEntity.cpp
@@ -48,8 +48,6 @@
#include "hpl1/engine/math/Math.h"
-#include <string.h>
-
namespace hpl {
//////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
Commit: 8641896f01420016c30b62b786ae351b59b4324c
https://github.com/scummvm/scummvm/commit/8641896f01420016c30b62b786ae351b59b4324c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:12+01:00
Commit Message:
HPL1: sprintf -> snprintf
Changed paths:
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/graphics/Color.cpp
engines/hpl1/engine/graphics/ImageEntityData.cpp
engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
engines/hpl1/engine/impl/MeshLoaderMSH.cpp
engines/hpl1/engine/impl/SqScript.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
engines/hpl1/engine/libraries/newton/core/dgDebug.cpp
engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/math/Vector2.h
engines/hpl1/engine/math/Vector3.h
engines/hpl1/engine/math/hplMatrix.h
engines/hpl1/engine/resources/ConfigFile.cpp
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/engine/system/String.cpp
engines/hpl1/engine/system/SystemTypes.h
engines/hpl1/engine/system/low_level_system.cpp
engines/hpl1/penumbra-overture/GameEnemy.cpp
engines/hpl1/penumbra-overture/Inventory.cpp
engines/hpl1/penumbra-overture/MainMenu.cpp
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index 98fa69fd7da..741d8ef3791 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -123,14 +123,14 @@ SCRIPT_DEFINE_FUNC_1(void, Print, string)
static tString FloatToString(float afX) {
char sTemp[30];
- sprintf(sTemp, "%f", afX);
+ snprintf(sTemp, 30, "%f", afX);
return (tString)sTemp;
}
SCRIPT_DEFINE_FUNC_1(string, FloatToString, float)
static tString IntToString(int alX) {
char sTemp[30];
- sprintf(sTemp, "%d", alX);
+ snprintf(sTemp, 30, "%d", alX);
return (tString)sTemp;
}
SCRIPT_DEFINE_FUNC_1(string, IntToString, int)
diff --git a/engines/hpl1/engine/graphics/Color.cpp b/engines/hpl1/engine/graphics/Color.cpp
index 9effc9427fe..3c770923a27 100644
--- a/engines/hpl1/engine/graphics/Color.cpp
+++ b/engines/hpl1/engine/graphics/Color.cpp
@@ -160,7 +160,7 @@ bool cColor::operator==(cColor aCol) const {
tString cColor::ToString() const {
char buf[512];
- sprintf(buf, "%f : %f : %f : %f", r, g, b, a);
+ snprintf(buf, 512, "%f : %f : %f : %f", r, g, b, a);
tString str = buf;
return str;
}
@@ -169,7 +169,7 @@ tString cColor::ToString() const {
tString cColor::ToFileString() const {
char buf[512];
- sprintf(buf, "%g %g %g %g", r, g, b, a);
+ snprintf(buf, 512, "%g %g %g %g", r, g, b, a);
tString str = buf;
return str;
}
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.cpp b/engines/hpl1/engine/graphics/ImageEntityData.cpp
index a427b10514e..cb9787409ed 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.cpp
+++ b/engines/hpl1/engine/graphics/ImageEntityData.cpp
@@ -227,7 +227,7 @@ bool cImageEntityData::CreateFromFile(const tString &asFile, tIntVec &avImageHan
if (bGotAnim) {
int lNum = i + 1;
char buff[5];
- sprintf(buff, "%d", lNum);
+ snprintf(buff, 5, "%d", lNum);
sFile = sImageName;
if (lNum < 10)
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
index 6b8a081e344..d91de989785 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaLoader.cpp
@@ -662,7 +662,7 @@ static void SaveGeometryVec(TiXmlElement *apRootElem, tColladaGeometryVec *apCol
sData = "";
char sTemp[20];
for (size_t j = 0; j < pGeometry->mvTangents.size(); ++j) {
- sprintf(sTemp, "%g ", pGeometry->mvTangents[j]);
+ snprintf(sTemp, 20, "%g ", pGeometry->mvTangents[j]);
sData += sTemp;
}
pDataElem = CreateXMLChild(pVertexVecElem, "Tangents");
diff --git a/engines/hpl1/engine/impl/MeshLoaderMSH.cpp b/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
index bf9751d1902..3d2cb1d4319 100644
--- a/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderMSH.cpp
@@ -304,25 +304,25 @@ void cMeshLoaderMSH::SaveFloatData(TiXmlElement *apRoot, int alSize, const char
switch (lDecimals) {
case 0:
- sprintf(sTemp, "%.0f", apData[i]);
+ snprintf(sTemp, 20, "%.0f", apData[i]);
break;
case 1:
- sprintf(sTemp, "%.1f", apData[i]);
+ snprintf(sTemp, 20, "%.1f", apData[i]);
break;
case 2:
- sprintf(sTemp, "%.2f", apData[i]);
+ snprintf(sTemp, 20, "%.2f", apData[i]);
break;
case 3:
- sprintf(sTemp, "%.3f", apData[i]);
+ snprintf(sTemp, 20, "%.3f", apData[i]);
break;
case 4:
- sprintf(sTemp, "%.4f", apData[i]);
+ snprintf(sTemp, 20, "%.4f", apData[i]);
break;
case 5:
- sprintf(sTemp, "%.5f", apData[i]);
+ snprintf(sTemp, 20, "%.5f", apData[i]);
break;
case 6:
- sprintf(sTemp, "%.6f", apData[i]);
+ snprintf(sTemp, 20, "%.6f", apData[i]);
break;
}
@@ -360,7 +360,7 @@ void cMeshLoaderMSH::SaveIntData(TiXmlElement *apElem, int alSize, unsigned int
char sTemp[10];
for (int i = 0; i < alSize; i++) {
- sprintf(sTemp, "%d", apData[i]);
+ snprintf(sTemp, 10, "%d", apData[i]);
sData += sTemp;
if (i != alSize - 1)
diff --git a/engines/hpl1/engine/impl/SqScript.cpp b/engines/hpl1/engine/impl/SqScript.cpp
index 3ec89464a33..15b33b7cb23 100644
--- a/engines/hpl1/engine/impl/SqScript.cpp
+++ b/engines/hpl1/engine/impl/SqScript.cpp
@@ -171,7 +171,7 @@ void cScriptOutput::AddMessage(const asSMessageInfo *msg) {
else if (msg->type == asMSGTYPE_INFORMATION)
type = "INFO";
- sprintf(sMess, "%s (%d, %d) : %s : %s\n", msg->section, msg->row, msg->col, type.c_str(), msg->message);
+ snprintf(sMess, 1024, "%s (%d, %d) : %s : %s\n", msg->section, msg->row, msg->col, type.c_str(), msg->message);
msMessage += sMess;
}
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
index d8bf210f4e3..8837aeb79bb 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
@@ -211,7 +211,7 @@ static bool ScriptArrayTemplateCallback(asITypeInfo *ti, bool &dontGarbageCollec
// It is not necessary to set the array as garbage collected for all handle types.
// If it is possible to determine that the handle cannot refer to an object type
- // that can potentially form a circular reference with the array then it is not
+ // that can potentially form a circular reference with the array then it is not
// necessary to make the array garbage collected.
asITypeInfo *subtype = ti->GetEngine()->GetTypeInfoById(typeId);
asDWORD flags = subtype->GetFlags();
@@ -220,7 +220,7 @@ static bool ScriptArrayTemplateCallback(asITypeInfo *ti, bool &dontGarbageCollec
if( (flags & asOBJ_SCRIPT_OBJECT) )
{
// Even if a script class is by itself not garbage collected, it is possible
- // that classes that derive from it may be, so it is not possible to know
+ // that classes that derive from it may be, so it is not possible to know
// that no circular reference can occur.
if( (flags & asOBJ_NOINHERIT) )
{
@@ -961,7 +961,7 @@ void CScriptArray::Construct(SArrayBuffer *buf, asUINT start, asUINT end)
*d = (void*)engine->CreateScriptObject(subType);
if( *d == 0 )
{
- // Set the remaining entries to null so the destructor
+ // Set the remaining entries to null so the destructor
// won't attempt to destroy invalid objects later
memset(d, 0, sizeof(void*)*(max-d));
@@ -1251,13 +1251,13 @@ int CScriptArray::Find(asUINT startAt, void *value) const
#if defined(_MSC_VER) && _MSC_VER >= 1500 && !defined(__S3E__)
sprintf_s(tmp, 512, "Type '%s' has multiple matching opEquals or opCmp methods", subType->GetName());
#else
- sprintf(tmp, "Type '%s' has multiple matching opEquals or opCmp methods", subType->GetName());
+ snprintf(tmp, 512, "Type '%s' has multiple matching opEquals or opCmp methods", subType->GetName());
#endif
else
#if defined(_MSC_VER) && _MSC_VER >= 1500 && !defined(__S3E__)
sprintf_s(tmp, 512, "Type '%s' does not have a matching opEquals or opCmp method", subType->GetName());
#else
- sprintf(tmp, "Type '%s' does not have a matching opEquals or opCmp method", subType->GetName());
+ snprintf(tmp, 512, "Type '%s' does not have a matching opEquals or opCmp method", subType->GetName());
#endif
ctx->SetException(tmp);
}
@@ -1323,7 +1323,7 @@ int CScriptArray::Find(asUINT startAt, void *value) const
// internal
// Copy object handle or primitive value
-// Even in arrays of objects the objects are allocated on
+// Even in arrays of objects the objects are allocated on
// the heap and the array stores the pointers to the objects
void CScriptArray::Copy(void *dst, void *src)
{
@@ -1333,7 +1333,7 @@ void CScriptArray::Copy(void *dst, void *src)
// internal
// Swap two elements
-// Even in arrays of objects the objects are allocated on
+// Even in arrays of objects the objects are allocated on
// the heap and the array stores the pointers to the objects.
void CScriptArray::Swap(void* a, void* b)
{
@@ -1414,13 +1414,13 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
#if defined(_MSC_VER) && _MSC_VER >= 1500 && !defined(__S3E__)
sprintf_s(tmp, 512, "Type '%s' has multiple matching opCmp methods", subType->GetName());
#else
- sprintf(tmp, "Type '%s' has multiple matching opCmp methods", subType->GetName());
+ snprintf(tmp, 512, "Type '%s' has multiple matching opCmp methods", subType->GetName());
#endif
else
#if defined(_MSC_VER) && _MSC_VER >= 1500 && !defined(__S3E__)
sprintf_s(tmp, 512, "Type '%s' does not have a matching opCmp method", subType->GetName());
#else
- sprintf(tmp, "Type '%s' does not have a matching opCmp method", subType->GetName());
+ snprintf(tmp, 512, "Type '%s' does not have a matching opCmp method", subType->GetName());
#endif
ctx->SetException(tmp);
@@ -1484,7 +1484,7 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
a = b;
b = TEMP;
}
-
+
int r = 0;
// Allow sort to work even if the array contains null handles
@@ -1504,13 +1504,13 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
{
return (int)cmpContext->GetReturnDWord() < 0;
}
- }
+ }
return false;
}
} customLess = {asc, cmpContext, cache ? cache->cmpFunc : 0};
std::sort((void**)GetArrayItemPointer(start), (void**)GetArrayItemPointer(end), customLess);
-
+
// Clean up
if( cmpContext )
{
@@ -1528,7 +1528,7 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
else
{
// TODO: Use std::sort for primitive types too
-
+
// Insertion sort
asBYTE tmp[16];
for( int i = start + 1; i < end; i++ )
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
index dc7436d8773..28d4980c991 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -33,19 +33,19 @@ class CStdStringFactory : public asIStringFactory
{
public:
CStdStringFactory() {}
- ~CStdStringFactory()
+ ~CStdStringFactory()
{
- // The script engine must release each string
+ // The script engine must release each string
// constant that it has requested
assert(stringCache.size() == 0);
}
const void *GetStringConstant(const char *data, asUINT length)
{
- // The string factory might be modified from multiple
+ // The string factory might be modified from multiple
// threads, so it is necessary to use a mutex.
asAcquireExclusiveLock();
-
+
string str(data, length);
map_t::iterator it = stringCache.find(str);
if (it != stringCache.end())
@@ -54,7 +54,7 @@ public:
it = stringCache.insert(map_t::value_type(str, 1)).first;
asReleaseExclusiveLock();
-
+
return reinterpret_cast<const void*>(&it->first);
}
@@ -64,11 +64,11 @@ public:
return asERROR;
int ret = asSUCCESS;
-
- // The string factory might be modified from multiple
+
+ // The string factory might be modified from multiple
// threads, so it is necessary to use a mutex.
asAcquireExclusiveLock();
-
+
map_t::iterator it = stringCache.find(*reinterpret_cast<const string*>(str));
if (it == stringCache.end())
ret = asERROR;
@@ -78,9 +78,9 @@ public:
if (it->second == 0)
stringCache.erase(it);
}
-
+
asReleaseExclusiveLock();
-
+
return ret;
}
@@ -104,14 +104,14 @@ public:
static CStdStringFactory *stringFactory = 0;
-// TODO: Make this public so the application can also use the string
+// TODO: Make this public so the application can also use the string
// factory and share the string constants if so desired, or to
// monitor the size of the string factory cache.
CStdStringFactory *GetStdStringFactorySingleton()
{
if( stringFactory == 0 )
{
- // The following instance will be destroyed by the global
+ // The following instance will be destroyed by the global
// CStdStringFactoryCleaner instance upon application shutdown
stringFactory = new CStdStringFactory();
}
@@ -495,7 +495,7 @@ static string formatInt(asINT64 value, const string &options, asUINT width)
// MSVC 8.0 / 2005 or newer
sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, value);
#else
- sprintf(&buf[0], fmt.c_str(), width, value);
+ snprintf(&buf[0], width+30, fmt.c_str(), width, value);
#endif
buf.resize(strlen(&buf[0]));
@@ -539,7 +539,7 @@ static string formatUInt(asQWORD value, const string &options, asUINT width)
// MSVC 8.0 / 2005 or newer
sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, value);
#else
- sprintf(&buf[0], fmt.c_str(), width, value);
+ snprintf(&buf[0], width+30, fmt.c_str(), width, value);
#endif
buf.resize(strlen(&buf[0]));
@@ -575,7 +575,7 @@ static string formatFloat(double value, const string &options, asUINT width, asU
// MSVC 8.0 / 2005 or newer
sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, precision, value);
#else
- sprintf(&buf[0], fmt.c_str(), width, precision, value);
+ snprintf(&buf[0], width+precision+50, fmt.c_str(), width, precision, value);
#endif
buf.resize(strlen(&buf[0]));
@@ -1359,7 +1359,3 @@ void RegisterStdString(asIScriptEngine * engine)
}
END_AS_NAMESPACE
-
-
-
-
diff --git a/engines/hpl1/engine/libraries/newton/core/dgDebug.cpp b/engines/hpl1/engine/libraries/newton/core/dgDebug.cpp
index 3aa25462374..b80e2eec9d5 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgDebug.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgDebug.cpp
@@ -1,21 +1,21 @@
/* Copyright (c) <2003-2011> <Julio Jerez, Newton Game Dynamics>
- *
+ *
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
- *
+ *
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
- *
+ *
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
- *
+ *
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
- *
+ *
* 3. This notice may not be removed or altered from any source distribution.
*/
@@ -31,7 +31,7 @@ void dgApi dgExpandTraceMessage(const char *fmt, ...)
text[0] = 0;
va_start(v_args, fmt);
- vsprintf(text, fmt, v_args);
+ vsnprintf(text, 4096, fmt, v_args);
va_end(v_args);
printf ("%s\n", text);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp b/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
index 6389479bd95..3b747e19007 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
@@ -364,12 +364,12 @@ dgInt32 dgWorld::GetHardwareMode(char *description) {
if (m_cpu == dgNoSimdPresent) {
mode = 0;
if (description) {
- sprintf(description, "x87");
+ snprintf(description, 5, "x87");
}
} else {
mode = 1;
if (description) {
- sprintf(description, "simd");
+ snprintf(description, 5, "simd");
}
}
// }
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index 6e0e9617c45..be51c86e618 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -1152,7 +1152,7 @@ cVector3f cMath::MatrixToEulerAngles(const cMatrixf &a_mtxA, eEulerRotationOrder
//-----------------------------------------------------------------------
const char *cMath::MatrixToChar(const cMatrixf &a_mtxA) {
- sprintf(mpTempChar, "[%.3f, %.3f, %.3f, %.3f] [%.3f, %.3f, %.3f, %.3f] [%.3f, %.3f, %.3f, %.3f] [%.3f, %.3f, %.3f, %.3f]",
+ snprintf(mpTempChar, 1024, "[%.3f, %.3f, %.3f, %.3f] [%.3f, %.3f, %.3f, %.3f] [%.3f, %.3f, %.3f, %.3f] [%.3f, %.3f, %.3f, %.3f]",
a_mtxA.m[0][0], a_mtxA.m[0][1], a_mtxA.m[0][2], a_mtxA.m[0][3],
a_mtxA.m[1][0], a_mtxA.m[1][1], a_mtxA.m[1][2], a_mtxA.m[1][3],
a_mtxA.m[2][0], a_mtxA.m[2][1], a_mtxA.m[2][2], a_mtxA.m[2][3],
diff --git a/engines/hpl1/engine/math/Vector2.h b/engines/hpl1/engine/math/Vector2.h
index 53ec1cca7e8..a261b7d0fe0 100644
--- a/engines/hpl1/engine/math/Vector2.h
+++ b/engines/hpl1/engine/math/Vector2.h
@@ -221,14 +221,14 @@ public:
tString ToString() const {
char buf[512];
- sprintf(buf, "%f : %f", x, y);
+ snprintf(buf, 512, "%f : %f", x, y);
tString str = buf;
return str;
}
tString ToFileString() const {
char buf[512];
- sprintf(buf, "%g %g", x, y);
+ snprintf(buf, 512, "%g %g", x, y);
tString str = buf;
return str;
}
diff --git a/engines/hpl1/engine/math/Vector3.h b/engines/hpl1/engine/math/Vector3.h
index abf106f8785..dbbaaa46801 100644
--- a/engines/hpl1/engine/math/Vector3.h
+++ b/engines/hpl1/engine/math/Vector3.h
@@ -332,14 +332,14 @@ public:
tString ToString() const {
char buf[512];
- sprintf(buf, "%f : %f : %f", x, y, z);
+ snprintf(buf, 512, "%f : %f : %f", x, y, z);
tString str = buf;
return str;
}
tString ToFileString() const {
char buf[512];
- sprintf(buf, "%g %g %g", x, y, z);
+ snprintf(buf, 512, "%g %g %g", x, y, z);
tString str = buf;
return str;
}
diff --git a/engines/hpl1/engine/math/hplMatrix.h b/engines/hpl1/engine/math/hplMatrix.h
index b2b67489b17..d969ef3e7fe 100644
--- a/engines/hpl1/engine/math/hplMatrix.h
+++ b/engines/hpl1/engine/math/hplMatrix.h
@@ -255,7 +255,7 @@ public:
tString ToString() {
char buf[512];
- sprintf(buf, "[%f : %f : %f : %f] [%f : %f : %f : %f] [%f : %f : %f : %f] [%f : %f : %f : %f]",
+ snprintf(buf, 512, "[%f : %f : %f : %f] [%f : %f : %f : %f] [%f : %f : %f : %f] [%f : %f : %f : %f]",
m[0][0], m[0][1], m[0][2], m[0][3],
m[1][0], m[1][1], m[1][2], m[1][3],
m[2][0], m[2][1], m[2][2], m[2][3],
@@ -265,7 +265,7 @@ public:
tString ToFileString() {
char buf[512];
- sprintf(buf, "%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g",
+ snprintf(buf, 512, "%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g",
m[0][0], m[0][1], m[0][2], m[0][3],
m[1][0], m[1][1], m[1][2], m[1][3],
m[2][0], m[2][1], m[2][2], m[2][3],
diff --git a/engines/hpl1/engine/resources/ConfigFile.cpp b/engines/hpl1/engine/resources/ConfigFile.cpp
index 0c34e9bc3d9..c603c20cf9a 100644
--- a/engines/hpl1/engine/resources/ConfigFile.cpp
+++ b/engines/hpl1/engine/resources/ConfigFile.cpp
@@ -91,7 +91,7 @@ void cConfigFile::SetString(tString asLevel, tString asName, tString asVal) {
void cConfigFile::SetInt(tString asLevel, tString asName, int alVal) {
char sBuffer[40];
- sprintf(sBuffer, "%d", alVal);
+ snprintf(sBuffer, 40, "%d", alVal);
SetString(asLevel, asName, sBuffer);
}
@@ -100,7 +100,7 @@ void cConfigFile::SetInt(tString asLevel, tString asName, int alVal) {
void cConfigFile::SetFloat(tString asLevel, tString asName, float afVal) {
char sBuffer[40];
- sprintf(sBuffer, "%f", afVal);
+ snprintf(sBuffer, 40, "%f", afVal);
SetString(asLevel, asName, sBuffer);
}
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index 519379f14f8..185beba1ff1 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -386,14 +386,14 @@ tString cSerializeClass::ValueToString(void *apData, size_t alOffset, eSerialize
/////////// INT 32 ////////////////////////////////
case eSerializeType_Int32: {
- sprintf(msTempCharArray, "%d", PointerValue(pVal, int));
+ snprintf(msTempCharArray, 2048, "%d", PointerValue(pVal, int));
return msTempCharArray;
break;
}
/////////// FLOAT 32 ////////////////////////////////
case eSerializeType_Float32: {
- sprintf(msTempCharArray, "%f", PointerValue(pVal, float));
+ snprintf(msTempCharArray, 2048, "%f", PointerValue(pVal, float));
return msTempCharArray;
break;
}
@@ -408,7 +408,7 @@ tString cSerializeClass::ValueToString(void *apData, size_t alOffset, eSerialize
/////////// VECTOR 2L ////////////////////////////////
case eSerializeType_Vector2l: {
cVector2l &vVec = PointerValue(pVal, cVector2l);
- sprintf(msTempCharArray, "%d %d", vVec.x, vVec.y);
+ snprintf(msTempCharArray, 2048, "%d %d", vVec.x, vVec.y);
return msTempCharArray;
break;
}
@@ -416,7 +416,7 @@ tString cSerializeClass::ValueToString(void *apData, size_t alOffset, eSerialize
/////////// VECTOR 2F ////////////////////////////////
case eSerializeType_Vector2f: {
cVector2f &vVec = PointerValue(pVal, cVector2f);
- sprintf(msTempCharArray, "%f %f", vVec.x, vVec.y);
+ snprintf(msTempCharArray, 2048, "%f %f", vVec.x, vVec.y);
return msTempCharArray;
break;
}
@@ -424,7 +424,7 @@ tString cSerializeClass::ValueToString(void *apData, size_t alOffset, eSerialize
/////////// VECTOR 3L ////////////////////////////////
case eSerializeType_Vector3l: {
cVector3l &vVec = PointerValue(pVal, cVector3l);
- sprintf(msTempCharArray, "%d %d %d", vVec.x, vVec.y, vVec.z);
+ snprintf(msTempCharArray, 2048, "%d %d %d", vVec.x, vVec.y, vVec.z);
return msTempCharArray;
break;
}
@@ -432,7 +432,7 @@ tString cSerializeClass::ValueToString(void *apData, size_t alOffset, eSerialize
/////////// VECTOR 3F ////////////////////////////////
case eSerializeType_Vector3f: {
cVector3f &vVec = PointerValue(pVal, cVector3f);
- sprintf(msTempCharArray, "%f %f %f", vVec.x, vVec.y, vVec.z);
+ snprintf(msTempCharArray, 2048, "%f %f %f", vVec.x, vVec.y, vVec.z);
return msTempCharArray;
break;
}
@@ -440,7 +440,7 @@ tString cSerializeClass::ValueToString(void *apData, size_t alOffset, eSerialize
/////////// MATRIX F ////////////////////////////////
case eSerializeType_Matrixf: {
cMatrixf &Mtx = PointerValue(pVal, cMatrixf);
- sprintf(msTempCharArray, "%f %f %f %f "
+ snprintf(msTempCharArray, 2048, "%f %f %f %f "
"%f %f %f %f "
"%f %f %f %f "
"%f %f %f %f",
@@ -455,7 +455,7 @@ tString cSerializeClass::ValueToString(void *apData, size_t alOffset, eSerialize
/////////// COLOR ////////////////////////////////
case eSerializeType_Color: {
cColor Col = PointerValue(pVal, cColor);
- sprintf(msTempCharArray, "%f %f %f %f", Col.r, Col.g, Col.b, Col.a);
+ snprintf(msTempCharArray, 2048, "%f %f %f %f", Col.r, Col.g, Col.b, Col.a);
return msTempCharArray;
break;
}
@@ -463,7 +463,7 @@ tString cSerializeClass::ValueToString(void *apData, size_t alOffset, eSerialize
/////////// RECT 2L ////////////////////////////////
case eSerializeType_Rect2l: {
cRect2l &vR = PointerValue(pVal, cRect2l);
- sprintf(msTempCharArray, "%d %d %d %d", vR.x, vR.y, vR.w, vR.h);
+ snprintf(msTempCharArray, 2048, "%d %d %d %d", vR.x, vR.y, vR.w, vR.h);
return msTempCharArray;
break;
}
@@ -471,7 +471,7 @@ tString cSerializeClass::ValueToString(void *apData, size_t alOffset, eSerialize
/////////// RECT 2F ////////////////////////////////
case eSerializeType_Rect2f: {
cRect2f &vR = PointerValue(pVal, cRect2f);
- sprintf(msTempCharArray, "%f %f %f %f", vR.x, vR.y, vR.w, vR.h);
+ snprintf(msTempCharArray, 2048, "%f %f %f %f", vR.x, vR.y, vR.w, vR.h);
return msTempCharArray;
break;
}
@@ -479,7 +479,7 @@ tString cSerializeClass::ValueToString(void *apData, size_t alOffset, eSerialize
/////////// PLANE F ////////////////////////////////
case eSerializeType_Planef: {
cPlanef &vP = PointerValue(pVal, cPlanef);
- sprintf(msTempCharArray, "%f %f %f %f", vP.a, vP.b, vP.c, vP.d);
+ snprintf(msTempCharArray, 2048, "%f %f %f %f", vP.a, vP.b, vP.c, vP.d);
return msTempCharArray;
break;
}
diff --git a/engines/hpl1/engine/system/String.cpp b/engines/hpl1/engine/system/String.cpp
index b9539d9d4ef..43a007e2809 100644
--- a/engines/hpl1/engine/system/String.cpp
+++ b/engines/hpl1/engine/system/String.cpp
@@ -491,7 +491,7 @@ tFloatVec &cString::GetFloatVec(const tString &asData, tFloatVec &avVec, tString
tString cString::ToString(int alX) {
char buff[256];
- sprintf(buff, "%d", alX);
+ snprintf(buff, 256, "%d", alX);
return buff;
}
@@ -499,7 +499,7 @@ tString cString::ToString(int alX) {
tString cString::ToString(float afX) {
char buff[256];
- sprintf(buff, "%f", afX);
+ snprintf(buff, 256, "%f", afX);
return buff;
}
diff --git a/engines/hpl1/engine/system/SystemTypes.h b/engines/hpl1/engine/system/SystemTypes.h
index dd8015ed95f..c29bda7f38c 100644
--- a/engines/hpl1/engine/system/SystemTypes.h
+++ b/engines/hpl1/engine/system/SystemTypes.h
@@ -168,7 +168,7 @@ public:
tString ToString() {
char buff[256];
- sprintf(buff, "%d/%d-%d %d:%d:%d", month_day, month, 1900 + year, hours, minutes, seconds);
+ snprintf(buff, 256, "%d/%d-%d %d:%d:%d", month_day, month, 1900 + year, hours, minutes, seconds);
return buff;
}
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index 68ea8fa7717..d3651564caa 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -94,7 +94,7 @@ void LogUpdate(const char *fmt, ...) {
if (fmt == NULL)
return;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, 2048, fmt, ap);
va_end(ap);
tString sMess = "";
diff --git a/engines/hpl1/penumbra-overture/GameEnemy.cpp b/engines/hpl1/penumbra-overture/GameEnemy.cpp
index efdc34c88aa..8ce21bd27f4 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy.cpp
@@ -826,7 +826,7 @@ void iGameEnemy::ChangeState(int alId) {
tString sStateName2 = "NONE";
if(mlCurrentState >=0) sStateName2 = gvStateName[alId];
- sprintf(sStr,"%s State %s -> %s",msName.c_str(),sStateName1.c_str(),sStateName2.c_str());
+ snprintf(sStr, 512, "%s State %s -> %s",msName.c_str(),sStateName1.c_str(),sStateName2.c_str());
//mpInit->mpEffectHandler->GetSubTitle()->Add(cString::To16Char(sStr),1.2f,false);
Log("%s\n",sStr);*/
diff --git a/engines/hpl1/penumbra-overture/Inventory.cpp b/engines/hpl1/penumbra-overture/Inventory.cpp
index deb8f2a195b..0195c0c9ca6 100644
--- a/engines/hpl1/penumbra-overture/Inventory.cpp
+++ b/engines/hpl1/penumbra-overture/Inventory.cpp
@@ -574,7 +574,7 @@ void cInventoryBattery::OnDraw() {
void cInventoryBattery::OnMouseOver() {
char sPercent[256];
- sprintf(sPercent, " %.0f%% ", mpInit->mpPlayer->GetPower());
+ snprintf(sPercent, 256, " %.0f%% ", mpInit->mpPlayer->GetPower());
mpInit->mpInventory->SetItemName(kTranslate("Inventory", "BatteryLevel"));
mpInit->mpInventory->SetItemDesc(kTranslate("Inventory", "BatteryLevelDesc1") +
cString::To16Char(sPercent) +
@@ -1545,7 +1545,7 @@ bool cInventory::CheckCombineCallback(const tString &asItem1, const tString &asI
if (pFinalCallback) {
char sString[30];
- sprintf(sString, "%d", alSlotIndex);
+ snprintf(sString, 30, "%d", alSlotIndex);
tString sCommand = pFinalCallback->msFunction + "(\"" + asItem1 + "\", \"" + asItem2 + "\", " +
cString::ToString(sString, "") + ")";
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index c73019d848b..71640190d3c 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -845,7 +845,7 @@ public:
}
char sTempVec[256];
- sprintf(sTempVec, "%.1f", afX);
+ snprintf(sTempVec, 256, "%.1f", afX);
gpWidgetWeightForceScaleText->msText = cString::To16Char(sTempVec);
mpInit->mfHapticForceMul = afX;
@@ -872,7 +872,7 @@ public:
}
char sTempVec[256];
- sprintf(sTempVec, "%.1f", afX);
+ snprintf(sTempVec, 256, "%.1f", afX);
gpWidgetInteractModeCameraSpeedText->msText = cString::To16Char(sTempVec);
mpInit->mpPlayer->GetHapticCamera()->SetInteractModeCameraSpeed(afX);
@@ -899,7 +899,7 @@ public:
}
char sTempVec[256];
- sprintf(sTempVec, "%.1f", afX);
+ snprintf(sTempVec, 256, "%.1f", afX);
gpWidgetActionModeCameraSpeedText->msText = cString::To16Char(sTempVec);
mpInit->mpPlayer->GetHapticCamera()->SetActionModeCameraSpeed(afX);
@@ -942,7 +942,7 @@ public:
}
char sTempVec[256];
- sprintf(sTempVec, "%.1f", mpInit->mpButtonHandler->mfMouseSensitivity);
+ snprintf(sTempVec, 256, "%.1f", mpInit->mpButtonHandler->mfMouseSensitivity);
gpMouseSensitivityText->msText = cString::To16Char(sTempVec);
}
};
@@ -1210,7 +1210,7 @@ public:
mpInit->mpGame->GetGraphics()->GetLowLevel()->SetGammaCorrection(mfGamma);
char sTempVec[256];
- sprintf(sTempVec, "%.1f", mfGamma);
+ snprintf(sTempVec, 256, "%.1f", mfGamma);
gpGammaText->msText = cString::To16Char(sTempVec);
if (mlGNum == 1)
@@ -1491,7 +1491,7 @@ public:
mpInit->mvScreenSize = gvResolutions[lCurrentNum];
char sTempVec[256];
- sprintf(sTempVec, "%d x %d", mpInit->mvScreenSize.x, mpInit->mvScreenSize.y);
+ snprintf(sTempVec, 256, "%d x %d", mpInit->mvScreenSize.x, mpInit->mvScreenSize.y);
gpResolutionText->msText = cString::To16Char(sTempVec);
gbMustRestart = true;
@@ -2367,7 +2367,7 @@ void cMainMenu::CreateWidgets() {
cMainMenuWidget *pGammaFirstButton = hplNew(cMainMenuWidget_Gamma, (mpInit, vPos, kTranslate("MainMenu", "Gamma:"), 20, eFontAlign_Right, 1));
AddWidgetToState(eMainMenuState_FirstStart, pGammaFirstButton);
vPos.x = 405;
- sprintf(sTempVec, "%.1f", mpInit->mpGame->GetGraphics()->GetLowLevel()->GetGammaCorrection());
+ snprintf(sTempVec, 256, "%.1f", mpInit->mpGame->GetGraphics()->GetLowLevel()->GetGammaCorrection());
sText = cString::To16Char(sTempVec);
gpGammaText2 = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left));
AddWidgetToState(eMainMenuState_FirstStart, gpGammaText2);
@@ -2632,7 +2632,7 @@ void cMainMenu::CreateWidgets() {
AddWidgetToState(eMainMenuState_OptionsControls, gpInvertMouseYText);
vPos.y += 29;
- sprintf(sTempVec, "%.1f", mpInit->mpButtonHandler->mfMouseSensitivity);
+ snprintf(sTempVec, 256, "%.1f", mpInit->mpButtonHandler->mfMouseSensitivity);
sText = cString::To16Char(sTempVec);
gpMouseSensitivityText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left, pWidgetMouseSensitivity));
AddWidgetToState(eMainMenuState_OptionsControls, gpMouseSensitivityText);
@@ -2651,19 +2651,19 @@ void cMainMenu::CreateWidgets() {
gpUseHapticsText->SetExtraWidget(pWidgetUseHaptics);
vPos.y += 29;
- sprintf(sTempVec, "%.1f", mpInit->mfHapticForceMul);
+ snprintf(sTempVec, 256, "%.1f", mpInit->mfHapticForceMul);
sText = cString::To16Char(sTempVec);
gpWidgetWeightForceScaleText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left, pWidgetWeightForceScale));
AddWidgetToState(eMainMenuState_OptionsControls, gpWidgetWeightForceScaleText);
vPos.y += 29;
- sprintf(sTempVec, "%.1f", mpInit->mpPlayer->GetHapticCamera()->GetInteractModeCameraSpeed());
+ snprintf(sTempVec, 256, "%.1f", mpInit->mpPlayer->GetHapticCamera()->GetInteractModeCameraSpeed());
sText = cString::To16Char(sTempVec);
gpWidgetInteractModeCameraSpeedText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left, pWidgetInteractModeCameraSpeed));
AddWidgetToState(eMainMenuState_OptionsControls, gpWidgetInteractModeCameraSpeedText);
vPos.y += 29;
- sprintf(sTempVec, "%.1f", mpInit->mpPlayer->GetHapticCamera()->GetActionModeCameraSpeed());
+ snprintf(sTempVec, 256, "%.1f", mpInit->mpPlayer->GetHapticCamera()->GetActionModeCameraSpeed());
sText = cString::To16Char(sTempVec);
gpWidgetActionModeCameraSpeedText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left, pWidgetActionModeCameraSpeed));
AddWidgetToState(eMainMenuState_OptionsControls, gpWidgetActionModeCameraSpeedText);
@@ -2978,7 +2978,7 @@ void cMainMenu::CreateWidgets() {
// Text
vPos = cVector3f(vTextStart.x + 12, vTextStart.y + 37, vTextStart.z);
- sprintf(sTempVec, "%d x %d", mpInit->mvScreenSize.x, mpInit->mvScreenSize.y);
+ snprintf(sTempVec, 256, "%d x %d", mpInit->mvScreenSize.x, mpInit->mvScreenSize.y);
sText = cString::To16Char(sTempVec);
gpResolutionText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsGraphics, gpResolutionText);
@@ -2997,7 +2997,7 @@ void cMainMenu::CreateWidgets() {
gpBloomText->SetExtraWidget(pWidgetBloom);
vPos.y += 29;
- sprintf(sTempVec, "%.1f", mpInit->mpGame->GetGraphics()->GetLowLevel()->GetGammaCorrection());
+ snprintf(sTempVec, 256, "%.1f", mpInit->mpGame->GetGraphics()->GetLowLevel()->GetGammaCorrection());
sText = cString::To16Char(sTempVec);
gpGammaText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left));
AddWidgetToState(eMainMenuState_OptionsGraphics, gpGammaText);
Commit: 65ee75176fb69161c11d7292fb9dac691cb1dfe3
https://github.com/scummvm/scummvm/commit/65ee75176fb69161c11d7292fb9dac691cb1dfe3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:12+01:00
Commit Message:
HPL1: Removed more system includes
Changed paths:
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/graphics/Mesh2d.cpp
engines/hpl1/engine/graphics/Renderer2D.h
engines/hpl1/engine/graphics/RendererPostEffects.h
engines/hpl1/engine/graphics/font_data.cpp
engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
engines/hpl1/engine/impl/tinyXML/tinyxml.h
engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/math/Vector2.h
engines/hpl1/engine/math/Vector3.h
engines/hpl1/engine/math/hplMatrix.h
engines/hpl1/engine/resources/ResourcesTypes.h
engines/hpl1/engine/scene/TileSet.cpp
engines/hpl1/engine/system/String.cpp
engines/hpl1/engine/system/SystemTypes.h
engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
engines/hpl1/penumbra-overture/SaveHandler.cpp
engines/hpl1/string.cpp
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index 741d8ef3791..f6a15bc6616 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -27,10 +27,6 @@
#include "hpl1/engine/game/ScriptFuncs.h"
-#include <math.h>
-#include <stdlib.h>
-//#include <time.h>
-
#include "hpl1/engine/game/Game.h"
#include "hpl1/engine/graphics/Beam.h"
#include "hpl1/engine/graphics/BillBoard.h"
diff --git a/engines/hpl1/engine/graphics/Mesh2d.cpp b/engines/hpl1/engine/graphics/Mesh2d.cpp
index ef1a01a39e4..07e04eed24a 100644
--- a/engines/hpl1/engine/graphics/Mesh2d.cpp
+++ b/engines/hpl1/engine/graphics/Mesh2d.cpp
@@ -29,7 +29,6 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/MemoryManager.h"
-#include <math.h>
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Renderer2D.h b/engines/hpl1/engine/graphics/Renderer2D.h
index 869d1239b38..aafa0307806 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.h
+++ b/engines/hpl1/engine/graphics/Renderer2D.h
@@ -28,8 +28,6 @@
#ifndef HPL_RENDERER2D_H
#define HPL_RENDERER2D_H
-#include <math.h>
-
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/Material.h"
#include "hpl1/engine/graphics/Mesh2d.h"
diff --git a/engines/hpl1/engine/graphics/RendererPostEffects.h b/engines/hpl1/engine/graphics/RendererPostEffects.h
index 95ad26f61b0..349d44dd261 100644
--- a/engines/hpl1/engine/graphics/RendererPostEffects.h
+++ b/engines/hpl1/engine/graphics/RendererPostEffects.h
@@ -28,8 +28,6 @@
#ifndef HPL_RENDERER_POST_EFFECTS_H
#define HPL_RENDERER_POST_EFFECTS_H
-#include <math.h>
-
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
#include "common/list.h"
diff --git a/engines/hpl1/engine/graphics/font_data.cpp b/engines/hpl1/engine/graphics/font_data.cpp
index f906562a47d..6a0ecc18967 100644
--- a/engines/hpl1/engine/graphics/font_data.cpp
+++ b/engines/hpl1/engine/graphics/font_data.cpp
@@ -26,8 +26,6 @@
*/
#include "hpl1/engine/graphics/font_data.h"
-#include <stdarg.h>
-#include <stdlib.h>
#include "hpl1/engine/system/low_level_system.h"
diff --git a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
index 054b800dbd9..034d83f99c8 100644
--- a/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
+++ b/engines/hpl1/engine/impl/LowLevelGraphicsSDL.cpp
@@ -25,8 +25,6 @@
* This file is part of HPL1 Engine.
*/
-#include <assert.h>
-
#include "hpl1/engine/graphics/font_data.h"
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
diff --git a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
index 31330d90b39..61c4123fd58 100644
--- a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
+++ b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
@@ -19,8 +19,6 @@
*
*/
-#include <assert.h>
-
#include "hpl1/engine/impl/low_level_graphics_tgl.h"
#include "hpl1/engine/graphics/bitmap2D.h"
diff --git a/engines/hpl1/engine/impl/tinyXML/tinyxml.h b/engines/hpl1/engine/impl/tinyXML/tinyxml.h
index 95bdb481746..7d7f75cbff1 100644
--- a/engines/hpl1/engine/impl/tinyXML/tinyxml.h
+++ b/engines/hpl1/engine/impl/tinyXML/tinyxml.h
@@ -31,7 +31,6 @@ distribution.
#pragma warning(disable : 4786)
#endif
-#include <assert.h>
#include "common/file.h"
#include "common/str.h"
#include "common/util.h"
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
index 8837aeb79bb..86a70dff7b5 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
@@ -1,10 +1,4 @@
-#include <new>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <stdio.h> // sprintf
#include <string>
-#include <algorithm> // std::sort
#include "scriptarray.h"
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
index 460fccacc81..564552d197b 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
@@ -1,9 +1,4 @@
-#include <string.h>
#include "scripthelper.h"
-#include <assert.h>
-#include <stdio.h>
-#include <fstream>
-#include <stdlib.h>
#include "hpl1/std/set.h"
@@ -68,7 +63,7 @@ int ExecuteString(asIScriptEngine *engine, const char *code, void *ref, int refT
}
else if (refTypeId & asTYPEID_MASK_OBJECT)
{
- // Use the registered assignment operator to do a value assign.
+ // Use the registered assignment operator to do a value assign.
// This assumes that the ref is pointing to a valid object instance.
engine->AssignScriptObject(ref, execCtx->GetAddressOfReturnValue(), engine->GetTypeInfoById(refTypeId));
}
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h
index 8e83ead2c7a..389abf7ba32 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h
@@ -1,7 +1,6 @@
#ifndef SCRIPTHELPER_H
#define SCRIPTHELPER_H
-#include <sstream>
#include <string>
#ifndef ANGELSCRIPT_H
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
index 28d4980c991..ab91534a39a 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -1,9 +1,5 @@
#include "hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h"
-#include <assert.h> // assert()
#include <sstream> // std::stringstream
-#include <string.h> // strstr()
-#include <stdio.h> // sprintf()
-#include <stdlib.h> // strtod()
#ifndef __psp2__
#include <locale.h> // setlocale()
#endif
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h
index a814ce6fe4e..341e73a9720 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h
@@ -3,7 +3,7 @@
//
// This function registers the std::string type with AngelScript to be used as the default string type.
//
-// The string type is registered as a value type, thus may have performance issues if a lot of
+// The string type is registered as a value type, thus may have performance issues if a lot of
// string operations are performed in the script. However, for relatively few operations, this should
// not cause any problem for most applications.
//
@@ -11,13 +11,11 @@
#ifndef SCRIPTSTDSTRING_H
#define SCRIPTSTDSTRING_H
-#ifndef ANGELSCRIPT_H
+#ifndef ANGELSCRIPT_H
// Avoid having to inform include path if header is already include before
#include "hpl1/engine/libraries/angelscript/angelscript.h"
#endif
-#include <string>
-
//---------------------------
// Compilation settings
//
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index be51c86e618..039d840e9aa 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -25,14 +25,8 @@
* This file is part of HPL1 Engine.
*/
-#include <stdlib.h>
-
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
-#include <map>
-#include <math.h>
-#include <stdlib.h>
-#include <limits>
#include "hpl1/hpl1.h"
namespace hpl {
diff --git a/engines/hpl1/engine/math/Vector2.h b/engines/hpl1/engine/math/Vector2.h
index a261b7d0fe0..2979d6b460a 100644
--- a/engines/hpl1/engine/math/Vector2.h
+++ b/engines/hpl1/engine/math/Vector2.h
@@ -29,8 +29,6 @@
#define HPL_VECTOR2_H
#include "hpl1/engine/system/SystemTypes.h"
-#include <math.h>
-#include <stdio.h>
namespace hpl {
diff --git a/engines/hpl1/engine/math/Vector3.h b/engines/hpl1/engine/math/Vector3.h
index dbbaaa46801..5755ff40a37 100644
--- a/engines/hpl1/engine/math/Vector3.h
+++ b/engines/hpl1/engine/math/Vector3.h
@@ -28,8 +28,7 @@
#ifndef HPL_VECTOR3_H
#define HPL_VECTOR3_H
-#include "Vector2.h"
-#include <math.h>
+#include "hpl1/engine/math/Vector2.h"
#define VEC3_CONST_ARRAY(name, vec) const float name[] = {vec.x, vec.y, vec.z}
diff --git a/engines/hpl1/engine/math/hplMatrix.h b/engines/hpl1/engine/math/hplMatrix.h
index d969ef3e7fe..f8c51207f3e 100644
--- a/engines/hpl1/engine/math/hplMatrix.h
+++ b/engines/hpl1/engine/math/hplMatrix.h
@@ -28,8 +28,7 @@
#ifndef HPL_MATRIX_H
#define HPL_MATRIX_H
-#include "Vector3.h"
-#include <math.h>
+#include "hpl1/engine/math/Vector3.h"
namespace hpl {
diff --git a/engines/hpl1/engine/resources/ResourcesTypes.h b/engines/hpl1/engine/resources/ResourcesTypes.h
index d2ac4f64fbc..383bb934276 100644
--- a/engines/hpl1/engine/resources/ResourcesTypes.h
+++ b/engines/hpl1/engine/resources/ResourcesTypes.h
@@ -28,8 +28,6 @@
#ifndef HPL_RESOURCES_TYPES_H
#define HPL_RESOURCES_TYPES_H
-#include <stdio.h>
-
namespace hpl {
// change to own file type?
diff --git a/engines/hpl1/engine/scene/TileSet.cpp b/engines/hpl1/engine/scene/TileSet.cpp
index 378fc2a36a8..79b7a791475 100644
--- a/engines/hpl1/engine/scene/TileSet.cpp
+++ b/engines/hpl1/engine/scene/TileSet.cpp
@@ -31,7 +31,6 @@
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/resources/Resources.h"
#include "hpl1/engine/system/low_level_system.h"
-#include <assert.h>
namespace hpl {
diff --git a/engines/hpl1/engine/system/String.cpp b/engines/hpl1/engine/system/String.cpp
index 43a007e2809..940e206b8fd 100644
--- a/engines/hpl1/engine/system/String.cpp
+++ b/engines/hpl1/engine/system/String.cpp
@@ -26,7 +26,6 @@
*/
#include "hpl1/engine/system/String.h"
-#include <stdlib.h>
#include "hpl1/engine/system/low_level_system.h"
diff --git a/engines/hpl1/engine/system/SystemTypes.h b/engines/hpl1/engine/system/SystemTypes.h
index c29bda7f38c..2e7bbf75803 100644
--- a/engines/hpl1/engine/system/SystemTypes.h
+++ b/engines/hpl1/engine/system/SystemTypes.h
@@ -28,9 +28,6 @@
#ifndef HPL_SYSTEM_TYPES_H
#define HPL_SYSTEM_TYPES_H
-#include <stdio.h>
-#include <string>
-
#include "hpl1/engine/system/Container.h"
#include "common/list.h"
#include "common/str.h"
diff --git a/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp b/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
index 1ea707f1a8b..7d5fdd44a93 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
@@ -26,7 +26,6 @@
*/
#include "hpl1/penumbra-overture/PlayerState_Interact.h"
-#include <math.h>
#include "hpl1/engine/engine.h"
#include "hpl1/penumbra-overture/GameStickArea.h"
diff --git a/engines/hpl1/penumbra-overture/SaveHandler.cpp b/engines/hpl1/penumbra-overture/SaveHandler.cpp
index d209679dd77..f07fb909b7a 100644
--- a/engines/hpl1/penumbra-overture/SaveHandler.cpp
+++ b/engines/hpl1/penumbra-overture/SaveHandler.cpp
@@ -40,7 +40,6 @@
#include "hpl1/string.h"
#include "common/savefile.h"
#include "hpl1/debug.h"
-#include <stdio.h>
//////////////////////////////////////////////////////////////////////////
// SAVED WORLD
diff --git a/engines/hpl1/string.cpp b/engines/hpl1/string.cpp
index d701a3349be..5cea3f7a721 100644
--- a/engines/hpl1/string.cpp
+++ b/engines/hpl1/string.cpp
@@ -19,7 +19,6 @@
*
*/
-#include <stdlib.h>
#include "hpl1/string.h"
namespace Hpl1 {
@@ -37,4 +36,4 @@ Common::String fileDir(const Common::String &path) {
return path.substr(0, last+1);
}
-}
\ No newline at end of file
+}
Commit: 0380cfb41f548bca62db5f498cea820a54bdb74d
https://github.com/scummvm/scummvm/commit/0380cfb41f548bca62db5f498cea820a54bdb74d
Author: D G Turner (digitall at scummvm.org)
Date: 2022-12-23T14:04:12+01:00
Commit Message:
HPL1: Fix Compilation
While these system headers should be removed in future, removing these
currently breaks the build. Have marked the restored headers with FIXME
comments for reference.
Changed paths:
engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
engines/hpl1/engine/math/Math.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
index 86a70dff7b5..11fe7c7c0ea 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
@@ -1,4 +1,7 @@
+#include <string.h> // FIXME: Refactor to remove this system header
+#include <assert.h> // assert() // FIXME: Refactor to remove this system header
#include <string>
+#include <algorithm> // std::sort // FIXME: Refactor to remove this system header
#include "scriptarray.h"
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
index ab91534a39a..2366739ba33 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -1,5 +1,9 @@
#include "hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h"
+#include <assert.h> // assert() // FIXME: Refactor to remove this system header
#include <sstream> // std::stringstream
+#include <string.h> // strstr() // FIXME: Refactor to remove this system header
+#include <stdio.h> // sprintf() // FIXME: Refactor to remove this system header
+#include <stdlib.h> // strtod() // FIXME: Refactor to remove this system header
#ifndef __psp2__
#include <locale.h> // setlocale()
#endif
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
index 4c4f14f8d38..4b6c14c8416 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
@@ -843,7 +843,7 @@ int asCScriptFunction::FindNextLineWithCode(int line) const
struct C
{
- static int cmp(const void *a, const void *b) { return *(int*)a - *(int*)b; }
+ static int cmp(const void *a, const void *b) { return *(const int*)a - *(const int*)b; }
};
std::qsort(&lineNbrs[0], lineNbrs.GetLength(), sizeof(int), C::cmp);
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index 039d840e9aa..9afe943de24 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -27,6 +27,7 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
+#include <limits> // FIXME: Refactor to remove this system header
#include "hpl1/hpl1.h"
namespace hpl {
Commit: 912403d72e3310d9d9fe3365370af576d9ca8b36
https://github.com/scummvm/scummvm/commit/912403d72e3310d9d9fe3365370af576d9ca8b36
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:13+01:00
Commit Message:
HPL1: add Hpl1::std::map and Hpl1::std::pair
the map implementation is copied from ags/std/lib but includes some changes.
Changed paths:
A engines/hpl1/std/map.h
A engines/hpl1/std/pair.h
diff --git a/engines/hpl1/std/map.h b/engines/hpl1/std/map.h
new file mode 100644
index 00000000000..affa79155ee
--- /dev/null
+++ b/engines/hpl1/std/map.h
@@ -0,0 +1,216 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_STD_MAP_H
+#define HPL1_STD_MAP_H
+
+#include "common/hashmap.h"
+#include "pair.h"
+
+namespace Hpl1 {
+namespace std {
+
+template<class Key, class Val, class CompFunc = Common::Less<Key> >
+class map {
+public:
+ using value_type = pair<Key, Val>;
+ using iterator = typename Common::Array<value_type>::iterator;
+ using const_iterator = typename Common::Array<value_type>::const_iterator;
+
+ /**
+ * Clears the map
+ */
+ void clear() {
+ _items.clear();
+ }
+
+ /**
+ * Gets the iterator start
+ */
+ iterator begin() {
+ return _items.begin();
+ }
+
+ /**
+ * Get the iterator end
+ */
+ iterator end() {
+ return _items.end();
+ }
+
+ /**
+ * Get the const iterator start
+ */
+ const_iterator begin() const {
+ return _items.begin();
+ }
+
+ /**
+ * Get the const iterator end
+ */
+ const_iterator end() const {
+ return _items.end();
+ }
+
+ /**
+ * Returns an iterator for the first element of the map that is
+ * not less than the given key
+ */
+ const_iterator lower_bound(const Key &theKey) const {
+ const_iterator first = this->begin();
+ const_iterator it;
+ int count_ = _items.size(), step;
+
+ while (count_ > 0) {
+ it = first;
+ step = count_ / 2;
+ it += step;
+
+ if (_comp(it->first, theKey)) {
+ first = ++it;
+ count_ -= step + 1;
+ } else {
+ count_ = step;
+ }
+ }
+
+ return first;
+ }
+
+ iterator lower_bound(const Key &theKey) {
+ iterator first = this->begin();
+ iterator it;
+ int count_ = _items.size(), step;
+
+ while (count_ > 0) {
+ it = first;
+ step = count_ / 2;
+ it += step;
+
+ if (_comp(it->first, theKey)) {
+ first = ++it;
+ count_ -= step + 1;
+ } else {
+ count_ = step;
+ }
+ }
+
+ return first;
+ }
+
+ iterator upper_bound(const Key &k)
+ {
+ return lower_bound(k) + 1;
+ }
+
+ /**
+ * Find the entry with the given key
+ */
+ iterator find(const Key &theKey) {
+ iterator it = this->lower_bound(theKey);
+
+ if (it != this->end() && it->first == theKey)
+ return it;
+ return this->end();
+ }
+
+ const_iterator find(const Key &theKey) const {
+ const_iterator it = this->lower_bound(theKey);
+
+ if (it != this->end() && it->first == theKey)
+ return it;
+ return this->end();
+ }
+
+ /**
+ * Square brackets operator accesses items by key, creating if necessary
+ */
+ Val &operator[](const Key &theKey) {
+ iterator it = this->lower_bound(theKey);
+ if (it == this->end() || it->first != theKey) {
+ size_t idx = it - this->begin();
+ _items.insert_at(idx, {});
+ _items[idx].first = theKey;
+ return _items[idx].second;
+ } else {
+ return _items[it - this->begin()].second;
+ }
+ }
+
+ /**
+ * Erases an entry in the map
+ */
+ iterator erase(iterator it) {
+ iterator next = it;
+ ++next;
+ _items.remove_at(it - begin());
+ return next;
+ }
+
+ iterator erase(const Key &theKey) {
+ iterator it = find(theKey);
+ if (it != this->end())
+ return erase(it);
+ return it;
+ }
+
+ std::pair<iterator, bool> insert(value_type const& val) {
+ iterator it = this->lower_bound(val.first);
+ if (it == this->end() || !(it->first == val.first)) {
+ size_t idx = it - this->begin();
+ _items.insert_at(idx, val);
+ return {it, true};
+ }
+ return {it, false};
+ }
+
+ /**
+ * Returns the size of the map
+ */
+ size_t size() const {
+ return _items.size();
+ }
+
+ bool empty() const {
+ return _items.empty();
+ }
+
+ /**
+ * Returns the number of elements with a matching key
+ */
+ size_t count(const Key &theKey) {
+ int count_ = 0;
+ for (iterator it = this->begin(); it != this->end(); ++it) {
+ if (it->first == theKey)
+ ++count_;
+ }
+
+ return count_;
+ }
+private:
+ Common::Array<value_type> _items;
+ CompFunc _comp;
+};
+
+} // namespace std
+} // namespace Hpl1
+
+#endif
\ No newline at end of file
diff --git a/engines/hpl1/std/pair.h b/engines/hpl1/std/pair.h
new file mode 100644
index 00000000000..4709bf57d36
--- /dev/null
+++ b/engines/hpl1/std/pair.h
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_STD_PAIR_H
+#define HPL1_STD_PAIR_H
+
+namespace Hpl1 {
+namespace std {
+
+template<typename T1, typename T2>
+struct pair {
+ pair(const T1 &f, const T2 &s) : first(f), second(s) {}
+
+ T1 first;
+ T2 second;
+};
+
+} // namespace std
+
+} // namespace Hpl1
+
+#endif
\ No newline at end of file
Commit: 81138eb006bf081f11e5c859ecafd4ae1c71991d
https://github.com/scummvm/scummvm/commit/81138eb006bf081f11e5c859ecafd4ae1c71991d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:13+01:00
Commit Message:
HPL1: replace std::map with Hpl1::std::map
Changed paths:
engines/hpl1/engine/ai/AINodeContainer.h
engines/hpl1/engine/ai/StateMachine.h
engines/hpl1/engine/game/Game.cpp
engines/hpl1/engine/game/Game.h
engines/hpl1/engine/game/GameTypes.h
engines/hpl1/engine/game/SaveGame.h
engines/hpl1/engine/game/Updater.h
engines/hpl1/engine/graphics/BackgroundImage.h
engines/hpl1/engine/graphics/Bone.h
engines/hpl1/engine/graphics/ImageEntityData.h
engines/hpl1/engine/graphics/Mesh.h
engines/hpl1/engine/graphics/ParticleEmitter.h
engines/hpl1/engine/graphics/Skeleton.h
engines/hpl1/engine/gui/Gui.h
engines/hpl1/engine/gui/GuiSkin.h
engines/hpl1/engine/haptic/HapticTypes.h
engines/hpl1/engine/input/Input.h
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/physics/Body2D.h
engines/hpl1/engine/physics/Physics.h
engines/hpl1/engine/physics/PhysicsJoint.h
engines/hpl1/engine/physics/PhysicsWorld.h
engines/hpl1/engine/resources/FileSearcher.h
engines/hpl1/engine/resources/ImageManager.cpp
engines/hpl1/engine/resources/ImageManager.h
engines/hpl1/engine/resources/LanguageFile.cpp
engines/hpl1/engine/resources/LanguageFile.h
engines/hpl1/engine/resources/ParticleManager.h
engines/hpl1/engine/resources/ResourceManager.h
engines/hpl1/engine/resources/Resources.h
engines/hpl1/engine/resources/TextureManager.h
engines/hpl1/engine/scene/GridMap2D.h
engines/hpl1/engine/scene/MeshEntity.h
engines/hpl1/engine/scene/MultiImageEntity.h
engines/hpl1/engine/scene/PortalContainer.h
engines/hpl1/engine/scene/SectorVisibility.cpp
engines/hpl1/engine/scene/SectorVisibility.h
engines/hpl1/engine/scene/SubMeshEntity.h
engines/hpl1/engine/scene/World2D.h
engines/hpl1/engine/scene/World3D.h
engines/hpl1/engine/sound/SoundHandler.h
engines/hpl1/engine/system/Container.h
engines/hpl1/engine/system/MemoryManager.h
engines/hpl1/engine/system/SerializeClass.h
engines/hpl1/penumbra-overture/GameEntity.h
engines/hpl1/penumbra-overture/GameTypes.h
engines/hpl1/penumbra-overture/PlayerHands.h
diff --git a/engines/hpl1/engine/ai/AINodeContainer.h b/engines/hpl1/engine/ai/AINodeContainer.h
index 4cff1c1bffb..c5d7c8a92a2 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.h
+++ b/engines/hpl1/engine/ai/AINodeContainer.h
@@ -92,7 +92,7 @@ typedef tAINodeVec::iterator tAINodeVecIt;
typedef Common::List<cAINode *> tAINodeList;
typedef tAINodeList::iterator tAINodeListIt;
-typedef std::map<tString, cAINode *> tAINodeMap;
+typedef Hpl1::std::map<tString, cAINode *> tAINodeMap;
typedef tAINodeMap::iterator tAINodeMapIt;
//--------------------------------
diff --git a/engines/hpl1/engine/ai/StateMachine.h b/engines/hpl1/engine/ai/StateMachine.h
index f65a9d8fab6..4fd66b17122 100644
--- a/engines/hpl1/engine/ai/StateMachine.h
+++ b/engines/hpl1/engine/ai/StateMachine.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/game/GameTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <map>
+#include "hpl1/std/map.h"
namespace hpl {
@@ -69,7 +69,7 @@ private:
float mfTimeCount;
};
-typedef std::map<int, iAIState *> tAIStateMap;
+typedef Hpl1::std::map<int, iAIState *> tAIStateMap;
typedef tAIStateMap::iterator tAIStateMapIt;
//-----------------------------------------
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index c4f137ce8db..645aa871d3a 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -93,7 +93,7 @@ cSetupVarContainer::cSetupVarContainer() {
//-----------------------------------------------------------------------
void cSetupVarContainer::AddString(const tString &asName, const tString &asValue) {
- std::map<tString, tString>::value_type val(asName, asValue);
+ Hpl1::std::map<tString, tString>::value_type val(asName, asValue);
m_mapVars.insert(val);
}
@@ -110,7 +110,7 @@ void cSetupVarContainer::AddBool(const tString &asName, bool abValue) {
//-----------------------------------------------------------------------
const tString &cSetupVarContainer::GetString(const tString &asName) {
- std::map<tString, tString>::iterator it = m_mapVars.find(asName);
+ Hpl1::std::map<tString, tString>::iterator it = m_mapVars.find(asName);
if (it == m_mapVars.end())
return msBlank;
else
diff --git a/engines/hpl1/engine/game/Game.h b/engines/hpl1/engine/game/Game.h
index 4b2a068165d..47e3c206c56 100644
--- a/engines/hpl1/engine/game/Game.h
+++ b/engines/hpl1/engine/game/Game.h
@@ -83,7 +83,7 @@ public:
bool GetBool(const tString &asName, bool abDefault);
private:
- std::map<tString, tString> m_mapVars;
+ Hpl1::std::map<tString, tString> m_mapVars;
tString msBlank;
};
diff --git a/engines/hpl1/engine/game/GameTypes.h b/engines/hpl1/engine/game/GameTypes.h
index 5afbb4ce0a7..24fc1959fe3 100644
--- a/engines/hpl1/engine/game/GameTypes.h
+++ b/engines/hpl1/engine/game/GameTypes.h
@@ -28,9 +28,9 @@
#ifndef HPL_GAME_TYPES_H
#define HPL_GAME_TYPES_H
-#include <map>
#include "hpl1/engine/system/SerializeClass.h"
+#include "hpl1/std/map.h"
namespace hpl {
@@ -41,7 +41,7 @@ class cScriptVar : public iSerializable {
int mlVal;
};
-typedef std::map<tString, cScriptVar> tScriptVarMap;
+typedef Hpl1::std::map<tString, cScriptVar> tScriptVarMap;
typedef tScriptVarMap::iterator tScriptVarMapIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/game/SaveGame.h b/engines/hpl1/engine/game/SaveGame.h
index 4736f116b24..bf4ece3798d 100644
--- a/engines/hpl1/engine/game/SaveGame.h
+++ b/engines/hpl1/engine/game/SaveGame.h
@@ -33,6 +33,7 @@
#include "hpl1/engine/system/SerializeClass.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/std/map.h"
class TiXmlElement;
diff --git a/engines/hpl1/engine/game/Updater.h b/engines/hpl1/engine/game/Updater.h
index 300c4217f25..c2cbdea0806 100644
--- a/engines/hpl1/engine/game/Updater.h
+++ b/engines/hpl1/engine/game/Updater.h
@@ -28,10 +28,9 @@
#ifndef HPL_UPDATER_H
#define HPL_UPDATER_H
-#include <map>
-
#include "hpl1/engine/system/SystemTypes.h"
#include "common/list.h"
+#include "hpl1/std/map.h"
namespace hpl {
@@ -41,7 +40,7 @@ class LowLevelSystem;
typedef Common::List<iUpdateable *> tUpdateableList;
typedef tUpdateableList::iterator tUpdateableListIt;
-typedef std::map<tString, tUpdateableList> tUpdateContainerMap;
+typedef Hpl1::std::map<tString, tUpdateableList> tUpdateContainerMap;
typedef tUpdateContainerMap::iterator tUpdateContainerMapIt;
class cUpdater {
diff --git a/engines/hpl1/engine/graphics/BackgroundImage.h b/engines/hpl1/engine/graphics/BackgroundImage.h
index 7b42a8b8cdd..9746bc1976f 100644
--- a/engines/hpl1/engine/graphics/BackgroundImage.h
+++ b/engines/hpl1/engine/graphics/BackgroundImage.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/Material.h"
#include "hpl1/engine/math/MathTypes.h"
-#include <map>
+#include "hpl1/std/map.h"
namespace hpl {
@@ -57,7 +57,7 @@ private:
cVector2f mvVel;
};
-typedef std::map<float, cBackgroundImage *> tBackgroundImageMap;
+typedef Hpl1::std::map<float, cBackgroundImage *> tBackgroundImageMap;
typedef tBackgroundImageMap::iterator tBackgroundImageMapIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/Bone.h b/engines/hpl1/engine/graphics/Bone.h
index cd89aeb129f..d0ba115527a 100644
--- a/engines/hpl1/engine/graphics/Bone.h
+++ b/engines/hpl1/engine/graphics/Bone.h
@@ -28,12 +28,11 @@
#ifndef HPL_BONE_H
#define HPL_BONE_H
-#include <map>
-
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "common/list.h"
+#include "hpl1/std/map.h"
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.h b/engines/hpl1/engine/graphics/ImageEntityData.h
index e5c531da4b5..d80b5908d86 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.h
+++ b/engines/hpl1/engine/graphics/ImageEntityData.h
@@ -32,7 +32,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/resources/ResourceBase.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <map>
+#include "hpl1/std/map.h"
class TiXmlElement;
@@ -64,7 +64,7 @@ public:
tString msSound;
};
-typedef std::map<tString, cImageAnimation> tImageAnimationMap;
+typedef Hpl1::std::map<tString, cImageAnimation> tImageAnimationMap;
typedef tImageAnimationMap::iterator tImageAnimationMapIt;
class cImageEntityData : public iResourceBase {
diff --git a/engines/hpl1/engine/graphics/Mesh.h b/engines/hpl1/engine/graphics/Mesh.h
index 6f9a4a85a29..bdcdb47f66d 100644
--- a/engines/hpl1/engine/graphics/Mesh.h
+++ b/engines/hpl1/engine/graphics/Mesh.h
@@ -28,8 +28,6 @@
#ifndef HPL_MESH_H
#define HPL_MESH_H
-#include <map>
-
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/resources/ResourceBase.h"
@@ -40,6 +38,7 @@
#include "hpl1/engine/scene/Light3D.h"
#include "common/array.h"
+#include "hpl1/std/map.h"
namespace hpl {
@@ -65,7 +64,7 @@ class cWorld3D;
typedef Common::Array<cAnimation *> tAnimationVec;
typedef tAnimationVec::iterator tAnimationVecIt;
-typedef std::map<tString, int> tAnimationIndexMap;
+typedef Hpl1::std::map<tString, int> tAnimationIndexMap;
typedef tAnimationIndexMap::iterator tAnimationIndexMapIt;
typedef Common::Array<cSubMesh *> tSubMeshVec;
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter.h b/engines/hpl1/engine/graphics/ParticleEmitter.h
index 3238b35219a..7f93d5887ae 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter.h
@@ -33,7 +33,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "common/list.h"
-#include <map>
+#include "hpl1/std/map.h"
#include "common/array.h"
namespace hpl {
@@ -233,7 +233,7 @@ protected:
float mfWarmUpStepsPerSec;
};
-typedef std::map<tString, iParticleEmitterData *> tParticleEmitterDataMap;
+typedef Hpl1::std::map<tString, iParticleEmitterData *> tParticleEmitterDataMap;
typedef tParticleEmitterDataMap::iterator tParticleEmitterDataMapIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/Skeleton.h b/engines/hpl1/engine/graphics/Skeleton.h
index 65de70e88d5..90e9a3f9e32 100644
--- a/engines/hpl1/engine/graphics/Skeleton.h
+++ b/engines/hpl1/engine/graphics/Skeleton.h
@@ -28,11 +28,10 @@
#ifndef HPL_SKELETON_H
#define HPL_SKELETON_H
-#include <map>
-
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/std/map.h"
namespace hpl {
@@ -41,7 +40,7 @@ class cBone;
typedef Common::Array<cBone *> tBoneVec;
typedef tBoneVec::iterator tBoneVecIt;
-typedef std::map<tString, int> tBoneIdxNameMap;
+typedef Hpl1::std::map<tString, int> tBoneIdxNameMap;
typedef tBoneIdxNameMap::iterator tBoneIdxNameMapIt;
class cSkeleton {
diff --git a/engines/hpl1/engine/gui/Gui.h b/engines/hpl1/engine/gui/Gui.h
index 9606fa3b17c..57a14eb8ea3 100644
--- a/engines/hpl1/engine/gui/Gui.h
+++ b/engines/hpl1/engine/gui/Gui.h
@@ -28,12 +28,11 @@
#ifndef HPL_GUI_H
#define HPL_GUI_H
-#include <map>
-
#include "hpl1/engine/game/Updateable.h"
#include "hpl1/engine/gui/GuiTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
+#include "hpl1/std/map.h"
namespace hpl {
@@ -50,23 +49,23 @@ class iGuiMaterial;
//------------------------------------------------
-typedef std::map<tString, cGuiSet *> tGuiSetMap;
+typedef Hpl1::std::map<tString, cGuiSet *> tGuiSetMap;
typedef tGuiSetMap::iterator tGuiSetMapIt;
//-------------------------------------
-typedef std::map<tString, cGuiSkin *> tGuiSkinMap;
+typedef Hpl1::std::map<tString, cGuiSkin *> tGuiSkinMap;
typedef tGuiSkinMap::iterator tGuiSkinMapIt;
//-------------------------------------
-typedef std::map<tString, eGuiSkinGfx> tGuiSkinGfxMap;
+typedef Hpl1::std::map<tString, eGuiSkinGfx> tGuiSkinGfxMap;
typedef tGuiSkinGfxMap::iterator tGuiSkinGfxMapIt;
-typedef std::map<tString, eGuiSkinFont> tGuiSkinFontMap;
+typedef Hpl1::std::map<tString, eGuiSkinFont> tGuiSkinFontMap;
typedef tGuiSkinFontMap::iterator tGuiSkinFontMapIt;
-typedef std::map<tString, eGuiSkinAttribute> tGuiSkinAttributeMap;
+typedef Hpl1::std::map<tString, eGuiSkinAttribute> tGuiSkinAttributeMap;
typedef tGuiSkinAttributeMap::iterator tGuiSkinAttributeMapIt;
//------------------------------------------------
diff --git a/engines/hpl1/engine/gui/GuiSkin.h b/engines/hpl1/engine/gui/GuiSkin.h
index f39a5bd3aed..8736ab2e4d9 100644
--- a/engines/hpl1/engine/gui/GuiSkin.h
+++ b/engines/hpl1/engine/gui/GuiSkin.h
@@ -28,9 +28,8 @@
#ifndef HPL_GUI_SKIN_H
#define HPL_GUI_SKIN_H
-#include <map>
-
#include "hpl1/engine/gui/GuiTypes.h"
+#include "hpl1/std/map.h"
namespace hpl {
diff --git a/engines/hpl1/engine/haptic/HapticTypes.h b/engines/hpl1/engine/haptic/HapticTypes.h
index b52a4b6d3ff..152079a6361 100644
--- a/engines/hpl1/engine/haptic/HapticTypes.h
+++ b/engines/hpl1/engine/haptic/HapticTypes.h
@@ -28,10 +28,10 @@
#ifndef HPL_HAPTIC_TYPES_H
#define HPL_HAPTIC_TYPES_H
-#include <map>
#include "hpl1/engine/system/SystemTypes.h"
#include "common/list.h"
#include "common/array.h"
+#include "hpl1/std/map.h"
namespace hpl {
@@ -88,7 +88,7 @@ typedef tHapticForceList::iterator tHapticForceListIt;
typedef Common::List<iHapticSurface *> tHapticSurfaceList;
typedef tHapticSurfaceList::iterator tHapticSurfaceListIt;
-typedef std::map<tString, iHapticSurface *> tHapticSurfaceMap;
+typedef Hpl1::std::map<tString, iHapticSurface *> tHapticSurfaceMap;
typedef tHapticSurfaceMap::iterator tHapticSurfaceMapIt;
typedef cSTLIterator<iHapticShape *, tHapticShapeList, tHapticShapeListIt> cHapticShapeIterator;
diff --git a/engines/hpl1/engine/input/Input.h b/engines/hpl1/engine/input/Input.h
index 6b2f3ccfd0a..b6bf43185e0 100644
--- a/engines/hpl1/engine/input/Input.h
+++ b/engines/hpl1/engine/input/Input.h
@@ -34,6 +34,7 @@
#include "hpl1/engine/input/InputTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "common/list.h"
+#include "hpl1/std/map.h"
namespace hpl {
@@ -43,7 +44,7 @@ class iLowLevelInput;
class iInputDevice;
class iAction;
-typedef std::map<tString, iAction *> tActionMap;
+typedef Hpl1::std::map<tString, iAction *> tActionMap;
typedef tActionMap::iterator tActionMapIt;
typedef std::multimap<tString, iAction *> tActionMultiMap;
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index 9afe943de24..98e9850afd9 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -29,6 +29,7 @@
#include "hpl1/engine/system/low_level_system.h"
#include <limits> // FIXME: Refactor to remove this system header
#include "hpl1/hpl1.h"
+#include <limits>
namespace hpl {
@@ -1391,7 +1392,7 @@ public:
tUIntList mlstIndices;
};
-typedef std::map<cVector3f, cVertexIndices> tVtxIdxMap;
+typedef Hpl1::std::map<cVector3f, cVertexIndices> tVtxIdxMap;
typedef tVtxIdxMap::iterator tVtxIdxMapIt;
//////////////////////////////////////////////////////
diff --git a/engines/hpl1/engine/physics/Body2D.h b/engines/hpl1/engine/physics/Body2D.h
index faa2057a0f9..217da204049 100644
--- a/engines/hpl1/engine/physics/Body2D.h
+++ b/engines/hpl1/engine/physics/Body2D.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/scene/Entity2D.h"
-#include <map>
+#include "hpl1/std/map.h"
#include "common/list.h"
namespace hpl {
diff --git a/engines/hpl1/engine/physics/Physics.h b/engines/hpl1/engine/physics/Physics.h
index 15596df4fca..876196df240 100644
--- a/engines/hpl1/engine/physics/Physics.h
+++ b/engines/hpl1/engine/physics/Physics.h
@@ -33,7 +33,7 @@
#include "hpl1/engine/physics/PhysicsMaterial.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "common/list.h"
-#include <map>
+#include "hpl1/std/map.h"
namespace hpl {
@@ -50,7 +50,7 @@ class cHaptic;
typedef Common::List<iPhysicsWorld *> tPhysicsWorldList;
typedef tPhysicsWorldList::iterator tPhysicsWorldListIt;
-typedef std::map<tString, cSurfaceData *> tSurfaceDataMap;
+typedef Hpl1::std::map<tString, cSurfaceData *> tSurfaceDataMap;
typedef tSurfaceDataMap::iterator tSurfaceDataMapIt;
//------------------------------------------------
diff --git a/engines/hpl1/engine/physics/PhysicsJoint.h b/engines/hpl1/engine/physics/PhysicsJoint.h
index 0ff1a058182..8c6c8a5db59 100644
--- a/engines/hpl1/engine/physics/PhysicsJoint.h
+++ b/engines/hpl1/engine/physics/PhysicsJoint.h
@@ -30,7 +30,7 @@
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <map>
+#include "hpl1/std/map.h"
#include "hpl1/engine/game/SaveGame.h"
@@ -44,7 +44,7 @@ class cSoundEntity;
class iPhysicsJoint;
class iPhysicsController;
-typedef std::map<tString, iPhysicsController *> tPhysicsControllerMap;
+typedef Hpl1::std::map<tString, iPhysicsController *> tPhysicsControllerMap;
typedef tPhysicsControllerMap::iterator tPhysicsControllerMapIt;
typedef cSTLMapIterator<iPhysicsController *, tPhysicsControllerMap, tPhysicsControllerMapIt> cPhysicsControllerIterator;
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.h b/engines/hpl1/engine/physics/PhysicsWorld.h
index a5c865a0ed3..aaeacb43d8f 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.h
+++ b/engines/hpl1/engine/physics/PhysicsWorld.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <map>
+#include "hpl1/std/map.h"
#include "hpl1/engine/physics/CollideData.h"
@@ -72,7 +72,7 @@ typedef tPhysicsControllerList::iterator tPhysicsControllerListIt;
typedef Common::List<iCharacterBody *> tCharacterBodyList;
typedef tCharacterBodyList::iterator tCharacterBodyListIt;
-typedef std::map<tString, iPhysicsMaterial *> tPhysicsMaterialMap;
+typedef Hpl1::std::map<tString, iPhysicsMaterial *> tPhysicsMaterialMap;
typedef tPhysicsMaterialMap::iterator tPhysicsMaterialMapIt;
typedef cSTLMapIterator<iPhysicsMaterial *, tPhysicsMaterialMap, tPhysicsMaterialMapIt> cPhysicsMaterialIterator;
diff --git a/engines/hpl1/engine/resources/FileSearcher.h b/engines/hpl1/engine/resources/FileSearcher.h
index 794ebfcc5cd..a4364e59ca9 100644
--- a/engines/hpl1/engine/resources/FileSearcher.h
+++ b/engines/hpl1/engine/resources/FileSearcher.h
@@ -28,9 +28,11 @@
#ifndef HPL_FILESEARCHER_H
#define HPL_FILESEARCHER_H
+#include <map>
+
#include "hpl1/engine/resources/ResourcesTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <map>
+#include "hpl1/std/map.h"
namespace hpl {
diff --git a/engines/hpl1/engine/resources/ImageManager.cpp b/engines/hpl1/engine/resources/ImageManager.cpp
index 8db5a28bd1a..6743077e119 100644
--- a/engines/hpl1/engine/resources/ImageManager.cpp
+++ b/engines/hpl1/engine/resources/ImageManager.cpp
@@ -344,7 +344,7 @@ cFrameBitmap *cImageManager::CreateBitmapFrame(cVector2l avSize) {
mlstBitmapFrames.push_back(pBFrame);
- std::pair<tFrameTextureMap::iterator, bool> ret = m_mapTextureFrames.insert(tFrameTextureMap::value_type(mlFrameHandle, pTFrame));
+ auto ret = m_mapTextureFrames.insert(tFrameTextureMap::value_type(mlFrameHandle, pTFrame));
if (ret.second == false) {
Error("Could not add texture frame %d with handle %d! Handle already exist!\n", pTFrame, mlFrameHandle);
} else {
diff --git a/engines/hpl1/engine/resources/ImageManager.h b/engines/hpl1/engine/resources/ImageManager.h
index 8626fb51463..3461bed0851 100644
--- a/engines/hpl1/engine/resources/ImageManager.h
+++ b/engines/hpl1/engine/resources/ImageManager.h
@@ -42,7 +42,7 @@ class Bitmap2D;
typedef Common::List<cFrameBitmap *> tFrameBitmapList;
typedef tFrameBitmapList::iterator tFrameBitmapListIt;
-typedef std::map<int, cFrameTexture *> tFrameTextureMap;
+typedef Hpl1::std::map<int, cFrameTexture *> tFrameTextureMap;
typedef tFrameTextureMap::iterator tFrameTextureMapIt;
class cImageManager : public iResourceManager {
diff --git a/engines/hpl1/engine/resources/LanguageFile.cpp b/engines/hpl1/engine/resources/LanguageFile.cpp
index 43e4d497353..3376bd723d6 100644
--- a/engines/hpl1/engine/resources/LanguageFile.cpp
+++ b/engines/hpl1/engine/resources/LanguageFile.cpp
@@ -162,7 +162,7 @@ bool cLanguageFile::LoadFromFile(const tString asFile) {
// if(sE == "Motion blur:") Log("After String: '%s'\n",cString::To8Char(pEntry->mwsText).c_str());
- std::pair<tLanguageEntryMap::iterator, bool> ret = pCategory->m_mapEntries.insert(tLanguageEntryMap::value_type(sEntryName, pEntry));
+ auto ret = pCategory->m_mapEntries.insert(tLanguageEntryMap::value_type(sEntryName, pEntry));
if (ret.second == false) {
Warning("Language entry '%s' in category '%s' already exists!\n", sEntryName.c_str(), sCatName.c_str());
hplDelete(pEntry);
diff --git a/engines/hpl1/engine/resources/LanguageFile.h b/engines/hpl1/engine/resources/LanguageFile.h
index a40af26ee1e..5adcfd74cc6 100644
--- a/engines/hpl1/engine/resources/LanguageFile.h
+++ b/engines/hpl1/engine/resources/LanguageFile.h
@@ -29,7 +29,7 @@
#define HPL_LANGUAGE_FILE_H
#include "hpl1/engine/system/SystemTypes.h"
-#include <map>
+#include "hpl1/std/map.h"
namespace hpl {
@@ -42,7 +42,7 @@ public:
tWString mwsText;
};
-typedef std::map<tString, cLanguageEntry *> tLanguageEntryMap;
+typedef Hpl1::std::map<tString, cLanguageEntry *> tLanguageEntryMap;
typedef tLanguageEntryMap::iterator tLanguageEntryMapIt;
//--------------------------------
@@ -56,7 +56,7 @@ public:
tLanguageEntryMap m_mapEntries;
};
-typedef std::map<tString, cLanguageCategory *> tLanguageCategoryMap;
+typedef Hpl1::std::map<tString, cLanguageCategory *> tLanguageCategoryMap;
typedef tLanguageCategoryMap::iterator tLanguageCategoryMapIt;
//--------------------------------
diff --git a/engines/hpl1/engine/resources/ParticleManager.h b/engines/hpl1/engine/resources/ParticleManager.h
index 74525c3435a..d4f1700b7c9 100644
--- a/engines/hpl1/engine/resources/ParticleManager.h
+++ b/engines/hpl1/engine/resources/ParticleManager.h
@@ -42,7 +42,7 @@ class cParticleSystemData3D;
//----------------------------------------------------
-typedef std::map<tString, cParticleSystemData3D *> tParticleSystemData3DMap;
+typedef Hpl1::std::map<tString, cParticleSystemData3D *> tParticleSystemData3DMap;
typedef tParticleSystemData3DMap::iterator tParticleSystemData3DMapIt;
//----------------------------------------------------
diff --git a/engines/hpl1/engine/resources/ResourceManager.h b/engines/hpl1/engine/resources/ResourceManager.h
index 4a8be63c20e..b99849a2fbf 100644
--- a/engines/hpl1/engine/resources/ResourceManager.h
+++ b/engines/hpl1/engine/resources/ResourceManager.h
@@ -29,7 +29,7 @@
#define HPL_RESOURCEMANAGER_H
#include "hpl1/engine/system/SystemTypes.h"
-#include <map>
+#include "hpl1/std/map.h"
namespace hpl {
@@ -38,10 +38,10 @@ class LowLevelSystem;
class cFileSearcher;
class iResourceBase;
-typedef std::map<unsigned long, iResourceBase *> tResourceHandleMap;
+typedef Hpl1::std::map<unsigned long, iResourceBase *> tResourceHandleMap;
typedef tResourceHandleMap::iterator tResourceHandleMapIt;
-typedef std::map<tString, iResourceBase *> tResourceNameMap;
+typedef Hpl1::std::map<tString, iResourceBase *> tResourceNameMap;
typedef tResourceNameMap::iterator tResourceNameMapIt;
typedef Common::List<iResourceBase *> tResourceBaseList;
diff --git a/engines/hpl1/engine/resources/Resources.h b/engines/hpl1/engine/resources/Resources.h
index 202acbadaac..2b03c94c1f0 100644
--- a/engines/hpl1/engine/resources/Resources.h
+++ b/engines/hpl1/engine/resources/Resources.h
@@ -29,7 +29,7 @@
#define HPL_RESOURCES_H
#include "hpl1/engine/system/SystemTypes.h"
-#include <map>
+#include "hpl1/std/map.h"
#include "hpl1/engine/graphics/GPUProgram.h"
@@ -88,7 +88,7 @@ protected:
tString msName;
};
-typedef std::map<tString, iEntity2DLoader *> tEntity2DLoaderMap;
+typedef Hpl1::std::map<tString, iEntity2DLoader *> tEntity2DLoaderMap;
typedef tEntity2DLoaderMap::iterator tEntity2DLoaderMapIt;
//-------------------------------------------------------
@@ -106,7 +106,7 @@ protected:
tString msName;
};
-typedef std::map<tString, iArea2DLoader *> tArea2DLoaderMap;
+typedef Hpl1::std::map<tString, iArea2DLoader *> tArea2DLoaderMap;
typedef tArea2DLoaderMap::iterator tArea2DLoaderMapIt;
//-------------------------------------------------------
@@ -125,7 +125,7 @@ protected:
tString msName;
};
-typedef std::map<tString, iEntity3DLoader *> tEntity3DLoaderMap;
+typedef Hpl1::std::map<tString, iEntity3DLoader *> tEntity3DLoaderMap;
typedef tEntity3DLoaderMap::iterator tEntity3DLoaderMapIt;
//-------------------------------------------------------
@@ -143,7 +143,7 @@ protected:
tString msName;
};
-typedef std::map<tString, iArea3DLoader *> tArea3DLoaderMap;
+typedef Hpl1::std::map<tString, iArea3DLoader *> tArea3DLoaderMap;
typedef tArea3DLoaderMap::iterator tArea3DLoaderMapIt;
//-------------------------------------------------------
diff --git a/engines/hpl1/engine/resources/TextureManager.h b/engines/hpl1/engine/resources/TextureManager.h
index 743e594ad93..54ad1bd48e8 100644
--- a/engines/hpl1/engine/resources/TextureManager.h
+++ b/engines/hpl1/engine/resources/TextureManager.h
@@ -39,8 +39,8 @@ class iTexture;
//------------------------------------------------------
-typedef std::map<tString, iTexture *> tTextureAttenuationMap;
-typedef std::map<tString, iTexture *>::iterator tTextureAttenuationMapIt;
+typedef Hpl1::std::map<tString, iTexture *> tTextureAttenuationMap;
+typedef Hpl1::std::map<tString, iTexture *>::iterator tTextureAttenuationMapIt;
//------------------------------------------------------
diff --git a/engines/hpl1/engine/scene/GridMap2D.h b/engines/hpl1/engine/scene/GridMap2D.h
index 202ec689f53..91225099acb 100644
--- a/engines/hpl1/engine/scene/GridMap2D.h
+++ b/engines/hpl1/engine/scene/GridMap2D.h
@@ -28,11 +28,10 @@
#ifndef HPL_GRIDMAP2D_H
#define HPL_GRIDMAP2D_H
-#include <map>
-
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
#include "common/array.h"
+#include "hpl1/std/map.h"
namespace hpl {
@@ -81,7 +80,7 @@ private:
/////////// GRID ////////////
-typedef std::map<int, cGrid2DObject *> tGrid2DObjectMap;
+typedef Hpl1::std::map<int, cGrid2DObject *> tGrid2DObjectMap;
typedef tGrid2DObjectMap::iterator tGrid2DObjectMapIt;
class cGrid2D {
diff --git a/engines/hpl1/engine/scene/MeshEntity.h b/engines/hpl1/engine/scene/MeshEntity.h
index 87e991b73c2..73b11020ae1 100644
--- a/engines/hpl1/engine/scene/MeshEntity.h
+++ b/engines/hpl1/engine/scene/MeshEntity.h
@@ -28,8 +28,6 @@
#ifndef HPL_MESH_ENTITY_H
#define HPL_MESH_ENTITY_H
-#include <map>
-
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/Renderable.h"
#include "hpl1/engine/math/MathTypes.h"
@@ -41,6 +39,7 @@
#include "hpl1/engine/scene/AnimationState.h"
#include "common/array.h"
+#include "hpl1/std/map.h"
namespace hpl {
diff --git a/engines/hpl1/engine/scene/MultiImageEntity.h b/engines/hpl1/engine/scene/MultiImageEntity.h
index 70f91445db0..31946319f1c 100644
--- a/engines/hpl1/engine/scene/MultiImageEntity.h
+++ b/engines/hpl1/engine/scene/MultiImageEntity.h
@@ -29,7 +29,7 @@
#define HPL_MULTI_IMAGE_ENTITY_H
#include "hpl1/engine/scene/ImageEntity.h"
-#include <map>
+#include "hpl1/std/map.h"
namespace hpl {
@@ -48,7 +48,7 @@ public:
bool mbSyncFrame;
};
-typedef std::map<unsigned int, cMultiImagePart> tMultiImagePartMap;
+typedef Hpl1::std::map<unsigned int, cMultiImagePart> tMultiImagePartMap;
typedef tMultiImagePartMap::iterator tMultiImagePartMapIt;
class cMultiImageEntity {
diff --git a/engines/hpl1/engine/scene/PortalContainer.h b/engines/hpl1/engine/scene/PortalContainer.h
index 8a8395aea9d..58d50a86a2f 100644
--- a/engines/hpl1/engine/scene/PortalContainer.h
+++ b/engines/hpl1/engine/scene/PortalContainer.h
@@ -32,7 +32,7 @@
#include "hpl1/engine/math/BoundingVolume.h"
#include "hpl1/engine/scene/RenderableContainer.h"
#include "common/list.h"
-#include <map>
+#include "hpl1/std/map.h"
#include "hpl1/std/set.h"
namespace hpl {
@@ -56,8 +56,8 @@ class cSector;
//----------------------------------------------------
-typedef std::map<tString, cSector *> tSectorMap;
-typedef std::map<tString, cSector *>::iterator tSectorMapIt;
+typedef Hpl1::std::map<tString, cSector *> tSectorMap;
+typedef Hpl1::std::map<tString, cSector *>::iterator tSectorMapIt;
//----------------------------------------------------
@@ -116,8 +116,8 @@ private:
class cSector;
class cPortal;
-typedef std::map<int, cPortal *> tPortalMap;
-typedef std::map<int, cPortal *>::iterator tPortalMapIt;
+typedef Hpl1::std::map<int, cPortal *> tPortalMap;
+typedef Hpl1::std::map<int, cPortal *>::iterator tPortalMapIt;
typedef Common::List<cPortal *> tPortalList;
typedef Common::List<cPortal *>::iterator tPortalListIt;
diff --git a/engines/hpl1/engine/scene/SectorVisibility.cpp b/engines/hpl1/engine/scene/SectorVisibility.cpp
index dbd6cf7117d..3daaebf8600 100644
--- a/engines/hpl1/engine/scene/SectorVisibility.cpp
+++ b/engines/hpl1/engine/scene/SectorVisibility.cpp
@@ -208,7 +208,7 @@ cSectorVisibility *cSectorVisibilityContainer::GetSectorVisibilty(cSector *apSec
cSectorVisibility *pVisSector = hplNew(cSectorVisibility, (this));
pVisSector->mpSector = apSector;
- m_mapSectors.insert(tSectorVisibilityMapIt::value_type(apSector, pVisSector));
+ m_mapSectors.insert(tSectorVisibilityMap::value_type(apSector, pVisSector));
return pVisSector;
}
diff --git a/engines/hpl1/engine/scene/SectorVisibility.h b/engines/hpl1/engine/scene/SectorVisibility.h
index 3d158e2df1d..e914dbb4dcf 100644
--- a/engines/hpl1/engine/scene/SectorVisibility.h
+++ b/engines/hpl1/engine/scene/SectorVisibility.h
@@ -117,7 +117,7 @@ private:
cSectorVisibilityContainer *mpContainer;
};
-typedef std::map<cSector *, cSectorVisibility *> tSectorVisibilityMap;
+typedef Hpl1::std::map<cSector *, cSectorVisibility *> tSectorVisibilityMap;
typedef tSectorVisibilityMap::iterator tSectorVisibilityMapIt;
//----------------------------------------------------
diff --git a/engines/hpl1/engine/scene/SubMeshEntity.h b/engines/hpl1/engine/scene/SubMeshEntity.h
index cd407a787c2..25a82c69d7c 100644
--- a/engines/hpl1/engine/scene/SubMeshEntity.h
+++ b/engines/hpl1/engine/scene/SubMeshEntity.h
@@ -28,8 +28,6 @@
#ifndef HPL_SUB_MESH_ENTITY_H
#define HPL_SUB_MESH_ENTITY_H
-#include <map>
-
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/graphics/Renderable.h"
#include "hpl1/engine/math/MathTypes.h"
@@ -38,6 +36,7 @@
#include "hpl1/engine/scene/SectorVisibility.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "common/array.h"
+#include "hpl1/std/map.h"
namespace hpl {
@@ -59,13 +58,13 @@ class cBoneState;
typedef Common::Array<cAnimationState *> tAnimationStateVec;
typedef tAnimationStateVec::iterator tAnimationStateVecIt;
-typedef std::map<tString, int> tAnimationStateIndexMap;
+typedef Hpl1::std::map<tString, int> tAnimationStateIndexMap;
typedef tAnimationStateIndexMap::iterator tAnimationStateIndexMapIt;
typedef Common::Array<cBoneState *> tNodeStateVec;
typedef tNodeStateVec::iterator tNodeStateVecIt;
-typedef std::map<tString, int> tNodeStateIndexMap;
+typedef Hpl1::std::map<tString, int> tNodeStateIndexMap;
typedef tNodeStateIndexMap::iterator tNodeStateIndexMapIt;
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/scene/World2D.h b/engines/hpl1/engine/scene/World2D.h
index 840d8af3599..4e85784bc10 100644
--- a/engines/hpl1/engine/scene/World2D.h
+++ b/engines/hpl1/engine/scene/World2D.h
@@ -28,14 +28,13 @@
#ifndef HPL_WORLD2D_H
#define HPL_WORLD2D_H
-#include <map>
-
#include "hpl1/engine/game/GameTypes.h"
#include "hpl1/engine/graphics/GraphicsTypes.h"
#include "hpl1/engine/math/MathTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/engine/scene/SoundSource.h"
+#include "hpl1/std/map.h"
class TiXmlElement;
diff --git a/engines/hpl1/engine/scene/World3D.h b/engines/hpl1/engine/scene/World3D.h
index 79cb8e3c001..995ba59e3fa 100644
--- a/engines/hpl1/engine/scene/World3D.h
+++ b/engines/hpl1/engine/scene/World3D.h
@@ -130,8 +130,8 @@ public:
tTempAiNodeList mlstNodes;
};
-typedef std::map<tString, cTempNodeContainer *> tTempNodeContainerMap;
-typedef std::map<tString, cTempNodeContainer *>::iterator tTempNodeContainerMapIt;
+typedef Hpl1::std::map<tString, cTempNodeContainer *> tTempNodeContainerMap;
+typedef Hpl1::std::map<tString, cTempNodeContainer *>::iterator tTempNodeContainerMapIt;
//-------------------------------------------------------------------
@@ -142,7 +142,7 @@ class cAreaEntity : public iSerializable {
cVector3f mvSize;
};
-typedef std::map<tString, cAreaEntity *> tAreaEntityMap;
+typedef Hpl1::std::map<tString, cAreaEntity *> tAreaEntityMap;
typedef tAreaEntityMap::iterator tAreaEntityMapIt;
//-------------------------------------------------------------------
diff --git a/engines/hpl1/engine/sound/SoundHandler.h b/engines/hpl1/engine/sound/SoundHandler.h
index 432a5bc6df6..c134790a945 100644
--- a/engines/hpl1/engine/sound/SoundHandler.h
+++ b/engines/hpl1/engine/sound/SoundHandler.h
@@ -110,7 +110,7 @@ typedef cSTLIterator<cSoundEntry, tSoundEntryList, tSoundEntryListIt> tSoundEntr
//----------------------------------------
-typedef std::map<tString, int> tPlayedSoundNumMap;
+typedef Hpl1::std::map<tString, int> tPlayedSoundNumMap;
typedef tPlayedSoundNumMap::iterator tPlayedSoundNumMapIt;
//----------------------------------------
diff --git a/engines/hpl1/engine/system/Container.h b/engines/hpl1/engine/system/Container.h
index 1ff81480113..fc3a1f772c8 100644
--- a/engines/hpl1/engine/system/Container.h
+++ b/engines/hpl1/engine/system/Container.h
@@ -28,11 +28,11 @@
#ifndef HPL_CONTAINER_H
#define HPL_CONTAINER_H
-#include <map>
-
#include "hpl1/engine/system/MemoryManager.h"
#include "common/list.h"
#include "common/array.h"
+#include "hpl1/std/map.h"
+
namespace hpl {
diff --git a/engines/hpl1/engine/system/MemoryManager.h b/engines/hpl1/engine/system/MemoryManager.h
index ddc07ee5bba..95138bfcb1c 100644
--- a/engines/hpl1/engine/system/MemoryManager.h
+++ b/engines/hpl1/engine/system/MemoryManager.h
@@ -28,8 +28,8 @@
#ifndef HPL_MEMORY_MANAGER_H
#define HPL_MEMORY_MANAGER_H
-#include <map>
#include <string>
+#include "hpl1/std/map.h"
namespace hpl {
@@ -47,7 +47,7 @@ public:
//------------------------------------
-typedef std::map<void *, cAllocatedPointer> tAllocatedPointerMap;
+typedef Hpl1::std::map<void *, cAllocatedPointer> tAllocatedPointerMap;
typedef tAllocatedPointerMap::iterator tAllocatedPointerMapIt;
//------------------------------------
diff --git a/engines/hpl1/engine/system/SerializeClass.h b/engines/hpl1/engine/system/SerializeClass.h
index af4470cf4f6..c57a710a81d 100644
--- a/engines/hpl1/engine/system/SerializeClass.h
+++ b/engines/hpl1/engine/system/SerializeClass.h
@@ -31,7 +31,7 @@
#include "hpl1/engine/system/MemoryManager.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/static_string.h"
-#include <map>
+#include "hpl1/std/map.h"
class TiXmlElement;
@@ -296,7 +296,7 @@ private:
//-------------------------------------------------
-typedef std::map<Hpl1::StaticString, cSerializeSavedClass> tSerializeSavedClassMap;
+typedef Hpl1::std::map<Hpl1::StaticString, cSerializeSavedClass> tSerializeSavedClassMap;
typedef tSerializeSavedClassMap::iterator tSerializeSavedClassMapIt;
typedef Common::List<cSerializeSavedClass *> tSerializeSavedClassList;
diff --git a/engines/hpl1/penumbra-overture/GameEntity.h b/engines/hpl1/penumbra-overture/GameEntity.h
index 24768650e85..66fb524f3c4 100644
--- a/engines/hpl1/penumbra-overture/GameEntity.h
+++ b/engines/hpl1/penumbra-overture/GameEntity.h
@@ -48,12 +48,12 @@ class cGameEntityScript : public iSerializable {
tString msScriptFunc;
};
-typedef std::map<tString, cGameEntityScript *> tGameEntityScriptMap;
+typedef Hpl1::std::map<tString, cGameEntityScript *> tGameEntityScriptMap;
typedef tGameEntityScriptMap::iterator tGameEntityScriptMapIt;
//-----------------------------------------
-typedef std::map<tString, int> tGameEntityVarMap;
+typedef Hpl1::std::map<tString, int> tGameEntityVarMap;
typedef tGameEntityVarMap::iterator tGameEntityVarMapIt;
//------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameTypes.h b/engines/hpl1/penumbra-overture/GameTypes.h
index 98c67509c89..6b038fd122f 100644
--- a/engines/hpl1/penumbra-overture/GameTypes.h
+++ b/engines/hpl1/penumbra-overture/GameTypes.h
@@ -280,7 +280,7 @@ public:
bool mbDeleteMe;
};
-typedef std::map<tString, cGameCollideScript *> tGameCollideScriptMap;
+typedef Hpl1::std::map<tString, cGameCollideScript *> tGameCollideScriptMap;
typedef tGameCollideScriptMap::iterator tGameCollideScriptMapIt;
//---------------------------------
diff --git a/engines/hpl1/penumbra-overture/PlayerHands.h b/engines/hpl1/penumbra-overture/PlayerHands.h
index 1bd6f36bd93..f68dfcc460c 100644
--- a/engines/hpl1/penumbra-overture/PlayerHands.h
+++ b/engines/hpl1/penumbra-overture/PlayerHands.h
@@ -151,7 +151,7 @@ public:
//------------------------------------------------
-typedef std::map<tString, iHudModel *> tHudModelMap;
+typedef Hpl1::std::map<tString, iHudModel *> tHudModelMap;
typedef tHudModelMap::iterator tHudModelMapIt;
//------------------------------------------------
Commit: 2e0cb7b5da5bd84308efb9b9fd5412aedde3ceb7
https://github.com/scummvm/scummvm/commit/2e0cb7b5da5bd84308efb9b9fd5412aedde3ceb7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:13+01:00
Commit Message:
HPL1: add upper/lowerBound to algorithm header
Changed paths:
engines/hpl1/algorithms.h
diff --git a/engines/hpl1/algorithms.h b/engines/hpl1/algorithms.h
index dc5df5d6fdf..85443ca7a32 100644
--- a/engines/hpl1/algorithms.h
+++ b/engines/hpl1/algorithms.h
@@ -34,6 +34,30 @@ void resizeAndFill(Common::Array<T> &container, const typename Common::Array<T>:
container[i] = value;
}
+template<typename RandomIt, typename V, typename Comp = Common::Less<V>>
+RandomIt lowerBound(RandomIt begin, RandomIt end, V const& val, Comp comp = {}) {
+ while (begin < end) {
+ const auto mid = begin + Common::distance(begin, end) / 2;
+ if (comp(*mid, val))
+ begin = mid + 1;
+ else
+ end = mid;
+ }
+ return begin;
+}
+
+template<typename RandomIt, typename V, typename Comp = Common::Less<V>>
+RandomIt upperBound(RandomIt begin, RandomIt end, V const& val, Comp comp = {})
+{
+ while (begin < end) {
+ const auto mid = begin + Common::distance(begin, end) / 2;
+ if (!comp(val, *mid))
+ begin = mid + 1;
+ else
+ end = mid;
+ }
+}
+
}
#endif //HPL1_ALGORITHMS
\ No newline at end of file
Commit: b586b4bd719afb98f6a56c8a4ed3a287122732ae
https://github.com/scummvm/scummvm/commit/b586b4bd719afb98f6a56c8a4ed3a287122732ae
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:13+01:00
Commit Message:
HPL1: cleanup Hpl1::std::map
Changed paths:
engines/hpl1/std/map.h
diff --git a/engines/hpl1/std/map.h b/engines/hpl1/std/map.h
index affa79155ee..0faca347d7d 100644
--- a/engines/hpl1/std/map.h
+++ b/engines/hpl1/std/map.h
@@ -23,6 +23,7 @@
#define HPL1_STD_MAP_H
#include "common/hashmap.h"
+#include "hpl1/algorithms.h"
#include "pair.h"
namespace Hpl1 {
@@ -74,51 +75,16 @@ public:
* Returns an iterator for the first element of the map that is
* not less than the given key
*/
- const_iterator lower_bound(const Key &theKey) const {
- const_iterator first = this->begin();
- const_iterator it;
- int count_ = _items.size(), step;
-
- while (count_ > 0) {
- it = first;
- step = count_ / 2;
- it += step;
-
- if (_comp(it->first, theKey)) {
- first = ++it;
- count_ -= step + 1;
- } else {
- count_ = step;
- }
- }
-
- return first;
+ const_iterator lower_bound(const Key &key) const {
+ return lowerBound(this->begin(), this->end(), key, [&](value_type const &p, Key const &k) { return _comp(p.first, k); });
}
- iterator lower_bound(const Key &theKey) {
- iterator first = this->begin();
- iterator it;
- int count_ = _items.size(), step;
-
- while (count_ > 0) {
- it = first;
- step = count_ / 2;
- it += step;
-
- if (_comp(it->first, theKey)) {
- first = ++it;
- count_ -= step + 1;
- } else {
- count_ = step;
- }
- }
-
- return first;
+ iterator lower_bound(const Key &key) {
+ return lowerBound(this->begin(), this->end(), key, [&](value_type const &p, Key const &k) { return _comp(p.first, k); });
}
- iterator upper_bound(const Key &k)
- {
- return lower_bound(k) + 1;
+ iterator upper_bound(const Key &key) {
+ return upperBound(this->begin(), this->end(), key, [&](Key const &k, value_type const &p) { return _comp(k, p.first); });
}
/**
@@ -172,7 +138,7 @@ public:
return it;
}
- std::pair<iterator, bool> insert(value_type const& val) {
+ std::pair<iterator, bool> insert(value_type const &val) {
iterator it = this->lower_bound(val.first);
if (it == this->end() || !(it->first == val.first)) {
size_t idx = it - this->begin();
@@ -205,6 +171,7 @@ public:
return count_;
}
+
private:
Common::Array<value_type> _items;
CompFunc _comp;
Commit: 0eafb65d43d079d7b7462dcf752c7508ad9d4e19
https://github.com/scummvm/scummvm/commit/0eafb65d43d079d7b7462dcf752c7508ad9d4e19
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:13+01:00
Commit Message:
HPL1: fix formatting
Changed paths:
engines/hpl1/algorithms.h
diff --git a/engines/hpl1/algorithms.h b/engines/hpl1/algorithms.h
index 85443ca7a32..5916ed82fc8 100644
--- a/engines/hpl1/algorithms.h
+++ b/engines/hpl1/algorithms.h
@@ -35,7 +35,7 @@ void resizeAndFill(Common::Array<T> &container, const typename Common::Array<T>:
}
template<typename RandomIt, typename V, typename Comp = Common::Less<V>>
-RandomIt lowerBound(RandomIt begin, RandomIt end, V const& val, Comp comp = {}) {
+RandomIt lowerBound(RandomIt begin, RandomIt end, V const &val, Comp comp = {}) {
while (begin < end) {
const auto mid = begin + Common::distance(begin, end) / 2;
if (comp(*mid, val))
@@ -47,17 +47,16 @@ RandomIt lowerBound(RandomIt begin, RandomIt end, V const& val, Comp comp = {})
}
template<typename RandomIt, typename V, typename Comp = Common::Less<V>>
-RandomIt upperBound(RandomIt begin, RandomIt end, V const& val, Comp comp = {})
-{
+RandomIt upperBound(RandomIt begin, RandomIt end, V const &val, Comp comp = {}) {
while (begin < end) {
const auto mid = begin + Common::distance(begin, end) / 2;
if (!comp(val, *mid))
begin = mid + 1;
else
- end = mid;
+ end = mid;
}
}
-}
+} // namespace Hpl1
-#endif //HPL1_ALGORITHMS
\ No newline at end of file
+#endif // HPL1_ALGORITHMS
\ No newline at end of file
Commit: edffe61371381190690f08f88495a65d30bb15fb
https://github.com/scummvm/scummvm/commit/edffe61371381190690f08f88495a65d30bb15fb
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:13+01:00
Commit Message:
HPL1: fix use after free
The stl std::map does not invalidate iterators on erase, its replacement does.
Changed paths:
engines/hpl1/penumbra-overture/Player.cpp
diff --git a/engines/hpl1/penumbra-overture/Player.cpp b/engines/hpl1/penumbra-overture/Player.cpp
index b0cc30ef7ab..f9071d239a0 100644
--- a/engines/hpl1/penumbra-overture/Player.cpp
+++ b/engines/hpl1/penumbra-overture/Player.cpp
@@ -535,10 +535,10 @@ void cPlayer::RemoveCollideScriptWithChildEntity(iGameEntity *apEntity) {
pCallback->mbDeleteMe = true;
} else {
hplDelete(pCallback);
- m_mapCollideCallbacks.erase(currentIt);
}
}
}
+ m_mapCollideCallbacks.clear();
}
//-----------------------------------------------------------------------
Commit: 452debbed8a4c7137d14a2e1abed3b7dd0339e4a
https://github.com/scummvm/scummvm/commit/452debbed8a4c7137d14a2e1abed3b7dd0339e4a
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:13+01:00
Commit Message:
HPL1: fix formatting
Changed paths:
engines/hpl1/std/map.h
diff --git a/engines/hpl1/std/map.h b/engines/hpl1/std/map.h
index 0faca347d7d..3241cc1ac42 100644
--- a/engines/hpl1/std/map.h
+++ b/engines/hpl1/std/map.h
@@ -138,7 +138,7 @@ public:
return it;
}
- std::pair<iterator, bool> insert(value_type const &val) {
+ std::pair<iterator, bool> insert(const value_type &val) {
iterator it = this->lower_bound(val.first);
if (it == this->end() || !(it->first == val.first)) {
size_t idx = it - this->begin();
Commit: 167483079e6d39df20899fc8ab15f70d977b77ad
https://github.com/scummvm/scummvm/commit/167483079e6d39df20899fc8ab15f70d977b77ad
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:14+01:00
Commit Message:
HPL1: cleanup loop implementation
Changed paths:
engines/hpl1/penumbra-overture/Player.cpp
diff --git a/engines/hpl1/penumbra-overture/Player.cpp b/engines/hpl1/penumbra-overture/Player.cpp
index f9071d239a0..85f14c5b906 100644
--- a/engines/hpl1/penumbra-overture/Player.cpp
+++ b/engines/hpl1/penumbra-overture/Player.cpp
@@ -524,18 +524,14 @@ void cPlayer::AddCollideScript(eGameCollideScriptType aType, const tString &asFu
//-----------------------------------------------------------------------
void cPlayer::RemoveCollideScriptWithChildEntity(iGameEntity *apEntity) {
- tGameCollideScriptMapIt it = m_mapCollideCallbacks.begin();
- for (; it != m_mapCollideCallbacks.end();) {
- cGameCollideScript *pCallback = it->second;
- tGameCollideScriptMapIt currentIt = it;
- ++it;
+ for (auto& kv : m_mapCollideCallbacks) {
+ cGameCollideScript *pCallback = kv.second;
if (pCallback && pCallback->mpEntity == apEntity) {
- if (mbUpdatingCollisionCallbacks) {
+ if (mbUpdatingCollisionCallbacks)
pCallback->mbDeleteMe = true;
- } else {
+ else
hplDelete(pCallback);
- }
}
}
m_mapCollideCallbacks.clear();
Commit: 98daf3635a2cf60a76e5500d3ad6747b1b5199b5
https://github.com/scummvm/scummvm/commit/98daf3635a2cf60a76e5500d3ad6747b1b5199b5
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:14+01:00
Commit Message:
HPL1: remove equality compairisons in Hpl1::std::map
Changed paths:
engines/hpl1/std/map.h
diff --git a/engines/hpl1/std/map.h b/engines/hpl1/std/map.h
index 3241cc1ac42..ea8b9a48f7f 100644
--- a/engines/hpl1/std/map.h
+++ b/engines/hpl1/std/map.h
@@ -93,7 +93,7 @@ public:
iterator find(const Key &theKey) {
iterator it = this->lower_bound(theKey);
- if (it != this->end() && it->first == theKey)
+ if (it != this->end() && compareEqual(it->first, theKey))
return it;
return this->end();
}
@@ -101,7 +101,7 @@ public:
const_iterator find(const Key &theKey) const {
const_iterator it = this->lower_bound(theKey);
- if (it != this->end() && it->first == theKey)
+ if (it != this->end() && compareEqual(it->first, theKey))
return it;
return this->end();
}
@@ -111,7 +111,7 @@ public:
*/
Val &operator[](const Key &theKey) {
iterator it = this->lower_bound(theKey);
- if (it == this->end() || it->first != theKey) {
+ if (it == this->end() || !compareEqual(it->first, theKey)) {
size_t idx = it - this->begin();
_items.insert_at(idx, {});
_items[idx].first = theKey;
@@ -140,7 +140,7 @@ public:
std::pair<iterator, bool> insert(const value_type &val) {
iterator it = this->lower_bound(val.first);
- if (it == this->end() || !(it->first == val.first)) {
+ if (it == this->end() || compareEqual(it->first, val.first)) {
size_t idx = it - this->begin();
_items.insert_at(idx, val);
return {it, true};
@@ -165,7 +165,7 @@ public:
size_t count(const Key &theKey) {
int count_ = 0;
for (iterator it = this->begin(); it != this->end(); ++it) {
- if (it->first == theKey)
+ if (compareEqual(it->first, theKey))
++count_;
}
@@ -173,6 +173,10 @@ public:
}
private:
+ bool compareEqual(const Key &a, const Key &b) {
+ return !_comp(a, b) && !_comp(b, a);
+ }
+
Common::Array<value_type> _items;
CompFunc _comp;
};
Commit: d4d0f6a37270cecdc2efbfc9a0adbf0d7bf2f9e4
https://github.com/scummvm/scummvm/commit/d4d0f6a37270cecdc2efbfc9a0adbf0d7bf2f9e4
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:14+01:00
Commit Message:
HPL1: fix compairison in Hpl1::std::map
Changed paths:
engines/hpl1/std/map.h
diff --git a/engines/hpl1/std/map.h b/engines/hpl1/std/map.h
index ea8b9a48f7f..f94d89c790d 100644
--- a/engines/hpl1/std/map.h
+++ b/engines/hpl1/std/map.h
@@ -140,7 +140,7 @@ public:
std::pair<iterator, bool> insert(const value_type &val) {
iterator it = this->lower_bound(val.first);
- if (it == this->end() || compareEqual(it->first, val.first)) {
+ if (it == this->end() || !compareEqual(it->first, val.first)) {
size_t idx = it - this->begin();
_items.insert_at(idx, val);
return {it, true};
Commit: df310242365e5131996b597b7eab7dfe0b37ed34
https://github.com/scummvm/scummvm/commit/df310242365e5131996b597b7eab7dfe0b37ed34
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:14+01:00
Commit Message:
HPL1: add std::multimap replacement
Changed paths:
A engines/hpl1/std/multimap.h
diff --git a/engines/hpl1/std/multimap.h b/engines/hpl1/std/multimap.h
new file mode 100644
index 00000000000..239b49c2c8c
--- /dev/null
+++ b/engines/hpl1/std/multimap.h
@@ -0,0 +1,170 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_STD_MULTIMAP_H
+#define HPL1_STD_MULTIMAP_H
+
+#include "common/array.h"
+#include "pair.h"
+
+namespace Hpl1 {
+
+namespace std {
+
+template<class Key, class Val, class CompFunc = Common::Less<Key> >
+class multimap {
+public:
+ using value_type = pair<Key, Val>;
+ using iterator = typename Common::Array<value_type>::iterator;
+ using const_iterator = typename Common::Array<value_type>::const_iterator;
+
+ /**
+ * Clears the map
+ */
+ void clear() {
+ _items.clear();
+ }
+
+ /**
+ * Gets the iterator start
+ */
+ iterator begin() {
+ return _items.begin();
+ }
+
+ /**
+ * Get the iterator end
+ */
+ iterator end() {
+ return _items.end();
+ }
+
+ /**
+ * Get the const iterator start
+ */
+ const_iterator begin() const {
+ return _items.begin();
+ }
+
+ /**
+ * Get the const iterator end
+ */
+ const_iterator end() const {
+ return _items.end();
+ }
+
+ /**
+ * Returns an iterator for the first element of the map that is
+ * not less than the given key
+ */
+ const_iterator lower_bound(const Key &key) const {
+ return lowerBound(this->begin(), this->end(), key, [&](value_type const &p, Key const &k) { return _comp(p.first, k); });
+ }
+
+ iterator lower_bound(const Key &key) {
+ return lowerBound(this->begin(), this->end(), key, [&](value_type const &p, Key const &k) { return _comp(p.first, k); });
+ }
+
+ iterator upper_bound(const Key &key) {
+ return upperBound(this->begin(), this->end(), key, [&](Key const &k, value_type const &p) { return _comp(k, p.first); });
+ }
+
+ /**
+ * Find the entry with the given key
+ */
+ iterator find(const Key &theKey) {
+ iterator it = this->lower_bound(theKey);
+
+ if (it != this->end() && compareEqual(it->first, theKey))
+ return it;
+ return this->end();
+ }
+
+ const_iterator find(const Key &theKey) const {
+ const_iterator it = this->lower_bound(theKey);
+
+ if (it != this->end() && compareEqual(it->first, theKey))
+ return it;
+ return this->end();
+ }
+
+ /**
+ * Erases an entry in the map
+ */
+ iterator erase(iterator it) {
+ iterator next = it;
+ ++next;
+ _items.remove_at(it - begin());
+ return next;
+ }
+
+ iterator erase(const Key &theKey) {
+ const iterator first = find(theKey);
+ iterator last = first;
+ while (last != this->end() && compareEqual(last->first, theKey))
+ ++last;
+ return _items.erase(first, last);
+ }
+
+ iterator insert(const value_type &val) {
+ iterator it = this->lower_bound(val.first);
+ size_t idx = it - this->begin();
+ _items.insert_at(idx, val);
+ return it;
+ }
+
+ /**
+ * Returns the size of the map
+ */
+ size_t size() const {
+ return _items.size();
+ }
+
+ bool empty() const {
+ return _items.empty();
+ }
+
+ /**
+ * Returns the number of elements with a matching key
+ */
+ size_t count(const Key &theKey) {
+ int count_ = 0;
+ for (iterator it = this->begin(); it != this->end(); ++it) {
+ if (compareEqual(it->first, theKey))
+ ++count_;
+ }
+
+ return count_;
+ }
+
+private:
+ bool compareEqual(const Key &a, const Key &b) {
+ return !_comp(a, b) && !_comp(b, a);
+ }
+
+ Common::Array<value_type> _items;
+ CompFunc _comp;
+};
+
+} // namespace std
+} // namespace Hpl1
+
+#endif
\ No newline at end of file
Commit: e68551b516b6c054caf73703251ec98dd1f4578d
https://github.com/scummvm/scummvm/commit/e68551b516b6c054caf73703251ec98dd1f4578d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:14+01:00
Commit Message:
HPL1: replace std::multimap -> Hpl1::std::multimap
Changed paths:
engines/hpl1/engine/game/SaveGame.h
engines/hpl1/engine/graphics/Mesh.h
engines/hpl1/engine/gui/Gui.cpp
engines/hpl1/engine/input/Input.h
engines/hpl1/engine/resources/FileSearcher.h
engines/hpl1/engine/scene/SubMeshEntity.h
engines/hpl1/penumbra-overture/GameTypes.h
engines/hpl1/penumbra-overture/Inventory.h
engines/hpl1/penumbra-overture/MapHandler.h
engines/hpl1/penumbra-overture/TriggerHandler.h
diff --git a/engines/hpl1/engine/game/SaveGame.h b/engines/hpl1/engine/game/SaveGame.h
index bf4ece3798d..b6771eeef44 100644
--- a/engines/hpl1/engine/game/SaveGame.h
+++ b/engines/hpl1/engine/game/SaveGame.h
@@ -29,11 +29,11 @@
#define HPL_SAVE_GAME_H
#include <cassert>
-#include <map>
#include "hpl1/engine/system/SerializeClass.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/std/map.h"
+#include "hpl1/std/multimap.h"
class TiXmlElement;
@@ -174,7 +174,7 @@ private:
//---------------------------------------------------------
-typedef std::multimap<int, iSaveObject *> tSaveObjectMap;
+typedef Hpl1::std::multimap<int, iSaveObject *> tSaveObjectMap;
typedef tSaveObjectMap::iterator tSaveObjectMapIt;
typedef cSTLMapIterator<iSaveObject *, tSaveObjectMap, tSaveObjectMapIt> cSaveObjectIterator;
@@ -205,7 +205,7 @@ private:
//---------------------------------------------------------
-typedef std::multimap<int, iSaveData *> tSaveDataMap;
+typedef Hpl1::std::multimap<int, iSaveData *> tSaveDataMap;
typedef tSaveDataMap::iterator tSaveDataMapIt;
typedef cSTLMapIterator<iSaveData *, tSaveDataMap, tSaveDataMapIt> cSaveDataIterator;
diff --git a/engines/hpl1/engine/graphics/Mesh.h b/engines/hpl1/engine/graphics/Mesh.h
index bdcdb47f66d..55353f3b194 100644
--- a/engines/hpl1/engine/graphics/Mesh.h
+++ b/engines/hpl1/engine/graphics/Mesh.h
@@ -39,6 +39,7 @@
#include "hpl1/engine/scene/Light3D.h"
#include "common/array.h"
#include "hpl1/std/map.h"
+#include "hpl1/std/multimap.h"
namespace hpl {
@@ -70,7 +71,7 @@ typedef tAnimationIndexMap::iterator tAnimationIndexMapIt;
typedef Common::Array<cSubMesh *> tSubMeshVec;
typedef Common::Array<cSubMesh *>::iterator tSubMeshVecIt;
-typedef std::multimap<tString, cSubMesh *> tSubMeshMap;
+typedef Hpl1::std::multimap<tString, cSubMesh *> tSubMeshMap;
typedef tSubMeshMap::iterator tSubMeshMapIt;
typedef Common::Array<cNode3D *> tNode3DVec;
diff --git a/engines/hpl1/engine/gui/Gui.cpp b/engines/hpl1/engine/gui/Gui.cpp
index 161984b5dc2..1e1ce0932c6 100644
--- a/engines/hpl1/engine/gui/Gui.cpp
+++ b/engines/hpl1/engine/gui/Gui.cpp
@@ -42,6 +42,7 @@
#include "hpl1/engine/resources/TextureManager.h"
#include "hpl1/engine/gui/GuiMaterialBasicTypes.h"
+#include "hpl1/std/multimap.h"
namespace hpl {
@@ -163,7 +164,7 @@ void cGui::OnPostSceneDraw() {
//-----------------------------------------------------------------------
void cGui::OnPostGUIDraw() {
- typedef std::multimap<int, cGuiSet *> tPrioMap;
+ typedef Hpl1::std::multimap<int, cGuiSet *> tPrioMap;
tPrioMap mapSortedSets;
tGuiSetMapIt it = m_mapSets.begin();
diff --git a/engines/hpl1/engine/input/Input.h b/engines/hpl1/engine/input/Input.h
index b6bf43185e0..d5d2c5834c4 100644
--- a/engines/hpl1/engine/input/Input.h
+++ b/engines/hpl1/engine/input/Input.h
@@ -28,13 +28,12 @@
#ifndef HPL_INPUT_H
#define HPL_INPUT_H
-#include <map>
-
#include "hpl1/engine/game/Updateable.h"
#include "hpl1/engine/input/InputTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "common/list.h"
#include "hpl1/std/map.h"
+#include "hpl1/std/multimap.h"
namespace hpl {
@@ -47,7 +46,7 @@ class iAction;
typedef Hpl1::std::map<tString, iAction *> tActionMap;
typedef tActionMap::iterator tActionMapIt;
-typedef std::multimap<tString, iAction *> tActionMultiMap;
+typedef Hpl1::std::multimap<tString, iAction *> tActionMultiMap;
typedef tActionMultiMap::iterator tActionMultiMapIt;
typedef Common::List<iInputDevice *> tInputDeviceList;
diff --git a/engines/hpl1/engine/resources/FileSearcher.h b/engines/hpl1/engine/resources/FileSearcher.h
index a4364e59ca9..575d827a47e 100644
--- a/engines/hpl1/engine/resources/FileSearcher.h
+++ b/engines/hpl1/engine/resources/FileSearcher.h
@@ -28,17 +28,16 @@
#ifndef HPL_FILESEARCHER_H
#define HPL_FILESEARCHER_H
-#include <map>
-
#include "hpl1/engine/resources/ResourcesTypes.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/std/map.h"
+#include "hpl1/std/multimap.h"
namespace hpl {
class LowLevelResources;
-typedef std::multimap<tString, tString> tFilePathMap;
+typedef Hpl1::std::multimap<tString, tString> tFilePathMap;
typedef tFilePathMap::iterator tFilePathMapIt;
class cFileSearcher {
diff --git a/engines/hpl1/engine/scene/SubMeshEntity.h b/engines/hpl1/engine/scene/SubMeshEntity.h
index 25a82c69d7c..cc31460e21a 100644
--- a/engines/hpl1/engine/scene/SubMeshEntity.h
+++ b/engines/hpl1/engine/scene/SubMeshEntity.h
@@ -37,6 +37,7 @@
#include "hpl1/engine/system/SystemTypes.h"
#include "common/array.h"
#include "hpl1/std/map.h"
+#include "hpl1/std/multimap.h"
namespace hpl {
@@ -176,7 +177,7 @@ private:
typedef Common::Array<cSubMeshEntity *> tSubMeshEntityVec;
typedef Common::Array<cSubMeshEntity *>::iterator tSubMeshEntityVecIt;
-typedef std::multimap<tString, cSubMeshEntity *> tSubMeshEntityMap;
+typedef Hpl1::std::multimap<tString, cSubMeshEntity *> tSubMeshEntityMap;
typedef tSubMeshEntityMap::iterator tSubMeshEntityMapIt;
} // namespace hpl
diff --git a/engines/hpl1/penumbra-overture/GameTypes.h b/engines/hpl1/penumbra-overture/GameTypes.h
index 6b038fd122f..d9ff8d2f3e6 100644
--- a/engines/hpl1/penumbra-overture/GameTypes.h
+++ b/engines/hpl1/penumbra-overture/GameTypes.h
@@ -34,6 +34,7 @@
#define kCopyFromVar(aVar, aVal) (aVal = aVar->aVal)
#include "hpl1/engine/engine.h"
+#include "hpl1/std/multimap.h"
using namespace hpl;
@@ -242,7 +243,7 @@ class cInventoryUseCallback : public iSerializable {
tString msFunction;
};
-typedef std::multimap<tString, cInventoryUseCallback *> tInventoryUseCallbackMap;
+typedef Hpl1::std::multimap<tString, cInventoryUseCallback *> tInventoryUseCallbackMap;
typedef tInventoryUseCallbackMap::iterator tInventoryUseCallbackMapIt;
//-----------------------------------------
@@ -252,7 +253,7 @@ class cInventoryPickupCallback : public iSerializable {
tString msFunction;
};
-typedef std::multimap<tString, cInventoryPickupCallback *> tInventoryPickupCallbackMap;
+typedef Hpl1::std::multimap<tString, cInventoryPickupCallback *> tInventoryPickupCallbackMap;
typedef tInventoryPickupCallbackMap::iterator tInventoryPickupCallbackMapIt;
//-----------------------------------------
diff --git a/engines/hpl1/penumbra-overture/Inventory.h b/engines/hpl1/penumbra-overture/Inventory.h
index 5275cc58cbc..ea20cb6c37e 100644
--- a/engines/hpl1/penumbra-overture/Inventory.h
+++ b/engines/hpl1/penumbra-overture/Inventory.h
@@ -184,7 +184,7 @@ private:
int mlCount;
};
-typedef std::multimap<tString, cInventoryItem *> tInventoryItemMap;
+typedef Hpl1::std::multimap<tString, cInventoryItem *> tInventoryItemMap;
typedef tInventoryItemMap::iterator tInventoryItemMapIt;
//-----------------------------------------
diff --git a/engines/hpl1/penumbra-overture/MapHandler.h b/engines/hpl1/penumbra-overture/MapHandler.h
index 1c1da6763b2..da7acf9d09c 100644
--- a/engines/hpl1/penumbra-overture/MapHandler.h
+++ b/engines/hpl1/penumbra-overture/MapHandler.h
@@ -44,7 +44,7 @@ class cSavedWorld;
class cGameTimer;
class cGameItem;
-typedef std::multimap<tString, iGameEntity *> tGameEntityMap;
+typedef Hpl1::std::multimap<tString, iGameEntity *> tGameEntityMap;
typedef tGameEntityMap::iterator tGameEntityMapIt;
typedef Common::Array<iGameEntity *> tGameEntityVec;
diff --git a/engines/hpl1/penumbra-overture/TriggerHandler.h b/engines/hpl1/penumbra-overture/TriggerHandler.h
index ec56968e9a6..1d42c9efb78 100644
--- a/engines/hpl1/penumbra-overture/TriggerHandler.h
+++ b/engines/hpl1/penumbra-overture/TriggerHandler.h
@@ -66,7 +66,7 @@ private:
float mfRadius;
};
-typedef std::multimap<int, cGameTrigger *, std::greater<int> > tGameTriggerMap;
+typedef Hpl1::std::multimap<int, cGameTrigger *, std::greater<int> > tGameTriggerMap;
typedef tGameTriggerMap::iterator tGameTriggerMapIt;
//----------------------------------------
Commit: c4d83a8e9b234ee11fd2822680b5bf872b1b9bf8
https://github.com/scummvm/scummvm/commit/c4d83a8e9b234ee11fd2822680b5bf872b1b9bf8
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:14+01:00
Commit Message:
HPL1: remove unused standard library headers
Changed paths:
engines/hpl1/engine/graphics/Material_Alpha.cpp
engines/hpl1/engine/graphics/Material_BaseLight.cpp
engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
engines/hpl1/engine/math/MathTypes.h
engines/hpl1/engine/resources/GpuProgramManager.cpp
diff --git a/engines/hpl1/engine/graphics/Material_Alpha.cpp b/engines/hpl1/engine/graphics/Material_Alpha.cpp
index c7a2eb16c2e..e73476b891f 100644
--- a/engines/hpl1/engine/graphics/Material_Alpha.cpp
+++ b/engines/hpl1/engine/graphics/Material_Alpha.cpp
@@ -34,7 +34,6 @@
#include "hpl1/engine/resources/TextureManager.h"
#include "hpl1/engine/scene/Camera.h"
#include "hpl1/engine/scene/Light.h"
-#include <cstddef>
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Material_BaseLight.cpp b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
index 5accb192e34..7e73e6681c4 100644
--- a/engines/hpl1/engine/graphics/Material_BaseLight.cpp
+++ b/engines/hpl1/engine/graphics/Material_BaseLight.cpp
@@ -38,7 +38,6 @@
#include "hpl1/engine/scene/Light3DSpot.h"
#include "hpl1/engine/scene/PortalContainer.h"
#include "hpl1/engine/system/String.h"
-#include <cstddef>
namespace hpl {
diff --git a/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp b/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
index 0ff453b61ce..bcae8d77ee3 100644
--- a/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
+++ b/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
@@ -34,7 +34,6 @@
#include "hpl1/engine/resources/TextureManager.h"
#include "hpl1/engine/scene/Camera.h"
#include "hpl1/engine/scene/Light.h"
-#include <cstddef>
namespace hpl {
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
index 88de1affd02..f6631698871 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
@@ -35,7 +35,6 @@
#include "hpl1/engine/physics/SurfaceData.h"
#include "hpl1/engine/system/low_level_system.h"
-//#include <algorithm>
namespace hpl {
diff --git a/engines/hpl1/engine/math/MathTypes.h b/engines/hpl1/engine/math/MathTypes.h
index addf3999fde..fbe0bb21d17 100644
--- a/engines/hpl1/engine/math/MathTypes.h
+++ b/engines/hpl1/engine/math/MathTypes.h
@@ -33,7 +33,6 @@
#include "hpl1/engine/math/Vector3.h"
#include "hpl1/engine/system/SystemTypes.h"
#include <cmath>
-#include <cstdlib>
#include "common/array.h"
#include "common/list.h"
diff --git a/engines/hpl1/engine/resources/GpuProgramManager.cpp b/engines/hpl1/engine/resources/GpuProgramManager.cpp
index 6115619b6aa..9f08de205d5 100644
--- a/engines/hpl1/engine/resources/GpuProgramManager.cpp
+++ b/engines/hpl1/engine/resources/GpuProgramManager.cpp
@@ -31,7 +31,6 @@
#include "hpl1/engine/graphics/LowLevelGraphics.h"
#include "hpl1/engine/system/String.h"
#include "hpl1/engine/system/low_level_system.h"
-#include <cstddef>
namespace hpl {
Commit: 084155c2feb5f37e3a8650d0bcfc32dcdaaeb51c
https://github.com/scummvm/scummvm/commit/084155c2feb5f37e3a8650d0bcfc32dcdaaeb51c
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:14+01:00
Commit Message:
HPL1: replace std::greater with Common::Greater
Changed paths:
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/TriggerHandler.h
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 71640190d3c..c26f1b1099e 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -2328,7 +2328,7 @@ public:
cDate mDate;
};
-typedef Hpl1::std::set<cTempFileAndData, std::greater<cTempFileAndData> > tTempFileAndDataSet;
+typedef Hpl1::std::set<cTempFileAndData, Common::Greater<cTempFileAndData> > tTempFileAndDataSet;
typedef tTempFileAndDataSet::iterator tTempFileAndDataSetIt;
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/TriggerHandler.h b/engines/hpl1/penumbra-overture/TriggerHandler.h
index 1d42c9efb78..5ca727f6f33 100644
--- a/engines/hpl1/penumbra-overture/TriggerHandler.h
+++ b/engines/hpl1/penumbra-overture/TriggerHandler.h
@@ -66,7 +66,7 @@ private:
float mfRadius;
};
-typedef Hpl1::std::multimap<int, cGameTrigger *, std::greater<int> > tGameTriggerMap;
+typedef Hpl1::std::multimap<int, cGameTrigger *, Common::Greater<int> > tGameTriggerMap;
typedef tGameTriggerMap::iterator tGameTriggerMapIt;
//----------------------------------------
Commit: 13a7b1379ae90a88714f4eee18948cce7c67e01c
https://github.com/scummvm/scummvm/commit/13a7b1379ae90a88714f4eee18948cce7c67e01c
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:15+01:00
Commit Message:
HPL1: replace instance of std::min and std::max
Changed paths:
engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
index f6631698871..cdeda481515 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
@@ -35,6 +35,7 @@
#include "hpl1/engine/physics/SurfaceData.h"
#include "hpl1/engine/system/low_level_system.h"
+#include "common/util.h"
namespace hpl {
@@ -155,9 +156,9 @@ void cPhysicsMaterialNewton::UpdateMaterials() {
while (MatIt.HasNext()) {
cPhysicsMaterialNewton *pMat = static_cast<cPhysicsMaterialNewton *>(MatIt.Next());
- ePhysicsMaterialCombMode frictionMode = (ePhysicsMaterialCombMode)std::max(mFrictionMode,
+ ePhysicsMaterialCombMode frictionMode = (ePhysicsMaterialCombMode)MAX(mFrictionMode,
pMat->mFrictionMode);
- ePhysicsMaterialCombMode elasticityMode = (ePhysicsMaterialCombMode)std::max(mElasticityMode,
+ ePhysicsMaterialCombMode elasticityMode = (ePhysicsMaterialCombMode)MAX(mElasticityMode,
pMat->mElasticityMode);
// If the material is the same do not blend.
@@ -188,9 +189,9 @@ float cPhysicsMaterialNewton::Combine(ePhysicsMaterialCombMode aMode, float afX,
case ePhysicsMaterialCombMode_Average:
return (afX + afY) / 2;
case ePhysicsMaterialCombMode_Min:
- return std::min(afX, afY);
+ return MIN(afX, afY);
case ePhysicsMaterialCombMode_Max:
- return std::max(afX, afY);
+ return MAX(afX, afY);
case ePhysicsMaterialCombMode_Multiply:
return afX * afY;
default:
Commit: 125de63a68fca30886d9e4344bed085d89e79653
https://github.com/scummvm/scummvm/commit/125de63a68fca30886d9e4344bed085d89e79653
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:15+01:00
Commit Message:
HPL1: remove std::string from MemoryManager
Changed paths:
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/engine/system/MemoryManager.cpp
engines/hpl1/engine/system/MemoryManager.h
engines/hpl1/penumbra-overture/GameScripts.cpp
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index f6a15bc6616..fb2c2d90e16 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -25,6 +25,8 @@
* This file is part of HPL1 Engine.
*/
+#include <string>
+
#include "hpl1/engine/game/ScriptFuncs.h"
#include "hpl1/engine/game/Game.h"
diff --git a/engines/hpl1/engine/system/MemoryManager.cpp b/engines/hpl1/engine/system/MemoryManager.cpp
index b5abe5bac77..7ce5b1cbfde 100644
--- a/engines/hpl1/engine/system/MemoryManager.cpp
+++ b/engines/hpl1/engine/system/MemoryManager.cpp
@@ -43,7 +43,7 @@ int cMemoryManager::mlCreationCount = 0;
//-----------------------------------------------------------------------
-cAllocatedPointer::cAllocatedPointer(void *apData, const std::string &asFile, int alLine, size_t alMemory) {
+cAllocatedPointer::cAllocatedPointer(void *apData, const Common::String &asFile, int alLine, size_t alMemory) {
mpData = apData;
msFile = asFile;
mlLine = alLine;
@@ -113,8 +113,8 @@ void cMemoryManager::LogResults() {
tAllocatedPointerMapIt it = m_mapPointers.begin();
for (; it != m_mapPointers.end(); ++it) {
cAllocatedPointer &ap = it->second;
- if ((int)ap.msFile.length() > lMax)
- lMax = (int)ap.msFile.length();
+ if ((int)ap.msFile.size() > lMax)
+ lMax = (int)ap.msFile.size();
}
lMax += 5;
@@ -130,7 +130,7 @@ void cMemoryManager::LogResults() {
for (; it != m_mapPointers.end(); ++it) {
cAllocatedPointer &ap = it->second;
Log("| %d\t %s", ap.mpData, ap.msFile.c_str());
- for (int i = 0; i < lMax - (int)ap.msFile.length(); ++i)
+ for (int i = 0; i < lMax - (int)ap.msFile.size(); ++i)
Log(" ");
Log("%d\t\t %d\t\n", ap.mlLine, ap.mlMemory);
}
diff --git a/engines/hpl1/engine/system/MemoryManager.h b/engines/hpl1/engine/system/MemoryManager.h
index 95138bfcb1c..41c2ea7b465 100644
--- a/engines/hpl1/engine/system/MemoryManager.h
+++ b/engines/hpl1/engine/system/MemoryManager.h
@@ -28,8 +28,8 @@
#ifndef HPL_MEMORY_MANAGER_H
#define HPL_MEMORY_MANAGER_H
-#include <string>
#include "hpl1/std/map.h"
+#include "common/str.h"
namespace hpl {
@@ -37,9 +37,9 @@ namespace hpl {
class cAllocatedPointer {
public:
- cAllocatedPointer(void *apData, const std::string &asFile, int alLine, size_t alMemory);
+ cAllocatedPointer(void *apData, const Common::String &asFile, int alLine, size_t alMemory);
- std::string msFile;
+ Common::String msFile;
int mlLine;
size_t mlMemory;
void *mpData;
diff --git a/engines/hpl1/penumbra-overture/GameScripts.cpp b/engines/hpl1/penumbra-overture/GameScripts.cpp
index ccb0bffe7a0..efb1628ce57 100644
--- a/engines/hpl1/penumbra-overture/GameScripts.cpp
+++ b/engines/hpl1/penumbra-overture/GameScripts.cpp
@@ -25,6 +25,8 @@
* This file is part of Penumbra Overture.
*/
+#include <string>
+
#include "hpl1/penumbra-overture/GameScripts.h"
#include "hpl1/engine/engine.h"
Commit: 784915388b1aba7672e16c0fda3a4cab641b7334
https://github.com/scummvm/scummvm/commit/784915388b1aba7672e16c0fda3a4cab641b7334
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:15+01:00
Commit Message:
HPL1: remove unused header in Hpl1::std::map
Changed paths:
engines/hpl1/std/map.h
diff --git a/engines/hpl1/std/map.h b/engines/hpl1/std/map.h
index f94d89c790d..56fe4527613 100644
--- a/engines/hpl1/std/map.h
+++ b/engines/hpl1/std/map.h
@@ -22,7 +22,6 @@
#ifndef HPL1_STD_MAP_H
#define HPL1_STD_MAP_H
-#include "common/hashmap.h"
#include "hpl1/algorithms.h"
#include "pair.h"
Commit: e0731245f06fef181b0400f83f6f767f9d54c2a5
https://github.com/scummvm/scummvm/commit/e0731245f06fef181b0400f83f6f767f9d54c2a5
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:15+01:00
Commit Message:
HPL1: fix compilation
Changed paths:
engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
index 564552d197b..747969d58e4 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
@@ -1,6 +1,7 @@
#include "scripthelper.h"
#include "hpl1/std/set.h"
+#include "common/str.h"
using namespace std;
Commit: a804c81f29804a6d8472515b7a16a4bd825d0f2c
https://github.com/scummvm/scummvm/commit/a804c81f29804a6d8472515b7a16a4bd825d0f2c
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:15+01:00
Commit Message:
HPL1: remove std::string from angelscript add-ons
Changed paths:
engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
engines/hpl1/engine/system/Script.h
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
index 11fe7c7c0ea..77fa8853e6d 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
@@ -1,9 +1,9 @@
#include <string.h> // FIXME: Refactor to remove this system header
#include <assert.h> // assert() // FIXME: Refactor to remove this system header
-#include <string>
-#include <algorithm> // std::sort // FIXME: Refactor to remove this system header
#include "scriptarray.h"
+#include "common/str.h"
+#include "common/algorithm.h"
using namespace std;
@@ -370,7 +370,7 @@ CScriptArray &CScriptArray::operator=(const CScriptArray &other)
CScriptArray::CScriptArray(asITypeInfo *ti, void *buf)
{
// The object type should be the template instance of the array
- assert( ti && string(ti->GetName()) == "array" );
+ assert( ti && Common::String(ti->GetName()) == "array" );
refCount = 1;
gcFlag = false;
@@ -463,7 +463,7 @@ CScriptArray::CScriptArray(asITypeInfo *ti, void *buf)
CScriptArray::CScriptArray(asUINT length, asITypeInfo *ti)
{
// The object type should be the template instance of the array
- assert( ti && string(ti->GetName()) == "array" );
+ assert( ti && Common::String(ti->GetName()) == "array" );
refCount = 1;
gcFlag = false;
@@ -517,7 +517,7 @@ CScriptArray::CScriptArray(const CScriptArray &other)
CScriptArray::CScriptArray(asUINT length, void *defVal, asITypeInfo *ti)
{
// The object type should be the template instance of the array
- assert( ti && string(ti->GetName()) == "array" );
+ assert( ti && Common::String(ti->GetName()) == "array" );
refCount = 1;
gcFlag = false;
@@ -1506,7 +1506,7 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
return false;
}
} customLess = {asc, cmpContext, cache ? cache->cmpFunc : 0};
- std::sort((void**)GetArrayItemPointer(start), (void**)GetArrayItemPointer(end), customLess);
+ Common::sort((void**)GetArrayItemPointer(start), (void**)GetArrayItemPointer(end), customLess);
// Clean up
if( cmpContext )
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
index 747969d58e4..0cd3153b8e3 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
@@ -15,7 +15,7 @@ int ExecuteString(asIScriptEngine *engine, const char *code, asIScriptModule *mo
int ExecuteString(asIScriptEngine *engine, const char *code, void *ref, int refTypeId, asIScriptModule *mod, asIScriptContext *ctx)
{
// Wrap the code in a function so that it can be compiled and executed
- string funcCode = " ExecuteString() {\n";
+ Common::String funcCode = " ExecuteString() {\n";
funcCode += code;
funcCode += "\n;}";
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h
index 389abf7ba32..6185586d0ba 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.h
@@ -1,8 +1,6 @@
#ifndef SCRIPTHELPER_H
#define SCRIPTHELPER_H
-#include <string>
-
#ifndef ANGELSCRIPT_H
// Avoid having to inform include path if header is already include before
#include "hpl1/engine/libraries/angelscript/angelscript.h"
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
index 2366739ba33..be8bd15958c 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -1,6 +1,5 @@
#include "hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h"
#include <assert.h> // assert() // FIXME: Refactor to remove this system header
-#include <sstream> // std::stringstream
#include <string.h> // strstr() // FIXME: Refactor to remove this system header
#include <stdio.h> // sprintf() // FIXME: Refactor to remove this system header
#include <stdlib.h> // strtod() // FIXME: Refactor to remove this system header
@@ -8,25 +7,17 @@
#include <locale.h> // setlocale()
#endif
-using namespace std;
+#include "common/str.h"
+#include "hpl1/std/map.h"
+#include "hpl1/debug.h"
// This macro is used to avoid warnings about unused variables.
// Usually where the variables are only used in debug mode.
#define UNUSED_VAR(x) (void)(x)
-#ifdef AS_CAN_USE_CPP11
-// The string factory doesn't need to keep a specific order in the
-// cache, so the unordered_map is faster than the ordinary map
-#include <unordered_map> // std::unordered_map
-BEGIN_AS_NAMESPACE
-typedef unordered_map<string, int> map_t;
-END_AS_NAMESPACE
-#else
-#include <map> // std::map
-BEGIN_AS_NAMESPACE
-typedef map<string, int> map_t;
-END_AS_NAMESPACE
-#endif
+#include <map>
+
+using map_t = std::map<Common::String, int>;
BEGIN_AS_NAMESPACE
class CStdStringFactory : public asIStringFactory
@@ -46,7 +37,7 @@ public:
// threads, so it is necessary to use a mutex.
asAcquireExclusiveLock();
- string str(data, length);
+ Common::String str(data, length);
map_t::iterator it = stringCache.find(str);
if (it != stringCache.end())
it->second++;
@@ -69,7 +60,7 @@ public:
// threads, so it is necessary to use a mutex.
asAcquireExclusiveLock();
- map_t::iterator it = stringCache.find(*reinterpret_cast<const string*>(str));
+ map_t::iterator it = stringCache.find(*reinterpret_cast<const Common::String*>(str));
if (it == stringCache.end())
ret = asERROR;
else
@@ -90,10 +81,10 @@ public:
return asERROR;
if (length)
- *length = (asUINT)reinterpret_cast<const string*>(str)->length();
+ *length = (asUINT)reinterpret_cast<const Common::String*>(str)->size();
if (data)
- memcpy(data, reinterpret_cast<const string*>(str)->c_str(), reinterpret_cast<const string*>(str)->length());
+ memcpy(data, reinterpret_cast<const Common::String*>(str)->c_str(), reinterpret_cast<const Common::String*>(str)->size());
return asSUCCESS;
}
@@ -143,22 +134,22 @@ public:
static CStdStringFactoryCleaner cleaner;
-static void ConstructString(string *thisPointer)
+static void ConstructString(Common::String *thisPointer)
{
- new(thisPointer) string();
+ new(thisPointer) Common::String();
}
-static void CopyConstructString(const string &other, string *thisPointer)
+static void CopyConstructString(const Common::String &other, Common::String *thisPointer)
{
- new(thisPointer) string(other);
+ new(thisPointer) Common::String(other);
}
-static void DestructString(string *thisPointer)
+static void DestructString(Common::String *thisPointer)
{
- thisPointer->~string();
+ thisPointer->Common::String::~String();
}
-static string &AddAssignStringToString(const string &str, string &dest)
+static Common::String &AddAssignStringToString(const Common::String &str, Common::String &dest)
{
// We don't register the method directly because some compilers
// and standard libraries inline the definition, resulting in the
@@ -170,166 +161,126 @@ static string &AddAssignStringToString(const string &str, string &dest)
// bool string::isEmpty()
// bool string::empty() // if AS_USE_STLNAMES == 1
-static bool StringIsEmpty(const string &str)
+static bool StringIsEmpty(const Common::String &str)
{
// We don't register the method directly because some compilers
// and standard libraries inline the definition, resulting in the
// linker being unable to find the declaration
// Example: CLang/LLVM with XCode 4.3 on OSX 10.7
- return str.empty();
+ return str.size() > 0;
}
-static string &AssignUInt64ToString(asQWORD i, string &dest)
+static Common::String &AssignUInt64ToString(asQWORD i, Common::String &dest)
{
- ostringstream stream;
- stream << i;
- dest = stream.str();
+ dest = Common::String::format("%lu", i);
return dest;
}
-static string &AddAssignUInt64ToString(asQWORD i, string &dest)
+static Common::String &AddAssignUInt64ToString(asQWORD i, Common::String &dest)
{
- ostringstream stream;
- stream << i;
- dest += stream.str();
+ dest += Common::String::format("%lu", i);
return dest;
}
-static string AddStringUInt64(const string &str, asQWORD i)
+static Common::String AddStringUInt64(const Common::String &str, asQWORD i)
{
- ostringstream stream;
- stream << i;
- return str + stream.str();
+ return str + Common::String::format("%lu", i);
}
-static string AddInt64String(asINT64 i, const string &str)
+static Common::String AddInt64String(asINT64 i, const Common::String &str)
{
- ostringstream stream;
- stream << i;
- return stream.str() + str;
+ return Common::String::format("%li", i) + str;
}
-static string &AssignInt64ToString(asINT64 i, string &dest)
+static Common::String &AssignInt64ToString(asINT64 i, Common::String &dest)
{
- ostringstream stream;
- stream << i;
- dest = stream.str();
+ dest = Common::String::format("%li", i);
return dest;
}
-static string &AddAssignInt64ToString(asINT64 i, string &dest)
+static Common::String &AddAssignInt64ToString(asINT64 i, Common::String &dest)
{
- ostringstream stream;
- stream << i;
- dest += stream.str();
+ dest += Common::String::format("%li", i);
return dest;
}
-static string AddStringInt64(const string &str, asINT64 i)
+static Common::String AddStringInt64(const Common::String &str, asINT64 i)
{
- ostringstream stream;
- stream << i;
- return str + stream.str();
+ return str + Common::String::format("%li", i);
}
-static string AddUInt64String(asQWORD i, const string &str)
+static Common::String AddUInt64String(asQWORD i, const Common::String &str)
{
- ostringstream stream;
- stream << i;
- return stream.str() + str;
+ return Common::String::format("%li", i) + str;
}
-static string &AssignDoubleToString(double f, string &dest)
+static Common::String &AssignDoubleToString(double f, Common::String &dest)
{
- ostringstream stream;
- stream << f;
- dest = stream.str();
+ dest = Common::String::format("%f", f);
return dest;
}
-static string &AddAssignDoubleToString(double f, string &dest)
+static Common::String &AddAssignDoubleToString(double f, Common::String &dest)
{
- ostringstream stream;
- stream << f;
- dest += stream.str();
+ dest += Common::String::format("%f", f);
return dest;
}
-static string &AssignFloatToString(float f, string &dest)
+static Common::String &AssignFloatToString(float f, Common::String &dest)
{
- ostringstream stream;
- stream << f;
- dest = stream.str();
+ dest = Common::String::format("%f", f);
return dest;
}
-static string &AddAssignFloatToString(float f, string &dest)
+static Common::String &AddAssignFloatToString(float f, Common::String &dest)
{
- ostringstream stream;
- stream << f;
- dest += stream.str();
+ dest += Common::String::format("%f", f);
return dest;
}
-static string &AssignBoolToString(bool b, string &dest)
+static Common::String &AssignBoolToString(bool b, Common::String &dest)
{
- ostringstream stream;
- stream << (b ? "true" : "false");
- dest = stream.str();
+ dest = (b ? "true" : "false");
return dest;
}
-static string &AddAssignBoolToString(bool b, string &dest)
+static Common::String &AddAssignBoolToString(bool b, Common::String &dest)
{
- ostringstream stream;
- stream << (b ? "true" : "false");
- dest += stream.str();
+ dest += (b ? "true" : "false");
return dest;
}
-static string AddStringDouble(const string &str, double f)
+static Common::String AddStringDouble(const Common::String &str, double f)
{
- ostringstream stream;
- stream << f;
- return str + stream.str();
+ return str + Common::String::format("%f", f);
}
-static string AddDoubleString(double f, const string &str)
+static Common::String AddDoubleString(double f, const Common::String &str)
{
- ostringstream stream;
- stream << f;
- return stream.str() + str;
+ return Common::String::format("%f", f) + str;
}
-static string AddStringFloat(const string &str, float f)
+static Common::String AddStringFloat(const Common::String &str, float f)
{
- ostringstream stream;
- stream << f;
- return str + stream.str();
+ return str + Common::String::format("%f", f);
}
-static string AddFloatString(float f, const string &str)
+static Common::String AddFloatString(float f, const Common::String &str)
{
- ostringstream stream;
- stream << f;
- return stream.str() + str;
+ return Common::String::format("%f", f) + str;
}
-static string AddStringBool(const string &str, bool b)
+static Common::String AddStringBool(const Common::String &str, bool b)
{
- ostringstream stream;
- stream << (b ? "true" : "false");
- return str + stream.str();
+ return str + (b ? "true" : "false");
}
-static string AddBoolString(bool b, const string &str)
+static Common::String AddBoolString(bool b, const Common::String &str)
{
- ostringstream stream;
- stream << (b ? "true" : "false");
- return stream.str() + str;
+ return (b ? "true" : "false") + str;
}
-static char *StringCharAt(unsigned int i, string &str)
+static char *StringCharAt(unsigned int i, Common::String &str)
{
if( i >= str.size() )
{
@@ -341,12 +292,12 @@ static char *StringCharAt(unsigned int i, string &str)
return 0;
}
- return &str[i];
+ return str.begin() + i;
}
// AngelScript signature:
// int string::opCmp(const string &in) const
-static int StringCmp(const string &a, const string &b)
+static int StringCmp(const Common::String &a, const Common::String &b)
{
int cmp = 0;
if( a < b ) cmp = -1;
@@ -360,7 +311,7 @@ static int StringCmp(const string &a, const string &b)
//
// AngelScript signature:
// int string::findFirst(const string &in sub, uint start = 0) const
-static int StringFindFirst(const string &sub, asUINT start, const string &str)
+static int StringFindFirst(const Common::String &sub, asUINT start, const Common::String &str)
{
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
return (int)str.find(sub, (size_t)start);
@@ -372,10 +323,10 @@ static int StringFindFirst(const string &sub, asUINT start, const string &str)
//
// AngelScript signature:
// int string::findFirstOf(const string &in sub, uint start = 0) const
-static int StringFindFirstOf(const string &sub, asUINT start, const string &str)
+static int StringFindFirstOf(const Common::String &sub, asUINT start, const Common::String &str)
{
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
- return (int)str.find_first_of(sub, (size_t)start);
+ return (int)str.findFirstOf(sub, (size_t)start);
}
// This function returns the index of the last position where the one of the bytes in substring
@@ -384,10 +335,10 @@ static int StringFindFirstOf(const string &sub, asUINT start, const string &str)
//
// AngelScript signature:
// int string::findLastOf(const string &in sub, uint start = -1) const
-static int StringFindLastOf(const string &sub, asUINT start, const string &str)
+static int StringFindLastOf(const Common::String &sub, asUINT start, const Common::String &str)
{
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
- return (int)str.find_last_of(sub, (size_t)start);
+ return (int)str.findLastOf(sub, (size_t)start);
}
// This function returns the index of the first position where a byte other than those in substring
@@ -395,10 +346,10 @@ static int StringFindLastOf(const string &sub, asUINT start, const string &str)
//
// AngelScript signature:
// int string::findFirstNotOf(const string &in sub, uint start = 0) const
-static int StringFindFirstNotOf(const string &sub, asUINT start, const string &str)
+static int StringFindFirstNotOf(const Common::String &sub, asUINT start, const Common::String &str)
{
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
- return (int)str.find_first_not_of(sub, (size_t)start);
+ return (int)str.findFirstNotOf(sub, (size_t)start);
}
// This function returns the index of the last position where a byte other than those in substring
@@ -406,10 +357,9 @@ static int StringFindFirstNotOf(const string &sub, asUINT start, const string &s
//
// AngelScript signature:
// int string::findLastNotOf(const string &in sub, uint start = -1) const
-static int StringFindLastNotOf(const string &sub, asUINT start, const string &str)
+static int StringFindLastNotOf(const Common::String &sub, asUINT start, const Common::String &str)
{
- // We don't register the method directly because the argument types change between 32bit and 64bit platforms
- return (int)str.find_last_not_of(sub, (size_t)start);
+ HPL1_UNIMPLEMENTED(__func__);
}
// This function returns the index of the last position where the substring
@@ -418,298 +368,81 @@ static int StringFindLastNotOf(const string &sub, asUINT start, const string &st
//
// AngelScript signature:
// int string::findLast(const string &in sub, int start = -1) const
-static int StringFindLast(const string &sub, int start, const string &str)
+static int StringFindLast(const Common::String &sub, int start, const Common::String &str)
{
- // We don't register the method directly because the argument types change between 32bit and 64bit platforms
- return (int)str.rfind(sub, (size_t)(start < 0 ? string::npos : start));
+ HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// void string::insert(uint pos, const string &in other)
-static void StringInsert(unsigned int pos, const string &other, string &str)
+static void StringInsert(unsigned int pos, const Common::String &other, Common::String &str)
{
- // We don't register the method directly because the argument types change between 32bit and 64bit platforms
- str.insert(pos, other);
+ HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// void string::erase(uint pos, int count = -1)
-static void StringErase(unsigned int pos, int count, string &str)
+static void StringErase(unsigned int pos, int count, Common::String &str)
{
- // We don't register the method directly because the argument types change between 32bit and 64bit platforms
- str.erase(pos, (size_t)(count < 0 ? string::npos : count));
+ HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// uint string::length() const
-static asUINT StringLength(const string &str)
+static asUINT StringLength(const Common::String &str)
{
- // We don't register the method directly because the return type changes between 32bit and 64bit platforms
- return (asUINT)str.length();
+ HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// void string::resize(uint l)
-static void StringResize(asUINT l, string &str)
+static void StringResize(asUINT l, Common::String &str)
{
- // We don't register the method directly because the argument types change between 32bit and 64bit platforms
- str.resize(l);
+ HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// string formatInt(int64 val, const string &in options, uint width)
-static string formatInt(asINT64 value, const string &options, asUINT width)
-{
- bool leftJustify = options.find("l") != string::npos;
- bool padWithZero = options.find("0") != string::npos;
- bool alwaysSign = options.find("+") != string::npos;
- bool spaceOnSign = options.find(" ") != string::npos;
- bool hexSmall = options.find("h") != string::npos;
- bool hexLarge = options.find("H") != string::npos;
-
- string fmt = "%";
- if( leftJustify ) fmt += "-";
- if( alwaysSign ) fmt += "+";
- if( spaceOnSign ) fmt += " ";
- if( padWithZero ) fmt += "0";
-
-#ifdef _WIN32
- fmt += "*I64";
-#else
-#ifdef _LP64
- fmt += "*l";
-#else
- fmt += "*ll";
-#endif
-#endif
-
- if( hexSmall ) fmt += "x";
- else if( hexLarge ) fmt += "X";
- else fmt += "d";
-
- string buf;
- buf.resize(width+30);
-#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(__S3E__)
- // MSVC 8.0 / 2005 or newer
- sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, value);
-#else
- snprintf(&buf[0], width+30, fmt.c_str(), width, value);
-#endif
- buf.resize(strlen(&buf[0]));
-
- return buf;
+static Common::String formatInt(asINT64 value, const Common::String &options, asUINT width)
+{
+ HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// string formatUInt(uint64 val, const string &in options, uint width)
-static string formatUInt(asQWORD value, const string &options, asUINT width)
-{
- bool leftJustify = options.find("l") != string::npos;
- bool padWithZero = options.find("0") != string::npos;
- bool alwaysSign = options.find("+") != string::npos;
- bool spaceOnSign = options.find(" ") != string::npos;
- bool hexSmall = options.find("h") != string::npos;
- bool hexLarge = options.find("H") != string::npos;
-
- string fmt = "%";
- if( leftJustify ) fmt += "-";
- if( alwaysSign ) fmt += "+";
- if( spaceOnSign ) fmt += " ";
- if( padWithZero ) fmt += "0";
-
-#ifdef _WIN32
- fmt += "*I64";
-#else
-#ifdef _LP64
- fmt += "*l";
-#else
- fmt += "*ll";
-#endif
-#endif
-
- if( hexSmall ) fmt += "x";
- else if( hexLarge ) fmt += "X";
- else fmt += "u";
-
- string buf;
- buf.resize(width+30);
-#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(__S3E__)
- // MSVC 8.0 / 2005 or newer
- sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, value);
-#else
- snprintf(&buf[0], width+30, fmt.c_str(), width, value);
-#endif
- buf.resize(strlen(&buf[0]));
-
- return buf;
+static Common::String formatUInt(asQWORD value, const Common::String &options, asUINT width)
+{
+ HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// string formatFloat(double val, const string &in options, uint width, uint precision)
-static string formatFloat(double value, const string &options, asUINT width, asUINT precision)
-{
- bool leftJustify = options.find("l") != string::npos;
- bool padWithZero = options.find("0") != string::npos;
- bool alwaysSign = options.find("+") != string::npos;
- bool spaceOnSign = options.find(" ") != string::npos;
- bool expSmall = options.find("e") != string::npos;
- bool expLarge = options.find("E") != string::npos;
-
- string fmt = "%";
- if( leftJustify ) fmt += "-";
- if( alwaysSign ) fmt += "+";
- if( spaceOnSign ) fmt += " ";
- if( padWithZero ) fmt += "0";
-
- fmt += "*.*";
-
- if( expSmall ) fmt += "e";
- else if( expLarge ) fmt += "E";
- else fmt += "f";
-
- string buf;
- buf.resize(width+precision+50);
-#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(__S3E__)
- // MSVC 8.0 / 2005 or newer
- sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, precision, value);
-#else
- snprintf(&buf[0], width+precision+50, fmt.c_str(), width, precision, value);
-#endif
- buf.resize(strlen(&buf[0]));
-
- return buf;
+static Common::String formatFloat(double value, const Common::String &options, asUINT width, asUINT precision)
+{
+ HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// int64 parseInt(const string &in val, uint base = 10, uint &out byteCount = 0)
-static asINT64 parseInt(const string &val, asUINT base, asUINT *byteCount)
+static asINT64 parseInt(const Common::String &val, asUINT base, asUINT *byteCount)
{
- // Only accept base 10 and 16
- if( base != 10 && base != 16 )
- {
- if( byteCount ) *byteCount = 0;
- return 0;
- }
-
- const char *end = &val[0];
-
- // Determine the sign
- bool sign = false;
- if( *end == '-' )
- {
- sign = true;
- end++;
- }
- else if( *end == '+' )
- end++;
-
- asINT64 res = 0;
- if( base == 10 )
- {
- while( *end >= '0' && *end <= '9' )
- {
- res *= 10;
- res += *end++ - '0';
- }
- }
- else if( base == 16 )
- {
- while( (*end >= '0' && *end <= '9') ||
- (*end >= 'a' && *end <= 'f') ||
- (*end >= 'A' && *end <= 'F') )
- {
- res *= 16;
- if( *end >= '0' && *end <= '9' )
- res += *end++ - '0';
- else if( *end >= 'a' && *end <= 'f' )
- res += *end++ - 'a' + 10;
- else if( *end >= 'A' && *end <= 'F' )
- res += *end++ - 'A' + 10;
- }
- }
-
- if( byteCount )
- *byteCount = asUINT(size_t(end - val.c_str()));
-
- if( sign )
- res = -res;
-
- return res;
+ HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// uint64 parseUInt(const string &in val, uint base = 10, uint &out byteCount = 0)
-static asQWORD parseUInt(const string &val, asUINT base, asUINT *byteCount)
+static asQWORD parseUInt(const Common::String &val, asUINT base, asUINT *byteCount)
{
- // Only accept base 10 and 16
- if (base != 10 && base != 16)
- {
- if (byteCount) *byteCount = 0;
- return 0;
- }
-
- const char *end = &val[0];
-
- asQWORD res = 0;
- if (base == 10)
- {
- while (*end >= '0' && *end <= '9')
- {
- res *= 10;
- res += *end++ - '0';
- }
- }
- else if (base == 16)
- {
- while ((*end >= '0' && *end <= '9') ||
- (*end >= 'a' && *end <= 'f') ||
- (*end >= 'A' && *end <= 'F'))
- {
- res *= 16;
- if (*end >= '0' && *end <= '9')
- res += *end++ - '0';
- else if (*end >= 'a' && *end <= 'f')
- res += *end++ - 'a' + 10;
- else if (*end >= 'A' && *end <= 'F')
- res += *end++ - 'A' + 10;
- }
- }
-
- if (byteCount)
- *byteCount = asUINT(size_t(end - val.c_str()));
-
- return res;
+ HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// double parseFloat(const string &in val, uint &out byteCount = 0)
-double parseFloat(const string &val, asUINT *byteCount)
-{
- char *end;
-
- // WinCE doesn't have setlocale. Some quick testing on my current platform
- // still manages to parse the numbers such as "3.14" even if the decimal for the
- // locale is ",".
-#if !defined(_WIN32_WCE) && !defined(ANDROID) && !defined(__psp2__)
- // Set the locale to C so that we are guaranteed to parse the float value correctly
- char *tmp = setlocale(LC_NUMERIC, 0);
- string orig = tmp ? tmp : "C";
- setlocale(LC_NUMERIC, "C");
-#endif
-
- double res = strtod(val.c_str(), &end);
-
-#if !defined(_WIN32_WCE) && !defined(ANDROID) && !defined(__psp2__)
- // Restore the locale
- setlocale(LC_NUMERIC, orig.c_str());
-#endif
-
- if( byteCount )
- *byteCount = asUINT(size_t(end - val.c_str()));
-
- return res;
+double parseFloat(const Common::String &val, asUINT *byteCount)
+{
+ HPL1_UNIMPLEMENTED(__func__);
}
// This function returns a string containing the substring of the input string
@@ -717,14 +450,9 @@ double parseFloat(const string &val, asUINT *byteCount)
//
// AngelScript signature:
// string string::substr(uint start = 0, int count = -1) const
-static string StringSubString(asUINT start, int count, const string &str)
+static Common::String StringSubString(asUINT start, int count, const Common::String &str)
{
- // Check for out-of-bounds
- string ret;
- if( start < str.length() && count != 0 )
- ret = str.substr(start, (size_t)(count < 0 ? string::npos : count));
-
- return ret;
+ HPL1_UNIMPLEMENTED(__func__);
}
// String equality comparison.
@@ -733,7 +461,7 @@ static string StringSubString(asUINT start, int count, const string &str)
// For some reason gcc 4.7 has difficulties resolving the
// asFUNCTIONPR(operator==, (const string &, const string &)
// makro, so this wrapper was introduced as work around.
-static bool StringEquals(const std::string& lhs, const std::string& rhs)
+static bool StringEquals(const Common::String& lhs, const Common::String& rhs)
{
return lhs == rhs;
}
@@ -746,9 +474,9 @@ void RegisterStdString_Native(asIScriptEngine *engine)
// Register the string type
#if AS_CAN_USE_CPP11
// With C++11 it is possible to use asGetTypeTraits to automatically determine the correct flags to use
- r = engine->RegisterObjectType("string", sizeof(string), asOBJ_VALUE | asGetTypeTraits<string>()); assert( r >= 0 );
+ r = engine->RegisterObjectType("string", sizeof(Common::String), asOBJ_VALUE | asGetTypeTraits<Common::String>()); assert( r >= 0 );
#else
- r = engine->RegisterObjectType("string", sizeof(string), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 );
+ r = engine->RegisterObjectType("string", sizeof(Common::String), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 );
#endif
r = engine->RegisterStringFactory("string", GetStdStringFactorySingleton());
@@ -757,15 +485,15 @@ void RegisterStdString_Native(asIScriptEngine *engine)
r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f(const string &in)", asFUNCTION(CopyConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
r = engine->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAssign(const string &in)", asMETHODPR(string, operator =, (const string&), string&), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAssign(const string &in)", asMETHODPR(Common::String, operator =, (const Common::String&), Common::String&), asCALL_THISCALL); assert( r >= 0 );
// Need to use a wrapper on Mac OS X 10.7/XCode 4.3 and CLang/LLVM, otherwise the linker fails
r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asFUNCTION(AddAssignStringToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
// r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asMETHODPR(string, operator+=, (const string&), string&), asCALL_THISCALL); assert( r >= 0 );
// Need to use a wrapper for operator== otherwise gcc 4.7 fails to compile
- r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in) const", asFUNCTIONPR(StringEquals, (const string &, const string &), bool), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in) const", asFUNCTIONPR(StringEquals, (const Common::String &, const Common::String &), bool), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
r = engine->RegisterObjectMethod("string", "int opCmp(const string &in) const", asFUNCTION(StringCmp), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(const string &in) const", asFUNCTIONPR(operator +, (const string &, const string &), string), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string opAdd(const string &in) const", asFUNCTIONPR(Common::operator +, (const Common::String &, const Common::String &), Common::String), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
// The string length can be accessed through methods or through virtual property
// TODO: Register as size() for consistency with other types
@@ -851,48 +579,48 @@ void RegisterStdString_Native(asIScriptEngine *engine)
static void ConstructStringGeneric(asIScriptGeneric * gen)
{
- new (gen->GetObject()) string();
+ new (gen->GetObject()) Common::String();
}
static void CopyConstructStringGeneric(asIScriptGeneric * gen)
{
- string * a = static_cast<string *>(gen->GetArgObject(0));
- new (gen->GetObject()) string(*a);
+ Common::String * a = static_cast<Common::String *>(gen->GetArgObject(0));
+ new (gen->GetObject()) Common::String(*a);
}
static void DestructStringGeneric(asIScriptGeneric * gen)
{
- string * ptr = static_cast<string *>(gen->GetObject());
- ptr->~string();
+ Common::String * ptr = static_cast<Common::String *>(gen->GetObject());
+ ptr->Common::String::~String();
}
static void AssignStringGeneric(asIScriptGeneric *gen)
{
- string * a = static_cast<string *>(gen->GetArgObject(0));
- string * self = static_cast<string *>(gen->GetObject());
+ Common::String * a = static_cast<Common::String *>(gen->GetArgObject(0));
+ Common::String * self = static_cast<Common::String *>(gen->GetObject());
*self = *a;
gen->SetReturnAddress(self);
}
static void AddAssignStringGeneric(asIScriptGeneric *gen)
{
- string * a = static_cast<string *>(gen->GetArgObject(0));
- string * self = static_cast<string *>(gen->GetObject());
+ Common::String * a = static_cast<Common::String *>(gen->GetArgObject(0));
+ Common::String * self = static_cast<Common::String *>(gen->GetObject());
*self += *a;
gen->SetReturnAddress(self);
}
static void StringEqualsGeneric(asIScriptGeneric * gen)
{
- string * a = static_cast<string *>(gen->GetObject());
- string * b = static_cast<string *>(gen->GetArgAddress(0));
+ Common::String * a = static_cast<Common::String *>(gen->GetObject());
+ Common::String * b = static_cast<Common::String *>(gen->GetArgAddress(0));
*(bool*)gen->GetAddressOfReturnLocation() = (*a == *b);
}
static void StringCmpGeneric(asIScriptGeneric * gen)
{
- string * a = static_cast<string *>(gen->GetObject());
- string * b = static_cast<string *>(gen->GetArgAddress(0));
+ Common::String * a = static_cast<Common::String *>(gen->GetObject());
+ Common::String * b = static_cast<Common::String *>(gen->GetArgAddress(0));
int cmp = 0;
if( *a < *b ) cmp = -1;
@@ -903,41 +631,40 @@ static void StringCmpGeneric(asIScriptGeneric * gen)
static void StringAddGeneric(asIScriptGeneric * gen)
{
- string * a = static_cast<string *>(gen->GetObject());
- string * b = static_cast<string *>(gen->GetArgAddress(0));
- string ret_val = *a + *b;
+ Common::String * a = static_cast<Common::String *>(gen->GetObject());
+ Common::String * b = static_cast<Common::String *>(gen->GetArgAddress(0));
+ Common::String ret_val = *a + *b;
gen->SetReturnObject(&ret_val);
}
static void StringLengthGeneric(asIScriptGeneric * gen)
{
- string * self = static_cast<string *>(gen->GetObject());
- *static_cast<asUINT *>(gen->GetAddressOfReturnLocation()) = (asUINT)self->length();
+ Common::String * self = static_cast<Common::String *>(gen->GetObject());
+ *static_cast<asUINT *>(gen->GetAddressOfReturnLocation()) = (asUINT)self->size();
}
static void StringIsEmptyGeneric(asIScriptGeneric * gen)
{
- string * self = reinterpret_cast<string *>(gen->GetObject());
+ Common::String * self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<bool *>(gen->GetAddressOfReturnLocation()) = StringIsEmpty(*self);
}
static void StringResizeGeneric(asIScriptGeneric * gen)
{
- string * self = static_cast<string *>(gen->GetObject());
- self->resize(*static_cast<asUINT *>(gen->GetAddressOfArg(0)));
+ HPL1_UNIMPLEMENTED(StringResizeGeneric);
}
static void StringInsert_Generic(asIScriptGeneric *gen)
{
- string * self = static_cast<string *>(gen->GetObject());
+ Common::String * self = static_cast<Common::String *>(gen->GetObject());
asUINT pos = gen->GetArgDWord(0);
- string *other = reinterpret_cast<string*>(gen->GetArgAddress(1));
+ Common::String *other = reinterpret_cast<Common::String*>(gen->GetArgAddress(1));
StringInsert(pos, *other, *self);
}
static void StringErase_Generic(asIScriptGeneric *gen)
{
- string * self = static_cast<string *>(gen->GetObject());
+ Common::String * self = static_cast<Common::String *>(gen->GetObject());
asUINT pos = gen->GetArgDWord(0);
int count = int(gen->GetArgDWord(1));
StringErase(pos, count, *self);
@@ -945,80 +672,80 @@ static void StringErase_Generic(asIScriptGeneric *gen)
static void StringFindFirst_Generic(asIScriptGeneric * gen)
{
- string *find = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ Common::String *find = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
asUINT start = gen->GetArgDWord(1);
- string *self = reinterpret_cast<string *>(gen->GetObject());
+ Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindFirst(*find, start, *self);
}
static void StringFindLast_Generic(asIScriptGeneric * gen)
{
- string *find = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ Common::String *find = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
asUINT start = gen->GetArgDWord(1);
- string *self = reinterpret_cast<string *>(gen->GetObject());
+ Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindLast(*find, start, *self);
}
static void StringFindFirstOf_Generic(asIScriptGeneric * gen)
{
- string *find = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ Common::String *find = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
asUINT start = gen->GetArgDWord(1);
- string *self = reinterpret_cast<string *>(gen->GetObject());
+ Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindFirstOf(*find, start, *self);
}
static void StringFindLastOf_Generic(asIScriptGeneric * gen)
{
- string *find = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ Common::String *find = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
asUINT start = gen->GetArgDWord(1);
- string *self = reinterpret_cast<string *>(gen->GetObject());
+ Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindLastOf(*find, start, *self);
}
static void StringFindFirstNotOf_Generic(asIScriptGeneric * gen)
{
- string *find = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ Common::String *find = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
asUINT start = gen->GetArgDWord(1);
- string *self = reinterpret_cast<string *>(gen->GetObject());
+ Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindFirstNotOf(*find, start, *self);
}
static void StringFindLastNotOf_Generic(asIScriptGeneric * gen)
{
- string *find = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ Common::String *find = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
asUINT start = gen->GetArgDWord(1);
- string *self = reinterpret_cast<string *>(gen->GetObject());
+ Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindLastNotOf(*find, start, *self);
}
static void formatInt_Generic(asIScriptGeneric * gen)
{
asINT64 val = gen->GetArgQWord(0);
- string *options = reinterpret_cast<string*>(gen->GetArgAddress(1));
+ Common::String *options = reinterpret_cast<Common::String*>(gen->GetArgAddress(1));
asUINT width = gen->GetArgDWord(2);
- new(gen->GetAddressOfReturnLocation()) string(formatInt(val, *options, width));
+ new(gen->GetAddressOfReturnLocation()) Common::String(formatInt(val, *options, width));
}
static void formatUInt_Generic(asIScriptGeneric * gen)
{
asQWORD val = gen->GetArgQWord(0);
- string *options = reinterpret_cast<string*>(gen->GetArgAddress(1));
+ Common::String *options = reinterpret_cast<Common::String*>(gen->GetArgAddress(1));
asUINT width = gen->GetArgDWord(2);
- new(gen->GetAddressOfReturnLocation()) string(formatUInt(val, *options, width));
+ new(gen->GetAddressOfReturnLocation()) Common::String(formatUInt(val, *options, width));
}
static void formatFloat_Generic(asIScriptGeneric *gen)
{
double val = gen->GetArgDouble(0);
- string *options = reinterpret_cast<string*>(gen->GetArgAddress(1));
+ Common::String *options = reinterpret_cast<Common::String*>(gen->GetArgAddress(1));
asUINT width = gen->GetArgDWord(2);
asUINT precision = gen->GetArgDWord(3);
- new(gen->GetAddressOfReturnLocation()) string(formatFloat(val, *options, width, precision));
+ new(gen->GetAddressOfReturnLocation()) Common::String(formatFloat(val, *options, width, precision));
}
static void parseInt_Generic(asIScriptGeneric *gen)
{
- string *str = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ Common::String *str = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
asUINT base = gen->GetArgDWord(1);
asUINT *byteCount = reinterpret_cast<asUINT*>(gen->GetArgAddress(2));
gen->SetReturnQWord(parseInt(*str,base,byteCount));
@@ -1026,7 +753,7 @@ static void parseInt_Generic(asIScriptGeneric *gen)
static void parseUInt_Generic(asIScriptGeneric *gen)
{
- string *str = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ Common::String *str = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
asUINT base = gen->GetArgDWord(1);
asUINT *byteCount = reinterpret_cast<asUINT*>(gen->GetArgAddress(2));
gen->SetReturnQWord(parseUInt(*str, base, byteCount));
@@ -1034,7 +761,7 @@ static void parseUInt_Generic(asIScriptGeneric *gen)
static void parseFloat_Generic(asIScriptGeneric *gen)
{
- string *str = reinterpret_cast<string*>(gen->GetArgAddress(0));
+ Common::String *str = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
asUINT *byteCount = reinterpret_cast<asUINT*>(gen->GetArgAddress(1));
gen->SetReturnDouble(parseFloat(*str,byteCount));
}
@@ -1042,7 +769,7 @@ static void parseFloat_Generic(asIScriptGeneric *gen)
static void StringCharAtGeneric(asIScriptGeneric * gen)
{
unsigned int index = gen->GetArgDWord(0);
- string * self = static_cast<string *>(gen->GetObject());
+ Common::String * self = static_cast<Common::String *>(gen->GetObject());
if (index >= self->size())
{
@@ -1054,219 +781,179 @@ static void StringCharAtGeneric(asIScriptGeneric * gen)
}
else
{
- gen->SetReturnAddress(&(self->operator [](index)));
+ gen->SetReturnAddress(self->begin() + index);
}
}
static void AssignInt2StringGeneric(asIScriptGeneric *gen)
{
asINT64 *a = static_cast<asINT64*>(gen->GetAddressOfArg(0));
- string *self = static_cast<string*>(gen->GetObject());
- std::stringstream sstr;
- sstr << *a;
- *self = sstr.str();
+ Common::String *self = static_cast<Common::String*>(gen->GetObject());
+ *self = Common::String::format("%ld", *a);
gen->SetReturnAddress(self);
}
static void AssignUInt2StringGeneric(asIScriptGeneric *gen)
{
asQWORD *a = static_cast<asQWORD*>(gen->GetAddressOfArg(0));
- string *self = static_cast<string*>(gen->GetObject());
- std::stringstream sstr;
- sstr << *a;
- *self = sstr.str();
+ Common::String *self = static_cast<Common::String*>(gen->GetObject());
+ *self = Common::String::format("%lu", *a);
gen->SetReturnAddress(self);
}
static void AssignDouble2StringGeneric(asIScriptGeneric *gen)
{
double *a = static_cast<double*>(gen->GetAddressOfArg(0));
- string *self = static_cast<string*>(gen->GetObject());
- std::stringstream sstr;
- sstr << *a;
- *self = sstr.str();
+ Common::String *self = static_cast<Common::String*>(gen->GetObject());
+ *self = Common::String::format("%f", *a);
gen->SetReturnAddress(self);
}
static void AssignFloat2StringGeneric(asIScriptGeneric *gen)
{
float *a = static_cast<float*>(gen->GetAddressOfArg(0));
- string *self = static_cast<string*>(gen->GetObject());
- std::stringstream sstr;
- sstr << *a;
- *self = sstr.str();
+ Common::String *self = static_cast<Common::String*>(gen->GetObject());
+ *self = Common::String::format("%f", *a);
gen->SetReturnAddress(self);
}
static void AssignBool2StringGeneric(asIScriptGeneric *gen)
{
bool *a = static_cast<bool*>(gen->GetAddressOfArg(0));
- string *self = static_cast<string*>(gen->GetObject());
- std::stringstream sstr;
- sstr << (*a ? "true" : "false");
- *self = sstr.str();
+ Common::String *self = static_cast<Common::String*>(gen->GetObject());
+ *self = (*a ? "true" : "false");
gen->SetReturnAddress(self);
}
static void AddAssignDouble2StringGeneric(asIScriptGeneric * gen)
{
- double * a = static_cast<double *>(gen->GetAddressOfArg(0));
- string * self = static_cast<string *>(gen->GetObject());
- std::stringstream sstr;
- sstr << *a;
- *self += sstr.str();
+ double *a = static_cast<double*>(gen->GetAddressOfArg(0));
+ Common::String *self = static_cast<Common::String*>(gen->GetObject());
+ *self += Common::String::format("%f", *a);
gen->SetReturnAddress(self);
}
static void AddAssignFloat2StringGeneric(asIScriptGeneric * gen)
{
- float * a = static_cast<float *>(gen->GetAddressOfArg(0));
- string * self = static_cast<string *>(gen->GetObject());
- std::stringstream sstr;
- sstr << *a;
- *self += sstr.str();
+ float *a = static_cast<float*>(gen->GetAddressOfArg(0));
+ Common::String *self = static_cast<Common::String*>(gen->GetObject());
+ *self += Common::String::format("%f", *a);
gen->SetReturnAddress(self);
}
static void AddAssignInt2StringGeneric(asIScriptGeneric * gen)
{
asINT64 * a = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
- string * self = static_cast<string *>(gen->GetObject());
- std::stringstream sstr;
- sstr << *a;
- *self += sstr.str();
+ Common::String *self = static_cast<Common::String*>(gen->GetObject());
+ *self += Common::String::format("%ld", *a);
gen->SetReturnAddress(self);
}
static void AddAssignUInt2StringGeneric(asIScriptGeneric * gen)
{
asQWORD * a = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
- string * self = static_cast<string *>(gen->GetObject());
- std::stringstream sstr;
- sstr << *a;
- *self += sstr.str();
+ Common::String *self = static_cast<Common::String*>(gen->GetObject());
+ *self += Common::String::format("%lu", *a);
gen->SetReturnAddress(self);
}
static void AddAssignBool2StringGeneric(asIScriptGeneric * gen)
{
bool * a = static_cast<bool *>(gen->GetAddressOfArg(0));
- string * self = static_cast<string *>(gen->GetObject());
- std::stringstream sstr;
- sstr << (*a ? "true" : "false");
- *self += sstr.str();
+ Common::String * self = static_cast<Common::String *>(gen->GetObject());
+ *self += (*a ? "true" : "false");
gen->SetReturnAddress(self);
}
static void AddString2DoubleGeneric(asIScriptGeneric * gen)
{
- string * a = static_cast<string *>(gen->GetObject());
+ Common::String * a = static_cast<Common::String *>(gen->GetObject());
double * b = static_cast<double *>(gen->GetAddressOfArg(0));
- std::stringstream sstr;
- sstr << *a << *b;
- std::string ret_val = sstr.str();
+ Common::String ret_val = *a + Common::String::format("%f", *b);
gen->SetReturnObject(&ret_val);
}
static void AddString2FloatGeneric(asIScriptGeneric * gen)
{
- string * a = static_cast<string *>(gen->GetObject());
+ Common::String * a = static_cast<Common::String *>(gen->GetObject());
float * b = static_cast<float *>(gen->GetAddressOfArg(0));
- std::stringstream sstr;
- sstr << *a << *b;
- std::string ret_val = sstr.str();
+ Common::String ret_val = *a + Common::String::format("%f", *b);
gen->SetReturnObject(&ret_val);
}
static void AddString2IntGeneric(asIScriptGeneric * gen)
{
- string * a = static_cast<string *>(gen->GetObject());
+ Common::String * a = static_cast<Common::String *>(gen->GetObject());
asINT64 * b = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
- std::stringstream sstr;
- sstr << *a << *b;
- std::string ret_val = sstr.str();
+ Common::String ret_val = *a + Common::String::format("%ld", *b);
gen->SetReturnObject(&ret_val);
}
static void AddString2UIntGeneric(asIScriptGeneric * gen)
{
- string * a = static_cast<string *>(gen->GetObject());
+ Common::String * a = static_cast<Common::String *>(gen->GetObject());
asQWORD * b = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
- std::stringstream sstr;
- sstr << *a << *b;
- std::string ret_val = sstr.str();
+ Common::String ret_val = *a + Common::String::format("%lu", *b);
gen->SetReturnObject(&ret_val);
}
static void AddString2BoolGeneric(asIScriptGeneric * gen)
{
- string * a = static_cast<string *>(gen->GetObject());
+ Common::String * a = static_cast<Common::String *>(gen->GetObject());
bool * b = static_cast<bool *>(gen->GetAddressOfArg(0));
- std::stringstream sstr;
- sstr << *a << (*b ? "true" : "false");
- std::string ret_val = sstr.str();
+ Common::String ret_val = *a + (*b ? "true" : "false");
gen->SetReturnObject(&ret_val);
}
static void AddDouble2StringGeneric(asIScriptGeneric * gen)
{
double* a = static_cast<double *>(gen->GetAddressOfArg(0));
- string * b = static_cast<string *>(gen->GetObject());
- std::stringstream sstr;
- sstr << *a << *b;
- std::string ret_val = sstr.str();
+ Common::String * b = static_cast<Common::String *>(gen->GetObject());
+ Common::String ret_val = Common::String::format("%f", *a) + *b;
gen->SetReturnObject(&ret_val);
}
static void AddFloat2StringGeneric(asIScriptGeneric * gen)
{
float* a = static_cast<float *>(gen->GetAddressOfArg(0));
- string * b = static_cast<string *>(gen->GetObject());
- std::stringstream sstr;
- sstr << *a << *b;
- std::string ret_val = sstr.str();
+ Common::String * b = static_cast<Common::String *>(gen->GetObject());
+ Common::String ret_val = Common::String::format("%f", *a) + *b;
gen->SetReturnObject(&ret_val);
}
static void AddInt2StringGeneric(asIScriptGeneric * gen)
{
asINT64* a = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
- string * b = static_cast<string *>(gen->GetObject());
- std::stringstream sstr;
- sstr << *a << *b;
- std::string ret_val = sstr.str();
+ Common::String * b = static_cast<Common::String *>(gen->GetObject());
+ Common::String ret_val = Common::String::format("%ld", *a) + *b;
gen->SetReturnObject(&ret_val);
}
static void AddUInt2StringGeneric(asIScriptGeneric * gen)
{
asQWORD* a = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
- string * b = static_cast<string *>(gen->GetObject());
- std::stringstream sstr;
- sstr << *a << *b;
- std::string ret_val = sstr.str();
+ Common::String * b = static_cast<Common::String *>(gen->GetObject());
+ Common::String ret_val = Common::String::format("%lu", *a) + *b;
gen->SetReturnObject(&ret_val);
}
static void AddBool2StringGeneric(asIScriptGeneric * gen)
{
bool* a = static_cast<bool *>(gen->GetAddressOfArg(0));
- string * b = static_cast<string *>(gen->GetObject());
- std::stringstream sstr;
- sstr << (*a ? "true" : "false") << *b;
- std::string ret_val = sstr.str();
+ Common::String * b = static_cast<Common::String *>(gen->GetObject());
+ Common::String ret_val = (*a ? "true" : "false") + *b;
gen->SetReturnObject(&ret_val);
}
static void StringSubString_Generic(asIScriptGeneric *gen)
{
// Get the arguments
- string *str = (string*)gen->GetObject();
+ Common::String *str = (Common::String*)gen->GetObject();
asUINT start = *(int*)gen->GetAddressOfArg(0);
int count = *(int*)gen->GetAddressOfArg(1);
// Return the substring
- new(gen->GetAddressOfReturnLocation()) string(StringSubString(start, count, *str));
+ new(gen->GetAddressOfReturnLocation()) Common::String(StringSubString(start, count, *str));
}
void RegisterStdString_Generic(asIScriptEngine *engine)
@@ -1275,7 +962,7 @@ void RegisterStdString_Generic(asIScriptEngine *engine)
UNUSED_VAR(r);
// Register the string type
- r = engine->RegisterObjectType("string", sizeof(string), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 );
+ r = engine->RegisterObjectType("string", sizeof(Common::String), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 );
r = engine->RegisterStringFactory("string", GetStdStringFactorySingleton());
diff --git a/engines/hpl1/engine/system/Script.h b/engines/hpl1/engine/system/Script.h
index 7a402be50a3..6c35ae839cc 100644
--- a/engines/hpl1/engine/system/Script.h
+++ b/engines/hpl1/engine/system/Script.h
@@ -197,7 +197,7 @@
// Parameter Macros
// FIXME: string types
-#define SCRIPT_ARG_string(n) tString _arg##n = (*(std::string *)gen->GetArgObject(n)).c_str()
+#define SCRIPT_ARG_string(n) tString _arg##n = (*(Common::String *)gen->GetArgObject(n))
#define SCRIPT_ARG_float(n) float _arg##n = gen->GetArgFloat(n)
#define SCRIPT_ARG_int(n) int _arg##n = gen->GetArgDWord(n)
#define SCRIPT_ARG_bool(n) bool _arg##n = gen->GetArgByte(n)
Commit: eb78910594531182c4287f48f5b4e6b7de6e4095
https://github.com/scummvm/scummvm/commit/eb78910594531182c4287f48f5b4e6b7de6e4095
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:15+01:00
Commit Message:
HPL1: remove unused includes
Changed paths:
engines/hpl1/engine/game/ScriptFuncs.cpp
engines/hpl1/penumbra-overture/GameScripts.cpp
diff --git a/engines/hpl1/engine/game/ScriptFuncs.cpp b/engines/hpl1/engine/game/ScriptFuncs.cpp
index fb2c2d90e16..f6a15bc6616 100644
--- a/engines/hpl1/engine/game/ScriptFuncs.cpp
+++ b/engines/hpl1/engine/game/ScriptFuncs.cpp
@@ -25,8 +25,6 @@
* This file is part of HPL1 Engine.
*/
-#include <string>
-
#include "hpl1/engine/game/ScriptFuncs.h"
#include "hpl1/engine/game/Game.h"
diff --git a/engines/hpl1/penumbra-overture/GameScripts.cpp b/engines/hpl1/penumbra-overture/GameScripts.cpp
index efb1628ce57..ccb0bffe7a0 100644
--- a/engines/hpl1/penumbra-overture/GameScripts.cpp
+++ b/engines/hpl1/penumbra-overture/GameScripts.cpp
@@ -25,8 +25,6 @@
* This file is part of Penumbra Overture.
*/
-#include <string>
-
#include "hpl1/penumbra-overture/GameScripts.h"
#include "hpl1/engine/engine.h"
Commit: 9296d9aea477ea0df2559f803230bbdc61277c4d
https://github.com/scummvm/scummvm/commit/9296d9aea477ea0df2559f803230bbdc61277c4d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:15+01:00
Commit Message:
HPL1: improve Hpl1::std::*map erase method
Changed paths:
engines/hpl1/std/map.h
engines/hpl1/std/multimap.h
diff --git a/engines/hpl1/std/map.h b/engines/hpl1/std/map.h
index 56fe4527613..85d19ca17ab 100644
--- a/engines/hpl1/std/map.h
+++ b/engines/hpl1/std/map.h
@@ -124,10 +124,11 @@ public:
* Erases an entry in the map
*/
iterator erase(iterator it) {
- iterator next = it;
- ++next;
- _items.remove_at(it - begin());
- return next;
+ return _items.erase(it);
+ }
+
+ iterator erase(iterator first, iterator last) {
+ return _items.erase(first, last);
}
iterator erase(const Key &theKey) {
diff --git a/engines/hpl1/std/multimap.h b/engines/hpl1/std/multimap.h
index 239b49c2c8c..61e50999fb8 100644
--- a/engines/hpl1/std/multimap.h
+++ b/engines/hpl1/std/multimap.h
@@ -110,10 +110,11 @@ public:
* Erases an entry in the map
*/
iterator erase(iterator it) {
- iterator next = it;
- ++next;
- _items.remove_at(it - begin());
- return next;
+ return _items.erase(it);
+ }
+
+ iterator erase(iterator first, iterator last) {
+ return _items.erase(first, last);
}
iterator erase(const Key &theKey) {
Commit: eab1cbd3cf0e1613080ee4485b3dc334ef927e38
https://github.com/scummvm/scummvm/commit/eab1cbd3cf0e1613080ee4485b3dc334ef927e38
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:15+01:00
Commit Message:
HPL1: add removeIf to algorithm header
Changed paths:
engines/hpl1/algorithms.h
diff --git a/engines/hpl1/algorithms.h b/engines/hpl1/algorithms.h
index 5916ed82fc8..97ba51359ac 100644
--- a/engines/hpl1/algorithms.h
+++ b/engines/hpl1/algorithms.h
@@ -57,6 +57,15 @@ RandomIt upperBound(RandomIt begin, RandomIt end, V const &val, Comp comp = {})
}
}
+template<typename RandomIt, typename Pred>
+RandomIt removeIf(RandomIt begin, RandomIt end, Pred pred) {
+ for(auto i = begin; i != end; ++i) {
+ if (!pred(*i))
+ *begin++ = *i;
+ }
+ return begin;
+}
+
} // namespace Hpl1
#endif // HPL1_ALGORITHMS
\ No newline at end of file
Commit: d5762cd762b377cc133d6d9b4ca370551459e90d
https://github.com/scummvm/scummvm/commit/d5762cd762b377cc133d6d9b4ca370551459e90d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:16+01:00
Commit Message:
HPL1: fix heap use after free
Changed paths:
engines/hpl1/penumbra-overture/TriggerHandler.cpp
diff --git a/engines/hpl1/penumbra-overture/TriggerHandler.cpp b/engines/hpl1/penumbra-overture/TriggerHandler.cpp
index a8b081c50fd..129b332883a 100644
--- a/engines/hpl1/penumbra-overture/TriggerHandler.cpp
+++ b/engines/hpl1/penumbra-overture/TriggerHandler.cpp
@@ -27,6 +27,7 @@
#include "hpl1/penumbra-overture/TriggerHandler.h"
+#include "hpl1/algorithms.h"
#include "hpl1/penumbra-overture/GameEnemy.h"
#include "hpl1/penumbra-overture/Init.h"
#include "hpl1/penumbra-overture/MapHandler.h"
@@ -142,19 +143,15 @@ void cTriggerHandler::Update(float afTimeStep) {
//////////////////////////////////
// Go through triggers and remove when timer is out.
- tGameTriggerMapIt TriggerIt = m_mapTriggers.begin();
- for (; TriggerIt != m_mapTriggers.end();) {
- cGameTrigger *pTrigger = TriggerIt->second;
-
- pTrigger->mfTimeCount -= afTimeStep;
-
- if (pTrigger->mfTimeCount <= 0) {
- hplDelete(pTrigger);
- m_mapTriggers.erase(TriggerIt++);
- } else {
- ++TriggerIt;
+ auto const newEnd = Hpl1::removeIf(m_mapTriggers.begin(), m_mapTriggers.end(), [afTimeStep](tGameTriggerMap::value_type &pair) {
+ pair.second->mfTimeCount -= afTimeStep;
+ if (pair.second->mfTimeCount <= 0) {
+ hplDelete(pair.second);
+ return true;
}
- }
+ return false;
+ });
+ m_mapTriggers.erase(newEnd, m_mapTriggers.end());
}
//-----------------------------------------------------------------------
Commit: cb965171e97d85b2686d9dad07c3b386e7c4f0c6
https://github.com/scummvm/scummvm/commit/cb965171e97d85b2686d9dad07c3b386e7c4f0c6
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:16+01:00
Commit Message:
HPL1: remove std::map use in angelscript add-on
Changed paths:
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
index be8bd15958c..aebff8cb7be 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -15,9 +15,13 @@
// Usually where the variables are only used in debug mode.
#define UNUSED_VAR(x) (void)(x)
-#include <map>
+struct StrComp {
+ bool operator()(const Common::String* a, const Common::String* b) {
+ return *a < *b;
+ }
+};
-using map_t = std::map<Common::String, int>;
+using map_t = Hpl1::std::map<const Common::String*, int, StrComp>;
BEGIN_AS_NAMESPACE
class CStdStringFactory : public asIStringFactory
@@ -37,7 +41,7 @@ public:
// threads, so it is necessary to use a mutex.
asAcquireExclusiveLock();
- Common::String str(data, length);
+ Common::String* str = new Common::String(data, length); // deleted at line 74
map_t::iterator it = stringCache.find(str);
if (it != stringCache.end())
it->second++;
@@ -46,7 +50,7 @@ public:
asReleaseExclusiveLock();
- return reinterpret_cast<const void*>(&it->first);
+ return reinterpret_cast<const void*>(str);
}
int ReleaseStringConstant(const void *str)
@@ -60,14 +64,16 @@ public:
// threads, so it is necessary to use a mutex.
asAcquireExclusiveLock();
- map_t::iterator it = stringCache.find(*reinterpret_cast<const Common::String*>(str));
+ map_t::iterator it = stringCache.find(reinterpret_cast<const Common::String*>(str));
if (it == stringCache.end())
ret = asERROR;
else
{
it->second--;
- if (it->second == 0)
+ if (it->second == 0) {
+ delete it->first;
stringCache.erase(it);
+ }
}
asReleaseExclusiveLock();
Commit: 04c611f015dba5e2ee72e4809ca5191adcf22ed8
https://github.com/scummvm/scummvm/commit/04c611f015dba5e2ee72e4809ca5191adcf22ed8
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:16+01:00
Commit Message:
HPL1: fix insert method in Hpl1::std::map
Changed paths:
engines/hpl1/std/map.h
diff --git a/engines/hpl1/std/map.h b/engines/hpl1/std/map.h
index 85d19ca17ab..2df9125748b 100644
--- a/engines/hpl1/std/map.h
+++ b/engines/hpl1/std/map.h
@@ -139,11 +139,15 @@ public:
}
std::pair<iterator, bool> insert(const value_type &val) {
+ if (_items.begin() == nullptr) {
+ _items.push_back(val);
+ return {_items.begin(), true};
+ }
iterator it = this->lower_bound(val.first);
if (it == this->end() || !compareEqual(it->first, val.first)) {
size_t idx = it - this->begin();
_items.insert_at(idx, val);
- return {it, true};
+ return {this->begin() + idx, true};
}
return {it, false};
}
Commit: c96deb63e9a26ceda9948e8cd749961bc74b2f9c
https://github.com/scummvm/scummvm/commit/c96deb63e9a26ceda9948e8cd749961bc74b2f9c
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:16+01:00
Commit Message:
HPL1: fix memory leak
Changed paths:
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
index aebff8cb7be..f9a56ee114a 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -41,16 +41,17 @@ public:
// threads, so it is necessary to use a mutex.
asAcquireExclusiveLock();
- Common::String* str = new Common::String(data, length); // deleted at line 74
- map_t::iterator it = stringCache.find(str);
- if (it != stringCache.end())
+ Common::String str(data, length);
+ map_t::iterator it = stringCache.find(&str);
+ if (it != stringCache.end()) {
it->second++;
- else
- it = stringCache.insert(map_t::value_type(str, 1)).first;
-
+ } else {
+ // deleted in ReleaseStringConstant
+ it = stringCache.insert(map_t::value_type(new Common::String(data, length), 1)).first;
+ }
asReleaseExclusiveLock();
- return reinterpret_cast<const void*>(str);
+ return reinterpret_cast<const void*>(it->first);
}
int ReleaseStringConstant(const void *str)
Commit: 90d9e0407ae7994ff6b307a2ce5d58461291c368
https://github.com/scummvm/scummvm/commit/90d9e0407ae7994ff6b307a2ce5d58461291c368
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:16+01:00
Commit Message:
HPL1: remove unused system headers
Changed paths:
engines/hpl1/engine/impl/VertexBufferVBO.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
engines/hpl1/engine/resources/ResourceBase.h
diff --git a/engines/hpl1/engine/impl/VertexBufferVBO.cpp b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
index 474994d4022..03a2abc7a92 100644
--- a/engines/hpl1/engine/impl/VertexBufferVBO.cpp
+++ b/engines/hpl1/engine/impl/VertexBufferVBO.cpp
@@ -29,7 +29,6 @@
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/opengl.h"
-#include <memory.h>
#ifdef USE_OPENGL
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
index 77fa8853e6d..e06a4b30d92 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
@@ -1,4 +1,3 @@
-#include <string.h> // FIXME: Refactor to remove this system header
#include <assert.h> // assert() // FIXME: Refactor to remove this system header
#include "scriptarray.h"
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
index f9a56ee114a..9b87bbbf34d 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -1,8 +1,4 @@
#include "hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h"
-#include <assert.h> // assert() // FIXME: Refactor to remove this system header
-#include <string.h> // strstr() // FIXME: Refactor to remove this system header
-#include <stdio.h> // sprintf() // FIXME: Refactor to remove this system header
-#include <stdlib.h> // strtod() // FIXME: Refactor to remove this system header
#ifndef __psp2__
#include <locale.h> // setlocale()
#endif
diff --git a/engines/hpl1/engine/resources/ResourceBase.h b/engines/hpl1/engine/resources/ResourceBase.h
index 9c092991630..dd88f08eaaf 100644
--- a/engines/hpl1/engine/resources/ResourceBase.h
+++ b/engines/hpl1/engine/resources/ResourceBase.h
@@ -30,7 +30,6 @@
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/SystemTypes.h"
-//#include <time.h>
namespace hpl {
Commit: a252ea4cf398e3e931ac741fd1a4a1ff20d78038
https://github.com/scummvm/scummvm/commit/a252ea4cf398e3e931ac741fd1a4a1ff20d78038
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:16+01:00
Commit Message:
HPL1: remove unused files
Changed paths:
R engines/hpl1/engine/impl/PBuffer.cpp
R engines/hpl1/engine/impl/PBuffer.h
R engines/hpl1/engine/impl/VideoStreamTheora.cpp
R engines/hpl1/engine/impl/VideoStreamTheora.h
engines/hpl1/engine/impl/SDLTexture.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/impl/PBuffer.cpp b/engines/hpl1/engine/impl/PBuffer.cpp
deleted file mode 100644
index 659ad0325de..00000000000
--- a/engines/hpl1/engine/impl/PBuffer.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#if 0
-#include "hpl1/engine/impl/PBuffer.h"
-#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
-
-
-namespace hpl {
-
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
-
- //-----------------------------------------------------------------------
-
- /**
- * All pBuffers must be created before any of them are set as a render target!
- *
- */
- cPBuffer::cPBuffer(iLowLevelGraphics* apLowLevelGraphics,bool abShareObjects,bool abUseMipMaps, bool abUseDepth,bool abUseStencil)
- {
-#ifdef WIN32
- mDeviceContext = 0;
- mGLContext =0;
-
- mbShareObjects = abShareObjects;
- mpLowLevelGraphics = apLowLevelGraphics;
-
- //Now we chose the pixel format attributes:
- //Format:
- mvAttribFormat.push_back(WGL_DRAW_TO_PBUFFER_ARB);
- mvAttribFormat.push_back(true);
-
- mvAttribFormat.push_back(WGL_BIND_TO_TEXTURE_RGBA_ARB);
- mvAttribFormat.push_back(true);
- //Use this if the texture is a rectangle: (nVidia only!)
- //mvAttribFormat.push_back(WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV);
- //mvAttribFormat.push_back(true);
-
- mvAttribFormat.push_back(WGL_DEPTH_BITS_ARB);
- mvAttribFormat.push_back(24);
- mvAttribFormat.push_back(WGL_STENCIL_BITS_ARB);
- mvAttribFormat.push_back(8);
- mvAttribFormat.push_back(WGL_COLOR_BITS_ARB);
- mvAttribFormat.push_back(32);
-
- //Buffer:
- mvAttribBuffer.push_back(WGL_PBUFFER_LARGEST_ARB);
- mvAttribBuffer.push_back(true);
- mvAttribBuffer.push_back(WGL_TEXTURE_FORMAT_ARB);
- mvAttribBuffer.push_back(WGL_TEXTURE_RGBA_ARB);
-
- mvAttribBuffer.push_back(WGL_TEXTURE_TARGET_ARB);
- mvAttribBuffer.push_back(WGL_TEXTURE_2D_ARB);
- //Use this if the texture is a rectangle: (nVidia only!)
- //mvAttribBuffer.push_back(WGL_TEXTURE_RECTANGLE_NV);
-
-
- mvAttribBuffer.push_back(WGL_MIPMAP_TEXTURE_ARB);
- mvAttribBuffer.push_back(false);
-
- //Use this if you have mipmaps:
- /*mvAttribBuffer.push_back(WGL_MIPMAP_LEVEL_ARB);
- mvAttribBuffer.push_back(0);*/
-
- //Set end of attributes vectors
- mvAttribFormat.push_back(0);
- mvAttribBuffer.push_back(0);
-#elif defined(__linux__)
-#endif
- }
-
- cPBuffer::~cPBuffer()
- {
-#ifdef WIN32
- //This should not be deleted if it is shared.
- wglDeleteContext(mGLContext);
- wglReleasePbufferDCARB(mPBuffer, mDeviceContext);
- wglDestroyPbufferARB(mPBuffer);
-#elif defined(__linux__)
-#endif
- }
-
- //-----------------------------------------------------------------------
-
- //////////////////////////////////////////////////////////////////////////
- // PUBLIC METHODS
- //////////////////////////////////////////////////////////////////////////
-
- //-----------------------------------------------------------------------
-
- bool cPBuffer::Init(unsigned int alWidth,unsigned int alHeight, cColor aCol)
- {
-#ifdef WIN32
- unsigned int lFormatNum=0;
- int lFormat=0;
-
- mlWidth = alWidth;
- mlHeight = alHeight;
-
- HDC CurrentHdc = wglGetCurrentDC();
- HGLRC CurrentGGlRc = wglGetCurrentContext();
-
- //Set the pixel format:
- wglChoosePixelFormatARB(CurrentHdc, &mvAttribFormat[0], NULL, 1, &lFormat, &lFormatNum);
- if(lFormatNum==0){
- Error("Couldn't find any pixel format!\n");
- return false;
- }
-
- //Create the buffer
- mPBuffer = wglCreatePbufferARB(CurrentHdc, lFormat, mlWidth, mlHeight, &mvAttribBuffer[0]);
- if (!mPBuffer)
- {
- int err = GetLastError();
- Error("pbuffer creation error!\n");
- return false;
- }
-
- //Get the Device Context
- mDeviceContext = wglGetPbufferDCARB(mPBuffer);
- if(!mDeviceContext){
- Error("Some DC error!\n");
- }
-
- //Get the GL Context
- mGLContext = wglCreateContext(mDeviceContext);
- if(!mGLContext){
- Error("Some GLRC error!\n");
- }
-
- if(mbShareObjects){
- if(!wglShareLists(CurrentGGlRc, mGLContext))
- {
- Error("Error sharing lists.\n");
- }
- }
-
- //Check the real dimensions of the PBuffer
- wglQueryPbufferARB(mPBuffer, WGL_PBUFFER_WIDTH_ARB, &mlWidth);
- wglQueryPbufferARB(mPBuffer, WGL_PBUFFER_HEIGHT_ARB, &mlHeight);
-
- //Init some GL stuff with the Buffer.
-#ifdef WIN32
- HDC OldHDC = wglGetCurrentDC();
- HGLRC OldGLRC = wglGetCurrentContext();
-#endif
- MakeCurrentContext();
-
- if(mbShareObjects)
- {
- cLowLevelGraphicsSDL* pSDLGfx = static_cast<cLowLevelGraphicsSDL*>(mpLowLevelGraphics);
- pSDLGfx->SetupGL();
- }
-
- mpLowLevelGraphics->SetClearColor(aCol);
- mpLowLevelGraphics->ClearScreen();
-
- wglMakeCurrent(OldHDC,OldGLRC);
-#elif defined(__linux__)
- return false;
-#endif
-
- return true;
- }
-
- //-----------------------------------------------------------------------
-
- int cPBuffer::MakeCurrentContext()
- {
-#ifdef WIN32
- return wglMakeCurrent(mDeviceContext, mGLContext);
-#else
- return 0;
- //return glXMakeCurrent(dpy, gPBuffer, glCtx);
-#endif
- }
-
- //-----------------------------------------------------------------------
-
- void cPBuffer::Bind()
- {
-#ifdef WIN32
- if(!wglBindTexImageARB(mPBuffer, WGL_FRONT_LEFT_ARB))
- {
- Error("Error Binding pbuffer...\n");
- }
-#elif defined(__linux__)
-#endif
- }
-
- //-----------------------------------------------------------------------
-
- void cPBuffer::UnBind()
- {
-#ifdef WIN32
- if(wglReleaseTexImageARB(mPBuffer, WGL_FRONT_LEFT_ARB)==false)
- {
- Error("Error UnBinding pbuffer...\n");
- }
-#elif defined(__linux__)
-#endif
- }
-
-
- //-----------------------------------------------------------------------
-}
-
-#endif
diff --git a/engines/hpl1/engine/impl/PBuffer.h b/engines/hpl1/engine/impl/PBuffer.h
deleted file mode 100644
index 838a6db71e1..00000000000
--- a/engines/hpl1/engine/impl/PBuffer.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#if 0
-#ifndef HPL_P_BUFFER_H
-#define HPL_P_BUFFER_H
-
-#include <GL/GLee.h>
-#include <vector>
-
-#include "hpl1/engine/graphics/GraphicsTypes.h"
-namespace hpl {
- class iLowLevelGraphics;
-
- class cPBuffer
- {
- public:
- cPBuffer(iLowLevelGraphics* apLowLevelGraphics,bool abShareObjects,bool abUseMipMaps=false,bool abUseDepth=true,bool abUseStencil=true);
- ~cPBuffer();
-
- bool Init(unsigned int alWidth,unsigned int alHeight, cColor aCol);
-
- int MakeCurrentContext();
-
- void Bind();
- void UnBind();
-
- private:
-#ifdef WIN32
- HDC mDeviceContext;
- HGLRC mGLContext;
- HPBUFFERARB mPBuffer;
-#elif defined(__linux__)
- Display *gDpy;
- GLXContext glCtx;
- GLXPbuffer gPBuffer;
-#endif
-
- int mlWidth;
- int mlHeight;
-
- bool mbShareObjects;
- iLowLevelGraphics* mpLowLevelGraphics;
-
- Common::Array<int> mvAttribBuffer;
- Common::Array<int> mvAttribFormat;
- };
-
-};
-#endif // HPL_P_BUFFER_H
-#endif
diff --git a/engines/hpl1/engine/impl/SDLTexture.h b/engines/hpl1/engine/impl/SDLTexture.h
index 94d2561ab20..96ab85c4554 100644
--- a/engines/hpl1/engine/impl/SDLTexture.h
+++ b/engines/hpl1/engine/impl/SDLTexture.h
@@ -30,7 +30,6 @@
#include "hpl1/engine/graphics/Texture.h"
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
-#include "hpl1/engine/impl/PBuffer.h"
#include "hpl1/engine/graphics/bitmap2D.h"
#include "common/scummsys.h"
diff --git a/engines/hpl1/engine/impl/VideoStreamTheora.cpp b/engines/hpl1/engine/impl/VideoStreamTheora.cpp
deleted file mode 100644
index 8103d84c363..00000000000
--- a/engines/hpl1/engine/impl/VideoStreamTheora.cpp
+++ /dev/null
@@ -1,735 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#if 0
-#include "hpl1/engine/impl/VideoStreamTheora.h"
-
-#include "hpl1/engine/graphics/Texture.h"
-#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/system/LowLevelSystem.h"
-
-#pragma comment(lib, "libogg.lib")
-#pragma comment(lib, "libtheora.lib")
-
-namespace hpl {
-
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
-
- //-----------------------------------------------------------------------
-
- cVideoStreamTheora_Loader::cVideoStreamTheora_Loader()
- {
- //////////////////////////////////////
- // Set up extensions
- mvExtensions.push_back("ogm");
-
- //////////////////////////////////////
- // Calculate YUV -> RBG
-
- //////////////////////////////
- //Create buffers
- mpYuvToR = hplNewArray( unsigned char,256*256);
- mpYuvToB = hplNewArray( unsigned char,256*256);
-
- mpYuv_G_UV = hplNewArray( unsigned short,256*256);
- mpYuv_G_Y_UV = hplNewArray( unsigned char,256*1024);
-
- //////////////////////////////
- //Values for R and B
- float fY, fI,fJ,fUV;
- for(int i=0; i<256; ++i)
- for(int y=0; y<256; ++y)
- {
- fY = 1.164f * ((float)y -16);
- fI = (float)i;
-
- //I = V
- mpYuvToR[y + i*256] = (unsigned char)cMath::Clamp(fY + 1.596f*(fI - 128),0,255);
-
- //I = U
- mpYuvToB[y + i*256] = (unsigned char)cMath::Clamp(fY + 2.018f * (fI - 128),0,255);
- }
-
- ///////////////////////////////////////////////////
- //Split the Green computation into two buffer
- float fMinVal = 0.813f * (-128.0f) - 0.391f * 127;
- float fMaxVal = 0.813f * (127.0f) + 0.391f * 128;
-
- //Green UV part
- for(int i=0; i<256; ++i)
- for(int j=0; j<256; ++j)
- {
- //I= U J = V
- fJ = (float)j;
- fI = (float)i;
-
- float fUV = 0.813f*(fJ - 128) - 0.391f * (fI - 128);
- mpYuv_G_UV[i*256 + j] = (unsigned short)cMath::Clamp(((fUV - fMinVal) / (fMaxVal - fMinVal)) * 1023.0f,0,1023.0f);
- }
-
- //Green Y * UV part
- for(int i=0; i<1024; ++i)
- for(int y=0; y<256; ++y)
- {
- fY = 1.164f * ((float)y -16);
- fUV = (float)i;
- fUV = (fUV / 1023.0f) * (fMaxVal - fMinVal) + fMinVal;
-
- mpYuv_G_Y_UV[i*256 + y] = (unsigned char)cMath::Clamp(fY - fUV, 0, 255);
- }
-
- }
-
- cVideoStreamTheora_Loader::~cVideoStreamTheora_Loader()
- {
- hplDeleteArray(mpYuvToR);
- hplDeleteArray(mpYuvToB);
-
- hplDeleteArray(mpYuv_G_UV);
- hplDeleteArray(mpYuv_G_Y_UV);
- }
-
- //-----------------------------------------------------------------------
-
-
- //////////////////////////////////////////////////////////////////////////
- // CONSTRUCTORS
- //////////////////////////////////////////////////////////////////////////
-
- //-----------------------------------------------------------------------
-
- cVideoStreamTheora::cVideoStreamTheora(tString asName, cVideoStreamTheora_Loader* apLoader) : iVideoStream(asName)
- {
- mpLoader = apLoader;
-
- mpFile = NULL;
-
- mbLooping = false;
- mbPaused = false;
- mbPlaying = false;
-
- mlVideobufReady =0;
- mlVideobufGranulePos=-1;
- mfVideobufTime=0;
-
- mfTime = 0;
-
- mlBufferSize = 4096;
-
- mbVideoFrameReady = false;
-
- mpFrameBuffer = NULL;
-
- //Theora structs that we want until class i deleted.
- theora_comment_init(&mTheoraComment);
- theora_info_init(&mTheoraInfo);
-
- ogg_sync_init(&mOggSyncState);
- }
-
- //-----------------------------------------------------------------------
-
-
- cVideoStreamTheora::~cVideoStreamTheora()
- {
- if(mpFile) fclose(mpFile);
-
- ogg_sync_clear(&mOggSyncState);
-
- theora_comment_clear(&mTheoraComment);
- theora_info_clear(&mTheoraInfo);
-
- ogg_stream_clear(&mTheoraStreamState);
-
- if(mbVideoLoaded)
- {
- theora_clear(&mTheoraState);
- if(mpFrameBuffer) hplDeleteArray(mpFrameBuffer);
- }
- }
-
- //-----------------------------------------------------------------------
-
- //////////////////////////////////////////////////////////////////////////
- // PUBLIC METHODS
- //////////////////////////////////////////////////////////////////////////
-
- //-----------------------------------------------------------------------
-
- bool cVideoStreamTheora::LoadFromFile(tString asFilePath)
- {
- ////////////////////////////////
- //Try to open the file
- mpFile = fopen(asFilePath.c_str(),"rb");
- if(mpFile==NULL)
- {
- return false;
- }
-
- msFilePath = asFilePath;
-
- ////////////////////////////////
- //Init stream
-
- //Set up variables
- mbVideoLoaded = false;
-
- //Get headers
- if(GetHeaders()==false) return false;
-
- //Initialize decoders and attributes
- if(InitDecoders()==false) return false;
-
-
- return true;
- }
-
- //-----------------------------------------------------------------------
-
- void cVideoStreamTheora::Update(float afTimeStep)
- {
- if(mbPlaying==false || mbPaused) return;
-
- mfTime += afTimeStep;
- ////////////////////////////////
- // Theora Decode packets until the video is ahead of real time.
- // (This could be skipped once non-keyframe seeks can be made?)
- while(!mlVideobufReady && mfVideobufTime < mfTime)
- {
- //Get first packet and decode,
- ogg_packet packet;
- if(ogg_stream_packetout(&mTheoraStreamState,&packet)>0)
- {
- if(theora_decode_packetin(&mTheoraState,&packet)==0)
- {
- //Get new time for current fram position.
- mlVideobufGranulePos = mTheoraState.granulepos;
- mfVideobufTime = theora_granule_time(&mTheoraState,mlVideobufGranulePos);
-
- mbVideoFrameReady = true;
- }
- }
- //No packets left, get new page.
- else
- {
- //Get Next page
- ogg_page page;
- if(ogg_sync_pageout(&mOggSyncState,&page) > 0)
- {
- QueuePage(&page);
- }
- //No pages left, read more buffer data.
- else
- {
- int bytes= BufferData(mpFile,&mOggSyncState);
- //Fill streams with pages.
- if(bytes!=0)
- {
- while(ogg_sync_pageout(&mOggSyncState,&page)>0) QueuePage(&page);
- }
- //No more buffer data in file, stop video
- else
- {
- if(mbLooping==false) mbPlaying = false;
- ResetStreams();
- }
-
- }
- }
- }
-
-
- ////////////////////////////////
- // Theora Check for end of file.
- if(!mlVideobufReady && feof(mpFile))
- {
- if(mbLooping==false) mbPlaying = false;
- ResetStreams();
- }
- }
-
- //-----------------------------------------------------------------------
-
- void cVideoStreamTheora::Play()
- {
- mbPlaying = true;
- }
-
- //-----------------------------------------------------------------------
-
- void cVideoStreamTheora::Stop()
- {
- mbPlaying = false;
- ResetStreams();
- }
-
- //-----------------------------------------------------------------------
-
- void cVideoStreamTheora::Pause(bool abX)
- {
- mbPaused = abX;
- }
- //-----------------------------------------------------------------------
-
-
- void cVideoStreamTheora::SetLoop(bool abX)
- {
- mbLooping = abX;
- }
-
- //-----------------------------------------------------------------------
-
- void cVideoStreamTheora::CopyToTexture(iTexture *apTexture)
- {
- if(mbVideoLoaded==false || mpFrameBuffer ==NULL) return;
-
- if(mbVideoFrameReady)
- {
- DrawFrameToBuffer();
- apTexture->SetPixels2D(0,0,mvSize,eColorDataFormat_RGB,mpFrameBuffer);
- mbVideoFrameReady = false;
- }
- }
-
- //-----------------------------------------------------------------------
-
- //////////////////////////////////////////////////////////////////////////
- // PRIVATE METHODS
- //////////////////////////////////////////////////////////////////////////
-
- //-----------------------------------------------------------------------
-
- void cVideoStreamTheora::DrawFrameToBuffer()
- {
- ////////////////////////////////
- //Get YUV buffer
- yuv_buffer yuvBuffer;
- theora_decode_YUVout(&mTheoraState,&yuvBuffer);
-
- /////////////////////////////
- // Set up variables
-
- //This is offsets in the SOURCE DATA
- size_t lCropOffsetY = mTheoraInfo.offset_x + yuvBuffer.y_stride * mTheoraInfo.offset_y;
- size_t lCropOffsetUV = mTheoraInfo.offset_x/2 + yuvBuffer.uv_stride * (mTheoraInfo.offset_y/2);
-
- //Pointers to conversion buffers.
- unsigned char* pYuvToR = mpLoader->mpYuvToR;
- unsigned char* pYuvToB = mpLoader->mpYuvToB;
-
- unsigned short* pYuv_G_UV = mpLoader->mpYuv_G_UV;
- unsigned char* pYuv_G_Y_UV = mpLoader->mpYuv_G_Y_UV;
-
- /////////////////////////////////
- //Write Y to R
-
- //Get start of buffers
- unsigned char *pSrcBuffer = mpFrameBuffer;
- unsigned char *pYBuffer = yuvBuffer.y + lCropOffsetY;
-
- //Set up counters
- int lXCount = mvSize.x;
- int lYCount = mvSize.y;
-
- //Precalculate some values
- const int lYBufferAdd = yuvBuffer.y_stride - mvSize.x;
-
- //Go through Y surface of copy to R in frame buffer
- while(lYCount)
- {
- *pSrcBuffer = *pYBuffer;
-
- pSrcBuffer+=3;
- pYBuffer++;
-
- --lXCount;
- if(!lXCount)
- {
- pYBuffer += lYBufferAdd;
- lXCount = mvSize.x;
- --lYCount;
- }
- }
-
- /////////////////////////////////
- //Write UV and use R as Y
-
- //Get start of buffers
- pSrcBuffer = mpFrameBuffer;
- unsigned char *pUBuffer = yuvBuffer.u + lCropOffsetUV;
- unsigned char *pVBuffer = yuvBuffer.v + lCropOffsetUV;
-
- //Setup counters
- lXCount = mvSize.x/2;
- lYCount = mvSize.y/2;
-
- //Precalculate some values
- const int lXRowAdd = mvSize.x/2;
- const int lSourceRowSize = mvSize.x*3;
- const int lUVBufferAdd = yuvBuffer.uv_stride - mvSize.x/2;
- unsigned char y;
-
- //Go through UV surfaces and convert to RGB in frame buffer
- while(lYCount)
- {
- const unsigned short u_add = (*pUBuffer) <<8;
- const unsigned short v_add = (*pVBuffer) <<8;
- const unsigned int g_uv_add = (pYuv_G_UV[u_add + (*pVBuffer)])<<8;
-
- //Here we draw to a 2x2 large piece of source.
- y = *pSrcBuffer;
- pSrcBuffer[0] = pYuvToR[y + v_add];
- pSrcBuffer[1] = pYuv_G_Y_UV[y +(g_uv_add)];
- pSrcBuffer[2] = pYuvToB[y + u_add];
-
- pSrcBuffer+= 3;
- y = *pSrcBuffer;
- pSrcBuffer[0] = pYuvToR[y + v_add];
- pSrcBuffer[1] = pYuv_G_Y_UV[y +(g_uv_add)];
- pSrcBuffer[2] = pYuvToB[y + u_add];
-
- pSrcBuffer += lSourceRowSize - 3;
- y = *pSrcBuffer;
- pSrcBuffer[0] = pYuvToR[y + v_add];
- pSrcBuffer[1] = pYuv_G_Y_UV[y +(g_uv_add)];
- pSrcBuffer[2] = pYuvToB[y + u_add];
-
- pSrcBuffer += 3;
- y = *pSrcBuffer;
- pSrcBuffer[0] = pYuvToR[y + v_add];
- pSrcBuffer[1] = pYuv_G_Y_UV[y +(g_uv_add)];
- pSrcBuffer[2] = pYuvToB[y + u_add];
-
- pSrcBuffer-= lSourceRowSize;
-
- pSrcBuffer+=3;
-
- pUBuffer++;
- pVBuffer++;
-
- --lXCount;
- if(!lXCount)
- {
- pSrcBuffer+= lSourceRowSize;
- pVBuffer += lUVBufferAdd;
- pUBuffer += lUVBufferAdd;
- lXCount = lXRowAdd;
- --lYCount;
- }
- }
- }
-
- //-----------------------------------------------------------------------
-
- /**
- * Gets BufferSize bytes to a sync buffer and checks how many bytes that
- * where written to it.
- */
- int cVideoStreamTheora::BufferData(FILE *pFile ,ogg_sync_state *apOggSynchState)
- {
- ogg_page tempPage;
- if (ogg_sync_pageout(apOggSynchState, &tempPage) ==1)
- {
- Warning("Still pages in buffer do not read another one! Go tell the programmer he messed up!\n");
- return 0;
- }
-
- //Get new buffer of BufferSize bytes
- char *pBuffer = ogg_sync_buffer(apOggSynchState,mlBufferSize);
- int lBytes= (int)fread(pBuffer,1,mlBufferSize,pFile);
-
- //Tell sync state we just wrote BufferSize bytes, so file (data?) pointer is increased by that.
- ogg_sync_wrote(apOggSynchState,lBytes);
-
- return lBytes;
- }
-
- //-----------------------------------------------------------------------
-
- /**
- * Queues a page in one of the stream, right now there is on the Theora stream
- * but could add a Vorbis stream here too.
- * pushing a page can be done blindly; a stream won't accept a page that does not belong to it.
- */
- void cVideoStreamTheora::QueuePage(ogg_page *apPage)
- {
- if(mbVideoLoaded)
- {
- if(ogg_stream_pagein(&mTheoraStreamState,apPage)!=0)
- {
- //I think the page can simply be skipped. Data is destroyed with buffer.... I think :S
- }
- }
-
- }
-
- //-----------------------------------------------------------------------
-
- /**
- * Initializes data needed for decoding and sets up video properties
- * Must be called after GetHeaders()
- * Could add init for Vorbis here too...
- */
- bool cVideoStreamTheora::InitDecoders()
- {
- if(mbVideoLoaded)
- {
- theora_decode_init(&mTheoraState,&mTheoraInfo); //Init the Theora state based on info
-
- mvSize = cVector2l(mTheoraInfo.frame_width, mTheoraInfo.frame_height);
-
- mpFrameBuffer = hplNewArray(unsigned char,mvSize.x * mvSize.y *3);
- }
- else
- {
- //Tear down the partial Theora setup
- theora_info_clear(&mTheoraInfo);
- theora_comment_clear(&mTheoraComment);
- }
-
- return true;
- }
-
- //-----------------------------------------------------------------------
-
- /**
- * Reinitializes all stream data and searches past header packets.
- * Vorbis must be reset here too if used.
- */
- void cVideoStreamTheora::ResetStreams()
- {
- /////////////////////////////////////
- // Clear all remaining packages and pages
- ogg_packet packet;
- while(ogg_stream_packetout(&mTheoraStreamState,&packet)>0);
-
- ogg_page testPage;
- while(ogg_sync_pageout(&mOggSyncState,&testPage));
-
-
- ////////////////////////////////
- //Reset variables
- mfTime =0;
- mfVideobufTime =0;
- mbVideoFrameReady = false;
-
- ////////////////////////////////
- //Clear all data structures
-
- //Setup stream and get past headers
- ogg_stream_clear(&mTheoraStreamState);
- ogg_sync_reset(&mOggSyncState);
-
- theora_clear(&mTheoraState);
- theora_decode_init(&mTheoraState,&mTheoraInfo);
-
- //Get start of file
- fclose(mpFile);
- mpFile = fopen(msFilePath.c_str(),"rb");
-
- BufferData(mpFile,&mOggSyncState);
-
- //////////////////////////////////
- // Get the streams and get past headers.
- int lPackCount=0;
- while(lPackCount<3)
- {
- ogg_page page;
- while(lPackCount<3 && ogg_sync_pageout(&mOggSyncState,&page)>0)
- {
- ////////////////////////////
- //Check if stream is Theora
- if(lPackCount == 0)
- {
- //Current page is at beggning of stream.
- if(ogg_page_bos(&page))
- {
- ogg_stream_state testStream;
- ogg_packet testPacket;
-
- //Init test stream
- ogg_stream_init(&testStream,ogg_page_serialno(&page));
- ogg_stream_pagein(&testStream,&page); //Put current page into stream.
- ogg_stream_packetout(&testStream,&testPacket); //Put first packet out in testPacket.
-
- //Check if packet is a header.
- if(testPacket.packet[0] & 0x80) {
- memcpy(&mTheoraStreamState,&testStream,sizeof(testStream)); //Copy contents of test stream to Theora stream
- lPackCount =1;
- }
- //If no type we are interested in, skip it.
- else {
- ogg_stream_clear(&testStream);
- }
- }
- else
- {
- }
- }
- ////////////////////////////
- //Get past all header packets.
- if(lPackCount > 0)
- {
- QueuePage(&page);
-
- while(lPackCount<3)
- {
- ogg_packet testPacket;
- int lRet = ogg_stream_packetout(&mTheoraStreamState, &testPacket);
- if(lRet < 1) break; //No packets left, we need new page.
- ++lPackCount;
- }
- }
- }
- //Fill buffer with more data from file.
- BufferData(mpFile,&mOggSyncState);
- }
- }
-
- //-----------------------------------------------------------------------
-
- /**
- * This function goes through all streams found in the file and looks for first Theora header.
- * Here one could add a search for Vorbis headers too.
- */
- bool cVideoStreamTheora::GetHeaders()
- {
- int lTheoraHeaderPackets =0;
-
- //////////////////////////////////////////
- // Initialize all usable streams and get headers
- bool bFoundHeaders=false;
- while(!bFoundHeaders)
- {
- int lRet = BufferData(mpFile,&mOggSyncState);
- if(lRet==0)
- {
- Error("Found no header in video file '%s'\n",msFilePath.c_str());
- return false;
- }
- //Get first page in sync state buffer
- ogg_page page;
- while(ogg_sync_pageout(&mOggSyncState,&page)>0)
- {
-
- /////////////////////////////////
- // Check if page is beginning of stream, else queue it.
- if(!ogg_page_bos(&page))
- {
- //Don't leak the page; get it into the appropriate stream
- //Does this only mean that if we have already intialized a stream and the next page is for it,
- //we cannot just leave it be or else that stream will be missing info, yeah that must be it.
- QueuePage(&page);
-
- continue;
- }
-
- /////////////////////////////////
- //Init the test stream with page
- ogg_stream_state testStream;
- ogg_stream_init(&testStream,ogg_page_serialno(&page)); //Init stream using logical serial to stream page belongs to.
- ogg_stream_pagein(&testStream,&page); //Put current page into stream.
-
- /////////////////////////////////
- //Get first packet in stream and check if it is a header.
- ogg_packet testPacket;
- ogg_stream_packetout(&testStream,&testPacket);
-
- if(!mbVideoLoaded && theora_decode_header(&mTheoraInfo,&mTheoraComment,&testPacket)>=0)
- {
- memcpy(&mTheoraStreamState,&testStream,sizeof(testStream)); //Copy contents of test stream to Theora stream
- lTheoraHeaderPackets = 1;
- mbVideoLoaded = true;
- }
- else
- {
- //We have some stream we do not want, destroy it.
- ogg_stream_clear(&testStream);
- }
-
- if(mbVideoLoaded) bFoundHeaders = true;
- }
- }
-
- //////////////////////////////////////////
- // Get remaining header data
- while(lTheoraHeaderPackets && lTheoraHeaderPackets<3)
- {
- int lRet;
- ogg_packet packet;
-
- //////////////////////////////////////////
- //Look for further Theora headers
- while( lTheoraHeaderPackets && lTheoraHeaderPackets<3)
- {
- //////////////////////////
- // Get next packet
- lRet = ogg_stream_packetout(&mTheoraStreamState,&packet);
- if(lRet == 0) break; //End of page, need to load new page.
-
- if(lRet<0){
- Error("Error parsing Theora stream headers in '%s'; corrupt stream?\n",msFilePath.c_str());
- return false;
- }
- if(theora_decode_header(&mTheoraInfo,&mTheoraComment,&packet))
- {
- Error("Error parsing Theora stream headers in '%s'; corrupt stream?\n",msFilePath.c_str());
- return false;
- }
- lTheoraHeaderPackets++;
- if(lTheoraHeaderPackets==3)break;
- }
-
- //////////////////////
- // Try to get next page.
- ogg_page page;
- if(ogg_sync_pageout(&mOggSyncState,&page)>0)
- {
- QueuePage(&page);
- }
- else
- {
- //No pages left, load more data.
- int lRet=BufferData(mpFile,&mOggSyncState);
- if(lRet==0)
- {
- Error("End of file while searching for codec headers in '%s'.\n",msFilePath.c_str());
- return false;
- }
- }
- }
-
-
- return true;
- }
-
- //-----------------------------------------------------------------------
-
-}
-#endif
diff --git a/engines/hpl1/engine/impl/VideoStreamTheora.h b/engines/hpl1/engine/impl/VideoStreamTheora.h
deleted file mode 100644
index ea554808824..00000000000
--- a/engines/hpl1/engine/impl/VideoStreamTheora.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#if 0 // ndef HPL_VIDEO_STREAM_THEORA_H
-#define HPL_VIDEO_STREAM_THEORA_H
-
-#include "hpl1/engine/graphics/VideoStream.h"
-
-//#include <theora/theora.h>
-
-namespace hpl {
-
- //-----------------------------------------
- class cVideoStreamTheora_Loader;
-
- class cVideoStreamTheora : public iVideoStream
- {
- public:
- cVideoStreamTheora(tString asName, cVideoStreamTheora_Loader* apLoader);
- ~cVideoStreamTheora();
-
- bool LoadFromFile(tString asFilePath);
-
- void Update(float afTimeStep);
-
- void Play();
- void Stop();
-
- void Pause(bool abX);
- bool IsPaused(){ return mbPaused;}
-
- void SetLoop(bool abX);
- bool IsLooping(){ return mbLooping;}
-
- void CopyToTexture(iTexture *apTexture);
-
- private:
- void DrawFrameToBuffer();
- int BufferData(FILE *pFile ,ogg_sync_state *apOggSynchState);
- void QueuePage(ogg_page *apPage);
- bool GetHeaders();
- bool InitDecoders();
- void ResetStreams();
-
- cVideoStreamTheora_Loader *mpLoader;
-
- FILE *mpFile;
-
- bool mbLooping;
- bool mbPaused;
- bool mbPlaying;
-
- float mfTime;
-
- unsigned char *mpFrameBuffer;
-
- ogg_sync_state mOggSyncState;
- ogg_stream_state mTheoraStreamState;
- theora_info mTheoraInfo;
- theora_comment mTheoraComment;
- theora_state mTheoraState;
-
- int mlVideobufReady;
- ogg_int64_t mlVideobufGranulePos;
- double mfVideobufTime;
-
- bool mbVideoLoaded;
- bool mbVideoFrameReady;
- int mlBufferSize;
- };
-
- //-----------------------------------------
-
- class cVideoStreamTheora_Loader : public iVideoStreamLoader
- {
- friend class cVideoStreamTheora;
- public:
- cVideoStreamTheora_Loader();
- ~cVideoStreamTheora_Loader();
-
- iVideoStream* Create(const tString& asName){ return hplNew( cVideoStreamTheora, (asName,this) );}
-
- private:
- unsigned char* mpYuvToR;
- unsigned char* mpYuvToB;
-
- unsigned short* mpYuv_G_UV;
- unsigned char* mpYuv_G_Y_UV;
- };
-
- //-----------------------------------------
-
-};
-#endif // HPL_VIDEO_STREAM_THEORA_H
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 0e730a3307e..943f0b8ee6a 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -113,7 +113,6 @@ MODULE_OBJS := \
engine/impl/OpenALSoundChannel.o \
engine/impl/OpenALSoundData.o \
engine/impl/OpenALSoundEnvironment.o \
- engine/impl/PBuffer.o \
engine/impl/PhysicsBodyNewton.o \
engine/impl/PhysicsControllerNewton.o \
engine/impl/PhysicsJointBallNewton.o \
@@ -126,7 +125,6 @@ MODULE_OBJS := \
engine/impl/SqScript.o \
engine/impl/VertexBufferOGL.o \
engine/impl/VertexBufferVBO.o \
- engine/impl/VideoStreamTheora.o \
engine/libraries/angelscript/add-ons/scriptstdstring.o \
engine/libraries/angelscript/add-ons/scripthelper.o \
engine/libraries/angelscript/add-ons/scriptarray.o \
Commit: 80c5519886be4164872d4c99d11906830c73b9cb
https://github.com/scummvm/scummvm/commit/80c5519886be4164872d4c99d11906830c73b9cb
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:16+01:00
Commit Message:
HPL1: replace qsort with Common::sort
Changed paths:
engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
index 4b6c14c8416..818611c2c29 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
@@ -48,7 +48,7 @@
#include "as_builder.h"
#include "as_scriptcode.h"
-#include <cstdlib> // qsort
+#include "common/algorithm.h"
BEGIN_AS_NAMESPACE
@@ -841,11 +841,7 @@ int asCScriptFunction::FindNextLineWithCode(int line) const
for( asUINT n = 1; n < scriptData->lineNumbers.GetLength(); n += 2 )
lineNbrs.PushLast(scriptData->lineNumbers[n]&0xFFFFF);
- struct C
- {
- static int cmp(const void *a, const void *b) { return *(const int*)a - *(const int*)b; }
- };
- std::qsort(&lineNbrs[0], lineNbrs.GetLength(), sizeof(int), C::cmp);
+ Common::sort(&lineNbrs[0], &lineNbrs[0] + lineNbrs.GetLength());
if( line < lineNbrs[0] && line < (scriptData->declaredAt&0xFFFFF)) return -1;
if( line > lineNbrs[lineNbrs.GetLength()-1] ) return -1;
Commit: e6064bd2913a66a05b6d3d049a304a89a8a1fb64
https://github.com/scummvm/scummvm/commit/e6064bd2913a66a05b6d3d049a304a89a8a1fb64
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:16+01:00
Commit Message:
HPL1: fix missing return statement
Changed paths:
engines/hpl1/algorithms.h
diff --git a/engines/hpl1/algorithms.h b/engines/hpl1/algorithms.h
index 97ba51359ac..4e1d873691d 100644
--- a/engines/hpl1/algorithms.h
+++ b/engines/hpl1/algorithms.h
@@ -55,6 +55,7 @@ RandomIt upperBound(RandomIt begin, RandomIt end, V const &val, Comp comp = {})
else
end = mid;
}
+ return begin;
}
template<typename RandomIt, typename Pred>
@@ -68,4 +69,4 @@ RandomIt removeIf(RandomIt begin, RandomIt end, Pred pred) {
} // namespace Hpl1
-#endif // HPL1_ALGORITHMS
\ No newline at end of file
+#endif // HPL1_ALGORITHMS
Commit: 4f27acda362d0977209268e0fdf4ad9cdc1a3e79
https://github.com/scummvm/scummvm/commit/4f27acda362d0977209268e0fdf4ad9cdc1a3e79
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:17+01:00
Commit Message:
HPL1: replace uint with unsigned
this fixes build errors on windows
Changed paths:
engines/hpl1/engine/libraries/newton/physics/dgCollision.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollision.h b/engines/hpl1/engine/libraries/newton/physics/dgCollision.h
index 0b9e0f5c4f6..1d2a70399a6 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollision.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollision.h
@@ -176,7 +176,8 @@ typedef void(dgApi *OnDebugCollisionMeshCallback)(void *userData, int vertexCoun
class dgCollisionBoundPlaneCache {
public:
dgCollisionBoundPlaneCache() {
- for (uint i = 0; i < sizeof(m_planes)/sizeof(m_planes[0]); i++) m_planes[i] = dgPlane(0.0, 0.0, 0.0, 0.0);
+ for (unsigned i = 0; i < sizeof(m_planes) / sizeof(m_planes[0]); i++)
+ m_planes[i] = dgPlane(0.0, 0.0, 0.0, 0.0);
}
dgPlane m_planes[2];
};
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
index 2b048f56052..759e9ca64b9 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
@@ -42,7 +42,8 @@ dgCollisionMesh::dgCollisionConvexPolygon::dgCollisionConvexPolygon(dgMemoryAllo
m_isEdgeIntersection = false;
m_rtti |= dgCollisionConvexPolygon_RTTI;
- for(uint i = 0; i < (sizeof(m_localPoly)/sizeof(m_localPoly[0])); i++) m_localPoly[i] = dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f));
+ for(unsigned i = 0; i < (sizeof(m_localPoly)/sizeof(m_localPoly[0])); i++)
+ m_localPoly[i] = dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f));
m_normal = dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f));
// m_aabbP0 = dgVector (dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f));
// m_aabbP1 = dgVector (dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f));
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgConstraint.h b/engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
index bf8de08e88b..43db8bb5d78 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
@@ -65,15 +65,21 @@ class dgConstraintInfo
{
m_attachMatrix_0 = dgGetZeroMatrix();
m_attachMatrix_1 = dgGetZeroMatrix();
- for (uint i = 0; i < ARRAYSIZE(m_minLinearDof); i++) m_minLinearDof[i] = dgFloat32(0.0);
- for (uint i = 0; i < ARRAYSIZE(m_maxLinearDof); i++) m_maxLinearDof[i] = dgFloat32(0.0);
- for (uint i = 0; i < ARRAYSIZE(m_minAngularDof); i++) m_minAngularDof[i] = dgFloat32(0.0);
- for (uint i = 0; i < ARRAYSIZE(m_maxAngularDof); i++) m_maxAngularDof[i] = dgFloat32(0.0);
+ for (unsigned i = 0; i < ARRAYSIZE(m_minLinearDof); i++)
+ m_minLinearDof[i] = dgFloat32(0.0);
+ for (unsigned i = 0; i < ARRAYSIZE(m_maxLinearDof); i++)
+ m_maxLinearDof[i] = dgFloat32(0.0);
+ for (unsigned i = 0; i < ARRAYSIZE(m_minAngularDof); i++)
+ m_minAngularDof[i] = dgFloat32(0.0);
+ for (unsigned i = 0; i < ARRAYSIZE(m_maxAngularDof); i++)
+ m_maxAngularDof[i] = dgFloat32(0.0);
m_attachBody_0 = nullptr;
m_attachBody_1 = nullptr;
- for (uint i = 0; i < ARRAYSIZE(m_extraParameters); i++) m_extraParameters[i] = dgFloat32(0.0);
+ for (unsigned i = 0; i < ARRAYSIZE(m_extraParameters); i++)
+ m_extraParameters[i] = dgFloat32(0.0);
m_collideCollisionOn = dgInt32(0);
- for (uint i = 0; i < ARRAYSIZE(m_discriptionType); i++) m_discriptionType[i] = 0;
+ for (unsigned i = 0; i < ARRAYSIZE(m_discriptionType); i++)
+ m_discriptionType[i] = 0;
}
};
Commit: 47049227b226cf19a3cb3a6b492fe20cb808aa29
https://github.com/scummvm/scummvm/commit/47049227b226cf19a3cb3a6b492fe20cb808aa29
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:17+01:00
Commit Message:
HPL1: replace c++ limits header with c equivalent
Changed paths:
engines/hpl1/engine/math/Math.cpp
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index 98e9850afd9..945fad5c291 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -25,11 +25,10 @@
* This file is part of HPL1 Engine.
*/
+#include <limits.h>
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
-#include <limits> // FIXME: Refactor to remove this system header
#include "hpl1/hpl1.h"
-#include <limits>
namespace hpl {
@@ -48,8 +47,8 @@ int cMath::RandRectl(int alMin, int alMax) {
//-----------------------------------------------------------------------
float cMath::RandRectf(float afMin, float afMax) {
- float fRand = static_cast<float>(Hpl1::g_engine->getRandomNumber(std::numeric_limits<uint32>::max()))
- / static_cast<float>(std::numeric_limits<uint32>::max());
+ float fRand = static_cast<float>(Hpl1::g_engine->getRandomNumber(UINT_MAX))
+ / static_cast<float>(UINT_MAX);
return afMin + fRand * (afMax - afMin);
}
Commit: b8843c8eb41336f4d6650d37243eee916ac1d7e1
https://github.com/scummvm/scummvm/commit/b8843c8eb41336f4d6650d37243eee916ac1d7e1
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:17+01:00
Commit Message:
HPL1: fix string compairison
Changed paths:
engines/hpl1/engine/system/SerializeClass.cpp
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index 185beba1ff1..d11144dbeba 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -1020,7 +1020,7 @@ cSerializeMemberField *cSerializeClass::GetMemberField(const tString &asName, cS
while (classIt.HasNext()) {
cSerializeMemberField *pField = classIt.GetNext();
- if (asName == pField->msName)
+ if (asName == pField->msName.c_str())
return pField;
}
Commit: aec5a0f7ac52816031daf1a91dd8a1909ebacf28
https://github.com/scummvm/scummvm/commit/aec5a0f7ac52816031daf1a91dd8a1909ebacf28
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:17+01:00
Commit Message:
HPL1: add shaders to Makefile.common and scummvm.rc
Changed paths:
Makefile.common
dists/scummvm.rc
diff --git a/Makefile.common b/Makefile.common
index bfcafac18c5..3088435fd04 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -510,6 +510,9 @@ endif
ifdef ENABLE_PLAYGROUND3D
DIST_FILES_SHADERS+=$(wildcard $(srcdir)/engines/playground3d/shaders/*)
endif
+ifdef ENABLE_HPL1
+DIST_FILES_SHADERS+=$(wildcard $(srcdir)/engines/hpl1/engine/impl/shaders/*)
+endif
endif
.PHONY: all clean distclean plugins dist-src clean-toplevel manual
diff --git a/dists/scummvm.rc b/dists/scummvm.rc
index 50c879a0537..bf6ba794001 100644
--- a/dists/scummvm.rc
+++ b/dists/scummvm.rc
@@ -196,6 +196,82 @@ shaders/playground3d_cube.vertex FILE "engines/playground3d/shaders/pl
shaders/playground3d_fade.fragment FILE "engines/playground3d/shaders/playground3d_fade.fragment"
shaders/playground3d_fade.vertex FILE "engines/playground3d/shaders/playground3d_fade.vertex"
#endif
+#if PLUGIN_ENABLED_STATIC(HPL1)
+shaders/hpl1_Ambient_Color.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Ambient_Color.fragment"
+shaders/hpl1_Bump2D_Light.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Bump2D_Light.fragment"
+shaders/hpl1_Bump2D_Light.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Bump2D_Light.vertex"
+shaders/hpl1_BumpColorSpec_Light.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_BumpColorSpec_Light.fragment"
+shaders/hpl1_BumpColorSpec_Light_Spot.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_BumpColorSpec_Light_Spot.fragment"
+shaders/hpl1_BumpSpec2D_Light.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_BumpSpec2D_Light.fragment"
+shaders/hpl1_BumpSpec2D_Light.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_BumpSpec2D_Light.vertex"
+shaders/hpl1_BumpSpec_Light.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_BumpSpec_Light.fragment"
+shaders/hpl1_BumpSpec_Light_Spot.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_BumpSpec_Light_Spot.fragment"
+shaders/hpl1_BumpSpec_Light_Spot_pass2.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_BumpSpec_Light_Spot_pass2.fragment"
+shaders/hpl1_Bump_Light.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Bump_Light.fragment"
+shaders/hpl1_Bump_Light_Spot.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Bump_Light_Spot.fragment"
+shaders/hpl1_Bump_Light_Spot_pass2.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Bump_Light_Spot_pass2.fragment"
+shaders/hpl1_DiffuseSpec_Light.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light.fragment"
+shaders/hpl1_DiffuseSpec_Light.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light.vertex"
+shaders/hpl1_DiffuseSpec_Light_Spot.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light_Spot.fragment"
+shaders/hpl1_DiffuseSpec_Light_Spot.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light_Spot.vertex"
+shaders/hpl1_DiffuseSpec_Light_Spot_pass2.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_DiffuseSpec_Light_Spot_pass2.fragment"
+shaders/hpl1_Diffuse_Color.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Color.fragment"
+shaders/hpl1_Diffuse_Color.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Color.vertex"
+shaders/hpl1_Diffuse_ColorMul.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Diffuse_ColorMul.vertex"
+shaders/hpl1_Diffuse_EnvMap_Reflect.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Diffuse_EnvMap_Reflect.fragment"
+shaders/hpl1_Diffuse_EnvMap_Reflect.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Diffuse_EnvMap_Reflect.vertex"
+shaders/hpl1_Diffuse_Light.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light.fragment"
+shaders/hpl1_Diffuse_Light.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light.vertex"
+shaders/hpl1_Diffuse_Light_Spot.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot.fragment"
+shaders/hpl1_Diffuse_Light_Spot.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot.vertex"
+shaders/hpl1_Diffuse_Light_Spot_pass1.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot_pass1.fragment"
+shaders/hpl1_Diffuse_Light_Spot_pass2.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Diffuse_Light_Spot_pass2.fragment"
+shaders/hpl1_Fallback01_Bump_Light.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Bump_Light.fragment"
+shaders/hpl1_Fallback01_Diffuse_Light_Spot.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_Spot.fragment"
+shaders/hpl1_Fallback01_Diffuse_Light_Spot_p2.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_Spot_p2.vertex"
+shaders/hpl1_Fallback01_Diffuse_Light_p1.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p1.fragment"
+shaders/hpl1_Fallback01_Diffuse_Light_p1.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p1.vertex"
+shaders/hpl1_Fallback01_Diffuse_Light_p2.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p2.fragment"
+shaders/hpl1_Fallback01_Diffuse_Light_p2.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback01_Diffuse_Light_p2.vertex"
+shaders/hpl1_Fallback02_DIffuse_Light_Spot_p2.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback02_DIffuse_Light_Spot_p2.fragment"
+shaders/hpl1_Fallback02_DIffuse_Light_Spot_p3.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback02_DIffuse_Light_Spot_p3.fragment"
+shaders/hpl1_Fallback02_Diffuse_Light_Spot_p2.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_Spot_p2.vertex"
+shaders/hpl1_Fallback02_Diffuse_Light_Spot_p3.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_Spot_p3.vertex"
+shaders/hpl1_Fallback02_Diffuse_Light_p1.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_p1.fragment"
+shaders/hpl1_Fallback02_Diffuse_Light_p1.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_p1.vertex"
+shaders/hpl1_Fallback02_Diffuse_Light_p2.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Fallback02_Diffuse_Light_p2.vertex"
+shaders/hpl1_Fog_Solid.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Fog_Solid.fragment"
+shaders/hpl1_Fog_Solid.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Fog_Solid.vertex"
+shaders/hpl1_Fog_Trans.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans.vertex"
+shaders/hpl1_Fog_Trans_Alpha.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans_Alpha.fragment"
+shaders/hpl1_Fog_Trans_Mod.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans_Mod.fragment"
+shaders/hpl1_Fog_Trans_ModX2.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Fog_Trans_ModX2.fragment"
+shaders/hpl1_PostEffect_Bloom.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.fragment"
+shaders/hpl1_PostEffect_Bloom.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Bloom.vertex"
+shaders/hpl1_PostEffect_Blur.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur.vertex"
+shaders/hpl1_PostEffect_Blur_2D.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_2D.fragment"
+shaders/hpl1_PostEffect_Blur_Rect.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Blur_Rect.fragment"
+shaders/hpl1_PostEffect_DoF.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_DoF.fragment"
+shaders/hpl1_PostEffect_DoF.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_DoF.vertex"
+shaders/hpl1_PostEffect_Fallback01_Blur_2D.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_2D.fragment"
+shaders/hpl1_PostEffect_Fallback01_Blur_Rect.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Fallback01_Blur_Rect.fragment"
+shaders/hpl1_PostEffect_Motion.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.fragment"
+shaders/hpl1_PostEffect_Motion.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion.vertex"
+shaders/hpl1_PostEffect_Motion_staticloop.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Motion_staticloop.fragment"
+shaders/hpl1_PostEffect_Offset.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Offset.fragment"
+shaders/hpl1_PostEffect_Offset.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_PostEffect_Offset.vertex"
+shaders/hpl1_ShadowExtrude.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_ShadowExtrude.fragment"
+shaders/hpl1_ShadowExtrude.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_ShadowExtrude.vertex"
+shaders/hpl1_Water_Diffuse.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Water_Diffuse.fragment"
+shaders/hpl1_Water_Diffuse.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Water_Diffuse.vertex"
+shaders/hpl1_Water_Fog.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_Water_Fog.fragment"
+shaders/hpl1_Water_Fog.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_Water_Fog.vertex"
+shaders/hpl1_refract.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_refract.fragment"
+shaders/hpl1_refract.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_refract.vertex"
+shaders/hpl1_refract_special.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_refract_special.fragment"
+shaders/hpl1_refract_water.fragment FILE "engines/hpl1/engine/impl/shaders/hpl1_refract_water.fragment"
+shaders/hpl1_refract_water.vertex FILE "engines/hpl1/engine/impl/shaders/hpl1_refract_water.vertex"
+#endif
#endif
#endif
Commit: 7e75e4684d1f0a1afed3aac2ff668b3a91867842
https://github.com/scummvm/scummvm/commit/7e75e4684d1f0a1afed3aac2ff668b3a91867842
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:17+01:00
Commit Message:
HPL1: Run astyle over libraries
Changed paths:
engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.h
engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
engines/hpl1/engine/libraries/angelscript/angelscript.h
engines/hpl1/engine/libraries/angelscript/sources/as_array.h
engines/hpl1/engine/libraries/angelscript/sources/as_atomic.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_atomic.h
engines/hpl1/engine/libraries/angelscript/sources/as_builder.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_builder.h
engines/hpl1/engine/libraries/angelscript/sources/as_bytecode.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_bytecode.h
engines/hpl1/engine/libraries/angelscript/sources/as_callfunc.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_callfunc.h
engines/hpl1/engine/libraries/angelscript/sources/as_compiler.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_compiler.h
engines/hpl1/engine/libraries/angelscript/sources/as_config.h
engines/hpl1/engine/libraries/angelscript/sources/as_configgroup.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_configgroup.h
engines/hpl1/engine/libraries/angelscript/sources/as_context.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_context.h
engines/hpl1/engine/libraries/angelscript/sources/as_criticalsection.h
engines/hpl1/engine/libraries/angelscript/sources/as_datatype.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_datatype.h
engines/hpl1/engine/libraries/angelscript/sources/as_debug.h
engines/hpl1/engine/libraries/angelscript/sources/as_gc.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_gc.h
engines/hpl1/engine/libraries/angelscript/sources/as_generic.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_generic.h
engines/hpl1/engine/libraries/angelscript/sources/as_globalproperty.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_map.h
engines/hpl1/engine/libraries/angelscript/sources/as_memory.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_memory.h
engines/hpl1/engine/libraries/angelscript/sources/as_module.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_module.h
engines/hpl1/engine/libraries/angelscript/sources/as_namespace.h
engines/hpl1/engine/libraries/angelscript/sources/as_objecttype.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_objecttype.h
engines/hpl1/engine/libraries/angelscript/sources/as_outputbuffer.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_outputbuffer.h
engines/hpl1/engine/libraries/angelscript/sources/as_parser.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_parser.h
engines/hpl1/engine/libraries/angelscript/sources/as_property.h
engines/hpl1/engine/libraries/angelscript/sources/as_restore.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_restore.h
engines/hpl1/engine/libraries/angelscript/sources/as_scriptcode.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_scriptcode.h
engines/hpl1/engine/libraries/angelscript/sources/as_scriptengine.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_scriptengine.h
engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_scriptfunction.h
engines/hpl1/engine/libraries/angelscript/sources/as_scriptnode.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_scriptnode.h
engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.h
engines/hpl1/engine/libraries/angelscript/sources/as_string.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_string.h
engines/hpl1/engine/libraries/angelscript/sources/as_string_util.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_string_util.h
engines/hpl1/engine/libraries/angelscript/sources/as_symboltable.h
engines/hpl1/engine/libraries/angelscript/sources/as_texts.h
engines/hpl1/engine/libraries/angelscript/sources/as_thread.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_thread.h
engines/hpl1/engine/libraries/angelscript/sources/as_tokendef.h
engines/hpl1/engine/libraries/angelscript/sources/as_tokenizer.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_tokenizer.h
engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_typeinfo.h
engines/hpl1/engine/libraries/angelscript/sources/as_variablescope.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_variablescope.h
engines/hpl1/engine/libraries/newton/Newton.cpp
engines/hpl1/engine/libraries/newton/Newton.h
engines/hpl1/engine/libraries/newton/NewtonClass.cpp
engines/hpl1/engine/libraries/newton/NewtonClass.h
engines/hpl1/engine/libraries/newton/core/dg.h
engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.h
engines/hpl1/engine/libraries/newton/core/dgArray.h
engines/hpl1/engine/libraries/newton/core/dgCRC.cpp
engines/hpl1/engine/libraries/newton/core/dgCRC.h
engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.cpp
engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.h
engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.cpp
engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.h
engines/hpl1/engine/libraries/newton/core/dgDebug.cpp
engines/hpl1/engine/libraries/newton/core/dgDebug.h
engines/hpl1/engine/libraries/newton/core/dgDelaunayTetrahedralization.cpp
engines/hpl1/engine/libraries/newton/core/dgDelaunayTetrahedralization.h
engines/hpl1/engine/libraries/newton/core/dgGeneralMatrix.cpp
engines/hpl1/engine/libraries/newton/core/dgGeneralMatrix.h
engines/hpl1/engine/libraries/newton/core/dgGeneralVector.cpp
engines/hpl1/engine/libraries/newton/core/dgGeneralVector.h
engines/hpl1/engine/libraries/newton/core/dgGoogol.cpp
engines/hpl1/engine/libraries/newton/core/dgGoogol.h
engines/hpl1/engine/libraries/newton/core/dgGraph.h
engines/hpl1/engine/libraries/newton/core/dgHeap.h
engines/hpl1/engine/libraries/newton/core/dgIntersections.cpp
engines/hpl1/engine/libraries/newton/core/dgIntersections.h
engines/hpl1/engine/libraries/newton/core/dgList.h
engines/hpl1/engine/libraries/newton/core/dgMatrix.cpp
engines/hpl1/engine/libraries/newton/core/dgMatrix.h
engines/hpl1/engine/libraries/newton/core/dgMemory.cpp
engines/hpl1/engine/libraries/newton/core/dgMemory.h
engines/hpl1/engine/libraries/newton/core/dgNode.cpp
engines/hpl1/engine/libraries/newton/core/dgNode.h
engines/hpl1/engine/libraries/newton/core/dgPathFinder.h
engines/hpl1/engine/libraries/newton/core/dgPlane.h
engines/hpl1/engine/libraries/newton/core/dgPolygonSoupBuilder.cpp
engines/hpl1/engine/libraries/newton/core/dgPolygonSoupBuilder.h
engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
engines/hpl1/engine/libraries/newton/core/dgPolyhedra.cpp
engines/hpl1/engine/libraries/newton/core/dgPolyhedra.h
engines/hpl1/engine/libraries/newton/core/dgPolyhedraMassProperties.cpp
engines/hpl1/engine/libraries/newton/core/dgPolyhedraMassProperties.h
engines/hpl1/engine/libraries/newton/core/dgQuaternion.cpp
engines/hpl1/engine/libraries/newton/core/dgQuaternion.h
engines/hpl1/engine/libraries/newton/core/dgRandom.cpp
engines/hpl1/engine/libraries/newton/core/dgRandom.h
engines/hpl1/engine/libraries/newton/core/dgRef.cpp
engines/hpl1/engine/libraries/newton/core/dgRef.h
engines/hpl1/engine/libraries/newton/core/dgRefCounter.cpp
engines/hpl1/engine/libraries/newton/core/dgRefCounter.h
engines/hpl1/engine/libraries/newton/core/dgRtti.h
engines/hpl1/engine/libraries/newton/core/dgSPDMatrix.cpp
engines/hpl1/engine/libraries/newton/core/dgSPDMatrix.h
engines/hpl1/engine/libraries/newton/core/dgSimd_Instrutions.h
engines/hpl1/engine/libraries/newton/core/dgSmallDeterminant.cpp
engines/hpl1/engine/libraries/newton/core/dgSmallDeterminant.h
engines/hpl1/engine/libraries/newton/core/dgSphere.cpp
engines/hpl1/engine/libraries/newton/core/dgSphere.h
engines/hpl1/engine/libraries/newton/core/dgStack.h
engines/hpl1/engine/libraries/newton/core/dgThreads.cpp
engines/hpl1/engine/libraries/newton/core/dgThreads.h
engines/hpl1/engine/libraries/newton/core/dgTree.cpp
engines/hpl1/engine/libraries/newton/core/dgTree.h
engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
engines/hpl1/engine/libraries/newton/core/dgTypes.h
engines/hpl1/engine/libraries/newton/core/dgVector.h
engines/hpl1/engine/libraries/newton/physics/dgBallConstraint.cpp
engines/hpl1/engine/libraries/newton/physics/dgBallConstraint.h
engines/hpl1/engine/libraries/newton/physics/dgBilateralConstraint.cpp
engines/hpl1/engine/libraries/newton/physics/dgBilateralConstraint.h
engines/hpl1/engine/libraries/newton/physics/dgBody.cpp
engines/hpl1/engine/libraries/newton/physics/dgBody.h
engines/hpl1/engine/libraries/newton/physics/dgBodyMasterList.cpp
engines/hpl1/engine/libraries/newton/physics/dgBodyMasterList.h
engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.cpp
engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.h
engines/hpl1/engine/libraries/newton/physics/dgCollision.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollision.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionBVH.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionBVH.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionBox.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionBox.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionChamferCylinder.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompound.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompound.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionCone.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionCone.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexHull.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexHull.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexModifier.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionConvexModifier.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionCylinder.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionCylinder.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionEllipse.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionEllipse.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionHeightField.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionHeightField.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionNull.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionNull.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionSphere.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionSphere.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.h
engines/hpl1/engine/libraries/newton/physics/dgConnectorConstraint.cpp
engines/hpl1/engine/libraries/newton/physics/dgConnectorConstraint.h
engines/hpl1/engine/libraries/newton/physics/dgConstraint.cpp
engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
engines/hpl1/engine/libraries/newton/physics/dgContact.h
engines/hpl1/engine/libraries/newton/physics/dgCorkscrewConstraint.cpp
engines/hpl1/engine/libraries/newton/physics/dgCorkscrewConstraint.h
engines/hpl1/engine/libraries/newton/physics/dgHingeConstraint.cpp
engines/hpl1/engine/libraries/newton/physics/dgHingeConstraint.h
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect2.cpp
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect3.cpp
engines/hpl1/engine/libraries/newton/physics/dgMeshEffectSolidTree.cpp
engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.h
engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
engines/hpl1/engine/libraries/newton/physics/dgPointToCurveConstraint.cpp
engines/hpl1/engine/libraries/newton/physics/dgPointToCurveConstraint.h
engines/hpl1/engine/libraries/newton/physics/dgSlidingConstraint.cpp
engines/hpl1/engine/libraries/newton/physics/dgSlidingConstraint.h
engines/hpl1/engine/libraries/newton/physics/dgUniversalConstraint.cpp
engines/hpl1/engine/libraries/newton/physics/dgUniversalConstraint.h
engines/hpl1/engine/libraries/newton/physics/dgUpVectorConstraint.cpp
engines/hpl1/engine/libraries/newton/physics/dgUpVectorConstraint.h
engines/hpl1/engine/libraries/newton/physics/dgUserConstraint.cpp
engines/hpl1/engine/libraries/newton/physics/dgUserConstraint.h
engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
engines/hpl1/engine/libraries/newton/physics/dgWorld.h
engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.h
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
index e06a4b30d92..76e74228b28 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
@@ -18,8 +18,7 @@ static asALLOCFUNC_t userAlloc = asAllocMem;
static asFREEFUNC_t userFree = asFreeMem;
// Allows the application to set which memory routines should be used by the array object
-void CScriptArray::SetMemoryFunctions(asALLOCFUNC_t allocFunc, asFREEFUNC_t freeFunc)
-{
+void CScriptArray::SetMemoryFunctions(asALLOCFUNC_t allocFunc, asFREEFUNC_t freeFunc) {
userAlloc = allocFunc;
userFree = freeFunc;
}
@@ -27,15 +26,13 @@ void CScriptArray::SetMemoryFunctions(asALLOCFUNC_t allocFunc, asFREEFUNC_t free
static void RegisterScriptArray_Native(asIScriptEngine *engine);
static void RegisterScriptArray_Generic(asIScriptEngine *engine);
-struct SArrayBuffer
-{
+struct SArrayBuffer {
asDWORD maxElements;
asDWORD numElements;
asBYTE data[1];
};
-struct SArrayCache
-{
+struct SArrayCache {
asIScriptFunction *cmpFunc;
asIScriptFunction *eqFunc;
int cmpFuncReturnCode; // To allow better error message in case of multiple matches
@@ -47,75 +44,66 @@ struct SArrayCache
// through 1999 for this purpose, so we should be fine.
const asPWORD ARRAY_CACHE = 1000;
-static void CleanupTypeInfoArrayCache(asITypeInfo *type)
-{
- SArrayCache *cache = reinterpret_cast<SArrayCache*>(type->GetUserData(ARRAY_CACHE));
- if( cache )
- {
+static void CleanupTypeInfoArrayCache(asITypeInfo *type) {
+ SArrayCache *cache = reinterpret_cast<SArrayCache *>(type->GetUserData(ARRAY_CACHE));
+ if (cache) {
cache->~SArrayCache();
userFree(cache);
}
}
-CScriptArray* CScriptArray::Create(asITypeInfo *ti, asUINT length)
-{
+CScriptArray *CScriptArray::Create(asITypeInfo *ti, asUINT length) {
// Allocate the memory
void *mem = userAlloc(sizeof(CScriptArray));
- if( mem == 0 )
- {
+ if (mem == 0) {
asIScriptContext *ctx = asGetActiveContext();
- if( ctx )
+ if (ctx)
ctx->SetException("Out of memory");
return 0;
}
// Initialize the object
- CScriptArray *a = new(mem) CScriptArray(length, ti);
+ CScriptArray *a = new (mem) CScriptArray(length, ti);
return a;
}
-CScriptArray* CScriptArray::Create(asITypeInfo *ti, void *initList)
-{
+CScriptArray *CScriptArray::Create(asITypeInfo *ti, void *initList) {
// Allocate the memory
void *mem = userAlloc(sizeof(CScriptArray));
- if( mem == 0 )
- {
+ if (mem == 0) {
asIScriptContext *ctx = asGetActiveContext();
- if( ctx )
+ if (ctx)
ctx->SetException("Out of memory");
return 0;
}
// Initialize the object
- CScriptArray *a = new(mem) CScriptArray(ti, initList);
+ CScriptArray *a = new (mem) CScriptArray(ti, initList);
return a;
}
-CScriptArray* CScriptArray::Create(asITypeInfo *ti, asUINT length, void *defVal)
-{
+CScriptArray *CScriptArray::Create(asITypeInfo *ti, asUINT length, void *defVal) {
// Allocate the memory
void *mem = userAlloc(sizeof(CScriptArray));
- if( mem == 0 )
- {
+ if (mem == 0) {
asIScriptContext *ctx = asGetActiveContext();
- if( ctx )
+ if (ctx)
ctx->SetException("Out of memory");
return 0;
}
// Initialize the object
- CScriptArray *a = new(mem) CScriptArray(length, defVal, ti);
+ CScriptArray *a = new (mem) CScriptArray(length, defVal, ti);
return a;
}
-CScriptArray* CScriptArray::Create(asITypeInfo *ti)
-{
+CScriptArray *CScriptArray::Create(asITypeInfo *ti) {
return CScriptArray::Create(ti, asUINT(0));
}
@@ -124,57 +112,46 @@ CScriptArray* CScriptArray::Create(asITypeInfo *ti)
// subtype at compile time, instead of at runtime. The output argument dontGarbageCollect
// allow the callback to tell the engine if the template instance type shouldn't be garbage collected,
// i.e. no asOBJ_GC flag.
-static bool ScriptArrayTemplateCallback(asITypeInfo *ti, bool &dontGarbageCollect)
-{
+static bool ScriptArrayTemplateCallback(asITypeInfo *ti, bool &dontGarbageCollect) {
// Make sure the subtype can be instantiated with a default factory/constructor,
// otherwise we won't be able to instantiate the elements.
int typeId = ti->GetSubTypeId();
- if( typeId == asTYPEID_VOID )
+ if (typeId == asTYPEID_VOID)
return false;
- if( (typeId & asTYPEID_MASK_OBJECT) && !(typeId & asTYPEID_OBJHANDLE) )
- {
+ if ((typeId & asTYPEID_MASK_OBJECT) && !(typeId & asTYPEID_OBJHANDLE)) {
asITypeInfo *subtype = ti->GetEngine()->GetTypeInfoById(typeId);
asDWORD flags = subtype->GetFlags();
- if( (flags & asOBJ_VALUE) && !(flags & asOBJ_POD) )
- {
+ if ((flags & asOBJ_VALUE) && !(flags & asOBJ_POD)) {
// Verify that there is a default constructor
bool found = false;
- for( asUINT n = 0; n < subtype->GetBehaviourCount(); n++ )
- {
+ for (asUINT n = 0; n < subtype->GetBehaviourCount(); n++) {
asEBehaviours beh;
asIScriptFunction *func = subtype->GetBehaviourByIndex(n, &beh);
- if( beh != asBEHAVE_CONSTRUCT ) continue;
+ if (beh != asBEHAVE_CONSTRUCT) continue;
- if( func->GetParamCount() == 0 )
- {
+ if (func->GetParamCount() == 0) {
// Found the default constructor
found = true;
break;
}
}
- if( !found )
- {
+ if (!found) {
// There is no default constructor
// TODO: Should format the message to give the name of the subtype for better understanding
ti->GetEngine()->WriteMessage("array", 0, 0, asMSGTYPE_ERROR, "The subtype has no default constructor");
return false;
}
- }
- else if( (flags & asOBJ_REF) )
- {
+ } else if ((flags & asOBJ_REF)) {
bool found = false;
// If value assignment for ref type has been disabled then the array
// can be created if the type has a default factory function
- if( !ti->GetEngine()->GetEngineProperty(asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE) )
- {
+ if (!ti->GetEngine()->GetEngineProperty(asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE)) {
// Verify that there is a default factory
- for( asUINT n = 0; n < subtype->GetFactoryCount(); n++ )
- {
+ for (asUINT n = 0; n < subtype->GetFactoryCount(); n++) {
asIScriptFunction *func = subtype->GetFactoryByIndex(n);
- if( func->GetParamCount() == 0 )
- {
+ if (func->GetParamCount() == 0) {
// Found the default factory
found = true;
break;
@@ -182,8 +159,7 @@ static bool ScriptArrayTemplateCallback(asITypeInfo *ti, bool &dontGarbageCollec
}
}
- if( !found )
- {
+ if (!found) {
// No default factory
// TODO: Should format the message to give the name of the subtype for better understanding
ti->GetEngine()->WriteMessage("array", 0, 0, asMSGTYPE_ERROR, "The subtype has no default factory");
@@ -192,18 +168,14 @@ static bool ScriptArrayTemplateCallback(asITypeInfo *ti, bool &dontGarbageCollec
}
// If the object type is not garbage collected then the array also doesn't need to be
- if( !(flags & asOBJ_GC) )
+ if (!(flags & asOBJ_GC))
dontGarbageCollect = true;
- }
- else if( !(typeId & asTYPEID_OBJHANDLE) )
- {
+ } else if (!(typeId & asTYPEID_OBJHANDLE)) {
// Arrays with primitives cannot form circular references,
// thus there is no need to garbage collect them
dontGarbageCollect = true;
- }
- else
- {
- assert( typeId & asTYPEID_OBJHANDLE );
+ } else {
+ assert(typeId & asTYPEID_OBJHANDLE);
// It is not necessary to set the array as garbage collected for all handle types.
// If it is possible to determine that the handle cannot refer to an object type
@@ -211,22 +183,17 @@ static bool ScriptArrayTemplateCallback(asITypeInfo *ti, bool &dontGarbageCollec
// necessary to make the array garbage collected.
asITypeInfo *subtype = ti->GetEngine()->GetTypeInfoById(typeId);
asDWORD flags = subtype->GetFlags();
- if( !(flags & asOBJ_GC) )
- {
- if( (flags & asOBJ_SCRIPT_OBJECT) )
- {
+ if (!(flags & asOBJ_GC)) {
+ if ((flags & asOBJ_SCRIPT_OBJECT)) {
// Even if a script class is by itself not garbage collected, it is possible
// that classes that derive from it may be, so it is not possible to know
// that no circular reference can occur.
- if( (flags & asOBJ_NOINHERIT) )
- {
+ if ((flags & asOBJ_NOINHERIT)) {
// A script class declared as final cannot be inherited from, thus
// we can be certain that the object cannot be garbage collected.
dontGarbageCollect = true;
}
- }
- else
- {
+ } else {
// For application registered classes we assume the application knows
// what it is doing and don't mark the array as garbage collected unless
// the type is also garbage collected.
@@ -240,22 +207,20 @@ static bool ScriptArrayTemplateCallback(asITypeInfo *ti, bool &dontGarbageCollec
}
// Registers the template array type
-void RegisterScriptArray(asIScriptEngine *engine, bool defaultArray)
-{
- if( strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY") == 0 )
+void RegisterScriptArray(asIScriptEngine *engine, bool defaultArray) {
+ if (strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY") == 0)
RegisterScriptArray_Native(engine);
else
RegisterScriptArray_Generic(engine);
- if( defaultArray )
- {
- int r = engine->RegisterDefaultArrayType("array<T>"); assert( r >= 0 );
+ if (defaultArray) {
+ int r = engine->RegisterDefaultArrayType("array<T>");
+ assert(r >= 0);
UNUSED_VAR(r);
}
}
-static void RegisterScriptArray_Native(asIScriptEngine *engine)
-{
+static void RegisterScriptArray_Native(asIScriptEngine *engine) {
int r = 0;
UNUSED_VAR(r);
@@ -263,99 +228,143 @@ static void RegisterScriptArray_Native(asIScriptEngine *engine)
engine->SetTypeInfoUserDataCleanupCallback(CleanupTypeInfoArrayCache, ARRAY_CACHE);
// Register the array type as a template
- r = engine->RegisterObjectType("array<class T>", 0, asOBJ_REF | asOBJ_GC | asOBJ_TEMPLATE); assert( r >= 0 );
+ r = engine->RegisterObjectType("array<class T>", 0, asOBJ_REF | asOBJ_GC | asOBJ_TEMPLATE);
+ assert(r >= 0);
// Register a callback for validating the subtype before it is used
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_TEMPLATE_CALLBACK, "bool f(int&in, bool&out)", asFUNCTION(ScriptArrayTemplateCallback), asCALL_CDECL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_TEMPLATE_CALLBACK, "bool f(int&in, bool&out)", asFUNCTION(ScriptArrayTemplateCallback), asCALL_CDECL);
+ assert(r >= 0);
// Templates receive the object type as the first parameter. To the script writer this is hidden
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in)", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo*), CScriptArray*), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in, uint length) explicit", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo*, asUINT), CScriptArray*), asCALL_CDECL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in, uint length, const T &in value)", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo*, asUINT, void *), CScriptArray*), asCALL_CDECL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in)", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo *), CScriptArray *), asCALL_CDECL);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in, uint length) explicit", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo *, asUINT), CScriptArray *), asCALL_CDECL);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in, uint length, const T &in value)", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo *, asUINT, void *), CScriptArray *), asCALL_CDECL);
+ assert(r >= 0);
// Register the factory that will be used for initialization lists
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_LIST_FACTORY, "array<T>@ f(int&in type, int&in list) {repeat T}", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo*, void*), CScriptArray*), asCALL_CDECL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_LIST_FACTORY, "array<T>@ f(int&in type, int&in list) {repeat T}", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo *, void *), CScriptArray *), asCALL_CDECL);
+ assert(r >= 0);
// The memory management methods
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_ADDREF, "void f()", asMETHOD(CScriptArray,AddRef), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_RELEASE, "void f()", asMETHOD(CScriptArray,Release), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_ADDREF, "void f()", asMETHOD(CScriptArray, AddRef), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_RELEASE, "void f()", asMETHOD(CScriptArray, Release), asCALL_THISCALL);
+ assert(r >= 0);
// The index operator returns the template subtype
- r = engine->RegisterObjectMethod("array<T>", "T &opIndex(uint index)", asMETHODPR(CScriptArray, At, (asUINT), void*), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "const T &opIndex(uint index) const", asMETHODPR(CScriptArray, At, (asUINT) const, const void*), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "T &opIndex(uint index)", asMETHODPR(CScriptArray, At, (asUINT), void *), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "const T &opIndex(uint index) const", asMETHODPR(CScriptArray, At, (asUINT) const, const void *), asCALL_THISCALL);
+ assert(r >= 0);
// The assignment operator
- r = engine->RegisterObjectMethod("array<T>", "array<T> &opAssign(const array<T>&in)", asMETHOD(CScriptArray, operator=), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "array<T> &opAssign(const array<T>&in)", asMETHOD(CScriptArray, operator=), asCALL_THISCALL);
+ assert(r >= 0);
// Other methods
- r = engine->RegisterObjectMethod("array<T>", "void insertAt(uint index, const T&in value)", asMETHODPR(CScriptArray, InsertAt, (asUINT, void *), void), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void insertAt(uint index, const array<T>& arr)", asMETHODPR(CScriptArray, InsertAt, (asUINT, const CScriptArray &), void), asCALL_THISCALL); assert(r >= 0);
- r = engine->RegisterObjectMethod("array<T>", "void insertLast(const T&in value)", asMETHOD(CScriptArray, InsertLast), asCALL_THISCALL); assert(r >= 0);
- r = engine->RegisterObjectMethod("array<T>", "void removeAt(uint index)", asMETHOD(CScriptArray, RemoveAt), asCALL_THISCALL); assert(r >= 0);
- r = engine->RegisterObjectMethod("array<T>", "void removeLast()", asMETHOD(CScriptArray, RemoveLast), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void removeRange(uint start, uint count)", asMETHOD(CScriptArray, RemoveRange), asCALL_THISCALL); assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void insertAt(uint index, const T&in value)", asMETHODPR(CScriptArray, InsertAt, (asUINT, void *), void), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void insertAt(uint index, const array<T>& arr)", asMETHODPR(CScriptArray, InsertAt, (asUINT, const CScriptArray &), void), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void insertLast(const T&in value)", asMETHOD(CScriptArray, InsertLast), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void removeAt(uint index)", asMETHOD(CScriptArray, RemoveAt), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void removeLast()", asMETHOD(CScriptArray, RemoveLast), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void removeRange(uint start, uint count)", asMETHOD(CScriptArray, RemoveRange), asCALL_THISCALL);
+ assert(r >= 0);
// TODO: Should length() and resize() be deprecated as the property accessors do the same thing?
// TODO: Register as size() for consistency with other types
#if AS_USE_ACCESSORS != 1
- r = engine->RegisterObjectMethod("array<T>", "uint length() const", asMETHOD(CScriptArray, GetSize), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "uint length() const", asMETHOD(CScriptArray, GetSize), asCALL_THISCALL);
+ assert(r >= 0);
#endif
- r = engine->RegisterObjectMethod("array<T>", "void reserve(uint length)", asMETHOD(CScriptArray, Reserve), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void resize(uint length)", asMETHODPR(CScriptArray, Resize, (asUINT), void), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void sortAsc()", asMETHODPR(CScriptArray, SortAsc, (), void), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void sortAsc(uint startAt, uint count)", asMETHODPR(CScriptArray, SortAsc, (asUINT, asUINT), void), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void sortDesc()", asMETHODPR(CScriptArray, SortDesc, (), void), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void sortDesc(uint startAt, uint count)", asMETHODPR(CScriptArray, SortDesc, (asUINT, asUINT), void), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void reverse()", asMETHOD(CScriptArray, Reverse), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void reserve(uint length)", asMETHOD(CScriptArray, Reserve), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void resize(uint length)", asMETHODPR(CScriptArray, Resize, (asUINT), void), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void sortAsc()", asMETHODPR(CScriptArray, SortAsc, (), void), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void sortAsc(uint startAt, uint count)", asMETHODPR(CScriptArray, SortAsc, (asUINT, asUINT), void), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void sortDesc()", asMETHODPR(CScriptArray, SortDesc, (), void), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void sortDesc(uint startAt, uint count)", asMETHODPR(CScriptArray, SortDesc, (asUINT, asUINT), void), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void reverse()", asMETHOD(CScriptArray, Reverse), asCALL_THISCALL);
+ assert(r >= 0);
// The token 'if_handle_then_const' tells the engine that if the type T is a handle, then it should refer to a read-only object
- r = engine->RegisterObjectMethod("array<T>", "int find(const T&in if_handle_then_const value) const", asMETHODPR(CScriptArray, Find, (void*) const, int), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "int find(const T&in if_handle_then_const value) const", asMETHODPR(CScriptArray, Find, (void *) const, int), asCALL_THISCALL);
+ assert(r >= 0);
// TODO: It should be "int find(const T&in value, uint startAt = 0) const"
- r = engine->RegisterObjectMethod("array<T>", "int find(uint startAt, const T&in if_handle_then_const value) const", asMETHODPR(CScriptArray, Find, (asUINT, void*) const, int), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "int findByRef(const T&in if_handle_then_const value) const", asMETHODPR(CScriptArray, FindByRef, (void*) const, int), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "int find(uint startAt, const T&in if_handle_then_const value) const", asMETHODPR(CScriptArray, Find, (asUINT, void *) const, int), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "int findByRef(const T&in if_handle_then_const value) const", asMETHODPR(CScriptArray, FindByRef, (void *) const, int), asCALL_THISCALL);
+ assert(r >= 0);
// TODO: It should be "int findByRef(const T&in value, uint startAt = 0) const"
- r = engine->RegisterObjectMethod("array<T>", "int findByRef(uint startAt, const T&in if_handle_then_const value) const", asMETHODPR(CScriptArray, FindByRef, (asUINT, void*) const, int), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "bool opEquals(const array<T>&in) const", asMETHOD(CScriptArray, operator==), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "bool isEmpty() const", asMETHOD(CScriptArray, IsEmpty), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "int findByRef(uint startAt, const T&in if_handle_then_const value) const", asMETHODPR(CScriptArray, FindByRef, (asUINT, void *) const, int), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "bool opEquals(const array<T>&in) const", asMETHOD(CScriptArray, operator==), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "bool isEmpty() const", asMETHOD(CScriptArray, IsEmpty), asCALL_THISCALL);
+ assert(r >= 0);
// Sort with callback for comparison
r = engine->RegisterFuncdef("bool array<T>::less(const T&in if_handle_then_const a, const T&in if_handle_then_const b)");
- r = engine->RegisterObjectMethod("array<T>", "void sort(const less &in, uint startAt = 0, uint count = uint(-1))", asMETHODPR(CScriptArray, Sort, (asIScriptFunction*, asUINT, asUINT), void), asCALL_THISCALL); assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void sort(const less &in, uint startAt = 0, uint count = uint(-1))", asMETHODPR(CScriptArray, Sort, (asIScriptFunction *, asUINT, asUINT), void), asCALL_THISCALL);
+ assert(r >= 0);
#if AS_USE_STLNAMES != 1 && AS_USE_ACCESSORS == 1
// Register virtual properties
- r = engine->RegisterObjectMethod("array<T>", "uint get_length() const property", asMETHOD(CScriptArray, GetSize), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void set_length(uint) property", asMETHODPR(CScriptArray, Resize, (asUINT), void), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "uint get_length() const property", asMETHOD(CScriptArray, GetSize), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void set_length(uint) property", asMETHODPR(CScriptArray, Resize, (asUINT), void), asCALL_THISCALL);
+ assert(r >= 0);
#endif
// Register GC behaviours in case the array needs to be garbage collected
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_GETREFCOUNT, "int f()", asMETHOD(CScriptArray, GetRefCount), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_SETGCFLAG, "void f()", asMETHOD(CScriptArray, SetFlag), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_GETGCFLAG, "bool f()", asMETHOD(CScriptArray, GetFlag), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_ENUMREFS, "void f(int&in)", asMETHOD(CScriptArray, EnumReferences), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_RELEASEREFS, "void f(int&in)", asMETHOD(CScriptArray, ReleaseAllHandles), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_GETREFCOUNT, "int f()", asMETHOD(CScriptArray, GetRefCount), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_SETGCFLAG, "void f()", asMETHOD(CScriptArray, SetFlag), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_GETGCFLAG, "bool f()", asMETHOD(CScriptArray, GetFlag), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_ENUMREFS, "void f(int&in)", asMETHOD(CScriptArray, EnumReferences), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_RELEASEREFS, "void f(int&in)", asMETHOD(CScriptArray, ReleaseAllHandles), asCALL_THISCALL);
+ assert(r >= 0);
#if AS_USE_STLNAMES == 1
// Same as length
- r = engine->RegisterObjectMethod("array<T>", "uint size() const", asMETHOD(CScriptArray, GetSize), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "uint size() const", asMETHOD(CScriptArray, GetSize), asCALL_THISCALL);
+ assert(r >= 0);
// Same as isEmpty
- r = engine->RegisterObjectMethod("array<T>", "bool empty() const", asMETHOD(CScriptArray, IsEmpty), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "bool empty() const", asMETHOD(CScriptArray, IsEmpty), asCALL_THISCALL);
+ assert(r >= 0);
// Same as insertLast
- r = engine->RegisterObjectMethod("array<T>", "void push_back(const T&in)", asMETHOD(CScriptArray, InsertLast), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void push_back(const T&in)", asMETHOD(CScriptArray, InsertLast), asCALL_THISCALL);
+ assert(r >= 0);
// Same as removeLast
- r = engine->RegisterObjectMethod("array<T>", "void pop_back()", asMETHOD(CScriptArray, RemoveLast), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void pop_back()", asMETHOD(CScriptArray, RemoveLast), asCALL_THISCALL);
+ assert(r >= 0);
// Same as insertAt
- r = engine->RegisterObjectMethod("array<T>", "void insert(uint index, const T&in value)", asMETHODPR(CScriptArray, InsertAt, (asUINT, void *), void), asCALL_THISCALL); assert(r >= 0);
- r = engine->RegisterObjectMethod("array<T>", "void insert(uint index, const array<T>& arr)", asMETHODPR(CScriptArray, InsertAt, (asUINT, const CScriptArray &), void), asCALL_THISCALL); assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void insert(uint index, const T&in value)", asMETHODPR(CScriptArray, InsertAt, (asUINT, void *), void), asCALL_THISCALL);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void insert(uint index, const array<T>& arr)", asMETHODPR(CScriptArray, InsertAt, (asUINT, const CScriptArray &), void), asCALL_THISCALL);
+ assert(r >= 0);
// Same as removeAt
- r = engine->RegisterObjectMethod("array<T>", "void erase(uint)", asMETHOD(CScriptArray, RemoveAt), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void erase(uint)", asMETHOD(CScriptArray, RemoveAt), asCALL_THISCALL);
+ assert(r >= 0);
#endif
}
-CScriptArray &CScriptArray::operator=(const CScriptArray &other)
-{
+CScriptArray &CScriptArray::operator=(const CScriptArray &other) {
// Only perform the copy if the array types are the same
- if( &other != this &&
- other.GetArrayObjectType() == GetArrayObjectType() )
- {
+ if (&other != this &&
+ other.GetArrayObjectType() == GetArrayObjectType()) {
// Make sure the arrays are of the same size
Resize(other.buffer->numElements);
@@ -366,10 +375,9 @@ CScriptArray &CScriptArray::operator=(const CScriptArray &other)
return *this;
}
-CScriptArray::CScriptArray(asITypeInfo *ti, void *buf)
-{
+CScriptArray::CScriptArray(asITypeInfo *ti, void *buf) {
// The object type should be the template instance of the array
- assert( ti && Common::String(ti->GetName()) == "array" );
+ assert(ti && Common::String(ti->GetName()) == "array");
refCount = 1;
gcFlag = false;
@@ -382,61 +390,53 @@ CScriptArray::CScriptArray(asITypeInfo *ti, void *buf)
asIScriptEngine *engine = ti->GetEngine();
// Determine element size
- if( subTypeId & asTYPEID_MASK_OBJECT )
+ if (subTypeId & asTYPEID_MASK_OBJECT)
elementSize = sizeof(asPWORD);
else
elementSize = engine->GetSizeOfPrimitiveType(subTypeId);
// Determine the initial size from the buffer
- asUINT length = *(asUINT*)buf;
+ asUINT length = *(asUINT *)buf;
// Make sure the array size isn't too large for us to handle
- if( !CheckMaxSize(length) )
- {
+ if (!CheckMaxSize(length)) {
// Don't continue with the initialization
return;
}
// Copy the values of the array elements from the buffer
- if( (ti->GetSubTypeId() & asTYPEID_MASK_OBJECT) == 0 )
- {
+ if ((ti->GetSubTypeId() & asTYPEID_MASK_OBJECT) == 0) {
CreateBuffer(&buffer, length);
// Copy the values of the primitive type into the internal buffer
- if( length > 0 )
- memcpy(At(0), (((asUINT*)buf)+1), length * elementSize);
- }
- else if( ti->GetSubTypeId() & asTYPEID_OBJHANDLE )
- {
+ if (length > 0)
+ memcpy(At(0), (((asUINT *)buf) + 1), length * elementSize);
+ } else if (ti->GetSubTypeId() & asTYPEID_OBJHANDLE) {
CreateBuffer(&buffer, length);
// Copy the handles into the internal buffer
- if( length > 0 )
- memcpy(At(0), (((asUINT*)buf)+1), length * elementSize);
+ if (length > 0)
+ memcpy(At(0), (((asUINT *)buf) + 1), length * elementSize);
// With object handles it is safe to clear the memory in the received buffer
// instead of increasing the ref count. It will save time both by avoiding the
// call the increase ref, and also relieve the engine from having to release
// its references too
- memset((((asUINT*)buf)+1), 0, length * elementSize);
- }
- else if( ti->GetSubType()->GetFlags() & asOBJ_REF )
- {
+ memset((((asUINT *)buf) + 1), 0, length * elementSize);
+ } else if (ti->GetSubType()->GetFlags() & asOBJ_REF) {
// Only allocate the buffer, but not the objects
subTypeId |= asTYPEID_OBJHANDLE;
CreateBuffer(&buffer, length);
subTypeId &= ~asTYPEID_OBJHANDLE;
// Copy the handles into the internal buffer
- if( length > 0 )
- memcpy(buffer->data, (((asUINT*)buf)+1), length * elementSize);
+ if (length > 0)
+ memcpy(buffer->data, (((asUINT *)buf) + 1), length * elementSize);
// For ref types we can do the same as for handles, as they are
// implicitly stored as handles.
- memset((((asUINT*)buf)+1), 0, length * elementSize);
- }
- else
- {
+ memset((((asUINT *)buf) + 1), 0, length * elementSize);
+ } else {
// TODO: Optimize by calling the copy constructor of the object instead of
// constructing with the default constructor and then assigning the value
// TODO: With C++11 ideally we should be calling the move constructor, instead
@@ -445,24 +445,22 @@ CScriptArray::CScriptArray(asITypeInfo *ti, void *buf)
CreateBuffer(&buffer, length);
// For value types we need to call the opAssign for each individual object
- for( asUINT n = 0; n < length; n++ )
- {
+ for (asUINT n = 0; n < length; n++) {
void *obj = At(n);
- asBYTE *srcObj = (asBYTE*)buf;
- srcObj += 4 + n*ti->GetSubType()->GetSize();
+ asBYTE *srcObj = (asBYTE *)buf;
+ srcObj += 4 + n * ti->GetSubType()->GetSize();
engine->AssignScriptObject(obj, srcObj, ti->GetSubType());
}
}
// Notify the GC of the successful creation
- if( objType->GetFlags() & asOBJ_GC )
+ if (objType->GetFlags() & asOBJ_GC)
objType->GetEngine()->NotifyGarbageCollectorOfNewObject(this, objType);
}
-CScriptArray::CScriptArray(asUINT length, asITypeInfo *ti)
-{
+CScriptArray::CScriptArray(asUINT length, asITypeInfo *ti) {
// The object type should be the template instance of the array
- assert( ti && Common::String(ti->GetName()) == "array" );
+ assert(ti && Common::String(ti->GetName()) == "array");
refCount = 1;
gcFlag = false;
@@ -473,14 +471,13 @@ CScriptArray::CScriptArray(asUINT length, asITypeInfo *ti)
Precache();
// Determine element size
- if( subTypeId & asTYPEID_MASK_OBJECT )
+ if (subTypeId & asTYPEID_MASK_OBJECT)
elementSize = sizeof(asPWORD);
else
elementSize = objType->GetEngine()->GetSizeOfPrimitiveType(subTypeId);
// Make sure the array size isn't too large for us to handle
- if( !CheckMaxSize(length) )
- {
+ if (!CheckMaxSize(length)) {
// Don't continue with the initialization
return;
}
@@ -488,12 +485,11 @@ CScriptArray::CScriptArray(asUINT length, asITypeInfo *ti)
CreateBuffer(&buffer, length);
// Notify the GC of the successful creation
- if( objType->GetFlags() & asOBJ_GC )
+ if (objType->GetFlags() & asOBJ_GC)
objType->GetEngine()->NotifyGarbageCollectorOfNewObject(this, objType);
}
-CScriptArray::CScriptArray(const CScriptArray &other)
-{
+CScriptArray::CScriptArray(const CScriptArray &other) {
refCount = 1;
gcFlag = false;
objType = other.objType;
@@ -504,7 +500,7 @@ CScriptArray::CScriptArray(const CScriptArray &other)
elementSize = other.elementSize;
- if( objType->GetFlags() & asOBJ_GC )
+ if (objType->GetFlags() & asOBJ_GC)
objType->GetEngine()->NotifyGarbageCollectorOfNewObject(this, objType);
CreateBuffer(&buffer, 0);
@@ -513,10 +509,9 @@ CScriptArray::CScriptArray(const CScriptArray &other)
*this = other;
}
-CScriptArray::CScriptArray(asUINT length, void *defVal, asITypeInfo *ti)
-{
+CScriptArray::CScriptArray(asUINT length, void *defVal, asITypeInfo *ti) {
// The object type should be the template instance of the array
- assert( ti && Common::String(ti->GetName()) == "array" );
+ assert(ti && Common::String(ti->GetName()) == "array");
refCount = 1;
gcFlag = false;
@@ -527,14 +522,13 @@ CScriptArray::CScriptArray(asUINT length, void *defVal, asITypeInfo *ti)
Precache();
// Determine element size
- if( subTypeId & asTYPEID_MASK_OBJECT )
+ if (subTypeId & asTYPEID_MASK_OBJECT)
elementSize = sizeof(asPWORD);
else
elementSize = objType->GetEngine()->GetSizeOfPrimitiveType(subTypeId);
// Make sure the array size isn't too large for us to handle
- if( !CheckMaxSize(length) )
- {
+ if (!CheckMaxSize(length)) {
// Don't continue with the initialization
return;
}
@@ -542,96 +536,85 @@ CScriptArray::CScriptArray(asUINT length, void *defVal, asITypeInfo *ti)
CreateBuffer(&buffer, length);
// Notify the GC of the successful creation
- if( objType->GetFlags() & asOBJ_GC )
+ if (objType->GetFlags() & asOBJ_GC)
objType->GetEngine()->NotifyGarbageCollectorOfNewObject(this, objType);
// Initialize the elements with the default value
- for( asUINT n = 0; n < GetSize(); n++ )
+ for (asUINT n = 0; n < GetSize(); n++)
SetValue(n, defVal);
}
-void CScriptArray::SetValue(asUINT index, void *value)
-{
+void CScriptArray::SetValue(asUINT index, void *value) {
// At() will take care of the out-of-bounds checking, though
// if called from the application then nothing will be done
void *ptr = At(index);
- if( ptr == 0 ) return;
+ if (ptr == 0) return;
- if( (subTypeId & ~asTYPEID_MASK_SEQNBR) && !(subTypeId & asTYPEID_OBJHANDLE) )
+ if ((subTypeId & ~asTYPEID_MASK_SEQNBR) && !(subTypeId & asTYPEID_OBJHANDLE))
objType->GetEngine()->AssignScriptObject(ptr, value, objType->GetSubType());
- else if( subTypeId & asTYPEID_OBJHANDLE )
- {
- void *tmp = *(void**)ptr;
- *(void**)ptr = *(void**)value;
- objType->GetEngine()->AddRefScriptObject(*(void**)value, objType->GetSubType());
- if( tmp )
+ else if (subTypeId & asTYPEID_OBJHANDLE) {
+ void *tmp = *(void **)ptr;
+ *(void **)ptr = *(void **)value;
+ objType->GetEngine()->AddRefScriptObject(*(void **)value, objType->GetSubType());
+ if (tmp)
objType->GetEngine()->ReleaseScriptObject(tmp, objType->GetSubType());
- }
- else if( subTypeId == asTYPEID_BOOL ||
- subTypeId == asTYPEID_INT8 ||
- subTypeId == asTYPEID_UINT8 )
- *(char*)ptr = *(char*)value;
- else if( subTypeId == asTYPEID_INT16 ||
- subTypeId == asTYPEID_UINT16 )
- *(short*)ptr = *(short*)value;
- else if( subTypeId == asTYPEID_INT32 ||
- subTypeId == asTYPEID_UINT32 ||
- subTypeId == asTYPEID_FLOAT ||
- subTypeId > asTYPEID_DOUBLE ) // enums have a type id larger than doubles
- *(int*)ptr = *(int*)value;
- else if( subTypeId == asTYPEID_INT64 ||
- subTypeId == asTYPEID_UINT64 ||
- subTypeId == asTYPEID_DOUBLE )
- *(double*)ptr = *(double*)value;
-}
-
-CScriptArray::~CScriptArray()
-{
- if( buffer )
- {
+ } else if (subTypeId == asTYPEID_BOOL ||
+ subTypeId == asTYPEID_INT8 ||
+ subTypeId == asTYPEID_UINT8)
+ *(char *)ptr = *(char *)value;
+ else if (subTypeId == asTYPEID_INT16 ||
+ subTypeId == asTYPEID_UINT16)
+ *(short *)ptr = *(short *)value;
+ else if (subTypeId == asTYPEID_INT32 ||
+ subTypeId == asTYPEID_UINT32 ||
+ subTypeId == asTYPEID_FLOAT ||
+ subTypeId > asTYPEID_DOUBLE) // enums have a type id larger than doubles
+ *(int *)ptr = *(int *)value;
+ else if (subTypeId == asTYPEID_INT64 ||
+ subTypeId == asTYPEID_UINT64 ||
+ subTypeId == asTYPEID_DOUBLE)
+ *(double *)ptr = *(double *)value;
+}
+
+CScriptArray::~CScriptArray() {
+ if (buffer) {
DeleteBuffer(buffer);
buffer = 0;
}
- if( objType ) objType->Release();
+ if (objType) objType->Release();
}
-asUINT CScriptArray::GetSize() const
-{
+asUINT CScriptArray::GetSize() const {
return buffer->numElements;
}
-bool CScriptArray::IsEmpty() const
-{
+bool CScriptArray::IsEmpty() const {
return buffer->numElements == 0;
}
-void CScriptArray::Reserve(asUINT maxElements)
-{
- if( maxElements <= buffer->maxElements )
+void CScriptArray::Reserve(asUINT maxElements) {
+ if (maxElements <= buffer->maxElements)
return;
- if( !CheckMaxSize(maxElements) )
+ if (!CheckMaxSize(maxElements))
return;
// Allocate memory for the buffer
- SArrayBuffer *newBuffer = reinterpret_cast<SArrayBuffer*>(userAlloc(sizeof(SArrayBuffer)-1 + elementSize*maxElements));
- if( newBuffer )
- {
+ SArrayBuffer *newBuffer = reinterpret_cast<SArrayBuffer *>(userAlloc(sizeof(SArrayBuffer) - 1 + elementSize * maxElements));
+ if (newBuffer) {
newBuffer->numElements = buffer->numElements;
newBuffer->maxElements = maxElements;
- }
- else
- {
+ } else {
// Out of memory
asIScriptContext *ctx = asGetActiveContext();
- if( ctx )
+ if (ctx)
ctx->SetException("Out of memory");
return;
}
// As objects in arrays of objects are not stored inline, it is safe to use memcpy here
// since we're just copying the pointers to objects and not the actual objects.
- memcpy(newBuffer->data, buffer->data, buffer->numElements*elementSize);
+ memcpy(newBuffer->data, buffer->data, buffer->numElements * elementSize);
// Release the old buffer
userFree(buffer);
@@ -639,21 +622,18 @@ void CScriptArray::Reserve(asUINT maxElements)
buffer = newBuffer;
}
-void CScriptArray::Resize(asUINT numElements)
-{
- if( !CheckMaxSize(numElements) )
+void CScriptArray::Resize(asUINT numElements) {
+ if (!CheckMaxSize(numElements))
return;
- Resize((int)numElements - (int)buffer->numElements, (asUINT)-1);
+ Resize((int)numElements - (int)buffer->numElements, (asUINT) - 1);
}
-void CScriptArray::RemoveRange(asUINT start, asUINT count)
-{
+void CScriptArray::RemoveRange(asUINT start, asUINT count) {
if (count == 0)
return;
- if( buffer == 0 || start > buffer->numElements )
- {
+ if (buffer == 0 || start > buffer->numElements) {
// If this is called from a script we raise a script exception
asIScriptContext *ctx = asGetActiveContext();
if (ctx)
@@ -671,96 +651,82 @@ void CScriptArray::RemoveRange(asUINT start, asUINT count)
// Compact the elements
// As objects in arrays of objects are not stored inline, it is safe to use memmove here
// since we're just copying the pointers to objects and not the actual objects.
- memmove(buffer->data + start*elementSize, buffer->data + (start + count)*elementSize, (buffer->numElements - start - count)*elementSize);
+ memmove(buffer->data + start * elementSize, buffer->data + (start + count)*elementSize, (buffer->numElements - start - count)*elementSize);
buffer->numElements -= count;
}
// Internal
-void CScriptArray::Resize(int delta, asUINT at)
-{
- if( delta < 0 )
- {
- if( -delta > (int)buffer->numElements )
+void CScriptArray::Resize(int delta, asUINT at) {
+ if (delta < 0) {
+ if (-delta > (int)buffer->numElements)
delta = -(int)buffer->numElements;
- if( at > buffer->numElements + delta )
+ if (at > buffer->numElements + delta)
at = buffer->numElements + delta;
- }
- else if( delta > 0 )
- {
+ } else if (delta > 0) {
// Make sure the array size isn't too large for us to handle
- if( delta > 0 && !CheckMaxSize(buffer->numElements + delta) )
+ if (delta > 0 && !CheckMaxSize(buffer->numElements + delta))
return;
- if( at > buffer->numElements )
+ if (at > buffer->numElements)
at = buffer->numElements;
}
- if( delta == 0 ) return;
+ if (delta == 0) return;
- if( buffer->maxElements < buffer->numElements + delta )
- {
+ if (buffer->maxElements < buffer->numElements + delta) {
// Allocate memory for the buffer
- SArrayBuffer *newBuffer = reinterpret_cast<SArrayBuffer*>(userAlloc(sizeof(SArrayBuffer)-1 + elementSize*(buffer->numElements + delta)));
- if( newBuffer )
- {
+ SArrayBuffer *newBuffer = reinterpret_cast<SArrayBuffer *>(userAlloc(sizeof(SArrayBuffer) - 1 + elementSize * (buffer->numElements + delta)));
+ if (newBuffer) {
newBuffer->numElements = buffer->numElements + delta;
newBuffer->maxElements = newBuffer->numElements;
- }
- else
- {
+ } else {
// Out of memory
asIScriptContext *ctx = asGetActiveContext();
- if( ctx )
+ if (ctx)
ctx->SetException("Out of memory");
return;
}
// As objects in arrays of objects are not stored inline, it is safe to use memcpy here
// since we're just copying the pointers to objects and not the actual objects.
- memcpy(newBuffer->data, buffer->data, at*elementSize);
- if( at < buffer->numElements )
- memcpy(newBuffer->data + (at+delta)*elementSize, buffer->data + at*elementSize, (buffer->numElements-at)*elementSize);
+ memcpy(newBuffer->data, buffer->data, at * elementSize);
+ if (at < buffer->numElements)
+ memcpy(newBuffer->data + (at + delta)*elementSize, buffer->data + at * elementSize, (buffer->numElements - at)*elementSize);
// Initialize the new elements with default values
- Construct(newBuffer, at, at+delta);
+ Construct(newBuffer, at, at + delta);
// Release the old buffer
userFree(buffer);
buffer = newBuffer;
- }
- else if( delta < 0 )
- {
- Destruct(buffer, at, at-delta);
+ } else if (delta < 0) {
+ Destruct(buffer, at, at - delta);
// As objects in arrays of objects are not stored inline, it is safe to use memmove here
// since we're just copying the pointers to objects and not the actual objects.
- memmove(buffer->data + at*elementSize, buffer->data + (at-delta)*elementSize, (buffer->numElements - (at-delta))*elementSize);
+ memmove(buffer->data + at * elementSize, buffer->data + (at - delta)*elementSize, (buffer->numElements - (at - delta))*elementSize);
buffer->numElements += delta;
- }
- else
- {
+ } else {
// As objects in arrays of objects are not stored inline, it is safe to use memmove here
// since we're just copying the pointers to objects and not the actual objects.
- memmove(buffer->data + (at+delta)*elementSize, buffer->data + at*elementSize, (buffer->numElements - at)*elementSize);
- Construct(buffer, at, at+delta);
+ memmove(buffer->data + (at + delta)*elementSize, buffer->data + at * elementSize, (buffer->numElements - at)*elementSize);
+ Construct(buffer, at, at + delta);
buffer->numElements += delta;
}
}
// internal
-bool CScriptArray::CheckMaxSize(asUINT numElements)
-{
+bool CScriptArray::CheckMaxSize(asUINT numElements) {
// This code makes sure the size of the buffer that is allocated
// for the array doesn't overflow and becomes smaller than requested
asUINT maxSize = 0xFFFFFFFFul - sizeof(SArrayBuffer) + 1;
- if( elementSize > 0 )
+ if (elementSize > 0)
maxSize /= elementSize;
- if( numElements > maxSize )
- {
+ if (numElements > maxSize) {
asIScriptContext *ctx = asGetActiveContext();
- if( ctx )
+ if (ctx)
ctx->SetException("Too large array size");
return false;
@@ -770,28 +736,23 @@ bool CScriptArray::CheckMaxSize(asUINT numElements)
return true;
}
-asITypeInfo *CScriptArray::GetArrayObjectType() const
-{
+asITypeInfo *CScriptArray::GetArrayObjectType() const {
return objType;
}
-int CScriptArray::GetArrayTypeId() const
-{
+int CScriptArray::GetArrayTypeId() const {
return objType->GetTypeId();
}
-int CScriptArray::GetElementTypeId() const
-{
+int CScriptArray::GetElementTypeId() const {
return subTypeId;
}
-void CScriptArray::InsertAt(asUINT index, void *value)
-{
- if( index > buffer->numElements )
- {
+void CScriptArray::InsertAt(asUINT index, void *value) {
+ if (index > buffer->numElements) {
// If this is called from a script we raise a script exception
asIScriptContext *ctx = asGetActiveContext();
- if( ctx )
+ if (ctx)
ctx->SetException("Index out of bounds");
return;
}
@@ -803,18 +764,15 @@ void CScriptArray::InsertAt(asUINT index, void *value)
SetValue(index, value);
}
-void CScriptArray::InsertAt(asUINT index, const CScriptArray &arr)
-{
- if (index > buffer->numElements)
- {
+void CScriptArray::InsertAt(asUINT index, const CScriptArray &arr) {
+ if (index > buffer->numElements) {
asIScriptContext *ctx = asGetActiveContext();
if (ctx)
ctx->SetException("Index out of bounds");
return;
}
- if (objType != arr.objType)
- {
+ if (objType != arr.objType) {
// This shouldn't really be possible to happen when
// called from a script, but let's check for it anyway
asIScriptContext *ctx = asGetActiveContext();
@@ -825,51 +783,42 @@ void CScriptArray::InsertAt(asUINT index, const CScriptArray &arr)
asUINT elements = arr.GetSize();
Resize(elements, index);
- if (&arr != this)
- {
- for (asUINT n = 0; n < arr.GetSize(); n++)
- {
+ if (&arr != this) {
+ for (asUINT n = 0; n < arr.GetSize(); n++) {
// This const cast is allowed, since we know the
// value will only be used to make a copy of it
- void *value = const_cast<void*>(arr.At(n));
+ void *value = const_cast<void *>(arr.At(n));
SetValue(index + n, value);
}
- }
- else
- {
+ } else {
// The array that is being inserted is the same as this one.
// So we should iterate over the elements before the index,
// and then the elements after
- for (asUINT n = 0; n < index; n++)
- {
+ for (asUINT n = 0; n < index; n++) {
// This const cast is allowed, since we know the
// value will only be used to make a copy of it
- void *value = const_cast<void*>(arr.At(n));
+ void *value = const_cast<void *>(arr.At(n));
SetValue(index + n, value);
}
- for (asUINT n = index + elements, m = 0; n < arr.GetSize(); n++, m++)
- {
+ for (asUINT n = index + elements, m = 0; n < arr.GetSize(); n++, m++) {
// This const cast is allowed, since we know the
// value will only be used to make a copy of it
- void *value = const_cast<void*>(arr.At(n));
+ void *value = const_cast<void *>(arr.At(n));
SetValue(index + index + m, value);
}
}
}
-void CScriptArray::InsertLast(void *value)
-{
+void CScriptArray::InsertLast(void *value) {
InsertAt(buffer->numElements, value);
}
-void CScriptArray::RemoveAt(asUINT index)
-{
- if( index >= buffer->numElements )
- {
+void CScriptArray::RemoveAt(asUINT index) {
+ if (index >= buffer->numElements) {
// If this is called from a script we raise a script exception
asIScriptContext *ctx = asGetActiveContext();
- if( ctx )
+ if (ctx)
ctx->SetException("Index out of bounds");
return;
}
@@ -878,62 +827,52 @@ void CScriptArray::RemoveAt(asUINT index)
Resize(-1, index);
}
-void CScriptArray::RemoveLast()
-{
- RemoveAt(buffer->numElements-1);
+void CScriptArray::RemoveLast() {
+ RemoveAt(buffer->numElements - 1);
}
// Return a pointer to the array element. Returns 0 if the index is out of bounds
-const void *CScriptArray::At(asUINT index) const
-{
- if( buffer == 0 || index >= buffer->numElements )
- {
+const void *CScriptArray::At(asUINT index) const {
+ if (buffer == 0 || index >= buffer->numElements) {
// If this is called from a script we raise a script exception
asIScriptContext *ctx = asGetActiveContext();
- if( ctx )
+ if (ctx)
ctx->SetException("Index out of bounds");
return 0;
}
- if( (subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE) )
- return *(void**)(buffer->data + elementSize*index);
+ if ((subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE))
+ return *(void **)(buffer->data + elementSize * index);
else
- return buffer->data + elementSize*index;
+ return buffer->data + elementSize * index;
}
-void *CScriptArray::At(asUINT index)
-{
- return const_cast<void*>(const_cast<const CScriptArray *>(this)->At(index));
+void *CScriptArray::At(asUINT index) {
+ return const_cast<void *>(const_cast<const CScriptArray *>(this)->At(index));
}
-void *CScriptArray::GetBuffer()
-{
+void *CScriptArray::GetBuffer() {
return buffer->data;
}
// internal
-void CScriptArray::CreateBuffer(SArrayBuffer **buf, asUINT numElements)
-{
- *buf = reinterpret_cast<SArrayBuffer*>(userAlloc(sizeof(SArrayBuffer)-1+elementSize*numElements));
+void CScriptArray::CreateBuffer(SArrayBuffer **buf, asUINT numElements) {
+ *buf = reinterpret_cast<SArrayBuffer *>(userAlloc(sizeof(SArrayBuffer) - 1 + elementSize * numElements));
- if( *buf )
- {
+ if (*buf) {
(*buf)->numElements = numElements;
(*buf)->maxElements = numElements;
Construct(*buf, 0, numElements);
- }
- else
- {
+ } else {
// Oops, out of memory
asIScriptContext *ctx = asGetActiveContext();
- if( ctx )
+ if (ctx)
ctx->SetException("Out of memory");
}
}
// internal
-void CScriptArray::DeleteBuffer(SArrayBuffer *buf)
-{
+void CScriptArray::DeleteBuffer(SArrayBuffer *buf) {
Destruct(buf, 0, buf->numElements);
// Free the buffer
@@ -941,53 +880,44 @@ void CScriptArray::DeleteBuffer(SArrayBuffer *buf)
}
// internal
-void CScriptArray::Construct(SArrayBuffer *buf, asUINT start, asUINT end)
-{
- if( (subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE) )
- {
+void CScriptArray::Construct(SArrayBuffer *buf, asUINT start, asUINT end) {
+ if ((subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE)) {
// Create an object using the default constructor/factory for each element
- void **max = (void**)(buf->data + end * sizeof(void*));
- void **d = (void**)(buf->data + start * sizeof(void*));
+ void **max = (void **)(buf->data + end * sizeof(void *));
+ void **d = (void **)(buf->data + start * sizeof(void *));
asIScriptEngine *engine = objType->GetEngine();
asITypeInfo *subType = objType->GetSubType();
- for( ; d < max; d++ )
- {
- *d = (void*)engine->CreateScriptObject(subType);
- if( *d == 0 )
- {
+ for (; d < max; d++) {
+ *d = (void *)engine->CreateScriptObject(subType);
+ if (*d == 0) {
// Set the remaining entries to null so the destructor
// won't attempt to destroy invalid objects later
- memset(d, 0, sizeof(void*)*(max-d));
+ memset(d, 0, sizeof(void *) * (max - d));
// There is no need to set an exception on the context,
// as CreateScriptObject has already done that
return;
}
}
- }
- else
- {
+ } else {
// Set all elements to zero whether they are handles or primitives
- void *d = (void*)(buf->data + start * elementSize);
- memset(d, 0, (end-start)*elementSize);
+ void *d = (void *)(buf->data + start * elementSize);
+ memset(d, 0, (end - start)*elementSize);
}
}
// internal
-void CScriptArray::Destruct(SArrayBuffer *buf, asUINT start, asUINT end)
-{
- if( subTypeId & asTYPEID_MASK_OBJECT )
- {
+void CScriptArray::Destruct(SArrayBuffer *buf, asUINT start, asUINT end) {
+ if (subTypeId & asTYPEID_MASK_OBJECT) {
asIScriptEngine *engine = objType->GetEngine();
- void **max = (void**)(buf->data + end * sizeof(void*));
- void **d = (void**)(buf->data + start * sizeof(void*));
+ void **max = (void **)(buf->data + end * sizeof(void *));
+ void **d = (void **)(buf->data + start * sizeof(void *));
- for( ; d < max; d++ )
- {
- if( *d )
+ for (; d < max; d++) {
+ if (*d)
engine->ReleaseScriptObject(*d, objType->GetSubType());
}
}
@@ -995,49 +925,52 @@ void CScriptArray::Destruct(SArrayBuffer *buf, asUINT start, asUINT end)
// internal
-bool CScriptArray::Less(const void *a, const void *b, bool asc)
-{
- if( !asc )
- {
+bool CScriptArray::Less(const void *a, const void *b, bool asc) {
+ if (!asc) {
// Swap items
const void *TEMP = a;
a = b;
b = TEMP;
}
- if( !(subTypeId & ~asTYPEID_MASK_SEQNBR) )
- {
+ if (!(subTypeId & ~asTYPEID_MASK_SEQNBR)) {
// Simple compare of values
- switch( subTypeId )
- {
- #define COMPARE(T) *((const T*)a) < *((const T*)b)
- case asTYPEID_BOOL: return COMPARE(bool);
- case asTYPEID_INT8: return COMPARE(signed char);
- case asTYPEID_UINT8: return COMPARE(unsigned char);
- case asTYPEID_INT16: return COMPARE(signed short);
- case asTYPEID_UINT16: return COMPARE(unsigned short);
- case asTYPEID_INT32: return COMPARE(signed int);
- case asTYPEID_UINT32: return COMPARE(unsigned int);
- case asTYPEID_FLOAT: return COMPARE(float);
- case asTYPEID_DOUBLE: return COMPARE(double);
- default: return COMPARE(signed int); // All enums fall in this case
- #undef COMPARE
+ switch (subTypeId) {
+#define COMPARE(T) *((const T*)a) < *((const T*)b)
+ case asTYPEID_BOOL:
+ return COMPARE(bool);
+ case asTYPEID_INT8:
+ return COMPARE(signed char);
+ case asTYPEID_UINT8:
+ return COMPARE(unsigned char);
+ case asTYPEID_INT16:
+ return COMPARE(signed short);
+ case asTYPEID_UINT16:
+ return COMPARE(unsigned short);
+ case asTYPEID_INT32:
+ return COMPARE(signed int);
+ case asTYPEID_UINT32:
+ return COMPARE(unsigned int);
+ case asTYPEID_FLOAT:
+ return COMPARE(float);
+ case asTYPEID_DOUBLE:
+ return COMPARE(double);
+ default:
+ return COMPARE(signed int); // All enums fall in this case
+#undef COMPARE
}
}
return false;
}
-void CScriptArray::Reverse()
-{
+void CScriptArray::Reverse() {
asUINT size = GetSize();
- if( size >= 2 )
- {
+ if (size >= 2) {
asBYTE TEMP[16];
- for( asUINT i = 0; i < size / 2; i++ )
- {
+ for (asUINT i = 0; i < size / 2; i++) {
Copy(TEMP, GetArrayItemPointer(i));
Copy(GetArrayItemPointer(i), GetArrayItemPointer(size - i - 1));
Copy(GetArrayItemPointer(size - i - 1), TEMP);
@@ -1045,30 +978,26 @@ void CScriptArray::Reverse()
}
}
-bool CScriptArray::operator==(const CScriptArray &other) const
-{
- if( objType != other.objType )
+bool CScriptArray::operator==(const CScriptArray &other) const {
+ if (objType != other.objType)
return false;
- if( GetSize() != other.GetSize() )
+ if (GetSize() != other.GetSize())
return false;
asIScriptContext *cmpContext = 0;
bool isNested = false;
- if( subTypeId & ~asTYPEID_MASK_SEQNBR )
- {
+ if (subTypeId & ~asTYPEID_MASK_SEQNBR) {
// Try to reuse the active context
cmpContext = asGetActiveContext();
- if( cmpContext )
- {
- if( cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0 )
+ if (cmpContext) {
+ if (cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0)
isNested = true;
else
cmpContext = 0;
}
- if( cmpContext == 0 )
- {
+ if (cmpContext == 0) {
// TODO: Ideally this context would be retrieved from a pool, so we don't have to
// create a new one everytime. We could keep a context with the array object
// but that would consume a lot of resources as each context is quite heavy.
@@ -1078,24 +1007,20 @@ bool CScriptArray::operator==(const CScriptArray &other) const
// Check if all elements are equal
bool isEqual = true;
- SArrayCache *cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
- for( asUINT n = 0; n < GetSize(); n++ )
- if( !Equals(At(n), other.At(n), cmpContext, cache) )
- {
+ SArrayCache *cache = reinterpret_cast<SArrayCache *>(objType->GetUserData(ARRAY_CACHE));
+ for (asUINT n = 0; n < GetSize(); n++)
+ if (!Equals(At(n), other.At(n), cmpContext, cache)) {
isEqual = false;
break;
}
- if( cmpContext )
- {
- if( isNested )
- {
+ if (cmpContext) {
+ if (isNested) {
asEContextState state = cmpContext->GetState();
cmpContext->PopState();
- if( state == asEXECUTION_ABORTED )
+ if (state == asEXECUTION_ABORTED)
cmpContext->Abort();
- }
- else
+ } else
cmpContext->Release();
}
@@ -1103,82 +1028,88 @@ bool CScriptArray::operator==(const CScriptArray &other) const
}
// internal
-bool CScriptArray::Equals(const void *a, const void *b, asIScriptContext *ctx, SArrayCache *cache) const
-{
- if( !(subTypeId & ~asTYPEID_MASK_SEQNBR) )
- {
+bool CScriptArray::Equals(const void *a, const void *b, asIScriptContext *ctx, SArrayCache *cache) const {
+ if (!(subTypeId & ~asTYPEID_MASK_SEQNBR)) {
// Simple compare of values
- switch( subTypeId )
- {
- #define COMPARE(T) *((const T*)a) == *((const T*)b)
- case asTYPEID_BOOL: return COMPARE(bool);
- case asTYPEID_INT8: return COMPARE(signed char);
- case asTYPEID_UINT8: return COMPARE(unsigned char);
- case asTYPEID_INT16: return COMPARE(signed short);
- case asTYPEID_UINT16: return COMPARE(unsigned short);
- case asTYPEID_INT32: return COMPARE(signed int);
- case asTYPEID_UINT32: return COMPARE(unsigned int);
- case asTYPEID_FLOAT: return COMPARE(float);
- case asTYPEID_DOUBLE: return COMPARE(double);
- default: return COMPARE(signed int); // All enums fall here
- #undef COMPARE
+ switch (subTypeId) {
+#define COMPARE(T) *((const T*)a) == *((const T*)b)
+ case asTYPEID_BOOL:
+ return COMPARE(bool);
+ case asTYPEID_INT8:
+ return COMPARE(signed char);
+ case asTYPEID_UINT8:
+ return COMPARE(unsigned char);
+ case asTYPEID_INT16:
+ return COMPARE(signed short);
+ case asTYPEID_UINT16:
+ return COMPARE(unsigned short);
+ case asTYPEID_INT32:
+ return COMPARE(signed int);
+ case asTYPEID_UINT32:
+ return COMPARE(unsigned int);
+ case asTYPEID_FLOAT:
+ return COMPARE(float);
+ case asTYPEID_DOUBLE:
+ return COMPARE(double);
+ default:
+ return COMPARE(signed int); // All enums fall here
+#undef COMPARE
}
- }
- else
- {
+ } else {
int r = 0;
- if( subTypeId & asTYPEID_OBJHANDLE )
- {
+ if (subTypeId & asTYPEID_OBJHANDLE) {
// Allow the find to work even if the array contains null handles
- if( *(const void**)a == *(const void**)b ) return true;
+ if (*(const void **)a == *(const void **)b) return true;
}
// Execute object opEquals if available
- if( cache && cache->eqFunc )
- {
+ if (cache && cache->eqFunc) {
// TODO: Add proper error handling
- r = ctx->Prepare(cache->eqFunc); assert(r >= 0);
-
- if( subTypeId & asTYPEID_OBJHANDLE )
- {
- r = ctx->SetObject(*((void**)a)); assert(r >= 0);
- r = ctx->SetArgObject(0, *((void**)b)); assert(r >= 0);
- }
- else
- {
- r = ctx->SetObject((void*)a); assert(r >= 0);
- r = ctx->SetArgObject(0, (void*)b); assert(r >= 0);
+ r = ctx->Prepare(cache->eqFunc);
+ assert(r >= 0);
+
+ if (subTypeId & asTYPEID_OBJHANDLE) {
+ r = ctx->SetObject(*((void **)a));
+ assert(r >= 0);
+ r = ctx->SetArgObject(0, *((void **)b));
+ assert(r >= 0);
+ } else {
+ r = ctx->SetObject((void *)a);
+ assert(r >= 0);
+ r = ctx->SetArgObject(0, (void *)b);
+ assert(r >= 0);
}
r = ctx->Execute();
- if( r == asEXECUTION_FINISHED )
+ if (r == asEXECUTION_FINISHED)
return ctx->GetReturnByte() != 0;
return false;
}
// Execute object opCmp if available
- if( cache && cache->cmpFunc )
- {
+ if (cache && cache->cmpFunc) {
// TODO: Add proper error handling
- r = ctx->Prepare(cache->cmpFunc); assert(r >= 0);
-
- if( subTypeId & asTYPEID_OBJHANDLE )
- {
- r = ctx->SetObject(*((void**)a)); assert(r >= 0);
- r = ctx->SetArgObject(0, *((void**)b)); assert(r >= 0);
- }
- else
- {
- r = ctx->SetObject((void*)a); assert(r >= 0);
- r = ctx->SetArgObject(0, (void*)b); assert(r >= 0);
+ r = ctx->Prepare(cache->cmpFunc);
+ assert(r >= 0);
+
+ if (subTypeId & asTYPEID_OBJHANDLE) {
+ r = ctx->SetObject(*((void **)a));
+ assert(r >= 0);
+ r = ctx->SetArgObject(0, *((void **)b));
+ assert(r >= 0);
+ } else {
+ r = ctx->SetObject((void *)a);
+ assert(r >= 0);
+ r = ctx->SetArgObject(0, (void *)b);
+ assert(r >= 0);
}
r = ctx->Execute();
- if( r == asEXECUTION_FINISHED )
+ if (r == asEXECUTION_FINISHED)
return (int)ctx->GetReturnDWord() == 0;
return false;
@@ -1188,31 +1119,24 @@ bool CScriptArray::Equals(const void *a, const void *b, asIScriptContext *ctx, S
return false;
}
-int CScriptArray::FindByRef(void *ref) const
-{
+int CScriptArray::FindByRef(void *ref) const {
return FindByRef(0, ref);
}
-int CScriptArray::FindByRef(asUINT startAt, void *ref) const
-{
+int CScriptArray::FindByRef(asUINT startAt, void *ref) const {
// Find the matching element by its reference
asUINT size = GetSize();
- if( subTypeId & asTYPEID_OBJHANDLE )
- {
+ if (subTypeId & asTYPEID_OBJHANDLE) {
// Dereference the pointer
- ref = *(void**)ref;
- for( asUINT i = startAt; i < size; i++ )
- {
- if( *(void**)At(i) == ref )
+ ref = *(void **)ref;
+ for (asUINT i = startAt; i < size; i++) {
+ if (*(void **)At(i) == ref)
return i;
}
- }
- else
- {
+ } else {
// Compare the reference directly
- for( asUINT i = startAt; i < size; i++ )
- {
- if( At(i) == ref )
+ for (asUINT i = startAt; i < size; i++) {
+ if (At(i) == ref)
return i;
}
}
@@ -1220,30 +1144,25 @@ int CScriptArray::FindByRef(asUINT startAt, void *ref) const
return -1;
}
-int CScriptArray::Find(void *value) const
-{
+int CScriptArray::Find(void *value) const {
return Find(0, value);
}
-int CScriptArray::Find(asUINT startAt, void *value) const
-{
+int CScriptArray::Find(asUINT startAt, void *value) const {
// Check if the subtype really supports find()
// TODO: Can't this be done at compile time too by the template callback
SArrayCache *cache = 0;
- if( subTypeId & ~asTYPEID_MASK_SEQNBR )
- {
- cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
- if( !cache || (cache->cmpFunc == 0 && cache->eqFunc == 0) )
- {
+ if (subTypeId & ~asTYPEID_MASK_SEQNBR) {
+ cache = reinterpret_cast<SArrayCache *>(objType->GetUserData(ARRAY_CACHE));
+ if (!cache || (cache->cmpFunc == 0 && cache->eqFunc == 0)) {
asIScriptContext *ctx = asGetActiveContext();
- asITypeInfo* subType = objType->GetEngine()->GetTypeInfoById(subTypeId);
+ asITypeInfo *subType = objType->GetEngine()->GetTypeInfoById(subTypeId);
// Throw an exception
- if( ctx )
- {
+ if (ctx) {
char tmp[512];
- if( cache && cache->eqFuncReturnCode == asMULTIPLE_FUNCTIONS )
+ if (cache && cache->eqFuncReturnCode == asMULTIPLE_FUNCTIONS)
#if defined(_MSC_VER) && _MSC_VER >= 1500 && !defined(__S3E__)
sprintf_s(tmp, 512, "Type '%s' has multiple matching opEquals or opCmp methods", subType->GetName());
#else
@@ -1265,19 +1184,16 @@ int CScriptArray::Find(asUINT startAt, void *value) const
asIScriptContext *cmpContext = 0;
bool isNested = false;
- if( subTypeId & ~asTYPEID_MASK_SEQNBR )
- {
+ if (subTypeId & ~asTYPEID_MASK_SEQNBR) {
// Try to reuse the active context
cmpContext = asGetActiveContext();
- if( cmpContext )
- {
- if( cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0 )
+ if (cmpContext) {
+ if (cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0)
isNested = true;
else
cmpContext = 0;
}
- if( cmpContext == 0 )
- {
+ if (cmpContext == 0) {
// TODO: Ideally this context would be retrieved from a pool, so we don't have to
// create a new one everytime. We could keep a context with the array object
// but that would consume a lot of resources as each context is quite heavy.
@@ -1289,26 +1205,21 @@ int CScriptArray::Find(asUINT startAt, void *value) const
int ret = -1;
asUINT size = GetSize();
- for( asUINT i = startAt; i < size; i++ )
- {
+ for (asUINT i = startAt; i < size; i++) {
// value passed by reference
- if( Equals(At(i), value, cmpContext, cache) )
- {
+ if (Equals(At(i), value, cmpContext, cache)) {
ret = (int)i;
break;
}
}
- if( cmpContext )
- {
- if( isNested )
- {
+ if (cmpContext) {
+ if (isNested) {
asEContextState state = cmpContext->GetState();
cmpContext->PopState();
- if( state == asEXECUTION_ABORTED )
+ if (state == asEXECUTION_ABORTED)
cmpContext->Abort();
- }
- else
+ } else
cmpContext->Release();
}
@@ -1321,8 +1232,7 @@ int CScriptArray::Find(asUINT startAt, void *value) const
// Copy object handle or primitive value
// Even in arrays of objects the objects are allocated on
// the heap and the array stores the pointers to the objects
-void CScriptArray::Copy(void *dst, void *src)
-{
+void CScriptArray::Copy(void *dst, void *src) {
memcpy(dst, src, elementSize);
}
@@ -1331,8 +1241,7 @@ void CScriptArray::Copy(void *dst, void *src)
// Swap two elements
// Even in arrays of objects the objects are allocated on
// the heap and the array stores the pointers to the objects.
-void CScriptArray::Swap(void* a, void* b)
-{
+void CScriptArray::Swap(void *a, void *b) {
asBYTE tmp[16];
Copy(tmp, a);
Copy(a, b);
@@ -1342,22 +1251,17 @@ void CScriptArray::Swap(void* a, void* b)
// internal
// Return pointer to array item (object handle or primitive value)
-void *CScriptArray::GetArrayItemPointer(int index)
-{
+void *CScriptArray::GetArrayItemPointer(int index) {
return buffer->data + index * elementSize;
}
// internal
// Return pointer to data in buffer (object or primitive)
-void *CScriptArray::GetDataPointer(void *buf)
-{
- if ((subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE) )
- {
+void *CScriptArray::GetDataPointer(void *buf) {
+ if ((subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE)) {
// Real address of object
- return reinterpret_cast<void*>(*(size_t*)buf);
- }
- else
- {
+ return reinterpret_cast<void *>(*(size_t *)buf);
+ } else {
// Primitive is just a raw data
return buf;
}
@@ -1365,48 +1269,40 @@ void *CScriptArray::GetDataPointer(void *buf)
// Sort ascending
-void CScriptArray::SortAsc()
-{
+void CScriptArray::SortAsc() {
Sort(0, GetSize(), true);
}
// Sort ascending
-void CScriptArray::SortAsc(asUINT startAt, asUINT count)
-{
+void CScriptArray::SortAsc(asUINT startAt, asUINT count) {
Sort(startAt, count, true);
}
// Sort descending
-void CScriptArray::SortDesc()
-{
+void CScriptArray::SortDesc() {
Sort(0, GetSize(), false);
}
// Sort descending
-void CScriptArray::SortDesc(asUINT startAt, asUINT count)
-{
+void CScriptArray::SortDesc(asUINT startAt, asUINT count) {
Sort(startAt, count, false);
}
// internal
-void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
-{
+void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc) {
// Subtype isn't primitive and doesn't have opCmp
- SArrayCache *cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
- if( subTypeId & ~asTYPEID_MASK_SEQNBR )
- {
- if( !cache || cache->cmpFunc == 0 )
- {
+ SArrayCache *cache = reinterpret_cast<SArrayCache *>(objType->GetUserData(ARRAY_CACHE));
+ if (subTypeId & ~asTYPEID_MASK_SEQNBR) {
+ if (!cache || cache->cmpFunc == 0) {
asIScriptContext *ctx = asGetActiveContext();
- asITypeInfo* subType = objType->GetEngine()->GetTypeInfoById(subTypeId);
+ asITypeInfo *subType = objType->GetEngine()->GetTypeInfoById(subTypeId);
// Throw an exception
- if( ctx )
- {
+ if (ctx) {
char tmp[512];
- if( cache && cache->cmpFuncReturnCode == asMULTIPLE_FUNCTIONS )
+ if (cache && cache->cmpFuncReturnCode == asMULTIPLE_FUNCTIONS)
#if defined(_MSC_VER) && _MSC_VER >= 1500 && !defined(__S3E__)
sprintf_s(tmp, 512, "Type '%s' has multiple matching opCmp methods", subType->GetName());
#else
@@ -1427,8 +1323,7 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
}
// No need to sort
- if( count < 2 )
- {
+ if (count < 2) {
return;
}
@@ -1436,34 +1331,30 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
int end = startAt + count;
// Check if we could access invalid item while sorting
- if( start >= (int)buffer->numElements || end > (int)buffer->numElements )
- {
+ if (start >= (int)buffer->numElements || end > (int)buffer->numElements) {
asIScriptContext *ctx = asGetActiveContext();
// Throw an exception
- if( ctx )
- {
+ if (ctx) {
ctx->SetException("Index out of bounds");
}
return;
}
- if( subTypeId & ~asTYPEID_MASK_SEQNBR )
- {
+ if (subTypeId & ~asTYPEID_MASK_SEQNBR) {
asIScriptContext *cmpContext = 0;
bool isNested = false;
// Try to reuse the active context
cmpContext = asGetActiveContext();
- if( cmpContext )
- {
- if( cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0 )
+ if (cmpContext) {
+ if (cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0)
isNested = true;
else
cmpContext = 0;
}
- if( cmpContext == 0 )
+ if (cmpContext == 0)
cmpContext = objType->GetEngine()->RequestContext();
// Do the sorting
@@ -1471,10 +1362,8 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
bool asc;
asIScriptContext *cmpContext;
asIScriptFunction *cmpFunc;
- bool operator()(void *a, void *b) const
- {
- if( !asc )
- {
+ bool operator()(void *a, void *b) const {
+ if (!asc) {
// Swap items
void *TEMP = a;
a = b;
@@ -1484,20 +1373,21 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
int r = 0;
// Allow sort to work even if the array contains null handles
- if( a == 0 ) return true;
- if( b == 0 ) return false;
+ if (a == 0) return true;
+ if (b == 0) return false;
// Execute object opCmp
- if( cmpFunc )
- {
+ if (cmpFunc) {
// TODO: Add proper error handling
- r = cmpContext->Prepare(cmpFunc); assert(r >= 0);
- r = cmpContext->SetObject(a); assert(r >= 0);
- r = cmpContext->SetArgObject(0, b); assert(r >= 0);
+ r = cmpContext->Prepare(cmpFunc);
+ assert(r >= 0);
+ r = cmpContext->SetObject(a);
+ assert(r >= 0);
+ r = cmpContext->SetArgObject(0, b);
+ assert(r >= 0);
r = cmpContext->Execute();
- if( r == asEXECUTION_FINISHED )
- {
+ if (r == asEXECUTION_FINISHED) {
return (int)cmpContext->GetReturnDWord() < 0;
}
}
@@ -1505,36 +1395,29 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
return false;
}
} customLess = {asc, cmpContext, cache ? cache->cmpFunc : 0};
- Common::sort((void**)GetArrayItemPointer(start), (void**)GetArrayItemPointer(end), customLess);
+ Common::sort((void **)GetArrayItemPointer(start), (void **)GetArrayItemPointer(end), customLess);
// Clean up
- if( cmpContext )
- {
- if( isNested )
- {
+ if (cmpContext) {
+ if (isNested) {
asEContextState state = cmpContext->GetState();
cmpContext->PopState();
- if( state == asEXECUTION_ABORTED )
+ if (state == asEXECUTION_ABORTED)
cmpContext->Abort();
- }
- else
+ } else
objType->GetEngine()->ReturnContext(cmpContext);
}
- }
- else
- {
+ } else {
// TODO: Use std::sort for primitive types too
// Insertion sort
asBYTE tmp[16];
- for( int i = start + 1; i < end; i++ )
- {
+ for (int i = start + 1; i < end; i++) {
Copy(tmp, GetArrayItemPointer(i));
int j = i - 1;
- while( j >= start && Less(GetDataPointer(tmp), At(j), asc) )
- {
+ while (j >= start && Less(GetDataPointer(tmp), At(j), asc)) {
Copy(GetArrayItemPointer(j + 1), GetArrayItemPointer(j));
j--;
}
@@ -1545,20 +1428,18 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
}
// Sort with script callback for comparing elements
-void CScriptArray::Sort(asIScriptFunction *func, asUINT startAt, asUINT count)
-{
+void CScriptArray::Sort(asIScriptFunction *func, asUINT startAt, asUINT count) {
// No need to sort
if (count < 2)
return;
// Check if we could access invalid item while sorting
asUINT start = startAt;
- asUINT end = asQWORD(startAt) + asQWORD(count) >= (asQWORD(1)<<32) ? 0xFFFFFFFF : startAt + count;
+ asUINT end = asQWORD(startAt) + asQWORD(count) >= (asQWORD(1) << 32) ? 0xFFFFFFFF : startAt + count;
if (end > buffer->numElements)
end = buffer->numElements;
- if (start >= buffer->numElements)
- {
+ if (start >= buffer->numElements) {
asIScriptContext *ctx = asGetActiveContext();
// Throw an exception
@@ -1573,8 +1454,7 @@ void CScriptArray::Sort(asIScriptFunction *func, asUINT startAt, asUINT count)
// Try to reuse the active context
cmpContext = asGetActiveContext();
- if (cmpContext)
- {
+ if (cmpContext) {
if (cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0)
isNested = true;
else
@@ -1589,88 +1469,73 @@ void CScriptArray::Sort(asIScriptFunction *func, asUINT startAt, asUINT count)
// Bubble sort
// TODO: optimize: Use an efficient sort algorithm
- for (asUINT i = start; i+1 < end; i++)
- {
+ for (asUINT i = start; i + 1 < end; i++) {
asUINT best = i;
- for (asUINT j = i + 1; j < end; j++)
- {
+ for (asUINT j = i + 1; j < end; j++) {
cmpContext->Prepare(func);
cmpContext->SetArgAddress(0, At(j));
cmpContext->SetArgAddress(1, At(best));
int r = cmpContext->Execute();
if (r != asEXECUTION_FINISHED)
break;
- if (*(bool*)(cmpContext->GetAddressOfReturnValue()))
+ if (*(bool *)(cmpContext->GetAddressOfReturnValue()))
best = j;
}
// With Swap we guarantee that the array always sees all references
// if the GC calls the EnumReferences in the middle of the sorting
- if( best != i )
+ if (best != i)
Swap(GetArrayItemPointer(i), GetArrayItemPointer(best));
}
- if (cmpContext)
- {
- if (isNested)
- {
+ if (cmpContext) {
+ if (isNested) {
asEContextState state = cmpContext->GetState();
cmpContext->PopState();
if (state == asEXECUTION_ABORTED)
cmpContext->Abort();
- }
- else
+ } else
objType->GetEngine()->ReturnContext(cmpContext);
}
}
// internal
-void CScriptArray::CopyBuffer(SArrayBuffer *dst, SArrayBuffer *src)
-{
+void CScriptArray::CopyBuffer(SArrayBuffer *dst, SArrayBuffer *src) {
asIScriptEngine *engine = objType->GetEngine();
- if( subTypeId & asTYPEID_OBJHANDLE )
- {
+ if (subTypeId & asTYPEID_OBJHANDLE) {
// Copy the references and increase the reference counters
- if( dst->numElements > 0 && src->numElements > 0 )
- {
+ if (dst->numElements > 0 && src->numElements > 0) {
int count = dst->numElements > src->numElements ? src->numElements : dst->numElements;
- void **max = (void**)(dst->data + count * sizeof(void*));
- void **d = (void**)dst->data;
- void **s = (void**)src->data;
+ void **max = (void **)(dst->data + count * sizeof(void *));
+ void **d = (void **)dst->data;
+ void **s = (void **)src->data;
- for( ; d < max; d++, s++ )
- {
+ for (; d < max; d++, s++) {
void *tmp = *d;
*d = *s;
- if( *d )
+ if (*d)
engine->AddRefScriptObject(*d, objType->GetSubType());
// Release the old ref after incrementing the new to avoid problem incase it is the same ref
- if( tmp )
+ if (tmp)
engine->ReleaseScriptObject(tmp, objType->GetSubType());
}
}
- }
- else
- {
- if( dst->numElements > 0 && src->numElements > 0 )
- {
+ } else {
+ if (dst->numElements > 0 && src->numElements > 0) {
int count = dst->numElements > src->numElements ? src->numElements : dst->numElements;
- if( subTypeId & asTYPEID_MASK_OBJECT )
- {
+ if (subTypeId & asTYPEID_MASK_OBJECT) {
// Call the assignment operator on all of the objects
- void **max = (void**)(dst->data + count * sizeof(void*));
- void **d = (void**)dst->data;
- void **s = (void**)src->data;
+ void **max = (void **)(dst->data + count * sizeof(void *));
+ void **d = (void **)dst->data;
+ void **s = (void **)src->data;
asITypeInfo *subType = objType->GetSubType();
- for( ; d < max; d++, s++ )
+ for (; d < max; d++, s++)
engine->AssignScriptObject(*d, *s, subType);
- }
- else
- {
+ } else {
// Primitives are copied byte for byte
- memcpy(dst->data, src->data, count*elementSize);
+ memcpy(dst->data, src->data, count * elementSize);
}
}
}
@@ -1678,21 +1543,20 @@ void CScriptArray::CopyBuffer(SArrayBuffer *dst, SArrayBuffer *src)
// internal
// Precache some info
-void CScriptArray::Precache()
-{
+void CScriptArray::Precache() {
subTypeId = objType->GetSubTypeId();
// Check if it is an array of objects. Only for these do we need to cache anything
// Type ids for primitives and enums only has the sequence number part
- if( !(subTypeId & ~asTYPEID_MASK_SEQNBR) )
+ if (!(subTypeId & ~asTYPEID_MASK_SEQNBR))
return;
// The opCmp and opEquals methods are cached because the searching for the
// methods is quite time consuming if a lot of array objects are created.
// First check if a cache already exists for this array type
- SArrayCache *cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
- if( cache ) return;
+ SArrayCache *cache = reinterpret_cast<SArrayCache *>(objType->GetUserData(ARRAY_CACHE));
+ if (cache) return;
// We need to make sure the cache is created only once, even
// if multiple threads reach the same point at the same time
@@ -1700,19 +1564,17 @@ void CScriptArray::Precache()
// Now that we got the lock, we need to check again to make sure the
// cache wasn't created while we were waiting for the lock
- cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
- if( cache )
- {
+ cache = reinterpret_cast<SArrayCache *>(objType->GetUserData(ARRAY_CACHE));
+ if (cache) {
asReleaseExclusiveLock();
return;
}
// Create the cache
- cache = reinterpret_cast<SArrayCache*>(userAlloc(sizeof(SArrayCache)));
- if( !cache )
- {
+ cache = reinterpret_cast<SArrayCache *>(userAlloc(sizeof(SArrayCache)));
+ if (!cache) {
asIScriptContext *ctx = asGetActiveContext();
- if( ctx )
+ if (ctx)
ctx->SetException("Out of memory");
asReleaseExclusiveLock();
return;
@@ -1723,78 +1585,64 @@ void CScriptArray::Precache()
bool mustBeConst = (subTypeId & asTYPEID_HANDLETOCONST) ? true : false;
asITypeInfo *subType = objType->GetEngine()->GetTypeInfoById(subTypeId);
- if( subType )
- {
- for( asUINT i = 0; i < subType->GetMethodCount(); i++ )
- {
+ if (subType) {
+ for (asUINT i = 0; i < subType->GetMethodCount(); i++) {
asIScriptFunction *func = subType->GetMethodByIndex(i);
- if( func->GetParamCount() == 1 && (!mustBeConst || func->IsReadOnly()) )
- {
+ if (func->GetParamCount() == 1 && (!mustBeConst || func->IsReadOnly())) {
asDWORD flags = 0;
int returnTypeId = func->GetReturnTypeId(&flags);
// The method must not return a reference
- if( flags != asTM_NONE )
+ if (flags != asTM_NONE)
continue;
// opCmp returns an int and opEquals returns a bool
bool isCmp = false, isEq = false;
- if( returnTypeId == asTYPEID_INT32 && strcmp(func->GetName(), "opCmp") == 0 )
+ if (returnTypeId == asTYPEID_INT32 && strcmp(func->GetName(), "opCmp") == 0)
isCmp = true;
- if( returnTypeId == asTYPEID_BOOL && strcmp(func->GetName(), "opEquals") == 0 )
+ if (returnTypeId == asTYPEID_BOOL && strcmp(func->GetName(), "opEquals") == 0)
isEq = true;
- if( !isCmp && !isEq )
+ if (!isCmp && !isEq)
continue;
// The parameter must either be a reference to the subtype or a handle to the subtype
int paramTypeId;
func->GetParam(0, ¶mTypeId, &flags);
- if( (paramTypeId & ~(asTYPEID_OBJHANDLE|asTYPEID_HANDLETOCONST)) != (subTypeId & ~(asTYPEID_OBJHANDLE|asTYPEID_HANDLETOCONST)) )
+ if ((paramTypeId & ~(asTYPEID_OBJHANDLE | asTYPEID_HANDLETOCONST)) != (subTypeId & ~(asTYPEID_OBJHANDLE | asTYPEID_HANDLETOCONST)))
continue;
- if( (flags & asTM_INREF) )
- {
- if( (paramTypeId & asTYPEID_OBJHANDLE) || (mustBeConst && !(flags & asTM_CONST)) )
+ if ((flags & asTM_INREF)) {
+ if ((paramTypeId & asTYPEID_OBJHANDLE) || (mustBeConst && !(flags & asTM_CONST)))
continue;
- }
- else if( paramTypeId & asTYPEID_OBJHANDLE )
- {
- if( mustBeConst && !(paramTypeId & asTYPEID_HANDLETOCONST) )
+ } else if (paramTypeId & asTYPEID_OBJHANDLE) {
+ if (mustBeConst && !(paramTypeId & asTYPEID_HANDLETOCONST))
continue;
- }
- else
+ } else
continue;
- if( isCmp )
- {
- if( cache->cmpFunc || cache->cmpFuncReturnCode )
- {
+ if (isCmp) {
+ if (cache->cmpFunc || cache->cmpFuncReturnCode) {
cache->cmpFunc = 0;
cache->cmpFuncReturnCode = asMULTIPLE_FUNCTIONS;
- }
- else
+ } else
cache->cmpFunc = func;
- }
- else if( isEq )
- {
- if( cache->eqFunc || cache->eqFuncReturnCode )
- {
+ } else if (isEq) {
+ if (cache->eqFunc || cache->eqFuncReturnCode) {
cache->eqFunc = 0;
cache->eqFuncReturnCode = asMULTIPLE_FUNCTIONS;
- }
- else
+ } else
cache->eqFunc = func;
}
}
}
}
- if( cache->eqFunc == 0 && cache->eqFuncReturnCode == 0 )
+ if (cache->eqFunc == 0 && cache->eqFuncReturnCode == 0)
cache->eqFuncReturnCode = asNO_FUNCTION;
- if( cache->cmpFunc == 0 && cache->cmpFuncReturnCode == 0 )
+ if (cache->cmpFunc == 0 && cache->cmpFuncReturnCode == 0)
cache->cmpFuncReturnCode = asNO_FUNCTION;
// Set the user data only at the end so others that retrieve it will know it is complete
@@ -1804,32 +1652,25 @@ void CScriptArray::Precache()
}
// GC behaviour
-void CScriptArray::EnumReferences(asIScriptEngine *engine)
-{
+void CScriptArray::EnumReferences(asIScriptEngine *engine) {
// TODO: If garbage collection can be done from a separate thread, then this method must be
// protected so that it doesn't get lost during the iteration if the array is modified
// If the array is holding handles, then we need to notify the GC of them
- if( subTypeId & asTYPEID_MASK_OBJECT )
- {
- void **d = (void**)buffer->data;
+ if (subTypeId & asTYPEID_MASK_OBJECT) {
+ void **d = (void **)buffer->data;
asITypeInfo *subType = engine->GetTypeInfoById(subTypeId);
- if ((subType->GetFlags() & asOBJ_REF))
- {
+ if ((subType->GetFlags() & asOBJ_REF)) {
// For reference types we need to notify the GC of each instance
- for (asUINT n = 0; n < buffer->numElements; n++)
- {
+ for (asUINT n = 0; n < buffer->numElements; n++) {
if (d[n])
engine->GCEnumCallback(d[n]);
}
- }
- else if ((subType->GetFlags() & asOBJ_VALUE) && (subType->GetFlags() & asOBJ_GC))
- {
+ } else if ((subType->GetFlags() & asOBJ_VALUE) && (subType->GetFlags() & asOBJ_GC)) {
// For value types we need to forward the enum callback
// to the object so it can decide what to do
- for (asUINT n = 0; n < buffer->numElements; n++)
- {
+ for (asUINT n = 0; n < buffer->numElements; n++) {
if (d[n])
engine->ForwardGCEnumReferences(d[n], subType);
}
@@ -1838,358 +1679,354 @@ void CScriptArray::EnumReferences(asIScriptEngine *engine)
}
// GC behaviour
-void CScriptArray::ReleaseAllHandles(asIScriptEngine *)
-{
+void CScriptArray::ReleaseAllHandles(asIScriptEngine *) {
// Resizing to zero will release everything
Resize(0);
}
-void CScriptArray::AddRef() const
-{
+void CScriptArray::AddRef() const {
// Clear the GC flag then increase the counter
gcFlag = false;
asAtomicInc(refCount);
}
-void CScriptArray::Release() const
-{
+void CScriptArray::Release() const {
// Clearing the GC flag then descrease the counter
gcFlag = false;
- if( asAtomicDec(refCount) == 0 )
- {
+ if (asAtomicDec(refCount) == 0) {
// When reaching 0 no more references to this instance
// exists and the object should be destroyed
this->~CScriptArray();
- userFree(const_cast<CScriptArray*>(this));
+ userFree(const_cast<CScriptArray *>(this));
}
}
// GC behaviour
-int CScriptArray::GetRefCount()
-{
+int CScriptArray::GetRefCount() {
return refCount;
}
// GC behaviour
-void CScriptArray::SetFlag()
-{
+void CScriptArray::SetFlag() {
gcFlag = true;
}
// GC behaviour
-bool CScriptArray::GetFlag()
-{
+bool CScriptArray::GetFlag() {
return gcFlag;
}
//--------------------------------------------
// Generic calling conventions
-static void ScriptArrayFactory_Generic(asIScriptGeneric *gen)
-{
- asITypeInfo *ti = *(asITypeInfo**)gen->GetAddressOfArg(0);
+static void ScriptArrayFactory_Generic(asIScriptGeneric *gen) {
+ asITypeInfo *ti = *(asITypeInfo **)gen->GetAddressOfArg(0);
- *reinterpret_cast<CScriptArray**>(gen->GetAddressOfReturnLocation()) = CScriptArray::Create(ti);
+ *reinterpret_cast<CScriptArray **>(gen->GetAddressOfReturnLocation()) = CScriptArray::Create(ti);
}
-static void ScriptArrayFactory2_Generic(asIScriptGeneric *gen)
-{
- asITypeInfo *ti = *(asITypeInfo**)gen->GetAddressOfArg(0);
+static void ScriptArrayFactory2_Generic(asIScriptGeneric *gen) {
+ asITypeInfo *ti = *(asITypeInfo **)gen->GetAddressOfArg(0);
asUINT length = gen->GetArgDWord(1);
- *reinterpret_cast<CScriptArray**>(gen->GetAddressOfReturnLocation()) = CScriptArray::Create(ti, length);
+ *reinterpret_cast<CScriptArray **>(gen->GetAddressOfReturnLocation()) = CScriptArray::Create(ti, length);
}
-static void ScriptArrayListFactory_Generic(asIScriptGeneric *gen)
-{
- asITypeInfo *ti = *(asITypeInfo**)gen->GetAddressOfArg(0);
+static void ScriptArrayListFactory_Generic(asIScriptGeneric *gen) {
+ asITypeInfo *ti = *(asITypeInfo **)gen->GetAddressOfArg(0);
void *buf = gen->GetArgAddress(1);
- *reinterpret_cast<CScriptArray**>(gen->GetAddressOfReturnLocation()) = CScriptArray::Create(ti, buf);
+ *reinterpret_cast<CScriptArray **>(gen->GetAddressOfReturnLocation()) = CScriptArray::Create(ti, buf);
}
-static void ScriptArrayFactoryDefVal_Generic(asIScriptGeneric *gen)
-{
- asITypeInfo *ti = *(asITypeInfo**)gen->GetAddressOfArg(0);
+static void ScriptArrayFactoryDefVal_Generic(asIScriptGeneric *gen) {
+ asITypeInfo *ti = *(asITypeInfo **)gen->GetAddressOfArg(0);
asUINT length = gen->GetArgDWord(1);
void *defVal = gen->GetArgAddress(2);
- *reinterpret_cast<CScriptArray**>(gen->GetAddressOfReturnLocation()) = CScriptArray::Create(ti, length, defVal);
+ *reinterpret_cast<CScriptArray **>(gen->GetAddressOfReturnLocation()) = CScriptArray::Create(ti, length, defVal);
}
-static void ScriptArrayTemplateCallback_Generic(asIScriptGeneric *gen)
-{
- asITypeInfo *ti = *(asITypeInfo**)gen->GetAddressOfArg(0);
- bool *dontGarbageCollect = *(bool**)gen->GetAddressOfArg(1);
- *reinterpret_cast<bool*>(gen->GetAddressOfReturnLocation()) = ScriptArrayTemplateCallback(ti, *dontGarbageCollect);
+static void ScriptArrayTemplateCallback_Generic(asIScriptGeneric *gen) {
+ asITypeInfo *ti = *(asITypeInfo **)gen->GetAddressOfArg(0);
+ bool *dontGarbageCollect = *(bool **)gen->GetAddressOfArg(1);
+ *reinterpret_cast<bool *>(gen->GetAddressOfReturnLocation()) = ScriptArrayTemplateCallback(ti, *dontGarbageCollect);
}
-static void ScriptArrayAssignment_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *other = (CScriptArray*)gen->GetArgObject(0);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+static void ScriptArrayAssignment_Generic(asIScriptGeneric *gen) {
+ CScriptArray *other = (CScriptArray *)gen->GetArgObject(0);
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
*self = *other;
gen->SetReturnObject(self);
}
-static void ScriptArrayEquals_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *other = (CScriptArray*)gen->GetArgObject(0);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+static void ScriptArrayEquals_Generic(asIScriptGeneric *gen) {
+ CScriptArray *other = (CScriptArray *)gen->GetArgObject(0);
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
gen->SetReturnByte(self->operator==(*other));
}
-static void ScriptArrayFind_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArrayFind_Generic(asIScriptGeneric *gen) {
void *value = gen->GetArgAddress(0);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
gen->SetReturnDWord(self->Find(value));
}
-static void ScriptArrayFind2_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArrayFind2_Generic(asIScriptGeneric *gen) {
asUINT index = gen->GetArgDWord(0);
void *value = gen->GetArgAddress(1);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
gen->SetReturnDWord(self->Find(index, value));
}
-static void ScriptArrayFindByRef_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArrayFindByRef_Generic(asIScriptGeneric *gen) {
void *value = gen->GetArgAddress(0);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
gen->SetReturnDWord(self->FindByRef(value));
}
-static void ScriptArrayFindByRef2_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArrayFindByRef2_Generic(asIScriptGeneric *gen) {
asUINT index = gen->GetArgDWord(0);
void *value = gen->GetArgAddress(1);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
gen->SetReturnDWord(self->FindByRef(index, value));
}
-static void ScriptArrayAt_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArrayAt_Generic(asIScriptGeneric *gen) {
asUINT index = gen->GetArgDWord(0);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
gen->SetReturnAddress(self->At(index));
}
-static void ScriptArrayInsertAt_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArrayInsertAt_Generic(asIScriptGeneric *gen) {
asUINT index = gen->GetArgDWord(0);
void *value = gen->GetArgAddress(1);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->InsertAt(index, value);
}
-static void ScriptArrayInsertAtArray_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArrayInsertAtArray_Generic(asIScriptGeneric *gen) {
asUINT index = gen->GetArgDWord(0);
- CScriptArray *array = (CScriptArray*)gen->GetArgAddress(1);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *array = (CScriptArray *)gen->GetArgAddress(1);
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->InsertAt(index, *array);
}
-static void ScriptArrayRemoveAt_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArrayRemoveAt_Generic(asIScriptGeneric *gen) {
asUINT index = gen->GetArgDWord(0);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->RemoveAt(index);
}
-static void ScriptArrayRemoveRange_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArrayRemoveRange_Generic(asIScriptGeneric *gen) {
asUINT start = gen->GetArgDWord(0);
asUINT count = gen->GetArgDWord(1);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->RemoveRange(start, count);
}
-static void ScriptArrayInsertLast_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArrayInsertLast_Generic(asIScriptGeneric *gen) {
void *value = gen->GetArgAddress(0);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->InsertLast(value);
}
-static void ScriptArrayRemoveLast_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+static void ScriptArrayRemoveLast_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->RemoveLast();
}
-static void ScriptArrayLength_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+static void ScriptArrayLength_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
gen->SetReturnDWord(self->GetSize());
}
-static void ScriptArrayResize_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArrayResize_Generic(asIScriptGeneric *gen) {
asUINT size = gen->GetArgDWord(0);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->Resize(size);
}
-static void ScriptArrayReserve_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArrayReserve_Generic(asIScriptGeneric *gen) {
asUINT size = gen->GetArgDWord(0);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->Reserve(size);
}
-static void ScriptArraySortAsc_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+static void ScriptArraySortAsc_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->SortAsc();
}
-static void ScriptArrayReverse_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+static void ScriptArrayReverse_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->Reverse();
}
-static void ScriptArrayIsEmpty_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
- *reinterpret_cast<bool*>(gen->GetAddressOfReturnLocation()) = self->IsEmpty();
+static void ScriptArrayIsEmpty_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
+ *reinterpret_cast<bool *>(gen->GetAddressOfReturnLocation()) = self->IsEmpty();
}
-static void ScriptArraySortAsc2_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArraySortAsc2_Generic(asIScriptGeneric *gen) {
asUINT index = gen->GetArgDWord(0);
asUINT count = gen->GetArgDWord(1);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->SortAsc(index, count);
}
-static void ScriptArraySortDesc_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+static void ScriptArraySortDesc_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->SortDesc();
}
-static void ScriptArraySortDesc2_Generic(asIScriptGeneric *gen)
-{
+static void ScriptArraySortDesc2_Generic(asIScriptGeneric *gen) {
asUINT index = gen->GetArgDWord(0);
asUINT count = gen->GetArgDWord(1);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->SortDesc(index, count);
}
-static void ScriptArraySortCallback_Generic(asIScriptGeneric *gen)
-{
- asIScriptFunction *callback = (asIScriptFunction*)gen->GetArgAddress(0);
+static void ScriptArraySortCallback_Generic(asIScriptGeneric *gen) {
+ asIScriptFunction *callback = (asIScriptFunction *)gen->GetArgAddress(0);
asUINT startAt = gen->GetArgDWord(1);
asUINT count = gen->GetArgDWord(2);
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->Sort(callback, startAt, count);
}
-static void ScriptArrayAddRef_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+static void ScriptArrayAddRef_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->AddRef();
}
-static void ScriptArrayRelease_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+static void ScriptArrayRelease_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->Release();
}
-static void ScriptArrayGetRefCount_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
- *reinterpret_cast<int*>(gen->GetAddressOfReturnLocation()) = self->GetRefCount();
+static void ScriptArrayGetRefCount_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
+ *reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = self->GetRefCount();
}
-static void ScriptArraySetFlag_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
+static void ScriptArraySetFlag_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
self->SetFlag();
}
-static void ScriptArrayGetFlag_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
- *reinterpret_cast<bool*>(gen->GetAddressOfReturnLocation()) = self->GetFlag();
+static void ScriptArrayGetFlag_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
+ *reinterpret_cast<bool *>(gen->GetAddressOfReturnLocation()) = self->GetFlag();
}
-static void ScriptArrayEnumReferences_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
- asIScriptEngine *engine = *(asIScriptEngine**)gen->GetAddressOfArg(0);
+static void ScriptArrayEnumReferences_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
+ asIScriptEngine *engine = *(asIScriptEngine **)gen->GetAddressOfArg(0);
self->EnumReferences(engine);
}
-static void ScriptArrayReleaseAllHandles_Generic(asIScriptGeneric *gen)
-{
- CScriptArray *self = (CScriptArray*)gen->GetObject();
- asIScriptEngine *engine = *(asIScriptEngine**)gen->GetAddressOfArg(0);
+static void ScriptArrayReleaseAllHandles_Generic(asIScriptGeneric *gen) {
+ CScriptArray *self = (CScriptArray *)gen->GetObject();
+ asIScriptEngine *engine = *(asIScriptEngine **)gen->GetAddressOfArg(0);
self->ReleaseAllHandles(engine);
}
-static void RegisterScriptArray_Generic(asIScriptEngine *engine)
-{
+static void RegisterScriptArray_Generic(asIScriptEngine *engine) {
int r = 0;
UNUSED_VAR(r);
engine->SetTypeInfoUserDataCleanupCallback(CleanupTypeInfoArrayCache, ARRAY_CACHE);
- r = engine->RegisterObjectType("array<class T>", 0, asOBJ_REF | asOBJ_GC | asOBJ_TEMPLATE); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_TEMPLATE_CALLBACK, "bool f(int&in, bool&out)", asFUNCTION(ScriptArrayTemplateCallback_Generic), asCALL_GENERIC); assert( r >= 0 );
-
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in)", asFUNCTION(ScriptArrayFactory_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in, uint length) explicit", asFUNCTION(ScriptArrayFactory2_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in, uint length, const T &in value)", asFUNCTION(ScriptArrayFactoryDefVal_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_LIST_FACTORY, "array<T>@ f(int&in, int&in) {repeat T}", asFUNCTION(ScriptArrayListFactory_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_ADDREF, "void f()", asFUNCTION(ScriptArrayAddRef_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_RELEASE, "void f()", asFUNCTION(ScriptArrayRelease_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "T &opIndex(uint index)", asFUNCTION(ScriptArrayAt_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "const T &opIndex(uint index) const", asFUNCTION(ScriptArrayAt_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "array<T> &opAssign(const array<T>&in)", asFUNCTION(ScriptArrayAssignment_Generic), asCALL_GENERIC); assert( r >= 0 );
-
- r = engine->RegisterObjectMethod("array<T>", "void insertAt(uint index, const T&in value)", asFUNCTION(ScriptArrayInsertAt_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void insertAt(uint index, const array<T>& arr)", asFUNCTION(ScriptArrayInsertAtArray_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterObjectMethod("array<T>", "void insertLast(const T&in value)", asFUNCTION(ScriptArrayInsertLast_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterObjectMethod("array<T>", "void removeAt(uint index)", asFUNCTION(ScriptArrayRemoveAt_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void removeLast()", asFUNCTION(ScriptArrayRemoveLast_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void removeRange(uint start, uint count)", asFUNCTION(ScriptArrayRemoveRange_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterObjectType("array<class T>", 0, asOBJ_REF | asOBJ_GC | asOBJ_TEMPLATE);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_TEMPLATE_CALLBACK, "bool f(int&in, bool&out)", asFUNCTION(ScriptArrayTemplateCallback_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in)", asFUNCTION(ScriptArrayFactory_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in, uint length) explicit", asFUNCTION(ScriptArrayFactory2_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_FACTORY, "array<T>@ f(int&in, uint length, const T &in value)", asFUNCTION(ScriptArrayFactoryDefVal_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_LIST_FACTORY, "array<T>@ f(int&in, int&in) {repeat T}", asFUNCTION(ScriptArrayListFactory_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_ADDREF, "void f()", asFUNCTION(ScriptArrayAddRef_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_RELEASE, "void f()", asFUNCTION(ScriptArrayRelease_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "T &opIndex(uint index)", asFUNCTION(ScriptArrayAt_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "const T &opIndex(uint index) const", asFUNCTION(ScriptArrayAt_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "array<T> &opAssign(const array<T>&in)", asFUNCTION(ScriptArrayAssignment_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+
+ r = engine->RegisterObjectMethod("array<T>", "void insertAt(uint index, const T&in value)", asFUNCTION(ScriptArrayInsertAt_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void insertAt(uint index, const array<T>& arr)", asFUNCTION(ScriptArrayInsertAtArray_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void insertLast(const T&in value)", asFUNCTION(ScriptArrayInsertLast_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void removeAt(uint index)", asFUNCTION(ScriptArrayRemoveAt_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void removeLast()", asFUNCTION(ScriptArrayRemoveLast_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void removeRange(uint start, uint count)", asFUNCTION(ScriptArrayRemoveRange_Generic), asCALL_GENERIC);
+ assert(r >= 0);
#if AS_USE_ACCESSORS != 1
- r = engine->RegisterObjectMethod("array<T>", "uint length() const", asFUNCTION(ScriptArrayLength_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "uint length() const", asFUNCTION(ScriptArrayLength_Generic), asCALL_GENERIC);
+ assert(r >= 0);
#endif
- r = engine->RegisterObjectMethod("array<T>", "void reserve(uint length)", asFUNCTION(ScriptArrayReserve_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void resize(uint length)", asFUNCTION(ScriptArrayResize_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void sortAsc()", asFUNCTION(ScriptArraySortAsc_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void sortAsc(uint startAt, uint count)", asFUNCTION(ScriptArraySortAsc2_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void sortDesc()", asFUNCTION(ScriptArraySortDesc_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void sortDesc(uint startAt, uint count)", asFUNCTION(ScriptArraySortDesc2_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void reverse()", asFUNCTION(ScriptArrayReverse_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "int find(const T&in if_handle_then_const value) const", asFUNCTION(ScriptArrayFind_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "int find(uint startAt, const T&in if_handle_then_const value) const", asFUNCTION(ScriptArrayFind2_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "int findByRef(const T&in if_handle_then_const value) const", asFUNCTION(ScriptArrayFindByRef_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "int findByRef(uint startAt, const T&in if_handle_then_const value) const", asFUNCTION(ScriptArrayFindByRef2_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "bool opEquals(const array<T>&in) const", asFUNCTION(ScriptArrayEquals_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "bool isEmpty() const", asFUNCTION(ScriptArrayIsEmpty_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "void reserve(uint length)", asFUNCTION(ScriptArrayReserve_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void resize(uint length)", asFUNCTION(ScriptArrayResize_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void sortAsc()", asFUNCTION(ScriptArraySortAsc_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void sortAsc(uint startAt, uint count)", asFUNCTION(ScriptArraySortAsc2_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void sortDesc()", asFUNCTION(ScriptArraySortDesc_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void sortDesc(uint startAt, uint count)", asFUNCTION(ScriptArraySortDesc2_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void reverse()", asFUNCTION(ScriptArrayReverse_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "int find(const T&in if_handle_then_const value) const", asFUNCTION(ScriptArrayFind_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "int find(uint startAt, const T&in if_handle_then_const value) const", asFUNCTION(ScriptArrayFind2_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "int findByRef(const T&in if_handle_then_const value) const", asFUNCTION(ScriptArrayFindByRef_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "int findByRef(uint startAt, const T&in if_handle_then_const value) const", asFUNCTION(ScriptArrayFindByRef2_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "bool opEquals(const array<T>&in) const", asFUNCTION(ScriptArrayEquals_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "bool isEmpty() const", asFUNCTION(ScriptArrayIsEmpty_Generic), asCALL_GENERIC);
+ assert(r >= 0);
r = engine->RegisterFuncdef("bool array<T>::less(const T&in if_handle_then_const a, const T&in if_handle_then_const b)");
- r = engine->RegisterObjectMethod("array<T>", "void sort(const less &in, uint startAt = 0, uint count = uint(-1))", asFUNCTION(ScriptArraySortCallback_Generic), asCALL_GENERIC); assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void sort(const less &in, uint startAt = 0, uint count = uint(-1))", asFUNCTION(ScriptArraySortCallback_Generic), asCALL_GENERIC);
+ assert(r >= 0);
#if AS_USE_STLNAMES != 1 && AS_USE_ACCESSORS == 1
- r = engine->RegisterObjectMethod("array<T>", "uint get_length() const property", asFUNCTION(ScriptArrayLength_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("array<T>", "void set_length(uint) property", asFUNCTION(ScriptArrayResize_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("array<T>", "uint get_length() const property", asFUNCTION(ScriptArrayLength_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("array<T>", "void set_length(uint) property", asFUNCTION(ScriptArrayResize_Generic), asCALL_GENERIC);
+ assert(r >= 0);
#endif
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_GETREFCOUNT, "int f()", asFUNCTION(ScriptArrayGetRefCount_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_SETGCFLAG, "void f()", asFUNCTION(ScriptArraySetFlag_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_GETGCFLAG, "bool f()", asFUNCTION(ScriptArrayGetFlag_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_ENUMREFS, "void f(int&in)", asFUNCTION(ScriptArrayEnumReferences_Generic), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_RELEASEREFS, "void f(int&in)", asFUNCTION(ScriptArrayReleaseAllHandles_Generic), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_GETREFCOUNT, "int f()", asFUNCTION(ScriptArrayGetRefCount_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_SETGCFLAG, "void f()", asFUNCTION(ScriptArraySetFlag_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_GETGCFLAG, "bool f()", asFUNCTION(ScriptArrayGetFlag_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_ENUMREFS, "void f(int&in)", asFUNCTION(ScriptArrayEnumReferences_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("array<T>", asBEHAVE_RELEASEREFS, "void f(int&in)", asFUNCTION(ScriptArrayReleaseAllHandles_Generic), asCALL_GENERIC);
+ assert(r >= 0);
}
END_AS_NAMESPACE
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.h b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.h
index a6e7bbc792a..c3bcf1a1315 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.h
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.h
@@ -1,7 +1,7 @@
#ifndef SCRIPTARRAY_H
#define SCRIPTARRAY_H
-#ifndef ANGELSCRIPT_H
+#ifndef ANGELSCRIPT_H
// Avoid having to inform include path if header is already include before
#include "hpl1/engine/libraries/angelscript/angelscript.h"
#endif
@@ -27,8 +27,7 @@ BEGIN_AS_NAMESPACE
struct SArrayBuffer;
struct SArrayCache;
-class CScriptArray
-{
+class CScriptArray {
public:
// Set the memory functions that should be used by all CScriptArrays
static void SetMemoryFunctions(asALLOCFUNC_t allocFunc, asFREEFUNC_t freeFunc);
@@ -64,14 +63,14 @@ public:
void *At(asUINT index);
const void *At(asUINT index) const;
- // Set value of an element.
+ // Set value of an element.
// The value arg should be a pointer to the value that will be copied to the element.
- // Remember, if the array holds handles the value parameter should be the
+ // Remember, if the array holds handles the value parameter should be the
// address of the handle. The refCount of the object will also be incremented
void SetValue(asUINT index, void *value);
// Copy the contents of one array to another (only if the types are the same)
- CScriptArray &operator=(const CScriptArray&);
+ CScriptArray &operator=(const CScriptArray &);
// Compare two arrays
bool operator==(const CScriptArray &) const;
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
index 0cd3153b8e3..b0d2602eacf 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scripthelper.cpp
@@ -7,13 +7,11 @@ using namespace std;
BEGIN_AS_NAMESPACE
-int ExecuteString(asIScriptEngine *engine, const char *code, asIScriptModule *mod, asIScriptContext *ctx)
-{
+int ExecuteString(asIScriptEngine *engine, const char *code, asIScriptModule *mod, asIScriptContext *ctx) {
return ExecuteString(engine, code, 0, asTYPEID_VOID, mod, ctx);
}
-int ExecuteString(asIScriptEngine *engine, const char *code, void *ref, int refTypeId, asIScriptModule *mod, asIScriptContext *ctx)
-{
+int ExecuteString(asIScriptEngine *engine, const char *code, void *ref, int refTypeId, asIScriptModule *mod, asIScriptContext *ctx) {
// Wrap the code in a function so that it can be compiled and executed
Common::String funcCode = " ExecuteString() {\n";
funcCode += code;
@@ -24,10 +22,9 @@ int ExecuteString(asIScriptEngine *engine, const char *code, void *ref, int refT
// GetModule will free unused types, so to be on the safe side we'll hold on to a reference to the type
asITypeInfo *type = 0;
- if( refTypeId & asTYPEID_MASK_OBJECT )
- {
+ if (refTypeId & asTYPEID_MASK_OBJECT) {
type = engine->GetTypeInfoById(refTypeId);
- if( type )
+ if (type)
type->AddRef();
}
@@ -35,41 +32,34 @@ int ExecuteString(asIScriptEngine *engine, const char *code, void *ref, int refT
asIScriptModule *execMod = mod ? mod : engine->GetModule("ExecuteString", asGM_ALWAYS_CREATE);
// Now it's ok to release the type
- if( type )
+ if (type)
type->Release();
// Compile the function that can be executed
asIScriptFunction *func = 0;
int r = execMod->CompileFunction("ExecuteString", funcCode.c_str(), -1, 0, &func);
- if( r < 0 )
+ if (r < 0)
return r;
// If no context was provided, request a new one from the engine
asIScriptContext *execCtx = ctx ? ctx : engine->RequestContext();
r = execCtx->Prepare(func);
- if (r >= 0)
- {
+ if (r >= 0) {
// Execute the function
r = execCtx->Execute();
// Unless the provided type was void retrieve it's value
- if (ref != 0 && refTypeId != asTYPEID_VOID)
- {
- if (refTypeId & asTYPEID_OBJHANDLE)
- {
+ if (ref != 0 && refTypeId != asTYPEID_VOID) {
+ if (refTypeId & asTYPEID_OBJHANDLE) {
// Expect the pointer to be null to start with
- assert(*reinterpret_cast<void**>(ref) == 0);
- *reinterpret_cast<void**>(ref) = *reinterpret_cast<void**>(execCtx->GetAddressOfReturnValue());
- engine->AddRefScriptObject(*reinterpret_cast<void**>(ref), engine->GetTypeInfoById(refTypeId));
- }
- else if (refTypeId & asTYPEID_MASK_OBJECT)
- {
+ assert(*reinterpret_cast<void **>(ref) == 0);
+ *reinterpret_cast<void **>(ref) = *reinterpret_cast<void **>(execCtx->GetAddressOfReturnValue());
+ engine->AddRefScriptObject(*reinterpret_cast<void **>(ref), engine->GetTypeInfoById(refTypeId));
+ } else if (refTypeId & asTYPEID_MASK_OBJECT) {
// Use the registered assignment operator to do a value assign.
// This assumes that the ref is pointing to a valid object instance.
engine->AssignScriptObject(ref, execCtx->GetAddressOfReturnValue(), engine->GetTypeInfoById(refTypeId));
- }
- else
- {
+ } else {
// Copy the primitive value
memcpy(ref, execCtx->GetAddressOfReturnValue(), engine->GetSizeOfPrimitiveType(refTypeId));
}
@@ -78,7 +68,7 @@ int ExecuteString(asIScriptEngine *engine, const char *code, void *ref, int refT
// Clean up
func->Release();
- if( !ctx ) engine->ReturnContext(execCtx);
+ if (!ctx) engine->ReturnContext(execCtx);
return r;
}
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
index 9b87bbbf34d..da548438a9d 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -1,6 +1,6 @@
#include "hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h"
#ifndef __psp2__
- #include <locale.h> // setlocale()
+#include <locale.h> // setlocale()
#endif
#include "common/str.h"
@@ -12,27 +12,24 @@
#define UNUSED_VAR(x) (void)(x)
struct StrComp {
- bool operator()(const Common::String* a, const Common::String* b) {
+ bool operator()(const Common::String *a, const Common::String *b) {
return *a < *b;
}
};
-using map_t = Hpl1::std::map<const Common::String*, int, StrComp>;
+using map_t = Hpl1::std::map<const Common::String *, int, StrComp>;
BEGIN_AS_NAMESPACE
-class CStdStringFactory : public asIStringFactory
-{
+class CStdStringFactory : public asIStringFactory {
public:
CStdStringFactory() {}
- ~CStdStringFactory()
- {
+ ~CStdStringFactory() {
// The script engine must release each string
// constant that it has requested
assert(stringCache.size() == 0);
}
- const void *GetStringConstant(const char *data, asUINT length)
- {
+ const void *GetStringConstant(const char *data, asUINT length) {
// The string factory might be modified from multiple
// threads, so it is necessary to use a mutex.
asAcquireExclusiveLock();
@@ -47,11 +44,10 @@ public:
}
asReleaseExclusiveLock();
- return reinterpret_cast<const void*>(it->first);
+ return reinterpret_cast<const void *>(it->first);
}
- int ReleaseStringConstant(const void *str)
- {
+ int ReleaseStringConstant(const void *str) {
if (str == 0)
return asERROR;
@@ -61,11 +57,10 @@ public:
// threads, so it is necessary to use a mutex.
asAcquireExclusiveLock();
- map_t::iterator it = stringCache.find(reinterpret_cast<const Common::String*>(str));
+ map_t::iterator it = stringCache.find(reinterpret_cast<const Common::String *>(str));
if (it == stringCache.end())
ret = asERROR;
- else
- {
+ else {
it->second--;
if (it->second == 0) {
delete it->first;
@@ -78,16 +73,15 @@ public:
return ret;
}
- int GetRawStringData(const void *str, char *data, asUINT *length) const
- {
+ int GetRawStringData(const void *str, char *data, asUINT *length) const {
if (str == 0)
return asERROR;
if (length)
- *length = (asUINT)reinterpret_cast<const Common::String*>(str)->size();
+ *length = (asUINT)reinterpret_cast<const Common::String *>(str)->size();
if (data)
- memcpy(data, reinterpret_cast<const Common::String*>(str)->c_str(), reinterpret_cast<const Common::String*>(str)->size());
+ memcpy(data, reinterpret_cast<const Common::String *>(str)->c_str(), reinterpret_cast<const Common::String *>(str)->size());
return asSUCCESS;
}
@@ -101,10 +95,8 @@ static CStdStringFactory *stringFactory = 0;
// TODO: Make this public so the application can also use the string
// factory and share the string constants if so desired, or to
// monitor the size of the string factory cache.
-CStdStringFactory *GetStdStringFactorySingleton()
-{
- if( stringFactory == 0 )
- {
+CStdStringFactory *GetStdStringFactorySingleton() {
+ if (stringFactory == 0) {
// The following instance will be destroyed by the global
// CStdStringFactoryCleaner instance upon application shutdown
stringFactory = new CStdStringFactory();
@@ -112,21 +104,17 @@ CStdStringFactory *GetStdStringFactorySingleton()
return stringFactory;
}
-class CStdStringFactoryCleaner
-{
+class CStdStringFactoryCleaner {
public:
- ~CStdStringFactoryCleaner()
- {
- if (stringFactory)
- {
+ ~CStdStringFactoryCleaner() {
+ if (stringFactory) {
// Only delete the string factory if the stringCache is empty
// If it is not empty, it means that someone might still attempt
// to release string constants, so if we delete the string factory
// the application might crash. Not deleting the cache would
// lead to a memory leak, but since this is only happens when the
// application is shutting down anyway, it is not important.
- if (stringFactory->stringCache.empty())
- {
+ if (stringFactory->stringCache.empty()) {
delete stringFactory;
stringFactory = 0;
}
@@ -137,23 +125,19 @@ public:
static CStdStringFactoryCleaner cleaner;
-static void ConstructString(Common::String *thisPointer)
-{
- new(thisPointer) Common::String();
+static void ConstructString(Common::String *thisPointer) {
+ new (thisPointer) Common::String();
}
-static void CopyConstructString(const Common::String &other, Common::String *thisPointer)
-{
- new(thisPointer) Common::String(other);
+static void CopyConstructString(const Common::String &other, Common::String *thisPointer) {
+ new (thisPointer) Common::String(other);
}
-static void DestructString(Common::String *thisPointer)
-{
+static void DestructString(Common::String *thisPointer) {
thisPointer->Common::String::~String();
}
-static Common::String &AddAssignStringToString(const Common::String &str, Common::String &dest)
-{
+static Common::String &AddAssignStringToString(const Common::String &str, Common::String &dest) {
// We don't register the method directly because some compilers
// and standard libraries inline the definition, resulting in the
// linker being unable to find the declaration.
@@ -164,8 +148,7 @@ static Common::String &AddAssignStringToString(const Common::String &str, Common
// bool string::isEmpty()
// bool string::empty() // if AS_USE_STLNAMES == 1
-static bool StringIsEmpty(const Common::String &str)
-{
+static bool StringIsEmpty(const Common::String &str) {
// We don't register the method directly because some compilers
// and standard libraries inline the definition, resulting in the
// linker being unable to find the declaration
@@ -173,120 +156,98 @@ static bool StringIsEmpty(const Common::String &str)
return str.size() > 0;
}
-static Common::String &AssignUInt64ToString(asQWORD i, Common::String &dest)
-{
+static Common::String &AssignUInt64ToString(asQWORD i, Common::String &dest) {
dest = Common::String::format("%lu", i);
return dest;
}
-static Common::String &AddAssignUInt64ToString(asQWORD i, Common::String &dest)
-{
+static Common::String &AddAssignUInt64ToString(asQWORD i, Common::String &dest) {
dest += Common::String::format("%lu", i);
return dest;
}
-static Common::String AddStringUInt64(const Common::String &str, asQWORD i)
-{
+static Common::String AddStringUInt64(const Common::String &str, asQWORD i) {
return str + Common::String::format("%lu", i);
}
-static Common::String AddInt64String(asINT64 i, const Common::String &str)
-{
+static Common::String AddInt64String(asINT64 i, const Common::String &str) {
return Common::String::format("%li", i) + str;
}
-static Common::String &AssignInt64ToString(asINT64 i, Common::String &dest)
-{
+static Common::String &AssignInt64ToString(asINT64 i, Common::String &dest) {
dest = Common::String::format("%li", i);
return dest;
}
-static Common::String &AddAssignInt64ToString(asINT64 i, Common::String &dest)
-{
+static Common::String &AddAssignInt64ToString(asINT64 i, Common::String &dest) {
dest += Common::String::format("%li", i);
return dest;
}
-static Common::String AddStringInt64(const Common::String &str, asINT64 i)
-{
+static Common::String AddStringInt64(const Common::String &str, asINT64 i) {
return str + Common::String::format("%li", i);
}
-static Common::String AddUInt64String(asQWORD i, const Common::String &str)
-{
+static Common::String AddUInt64String(asQWORD i, const Common::String &str) {
return Common::String::format("%li", i) + str;
}
-static Common::String &AssignDoubleToString(double f, Common::String &dest)
-{
+static Common::String &AssignDoubleToString(double f, Common::String &dest) {
dest = Common::String::format("%f", f);
return dest;
}
-static Common::String &AddAssignDoubleToString(double f, Common::String &dest)
-{
+static Common::String &AddAssignDoubleToString(double f, Common::String &dest) {
dest += Common::String::format("%f", f);
return dest;
}
-static Common::String &AssignFloatToString(float f, Common::String &dest)
-{
+static Common::String &AssignFloatToString(float f, Common::String &dest) {
dest = Common::String::format("%f", f);
return dest;
}
-static Common::String &AddAssignFloatToString(float f, Common::String &dest)
-{
+static Common::String &AddAssignFloatToString(float f, Common::String &dest) {
dest += Common::String::format("%f", f);
return dest;
}
-static Common::String &AssignBoolToString(bool b, Common::String &dest)
-{
+static Common::String &AssignBoolToString(bool b, Common::String &dest) {
dest = (b ? "true" : "false");
return dest;
}
-static Common::String &AddAssignBoolToString(bool b, Common::String &dest)
-{
+static Common::String &AddAssignBoolToString(bool b, Common::String &dest) {
dest += (b ? "true" : "false");
return dest;
}
-static Common::String AddStringDouble(const Common::String &str, double f)
-{
+static Common::String AddStringDouble(const Common::String &str, double f) {
return str + Common::String::format("%f", f);
}
-static Common::String AddDoubleString(double f, const Common::String &str)
-{
+static Common::String AddDoubleString(double f, const Common::String &str) {
return Common::String::format("%f", f) + str;
}
-static Common::String AddStringFloat(const Common::String &str, float f)
-{
+static Common::String AddStringFloat(const Common::String &str, float f) {
return str + Common::String::format("%f", f);
}
-static Common::String AddFloatString(float f, const Common::String &str)
-{
+static Common::String AddFloatString(float f, const Common::String &str) {
return Common::String::format("%f", f) + str;
}
-static Common::String AddStringBool(const Common::String &str, bool b)
-{
+static Common::String AddStringBool(const Common::String &str, bool b) {
return str + (b ? "true" : "false");
}
-static Common::String AddBoolString(bool b, const Common::String &str)
-{
+static Common::String AddBoolString(bool b, const Common::String &str) {
return (b ? "true" : "false") + str;
}
-static char *StringCharAt(unsigned int i, Common::String &str)
-{
- if( i >= str.size() )
- {
+static char *StringCharAt(unsigned int i, Common::String &str) {
+ if (i >= str.size()) {
// Set a script exception
asIScriptContext *ctx = asGetActiveContext();
ctx->SetException("Out of range");
@@ -300,11 +261,10 @@ static char *StringCharAt(unsigned int i, Common::String &str)
// AngelScript signature:
// int string::opCmp(const string &in) const
-static int StringCmp(const Common::String &a, const Common::String &b)
-{
+static int StringCmp(const Common::String &a, const Common::String &b) {
int cmp = 0;
- if( a < b ) cmp = -1;
- else if( a > b ) cmp = 1;
+ if (a < b) cmp = -1;
+ else if (a > b) cmp = 1;
return cmp;
}
@@ -314,8 +274,7 @@ static int StringCmp(const Common::String &a, const Common::String &b)
//
// AngelScript signature:
// int string::findFirst(const string &in sub, uint start = 0) const
-static int StringFindFirst(const Common::String &sub, asUINT start, const Common::String &str)
-{
+static int StringFindFirst(const Common::String &sub, asUINT start, const Common::String &str) {
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
return (int)str.find(sub, (size_t)start);
}
@@ -326,8 +285,7 @@ static int StringFindFirst(const Common::String &sub, asUINT start, const Common
//
// AngelScript signature:
// int string::findFirstOf(const string &in sub, uint start = 0) const
-static int StringFindFirstOf(const Common::String &sub, asUINT start, const Common::String &str)
-{
+static int StringFindFirstOf(const Common::String &sub, asUINT start, const Common::String &str) {
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
return (int)str.findFirstOf(sub, (size_t)start);
}
@@ -338,8 +296,7 @@ static int StringFindFirstOf(const Common::String &sub, asUINT start, const Comm
//
// AngelScript signature:
// int string::findLastOf(const string &in sub, uint start = -1) const
-static int StringFindLastOf(const Common::String &sub, asUINT start, const Common::String &str)
-{
+static int StringFindLastOf(const Common::String &sub, asUINT start, const Common::String &str) {
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
return (int)str.findLastOf(sub, (size_t)start);
}
@@ -349,8 +306,7 @@ static int StringFindLastOf(const Common::String &sub, asUINT start, const Commo
//
// AngelScript signature:
// int string::findFirstNotOf(const string &in sub, uint start = 0) const
-static int StringFindFirstNotOf(const Common::String &sub, asUINT start, const Common::String &str)
-{
+static int StringFindFirstNotOf(const Common::String &sub, asUINT start, const Common::String &str) {
// We don't register the method directly because the argument types change between 32bit and 64bit platforms
return (int)str.findFirstNotOf(sub, (size_t)start);
}
@@ -360,8 +316,7 @@ static int StringFindFirstNotOf(const Common::String &sub, asUINT start, const C
//
// AngelScript signature:
// int string::findLastNotOf(const string &in sub, uint start = -1) const
-static int StringFindLastNotOf(const Common::String &sub, asUINT start, const Common::String &str)
-{
+static int StringFindLastNotOf(const Common::String &sub, asUINT start, const Common::String &str) {
HPL1_UNIMPLEMENTED(__func__);
}
@@ -371,80 +326,69 @@ static int StringFindLastNotOf(const Common::String &sub, asUINT start, const Co
//
// AngelScript signature:
// int string::findLast(const string &in sub, int start = -1) const
-static int StringFindLast(const Common::String &sub, int start, const Common::String &str)
-{
+static int StringFindLast(const Common::String &sub, int start, const Common::String &str) {
HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// void string::insert(uint pos, const string &in other)
-static void StringInsert(unsigned int pos, const Common::String &other, Common::String &str)
-{
+static void StringInsert(unsigned int pos, const Common::String &other, Common::String &str) {
HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// void string::erase(uint pos, int count = -1)
-static void StringErase(unsigned int pos, int count, Common::String &str)
-{
+static void StringErase(unsigned int pos, int count, Common::String &str) {
HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// uint string::length() const
-static asUINT StringLength(const Common::String &str)
-{
+static asUINT StringLength(const Common::String &str) {
HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// void string::resize(uint l)
-static void StringResize(asUINT l, Common::String &str)
-{
+static void StringResize(asUINT l, Common::String &str) {
HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// string formatInt(int64 val, const string &in options, uint width)
-static Common::String formatInt(asINT64 value, const Common::String &options, asUINT width)
-{
+static Common::String formatInt(asINT64 value, const Common::String &options, asUINT width) {
HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// string formatUInt(uint64 val, const string &in options, uint width)
-static Common::String formatUInt(asQWORD value, const Common::String &options, asUINT width)
-{
+static Common::String formatUInt(asQWORD value, const Common::String &options, asUINT width) {
HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// string formatFloat(double val, const string &in options, uint width, uint precision)
-static Common::String formatFloat(double value, const Common::String &options, asUINT width, asUINT precision)
-{
+static Common::String formatFloat(double value, const Common::String &options, asUINT width, asUINT precision) {
HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// int64 parseInt(const string &in val, uint base = 10, uint &out byteCount = 0)
-static asINT64 parseInt(const Common::String &val, asUINT base, asUINT *byteCount)
-{
+static asINT64 parseInt(const Common::String &val, asUINT base, asUINT *byteCount) {
HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// uint64 parseUInt(const string &in val, uint base = 10, uint &out byteCount = 0)
-static asQWORD parseUInt(const Common::String &val, asUINT base, asUINT *byteCount)
-{
+static asQWORD parseUInt(const Common::String &val, asUINT base, asUINT *byteCount) {
HPL1_UNIMPLEMENTED(__func__);
}
// AngelScript signature:
// double parseFloat(const string &in val, uint &out byteCount = 0)
-double parseFloat(const Common::String &val, asUINT *byteCount)
-{
+double parseFloat(const Common::String &val, asUINT *byteCount) {
HPL1_UNIMPLEMENTED(__func__);
}
@@ -453,8 +397,7 @@ double parseFloat(const Common::String &val, asUINT *byteCount)
//
// AngelScript signature:
// string string::substr(uint start = 0, int count = -1) const
-static Common::String StringSubString(asUINT start, int count, const Common::String &str)
-{
+static Common::String StringSubString(asUINT start, int count, const Common::String &str) {
HPL1_UNIMPLEMENTED(__func__);
}
@@ -464,114 +407,168 @@ static Common::String StringSubString(asUINT start, int count, const Common::Str
// For some reason gcc 4.7 has difficulties resolving the
// asFUNCTIONPR(operator==, (const string &, const string &)
// makro, so this wrapper was introduced as work around.
-static bool StringEquals(const Common::String& lhs, const Common::String& rhs)
-{
+static bool StringEquals(const Common::String &lhs, const Common::String &rhs) {
return lhs == rhs;
}
-void RegisterStdString_Native(asIScriptEngine *engine)
-{
+void RegisterStdString_Native(asIScriptEngine *engine) {
int r = 0;
UNUSED_VAR(r);
// Register the string type
#if AS_CAN_USE_CPP11
// With C++11 it is possible to use asGetTypeTraits to automatically determine the correct flags to use
- r = engine->RegisterObjectType("string", sizeof(Common::String), asOBJ_VALUE | asGetTypeTraits<Common::String>()); assert( r >= 0 );
+ r = engine->RegisterObjectType("string", sizeof(Common::String), asOBJ_VALUE | asGetTypeTraits<Common::String>());
+ assert(r >= 0);
#else
- r = engine->RegisterObjectType("string", sizeof(Common::String), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 );
+ r = engine->RegisterObjectType("string", sizeof(Common::String), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK);
+ assert(r >= 0);
#endif
r = engine->RegisterStringFactory("string", GetStdStringFactorySingleton());
// Register the object operator overloads
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f(const string &in)", asFUNCTION(CopyConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAssign(const string &in)", asMETHODPR(Common::String, operator =, (const Common::String&), Common::String&), asCALL_THISCALL); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f(const string &in)", asFUNCTION(CopyConstructString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAssign(const string &in)", asMETHODPR(Common::String, operator =, (const Common::String &), Common::String &), asCALL_THISCALL);
+ assert(r >= 0);
// Need to use a wrapper on Mac OS X 10.7/XCode 4.3 and CLang/LLVM, otherwise the linker fails
- r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asFUNCTION(AddAssignStringToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asFUNCTION(AddAssignStringToString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
// r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asMETHODPR(string, operator+=, (const string&), string&), asCALL_THISCALL); assert( r >= 0 );
// Need to use a wrapper for operator== otherwise gcc 4.7 fails to compile
- r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in) const", asFUNCTIONPR(StringEquals, (const Common::String &, const Common::String &), bool), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "int opCmp(const string &in) const", asFUNCTION(StringCmp), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(const string &in) const", asFUNCTIONPR(Common::operator +, (const Common::String &, const Common::String &), Common::String), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in) const", asFUNCTIONPR(StringEquals, (const Common::String &, const Common::String &), bool), asCALL_CDECL_OBJFIRST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int opCmp(const string &in) const", asFUNCTION(StringCmp), asCALL_CDECL_OBJFIRST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd(const string &in) const", asFUNCTIONPR(Common::operator +, (const Common::String &, const Common::String &), Common::String), asCALL_CDECL_OBJFIRST);
+ assert(r >= 0);
// The string length can be accessed through methods or through virtual property
// TODO: Register as size() for consistency with other types
#if AS_USE_ACCESSORS != 1
- r = engine->RegisterObjectMethod("string", "uint length() const", asFUNCTION(StringLength), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "uint length() const", asFUNCTION(StringLength), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
#endif
- r = engine->RegisterObjectMethod("string", "void resize(uint)", asFUNCTION(StringResize), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "void resize(uint)", asFUNCTION(StringResize), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
#if AS_USE_STLNAMES != 1 && AS_USE_ACCESSORS == 1
// Don't register these if STL names is used, as they conflict with the method size()
- r = engine->RegisterObjectMethod("string", "uint get_length() const property", asFUNCTION(StringLength), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "void set_length(uint) property", asFUNCTION(StringResize), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "uint get_length() const property", asFUNCTION(StringLength), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "void set_length(uint) property", asFUNCTION(StringResize), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
#endif
// Need to use a wrapper on Mac OS X 10.7/XCode 4.3 and CLang/LLVM, otherwise the linker fails
// r = engine->RegisterObjectMethod("string", "bool isEmpty() const", asMETHOD(string, empty), asCALL_THISCALL); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "bool isEmpty() const", asFUNCTION(StringIsEmpty), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "bool isEmpty() const", asFUNCTION(StringIsEmpty), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
// Register the index operator, both as a mutator and as an inspector
// Note that we don't register the operator[] directly, as it doesn't do bounds checking
- r = engine->RegisterObjectMethod("string", "uint8 &opIndex(uint)", asFUNCTION(StringCharAt), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "const uint8 &opIndex(uint) const", asFUNCTION(StringCharAt), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "uint8 &opIndex(uint)", asFUNCTION(StringCharAt), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "const uint8 &opIndex(uint) const", asFUNCTION(StringCharAt), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
// Automatic conversion from values
- r = engine->RegisterObjectMethod("string", "string &opAssign(double)", asFUNCTION(AssignDoubleToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAddAssign(double)", asFUNCTION(AddAssignDoubleToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(double) const", asFUNCTION(AddStringDouble), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd_r(double) const", asFUNCTION(AddDoubleString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
-
- r = engine->RegisterObjectMethod("string", "string &opAssign(float)", asFUNCTION(AssignFloatToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAddAssign(float)", asFUNCTION(AddAssignFloatToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(float) const", asFUNCTION(AddStringFloat), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd_r(float) const", asFUNCTION(AddFloatString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
-
- r = engine->RegisterObjectMethod("string", "string &opAssign(int64)", asFUNCTION(AssignInt64ToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAddAssign(int64)", asFUNCTION(AddAssignInt64ToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(int64) const", asFUNCTION(AddStringInt64), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd_r(int64) const", asFUNCTION(AddInt64String), asCALL_CDECL_OBJLAST); assert( r >= 0 );
-
- r = engine->RegisterObjectMethod("string", "string &opAssign(uint64)", asFUNCTION(AssignUInt64ToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAddAssign(uint64)", asFUNCTION(AddAssignUInt64ToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(uint64) const", asFUNCTION(AddStringUInt64), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd_r(uint64) const", asFUNCTION(AddUInt64String), asCALL_CDECL_OBJLAST); assert( r >= 0 );
-
- r = engine->RegisterObjectMethod("string", "string &opAssign(bool)", asFUNCTION(AssignBoolToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAddAssign(bool)", asFUNCTION(AddAssignBoolToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(bool) const", asFUNCTION(AddStringBool), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd_r(bool) const", asFUNCTION(AddBoolString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "string &opAssign(double)", asFUNCTION(AssignDoubleToString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(double)", asFUNCTION(AddAssignDoubleToString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd(double) const", asFUNCTION(AddStringDouble), asCALL_CDECL_OBJFIRST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(double) const", asFUNCTION(AddDoubleString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(float)", asFUNCTION(AssignFloatToString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(float)", asFUNCTION(AddAssignFloatToString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd(float) const", asFUNCTION(AddStringFloat), asCALL_CDECL_OBJFIRST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(float) const", asFUNCTION(AddFloatString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(int64)", asFUNCTION(AssignInt64ToString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(int64)", asFUNCTION(AddAssignInt64ToString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd(int64) const", asFUNCTION(AddStringInt64), asCALL_CDECL_OBJFIRST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(int64) const", asFUNCTION(AddInt64String), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(uint64)", asFUNCTION(AssignUInt64ToString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(uint64)", asFUNCTION(AddAssignUInt64ToString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd(uint64) const", asFUNCTION(AddStringUInt64), asCALL_CDECL_OBJFIRST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(uint64) const", asFUNCTION(AddUInt64String), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(bool)", asFUNCTION(AssignBoolToString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(bool)", asFUNCTION(AddAssignBoolToString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd(bool) const", asFUNCTION(AddStringBool), asCALL_CDECL_OBJFIRST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(bool) const", asFUNCTION(AddBoolString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
// Utilities
- r = engine->RegisterObjectMethod("string", "string substr(uint start = 0, int count = -1) const", asFUNCTION(StringSubString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "int findFirst(const string &in, uint start = 0) const", asFUNCTION(StringFindFirst), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "int findFirstOf(const string &in, uint start = 0) const", asFUNCTION(StringFindFirstOf), asCALL_CDECL_OBJLAST); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "int findFirstNotOf(const string &in, uint start = 0) const", asFUNCTION(StringFindFirstNotOf), asCALL_CDECL_OBJLAST); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "int findLast(const string &in, int start = -1) const", asFUNCTION(StringFindLast), asCALL_CDECL_OBJLAST); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "int findLastOf(const string &in, int start = -1) const", asFUNCTION(StringFindLastOf), asCALL_CDECL_OBJLAST); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "int findLastNotOf(const string &in, int start = -1) const", asFUNCTION(StringFindLastNotOf), asCALL_CDECL_OBJLAST); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "void insert(uint pos, const string &in other)", asFUNCTION(StringInsert), asCALL_CDECL_OBJLAST); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "void erase(uint pos, int count = -1)", asFUNCTION(StringErase), asCALL_CDECL_OBJLAST); assert(r >= 0);
-
-
- r = engine->RegisterGlobalFunction("string formatInt(int64 val, const string &in options = \"\", uint width = 0)", asFUNCTION(formatInt), asCALL_CDECL); assert(r >= 0);
- r = engine->RegisterGlobalFunction("string formatUInt(uint64 val, const string &in options = \"\", uint width = 0)", asFUNCTION(formatUInt), asCALL_CDECL); assert(r >= 0);
- r = engine->RegisterGlobalFunction("string formatFloat(double val, const string &in options = \"\", uint width = 0, uint precision = 0)", asFUNCTION(formatFloat), asCALL_CDECL); assert(r >= 0);
- r = engine->RegisterGlobalFunction("int64 parseInt(const string &in, uint base = 10, uint &out byteCount = 0)", asFUNCTION(parseInt), asCALL_CDECL); assert(r >= 0);
- r = engine->RegisterGlobalFunction("uint64 parseUInt(const string &in, uint base = 10, uint &out byteCount = 0)", asFUNCTION(parseUInt), asCALL_CDECL); assert(r >= 0);
- r = engine->RegisterGlobalFunction("double parseFloat(const string &in, uint &out byteCount = 0)", asFUNCTION(parseFloat), asCALL_CDECL); assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string substr(uint start = 0, int count = -1) const", asFUNCTION(StringSubString), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findFirst(const string &in, uint start = 0) const", asFUNCTION(StringFindFirst), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findFirstOf(const string &in, uint start = 0) const", asFUNCTION(StringFindFirstOf), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findFirstNotOf(const string &in, uint start = 0) const", asFUNCTION(StringFindFirstNotOf), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findLast(const string &in, int start = -1) const", asFUNCTION(StringFindLast), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findLastOf(const string &in, int start = -1) const", asFUNCTION(StringFindLastOf), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findLastNotOf(const string &in, int start = -1) const", asFUNCTION(StringFindLastNotOf), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "void insert(uint pos, const string &in other)", asFUNCTION(StringInsert), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "void erase(uint pos, int count = -1)", asFUNCTION(StringErase), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
+
+
+ r = engine->RegisterGlobalFunction("string formatInt(int64 val, const string &in options = \"\", uint width = 0)", asFUNCTION(formatInt), asCALL_CDECL);
+ assert(r >= 0);
+ r = engine->RegisterGlobalFunction("string formatUInt(uint64 val, const string &in options = \"\", uint width = 0)", asFUNCTION(formatUInt), asCALL_CDECL);
+ assert(r >= 0);
+ r = engine->RegisterGlobalFunction("string formatFloat(double val, const string &in options = \"\", uint width = 0, uint precision = 0)", asFUNCTION(formatFloat), asCALL_CDECL);
+ assert(r >= 0);
+ r = engine->RegisterGlobalFunction("int64 parseInt(const string &in, uint base = 10, uint &out byteCount = 0)", asFUNCTION(parseInt), asCALL_CDECL);
+ assert(r >= 0);
+ r = engine->RegisterGlobalFunction("uint64 parseUInt(const string &in, uint base = 10, uint &out byteCount = 0)", asFUNCTION(parseUInt), asCALL_CDECL);
+ assert(r >= 0);
+ r = engine->RegisterGlobalFunction("double parseFloat(const string &in, uint &out byteCount = 0)", asFUNCTION(parseFloat), asCALL_CDECL);
+ assert(r >= 0);
#if AS_USE_STLNAMES == 1
// Same as length
- r = engine->RegisterObjectMethod("string", "uint size() const", asFUNCTION(StringLength), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "uint size() const", asFUNCTION(StringLength), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
// Same as isEmpty
- r = engine->RegisterObjectMethod("string", "bool empty() const", asFUNCTION(StringIsEmpty), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "bool empty() const", asFUNCTION(StringIsEmpty), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
// Same as findFirst
- r = engine->RegisterObjectMethod("string", "int find(const string &in, uint start = 0) const", asFUNCTION(StringFindFirst), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "int find(const string &in, uint start = 0) const", asFUNCTION(StringFindFirst), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
// Same as findLast
- r = engine->RegisterObjectMethod("string", "int rfind(const string &in, int start = -1) const", asFUNCTION(StringFindLast), asCALL_CDECL_OBJLAST); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "int rfind(const string &in, int start = -1) const", asFUNCTION(StringFindLast), asCALL_CDECL_OBJLAST);
+ assert(r >= 0);
#endif
// TODO: Implement the following
@@ -580,468 +577,467 @@ void RegisterStdString_Native(asIScriptEngine *engine)
// multiply/times/opMul/opMul_r - takes the string and multiplies it n times, e.g. "-".multiply(5) returns "-----"
}
-static void ConstructStringGeneric(asIScriptGeneric * gen)
-{
+static void ConstructStringGeneric(asIScriptGeneric *gen) {
new (gen->GetObject()) Common::String();
}
-static void CopyConstructStringGeneric(asIScriptGeneric * gen)
-{
- Common::String * a = static_cast<Common::String *>(gen->GetArgObject(0));
+static void CopyConstructStringGeneric(asIScriptGeneric *gen) {
+ Common::String *a = static_cast<Common::String *>(gen->GetArgObject(0));
new (gen->GetObject()) Common::String(*a);
}
-static void DestructStringGeneric(asIScriptGeneric * gen)
-{
- Common::String * ptr = static_cast<Common::String *>(gen->GetObject());
+static void DestructStringGeneric(asIScriptGeneric *gen) {
+ Common::String *ptr = static_cast<Common::String *>(gen->GetObject());
ptr->Common::String::~String();
}
-static void AssignStringGeneric(asIScriptGeneric *gen)
-{
- Common::String * a = static_cast<Common::String *>(gen->GetArgObject(0));
- Common::String * self = static_cast<Common::String *>(gen->GetObject());
+static void AssignStringGeneric(asIScriptGeneric *gen) {
+ Common::String *a = static_cast<Common::String *>(gen->GetArgObject(0));
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*self = *a;
gen->SetReturnAddress(self);
}
-static void AddAssignStringGeneric(asIScriptGeneric *gen)
-{
- Common::String * a = static_cast<Common::String *>(gen->GetArgObject(0));
- Common::String * self = static_cast<Common::String *>(gen->GetObject());
+static void AddAssignStringGeneric(asIScriptGeneric *gen) {
+ Common::String *a = static_cast<Common::String *>(gen->GetArgObject(0));
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*self += *a;
gen->SetReturnAddress(self);
}
-static void StringEqualsGeneric(asIScriptGeneric * gen)
-{
- Common::String * a = static_cast<Common::String *>(gen->GetObject());
- Common::String * b = static_cast<Common::String *>(gen->GetArgAddress(0));
- *(bool*)gen->GetAddressOfReturnLocation() = (*a == *b);
+static void StringEqualsGeneric(asIScriptGeneric *gen) {
+ Common::String *a = static_cast<Common::String *>(gen->GetObject());
+ Common::String *b = static_cast<Common::String *>(gen->GetArgAddress(0));
+ *(bool *)gen->GetAddressOfReturnLocation() = (*a == *b);
}
-static void StringCmpGeneric(asIScriptGeneric * gen)
-{
- Common::String * a = static_cast<Common::String *>(gen->GetObject());
- Common::String * b = static_cast<Common::String *>(gen->GetArgAddress(0));
+static void StringCmpGeneric(asIScriptGeneric *gen) {
+ Common::String *a = static_cast<Common::String *>(gen->GetObject());
+ Common::String *b = static_cast<Common::String *>(gen->GetArgAddress(0));
int cmp = 0;
- if( *a < *b ) cmp = -1;
- else if( *a > *b ) cmp = 1;
+ if (*a < *b) cmp = -1;
+ else if (*a > *b) cmp = 1;
- *(int*)gen->GetAddressOfReturnLocation() = cmp;
+ *(int *)gen->GetAddressOfReturnLocation() = cmp;
}
-static void StringAddGeneric(asIScriptGeneric * gen)
-{
- Common::String * a = static_cast<Common::String *>(gen->GetObject());
- Common::String * b = static_cast<Common::String *>(gen->GetArgAddress(0));
+static void StringAddGeneric(asIScriptGeneric *gen) {
+ Common::String *a = static_cast<Common::String *>(gen->GetObject());
+ Common::String *b = static_cast<Common::String *>(gen->GetArgAddress(0));
Common::String ret_val = *a + *b;
gen->SetReturnObject(&ret_val);
}
-static void StringLengthGeneric(asIScriptGeneric * gen)
-{
- Common::String * self = static_cast<Common::String *>(gen->GetObject());
+static void StringLengthGeneric(asIScriptGeneric *gen) {
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*static_cast<asUINT *>(gen->GetAddressOfReturnLocation()) = (asUINT)self->size();
}
-static void StringIsEmptyGeneric(asIScriptGeneric * gen)
-{
- Common::String * self = reinterpret_cast<Common::String *>(gen->GetObject());
+static void StringIsEmptyGeneric(asIScriptGeneric *gen) {
+ Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<bool *>(gen->GetAddressOfReturnLocation()) = StringIsEmpty(*self);
}
-static void StringResizeGeneric(asIScriptGeneric * gen)
-{
+static void StringResizeGeneric(asIScriptGeneric *gen) {
HPL1_UNIMPLEMENTED(StringResizeGeneric);
}
-static void StringInsert_Generic(asIScriptGeneric *gen)
-{
- Common::String * self = static_cast<Common::String *>(gen->GetObject());
+static void StringInsert_Generic(asIScriptGeneric *gen) {
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
asUINT pos = gen->GetArgDWord(0);
- Common::String *other = reinterpret_cast<Common::String*>(gen->GetArgAddress(1));
+ Common::String *other = reinterpret_cast<Common::String *>(gen->GetArgAddress(1));
StringInsert(pos, *other, *self);
}
-static void StringErase_Generic(asIScriptGeneric *gen)
-{
- Common::String * self = static_cast<Common::String *>(gen->GetObject());
+static void StringErase_Generic(asIScriptGeneric *gen) {
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
asUINT pos = gen->GetArgDWord(0);
int count = int(gen->GetArgDWord(1));
StringErase(pos, count, *self);
}
-static void StringFindFirst_Generic(asIScriptGeneric * gen)
-{
- Common::String *find = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
+static void StringFindFirst_Generic(asIScriptGeneric *gen) {
+ Common::String *find = reinterpret_cast<Common::String *>(gen->GetArgAddress(0));
asUINT start = gen->GetArgDWord(1);
Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindFirst(*find, start, *self);
}
-static void StringFindLast_Generic(asIScriptGeneric * gen)
-{
- Common::String *find = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
+static void StringFindLast_Generic(asIScriptGeneric *gen) {
+ Common::String *find = reinterpret_cast<Common::String *>(gen->GetArgAddress(0));
asUINT start = gen->GetArgDWord(1);
Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindLast(*find, start, *self);
}
-static void StringFindFirstOf_Generic(asIScriptGeneric * gen)
-{
- Common::String *find = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
+static void StringFindFirstOf_Generic(asIScriptGeneric *gen) {
+ Common::String *find = reinterpret_cast<Common::String *>(gen->GetArgAddress(0));
asUINT start = gen->GetArgDWord(1);
Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindFirstOf(*find, start, *self);
}
-static void StringFindLastOf_Generic(asIScriptGeneric * gen)
-{
- Common::String *find = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
+static void StringFindLastOf_Generic(asIScriptGeneric *gen) {
+ Common::String *find = reinterpret_cast<Common::String *>(gen->GetArgAddress(0));
asUINT start = gen->GetArgDWord(1);
Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindLastOf(*find, start, *self);
}
-static void StringFindFirstNotOf_Generic(asIScriptGeneric * gen)
-{
- Common::String *find = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
+static void StringFindFirstNotOf_Generic(asIScriptGeneric *gen) {
+ Common::String *find = reinterpret_cast<Common::String *>(gen->GetArgAddress(0));
asUINT start = gen->GetArgDWord(1);
Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindFirstNotOf(*find, start, *self);
}
-static void StringFindLastNotOf_Generic(asIScriptGeneric * gen)
-{
- Common::String *find = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
+static void StringFindLastNotOf_Generic(asIScriptGeneric *gen) {
+ Common::String *find = reinterpret_cast<Common::String *>(gen->GetArgAddress(0));
asUINT start = gen->GetArgDWord(1);
Common::String *self = reinterpret_cast<Common::String *>(gen->GetObject());
*reinterpret_cast<int *>(gen->GetAddressOfReturnLocation()) = StringFindLastNotOf(*find, start, *self);
}
-static void formatInt_Generic(asIScriptGeneric * gen)
-{
+static void formatInt_Generic(asIScriptGeneric *gen) {
asINT64 val = gen->GetArgQWord(0);
- Common::String *options = reinterpret_cast<Common::String*>(gen->GetArgAddress(1));
+ Common::String *options = reinterpret_cast<Common::String *>(gen->GetArgAddress(1));
asUINT width = gen->GetArgDWord(2);
- new(gen->GetAddressOfReturnLocation()) Common::String(formatInt(val, *options, width));
+ new (gen->GetAddressOfReturnLocation()) Common::String(formatInt(val, *options, width));
}
-static void formatUInt_Generic(asIScriptGeneric * gen)
-{
+static void formatUInt_Generic(asIScriptGeneric *gen) {
asQWORD val = gen->GetArgQWord(0);
- Common::String *options = reinterpret_cast<Common::String*>(gen->GetArgAddress(1));
+ Common::String *options = reinterpret_cast<Common::String *>(gen->GetArgAddress(1));
asUINT width = gen->GetArgDWord(2);
- new(gen->GetAddressOfReturnLocation()) Common::String(formatUInt(val, *options, width));
+ new (gen->GetAddressOfReturnLocation()) Common::String(formatUInt(val, *options, width));
}
-static void formatFloat_Generic(asIScriptGeneric *gen)
-{
+static void formatFloat_Generic(asIScriptGeneric *gen) {
double val = gen->GetArgDouble(0);
- Common::String *options = reinterpret_cast<Common::String*>(gen->GetArgAddress(1));
+ Common::String *options = reinterpret_cast<Common::String *>(gen->GetArgAddress(1));
asUINT width = gen->GetArgDWord(2);
asUINT precision = gen->GetArgDWord(3);
- new(gen->GetAddressOfReturnLocation()) Common::String(formatFloat(val, *options, width, precision));
+ new (gen->GetAddressOfReturnLocation()) Common::String(formatFloat(val, *options, width, precision));
}
-static void parseInt_Generic(asIScriptGeneric *gen)
-{
- Common::String *str = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
+static void parseInt_Generic(asIScriptGeneric *gen) {
+ Common::String *str = reinterpret_cast<Common::String *>(gen->GetArgAddress(0));
asUINT base = gen->GetArgDWord(1);
- asUINT *byteCount = reinterpret_cast<asUINT*>(gen->GetArgAddress(2));
- gen->SetReturnQWord(parseInt(*str,base,byteCount));
+ asUINT *byteCount = reinterpret_cast<asUINT *>(gen->GetArgAddress(2));
+ gen->SetReturnQWord(parseInt(*str, base, byteCount));
}
-static void parseUInt_Generic(asIScriptGeneric *gen)
-{
- Common::String *str = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
+static void parseUInt_Generic(asIScriptGeneric *gen) {
+ Common::String *str = reinterpret_cast<Common::String *>(gen->GetArgAddress(0));
asUINT base = gen->GetArgDWord(1);
- asUINT *byteCount = reinterpret_cast<asUINT*>(gen->GetArgAddress(2));
+ asUINT *byteCount = reinterpret_cast<asUINT *>(gen->GetArgAddress(2));
gen->SetReturnQWord(parseUInt(*str, base, byteCount));
}
-static void parseFloat_Generic(asIScriptGeneric *gen)
-{
- Common::String *str = reinterpret_cast<Common::String*>(gen->GetArgAddress(0));
- asUINT *byteCount = reinterpret_cast<asUINT*>(gen->GetArgAddress(1));
- gen->SetReturnDouble(parseFloat(*str,byteCount));
+static void parseFloat_Generic(asIScriptGeneric *gen) {
+ Common::String *str = reinterpret_cast<Common::String *>(gen->GetArgAddress(0));
+ asUINT *byteCount = reinterpret_cast<asUINT *>(gen->GetArgAddress(1));
+ gen->SetReturnDouble(parseFloat(*str, byteCount));
}
-static void StringCharAtGeneric(asIScriptGeneric * gen)
-{
+static void StringCharAtGeneric(asIScriptGeneric *gen) {
unsigned int index = gen->GetArgDWord(0);
- Common::String * self = static_cast<Common::String *>(gen->GetObject());
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
- if (index >= self->size())
- {
+ if (index >= self->size()) {
// Set a script exception
asIScriptContext *ctx = asGetActiveContext();
ctx->SetException("Out of range");
gen->SetReturnAddress(0);
- }
- else
- {
+ } else {
gen->SetReturnAddress(self->begin() + index);
}
}
-static void AssignInt2StringGeneric(asIScriptGeneric *gen)
-{
- asINT64 *a = static_cast<asINT64*>(gen->GetAddressOfArg(0));
- Common::String *self = static_cast<Common::String*>(gen->GetObject());
+static void AssignInt2StringGeneric(asIScriptGeneric *gen) {
+ asINT64 *a = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*self = Common::String::format("%ld", *a);
gen->SetReturnAddress(self);
}
-static void AssignUInt2StringGeneric(asIScriptGeneric *gen)
-{
- asQWORD *a = static_cast<asQWORD*>(gen->GetAddressOfArg(0));
- Common::String *self = static_cast<Common::String*>(gen->GetObject());
+static void AssignUInt2StringGeneric(asIScriptGeneric *gen) {
+ asQWORD *a = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*self = Common::String::format("%lu", *a);
gen->SetReturnAddress(self);
}
-static void AssignDouble2StringGeneric(asIScriptGeneric *gen)
-{
- double *a = static_cast<double*>(gen->GetAddressOfArg(0));
- Common::String *self = static_cast<Common::String*>(gen->GetObject());
+static void AssignDouble2StringGeneric(asIScriptGeneric *gen) {
+ double *a = static_cast<double *>(gen->GetAddressOfArg(0));
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*self = Common::String::format("%f", *a);
gen->SetReturnAddress(self);
}
-static void AssignFloat2StringGeneric(asIScriptGeneric *gen)
-{
- float *a = static_cast<float*>(gen->GetAddressOfArg(0));
- Common::String *self = static_cast<Common::String*>(gen->GetObject());
+static void AssignFloat2StringGeneric(asIScriptGeneric *gen) {
+ float *a = static_cast<float *>(gen->GetAddressOfArg(0));
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*self = Common::String::format("%f", *a);
gen->SetReturnAddress(self);
}
-static void AssignBool2StringGeneric(asIScriptGeneric *gen)
-{
- bool *a = static_cast<bool*>(gen->GetAddressOfArg(0));
- Common::String *self = static_cast<Common::String*>(gen->GetObject());
+static void AssignBool2StringGeneric(asIScriptGeneric *gen) {
+ bool *a = static_cast<bool *>(gen->GetAddressOfArg(0));
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*self = (*a ? "true" : "false");
gen->SetReturnAddress(self);
}
-static void AddAssignDouble2StringGeneric(asIScriptGeneric * gen)
-{
- double *a = static_cast<double*>(gen->GetAddressOfArg(0));
- Common::String *self = static_cast<Common::String*>(gen->GetObject());
+static void AddAssignDouble2StringGeneric(asIScriptGeneric *gen) {
+ double *a = static_cast<double *>(gen->GetAddressOfArg(0));
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*self += Common::String::format("%f", *a);
gen->SetReturnAddress(self);
}
-static void AddAssignFloat2StringGeneric(asIScriptGeneric * gen)
-{
- float *a = static_cast<float*>(gen->GetAddressOfArg(0));
- Common::String *self = static_cast<Common::String*>(gen->GetObject());
+static void AddAssignFloat2StringGeneric(asIScriptGeneric *gen) {
+ float *a = static_cast<float *>(gen->GetAddressOfArg(0));
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*self += Common::String::format("%f", *a);
gen->SetReturnAddress(self);
}
-static void AddAssignInt2StringGeneric(asIScriptGeneric * gen)
-{
- asINT64 * a = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
- Common::String *self = static_cast<Common::String*>(gen->GetObject());
+static void AddAssignInt2StringGeneric(asIScriptGeneric *gen) {
+ asINT64 *a = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*self += Common::String::format("%ld", *a);
gen->SetReturnAddress(self);
}
-static void AddAssignUInt2StringGeneric(asIScriptGeneric * gen)
-{
- asQWORD * a = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
- Common::String *self = static_cast<Common::String*>(gen->GetObject());
+static void AddAssignUInt2StringGeneric(asIScriptGeneric *gen) {
+ asQWORD *a = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*self += Common::String::format("%lu", *a);
gen->SetReturnAddress(self);
}
-static void AddAssignBool2StringGeneric(asIScriptGeneric * gen)
-{
- bool * a = static_cast<bool *>(gen->GetAddressOfArg(0));
- Common::String * self = static_cast<Common::String *>(gen->GetObject());
+static void AddAssignBool2StringGeneric(asIScriptGeneric *gen) {
+ bool *a = static_cast<bool *>(gen->GetAddressOfArg(0));
+ Common::String *self = static_cast<Common::String *>(gen->GetObject());
*self += (*a ? "true" : "false");
gen->SetReturnAddress(self);
}
-static void AddString2DoubleGeneric(asIScriptGeneric * gen)
-{
- Common::String * a = static_cast<Common::String *>(gen->GetObject());
- double * b = static_cast<double *>(gen->GetAddressOfArg(0));
+static void AddString2DoubleGeneric(asIScriptGeneric *gen) {
+ Common::String *a = static_cast<Common::String *>(gen->GetObject());
+ double *b = static_cast<double *>(gen->GetAddressOfArg(0));
Common::String ret_val = *a + Common::String::format("%f", *b);
gen->SetReturnObject(&ret_val);
}
-static void AddString2FloatGeneric(asIScriptGeneric * gen)
-{
- Common::String * a = static_cast<Common::String *>(gen->GetObject());
- float * b = static_cast<float *>(gen->GetAddressOfArg(0));
+static void AddString2FloatGeneric(asIScriptGeneric *gen) {
+ Common::String *a = static_cast<Common::String *>(gen->GetObject());
+ float *b = static_cast<float *>(gen->GetAddressOfArg(0));
Common::String ret_val = *a + Common::String::format("%f", *b);
gen->SetReturnObject(&ret_val);
}
-static void AddString2IntGeneric(asIScriptGeneric * gen)
-{
- Common::String * a = static_cast<Common::String *>(gen->GetObject());
- asINT64 * b = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
+static void AddString2IntGeneric(asIScriptGeneric *gen) {
+ Common::String *a = static_cast<Common::String *>(gen->GetObject());
+ asINT64 *b = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
Common::String ret_val = *a + Common::String::format("%ld", *b);
gen->SetReturnObject(&ret_val);
}
-static void AddString2UIntGeneric(asIScriptGeneric * gen)
-{
- Common::String * a = static_cast<Common::String *>(gen->GetObject());
- asQWORD * b = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
+static void AddString2UIntGeneric(asIScriptGeneric *gen) {
+ Common::String *a = static_cast<Common::String *>(gen->GetObject());
+ asQWORD *b = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
Common::String ret_val = *a + Common::String::format("%lu", *b);
gen->SetReturnObject(&ret_val);
}
-static void AddString2BoolGeneric(asIScriptGeneric * gen)
-{
- Common::String * a = static_cast<Common::String *>(gen->GetObject());
- bool * b = static_cast<bool *>(gen->GetAddressOfArg(0));
+static void AddString2BoolGeneric(asIScriptGeneric *gen) {
+ Common::String *a = static_cast<Common::String *>(gen->GetObject());
+ bool *b = static_cast<bool *>(gen->GetAddressOfArg(0));
Common::String ret_val = *a + (*b ? "true" : "false");
gen->SetReturnObject(&ret_val);
}
-static void AddDouble2StringGeneric(asIScriptGeneric * gen)
-{
- double* a = static_cast<double *>(gen->GetAddressOfArg(0));
- Common::String * b = static_cast<Common::String *>(gen->GetObject());
+static void AddDouble2StringGeneric(asIScriptGeneric *gen) {
+ double *a = static_cast<double *>(gen->GetAddressOfArg(0));
+ Common::String *b = static_cast<Common::String *>(gen->GetObject());
Common::String ret_val = Common::String::format("%f", *a) + *b;
gen->SetReturnObject(&ret_val);
}
-static void AddFloat2StringGeneric(asIScriptGeneric * gen)
-{
- float* a = static_cast<float *>(gen->GetAddressOfArg(0));
- Common::String * b = static_cast<Common::String *>(gen->GetObject());
+static void AddFloat2StringGeneric(asIScriptGeneric *gen) {
+ float *a = static_cast<float *>(gen->GetAddressOfArg(0));
+ Common::String *b = static_cast<Common::String *>(gen->GetObject());
Common::String ret_val = Common::String::format("%f", *a) + *b;
gen->SetReturnObject(&ret_val);
}
-static void AddInt2StringGeneric(asIScriptGeneric * gen)
-{
- asINT64* a = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
- Common::String * b = static_cast<Common::String *>(gen->GetObject());
+static void AddInt2StringGeneric(asIScriptGeneric *gen) {
+ asINT64 *a = static_cast<asINT64 *>(gen->GetAddressOfArg(0));
+ Common::String *b = static_cast<Common::String *>(gen->GetObject());
Common::String ret_val = Common::String::format("%ld", *a) + *b;
gen->SetReturnObject(&ret_val);
}
-static void AddUInt2StringGeneric(asIScriptGeneric * gen)
-{
- asQWORD* a = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
- Common::String * b = static_cast<Common::String *>(gen->GetObject());
+static void AddUInt2StringGeneric(asIScriptGeneric *gen) {
+ asQWORD *a = static_cast<asQWORD *>(gen->GetAddressOfArg(0));
+ Common::String *b = static_cast<Common::String *>(gen->GetObject());
Common::String ret_val = Common::String::format("%lu", *a) + *b;
gen->SetReturnObject(&ret_val);
}
-static void AddBool2StringGeneric(asIScriptGeneric * gen)
-{
- bool* a = static_cast<bool *>(gen->GetAddressOfArg(0));
- Common::String * b = static_cast<Common::String *>(gen->GetObject());
+static void AddBool2StringGeneric(asIScriptGeneric *gen) {
+ bool *a = static_cast<bool *>(gen->GetAddressOfArg(0));
+ Common::String *b = static_cast<Common::String *>(gen->GetObject());
Common::String ret_val = (*a ? "true" : "false") + *b;
gen->SetReturnObject(&ret_val);
}
-static void StringSubString_Generic(asIScriptGeneric *gen)
-{
+static void StringSubString_Generic(asIScriptGeneric *gen) {
// Get the arguments
- Common::String *str = (Common::String*)gen->GetObject();
- asUINT start = *(int*)gen->GetAddressOfArg(0);
- int count = *(int*)gen->GetAddressOfArg(1);
+ Common::String *str = (Common::String *)gen->GetObject();
+ asUINT start = *(int *)gen->GetAddressOfArg(0);
+ int count = *(int *)gen->GetAddressOfArg(1);
// Return the substring
- new(gen->GetAddressOfReturnLocation()) Common::String(StringSubString(start, count, *str));
+ new (gen->GetAddressOfReturnLocation()) Common::String(StringSubString(start, count, *str));
}
-void RegisterStdString_Generic(asIScriptEngine *engine)
-{
+void RegisterStdString_Generic(asIScriptEngine *engine) {
int r = 0;
UNUSED_VAR(r);
// Register the string type
- r = engine->RegisterObjectType("string", sizeof(Common::String), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 );
+ r = engine->RegisterObjectType("string", sizeof(Common::String), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK);
+ assert(r >= 0);
r = engine->RegisterStringFactory("string", GetStdStringFactorySingleton());
// Register the object operator overloads
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructStringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f(const string &in)", asFUNCTION(CopyConstructStringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructStringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAssign(const string &in)", asFUNCTION(AssignStringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asFUNCTION(AddAssignStringGeneric), asCALL_GENERIC); assert( r >= 0 );
-
- r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in) const", asFUNCTION(StringEqualsGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "int opCmp(const string &in) const", asFUNCTION(StringCmpGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(const string &in) const", asFUNCTION(StringAddGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructStringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f(const string &in)", asFUNCTION(CopyConstructStringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructStringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAssign(const string &in)", asFUNCTION(AssignStringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asFUNCTION(AddAssignStringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+
+ r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in) const", asFUNCTION(StringEqualsGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int opCmp(const string &in) const", asFUNCTION(StringCmpGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd(const string &in) const", asFUNCTION(StringAddGeneric), asCALL_GENERIC);
+ assert(r >= 0);
// Register the object methods
#if AS_USE_ACCESSORS != 1
- r = engine->RegisterObjectMethod("string", "uint length() const", asFUNCTION(StringLengthGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "uint length() const", asFUNCTION(StringLengthGeneric), asCALL_GENERIC);
+ assert(r >= 0);
#endif
- r = engine->RegisterObjectMethod("string", "void resize(uint)", asFUNCTION(StringResizeGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "void resize(uint)", asFUNCTION(StringResizeGeneric), asCALL_GENERIC);
+ assert(r >= 0);
#if AS_USE_STLNAMES != 1 && AS_USE_ACCESSORS == 1
- r = engine->RegisterObjectMethod("string", "uint get_length() const property", asFUNCTION(StringLengthGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "void set_length(uint) property", asFUNCTION(StringResizeGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "uint get_length() const property", asFUNCTION(StringLengthGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "void set_length(uint) property", asFUNCTION(StringResizeGeneric), asCALL_GENERIC);
+ assert(r >= 0);
#endif
- r = engine->RegisterObjectMethod("string", "bool isEmpty() const", asFUNCTION(StringIsEmptyGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "bool isEmpty() const", asFUNCTION(StringIsEmptyGeneric), asCALL_GENERIC);
+ assert(r >= 0);
// Register the index operator, both as a mutator and as an inspector
- r = engine->RegisterObjectMethod("string", "uint8 &opIndex(uint)", asFUNCTION(StringCharAtGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "const uint8 &opIndex(uint) const", asFUNCTION(StringCharAtGeneric), asCALL_GENERIC); assert( r >= 0 );
+ r = engine->RegisterObjectMethod("string", "uint8 &opIndex(uint)", asFUNCTION(StringCharAtGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "const uint8 &opIndex(uint) const", asFUNCTION(StringCharAtGeneric), asCALL_GENERIC);
+ assert(r >= 0);
// Automatic conversion from values
- r = engine->RegisterObjectMethod("string", "string &opAssign(double)", asFUNCTION(AssignDouble2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAddAssign(double)", asFUNCTION(AddAssignDouble2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(double) const", asFUNCTION(AddString2DoubleGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd_r(double) const", asFUNCTION(AddDouble2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
-
- r = engine->RegisterObjectMethod("string", "string &opAssign(float)", asFUNCTION(AssignFloat2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAddAssign(float)", asFUNCTION(AddAssignFloat2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(float) const", asFUNCTION(AddString2FloatGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd_r(float) const", asFUNCTION(AddFloat2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
-
- r = engine->RegisterObjectMethod("string", "string &opAssign(int64)", asFUNCTION(AssignInt2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAddAssign(int64)", asFUNCTION(AddAssignInt2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(int64) const", asFUNCTION(AddString2IntGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd_r(int64) const", asFUNCTION(AddInt2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
-
- r = engine->RegisterObjectMethod("string", "string &opAssign(uint64)", asFUNCTION(AssignUInt2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAddAssign(uint64)", asFUNCTION(AddAssignUInt2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(uint64) const", asFUNCTION(AddString2UIntGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd_r(uint64) const", asFUNCTION(AddUInt2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
-
- r = engine->RegisterObjectMethod("string", "string &opAssign(bool)", asFUNCTION(AssignBool2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string &opAddAssign(bool)", asFUNCTION(AddAssignBool2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd(bool) const", asFUNCTION(AddString2BoolGeneric), asCALL_GENERIC); assert( r >= 0 );
- r = engine->RegisterObjectMethod("string", "string opAdd_r(bool) const", asFUNCTION(AddBool2StringGeneric), asCALL_GENERIC); assert( r >= 0 );
-
- r = engine->RegisterObjectMethod("string", "string substr(uint start = 0, int count = -1) const", asFUNCTION(StringSubString_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "int findFirst(const string &in, uint start = 0) const", asFUNCTION(StringFindFirst_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "int findFirstOf(const string &in, uint start = 0) const", asFUNCTION(StringFindFirstOf_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "int findFirstNotOf(const string &in, uint start = 0) const", asFUNCTION(StringFindFirstNotOf_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "int findLast(const string &in, int start = -1) const", asFUNCTION(StringFindLast_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "int findLastOf(const string &in, int start = -1) const", asFUNCTION(StringFindLastOf_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "int findLastNotOf(const string &in, int start = -1) const", asFUNCTION(StringFindLastNotOf_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "void insert(uint pos, const string &in other)", asFUNCTION(StringInsert_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterObjectMethod("string", "void erase(uint pos, int count = -1)", asFUNCTION(StringErase_Generic), asCALL_GENERIC); assert(r >= 0);
-
-
- r = engine->RegisterGlobalFunction("string formatInt(int64 val, const string &in options = \"\", uint width = 0)", asFUNCTION(formatInt_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterGlobalFunction("string formatUInt(uint64 val, const string &in options = \"\", uint width = 0)", asFUNCTION(formatUInt_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterGlobalFunction("string formatFloat(double val, const string &in options = \"\", uint width = 0, uint precision = 0)", asFUNCTION(formatFloat_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterGlobalFunction("int64 parseInt(const string &in, uint base = 10, uint &out byteCount = 0)", asFUNCTION(parseInt_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterGlobalFunction("uint64 parseUInt(const string &in, uint base = 10, uint &out byteCount = 0)", asFUNCTION(parseUInt_Generic), asCALL_GENERIC); assert(r >= 0);
- r = engine->RegisterGlobalFunction("double parseFloat(const string &in, uint &out byteCount = 0)", asFUNCTION(parseFloat_Generic), asCALL_GENERIC); assert(r >= 0);
-}
-
-void RegisterStdString(asIScriptEngine * engine)
-{
+ r = engine->RegisterObjectMethod("string", "string &opAssign(double)", asFUNCTION(AssignDouble2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(double)", asFUNCTION(AddAssignDouble2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd(double) const", asFUNCTION(AddString2DoubleGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(double) const", asFUNCTION(AddDouble2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(float)", asFUNCTION(AssignFloat2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(float)", asFUNCTION(AddAssignFloat2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd(float) const", asFUNCTION(AddString2FloatGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(float) const", asFUNCTION(AddFloat2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(int64)", asFUNCTION(AssignInt2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(int64)", asFUNCTION(AddAssignInt2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd(int64) const", asFUNCTION(AddString2IntGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(int64) const", asFUNCTION(AddInt2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(uint64)", asFUNCTION(AssignUInt2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(uint64)", asFUNCTION(AddAssignUInt2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd(uint64) const", asFUNCTION(AddString2UIntGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(uint64) const", asFUNCTION(AddUInt2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+
+ r = engine->RegisterObjectMethod("string", "string &opAssign(bool)", asFUNCTION(AssignBool2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string &opAddAssign(bool)", asFUNCTION(AddAssignBool2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd(bool) const", asFUNCTION(AddString2BoolGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "string opAdd_r(bool) const", asFUNCTION(AddBool2StringGeneric), asCALL_GENERIC);
+ assert(r >= 0);
+
+ r = engine->RegisterObjectMethod("string", "string substr(uint start = 0, int count = -1) const", asFUNCTION(StringSubString_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findFirst(const string &in, uint start = 0) const", asFUNCTION(StringFindFirst_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findFirstOf(const string &in, uint start = 0) const", asFUNCTION(StringFindFirstOf_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findFirstNotOf(const string &in, uint start = 0) const", asFUNCTION(StringFindFirstNotOf_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findLast(const string &in, int start = -1) const", asFUNCTION(StringFindLast_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findLastOf(const string &in, int start = -1) const", asFUNCTION(StringFindLastOf_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "int findLastNotOf(const string &in, int start = -1) const", asFUNCTION(StringFindLastNotOf_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "void insert(uint pos, const string &in other)", asFUNCTION(StringInsert_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterObjectMethod("string", "void erase(uint pos, int count = -1)", asFUNCTION(StringErase_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+
+
+ r = engine->RegisterGlobalFunction("string formatInt(int64 val, const string &in options = \"\", uint width = 0)", asFUNCTION(formatInt_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterGlobalFunction("string formatUInt(uint64 val, const string &in options = \"\", uint width = 0)", asFUNCTION(formatUInt_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterGlobalFunction("string formatFloat(double val, const string &in options = \"\", uint width = 0, uint precision = 0)", asFUNCTION(formatFloat_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterGlobalFunction("int64 parseInt(const string &in, uint base = 10, uint &out byteCount = 0)", asFUNCTION(parseInt_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterGlobalFunction("uint64 parseUInt(const string &in, uint base = 10, uint &out byteCount = 0)", asFUNCTION(parseUInt_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+ r = engine->RegisterGlobalFunction("double parseFloat(const string &in, uint &out byteCount = 0)", asFUNCTION(parseFloat_Generic), asCALL_GENERIC);
+ assert(r >= 0);
+}
+
+void RegisterStdString(asIScriptEngine *engine) {
if (strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY"))
RegisterStdString_Generic(engine);
else
diff --git a/engines/hpl1/engine/libraries/angelscript/angelscript.h b/engines/hpl1/engine/libraries/angelscript/angelscript.h
index 74a52c6a53e..9152033169e 100644
--- a/engines/hpl1/engine/libraries/angelscript/angelscript.h
+++ b/engines/hpl1/engine/libraries/angelscript/angelscript.h
@@ -45,13 +45,13 @@
#endif
#ifdef AS_USE_NAMESPACE
- #define BEGIN_AS_NAMESPACE namespace AngelScript {
- #define END_AS_NAMESPACE }
- #define AS_NAMESPACE_QUALIFIER AngelScript::
+#define BEGIN_AS_NAMESPACE namespace AngelScript {
+#define END_AS_NAMESPACE }
+#define AS_NAMESPACE_QUALIFIER AngelScript::
#else
- #define BEGIN_AS_NAMESPACE
- #define END_AS_NAMESPACE
- #define AS_NAMESPACE_QUALIFIER ::
+#define BEGIN_AS_NAMESPACE
+#define END_AS_NAMESPACE
+#define AS_NAMESPACE_QUALIFIER ::
#endif
BEGIN_AS_NAMESPACE
@@ -79,8 +79,7 @@ class asIStringFactory;
// Enumerations and constants
// Return codes
-enum asERetCodes
-{
+enum asERetCodes {
asSUCCESS = 0,
asERROR = -1,
asCONTEXT_ACTIVE = -2,
@@ -113,8 +112,7 @@ enum asERetCodes
};
// Engine properties
-enum asEEngineProp
-{
+enum asEEngineProp {
asEP_ALLOW_UNSAFE_REFERENCES = 1,
asEP_OPTIMIZE_BYTECODE = 2,
asEP_COPY_SCRIPT_SECTIONS = 3,
@@ -151,8 +149,7 @@ enum asEEngineProp
};
// Calling conventions
-enum asECallConvTypes
-{
+enum asECallConvTypes {
asCALL_CDECL = 0,
asCALL_STDCALL = 1,
asCALL_THISCALL_ASGLOBAL = 2,
@@ -165,22 +162,21 @@ enum asECallConvTypes
};
// Object type flags
-enum asEObjTypeFlags
-{
+enum asEObjTypeFlags {
asOBJ_NULL = 0,
- asOBJ_REF = (1<<0),
- asOBJ_VALUE = (1<<1),
- asOBJ_GC = (1<<2),
- asOBJ_POD = (1<<3),
- asOBJ_NOHANDLE = (1<<4),
- asOBJ_SCOPED = (1<<5),
- asOBJ_TEMPLATE = (1<<6),
- asOBJ_ASHANDLE = (1<<7),
- asOBJ_APP_CLASS = (1<<8),
- asOBJ_APP_CLASS_CONSTRUCTOR = (1<<9),
- asOBJ_APP_CLASS_DESTRUCTOR = (1<<10),
- asOBJ_APP_CLASS_ASSIGNMENT = (1<<11),
- asOBJ_APP_CLASS_COPY_CONSTRUCTOR = (1<<12),
+ asOBJ_REF = (1 << 0),
+ asOBJ_VALUE = (1 << 1),
+ asOBJ_GC = (1 << 2),
+ asOBJ_POD = (1 << 3),
+ asOBJ_NOHANDLE = (1 << 4),
+ asOBJ_SCOPED = (1 << 5),
+ asOBJ_TEMPLATE = (1 << 6),
+ asOBJ_ASHANDLE = (1 << 7),
+ asOBJ_APP_CLASS = (1 << 8),
+ asOBJ_APP_CLASS_CONSTRUCTOR = (1 << 9),
+ asOBJ_APP_CLASS_DESTRUCTOR = (1 << 10),
+ asOBJ_APP_CLASS_ASSIGNMENT = (1 << 11),
+ asOBJ_APP_CLASS_COPY_CONSTRUCTOR = (1 << 12),
asOBJ_APP_CLASS_C = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR),
asOBJ_APP_CLASS_CD = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_DESTRUCTOR),
asOBJ_APP_CLASS_CA = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT),
@@ -196,32 +192,31 @@ enum asEObjTypeFlags
asOBJ_APP_CLASS_A = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_ASSIGNMENT),
asOBJ_APP_CLASS_AK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_ASSIGNMENT + asOBJ_APP_CLASS_COPY_CONSTRUCTOR),
asOBJ_APP_CLASS_K = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_COPY_CONSTRUCTOR),
- asOBJ_APP_CLASS_MORE_CONSTRUCTORS = (1<<31),
- asOBJ_APP_PRIMITIVE = (1<<13),
- asOBJ_APP_FLOAT = (1<<14),
- asOBJ_APP_ARRAY = (1<<15),
- asOBJ_APP_CLASS_ALLINTS = (1<<16),
- asOBJ_APP_CLASS_ALLFLOATS = (1<<17),
- asOBJ_NOCOUNT = (1<<18),
- asOBJ_APP_CLASS_ALIGN8 = (1<<19),
- asOBJ_IMPLICIT_HANDLE = (1<<20),
+ asOBJ_APP_CLASS_MORE_CONSTRUCTORS = (1 << 31),
+ asOBJ_APP_PRIMITIVE = (1 << 13),
+ asOBJ_APP_FLOAT = (1 << 14),
+ asOBJ_APP_ARRAY = (1 << 15),
+ asOBJ_APP_CLASS_ALLINTS = (1 << 16),
+ asOBJ_APP_CLASS_ALLFLOATS = (1 << 17),
+ asOBJ_NOCOUNT = (1 << 18),
+ asOBJ_APP_CLASS_ALIGN8 = (1 << 19),
+ asOBJ_IMPLICIT_HANDLE = (1 << 20),
asOBJ_MASK_VALID_FLAGS = 0x801FFFFF,
// Internal flags
- asOBJ_SCRIPT_OBJECT = (1<<21),
- asOBJ_SHARED = (1<<22),
- asOBJ_NOINHERIT = (1<<23),
- asOBJ_FUNCDEF = (1<<24),
- asOBJ_LIST_PATTERN = (1<<25),
- asOBJ_ENUM = (1<<26),
- asOBJ_TEMPLATE_SUBTYPE = (1<<27),
- asOBJ_TYPEDEF = (1<<28),
- asOBJ_ABSTRACT = (1<<29),
- asOBJ_APP_ALIGN16 = (1<<30)
+ asOBJ_SCRIPT_OBJECT = (1 << 21),
+ asOBJ_SHARED = (1 << 22),
+ asOBJ_NOINHERIT = (1 << 23),
+ asOBJ_FUNCDEF = (1 << 24),
+ asOBJ_LIST_PATTERN = (1 << 25),
+ asOBJ_ENUM = (1 << 26),
+ asOBJ_TEMPLATE_SUBTYPE = (1 << 27),
+ asOBJ_TYPEDEF = (1 << 28),
+ asOBJ_ABSTRACT = (1 << 29),
+ asOBJ_APP_ALIGN16 = (1 << 30)
};
// Behaviours
-enum asEBehaviours
-{
+enum asEBehaviours {
// Value object memory management
asBEHAVE_CONSTRUCT,
asBEHAVE_LIST_CONSTRUCT,
@@ -239,19 +234,18 @@ enum asEBehaviours
// Garbage collection behaviours
asBEHAVE_FIRST_GC,
- asBEHAVE_GETREFCOUNT = asBEHAVE_FIRST_GC,
- asBEHAVE_SETGCFLAG,
- asBEHAVE_GETGCFLAG,
- asBEHAVE_ENUMREFS,
- asBEHAVE_RELEASEREFS,
+ asBEHAVE_GETREFCOUNT = asBEHAVE_FIRST_GC,
+ asBEHAVE_SETGCFLAG,
+ asBEHAVE_GETGCFLAG,
+ asBEHAVE_ENUMREFS,
+ asBEHAVE_RELEASEREFS,
asBEHAVE_LAST_GC = asBEHAVE_RELEASEREFS,
asBEHAVE_MAX
};
// Context states
-enum asEContextState
-{
+enum asEContextState {
asEXECUTION_FINISHED = 0,
asEXECUTION_SUSPENDED = 1,
asEXECUTION_ABORTED = 2,
@@ -263,16 +257,14 @@ enum asEContextState
};
// Message types
-enum asEMsgType
-{
+enum asEMsgType {
asMSGTYPE_ERROR = 0,
asMSGTYPE_WARNING = 1,
asMSGTYPE_INFORMATION = 2
};
// Garbage collector flags
-enum asEGCFlags
-{
+enum asEGCFlags {
asGC_FULL_CYCLE = 1,
asGC_ONE_STEP = 2,
asGC_DESTROY_GARBAGE = 4,
@@ -280,8 +272,7 @@ enum asEGCFlags
};
// Token classes
-enum asETokenClass
-{
+enum asETokenClass {
asTC_UNKNOWN = 0,
asTC_KEYWORD = 1,
asTC_VALUE = 2,
@@ -291,8 +282,7 @@ enum asETokenClass
};
// Type id flags
-enum asETypeIdFlags
-{
+enum asETypeIdFlags {
asTYPEID_VOID = 0,
asTYPEID_BOOL = 1,
asTYPEID_INT8 = 2,
@@ -315,8 +305,7 @@ enum asETypeIdFlags
};
// Type modifiers
-enum asETypeModifiers
-{
+enum asETypeModifiers {
asTM_NONE = 0,
asTM_INREF = 1,
asTM_OUTREF = 2,
@@ -325,23 +314,20 @@ enum asETypeModifiers
};
// GetModule flags
-enum asEGMFlags
-{
+enum asEGMFlags {
asGM_ONLY_IF_EXISTS = 0,
asGM_CREATE_IF_NOT_EXISTS = 1,
asGM_ALWAYS_CREATE = 2
};
// Compile flags
-enum asECompileFlags
-{
+enum asECompileFlags {
asCOMP_ADD_TO_MODULE = 1
};
// Function types
-enum asEFuncType
-{
- asFUNC_DUMMY =-1,
+enum asEFuncType {
+ asFUNC_DUMMY = -1,
asFUNC_SYSTEM = 0,
asFUNC_SCRIPT = 1,
asFUNC_INTERFACE = 2,
@@ -364,33 +350,33 @@ typedef unsigned char asBYTE;
typedef unsigned short asWORD;
typedef unsigned int asUINT;
#if (defined(_MSC_VER) && _MSC_VER <= 1200) || defined(__S3E__) || (defined(_MSC_VER) && defined(__clang__))
- // size_t is not really correct, since it only guaranteed to be large enough to hold the segment size.
- // For example, on 16bit systems the size_t may be 16bits only even if pointers are 32bit. But nobody
- // is likely to use MSVC6 to compile for 16bit systems anymore, so this should be ok.
- typedef size_t asPWORD;
+// size_t is not really correct, since it only guaranteed to be large enough to hold the segment size.
+// For example, on 16bit systems the size_t may be 16bits only even if pointers are 32bit. But nobody
+// is likely to use MSVC6 to compile for 16bit systems anymore, so this should be ok.
+typedef size_t asPWORD;
#else
- typedef uintptr_t asPWORD;
+typedef uintptr_t asPWORD;
#endif
#ifdef __LP64__
- typedef unsigned int asDWORD;
- typedef unsigned long asQWORD;
- typedef long asINT64;
+typedef unsigned int asDWORD;
+typedef unsigned long asQWORD;
+typedef long asINT64;
+#else
+typedef unsigned long asDWORD;
+#if !defined(_MSC_VER) && (defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_CC) || defined(__psp2__))
+typedef uint64_t asQWORD;
+typedef int64_t asINT64;
#else
- typedef unsigned long asDWORD;
- #if !defined(_MSC_VER) && (defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_CC) || defined(__psp2__))
- typedef uint64_t asQWORD;
- typedef int64_t asINT64;
- #else
- typedef unsigned __int64 asQWORD;
- typedef __int64 asINT64;
- #endif
+typedef unsigned __int64 asQWORD;
+typedef __int64 asINT64;
+#endif
#endif
// Is the target a 64bit system?
#if defined(__LP64__) || defined(__amd64__) || defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_M_ARM64)
- #ifndef AS_64BIT_PTR
- #define AS_64BIT_PTR
- #endif
+#ifndef AS_64BIT_PTR
+#define AS_64BIT_PTR
+#endif
#endif
typedef void (*asFUNCTION_t)();
@@ -409,13 +395,13 @@ typedef void (*asCIRCULARREFFUNC_t)(asITypeInfo *, const void *, void *);
// Check if the compiler can use C++11 features
#if !defined(_MSC_VER) || _MSC_VER >= 1700 // MSVC 2012
- #if !defined(__GNUC__) || defined(__clang__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) // gnuc 4.7 or clang
- #if !(defined(__GNUC__) && defined(__cplusplus) && __cplusplus < 201103L) // gnuc and clang require compiler flag -std=c++11
- #if !defined(__SUNPRO_CC) // Oracle Solaris Studio
- #define AS_CAN_USE_CPP11 1
- #endif
- #endif
- #endif
+#if !defined(__GNUC__) || defined(__clang__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) // gnuc 4.7 or clang
+#if !(defined(__GNUC__) && defined(__cplusplus) && __cplusplus < 201103L) // gnuc and clang require compiler flag -std=c++11
+#if !defined(__SUNPRO_CC) // Oracle Solaris Studio
+#define AS_CAN_USE_CPP11 1
+#endif
+#endif
+#endif
#endif
// This macro does basically the same thing as offsetof defined in stddef.h, but
@@ -438,29 +424,31 @@ typedef void (*asCIRCULARREFFUNC_t)(asITypeInfo *, const void *, void *);
class asCUnknownClass;
typedef void (asCUnknownClass::*asMETHOD_t)();
-struct asSFuncPtr
-{
- asSFuncPtr(asBYTE f = 0)
- {
- for( size_t n = 0; n < sizeof(ptr.dummy); n++ )
+struct asSFuncPtr {
+ asSFuncPtr(asBYTE f = 0) {
+ for (size_t n = 0; n < sizeof(ptr.dummy); n++)
ptr.dummy[n] = 0;
flag = f;
}
- void CopyMethodPtr(const void *mthdPtr, size_t size)
- {
- for( size_t n = 0; n < size; n++ )
+ void CopyMethodPtr(const void *mthdPtr, size_t size) {
+ for (size_t n = 0; n < size; n++)
ptr.dummy[n] = reinterpret_cast<const char *>(mthdPtr)[n];
}
- union
- {
+ union {
// The largest known method point is 20 bytes (MSVC 64bit),
// but with 8byte alignment this becomes 24 bytes. So we need
// to be able to store at least that much.
char dummy[25];
- struct {asMETHOD_t mthd; char dummy[25-sizeof(asMETHOD_t)];} m;
- struct {asFUNCTION_t func; char dummy[25-sizeof(asFUNCTION_t)];} f;
+ struct {
+ asMETHOD_t mthd;
+ char dummy[25 - sizeof(asMETHOD_t)];
+ } m;
+ struct {
+ asFUNCTION_t func;
+ char dummy[25 - sizeof(asFUNCTION_t)];
+ } f;
} ptr;
asBYTE flag; // 1 = generic, 2 = global func, 3 = method
};
@@ -469,19 +457,20 @@ struct asSFuncPtr
// A bug in BCC (QC #85374) makes it impossible to distinguish const/non-const method overloads
// with static_cast<>. The workaround is to use an _implicit_cast instead.
- #if __BORLANDC__ < 0x590
- // BCC v5.8 (C++Builder 2006) and earlier have an even more annoying bug which causes
- // the "pretty" workaround below (with _implicit_cast<>) to fail. For these compilers
- // we need to use a traditional C-style cast.
- #define AS_METHOD_AMBIGUITY_CAST(t) (t)
- #else
+#if __BORLANDC__ < 0x590
+// BCC v5.8 (C++Builder 2006) and earlier have an even more annoying bug which causes
+// the "pretty" workaround below (with _implicit_cast<>) to fail. For these compilers
+// we need to use a traditional C-style cast.
+#define AS_METHOD_AMBIGUITY_CAST(t) (t)
+#else
template <typename T>
- T _implicit_cast (T val)
-{ return val; }
- #define AS_METHOD_AMBIGUITY_CAST(t) AS_NAMESPACE_QUALIFIER _implicit_cast<t >
- #endif
+T _implicit_cast(T val) {
+ return val;
+}
+#define AS_METHOD_AMBIGUITY_CAST(t) AS_NAMESPACE_QUALIFIER _implicit_cast<t >
+#endif
#else
- #define AS_METHOD_AMBIGUITY_CAST(t) static_cast<t >
+#define AS_METHOD_AMBIGUITY_CAST(t) static_cast<t >
#endif
#define asMETHOD(c,m) asSMethodPtr<sizeof(void (c::*)())>::Convert((void (c::*)())(&c::m))
@@ -489,27 +478,26 @@ template <typename T>
#else // Class methods are disabled
-struct asSFuncPtr
-{
- asSFuncPtr(asBYTE f)
- {
- for( int n = 0; n < sizeof(ptr.dummy); n++ )
+struct asSFuncPtr {
+ asSFuncPtr(asBYTE f) {
+ for (int n = 0; n < sizeof(ptr.dummy); n++)
ptr.dummy[n] = 0;
flag = f;
}
- union
- {
+ union {
char dummy[25]; // largest known class method pointer
- struct {asFUNCTION_t func; char dummy[25-sizeof(asFUNCTION_t)];} f;
+ struct {
+ asFUNCTION_t func;
+ char dummy[25 - sizeof(asFUNCTION_t)];
+ } f;
} ptr;
asBYTE flag; // 1 = generic, 2 = global func
};
#endif
-struct asSMessageInfo
-{
+struct asSMessageInfo {
const char *section;
int row;
int col;
@@ -527,21 +515,21 @@ struct asSMessageInfo
// Don't define anything when linking statically to the lib
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
- #if defined(ANGELSCRIPT_EXPORT)
- #define AS_API __declspec(dllexport)
- #elif defined(ANGELSCRIPT_DLL_LIBRARY_IMPORT)
- #define AS_API __declspec(dllimport)
- #else // statically linked library
- #define AS_API
- #endif
+#if defined(ANGELSCRIPT_EXPORT)
+#define AS_API __declspec(dllexport)
+#elif defined(ANGELSCRIPT_DLL_LIBRARY_IMPORT)
+#define AS_API __declspec(dllimport)
+#else // statically linked library
+#define AS_API
+#endif
#elif defined(__GNUC__)
- #if defined(ANGELSCRIPT_EXPORT)
- #define AS_API __attribute__((visibility ("default")))
- #else
- #define AS_API
- #endif
+#if defined(ANGELSCRIPT_EXPORT)
+#define AS_API __attribute__((visibility ("default")))
+#else
+#define AS_API
+#endif
#else
- #define AS_API
+#define AS_API
#endif
#ifndef ANGELSCRIPT_DLL_MANUAL_IMPORT
@@ -587,8 +575,7 @@ END_AS_NAMESPACE
BEGIN_AS_NAMESPACE
template<typename T>
-asUINT asGetTypeTraits()
-{
+asUINT asGetTypeTraits() {
#if defined(_MSC_VER) || defined(_LIBCPP_TYPE_TRAITS) || (__GNUC__ >= 5) || defined(__clang__)
// MSVC, XCode/Clang, and gnuc 5+
// C++11 compliant code
@@ -618,26 +605,25 @@ asUINT asGetTypeTraits()
bool isClass = std::is_class<T>::value;
bool isArray = std::is_array<T>::value;
- if( isFloat )
+ if (isFloat)
return asOBJ_APP_FLOAT;
- if( isPrimitive )
+ if (isPrimitive)
return asOBJ_APP_PRIMITIVE;
- if( isClass )
- {
+ if (isClass) {
asDWORD flags = asOBJ_APP_CLASS;
- if( hasConstructor )
+ if (hasConstructor)
flags |= asOBJ_APP_CLASS_CONSTRUCTOR;
- if( hasDestructor )
+ if (hasDestructor)
flags |= asOBJ_APP_CLASS_DESTRUCTOR;
- if( hasAssignmentOperator )
+ if (hasAssignmentOperator)
flags |= asOBJ_APP_CLASS_ASSIGNMENT;
- if( hasCopyConstructor )
+ if (hasCopyConstructor)
flags |= asOBJ_APP_CLASS_COPY_CONSTRUCTOR;
return flags;
}
- if( isArray )
+ if (isArray)
return asOBJ_APP_ARRAY;
// Unknown type traits
@@ -648,8 +634,7 @@ asUINT asGetTypeTraits()
// Interface declarations
-class asIScriptEngine
-{
+class asIScriptEngine {
public:
// Memory management
virtual int AddRef() const = 0;
@@ -788,8 +773,7 @@ protected:
virtual ~asIScriptEngine() {}
};
-class asIStringFactory
-{
+class asIStringFactory {
public:
virtual const void *GetStringConstant(const char *data, asUINT length) = 0;
virtual int ReleaseStringConstant(const void *str) = 0;
@@ -799,14 +783,12 @@ protected:
virtual ~asIStringFactory() {}
};
-class asIThreadManager
-{
+class asIThreadManager {
protected:
virtual ~asIThreadManager() {}
};
-class asIScriptModule
-{
+class asIScriptModule {
public:
virtual asIScriptEngine *GetEngine() const = 0;
virtual void SetName(const char *name) = 0;
@@ -876,8 +858,7 @@ protected:
virtual ~asIScriptModule() {}
};
-class asIScriptContext
-{
+class asIScriptContext {
public:
// Memory management
virtual int AddRef() const = 0;
@@ -927,7 +908,7 @@ public:
virtual int SetException(const char *info, bool allowCatch = true) = 0;
virtual int GetExceptionLineNumber(int *column = 0, const char **sectionName = 0) = 0;
virtual asIScriptFunction *GetExceptionFunction() = 0;
- virtual const char * GetExceptionString() = 0;
+ virtual const char *GetExceptionString() = 0;
virtual bool WillExceptionBeCaught() = 0;
virtual int SetExceptionCallback(asSFuncPtr callback, void *obj, int callConv) = 0;
virtual void ClearExceptionCallback() = 0;
@@ -956,8 +937,7 @@ protected:
virtual ~asIScriptContext() {}
};
-class asIScriptGeneric
-{
+class asIScriptGeneric {
public:
// Miscellaneous
virtual asIScriptEngine *GetEngine() const = 0;
@@ -997,8 +977,7 @@ protected:
virtual ~asIScriptGeneric() {}
};
-class asIScriptObject
-{
+class asIScriptObject {
public:
// Memory management
virtual int AddRef() const = 0;
@@ -1027,8 +1006,7 @@ protected:
virtual ~asIScriptObject() {}
};
-class asITypeInfo
-{
+class asITypeInfo {
public:
// Miscellaneous
virtual asIScriptEngine *GetEngine() const = 0;
@@ -1042,7 +1020,7 @@ public:
// Type info
virtual const char *GetName() const = 0;
- virtual const char *GetNamespace() const = 0;
+ virtual const char *GetNamespace() const = 0;
virtual asITypeInfo *GetBaseType() const = 0;
virtual bool DerivesFrom(const asITypeInfo *objType) const = 0;
virtual asDWORD GetFlags() const = 0;
@@ -1100,8 +1078,7 @@ protected:
virtual ~asITypeInfo() {}
};
-class asIScriptFunction
-{
+class asIScriptFunction {
public:
virtual asIScriptEngine *GetEngine() const = 0;
@@ -1163,8 +1140,7 @@ protected:
virtual ~asIScriptFunction() {};
};
-class asIBinaryStream
-{
+class asIBinaryStream {
public:
virtual int Read(void *ptr, asUINT size) = 0;
virtual int Write(const void *ptr, asUINT size) = 0;
@@ -1173,8 +1149,7 @@ public:
virtual ~asIBinaryStream() {}
};
-class asILockableSharedBool
-{
+class asILockableSharedBool {
public:
// Memory management
virtual int AddRef() const = 0;
@@ -1198,8 +1173,7 @@ protected:
// Template function to capture all global functions,
// except the ones using the generic calling convention
template <class T>
-inline asSFuncPtr asFunctionPtr(T func)
-{
+inline asSFuncPtr asFunctionPtr(T func) {
// Mark this as a global function
asSFuncPtr p(2);
@@ -1218,8 +1192,7 @@ inline asSFuncPtr asFunctionPtr(T func)
// Specialization for functions using the generic calling convention
template<>
-inline asSFuncPtr asFunctionPtr<asGENFUNC_t>(asGENFUNC_t func)
-{
+inline asSFuncPtr asFunctionPtr<asGENFUNC_t>(asGENFUNC_t func) {
// Mark this as a generic function
asSFuncPtr p(1);
p.ptr.f.func = reinterpret_cast<asFUNCTION_t>(func);
@@ -1237,15 +1210,13 @@ const int SINGLE_PTR_SIZE = sizeof(asSIMPLEMETHOD_t);
// Define template
template <int N>
-struct asSMethodPtr
-{
+struct asSMethodPtr {
template<class M>
- static asSFuncPtr Convert(M Mthd)
- {
+ static asSFuncPtr Convert(M Mthd) {
// This version of the function should never be executed, nor compiled,
// as it would mean that the size of the method pointer cannot be determined.
- int ERROR_UnsupportedMethodPtr[N-100];
+ int ERROR_UnsupportedMethodPtr[N - 100];
asSFuncPtr p(0);
return p;
@@ -1254,11 +1225,9 @@ struct asSMethodPtr
// Template specialization
template <>
-struct asSMethodPtr<SINGLE_PTR_SIZE>
-{
+struct asSMethodPtr<SINGLE_PTR_SIZE> {
template<class M>
- static asSFuncPtr Convert(M Mthd)
- {
+ static asSFuncPtr Convert(M Mthd) {
// Mark this as a class method
asSFuncPtr p(3);
p.CopyMethodPtr(&Mthd, SINGLE_PTR_SIZE);
@@ -1270,53 +1239,49 @@ struct asSMethodPtr<SINGLE_PTR_SIZE>
// MSVC and Intel uses different sizes for different class method pointers
template <>
-struct asSMethodPtr<SINGLE_PTR_SIZE+1*sizeof(int)>
-{
+struct asSMethodPtr < SINGLE_PTR_SIZE + 1 * sizeof(int) > {
template <class M>
- static asSFuncPtr Convert(M Mthd)
- {
+ static asSFuncPtr Convert(M Mthd) {
// Mark this as a class method
asSFuncPtr p(3);
- p.CopyMethodPtr(&Mthd, SINGLE_PTR_SIZE+sizeof(int));
+ p.CopyMethodPtr(&Mthd, SINGLE_PTR_SIZE + sizeof(int));
return p;
}
};
template <>
-struct asSMethodPtr<SINGLE_PTR_SIZE+2*sizeof(int)>
-{
+struct asSMethodPtr < SINGLE_PTR_SIZE + 2 * sizeof(int) > {
template <class M>
- static asSFuncPtr Convert(M Mthd)
- {
+ static asSFuncPtr Convert(M Mthd) {
// On 32bit platforms with is where a class with virtual inheritance falls.
// On 64bit platforms we can also fall here if 8byte data alignments is used.
// Mark this as a class method
asSFuncPtr p(3);
- p.CopyMethodPtr(&Mthd, SINGLE_PTR_SIZE+2*sizeof(int));
+ p.CopyMethodPtr(&Mthd, SINGLE_PTR_SIZE + 2 * sizeof(int));
// Microsoft has a terrible optimization on class methods with virtual inheritance.
// They are hardcoding an important offset, which is not coming in the method pointer.
#if defined(_MSC_VER) && !defined(AS_64BIT_PTR)
- // Method pointers for virtual inheritance is not supported,
- // as it requires the location of the vbase table, which is
- // only available to the C++ compiler, but not in the method
- // pointer.
+ // Method pointers for virtual inheritance is not supported,
+ // as it requires the location of the vbase table, which is
+ // only available to the C++ compiler, but not in the method
+ // pointer.
- // You can get around this by forward declaring the class and
- // storing the sizeof its method pointer in a constant. Example:
+ // You can get around this by forward declaring the class and
+ // storing the sizeof its method pointer in a constant. Example:
- // class ClassWithVirtualInheritance;
- // const int ClassWithVirtualInheritance_workaround = sizeof(void ClassWithVirtualInheritance::*());
+ // class ClassWithVirtualInheritance;
+ // const int ClassWithVirtualInheritance_workaround = sizeof(void ClassWithVirtualInheritance::*());
- // This will force the compiler to use the unknown type
- // for the class, which falls under the next case
+ // This will force the compiler to use the unknown type
+ // for the class, which falls under the next case
- // Copy the virtual table index to the 4th dword so that AngelScript
- // can properly detect and deny the use of methods with virtual inheritance.
- *(reinterpret_cast<asDWORD*>(&p)+3) = *(reinterpret_cast<asDWORD*>(&p)+2);
+ // Copy the virtual table index to the 4th dword so that AngelScript
+ // can properly detect and deny the use of methods with virtual inheritance.
+ *(reinterpret_cast<asDWORD *>(&p) + 3) = *(reinterpret_cast<asDWORD *>(&p) + 2);
#endif
return p;
@@ -1324,30 +1289,26 @@ struct asSMethodPtr<SINGLE_PTR_SIZE+2*sizeof(int)>
};
template <>
-struct asSMethodPtr<SINGLE_PTR_SIZE+3*sizeof(int)>
-{
+struct asSMethodPtr < SINGLE_PTR_SIZE + 3 * sizeof(int) > {
template <class M>
- static asSFuncPtr Convert(M Mthd)
- {
+ static asSFuncPtr Convert(M Mthd) {
// Mark this as a class method
asSFuncPtr p(3);
- p.CopyMethodPtr(&Mthd, SINGLE_PTR_SIZE+3*sizeof(int));
+ p.CopyMethodPtr(&Mthd, SINGLE_PTR_SIZE + 3 * sizeof(int));
return p;
}
};
template <>
-struct asSMethodPtr<SINGLE_PTR_SIZE+4*sizeof(int)>
-{
+struct asSMethodPtr < SINGLE_PTR_SIZE + 4 * sizeof(int) > {
template <class M>
- static asSFuncPtr Convert(M Mthd)
- {
+ static asSFuncPtr Convert(M Mthd) {
// On 64bit platforms with 8byte data alignment
// the unknown class method pointers will come here.
// Mark this as a class method
asSFuncPtr p(3);
- p.CopyMethodPtr(&Mthd, SINGLE_PTR_SIZE+4*sizeof(int));
+ p.CopyMethodPtr(&Mthd, SINGLE_PTR_SIZE + 4 * sizeof(int));
return p;
}
};
@@ -1359,8 +1320,7 @@ struct asSMethodPtr<SINGLE_PTR_SIZE+4*sizeof(int)>
//----------------------------------------------------------------
// JIT compiler
-struct asSVMRegisters
-{
+struct asSVMRegisters {
asDWORD *programPointer; // points to current bytecode instruction
asDWORD *stackFramePointer; // function stack frame
asDWORD *stackPointer; // top of stack (grows downward)
@@ -1373,8 +1333,7 @@ struct asSVMRegisters
typedef void (*asJITFunction)(asSVMRegisters *registers, asPWORD jitArg);
-class asIJITCompiler
-{
+class asIJITCompiler {
public:
virtual int CompileFunction(asIScriptFunction *function, asJITFunction *output) = 0;
virtual void ReleaseJITFunction(asJITFunction func) = 0;
@@ -1383,223 +1342,221 @@ public:
};
// Byte code instructions
-enum asEBCInstr
-{
- asBC_PopPtr = 0,
- asBC_PshGPtr = 1,
- asBC_PshC4 = 2,
- asBC_PshV4 = 3,
- asBC_PSF = 4,
- asBC_SwapPtr = 5,
- asBC_NOT = 6,
- asBC_PshG4 = 7,
- asBC_LdGRdR4 = 8,
- asBC_CALL = 9,
- asBC_RET = 10,
- asBC_JMP = 11,
- asBC_JZ = 12,
- asBC_JNZ = 13,
- asBC_JS = 14,
- asBC_JNS = 15,
- asBC_JP = 16,
- asBC_JNP = 17,
- asBC_TZ = 18,
- asBC_TNZ = 19,
- asBC_TS = 20,
- asBC_TNS = 21,
- asBC_TP = 22,
- asBC_TNP = 23,
- asBC_NEGi = 24,
- asBC_NEGf = 25,
- asBC_NEGd = 26,
- asBC_INCi16 = 27,
- asBC_INCi8 = 28,
- asBC_DECi16 = 29,
- asBC_DECi8 = 30,
- asBC_INCi = 31,
- asBC_DECi = 32,
- asBC_INCf = 33,
- asBC_DECf = 34,
- asBC_INCd = 35,
- asBC_DECd = 36,
- asBC_IncVi = 37,
- asBC_DecVi = 38,
- asBC_BNOT = 39,
- asBC_BAND = 40,
- asBC_BOR = 41,
- asBC_BXOR = 42,
- asBC_BSLL = 43,
- asBC_BSRL = 44,
- asBC_BSRA = 45,
- asBC_COPY = 46,
- asBC_PshC8 = 47,
- asBC_PshVPtr = 48,
- asBC_RDSPtr = 49,
- asBC_CMPd = 50,
- asBC_CMPu = 51,
- asBC_CMPf = 52,
- asBC_CMPi = 53,
- asBC_CMPIi = 54,
- asBC_CMPIf = 55,
- asBC_CMPIu = 56,
- asBC_JMPP = 57,
- asBC_PopRPtr = 58,
- asBC_PshRPtr = 59,
- asBC_STR = 60,
- asBC_CALLSYS = 61,
- asBC_CALLBND = 62,
- asBC_SUSPEND = 63,
- asBC_ALLOC = 64,
- asBC_FREE = 65,
- asBC_LOADOBJ = 66,
- asBC_STOREOBJ = 67,
- asBC_GETOBJ = 68,
- asBC_REFCPY = 69,
- asBC_CHKREF = 70,
- asBC_GETOBJREF = 71,
- asBC_GETREF = 72,
- asBC_PshNull = 73,
- asBC_ClrVPtr = 74,
- asBC_OBJTYPE = 75,
- asBC_TYPEID = 76,
- asBC_SetV4 = 77,
- asBC_SetV8 = 78,
- asBC_ADDSi = 79,
- asBC_CpyVtoV4 = 80,
- asBC_CpyVtoV8 = 81,
- asBC_CpyVtoR4 = 82,
- asBC_CpyVtoR8 = 83,
- asBC_CpyVtoG4 = 84,
- asBC_CpyRtoV4 = 85,
- asBC_CpyRtoV8 = 86,
- asBC_CpyGtoV4 = 87,
- asBC_WRTV1 = 88,
- asBC_WRTV2 = 89,
- asBC_WRTV4 = 90,
- asBC_WRTV8 = 91,
- asBC_RDR1 = 92,
- asBC_RDR2 = 93,
- asBC_RDR4 = 94,
- asBC_RDR8 = 95,
- asBC_LDG = 96,
- asBC_LDV = 97,
- asBC_PGA = 98,
- asBC_CmpPtr = 99,
- asBC_VAR = 100,
- asBC_iTOf = 101,
- asBC_fTOi = 102,
- asBC_uTOf = 103,
- asBC_fTOu = 104,
- asBC_sbTOi = 105,
- asBC_swTOi = 106,
- asBC_ubTOi = 107,
- asBC_uwTOi = 108,
- asBC_dTOi = 109,
- asBC_dTOu = 110,
- asBC_dTOf = 111,
- asBC_iTOd = 112,
- asBC_uTOd = 113,
- asBC_fTOd = 114,
- asBC_ADDi = 115,
- asBC_SUBi = 116,
- asBC_MULi = 117,
- asBC_DIVi = 118,
- asBC_MODi = 119,
- asBC_ADDf = 120,
- asBC_SUBf = 121,
- asBC_MULf = 122,
- asBC_DIVf = 123,
- asBC_MODf = 124,
- asBC_ADDd = 125,
- asBC_SUBd = 126,
- asBC_MULd = 127,
- asBC_DIVd = 128,
- asBC_MODd = 129,
- asBC_ADDIi = 130,
- asBC_SUBIi = 131,
- asBC_MULIi = 132,
- asBC_ADDIf = 133,
- asBC_SUBIf = 134,
- asBC_MULIf = 135,
- asBC_SetG4 = 136,
- asBC_ChkRefS = 137,
- asBC_ChkNullV = 138,
- asBC_CALLINTF = 139,
- asBC_iTOb = 140,
- asBC_iTOw = 141,
- asBC_SetV1 = 142,
- asBC_SetV2 = 143,
- asBC_Cast = 144,
- asBC_i64TOi = 145,
- asBC_uTOi64 = 146,
- asBC_iTOi64 = 147,
- asBC_fTOi64 = 148,
- asBC_dTOi64 = 149,
- asBC_fTOu64 = 150,
- asBC_dTOu64 = 151,
- asBC_i64TOf = 152,
- asBC_u64TOf = 153,
- asBC_i64TOd = 154,
- asBC_u64TOd = 155,
- asBC_NEGi64 = 156,
- asBC_INCi64 = 157,
- asBC_DECi64 = 158,
- asBC_BNOT64 = 159,
- asBC_ADDi64 = 160,
- asBC_SUBi64 = 161,
- asBC_MULi64 = 162,
- asBC_DIVi64 = 163,
- asBC_MODi64 = 164,
- asBC_BAND64 = 165,
- asBC_BOR64 = 166,
- asBC_BXOR64 = 167,
- asBC_BSLL64 = 168,
- asBC_BSRL64 = 169,
- asBC_BSRA64 = 170,
- asBC_CMPi64 = 171,
- asBC_CMPu64 = 172,
- asBC_ChkNullS = 173,
- asBC_ClrHi = 174,
- asBC_JitEntry = 175,
- asBC_CallPtr = 176,
- asBC_FuncPtr = 177,
- asBC_LoadThisR = 178,
- asBC_PshV8 = 179,
- asBC_DIVu = 180,
- asBC_MODu = 181,
- asBC_DIVu64 = 182,
- asBC_MODu64 = 183,
- asBC_LoadRObjR = 184,
- asBC_LoadVObjR = 185,
- asBC_RefCpyV = 186,
- asBC_JLowZ = 187,
- asBC_JLowNZ = 188,
- asBC_AllocMem = 189,
- asBC_SetListSize = 190,
- asBC_PshListElmnt = 191,
- asBC_SetListType = 192,
- asBC_POWi = 193,
- asBC_POWu = 194,
- asBC_POWf = 195,
- asBC_POWd = 196,
- asBC_POWdi = 197,
- asBC_POWi64 = 198,
- asBC_POWu64 = 199,
- asBC_Thiscall1 = 200,
- asBC_MAXBYTECODE = 201,
+enum asEBCInstr {
+ asBC_PopPtr = 0,
+ asBC_PshGPtr = 1,
+ asBC_PshC4 = 2,
+ asBC_PshV4 = 3,
+ asBC_PSF = 4,
+ asBC_SwapPtr = 5,
+ asBC_NOT = 6,
+ asBC_PshG4 = 7,
+ asBC_LdGRdR4 = 8,
+ asBC_CALL = 9,
+ asBC_RET = 10,
+ asBC_JMP = 11,
+ asBC_JZ = 12,
+ asBC_JNZ = 13,
+ asBC_JS = 14,
+ asBC_JNS = 15,
+ asBC_JP = 16,
+ asBC_JNP = 17,
+ asBC_TZ = 18,
+ asBC_TNZ = 19,
+ asBC_TS = 20,
+ asBC_TNS = 21,
+ asBC_TP = 22,
+ asBC_TNP = 23,
+ asBC_NEGi = 24,
+ asBC_NEGf = 25,
+ asBC_NEGd = 26,
+ asBC_INCi16 = 27,
+ asBC_INCi8 = 28,
+ asBC_DECi16 = 29,
+ asBC_DECi8 = 30,
+ asBC_INCi = 31,
+ asBC_DECi = 32,
+ asBC_INCf = 33,
+ asBC_DECf = 34,
+ asBC_INCd = 35,
+ asBC_DECd = 36,
+ asBC_IncVi = 37,
+ asBC_DecVi = 38,
+ asBC_BNOT = 39,
+ asBC_BAND = 40,
+ asBC_BOR = 41,
+ asBC_BXOR = 42,
+ asBC_BSLL = 43,
+ asBC_BSRL = 44,
+ asBC_BSRA = 45,
+ asBC_COPY = 46,
+ asBC_PshC8 = 47,
+ asBC_PshVPtr = 48,
+ asBC_RDSPtr = 49,
+ asBC_CMPd = 50,
+ asBC_CMPu = 51,
+ asBC_CMPf = 52,
+ asBC_CMPi = 53,
+ asBC_CMPIi = 54,
+ asBC_CMPIf = 55,
+ asBC_CMPIu = 56,
+ asBC_JMPP = 57,
+ asBC_PopRPtr = 58,
+ asBC_PshRPtr = 59,
+ asBC_STR = 60,
+ asBC_CALLSYS = 61,
+ asBC_CALLBND = 62,
+ asBC_SUSPEND = 63,
+ asBC_ALLOC = 64,
+ asBC_FREE = 65,
+ asBC_LOADOBJ = 66,
+ asBC_STOREOBJ = 67,
+ asBC_GETOBJ = 68,
+ asBC_REFCPY = 69,
+ asBC_CHKREF = 70,
+ asBC_GETOBJREF = 71,
+ asBC_GETREF = 72,
+ asBC_PshNull = 73,
+ asBC_ClrVPtr = 74,
+ asBC_OBJTYPE = 75,
+ asBC_TYPEID = 76,
+ asBC_SetV4 = 77,
+ asBC_SetV8 = 78,
+ asBC_ADDSi = 79,
+ asBC_CpyVtoV4 = 80,
+ asBC_CpyVtoV8 = 81,
+ asBC_CpyVtoR4 = 82,
+ asBC_CpyVtoR8 = 83,
+ asBC_CpyVtoG4 = 84,
+ asBC_CpyRtoV4 = 85,
+ asBC_CpyRtoV8 = 86,
+ asBC_CpyGtoV4 = 87,
+ asBC_WRTV1 = 88,
+ asBC_WRTV2 = 89,
+ asBC_WRTV4 = 90,
+ asBC_WRTV8 = 91,
+ asBC_RDR1 = 92,
+ asBC_RDR2 = 93,
+ asBC_RDR4 = 94,
+ asBC_RDR8 = 95,
+ asBC_LDG = 96,
+ asBC_LDV = 97,
+ asBC_PGA = 98,
+ asBC_CmpPtr = 99,
+ asBC_VAR = 100,
+ asBC_iTOf = 101,
+ asBC_fTOi = 102,
+ asBC_uTOf = 103,
+ asBC_fTOu = 104,
+ asBC_sbTOi = 105,
+ asBC_swTOi = 106,
+ asBC_ubTOi = 107,
+ asBC_uwTOi = 108,
+ asBC_dTOi = 109,
+ asBC_dTOu = 110,
+ asBC_dTOf = 111,
+ asBC_iTOd = 112,
+ asBC_uTOd = 113,
+ asBC_fTOd = 114,
+ asBC_ADDi = 115,
+ asBC_SUBi = 116,
+ asBC_MULi = 117,
+ asBC_DIVi = 118,
+ asBC_MODi = 119,
+ asBC_ADDf = 120,
+ asBC_SUBf = 121,
+ asBC_MULf = 122,
+ asBC_DIVf = 123,
+ asBC_MODf = 124,
+ asBC_ADDd = 125,
+ asBC_SUBd = 126,
+ asBC_MULd = 127,
+ asBC_DIVd = 128,
+ asBC_MODd = 129,
+ asBC_ADDIi = 130,
+ asBC_SUBIi = 131,
+ asBC_MULIi = 132,
+ asBC_ADDIf = 133,
+ asBC_SUBIf = 134,
+ asBC_MULIf = 135,
+ asBC_SetG4 = 136,
+ asBC_ChkRefS = 137,
+ asBC_ChkNullV = 138,
+ asBC_CALLINTF = 139,
+ asBC_iTOb = 140,
+ asBC_iTOw = 141,
+ asBC_SetV1 = 142,
+ asBC_SetV2 = 143,
+ asBC_Cast = 144,
+ asBC_i64TOi = 145,
+ asBC_uTOi64 = 146,
+ asBC_iTOi64 = 147,
+ asBC_fTOi64 = 148,
+ asBC_dTOi64 = 149,
+ asBC_fTOu64 = 150,
+ asBC_dTOu64 = 151,
+ asBC_i64TOf = 152,
+ asBC_u64TOf = 153,
+ asBC_i64TOd = 154,
+ asBC_u64TOd = 155,
+ asBC_NEGi64 = 156,
+ asBC_INCi64 = 157,
+ asBC_DECi64 = 158,
+ asBC_BNOT64 = 159,
+ asBC_ADDi64 = 160,
+ asBC_SUBi64 = 161,
+ asBC_MULi64 = 162,
+ asBC_DIVi64 = 163,
+ asBC_MODi64 = 164,
+ asBC_BAND64 = 165,
+ asBC_BOR64 = 166,
+ asBC_BXOR64 = 167,
+ asBC_BSLL64 = 168,
+ asBC_BSRL64 = 169,
+ asBC_BSRA64 = 170,
+ asBC_CMPi64 = 171,
+ asBC_CMPu64 = 172,
+ asBC_ChkNullS = 173,
+ asBC_ClrHi = 174,
+ asBC_JitEntry = 175,
+ asBC_CallPtr = 176,
+ asBC_FuncPtr = 177,
+ asBC_LoadThisR = 178,
+ asBC_PshV8 = 179,
+ asBC_DIVu = 180,
+ asBC_MODu = 181,
+ asBC_DIVu64 = 182,
+ asBC_MODu64 = 183,
+ asBC_LoadRObjR = 184,
+ asBC_LoadVObjR = 185,
+ asBC_RefCpyV = 186,
+ asBC_JLowZ = 187,
+ asBC_JLowNZ = 188,
+ asBC_AllocMem = 189,
+ asBC_SetListSize = 190,
+ asBC_PshListElmnt = 191,
+ asBC_SetListType = 192,
+ asBC_POWi = 193,
+ asBC_POWu = 194,
+ asBC_POWf = 195,
+ asBC_POWd = 196,
+ asBC_POWdi = 197,
+ asBC_POWi64 = 198,
+ asBC_POWu64 = 199,
+ asBC_Thiscall1 = 200,
+ asBC_MAXBYTECODE = 201,
// Temporary tokens. Can't be output to the final program
- asBC_TryBlock = 250,
- asBC_VarDecl = 251,
- asBC_Block = 252,
- asBC_ObjInfo = 253,
- asBC_LINE = 254,
- asBC_LABEL = 255
+ asBC_TryBlock = 250,
+ asBC_VarDecl = 251,
+ asBC_Block = 252,
+ asBC_ObjInfo = 253,
+ asBC_LINE = 254,
+ asBC_LABEL = 255
};
// Instruction types
-enum asEBCType
-{
+enum asEBCType {
asBCTYPE_INFO = 0,
asBCTYPE_NO_ARG = 1,
asBCTYPE_W_ARG = 2,
@@ -1624,8 +1581,7 @@ enum asEBCType
};
// Instruction type sizes
-const int asBCTypeSize[21] =
-{
+const int asBCTypeSize[21] = {
0, // asBCTYPE_INFO
1, // asBCTYPE_NO_ARG
1, // asBCTYPE_W_ARG
@@ -1650,8 +1606,7 @@ const int asBCTypeSize[21] =
};
// Instruction info
-struct asSBCInfo
-{
+struct asSBCInfo {
asEBCInstr bc;
asEBCType type;
int stackInc;
@@ -1659,229 +1614,228 @@ struct asSBCInfo
};
#ifndef AS_64BIT_PTR
- #define asBCTYPE_PTR_ARG asBCTYPE_DW_ARG
- #define asBCTYPE_PTR_DW_ARG asBCTYPE_DW_DW_ARG
- #define asBCTYPE_wW_PTR_ARG asBCTYPE_wW_DW_ARG
- #define asBCTYPE_rW_PTR_ARG asBCTYPE_rW_DW_ARG
- #ifndef AS_PTR_SIZE
- #define AS_PTR_SIZE 1
- #endif
+#define asBCTYPE_PTR_ARG asBCTYPE_DW_ARG
+#define asBCTYPE_PTR_DW_ARG asBCTYPE_DW_DW_ARG
+#define asBCTYPE_wW_PTR_ARG asBCTYPE_wW_DW_ARG
+#define asBCTYPE_rW_PTR_ARG asBCTYPE_rW_DW_ARG
+#ifndef AS_PTR_SIZE
+#define AS_PTR_SIZE 1
+#endif
#else
- #define asBCTYPE_PTR_ARG asBCTYPE_QW_ARG
- #define asBCTYPE_PTR_DW_ARG asBCTYPE_QW_DW_ARG
- #define asBCTYPE_wW_PTR_ARG asBCTYPE_wW_QW_ARG
- #define asBCTYPE_rW_PTR_ARG asBCTYPE_rW_QW_ARG
- #ifndef AS_PTR_SIZE
- #define AS_PTR_SIZE 2
- #endif
+#define asBCTYPE_PTR_ARG asBCTYPE_QW_ARG
+#define asBCTYPE_PTR_DW_ARG asBCTYPE_QW_DW_ARG
+#define asBCTYPE_wW_PTR_ARG asBCTYPE_wW_QW_ARG
+#define asBCTYPE_rW_PTR_ARG asBCTYPE_rW_QW_ARG
+#ifndef AS_PTR_SIZE
+#define AS_PTR_SIZE 2
+#endif
#endif
#define asBCINFO(b,t,s) {asBC_##b, asBCTYPE_##t, s, #b}
#define asBCINFO_DUMMY(b) {asBC_MAXBYTECODE, asBCTYPE_INFO, 0, "BC_" #b}
-const asSBCInfo asBCInfo[256] =
-{
- asBCINFO(PopPtr, NO_ARG, -AS_PTR_SIZE),
- asBCINFO(PshGPtr, PTR_ARG, AS_PTR_SIZE),
- asBCINFO(PshC4, DW_ARG, 1),
- asBCINFO(PshV4, rW_ARG, 1),
- asBCINFO(PSF, rW_ARG, AS_PTR_SIZE),
- asBCINFO(SwapPtr, NO_ARG, 0),
- asBCINFO(NOT, rW_ARG, 0),
- asBCINFO(PshG4, PTR_ARG, 1),
- asBCINFO(LdGRdR4, wW_PTR_ARG, 0),
- asBCINFO(CALL, DW_ARG, 0xFFFF),
- asBCINFO(RET, W_ARG, 0xFFFF),
- asBCINFO(JMP, DW_ARG, 0),
- asBCINFO(JZ, DW_ARG, 0),
- asBCINFO(JNZ, DW_ARG, 0),
- asBCINFO(JS, DW_ARG, 0),
- asBCINFO(JNS, DW_ARG, 0),
- asBCINFO(JP, DW_ARG, 0),
- asBCINFO(JNP, DW_ARG, 0),
- asBCINFO(TZ, NO_ARG, 0),
- asBCINFO(TNZ, NO_ARG, 0),
- asBCINFO(TS, NO_ARG, 0),
- asBCINFO(TNS, NO_ARG, 0),
- asBCINFO(TP, NO_ARG, 0),
- asBCINFO(TNP, NO_ARG, 0),
- asBCINFO(NEGi, rW_ARG, 0),
- asBCINFO(NEGf, rW_ARG, 0),
- asBCINFO(NEGd, rW_ARG, 0),
- asBCINFO(INCi16, NO_ARG, 0),
- asBCINFO(INCi8, NO_ARG, 0),
- asBCINFO(DECi16, NO_ARG, 0),
- asBCINFO(DECi8, NO_ARG, 0),
- asBCINFO(INCi, NO_ARG, 0),
- asBCINFO(DECi, NO_ARG, 0),
- asBCINFO(INCf, NO_ARG, 0),
- asBCINFO(DECf, NO_ARG, 0),
- asBCINFO(INCd, NO_ARG, 0),
- asBCINFO(DECd, NO_ARG, 0),
- asBCINFO(IncVi, rW_ARG, 0),
- asBCINFO(DecVi, rW_ARG, 0),
- asBCINFO(BNOT, rW_ARG, 0),
- asBCINFO(BAND, wW_rW_rW_ARG, 0),
- asBCINFO(BOR, wW_rW_rW_ARG, 0),
- asBCINFO(BXOR, wW_rW_rW_ARG, 0),
- asBCINFO(BSLL, wW_rW_rW_ARG, 0),
- asBCINFO(BSRL, wW_rW_rW_ARG, 0),
- asBCINFO(BSRA, wW_rW_rW_ARG, 0),
- asBCINFO(COPY, W_DW_ARG, -AS_PTR_SIZE),
- asBCINFO(PshC8, QW_ARG, 2),
- asBCINFO(PshVPtr, rW_ARG, AS_PTR_SIZE),
- asBCINFO(RDSPtr, NO_ARG, 0),
- asBCINFO(CMPd, rW_rW_ARG, 0),
- asBCINFO(CMPu, rW_rW_ARG, 0),
- asBCINFO(CMPf, rW_rW_ARG, 0),
- asBCINFO(CMPi, rW_rW_ARG, 0),
- asBCINFO(CMPIi, rW_DW_ARG, 0),
- asBCINFO(CMPIf, rW_DW_ARG, 0),
- asBCINFO(CMPIu, rW_DW_ARG, 0),
- asBCINFO(JMPP, rW_ARG, 0),
- asBCINFO(PopRPtr, NO_ARG, -AS_PTR_SIZE),
- asBCINFO(PshRPtr, NO_ARG, AS_PTR_SIZE),
- asBCINFO(STR, W_ARG, 1+AS_PTR_SIZE),
- asBCINFO(CALLSYS, DW_ARG, 0xFFFF),
- asBCINFO(CALLBND, DW_ARG, 0xFFFF),
- asBCINFO(SUSPEND, NO_ARG, 0),
- asBCINFO(ALLOC, PTR_DW_ARG, 0xFFFF),
- asBCINFO(FREE, wW_PTR_ARG, 0),
- asBCINFO(LOADOBJ, rW_ARG, 0),
- asBCINFO(STOREOBJ, wW_ARG, 0),
- asBCINFO(GETOBJ, W_ARG, 0),
- asBCINFO(REFCPY, PTR_ARG, -AS_PTR_SIZE),
- asBCINFO(CHKREF, NO_ARG, 0),
- asBCINFO(GETOBJREF, W_ARG, 0),
- asBCINFO(GETREF, W_ARG, 0),
- asBCINFO(PshNull, NO_ARG, AS_PTR_SIZE),
- asBCINFO(ClrVPtr, wW_ARG, 0),
- asBCINFO(OBJTYPE, PTR_ARG, AS_PTR_SIZE),
- asBCINFO(TYPEID, DW_ARG, 1),
- asBCINFO(SetV4, wW_DW_ARG, 0),
- asBCINFO(SetV8, wW_QW_ARG, 0),
- asBCINFO(ADDSi, W_DW_ARG, 0),
- asBCINFO(CpyVtoV4, wW_rW_ARG, 0),
- asBCINFO(CpyVtoV8, wW_rW_ARG, 0),
- asBCINFO(CpyVtoR4, rW_ARG, 0),
- asBCINFO(CpyVtoR8, rW_ARG, 0),
- asBCINFO(CpyVtoG4, rW_PTR_ARG, 0),
- asBCINFO(CpyRtoV4, wW_ARG, 0),
- asBCINFO(CpyRtoV8, wW_ARG, 0),
- asBCINFO(CpyGtoV4, wW_PTR_ARG, 0),
- asBCINFO(WRTV1, rW_ARG, 0),
- asBCINFO(WRTV2, rW_ARG, 0),
- asBCINFO(WRTV4, rW_ARG, 0),
- asBCINFO(WRTV8, rW_ARG, 0),
- asBCINFO(RDR1, wW_ARG, 0),
- asBCINFO(RDR2, wW_ARG, 0),
- asBCINFO(RDR4, wW_ARG, 0),
- asBCINFO(RDR8, wW_ARG, 0),
- asBCINFO(LDG, PTR_ARG, 0),
- asBCINFO(LDV, rW_ARG, 0),
- asBCINFO(PGA, PTR_ARG, AS_PTR_SIZE),
- asBCINFO(CmpPtr, rW_rW_ARG, 0),
- asBCINFO(VAR, rW_ARG, AS_PTR_SIZE),
- asBCINFO(iTOf, rW_ARG, 0),
- asBCINFO(fTOi, rW_ARG, 0),
- asBCINFO(uTOf, rW_ARG, 0),
- asBCINFO(fTOu, rW_ARG, 0),
- asBCINFO(sbTOi, rW_ARG, 0),
- asBCINFO(swTOi, rW_ARG, 0),
- asBCINFO(ubTOi, rW_ARG, 0),
- asBCINFO(uwTOi, rW_ARG, 0),
- asBCINFO(dTOi, wW_rW_ARG, 0),
- asBCINFO(dTOu, wW_rW_ARG, 0),
- asBCINFO(dTOf, wW_rW_ARG, 0),
- asBCINFO(iTOd, wW_rW_ARG, 0),
- asBCINFO(uTOd, wW_rW_ARG, 0),
- asBCINFO(fTOd, wW_rW_ARG, 0),
- asBCINFO(ADDi, wW_rW_rW_ARG, 0),
- asBCINFO(SUBi, wW_rW_rW_ARG, 0),
- asBCINFO(MULi, wW_rW_rW_ARG, 0),
- asBCINFO(DIVi, wW_rW_rW_ARG, 0),
- asBCINFO(MODi, wW_rW_rW_ARG, 0),
- asBCINFO(ADDf, wW_rW_rW_ARG, 0),
- asBCINFO(SUBf, wW_rW_rW_ARG, 0),
- asBCINFO(MULf, wW_rW_rW_ARG, 0),
- asBCINFO(DIVf, wW_rW_rW_ARG, 0),
- asBCINFO(MODf, wW_rW_rW_ARG, 0),
- asBCINFO(ADDd, wW_rW_rW_ARG, 0),
- asBCINFO(SUBd, wW_rW_rW_ARG, 0),
- asBCINFO(MULd, wW_rW_rW_ARG, 0),
- asBCINFO(DIVd, wW_rW_rW_ARG, 0),
- asBCINFO(MODd, wW_rW_rW_ARG, 0),
- asBCINFO(ADDIi, wW_rW_DW_ARG, 0),
- asBCINFO(SUBIi, wW_rW_DW_ARG, 0),
- asBCINFO(MULIi, wW_rW_DW_ARG, 0),
- asBCINFO(ADDIf, wW_rW_DW_ARG, 0),
- asBCINFO(SUBIf, wW_rW_DW_ARG, 0),
- asBCINFO(MULIf, wW_rW_DW_ARG, 0),
- asBCINFO(SetG4, PTR_DW_ARG, 0),
- asBCINFO(ChkRefS, NO_ARG, 0),
- asBCINFO(ChkNullV, rW_ARG, 0),
- asBCINFO(CALLINTF, DW_ARG, 0xFFFF),
- asBCINFO(iTOb, rW_ARG, 0),
- asBCINFO(iTOw, rW_ARG, 0),
- asBCINFO(SetV1, wW_DW_ARG, 0),
- asBCINFO(SetV2, wW_DW_ARG, 0),
- asBCINFO(Cast, DW_ARG, -AS_PTR_SIZE),
- asBCINFO(i64TOi, wW_rW_ARG, 0),
- asBCINFO(uTOi64, wW_rW_ARG, 0),
- asBCINFO(iTOi64, wW_rW_ARG, 0),
- asBCINFO(fTOi64, wW_rW_ARG, 0),
- asBCINFO(dTOi64, rW_ARG, 0),
- asBCINFO(fTOu64, wW_rW_ARG, 0),
- asBCINFO(dTOu64, rW_ARG, 0),
- asBCINFO(i64TOf, wW_rW_ARG, 0),
- asBCINFO(u64TOf, wW_rW_ARG, 0),
- asBCINFO(i64TOd, rW_ARG, 0),
- asBCINFO(u64TOd, rW_ARG, 0),
- asBCINFO(NEGi64, rW_ARG, 0),
- asBCINFO(INCi64, NO_ARG, 0),
- asBCINFO(DECi64, NO_ARG, 0),
- asBCINFO(BNOT64, rW_ARG, 0),
- asBCINFO(ADDi64, wW_rW_rW_ARG, 0),
- asBCINFO(SUBi64, wW_rW_rW_ARG, 0),
- asBCINFO(MULi64, wW_rW_rW_ARG, 0),
- asBCINFO(DIVi64, wW_rW_rW_ARG, 0),
- asBCINFO(MODi64, wW_rW_rW_ARG, 0),
- asBCINFO(BAND64, wW_rW_rW_ARG, 0),
- asBCINFO(BOR64, wW_rW_rW_ARG, 0),
- asBCINFO(BXOR64, wW_rW_rW_ARG, 0),
- asBCINFO(BSLL64, wW_rW_rW_ARG, 0),
- asBCINFO(BSRL64, wW_rW_rW_ARG, 0),
- asBCINFO(BSRA64, wW_rW_rW_ARG, 0),
- asBCINFO(CMPi64, rW_rW_ARG, 0),
- asBCINFO(CMPu64, rW_rW_ARG, 0),
- asBCINFO(ChkNullS, W_ARG, 0),
- asBCINFO(ClrHi, NO_ARG, 0),
- asBCINFO(JitEntry, PTR_ARG, 0),
- asBCINFO(CallPtr, rW_ARG, 0xFFFF),
- asBCINFO(FuncPtr, PTR_ARG, AS_PTR_SIZE),
- asBCINFO(LoadThisR, W_DW_ARG, 0),
- asBCINFO(PshV8, rW_ARG, 2),
- asBCINFO(DIVu, wW_rW_rW_ARG, 0),
- asBCINFO(MODu, wW_rW_rW_ARG, 0),
- asBCINFO(DIVu64, wW_rW_rW_ARG, 0),
- asBCINFO(MODu64, wW_rW_rW_ARG, 0),
- asBCINFO(LoadRObjR, rW_W_DW_ARG, 0),
- asBCINFO(LoadVObjR, rW_W_DW_ARG, 0),
- asBCINFO(RefCpyV, wW_PTR_ARG, 0),
- asBCINFO(JLowZ, DW_ARG, 0),
- asBCINFO(JLowNZ, DW_ARG, 0),
- asBCINFO(AllocMem, wW_DW_ARG, 0),
- asBCINFO(SetListSize, rW_DW_DW_ARG, 0),
- asBCINFO(PshListElmnt, rW_DW_ARG, AS_PTR_SIZE),
- asBCINFO(SetListType, rW_DW_DW_ARG, 0),
- asBCINFO(POWi, wW_rW_rW_ARG, 0),
- asBCINFO(POWu, wW_rW_rW_ARG, 0),
- asBCINFO(POWf, wW_rW_rW_ARG, 0),
- asBCINFO(POWd, wW_rW_rW_ARG, 0),
- asBCINFO(POWdi, wW_rW_rW_ARG, 0),
- asBCINFO(POWi64, wW_rW_rW_ARG, 0),
- asBCINFO(POWu64, wW_rW_rW_ARG, 0),
- asBCINFO(Thiscall1, DW_ARG, -AS_PTR_SIZE-1),
+const asSBCInfo asBCInfo[256] = {
+ asBCINFO(PopPtr, NO_ARG, -AS_PTR_SIZE),
+ asBCINFO(PshGPtr, PTR_ARG, AS_PTR_SIZE),
+ asBCINFO(PshC4, DW_ARG, 1),
+ asBCINFO(PshV4, rW_ARG, 1),
+ asBCINFO(PSF, rW_ARG, AS_PTR_SIZE),
+ asBCINFO(SwapPtr, NO_ARG, 0),
+ asBCINFO(NOT, rW_ARG, 0),
+ asBCINFO(PshG4, PTR_ARG, 1),
+ asBCINFO(LdGRdR4, wW_PTR_ARG, 0),
+ asBCINFO(CALL, DW_ARG, 0xFFFF),
+ asBCINFO(RET, W_ARG, 0xFFFF),
+ asBCINFO(JMP, DW_ARG, 0),
+ asBCINFO(JZ, DW_ARG, 0),
+ asBCINFO(JNZ, DW_ARG, 0),
+ asBCINFO(JS, DW_ARG, 0),
+ asBCINFO(JNS, DW_ARG, 0),
+ asBCINFO(JP, DW_ARG, 0),
+ asBCINFO(JNP, DW_ARG, 0),
+ asBCINFO(TZ, NO_ARG, 0),
+ asBCINFO(TNZ, NO_ARG, 0),
+ asBCINFO(TS, NO_ARG, 0),
+ asBCINFO(TNS, NO_ARG, 0),
+ asBCINFO(TP, NO_ARG, 0),
+ asBCINFO(TNP, NO_ARG, 0),
+ asBCINFO(NEGi, rW_ARG, 0),
+ asBCINFO(NEGf, rW_ARG, 0),
+ asBCINFO(NEGd, rW_ARG, 0),
+ asBCINFO(INCi16, NO_ARG, 0),
+ asBCINFO(INCi8, NO_ARG, 0),
+ asBCINFO(DECi16, NO_ARG, 0),
+ asBCINFO(DECi8, NO_ARG, 0),
+ asBCINFO(INCi, NO_ARG, 0),
+ asBCINFO(DECi, NO_ARG, 0),
+ asBCINFO(INCf, NO_ARG, 0),
+ asBCINFO(DECf, NO_ARG, 0),
+ asBCINFO(INCd, NO_ARG, 0),
+ asBCINFO(DECd, NO_ARG, 0),
+ asBCINFO(IncVi, rW_ARG, 0),
+ asBCINFO(DecVi, rW_ARG, 0),
+ asBCINFO(BNOT, rW_ARG, 0),
+ asBCINFO(BAND, wW_rW_rW_ARG, 0),
+ asBCINFO(BOR, wW_rW_rW_ARG, 0),
+ asBCINFO(BXOR, wW_rW_rW_ARG, 0),
+ asBCINFO(BSLL, wW_rW_rW_ARG, 0),
+ asBCINFO(BSRL, wW_rW_rW_ARG, 0),
+ asBCINFO(BSRA, wW_rW_rW_ARG, 0),
+ asBCINFO(COPY, W_DW_ARG, -AS_PTR_SIZE),
+ asBCINFO(PshC8, QW_ARG, 2),
+ asBCINFO(PshVPtr, rW_ARG, AS_PTR_SIZE),
+ asBCINFO(RDSPtr, NO_ARG, 0),
+ asBCINFO(CMPd, rW_rW_ARG, 0),
+ asBCINFO(CMPu, rW_rW_ARG, 0),
+ asBCINFO(CMPf, rW_rW_ARG, 0),
+ asBCINFO(CMPi, rW_rW_ARG, 0),
+ asBCINFO(CMPIi, rW_DW_ARG, 0),
+ asBCINFO(CMPIf, rW_DW_ARG, 0),
+ asBCINFO(CMPIu, rW_DW_ARG, 0),
+ asBCINFO(JMPP, rW_ARG, 0),
+ asBCINFO(PopRPtr, NO_ARG, -AS_PTR_SIZE),
+ asBCINFO(PshRPtr, NO_ARG, AS_PTR_SIZE),
+ asBCINFO(STR, W_ARG, 1 + AS_PTR_SIZE),
+ asBCINFO(CALLSYS, DW_ARG, 0xFFFF),
+ asBCINFO(CALLBND, DW_ARG, 0xFFFF),
+ asBCINFO(SUSPEND, NO_ARG, 0),
+ asBCINFO(ALLOC, PTR_DW_ARG, 0xFFFF),
+ asBCINFO(FREE, wW_PTR_ARG, 0),
+ asBCINFO(LOADOBJ, rW_ARG, 0),
+ asBCINFO(STOREOBJ, wW_ARG, 0),
+ asBCINFO(GETOBJ, W_ARG, 0),
+ asBCINFO(REFCPY, PTR_ARG, -AS_PTR_SIZE),
+ asBCINFO(CHKREF, NO_ARG, 0),
+ asBCINFO(GETOBJREF, W_ARG, 0),
+ asBCINFO(GETREF, W_ARG, 0),
+ asBCINFO(PshNull, NO_ARG, AS_PTR_SIZE),
+ asBCINFO(ClrVPtr, wW_ARG, 0),
+ asBCINFO(OBJTYPE, PTR_ARG, AS_PTR_SIZE),
+ asBCINFO(TYPEID, DW_ARG, 1),
+ asBCINFO(SetV4, wW_DW_ARG, 0),
+ asBCINFO(SetV8, wW_QW_ARG, 0),
+ asBCINFO(ADDSi, W_DW_ARG, 0),
+ asBCINFO(CpyVtoV4, wW_rW_ARG, 0),
+ asBCINFO(CpyVtoV8, wW_rW_ARG, 0),
+ asBCINFO(CpyVtoR4, rW_ARG, 0),
+ asBCINFO(CpyVtoR8, rW_ARG, 0),
+ asBCINFO(CpyVtoG4, rW_PTR_ARG, 0),
+ asBCINFO(CpyRtoV4, wW_ARG, 0),
+ asBCINFO(CpyRtoV8, wW_ARG, 0),
+ asBCINFO(CpyGtoV4, wW_PTR_ARG, 0),
+ asBCINFO(WRTV1, rW_ARG, 0),
+ asBCINFO(WRTV2, rW_ARG, 0),
+ asBCINFO(WRTV4, rW_ARG, 0),
+ asBCINFO(WRTV8, rW_ARG, 0),
+ asBCINFO(RDR1, wW_ARG, 0),
+ asBCINFO(RDR2, wW_ARG, 0),
+ asBCINFO(RDR4, wW_ARG, 0),
+ asBCINFO(RDR8, wW_ARG, 0),
+ asBCINFO(LDG, PTR_ARG, 0),
+ asBCINFO(LDV, rW_ARG, 0),
+ asBCINFO(PGA, PTR_ARG, AS_PTR_SIZE),
+ asBCINFO(CmpPtr, rW_rW_ARG, 0),
+ asBCINFO(VAR, rW_ARG, AS_PTR_SIZE),
+ asBCINFO(iTOf, rW_ARG, 0),
+ asBCINFO(fTOi, rW_ARG, 0),
+ asBCINFO(uTOf, rW_ARG, 0),
+ asBCINFO(fTOu, rW_ARG, 0),
+ asBCINFO(sbTOi, rW_ARG, 0),
+ asBCINFO(swTOi, rW_ARG, 0),
+ asBCINFO(ubTOi, rW_ARG, 0),
+ asBCINFO(uwTOi, rW_ARG, 0),
+ asBCINFO(dTOi, wW_rW_ARG, 0),
+ asBCINFO(dTOu, wW_rW_ARG, 0),
+ asBCINFO(dTOf, wW_rW_ARG, 0),
+ asBCINFO(iTOd, wW_rW_ARG, 0),
+ asBCINFO(uTOd, wW_rW_ARG, 0),
+ asBCINFO(fTOd, wW_rW_ARG, 0),
+ asBCINFO(ADDi, wW_rW_rW_ARG, 0),
+ asBCINFO(SUBi, wW_rW_rW_ARG, 0),
+ asBCINFO(MULi, wW_rW_rW_ARG, 0),
+ asBCINFO(DIVi, wW_rW_rW_ARG, 0),
+ asBCINFO(MODi, wW_rW_rW_ARG, 0),
+ asBCINFO(ADDf, wW_rW_rW_ARG, 0),
+ asBCINFO(SUBf, wW_rW_rW_ARG, 0),
+ asBCINFO(MULf, wW_rW_rW_ARG, 0),
+ asBCINFO(DIVf, wW_rW_rW_ARG, 0),
+ asBCINFO(MODf, wW_rW_rW_ARG, 0),
+ asBCINFO(ADDd, wW_rW_rW_ARG, 0),
+ asBCINFO(SUBd, wW_rW_rW_ARG, 0),
+ asBCINFO(MULd, wW_rW_rW_ARG, 0),
+ asBCINFO(DIVd, wW_rW_rW_ARG, 0),
+ asBCINFO(MODd, wW_rW_rW_ARG, 0),
+ asBCINFO(ADDIi, wW_rW_DW_ARG, 0),
+ asBCINFO(SUBIi, wW_rW_DW_ARG, 0),
+ asBCINFO(MULIi, wW_rW_DW_ARG, 0),
+ asBCINFO(ADDIf, wW_rW_DW_ARG, 0),
+ asBCINFO(SUBIf, wW_rW_DW_ARG, 0),
+ asBCINFO(MULIf, wW_rW_DW_ARG, 0),
+ asBCINFO(SetG4, PTR_DW_ARG, 0),
+ asBCINFO(ChkRefS, NO_ARG, 0),
+ asBCINFO(ChkNullV, rW_ARG, 0),
+ asBCINFO(CALLINTF, DW_ARG, 0xFFFF),
+ asBCINFO(iTOb, rW_ARG, 0),
+ asBCINFO(iTOw, rW_ARG, 0),
+ asBCINFO(SetV1, wW_DW_ARG, 0),
+ asBCINFO(SetV2, wW_DW_ARG, 0),
+ asBCINFO(Cast, DW_ARG, -AS_PTR_SIZE),
+ asBCINFO(i64TOi, wW_rW_ARG, 0),
+ asBCINFO(uTOi64, wW_rW_ARG, 0),
+ asBCINFO(iTOi64, wW_rW_ARG, 0),
+ asBCINFO(fTOi64, wW_rW_ARG, 0),
+ asBCINFO(dTOi64, rW_ARG, 0),
+ asBCINFO(fTOu64, wW_rW_ARG, 0),
+ asBCINFO(dTOu64, rW_ARG, 0),
+ asBCINFO(i64TOf, wW_rW_ARG, 0),
+ asBCINFO(u64TOf, wW_rW_ARG, 0),
+ asBCINFO(i64TOd, rW_ARG, 0),
+ asBCINFO(u64TOd, rW_ARG, 0),
+ asBCINFO(NEGi64, rW_ARG, 0),
+ asBCINFO(INCi64, NO_ARG, 0),
+ asBCINFO(DECi64, NO_ARG, 0),
+ asBCINFO(BNOT64, rW_ARG, 0),
+ asBCINFO(ADDi64, wW_rW_rW_ARG, 0),
+ asBCINFO(SUBi64, wW_rW_rW_ARG, 0),
+ asBCINFO(MULi64, wW_rW_rW_ARG, 0),
+ asBCINFO(DIVi64, wW_rW_rW_ARG, 0),
+ asBCINFO(MODi64, wW_rW_rW_ARG, 0),
+ asBCINFO(BAND64, wW_rW_rW_ARG, 0),
+ asBCINFO(BOR64, wW_rW_rW_ARG, 0),
+ asBCINFO(BXOR64, wW_rW_rW_ARG, 0),
+ asBCINFO(BSLL64, wW_rW_rW_ARG, 0),
+ asBCINFO(BSRL64, wW_rW_rW_ARG, 0),
+ asBCINFO(BSRA64, wW_rW_rW_ARG, 0),
+ asBCINFO(CMPi64, rW_rW_ARG, 0),
+ asBCINFO(CMPu64, rW_rW_ARG, 0),
+ asBCINFO(ChkNullS, W_ARG, 0),
+ asBCINFO(ClrHi, NO_ARG, 0),
+ asBCINFO(JitEntry, PTR_ARG, 0),
+ asBCINFO(CallPtr, rW_ARG, 0xFFFF),
+ asBCINFO(FuncPtr, PTR_ARG, AS_PTR_SIZE),
+ asBCINFO(LoadThisR, W_DW_ARG, 0),
+ asBCINFO(PshV8, rW_ARG, 2),
+ asBCINFO(DIVu, wW_rW_rW_ARG, 0),
+ asBCINFO(MODu, wW_rW_rW_ARG, 0),
+ asBCINFO(DIVu64, wW_rW_rW_ARG, 0),
+ asBCINFO(MODu64, wW_rW_rW_ARG, 0),
+ asBCINFO(LoadRObjR, rW_W_DW_ARG, 0),
+ asBCINFO(LoadVObjR, rW_W_DW_ARG, 0),
+ asBCINFO(RefCpyV, wW_PTR_ARG, 0),
+ asBCINFO(JLowZ, DW_ARG, 0),
+ asBCINFO(JLowNZ, DW_ARG, 0),
+ asBCINFO(AllocMem, wW_DW_ARG, 0),
+ asBCINFO(SetListSize, rW_DW_DW_ARG, 0),
+ asBCINFO(PshListElmnt, rW_DW_ARG, AS_PTR_SIZE),
+ asBCINFO(SetListType, rW_DW_DW_ARG, 0),
+ asBCINFO(POWi, wW_rW_rW_ARG, 0),
+ asBCINFO(POWu, wW_rW_rW_ARG, 0),
+ asBCINFO(POWf, wW_rW_rW_ARG, 0),
+ asBCINFO(POWd, wW_rW_rW_ARG, 0),
+ asBCINFO(POWdi, wW_rW_rW_ARG, 0),
+ asBCINFO(POWi64, wW_rW_rW_ARG, 0),
+ asBCINFO(POWu64, wW_rW_rW_ARG, 0),
+ asBCINFO(Thiscall1, DW_ARG, -AS_PTR_SIZE - 1),
asBCINFO_DUMMY(201),
asBCINFO_DUMMY(202),
@@ -1933,12 +1887,12 @@ const asSBCInfo asBCInfo[256] =
asBCINFO_DUMMY(248),
asBCINFO_DUMMY(249),
- asBCINFO(TryBlock, DW_ARG, 0),
- asBCINFO(VarDecl, W_ARG, 0),
- asBCINFO(Block, INFO, 0),
- asBCINFO(ObjInfo, rW_DW_ARG, 0),
- asBCINFO(LINE, INFO, 0),
- asBCINFO(LABEL, INFO, 0)
+ asBCINFO(TryBlock, DW_ARG, 0),
+ asBCINFO(VarDecl, W_ARG, 0),
+ asBCINFO(Block, INFO, 0),
+ asBCINFO(ObjInfo, rW_DW_ARG, 0),
+ asBCINFO(LINE, INFO, 0),
+ asBCINFO(LABEL, INFO, 0)
};
// Macros to access bytecode instruction arguments
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_array.h b/engines/hpl1/engine/libraries/angelscript/sources/as_array.h
index 8894dac67a1..5c8cca5156c 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_array.h
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_array.h
@@ -44,8 +44,7 @@
BEGIN_AS_NAMESPACE
-template <class T> class asCArray
-{
+template <class T> class asCArray {
public:
asCArray();
asCArray(const asCArray<T> &);
@@ -63,7 +62,7 @@ public:
bool SetLengthNoConstruct(asUINT numElements);
asUINT GetLength() const;
- void Copy(const T*, asUINT count);
+ void Copy(const T *, asUINT count);
asCArray<T> &operator =(const asCArray<T> &);
void SwapWith(asCArray<T> &other);
@@ -73,7 +72,7 @@ public:
const T *AddressOf() const;
bool Concatenate(const asCArray<T> &);
- void Concatenate(T*, unsigned int count);
+ void Concatenate(T *, unsigned int count);
bool Exists(const T &element) const;
int IndexOf(const T &element) const;
@@ -88,34 +87,30 @@ protected:
T *array;
asUINT length; // 32bits is enough for all uses of this array
asUINT maxLength;
- char buf[2*4*AS_PTR_SIZE]; // Avoid dynamically allocated memory for tiny arrays
+ char buf[2 * 4 * AS_PTR_SIZE]; // Avoid dynamically allocated memory for tiny arrays
};
// Implementation
template <class T>
-T *asCArray<T>::AddressOf()
-{
+T *asCArray<T>::AddressOf() {
return array;
}
template <class T>
-const T *asCArray<T>::AddressOf() const
-{
+const T *asCArray<T>::AddressOf() const {
return array;
}
template <class T>
-asCArray<T>::asCArray(void)
-{
+asCArray<T>::asCArray(void) {
array = 0;
length = 0;
maxLength = 0;
}
template <class T>
-asCArray<T>::asCArray(const asCArray<T> ©)
-{
+asCArray<T>::asCArray(const asCArray<T> ©) {
array = 0;
length = 0;
maxLength = 0;
@@ -124,8 +119,7 @@ asCArray<T>::asCArray(const asCArray<T> ©)
}
template <class T>
-asCArray<T>::asCArray(asUINT reserve)
-{
+asCArray<T>::asCArray(asUINT reserve) {
array = 0;
length = 0;
maxLength = 0;
@@ -134,46 +128,39 @@ asCArray<T>::asCArray(asUINT reserve)
}
template <class T>
-asCArray<T>::~asCArray(void)
-{
+asCArray<T>::~asCArray(void) {
// Allocating a zero length array will free all memory
- Allocate(0,0);
+ Allocate(0, 0);
}
template <class T>
-asUINT asCArray<T>::GetLength() const
-{
+asUINT asCArray<T>::GetLength() const {
return length;
}
template <class T>
-const T &asCArray<T>::operator [](asUINT index) const
-{
+const T &asCArray<T>::operator [](asUINT index) const {
asASSERT(index < length);
return array[index];
}
template <class T>
-T &asCArray<T>::operator [](asUINT index)
-{
+T &asCArray<T>::operator [](asUINT index) {
asASSERT(index < length);
return array[index];
}
template <class T>
-void asCArray<T>::PushLast(const T &element)
-{
- if( length == maxLength )
- {
- if( maxLength == 0 )
+void asCArray<T>::PushLast(const T &element) {
+ if (length == maxLength) {
+ if (maxLength == 0)
Allocate(1, false);
else
- Allocate(2*maxLength, true);
+ Allocate(2 * maxLength, true);
- if( length == maxLength )
- {
+ if (length == maxLength) {
// Out of memory. Return without doing anything
return;
}
@@ -183,16 +170,14 @@ void asCArray<T>::PushLast(const T &element)
}
template <class T>
-T asCArray<T>::PopLast()
-{
+T asCArray<T>::PopLast() {
asASSERT(length > 0);
return array[--length];
}
template <class T>
-void asCArray<T>::Allocate(asUINT numElements, bool keepData)
-{
+void asCArray<T>::Allocate(asUINT numElements, bool keepData) {
// We have 4 situations
// 1. The previous array is 8 bytes or smaller and the new array is also 8 bytes or smaller
// 2. The previous array is 8 bytes or smaller and the new array is larger than 8 bytes
@@ -200,72 +185,58 @@ void asCArray<T>::Allocate(asUINT numElements, bool keepData)
// 4. The previous array is larger than 8 bytes and the new array is also larger than 8 bytes
T *tmp = 0;
- if( numElements )
- {
- if( sizeof(T)*numElements <= sizeof(buf) )
+ if (numElements) {
+ if (sizeof(T)*numElements <= sizeof(buf))
// Use the internal buffer
- tmp = reinterpret_cast<T*>(buf);
- else
- {
+ tmp = reinterpret_cast<T *>(buf);
+ else {
// Allocate the array and construct each of the elements
- tmp = asNEWARRAY(T,numElements);
- if( tmp == 0 )
- {
+ tmp = asNEWARRAY(T, numElements);
+ if (tmp == 0) {
// Out of memory. Return without doing anything
return;
}
}
- if( array == tmp )
- {
+ if (array == tmp) {
// Construct only the newly allocated elements
- for( asUINT n = length; n < numElements; n++ )
+ for (asUINT n = length; n < numElements; n++)
new (&tmp[n]) T();
- }
- else
- {
+ } else {
// Construct all elements
- for( asUINT n = 0; n < numElements; n++ )
+ for (asUINT n = 0; n < numElements; n++)
new (&tmp[n]) T();
}
}
- if( array )
- {
+ if (array) {
asUINT oldLength = length;
- if( array == tmp )
- {
- if( keepData )
- {
- if( length > numElements )
+ if (array == tmp) {
+ if (keepData) {
+ if (length > numElements)
length = numElements;
- }
- else
+ } else
length = 0;
// Call the destructor for elements that are no longer used
- for( asUINT n = length; n < oldLength; n++ )
+ for (asUINT n = length; n < oldLength; n++)
array[n].~T();
- }
- else
- {
- if( keepData )
- {
- if( length > numElements )
+ } else {
+ if (keepData) {
+ if (length > numElements)
length = numElements;
- for( asUINT n = 0; n < length; n++ )
+ for (asUINT n = 0; n < length; n++)
tmp[n] = array[n];
- }
- else
+ } else
length = 0;
// Call the destructor for all elements
- for( asUINT n = 0; n < oldLength; n++ )
+ for (asUINT n = 0; n < oldLength; n++)
array[n].~T();
- if( array != reinterpret_cast<T*>(buf) )
+ if (array != reinterpret_cast<T *>(buf))
asDELETEARRAY(array);
}
}
@@ -275,8 +246,7 @@ void asCArray<T>::Allocate(asUINT numElements, bool keepData)
}
template <class T>
-void asCArray<T>::AllocateNoConstruct(asUINT numElements, bool keepData)
-{
+void asCArray<T>::AllocateNoConstruct(asUINT numElements, bool keepData) {
// We have 4 situations
// 1. The previous array is 8 bytes or smaller and the new array is also 8 bytes or smaller
// 2. The previous array is 8 bytes or smaller and the new array is larger than 8 bytes
@@ -284,48 +254,37 @@ void asCArray<T>::AllocateNoConstruct(asUINT numElements, bool keepData)
// 4. The previous array is larger than 8 bytes and the new array is also larger than 8 bytes
T *tmp = 0;
- if( numElements )
- {
- if( sizeof(T)*numElements <= sizeof(buf) )
+ if (numElements) {
+ if (sizeof(T)*numElements <= sizeof(buf))
// Use the internal buffer
- tmp = reinterpret_cast<T*>(buf);
- else
- {
+ tmp = reinterpret_cast<T *>(buf);
+ else {
// Allocate the array and construct each of the elements
- tmp = asNEWARRAY(T,numElements);
- if( tmp == 0 )
- {
+ tmp = asNEWARRAY(T, numElements);
+ if (tmp == 0) {
// Out of memory. Return without doing anything
return;
}
}
}
- if( array )
- {
- if( array == tmp )
- {
- if( keepData )
- {
- if( length > numElements )
+ if (array) {
+ if (array == tmp) {
+ if (keepData) {
+ if (length > numElements)
length = numElements;
- }
- else
+ } else
length = 0;
- }
- else
- {
- if( keepData )
- {
- if( length > numElements )
+ } else {
+ if (keepData) {
+ if (length > numElements)
length = numElements;
memcpy(tmp, array, sizeof(T)*length);
- }
- else
+ } else
length = 0;
- if( array != reinterpret_cast<T*>(buf) )
+ if (array != reinterpret_cast<T *>(buf))
asDELETEARRAY(array);
}
}
@@ -335,19 +294,15 @@ void asCArray<T>::AllocateNoConstruct(asUINT numElements, bool keepData)
}
template <class T>
-asUINT asCArray<T>::GetCapacity() const
-{
+asUINT asCArray<T>::GetCapacity() const {
return maxLength;
}
template <class T>
-bool asCArray<T>::SetLength(asUINT numElements)
-{
- if( numElements > maxLength )
- {
+bool asCArray<T>::SetLength(asUINT numElements) {
+ if (numElements > maxLength) {
Allocate(numElements, true);
- if( numElements > maxLength )
- {
+ if (numElements > maxLength) {
// Out of memory. Return without doing anything
return false;
}
@@ -358,13 +313,10 @@ bool asCArray<T>::SetLength(asUINT numElements)
}
template <class T>
-bool asCArray<T>::SetLengthNoConstruct(asUINT numElements)
-{
- if( numElements > maxLength )
- {
+bool asCArray<T>::SetLengthNoConstruct(asUINT numElements) {
+ if (numElements > maxLength) {
AllocateNoConstruct(numElements, true);
- if( numElements > maxLength )
- {
+ if (numElements > maxLength) {
// Out of memory. Return without doing anything
return false;
}
@@ -375,35 +327,30 @@ bool asCArray<T>::SetLengthNoConstruct(asUINT numElements)
}
template <class T>
-void asCArray<T>::Copy(const T *data, asUINT count)
-{
- if( maxLength < count )
- {
+void asCArray<T>::Copy(const T *data, asUINT count) {
+ if (maxLength < count) {
Allocate(count, false);
- if( maxLength < count )
- {
+ if (maxLength < count) {
// Out of memory. Return without doing anything
return;
}
}
- for( asUINT n = 0; n < count; n++ )
+ for (asUINT n = 0; n < count; n++)
array[n] = data[n];
length = count;
}
template <class T>
-asCArray<T> &asCArray<T>::operator =(const asCArray<T> ©)
-{
+asCArray<T> &asCArray<T>::operator =(const asCArray<T> ©) {
Copy(copy.array, copy.length);
return *this;
}
template <class T>
-void asCArray<T>::SwapWith(asCArray<T> &other)
-{
+void asCArray<T>::SwapWith(asCArray<T> &other) {
T *tmpArray = array;
asUINT tmpLength = length;
asUINT tmpMaxLength = maxLength;
@@ -421,47 +368,42 @@ void asCArray<T>::SwapWith(asCArray<T> &other)
memcpy(other.buf, tmpBuf, sizeof(buf));
// If the data is in the internal buffer, then the array pointer must refer to it
- if( array == reinterpret_cast<T*>(other.buf) )
- array = reinterpret_cast<T*>(buf);
- if( other.array == reinterpret_cast<T*>(buf) )
- other.array = reinterpret_cast<T*>(other.buf);
+ if (array == reinterpret_cast<T *>(other.buf))
+ array = reinterpret_cast<T *>(buf);
+ if (other.array == reinterpret_cast<T *>(buf))
+ other.array = reinterpret_cast<T *>(other.buf);
}
template <class T>
-bool asCArray<T>::operator ==(const asCArray<T> &other) const
-{
- if( length != other.length ) return false;
+bool asCArray<T>::operator ==(const asCArray<T> &other) const {
+ if (length != other.length) return false;
- for( asUINT n = 0; n < length; n++ )
- if( array[n] != other.array[n] )
+ for (asUINT n = 0; n < length; n++)
+ if (array[n] != other.array[n])
return false;
return true;
}
template <class T>
-bool asCArray<T>::operator !=(const asCArray<T> &other) const
-{
+bool asCArray<T>::operator !=(const asCArray<T> &other) const {
return !(*this == other);
}
// Returns false if the concatenation wasn't successful due to out of memory
template <class T>
-bool asCArray<T>::Concatenate(const asCArray<T> &other)
-{
- if( maxLength < length + other.length )
- {
+bool asCArray<T>::Concatenate(const asCArray<T> &other) {
+ if (maxLength < length + other.length) {
Allocate(length + other.length, true);
- if( maxLength < length + other.length )
- {
+ if (maxLength < length + other.length) {
// Out of memory
return false;
}
}
- for( asUINT n = 0; n < other.length; n++ )
- array[length+n] = other.array[n];
+ for (asUINT n = 0; n < other.length; n++)
+ array[length + n] = other.array[n];
length += other.length;
@@ -470,46 +412,38 @@ bool asCArray<T>::Concatenate(const asCArray<T> &other)
}
template <class T>
-void asCArray<T>::Concatenate(T* other, unsigned int count)
-{
- for( unsigned int c = 0; c < count; c++ )
+void asCArray<T>::Concatenate(T *other, unsigned int count) {
+ for (unsigned int c = 0; c < count; c++)
PushLast(other[c]);
}
template <class T>
-bool asCArray<T>::Exists(const T &e) const
-{
+bool asCArray<T>::Exists(const T &e) const {
return IndexOf(e) == -1 ? false : true;
}
template <class T>
-int asCArray<T>::IndexOf(const T &e) const
-{
- for( asUINT n = 0; n < length; n++ )
- if( array[n] == e ) return static_cast<int>(n);
+int asCArray<T>::IndexOf(const T &e) const {
+ for (asUINT n = 0; n < length; n++)
+ if (array[n] == e) return static_cast<int>(n);
return -1;
}
template <class T>
-void asCArray<T>::RemoveIndex(asUINT index)
-{
- if( index < length )
- {
- for( asUINT n = index; n < length-1; n++ )
- array[n] = array[n+1];
+void asCArray<T>::RemoveIndex(asUINT index) {
+ if (index < length) {
+ for (asUINT n = index; n < length - 1; n++)
+ array[n] = array[n + 1];
PopLast();
}
}
template <class T>
-void asCArray<T>::RemoveValue(const T &e)
-{
- for( asUINT n = 0; n < length; n++ )
- {
- if( array[n] == e )
- {
+void asCArray<T>::RemoveValue(const T &e) {
+ for (asUINT n = 0; n < length; n++) {
+ if (array[n] == e) {
RemoveIndex(n);
break;
}
@@ -517,11 +451,10 @@ void asCArray<T>::RemoveValue(const T &e)
}
template <class T>
-void asCArray<T>::RemoveIndexUnordered(asUINT index)
-{
- if( index == length - 1 )
+void asCArray<T>::RemoveIndexUnordered(asUINT index) {
+ if (index == length - 1)
PopLast();
- else if( index < length )
+ else if (index < length)
array[index] = PopLast();
}
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.cpp
index e110b3fc9dd..5b18a0ab631 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.cpp
@@ -27,7 +27,7 @@
Andreas Jonsson
andreas at angelcode.com
*/
-
+
//
// as_atomic.cpp
//
@@ -38,13 +38,11 @@
BEGIN_AS_NAMESPACE
-asCAtomic::asCAtomic()
-{
+asCAtomic::asCAtomic() {
value = 0;
}
-asDWORD asCAtomic::get() const
-{
+asDWORD asCAtomic::get() const {
// A very high ref count is highly unlikely. It most likely a problem with
// memory that has been overwritten or is being accessed after it was deleted.
asASSERT(value < 1000000);
@@ -52,8 +50,7 @@ asDWORD asCAtomic::get() const
return value;
}
-void asCAtomic::set(asDWORD val)
-{
+void asCAtomic::set(asDWORD val) {
// A very high ref count is highly unlikely. It most likely a problem with
// memory that has been overwritten or is being accessed after it was deleted.
asASSERT(value < 1000000);
@@ -61,22 +58,20 @@ void asCAtomic::set(asDWORD val)
value = val;
}
-asDWORD asCAtomic::atomicInc()
-{
+asDWORD asCAtomic::atomicInc() {
// A very high ref count is highly unlikely. It most likely a problem with
// memory that has been overwritten or is being accessed after it was deleted.
asASSERT(value < 1000000);
- return asAtomicInc((int&)value);
+ return asAtomicInc((int &)value);
}
-asDWORD asCAtomic::atomicDec()
-{
+asDWORD asCAtomic::atomicDec() {
// A very high ref count is highly unlikely. It most likely a problem with
// memory that has been overwritten or is being accessed after it was deleted.
asASSERT(value < 1000000);
- return asAtomicDec((int&)value);
+ return asAtomicDec((int &)value);
}
//
@@ -84,13 +79,11 @@ asDWORD asCAtomic::atomicDec()
//
#if defined(AS_NO_THREADS) || defined(AS_NO_ATOMIC)
-int asAtomicInc(int &value)
-{
+int asAtomicInc(int &value) {
return ++value;
}
-int asAtomicDec(int &value)
-{
+int asAtomicDec(int &value) {
return --value;
}
@@ -100,14 +93,12 @@ END_AS_NAMESPACE
#include <xtl.h>
BEGIN_AS_NAMESPACE
-int asAtomicInc(int &value)
-{
- return InterlockedIncrement((LONG*)&value);
+int asAtomicInc(int &value) {
+ return InterlockedIncrement((LONG *)&value);
}
-int asAtomicDec(int &value)
-{
- return InterlockedDecrement((LONG*)&value);
+int asAtomicDec(int &value) {
+ return InterlockedDecrement((LONG *)&value);
}
#elif defined(AS_WIN)
@@ -117,37 +108,33 @@ END_AS_NAMESPACE
#include <windows.h>
BEGIN_AS_NAMESPACE
-int asAtomicInc(int &value)
-{
- return InterlockedIncrement((LONG*)&value);
+int asAtomicInc(int &value) {
+ return InterlockedIncrement((LONG *)&value);
}
-int asAtomicDec(int &value)
-{
+int asAtomicDec(int &value) {
asASSERT(value > 0);
- return InterlockedDecrement((LONG*)&value);
+ return InterlockedDecrement((LONG *)&value);
}
#elif defined(AS_LINUX) || defined(AS_BSD) || defined(AS_ILLUMOS) || defined(AS_ANDROID)
//
-// atomic_inc_and_test() and atomic_dec_and_test() from asm/atomic.h is not meant
-// to be used outside the Linux kernel. Instead we should use the GNUC provided
+// atomic_inc_and_test() and atomic_dec_and_test() from asm/atomic.h is not meant
+// to be used outside the Linux kernel. Instead we should use the GNUC provided
// __sync_add_and_fetch() and __sync_sub_and_fetch() functions.
//
// Reference: http://golubenco.org/blog/atomic-operations/
//
-// These are only available in GCC 4.1 and above, so for older versions we
+// These are only available in GCC 4.1 and above, so for older versions we
// use the critical sections, though it is a lot slower.
-//
+//
-int asAtomicInc(int &value)
-{
+int asAtomicInc(int &value) {
return __sync_add_and_fetch(&value, 1);
}
-int asAtomicDec(int &value)
-{
+int asAtomicDec(int &value) {
return __sync_sub_and_fetch(&value, 1);
}
@@ -157,20 +144,18 @@ END_AS_NAMESPACE
#include <libkern/OSAtomic.h>
BEGIN_AS_NAMESPACE
-int asAtomicInc(int &value)
-{
- return OSAtomicIncrement32((int32_t*)&value);
+int asAtomicInc(int &value) {
+ return OSAtomicIncrement32((int32_t *)&value);
}
-int asAtomicDec(int &value)
-{
- return OSAtomicDecrement32((int32_t*)&value);
+int asAtomicDec(int &value) {
+ return OSAtomicDecrement32((int32_t *)&value);
}
#else
// If we get here, then the configuration in as_config.h
-// is wrong for the compiler/platform combination.
+// is wrong for the compiler/platform combination.
int ERROR_PleaseFixTheConfig[-1];
#endif
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.h b/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.h
index c6fea885dcc..13dc5401df8 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.h
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_atomic.h
@@ -2,23 +2,23 @@
AngelCode Scripting Library
Copyright (c) 2003-2013 Andreas Jonsson
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
+ Permission is granted to anyone to use this software for any
+ purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
- 1. The origin of this software must not be misrepresented; you
+ 1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
+ this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
+ 2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
- 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.
The original version of this library can be located at:
@@ -33,7 +33,7 @@
// as_atomic.h
//
// The asCAtomic class provides methods for performing threadsafe
-// operations on a single dword, e.g. reference counting and
+// operations on a single dword, e.g. reference counting and
// bitfields.
//
@@ -46,8 +46,7 @@
BEGIN_AS_NAMESPACE
-class asCAtomic
-{
+class asCAtomic {
public:
asCAtomic();
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_builder.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_builder.cpp
index 5d0f29d6f95..6b956c75a22 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_builder.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_builder.cpp
@@ -53,54 +53,49 @@ BEGIN_AS_NAMESPACE
// asCSymbolTable template specializations for sGlobalVariableDescription entries
template<>
-void asCSymbolTable<sGlobalVariableDescription>::GetKey(const sGlobalVariableDescription *entry, asSNameSpaceNamePair &key) const
-{
+void asCSymbolTable<sGlobalVariableDescription>::GetKey(const sGlobalVariableDescription *entry, asSNameSpaceNamePair &key) const {
asSNameSpace *ns = entry->ns;
asCString name = entry->name;
key = asSNameSpaceNamePair(ns, name);
}
// Comparator for exact variable search
-class asCCompGlobVarType : public asIFilter
-{
+class asCCompGlobVarType : public asIFilter {
public:
const asCDataType &m_type;
asCCompGlobVarType(const asCDataType &type) : m_type(type) {}
- bool operator()(const void *p) const
- {
- const sGlobalVariableDescription* desc = reinterpret_cast<const sGlobalVariableDescription*>(p);
+ bool operator()(const void *p) const {
+ const sGlobalVariableDescription *desc = reinterpret_cast<const sGlobalVariableDescription *>(p);
return desc->datatype == m_type;
}
private:
// The assignment operator is required for MSVC9, otherwise it will complain that it is not possible to auto generate the operator
- asCCompGlobVarType &operator=(const asCCompGlobVarType &) {return *this;}
+ asCCompGlobVarType &operator=(const asCCompGlobVarType &) {
+ return *this;
+ }
};
#endif
-asCBuilder::asCBuilder(asCScriptEngine *_engine, asCModule *_module)
-{
+asCBuilder::asCBuilder(asCScriptEngine *_engine, asCModule *_module) {
this->engine = _engine;
this->module = _module;
silent = false;
}
-asCBuilder::~asCBuilder()
-{
+asCBuilder::~asCBuilder() {
#ifndef AS_NO_COMPILER
asUINT n;
// Free all functions
- for( n = 0; n < functions.GetLength(); n++ )
- {
- if( functions[n] )
- {
- if( functions[n]->node )
+ for (n = 0; n < functions.GetLength(); n++) {
+ if (functions[n]) {
+ if (functions[n]->node)
functions[n]->node->Destroy(engine);
- asDELETE(functions[n],sFunctionDescription);
+ asDELETE(functions[n], sFunctionDescription);
}
functions[n] = 0;
@@ -109,83 +104,71 @@ asCBuilder::~asCBuilder()
// Free all global variables
CleanupEnumValues();
asCSymbolTable<sGlobalVariableDescription>::iterator it = globVariables.List();
- while( it )
- {
- if( (*it)->declaredAtNode )
+ while (it) {
+ if ((*it)->declaredAtNode)
(*it)->declaredAtNode->Destroy(engine);
- if( (*it)->initializationNode )
+ if ((*it)->initializationNode)
(*it)->initializationNode->Destroy(engine);
- asDELETE((*it),sGlobalVariableDescription);
+ asDELETE((*it), sGlobalVariableDescription);
it++;
}
globVariables.Clear();
// Free all the loaded files
- for( n = 0; n < scripts.GetLength(); n++ )
- {
- if( scripts[n] )
- asDELETE(scripts[n],asCScriptCode);
+ for (n = 0; n < scripts.GetLength(); n++) {
+ if (scripts[n])
+ asDELETE(scripts[n], asCScriptCode);
scripts[n] = 0;
}
// Free all class declarations
- for( n = 0; n < classDeclarations.GetLength(); n++ )
- {
- if( classDeclarations[n] )
- {
- if( classDeclarations[n]->node )
+ for (n = 0; n < classDeclarations.GetLength(); n++) {
+ if (classDeclarations[n]) {
+ if (classDeclarations[n]->node)
classDeclarations[n]->node->Destroy(engine);
- asDELETE(classDeclarations[n],sClassDeclaration);
+ asDELETE(classDeclarations[n], sClassDeclaration);
classDeclarations[n] = 0;
}
}
- for( n = 0; n < interfaceDeclarations.GetLength(); n++ )
- {
- if( interfaceDeclarations[n] )
- {
- if( interfaceDeclarations[n]->node )
+ for (n = 0; n < interfaceDeclarations.GetLength(); n++) {
+ if (interfaceDeclarations[n]) {
+ if (interfaceDeclarations[n]->node)
interfaceDeclarations[n]->node->Destroy(engine);
- asDELETE(interfaceDeclarations[n],sClassDeclaration);
+ asDELETE(interfaceDeclarations[n], sClassDeclaration);
interfaceDeclarations[n] = 0;
}
}
- for( n = 0; n < namedTypeDeclarations.GetLength(); n++ )
- {
- if( namedTypeDeclarations[n] )
- {
- if( namedTypeDeclarations[n]->node )
+ for (n = 0; n < namedTypeDeclarations.GetLength(); n++) {
+ if (namedTypeDeclarations[n]) {
+ if (namedTypeDeclarations[n]->node)
namedTypeDeclarations[n]->node->Destroy(engine);
- asDELETE(namedTypeDeclarations[n],sClassDeclaration);
+ asDELETE(namedTypeDeclarations[n], sClassDeclaration);
namedTypeDeclarations[n] = 0;
}
}
- for( n = 0; n < funcDefs.GetLength(); n++ )
- {
- if( funcDefs[n] )
- {
- if( funcDefs[n]->node )
+ for (n = 0; n < funcDefs.GetLength(); n++) {
+ if (funcDefs[n]) {
+ if (funcDefs[n]->node)
funcDefs[n]->node->Destroy(engine);
- asDELETE(funcDefs[n],sFuncDef);
+ asDELETE(funcDefs[n], sFuncDef);
funcDefs[n] = 0;
}
}
- for( n = 0; n < mixinClasses.GetLength(); n++ )
- {
- if( mixinClasses[n] )
- {
- if( mixinClasses[n]->node )
+ for (n = 0; n < mixinClasses.GetLength(); n++) {
+ if (mixinClasses[n]) {
+ if (mixinClasses[n]->node)
mixinClasses[n]->node->Destroy(engine);
- asDELETE(mixinClasses[n],sMixinClass);
+ asDELETE(mixinClasses[n], sMixinClass);
mixinClasses[n] = 0;
}
}
@@ -193,8 +176,7 @@ asCBuilder::~asCBuilder()
#endif // AS_NO_COMPILER
}
-void asCBuilder::Reset()
-{
+void asCBuilder::Reset() {
numErrors = 0;
numWarnings = 0;
engine->preMessage.isSet = false;
@@ -207,15 +189,13 @@ void asCBuilder::Reset()
}
#ifndef AS_NO_COMPILER
-int asCBuilder::AddCode(const char *name, const char *code, int codeLength, int lineOffset, int sectionIdx, bool makeCopy)
-{
+int asCBuilder::AddCode(const char *name, const char *code, int codeLength, int lineOffset, int sectionIdx, bool makeCopy) {
asCScriptCode *script = asNEW(asCScriptCode);
- if( script == 0 )
+ if (script == 0)
return asOUT_OF_MEMORY;
int r = script->SetCode(name, code, codeLength, makeCopy);
- if( r < 0 )
- {
+ if (r < 0) {
asDELETE(script, asCScriptCode);
return r;
}
@@ -227,10 +207,9 @@ int asCBuilder::AddCode(const char *name, const char *code, int codeLength, int
return 0;
}
-asCScriptCode *asCBuilder::FindOrAddCode(const char *name, const char *code, size_t length)
-{
+asCScriptCode *asCBuilder::FindOrAddCode(const char *name, const char *code, size_t length) {
for (asUINT n = 0; n < scripts.GetLength(); n++)
- if( scripts[n]->name == name && scripts[n]->codeLength == length && memcmp(scripts[n]->code, code, length) == 0 )
+ if (scripts[n]->name == name && scripts[n]->codeLength == length && memcmp(scripts[n]->code, code, length) == 0)
return scripts[n];
asCScriptCode *script = asNEW(asCScriptCode);
@@ -238,8 +217,7 @@ asCScriptCode *asCBuilder::FindOrAddCode(const char *name, const char *code, siz
return 0;
int r = script->SetCode(name, code, length, true);
- if (r < 0)
- {
+ if (r < 0) {
asDELETE(script, asCScriptCode);
return 0;
}
@@ -249,8 +227,7 @@ asCScriptCode *asCBuilder::FindOrAddCode(const char *name, const char *code, siz
return script;
}
-void asCBuilder::EvaluateTemplateInstances(asUINT startIdx, bool keepSilent)
-{
+void asCBuilder::EvaluateTemplateInstances(asUINT startIdx, bool keepSilent) {
// Backup the original message stream
bool msgCallback = engine->msgCallback;
asSSystemFunctionInterface msgCallbackFunc = engine->msgCallbackFunc;
@@ -258,47 +235,40 @@ void asCBuilder::EvaluateTemplateInstances(asUINT startIdx, bool keepSilent)
// Set the new temporary message stream
asCOutputBuffer outBuffer;
- if( keepSilent )
+ if (keepSilent)
engine->SetMessageCallback(asMETHOD(asCOutputBuffer, Callback), &outBuffer, asCALL_THISCALL);
// Evaluate each of the template instances that have been created since the start of the build
// TODO: This is not exactly correct, since another thread may have created template instances in parallel
- for( asUINT n = startIdx; n < engine->templateInstanceTypes.GetLength(); n++ )
- {
+ for (asUINT n = startIdx; n < engine->templateInstanceTypes.GetLength(); n++) {
bool dontGarbageCollect = false;
asCObjectType *tmpl = engine->templateInstanceTypes[n];
asCScriptFunction *callback = engine->scriptFunctions[tmpl->beh.templateCallback];
- if( callback && !engine->CallGlobalFunctionRetBool(tmpl, &dontGarbageCollect, callback->sysFuncIntf, callback) )
- {
+ if (callback && !engine->CallGlobalFunctionRetBool(tmpl, &dontGarbageCollect, callback->sysFuncIntf, callback)) {
asCString sub = tmpl->templateSubTypes[0].Format(engine->nameSpaces[0]);
- for( asUINT m = 1; m < tmpl->templateSubTypes.GetLength(); m++ )
- {
+ for (asUINT m = 1; m < tmpl->templateSubTypes.GetLength(); m++) {
sub += ",";
sub += tmpl->templateSubTypes[m].Format(engine->nameSpaces[0]);
}
asCString str;
str.Format(TXT_INSTANCING_INVLD_TMPL_TYPE_s_s, tmpl->name.AddressOf(), sub.AddressOf());
- WriteError(tmpl->scriptSectionIdx >= 0 ? engine->scriptSectionNames[tmpl->scriptSectionIdx]->AddressOf() : "", str, tmpl->declaredAt&0xFFFFF, (tmpl->declaredAt>>20)&0xFFF);
- }
- else
- {
+ WriteError(tmpl->scriptSectionIdx >= 0 ? engine->scriptSectionNames[tmpl->scriptSectionIdx]->AddressOf() : "", str, tmpl->declaredAt & 0xFFFFF, (tmpl->declaredAt >> 20) & 0xFFF);
+ } else {
// If the callback said this template instance won't be garbage collected then remove the flag
- if( dontGarbageCollect )
+ if (dontGarbageCollect)
tmpl->flags &= ~asOBJ_GC;
}
}
// Restore message callback
- if( keepSilent )
- {
+ if (keepSilent) {
engine->msgCallback = msgCallback;
engine->msgCallbackFunc = msgCallbackFunc;
engine->msgCallbackObj = msgCallbackObj;
}
}
-int asCBuilder::Build()
-{
+int asCBuilder::Build() {
Reset();
// The template callbacks must only be called after the subtypes have a known structure,
@@ -337,15 +307,14 @@ int asCBuilder::Build()
// The builder needs to check for each of the global variable, what functions
// that are accessed, and what global variables are access by these functions.
- if( numWarnings > 0 && engine->ep.compilerWarnings == 2 )
+ if (numWarnings > 0 && engine->ep.compilerWarnings == 2)
WriteError(TXT_WARNINGS_TREATED_AS_ERROR, 0, 0);
- if( numErrors > 0 )
+ if (numErrors > 0)
return asERROR;
// Make sure something was compiled, otherwise return an error
- if( module->IsEmpty() )
- {
+ if (module->IsEmpty()) {
WriteError(TXT_NOTHING_WAS_BUILT, 0, 0);
return asERROR;
}
@@ -353,13 +322,12 @@ int asCBuilder::Build()
return asSUCCESS;
}
-int asCBuilder::CompileGlobalVar(const char *sectionName, const char *code, int lineOffset)
-{
+int asCBuilder::CompileGlobalVar(const char *sectionName, const char *code, int lineOffset) {
Reset();
// Add the string to the script code
asCScriptCode *script = asNEW(asCScriptCode);
- if( script == 0 )
+ if (script == 0)
return asOUT_OF_MEMORY;
script->SetCode(sectionName, code, true);
@@ -369,17 +337,16 @@ int asCBuilder::CompileGlobalVar(const char *sectionName, const char *code, int
// Parse the string
asCParser parser(this);
- if( parser.ParseScript(scripts[0]) < 0 )
+ if (parser.ParseScript(scripts[0]) < 0)
return asERROR;
asCScriptNode *node = parser.GetScriptNode();
// Make sure there is nothing else than the global variable in the script code
- if( node == 0 ||
- node->firstChild == 0 ||
- node->firstChild != node->lastChild ||
- node->firstChild->nodeType != snDeclaration )
- {
+ if (node == 0 ||
+ node->firstChild == 0 ||
+ node->firstChild != node->lastChild ||
+ node->firstChild->nodeType != snDeclaration) {
WriteError(TXT_ONLY_ONE_VARIABLE_ALLOWED, script, 0);
return asERROR;
}
@@ -391,27 +358,23 @@ int asCBuilder::CompileGlobalVar(const char *sectionName, const char *code, int
CompileGlobalVariables();
// It is possible that the global variable initialization included anonymous functions that must be compiled too
- for( asUINT n = 0; n < functions.GetLength(); n++ )
- {
+ for (asUINT n = 0; n < functions.GetLength(); n++) {
asCCompiler compiler(engine);
asCScriptFunction *func = engine->scriptFunctions[functions[n]->funcId];
int r = compiler.CompileFunction(this, functions[n]->script, func->parameterNames, functions[n]->node, func, 0);
- if( r < 0 )
+ if (r < 0)
break;
}
- if( numWarnings > 0 && engine->ep.compilerWarnings == 2 )
+ if (numWarnings > 0 && engine->ep.compilerWarnings == 2)
WriteError(TXT_WARNINGS_TREATED_AS_ERROR, 0, 0);
// None of the functions should be added to the module if any error occurred,
// or it was requested that the functions wouldn't be added to the scope
- if( numErrors > 0 )
- {
- for( asUINT n = 0; n < functions.GetLength(); n++ )
- {
+ if (numErrors > 0) {
+ for (asUINT n = 0; n < functions.GetLength(); n++) {
asCScriptFunction *func = engine->scriptFunctions[functions[n]->funcId];
- if( module->m_globalFunctions.GetIndex(func) >= 0 )
- {
+ if (module->m_globalFunctions.GetIndex(func) >= 0) {
module->m_globalFunctions.Erase(module->m_globalFunctions.GetIndex(func));
module->m_scriptFunctions.RemoveValue(func);
func->ReleaseInternal();
@@ -419,11 +382,10 @@ int asCBuilder::CompileGlobalVar(const char *sectionName, const char *code, int
}
}
- if( numErrors > 0 )
- {
+ if (numErrors > 0) {
// Remove the variable from the module, if it was registered
- if( globVariables.GetSize() > 0 )
- module->RemoveGlobalVar(module->GetGlobalVarCount()-1);
+ if (globVariables.GetSize() > 0)
+ module->RemoveGlobalVar(module->GetGlobalVarCount() - 1);
return asERROR;
}
@@ -432,15 +394,12 @@ int asCBuilder::CompileGlobalVar(const char *sectionName, const char *code, int
}
#endif
-int asCBuilder::ValidateDefaultArgs(asCScriptCode *script, asCScriptNode *node, asCScriptFunction *func)
-{
+int asCBuilder::ValidateDefaultArgs(asCScriptCode *script, asCScriptNode *node, asCScriptFunction *func) {
int firstArgWithDefaultValue = -1;
- for( asUINT n = 0; n < func->defaultArgs.GetLength(); n++ )
- {
- if( func->defaultArgs[n] )
+ for (asUINT n = 0; n < func->defaultArgs.GetLength(); n++) {
+ if (func->defaultArgs[n])
firstArgWithDefaultValue = n;
- else if( firstArgWithDefaultValue >= 0 )
- {
+ else if (firstArgWithDefaultValue >= 0) {
asCString str;
str.Format(TXT_DEF_ARG_MISSING_IN_FUNC_s, func->GetDeclaration());
WriteError(str, script, node);
@@ -454,52 +413,45 @@ int asCBuilder::ValidateDefaultArgs(asCScriptCode *script, asCScriptNode *node,
#ifndef AS_NO_COMPILER
// This function will verify if the newly created function will conflict another overload due to having
// identical function arguments that are not default args, e.g: foo(int) and foo(int, int=0)
-int asCBuilder::CheckForConflictsDueToDefaultArgs(asCScriptCode *script, asCScriptNode *node, asCScriptFunction *func, asCObjectType *objType)
-{
+int asCBuilder::CheckForConflictsDueToDefaultArgs(asCScriptCode *script, asCScriptNode *node, asCScriptFunction *func, asCObjectType *objType) {
// TODO: Implement for global functions too
- if( func->objectType == 0 || objType == 0 ) return 0;
+ if (func->objectType == 0 || objType == 0) return 0;
asCArray<int> funcs;
GetObjectMethodDescriptions(func->name.AddressOf(), objType, funcs, false);
- for( asUINT n = 0; n < funcs.GetLength(); n++ )
- {
+ for (asUINT n = 0; n < funcs.GetLength(); n++) {
asCScriptFunction *func2 = engine->scriptFunctions[funcs[n]];
- if( func == func2 )
+ if (func == func2)
continue;
- if( func->IsReadOnly() != func2->IsReadOnly() )
+ if (func->IsReadOnly() != func2->IsReadOnly())
continue;
bool match = true;
asUINT p = 0;
- for( ; p < func->parameterTypes.GetLength() && p < func2->parameterTypes.GetLength(); p++ )
- {
+ for (; p < func->parameterTypes.GetLength() && p < func2->parameterTypes.GetLength(); p++) {
// Only verify until the first argument with default args
- if( (func->defaultArgs.GetLength() > p && func->defaultArgs[p]) ||
- (func2->defaultArgs.GetLength() > p && func2->defaultArgs[p]) )
+ if ((func->defaultArgs.GetLength() > p && func->defaultArgs[p]) ||
+ (func2->defaultArgs.GetLength() > p && func2->defaultArgs[p]))
break;
- if( func->parameterTypes[p] != func2->parameterTypes[p] ||
- func->inOutFlags[p] != func2->inOutFlags[p] )
- {
+ if (func->parameterTypes[p] != func2->parameterTypes[p] ||
+ func->inOutFlags[p] != func2->inOutFlags[p]) {
match = false;
break;
}
}
- if( match )
- {
- if( !((p >= func->parameterTypes.GetLength() && p < func2->defaultArgs.GetLength() && func2->defaultArgs[p]) ||
- (p >= func2->parameterTypes.GetLength() && p < func->defaultArgs.GetLength() && func->defaultArgs[p])) )
- {
+ if (match) {
+ if (!((p >= func->parameterTypes.GetLength() && p < func2->defaultArgs.GetLength() && func2->defaultArgs[p]) ||
+ (p >= func2->parameterTypes.GetLength() && p < func->defaultArgs.GetLength() && func->defaultArgs[p]))) {
// The argument lists match for the full length of the shorter, but the next
// argument on the longer does not have a default arg so there is no conflict
match = false;
}
}
- if( match )
- {
+ if (match) {
WriteWarning(TXT_OVERLOAD_CONFLICTS_DUE_TO_DEFAULT_ARGS, script, node);
WriteInfo(func->GetDeclaration(), script, node);
WriteInfo(func2->GetDeclaration(), script, node);
@@ -510,15 +462,14 @@ int asCBuilder::CheckForConflictsDueToDefaultArgs(asCScriptCode *script, asCScri
return 0;
}
-int asCBuilder::CompileFunction(const char *sectionName, const char *code, int lineOffset, asDWORD compileFlags, asCScriptFunction **outFunc)
-{
+int asCBuilder::CompileFunction(const char *sectionName, const char *code, int lineOffset, asDWORD compileFlags, asCScriptFunction **outFunc) {
asASSERT(outFunc != 0);
Reset();
// Add the string to the script code
asCScriptCode *script = asNEW(asCScriptCode);
- if( script == 0 )
+ if (script == 0)
return asOUT_OF_MEMORY;
script->SetCode(sectionName, code, true);
@@ -528,17 +479,16 @@ int asCBuilder::CompileFunction(const char *sectionName, const char *code, int l
// Parse the string
asCParser parser(this);
- if( parser.ParseScript(scripts[0]) < 0 )
+ if (parser.ParseScript(scripts[0]) < 0)
return asERROR;
asCScriptNode *node = parser.GetScriptNode();
// Make sure there is nothing else than the function in the script code
- if( node == 0 ||
- node->firstChild == 0 ||
- node->firstChild != node->lastChild ||
- node->firstChild->nodeType != snFunction )
- {
+ if (node == 0 ||
+ node->firstChild == 0 ||
+ node->firstChild != node->lastChild ||
+ node->firstChild->nodeType != snFunction) {
WriteError(TXT_ONLY_ONE_FUNCTION_ALLOWED, script, 0);
return asERROR;
}
@@ -549,7 +499,7 @@ int asCBuilder::CompileFunction(const char *sectionName, const char *code, int l
// Create the function
asSFunctionTraits funcTraits;
asCScriptFunction *func = asNEW(asCScriptFunction)(engine, compileFlags & asCOMP_ADD_TO_MODULE ? module : 0, asFUNC_SCRIPT);
- if( func == 0 )
+ if (func == 0)
return asOUT_OF_MEMORY;
GetParsedFunctionDetails(node, scripts[0], 0, func->name, func->returnType, func->parameterNames, func->parameterTypes, func->inOutFlags, func->defaultArgs, funcTraits, module->m_defaultNamespace);
@@ -557,23 +507,20 @@ int asCBuilder::CompileFunction(const char *sectionName, const char *code, int l
func->scriptData->scriptSectionIdx = engine->GetScriptSectionNameIndex(sectionName ? sectionName : "");
int row, col;
scripts[0]->ConvertPosToRowCol(node->tokenPos, &row, &col);
- func->scriptData->declaredAt = (row & 0xFFFFF)|((col & 0xFFF)<<20);
+ func->scriptData->declaredAt = (row & 0xFFFFF) | ((col & 0xFFF) << 20);
func->nameSpace = module->m_defaultNamespace;
// Make sure the default args are declared correctly
int r = ValidateDefaultArgs(script, node, func);
- if( r < 0 )
- {
+ if (r < 0) {
func->ReleaseInternal();
return asERROR;
}
// Tell the engine that the function exists already so the compiler can access it
- if( compileFlags & asCOMP_ADD_TO_MODULE )
- {
+ if (compileFlags & asCOMP_ADD_TO_MODULE) {
r = CheckNameConflict(func->name.AddressOf(), node, scripts[0], module->m_defaultNamespace, false, false);
- if( r < 0 )
- {
+ if (r < 0) {
func->ReleaseInternal();
return asERROR;
}
@@ -581,15 +528,13 @@ int asCBuilder::CompileFunction(const char *sectionName, const char *code, int l
module->m_globalFunctions.Put(func);
module->AddScriptFunction(func);
- }
- else
+ } else
engine->AddScriptFunction(func);
// Fill in the function info for the builder too
node->DisconnectParent();
sFunctionDescription *funcDesc = asNEW(sFunctionDescription);
- if( funcDesc == 0 )
- {
+ if (funcDesc == 0) {
func->ReleaseInternal();
return asOUT_OF_MEMORY;
}
@@ -603,27 +548,23 @@ int asCBuilder::CompileFunction(const char *sectionName, const char *code, int l
funcDesc->isExistingShared = false;
// This must be done in a loop, as it is possible that additional functions get declared as lambda's in the code
- for( asUINT n = 0; n < functions.GetLength(); n++ )
- {
+ for (asUINT n = 0; n < functions.GetLength(); n++) {
asCCompiler compiler(engine);
asCScriptFunction *f = engine->scriptFunctions[functions[n]->funcId];
r = compiler.CompileFunction(this, functions[n]->script, f->parameterNames, functions[n]->node, f, 0);
- if( r < 0 )
+ if (r < 0)
break;
}
- if( numWarnings > 0 && engine->ep.compilerWarnings == 2 )
+ if (numWarnings > 0 && engine->ep.compilerWarnings == 2)
WriteError(TXT_WARNINGS_TREATED_AS_ERROR, 0, 0);
// None of the functions should be added to the module if any error occurred,
// or it was requested that the functions wouldn't be added to the scope
- if( !(compileFlags & asCOMP_ADD_TO_MODULE) || numErrors > 0 )
- {
- for( asUINT n = 0; n < functions.GetLength(); n++ )
- {
+ if (!(compileFlags & asCOMP_ADD_TO_MODULE) || numErrors > 0) {
+ for (asUINT n = 0; n < functions.GetLength(); n++) {
asCScriptFunction *f = engine->scriptFunctions[functions[n]->funcId];
- if( module->m_globalFunctions.GetIndex(f) >= 0 )
- {
+ if (module->m_globalFunctions.GetIndex(f) >= 0) {
module->m_globalFunctions.Erase(module->m_globalFunctions.GetIndex(f));
module->m_scriptFunctions.RemoveValue(f);
f->ReleaseInternal();
@@ -631,8 +572,7 @@ int asCBuilder::CompileFunction(const char *sectionName, const char *code, int l
}
}
- if( numErrors > 0 )
- {
+ if (numErrors > 0) {
// Release the function pointer that would otherwise be returned if no errors occured
func->ReleaseInternal();
@@ -645,19 +585,16 @@ int asCBuilder::CompileFunction(const char *sectionName, const char *code, int l
return asSUCCESS;
}
-void asCBuilder::ParseScripts()
-{
+void asCBuilder::ParseScripts() {
TimeIt("asCBuilder::ParseScripts");
- asCArray<asCParser*> parsers((int)scripts.GetLength());
+ asCArray<asCParser *> parsers((int)scripts.GetLength());
// Parse all the files as if they were one
asUINT n = 0;
- for( n = 0; n < scripts.GetLength(); n++ )
- {
+ for (n = 0; n < scripts.GetLength(); n++) {
asCParser *parser = asNEW(asCParser)(this);
- if( parser != 0 )
- {
+ if (parser != 0) {
parsers.PushLast(parser);
// Parse the script file
@@ -665,11 +602,9 @@ void asCBuilder::ParseScripts()
}
}
- if (numErrors == 0)
- {
+ if (numErrors == 0) {
// Find all type declarations
- for (n = 0; n < scripts.GetLength(); n++)
- {
+ for (n = 0; n < scripts.GetLength(); n++) {
asCScriptNode *node = parsers[n]->GetScriptNode();
RegisterTypesFromScript(node, scripts[n], engine->nameSpaces[0]);
}
@@ -679,37 +614,31 @@ void asCBuilder::ParseScripts()
DetermineTypeRelations();
// Complete function definitions (defining returntype and parameters)
- for( n = 0; n < funcDefs.GetLength(); n++ )
+ for (n = 0; n < funcDefs.GetLength(); n++)
CompleteFuncDef(funcDefs[n]);
// Find other global nodes
- for (n = 0; n < scripts.GetLength(); n++)
- {
+ for (n = 0; n < scripts.GetLength(); n++) {
// Find other global nodes
asCScriptNode *node = parsers[n]->GetScriptNode();
RegisterNonTypesFromScript(node, scripts[n], engine->nameSpaces[0]);
}
// Register script methods found in the interfaces
- for( n = 0; n < interfaceDeclarations.GetLength(); n++ )
- {
+ for (n = 0; n < interfaceDeclarations.GetLength(); n++) {
sClassDeclaration *decl = interfaceDeclarations[n];
asCScriptNode *node = decl->node->firstChild->next;
// Skip list of inherited interfaces
- while( node && node->nodeType == snIdentifier )
+ while (node && node->nodeType == snIdentifier)
node = node->next;
- while( node )
- {
+ while (node) {
asCScriptNode *next = node->next;
- if( node->nodeType == snFunction )
- {
+ if (node->nodeType == snFunction) {
node->DisconnectParent();
RegisterScriptFunctionFromNode(node, decl->script, CastToObjectType(decl->typeInfo), true, false, 0, decl->isExistingShared);
- }
- else if( node->nodeType == snVirtualProperty )
- {
+ } else if (node->nodeType == snVirtualProperty) {
node->DisconnectParent();
RegisterVirtualProperty(node, decl->script, CastToObjectType(decl->typeInfo), true, false, 0, decl->isExistingShared);
}
@@ -719,26 +648,21 @@ void asCBuilder::ParseScripts()
}
// Register script methods found in the classes
- for( n = 0; n < classDeclarations.GetLength(); n++ )
- {
+ for (n = 0; n < classDeclarations.GetLength(); n++) {
sClassDeclaration *decl = classDeclarations[n];
asCScriptNode *node = decl->node->firstChild->next;
// Skip list of classes and interfaces
- while( node && node->nodeType == snIdentifier )
+ while (node && node->nodeType == snIdentifier)
node = node->next;
- while( node )
- {
+ while (node) {
asCScriptNode *next = node->next;
- if( node->nodeType == snFunction )
- {
+ if (node->nodeType == snFunction) {
node->DisconnectParent();
RegisterScriptFunctionFromNode(node, decl->script, CastToObjectType(decl->typeInfo), false, false, 0, decl->isExistingShared);
- }
- else if( node->nodeType == snVirtualProperty )
- {
+ } else if (node->nodeType == snVirtualProperty) {
node->DisconnectParent();
RegisterVirtualProperty(node, decl->script, CastToObjectType(decl->typeInfo), false, false, 0, decl->isExistingShared);
}
@@ -748,30 +672,23 @@ void asCBuilder::ParseScripts()
// Make sure the default factory & constructor exists for classes
asCObjectType *ot = CastToObjectType(decl->typeInfo);
- if( ot->beh.construct == engine->scriptTypeBehaviours.beh.construct )
- {
- if( ot->beh.constructors.GetLength() == 1 || engine->ep.alwaysImplDefaultConstruct )
- {
+ if (ot->beh.construct == engine->scriptTypeBehaviours.beh.construct) {
+ if (ot->beh.constructors.GetLength() == 1 || engine->ep.alwaysImplDefaultConstruct) {
AddDefaultConstructor(ot, decl->script);
- }
- else
- {
+ } else {
// As the class has another constructor we shouldn't provide the default constructor
- if( ot->beh.construct )
- {
+ if (ot->beh.construct) {
engine->scriptFunctions[ot->beh.construct]->ReleaseInternal();
ot->beh.construct = 0;
ot->beh.constructors.RemoveIndex(0);
}
- if( ot->beh.factory )
- {
+ if (ot->beh.factory) {
engine->scriptFunctions[ot->beh.factory]->ReleaseInternal();
ot->beh.factory = 0;
ot->beh.factories.RemoveIndex(0);
}
// Only remove the opAssign method if the script hasn't provided one
- if( ot->beh.copy == engine->scriptTypeBehaviours.beh.copy )
- {
+ if (ot->beh.copy == engine->scriptTypeBehaviours.beh.copy) {
engine->scriptFunctions[ot->beh.copy]->ReleaseInternal();
ot->beh.copy = 0;
}
@@ -780,61 +697,44 @@ void asCBuilder::ParseScripts()
}
}
- for( n = 0; n < parsers.GetLength(); n++ )
- {
- asDELETE(parsers[n],asCParser);
+ for (n = 0; n < parsers.GetLength(); n++) {
+ asDELETE(parsers[n], asCParser);
}
}
-void asCBuilder::RegisterTypesFromScript(asCScriptNode *node, asCScriptCode *script, asSNameSpace *ns)
-{
+void asCBuilder::RegisterTypesFromScript(asCScriptNode *node, asCScriptCode *script, asSNameSpace *ns) {
asASSERT(node->nodeType == snScript);
// Find structure definitions first
node = node->firstChild;
- while( node )
- {
+ while (node) {
asCScriptNode *next = node->next;
- if( node->nodeType == snNamespace )
- {
+ if (node->nodeType == snNamespace) {
// Recursively register the entities defined in the namespace
asCString nsName;
nsName.Assign(&script->code[node->firstChild->tokenPos], node->firstChild->tokenLength);
- if( ns->name != "" )
+ if (ns->name != "")
nsName = ns->name + "::" + nsName;
asSNameSpace *nsChild = engine->AddNameSpace(nsName.AddressOf());
RegisterTypesFromScript(node->lastChild, script, nsChild);
- }
- else
- {
- if( node->nodeType == snClass )
- {
+ } else {
+ if (node->nodeType == snClass) {
node->DisconnectParent();
RegisterClass(node, script, ns);
- }
- else if( node->nodeType == snInterface )
- {
+ } else if (node->nodeType == snInterface) {
node->DisconnectParent();
RegisterInterface(node, script, ns);
- }
- else if( node->nodeType == snEnum )
- {
+ } else if (node->nodeType == snEnum) {
node->DisconnectParent();
RegisterEnum(node, script, ns);
- }
- else if( node->nodeType == snTypedef )
- {
+ } else if (node->nodeType == snTypedef) {
node->DisconnectParent();
RegisterTypedef(node, script, ns);
- }
- else if( node->nodeType == snFuncDef )
- {
+ } else if (node->nodeType == snFuncDef) {
node->DisconnectParent();
RegisterFuncDef(node, script, ns, 0);
- }
- else if( node->nodeType == snMixin )
- {
+ } else if (node->nodeType == snMixin) {
node->DisconnectParent();
RegisterMixinClass(node, script, ns);
}
@@ -844,37 +744,31 @@ void asCBuilder::RegisterTypesFromScript(asCScriptNode *node, asCScriptCode *scr
}
}
-void asCBuilder::RegisterNonTypesFromScript(asCScriptNode *node, asCScriptCode *script, asSNameSpace *ns)
-{
+void asCBuilder::RegisterNonTypesFromScript(asCScriptNode *node, asCScriptCode *script, asSNameSpace *ns) {
node = node->firstChild;
- while( node )
- {
+ while (node) {
asCScriptNode *next = node->next;
- if( node->nodeType == snNamespace )
- {
+ if (node->nodeType == snNamespace) {
// Determine the name of the namespace
asCString nsName;
nsName.Assign(&script->code[node->firstChild->tokenPos], node->firstChild->tokenLength);
- if( ns->name != "" )
+ if (ns->name != "")
nsName = ns->name + "::" + nsName;
// Declare the namespace, then add the entities
asSNameSpace *nsChild = engine->AddNameSpace(nsName.AddressOf());
RegisterNonTypesFromScript(node->lastChild, script, nsChild);
- }
- else
- {
+ } else {
node->DisconnectParent();
- if( node->nodeType == snFunction )
+ if (node->nodeType == snFunction)
RegisterScriptFunctionFromNode(node, script, 0, false, true, ns);
- else if( node->nodeType == snDeclaration )
+ else if (node->nodeType == snDeclaration)
RegisterGlobalVar(node, script, ns);
- else if( node->nodeType == snVirtualProperty )
+ else if (node->nodeType == snVirtualProperty)
RegisterVirtualProperty(node, script, 0, false, true, ns);
- else if( node->nodeType == snImport )
+ else if (node->nodeType == snImport)
RegisterImportedFunction(module->GetNextImportedFunctionId(), node, script, ns);
- else
- {
+ else {
// Unused script node
int r, c;
script->ConvertPosToRowCol(node->tokenPos, &r, &c);
@@ -889,16 +783,14 @@ void asCBuilder::RegisterNonTypesFromScript(asCScriptNode *node, asCScriptCode *
}
}
-void asCBuilder::CompileFunctions()
-{
+void asCBuilder::CompileFunctions() {
// Compile each function
- for( asUINT n = 0; n < functions.GetLength(); n++ )
- {
+ for (asUINT n = 0; n < functions.GetLength(); n++) {
sFunctionDescription *current = functions[n];
- if( current == 0 ) continue;
+ if (current == 0) continue;
// Don't compile the function again if it was an existing shared function
- if( current->isExistingShared ) continue;
+ if (current->isExistingShared) continue;
// Don't compile if there is no statement block
if (current->node && !(current->node->nodeType == snStatementBlock || current->node->lastChild->nodeType == snStatementBlock))
@@ -909,22 +801,18 @@ void asCBuilder::CompileFunctions()
// Find the class declaration for constructors
sClassDeclaration *classDecl = 0;
- if( current->objType && current->name == current->objType->name )
- {
- for( asUINT c = 0; c < classDeclarations.GetLength(); c++ )
- {
- if( classDeclarations[c]->typeInfo == current->objType )
- {
+ if (current->objType && current->name == current->objType->name) {
+ for (asUINT c = 0; c < classDeclarations.GetLength(); c++) {
+ if (classDeclarations[c]->typeInfo == current->objType) {
classDecl = classDeclarations[c];
break;
}
}
- asASSERT( classDecl );
+ asASSERT(classDecl);
}
- if( current->node )
- {
+ if (current->node) {
int r, c;
current->script->ConvertPosToRowCol(current->node->tokenPos, &r, &c);
@@ -936,13 +824,11 @@ void asCBuilder::CompileFunctions()
compiler.CompileFunction(this, current->script, current->paramNames, current->node, func, classDecl);
engine->preMessage.isSet = false;
- }
- else if( current->objType && current->name == current->objType->name )
- {
+ } else if (current->objType && current->name == current->objType->name) {
asCScriptNode *node = classDecl->node;
int r = 0, c = 0;
- if( node )
+ if (node)
current->script->ConvertPosToRowCol(node->tokenPos, &r, &c);
asCString str = func->GetDeclarationStr();
@@ -954,18 +840,15 @@ void asCBuilder::CompileFunctions()
compiler.CompileDefaultConstructor(this, current->script, node, func, classDecl);
engine->preMessage.isSet = false;
- }
- else
- {
- asASSERT( false );
+ } else {
+ asASSERT(false);
}
}
}
#endif
// Called from module and engine
-int asCBuilder::ParseDataType(const char *datatype, asCDataType *result, asSNameSpace *implicitNamespace, bool isReturnType)
-{
+int asCBuilder::ParseDataType(const char *datatype, asCDataType *result, asSNameSpace *implicitNamespace, bool isReturnType) {
Reset();
asCScriptCode source;
@@ -973,24 +856,23 @@ int asCBuilder::ParseDataType(const char *datatype, asCDataType *result, asSName
asCParser parser(this);
int r = parser.ParseDataType(&source, isReturnType);
- if( r < 0 )
+ if (r < 0)
return asINVALID_TYPE;
// Get data type and property name
asCScriptNode *dataType = parser.GetScriptNode()->firstChild;
*result = CreateDataTypeFromNode(dataType, &source, implicitNamespace, true);
- if( isReturnType )
+ if (isReturnType)
*result = ModifyDataTypeFromNode(*result, dataType->next, &source, 0, 0);
- if( numErrors > 0 )
+ if (numErrors > 0)
return asINVALID_TYPE;
return asSUCCESS;
}
-int asCBuilder::ParseTemplateDecl(const char *decl, asCString *name, asCArray<asCString> &subtypeNames)
-{
+int asCBuilder::ParseTemplateDecl(const char *decl, asCString *name, asCArray<asCString> &subtypeNames) {
Reset();
asCScriptCode source;
@@ -998,15 +880,14 @@ int asCBuilder::ParseTemplateDecl(const char *decl, asCString *name, asCArray<as
asCParser parser(this);
int r = parser.ParseTemplateDecl(&source);
- if( r < 0 )
+ if (r < 0)
return asINVALID_TYPE;
// Get the template name and subtype names
asCScriptNode *node = parser.GetScriptNode()->firstChild;
name->Assign(&decl[node->tokenPos], node->tokenLength);
- while( (node = node->next) != 0 )
- {
+ while ((node = node->next) != 0) {
asCString subtypeName;
subtypeName.Assign(&decl[node->tokenPos], node->tokenLength);
subtypeNames.PushLast(subtypeName);
@@ -1014,23 +895,21 @@ int asCBuilder::ParseTemplateDecl(const char *decl, asCString *name, asCArray<as
// TODO: template: check for name conflicts
- if( numErrors > 0 )
+ if (numErrors > 0)
return asINVALID_DECLARATION;
return asSUCCESS;
}
-int asCBuilder::VerifyProperty(asCDataType *dt, const char *decl, asCString &name, asCDataType &type, asSNameSpace *ns)
-{
+int asCBuilder::VerifyProperty(asCDataType *dt, const char *decl, asCString &name, asCDataType &type, asSNameSpace *ns) {
// Either datatype or namespace must be informed
- asASSERT( dt || ns );
+ asASSERT(dt || ns);
Reset();
- if( dt )
- {
+ if (dt) {
// Verify that the object type exist
- if( CastToObjectType(dt->GetTypeInfo()) == 0 )
+ if (CastToObjectType(dt->GetTypeInfo()) == 0)
return asINVALID_OBJECT;
}
@@ -1040,7 +919,7 @@ int asCBuilder::VerifyProperty(asCDataType *dt, const char *decl, asCString &nam
asCParser parser(this);
int r = parser.ParsePropertyDeclaration(&source);
- if( r < 0 )
+ if (r < 0)
return asINVALID_DECLARATION;
// Get data type
@@ -1061,42 +940,35 @@ int asCBuilder::VerifyProperty(asCDataType *dt, const char *decl, asCString &nam
// Validate that the type really can be a registered property
// We cannot use CanBeInstantiated, as it is allowed to register
// properties of type that cannot otherwise be instantiated
- if( type.IsFuncdef() && !type.IsObjectHandle() )
- {
+ if (type.IsFuncdef() && !type.IsObjectHandle()) {
// Function definitions must always be handles
return asINVALID_DECLARATION;
}
// Verify property name
- if( dt )
- {
- if( CheckNameConflictMember(dt->GetTypeInfo(), name.AddressOf(), nameNode, &source, true, false) < 0 )
+ if (dt) {
+ if (CheckNameConflictMember(dt->GetTypeInfo(), name.AddressOf(), nameNode, &source, true, false) < 0)
return asNAME_TAKEN;
- }
- else
- {
- if( CheckNameConflict(name.AddressOf(), nameNode, &source, ns, true, false) < 0 )
+ } else {
+ if (CheckNameConflict(name.AddressOf(), nameNode, &source, ns, true, false) < 0)
return asNAME_TAKEN;
}
- if( numErrors > 0 )
+ if (numErrors > 0)
return asINVALID_DECLARATION;
return asSUCCESS;
}
#ifndef AS_NO_COMPILER
-asCObjectProperty *asCBuilder::GetObjectProperty(asCDataType &obj, const char *prop)
-{
+asCObjectProperty *asCBuilder::GetObjectProperty(asCDataType &obj, const char *prop) {
asASSERT(CastToObjectType(obj.GetTypeInfo()) != 0);
// TODO: optimize: Improve linear search
asCArray<asCObjectProperty *> &props = CastToObjectType(obj.GetTypeInfo())->properties;
- for( asUINT n = 0; n < props.GetLength(); n++ )
- {
- if( props[n]->name == prop )
- {
- if( module->m_accessMask & props[n]->accessMask )
+ for (asUINT n = 0; n < props.GetLength(); n++) {
+ if (props[n]->name == prop) {
+ if (module->m_accessMask & props[n]->accessMask)
return props[n];
else
return 0;
@@ -1107,40 +979,35 @@ asCObjectProperty *asCBuilder::GetObjectProperty(asCDataType &obj, const char *p
}
#endif
-bool asCBuilder::DoesGlobalPropertyExist(const char *prop, asSNameSpace *ns, asCGlobalProperty **outProp, sGlobalVariableDescription **outDesc, bool *isAppProp)
-{
- if( outProp ) *outProp = 0;
- if( outDesc ) *outDesc = 0;
- if( isAppProp ) *isAppProp = false;
+bool asCBuilder::DoesGlobalPropertyExist(const char *prop, asSNameSpace *ns, asCGlobalProperty **outProp, sGlobalVariableDescription **outDesc, bool *isAppProp) {
+ if (outProp) *outProp = 0;
+ if (outDesc) *outDesc = 0;
+ if (isAppProp) *isAppProp = false;
// Check application registered properties
asCString name(prop);
asCGlobalProperty *globProp = engine->registeredGlobalProps.GetFirst(ns, name);
- if( globProp )
- {
- if( isAppProp ) *isAppProp = true;
- if( outProp ) *outProp = globProp;
+ if (globProp) {
+ if (isAppProp) *isAppProp = true;
+ if (outProp) *outProp = globProp;
return true;
}
#ifndef AS_NO_COMPILER
// Check properties being compiled now
- sGlobalVariableDescription* desc = globVariables.GetFirst(ns, prop);
- if( desc && !desc->isEnumValue )
- {
- if( outProp ) *outProp = desc->property;
- if( outDesc ) *outDesc = desc;
+ sGlobalVariableDescription *desc = globVariables.GetFirst(ns, prop);
+ if (desc && !desc->isEnumValue) {
+ if (outProp) *outProp = desc->property;
+ if (outDesc) *outDesc = desc;
return true;
}
#endif
// Check previously compiled global variables
- if( module )
- {
+ if (module) {
globProp = module->m_scriptGlobals.GetFirst(ns, prop);
- if( globProp )
- {
- if( outProp ) *outProp = globProp;
+ if (globProp) {
+ if (outProp) *outProp = globProp;
return true;
}
}
@@ -1148,42 +1015,36 @@ bool asCBuilder::DoesGlobalPropertyExist(const char *prop, asSNameSpace *ns, asC
return false;
}
-asCGlobalProperty *asCBuilder::GetGlobalProperty(const char *prop, asSNameSpace *ns, bool *isCompiled, bool *isPureConstant, asQWORD *constantValue, bool *isAppProp)
-{
- if( isCompiled ) *isCompiled = true;
- if( isPureConstant ) *isPureConstant = false;
- if( isAppProp ) *isAppProp = false;
- if( constantValue ) *constantValue = 0;
+asCGlobalProperty *asCBuilder::GetGlobalProperty(const char *prop, asSNameSpace *ns, bool *isCompiled, bool *isPureConstant, asQWORD *constantValue, bool *isAppProp) {
+ if (isCompiled) *isCompiled = true;
+ if (isPureConstant) *isPureConstant = false;
+ if (isAppProp) *isAppProp = false;
+ if (constantValue) *constantValue = 0;
asCGlobalProperty *globProp = 0;
sGlobalVariableDescription *globDesc = 0;
- if( DoesGlobalPropertyExist(prop, ns, &globProp, &globDesc, isAppProp) )
- {
+ if (DoesGlobalPropertyExist(prop, ns, &globProp, &globDesc, isAppProp)) {
#ifndef AS_NO_COMPILER
- if( globDesc )
- {
+ if (globDesc) {
// The property was declared in this build call, check if it has been compiled successfully already
- if( isCompiled ) *isCompiled = globDesc->isCompiled;
- if( isPureConstant ) *isPureConstant = globDesc->isPureConstant;
- if( constantValue ) *constantValue = globDesc->constantValue;
- }
- else
+ if (isCompiled) *isCompiled = globDesc->isCompiled;
+ if (isPureConstant) *isPureConstant = globDesc->isPureConstant;
+ if (constantValue) *constantValue = globDesc->constantValue;
+ } else
#endif
- if( isAppProp )
- {
- // Don't return the property if the module doesn't have access to it
- if( !(module->m_accessMask & globProp->accessMask) )
- globProp = 0;
- }
+ if (isAppProp) {
+ // Don't return the property if the module doesn't have access to it
+ if (!(module->m_accessMask & globProp->accessMask))
+ globProp = 0;
+ }
return globProp;
}
return 0;
}
-int asCBuilder::ParseFunctionDeclaration(asCObjectType *objType, const char *decl, asCScriptFunction *func, bool isSystemFunction, asCArray<bool> *paramAutoHandles, bool *returnAutoHandle, asSNameSpace *ns, asCScriptNode **listPattern, asCObjectType **outParentClass)
-{
- asASSERT( objType || ns );
+int asCBuilder::ParseFunctionDeclaration(asCObjectType *objType, const char *decl, asCScriptFunction *func, bool isSystemFunction, asCArray<bool> *paramAutoHandles, bool *returnAutoHandle, asSNameSpace *ns, asCScriptNode **listPattern, asCObjectType **outParentClass) {
+ asASSERT(objType || ns);
if (listPattern)
*listPattern = 0;
@@ -1199,7 +1060,7 @@ int asCBuilder::ParseFunctionDeclaration(asCObjectType *objType, const char *dec
asCParser parser(this);
int r = parser.ParseFunctionDefinition(&source, listPattern != 0);
- if( r < 0 )
+ if (r < 0)
return asINVALID_DECLARATION;
asCScriptNode *node = parser.GetScriptNode();
@@ -1208,7 +1069,7 @@ int asCBuilder::ParseFunctionDeclaration(asCObjectType *objType, const char *dec
asCScriptNode *n = node->firstChild->next->next;
asCObjectType *parentClass = 0;
func->nameSpace = GetNameSpaceFromNode(n, &source, ns, &n, &parentClass);
- if( func->nameSpace == 0 && parentClass == 0 )
+ if (func->nameSpace == 0 && parentClass == 0)
return asINVALID_DECLARATION;
if (parentClass && func->funcType != asFUNC_FUNCDEF)
return asINVALID_DECLARATION;
@@ -1225,30 +1086,29 @@ int asCBuilder::ParseFunctionDeclaration(asCObjectType *objType, const char *dec
// Scoped reference types are allowed to use handle when returned from application functions
func->returnType = CreateDataTypeFromNode(node->firstChild, &source, objType ? objType->nameSpace : ns, true, parentClass ? parentClass : objType);
func->returnType = ModifyDataTypeFromNode(func->returnType, node->firstChild->next, &source, 0, &autoHandle);
- if( autoHandle && (!func->returnType.IsObjectHandle() || func->returnType.IsReference()) )
+ if (autoHandle && (!func->returnType.IsObjectHandle() || func->returnType.IsReference()))
return asINVALID_DECLARATION;
- if( returnAutoHandle ) *returnAutoHandle = autoHandle;
+ if (returnAutoHandle) *returnAutoHandle = autoHandle;
// Reference types cannot be returned by value from system functions
- if( isSystemFunction &&
- (func->returnType.GetTypeInfo() &&
- (func->returnType.GetTypeInfo()->flags & asOBJ_REF)) &&
- !(func->returnType.IsReference() ||
- func->returnType.IsObjectHandle()) )
+ if (isSystemFunction &&
+ (func->returnType.GetTypeInfo() &&
+ (func->returnType.GetTypeInfo()->flags & asOBJ_REF)) &&
+ !(func->returnType.IsReference() ||
+ func->returnType.IsObjectHandle()))
return asINVALID_DECLARATION;
// Count number of parameters
int paramCount = 0;
asCScriptNode *paramList = n->next;
n = paramList->firstChild;
- while( n )
- {
+ while (n) {
paramCount++;
n = n->next->next;
- if( n && n->nodeType == snIdentifier )
+ if (n && n->nodeType == snIdentifier)
n = n->next;
- if( n && n->nodeType == snExpression )
+ if (n && n->nodeType == snExpression)
n = n->next;
}
@@ -1257,22 +1117,21 @@ int asCBuilder::ParseFunctionDeclaration(asCObjectType *objType, const char *dec
func->parameterNames.SetLength(paramCount);
func->inOutFlags.Allocate(paramCount, false);
func->defaultArgs.Allocate(paramCount, false);
- if( paramAutoHandles ) paramAutoHandles->Allocate(paramCount, false);
+ if (paramAutoHandles) paramAutoHandles->Allocate(paramCount, false);
n = paramList->firstChild;
asUINT index = 0;
- while( n )
- {
+ while (n) {
asETypeModifiers inOutFlags;
asCDataType type = CreateDataTypeFromNode(n, &source, objType ? objType->nameSpace : ns, false, parentClass ? parentClass : objType);
type = ModifyDataTypeFromNode(type, n->next, &source, &inOutFlags, &autoHandle);
// Reference types cannot be passed by value to system functions
- if( isSystemFunction &&
- (type.GetTypeInfo() &&
- (type.GetTypeInfo()->flags & asOBJ_REF)) &&
- !(type.IsReference() ||
- type.IsObjectHandle()) )
+ if (isSystemFunction &&
+ (type.GetTypeInfo() &&
+ (type.GetTypeInfo()->flags & asOBJ_REF)) &&
+ !(type.IsReference() ||
+ type.IsObjectHandle()))
return asINVALID_DECLARATION;
// Store the parameter type
@@ -1280,63 +1139,56 @@ int asCBuilder::ParseFunctionDeclaration(asCObjectType *objType, const char *dec
func->inOutFlags.PushLast(inOutFlags);
// Don't permit void parameters
- if( type.GetTokenType() == ttVoid )
+ if (type.GetTokenType() == ttVoid)
return asINVALID_DECLARATION;
- if( autoHandle && (!type.IsObjectHandle() || type.IsReference()) )
+ if (autoHandle && (!type.IsObjectHandle() || type.IsReference()))
return asINVALID_DECLARATION;
- if( paramAutoHandles ) paramAutoHandles->PushLast(autoHandle);
+ if (paramAutoHandles) paramAutoHandles->PushLast(autoHandle);
// Make sure that var type parameters are references
- if( type.GetTokenType() == ttQuestion &&
- !type.IsReference() )
+ if (type.GetTokenType() == ttQuestion &&
+ !type.IsReference())
return asINVALID_DECLARATION;
// Move to next parameter
n = n->next->next;
- if( n && n->nodeType == snIdentifier )
- {
+ if (n && n->nodeType == snIdentifier) {
func->parameterNames[index] = asCString(&source.code[n->tokenPos], n->tokenLength);
n = n->next;
}
++index;
- if( n && n->nodeType == snExpression )
- {
+ if (n && n->nodeType == snExpression) {
// Strip out white space and comments to better share the string
asCString *defaultArgStr = asNEW(asCString);
- if( defaultArgStr )
- {
+ if (defaultArgStr) {
*defaultArgStr = GetCleanExpressionString(n, &source);
func->defaultArgs.PushLast(defaultArgStr);
}
n = n->next;
- }
- else
+ } else
func->defaultArgs.PushLast(0);
}
// Set the read-only flag if const is declared after parameter list
n = paramList->next;
- if( n && n->nodeType == snUndefined && n->tokenType == ttConst )
- {
- if( objType == 0 )
+ if (n && n->nodeType == snUndefined && n->tokenType == ttConst) {
+ if (objType == 0)
return asINVALID_DECLARATION;
func->SetReadOnly(true);
n = n->next;
- }
- else
+ } else
func->SetReadOnly(false);
// Check for additional function traits
- while (n && n->nodeType == snIdentifier)
- {
+ while (n && n->nodeType == snIdentifier) {
if (source.TokenEquals(n->tokenPos, n->tokenLength, EXPLICIT_TOKEN))
func->SetExplicit(true);
- else if( source.TokenEquals(n->tokenPos, n->tokenLength, PROPERTY_TOKEN))
+ else if (source.TokenEquals(n->tokenPos, n->tokenLength, PROPERTY_TOKEN))
func->SetProperty(true);
else
return asINVALID_DECLARATION;
@@ -1345,33 +1197,28 @@ int asCBuilder::ParseFunctionDeclaration(asCObjectType *objType, const char *dec
}
// If the caller expects a list pattern, check for the existence, else report an error if not
- if( listPattern )
- {
- if( n == 0 || n->nodeType != snListPattern )
+ if (listPattern) {
+ if (n == 0 || n->nodeType != snListPattern)
return asINVALID_DECLARATION;
- else
- {
+ else {
*listPattern = n;
n->DisconnectParent();
}
- }
- else
- {
- if( n )
+ } else {
+ if (n)
return asINVALID_DECLARATION;
}
// Make sure the default args are declared correctly
ValidateDefaultArgs(&source, node, func);
- if( numErrors > 0 || numWarnings > 0 )
+ if (numErrors > 0 || numWarnings > 0)
return asINVALID_DECLARATION;
return 0;
}
-int asCBuilder::ParseVariableDeclaration(const char *decl, asSNameSpace *implicitNamespace, asCString &outName, asSNameSpace *&outNamespace, asCDataType &outDt)
-{
+int asCBuilder::ParseVariableDeclaration(const char *decl, asSNameSpace *implicitNamespace, asCString &outName, asSNameSpace *&outNamespace, asCDataType &outDt) {
Reset();
asCScriptCode source;
@@ -1380,7 +1227,7 @@ int asCBuilder::ParseVariableDeclaration(const char *decl, asSNameSpace *implici
asCParser parser(this);
int r = parser.ParsePropertyDeclaration(&source);
- if( r < 0 )
+ if (r < 0)
return asINVALID_DECLARATION;
asCScriptNode *node = parser.GetScriptNode();
@@ -1389,7 +1236,7 @@ int asCBuilder::ParseVariableDeclaration(const char *decl, asSNameSpace *implici
asCScriptNode *n = node->firstChild->next;
// TODO: child funcdef: The parentType will be set if the scope is actually a type rather than a namespace
outNamespace = GetNameSpaceFromNode(n, &source, implicitNamespace, &n);
- if( outNamespace == 0 )
+ if (outNamespace == 0)
return asINVALID_DECLARATION;
// Find name
@@ -1398,15 +1245,14 @@ int asCBuilder::ParseVariableDeclaration(const char *decl, asSNameSpace *implici
// Initialize a script variable object for registration
outDt = CreateDataTypeFromNode(node->firstChild, &source, implicitNamespace);
- if( numErrors > 0 || numWarnings > 0 )
+ if (numErrors > 0 || numWarnings > 0)
return asINVALID_DECLARATION;
return 0;
}
// TODO: This should use SymbolLookupMember, which should be available in the TypeInfo class
-int asCBuilder::CheckNameConflictMember(asCTypeInfo *t, const char *name, asCScriptNode *node, asCScriptCode *code, bool isProperty, bool isVirtualProperty)
-{
+int asCBuilder::CheckNameConflictMember(asCTypeInfo *t, const char *name, asCScriptNode *node, asCScriptCode *code, bool isProperty, bool isVirtualProperty) {
// It's not necessary to check against object types
asCObjectType *ot = CastToObjectType(t);
@@ -1416,15 +1262,11 @@ int asCBuilder::CheckNameConflictMember(asCTypeInfo *t, const char *name, asCScr
// Check against properties
// TODO: optimize: Improve linear search
// Properties are allowed to have the same name as virtual properties
- if( !isVirtualProperty )
- {
+ if (!isVirtualProperty) {
asCArray<asCObjectProperty *> &props = ot->properties;
- for( asUINT n = 0; n < props.GetLength(); n++ )
- {
- if( props[n]->name == name )
- {
- if( code )
- {
+ for (asUINT n = 0; n < props.GetLength(); n++) {
+ if (props[n]->name == name) {
+ if (code) {
asCString str;
str.Format(TXT_NAME_CONFLICT_s_OBJ_PROPERTY, name);
WriteError(str, code, node);
@@ -1438,16 +1280,12 @@ int asCBuilder::CheckNameConflictMember(asCTypeInfo *t, const char *name, asCScr
// Check against virtual properties
// Don't do this when the check is for a virtual property, as it is allowed to have multiple overloads for virtual properties
// Properties are allowed to have the same name as virtual properties
- if( !isProperty && !isVirtualProperty )
- {
+ if (!isProperty && !isVirtualProperty) {
asCArray<int> methods = ot->methods;
- for( asUINT n = 0; n < methods.GetLength(); n++ )
- {
+ for (asUINT n = 0; n < methods.GetLength(); n++) {
asCScriptFunction *func = engine->scriptFunctions[methods[n]];
- if( func->IsProperty() && func->name.SubString(4) == name )
- {
- if( code )
- {
+ if (func->IsProperty() && func->name.SubString(4) == name) {
+ if (code) {
asCString str;
str.Format(TXT_NAME_CONFLICT_s_OBJ_PROPERTY, name);
WriteError(str, code, node);
@@ -1459,13 +1297,10 @@ int asCBuilder::CheckNameConflictMember(asCTypeInfo *t, const char *name, asCScr
}
// Check against child types
- asCArray<asCFuncdefType*> &funcdefs = ot->childFuncDefs;
- for (asUINT n = 0; n < funcdefs.GetLength(); n++)
- {
- if (funcdefs[n]->name == name)
- {
- if (code)
- {
+ asCArray<asCFuncdefType *> &funcdefs = ot->childFuncDefs;
+ for (asUINT n = 0; n < funcdefs.GetLength(); n++) {
+ if (funcdefs[n]->name == name) {
+ if (code) {
asCString str;
str.Format(TXT_NAME_CONFLICT_s_IS_FUNCDEF, name);
WriteError(str, code, node);
@@ -1476,15 +1311,11 @@ int asCBuilder::CheckNameConflictMember(asCTypeInfo *t, const char *name, asCScr
}
// Property names must be checked against method names
- if( isProperty )
- {
+ if (isProperty) {
asCArray<int> methods = ot->methods;
- for( asUINT n = 0; n < methods.GetLength(); n++ )
- {
- if( engine->scriptFunctions[methods[n]]->name == name )
- {
- if( code )
- {
+ for (asUINT n = 0; n < methods.GetLength(); n++) {
+ if (engine->scriptFunctions[methods[n]]->name == name) {
+ if (code) {
asCString str;
str.Format(TXT_NAME_CONFLICT_s_METHOD, name);
WriteError(str, code, node);
@@ -1503,23 +1334,19 @@ int asCBuilder::CheckNameConflictMember(asCTypeInfo *t, const char *name, asCScr
else
scope = ot->name;
asSNameSpace *ns = engine->FindNameSpace(scope.AddressOf());
- if (ns)
- {
+ if (ns) {
// Check as if not a function as it doesn't matter the function signature
return CheckNameConflict(name, node, code, ns, true, isVirtualProperty);
}
-
+
return 0;
}
// TODO: This should use SymbolLookup
-int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScriptCode *code, asSNameSpace *ns, bool isProperty, bool isVirtualProperty)
-{
+int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScriptCode *code, asSNameSpace *ns, bool isProperty, bool isVirtualProperty) {
// Check against registered object types
- if( engine->GetRegisteredType(name, ns) != 0 )
- {
- if( code )
- {
+ if (engine->GetRegisteredType(name, ns) != 0) {
+ if (code) {
asCString str;
if (ns->name != "")
str = ns->name + "::" + name;
@@ -1534,10 +1361,8 @@ int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScri
// Check against global properties
// Virtual properties are allowed to have the same name as a real property
- if( !isVirtualProperty && DoesGlobalPropertyExist(name, ns) )
- {
- if( code )
- {
+ if (!isVirtualProperty && DoesGlobalPropertyExist(name, ns)) {
+ if (code) {
asCString str;
if (ns->name != "")
str = ns->name + "::" + name;
@@ -1549,20 +1374,16 @@ int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScri
return -1;
}
-
+
// Check against registered global virtual properties
// Don't do this when the check is for a virtual property, as it is allowed to have multiple overloads for virtual properties
- if( !isProperty || !isVirtualProperty )
- {
- for (asUINT n = 0; n < engine->registeredGlobalFuncs.GetSize(); n++)
- {
+ if (!isProperty || !isVirtualProperty) {
+ for (asUINT n = 0; n < engine->registeredGlobalFuncs.GetSize(); n++) {
asCScriptFunction *func = engine->registeredGlobalFuncs.Get(n);
if (func->IsProperty() &&
- func->nameSpace == ns &&
- func->name.SubString(4) == name)
- {
- if (code)
- {
+ func->nameSpace == ns &&
+ func->name.SubString(4) == name) {
+ if (code) {
asCString str;
if (ns->name != "")
str = ns->name + "::" + name;
@@ -1578,15 +1399,11 @@ int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScri
}
// Property names must be checked against function names
- if (isProperty)
- {
- for (asUINT n = 0; n < engine->registeredGlobalFuncs.GetSize(); n++)
- {
+ if (isProperty) {
+ for (asUINT n = 0; n < engine->registeredGlobalFuncs.GetSize(); n++) {
if (engine->registeredGlobalFuncs.Get(n)->name == name &&
- engine->registeredGlobalFuncs.Get(n)->nameSpace == ns)
- {
- if (code)
- {
+ engine->registeredGlobalFuncs.Get(n)->nameSpace == ns) {
+ if (code) {
asCString str;
if (ns->name != "")
str = ns->name + "::" + name;
@@ -1604,13 +1421,10 @@ int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScri
#ifndef AS_NO_COMPILER
// Check against interface types
asUINT n;
- for (n = 0; n < interfaceDeclarations.GetLength(); n++)
- {
+ for (n = 0; n < interfaceDeclarations.GetLength(); n++) {
if (interfaceDeclarations[n]->name == name &&
- interfaceDeclarations[n]->typeInfo->nameSpace == ns)
- {
- if (code)
- {
+ interfaceDeclarations[n]->typeInfo->nameSpace == ns) {
+ if (code) {
asCString str;
if (ns->name != "")
str = ns->name + "::" + name;
@@ -1625,13 +1439,10 @@ int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScri
}
// Check against class types
- for( n = 0; n < classDeclarations.GetLength(); n++ )
- {
- if( classDeclarations[n]->name == name &&
- classDeclarations[n]->typeInfo->nameSpace == ns )
- {
- if( code )
- {
+ for (n = 0; n < classDeclarations.GetLength(); n++) {
+ if (classDeclarations[n]->name == name &&
+ classDeclarations[n]->typeInfo->nameSpace == ns) {
+ if (code) {
asCString str;
if (ns->name != "")
str = ns->name + "::" + name;
@@ -1646,13 +1457,10 @@ int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScri
}
// Check against named types
- for( n = 0; n < namedTypeDeclarations.GetLength(); n++ )
- {
- if( namedTypeDeclarations[n]->name == name &&
- namedTypeDeclarations[n]->typeInfo->nameSpace == ns )
- {
- if( code )
- {
+ for (n = 0; n < namedTypeDeclarations.GetLength(); n++) {
+ if (namedTypeDeclarations[n]->name == name &&
+ namedTypeDeclarations[n]->typeInfo->nameSpace == ns) {
+ if (code) {
asCString str;
if (ns->name != "")
str = ns->name + "::" + name;
@@ -1667,13 +1475,10 @@ int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScri
}
// Must check for name conflicts with funcdefs
- for( n = 0; n < funcDefs.GetLength(); n++ )
- {
- if( funcDefs[n]->name == name &&
- module->m_funcDefs[funcDefs[n]->idx]->nameSpace == ns )
- {
- if( code )
- {
+ for (n = 0; n < funcDefs.GetLength(); n++) {
+ if (funcDefs[n]->name == name &&
+ module->m_funcDefs[funcDefs[n]->idx]->nameSpace == ns) {
+ if (code) {
asCString str;
if (ns->name != "")
str = ns->name + "::" + name;
@@ -1688,10 +1493,8 @@ int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScri
}
// Check against mixin classes
- if( GetMixinClass(name, ns) )
- {
- if( code )
- {
+ if (GetMixinClass(name, ns)) {
+ if (code) {
asCString str;
if (ns->name != "")
str = ns->name + "::" + name;
@@ -1706,19 +1509,15 @@ int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScri
// Check against virtual properties
// Don't do this when the check is for a virtual property, as it is allowed to have multiple overloads for virtual properties
- if( !isProperty && !isVirtualProperty )
- {
- for (n = 0; n < functions.GetLength(); n++)
- {
+ if (!isProperty && !isVirtualProperty) {
+ for (n = 0; n < functions.GetLength(); n++) {
asCScriptFunction *func = engine->scriptFunctions[functions[n] ? functions[n]->funcId : 0];
- if (func &&
- func->IsProperty() &&
- func->objectType == 0 &&
- func->nameSpace == ns &&
- func->name.SubString(4) == name)
- {
- if (code)
- {
+ if (func &&
+ func->IsProperty() &&
+ func->objectType == 0 &&
+ func->nameSpace == ns &&
+ func->name.SubString(4) == name) {
+ if (code) {
asCString str;
if (ns->name != "")
str = ns->name + "::" + name;
@@ -1732,19 +1531,15 @@ int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScri
}
}
}
-
+
// Property names must be checked against function names
- if (isProperty)
- {
- for (n = 0; n < functions.GetLength(); n++)
- {
- if (functions[n] &&
- functions[n]->objType == 0 &&
- functions[n]->name == name &&
- engine->scriptFunctions[functions[n]->funcId]->nameSpace == ns )
- {
- if (code)
- {
+ if (isProperty) {
+ for (n = 0; n < functions.GetLength(); n++) {
+ if (functions[n] &&
+ functions[n]->objType == 0 &&
+ functions[n]->name == name &&
+ engine->scriptFunctions[functions[n]->funcId]->nameSpace == ns) {
+ if (code) {
asCString str;
if (ns->name != "")
str = ns->name + "::" + name;
@@ -1768,110 +1563,100 @@ int asCBuilder::CheckNameConflict(const char *name, asCScriptNode *node, asCScri
// -3 invalid signature
// -4 mismatching type for get/set
// -5 name conflict
-int asCBuilder::ValidateVirtualProperty(asCScriptFunction *func)
-{
- asASSERT( func->IsProperty() );
-
+int asCBuilder::ValidateVirtualProperty(asCScriptFunction *func) {
+ asASSERT(func->IsProperty());
+
// A virtual property must have the prefix "get_" or "set_"
asCString prefix = func->name.SubString(0, 4);
- if( prefix != "get_" && prefix != "set_" )
+ if (prefix != "get_" && prefix != "set_")
return -2;
-
+
// A getter must return a non-void type and have at most 1 argument (indexed property)
- if( prefix == "get_" && (func->returnType == asCDataType::CreatePrimitive(ttVoid, false) || func->parameterTypes.GetLength() > 1) )
+ if (prefix == "get_" && (func->returnType == asCDataType::CreatePrimitive(ttVoid, false) || func->parameterTypes.GetLength() > 1))
return -3;
-
+
// A setter must return a void and have 1 or 2 arguments (indexed property)
- if( prefix == "set_" && (func->returnType != asCDataType::CreatePrimitive(ttVoid, false) || func->parameterTypes.GetLength() < 1 || func->parameterTypes.GetLength() > 2) )
+ if (prefix == "set_" && (func->returnType != asCDataType::CreatePrimitive(ttVoid, false) || func->parameterTypes.GetLength() < 1 || func->parameterTypes.GetLength() > 2))
return -3;
-
+
// Check matching getter/setter
asCDataType getType, setType;
bool found = false;
- if( prefix == "get_" )
- {
+ if (prefix == "get_") {
getType = func->returnType;
-
+
// Find if there is a set accessor in the same scope, and then validate the type of it
// TODO: optimize search
asCString setName = "set_" + func->name.SubString(4);
- for( asUINT n = 0; n < engine->scriptFunctions.GetLength(); n++ )
- {
+ for (asUINT n = 0; n < engine->scriptFunctions.GetLength(); n++) {
asCScriptFunction *setFunc = engine->scriptFunctions[n];
- if( setFunc == 0 || setFunc->name != setName || !setFunc->IsProperty() )
+ if (setFunc == 0 || setFunc->name != setName || !setFunc->IsProperty())
continue;
-
+
// Is it the same scope?
- if( func->module != setFunc->module || func->nameSpace != setFunc->nameSpace || func->objectType != setFunc->objectType )
+ if (func->module != setFunc->module || func->nameSpace != setFunc->nameSpace || func->objectType != setFunc->objectType)
continue;
-
+
setType = setFunc->parameterTypes[setFunc->parameterTypes.GetLength() - 1];
found = true;
break;
}
- }
- else
- {
+ } else {
setType = func->parameterTypes[func->parameterTypes.GetLength() - 1];
-
+
// Find if there is a get accessor in the same scope and then validate the type of it
// TODO: optimize search
asCString getName = "get_" + func->name.SubString(4);
- for( asUINT n = 0; n < engine->scriptFunctions.GetLength(); n++ )
- {
+ for (asUINT n = 0; n < engine->scriptFunctions.GetLength(); n++) {
asCScriptFunction *getFunc = engine->scriptFunctions[n];
- if( getFunc == 0 || getFunc->name != getName || !getFunc->IsProperty() )
+ if (getFunc == 0 || getFunc->name != getName || !getFunc->IsProperty())
continue;
-
+
// Is it the same scope?
- if( func->module != getFunc->module || func->nameSpace != getFunc->nameSpace || func->objectType != getFunc->objectType )
+ if (func->module != getFunc->module || func->nameSpace != getFunc->nameSpace || func->objectType != getFunc->objectType)
continue;
-
+
getType = getFunc->returnType;
found = true;
break;
}
}
-
- if( found )
- {
+
+ if (found) {
// Check that the type matches
// It is permitted for a getter to return a handle and the setter to take a reference
- if( !getType.IsEqualExceptRefAndConst(setType) &&
- !((getType.IsObjectHandle() && !setType.IsObjectHandle()) &&
- (getType.GetTypeInfo() == setType.GetTypeInfo())) )
- {
+ if (!getType.IsEqualExceptRefAndConst(setType) &&
+ !((getType.IsObjectHandle() && !setType.IsObjectHandle()) &&
+ (getType.GetTypeInfo() == setType.GetTypeInfo()))) {
return -4;
}
}
-
+
// Check name conflict with other entities in the same scope
// It is allowed to have a real property of the same name, in which case the virtual property hides the real one.
int r;
- if( func->objectType )
+ if (func->objectType)
r = CheckNameConflictMember(func->objectType, func->name.SubString(4).AddressOf(), 0, 0, true, true);
else
r = CheckNameConflict(func->name.SubString(4).AddressOf(), 0, 0, func->nameSpace, true, true);
- if( r < 0 )
+ if (r < 0)
return -5;
-
+
// Everything is OK
return 0;
}
#ifndef AS_NO_COMPILER
-sMixinClass *asCBuilder::GetMixinClass(const char *name, asSNameSpace *ns)
-{
- for( asUINT n = 0; n < mixinClasses.GetLength(); n++ )
- if( mixinClasses[n]->name == name &&
- mixinClasses[n]->ns == ns )
+sMixinClass *asCBuilder::GetMixinClass(const char *name, asSNameSpace *ns) {
+ for (asUINT n = 0; n < mixinClasses.GetLength(); n++)
+ if (mixinClasses[n]->name == name &&
+ mixinClasses[n]->ns == ns)
return mixinClasses[n];
return 0;
}
-int asCBuilder::RegisterFuncDef(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns, asCObjectType *parent)
-{
+int asCBuilder::RegisterFuncDef(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns, asCObjectType *parent) {
// namespace and parent are exclusively mutual
asASSERT((ns == 0 && parent) || (ns && parent == 0));
@@ -1881,27 +1666,22 @@ int asCBuilder::RegisterFuncDef(asCScriptNode *node, asCScriptCode *file, asSNam
n = n->next;
// Find the name
- asASSERT( n->nodeType == snDataType );
+ asASSERT(n->nodeType == snDataType);
n = n->next->next;
asCString name;
name.Assign(&file->code[n->tokenPos], n->tokenLength);
// Check for name conflict with other types
- if (ns)
- {
+ if (ns) {
int r = CheckNameConflict(name.AddressOf(), node, file, ns, true, false);
- if (asSUCCESS != r)
- {
+ if (asSUCCESS != r) {
node->Destroy(engine);
return r;
}
- }
- else
- {
+ } else {
int r = CheckNameConflictMember(parent, name.AddressOf(), node, file, false, false);
- if (asSUCCESS != r)
- {
+ if (asSUCCESS != r) {
node->Destroy(engine);
return r;
}
@@ -1915,8 +1695,7 @@ int asCBuilder::RegisterFuncDef(asCScriptNode *node, asCScriptCode *file, asSNam
// in CompleteFuncDef().
sFuncDef *fd = asNEW(sFuncDef);
- if( fd == 0 )
- {
+ if (fd == 0) {
node->Destroy(engine);
return asOUT_OF_MEMORY;
}
@@ -1931,41 +1710,36 @@ int asCBuilder::RegisterFuncDef(asCScriptNode *node, asCScriptCode *file, asSNam
return 0;
}
-void asCBuilder::CompleteFuncDef(sFuncDef *funcDef)
-{
+void asCBuilder::CompleteFuncDef(sFuncDef *funcDef) {
asCArray<asCString *> defaultArgs;
asSFunctionTraits funcTraits;
asCFuncdefType *fdt = module->m_funcDefs[funcDef->idx];
- asASSERT( fdt );
+ asASSERT(fdt);
asCScriptFunction *func = fdt->funcdef;
asSNameSpace *implicitNs = func->nameSpace ? func->nameSpace : fdt->parentClass->nameSpace;
GetParsedFunctionDetails(funcDef->node, funcDef->script, fdt->parentClass, funcDef->name, func->returnType, func->parameterNames, func->parameterTypes, func->inOutFlags, defaultArgs, funcTraits, implicitNs);
// There should not be any defaultArgs, but if there are any we need to delete them to avoid leaks
- for( asUINT n = 0; n < defaultArgs.GetLength(); n++ )
- if( defaultArgs[n] )
+ for (asUINT n = 0; n < defaultArgs.GetLength(); n++)
+ if (defaultArgs[n])
asDELETE(defaultArgs[n], asCString);
// All funcdefs are shared, unless one of the parameter types or return type is not shared
bool declaredShared = funcTraits.GetTrait(asTRAIT_SHARED);
funcTraits.SetTrait(asTRAIT_SHARED, true);
- if (func->returnType.GetTypeInfo() && !func->returnType.GetTypeInfo()->IsShared())
- {
- if (declaredShared)
- {
+ if (func->returnType.GetTypeInfo() && !func->returnType.GetTypeInfo()->IsShared()) {
+ if (declaredShared) {
asCString s;
s.Format(TXT_SHARED_CANNOT_USE_NON_SHARED_TYPE_s, func->returnType.GetTypeInfo()->name.AddressOf());
WriteError(s.AddressOf(), funcDef->script, funcDef->node);
}
funcTraits.SetTrait(asTRAIT_SHARED, false);
}
- for( asUINT n = 0; funcTraits.GetTrait(asTRAIT_SHARED) && n < func->parameterTypes.GetLength(); n++ )
- if (func->parameterTypes[n].GetTypeInfo() && !func->parameterTypes[n].GetTypeInfo()->IsShared())
- {
- if (declaredShared)
- {
+ for (asUINT n = 0; funcTraits.GetTrait(asTRAIT_SHARED) && n < func->parameterTypes.GetLength(); n++)
+ if (func->parameterTypes[n].GetTypeInfo() && !func->parameterTypes[n].GetTypeInfo()->IsShared()) {
+ if (declaredShared) {
asCString s;
s.Format(TXT_SHARED_CANNOT_USE_NON_SHARED_TYPE_s, func->parameterTypes[n].GetTypeInfo()->name.AddressOf());
WriteError(s.AddressOf(), funcDef->script, funcDef->node);
@@ -1976,21 +1750,18 @@ void asCBuilder::CompleteFuncDef(sFuncDef *funcDef)
// Check if there is another identical funcdef from another module and if so reuse that instead
bool found = false;
- if( func->IsShared() )
- {
- for( asUINT n = 0; n < engine->funcDefs.GetLength(); n++ )
- {
+ if (func->IsShared()) {
+ for (asUINT n = 0; n < engine->funcDefs.GetLength(); n++) {
asCFuncdefType *fdt2 = engine->funcDefs[n];
- if( fdt2 == 0 || fdt == fdt2 )
+ if (fdt2 == 0 || fdt == fdt2)
continue;
- if( !fdt2->funcdef->IsShared() )
+ if (!fdt2->funcdef->IsShared())
continue;
- if( fdt2->name == fdt->name &&
- fdt2->nameSpace == fdt->nameSpace &&
- fdt2->funcdef->IsSignatureExceptNameEqual(func) )
- {
+ if (fdt2->name == fdt->name &&
+ fdt2->nameSpace == fdt->nameSpace &&
+ fdt2->funcdef->IsSignatureExceptNameEqual(func)) {
// Replace our funcdef for the existing one
funcDef->idx = fdt2->funcdef->id;
module->ReplaceFuncDef(fdt, fdt2);
@@ -2006,8 +1777,7 @@ void asCBuilder::CompleteFuncDef(sFuncDef *funcDef)
}
// If the funcdef was declared as external then the existing shared declaration must have been found
- if (funcTraits.GetTrait(asTRAIT_EXTERNAL) && !found)
- {
+ if (funcTraits.GetTrait(asTRAIT_EXTERNAL) && !found) {
asCString str;
str.Format(TXT_EXTERNAL_SHARED_s_NOT_FOUND, funcDef->name.AddressOf());
WriteError(str, funcDef->script, funcDef->node);
@@ -2018,21 +1788,19 @@ void asCBuilder::CompleteFuncDef(sFuncDef *funcDef)
module->m_externalTypes.PushLast(engine->scriptFunctions[funcDef->idx]->funcdefType);
}
-int asCBuilder::RegisterGlobalVar(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns)
-{
+int asCBuilder::RegisterGlobalVar(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns) {
// Has the application disabled global vars?
- if( engine->ep.disallowGlobalVars )
+ if (engine->ep.disallowGlobalVars)
WriteError(TXT_GLOBAL_VARS_NOT_ALLOWED, file, node);
// What data type is it?
asCDataType type = CreateDataTypeFromNode(node->firstChild, file, ns);
- if( !type.CanBeInstantiated() )
- {
+ if (!type.CanBeInstantiated()) {
asCString str;
- if( type.IsAbstractClass() )
+ if (type.IsAbstractClass())
str.Format(TXT_ABSTRACT_CLASS_s_CANNOT_BE_INSTANTIATED, type.Format(ns).AddressOf());
- else if( type.IsInterface() )
+ else if (type.IsInterface())
str.Format(TXT_INTERFACE_s_CANNOT_BE_INSTANTIATED, type.Format(ns).AddressOf());
else
// TODO: Improve error message to explain why
@@ -2043,16 +1811,14 @@ int asCBuilder::RegisterGlobalVar(asCScriptNode *node, asCScriptCode *file, asSN
asCScriptNode *n = node->firstChild->next;
- while( n )
- {
+ while (n) {
// Verify that the name isn't taken
asCString name(&file->code[n->tokenPos], n->tokenLength);
CheckNameConflict(name.AddressOf(), n, file, ns, true, false);
// Register the global variable
sGlobalVariableDescription *gvar = asNEW(sGlobalVariableDescription);
- if( gvar == 0 )
- {
+ if (gvar == 0) {
node->Destroy(engine);
return asOUT_OF_MEMORY;
}
@@ -2078,11 +1844,10 @@ int asCBuilder::RegisterGlobalVar(asCScriptNode *node, asCScriptCode *file, asSN
n = n->next;
gvar->declaredAtNode->DisconnectParent();
gvar->initializationNode = 0;
- if( n &&
- ( n->nodeType == snAssignment ||
- n->nodeType == snArgList ||
- n->nodeType == snInitList ) )
- {
+ if (n &&
+ (n->nodeType == snAssignment ||
+ n->nodeType == snArgList ||
+ n->nodeType == snInitList)) {
gvar->initializationNode = n;
n = n->next;
gvar->initializationNode->DisconnectParent();
@@ -2094,20 +1859,18 @@ int asCBuilder::RegisterGlobalVar(asCScriptNode *node, asCScriptCode *file, asSN
return 0;
}
-int asCBuilder::RegisterMixinClass(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns)
-{
+int asCBuilder::RegisterMixinClass(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns) {
asCScriptNode *cl = node->firstChild;
- asASSERT( cl->nodeType == snClass );
+ asASSERT(cl->nodeType == snClass);
asCScriptNode *n = cl->firstChild;
// Skip potential decorator tokens
- while( n->tokenType == ttIdentifier &&
- (file->TokenEquals(n->tokenPos, n->tokenLength, FINAL_TOKEN) ||
- file->TokenEquals(n->tokenPos, n->tokenLength, SHARED_TOKEN) ||
- file->TokenEquals(n->tokenPos, n->tokenLength, ABSTRACT_TOKEN) ||
- file->TokenEquals(n->tokenPos, n->tokenLength, EXTERNAL_TOKEN)) )
- {
+ while (n->tokenType == ttIdentifier &&
+ (file->TokenEquals(n->tokenPos, n->tokenLength, FINAL_TOKEN) ||
+ file->TokenEquals(n->tokenPos, n->tokenLength, SHARED_TOKEN) ||
+ file->TokenEquals(n->tokenPos, n->tokenLength, ABSTRACT_TOKEN) ||
+ file->TokenEquals(n->tokenPos, n->tokenLength, EXTERNAL_TOKEN))) {
// Report error, because mixin class cannot be final or shared
asCString msg;
msg.Format(TXT_MIXIN_CANNOT_BE_DECLARED_AS_s, asCString(&file->code[n->tokenPos], n->tokenLength).AddressOf());
@@ -2129,8 +1892,7 @@ int asCBuilder::RegisterMixinClass(asCScriptNode *node, asCScriptCode *file, asS
CheckNameConflict(name.AddressOf(), n, file, ns, true, false);
sMixinClass *decl = asNEW(sMixinClass);
- if( decl == 0 )
- {
+ if (decl == 0) {
node->Destroy(engine);
return asOUT_OF_MEMORY;
}
@@ -2148,10 +1910,8 @@ int asCBuilder::RegisterMixinClass(asCScriptNode *node, asCScriptCode *file, asS
// Check that the mixin class doesn't contain any child types
// TODO: Add support for child types in mixin classes
n = cl->firstChild;
- while (n)
- {
- if (n->nodeType == snFuncDef)
- {
+ while (n) {
+ if (n->nodeType == snFuncDef) {
WriteError(TXT_MIXIN_CANNOT_HAVE_CHILD_TYPES, file, n);
break;
}
@@ -2161,8 +1921,7 @@ int asCBuilder::RegisterMixinClass(asCScriptNode *node, asCScriptCode *file, asS
return 0;
}
-int asCBuilder::RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns)
-{
+int asCBuilder::RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns) {
asCScriptNode *n = node->firstChild;
bool isFinal = false;
bool isShared = false;
@@ -2170,60 +1929,44 @@ int asCBuilder::RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameS
bool isExternal = false;
// Check the class modifiers
- while( n->tokenType == ttIdentifier )
- {
- if( file->TokenEquals(n->tokenPos, n->tokenLength, FINAL_TOKEN) )
- {
- if( isAbstract )
+ while (n->tokenType == ttIdentifier) {
+ if (file->TokenEquals(n->tokenPos, n->tokenLength, FINAL_TOKEN)) {
+ if (isAbstract)
WriteError(TXT_CLASS_CANT_BE_FINAL_AND_ABSTRACT, file, n);
- else
- {
- if( isFinal )
- {
+ else {
+ if (isFinal) {
asCString msg;
msg.Format(TXT_ATTR_s_INFORMED_MULTIPLE_TIMES, asCString(&file->code[n->tokenPos], n->tokenLength).AddressOf());
WriteWarning(msg, file, n);
}
isFinal = true;
}
- }
- else if( file->TokenEquals(n->tokenPos, n->tokenLength, SHARED_TOKEN) )
- {
- if( isShared )
- {
+ } else if (file->TokenEquals(n->tokenPos, n->tokenLength, SHARED_TOKEN)) {
+ if (isShared) {
asCString msg;
msg.Format(TXT_ATTR_s_INFORMED_MULTIPLE_TIMES, asCString(&file->code[n->tokenPos], n->tokenLength).AddressOf());
WriteWarning(msg, file, n);
}
isShared = true;
- }
- else if (file->TokenEquals(n->tokenPos, n->tokenLength, EXTERNAL_TOKEN))
- {
- if (isExternal)
- {
+ } else if (file->TokenEquals(n->tokenPos, n->tokenLength, EXTERNAL_TOKEN)) {
+ if (isExternal) {
asCString msg;
msg.Format(TXT_ATTR_s_INFORMED_MULTIPLE_TIMES, asCString(&file->code[n->tokenPos], n->tokenLength).AddressOf());
WriteWarning(msg, file, n);
}
isExternal = true;
- }
- else if( file->TokenEquals(n->tokenPos, n->tokenLength, ABSTRACT_TOKEN) )
- {
- if( isFinal )
+ } else if (file->TokenEquals(n->tokenPos, n->tokenLength, ABSTRACT_TOKEN)) {
+ if (isFinal)
WriteError(TXT_CLASS_CANT_BE_FINAL_AND_ABSTRACT, file, n);
- else
- {
- if( isAbstract )
- {
+ else {
+ if (isAbstract) {
asCString msg;
msg.Format(TXT_ATTR_s_INFORMED_MULTIPLE_TIMES, asCString(&file->code[n->tokenPos], n->tokenLength).AddressOf());
WriteWarning(msg, file, n);
}
isAbstract = true;
}
- }
- else
- {
+ } else {
// This is the name of the class
break;
}
@@ -2239,8 +1982,7 @@ int asCBuilder::RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameS
CheckNameConflict(name.AddressOf(), n, file, ns, true, false);
sClassDeclaration *decl = asNEW(sClassDeclaration);
- if( decl == 0 )
- {
+ if (decl == 0) {
node->Destroy(engine);
return asOUT_OF_MEMORY;
}
@@ -2251,14 +1993,11 @@ int asCBuilder::RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameS
decl->node = node;
// External shared interfaces must not try to redefine the interface
- if (isExternal && (n->next == 0 || n->next->tokenType != ttEndStatement))
- {
+ if (isExternal && (n->next == 0 || n->next->tokenType != ttEndStatement)) {
asCString str;
str.Format(TXT_EXTERNAL_SHARED_s_CANNOT_REDEF, name.AddressOf());
WriteError(str, file, n);
- }
- else if (!isExternal && n->next && n->next->tokenType == ttEndStatement)
- {
+ } else if (!isExternal && n->next && n->next->tokenType == ttEndStatement) {
asCString str;
str.Format(TXT_MISSING_DEFINITION_OF_s, name.AddressOf());
WriteError(str, file, n);
@@ -2268,17 +2007,14 @@ int asCBuilder::RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameS
// type of the same name, then that one should be used instead of
// creating a new one.
asCObjectType *st = 0;
- if( isShared )
- {
- for( asUINT i = 0; i < engine->sharedScriptTypes.GetLength(); i++ )
- {
+ if (isShared) {
+ for (asUINT i = 0; i < engine->sharedScriptTypes.GetLength(); i++) {
st = CastToObjectType(engine->sharedScriptTypes[i]);
- if( st &&
- st->IsShared() &&
- st->name == name &&
- st->nameSpace == ns &&
- !st->IsInterface() )
- {
+ if (st &&
+ st->IsShared() &&
+ st->name == name &&
+ st->nameSpace == ns &&
+ !st->IsInterface()) {
// We'll use the existing type
decl->isExistingShared = true;
decl->typeInfo = st;
@@ -2290,8 +2026,7 @@ int asCBuilder::RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameS
}
// If the class was declared as external then it must have been compiled in a different module first
- if (isExternal && decl->typeInfo == 0)
- {
+ if (isExternal && decl->typeInfo == 0) {
asCString str;
str.Format(TXT_EXTERNAL_SHARED_s_NOT_FOUND, name.AddressOf());
WriteError(str, file, n);
@@ -2301,8 +2036,7 @@ int asCBuilder::RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameS
if (isExternal)
module->m_externalTypes.PushLast(st);
- if (!decl->isExistingShared)
- {
+ if (!decl->isExistingShared) {
// Create a new object type for this class
st = asNEW(asCObjectType)(engine);
if (st == 0)
@@ -2334,8 +2068,7 @@ int asCBuilder::RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameS
st->nameSpace = ns;
st->module = module;
module->AddClassType(st);
- if (isShared)
- {
+ if (isShared) {
engine->sharedScriptTypes.PushLast(st);
st->AddRefInternal();
}
@@ -2364,16 +2097,13 @@ int asCBuilder::RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameS
}
// Register possible child types
- while (n)
- {
+ while (n) {
node = n->next;
- if (n->nodeType == snFuncDef)
- {
+ if (n->nodeType == snFuncDef) {
n->DisconnectParent();
if (!decl->isExistingShared)
RegisterFuncDef(n, file, 0, st);
- else
- {
+ else {
// Destroy the node, since it won't be used
// TODO: Should verify that the funcdef is identical to the one in the existing shared class
n->Destroy(engine);
@@ -2385,14 +2115,12 @@ int asCBuilder::RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameS
return 0;
}
-int asCBuilder::RegisterInterface(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns)
-{
+int asCBuilder::RegisterInterface(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns) {
asCScriptNode *n = node->firstChild;
bool isShared = false;
bool isExternal = false;
- while( n->nodeType == snIdentifier )
- {
+ while (n->nodeType == snIdentifier) {
if (file->TokenEquals(n->tokenPos, n->tokenLength, SHARED_TOKEN))
isShared = true;
else if (file->TokenEquals(n->tokenPos, n->tokenLength, EXTERNAL_TOKEN))
@@ -2410,8 +2138,7 @@ int asCBuilder::RegisterInterface(asCScriptNode *node, asCScriptCode *file, asSN
CheckNameConflict(name.AddressOf(), n, file, ns, true, false);
sClassDeclaration *decl = asNEW(sClassDeclaration);
- if( decl == 0 )
- {
+ if (decl == 0) {
node->Destroy(engine);
return asOUT_OF_MEMORY;
}
@@ -2422,14 +2149,11 @@ int asCBuilder::RegisterInterface(asCScriptNode *node, asCScriptCode *file, asSN
decl->node = node;
// External shared interfaces must not try to redefine the interface
- if (isExternal && (n->next == 0 || n->next->tokenType != ttEndStatement) )
- {
+ if (isExternal && (n->next == 0 || n->next->tokenType != ttEndStatement)) {
asCString str;
str.Format(TXT_EXTERNAL_SHARED_s_CANNOT_REDEF, name.AddressOf());
WriteError(str, file, n);
- }
- else if (!isExternal && n->next && n->next->tokenType == ttEndStatement)
- {
+ } else if (!isExternal && n->next && n->next->tokenType == ttEndStatement) {
asCString str;
str.Format(TXT_MISSING_DEFINITION_OF_s, name.AddressOf());
WriteError(str, file, n);
@@ -2438,17 +2162,14 @@ int asCBuilder::RegisterInterface(asCScriptNode *node, asCScriptCode *file, asSN
// If this type is shared and there already exist another shared
// type of the same name, then that one should be used instead of
// creating a new one.
- if( isShared )
- {
- for( asUINT i = 0; i < engine->sharedScriptTypes.GetLength(); i++ )
- {
+ if (isShared) {
+ for (asUINT i = 0; i < engine->sharedScriptTypes.GetLength(); i++) {
asCObjectType *st = CastToObjectType(engine->sharedScriptTypes[i]);
- if( st &&
- st->IsShared() &&
- st->name == name &&
- st->nameSpace == ns &&
- st->IsInterface() )
- {
+ if (st &&
+ st->IsShared() &&
+ st->name == name &&
+ st->nameSpace == ns &&
+ st->IsInterface()) {
// We'll use the existing type
decl->isExistingShared = true;
decl->typeInfo = st;
@@ -2465,8 +2186,7 @@ int asCBuilder::RegisterInterface(asCScriptNode *node, asCScriptCode *file, asSN
}
// If the interface was declared as external then it must have been compiled in a different module first
- if (isExternal)
- {
+ if (isExternal) {
asCString str;
str.Format(TXT_EXTERNAL_SHARED_s_NOT_FOUND, name.AddressOf());
WriteError(str, file, n);
@@ -2474,12 +2194,12 @@ int asCBuilder::RegisterInterface(asCScriptNode *node, asCScriptCode *file, asSN
// Register the object type for the interface
asCObjectType *st = asNEW(asCObjectType)(engine);
- if( st == 0 )
+ if (st == 0)
return asOUT_OF_MEMORY;
st->flags = asOBJ_REF | asOBJ_SCRIPT_OBJECT;
- if( isShared )
+ if (isShared)
st->flags |= asOBJ_SHARED;
st->size = 0; // Cannot be instantiated
@@ -2487,8 +2207,7 @@ int asCBuilder::RegisterInterface(asCScriptNode *node, asCScriptCode *file, asSN
st->nameSpace = ns;
st->module = module;
module->AddClassType(st);
- if( isShared )
- {
+ if (isShared) {
engine->sharedScriptTypes.PushLast(st);
st->AddRefInternal();
}
@@ -2505,8 +2224,7 @@ int asCBuilder::RegisterInterface(asCScriptNode *node, asCScriptCode *file, asSN
return 0;
}
-void asCBuilder::CompileGlobalVariables()
-{
+void asCBuilder::CompileGlobalVariables() {
bool compileSucceeded = true;
// Store state of compilation (errors, warning, output)
@@ -2536,8 +2254,7 @@ void asCBuilder::CompileGlobalVariables()
bool compilingPrimitives = true;
// Compile each global variable
- while( compileSucceeded )
- {
+ while (compileSucceeded) {
compileSucceeded = false;
int accumErrors = 0;
@@ -2546,10 +2263,9 @@ void asCBuilder::CompileGlobalVariables()
// Restore state of compilation
finalOutput.Clear();
asCSymbolTable<sGlobalVariableDescription>::iterator it = globVariables.List();
- for( ; it; it++ )
- {
+ for (; it; it++) {
sGlobalVariableDescription *gvar = *it;
- if( gvar->isCompiled )
+ if (gvar->isCompiled)
continue;
asCByteCode init(engine);
@@ -2558,11 +2274,10 @@ void asCBuilder::CompileGlobalVariables()
outBuffer.Clear();
// Skip this for now if we're not compiling complex types yet
- if( compilingPrimitives && !gvar->datatype.IsPrimitive() )
+ if (compilingPrimitives && !gvar->datatype.IsPrimitive())
continue;
- if( gvar->declaredAtNode )
- {
+ if (gvar->declaredAtNode) {
int r, c;
gvar->script->ConvertPosToRowCol(gvar->declaredAtNode->tokenPos, &r, &c);
asCString str = gvar->datatype.Format(gvar->ns);
@@ -2571,11 +2286,9 @@ void asCBuilder::CompileGlobalVariables()
WriteInfo(gvar->script->name, str, r, c, true);
}
- if( gvar->isEnumValue )
- {
+ if (gvar->isEnumValue) {
int r;
- if( gvar->initializationNode )
- {
+ if (gvar->initializationNode) {
asCCompiler comp(engine);
asCScriptFunction func(engine, module, asFUNC_SCRIPT);
@@ -2591,24 +2304,19 @@ void asCBuilder::CompileGlobalVariables()
// Make the function a dummy so it doesn't try to release objects while destroying the function
func.funcType = asFUNC_DUMMY;
- }
- else
- {
+ } else {
r = 0;
// When there is no assignment the value is the last + 1
int enumVal = 0;
asCSymbolTable<sGlobalVariableDescription>::iterator prev_it = it;
prev_it--;
- if( prev_it )
- {
+ if (prev_it) {
sGlobalVariableDescription *gvar2 = *prev_it;
- if(gvar2->datatype == gvar->datatype )
- {
+ if (gvar2->datatype == gvar->datatype) {
enumVal = int(gvar2->constantValue) + 1;
- if( !gvar2->isCompiled )
- {
+ if (!gvar2->isCompiled) {
int row, col;
gvar->script->ConvertPosToRowCol(gvar->declaredAtNode->tokenPos, &row, &col);
@@ -2627,19 +2335,15 @@ void asCBuilder::CompileGlobalVariables()
gvar->constantValue = enumVal;
}
- if( r >= 0 )
- {
+ if (r >= 0) {
// Set the value as compiled
gvar->isCompiled = true;
compileSucceeded = true;
}
- }
- else
- {
+ } else {
// Compile the global variable
initFunc = asNEW(asCScriptFunction)(engine, module, asFUNC_SCRIPT);
- if( initFunc == 0 )
- {
+ if (initFunc == 0) {
// Out of memory
return;
}
@@ -2649,14 +2353,11 @@ void asCBuilder::CompileGlobalVariables()
asCCompiler comp(engine);
int r = comp.CompileGlobalVariable(this, gvar->script, gvar->initializationNode, gvar, initFunc);
- if( r >= 0 )
- {
+ if (r >= 0) {
// Compilation succeeded
gvar->isCompiled = true;
compileSucceeded = true;
- }
- else
- {
+ } else {
// Compilation failed
initFunc->funcType = asFUNC_DUMMY;
asDELETE(initFunc, asCScriptFunction);
@@ -2664,23 +2365,20 @@ void asCBuilder::CompileGlobalVariables()
}
}
- if( gvar->isCompiled )
- {
+ if (gvar->isCompiled) {
// Add warnings for this constant to the total build
- if( numWarnings )
- {
+ if (numWarnings) {
currNumWarnings += numWarnings;
- if( msgCallback )
+ if (msgCallback)
outBuffer.SendToCallback(engine, &msgCallbackFunc, msgCallbackObj);
}
// Determine order of variable initializations
- if( gvar->property && !gvar->isEnumValue )
+ if (gvar->property && !gvar->isEnumValue)
initOrder.Put(gvar->property);
// Does the function contain more than just a SUSPEND followed by a RET instruction?
- if( initFunc && initFunc->scriptData->byteCode.GetLength() > 2 )
- {
+ if (initFunc && initFunc->scriptData->byteCode.GetLength() > 2) {
// Create the init function for this variable
initFunc->id = engine->GetNextScriptFunctionId();
engine->AddScriptFunction(initFunc);
@@ -2688,20 +2386,17 @@ void asCBuilder::CompileGlobalVariables()
// Finalize the init function for this variable
initFunc->returnType = asCDataType::CreatePrimitive(ttVoid, false);
initFunc->scriptData->scriptSectionIdx = engine->GetScriptSectionNameIndex(gvar->script->name.AddressOf());
- if( gvar->declaredAtNode )
- {
+ if (gvar->declaredAtNode) {
int row, col;
gvar->script->ConvertPosToRowCol(gvar->declaredAtNode->tokenPos, &row, &col);
- initFunc->scriptData->declaredAt = (row & 0xFFFFF)|((col & 0xFFF)<<20);
+ initFunc->scriptData->declaredAt = (row & 0xFFFFF) | ((col & 0xFFF) << 20);
}
gvar->property->SetInitFunc(initFunc);
initFunc->ReleaseInternal();
initFunc = 0;
- }
- else if( initFunc )
- {
+ } else if (initFunc) {
// Destroy the function as it won't be used
initFunc->funcType = asFUNC_DUMMY;
asDELETE(initFunc, asCScriptFunction);
@@ -2709,14 +2404,12 @@ void asCBuilder::CompileGlobalVariables()
}
// Convert enums to true enum values, so subsequent compilations can access it as an enum
- if( gvar->isEnumValue )
- {
+ if (gvar->isEnumValue) {
asCEnumType *enumType = CastToEnumType(gvar->datatype.GetTypeInfo());
asASSERT(NULL != enumType);
asSEnumValue *e = asNEW(asSEnumValue);
- if( e == 0 )
- {
+ if (e == 0) {
// Out of memory
numErrors++;
return;
@@ -2727,9 +2420,7 @@ void asCBuilder::CompileGlobalVariables()
enumType->enumValues.PushLast(e);
}
- }
- else
- {
+ } else {
// Add output to final output
finalOutput.Append(outBuffer);
accumErrors += numErrors;
@@ -2739,22 +2430,18 @@ void asCBuilder::CompileGlobalVariables()
engine->preMessage.isSet = false;
}
- if( !compileSucceeded )
- {
- if( compilingPrimitives )
- {
+ if (!compileSucceeded) {
+ if (compilingPrimitives) {
// No more primitives could be compiled, so
// switch to compiling the complex variables
compilingPrimitives = false;
compileSucceeded = true;
- }
- else
- {
+ } else {
// No more variables can be compiled
// Add errors and warnings to total build
currNumWarnings += accumWarnings;
currNumErrors += accumErrors;
- if( msgCallback )
+ if (msgCallback)
finalOutput.SendToCallback(engine, &msgCallbackFunc, msgCallbackObj);
}
}
@@ -2769,63 +2456,54 @@ void asCBuilder::CompileGlobalVariables()
numErrors = currNumErrors;
// Set the correct order of initialization
- if( numErrors == 0 )
- {
+ if (numErrors == 0) {
// If the length of the arrays are not the same, then this is the compilation
// of a single variable, in which case the initialization order of the previous
// variables must be preserved.
- if( module->m_scriptGlobals.GetSize() == initOrder.GetSize() )
+ if (module->m_scriptGlobals.GetSize() == initOrder.GetSize())
module->m_scriptGlobals.SwapWith(initOrder);
}
CleanupEnumValues();
}
-void asCBuilder::CleanupEnumValues()
-{
+void asCBuilder::CleanupEnumValues() {
// Delete the enum expressions
asCSymbolTableIterator<sGlobalVariableDescription> it = globVariables.List();
- while (it)
- {
+ while (it) {
sGlobalVariableDescription *gvar = *it;
- if (gvar->isEnumValue)
- {
+ if (gvar->isEnumValue) {
// Remove from symboltable. This has to be done prior to freeing the memeory
globVariables.Erase(it.GetIndex());
// Destroy the gvar property
- if (gvar->declaredAtNode)
- {
+ if (gvar->declaredAtNode) {
gvar->declaredAtNode->Destroy(engine);
gvar->declaredAtNode = 0;
}
- if (gvar->initializationNode)
- {
+ if (gvar->initializationNode) {
gvar->initializationNode->Destroy(engine);
gvar->initializationNode = 0;
}
- if (gvar->property)
- {
+ if (gvar->property) {
asDELETE(gvar->property, asCGlobalProperty);
gvar->property = 0;
}
asDELETE(gvar, sGlobalVariableDescription);
- }
- else
+ } else
it++;
}
}
-int asCBuilder::GetNamespaceAndNameFromNode(asCScriptNode *n, asCScriptCode *script, asSNameSpace *implicitNs, asSNameSpace *&outNs, asCString &outName)
-{
+int asCBuilder::GetNamespaceAndNameFromNode(asCScriptNode *n, asCScriptCode *script, asSNameSpace *implicitNs, asSNameSpace *&outNs, asCString &outName) {
// TODO: child funcdef: The node might be a snScope now
- asASSERT( n->nodeType == snIdentifier );
+ asASSERT(n->nodeType == snIdentifier);
// Get the optional scope from the node
// TODO: child funcdef: The parentType will be set if the scope is actually a type rather than a namespace
asSNameSpace *ns = GetNameSpaceFromNode(n->firstChild, script, implicitNs, 0);
- if( ns == 0 )
+ if (ns == 0)
return -1;
// Get the name
@@ -2837,8 +2515,7 @@ int asCBuilder::GetNamespaceAndNameFromNode(asCScriptNode *n, asCScriptCode *scr
return 0;
}
-void asCBuilder::AddInterfaceFromMixinToClass(sClassDeclaration *decl, asCScriptNode *errNode, sMixinClass *mixin)
-{
+void asCBuilder::AddInterfaceFromMixinToClass(sClassDeclaration *decl, asCScriptNode *errNode, sMixinClass *mixin) {
// Determine what interfaces that the mixin implements
asCScriptNode *node = mixin->node;
asASSERT(node->nodeType == snClass);
@@ -2847,34 +2524,28 @@ void asCBuilder::AddInterfaceFromMixinToClass(sClassDeclaration *decl, asCScript
node = node->firstChild->next;
- while( node && node->nodeType == snIdentifier )
- {
+ while (node && node->nodeType == snIdentifier) {
bool ok = true;
asSNameSpace *ns;
asCString name;
- if( GetNamespaceAndNameFromNode(node, mixin->script, mixin->ns, ns, name) < 0 )
+ if (GetNamespaceAndNameFromNode(node, mixin->script, mixin->ns, ns, name) < 0)
ok = false;
- else
- {
+ else {
// Find the object type for the interface
asCObjectType *objType = GetObjectType(name.AddressOf(), ns);
// Check that the object type is an interface
- if( objType && objType->IsInterface() )
- {
+ if (objType && objType->IsInterface()) {
// Only add the interface if the class doesn't already implement it
- if( !decl->typeInfo->Implements(objType) )
+ if (!decl->typeInfo->Implements(objType))
AddInterfaceToClass(decl, errNode, objType);
- }
- else
- {
+ } else {
WriteError(TXT_MIXIN_CLASS_CANNOT_INHERIT, mixin->script, node);
ok = false;
}
}
- if( !ok )
- {
+ if (!ok) {
// Remove this node so the error isn't reported again
asCScriptNode *delNode = node;
node = node->prev;
@@ -2886,33 +2557,27 @@ void asCBuilder::AddInterfaceFromMixinToClass(sClassDeclaration *decl, asCScript
}
}
-void asCBuilder::AddInterfaceToClass(sClassDeclaration *decl, asCScriptNode *errNode, asCObjectType *intfType)
-{
+void asCBuilder::AddInterfaceToClass(sClassDeclaration *decl, asCScriptNode *errNode, asCObjectType *intfType) {
// A shared type may only implement from shared interfaces
- if( decl->typeInfo->IsShared() && !intfType->IsShared() )
- {
+ if (decl->typeInfo->IsShared() && !intfType->IsShared()) {
asCString msg;
msg.Format(TXT_SHARED_CANNOT_IMPLEMENT_NON_SHARED_s, intfType->name.AddressOf());
WriteError(msg, decl->script, errNode);
return;
}
- if( decl->isExistingShared )
- {
+ if (decl->isExistingShared) {
// If the class is an existing shared class, then just check if the
// interface exists in the original declaration too
- if( !decl->typeInfo->Implements(intfType) )
- {
+ if (!decl->typeInfo->Implements(intfType)) {
asCString str;
str.Format(TXT_SHARED_s_DOESNT_MATCH_ORIGINAL, decl->typeInfo->GetName());
WriteError(str, decl->script, errNode);
return;
}
- }
- else
- {
+ } else {
// If the interface is already in the class then don't add it again
- if( decl->typeInfo->Implements(intfType) )
+ if (decl->typeInfo->Implements(intfType))
return;
// Add the interface to the class
@@ -2920,33 +2585,28 @@ void asCBuilder::AddInterfaceToClass(sClassDeclaration *decl, asCScriptNode *err
// Add the inherited interfaces too
// For interfaces this will be done outside to handle out-of-order declarations
- if( !CastToObjectType(decl->typeInfo)->IsInterface() )
- {
- for( asUINT n = 0; n < intfType->interfaces.GetLength(); n++ )
+ if (!CastToObjectType(decl->typeInfo)->IsInterface()) {
+ for (asUINT n = 0; n < intfType->interfaces.GetLength(); n++)
AddInterfaceToClass(decl, errNode, intfType->interfaces[n]);
}
}
}
-void asCBuilder::CompileInterfaces()
-{
+void asCBuilder::CompileInterfaces() {
asUINT n;
// Order the interfaces with inheritances so that the inherited
// of inherited interfaces can be added properly
- for( n = 0; n < interfaceDeclarations.GetLength(); n++ )
- {
+ for (n = 0; n < interfaceDeclarations.GetLength(); n++) {
sClassDeclaration *intfDecl = interfaceDeclarations[n];
asCObjectType *intfType = CastToObjectType(intfDecl->typeInfo);
- if( intfType->interfaces.GetLength() == 0 ) continue;
+ if (intfType->interfaces.GetLength() == 0) continue;
// If any of the derived interfaces are found after this interface, then move this to the end of the list
- for( asUINT m = n+1; m < interfaceDeclarations.GetLength(); m++ )
- {
- if( intfType != interfaceDeclarations[m]->typeInfo &&
- intfType->Implements(interfaceDeclarations[m]->typeInfo) )
- {
+ for (asUINT m = n + 1; m < interfaceDeclarations.GetLength(); m++) {
+ if (intfType != interfaceDeclarations[m]->typeInfo &&
+ intfType->Implements(interfaceDeclarations[m]->typeInfo)) {
interfaceDeclarations.RemoveIndex(n);
interfaceDeclarations.PushLast(intfDecl);
@@ -2958,24 +2618,21 @@ void asCBuilder::CompileInterfaces()
}
// Now recursively add the additional inherited interfaces
- for( n = 0; n < interfaceDeclarations.GetLength(); n++ )
- {
+ for (n = 0; n < interfaceDeclarations.GetLength(); n++) {
sClassDeclaration *intfDecl = interfaceDeclarations[n];
- if( intfDecl->isExistingShared )
- {
+ if (intfDecl->isExistingShared) {
// Set the declaration as validated already, so that other
// types that contain this will accept this type
intfDecl->validState = 1;
continue;
}
-
+
asCObjectType *intfType = CastToObjectType(intfDecl->typeInfo);
// TODO: Is this really at the correct place? Hasn't the vfTableIdx already been set here?
// Co-opt the vfTableIdx value in our own methods to indicate the
// index the function should have in the table chunk for this interface.
- for( asUINT d = 0; d < intfType->methods.GetLength(); d++ )
- {
+ for (asUINT d = 0; d < intfType->methods.GetLength(); d++) {
asCScriptFunction *func = GetFunctionDescription(intfType->methods[d]);
func->vfTableIdx = d;
@@ -2984,33 +2641,28 @@ void asCBuilder::CompileInterfaces()
// As new interfaces will be added to the end of the list, all
// interfaces will be traversed the same as recursively
- for( asUINT m = 0; m < intfType->interfaces.GetLength(); m++ )
- {
+ for (asUINT m = 0; m < intfType->interfaces.GetLength(); m++) {
asCObjectType *base = intfType->interfaces[m];
// Add any interfaces not already implemented
- for( asUINT l = 0; l < base->interfaces.GetLength(); l++ )
+ for (asUINT l = 0; l < base->interfaces.GetLength(); l++)
AddInterfaceToClass(intfDecl, intfDecl->node, base->interfaces[l]);
// Add the methods from the implemented interface
- for( asUINT l = 0; l < base->methods.GetLength(); l++ )
- {
+ for (asUINT l = 0; l < base->methods.GetLength(); l++) {
// If the derived interface implements the same method, then don't add the base interface' method
asCScriptFunction *baseFunc = GetFunctionDescription(base->methods[l]);
asCScriptFunction *derivedFunc = 0;
bool found = false;
- for( asUINT d = 0; d < intfType->methods.GetLength(); d++ )
- {
+ for (asUINT d = 0; d < intfType->methods.GetLength(); d++) {
derivedFunc = GetFunctionDescription(intfType->methods[d]);
- if( derivedFunc->IsSignatureEqual(baseFunc) )
- {
+ if (derivedFunc->IsSignatureEqual(baseFunc)) {
found = true;
break;
}
}
- if( !found )
- {
+ if (!found) {
// Add the method
intfType->methods.PushLast(baseFunc->id);
baseFunc->AddRefInternal();
@@ -3020,11 +2672,9 @@ void asCBuilder::CompileInterfaces()
}
}
-void asCBuilder::DetermineTypeRelations()
-{
+void asCBuilder::DetermineTypeRelations() {
// Determine inheritance between interfaces
- for (asUINT n = 0; n < interfaceDeclarations.GetLength(); n++)
- {
+ for (asUINT n = 0; n < interfaceDeclarations.GetLength(); n++) {
sClassDeclaration *intfDecl = interfaceDeclarations[n];
asCObjectType *intfType = CastToObjectType(intfDecl->typeInfo);
@@ -3033,29 +2683,26 @@ void asCBuilder::DetermineTypeRelations()
node = node->firstChild;
// Skip the 'shared' & 'external' keywords
- while( node->nodeType == snIdentifier &&
- (intfDecl->script->TokenEquals(node->tokenPos, node->tokenLength, SHARED_TOKEN) ||
- intfDecl->script->TokenEquals(node->tokenPos, node->tokenLength, EXTERNAL_TOKEN)) )
+ while (node->nodeType == snIdentifier &&
+ (intfDecl->script->TokenEquals(node->tokenPos, node->tokenLength, SHARED_TOKEN) ||
+ intfDecl->script->TokenEquals(node->tokenPos, node->tokenLength, EXTERNAL_TOKEN)))
node = node->next;
// Skip the name
node = node->next;
// Verify the inherited interfaces
- while (node && node->nodeType == snIdentifier)
- {
+ while (node && node->nodeType == snIdentifier) {
asSNameSpace *ns;
asCString name;
- if (GetNamespaceAndNameFromNode(node, intfDecl->script, intfType->nameSpace, ns, name) < 0)
- {
+ if (GetNamespaceAndNameFromNode(node, intfDecl->script, intfType->nameSpace, ns, name) < 0) {
node = node->next;
continue;
}
// Find the object type for the interface
asCObjectType *objType = 0;
- while (ns)
- {
+ while (ns) {
objType = GetObjectType(name.AddressOf(), ns);
if (objType) break;
@@ -3064,31 +2711,24 @@ void asCBuilder::DetermineTypeRelations()
// Check that the object type is an interface
bool ok = true;
- if (objType && objType->IsInterface())
- {
+ if (objType && objType->IsInterface()) {
// Check that the implemented interface is shared if the base interface is shared
- if (intfType->IsShared() && !objType->IsShared())
- {
+ if (intfType->IsShared() && !objType->IsShared()) {
asCString str;
str.Format(TXT_SHARED_CANNOT_IMPLEMENT_NON_SHARED_s, objType->GetName());
WriteError(str, intfDecl->script, node);
ok = false;
}
- }
- else
- {
+ } else {
WriteError(TXT_INTERFACE_CAN_ONLY_IMPLEMENT_INTERFACE, intfDecl->script, node);
ok = false;
}
- if (ok)
- {
+ if (ok) {
// Make sure none of the implemented interfaces implement from this one
asCObjectType *base = objType;
- while (base != 0)
- {
- if (base == intfType)
- {
+ while (base != 0) {
+ if (base == intfType) {
WriteError(TXT_CANNOT_IMPLEMENT_SELF, intfDecl->script, node);
ok = false;
break;
@@ -3114,8 +2754,7 @@ void asCBuilder::DetermineTypeRelations()
}
// Determine class inheritances and interfaces
- for (asUINT n = 0; n < classDeclarations.GetLength(); n++)
- {
+ for (asUINT n = 0; n < classDeclarations.GetLength(); n++) {
sClassDeclaration *decl = classDeclarations[n];
asCScriptCode *file = decl->script;
@@ -3124,10 +2763,9 @@ void asCBuilder::DetermineTypeRelations()
asCScriptNode *node = decl->node->firstChild;
while (file->TokenEquals(node->tokenPos, node->tokenLength, FINAL_TOKEN) ||
- file->TokenEquals(node->tokenPos, node->tokenLength, SHARED_TOKEN) ||
- file->TokenEquals(node->tokenPos, node->tokenLength, ABSTRACT_TOKEN) ||
- file->TokenEquals(node->tokenPos, node->tokenLength, EXTERNAL_TOKEN))
- {
+ file->TokenEquals(node->tokenPos, node->tokenLength, SHARED_TOKEN) ||
+ file->TokenEquals(node->tokenPos, node->tokenLength, ABSTRACT_TOKEN) ||
+ file->TokenEquals(node->tokenPos, node->tokenLength, EXTERNAL_TOKEN)) {
node = node->next;
}
@@ -3135,12 +2773,10 @@ void asCBuilder::DetermineTypeRelations()
asASSERT(node->tokenType == ttIdentifier);
node = node->next;
- while (node && node->nodeType == snIdentifier)
- {
+ while (node && node->nodeType == snIdentifier) {
asSNameSpace *ns;
asCString name;
- if (GetNamespaceAndNameFromNode(node, file, decl->typeInfo->nameSpace, ns, name) < 0)
- {
+ if (GetNamespaceAndNameFromNode(node, file, decl->typeInfo->nameSpace, ns, name) < 0) {
node = node->next;
Commit: ae1dc3c285866b357b21ee840280cc8803a9e51f
https://github.com/scummvm/scummvm/commit/ae1dc3c285866b357b21ee840280cc8803a9e51f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:17+01:00
Commit Message:
HPL1: Fix warnings
Changed paths:
engines/hpl1/engine/libraries/angelscript/sources/as_restore.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.cpp
engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.h
engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
engines/hpl1/engine/libraries/newton/core/dgTypes.h
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_restore.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_restore.cpp
index c9556082274..7184f9eff12 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_restore.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_restore.cpp
@@ -3359,10 +3359,10 @@ int asCWriter::WriteData(const void *data, asUINT size) {
int ret = 0;
#if defined(AS_BIG_ENDIAN)
for (asUINT n = 0; ret >= 0 && n < size; n++)
- ret = stream->Write(((asBYTE *)data) + n, 1);
+ ret = stream->Write(((const asBYTE *)data) + n, 1);
#else
for (int n = size - 1; ret >= 0 && n >= 0; n--)
- ret = stream->Write(((asBYTE *)data) + n, 1);
+ ret = stream->Write(((const asBYTE *)data) + n, 1);
#endif
if (ret < 0)
Error(TXT_UNEXPECTED_END_OF_FILE);
@@ -5080,4 +5080,3 @@ int asCWriter::FindTypeInfoIdx(asCTypeInfo *obj) {
#endif // AS_NO_COMPILER
END_AS_NAMESPACE
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.cpp
index 6184ffc08da..ef5b67c4b19 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.cpp
@@ -35,6 +35,8 @@
#include "as_scriptobject.h"
#include "as_texts.h"
+#include "common/util.h"
+
BEGIN_AS_NAMESPACE
// This helper function will call the default factory, that is a script function
@@ -822,17 +824,17 @@ int asCScriptObject::CopyFromAs(const asCScriptObject *other, asCObjectType *in_
asCObjectProperty *prop = in_objType->properties[n];
if (prop->type.IsObject()) {
void **dst = (void **)(((char *)this) + prop->byteOffset);
- void **src = (void **)(((char *)other) + prop->byteOffset);
+ const void * const *src = (const void * const *)(((const char *)other) + prop->byteOffset);
if (!prop->type.IsObjectHandle()) {
if (prop->type.IsReference() || (prop->type.GetTypeInfo()->flags & asOBJ_REF))
CopyObject(*src, *dst, CastToObjectType(prop->type.GetTypeInfo()), engine);
else
CopyObject(src, dst, CastToObjectType(prop->type.GetTypeInfo()), engine);
} else
- CopyHandle((asPWORD *)src, (asPWORD *)dst, CastToObjectType(prop->type.GetTypeInfo()), engine);
+ CopyHandle((const asPWORD *)src, (asPWORD *)dst, CastToObjectType(prop->type.GetTypeInfo()), engine);
} else if (prop->type.IsFuncdef()) {
asCScriptFunction **dst = (asCScriptFunction **)(((char *)this) + prop->byteOffset);
- asCScriptFunction **src = (asCScriptFunction **)(((char *)other) + prop->byteOffset);
+ asCScriptFunction * const *src = (asCScriptFunction * const *)(((const char *)other) + prop->byteOffset);
if (*dst)
(*dst)->Release();
*dst = *src;
@@ -840,7 +842,7 @@ int asCScriptObject::CopyFromAs(const asCScriptObject *other, asCObjectType *in_
(*dst)->AddRef();
} else {
void *dst = ((char *)this) + prop->byteOffset;
- void *src = ((char *)other) + prop->byteOffset;
+ const void *src = ((const char *)other) + prop->byteOffset;
memcpy(dst, src, prop->type.GetSizeInMemoryBytes());
}
}
@@ -924,7 +926,7 @@ int asCScriptObject::CopyFrom(const asIScriptObject *other) {
if (GetTypeId() != other->GetTypeId())
return asINVALID_TYPE;
- *this = *(asCScriptObject *)other;
+ *this = *(const asCScriptObject *)other;
return asSUCCESS;
}
@@ -979,7 +981,7 @@ void asCScriptObject::CopyObject(const void *src, void *dst, asCObjectType *in_o
memcpy(dst, src, in_objType->size);
}
-void asCScriptObject::CopyHandle(asPWORD *src, asPWORD *dst, asCObjectType *in_objType, asCScriptEngine *engine) {
+void asCScriptObject::CopyHandle(const asPWORD *src, asPWORD *dst, asCObjectType *in_objType, asCScriptEngine *engine) {
// asOBJ_NOCOUNT doesn't have addref or release behaviours
asASSERT((in_objType->flags & asOBJ_NOCOUNT) || (in_objType->beh.release && in_objType->beh.addref));
@@ -1034,4 +1036,3 @@ AS_API asILockableSharedBool *asCreateLockableSharedBool() {
}
END_AS_NAMESPACE
-
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.h b/engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.h
index c12afba7434..355ffd8ddf3 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.h
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_scriptobject.h
@@ -118,7 +118,7 @@ public:
void *AllocateUninitializedObject(asCObjectType *objType, asCScriptEngine *engine);
void FreeObject(void *ptr, asCObjectType *objType, asCScriptEngine *engine);
void CopyObject(const void *src, void *dst, asCObjectType *objType, asCScriptEngine *engine);
- void CopyHandle(asPWORD *src, asPWORD *dst, asCObjectType *objType, asCScriptEngine *engine);
+ void CopyHandle(const asPWORD *src, asPWORD *dst, asCObjectType *objType, asCScriptEngine *engine);
int CopyFromAs(const asCScriptObject *other, asCObjectType *objType);
void CallDestructor();
diff --git a/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp b/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
index 0d961b01221..b0b79c10782 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
@@ -1678,4 +1678,3 @@ void dgAABBPolygonSoup::Create(const dgPolygonSoupDatabaseBuilder &builder, boo
GetAABB(p0, p1);
ForAllSectors(p0, p1, CalculateAllFaceEdgeNormals, this);
}
-
diff --git a/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h b/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
index af78bc4e0c5..06036bcd4c0 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
@@ -138,4 +138,3 @@ inline void dgPolygonSoupDatabase::ForAllSectorsRayHitSimd(const dgFastRayTest &
}
#endif
-
diff --git a/engines/hpl1/engine/libraries/newton/core/dgTypes.h b/engines/hpl1/engine/libraries/newton/core/dgTypes.h
index e79c96cc878..318f67cdbc0 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgTypes.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgTypes.h
@@ -291,14 +291,10 @@ dgInt32 dgBinarySearch(T const *array, dgInt32 elements, dgInt32 entry) {
dgInt32 index0;
dgInt32 index1;
dgInt32 index2;
- dgInt32 entry0;
dgInt32 entry1;
- dgInt32 entry2;
index0 = 0;
index2 = elements - 1;
- entry0 = array[index0].m_Key;
- entry2 = array[index2].m_Key;
while ((index2 - index0) > 1) {
index1 = (index0 + index2) >> 1;
@@ -311,10 +307,8 @@ dgInt32 dgBinarySearch(T const *array, dgInt32 elements, dgInt32 entry) {
return index1;
} else if (entry < entry1) {
index2 = index1;
- entry2 = entry1;
} else {
index0 = index1;
- entry0 = entry1;
}
}
Commit: 430dfffa26d328bfb90fdb2a84c83788b641fca0
https://github.com/scummvm/scummvm/commit/430dfffa26d328bfb90fdb2a84c83788b641fca0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:17+01:00
Commit Message:
HPL1: Fix more warnings
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgHeap.h
engines/hpl1/engine/libraries/newton/core/dgNode.h
engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
engines/hpl1/engine/libraries/newton/core/dgStack.h
engines/hpl1/engine/libraries/newton/core/dgThreads.h
engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/resources/MaterialManager.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgHeap.h b/engines/hpl1/engine/libraries/newton/core/dgHeap.h
index 6b248a8b3aa..4f5a5e1c31e 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgHeap.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgHeap.h
@@ -30,6 +30,8 @@
#include "dgStdafx.h"
#include "dgMemory.h"
+#include "common/util.h"
+
//#define DG_HEAP_SANITY_CHECK
@@ -116,7 +118,7 @@ dgHeapBase<OBJECT, KEY>::dgHeapBase(const void *const buffer, dgInt32 sizeInByte
// _ASSERTE (0);
// m_allocated = false;
m_allocator = NULL;
- m_pool = (RECORD *) buffer;
+ m_pool = (RECORD *)Common::remove_const<void * const>::type(buffer);
m_maxCount = dgInt32(sizeInBytes / sizeof(RECORD));
Flush();
}
@@ -502,5 +504,3 @@ void dgUpHeap<OBJECT, KEY>::Pop() {
#endif
-
-
diff --git a/engines/hpl1/engine/libraries/newton/core/dgNode.h b/engines/hpl1/engine/libraries/newton/core/dgNode.h
index b7d8c813f60..a5f4600f885 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgNode.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgNode.h
@@ -27,6 +27,8 @@
#include "dgRef.h"
#include "dgRtti.h"
+#include "common/util.h"
+
class dgFile;
//enum dgSaveType;
@@ -162,7 +164,7 @@ dgNode<T>::~dgNode() {
template<class T>
dgRef *dgNode<T>::CreateClone() const {
- return new T(*(T *)this);
+ return new T(*(T *)Common::remove_const<T *>::type(this));
}
template<class T>
@@ -233,4 +235,3 @@ T *dgNode<T>::Find(const char *name) const {
#endif
-
diff --git a/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h b/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
index 06036bcd4c0..6fb687f8a67 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
@@ -94,7 +94,7 @@ inline dgUnsigned32 dgPolygonSoupDatabase::GetTagId(const dgInt32 *face) const {
inline void dgPolygonSoupDatabase::SetTagId(const dgInt32 *facePtr, dgUnsigned32 newID) const {
dgUnsigned32 *face;
- face = (dgUnsigned32 *) facePtr;
+ face = Common::remove_const<dgUnsigned32 *>::type(facePtr);
face[-1] = newID;
}
diff --git a/engines/hpl1/engine/libraries/newton/core/dgStack.h b/engines/hpl1/engine/libraries/newton/core/dgStack.h
index 757e2dd5d6b..060c499719a 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgStack.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgStack.h
@@ -26,6 +26,8 @@
#include "dgDebug.h"
#include "dgMemory.h"
+#include "common/util.h"
+
class dgStackBase {
protected:
dgStackBase(dgInt32 size);
@@ -39,7 +41,7 @@ inline dgStackBase::dgStackBase(dgInt32 size) {
}
inline dgStackBase::~dgStackBase() {
- dgFreeStack((void *)m_ptr);
+ dgFreeStack(Common::remove_const<void *>::type(m_ptr));
}
@@ -100,10 +102,9 @@ const T &dgStack<T>::operator[](dgInt32 entry) const {
_ASSERTE(entry >= 0);
_ASSERTE((entry < m_size) || ((m_size == 0) && (entry == 0)));
- mem = (T *) m_ptr;
+ mem = Common::remove_const<T *>::type(m_ptr);
return mem[entry];
}
#endif
-
diff --git a/engines/hpl1/engine/libraries/newton/core/dgThreads.h b/engines/hpl1/engine/libraries/newton/core/dgThreads.h
index 67c3b0f2dd7..9fabadd7bb5 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgThreads.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgThreads.h
@@ -81,9 +81,9 @@ private:
mutable dgInt32 m_globalSpinLock;
bool m_exit;
- dgInt32 m_emptySlot;
- dgInt32 m_workToDo;
- dgInt32 m_criticalSection;
+ //dgInt32 m_emptySlot;
+ //dgInt32 m_workToDo;
+ //dgInt32 m_criticalSection;
dgInt32 m_workToDoSpinLock;
dgWorkerThread *m_queue[DG_MAXQUEUE];
//pthread_t m_threadhandles[DG_MAXIMUN_THREADS];
@@ -95,4 +95,3 @@ private:
#endif
-
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgContact.cpp b/engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
index 030bb7cb907..fa1bbff4079 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
@@ -83,7 +83,7 @@ void dgContact::GetInfo(dgConstraintInfo *const info) const {
memset(info, 0, sizeof(dgConstraintInfo));
InitInfo(info);
info->m_collideCollisionOn = GetCount();
- strcpy(info->m_discriptionType, "contact");
+ strncpy(info->m_discriptionType, "contact", 7);
}
void dgContact::CalculatePointDerivative(dgInt32 index,
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index 945fad5c291..1078d3e5b56 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -464,7 +464,7 @@ float cMath::TurnAngleDeg(float afAngle, float afFinalAngle, float afSpeed) {
float cMath::GetAngleFromPoints2D(const cVector2f &avStartPos, const cVector2f &avGoalPos) {
float fDx;
float fDy;
- float fAns;
+ float fAns = 0.0;
fDx = avGoalPos.x - avStartPos.x;
fDy = avGoalPos.y - avStartPos.y;
diff --git a/engines/hpl1/engine/resources/MaterialManager.cpp b/engines/hpl1/engine/resources/MaterialManager.cpp
index 2c4ae445eb7..704c88ca12f 100644
--- a/engines/hpl1/engine/resources/MaterialManager.cpp
+++ b/engines/hpl1/engine/resources/MaterialManager.cpp
@@ -281,7 +281,7 @@ iMaterial *cMaterialManager::LoadFromFile(const tString &asName, const tString &
tTextureTypeList lstTexTypes = pMat->GetTextureTypes();
tTextureTypeListIt it = lstTexTypes.begin();
for (; it != lstTexTypes.end(); it++) {
- iTexture *pTex;
+ iTexture *pTex = nullptr;
TiXmlElement *pTexChild = pTexRoot->FirstChildElement(GetTextureString(it->mType).c_str());
if (pTexChild == NULL) {
Commit: 0f1f2b9946aa0e947c2b7e0a63040f47a17787f1
https://github.com/scummvm/scummvm/commit/0f1f2b9946aa0e947c2b7e0a63040f47a17787f1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:18+01:00
Commit Message:
HPL1: Fix more const warnings
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgStack.h
diff --git a/engines/hpl1/engine/libraries/newton/core/dgStack.h b/engines/hpl1/engine/libraries/newton/core/dgStack.h
index 060c499719a..d91ae714254 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgStack.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgStack.h
@@ -26,14 +26,12 @@
#include "dgDebug.h"
#include "dgMemory.h"
-#include "common/util.h"
-
class dgStackBase {
protected:
dgStackBase(dgInt32 size);
~dgStackBase();
- const void *m_ptr;
+ void *m_ptr;
};
inline dgStackBase::dgStackBase(dgInt32 size) {
@@ -41,7 +39,7 @@ inline dgStackBase::dgStackBase(dgInt32 size) {
}
inline dgStackBase::~dgStackBase() {
- dgFreeStack(Common::remove_const<void *>::type(m_ptr));
+ dgFreeStack(m_ptr);
}
@@ -102,7 +100,7 @@ const T &dgStack<T>::operator[](dgInt32 entry) const {
_ASSERTE(entry >= 0);
_ASSERTE((entry < m_size) || ((m_size == 0) && (entry == 0)));
- mem = Common::remove_const<T *>::type(m_ptr);
+ mem = (T *) m_ptr;
return mem[entry];
}
Commit: 65935ec05eb41a22ffcf93141fc3433915148780
https://github.com/scummvm/scummvm/commit/65935ec05eb41a22ffcf93141fc3433915148780
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:18+01:00
Commit Message:
HPL1: remove globals in serialization macros
Changed paths:
engines/hpl1/engine/system/SerializeClass.h
diff --git a/engines/hpl1/engine/system/SerializeClass.h b/engines/hpl1/engine/system/SerializeClass.h
index c57a710a81d..c617422dbc4 100644
--- a/engines/hpl1/engine/system/SerializeClass.h
+++ b/engines/hpl1/engine/system/SerializeClass.h
@@ -109,6 +109,7 @@ public: \
const static char *msSerialize_Name; \
const static char *msSerialize_ParentName; \
const static cSerializeMemberField *mpSerialize_MemberFields; \
+ const static cSerializeClass serializedClass_##aClass; \
virtual ~aClass() = default; \
virtual tString Serialize_GetTopClass() { return #aClass; }
@@ -117,6 +118,7 @@ public: \
const static char *msSerialize_Name; \
const static char *msSerialize_ParentName; \
const static cSerializeMemberField *mpSerialize_MemberFields; \
+ const static cSerializeClass serializedClass_##aClass; \
virtual tString Serialize_GetTopClass() { return #aClass; }
/**
@@ -127,7 +129,7 @@ public: \
extern cSerializeMemberField mvTempMemberFields[]; \
} \
static iSerializable *_Create_##aClass() { return hplNew(aClass, ()); } \
- static cSerializeClass gSerializedClass_##aClass(#aClass, #aParent, SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), _Create_##aClass); \
+ const cSerializeClass aClass::serializedClass_##aClass(#aClass, #aParent, SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), _Create_##aClass); \
const char *aClass::msSerialize_Name = #aClass; \
const char *aClass::msSerialize_ParentName = #aParent; \
const cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
@@ -140,7 +142,7 @@ public: \
extern cSerializeMemberField mvTempMemberFields[]; \
} \
static iSerializable *_Create_##aClass() { return hplNew(aClass, ()); } \
- static cSerializeClass gSerializedClass_##aClass(#aClass, "", SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), _Create_##aClass); \
+ const cSerializeClass aClass::serializedClass_##aClass(#aClass, "", SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), _Create_##aClass); \
const char *aClass::msSerialize_Name = #aClass; \
const char *aClass::msSerialize_ParentName = ""; \
const cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
@@ -152,7 +154,7 @@ public: \
namespace SerializeNamespace_##aClass { \
extern cSerializeMemberField mvTempMemberFields[]; \
} \
- static cSerializeClass gSerializedClass_##aClass(#aClass, #aParent, SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), NULL); \
+ const cSerializeClass aClass::serializedClass_##aClass(#aClass, #aParent, SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), NULL); \
const char *aClass::msSerialize_Name = #aClass; \
const char *aClass::msSerialize_ParentName = #aParent; \
const cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
@@ -164,7 +166,7 @@ public: \
namespace SerializeNamespace_##aClass { \
extern cSerializeMemberField mvTempMemberFields[]; \
} \
- static cSerializeClass gSerializedClass_##aClass(#aClass, "", SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), NULL); \
+ const cSerializeClass aClass::serializedClass_##aClass(#aClass, "", SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), NULL); \
const char *aClass::msSerialize_Name = #aClass; \
const char *aClass::msSerialize_ParentName = ""; \
const cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
Commit: 2db6ed40b4c46f6854a71dc0e0d9f72984dfa0fb
https://github.com/scummvm/scummvm/commit/2db6ed40b4c46f6854a71dc0e0d9f72984dfa0fb
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:18+01:00
Commit Message:
TINYGL: reduce memory allocation
Changed paths:
graphics/tinygl/init.cpp
diff --git a/graphics/tinygl/init.cpp b/graphics/tinygl/init.cpp
index 553e7e43ce4..f6a5c05a870 100644
--- a/graphics/tinygl/init.cpp
+++ b/graphics/tinygl/init.cpp
@@ -261,7 +261,7 @@ void GLContext::init(int screenW, int screenH, Graphics::PixelFormat pixelFormat
// color mask
color_mask_red = color_mask_green = color_mask_blue = color_mask_alpha = true;
- const size_t kDrawCallMemory = 1024 * 1024 * 1024;
+ const size_t kDrawCallMemory = 60ULL * 1024ULL * 1024ULL;
_currentAllocatorIndex = 0;
_drawCallAllocator[0].initialize(kDrawCallMemory);
Commit: 07642582a0db916855b29263c56365b4ac9d4516
https://github.com/scummvm/scummvm/commit/07642582a0db916855b29263c56365b4ac9d4516
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:18+01:00
Commit Message:
HPL1: remove unused files
Changed paths:
R engines/hpl1/console.cpp
R engines/hpl1/console.h
engines/hpl1/hpl1.cpp
engines/hpl1/module.mk
diff --git a/engines/hpl1/console.cpp b/engines/hpl1/console.cpp
deleted file mode 100644
index ee5b29ae58a..00000000000
--- a/engines/hpl1/console.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "hpl1/console.h"
-
-namespace Hpl1 {
-
-Console::Console() : GUI::Debugger() {
- registerCmd("test", WRAP_METHOD(Console, Cmd_test));
-}
-
-Console::~Console() {
-}
-
-bool Console::Cmd_test(int argc, const char **argv) {
- debugPrintf("Test\n");
- return true;
-}
-
-} // namespace Hpl1
diff --git a/engines/hpl1/console.h b/engines/hpl1/console.h
deleted file mode 100644
index 124c647a618..00000000000
--- a/engines/hpl1/console.h
+++ /dev/null
@@ -1,41 +0,0 @@
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef HPL1_CONSOLE_H
-#define HPL1_CONSOLE_H
-
-#include "gui/debugger.h"
-
-namespace Hpl1 {
-
-class Console : public GUI::Debugger {
-private:
- bool Cmd_test(int argc, const char **argv);
-
-public:
- Console();
- ~Console() override;
-};
-
-} // End of namespace Hpl1
-
-#endif
diff --git a/engines/hpl1/hpl1.cpp b/engines/hpl1/hpl1.cpp
index 76756f191a0..deee38415c8 100644
--- a/engines/hpl1/hpl1.cpp
+++ b/engines/hpl1/hpl1.cpp
@@ -32,7 +32,6 @@
#include "common/system.h"
#include "engines/util.h"
#include "graphics/palette.h"
-#include "hpl1/console.h"
#include "hpl1/detection.h"
#include "hpl1/debug.h"
#include "audio/mixer.h"
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 943f0b8ee6a..0a6652443dc 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -1,7 +1,6 @@
MODULE := engines/hpl1
MODULE_OBJS := \
- console.o \
detection.o \
string.o \
opengl.o \
Commit: 204945ad313dc822677517efb7becde8f705f494
https://github.com/scummvm/scummvm/commit/204945ad313dc822677517efb7becde8f705f494
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:18+01:00
Commit Message:
HPL1: use full paths in include directives
Changed paths:
engines/hpl1/std/map.h
engines/hpl1/std/multimap.h
engines/hpl1/std/multiset.h
diff --git a/engines/hpl1/std/map.h b/engines/hpl1/std/map.h
index 2df9125748b..8f05a1e62cd 100644
--- a/engines/hpl1/std/map.h
+++ b/engines/hpl1/std/map.h
@@ -23,7 +23,7 @@
#define HPL1_STD_MAP_H
#include "hpl1/algorithms.h"
-#include "pair.h"
+#include "hpl1/std/pair.h"
namespace Hpl1 {
namespace std {
diff --git a/engines/hpl1/std/multimap.h b/engines/hpl1/std/multimap.h
index 61e50999fb8..2feefd195b8 100644
--- a/engines/hpl1/std/multimap.h
+++ b/engines/hpl1/std/multimap.h
@@ -23,7 +23,7 @@
#define HPL1_STD_MULTIMAP_H
#include "common/array.h"
-#include "pair.h"
+#include "hpl1/std/pair.h"
namespace Hpl1 {
diff --git a/engines/hpl1/std/multiset.h b/engines/hpl1/std/multiset.h
index f136ef45467..2d3a780dfaa 100644
--- a/engines/hpl1/std/multiset.h
+++ b/engines/hpl1/std/multiset.h
@@ -22,7 +22,7 @@
#ifndef HPL1_STD_MULTISET_H
#define HPL1_STD_MULTISET_H
-#include "set.h"
+#include "hpl1/std/set.h"
namespace Hpl1 {
namespace std {
Commit: 96ed9b9f7938c09164554f9bb6d3773ad1ebff52
https://github.com/scummvm/scummvm/commit/96ed9b9f7938c09164554f9bb6d3773ad1ebff52
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:18+01:00
Commit Message:
HPL1: make StaticString constructor constexpr
Changed paths:
engines/hpl1/static_string.h
diff --git a/engines/hpl1/static_string.h b/engines/hpl1/static_string.h
index a874dc1414b..319db556d90 100644
--- a/engines/hpl1/static_string.h
+++ b/engines/hpl1/static_string.h
@@ -27,7 +27,7 @@ namespace Hpl1 {
class StaticString
{
public:
- StaticString(const char *str) : _str(str)
+ constexpr StaticString(const char *str) : _str(str)
{
}
Commit: e29771eff7decb31b623fe8e6cca46bd5fee6437
https://github.com/scummvm/scummvm/commit/e29771eff7decb31b623fe8e6cca46bd5fee6437
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:18+01:00
Commit Message:
HPL1: make SerializeMemberField constructor constexpr
Changed paths:
engines/hpl1/engine/system/SerializeClass.h
diff --git a/engines/hpl1/engine/system/SerializeClass.h b/engines/hpl1/engine/system/SerializeClass.h
index c617422dbc4..e7580b03dc6 100644
--- a/engines/hpl1/engine/system/SerializeClass.h
+++ b/engines/hpl1/engine/system/SerializeClass.h
@@ -214,29 +214,16 @@ public: \
class cSerializeMemberField {
public:
- cSerializeMemberField(Hpl1::StaticString asName, size_t alOffset, size_t alSize, eSerializeType alType,
- eSerializeMainType aMainType) : msName(asName), msClassName(""){
- mlOffset = alOffset;
- mlSize = alSize;
- mType = alType;
- mMainType = aMainType;
+ constexpr cSerializeMemberField(Hpl1::StaticString asName, size_t alOffset, size_t alSize, eSerializeType alType,
+ eSerializeMainType aMainType) : msName(asName), msClassName(""), mlOffset(alOffset), mlSize(alSize), mType(alType), mMainType(aMainType), mlArraySize(0) {
}
- cSerializeMemberField(Hpl1::StaticString asName, size_t alOffset, size_t alSize, eSerializeType alType,
- eSerializeMainType aMainType, size_t alArraySize) : msName(asName), msClassName("") {
- mlOffset = alOffset;
- mlSize = alSize;
- mType = alType;
- mMainType = aMainType;
- mlArraySize = alArraySize;
+ constexpr cSerializeMemberField(Hpl1::StaticString asName, size_t alOffset, size_t alSize, eSerializeType alType,
+ eSerializeMainType aMainType, size_t alArraySize) : msName(asName), msClassName(""), mlOffset(alOffset), mlSize(alSize), mType(alType), mMainType(aMainType), mlArraySize(alArraySize) {
}
- cSerializeMemberField(Hpl1::StaticString asName, size_t alOffset, size_t alSize, eSerializeType alType,
- eSerializeMainType aMainType, Hpl1::StaticString asClassName) : msName(asName), msClassName(asClassName) {
- mlOffset = alOffset;
- mlSize = alSize;
- mType = alType;
- mMainType = aMainType;
+ constexpr cSerializeMemberField(Hpl1::StaticString asName, size_t alOffset, size_t alSize, eSerializeType alType,
+ eSerializeMainType aMainType, Hpl1::StaticString asClassName) : msName(asName), msClassName(asClassName), mlOffset(alOffset), mlSize(alSize), mType(alType), mMainType(aMainType), mlArraySize(0) {
}
Hpl1::StaticString msName;
Commit: 772906a5cbf0fdd82ea82440c7b428478e60bb9f
https://github.com/scummvm/scummvm/commit/772906a5cbf0fdd82ea82440c7b428478e60bb9f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:18+01:00
Commit Message:
HPL1: fix global costructors used in serialization
Changed paths:
A engines/hpl1/serialize.cpp
A engines/hpl1/serialize.h
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/engine/system/SerializeClass.h
engines/hpl1/module.mk
engines/hpl1/penumbra-overture/Init.cpp
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index d11144dbeba..0f495b3c144 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -39,33 +39,10 @@
#include "hpl1/hpl1.h"
#include "hpl1/debug.h"
#include "common/savefile.h"
+#include "hpl1/serialize.h"
namespace hpl {
-//////////////////////////////////////////////////////////////////////////
-// SERIALIZEABLE
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// SERIALIZE SAVED CLASS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cSerializeSavedClass::cSerializeSavedClass(const char *asName, const char *asParent,
- cSerializeMemberField *apMemberFields, size_t alSize,
- iSerializable *(*apCreateFunc)()) {
- msName = asName;
- msParentName = asParent;
- mpMemberFields = apMemberFields;
- mlSize = alSize;
- mpCreateFunc = apCreateFunc;
-}
-
-//-----------------------------------------------------------------------
-
//////////////////////////////////////////////////////////////////////////
// SERIALIZE MEMBER FIELD ITERATOR
//////////////////////////////////////////////////////////////////////////
@@ -126,9 +103,6 @@ cSerializeMemberField *cSerializeMemberFieldIterator::GetNext() {
//-----------------------------------------------------------------------
-cSerializeSavedClass gvSerializeTempClasses[kMaxSerializeClasses];
-int glSerializeTempClassesNum = 0;
-
// Define static variables
tSerializeSavedClassMap cSerializeClass::m_mapSavedClasses;
bool cSerializeClass::mbDataSetup = false;
@@ -147,16 +121,6 @@ static const char* gsTabString = "";
const char *GetTabs() {
return gsTabString;
}
-
-cSerializeClass::cSerializeClass(const char *asName, const char *asParent,
- cSerializeMemberField *apMemberFields, size_t alSize,
- iSerializable *(*apCreateFunc)()) {
- gvSerializeTempClasses[glSerializeTempClassesNum] = cSerializeSavedClass(asName, asParent,
- apMemberFields, alSize, apCreateFunc);
-
- glSerializeTempClassesNum++;
-}
-
//-----------------------------------------------------------------------
void cSerializeClass::SetLog(bool abX) {
@@ -1073,9 +1037,9 @@ void cSerializeClass::SetUpData() {
mbDataSetup = true;
- for (int i = 0; i < glSerializeTempClassesNum; i++) {
+ for (int i = 0; i < Hpl1::nSerializeTempClasses; i++) {
m_mapSavedClasses.insert(tSerializeSavedClassMap::value_type(
- gvSerializeTempClasses[i].msName, gvSerializeTempClasses[i]));
+ Hpl1::serializeTempClasses[i].msName, Hpl1::serializeTempClasses[i]));
}
}
diff --git a/engines/hpl1/engine/system/SerializeClass.h b/engines/hpl1/engine/system/SerializeClass.h
index e7580b03dc6..4a2f3b07e12 100644
--- a/engines/hpl1/engine/system/SerializeClass.h
+++ b/engines/hpl1/engine/system/SerializeClass.h
@@ -96,8 +96,6 @@ typedef unsigned int eSerializeMainType;
//// HELPER DEFINES /////////////////////////////
/////////////////////////////////////////////////
-#define kMaxSerializeClasses 1000
-
#define ClassMemberOffset(aClass, aMember) (size_t(&(((aClass *)1)->aMember)) - 1)
#define ClassMemberSize(aClass, aMember) (sizeof(((aClass *)1)->aMember))
@@ -108,8 +106,7 @@ typedef unsigned int eSerializeMainType;
public: \
const static char *msSerialize_Name; \
const static char *msSerialize_ParentName; \
- const static cSerializeMemberField *mpSerialize_MemberFields; \
- const static cSerializeClass serializedClass_##aClass; \
+ static cSerializeMemberField *mpSerialize_MemberFields; \
virtual ~aClass() = default; \
virtual tString Serialize_GetTopClass() { return #aClass; }
@@ -117,8 +114,7 @@ public: \
public: \
const static char *msSerialize_Name; \
const static char *msSerialize_ParentName; \
- const static cSerializeMemberField *mpSerialize_MemberFields; \
- const static cSerializeClass serializedClass_##aClass; \
+ static cSerializeMemberField *mpSerialize_MemberFields; \
virtual tString Serialize_GetTopClass() { return #aClass; }
/**
@@ -128,11 +124,9 @@ public: \
namespace SerializeNamespace_##aClass { \
extern cSerializeMemberField mvTempMemberFields[]; \
} \
- static iSerializable *_Create_##aClass() { return hplNew(aClass, ()); } \
- const cSerializeClass aClass::serializedClass_##aClass(#aClass, #aParent, SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), _Create_##aClass); \
const char *aClass::msSerialize_Name = #aClass; \
const char *aClass::msSerialize_ParentName = #aParent; \
- const cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
+ cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
namespace SerializeNamespace_##aClass { \
typedef aClass tVarClass; \
cSerializeMemberField mvTempMemberFields[] = {
@@ -141,11 +135,9 @@ public: \
namespace SerializeNamespace_##aClass { \
extern cSerializeMemberField mvTempMemberFields[]; \
} \
- static iSerializable *_Create_##aClass() { return hplNew(aClass, ()); } \
- const cSerializeClass aClass::serializedClass_##aClass(#aClass, "", SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), _Create_##aClass); \
const char *aClass::msSerialize_Name = #aClass; \
const char *aClass::msSerialize_ParentName = ""; \
- const cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
+ cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
namespace SerializeNamespace_##aClass { \
typedef aClass tVarClass; \
cSerializeMemberField mvTempMemberFields[] = {
@@ -154,10 +146,9 @@ public: \
namespace SerializeNamespace_##aClass { \
extern cSerializeMemberField mvTempMemberFields[]; \
} \
- const cSerializeClass aClass::serializedClass_##aClass(#aClass, #aParent, SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), NULL); \
const char *aClass::msSerialize_Name = #aClass; \
const char *aClass::msSerialize_ParentName = #aParent; \
- const cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
+ cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
namespace SerializeNamespace_##aClass { \
typedef aClass tVarClass; \
cSerializeMemberField mvTempMemberFields[] = {
@@ -166,10 +157,9 @@ public: \
namespace SerializeNamespace_##aClass { \
extern cSerializeMemberField mvTempMemberFields[]; \
} \
- const cSerializeClass aClass::serializedClass_##aClass(#aClass, "", SerializeNamespace_##aClass::mvTempMemberFields, sizeof(aClass), NULL); \
const char *aClass::msSerialize_Name = #aClass; \
const char *aClass::msSerialize_ParentName = ""; \
- const cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
+ cSerializeMemberField *aClass::mpSerialize_MemberFields = SerializeNamespace_##aClass::mvTempMemberFields; \
namespace SerializeNamespace_##aClass { \
typedef aClass tVarClass; \
cSerializeMemberField mvTempMemberFields[] = {
@@ -254,20 +244,22 @@ public:
//-------------------------------------------------
-typedef struct cSerializeSavedClass {
+struct cSerializeSavedClass {
public:
- cSerializeSavedClass() {}
- cSerializeSavedClass(const char *asName, const char *asParent,
+ constexpr cSerializeSavedClass() = default;
+ constexpr cSerializeSavedClass(const char *asName, const char *asParent,
cSerializeMemberField *apMemberFields, size_t alSize,
- iSerializable *(*apCreateFunc)());
+ iSerializable *(*apCreateFunc)()) : msName(asName), msParentName(asParent), mpMemberFields(apMemberFields),
+ mlSize(alSize), mpCreateFunc(apCreateFunc)
+ {}
- const char *msName;
- const char *msParentName;
- cSerializeMemberField *mpMemberFields;
- size_t mlSize;
- iSerializable *(*mpCreateFunc)();
+ const char *msName = "";
+ const char *msParentName = "";
+ cSerializeMemberField *mpMemberFields = nullptr;
+ size_t mlSize = 0;
+ iSerializable *(*mpCreateFunc)() = nullptr;
-} cSerializeSavedClass;
+};
//-------------------------------------------------
@@ -293,9 +285,6 @@ typedef tSerializeSavedClassList::iterator tSerializeSavedClassListIt;
class cSerializeClass {
public:
- cSerializeClass(const char *asName, const char *asParent, cSerializeMemberField *apMemberFields,
- size_t alSize, iSerializable *(*apCreateFunc)());
-
static void SetLog(bool abX);
static bool GetLog();
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 0a6652443dc..f657ca3ecaf 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS := \
string.o \
opengl.o \
graphics.o \
+ serialize.o \
engine/ai/AI.o \
engine/ai/AINodeContainer.o \
engine/ai/AINodeGenerator.o \
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 378c8def580..8d05e64b261 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -73,6 +73,7 @@
#include "common/config-manager.h"
#include "hpl1/graphics.h"
+#include "hpl1/serialize.h"
// Global init...
cInit *gpInit;
@@ -246,6 +247,9 @@ static tString getStringConfig(const char *name, const tString &defaultVal) {
}
bool cInit::Init(tString saveToLoad) {
+ Hpl1::serializeInit();
+ Hpl1::engineSerializeInit();
+ Hpl1::penumbraOvertureSerializeInit();
SetWindowCaption("Penumbra Loading...");
// MAIN INIT /////////////////////
diff --git a/engines/hpl1/serialize.cpp b/engines/hpl1/serialize.cpp
new file mode 100644
index 00000000000..5dd74971f2d
--- /dev/null
+++ b/engines/hpl1/serialize.cpp
@@ -0,0 +1,170 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "serialize.h"
+
+#include "hpl1/engine/engine.h"
+#include "hpl1/engine/system/SerializeClass.h"
+
+#include "hpl1/penumbra-overture/Init.h"
+#include "hpl1/penumbra-overture/ButtonHandler.h"
+#include "hpl1/penumbra-overture/GameArea.h"
+#include "hpl1/penumbra-overture/GameDamageArea.h"
+#include "hpl1/penumbra-overture/GameEnemy.h"
+#include "hpl1/penumbra-overture/GameForceArea.h"
+#include "hpl1/penumbra-overture/GameItem.h"
+#include "hpl1/penumbra-overture/GameLadder.h"
+#include "hpl1/penumbra-overture/GameLamp.h"
+#include "hpl1/penumbra-overture/GameLink.h"
+#include "hpl1/penumbra-overture/GameLiquidArea.h"
+#include "hpl1/penumbra-overture/GameMessageHandler.h"
+#include "hpl1/penumbra-overture/GameObject.h"
+#include "hpl1/penumbra-overture/GameSaveArea.h"
+#include "hpl1/penumbra-overture/GameScripts.h"
+#include "hpl1/penumbra-overture/GameStickArea.h"
+#include "hpl1/penumbra-overture/GameSwingDoor.h"
+#include "hpl1/penumbra-overture/MapHandler.h"
+#include "hpl1/penumbra-overture/Player.h"
+
+#include "hpl1/penumbra-overture/AttackHandler.h"
+#include "hpl1/penumbra-overture/Credits.h"
+#include "hpl1/penumbra-overture/DeathMenu.h"
+#include "hpl1/penumbra-overture/DemoEndText.h"
+#include "hpl1/penumbra-overture/EffectHandler.h"
+#include "hpl1/penumbra-overture/FadeHandler.h"
+#include "hpl1/penumbra-overture/GameMusicHandler.h"
+#include "hpl1/penumbra-overture/GraphicsHelper.h"
+#include "hpl1/penumbra-overture/HapticGameCamera.h"
+#include "hpl1/penumbra-overture/Inventory.h"
+#include "hpl1/penumbra-overture/MapLoadText.h"
+#include "hpl1/penumbra-overture/Notebook.h"
+#include "hpl1/penumbra-overture/NumericalPanel.h"
+#include "hpl1/penumbra-overture/PlayerHands.h"
+#include "hpl1/penumbra-overture/PreMenu.h"
+#include "hpl1/penumbra-overture/RadioHandler.h"
+#include "hpl1/penumbra-overture/SaveHandler.h"
+#include "hpl1/penumbra-overture/TriggerHandler.h"
+
+namespace Hpl1 {
+
+#define SERIALIZE(klass, parent) serializeTempClasses[++nSerializeTempClasses] = cSerializeSavedClass(#klass, #parent, klass::mpSerialize_MemberFields, sizeof(klass), []() { return static_cast<iSerializable *>(new klass()); })
+#define SERIALIZE_BASE(klass) serializeTempClasses[++nSerializeTempClasses] = cSerializeSavedClass(#klass, "", klass::mpSerialize_MemberFields, sizeof(klass), []() { return static_cast<iSerializable *>(new klass()); })
+#define SERIALIZE_VIRTUAL(klass, parent) serializeTempClasses[++nSerializeTempClasses] = cSerializeSavedClass(#klass, #parent, klass::mpSerialize_MemberFields, sizeof(klass), nullptr)
+#define SERIALIZE_BASE_VIRTUAL(klass) serializeTempClasses[++nSerializeTempClasses] = cSerializeSavedClass(#klass, "", klass::mpSerialize_MemberFields, sizeof(klass), nullptr)
+
+using namespace hpl;
+
+cSerializeSavedClass serializeTempClasses[1000];
+int nSerializeTempClasses = 0;
+
+void engineSerializeInit() {
+ SERIALIZE_BASE_VIRTUAL(iSaveData);
+ SERIALIZE_BASE(cScriptVar);
+ SERIALIZE_BASE(cBoundingVolume);
+ SERIALIZE(cSaveData_cSoundEntity, cSaveData_iEntity3D);
+ SERIALIZE(cSaveData_cSubMeshEntity, cSaveData_iRenderable);
+ SERIALIZE_BASE(cAreaEntity);
+ SERIALIZE_BASE(cStartPosEntity);
+ SERIALIZE_BASE(cSaveData_cWorld3D);
+ SERIALIZE_VIRTUAL(cSaveData_iNode, iSaveData);
+ SERIALIZE(cSaveData_cNode3D, cSaveData_iNode);
+ SERIALIZE_BASE(cSaveData_cAnimationState);
+ SERIALIZE(cSaveData_cMeshEntity, cSaveData_iRenderable);
+ SERIALIZE_VIRTUAL(cSaveData_iEntity, iSaveData);
+ SERIALIZE(cSaveData_cLight3DSpot, cSaveData_iLight3D);
+ SERIALIZE_VIRTUAL(cSaveData_iEntity3D, cSaveData_iEntity);
+ SERIALIZE_VIRTUAL(cSaveData_iLight3D, cSaveData_iRenderable);
+ SERIALIZE(cSaveData_cLight3DPoint, cSaveData_iLight3D);
+ SERIALIZE(cSaveData_iPhysicsJointHinge, cSaveData_iPhysicsJoint);
+ SERIALIZE(cSaveData_iPhysicsBody, cSaveData_iEntity3D);
+ SERIALIZE_BASE(cSaveData_iCollideShape);
+ SERIALIZE(cSaveData_iPhysicsJointBall, cSaveData_iPhysicsJoint);
+ SERIALIZE_BASE(cJointLimitEffect);
+ SERIALIZE_VIRTUAL(cSaveData_iPhysicsJoint, iSaveData);
+ SERIALIZE_BASE(cSaveData_iPhysicsController);
+ SERIALIZE(cSaveData_iCharacterBody, iSaveData);
+ SERIALIZE(cSaveData_iPhysicsJointSlider, cSaveData_iPhysicsJoint);
+ SERIALIZE(cSaveData_iPhysicsJointScrew, cSaveData_iPhysicsJoint);
+ SERIALIZE_VIRTUAL(cSaveData_iRenderable, cSaveData_iEntity3D);
+ SERIALIZE(cSaveData_cBillboard, cSaveData_iRenderable);
+ SERIALIZE(cSaveData_iParticleEmitter3D, cSaveData_iRenderable);
+ SERIALIZE(cSaveData_cParticleSystem3D, cSaveData_iEntity3D);
+ SERIALIZE_BASE(cSaveData_ParticleEmitter3D);
+}
+
+void penumbraOvertureSerializeInit() {
+ SERIALIZE_BASE(cInventoryUseCallback);
+ SERIALIZE_BASE(cInventoryPickupCallback);
+ SERIALIZE_BASE(cInventoryCombineCallback);
+ SERIALIZE_BASE(cSaveData_cInventory);
+ SERIALIZE(cGameLiquidArea_SaveData, iGameEntity_SaveData);
+ SERIALIZE(cGameLamp_SaveData, iGameEntity_SaveData);
+ SERIALIZE_BASE(cEngineBody_SaveData);
+ SERIALIZE_BASE(cEngineJointController_SaveData);
+ SERIALIZE_BASE(cEngineJoint_SaveData);
+ SERIALIZE_BASE(cEnginePSEmitter_SaveData);
+ SERIALIZE_BASE(cEnginePS_SaveData);
+ SERIALIZE_BASE(cEngineBeam_SaveData);
+ SERIALIZE_BASE(cEngineSound_SaveData);
+ SERIALIZE_BASE(cEngineLightAttachBB_SaveData);
+ SERIALIZE_BASE(cEngineLight_SaveData);
+ SERIALIZE(cGameLink_SaveData, iGameEntity_SaveData);
+ SERIALIZE(cGameForceArea_SaveData, iGameEntity_SaveData);
+ SERIALIZE(cGameObject_SaveData, iGameEntity_SaveData);
+ SERIALIZE(cGameItem_SaveData, iGameEntity_SaveData);
+ SERIALIZE(cGameStickArea_SaveData, iGameEntity_SaveData);
+ SERIALIZE_BASE(cSaveData_cPlayer);
+ SERIALIZE(cGameLadder_SaveData, iGameEntity_SaveData);
+ SERIALIZE(cGameDamageArea_SaveData, iGameEntity_SaveData);
+ SERIALIZE(cGameSaveArea_SaveData, iGameEntity_SaveData);
+ SERIALIZE(cGameSwingDoor_SaveData, iGameEntity_SaveData);
+ SERIALIZE_BASE(cGameEntityScript);
+ SERIALIZE_BASE(cGameEntityAnimation_SaveData);
+ SERIALIZE_BASE_VIRTUAL(iGameEntity_SaveData);
+ SERIALIZE(cGameArea_SaveData, iGameEntity_SaveData);
+ SERIALIZE_BASE(cMusic_GlobalSave);
+ SERIALIZE_BASE(cGameMusic_GlobalSave);
+ SERIALIZE_BASE(cGameMusicHandler_GlobalSave);
+ SERIALIZE_BASE(cNotebookTask_GlobalSave);
+ SERIALIZE_BASE(cNotebookNote_GlobalSave);
+ SERIALIZE_BASE(cNotebook_GlobalSave);
+ SERIALIZE_BASE(cInventorySlot_GlobalSave);
+ SERIALIZE_BASE(cInventoryItem_GlobalSave);
+ SERIALIZE_BASE(cInventory_GlobalSave);
+ SERIALIZE_BASE(cSceneLoadedMap_GlobalSave);
+ SERIALIZE_BASE(cMapHandlerLoadedMap_GlobalSave);
+ SERIALIZE_BASE(cMapHandlerTimer_GlobalSave);
+ SERIALIZE_BASE(cMapHandler_GlobalSave);
+ SERIALIZE_BASE(cPlayer_GlobalSave_CameraPS);
+ SERIALIZE_BASE(cPlayer_GlobalSave);
+ SERIALIZE_BASE(cSavedWorld);
+ SERIALIZE_BASE(cSavedGame);
+ SERIALIZE_BASE(cGameTimer);
+ SERIALIZE_BASE(cSaveGame_cGameCollideScript);
+ SERIALIZE(iGameEnemy_SaveData, iGameEntity_SaveData);
+ SERIALIZE_BASE(cEnemyPatrolNode);
+}
+
+void serializeInit() {
+ nSerializeTempClasses = 0;
+}
+
+} // namespace hpl
diff --git a/engines/hpl1/serialize.h b/engines/hpl1/serialize.h
new file mode 100644
index 00000000000..e5def16005b
--- /dev/null
+++ b/engines/hpl1/serialize.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HPL1_SERIALIZE_H
+#define HPL1_SERIALIZE_H
+
+namespace hpl {
+class cSerializeSavedClass;
+}
+
+namespace Hpl1 {
+
+extern hpl::cSerializeSavedClass serializeTempClasses[];
+extern int nSerializeTempClasses;
+
+void serializeInit();
+
+void engineSerializeInit();
+
+void penumbraOvertureSerializeInit();
+
+} // namespace Hpl1
+
+#endif // HPL1_SERIALIZE_H
Commit: 43a5b6f3adb25701e2cf377b21d05ff954ef8d9d
https://github.com/scummvm/scummvm/commit/43a5b6f3adb25701e2cf377b21d05ff954ef8d9d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:19+01:00
Commit Message:
HPL1: Fix warning
Changed paths:
engines/hpl1/serialize.h
diff --git a/engines/hpl1/serialize.h b/engines/hpl1/serialize.h
index e5def16005b..7c96db8a9b5 100644
--- a/engines/hpl1/serialize.h
+++ b/engines/hpl1/serialize.h
@@ -23,7 +23,7 @@
#define HPL1_SERIALIZE_H
namespace hpl {
-class cSerializeSavedClass;
+struct cSerializeSavedClass;
}
namespace Hpl1 {
Commit: 0fb2d3c8db008c76d661dce241508294fbd79edc
https://github.com/scummvm/scummvm/commit/0fb2d3c8db008c76d661dce241508294fbd79edc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:19+01:00
Commit Message:
HPL1: Fix more warnings
Changed paths:
engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
engines/hpl1/engine/libraries/newton/Newton.cpp
engines/hpl1/engine/libraries/newton/Newton.h
engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
engines/hpl1/engine/libraries/newton/core/dgCRC.cpp
engines/hpl1/engine/libraries/newton/core/dgTree.h
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
index 76e74228b28..866e801dc72 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
@@ -1060,7 +1060,7 @@ bool CScriptArray::Equals(const void *a, const void *b, asIScriptContext *ctx, S
if (subTypeId & asTYPEID_OBJHANDLE) {
// Allow the find to work even if the array contains null handles
- if (*(const void **)a == *(const void **)b) return true;
+ if (*(const void * const *)a == *(const void * const *)b) return true;
}
// Execute object opEquals if available
@@ -1070,9 +1070,9 @@ bool CScriptArray::Equals(const void *a, const void *b, asIScriptContext *ctx, S
assert(r >= 0);
if (subTypeId & asTYPEID_OBJHANDLE) {
- r = ctx->SetObject(*((void **)a));
+ r = ctx->SetObject(*((void * const *)a));
assert(r >= 0);
- r = ctx->SetArgObject(0, *((void **)b));
+ r = ctx->SetArgObject(0, *((void * const *)b));
assert(r >= 0);
} else {
r = ctx->SetObject((void *)a);
@@ -1096,9 +1096,9 @@ bool CScriptArray::Equals(const void *a, const void *b, asIScriptContext *ctx, S
assert(r >= 0);
if (subTypeId & asTYPEID_OBJHANDLE) {
- r = ctx->SetObject(*((void **)a));
+ r = ctx->SetObject(*((void * const *)a));
assert(r >= 0);
- r = ctx->SetArgObject(0, *((void **)b));
+ r = ctx->SetArgObject(0, *((void * const *)b));
assert(r >= 0);
} else {
r = ctx->SetObject((void *)a);
@@ -1130,7 +1130,7 @@ int CScriptArray::FindByRef(asUINT startAt, void *ref) const {
// Dereference the pointer
ref = *(void **)ref;
for (asUINT i = startAt; i < size; i++) {
- if (*(void **)At(i) == ref)
+ if (*(void * const *)At(i) == ref)
return i;
}
} else {
diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
index f2cc31b6652..20897ee51d8 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.cpp
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -177,7 +177,7 @@ NewtonWorld *NewtonCreate() {
void NewtonDestroy(const NewtonWorld *const newtonWorld) {
TRACE_FUNTION(__FUNCTION__);
- Newton *const world = (Newton *)newtonWorld;
+ const Newton *const world = (const Newton *)newtonWorld;
dgMemoryAllocator *const allocator = world->dgWorld::GetAllocator();
delete world;
@@ -7986,38 +7986,38 @@ NewtonMesh *NewtonMeshVoronoiDecomposition(const NewtonMesh *const mesh,
return (NewtonMesh *)((dgMeshEffect *)mesh)->CreateVoronoiPartition(pointCount, pointStrideInBytes, pointCloud, internalMaterial, tetMatrix);
}
-NewtonMesh *NewtonMeshUnion(const NewtonMesh *const mesh,
+NewtonMesh *NewtonMeshUnion(NewtonMesh *const mesh,
const NewtonMesh *const clipper, const dFloat *const clipperMatrix) {
TRACE_FUNTION(__FUNCTION__);
dgMatrix &matrix = *((dgMatrix *)clipperMatrix);
- return (NewtonMesh *)((dgMeshEffect *)mesh)->Union(matrix, (dgMeshEffect *)clipper);
+ return (NewtonMesh *)((dgMeshEffect *)mesh)->Union(matrix, (const dgMeshEffect *)clipper);
}
-NewtonMesh *NewtonMeshDifference(const NewtonMesh *const mesh,
+NewtonMesh *NewtonMeshDifference(NewtonMesh *const mesh,
const NewtonMesh *const clipper, const dFloat *const clipperMatrix) {
TRACE_FUNTION(__FUNCTION__);
- dgMatrix &matrix = *((dgMatrix *)clipperMatrix);
+ const dgMatrix &matrix = *((const dgMatrix *)clipperMatrix);
- return (NewtonMesh *)((dgMeshEffect *)mesh)->Difference(matrix, (dgMeshEffect *)clipper);
+ return (NewtonMesh *)((dgMeshEffect *)mesh)->Difference(matrix, (const dgMeshEffect *)clipper);
}
-NewtonMesh *NewtonMeshIntersection(const NewtonMesh *const mesh,
+NewtonMesh *NewtonMeshIntersection(NewtonMesh *const mesh,
const NewtonMesh *const clipper, const dFloat *const clipperMatrix) {
TRACE_FUNTION(__FUNCTION__);
- dgMatrix &matrix = *((dgMatrix *)clipperMatrix);
+ const dgMatrix &matrix = *((const dgMatrix *)clipperMatrix);
- return (NewtonMesh *)((dgMeshEffect *)mesh)->Intersection(matrix, (dgMeshEffect *)clipper);
+ return (NewtonMesh *)((dgMeshEffect *)mesh)->Intersection(matrix, (const dgMeshEffect *)clipper);
}
-void NewtonRemoveUnusedVertices(const NewtonMesh *const mesh,
+void NewtonRemoveUnusedVertices(NewtonMesh *const mesh,
int *const vertexRemapTable) {
TRACE_FUNTION(__FUNCTION__);
((dgMeshEffect *)mesh)->RemoveUnusedVertices(vertexRemapTable);
}
-void NewtonMeshBeginFace(const NewtonMesh *const mesh) {
+void NewtonMeshBeginFace(NewtonMesh *const mesh) {
dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
@@ -8025,7 +8025,7 @@ void NewtonMeshBeginFace(const NewtonMesh *const mesh) {
meshEffect->BeginPolygon();
}
-void NewtonMeshAddFace(const NewtonMesh *const mesh, int vertexCount,
+void NewtonMeshAddFace(NewtonMesh *const mesh, int vertexCount,
const dFloat *const vertex, int strideInBytes, int materialIndex) {
dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
@@ -8033,14 +8033,14 @@ void NewtonMeshAddFace(const NewtonMesh *const mesh, int vertexCount,
meshEffect->AddPolygon(vertexCount, vertex, strideInBytes, materialIndex);
}
-void NewtonMeshEndFace(const NewtonMesh *const mesh) {
+void NewtonMeshEndFace(NewtonMesh *const mesh) {
dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
meshEffect->EndPolygon(dgFloat64(1.0e-8f));
}
-void NewtonMeshBuildFromVertexListIndexList(const NewtonMesh *const mesh,
+void NewtonMeshBuildFromVertexListIndexList(NewtonMesh *const mesh,
int faceCount, const int *const faceIndexCount,
const int *const faceMaterialIndex, const dFloat *const vertex,
int vertexStrideInBytes, const int *const vertexIndex,
@@ -8059,7 +8059,7 @@ void NewtonMeshBuildFromVertexListIndexList(const NewtonMesh *const mesh,
int NewtonMeshGetVertexCount(const NewtonMesh *const mesh) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
// return meshEffect->GetPropertiesCount();
@@ -8067,21 +8067,21 @@ int NewtonMeshGetVertexCount(const NewtonMesh *const mesh) {
}
int NewtonMeshGetVertexStrideInByte(const NewtonMesh *const mesh) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->GetVertexStrideInByte();
}
dFloat64 *NewtonMeshGetVertexArray(const NewtonMesh *const mesh) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->GetVertexPool();
}
int NewtonMeshGetPointCount(const NewtonMesh *const mesh) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->GetPropertiesCount();
@@ -8089,35 +8089,35 @@ int NewtonMeshGetPointCount(const NewtonMesh *const mesh) {
int NewtonMeshGetPointStrideInByte(const NewtonMesh *const mesh) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->GetPropertiesStrideInByte();
}
dFloat64 *NewtonMeshGetPointArray(const NewtonMesh *const mesh) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->GetAttributePool();
}
dFloat64 *NewtonMeshGetNormalArray(const NewtonMesh *const mesh) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->GetNormalPool();
}
dFloat64 *NewtonMeshGetUV0Array(const NewtonMesh *const mesh) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->GetUV0Pool();
}
dFloat64 *NewtonMeshGetUV1Array(const NewtonMesh *const mesh) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->GetUV1Pool();
@@ -8128,7 +8128,7 @@ void NewtonMeshGetVertexStreams(const NewtonMesh *const mesh,
dFloat *const normal, dgInt32 uvStrideInByte0, dFloat *const uv0,
dgInt32 uvStrideInByte1, dFloat *const uv1) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
meshEffect->GetVertexStreams(vetexStrideInByte, (dgFloat32 *)vertex,
@@ -8146,7 +8146,7 @@ void NewtonMeshGetIndirectVertexStreams(const NewtonMesh *const mesh,
_ASSERTE(0);
/*
- dgMeshEffect* const meshEffect = (dgMeshEffect*) mesh;
+ const dgMeshEffect* const meshEffect = (const dgMeshEffect*) mesh;
TRACE_FUNTION(__FUNCTION__);
meshEffect->GetIndirectVertexStreams (vetexStrideInByte, (dgFloat32*) vertex, (dgInt32*) vertexIndices, (dgInt32*) vertexCount,
@@ -8158,7 +8158,7 @@ void NewtonMeshGetIndirectVertexStreams(const NewtonMesh *const mesh,
void *NewtonMeshBeginHandle(const NewtonMesh *const mesh) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->MaterialGeometryBegin();
@@ -8166,7 +8166,7 @@ void *NewtonMeshBeginHandle(const NewtonMesh *const mesh) {
void NewtonMeshEndHandle(const NewtonMesh *const mesh, void *const handle) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
@@ -8175,7 +8175,7 @@ void NewtonMeshEndHandle(const NewtonMesh *const mesh, void *const handle) {
int NewtonMeshFirstMaterial(const NewtonMesh *const mesh, void *const handle) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->GetFirstMaterial((dgMeshEffect::dgIndexArray *)handle);
@@ -8184,7 +8184,7 @@ int NewtonMeshFirstMaterial(const NewtonMesh *const mesh, void *const handle) {
int NewtonMeshNextMaterial(const NewtonMesh *const mesh, void *const handle,
int materialId) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->GetNextMaterial((dgMeshEffect::dgIndexArray *)handle,
@@ -8194,7 +8194,7 @@ int NewtonMeshNextMaterial(const NewtonMesh *const mesh, void *const handle,
int NewtonMeshMaterialGetMaterial(const NewtonMesh *const mesh,
void *const handle, int materialId) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->GetMaterialID((dgMeshEffect::dgIndexArray *)handle,
@@ -8204,7 +8204,7 @@ int NewtonMeshMaterialGetMaterial(const NewtonMesh *const mesh,
int NewtonMeshMaterialGetIndexCount(const NewtonMesh *const mesh,
void *const handle, int materialId) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
return meshEffect->GetMaterialIndexCount((dgMeshEffect::dgIndexArray *)handle,
@@ -8214,7 +8214,7 @@ int NewtonMeshMaterialGetIndexCount(const NewtonMesh *const mesh,
void NewtonMeshMaterialGetIndexStream(const NewtonMesh *const mesh,
void *const handle, int materialId, int *const index) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
meshEffect->GetMaterialGetIndexStream((dgMeshEffect::dgIndexArray *)handle,
@@ -8223,7 +8223,7 @@ void NewtonMeshMaterialGetIndexStream(const NewtonMesh *const mesh,
void NewtonMeshMaterialGetIndexStreamShort(const NewtonMesh *const mesh,
void *const handle, int materialId, short int *const index) {
- dgMeshEffect *const meshEffect = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const meshEffect = (const dgMeshEffect *)mesh;
TRACE_FUNTION(__FUNCTION__);
meshEffect->GetMaterialGetIndexStreamShort(
(dgMeshEffect::dgIndexArray *)handle, materialId, index);
@@ -8232,7 +8232,7 @@ void NewtonMeshMaterialGetIndexStreamShort(const NewtonMesh *const mesh,
NewtonMesh *NewtonMeshCreateFirstSingleSegment(const NewtonMesh *const mesh) {
TRACE_FUNTION(__FUNCTION__);
- dgMeshEffect *const effectMesh = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const effectMesh = (const dgMeshEffect *)mesh;
dgPolyhedra segment(effectMesh->GetAllocator());
@@ -8250,7 +8250,7 @@ NewtonMesh *NewtonMeshCreateNextSingleSegment(const NewtonMesh *const mesh,
const NewtonMesh *const segment) {
TRACE_FUNTION(__FUNCTION__);
- dgMeshEffect *const effectMesh = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const effectMesh = (const dgMeshEffect *)mesh;
dgPolyhedra nextSegment(effectMesh->GetAllocator());
_ASSERTE(segment);
@@ -8271,7 +8271,7 @@ NewtonMesh *NewtonMeshCreateNextSingleSegment(const NewtonMesh *const mesh,
NewtonMesh *NewtonMeshCreateFirstLayer(const NewtonMesh *const mesh) {
TRACE_FUNTION(__FUNCTION__);
- dgMeshEffect *const effectMesh = (dgMeshEffect *)mesh;
+ const dgMeshEffect *const effectMesh = (const dgMeshEffect *)mesh;
return (NewtonMesh *)effectMesh->GetFirstLayer();
}
@@ -8279,79 +8279,79 @@ NewtonMesh *NewtonMeshCreateNextLayer(const NewtonMesh *const mesh,
const NewtonMesh *const segment) {
TRACE_FUNTION(__FUNCTION__);
- dgMeshEffect *const effectMesh = (dgMeshEffect *)mesh;
- return (NewtonMesh *)effectMesh->GetNextLayer((dgMeshEffect *)segment);
+ const dgMeshEffect *const effectMesh = (const dgMeshEffect *)mesh;
+ return (NewtonMesh *)effectMesh->GetNextLayer((const dgMeshEffect *)segment);
}
int NewtonMeshGetTotalFaceCount(const NewtonMesh *const mesh) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetTotalFaceCount();
+ return ((const dgMeshEffect *)mesh)->GetTotalFaceCount();
}
int NewtonMeshGetTotalIndexCount(const NewtonMesh *const mesh) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetTotalIndexCount();
+ return ((const dgMeshEffect *)mesh)->GetTotalIndexCount();
}
void NewtonMeshGetFaces(const NewtonMesh *const mesh, int *const faceIndexCount,
int *const faceMaterial, void **const faceIndices) {
- ((dgMeshEffect *)mesh)->GetFaces(faceIndexCount, faceMaterial, faceIndices);
+ ((const dgMeshEffect *)mesh)->GetFaces(faceIndexCount, faceMaterial, faceIndices);
}
void *NewtonMeshGetFirstVertex(const NewtonMesh *const mesh) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetFirstVertex();
+ return ((const dgMeshEffect *)mesh)->GetFirstVertex();
}
void *NewtonMeshGetNextVertex(const NewtonMesh *const mesh,
const void *const vertex) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetNextVertex(vertex);
+ return ((const dgMeshEffect *)mesh)->GetNextVertex(vertex);
}
int NewtonMeshGetVertexIndex(const NewtonMesh *const mesh,
const void *const vertex) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetVertexIndex(vertex);
+ return ((const dgMeshEffect *)mesh)->GetVertexIndex(vertex);
}
void *NewtonMeshGetFirstPoint(const NewtonMesh *const mesh) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetFirstPoint();
+ return ((const dgMeshEffect *)mesh)->GetFirstPoint();
}
void *NewtonMeshGetNextPoint(const NewtonMesh *const mesh,
const void *const point) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetNextPoint(point);
+ return ((const dgMeshEffect *)mesh)->GetNextPoint(point);
}
int NewtonMeshGetPointIndex(const NewtonMesh *const mesh,
const void *const point) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetPointIndex(point);
+ return ((const dgMeshEffect *)mesh)->GetPointIndex(point);
}
int NewtonMeshGetVertexIndexFromPoint(const NewtonMesh *const mesh,
const void *const point) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetVertexIndexFromPoint(point);
+ return ((const dgMeshEffect *)mesh)->GetVertexIndexFromPoint(point);
}
void *NewtonMeshGetFirstEdge(const NewtonMesh *const mesh) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetFirstEdge();
+ return ((const dgMeshEffect *)mesh)->GetFirstEdge();
}
void *NewtonMeshGetNextEdge(const NewtonMesh *const mesh,
const void *const edge) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetNextEdge(edge);
+ return ((const dgMeshEffect *)mesh)->GetNextEdge(edge);
}
void NewtonMeshGetEdgeIndices(const NewtonMesh *const mesh,
const void *const edge, int *const v0, int *const v1) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetEdgeIndex(edge, *v0, *v1);
+ return ((const dgMeshEffect *)mesh)->GetEdgeIndex(edge, *v0, *v1);
}
// void NewtonMeshGetEdgePointIndices (const NewtonMesh* const mesh, const void* const edge, int* const v0, int* const v1)
@@ -8361,42 +8361,42 @@ void NewtonMeshGetEdgeIndices(const NewtonMesh *const mesh,
void *NewtonMeshGetFirstFace(const NewtonMesh *const mesh) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetFirstFace();
+ return ((const dgMeshEffect *)mesh)->GetFirstFace();
}
void *NewtonMeshGetNextFace(const NewtonMesh *const mesh,
const void *const face) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetNextFace(face);
+ return ((const dgMeshEffect *)mesh)->GetNextFace(face);
}
int NewtonMeshIsFaceOpen(const NewtonMesh *const mesh, const void *const face) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->IsFaceOpen(face);
+ return ((const dgMeshEffect *)mesh)->IsFaceOpen(face);
}
int NewtonMeshGetFaceIndexCount(const NewtonMesh *const mesh,
const void *const face) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetFaceIndexCount(face);
+ return ((const dgMeshEffect *)mesh)->GetFaceIndexCount(face);
}
int NewtonMeshGetFaceMaterial(const NewtonMesh *const mesh,
const void *const face) {
TRACE_FUNTION(__FUNCTION__);
- return ((dgMeshEffect *)mesh)->GetFaceMaterial(face);
+ return ((const dgMeshEffect *)mesh)->GetFaceMaterial(face);
}
void NewtonMeshGetFaceIndices(const NewtonMesh *const mesh,
const void *const face, int *const indices) {
TRACE_FUNTION(__FUNCTION__);
- ((dgMeshEffect *)mesh)->GetFaceIndex(face, indices);
+ ((const dgMeshEffect *)mesh)->GetFaceIndex(face, indices);
}
void NewtonMeshGetFacePointIndices(const NewtonMesh *const mesh,
const void *const face, int *const indices) {
TRACE_FUNTION(__FUNCTION__);
- ((dgMeshEffect *)mesh)->GetFaceAttributeIndex(face, indices);
+ ((const dgMeshEffect *)mesh)->GetFaceAttributeIndex(face, indices);
}
#if 0
diff --git a/engines/hpl1/engine/libraries/newton/Newton.h b/engines/hpl1/engine/libraries/newton/Newton.h
index a4120ba0059..61900471fc2 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.h
+++ b/engines/hpl1/engine/libraries/newton/Newton.h
@@ -1018,6 +1018,3 @@ NEWTON_API void NewtonMeshGetFacePointIndices(const NewtonMesh *const mesh, cons
#endif
#endif
-
-
-
diff --git a/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp b/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
index b0b79c10782..ac041541b70 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
@@ -890,7 +890,7 @@ public:
stack--;
const dgAABBTree *const me = stackPool[stack];
- if (me->BoxIntersectSimd((dgTriplex *) vertexArray, min, max) >= 0) {
+ if (me->BoxIntersectSimd((const dgTriplex *)vertexArray, min, max) >= 0) {
if (me->m_back.IsLeaf()) {
dgInt32 index = dgInt32(me->m_back.GetIndex());
@@ -938,7 +938,7 @@ public:
stack--;
const dgAABBTree *const me = stackPool[stack];
- if (me->BoxIntersect((dgTriplex *) vertexArray, min, max) >= 0) {
+ if (me->BoxIntersect((const dgTriplex *)vertexArray, min, max) >= 0) {
if (me->m_back.IsLeaf()) {
dgInt32 index = dgInt32(me->m_back.GetIndex());
@@ -983,7 +983,7 @@ public:
stack--;
const dgAABBTree *const me = stackPool[stack];
- if (me->RayTestSimd(ray, (dgTriplex *) vertexArray)) {
+ if (me->RayTestSimd(ray, (const dgTriplex *)vertexArray)) {
if (me->m_back.IsLeaf()) {
dgInt32 vCount = dgInt32((me->m_back.GetCount() >> 1) - 1);
@@ -1046,7 +1046,7 @@ public:
while (stack) {
stack--;
const dgAABBTree *const me = stackPool[stack];
- if (me->RayTest(ray, (dgTriplex *) vertexArray)) {
+ if (me->RayTest(ray, (const dgTriplex *)vertexArray)) {
if (me->m_back.IsLeaf()) {
dgInt32 vCount = dgInt32((me->m_back.GetCount() >> 1) - 1);
@@ -1103,7 +1103,7 @@ public:
dgInt32 stack = 1;
stackPool[0] = this;
aabbProjection[0] = dgFloat32(1.0e10f);
- const dgTriplex *const boxArray = (dgTriplex *) vertexArray;
+ const dgTriplex *const boxArray = (const dgTriplex *)vertexArray;
dgVector supportVertex(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
dgFloat32(0.0f));
@@ -1329,18 +1329,18 @@ void *dgAABBPolygonSoup::GetRootNode() const {
}
void *dgAABBPolygonSoup::GetBackNode(const void *const root) const {
- dgAABBTree *const node = (dgAABBTree *) root;
+ const dgAABBTree *const node = (const dgAABBTree *)root;
return node->m_back.IsLeaf() ? NULL : node->m_back.GetNode(m_aabb);
}
void *dgAABBPolygonSoup::GetFrontNode(const void *const root) const {
- dgAABBTree *const node = (dgAABBTree *) root;
+ const dgAABBTree *const node = (const dgAABBTree *)root;
return node->m_front.IsLeaf() ? NULL : node->m_front.GetNode(m_aabb);
}
void dgAABBPolygonSoup::GetNodeAABB(const void *const root, dgVector &p0,
dgVector &p1) const {
- dgAABBTree *const node = (dgAABBTree *) root;
+ const dgAABBTree *const node = (const dgAABBTree *)root;
const dgTriplex *const vertex = (dgTriplex *) m_localVertex;
p0 = dgVector(vertex[node->m_minIndex].m_x, vertex[node->m_minIndex].m_y,
diff --git a/engines/hpl1/engine/libraries/newton/core/dgCRC.cpp b/engines/hpl1/engine/libraries/newton/core/dgCRC.cpp
index 87c5296ff4a..fa55bd923f9 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgCRC.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgCRC.cpp
@@ -332,7 +332,7 @@ dgUnsigned32 dgApi dgCRC(const char *const name) {
dgUnsigned32 dgApi dgCRC(const void *const buffer, dgInt32 size,
dgUnsigned32 crcAcc) {
_ASSERTE(buffer);
- unsigned char *const ptr = (unsigned char *) buffer;
+ const unsigned char *const ptr = (const unsigned char *) buffer;
for (dgInt32 i = 0; i < size; i++) {
dgUnsigned32 c = ptr[i];
dgUnsigned32 val = InternalCRC::randBits[((crcAcc >> 24) ^ c) & 0xff];
@@ -348,5 +348,5 @@ const char *dgApi dgInverseCRC(dgUnsigned32 crc) {
}
dgUnsigned32 dgApi dgHash(const void *const string, int size) {
- return InternalCRC::DJBHash((char *) string, size);
+ return InternalCRC::DJBHash((const char *)string, size);
}
diff --git a/engines/hpl1/engine/libraries/newton/core/dgTree.h b/engines/hpl1/engine/libraries/newton/core/dgTree.h
index 5e781fd2dcc..23b44ffd38e 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgTree.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgTree.h
@@ -780,5 +780,3 @@ void dgTree<OBJECT, KEY>::SwapInfo(dgTree<OBJECT, KEY> &tree) {
#endif
-
-
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
index ce48a24ff04..a74a130fb39 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
@@ -1699,7 +1699,7 @@ void dgMeshEffect::GetFaces(dgInt32 *const facesIndex, dgInt32 *const materials,
}
}
-void *dgMeshEffect::GetFirstVertex() {
+void *dgMeshEffect::GetFirstVertex() const {
_ASSERTE(0);
return 0;
/*
@@ -1723,7 +1723,7 @@ void *dgMeshEffect::GetFirstVertex() {
*/
}
-void *dgMeshEffect::GetNextVertex(const void *vertex) {
+void *dgMeshEffect::GetNextVertex(const void *vertex) const {
dgTreeNode *const node = (dgTreeNode *)vertex;
dgInt32 mark = node->GetInfo().m_mark;
@@ -1750,7 +1750,7 @@ dgInt32 dgMeshEffect::GetVertexIndex(const void *vertex) const {
return edge->m_incidentVertex;
}
-void *dgMeshEffect::GetFirstPoint() {
+void *dgMeshEffect::GetFirstPoint() const {
Iterator iter(*this);
for (iter.Begin(); iter; iter++) {
dgTreeNode *const nodeI = iter.GetNode();
@@ -1762,7 +1762,7 @@ void *dgMeshEffect::GetFirstPoint() {
return NULL;
}
-void *dgMeshEffect::GetNextPoint(const void *const point) {
+void *dgMeshEffect::GetNextPoint(const void *const point) const {
Iterator iter(*this);
iter.Set((dgTreeNode *)point);
for (iter++; iter; iter++) {
@@ -1822,7 +1822,7 @@ dgEdge *dgMeshEffect::ConectVertex(dgEdge *const e0, dgEdge *const e1) {
// return int (edge->m_userData);
// }
-void *dgMeshEffect::GetFirstEdge() {
+void *dgMeshEffect::GetFirstEdge() const {
Iterator iter(*this);
iter.Begin();
@@ -1839,7 +1839,7 @@ void *dgMeshEffect::GetFirstEdge() {
return node;
}
-void *dgMeshEffect::GetNextEdge(const void *edge) {
+void *dgMeshEffect::GetNextEdge(const void *edge) const {
dgTreeNode *const node = (dgTreeNode *)edge;
dgInt32 mark = node->GetInfo().m_mark;
@@ -1870,7 +1870,7 @@ void dgMeshEffect::GetEdgeIndex(const void *edge, dgInt32 &v0,
// v1 = int (node->GetInfo().m_twin->m_userData);
// }
-void *dgMeshEffect::GetFirstFace() {
+void *dgMeshEffect::GetFirstFace() const {
Iterator iter(*this);
iter.Begin();
@@ -1890,7 +1890,7 @@ void *dgMeshEffect::GetFirstFace() {
return node;
}
-void *dgMeshEffect::GetNextFace(const void *const face) {
+void *dgMeshEffect::GetNextFace(const void *const face) const {
dgTreeNode *const node = (dgTreeNode *)face;
dgInt32 mark = node->GetInfo().m_mark;
@@ -2020,7 +2020,7 @@ void dgMeshEffect::GetFaceAttributeIndex(const void *const face, int *const indi
void dgMeshEffect::GetVertexStreams(dgInt32 vetexStrideInByte,
dgFloat32 *const vertex, dgInt32 normalStrideInByte,
dgFloat32 *const normal, dgInt32 uvStrideInByte0, dgFloat32 *const uv0,
- dgInt32 uvStrideInByte1, dgFloat32 *const uv1) {
+ dgInt32 uvStrideInByte1, dgFloat32 *const uv1) const {
uvStrideInByte0 /= sizeof(dgFloat32);
uvStrideInByte1 /= sizeof(dgFloat32);
vetexStrideInByte /= sizeof(dgFloat32);
@@ -2091,7 +2091,7 @@ void dgMeshEffect::GetIndirectVertexStreams(dgInt32 vetexStrideInByte,
*/
}
-dgMeshEffect::dgIndexArray *dgMeshEffect::MaterialGeometryBegin() {
+dgMeshEffect::dgIndexArray *dgMeshEffect::MaterialGeometryBegin() const {
dgInt32 materials[256];
dgInt32 streamIndexMap[256];
@@ -2154,15 +2154,15 @@ dgMeshEffect::dgIndexArray *dgMeshEffect::MaterialGeometryBegin() {
return array;
}
-void dgMeshEffect::MaterialGeomteryEnd(dgIndexArray *handle) {
+void dgMeshEffect::MaterialGeomteryEnd(dgIndexArray *handle) const {
GetAllocator()->FreeLow(handle);
}
-dgInt32 dgMeshEffect::GetFirstMaterial(dgIndexArray *handle) {
+dgInt32 dgMeshEffect::GetFirstMaterial(dgIndexArray *handle)const {
return GetNextMaterial(handle, -1);
}
-dgInt32 dgMeshEffect::GetNextMaterial(dgIndexArray *const handle, dgInt32 materialId) {
+dgInt32 dgMeshEffect::GetNextMaterial(dgIndexArray *const handle, dgInt32 materialId) const {
materialId++;
if (materialId >= handle->m_materialCount) {
materialId = -1;
@@ -2171,7 +2171,7 @@ dgInt32 dgMeshEffect::GetNextMaterial(dgIndexArray *const handle, dgInt32 materi
}
void dgMeshEffect::GetMaterialGetIndexStream(dgIndexArray *const handle,
- dgInt32 materialHandle, dgInt32 *const indexArray) {
+ dgInt32 materialHandle, dgInt32 *const indexArray) const {
dgInt32 index;
dgInt32 textureID;
@@ -2189,7 +2189,7 @@ void dgMeshEffect::GetMaterialGetIndexStream(dgIndexArray *const handle,
}
void dgMeshEffect::GetMaterialGetIndexStreamShort(dgIndexArray *const handle,
- dgInt32 materialHandle, dgInt16 *const indexArray) {
+ dgInt32 materialHandle, dgInt16 *const indexArray) const {
dgInt32 index;
dgInt32 textureID;
@@ -3764,7 +3764,7 @@ bool dgMeshEffect::SeparateDuplicateLoops(dgEdge *const face) {
return false;
}
-dgMeshEffect *dgMeshEffect::GetNextLayer(dgInt32 mark) {
+dgMeshEffect *dgMeshEffect::GetNextLayer(dgInt32 mark) const {
Iterator iter(*this);
dgEdge *edge = NULL;
for (iter.Begin(); iter; iter++) {
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
index d128000e60b..3cc64586b8d 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
@@ -137,8 +137,8 @@ public:
static bool CheckIntersection(const dgMeshEffect *const meshA, const dgMeshEffectSolidTree *const solidTreeA,
const dgMeshEffect *const meshB, const dgMeshEffectSolidTree *const solidTreeB, dgFloat64 scale);
- dgMeshEffect *GetFirstLayer();
- dgMeshEffect *GetNextLayer(dgMeshEffect *const layer);
+ dgMeshEffect *GetFirstLayer() const;
+ dgMeshEffect *GetNextLayer(const dgMeshEffect *const layer) const;
void Triangulate();
void ConvertToPolygons();
@@ -185,21 +185,21 @@ public:
void GetVertexStreams(dgInt32 vetexStrideInByte, dgFloat32 *const vertex,
dgInt32 normalStrideInByte, dgFloat32 *const normal,
dgInt32 uvStrideInByte0, dgFloat32 *const uv0,
- dgInt32 uvStrideInByte1, dgFloat32 *const uv1);
+ dgInt32 uvStrideInByte1, dgFloat32 *const uv1) const;
void GetIndirectVertexStreams(dgInt32 vetexStrideInByte, dgFloat64 *const vertex, dgInt32 *const vertexIndices, dgInt32 *const vertexCount,
dgInt32 normalStrideInByte, dgFloat64 *const normal, dgInt32 *const normalIndices, dgInt32 *const normalCount,
dgInt32 uvStrideInByte0, dgFloat64 *const uv0, dgInt32 *const uvIndices0, dgInt32 *const uvCount0,
dgInt32 uvStrideInByte1, dgFloat64 *const uv1, dgInt32 *const uvIndices1, dgInt32 *const uvCount1);
- dgIndexArray *MaterialGeometryBegin();
- void MaterialGeomteryEnd(dgIndexArray *const handle);
- dgInt32 GetFirstMaterial(dgIndexArray *const handle);
- dgInt32 GetNextMaterial(dgIndexArray *const handle, dgInt32 materialHandle);
- dgInt32 GetMaterialID(dgIndexArray *const handle, dgInt32 materialHandle);
- dgInt32 GetMaterialIndexCount(dgIndexArray *const handle, dgInt32 materialHandle);
- void GetMaterialGetIndexStream(dgIndexArray *const handle, dgInt32 materialHandle, dgInt32 *const index);
- void GetMaterialGetIndexStreamShort(dgIndexArray *const handle, dgInt32 materialHandle, dgInt16 *const index);
+ dgIndexArray *MaterialGeometryBegin() const;
+ void MaterialGeomteryEnd(dgIndexArray *const handle) const;
+ dgInt32 GetFirstMaterial(dgIndexArray *const handle) const;
+ dgInt32 GetNextMaterial(dgIndexArray *const handle, dgInt32 materialHandle) const;
+ dgInt32 GetMaterialID(dgIndexArray *const handle, dgInt32 materialHandle) const;
+ dgInt32 GetMaterialIndexCount(dgIndexArray *const handle, dgInt32 materialHandle) const;
+ void GetMaterialGetIndexStream(dgIndexArray *const handle, dgInt32 materialHandle, dgInt32 *const index) const;
+ void GetMaterialGetIndexStreamShort(dgIndexArray *const handle, dgInt32 materialHandle, dgInt16 *const index) const;
dgCollision *CreateCollisionTree(dgInt32 shapeID) const;
dgCollision *CreateConvexCollision(dgFloat64 tolerance, dgInt32 shapeID, const dgMatrix &matrix = dgGetIdentityMatrix()) const;
@@ -213,22 +213,22 @@ public:
dgVertexAtribute &GetAttribute(dgInt32 index) const;
void TransformMesh(const dgMatrix &matrix);
- void *GetFirstVertex();
- void *GetNextVertex(const void *const vertex);
+ void *GetFirstVertex() const;
+ void *GetNextVertex(const void *const vertex) const;
int GetVertexIndex(const void *const vertex) const;
- void *GetFirstPoint();
- void *GetNextPoint(const void *const point);
+ void *GetFirstPoint() const;
+ void *GetNextPoint(const void *const point) const;
int GetPointIndex(const void *const point) const;
int GetVertexIndexFromPoint(const void *const point) const;
- void *GetFirstEdge();
- void *GetNextEdge(const void *const edge);
+ void *GetFirstEdge() const;
+ void *GetNextEdge(const void *const edge) const;
void GetEdgeIndex(const void *const edge, dgInt32 &v0, dgInt32 &v1) const;
// void GetEdgeAttributeIndex (const void* edge, dgInt32& v0, dgInt32& v1) const;
- void *GetFirstFace();
- void *GetNextFace(const void *const face);
+ void *GetFirstFace() const;
+ void *GetNextFace(const void *const face) const;
int IsFaceOpen(const void *const face) const;
int GetFaceMaterial(const void *const face) const;
int GetFaceIndexCount(const void *const face) const;
@@ -254,7 +254,7 @@ protected:
dgVertexAtribute InterpolateEdge(dgEdge *const edge, dgFloat64 param) const;
dgVertexAtribute InterpolateVertex(const dgBigVector &point, dgEdge *const face) const;
- dgMeshEffect *GetNextLayer(dgInt32 mark);
+ dgMeshEffect *GetNextLayer(dgInt32 mark) const;
void FilterCoplanarFaces(const dgMeshEffect *const otherCap, dgFloat32 sign);
void ClipMesh(const dgMeshEffect *const clipMesh, dgMeshEffect **const back, dgMeshEffect **const front, dgMeshEffect **const coplanar) const;
@@ -290,11 +290,11 @@ inline dgInt32 dgMeshEffect::GetPropertiesCount() const {
return m_atribCount;
}
-inline dgInt32 dgMeshEffect::GetMaterialID(dgIndexArray *const handle, dgInt32 materialHandle) {
+inline dgInt32 dgMeshEffect::GetMaterialID(dgIndexArray *const handle, dgInt32 materialHandle) const {
return handle->m_materials[materialHandle];
}
-inline dgInt32 dgMeshEffect::GetMaterialIndexCount(dgIndexArray *const handle, dgInt32 materialHandle) {
+inline dgInt32 dgMeshEffect::GetMaterialIndexCount(dgIndexArray *const handle, dgInt32 materialHandle) const {
return handle->m_materialsIndexCount[materialHandle];
}
@@ -334,11 +334,11 @@ inline dgFloat64 *dgMeshEffect::GetVertexPool() const {
return &m_points[0].m_x;
}
-inline dgMeshEffect *dgMeshEffect::GetFirstLayer() {
+inline dgMeshEffect *dgMeshEffect::GetFirstLayer() const {
return GetNextLayer(IncLRU());
}
-inline dgMeshEffect *dgMeshEffect::GetNextLayer(dgMeshEffect *const layerSegment) {
+inline dgMeshEffect *dgMeshEffect::GetNextLayer(const dgMeshEffect *const layerSegment) const {
if (!layerSegment) {
return NULL;
}
Commit: 4571fc3e2c87b24c1b70c26cb869ebc99ba7b052
https://github.com/scummvm/scummvm/commit/4571fc3e2c87b24c1b70c26cb869ebc99ba7b052
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:19+01:00
Commit Message:
HPL1: fix warnings
Changed paths:
engines/hpl1/engine/graphics/Material_Modulative.cpp
engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
diff --git a/engines/hpl1/engine/graphics/Material_Modulative.cpp b/engines/hpl1/engine/graphics/Material_Modulative.cpp
index 65e5e963bba..69e6b60ce5f 100644
--- a/engines/hpl1/engine/graphics/Material_Modulative.cpp
+++ b/engines/hpl1/engine/graphics/Material_Modulative.cpp
@@ -53,8 +53,6 @@ public:
}
};
-static cFogProgramSetup gFogProgramSetup;
-
//////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
//////////////////////////////////////////////////////////////////////////
@@ -96,6 +94,7 @@ iGpuProgram *cMaterial_Modulative::getGpuProgram(const eMaterialRenderType aType
}
iMaterialProgramSetup *cMaterial_Modulative::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
+ static cFogProgramSetup gFogProgramSetup;
if (mpRenderSettings->mbFogActive)
return &gFogProgramSetup;
return nullptr;
diff --git a/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp b/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
index bcae8d77ee3..26458851028 100644
--- a/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
+++ b/engines/hpl1/engine/graphics/Material_ModulativeX2.cpp
@@ -51,8 +51,6 @@ public:
}
};
-static cFogProgramSetup gFogProgramSetup;
-
//////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
//////////////////////////////////////////////////////////////////////////
@@ -93,6 +91,7 @@ iGpuProgram *cMaterial_ModulativeX2::getGpuProgram(const eMaterialRenderType aTy
}
iMaterialProgramSetup *cMaterial_ModulativeX2::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
+ static cFogProgramSetup gFogProgramSetup;
if (mpRenderSettings->mbFogActive)
return &gFogProgramSetup;
return nullptr;
Commit: 76a9976c37d4e184cc3a8cafc8524d16e1a9e24c
https://github.com/scummvm/scummvm/commit/76a9976c37d4e184cc3a8cafc8524d16e1a9e24c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:19+01:00
Commit Message:
HPL1: More const correctness
Changed paths:
engines/hpl1/engine/libraries/newton/Newton.cpp
diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
index 20897ee51d8..0e86f32d99f 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.cpp
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -6796,10 +6796,10 @@ dFloat NewtonCorkscrewGetJointAngle(const NewtonJoint *const corkscrew) {
//
// See also: NewtonCorkscrewSetUserCallback
dFloat NewtonCorkscrewGetJointOmega(const NewtonJoint *const corkscrew) {
- dgCorkscrewConstraint *contraint;
+ const dgCorkscrewConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgCorkscrewConstraint *)corkscrew;
+ contraint = (const dgCorkscrewConstraint *)corkscrew;
return contraint->GetJointOmega();
}
@@ -6818,11 +6818,11 @@ dFloat NewtonCorkscrewGetJointOmega(const NewtonJoint *const corkscrew) {
// See also: NewtonCorkscrewSetUserCallback
dFloat NewtonCorkscrewCalculateStopAlpha(const NewtonJoint *const corkscrew,
const NewtonHingeSliderUpdateDesc *const desc, dFloat angle) {
- dgCorkscrewConstraint *contraint;
+ const dgCorkscrewConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgCorkscrewConstraint *)corkscrew;
- return contraint->CalculateStopAlpha(angle, (dgJointCallBackParam *)desc);
+ contraint = (const dgCorkscrewConstraint *)corkscrew;
+ return contraint->CalculateStopAlpha(angle, (const dgJointCallBackParam *)desc);
}
// Name: NewtonCorkscrewGetJointForce
@@ -6840,9 +6840,9 @@ dFloat NewtonCorkscrewCalculateStopAlpha(const NewtonJoint *const corkscrew,
// See also: NewtonCorkscrewSetUserCallback
dFloat NewtonCorkscrewCalculateStopAccel(const NewtonJoint *const corkscrew,
const NewtonHingeSliderUpdateDesc *const desc, dFloat distance) {
- dgCorkscrewConstraint *contraint;
- contraint = (dgCorkscrewConstraint *)corkscrew;
- return contraint->CalculateStopAccel(distance, (dgJointCallBackParam *)desc);
+ const dgCorkscrewConstraint *contraint;
+ contraint = (const dgCorkscrewConstraint *)corkscrew;
+ return contraint->CalculateStopAccel(distance, (const dgJointCallBackParam *)desc);
}
// Name: NewtonCorkscrewGetJointForce
@@ -6860,10 +6860,10 @@ dFloat NewtonCorkscrewCalculateStopAccel(const NewtonJoint *const corkscrew,
// See also: NewtonCorkscrewSetUserCallback
void NewtonCorkscrewGetJointForce(const NewtonJoint *const corkscrew,
dFloat *const force) {
- dgCorkscrewConstraint *contraint;
+ const dgCorkscrewConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgCorkscrewConstraint *)corkscrew;
+ contraint = (const dgCorkscrewConstraint *)corkscrew;
dgVector forceVector(contraint->GetJointForce());
force[0] = forceVector.m_x;
force[1] = forceVector.m_y;
@@ -6895,9 +6895,9 @@ void NewtonCorkscrewGetJointForce(const NewtonJoint *const corkscrew,
// while and allowing one body to spin around a fix axis in is own frame, and the other body to spin around another axis fixes on
// it own frame. Both axis must be mutually perpendicular.
NewtonJoint *NewtonConstraintCreateUniversal(
- const NewtonWorld *const newtonWorld, const dFloat *pivotPoint,
+ NewtonWorld *newtonWorld, const dFloat *pivotPoint,
const dFloat *pinDir0, const dFloat *pinDir1,
- const NewtonBody *const childBody, const NewtonBody *const parentBody) {
+ NewtonBody *childBody, NewtonBody *parentBody) {
dgBody *body0;
dgBody *body1;
Newton *world;
@@ -6933,7 +6933,7 @@ NewtonJoint *NewtonConstraintCreateUniversal(
// if the application only wants to change the joint angular and linear acceleration the return code is 3
//
// See also: NewtonJointGetUserData, NewtonJointSetUserData
-void NewtonUniversalSetUserCallback(const NewtonJoint *const universal,
+void NewtonUniversalSetUserCallback(NewtonJoint *universal,
NewtonUniversalCallBack callback) {
dgUniversalConstraint *contraint;
@@ -6955,10 +6955,10 @@ void NewtonUniversalSetUserCallback(const NewtonJoint *const universal,
//
// See also: NewtonUniversalSetUserCallback
dFloat NewtonUniversalGetJointAngle0(const NewtonJoint *const universal) {
- dgUniversalConstraint *contraint;
+ const dgUniversalConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgUniversalConstraint *)universal;
+ contraint = (const dgUniversalConstraint *)universal;
return contraint->GetJointAngle0();
}
@@ -6975,10 +6975,10 @@ dFloat NewtonUniversalGetJointAngle0(const NewtonJoint *const universal) {
//
// See also: NewtonUniversalSetUserCallback
dFloat NewtonUniversalGetJointAngle1(const NewtonJoint *const universal) {
- dgUniversalConstraint *contraint;
+ const dgUniversalConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgUniversalConstraint *)universal;
+ contraint = (const dgUniversalConstraint *)universal;
return contraint->GetJointAngle1();
}
@@ -6995,10 +6995,10 @@ dFloat NewtonUniversalGetJointAngle1(const NewtonJoint *const universal) {
//
// See also: NewtonUniversalSetUserCallback
dFloat NewtonUniversalGetJointOmega0(const NewtonJoint *const universal) {
- dgUniversalConstraint *contraint;
+ const dgUniversalConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgUniversalConstraint *)universal;
+ contraint = (const dgUniversalConstraint *)universal;
return contraint->GetJointOmega0();
}
@@ -7015,10 +7015,10 @@ dFloat NewtonUniversalGetJointOmega0(const NewtonJoint *const universal) {
//
// See also: NewtonUniversalSetUserCallback
dFloat NewtonUniversalGetJointOmega1(const NewtonJoint *const universal) {
- dgUniversalConstraint *contraint;
+ const dgUniversalConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgUniversalConstraint *)universal;
+ contraint = (const dgUniversalConstraint *)universal;
return contraint->GetJointOmega1();
}
@@ -7037,11 +7037,11 @@ dFloat NewtonUniversalGetJointOmega1(const NewtonJoint *const universal) {
// See also: NewtonUniversalSetUserCallback
dFloat NewtonUniversalCalculateStopAlpha0(const NewtonJoint *const universal,
const NewtonHingeSliderUpdateDesc *const desc, dFloat angle) {
- dgUniversalConstraint *contraint;
+ const dgUniversalConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgUniversalConstraint *)universal;
- return contraint->CalculateStopAlpha0(angle, (dgJointCallBackParam *)desc);
+ contraint = (const dgUniversalConstraint *)universal;
+ return contraint->CalculateStopAlpha0(angle, (const dgJointCallBackParam *)desc);
}
// Name: NewtonUniversalCalculateStopAlpha1
@@ -7059,11 +7059,11 @@ dFloat NewtonUniversalCalculateStopAlpha0(const NewtonJoint *const universal,
// See also: NewtonUniversalSetUserCallback
dFloat NewtonUniversalCalculateStopAlpha1(const NewtonJoint *const universal,
const NewtonHingeSliderUpdateDesc *const desc, dFloat angle) {
- dgUniversalConstraint *contraint;
+ const dgUniversalConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgUniversalConstraint *)universal;
- return contraint->CalculateStopAlpha1(angle, (dgJointCallBackParam *)desc);
+ contraint = (const dgUniversalConstraint *)universal;
+ return contraint->CalculateStopAlpha1(angle, (const dgJointCallBackParam *)desc);
}
// Name: NewtonUniversalGetJointForce
@@ -7081,10 +7081,10 @@ dFloat NewtonUniversalCalculateStopAlpha1(const NewtonJoint *const universal,
// See also: NewtonUniversalSetUserCallback
void NewtonUniversalGetJointForce(const NewtonJoint *const universal,
dFloat *const force) {
- dgUniversalConstraint *contraint;
+ const dgUniversalConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgUniversalConstraint *)universal;
+ contraint = (const dgUniversalConstraint *)universal;
dgVector forceVector(contraint->GetJointForce());
force[0] = forceVector.m_x;
force[1] = forceVector.m_y;
@@ -7114,8 +7114,8 @@ void NewtonUniversalGetJointForce(const NewtonJoint *const universal,
// Remark: Since the UpVector joint is a unary constraint, there is not need to have user callback or user data assigned to it.
// The application can simple hold to the joint handle and update the pin on the force callback function of the rigid body owning the joint.
NewtonJoint *NewtonConstraintCreateUpVector(
- const NewtonWorld *const newtonWorld, const dFloat *pinDir,
- const NewtonBody *const body) {
+ NewtonWorld *newtonWorld, const dFloat *pinDir,
+ NewtonBody *body) {
dgBody *body0;
Newton *world;
@@ -7141,10 +7141,10 @@ NewtonJoint *NewtonConstraintCreateUpVector(
//
// See also: NewtonUpVectorSetUserCallback, NewtonUpVectorSetPin
void NewtonUpVectorGetPin(const NewtonJoint *const upVector, dFloat *pin) {
- dgUpVectorConstraint *contraint;
+ const dgUpVectorConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgUpVectorConstraint *)upVector;
+ contraint = (const dgUpVectorConstraint *)upVector;
dgVector pinVector(contraint->GetPinDir());
pin[0] = pinVector.m_x;
@@ -7166,7 +7166,7 @@ void NewtonUpVectorGetPin(const NewtonJoint *const upVector, dFloat *pin) {
// too large rotation can cause vibration of the joint.
//
// See also: NewtonUpVectorSetUserCallback, NewtonUpVectorGetPin
-void NewtonUpVectorSetPin(const NewtonJoint *const upVector, const dFloat *pin) {
+void NewtonUpVectorSetPin(NewtonJoint *upVector, const dFloat *pin) {
dgUpVectorConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
@@ -7214,10 +7214,10 @@ void NewtonUpVectorSetPin(const NewtonJoint *const upVector, const dFloat *pin)
//
// See also: NewtonUserJointSetFeedbackCollectorCallback
NewtonJoint *NewtonConstraintCreateUserJoint(
- const NewtonWorld *const newtonWorld, int maxDOF,
+ NewtonWorld *newtonWorld, int maxDOF,
NewtonUserBilateralCallBack submitConstraints,
NewtonUserBilateralGetInfoCallBack getInfo,
- const NewtonBody *const childBody, const NewtonBody *const parentBody) {
+ NewtonBody *childBody, NewtonBody *parentBody) {
dgBody *body0;
dgBody *body1;
Newton *world;
@@ -7251,7 +7251,7 @@ NewtonJoint *NewtonConstraintCreateUserJoint(
// Remark: This function call only be called from inside a *NewtonUserBilateralCallBack* callback.
//
// See also: NewtonUserJointAddAngularRow,
-void NewtonUserJointAddLinearRow(const NewtonJoint *const joint,
+void NewtonUserJointAddLinearRow(NewtonJoint *joint,
const dFloat *const pivot0, const dFloat *const pivot1,
const dFloat *const dir) {
NewtonUserJoint *userJoint;
@@ -7289,7 +7289,7 @@ void NewtonUserJointAddLinearRow(const NewtonJoint *const joint,
// Remark: This function is of not practical to enforce hard constraints, but it is very useful for making angular motors.
//
// See also: NewtonUserJointAddLinearRow, NewtonUserJointAddIndependentAngularRow
-void NewtonUserJointAddAngularRow(const NewtonJoint *const joint,
+void NewtonUserJointAddAngularRow(NewtonJoint *joint,
dFloat relativeAngleError, const dFloat *const pin) {
NewtonUserJoint *userJoint;
@@ -7320,7 +7320,7 @@ void NewtonUserJointAddAngularRow(const NewtonJoint *const joint,
// application responsibility to set the relative acceleration after a call to this function
//
// See also: NewtonUserJointAddLinearRow, NewtonUserJointAddAngularRow
-void NewtonUserJointAddGeneralRow(const NewtonJoint *const joint,
+void NewtonUserJointAddGeneralRow(NewtonJoint *joint,
const dFloat *const jacobian0, const dFloat *const jacobian1) {
NewtonUserJoint *userJoint;
@@ -7341,7 +7341,7 @@ void NewtonUserJointAddGeneralRow(const NewtonJoint *const joint,
// max friction is a Max friction torque.
//
// See also: NewtonUserJointSetRowMinimumFriction, NewtonUserJointAddLinearRow, NewtonUserJointAddAngularRow
-void NewtonUserJointSetRowMaximumFriction(const NewtonJoint *const joint,
+void NewtonUserJointSetRowMaximumFriction(NewtonJoint *joint,
dFloat friction) {
NewtonUserJoint *userJoint;
userJoint = (NewtonUserJoint *)joint;
@@ -7362,7 +7362,7 @@ void NewtonUserJointSetRowMaximumFriction(const NewtonJoint *const joint,
// friction is a Min friction torque.
//
// See also: NewtonUserJointSetRowMaximumFriction, NewtonUserJointAddLinearRow, NewtonUserJointAddAngularRow
-void NewtonUserJointSetRowMinimumFriction(const NewtonJoint *const joint,
+void NewtonUserJointSetRowMinimumFriction(NewtonJoint *joint,
dFloat friction) {
NewtonUserJoint *userJoint;
userJoint = (NewtonUserJoint *)joint;
@@ -7382,7 +7382,7 @@ void NewtonUserJointSetRowMinimumFriction(const NewtonJoint *const joint,
// angular acceleration.
//
// See also: NewtonUserJointAddLinearRow, NewtonUserJointAddAngularRow
-void NewtonUserJointSetRowAcceleration(const NewtonJoint *const joint,
+void NewtonUserJointSetRowAcceleration(NewtonJoint *joint,
dFloat acceleration) {
NewtonUserJoint *userJoint;
userJoint = (NewtonUserJoint *)joint;
@@ -7410,7 +7410,7 @@ void NewtonUserJointSetRowAcceleration(const NewtonJoint *const joint,
//
// See also: NewtonUserJointSetRowAcceleration, NewtonUserJointSetRowStiffness
void NewtonUserJointSetRowSpringDamperAcceleration(
- const NewtonJoint *const joint, dFloat springK, dFloat springD) {
+ NewtonJoint *joint, dFloat springK, dFloat springD) {
NewtonUserJoint *userJoint;
userJoint = (NewtonUserJoint *)joint;
@@ -7430,7 +7430,7 @@ void NewtonUserJointSetRowSpringDamperAcceleration(
// 1.0 (100% stiff) but dues to numerical integration error this could be the joint a little unstable, and lower values are preferred.
//
// See also: NewtonUserJointAddLinearRow, NewtonUserJointAddAngularRow, NewtonUserJointSetRowSpringDamperAcceleration
-void NewtonUserJointSetRowStiffness(const NewtonJoint *const joint,
+void NewtonUserJointSetRowStiffness(NewtonJoint *joint,
dFloat stiffness) {
NewtonUserJoint *userJoint;
userJoint = (NewtonUserJoint *)joint;
@@ -7451,8 +7451,8 @@ void NewtonUserJointSetRowStiffness(const NewtonJoint *const joint,
// Remark: This function can be used to produce special effects like breakable or malleable joints, fro example a hinge can turn into ball and socket
// after the force in some of the row exceed certain high value.
dFloat NewtonUserJointGetRowForce(const NewtonJoint *const joint, int row) {
- NewtonUserJoint *userJoint;
- userJoint = (NewtonUserJoint *)joint;
+ const NewtonUserJoint *userJoint;
+ userJoint = (const NewtonUserJoint *)joint;
TRACE_FUNTION(__FUNCTION__);
return userJoint->GetRowForce(row);
@@ -7466,7 +7466,7 @@ dFloat NewtonUserJointGetRowForce(const NewtonJoint *const joint, int row) {
// *NewtonUserBilateralCallBack* getFeedback - pointer to the joint constraint definition function call back.
//
// See also: NewtonUserJointGetRowForce
-void NewtonUserJointSetFeedbackCollectorCallback(const NewtonJoint *const joint,
+void NewtonUserJointSetFeedbackCollectorCallback(NewtonJoint *joint,
NewtonUserBilateralCallBack getFeedback) {
NewtonUserJoint *userJoint;
userJoint = (NewtonUserJoint *)joint;
@@ -7517,9 +7517,9 @@ void NewtonJointSetUserData(const NewtonJoint *const joint,
//
// See also: NewtonJointSetUserData
void *NewtonJointGetUserData(const NewtonJoint *const joint) {
- dgConstraint *contraint;
+ const dgConstraint *contraint;
- contraint = (dgConstraint *)joint;
+ contraint = (const dgConstraint *)joint;
TRACE_FUNTION(__FUNCTION__);
return contraint->GetUserData();
@@ -7588,8 +7588,8 @@ void *NewtonJointGetUserData(const NewtonJoint *const joint) {
// See also:
void NewtonJointGetInfo(const NewtonJoint *const joint,
NewtonJointRecord *const jointInfo) {
- dgConstraint *contraint;
- contraint = (dgConstraint *)joint;
+ const dgConstraint *contraint;
+ contraint = (const dgConstraint *)joint;
TRACE_FUNTION(__FUNCTION__);
contraint->GetInfo((dgConstraintInfo *)jointInfo);
@@ -7605,8 +7605,8 @@ void NewtonJointGetInfo(const NewtonJoint *const joint,
// See also:
NewtonBody *NewtonJointGetBody0(const NewtonJoint *const joint) {
- dgConstraint *contraint;
- contraint = (dgConstraint *)joint;
+ const dgConstraint *contraint;
+ contraint = (const dgConstraint *)joint;
TRACE_FUNTION(__FUNCTION__);
@@ -7624,8 +7624,8 @@ NewtonBody *NewtonJointGetBody1(const NewtonJoint *const joint) {
dgBody *body;
dgWorld *world;
- dgConstraint *contraint;
- contraint = (dgConstraint *)joint;
+ const dgConstraint *contraint;
+ contraint = (const dgConstraint *)joint;
TRACE_FUNTION(__FUNCTION__);
body = contraint->GetBody1();
@@ -7736,9 +7736,9 @@ void NewtonJointSetStiffness(const NewtonJoint *const joint, dFloat stiffness) {
//
// See also: NewtonJointSetStiffness
dFloat NewtonJointGetStiffness(const NewtonJoint *const joint) {
- dgConstraint *contraint;
+ const dgConstraint *contraint;
- contraint = (dgConstraint *)joint;
+ contraint = (const dgConstraint *)joint;
TRACE_FUNTION(__FUNCTION__);
return contraint->GetStiffness();
@@ -7757,7 +7757,7 @@ dFloat NewtonJointGetStiffness(const NewtonJoint *const joint) {
// joint is about to be destroyed. The application can register a destructor call back with the joint.
//
// See also: NewtonJointSetUserData
-void NewtonJointSetDestructor(const NewtonJoint *const joint,
+void NewtonJointSetDestructor(NewtonJoint *joint,
NewtonConstraintDestructor destructor) {
dgConstraint *contraint;
@@ -7796,7 +7796,7 @@ void NewtonDestroyJoint(const NewtonWorld *const newtonWorld,
//
// ***************************************************************************************************************
-NewtonMesh *NewtonMeshCreate(const NewtonWorld *const newtonWorld) {
+NewtonMesh *NewtonMeshCreate(NewtonWorld *newtonWorld) {
TRACE_FUNTION(__FUNCTION__);
Newton *world = (Newton *)newtonWorld;
@@ -7805,7 +7805,7 @@ NewtonMesh *NewtonMeshCreate(const NewtonWorld *const newtonWorld) {
return (NewtonMesh *)mesh;
}
-NewtonMesh *NewtonMeshCreateFromMesh(const NewtonMesh *const mesh) {
+NewtonMesh *NewtonMeshCreateFromMesh(NewtonMesh *mesh) {
TRACE_FUNTION(__FUNCTION__);
dgMeshEffect *srcMesh = (dgMeshEffect *)mesh;
@@ -7813,8 +7813,7 @@ NewtonMesh *NewtonMeshCreateFromMesh(const NewtonMesh *const mesh) {
return (NewtonMesh *)clone;
}
-NewtonMesh *NewtonMeshCreateFromCollision(
- const NewtonCollision *const collision) {
+NewtonMesh *NewtonMeshCreateFromCollision(NewtonCollision *collision) {
TRACE_FUNTION(__FUNCTION__);
dgCollision *const shape = (dgCollision *)collision;
@@ -7822,7 +7821,7 @@ NewtonMesh *NewtonMeshCreateFromCollision(
return (NewtonMesh *)mesh;
}
-NewtonMesh *NewtonMeshConvexHull(const NewtonWorld *const newtonWorld,
+NewtonMesh *NewtonMeshConvexHull(NewtonWorld *newtonWorld,
int count, const dFloat *const vertexCloud, int strideInBytes,
dFloat tolerance) {
TRACE_FUNTION(__FUNCTION__);
@@ -7861,7 +7860,7 @@ void NewtonMeshDestroy(const NewtonMesh *const mesh) {
delete meshEffect;
}
-void NewtonMesApplyTransform(NewtonMesh *const mesh, const dFloat *const matrix) {
+void NewtonMesApplyTransform(NewtonMesh *const mesh, dFloat *matrix) {
TRACE_FUNTION(__FUNCTION__);
dgMeshEffect *const meshEffect = (dgMeshEffect * const)mesh;
@@ -7942,7 +7941,7 @@ void NewtonMeshFixTJoints(NewtonMesh *const mesh) {
}
void NewtonMeshClip(const NewtonMesh *const mesh,
- const NewtonMesh *const clipper, const dFloat *const clipperMatrix,
+ const NewtonMesh *const clipper, dFloat *clipperMatrix,
NewtonMesh **const topMesh, NewtonMesh **const bottomMesh) {
TRACE_FUNTION(__FUNCTION__);
@@ -7965,31 +7964,31 @@ void NewtonMeshPlaneClip(const NewtonMesh *const mesh,
((const dgMeshEffect *)mesh)->PlaneClipMesh(matrix, texMatrix, planeMaterial, (dgMeshEffect **)topMesh, (dgMeshEffect **)bottomMesh);
}
-NewtonMesh *NewtonMeshApproximateConvexDecomposition(const NewtonMesh *const mesh, dFloat maxConcavity, int maxCount) {
+NewtonMesh *NewtonMeshApproximateConvexDecomposition(NewtonMesh *mesh, dFloat maxConcavity, int maxCount) {
TRACE_FUNTION(__FUNCTION__);
return (NewtonMesh *)((dgMeshEffect *)mesh)->CreateConvexApproximation(maxConcavity, maxCount);
}
-NewtonMesh *NewtonMeshTetrahedralization(const NewtonMesh *const mesh,
- int internalMaterial, const dFloat *const textureMatrix) {
+NewtonMesh *NewtonMeshTetrahedralization(NewtonMesh *mesh,
+ int internalMaterial, dFloat *textureMatrix) {
TRACE_FUNTION(__FUNCTION__);
dgMatrix &tetMatrix = *((dgMatrix *)textureMatrix);
return (NewtonMesh *)((dgMeshEffect *)mesh)->CreateDelanayTretrahedralization(internalMaterial, tetMatrix);
}
-NewtonMesh *NewtonMeshVoronoiDecomposition(const NewtonMesh *const mesh,
+NewtonMesh *NewtonMeshVoronoiDecomposition(NewtonMesh *mesh,
int pointCount, int pointStrideInBytes, const dFloat *const pointCloud,
- int internalMaterial, const dFloat *const textureMatrix) {
+ int internalMaterial, dFloat *const textureMatrix) {
TRACE_FUNTION(__FUNCTION__);
dgMatrix &tetMatrix = *((dgMatrix *)textureMatrix);
return (NewtonMesh *)((dgMeshEffect *)mesh)->CreateVoronoiPartition(pointCount, pointStrideInBytes, pointCloud, internalMaterial, tetMatrix);
}
-NewtonMesh *NewtonMeshUnion(NewtonMesh *const mesh,
+NewtonMesh *NewtonMeshUnion(NewtonMesh *mesh,
const NewtonMesh *const clipper, const dFloat *const clipperMatrix) {
TRACE_FUNTION(__FUNCTION__);
- dgMatrix &matrix = *((dgMatrix *)clipperMatrix);
+ const dgMatrix &matrix = *((const dgMatrix *)clipperMatrix);
return (NewtonMesh *)((dgMeshEffect *)mesh)->Union(matrix, (const dgMeshEffect *)clipper);
}
Commit: 1a3ddfab1c1e97f2afce38fb087da2846b74cf93
https://github.com/scummvm/scummvm/commit/1a3ddfab1c1e97f2afce38fb087da2846b74cf93
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:19+01:00
Commit Message:
HPL1: More const corrections
Changed paths:
engines/hpl1/engine/libraries/newton/Newton.cpp
engines/hpl1/engine/libraries/newton/Newton.h
engines/hpl1/engine/libraries/newton/NewtonClass.cpp
diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
index 0e86f32d99f..96bb0f11252 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.cpp
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -4010,9 +4010,9 @@ int NewtonCollisionCollideContinue(const NewtonWorld *const newtonWorld,
TRACE_FUNTION(__FUNCTION__);
return world->CollideContinue((dgCollision *)collisionA,
- *((dgMatrix *)matrixA), *((dgVector *)velocA), *((dgVector *)omegaA),
- (dgCollision *)collisionB, *((dgMatrix *)matrixB), *((dgVector *)velocB),
- *((dgVector *)omegaB), *timeOfImpact, (dgTriplex *)contacts,
+ *((const dgMatrix *)matrixA), *((const dgVector *)velocA), *((const dgVector *)omegaA),
+ (dgCollision *)collisionB, *((const dgMatrix *)matrixB), *((const dgVector *)velocB),
+ *((const dgVector *)omegaB), *timeOfImpact, (dgTriplex *)contacts,
(dgTriplex *)normals, penetration, maxSize, threadIndex);
}
@@ -4031,11 +4031,11 @@ int NewtonCollisionCollideContinue(const NewtonWorld *const newtonWorld,
// See also: NewtonCollisionRayCast, NewtonCollisionClosestPoint, NewtonCollisionPointDistance
void NewtonCollisionSupportVertex(const NewtonCollision *collisionPtr,
const dFloat *const dir, dFloat *const vertex) {
- dgCollisionConvex *collision;
+ const dgCollisionConvex *collision;
TRACE_FUNTION(__FUNCTION__);
- collision = (dgCollisionConvex *)collisionPtr;
+ collision = (const dgCollisionConvex *)collisionPtr;
// _ASSERTE (collision->IsType (dgCollision::dgConvexCollision_RTTI));
const dgMatrix &matrix = collision->GetOffsetMatrix();
@@ -4075,9 +4075,9 @@ dFloat NewtonCollisionRayCast(const NewtonCollision *collisionPtr,
const dFloat *const p0, const dFloat *const p1, dFloat *const normal,
int *const attribute) {
dFloat t;
- dgCollision *collision;
+ const dgCollision *collision;
- collision = (dgCollision *)collisionPtr;
+ collision = (const dgCollision *)collisionPtr;
TRACE_FUNTION(__FUNCTION__);
const dgMatrix &matrix = collision->GetOffsetMatrix();
@@ -4114,8 +4114,8 @@ dFloat NewtonCollisionRayCast(const NewtonCollision *collisionPtr,
// See also: NewtonCollisionClosestPoint, NewtonCollisionPointDistance, NewtonCollisionCollide, NewtonCollisionRayCast
void NewtonCollisionCalculateAABB(const NewtonCollision *collisionPtr,
const dFloat *const offsetMatrix, dFloat *const p0, dFloat *const p1) {
- dgCollision *collision;
- collision = (dgCollision *)collisionPtr;
+ const dgCollision *collision;
+ collision = (const dgCollision *)collisionPtr;
// const dgMatrix& matrix = *((dgMatrix*) offsetMatrix);
dgMatrix matrix(collision->GetOffsetMatrix() * (*((dgMatrix *)offsetMatrix)));
@@ -4349,8 +4349,8 @@ NewtonCollision *NewtonCreateCollisionFromSerialization(
// See also: NewtonCollisionGetInfo, NewtonCollisionSerialize
void NewtonCollisionGetInfo(const NewtonCollision *const collision,
NewtonCollisionInfoRecord *const collisionInfo) {
- dgCollision *coll;
- coll = (dgCollision *)collision;
+ const dgCollision *coll;
+ coll = (const dgCollision *)collision;
TRACE_FUNTION(__FUNCTION__);
@@ -4382,7 +4382,7 @@ void NewtonCollisionGetInfo(const NewtonCollision *const collision,
//
// See also: NewtonSetEulerAngle
void NewtonGetEulerAngle(const dFloat *const matrix, dFloat *const angles) {
- const dgMatrix &mat = *((dgMatrix *)matrix);
+ const dgMatrix &mat = *((const dgMatrix *)matrix);
TRACE_FUNTION(__FUNCTION__);
dgVector eulers(mat.CalcPitchYawRoll());
@@ -4563,8 +4563,8 @@ void NewtonBodySetUserData(const NewtonBody *const bodyPtr,
//
// See also: NewtonBodySetUserData
void *NewtonBodyGetUserData(const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return body->GetUserData();
@@ -4583,8 +4583,8 @@ void *NewtonBodyGetUserData(const NewtonBody *const bodyPtr) {
// that body.
//
NewtonWorld *NewtonBodyGetWorld(const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return (NewtonWorld *)body->GetWorld();
@@ -4632,7 +4632,7 @@ void NewtonBodySetTransformCallback(const NewtonBody *const bodyPtr,
//
// See also: NewtonBodyGetUserData, NewtonBodyGetUserData
NewtonSetTransform NewtonBodyGetTransformCallback(
- const NewtonBody *const bodyPtr) {
+ const NewtonBody *const bodyPtr) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -4685,8 +4685,8 @@ void NewtonBodySetForceAndTorqueCallback(const NewtonBody *const bodyPtr,
// See also: NewtonBodyGetUserData, NewtonBodyGetUserData, NewtonBodySetForceAndTorqueCallback
NewtonApplyForceAndTorque NewtonBodyGetForceAndTorqueCallback(
const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return (NewtonApplyForceAndTorque)body->GetExtForceAndTorqueCallback();
@@ -4779,8 +4779,8 @@ void NewtonBodySetMassMatrix(const NewtonBody *const bodyPtr, dFloat mass,
// See also: NewtonBodySetMassMatrix, NewtonBodyGetInvMass
void NewtonBodyGetMassMatrix(const NewtonBody *const bodyPtr,
dFloat *const mass, dFloat *const Ixx, dFloat *const Iyy, dFloat *const Izz) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
@@ -4814,8 +4814,8 @@ void NewtonBodyGetMassMatrix(const NewtonBody *const bodyPtr,
void NewtonBodyGetInvMass(const NewtonBody *const bodyPtr,
dFloat *const invMass, dFloat *const invIxx, dFloat *const invIyy,
dFloat *const invIzz) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
// dgVector vector (body->GetInvMass ());
@@ -4921,8 +4921,8 @@ void NewtonBodySetMatrixRecursive(const NewtonBody *const bodyPtr,
// See also: NewtonBodySetMatrix, NewtonBodyGetRotation
void NewtonBodyGetMatrix(const NewtonBody *const bodyPtr,
dFloat *const matrixPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
dgMatrix &matrix = *((dgMatrix *)matrixPtr);
@@ -4949,8 +4949,8 @@ void NewtonBodyGetMatrix(const NewtonBody *const bodyPtr,
//
// See also: NewtonBodySetMatrix, NewtonBodyGetMatrix
void NewtonBodyGetRotation(const NewtonBody *const bodyPtr, dFloat *rotPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
dgQuaternion &rot = *((dgQuaternion *)rotPtr);
@@ -5016,8 +5016,8 @@ void NewtonBodyAddForce(const NewtonBody *const bodyPtr,
// See also: NewtonBodyAddForce, NewtonBodyGetForce, NewtonBodyGetForce
void NewtonBodyGetForceAcc(const NewtonBody *const bodyPtr,
dFloat *const vectorPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
dgVector vector(body->GetForce());
@@ -5038,8 +5038,8 @@ void NewtonBodyGetForceAcc(const NewtonBody *const bodyPtr,
// See also: NewtonBodyAddForce, NewtonBodyGetForce, NewtonBodyGetForceAcc
void NewtonBodyGetForce(const NewtonBody *const bodyPtr,
dFloat *const vectorPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
dgVector vector(body->GetNetForce());
@@ -5069,8 +5069,8 @@ void NewtonBodyGetForce(const NewtonBody *const bodyPtr,
// See also: NewtonBodySetForce, NewtonBodyAddForce, NewtonBodyGetForce, NewtonBodyGetForceAcc
void NewtonBodyCalculateInverseDynamicsForce(const NewtonBody *const bodyPtr,
dFloat timestep, const dFloat *const desiredVeloc, dFloat *const forceOut) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
dgVector veloc(desiredVeloc[0], desiredVeloc[1], desiredVeloc[2],
@@ -5094,7 +5094,7 @@ void NewtonBodyCalculateInverseDynamicsForce(const NewtonBody *const bodyPtr,
// Remarks: This function is only effective when called from *NewtonApplyForceAndTorque callback*
//
// See also: NewtonBodyAddTorque, NewtonBodyGetTorque, NewtonBodyGetTorqueAcc
-void NewtonBodySetTorque(const NewtonBody *const bodyPtr,
+void NewtonBodySetTorque(NewtonBody *bodyPtr,
const dFloat *const vectorPtr) {
dgBody *body;
@@ -5138,8 +5138,8 @@ void NewtonBodyAddTorque(const NewtonBody *const bodyPtr,
// See also: NewtonBodyAddTorque, NewtonBodyGetTorque, NewtonBodyGetTorqueAcc
void NewtonBodyGetTorque(const NewtonBody *const bodyPtr,
dFloat *const vectorPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
dgVector vector(body->GetNetTorque());
@@ -5162,8 +5162,8 @@ void NewtonBodyGetTorque(const NewtonBody *const bodyPtr,
// See also: NewtonBodyAddTorque, NewtonBodyGetTorque, NewtonBodyGetTorque
void NewtonBodyGetTorqueAcc(const NewtonBody *const bodyPtr,
dFloat *const vectorPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
dgVector vector(body->GetTorque());
@@ -5210,7 +5210,7 @@ void NewtonBodyGetTorqueAcc(const NewtonBody *const bodyPtr,
// Vector globalTroque (crossproduct ((globalPosition - globalCentre). globalForce);
//
// See also: NewtonConvexCollisionCalculateInertialMatrix, NewtonBodyGetCentreOfMass
-void NewtonBodySetCentreOfMass(const NewtonBody *const bodyPtr,
+void NewtonBodySetCentreOfMass(NewtonBody *bodyPtr,
const dFloat *const comPtr) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -5239,8 +5239,8 @@ void NewtonBodySetCentreOfMass(const NewtonBody *const bodyPtr,
// See also: NewtonConvexCollisionCalculateInertialMatrix, NewtonBodySetCentreOfMass
void NewtonBodyGetCentreOfMass(const NewtonBody *const bodyPtr,
dFloat *const comPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
dgVector vector(body->GetCentreOfMass());
@@ -5263,8 +5263,8 @@ void NewtonBodyGetCentreOfMass(const NewtonBody *const bodyPtr,
//
// See also: NewtonBodyGetNextJoint
NewtonJoint *NewtonBodyGetFirstJoint(const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return (NewtonJoint *)body->GetFirstJoint();
@@ -5286,8 +5286,8 @@ NewtonJoint *NewtonBodyGetFirstJoint(const NewtonBody *const bodyPtr) {
// See also: NewtonBodyGetFirstJoint
NewtonJoint *NewtonBodyGetNextJoint(const NewtonBody *const bodyPtr,
const NewtonJoint *const jointPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return (NewtonJoint *)body->GetNextJoint((dgConstraint *)jointPtr);
@@ -5303,8 +5303,8 @@ NewtonJoint *NewtonBodyGetNextJoint(const NewtonBody *const bodyPtr,
//
// See also: NewtonBodyGetNextContactJoint, NewtonContactJointGetFirstContact, NewtonContactJointGetNextContact, NewtonContactJointRemoveContact
NewtonJoint *NewtonBodyGetFirstContactJoint(const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return (NewtonJoint *)body->GetFirstContact();
@@ -5322,8 +5322,8 @@ NewtonJoint *NewtonBodyGetFirstContactJoint(const NewtonBody *const bodyPtr) {
// See also: NewtonBodyGetFirstContactJoint, NewtonContactJointGetFirstContact, NewtonContactJointGetNextContact, NewtonContactJointRemoveContact
NewtonJoint *NewtonBodyGetNextContactJoint(const NewtonBody *const bodyPtr,
const NewtonJoint *const contactPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return (NewtonJoint *)body->GetNextContact((dgConstraint *)contactPtr);
@@ -5339,8 +5339,8 @@ NewtonJoint *NewtonBodyGetNextContactJoint(const NewtonBody *const bodyPtr,
//
// See also: NewtonContactJointGetFirstContact, NewtonContactJointGetNextContact, NewtonContactJointRemoveContact
int NewtonContactJointGetContactCount(const NewtonJoint *const contactJoint) {
- dgContact *joint;
- joint = (dgContact *)contactJoint;
+ const dgContact *joint;
+ joint = (const dgContact *)contactJoint;
TRACE_FUNTION(__FUNCTION__);
@@ -5361,8 +5361,8 @@ int NewtonContactJointGetContactCount(const NewtonJoint *const contactJoint) {
//
// See also: NewtonContactJointGetNextContact, NewtonContactGetMaterial, NewtonContactJointRemoveContact
void *NewtonContactJointGetFirstContact(const NewtonJoint *const contactJoint) {
- dgContact *joint;
- joint = (dgContact *)contactJoint;
+ const dgContact *joint;
+ joint = (const dgContact *)contactJoint;
TRACE_FUNTION(__FUNCTION__);
@@ -5385,8 +5385,8 @@ void *NewtonContactJointGetFirstContact(const NewtonJoint *const contactJoint) {
// See also: NewtonContactJointGetFirstContact, NewtonContactGetMaterial, NewtonContactJointRemoveContact
void *NewtonContactJointGetNextContact(const NewtonJoint *const contactJoint,
void *const contact) {
- dgContact *joint;
- joint = (dgContact *)contactJoint;
+ const dgContact *joint;
+ joint = (const dgContact *)contactJoint;
TRACE_FUNTION(__FUNCTION__);
@@ -5408,7 +5408,7 @@ void *NewtonContactJointGetNextContact(const NewtonJoint *const contactJoint,
// Return: first contact contact array of the joint contact exist, NULL otherwise
//
// See also: NewtonBodyGetFirstContactJoint, NewtonBodyGetNextContactJoint, NewtonContactJointGetFirstContact, NewtonContactJointGetNextContact
-void NewtonContactJointRemoveContact(const NewtonJoint *const contactJoint,
+void NewtonContactJointRemoveContact(NewtonJoint *contactJoint,
void *const contact) {
dgContact *joint;
joint = (dgContact *)contactJoint;
@@ -5431,7 +5431,7 @@ void NewtonContactJointRemoveContact(const NewtonJoint *const contactJoint,
// Return: first contact contact array of the joint contact exist, NULL otherwise
//
// See also: NewtonContactJointGetFirstContact, NewtonContactJointGetNextContact
-NewtonMaterial *NewtonContactGetMaterial(const void *const contact) {
+NewtonMaterial *NewtonContactGetMaterial(void *const contact) {
dgList<dgContactMaterial>::dgListNode *node;
TRACE_FUNTION(__FUNCTION__);
@@ -5494,8 +5494,8 @@ void NewtonBodyAddBuoyancyForce(const NewtonBody *const bodyPtr,
// This function can be used to swap the collision geometry of bodies at runtime.
//
// See also: NewtonCreateBody, NewtonBodyGetCollision
-void NewtonBodySetCollision(const NewtonBody *const bodyPtr,
- const NewtonCollision *const collisionPtr) {
+void NewtonBodySetCollision(NewtonBody *bodyPtr,
+ NewtonCollision *collisionPtr) {
dgBody *body;
dgCollision *collision;
@@ -5560,8 +5560,8 @@ void NewtonBodySetCollision(const NewtonBody *const bodyPtr,
//
// See also: NewtonCreateBody, NewtonBodySetCollision
NewtonCollision *NewtonBodyGetCollision(const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return (NewtonCollision *)body->GetCollision();
@@ -5579,7 +5579,7 @@ NewtonCollision *NewtonBodyGetCollision(const NewtonBody *const bodyPtr) {
// Remarks: When the application creates a body, the default material group, *defaultGroupId*, is applied by default.
//
// See also: NewtonBodyGetMaterialGroupID, NewtonMaterialCreateGroupID, NewtonMaterialGetDefaultGroupID
-void NewtonBodySetMaterialGroupID(const NewtonBody *const bodyPtr, int id) {
+void NewtonBodySetMaterialGroupID(NewtonBody *bodyPtr, int id) {
dgBody *const body = (dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
@@ -5597,7 +5597,7 @@ void NewtonBodySetMaterialGroupID(const NewtonBody *const bodyPtr, int id) {
//
// See also: NewtonBodySetMaterialGroupID
int NewtonBodyGetMaterialGroupID(const NewtonBody *const bodyPtr) {
- dgBody *const body = (dgBody *)bodyPtr;
+ const dgBody *const body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return int(body->GetGroupID());
@@ -5633,7 +5633,7 @@ int NewtonBodyGetMaterialGroupID(const NewtonBody *const bodyPtr) {
// and bodies that move a height speed.
//
// See also: NewtonBodyGetContinuousCollisionMode, NewtonBodySetContinuousCollisionMode
-void NewtonBodySetContinuousCollisionMode(const NewtonBody *const bodyPtr,
+void NewtonBodySetContinuousCollisionMode(NewtonBody *bodyPtr,
unsigned state) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -5659,8 +5659,8 @@ void NewtonBodySetContinuousCollisionMode(const NewtonBody *const bodyPtr,
//
// See also: NewtonBodySetContinuousCollisionMode, NewtonBodySetContinuousCollisionMode
int NewtonBodyGetContinuousCollisionMode(const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return body->GetContinuesCollisionMode() ? 1 : false;
@@ -5683,7 +5683,7 @@ int NewtonBodyGetContinuousCollisionMode(const NewtonBody *const bodyPtr) {
// for jointed bodies.
//
// See also: NewtonBodySetMaterialGroupID
-void NewtonBodySetJointRecursiveCollision(const NewtonBody *const bodyPtr,
+void NewtonBodySetJointRecursiveCollision(NewtonBody *bodyPtr,
unsigned state) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -5702,8 +5702,8 @@ void NewtonBodySetJointRecursiveCollision(const NewtonBody *const bodyPtr,
//
// See also: NewtonBodySetMaterialGroupID
int NewtonBodyGetJointRecursiveCollision(const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return body->GetCollisionWithLinkedBodies() ? 1 : 0;
@@ -5726,8 +5726,8 @@ int NewtonBodyGetJointRecursiveCollision(const NewtonBody *const bodyPtr) {
//
// See also: NewtonBodySetAutoSleep, NewtonBodyGetAutoSleep
int NewtonBodyGetFreezeState(const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return body->GetFreeze() ? 1 : 0;
@@ -5745,7 +5745,7 @@ int NewtonBodyGetFreezeState(const NewtonBody *const bodyPtr) {
// Remarks: This function to no activate the body, is just lock or unlock the body for physics simulation.
//
// See also: NewtonBodyGetFreezeState, NewtonBodySetAutoSleep, NewtonBodyGetAutoSleep
-void NewtonBodySetFreezeState(const NewtonBody *const bodyPtr, int state) {
+void NewtonBodySetFreezeState(NewtonBody *bodyPtr, int state) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -5771,7 +5771,7 @@ void NewtonBodySetFreezeState(const NewtonBody *const bodyPtr, int state) {
// NewtonBodySetFreezeState(body), this will make the body active forever.
//
// See also: NewtonBodyGetFreezeState, NewtonBodySetFreezeState, NewtonBodyGetAutoSleep, NewtonBodySetFreezeTreshold
-void NewtonBodySetAutoSleep(const NewtonBody *const bodyPtr, int state) {
+void NewtonBodySetAutoSleep(NewtonBody *bodyPtr, int state) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -5790,8 +5790,8 @@ void NewtonBodySetAutoSleep(const NewtonBody *const bodyPtr, int state) {
//
// See also: NewtonBodySetAutoSleep, NewtonBodyGetSleepState
int NewtonBodyGetAutoSleep(const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return body->GetAutoSleep() ? 1 : 0;
@@ -5807,8 +5807,8 @@ int NewtonBodyGetAutoSleep(const NewtonBody *const bodyPtr) {
//
// See also: NewtonBodySetAutoSleep
int NewtonBodyGetSleepState(const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
return body->GetSleepState() ? 1 : 0;
}
@@ -5885,13 +5885,13 @@ int NewtonBodyGetSleepState(const NewtonBody *const bodyPtr) {
//
void NewtonBodyGetAABB(const NewtonBody *const bodyPtr, dFloat *const p0,
dFloat *const p1) {
- dgBody *body;
+ const dgBody *body;
dgVector vector0;
dgVector vector1;
TRACE_FUNTION(__FUNCTION__);
- body = (dgBody *)bodyPtr;
+ body = (const dgBody *)bodyPtr;
body->GetAABB(vector0, vector1);
p0[0] = vector0.m_x;
@@ -5911,7 +5911,7 @@ void NewtonBodyGetAABB(const NewtonBody *const bodyPtr, dFloat *const p0,
// *const dFloat* *velocity - pointer to an array of at least three floats containing the velocity vector.
//
// See also: NewtonBodyGetVelocity
-void NewtonBodySetVelocity(const NewtonBody *const bodyPtr,
+void NewtonBodySetVelocity(NewtonBody *bodyPtr,
const dFloat *const velocity) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -5931,8 +5931,8 @@ void NewtonBodySetVelocity(const NewtonBody *const bodyPtr,
// See also: NewtonBodySetVelocity
void NewtonBodyGetVelocity(const NewtonBody *const bodyPtr,
dFloat *const velocity) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
// dgVector& vector = *((dgVector*) velocity);
@@ -5952,7 +5952,7 @@ void NewtonBodyGetVelocity(const NewtonBody *const bodyPtr,
// *const dFloat* *omega - pointer to an array of at least three floats containing the angular velocity vector.
//
// See also: NewtonBodyGetOmega
-void NewtonBodySetOmega(const NewtonBody *const bodyPtr,
+void NewtonBodySetOmega(NewtonBody *bodyPtr,
const dFloat *const omega) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -5971,8 +5971,8 @@ void NewtonBodySetOmega(const NewtonBody *const bodyPtr,
//
// See also: NewtonBodySetOmega
void NewtonBodyGetOmega(const NewtonBody *const bodyPtr, dFloat *const omega) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
// dgVector& vector = *((dgVector*) omega);
@@ -6002,7 +6002,7 @@ void NewtonBodyGetOmega(const NewtonBody *const bodyPtr, dFloat *const omega) {
// adding very large velocities to a body.
//
// See also: NewtonBodyGetLinearDamping
-void NewtonBodySetLinearDamping(const NewtonBody *const bodyPtr,
+void NewtonBodySetLinearDamping(NewtonBody *bodyPtr,
dFloat linearDamp) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -6021,8 +6021,8 @@ void NewtonBodySetLinearDamping(const NewtonBody *const bodyPtr,
//
// See also: NewtonBodySetLinearDamping
dFloat NewtonBodyGetLinearDamping(const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return body->GetLinearDamping();
@@ -6046,7 +6046,7 @@ dFloat NewtonBodyGetLinearDamping(const NewtonBody *const bodyPtr) {
// adding very large velocities to a body.
//
// See also: NewtonBodyGetAngularDamping
-void NewtonBodySetAngularDamping(const NewtonBody *const bodyPtr,
+void NewtonBodySetAngularDamping(NewtonBody *bodyPtr,
const dFloat *angularDamp) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -6067,8 +6067,8 @@ void NewtonBodySetAngularDamping(const NewtonBody *const bodyPtr,
// See also: NewtonBodySetAngularDamping
void NewtonBodyGetAngularDamping(const NewtonBody *const bodyPtr,
dFloat *angularDamp) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
// dgVector& vector = *((dgVector*) angularDamp);
@@ -6140,7 +6140,7 @@ void NewtonBodyGetAngularDamping(const NewtonBody *const bodyPtr,
//
// Remarks: Because *pointDeltaVeloc* represents a change in velocity, this function must be used with care. Repeated calls
// to this function will result in an increase of the velocity of the body and may cause to integrator to lose stability.
-void NewtonBodyAddImpulse(const NewtonBody *const bodyPtr,
+void NewtonBodyAddImpulse(NewtonBody *bodyPtr,
const dFloat *const pointDeltaVeloc, const dFloat *const pointPosit) {
dgBody *body;
dgWorld *world;
@@ -6175,7 +6175,7 @@ void NewtonBodyAddImpulse(const NewtonBody *const bodyPtr,
//
// Remarks: this function apply at general impulse to a body a oppose to a desired change on velocity
// this mean that the body mass, and Inertia will determine the gain on velocity.
-void NewtonBodyApplyImpulseArray(const NewtonBody *const bodyPtr,
+void NewtonBodyApplyImpulseArray(NewtonBody *bodyPtr,
int impuleCount, int strideInByte, const dFloat *const impulseArray,
const dFloat *const pointArray) {
dgBody *body;
@@ -6207,9 +6207,9 @@ void NewtonBodyApplyImpulseArray(const NewtonBody *const bodyPtr,
// Return: Pointer to the ball and socket joint.
//
// Remarks: This function creates a ball and socket and add it to the world. By default joint disables collision with the linked bodies.
-NewtonJoint *NewtonConstraintCreateBall(const NewtonWorld *const newtonWorld,
- const dFloat *pivotPoint, const NewtonBody *const childBody,
- const NewtonBody *const parentBody) {
+NewtonJoint *NewtonConstraintCreateBall(NewtonWorld *newtonWorld,
+ const dFloat *pivotPoint, NewtonBody *childBody,
+ NewtonBody *parentBody) {
dgBody *body0;
dgBody *body1;
Newton *world;
@@ -6235,7 +6235,7 @@ NewtonJoint *NewtonConstraintCreateBall(const NewtonWorld *const newtonWorld,
// all non-zero value for *maxConeAngle* are clamped between 5 degree and 175 degrees
//
// See also: NewtonConstraintCreateBall
-void NewtonBallSetConeLimits(const NewtonJoint *const ball, const dFloat *pin,
+void NewtonBallSetConeLimits(NewtonJoint *ball, const dFloat *pin,
dFloat maxConeAngle, dFloat maxTwistAngle) {
dgBallConstraint *joint;
@@ -6285,7 +6285,7 @@ void NewtonBallSetConeLimits(const NewtonJoint *const ball, const dFloat *pin,
// effects like particles, sound or even to simulate breakable moving parts.
//
// See also: NewtonJointSetUserData
-void NewtonBallSetUserCallback(const NewtonJoint *const ball,
+void NewtonBallSetUserCallback(NewtonJoint *ball,
NewtonBallCallBack callback) {
dgBallConstraint *contraint;
@@ -6308,9 +6308,9 @@ void NewtonBallSetUserCallback(const NewtonJoint *const ball,
//
// See also: NewtonBallSetUserCallback
void NewtonBallGetJointAngle(const NewtonJoint *const ball, dFloat *angle) {
- dgBallConstraint *contraint;
+ const dgBallConstraint *contraint;
- contraint = (dgBallConstraint *)ball;
+ contraint = (const dgBallConstraint *)ball;
dgVector angleVector(contraint->GetJointAngle());
TRACE_FUNTION(__FUNCTION__);
@@ -6333,10 +6333,10 @@ void NewtonBallGetJointAngle(const NewtonJoint *const ball, dFloat *angle) {
//
// See also: NewtonBallSetUserCallback
void NewtonBallGetJointOmega(const NewtonJoint *const ball, dFloat *omega) {
- dgBallConstraint *contraint;
+ const dgBallConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgBallConstraint *)ball;
+ contraint = (const dgBallConstraint *)ball;
dgVector omegaVector(contraint->GetJointOmega());
omega[0] = omegaVector.m_x;
omega[1] = omegaVector.m_y;
@@ -6357,10 +6357,10 @@ void NewtonBallGetJointOmega(const NewtonJoint *const ball, dFloat *omega) {
//
// See also: NewtonBallSetUserCallback
void NewtonBallGetJointForce(const NewtonJoint *const ball, dFloat *const force) {
- dgBallConstraint *contraint;
+ const dgBallConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgBallConstraint *)ball;
+ contraint = (const dgBallConstraint *)ball;
dgVector forceVector(contraint->GetJointForce());
force[0] = forceVector.m_x;
force[1] = forceVector.m_y;
@@ -6386,9 +6386,9 @@ void NewtonBallGetJointForce(const NewtonJoint *const ball, dFloat *const force)
// Return: Pointer to the hinge joint.
//
// Remarks: This function creates a hinge and add it to the world. By default joint disables collision with the linked bodies.
-NewtonJoint *NewtonConstraintCreateHinge(const NewtonWorld *const newtonWorld,
+NewtonJoint *NewtonConstraintCreateHinge(NewtonWorld *newtonWorld,
const dFloat *pivotPoint, const dFloat *pinDir,
- const NewtonBody *const childBody, const NewtonBody *const parentBody) {
+ NewtonBody *childBody, NewtonBody *parentBody) {
dgBody *body0;
dgBody *body1;
Newton *world;
@@ -6416,7 +6416,7 @@ NewtonJoint *NewtonConstraintCreateHinge(const NewtonWorld *const newtonWorld,
// effects like particles, sound or even to simulate breakable moving parts.
//
// See also: NewtonJointGetUserData, NewtonJointSetUserData
-void NewtonHingeSetUserCallback(const NewtonJoint *const hinge,
+void NewtonHingeSetUserCallback(NewtonJoint *hinge,
NewtonHingeCallBack callback) {
dgHingeConstraint *contraint;
@@ -6438,10 +6438,10 @@ void NewtonHingeSetUserCallback(const NewtonJoint *const hinge,
//
// See also: NewtonHingeSetUserCallback
dFloat NewtonHingeGetJointAngle(const NewtonJoint *const hinge) {
- dgHingeConstraint *contraint;
+ const dgHingeConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgHingeConstraint *)hinge;
+ contraint = (const dgHingeConstraint *)hinge;
return contraint->GetJointAngle();
}
@@ -6458,10 +6458,10 @@ dFloat NewtonHingeGetJointAngle(const NewtonJoint *const hinge) {
//
// See also: NewtonHingeSetUserCallback
dFloat NewtonHingeGetJointOmega(const NewtonJoint *const hinge) {
- dgHingeConstraint *contraint;
+ const dgHingeConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgHingeConstraint *)hinge;
+ contraint = (const dgHingeConstraint *)hinge;
return contraint->GetJointOmega();
}
@@ -6480,11 +6480,11 @@ dFloat NewtonHingeGetJointOmega(const NewtonJoint *const hinge) {
// See also: NewtonHingeSetUserCallback
dFloat NewtonHingeCalculateStopAlpha(const NewtonJoint *const hinge,
const NewtonHingeSliderUpdateDesc *const desc, dFloat angle) {
- dgHingeConstraint *contraint;
+ const dgHingeConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgHingeConstraint *)hinge;
- return contraint->CalculateStopAlpha(angle, (dgJointCallBackParam *)desc);
+ contraint = (const dgHingeConstraint *)hinge;
+ return contraint->CalculateStopAlpha(angle, (const dgJointCallBackParam *)desc);
}
// Name: NewtonHingeGetJointForce
@@ -6502,10 +6502,10 @@ dFloat NewtonHingeCalculateStopAlpha(const NewtonJoint *const hinge,
// See also: NewtonHingeSetUserCallback
void NewtonHingeGetJointForce(const NewtonJoint *const hinge,
dFloat *const force) {
- dgHingeConstraint *contraint;
+ const dgHingeConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgHingeConstraint *)hinge;
+ contraint = (const dgHingeConstraint *)hinge;
dgVector forceVector(contraint->GetJointForce());
force[0] = forceVector.m_x;
force[1] = forceVector.m_y;
@@ -6531,9 +6531,9 @@ void NewtonHingeGetJointForce(const NewtonJoint *const hinge,
// Return: Pointer to the slider joint.
//
// Remarks: This function creates a slider and add it to the world. By default joint disables collision with the linked bodies.
-NewtonJoint *NewtonConstraintCreateSlider(const NewtonWorld *const newtonWorld,
+NewtonJoint *NewtonConstraintCreateSlider(NewtonWorld *newtonWorld,
const dFloat *pivotPoint, const dFloat *pinDir,
- const NewtonBody *const childBody, const NewtonBody *const parentBody) {
+ NewtonBody *childBody, NewtonBody *parentBody) {
dgBody *body0;
dgBody *body1;
Newton *world;
@@ -6561,7 +6561,7 @@ NewtonJoint *NewtonConstraintCreateSlider(const NewtonWorld *const newtonWorld,
// effects like particles, sound or even to simulate breakable moving parts.
//
// See also: NewtonJointGetUserData, NewtonJointSetUserData
-void NewtonSliderSetUserCallback(const NewtonJoint *const slider,
+void NewtonSliderSetUserCallback(NewtonJoint *slider,
NewtonSliderCallBack callback) {
dgSlidingConstraint *contraint;
@@ -6583,10 +6583,10 @@ void NewtonSliderSetUserCallback(const NewtonJoint *const slider,
//
// See also: NewtonSliderSetUserCallback
dFloat NewtonSliderGetJointPosit(const NewtonJoint *Slider) {
- dgSlidingConstraint *contraint;
+ const dgSlidingConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgSlidingConstraint *)Slider;
+ contraint = (const dgSlidingConstraint *)Slider;
return contraint->GetJointPosit();
}
@@ -6603,10 +6603,10 @@ dFloat NewtonSliderGetJointPosit(const NewtonJoint *Slider) {
//
// See also: NewtonSliderSetUserCallback
dFloat NewtonSliderGetJointVeloc(const NewtonJoint *Slider) {
- dgSlidingConstraint *contraint;
+ const dgSlidingConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgSlidingConstraint *)Slider;
+ contraint = (const dgSlidingConstraint *)Slider;
return contraint->GetJointVeloc();
}
@@ -6625,11 +6625,11 @@ dFloat NewtonSliderGetJointVeloc(const NewtonJoint *Slider) {
// See also: NewtonSliderSetUserCallback
dFloat NewtonSliderCalculateStopAccel(const NewtonJoint *const slider,
const NewtonHingeSliderUpdateDesc *const desc, dFloat distance) {
- dgSlidingConstraint *contraint;
+ const dgSlidingConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgSlidingConstraint *)slider;
- return contraint->CalculateStopAccel(distance, (dgJointCallBackParam *)desc);
+ contraint = (const dgSlidingConstraint *)slider;
+ return contraint->CalculateStopAccel(distance, (const dgJointCallBackParam *)desc);
}
// Name: NewtonSliderGetJointForce
@@ -6647,10 +6647,10 @@ dFloat NewtonSliderCalculateStopAccel(const NewtonJoint *const slider,
// See also: NewtonSliderSetUserCallback
void NewtonSliderGetJointForce(const NewtonJoint *const slider,
dFloat *const force) {
- dgSlidingConstraint *contraint;
+ const dgSlidingConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgSlidingConstraint *)slider;
+ contraint = (const dgSlidingConstraint *)slider;
dgVector forceVector(contraint->GetJointForce());
force[0] = forceVector.m_x;
force[1] = forceVector.m_y;
@@ -6677,9 +6677,9 @@ void NewtonSliderGetJointForce(const NewtonJoint *const slider,
//
// Remarks: This function creates a corkscrew and add it to the world. By default joint disables collision with the linked bodies.
NewtonJoint *NewtonConstraintCreateCorkscrew(
- const NewtonWorld *const newtonWorld, const dFloat *pivotPoint,
- const dFloat *pinDir, const NewtonBody *const childBody,
- const NewtonBody *const parentBody) {
+ NewtonWorld *newtonWorld, const dFloat *pivotPoint,
+ const dFloat *pinDir, NewtonBody *childBody,
+ NewtonBody *parentBody) {
dgBody *body0;
dgBody *body1;
Newton *world;
@@ -6714,7 +6714,7 @@ NewtonJoint *NewtonConstraintCreateCorkscrew(
// if the application only wants to change the joint angular and linear acceleration the return code is 3
//
// See also: NewtonJointGetUserData, NewtonJointSetUserData
-void NewtonCorkscrewSetUserCallback(const NewtonJoint *const corkscrew,
+void NewtonCorkscrewSetUserCallback(NewtonJoint *corkscrew,
NewtonCorkscrewCallBack callback) {
dgCorkscrewConstraint *contraint;
@@ -6736,10 +6736,10 @@ void NewtonCorkscrewSetUserCallback(const NewtonJoint *const corkscrew,
//
// See also: NewtonCorkscrewSetUserCallback
dFloat NewtonCorkscrewGetJointPosit(const NewtonJoint *const corkscrew) {
- dgCorkscrewConstraint *contraint;
+ const dgCorkscrewConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgCorkscrewConstraint *)corkscrew;
+ contraint = (const dgCorkscrewConstraint *)corkscrew;
return contraint->GetJointPosit();
}
@@ -6756,10 +6756,10 @@ dFloat NewtonCorkscrewGetJointPosit(const NewtonJoint *const corkscrew) {
//
// See also: NewtonCorkscrewSetUserCallback
dFloat NewtonCorkscrewGetJointVeloc(const NewtonJoint *const corkscrew) {
- dgCorkscrewConstraint *contraint;
+ const dgCorkscrewConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgCorkscrewConstraint *)corkscrew;
+ contraint = (const dgCorkscrewConstraint *)corkscrew;
return contraint->GetJointVeloc();
}
@@ -6776,10 +6776,10 @@ dFloat NewtonCorkscrewGetJointVeloc(const NewtonJoint *const corkscrew) {
//
// See also: NewtonCorkscrewSetUserCallback
dFloat NewtonCorkscrewGetJointAngle(const NewtonJoint *const corkscrew) {
- dgCorkscrewConstraint *contraint;
+ const dgCorkscrewConstraint *contraint;
TRACE_FUNTION(__FUNCTION__);
- contraint = (dgCorkscrewConstraint *)corkscrew;
+ contraint = (const dgCorkscrewConstraint *)corkscrew;
return contraint->GetJointAngle();
}
@@ -7494,7 +7494,7 @@ void NewtonUserJointSetFeedbackCollectorCallback(NewtonJoint *joint,
// if the application allocate some resource to store the user data, the application can register a joint destructor to get rid of the allocated resource when the Joint is destroyed
//
// See also: NewtonConstraintCreateJoint, NewtonJointSetDestructor
-void NewtonJointSetUserData(const NewtonJoint *const joint,
+void NewtonJointSetUserData(NewtonJoint *joint,
void *const userData) {
dgConstraint *contraint;
@@ -7651,7 +7651,7 @@ NewtonBody *NewtonJointGetBody1(const NewtonJoint *const joint) {
// Remarks: if the joint is destroyed the collision state of the two bodies linked by this joint is determined by the material pair assigned to each body.
//
// See also: NewtonJointGetCollisionState, NewtonBodySetJointRecursiveCollision
-void NewtonJointSetCollisionState(const NewtonJoint *const joint, int state) {
+void NewtonJointSetCollisionState(NewtonJoint *joint, int state) {
dgConstraint *contraint;
contraint = (dgConstraint *)joint;
@@ -7675,8 +7675,8 @@ void NewtonJointSetCollisionState(const NewtonJoint *const joint, int state) {
//
// See also: NewtonJointSetCollisionState
int NewtonJointGetCollisionState(const NewtonJoint *const joint) {
- dgConstraint *contraint;
- contraint = (dgConstraint *)joint;
+ const dgConstraint *contraint;
+ contraint = (const dgConstraint *)joint;
TRACE_FUNTION(__FUNCTION__);
return contraint->IsCollidable() ? 1 : 0;
@@ -7704,7 +7704,7 @@ int NewtonJointGetCollisionState(const NewtonJoint *const joint) {
// value will make the joint more stable but weaker.
//
// See also: NewtonJointGetStiffness
-void NewtonJointSetStiffness(const NewtonJoint *const joint, dFloat stiffness) {
+void NewtonJointSetStiffness(NewtonJoint *joint, dFloat stiffness) {
dgConstraint *contraint;
contraint = (dgConstraint *)joint;
@@ -7780,8 +7780,8 @@ void NewtonJointSetDestructor(NewtonJoint *joint,
// breakable joints
//
// See also: NewtonConstraintCreateJoint, NewtonConstraintCreateHinge, NewtonConstraintCreateSlider
-void NewtonDestroyJoint(const NewtonWorld *const newtonWorld,
- const NewtonJoint *const joint) {
+void NewtonDestroyJoint(NewtonWorld *newtonWorld,
+ NewtonJoint *joint) {
Newton *world;
world = (Newton *)newtonWorld;
@@ -8238,7 +8238,7 @@ NewtonMesh *NewtonMeshCreateFirstSingleSegment(const NewtonMesh *const mesh) {
effectMesh->BeginConectedSurface();
if (effectMesh->GetConectedSurface(segment)) {
dgMeshEffect *const solid = new (effectMesh->GetAllocator()) dgMeshEffect(
- segment, *((dgMeshEffect *)mesh));
+ segment, *((const dgMeshEffect *)mesh));
return (NewtonMesh *)solid;
} else {
return NULL;
diff --git a/engines/hpl1/engine/libraries/newton/Newton.h b/engines/hpl1/engine/libraries/newton/Newton.h
index 61900471fc2..44a7877b0f8 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.h
+++ b/engines/hpl1/engine/libraries/newton/Newton.h
@@ -669,28 +669,28 @@ NEWTON_API void NewtonBodyCalculateInverseDynamicsForce(const NewtonBody *const
NEWTON_API void NewtonBodySetMatrix(const NewtonBody *const body, const dFloat *const matrix);
NEWTON_API void NewtonBodySetMatrixRecursive(const NewtonBody *const body, const dFloat *const matrix);
NEWTON_API void NewtonBodySetMassMatrix(const NewtonBody *const body, dFloat mass, dFloat Ixx, dFloat Iyy, dFloat Izz);
-NEWTON_API void NewtonBodySetMaterialGroupID(const NewtonBody *const body, int id);
-NEWTON_API void NewtonBodySetContinuousCollisionMode(const NewtonBody *const body, unsigned state);
-NEWTON_API void NewtonBodySetJointRecursiveCollision(const NewtonBody *const body, unsigned state);
-NEWTON_API void NewtonBodySetOmega(const NewtonBody *const body, const dFloat *const omega);
-NEWTON_API void NewtonBodySetVelocity(const NewtonBody *const body, const dFloat *const velocity);
+NEWTON_API void NewtonBodySetMaterialGroupID(NewtonBody *body, int id);
+NEWTON_API void NewtonBodySetContinuousCollisionMode(NewtonBody *body, unsigned state);
+NEWTON_API void NewtonBodySetJointRecursiveCollision(NewtonBody *body, unsigned state);
+NEWTON_API void NewtonBodySetOmega(NewtonBody *body, const dFloat *const omega);
+NEWTON_API void NewtonBodySetVelocity(NewtonBody *body, const dFloat *const velocity);
NEWTON_API void NewtonBodySetForce(const NewtonBody *const body, const dFloat *const force);
-NEWTON_API void NewtonBodySetTorque(const NewtonBody *const body, const dFloat *const torque);
+NEWTON_API void NewtonBodySetTorque(NewtonBody *body, const dFloat *const torque);
-NEWTON_API void NewtonBodySetCentreOfMass(const NewtonBody *const body, const dFloat *const com);
-NEWTON_API void NewtonBodySetLinearDamping(const NewtonBody *const body, dFloat linearDamp);
-NEWTON_API void NewtonBodySetAngularDamping(const NewtonBody *const body, const dFloat *const angularDamp);
+NEWTON_API void NewtonBodySetCentreOfMass(NewtonBody *body, const dFloat *const com);
+NEWTON_API void NewtonBodySetLinearDamping(NewtonBody *body, dFloat linearDamp);
+NEWTON_API void NewtonBodySetAngularDamping(NewtonBody *body, const dFloat *const angularDamp);
NEWTON_API void NewtonBodySetUserData(const NewtonBody *const body, void *const userData);
-NEWTON_API void NewtonBodySetCollision(const NewtonBody *const body, const NewtonCollision *const collision);
+NEWTON_API void NewtonBodySetCollision(NewtonBody *body, NewtonCollision *collision);
NEWTON_API int NewtonBodyGetSleepState(const NewtonBody *const body);
NEWTON_API int NewtonBodyGetAutoSleep(const NewtonBody *const body);
-NEWTON_API void NewtonBodySetAutoSleep(const NewtonBody *const body, int state);
+NEWTON_API void NewtonBodySetAutoSleep(NewtonBody *body, int state);
NEWTON_API int NewtonBodyGetFreezeState(const NewtonBody *const body);
-NEWTON_API void NewtonBodySetFreezeState(const NewtonBody *const body, int state);
+NEWTON_API void NewtonBodySetFreezeState(NewtonBody *body, int state);
// NEWTON_API void NewtonBodySetAutoFreeze(const NewtonBody* const body, int state);
@@ -743,9 +743,9 @@ NEWTON_API void *NewtonContactJointGetFirstContact(const NewtonJoint *const cont
NEWTON_API void *NewtonContactJointGetNextContact(const NewtonJoint *const contactJoint, void *const contact);
NEWTON_API int NewtonContactJointGetContactCount(const NewtonJoint *const contactJoint);
-NEWTON_API void NewtonContactJointRemoveContact(const NewtonJoint *const contactJoint, void *const contact);
+NEWTON_API void NewtonContactJointRemoveContact(NewtonJoint *contactJoint, void *const contact);
-NEWTON_API NewtonMaterial *NewtonContactGetMaterial(const void *const contact);
+NEWTON_API NewtonMaterial *NewtonContactGetMaterial(void *const contact);
NEWTON_API void NewtonBodyAddBuoyancyForce(const NewtonBody *const body, dFloat fluidDensity,
@@ -753,10 +753,10 @@ NEWTON_API void NewtonBodyAddBuoyancyForce(const NewtonBody *const body, dFloat
const dFloat *const gravityVector, NewtonGetBuoyancyPlane buoyancyPlane, void *const context);
// NEWTON_API void NewtonBodyForEachPolygonDo (const NewtonBody* const body, NewtonCollisionIterator callback);
-NEWTON_API void NewtonBodyAddImpulse(const NewtonBody *const body, const dFloat *const pointDeltaVeloc, const dFloat *const pointPosit);
+NEWTON_API void NewtonBodyAddImpulse(NewtonBody *body, const dFloat *const pointDeltaVeloc, const dFloat *const pointPosit);
-NEWTON_API void NewtonBodyApplyImpulseArray(const NewtonBody *const body, int impuleCount, int strideInByte, const dFloat *const impulseArray, const dFloat *const pointArray);
+NEWTON_API void NewtonBodyApplyImpulseArray(NewtonBody *body, int impuleCount, int strideInByte, const dFloat *const impulseArray, const dFloat *const pointArray);
// **********************************************************************************************
@@ -765,19 +765,19 @@ NEWTON_API void NewtonBodyApplyImpulseArray(const NewtonBody *const body, int im
//
// **********************************************************************************************
NEWTON_API void *NewtonJointGetUserData(const NewtonJoint *const joint);
-NEWTON_API void NewtonJointSetUserData(const NewtonJoint *const joint, void *const userData);
+NEWTON_API void NewtonJointSetUserData(NewtonJoint *joint, void *const userData);
NEWTON_API NewtonBody *NewtonJointGetBody0(const NewtonJoint *const joint);
NEWTON_API NewtonBody *NewtonJointGetBody1(const NewtonJoint *const joint);
NEWTON_API void NewtonJointGetInfo(const NewtonJoint *const joint, NewtonJointRecord *const info);
NEWTON_API int NewtonJointGetCollisionState(const NewtonJoint *const joint);
-NEWTON_API void NewtonJointSetCollisionState(const NewtonJoint *const joint, int state);
+NEWTON_API void NewtonJointSetCollisionState(NewtonJoint *joint, int state);
NEWTON_API dFloat NewtonJointGetStiffness(const NewtonJoint *const joint);
-NEWTON_API void NewtonJointSetStiffness(const NewtonJoint *const joint, dFloat state);
+NEWTON_API void NewtonJointSetStiffness(NewtonJoint *joint, dFloat state);
-NEWTON_API void NewtonDestroyJoint(const NewtonWorld *const newtonWorld, const NewtonJoint *const joint);
+NEWTON_API void NewtonDestroyJoint(NewtonWorld *newtonWorld, NewtonJoint *joint);
NEWTON_API void NewtonJointSetDestructor(const NewtonJoint *const joint, NewtonConstraintDestructor destructor);
@@ -788,24 +788,24 @@ NEWTON_API void NewtonJointSetDestructor(const NewtonJoint *const joint, NewtonC
// Ball and Socket joint functions
//
// **********************************************************************************************
-NEWTON_API NewtonJoint *NewtonConstraintCreateBall(const NewtonWorld *const newtonWorld, const dFloat *pivotPoint,
- const NewtonBody *const childBody, const NewtonBody *const parentBody);
-NEWTON_API void NewtonBallSetUserCallback(const NewtonJoint *const ball, NewtonBallCallBack callback);
+NEWTON_API NewtonJoint *NewtonConstraintCreateBall(NewtonWorld *newtonWorld, const dFloat *pivotPoint,
+ NewtonBody *childBody, NewtonBody *parentBody);
+NEWTON_API void NewtonBallSetUserCallback(NewtonJoint *ball, NewtonBallCallBack callback);
NEWTON_API void NewtonBallGetJointAngle(const NewtonJoint *const ball, dFloat *angle);
NEWTON_API void NewtonBallGetJointOmega(const NewtonJoint *const ball, dFloat *omega);
NEWTON_API void NewtonBallGetJointForce(const NewtonJoint *const ball, dFloat *const force);
-NEWTON_API void NewtonBallSetConeLimits(const NewtonJoint *const ball, const dFloat *pin, dFloat maxConeAngle, dFloat maxTwistAngle);
+NEWTON_API void NewtonBallSetConeLimits(NewtonJoint *ball, const dFloat *pin, dFloat maxConeAngle, dFloat maxTwistAngle);
// **********************************************************************************************
//
// Hinge joint functions
//
// **********************************************************************************************
-NEWTON_API NewtonJoint *NewtonConstraintCreateHinge(const NewtonWorld *const newtonWorld,
+NEWTON_API NewtonJoint *NewtonConstraintCreateHinge(NewtonWorld *newtonWorld,
const dFloat *pivotPoint, const dFloat *pinDir,
- const NewtonBody *const childBody, const NewtonBody *const parentBody);
+ NewtonBody *childBody, NewtonBody *parentBody);
-NEWTON_API void NewtonHingeSetUserCallback(const NewtonJoint *const hinge, NewtonHingeCallBack callback);
+NEWTON_API void NewtonHingeSetUserCallback(NewtonJoint *hinge, NewtonHingeCallBack callback);
NEWTON_API dFloat NewtonHingeGetJointAngle(const NewtonJoint *const hinge);
NEWTON_API dFloat NewtonHingeGetJointOmega(const NewtonJoint *const hinge);
NEWTON_API void NewtonHingeGetJointForce(const NewtonJoint *const hinge, dFloat *const force);
@@ -816,10 +816,10 @@ NEWTON_API dFloat NewtonHingeCalculateStopAlpha(const NewtonJoint *const hinge,
// Slider joint functions
//
// **********************************************************************************************
-NEWTON_API NewtonJoint *NewtonConstraintCreateSlider(const NewtonWorld *const newtonWorld,
+NEWTON_API NewtonJoint *NewtonConstraintCreateSlider(NewtonWorld *newtonWorld,
const dFloat *pivotPoint, const dFloat *pinDir,
- const NewtonBody *const childBody, const NewtonBody *const parentBody);
-NEWTON_API void NewtonSliderSetUserCallback(const NewtonJoint *const slider, NewtonSliderCallBack callback);
+ NewtonBody *childBody, NewtonBody *parentBody);
+NEWTON_API void NewtonSliderSetUserCallback(NewtonJoint *slider, NewtonSliderCallBack callback);
NEWTON_API dFloat NewtonSliderGetJointPosit(const NewtonJoint *slider);
NEWTON_API dFloat NewtonSliderGetJointVeloc(const NewtonJoint *slider);
NEWTON_API void NewtonSliderGetJointForce(const NewtonJoint *const slider, dFloat *const force);
@@ -831,10 +831,10 @@ NEWTON_API dFloat NewtonSliderCalculateStopAccel(const NewtonJoint *const slider
// Corkscrew joint functions
//
// **********************************************************************************************
-NEWTON_API NewtonJoint *NewtonConstraintCreateCorkscrew(const NewtonWorld *const newtonWorld,
+NEWTON_API NewtonJoint *NewtonConstraintCreateCorkscrew(NewtonWorld *newtonWorld,
const dFloat *pivotPoint, const dFloat *pinDir,
- const NewtonBody *const childBody, const NewtonBody *const parentBody);
-NEWTON_API void NewtonCorkscrewSetUserCallback(const NewtonJoint *const corkscrew, NewtonCorkscrewCallBack callback);
+ NewtonBody *childBody, NewtonBody *parentBody);
+NEWTON_API void NewtonCorkscrewSetUserCallback(NewtonJoint *corkscrew, NewtonCorkscrewCallBack callback);
NEWTON_API dFloat NewtonCorkscrewGetJointPosit(const NewtonJoint *const corkscrew);
NEWTON_API dFloat NewtonCorkscrewGetJointAngle(const NewtonJoint *const corkscrew);
NEWTON_API dFloat NewtonCorkscrewGetJointVeloc(const NewtonJoint *const corkscrew);
diff --git a/engines/hpl1/engine/libraries/newton/NewtonClass.cpp b/engines/hpl1/engine/libraries/newton/NewtonClass.cpp
index 909eea8152b..9a672e2c1fb 100644
--- a/engines/hpl1/engine/libraries/newton/NewtonClass.cpp
+++ b/engines/hpl1/engine/libraries/newton/NewtonClass.cpp
@@ -271,4 +271,3 @@ void NewtonUserJoint::SetUpdateFeedbackFunction(
dgUserConstraint::SetUpdateFeedbackFunction(
(ConstraintsForceFeeback) getFeedback);
}
-
Commit: 08311ab215a95e8ba77975eab6cbae87ffb969ce
https://github.com/scummvm/scummvm/commit/08311ab215a95e8ba77975eab6cbae87ffb969ce
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:19+01:00
Commit Message:
HPL1: Fix more warnings
Changed paths:
engines/hpl1/engine/libraries/angelscript/sources/as_config.h
engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_config.h b/engines/hpl1/engine/libraries/angelscript/sources/as_config.h
index 5b68ff67994..edf85ab7f61 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_config.h
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_config.h
@@ -639,7 +639,7 @@
// MSVC2015 can now use CLang too, but it shouldn't go in here
#if (defined(__GNUC__) && !defined(__SNC__) && !defined(_MSC_VER)) || defined(EPPC) || defined(__CYGWIN__) // JWC -- use this instead for Wii
#define GNU_STYLE_VIRTUAL_METHOD
-#define MULTI_BASE_OFFSET(x) (*((asPWORD*)(&x)+1))
+#define MULTI_BASE_OFFSET(x) (*((const asPWORD*)(&x)+1))
#define asVSNPRINTF(a, b, c, d) vsnprintf(a, b, c, d)
#define CALLEE_POPS_HIDDEN_RETURN_POINTER
#define COMPLEX_OBJS_PASSED_BY_REF
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp b/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
index d6ee4068e8d..ce799b1e8dd 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
@@ -351,7 +351,7 @@ dgCollision *dgWorld::CreateCollisionCompound(dgInt32 count,
dgCollision *const array[]) {
// compound collision are not cached
return new (m_allocator) dgCollisionCompound(count,
- (dgCollisionConvex **)array, this);
+ (dgCollisionConvex * const*)array, this);
}
// dgCollision* dgWorld::CreateCollisionCompoundBreakable (
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp b/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
index 64749d74841..aaf7d87cd75 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
@@ -95,7 +95,7 @@ static inline dgInt32 CompareIslands(const dgIsland *const islandA,
}
dgBody *dgWorld::GetIslandBody(const void *const islandPtr, dgInt32 index) const {
- const dgIslandCallbackStruct &island = *(dgIslandCallbackStruct *)islandPtr;
+ const dgIslandCallbackStruct &island = *(const dgIslandCallbackStruct *)islandPtr;
char *ptr = &((char *)island.m_bodyArray)[island.m_strideInByte * index];
dgBody **bodyPtr = (dgBody **)ptr;
Commit: 13b899b8e4feb68c9708b653ba6761aab6df601f
https://github.com/scummvm/scummvm/commit/13b899b8e4feb68c9708b653ba6761aab6df601f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:19+01:00
Commit Message:
HPL1: move global instance to class scope
Changed paths:
engines/hpl1/engine/ai/AINodeGenerator.cpp
engines/hpl1/engine/ai/AINodeGenerator.h
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.cpp b/engines/hpl1/engine/ai/AINodeGenerator.cpp
index c1b8d46accf..465514a14bf 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.cpp
+++ b/engines/hpl1/engine/ai/AINodeGenerator.cpp
@@ -65,24 +65,16 @@ cAINodeGeneratorParams::cAINodeGeneratorParams() {
//-----------------------------------------------------------------------
-class cCollideRayCallback : public iPhysicsRayCallback {
-public:
- virtual ~cCollideRayCallback() {}
- bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
- if (pBody->GetMass() != 0)
- return true;
-
- mbIntersected = true;
- mvPos = apParams->mvPoint;
- mfDist = apParams->mfDist;
-
- return false;
- }
+bool cCollideRayCallback::OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams) {
+ if (pBody->GetMass() != 0)
+ return true;
- bool mbIntersected;
- cVector3f mvPos;
- float mfDist;
-};
+ mbIntersected = true;
+ mvPos = apParams->mvPoint;
+ mfDist = apParams->mfDist;
+
+ return false;
+}
//-----------------------------------------------------------------------
@@ -92,7 +84,11 @@ public:
//-----------------------------------------------------------------------
+// TODO: remove after the game is tested
+unsigned generatorInstances = 0;
+
cAINodeGenerator::cAINodeGenerator() {
+ assert(++generatorInstances == 1);
}
cAINodeGenerator::~cAINodeGenerator() {
@@ -106,7 +102,7 @@ cAINodeGenerator::~cAINodeGenerator() {
//-----------------------------------------------------------------------
-static cCollideRayCallback gCollideRayCallback;
+//static cCollideRayCallback gCollideRayCallback;
//-----------------------------------------------------------------------
@@ -233,16 +229,16 @@ void cAINodeGenerator::Generate(cWorld3D *apWorld, cAINodeGeneratorParams *apPar
// Check if there are any walls close by.
for (int i = 0; i < 4; ++i) {
- gCollideRayCallback.mbIntersected = false;
- pPhysicsWorld->CastRay(&gCollideRayCallback, Node.mvPos, Node.mvPos + vEnds[i], true, false, true);
+ _rayCallback.mbIntersected = false;
+ pPhysicsWorld->CastRay(&_rayCallback, Node.mvPos, Node.mvPos + vEnds[i], true, false, true);
- if (gCollideRayCallback.mbIntersected) {
+ if (_rayCallback.mbIntersected) {
// Log("Walldistance %f : Add: (%s) Push (%s) Min: %f\n",gCollideRayCallback.mfDist,
// vEnds[i].ToString().c_str(),
// vPushBackDirs[i].ToString().c_str(),
// mpParams->mfMinWallDist);
- if (gCollideRayCallback.mfDist < mpParams->mfMinWallDist) {
- Node.mvPos += vPushBackDirs[i] * (mpParams->mfMinWallDist - gCollideRayCallback.mfDist);
+ if (_rayCallback.mfDist < mpParams->mfMinWallDist) {
+ Node.mvPos += vPushBackDirs[i] * (mpParams->mfMinWallDist - _rayCallback.mfDist);
}
}
}
diff --git a/engines/hpl1/engine/ai/AINodeGenerator.h b/engines/hpl1/engine/ai/AINodeGenerator.h
index 74ac55ac536..f7de91806d5 100644
--- a/engines/hpl1/engine/ai/AINodeGenerator.h
+++ b/engines/hpl1/engine/ai/AINodeGenerator.h
@@ -38,6 +38,16 @@ namespace hpl {
class cWorld3D;
+class cCollideRayCallback : public iPhysicsRayCallback {
+public:
+ virtual ~cCollideRayCallback() {}
+ bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
+
+ bool mbIntersected;
+ cVector3f mvPos;
+ float mfDist;
+};
+
//-------------------------------
class cAINodeGeneratorParams {
@@ -73,6 +83,7 @@ private:
cAINodeGeneratorParams *mpParams;
cWorld3D *mpWorld;
tTempAiNodeList *mpNodeList;
+ cCollideRayCallback _rayCallback;
};
} // namespace hpl
Commit: 72c336296fa714d85cd62aac7fea784109169b3a
https://github.com/scummvm/scummvm/commit/72c336296fa714d85cd62aac7fea784109169b3a
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:19+01:00
Commit Message:
HPL1: make Vector2 constructors constexpr
Changed paths:
engines/hpl1/engine/math/Vector2.h
diff --git a/engines/hpl1/engine/math/Vector2.h b/engines/hpl1/engine/math/Vector2.h
index 2979d6b460a..50f71b28a1c 100644
--- a/engines/hpl1/engine/math/Vector2.h
+++ b/engines/hpl1/engine/math/Vector2.h
@@ -48,22 +48,16 @@ public:
//////////////////////////////////////////
// Constructors
/////////////////////////////////////////
- cVector2() {
- x = 0;
- y = 0;
+ constexpr cVector2() : x(0), y(0) {
}
- cVector2(T aVal) {
- x = aVal;
- y = aVal;
+
+ constexpr cVector2(T aVal) : x(aVal), y(aVal) {
}
- cVector2(T aX, T aY) {
- x = aX;
- y = aY;
+
+ constexpr cVector2(T aX, T aY) : x(aX), y(aY) {
}
- cVector2(cVector2<T> const &aVec) {
- x = aVec.x;
- y = aVec.y;
+ constexpr cVector2(cVector2<T> const &aVec) : x(aVec.x), y(aVec.y) {
}
//////////////////////////////////////////
Commit: 8eb558a3ba4400a6f485238e720af92d76aa3736
https://github.com/scummvm/scummvm/commit/8eb558a3ba4400a6f485238e720af92d76aa3736
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:20+01:00
Commit Message:
HPL1: fix global destructor warnings
Changed paths:
engines/hpl1/penumbra-overture/MainMenu.cpp
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index c26f1b1099e..22f8c36458a 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -1005,8 +1005,8 @@ public:
}
};
-tString gvDifficultyLevel[] = {"Easy", "Normal", "Hard"};
-int glDifficultyLevelNum = 3;
+constexpr const char *gvDifficultyLevel[] = {"Easy", "Normal", "Hard"};
+constexpr int glDifficultyLevelNum = 3;
class cMainMenuWidget_Difficulty : public cMainMenuWidget_Button {
public:
@@ -1163,7 +1163,7 @@ cMainMenuWidget_Text *gpGammaText2 = NULL;
cMainMenuWidget_Text *gpFSAAText = NULL;
cMainMenuWidget_Text *gpDoFText = NULL;
-cVector2l gvResolutions[] = {cVector2l(640, 480), cVector2l(800, 600), cVector2l(1024, 768),
+constexpr cVector2l gvResolutions[] = {cVector2l(640, 480), cVector2l(800, 600), cVector2l(1024, 768),
cVector2l(1152, 864), cVector2l(1280, 720), cVector2l(1280, 768),
cVector2l(1280, 800), cVector2l(1280, 960), cVector2l(1280, 1024),
cVector2l(1360, 768), cVector2l(1360, 1024), cVector2l(1400, 1050),
@@ -1171,10 +1171,10 @@ cVector2l gvResolutions[] = {cVector2l(640, 480), cVector2l(800, 600), cVector2l
cVector2l(1920, 1080), cVector2l(1920, 1200)};
int glResolutionNum = 17;
-tString gvTextureQuality[] = {"High", "Medium", "Low"};
-int glTextureQualityNum = 3;
-tString gvShaderQuality[] = {"Very Low", "Low", "Medium", "High"};
-int glShaderQualityNum = 4;
+constexpr const char *gvTextureQuality[] = {"High", "Medium", "Low"};
+constexpr int glTextureQualityNum = 3;
+constexpr const char *gvShaderQuality[] = {"Very Low", "Low", "Medium", "High"};
+constexpr int glShaderQualityNum = 4;
cMainMenuWidget_Text *gpNoiseFilterText = NULL;
@@ -1243,7 +1243,7 @@ public:
//------------------------------------------------------------
-tString gvShadowTypes[] = {"On", "Only Static", "Off"};
+constexpr const char *gvShadowTypes[] = {"On", "Only Static", "Off"};
class cMainMenuWidget_Shadows : public cMainMenuWidget_Button {
public:
@@ -1273,7 +1273,7 @@ public:
//------------------------------------------------------------
-tString gvTextureFilter[] = {"Bilinear", "Trilinear"};
+constexpr const char *gvTextureFilter[] = {"Bilinear", "Trilinear"};
class cMainMenuWidget_TextureFilter : public cMainMenuWidget_Button {
public:
Commit: 6c697ab1b52212c1c1da03803e4bc47502e56271
https://github.com/scummvm/scummvm/commit/6c697ab1b52212c1c1da03803e4bc47502e56271
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:20+01:00
Commit Message:
HPL1: fix globals in material classes
Changed paths:
engines/hpl1/engine/graphics/Material_Additive.cpp
engines/hpl1/engine/graphics/Material_Alpha.cpp
engines/hpl1/engine/graphics/Material_Water.cpp
diff --git a/engines/hpl1/engine/graphics/Material_Additive.cpp b/engines/hpl1/engine/graphics/Material_Additive.cpp
index 55992bf9e89..41cb081c1bf 100644
--- a/engines/hpl1/engine/graphics/Material_Additive.cpp
+++ b/engines/hpl1/engine/graphics/Material_Additive.cpp
@@ -52,8 +52,6 @@ public:
}
};
-static cFogProgramSetup gFogProgramSetup;
-
//-----------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////
@@ -97,8 +95,9 @@ iGpuProgram *cMaterial_Additive::getGpuProgram(const eMaterialRenderType aType,
}
iMaterialProgramSetup *cMaterial_Additive::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
+ static cFogProgramSetup fogProgramSetup;
if (mpRenderSettings->mbFogActive)
- return &gFogProgramSetup;
+ return &fogProgramSetup;
else
return nullptr;
}
diff --git a/engines/hpl1/engine/graphics/Material_Alpha.cpp b/engines/hpl1/engine/graphics/Material_Alpha.cpp
index e73476b891f..84ed348b99f 100644
--- a/engines/hpl1/engine/graphics/Material_Alpha.cpp
+++ b/engines/hpl1/engine/graphics/Material_Alpha.cpp
@@ -51,8 +51,6 @@ public:
}
};
-static cFogProgramSetup gFogProgramSetup;
-
//////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
//////////////////////////////////////////////////////////////////////////
@@ -94,8 +92,9 @@ iGpuProgram *cMaterial_Alpha::getGpuProgram(eMaterialRenderType aType, int alPas
}
iMaterialProgramSetup *cMaterial_Alpha::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
+ static cFogProgramSetup fogProgramSetup;
if (mpRenderSettings->mbFogActive)
- return &gFogProgramSetup;
+ return &fogProgramSetup;
return nullptr;
}
diff --git a/engines/hpl1/engine/graphics/Material_Water.cpp b/engines/hpl1/engine/graphics/Material_Water.cpp
index e36cb34199f..d58d02fc0f5 100644
--- a/engines/hpl1/engine/graphics/Material_Water.cpp
+++ b/engines/hpl1/engine/graphics/Material_Water.cpp
@@ -48,26 +48,21 @@ public:
void Setup(iGpuProgram *apProgram, cRenderSettings *apRenderSettings) {
apProgram->SetFloat("fogStart", apRenderSettings->mfFogStart);
apProgram->SetFloat("fogEnd", apRenderSettings->mfFogEnd);
- // apProgram->SetFloat("timeCount",mfTime);
- // Log("Setting %f\n",mfTime);
}
- float mfTime;
};
-static cFogWaterProgramSetup gFogWaterProgramSetup;
+
//-----------------------------------------------------------------------
+static float globalTime = 0;
class cWaterProgramSetup : public iMaterialProgramSetup {
public:
void Setup(iGpuProgram *apProgram, cRenderSettings *apRenderSettings) {
- apProgram->SetFloat("timeCount", mfTime);
+ apProgram->SetFloat("timeCount", globalTime);
}
-
- float mfTime;
};
-static cWaterProgramSetup gWaterProgramSetup;
//////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
@@ -113,8 +108,7 @@ cMaterial_Water::~cMaterial_Water() {
void cMaterial_Water::Update(float afTimeStep) {
mfTime += afTimeStep;
- gWaterProgramSetup.mfTime = mfTime;
- gFogWaterProgramSetup.mfTime = mfTime;
+ globalTime = mfTime;
}
//-----------------------------------------------------------------------
@@ -126,9 +120,11 @@ iGpuProgram *cMaterial_Water::getGpuProgram(eMaterialRenderType aType, int alPas
}
iMaterialProgramSetup *cMaterial_Water::getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight) {
+ static cFogWaterProgramSetup fogWaterProgramSetup;
+ static cWaterProgramSetup waterProgramSetup;
if (mpRenderSettings->mbFogActive)
- return &gFogWaterProgramSetup;
- return &gWaterProgramSetup;
+ return &fogWaterProgramSetup;
+ return &waterProgramSetup;
}
bool cMaterial_Water::VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight) {
Commit: c3a08880e397cdfbff7f94de7044f669d2b2f2e5
https://github.com/scummvm/scummvm/commit/c3a08880e397cdfbff7f94de7044f669d2b2f2e5
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:20+01:00
Commit Message:
HPL1: fix global destructor warnings
Changed paths:
engines/hpl1/penumbra-overture/ButtonHandler.cpp
engines/hpl1/penumbra-overture/GameEnemy.cpp
diff --git a/engines/hpl1/penumbra-overture/ButtonHandler.cpp b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
index 56a5a6b2680..bcb12e4f465 100644
--- a/engines/hpl1/penumbra-overture/ButtonHandler.cpp
+++ b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
@@ -44,14 +44,14 @@
#include "hpl1/penumbra-overture/MainMenu.h"
struct cButtonHandlerAction {
- tString msName;
- tString msType;
+ const char *msName;
+ const char *msType;
int mlVal;
bool mbConfig;
};
static const char* const gsLastPlayerAction = "GlowStick";
-static cButtonHandlerAction gvDefaultActions[] = {
+static constexpr cButtonHandlerAction gvDefaultActions[] = {
{"Forward", "Keyboard", eKey_w, true},
{"Backward", "Keyboard", eKey_s, true},
{"Left", "Keyboard", eKey_a, true},
@@ -139,8 +139,8 @@ cButtonHandler::cButtonHandler(cInit *apInit) : iUpdateable("ButtonHandler") {
mlNumOfActions = 0;
// INIT ALL ACTIONS USED
- cButtonHandlerAction *pBHAction = &gvDefaultActions[0];
- while (pBHAction->msName != "") {
+ const cButtonHandlerAction *pBHAction = &gvDefaultActions[0];
+ while (pBHAction->msName[0] != '\0') {
tString sName = pBHAction->msName;
tString sType = mpInit->mpConfig->GetString("Keys", sName + "_Type", pBHAction->msType);
tString sVal = mpInit->mpConfig->GetString("Keys", sName + "_Val", cString::ToString(pBHAction->mlVal));
@@ -149,7 +149,7 @@ cButtonHandler::cButtonHandler(cInit *apInit) : iUpdateable("ButtonHandler") {
if (pAction) {
mpInput->AddAction(pAction);
} else {
- Warning("Couldn't create action from '%s' and %d\n", pBHAction->msType.c_str(),
+ Warning("Couldn't create action from '%s' and %d\n", pBHAction->msType,
pBHAction->mlVal);
}
@@ -687,16 +687,16 @@ void cButtonHandler::OnExit() {
// Log(" type %s val: %s\n",sType.c_str(),sVal.c_str());
- mpInit->mpConfig->SetString("Keys", gvDefaultActions[i].msName + "_Type", sType);
- mpInit->mpConfig->SetString("Keys", gvDefaultActions[i].msName + "_Val", sVal);
+ mpInit->mpConfig->SetString("Keys", gvDefaultActions[i].msName + Common::String("_Type"), sType);
+ mpInit->mpConfig->SetString("Keys", gvDefaultActions[i].msName + Common::String("_Val"), sVal);
}
}
//-----------------------------------------------------------------------
void cButtonHandler::SetDefaultKeys() {
- cButtonHandlerAction *pBHAction = &gvDefaultActions[0];
- while (pBHAction->msName != "") {
+ const cButtonHandlerAction *pBHAction = &gvDefaultActions[0];
+ while (pBHAction->msName[0] != '\0') {
tString sName = pBHAction->msName;
tString sType = pBHAction->msType;
tString sVal = cString::ToString(pBHAction->mlVal);
@@ -707,7 +707,7 @@ void cButtonHandler::SetDefaultKeys() {
mpInput->DestroyAction(sName);
mpInput->AddAction(pAction);
} else {
- Warning("Couldn't create action from '%s' and %d\n", pBHAction->msType.c_str(),
+ Warning("Couldn't create action from '%s' and %d\n", pBHAction->msType,
pBHAction->mlVal);
}
@@ -718,8 +718,8 @@ void cButtonHandler::SetDefaultKeys() {
//-----------------------------------------------------------------------
tString cButtonHandler::GetActionName(const tString &asInputName, const tString &asSkipAction) {
- cButtonHandlerAction *pBHAction = &gvDefaultActions[0];
- while (pBHAction->msName != "") {
+ const cButtonHandlerAction *pBHAction = &gvDefaultActions[0];
+ while (pBHAction->msName[0] != '\0') {
tString sName = pBHAction->msName;
tString sType = pBHAction->msType;
tString sVal = cString::ToString(pBHAction->mlVal);
diff --git a/engines/hpl1/penumbra-overture/GameEnemy.cpp b/engines/hpl1/penumbra-overture/GameEnemy.cpp
index 8ce21bd27f4..2cf459b5904 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy.cpp
@@ -46,7 +46,7 @@
#include "hpl1/penumbra-overture/GlobalInit.h"
-tString gvStateName[STATE_NUM] = {
+constexpr const char *gvStateName[STATE_NUM] = {
"IDLE",
"HUNT",
"ATTACK",
Commit: c1f076187bed17acad21e4e7d155a04e2ec1ec7d
https://github.com/scummvm/scummvm/commit/c1f076187bed17acad21e4e7d155a04e2ec1ec7d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:20+01:00
Commit Message:
HPL1: fix warnings
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgTree.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionCylinder.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.cpp
engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgTree.h b/engines/hpl1/engine/libraries/newton/core/dgTree.h
index 23b44ffd38e..d500563cb28 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgTree.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgTree.h
@@ -128,6 +128,10 @@ public:
return m_info;
}
+ const OBJECT &GetInfo() const {
+ return m_info;
+ }
+
private:
OBJECT m_info;
KEY m_key;
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.cpp
index 31801a5bae2..3d4f3c9024c 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.cpp
@@ -66,35 +66,9 @@ dgTriplex dgCollisionConvex::m_hullDirs[] = {
dgVector dgCollisionConvex::m_multiResDir[8];
dgVector dgCollisionConvex::m_multiResDir_sse[6];
-dgVector dgCollisionConvex::m_zero(dgFloat32(0.0f), dgFloat32(0.0f),
- dgFloat32(0.0f), dgFloat32(0.0f));
-dgVector dgCollisionConvex::m_negOne(dgFloat32(-1.0f), dgFloat32(-1.0f),
- dgFloat32(-1.0f), dgFloat32(-1.0f));
-dgVector dgCollisionConvex::m_nrh0p5(dgFloat32(0.5f), dgFloat32(0.5f),
- dgFloat32(0.5f), dgFloat32(0.5f));
-dgVector dgCollisionConvex::m_nrh3p0(dgFloat32(3.0f), dgFloat32(3.0f),
- dgFloat32(3.0f), dgFloat32(3.0f));
-dgVector dgCollisionConvex::m_indexStep(dgFloat32(4.0f), dgFloat32(4.0f),
- dgFloat32(4.0f), dgFloat32(4.0f));
-dgVector dgCollisionConvex::m_index_0123(dgFloat32(0.0f), dgFloat32(1.0f),
- dgFloat32(2.0f), dgFloat32(3.0f));
-dgVector dgCollisionConvex::m_index_4567(dgFloat32(4.0f), dgFloat32(5.0f),
- dgFloat32(6.0f), dgFloat32(7.0f));
-dgVector dgCollisionConvex::m_huge(dgFloat32(1.0e20f), dgFloat32(1.0e20f),
- dgFloat32(1.0e20f), dgFloat32(1.0e20f));
-dgVector dgCollisionConvex::m_negativeTiny(dgFloat32(-1.0e-24f),
- dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f));
-dgVector dgCollisionConvex::m_aabb_padd(DG_MAX_COLLISION_PADDING,
- DG_MAX_COLLISION_PADDING, DG_MAX_COLLISION_PADDING, dgFloat32(0.0f));
-
// dgCollisionConvex::IntVector dgCollisionConvex::m_signMask = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff};
// dgCollisionConvex::IntVector dgCollisionConvex::m_triplexMask = {0xffffffff, 0xffffffff, 0xffffffff, 0x0};
-dgVector dgCollisionConvex::m_signMask(dgFloat32(0.0f), dgFloat32(0.0f),
- dgFloat32(0.0f), dgFloat32(0.0f));
-dgVector dgCollisionConvex::m_triplexMask(dgFloat32(0.0f), dgFloat32(0.0f),
- dgFloat32(0.0f), dgFloat32(0.0f));
-
dgInt32 dgCollisionConvex::m_iniliazised = 0;
//////////////////////////////////////////////////////////////////////
@@ -1647,7 +1621,7 @@ dgFloat32 dgCollisionConvex::RayCast(const dgVector &localP0,
dgFloat32 interset = dgFloat32(1.2f);
if (RayHitBox(localP0, localP1)) {
- if ((m_collsionId != m_convexHullCollision) || (((dgCollisionConvexHull *)this)->m_faceCount > 48)) {
+ if ((m_collsionId != m_convexHullCollision) || (((const dgCollisionConvexHull *)this)->m_faceCount > 48)) {
// dgInt32 i;
// dgInt32 i0;
// dgInt32 i1;
@@ -1803,9 +1777,9 @@ dgFloat32 dgCollisionConvex::RayCast(const dgVector &localP0,
dgFloat32 tL = dgFloat32(1.0f); // for the minimum leaving segment parameter;
dgVector dS(localP1 - localP0); // is the segment direction vector;
- dgInt32 faceCount = ((dgCollisionConvexHull *)this)->m_faceCount;
+ dgInt32 faceCount = ((const dgCollisionConvexHull *)this)->m_faceCount;
const dgConvexSimplexEdge *const *faceArray =
- ((dgCollisionConvexHull *)this)->m_faceArray;
+ ((const dgCollisionConvexHull *)this)->m_faceArray;
dgInt32 hasHit = 0;
for (dgInt32 i = 0; i < faceCount; i++) {
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.h b/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.h
index 1382f915667..7cadbf3276c 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionConvex.h
@@ -115,22 +115,9 @@ protected:
dgUnsigned16 m_vertexCount;
dgUnsigned32 m_isTriggerVolume : 1;
- static dgVector m_zero;
- static dgVector m_negOne;
- static dgVector m_indexStep;
- static dgVector m_aabb_padd;
- static dgVector m_index_0123;
- static dgVector m_index_4567;
static dgVector m_multiResDir[8];
static dgVector m_multiResDir_sse[6];
- static dgVector m_nrh0p5;
- static dgVector m_nrh3p0;
- static dgVector m_huge;
- static dgVector m_negativeTiny;
-
- static dgVector m_signMask;
- static dgVector m_triplexMask;
static dgTriplex m_hullDirs[14];
static dgInt32 m_iniliazised;
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCylinder.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCylinder.cpp
index a8fb2b924f4..2ff132aa86b 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCylinder.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCylinder.cpp
@@ -238,7 +238,7 @@ dgVector dgCollisionCylinder::SupportVertex(const dgVector &dir) const {
dgFloat32 y0;
dgFloat32 z0;
dgFloat32 mag2;
- dgFloatSign const *ptr = (dgFloatSign *)&dir;
+ dgFloatSign const *ptr = (const dgFloatSign *)&dir;
_ASSERTE(dgAbsf((dir % dir - dgFloat32(1.0f))) < dgFloat32(1.0e-3f));
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
index de24af14f11..835de2df435 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionMesh.cpp
@@ -834,7 +834,6 @@ dgFloat32 dgCollisionMesh::dgCollisionConvexPolygon::MovingPointToPolygonContact
return dgFloat32(-1.0f);
}
- bool isEdge = true;
dgFloat32 timestep = dgFloat32(-1.0f);
dgVector closestPoint(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f));
dgFloat32 minDist = dgFloat32(1.0e20f);
@@ -842,7 +841,6 @@ dgFloat32 dgCollisionMesh::dgCollisionConvexPolygon::MovingPointToPolygonContact
bool tmpIsEdge;
m_localPoly[j] = dgVector(&m_vertex[m_index[j] * m_stride]);
const dgVector q(ClosestDistanceToTriangle(p, m_localPoly[0], m_localPoly[j - 1], m_localPoly[j], tmpIsEdge));
- isEdge &= tmpIsEdge;
const dgVector error(q - p);
dgFloat32 dist = error % error;
if (dist < minDist) {
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.cpp
index 47e467b0927..8d39058d849 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionScene.cpp
@@ -384,7 +384,7 @@ dgFloat32 dgCollisionScene::RayCastSimd(const dgVector &localP0,
if (!me->m_left) {
_ASSERTE(!me->m_right);
dgContactPoint tmpContactOut;
- const dgProxy *const proxy = (dgProxy *)me;
+ const dgProxy *const proxy = (const dgProxy *)me;
dgVector l0(proxy->m_matrix.UntransformVector(localP0));
dgVector l1(proxy->m_matrix.UntransformVector(localP1));
dgFloat32 param = proxy->m_shape->RayCastSimd(l0, l1, tmpContactOut,
@@ -437,7 +437,7 @@ dgFloat32 dgCollisionScene::RayCast(const dgVector &localP0,
if (!me->m_left) {
_ASSERTE(!me->m_right);
dgContactPoint tmpContactOut;
- const dgProxy *const proxy = (dgProxy *)me;
+ const dgProxy *const proxy = (const dgProxy *)me;
dgVector l0(proxy->m_matrix.UntransformVector(localP0));
dgVector l1(proxy->m_matrix.UntransformVector(localP1));
dgFloat32 param = proxy->m_shape->RayCast(l0, l1, tmpContactOut,
@@ -490,7 +490,7 @@ void dgCollisionScene::CollidePairSimd(
if (!me->m_left) {
_ASSERTE(!me->m_right);
- const dgProxy *const sceneProxy = (dgProxy *)me;
+ const dgProxy *const sceneProxy = (const dgProxy *)me;
m_world->SceneContactsSimd(*sceneProxy, pair, proxy);
} else {
_ASSERTE(me->m_left);
@@ -531,7 +531,7 @@ void dgCollisionScene::CollidePair(dgCollidingPairCollector::dgPair *const pair,
if (!me->m_left) {
_ASSERTE(!me->m_right);
- const dgProxy *const sceneProxy = (dgProxy *)me;
+ const dgProxy *const sceneProxy = (const dgProxy *)me;
m_world->SceneContacts(*sceneProxy, pair, proxy);
} else {
_ASSERTE(me->m_left);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgContact.cpp b/engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
index fa1bbff4079..3f6811812cf 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
@@ -444,7 +444,7 @@ void dgCollidingPairCollector::AddPair(dgBody *const bodyPtr0,
dgBody *const bodyPtr1, dgInt32 threadIndex) {
if ((bodyPtr0 != m_sentinel) && (bodyPtr1 != m_sentinel)) {
dgWorld *const world = (dgWorld *)this;
- if (bodyPtr0->GetSleepState() & bodyPtr1->GetSleepState()) {
+ if (bodyPtr0->GetSleepState() && bodyPtr1->GetSleepState()) {
dgContact *contact = NULL;
if (bodyPtr0->m_invMass.m_w != dgFloat32(0.0f)) {
for (dgBodyMasterListRow::dgListNode *link = world->FindConstraintLink(
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
index a74a130fb39..81600f009d1 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
@@ -1912,22 +1912,22 @@ void *dgMeshEffect::GetNextFace(const void *const face) const {
}
dgInt32 dgMeshEffect::IsFaceOpen(const void *const face) const {
- dgTreeNode *const node = (dgTreeNode *)face;
- dgEdge *const edge = &node->GetInfo();
+ const dgTreeNode *const node = (const dgTreeNode *)face;
+ const dgEdge *const edge = &node->GetInfo();
return (edge->m_incidentFace > 0) ? 0 : 1;
}
dgInt32 dgMeshEffect::GetFaceMaterial(const void *const face) const {
- dgTreeNode *const node = (dgTreeNode *)face;
- dgEdge *const edge = &node->GetInfo();
+ const dgTreeNode *const node = (const dgTreeNode *)face;
+ const dgEdge *const edge = &node->GetInfo();
return dgInt32(m_attib[edge->m_userData].m_material);
}
dgInt32 dgMeshEffect::GetFaceIndexCount(const void *const face) const {
int count = 0;
- dgTreeNode *const node = (dgTreeNode *)face;
- dgEdge *const edge = &node->GetInfo();
- dgEdge *ptr = edge;
+ const dgTreeNode *const node = (const dgTreeNode *)face;
+ const dgEdge *const edge = &node->GetInfo();
+ const dgEdge *ptr = edge;
do {
count++;
ptr = ptr->m_next;
@@ -1937,9 +1937,9 @@ dgInt32 dgMeshEffect::GetFaceIndexCount(const void *const face) const {
void dgMeshEffect::GetFaceIndex(const void *const face, int *const indices) const {
int count = 0;
- dgTreeNode *const node = (dgTreeNode *)face;
- dgEdge *const edge = &node->GetInfo();
- dgEdge *ptr = edge;
+ const dgTreeNode *const node = (const dgTreeNode *)face;
+ const dgEdge *const edge = &node->GetInfo();
+ const dgEdge *ptr = edge;
do {
indices[count] = ptr->m_incidentVertex;
count++;
@@ -1949,9 +1949,9 @@ void dgMeshEffect::GetFaceIndex(const void *const face, int *const indices) cons
void dgMeshEffect::GetFaceAttributeIndex(const void *const face, int *const indices) const {
int count = 0;
- dgTreeNode *const node = (dgTreeNode *)face;
- dgEdge *const edge = &node->GetInfo();
- dgEdge *ptr = edge;
+ const dgTreeNode *const node = (const dgTreeNode *)face;
+ const dgEdge *const edge = &node->GetInfo();
+ const dgEdge *ptr = edge;
do {
indices[count] = int(ptr->m_userData);
count++;
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
index e2b9e69129c..120c9ecce13 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
@@ -961,7 +961,7 @@ class dgContactSolver {
const dgVector &shapeNormal, dgUnsigned32 id, dgFloat32 penetration,
dgInt32 shape1VertexCount, dgVector *const shape1,
dgInt32 shape2VertexCount, dgVector *const shape2,
- dgContactPoint *const contactOut, dgInt32 maxContacts) const {
+ dgContactPoint *const contactOut, dgInt32 maxContacts) {
dgInt32 count = 0;
if (shape2VertexCount <= 2) {
@@ -1436,7 +1436,7 @@ class dgContactSolver {
}
dgInt32 edgeContactFlag =
- (m_floatingcollision->IsEdgeIntersection() | m_referenceCollision->IsEdgeIntersection()) ? 1 : 0;
+ (m_floatingcollision->IsEdgeIntersection() || m_referenceCollision->IsEdgeIntersection()) ? 1 : 0;
for (dgInt32 i = 0; i < count; i++) {
contactOut[i].m_isEdgeContact = edgeContactFlag;
}
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp b/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
index ce799b1e8dd..8e4806abf70 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
@@ -1801,7 +1801,7 @@ void dgWorld::CalculateContactsSimd(
// proxy.m_continueCollision = material->m_collisionContinueCollisionEnable & (body0->m_continueCollisionMode | body1->m_continueCollisionMode);
proxy.m_continueCollision = dgInt32(
((material->m_flags & dgContactMaterial::m_collisionContinueCollisionEnable__) ? 1 : 0) & (body0->m_continueCollisionMode | body1->m_continueCollisionMode));
- proxy.m_isTriggerVolume = body0->m_collision->IsTriggerVolume() | body1->m_collision->IsTriggerVolume();
+ proxy.m_isTriggerVolume = body0->m_collision->IsTriggerVolume() || body1->m_collision->IsTriggerVolume();
if (body0->m_collision->IsType(dgCollision::dgCollisionScene_RTTI)) {
Swap(pair->m_body0, pair->m_body1);
@@ -1833,7 +1833,7 @@ void dgWorld::CalculateContacts(dgCollidingPairCollector::dgPair *const pair,
proxy.m_unconditionalCast = 0;
proxy.m_maxContacts = DG_MAX_CONTATCS;
proxy.m_penetrationPadding = material->m_penetrationPadding;
- proxy.m_isTriggerVolume = body0->m_collision->IsTriggerVolume() | body1->m_collision->IsTriggerVolume();
+ proxy.m_isTriggerVolume = body0->m_collision->IsTriggerVolume() || body1->m_collision->IsTriggerVolume();
// proxy.m_continueCollision = material->m_collisionContinueCollisionEnable & (body0->m_continueCollisionMode | body1->m_continueCollisionMode);
proxy.m_continueCollision = dgInt32(
((material->m_flags & dgContactMaterial::m_collisionContinueCollisionEnable__) ? 1 : 0) & (body0->m_continueCollisionMode | body1->m_continueCollisionMode));
Commit: f0e312d990553c129bca195f750c026f6ee508b0
https://github.com/scummvm/scummvm/commit/f0e312d990553c129bca195f750c026f6ee508b0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:20+01:00
Commit Message:
HPL1: Fix more const correctness
Changed paths:
engines/hpl1/engine/libraries/newton/Newton.cpp
diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
index 96bb0f11252..40047a57d6a 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.cpp
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -1151,10 +1151,10 @@ int NewtonWorldGetBodyCount(const NewtonWorld *const newtonWorld) {
// Return: number of rigid bodies in this world.
//
int NewtonWorldGetConstraintCount(const NewtonWorld *const newtonWorld) {
- Newton *world;
+ const Newton *world;
TRACE_FUNTION(__FUNCTION__);
- world = (Newton *)newtonWorld;
+ world = (const Newton *)newtonWorld;
return world->GetConstraintsCount();
}
@@ -1283,10 +1283,10 @@ int NewtonWorldConvexCast(const NewtonWorld *const newtonWorld,
//
// See also: NewtonSetIslandUpdateEvent
NewtonBody *NewtonIslandGetBody(const void *const island, int bodyIndex) {
- dgWorld *world;
+ const dgWorld *world;
TRACE_FUNTION(__FUNCTION__);
- world = *(dgWorld **)island;
+ world = *(const dgWorld * const *)island;
return (NewtonBody *)world->GetIslandBody(island, bodyIndex);
}
@@ -1312,7 +1312,7 @@ NewtonBody *NewtonIslandGetBody(const void *const island, int bodyIndex) {
void NewtonIslandGetBodyAABB(const void *const island, int bodyIndex,
dFloat *const p0, dFloat *const p1) {
TRACE_FUNTION(__FUNCTION__);
- dgBody *const body = (dgBody *)NewtonIslandGetBody(island, bodyIndex);
+ const dgBody *const body = (const dgBody *)NewtonIslandGetBody(island, bodyIndex);
if (body) {
body->GetAABB((dgVector &)*p0, (dgVector &)*p1);
}
@@ -1336,7 +1336,7 @@ void NewtonIslandGetBodyAABB(const void *const island, int bodyIndex,
// When the Newton world is created, the default Group ID is created by the engine.
// When bodies are created the application assigns a group ID to the body.
int NewtonMaterialGetDefaultGroupID(const NewtonWorld *const newtonWorld) {
- Newton *const world = (Newton *)newtonWorld;
+ const Newton *const world = (const Newton *)newtonWorld;
TRACE_FUNTION(__FUNCTION__);
return int(world->GetDefualtBodyGroupID());
@@ -1503,7 +1503,7 @@ void NewtonMaterialSetSurfaceThickness(const NewtonWorld *const newtonWorld,
int id0, int id1, dFloat thickness) {
TRACE_FUNTION(__FUNCTION__);
- Newton *const world = (Newton *)newtonWorld;
+ const Newton *const world = (const Newton *)newtonWorld;
dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
dgUnsigned32(id1));
@@ -1713,10 +1713,10 @@ void NewtonMaterialSetCompondCollisionCallback(
// Return: Nothing.
void *NewtonMaterialGetUserData(const NewtonWorld *const newtonWorld, int id0,
int id1) {
- Newton *world;
+ const Newton *world;
TRACE_FUNTION(__FUNCTION__);
- world = (Newton *)newtonWorld;
+ world = (const Newton *)newtonWorld;
dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
dgUnsigned32(id1));
@@ -1734,10 +1734,10 @@ void *NewtonMaterialGetUserData(const NewtonWorld *const newtonWorld, int id0,
// See also: NewtonWorldGetNextMaterial
NewtonMaterial *NewtonWorldGetFirstMaterial(
const NewtonWorld *const newtonWorld) {
- Newton *world;
+ const Newton *world;
TRACE_FUNTION(__FUNCTION__);
- world = (Newton *)newtonWorld;
+ world = (const Newton *)newtonWorld;
return (NewtonMaterial *)world->GetFirstMaterial();
}
@@ -1799,7 +1799,7 @@ NewtonMaterial *NewtonWorldGetNextMaterial(const NewtonWorld *const newtonWorld,
void *NewtonMaterialGetMaterialPairUserData(
const NewtonMaterial *const materialHandle) {
TRACE_FUNTION(__FUNCTION__);
- dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ const dgContactMaterial *const material = (const dgContactMaterial *)materialHandle;
return material->GetUserData();
}
@@ -2698,8 +2698,8 @@ NewtonCollision *NewtonCreateConvexHullModifier(
// See also: NewtonCreateConvexHullModifier, NewtonConvexHullModifierSetMatrix
void NewtonConvexHullModifierGetMatrix(
const NewtonCollision *convexHullModifier, dFloat *matrixPtr) {
- dgCollision *collision;
- collision = (dgCollision *)convexHullModifier;
+ const dgCollision *collision;
+ collision = (const dgCollision *)convexHullModifier;
TRACE_FUNTION(__FUNCTION__);
dgMatrix &matrix = (*((dgMatrix *)matrixPtr));
@@ -2872,11 +2872,11 @@ void NewtonCompoundBreakableSetAnchoredPieces(
NewtonbreakableComponentMesh *NewtonBreakableGetMainMesh(
const NewtonCollision *const compoundBreakable) {
- dgCollision *collision;
+ const dgCollision *collision;
NewtonbreakableComponentMesh *mesh;
TRACE_FUNTION(__FUNCTION__);
- collision = (dgCollision *)compoundBreakable;
+ collision = (const dgCollision *)compoundBreakable;
mesh = NULL;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
@@ -2951,11 +2951,11 @@ void NewtonBreakableEndDelete(const NewtonCollision *const compoundBreakable) {
NewtonbreakableComponentMesh *NewtonBreakableGetFirstComponent(
const NewtonCollision *const compoundBreakable) {
- dgCollision *collision;
+ const dgCollision *collision;
NewtonbreakableComponentMesh *mesh;
TRACE_FUNTION(__FUNCTION__);
- collision = (dgCollision *)compoundBreakable;
+ collision = (const dgCollision *)compoundBreakable;
mesh = NULL;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
@@ -2980,15 +2980,15 @@ NewtonbreakableComponentMesh *NewtonBreakableGetNextComponent(
int NewtonCompoundBreakableGetVertexCount(
const NewtonCollision *const compoundBreakable) {
dgInt32 count;
- dgCollision *collision;
+ const dgCollision *collision;
TRACE_FUNTION(__FUNCTION__);
- collision = (dgCollision *)compoundBreakable;
+ collision = (const dgCollision *)compoundBreakable;
count = 0;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
- dgCollisionCompoundBreakable *compound;
- compound = (dgCollisionCompoundBreakable *)collision;
+ const dgCollisionCompoundBreakable *compound;
+ compound = (const dgCollisionCompoundBreakable *)collision;
count = compound->GetVertecCount();
}
return count;
@@ -2998,14 +2998,14 @@ void NewtonCompoundBreakableGetVertexStreams(
const NewtonCollision *const compoundBreakable, int vertexStrideInByte,
dFloat *const vertex, int normalStrideInByte, dFloat *const normal,
int uvStrideInByte, dFloat *const uv) {
- dgCollision *collision;
+ const dgCollision *collision;
TRACE_FUNTION(__FUNCTION__);
- collision = (dgCollision *)compoundBreakable;
+ collision = (const dgCollision *)compoundBreakable;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
- dgCollisionCompoundBreakable *compound;
- compound = (dgCollisionCompoundBreakable *)collision;
+ const dgCollisionCompoundBreakable *compound;
+ compound = (const dgCollisionCompoundBreakable *)collision;
compound->GetVertexStreams(vertexStrideInByte, vertex, normalStrideInByte,
normal, uvStrideInByte, uv);
}
@@ -3022,10 +3022,10 @@ void *NewtonBreakableGetFirstSegment(
}
void *NewtonBreakableGetNextSegment(const void *const segment) {
- dgCollisionCompoundBreakable::dgMesh::dgListNode *node;
+ const dgCollisionCompoundBreakable::dgMesh::dgListNode *node;
TRACE_FUNTION(__FUNCTION__);
- node = (dgCollisionCompoundBreakable::dgMesh::dgListNode *)segment;
+ node = (const dgCollisionCompoundBreakable::dgMesh::dgListNode *)segment;
return node->GetNext();
}
@@ -3033,12 +3033,12 @@ int NewtonBreakableGetComponentsInRadius(
const NewtonCollision *const compoundBreakable, const dFloat *position,
dFloat radius, NewtonbreakableComponentMesh **const segments, int maxCount) {
dgInt32 count;
- dgCollision *collision;
+ const dgCollision *collision;
TRACE_FUNTION(__FUNCTION__);
count = 0;
- collision = (dgCollision *)compoundBreakable;
+ collision = (const dgCollision *)compoundBreakable;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
dgCollisionCompoundBreakable *compound;
compound = (dgCollisionCompoundBreakable *)collision;
@@ -3072,15 +3072,15 @@ int NewtonBreakableSegmentGetIndexStream(
const NewtonbreakableComponentMesh *const meshOwner,
const void *const segment, int *const index) {
int count;
- dgCollision *collision;
+ const dgCollision *collision;
TRACE_FUNTION(__FUNCTION__);
count = 0;
- collision = (dgCollision *)compoundBreakable;
+ collision = (const dgCollision *)compoundBreakable;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
- dgCollisionCompoundBreakable *compound;
- compound = (dgCollisionCompoundBreakable *)collision;
+ const dgCollisionCompoundBreakable *compound;
+ compound = (const dgCollisionCompoundBreakable *)collision;
count = compound->GetSegmentIndexStream(
(dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)meshOwner,
(dgCollisionCompoundBreakable::dgMesh::dgListNode *)segment, index);
@@ -3093,15 +3093,15 @@ int NewtonBreakableSegmentGetIndexStreamShort(
const NewtonbreakableComponentMesh *const meshOwner,
const void *const segment, short int *const index) {
int count;
- dgCollision *collision;
+ const dgCollision *collision;
TRACE_FUNTION(__FUNCTION__);
count = 0;
- collision = (dgCollision *)compoundBreakable;
+ collision = (const dgCollision *)compoundBreakable;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
- dgCollisionCompoundBreakable *compound;
- compound = (dgCollisionCompoundBreakable *)collision;
+ const dgCollisionCompoundBreakable *compound;
+ compound = (const dgCollisionCompoundBreakable *)collision;
count = compound->GetSegmentIndexStreamShort(
(dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)meshOwner,
(dgCollisionCompoundBreakable::dgMesh::dgListNode *)segment, index);
@@ -3123,8 +3123,8 @@ int NewtonBreakableSegmentGetIndexStreamShort(
//
// See also: NewtonCollisionIsTriggerVolume
int NewtonCollisionIsTriggerVolume(const NewtonCollision *const convexCollision) {
- dgCollision *collision;
- collision = (dgCollision *)convexCollision;
+ const dgCollision *collision;
+ collision = (const dgCollision *)convexCollision;
TRACE_FUNTION(__FUNCTION__);
@@ -3166,8 +3166,8 @@ void NewtonCollisionSetMaxBreakImpactImpulse(
dFloat NewtonCollisionGetMaxBreakImpactImpulse(
const NewtonCollision *const convexHullCollision) {
- dgCollision *collision;
- collision = (dgCollision *)convexHullCollision;
+ const dgCollision *collision;
+ collision = (const dgCollision *)convexHullCollision;
TRACE_FUNTION(__FUNCTION__);
return dgFloat32(collision->GetBreakImpulse());
@@ -3232,10 +3232,10 @@ unsigned NewtonCollisionGetUserID(const NewtonCollision *const collision) {
int NewtonConvexHullGetFaceIndices(
const NewtonCollision *const convexHullCollision, int face,
int *const faceIndices) {
- dgCollision *coll;
+ const dgCollision *coll;
TRACE_FUNTION(__FUNCTION__);
- coll = (dgCollision *)convexHullCollision;
+ coll = (const dgCollision *)convexHullCollision;
if (coll->IsType(dgCollision::dgCollisionConvexHull_RTTI)) {
return ((dgCollisionConvexHull *)coll)->GetFaceIndices(face, faceIndices);
@@ -3259,10 +3259,10 @@ int NewtonConvexHullGetFaceIndices(
// See also: NewtonBodyAddBuoyancyForce
dFloat NewtonConvexCollisionCalculateVolume(
const NewtonCollision *const convexCollision) {
- dgCollision *collision;
+ const dgCollision *collision;
TRACE_FUNTION(__FUNCTION__);
- collision = (dgCollision *)convexCollision;
+ collision = (const dgCollision *)convexCollision;
return collision->GetVolume();
}
@@ -3593,7 +3593,7 @@ void NewtonTreeCollisionEndBuild(const NewtonCollision *const treeCollision,
int NewtonTreeCollisionGetFaceAtribute(
const NewtonCollision *const treeCollision, const int *const faceIndexArray) {
TRACE_FUNTION(__FUNCTION__);
- dgCollisionBVH *const collision = (dgCollisionBVH *)treeCollision;
+ const dgCollisionBVH *const collision = (const dgCollisionBVH *)treeCollision;
_ASSERTE(collision->IsType(dgCollision::dgCollisionBVH_RTTI));
return int(collision->GetTagId(faceIndexArray));
@@ -3657,17 +3657,17 @@ int NewtonTreeCollisionGetVertexListIndexListInAABB(
const int *const indexList, int maxIndexCount,
const int *const faceAttribute) {
dgInt32 count;
- dgCollision *meshColl;
+ const dgCollision *meshColl;
count = 0;
TRACE_FUNTION(__FUNCTION__);
- meshColl = (dgCollision *)treeCollision;
+ meshColl = (const dgCollision *)treeCollision;
if (meshColl->IsType(dgCollision::dgCollisionMesh_RTTI)) {
- dgCollisionMesh *collision;
- collision = (dgCollisionMesh *)meshColl;
+ const dgCollisionMesh *collision;
+ collision = (const dgCollisionMesh *)meshColl;
// NewtonCollisionTree& tree = *((NewtonCollisionTree*) collisionTree->GetUserData());
dgVector pmin(p0[0], p0[1], p0[2], dgFloat32(0.0f));
Commit: 3b9e91a624642c24354aa3ac3db0e20b7e0c18e4
https://github.com/scummvm/scummvm/commit/3b9e91a624642c24354aa3ac3db0e20b7e0c18e4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:20+01:00
Commit Message:
HPL1: Fix const correctness
Changed paths:
engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
engines/hpl1/engine/impl/PhysicsBodyNewton.h
engines/hpl1/engine/libraries/newton/Newton.cpp
engines/hpl1/engine/libraries/newton/Newton.h
engines/hpl1/engine/libraries/newton/core/dgList.h
engines/hpl1/engine/libraries/newton/physics/dgBody.cpp
engines/hpl1/engine/libraries/newton/physics/dgBody.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
engines/hpl1/engine/libraries/newton/physics/dgWorld.h
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
index f5c0222f762..f89f6670e81 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
@@ -447,7 +447,7 @@ static int BuoyancyPlaneCallback(const int alCollisionID, void *apContext,
return 1;
}
-void cPhysicsBodyNewton::OnUpdateCallback(const NewtonBody *apBody, float, int) {
+void cPhysicsBodyNewton::OnUpdateCallback(NewtonBody *apBody, float, int) {
float fMass;
float fX, fY, fZ;
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.h b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
index dcad510bb88..d308aa93ab0 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
@@ -102,7 +102,7 @@ public:
private:
static void OnTransformCallback(const NewtonBody *apBody, const dFloat *apMatrix, int);
- static void OnUpdateCallback(const NewtonBody *apBody, float, int);
+ static void OnUpdateCallback(NewtonBody *apBody, float, int);
NewtonBody *mpNewtonBody;
NewtonWorld *mpNewtonWorld;
diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
index 40047a57d6a..94be6f8fc6e 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.cpp
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -2790,7 +2790,7 @@ NewtonCollision *NewtonCreateCompoundCollision(
// Neglecting to release references to collision primitives is a common cause of memory leaks.
//
// See also: NewtonCreateCompoundCollision
-NEWTON_API NewtonCollision *NewtonCreateCompoundCollisionFromMesh(const NewtonWorld *const newtonWorld, const NewtonMesh *const convexAproximation, dFloat hullTolerance, int shapeID, int subShapeID) {
+NEWTON_API NewtonCollision *NewtonCreateCompoundCollisionFromMesh(NewtonWorld *const newtonWorld, const NewtonMesh *const convexAproximation, dFloat hullTolerance, int shapeID, int subShapeID) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
// dgMeshEffect* const convexAproximation = (dgMeshEffect*) mesh;
@@ -3012,12 +3012,11 @@ void NewtonCompoundBreakableGetVertexStreams(
}
void *NewtonBreakableGetFirstSegment(
- const NewtonbreakableComponentMesh *const breakableComponent) {
+ NewtonbreakableComponentMesh *const breakableComponent) {
dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *node;
TRACE_FUNTION(__FUNCTION__);
- node =
- (dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)breakableComponent;
+ node = (dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)breakableComponent;
return node->GetInfo().m_nodeData.m_mesh->GetFirst();
}
@@ -3040,8 +3039,8 @@ int NewtonBreakableGetComponentsInRadius(
count = 0;
collision = (const dgCollision *)compoundBreakable;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
- dgCollisionCompoundBreakable *compound;
- compound = (dgCollisionCompoundBreakable *)collision;
+ const dgCollisionCompoundBreakable *compound;
+ compound = (const dgCollisionCompoundBreakable *)collision;
dgVector origin(position[0], position[1], position[2], dgFloat32(0.0f));
count = compound->GetSegmentsInRadius(origin, radius,
(dgCollisionCompoundBreakable::dgDebriGraph::dgListNode **)segments,
@@ -3051,7 +3050,7 @@ int NewtonBreakableGetComponentsInRadius(
return count;
}
-int NewtonBreakableSegmentGetMaterial(const void *const segment) {
+int NewtonBreakableSegmentGetMaterial(void *const segment) {
dgCollisionCompoundBreakable::dgMesh::dgListNode *node;
TRACE_FUNTION(__FUNCTION__);
@@ -3059,7 +3058,7 @@ int NewtonBreakableSegmentGetMaterial(const void *const segment) {
return node->GetInfo().m_material;
}
-int NewtonBreakableSegmentGetIndexCount(const void *const segment) {
+int NewtonBreakableSegmentGetIndexCount(void *const segment) {
dgCollisionCompoundBreakable::dgMesh::dgListNode *node;
TRACE_FUNTION(__FUNCTION__);
@@ -3069,8 +3068,8 @@ int NewtonBreakableSegmentGetIndexCount(const void *const segment) {
int NewtonBreakableSegmentGetIndexStream(
const NewtonCollision *const compoundBreakable,
- const NewtonbreakableComponentMesh *const meshOwner,
- const void *const segment, int *const index) {
+ NewtonbreakableComponentMesh *const meshOwner,
+ void *const segment, int *const index) {
int count;
const dgCollision *collision;
@@ -3091,7 +3090,7 @@ int NewtonBreakableSegmentGetIndexStream(
int NewtonBreakableSegmentGetIndexStreamShort(
const NewtonCollision *const compoundBreakable,
const NewtonbreakableComponentMesh *const meshOwner,
- const void *const segment, short int *const index) {
+ void *const segment, short int *const index) {
int count;
const dgCollision *collision;
@@ -3103,7 +3102,7 @@ int NewtonBreakableSegmentGetIndexStreamShort(
const dgCollisionCompoundBreakable *compound;
compound = (const dgCollisionCompoundBreakable *)collision;
count = compound->GetSegmentIndexStreamShort(
- (dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)meshOwner,
+ (const dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)meshOwner,
(dgCollisionCompoundBreakable::dgMesh::dgListNode *)segment, index);
}
return count;
@@ -3145,7 +3144,7 @@ int NewtonCollisionIsTriggerVolume(const NewtonCollision *const convexCollision)
// this particular shape is a trigger volume and no contact calculation is desired.
//
// See also: NewtonCollisionIsTriggerVolume
-void NewtonCollisionSetAsTriggerVolume(const NewtonCollision *convexCollision,
+void NewtonCollisionSetAsTriggerVolume(NewtonCollision *convexCollision,
int trigger) {
dgCollision *collision;
collision = (dgCollision *)convexCollision;
@@ -3156,7 +3155,7 @@ void NewtonCollisionSetAsTriggerVolume(const NewtonCollision *convexCollision,
}
void NewtonCollisionSetMaxBreakImpactImpulse(
- const NewtonCollision *const convexHullCollision, dFloat maxImpactImpulse) {
+ NewtonCollision *const convexHullCollision, dFloat maxImpactImpulse) {
dgCollision *collision;
collision = (dgCollision *)convexHullCollision;
@@ -3185,7 +3184,7 @@ dFloat NewtonCollisionGetMaxBreakImpactImpulse(
// Remarks: the application can store an id with any collision primitive. This id can be used to identify what type of collision primitive generated a contact.
//
// See also: NewtonMaterialGetBodyCollisionID, NewtonCollisionGetUserID, NewtonCreateBox, NewtonCreateSphere
-void NewtonCollisionSetUserID(const NewtonCollision *const collision,
+void NewtonCollisionSetUserID(NewtonCollision *const collision,
unsigned id) {
dgCollision *coll;
@@ -3206,7 +3205,7 @@ void NewtonCollisionSetUserID(const NewtonCollision *const collision,
// Remarks: the application can store an id with any collision primitive. This id can be used to identify what type of collision primitive generated a contact.
//
// See also: NewtonMaterialGetBodyCollisionID, NewtonMaterialGetBodyCollisionID, NewtonCreateBox, NewtonCreateSphere
-unsigned NewtonCollisionGetUserID(const NewtonCollision *const collision) {
+unsigned NewtonCollisionGetUserID(NewtonCollision *const collision) {
dgCollision *coll;
TRACE_FUNTION(__FUNCTION__);
@@ -3238,7 +3237,7 @@ int NewtonConvexHullGetFaceIndices(
coll = (const dgCollision *)convexHullCollision;
if (coll->IsType(dgCollision::dgCollisionConvexHull_RTTI)) {
- return ((dgCollisionConvexHull *)coll)->GetFaceIndices(face, faceIndices);
+ return ((const dgCollisionConvexHull *)coll)->GetFaceIndices(face, faceIndices);
} else {
return 0;
}
@@ -3280,8 +3279,8 @@ dFloat NewtonConvexCollisionCalculateVolume(
void NewtonConvexCollisionCalculateInertialMatrix(
const NewtonCollision *convexCollision, dFloat *const inertia,
dFloat *const origin) {
- dgCollision *collision;
- collision = (dgCollision *)convexCollision;
+ const dgCollision *collision;
+ collision = (const dgCollision *)convexCollision;
dgVector tmpInertia;
dgVector tmpOringin;
@@ -3335,7 +3334,7 @@ void NewtonConvexCollisionCalculateInertialMatrix(
//
// See also: NewtonReleaseCollision
NewtonCollision *NewtonCreateUserMeshCollision(
- const NewtonWorld *const newtonWorld, const dFloat *const minBox,
+ NewtonWorld *const newtonWorld, const dFloat *const minBox,
const dFloat *const maxBox, void *const userData,
NewtonUserMeshCollisionCollideCallback collideCallback,
NewtonUserMeshCollisionRayHitCallback rayHitCallBack,
@@ -3385,7 +3384,7 @@ NewtonCollision *NewtonCreateUserMeshCollision(
// as speed up some calculations.
//
// See also: NewtonTreeCollisionBeginBuild, NewtonTreeCollisionAddFace, NewtonTreeCollisionEndBuild, NewtonStaticCollisionSetDebugCallback, NewtonTreeCollisionGetFaceAtribute, NewtonTreeCollisionSetFaceAtribute, NewtonReleaseCollision
-NewtonCollision *NewtonCreateTreeCollision(const NewtonWorld *const newtonWorld,
+NewtonCollision *NewtonCreateTreeCollision(NewtonWorld *const newtonWorld,
int shapeID) {
Newton *world;
dgCollision *collision;
@@ -3421,7 +3420,7 @@ NewtonCollision *NewtonCreateTreeCollisionFromMesh(const NewtonWorld *const newt
//
// See also: NewtonTreeCollisionGetFaceAtribute, NewtonTreeCollisionSetFaceAtribute
void NewtonStaticCollisionSetDebugCallback(
- const NewtonCollision *const staticCollision,
+ NewtonCollision *const staticCollision,
NewtonTreeCollisionCallback userCallback) {
/*
dgCollision* collision;
@@ -3485,7 +3484,7 @@ void NewtonStaticCollisionSetDebugCallback(
//
// See also: NewtonTreeCollisionGetFaceAtribute, NewtonTreeCollisionSetFaceAtribute
void NewtonTreeCollisionSetUserRayCastCallback(
- const NewtonCollision *const treeCollision,
+ NewtonCollision *const treeCollision,
NewtonCollisionTreeRayCastCallback rayHitCallback) {
TRACE_FUNTION(__FUNCTION__);
dgCollisionBVH *const collision = (dgCollisionBVH *)treeCollision;
@@ -3496,7 +3495,7 @@ void NewtonTreeCollisionSetUserRayCastCallback(
}
void NewtonHeightFieldSetUserRayCastCallback(
- const NewtonCollision *treeCollision,
+ NewtonCollision *treeCollision,
NewtonHeightFieldRayCastCallback rayHitCallback) {
TRACE_FUNTION(__FUNCTION__);
dgCollisionHeightField *const collision =
@@ -3516,7 +3515,7 @@ void NewtonHeightFieldSetUserRayCastCallback(
// Return: Nothing.
//
// See also: NewtonTreeCollisionAddFace, NewtonTreeCollisionEndBuild
-void NewtonTreeCollisionBeginBuild(const NewtonCollision *treeCollision) {
+void NewtonTreeCollisionBeginBuild(NewtonCollision *treeCollision) {
TRACE_FUNTION(__FUNCTION__);
dgCollisionBVH *const collision = (dgCollisionBVH *)treeCollision;
@@ -3542,7 +3541,7 @@ void NewtonTreeCollisionBeginBuild(const NewtonCollision *treeCollision) {
// The polygons must be flat and non-self intersecting.
//
// See also: NewtonTreeCollisionAddFace, NewtonTreeCollisionEndBuild
-void NewtonTreeCollisionAddFace(const NewtonCollision *const treeCollision,
+void NewtonTreeCollisionAddFace(NewtonCollision *const treeCollision,
int vertexCount, const dFloat *const vertexPtr, int strideInBytes,
int faceAttribute) {
TRACE_FUNTION(__FUNCTION__);
@@ -3569,7 +3568,7 @@ void NewtonTreeCollisionAddFace(const NewtonCollision *const treeCollision,
// Calling this function with the parameter *optimize* set to zero, will leave the mesh geometry unaltered.
//
// See also: NewtonTreeCollisionAddFace, NewtonTreeCollisionEndBuild
-void NewtonTreeCollisionEndBuild(const NewtonCollision *const treeCollision,
+void NewtonTreeCollisionEndBuild(NewtonCollision *const treeCollision,
int optimize) {
TRACE_FUNTION(__FUNCTION__);
dgCollisionBVH *const collision = (dgCollisionBVH *)treeCollision;
@@ -3617,7 +3616,7 @@ int NewtonTreeCollisionGetFaceAtribute(
//
// See also: NewtonTreeCollisionGetFaceAtribute, NewtonCreateTreeCollision, NewtonCreateTreeCollisionFromSerialization
void NewtonTreeCollisionSetFaceAtribute(
- const NewtonCollision *const treeCollision, const int *const faceIndexArray,
+ NewtonCollision *const treeCollision, const int *const faceIndexArray,
int attribute) {
TRACE_FUNTION(__FUNCTION__);
dgCollisionBVH *const collision = (dgCollisionBVH *)treeCollision;
@@ -3654,8 +3653,8 @@ int NewtonTreeCollisionGetVertexListIndexListInAABB(
const NewtonCollision *const treeCollision, const dFloat *const p0,
const dFloat *const p1, const dFloat **const vertexArray,
int *const vertexCount, int *const vertexStrideInBytes,
- const int *const indexList, int maxIndexCount,
- const int *const faceAttribute) {
+ int *const indexList, int maxIndexCount,
+ int *const faceAttribute) {
dgInt32 count;
const dgCollision *meshColl;
@@ -3710,7 +3709,7 @@ int NewtonTreeCollisionGetVertexListIndexListInAABB(
//
// See also: NewtonCreateTreeCollision, NewtonReleaseCollision
NewtonCollision *NewtonCreateHeightFieldCollision(
- const NewtonWorld *const newtonWorld, int width, int height,
+ NewtonWorld *const newtonWorld, int width, int height,
int cellsDiagonals, const unsigned short *const elevationMap,
const char *const atributeMap, dFloat horizontalScale, dFloat verticalScale,
int shapeID) {
@@ -3739,8 +3738,7 @@ NewtonCollision *NewtonCreateHeightFieldCollision(
// Remarks:
//
// See also: NewtonCreateTreeCollision, NewtonReleaseCollision
-NewtonCollision *NewtonCreateSceneCollision(
- const NewtonWorld *const newtonWorld, int shapeID) {
+NewtonCollision *NewtonCreateSceneCollision(NewtonWorld *const newtonWorld, int shapeID) {
Newton *world;
dgCollision *collision;
@@ -3754,7 +3752,7 @@ NewtonCollision *NewtonCreateSceneCollision(
}
NewtonSceneProxy *NewtonSceneCollisionCreateProxy(NewtonCollision *const scene,
- NewtonCollision *const collision, const dFloat *const matrixPtr) {
+ NewtonCollision *const collision, dFloat *const matrixPtr) {
dgMatrix matrix(*((dgMatrix *)matrixPtr));
matrix.m_front.m_w = dgFloat32(0.0f);
matrix.m_up.m_w = dgFloat32(0.0f);
@@ -3779,7 +3777,7 @@ void NewtonSceneProxySetMatrix(NewtonSceneProxy *const proxy,
dgList<dgCollisionScene::dgProxy *>::dgListNode *const node = (dgList <
dgCollisionScene::dgProxy * >::dgListNode *)proxy;
dgCollisionScene *const newtonScene = node->GetInfo()->m_owner;
- dgMatrix &offset = *((dgMatrix *)matrix);
+ const dgMatrix &offset = *((const dgMatrix *)matrix);
newtonScene->SetProxyMatrix(node, offset);
}
@@ -3861,16 +3859,16 @@ void NewtonSceneCollisionOptimize(NewtonCollision *const scene) {
// Remarks: the current implementation of this function do work on collision trees, or user define collision.
//
// See also: NewtonCollisionCollideContinue, NewtonCollisionClosestPoint, NewtonCollisionCollide, NewtonCollisionRayCast, NewtonCollisionCalculateAABB
-int NewtonCollisionPointDistance(const NewtonWorld *const newtonWorld,
- const dFloat *const point, const NewtonCollision *const collision,
+int NewtonCollisionPointDistance(NewtonWorld *const newtonWorld,
+ const dFloat *const point, NewtonCollision *const collision,
const dFloat *const matrix, dFloat *const contact, dFloat *const normal,
int threadIndex) {
Newton *world;
world = (Newton *)newtonWorld;
TRACE_FUNTION(__FUNCTION__);
- return world->ClosestPoint(*((dgTriplex *)point), (dgCollision *)collision,
- *((dgMatrix *)matrix), *((dgTriplex *)contact), *((dgTriplex *)normal),
+ return world->ClosestPoint(*((const dgTriplex *)point), (dgCollision *)collision,
+ *((const dgMatrix *)matrix), *((dgTriplex *)contact), *((dgTriplex *)normal),
threadIndex);
}
@@ -3902,17 +3900,17 @@ int NewtonCollisionPointDistance(const NewtonWorld *const newtonWorld,
// Remarks: the current implementation of this function does not work on collision trees, or user define collision.
//
// See also: NewtonCollisionCollideContinue, NewtonCollisionPointDistance, NewtonCollisionCollide, NewtonCollisionRayCast, NewtonCollisionCalculateAABB
-int NewtonCollisionClosestPoint(const NewtonWorld *const newtonWorld,
- const NewtonCollision *const collisionA, const dFloat *const matrixA,
- const NewtonCollision *const collisionB, const dFloat *const matrixB,
+int NewtonCollisionClosestPoint(NewtonWorld *const newtonWorld,
+ NewtonCollision *const collisionA, const dFloat *const matrixA,
+ NewtonCollision *const collisionB, const dFloat *const matrixB,
dFloat *const contactA, dFloat *const contactB, dFloat *const normalAB,
int threadIndex) {
Newton *world;
world = (Newton *)newtonWorld;
TRACE_FUNTION(__FUNCTION__);
- return world->ClosestPoint((dgCollision *)collisionA, *((dgMatrix *)matrixA),
- (dgCollision *)collisionB, *((dgMatrix *)matrixB),
+ return world->ClosestPoint((dgCollision *)collisionA, *((const dgMatrix *)matrixA),
+ (dgCollision *)collisionB, *((const dgMatrix *)matrixB),
*((dgTriplex *)contactA), *((dgTriplex *)contactB),
*((dgTriplex *)normalAB), threadIndex);
}
@@ -3943,17 +3941,17 @@ int NewtonCollisionClosestPoint(const NewtonWorld *const newtonWorld,
// Also the application should implement their own trivial aabb test, before calling this function .
//
// See also: NewtonCollisionCollideContinue, NewtonCollisionClosestPoint, NewtonCollisionPointDistance, NewtonCollisionRayCast, NewtonCollisionCalculateAABB
-int NewtonCollisionCollide(const NewtonWorld *const newtonWorld, int maxSize,
- const NewtonCollision *const collisionA, const dFloat *const matrixA,
- const NewtonCollision *const collisionB, const dFloat *const matrixB,
+int NewtonCollisionCollide(NewtonWorld *const newtonWorld, int maxSize,
+ NewtonCollision *const collisionA, const dFloat *const matrixA,
+ NewtonCollision *const collisionB, const dFloat *const matrixB,
dFloat *const contacts, dFloat *const normals, dFloat *const penetration,
int threadIndex) {
Newton *world;
world = (Newton *)newtonWorld;
TRACE_FUNTION(__FUNCTION__);
- return world->Collide((dgCollision *)collisionA, *((dgMatrix *)matrixA),
- (dgCollision *)collisionB, *((dgMatrix *)matrixB), (dgTriplex *)contacts,
+ return world->Collide((dgCollision *)collisionA, *((const dgMatrix *)matrixA),
+ (dgCollision *)collisionB, *((const dgMatrix *)matrixB), (dgTriplex *)contacts,
(dgTriplex *)normals, penetration, maxSize, threadIndex);
}
@@ -3995,10 +3993,10 @@ int NewtonCollisionCollide(const NewtonWorld *const newtonWorld, int maxSize,
// Also the application should implement their own trivial aabb test, before calling this function .
//
// See also: NewtonCollisionCollide, NewtonCollisionClosestPoint, NewtonCollisionPointDistance, NewtonCollisionRayCast, NewtonCollisionCalculateAABB
-int NewtonCollisionCollideContinue(const NewtonWorld *const newtonWorld,
- int maxSize, const dFloat timestep, const NewtonCollision *const collisionA,
+int NewtonCollisionCollideContinue(NewtonWorld *const newtonWorld,
+ int maxSize, const dFloat timestep, NewtonCollision *const collisionA,
const dFloat *const matrixA, const dFloat *const velocA,
- const dFloat *const omegaA, const NewtonCollision *const collisionB,
+ const dFloat *const omegaA, NewtonCollision *const collisionB,
const dFloat *const matrixB, const dFloat *const velocB,
const dFloat *const omegaB, dFloat *const timeOfImpact,
dFloat *const contacts, dFloat *const normals, dFloat *const penetration,
@@ -4117,7 +4115,7 @@ void NewtonCollisionCalculateAABB(const NewtonCollision *collisionPtr,
const dgCollision *collision;
collision = (const dgCollision *)collisionPtr;
// const dgMatrix& matrix = *((dgMatrix*) offsetMatrix);
- dgMatrix matrix(collision->GetOffsetMatrix() * (*((dgMatrix *)offsetMatrix)));
+ dgMatrix matrix(collision->GetOffsetMatrix() * (*((const dgMatrix *)offsetMatrix)));
dgVector q0;
dgVector q1;
@@ -4159,8 +4157,8 @@ void NewtonCollisionForEachPolygonDo(const NewtonCollision *collisionPtr,
const dFloat *const matrixPtr, NewtonCollisionIterator callback,
void *const userDataPtr) {
TRACE_FUNTION(__FUNCTION__);
- dgCollision *const collision = (dgCollision *)(collisionPtr);
- dgMatrix matrix = *((dgMatrix *)matrixPtr);
+ const dgCollision *const collision = (const dgCollision *)(collisionPtr);
+ const dgMatrix matrix = *((const dgMatrix *)matrixPtr);
collision->DebugCollision(matrix, (OnDebugCollisionMeshCallback)callback,
userDataPtr);
@@ -4182,8 +4180,8 @@ void NewtonCollisionForEachPolygonDo(const NewtonCollision *collisionPtr,
// Remarks:
// Collision objects are reference counted objects. The application should call *NewtonReleaseCollision* in order to release references to the object.
// Neglecting to release references to collision primitives is a common cause of memory leaks.
-void NewtonCollisionMakeUnique(const NewtonWorld *const newtonWorld,
- const NewtonCollision *const collisionPtr) {
+void NewtonCollisionMakeUnique(NewtonWorld *const newtonWorld,
+ NewtonCollision *const collisionPtr) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
dgCollision *const collision = (dgCollision *)collisionPtr;
@@ -4205,7 +4203,7 @@ void NewtonCollisionMakeUnique(const NewtonWorld *const newtonWorld,
// Neglecting to release references to collision primitives is a common cause of memory leaks.
//
// See also: NewtonReleaseCollision , NewtonCollisionGetInfo, NewtonCollisionSerialize
-int NewtonAddCollisionReference(const NewtonCollision *collisionPtr) {
+int NewtonAddCollisionReference(NewtonCollision *collisionPtr) {
TRACE_FUNTION(__FUNCTION__);
dgCollision *const collision = (dgCollision *)collisionPtr;
collision->AddRef();
@@ -4228,8 +4226,8 @@ int NewtonAddCollisionReference(const NewtonCollision *collisionPtr) {
// Neglecting to release references to collision primitives is a common cause of memory leaks.
//
// See also: NewtonAddCollisionReference, NewtonCollisionGetInfo, NewtonCollisionSerialize
-void NewtonReleaseCollision(const NewtonWorld *const newtonWorld,
- const NewtonCollision *const collisionPtr) {
+void NewtonReleaseCollision(NewtonWorld *const newtonWorld,
+ NewtonCollision *const collisionPtr) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
dgCollision *const collision = (dgCollision *)collisionPtr;
@@ -4256,8 +4254,8 @@ void NewtonCollisionSerialize(const NewtonWorld *const newtonWorld,
const NewtonCollision *const collision, NewtonSerialize serializeFunction,
void *const serializeHandle) {
TRACE_FUNTION(__FUNCTION__);
- Newton *const world = (Newton *)newtonWorld;
- world->Serialize((dgCollision *)collision, (dgSerialize)serializeFunction,
+ const Newton *const world = (const Newton *)newtonWorld;
+ world->Serialize((const dgCollision *)collision, (dgSerialize)serializeFunction,
serializeHandle);
}
@@ -4280,7 +4278,7 @@ void NewtonCollisionSerialize(const NewtonWorld *const newtonWorld,
//
// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCollisionSerialize, NewtonCollisionGetInfo
NewtonCollision *NewtonCreateCollisionFromSerialization(
- const NewtonWorld *const newtonWorld, NewtonDeserialize deserializeFunction,
+ NewtonWorld *const newtonWorld, NewtonDeserialize deserializeFunction,
void *const serializeHandle) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
@@ -4476,8 +4474,8 @@ dFloat NewtonCalculateSpringDamperAcceleration(dFloat dt, dFloat ks, dFloat x,
// All event functions are set to NULL and the material gruopID of the body is set to the default GroupID.
//
// See also: NewtonDestroyBody
-NewtonBody *NewtonCreateBody(const NewtonWorld *const newtonWorld,
- const NewtonCollision *const collisionPtr, const dFloat *const matrixPtr) {
+NewtonBody *NewtonCreateBody(NewtonWorld *const newtonWorld,
+ NewtonCollision *const collisionPtr, const dFloat *const matrixPtr) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
@@ -4487,7 +4485,7 @@ NewtonBody *NewtonCreateBody(const NewtonWorld *const newtonWorld,
SaveCollision(collisionPtr);
#endif
- dgMatrix matrix(*((dgMatrix *)matrixPtr));
+ dgMatrix matrix(*((const dgMatrix *)matrixPtr));
#ifdef _DEBUG
// matrix.m_front = matrix.m_front.Scale (dgRsqrt (matrix.m_front % matrix.m_front));
// matrix.m_right = matrix.m_front * matrix.m_up;
@@ -4517,8 +4515,8 @@ NewtonBody *NewtonCreateBody(const NewtonWorld *const newtonWorld,
// geometry will be destroyed. This function will destroy all joints associated with this body.
//
// See also: NewtonCreateBody
-void NewtonDestroyBody(const NewtonWorld *const newtonWorld,
- const NewtonBody *const bodyPtr) {
+void NewtonDestroyBody(NewtonWorld *const newtonWorld,
+ NewtonBody *const bodyPtr) {
dgBody *body;
Newton *world;
@@ -4541,7 +4539,7 @@ void NewtonDestroyBody(const NewtonWorld *const newtonWorld,
// if the application allocate some resource to store the user data, the application can register a joint destructor to get rid of the allocated resource when the body is destroyed
//
// See also: NewtonBodyGetUserData, NewtonBodySetDestructorCallback
-void NewtonBodySetUserData(const NewtonBody *const bodyPtr,
+void NewtonBodySetUserData(NewtonBody *const bodyPtr,
void *const userDataPtr) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -4606,7 +4604,7 @@ NewtonWorld *NewtonBodyGetWorld(const NewtonBody *const bodyPtr) {
// Remarks: The matrix should be organized in row-major order (this is the way directX and OpenGL stores matrices).
//
// See also: NewtonBodyGetUserData, NewtonBodyGetUserData
-void NewtonBodySetTransformCallback(const NewtonBody *const bodyPtr,
+void NewtonBodySetTransformCallback(NewtonBody *const bodyPtr,
NewtonSetTransform callback) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -4633,8 +4631,8 @@ void NewtonBodySetTransformCallback(const NewtonBody *const bodyPtr,
// See also: NewtonBodyGetUserData, NewtonBodyGetUserData
NewtonSetTransform NewtonBodyGetTransformCallback(
const NewtonBody *const bodyPtr) {
- dgBody *body;
- body = (dgBody *)bodyPtr;
+ const dgBody *body;
+ body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
return (NewtonSetTransform)body->GetMatrixUpdateCallback();
@@ -4655,7 +4653,7 @@ NewtonSetTransform NewtonBodyGetTransformCallback(
// The Newton Engine does not call the *NewtonApplyForceAndTorque callback* function for bodies that are inactive or have reached a state of stable equilibrium.
//
// See also: NewtonBodyGetUserData, NewtonBodyGetUserData, NewtonBodyGetForceAndTorqueCallback
-void NewtonBodySetForceAndTorqueCallback(const NewtonBody *const bodyPtr,
+void NewtonBodySetForceAndTorqueCallback(NewtonBody *const bodyPtr,
NewtonApplyForceAndTorque callback) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -4711,7 +4709,7 @@ NewtonApplyForceAndTorque NewtonBodyGetForceAndTorqueCallback(
// The destruction of a body will destroy all joints associated with the body.
//
// See also: NewtonBodyGetUserData, NewtonBodyGetUserData
-void NewtonBodySetDestructorCallback(const NewtonBody *const bodyPtr,
+void NewtonBodySetDestructorCallback(NewtonBody *const bodyPtr,
NewtonBodyDestructor callback) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -4739,7 +4737,7 @@ void NewtonBodySetDestructorCallback(const NewtonBody *const bodyPtr,
// realistic physics behavior.
//
// See also: NewtonConvexCollisionCalculateInertialMatrix, NewtonBodyGetMassMatrix, NewtonBodyGetInvMass
-void NewtonBodySetMassMatrix(const NewtonBody *const bodyPtr, dFloat mass,
+void NewtonBodySetMassMatrix(NewtonBody *const bodyPtr, dFloat mass,
dFloat Ixx, dFloat Iyy, dFloat Izz) {
dgBody *body;
dFloat Ixx1;
@@ -4847,8 +4845,8 @@ void NewtonBodyGetInvMass(const NewtonBody *const bodyPtr,
// Remarks: That application should make sure the transformation matrix has not scale, otherwise unpredictable result will occur.
//
// See also: NewtonBodyGetMatrix
-void NewtonBodySetMatrix(const NewtonBody *const bodyPtr,
- const dFloat *const matrixPtr) {
+void NewtonBodySetMatrix(NewtonBody *const bodyPtr,
+ dFloat *const matrixPtr) {
dgBody *body;
body = (dgBody *)bodyPtr;
dgMatrix matrix(*((dgMatrix *)matrixPtr));
@@ -4893,14 +4891,14 @@ void NewtonBodySetMatrix(const NewtonBody *const bodyPtr,
// passing them to Newton.
//
// See also: NewtonBodySetMatrix
-void NewtonBodySetMatrixRecursive(const NewtonBody *const bodyPtr,
+void NewtonBodySetMatrixRecursive(NewtonBody *const bodyPtr,
const dFloat *const matrixPtr) {
dgBody *body;
Newton *world;
body = (dgBody *)bodyPtr;
world = (Newton *)body->GetWorld();
- dgMatrix matrix(*((dgMatrix *)matrixPtr));
+ const dgMatrix matrix(*((const dgMatrix *)matrixPtr));
world->BodySetMatrix(body, matrix);
}
@@ -4969,7 +4967,7 @@ void NewtonBodyGetRotation(const NewtonBody *const bodyPtr, dFloat *rotPtr) {
// Remarks: This function is only effective when called from *NewtonApplyForceAndTorque callback*
//
// See also: NewtonBodyAddForce, NewtonBodyGetForce, NewtonBodyGetForceAcc
-void NewtonBodySetForce(const NewtonBody *const bodyPtr,
+void NewtonBodySetForce(NewtonBody *const bodyPtr,
const dFloat *vectorPtr) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -4991,7 +4989,7 @@ void NewtonBodySetForce(const NewtonBody *const bodyPtr,
// Remarks: This function is only effective when called from *NewtonApplyForceAndTorque callback*
//
// See also: NewtonBodySetForce, NewtonBodyGetForce, NewtonBodyGetForceAcc
-void NewtonBodyAddForce(const NewtonBody *const bodyPtr,
+void NewtonBodyAddForce(NewtonBody *const bodyPtr,
const dFloat *const vectorPtr) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -5116,7 +5114,7 @@ void NewtonBodySetTorque(NewtonBody *bodyPtr,
// Remarks: This function is only effective when called from *NewtonApplyForceAndTorque callback*
//
// See also: NewtonBodySetTorque, NewtonBodyGetTorque, NewtonBodyGetTorqueAcc
-void NewtonBodyAddTorque(const NewtonBody *const bodyPtr,
+void NewtonBodyAddTorque(NewtonBody *const bodyPtr,
const dFloat *const vectorPtr) {
dgBody *body;
body = (dgBody *)bodyPtr;
@@ -5290,7 +5288,7 @@ NewtonJoint *NewtonBodyGetNextJoint(const NewtonBody *const bodyPtr,
body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
- return (NewtonJoint *)body->GetNextJoint((dgConstraint *)jointPtr);
+ return (NewtonJoint *)body->GetNextJoint((const dgConstraint *)jointPtr);
}
// Name: NewtonBodyGetFirstContactJoint
@@ -5326,7 +5324,7 @@ NewtonJoint *NewtonBodyGetNextContactJoint(const NewtonBody *const bodyPtr,
body = (const dgBody *)bodyPtr;
TRACE_FUNTION(__FUNCTION__);
- return (NewtonJoint *)body->GetNextContact((dgConstraint *)contactPtr);
+ return (NewtonJoint *)body->GetNextContact((const dgConstraint *)contactPtr);
}
// Name: NewtonContactJointGetContactCount
@@ -5464,7 +5462,7 @@ NewtonMaterial *NewtonContactGetMaterial(void *const contact) {
// of compound collision geometry with different IDs.
//
// See also: NewtonConvexCollisionCalculateVolume
-void NewtonBodyAddBuoyancyForce(const NewtonBody *const bodyPtr,
+void NewtonBodyAddBuoyancyForce(NewtonBody *const bodyPtr,
dFloat fluidDensity, dFloat fluidLinearViscosity,
dFloat fluidAngularViscosity, const dFloat *const gravityVector,
NewtonGetBuoyancyPlane buoyancyPlane, void *const context) {
diff --git a/engines/hpl1/engine/libraries/newton/Newton.h b/engines/hpl1/engine/libraries/newton/Newton.h
index 44a7877b0f8..d78e7acaf1e 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.h
+++ b/engines/hpl1/engine/libraries/newton/Newton.h
@@ -283,7 +283,7 @@ typedef void (*NewtonTreeCollisionCallback)(const NewtonBody *const bodyWithTree
int vertexCount, const dFloat *const vertex, int vertexStrideInBytes);
typedef void (*NewtonBodyDestructor)(const NewtonBody *const body);
-typedef void (*NewtonApplyForceAndTorque)(const NewtonBody *const body, dFloat timestep, int threadIndex);
+typedef void (*NewtonApplyForceAndTorque)(NewtonBody *const body, dFloat timestep, int threadIndex);
typedef void (*NewtonSetTransform)(const NewtonBody *const body, const dFloat *const matrix, int threadIndex);
typedef int (*NewtonIslandUpdate)(const NewtonWorld *const newtonWorld, const void *islandHandle, int bodyCount);
@@ -475,22 +475,22 @@ NEWTON_API void NewtonConvexHullModifierGetMatrix(const NewtonCollision *const c
NEWTON_API void NewtonConvexHullModifierSetMatrix(const NewtonCollision *const convexHullCollision, const dFloat *const matrix);
NEWTON_API int NewtonCollisionIsTriggerVolume(const NewtonCollision *const convexCollision);
-NEWTON_API void NewtonCollisionSetAsTriggerVolume(const NewtonCollision *convexCollision, int trigger);
+NEWTON_API void NewtonCollisionSetAsTriggerVolume(NewtonCollision *convexCollision, int trigger);
-NEWTON_API void NewtonCollisionSetMaxBreakImpactImpulse(const NewtonCollision *const convexHullCollision, dFloat maxImpactImpulse);
+NEWTON_API void NewtonCollisionSetMaxBreakImpactImpulse(NewtonCollision *const convexHullCollision, dFloat maxImpactImpulse);
NEWTON_API dFloat NewtonCollisionGetMaxBreakImpactImpulse(const NewtonCollision *const convexHullCollision);
-NEWTON_API void NewtonCollisionSetUserID(const NewtonCollision *convexCollision, unsigned id);
-NEWTON_API unsigned NewtonCollisionGetUserID(const NewtonCollision *const convexCollision);
+NEWTON_API void NewtonCollisionSetUserID(NewtonCollision *convexCollision, unsigned id);
+NEWTON_API unsigned NewtonCollisionGetUserID(NewtonCollision *const convexCollision);
NEWTON_API int NewtonConvexHullGetFaceIndices(const NewtonCollision *const convexHullCollision, int face, int *const faceIndices);
NEWTON_API dFloat NewtonConvexCollisionCalculateVolume(const NewtonCollision *const convexCollision);
NEWTON_API void NewtonConvexCollisionCalculateInertialMatrix(const NewtonCollision *convexCollision, dFloat *const inertia, dFloat *const origin);
-NEWTON_API void NewtonCollisionMakeUnique(const NewtonWorld *const newtonWorld, const NewtonCollision *const collision);
-NEWTON_API void NewtonReleaseCollision(const NewtonWorld *const newtonWorld, const NewtonCollision *const collision);
-NEWTON_API int NewtonAddCollisionReference(const NewtonCollision *const collision);
+NEWTON_API void NewtonCollisionMakeUnique(NewtonWorld *const newtonWorld, NewtonCollision *const collision);
+NEWTON_API void NewtonReleaseCollision(NewtonWorld *const newtonWorld, NewtonCollision *const collision);
+NEWTON_API int NewtonAddCollisionReference(NewtonCollision *const collision);
// **********************************************************************************************
@@ -513,7 +513,7 @@ NEWTON_API int NewtonAddCollisionReference(const NewtonCollision *const collisio
//
// **********************************************************************************************
NEWTON_API NewtonCollision *NewtonCreateCompoundCollision(const NewtonWorld *const newtonWorld, int count, NewtonCollision *const collisionPrimitiveArray[], int shapeID);
-NEWTON_API NewtonCollision *NewtonCreateCompoundCollisionFromMesh(const NewtonWorld *const newtonWorld, const NewtonMesh *const mesh, dFloat hullTolerance, int shapeID, int subShapeID);
+NEWTON_API NewtonCollision *NewtonCreateCompoundCollisionFromMesh(NewtonWorld *const newtonWorld, const NewtonMesh *const mesh, dFloat hullTolerance, int shapeID, int subShapeID);
//NEWTON_API NewtonCollision* NewtonCreateCompoundCollisionFromMesh(const NewtonWorld* const newtonWorld, const NewtonMesh* const mesh, int maxSubShapesCount, int shapeID, int subShapeID);
// **********************************************************************************************
@@ -552,23 +552,23 @@ NEWTON_API void NewtonBreakableEndDelete(const NewtonCollision *const compoundBr
NEWTON_API int NewtonBreakableGetComponentsInRadius(const NewtonCollision *const compoundBreakable, const dFloat *position, dFloat radius, NewtonbreakableComponentMesh **const segments, int maxCount);
-NEWTON_API void *NewtonBreakableGetFirstSegment(const NewtonbreakableComponentMesh *const breakableComponent);
+NEWTON_API void *NewtonBreakableGetFirstSegment(NewtonbreakableComponentMesh *const breakableComponent);
NEWTON_API void *NewtonBreakableGetNextSegment(const void *const segment);
-NEWTON_API int NewtonBreakableSegmentGetMaterial(const void *const segment);
-NEWTON_API int NewtonBreakableSegmentGetIndexCount(const void *const segment);
-NEWTON_API int NewtonBreakableSegmentGetIndexStream(const NewtonCollision *const compoundBreakable, const NewtonbreakableComponentMesh *const meshOwner, const void *const segment, int *const index);
-NEWTON_API int NewtonBreakableSegmentGetIndexStreamShort(const NewtonCollision *const compoundBreakable, const NewtonbreakableComponentMesh *const meshOwner, const void *const segment, short int *const index);
+NEWTON_API int NewtonBreakableSegmentGetMaterial(void *const segment);
+NEWTON_API int NewtonBreakableSegmentGetIndexCount(void *const segment);
+NEWTON_API int NewtonBreakableSegmentGetIndexStream(const NewtonCollision *const compoundBreakable, NewtonbreakableComponentMesh *const meshOwner, void *const segment, int *const index);
+NEWTON_API int NewtonBreakableSegmentGetIndexStreamShort(const NewtonCollision *const compoundBreakable, const NewtonbreakableComponentMesh *const meshOwner, void *const segment, short int *const index);
-NEWTON_API NewtonCollision *NewtonCreateUserMeshCollision(const NewtonWorld *const newtonWorld, const dFloat *const minBox,
+NEWTON_API NewtonCollision *NewtonCreateUserMeshCollision(NewtonWorld *const newtonWorld, const dFloat *const minBox,
const dFloat *const maxBox, void *const userData, NewtonUserMeshCollisionCollideCallback collideCallback,
NewtonUserMeshCollisionRayHitCallback rayHitCallback, NewtonUserMeshCollisionDestroyCallback destroyCallback,
NewtonUserMeshCollisionGetCollisionInfo getInfoCallback, NewtonUserMeshCollisionGetFacesInAABB facesInAABBCallback, int shapeID);
-NEWTON_API NewtonCollision *NewtonCreateSceneCollision(const NewtonWorld *const newtonWorld, int shapeID);
-NEWTON_API NewtonSceneProxy *NewtonSceneCollisionCreateProxy(NewtonCollision *const scene, NewtonCollision *const collision, const dFloat *const matrix);
+NEWTON_API NewtonCollision *NewtonCreateSceneCollision(NewtonWorld *const newtonWorld, int shapeID);
+NEWTON_API NewtonSceneProxy *NewtonSceneCollisionCreateProxy(NewtonCollision *const scene, NewtonCollision *const collision, dFloat *const matrix);
NEWTON_API void NewtonSceneCollisionDestroyProxy(NewtonCollision *const scene, NewtonSceneProxy *Proxy);
NEWTON_API void NewtonSceneProxySetMatrix(NewtonSceneProxy *const proxy, const dFloat *matrix);
@@ -586,7 +586,7 @@ NEWTON_API void NewtonSceneCollisionOptimize(NewtonCollision *scene);
// Collision serialization functions
//
// ***********************************************************************************************************
-NEWTON_API NewtonCollision *NewtonCreateCollisionFromSerialization(const NewtonWorld *const newtonWorld, NewtonDeserialize deserializeFunction, void *const serializeHandle);
+NEWTON_API NewtonCollision *NewtonCreateCollisionFromSerialization(NewtonWorld *const newtonWorld, NewtonDeserialize deserializeFunction, void *const serializeHandle);
NEWTON_API void NewtonCollisionSerialize(const NewtonWorld *const newtonWorld, const NewtonCollision *const collision, NewtonSerialize serializeFunction, void *const serializeHandle);
NEWTON_API void NewtonCollisionGetInfo(const NewtonCollision *const collision, NewtonCollisionInfoRecord *const collisionInfo);
@@ -595,48 +595,48 @@ NEWTON_API void NewtonCollisionGetInfo(const NewtonCollision *const collision, N
// Static collision shapes functions
//
// **********************************************************************************************
-NEWTON_API NewtonCollision *NewtonCreateHeightFieldCollision(const NewtonWorld *const newtonWorld, int width, int height, int gridsDiagonals,
+NEWTON_API NewtonCollision *NewtonCreateHeightFieldCollision(NewtonWorld *const newtonWorld, int width, int height, int gridsDiagonals,
const unsigned short *const elevationMap, const char *const attributeMap,
dFloat horizontalScale, dFloat verticalScale, int shapeID);
-NEWTON_API void NewtonHeightFieldSetUserRayCastCallback(const NewtonCollision *const treeCollision, NewtonHeightFieldRayCastCallback rayHitCallback);
+NEWTON_API void NewtonHeightFieldSetUserRayCastCallback(NewtonCollision *const treeCollision, NewtonHeightFieldRayCastCallback rayHitCallback);
-NEWTON_API NewtonCollision *NewtonCreateTreeCollision(const NewtonWorld *const newtonWorld, int shapeID);
+NEWTON_API NewtonCollision *NewtonCreateTreeCollision(NewtonWorld *const newtonWorld, int shapeID);
NEWTON_API NewtonCollision *NewtonCreateTreeCollisionFromMesh(const NewtonWorld *const newtonWorld, const NewtonMesh *const mesh, int shapeID);
NEWTON_API void NewtonTreeCollisionSetUserRayCastCallback(const NewtonCollision *const treeCollision, NewtonCollisionTreeRayCastCallback rayHitCallback);
-NEWTON_API void NewtonTreeCollisionBeginBuild(const NewtonCollision *treeCollision);
-NEWTON_API void NewtonTreeCollisionAddFace(const NewtonCollision *const treeCollision, int vertexCount, const dFloat *const vertexPtr, int strideInBytes, int faceAttribute);
-NEWTON_API void NewtonTreeCollisionEndBuild(const NewtonCollision *const treeCollision, int optimize);
+NEWTON_API void NewtonTreeCollisionBeginBuild(NewtonCollision *treeCollision);
+NEWTON_API void NewtonTreeCollisionAddFace(NewtonCollision *const treeCollision, int vertexCount, const dFloat *const vertexPtr, int strideInBytes, int faceAttribute);
+NEWTON_API void NewtonTreeCollisionEndBuild(NewtonCollision *const treeCollision, int optimize);
NEWTON_API int NewtonTreeCollisionGetFaceAtribute(const NewtonCollision *const treeCollision, const int *const faceIndexArray);
-NEWTON_API void NewtonTreeCollisionSetFaceAtribute(const NewtonCollision *const treeCollision, const int *const faceIndexArray, int attribute);
-NEWTON_API int NewtonTreeCollisionGetVertexListIndexListInAABB(const NewtonCollision *const treeCollision, const dFloat *const p0, const dFloat *const p1, const dFloat **const vertexArray, int *const vertexCount, int *const vertexStrideInBytes, const int *const indexList, int maxIndexCount, const int *const faceAttribute);
+NEWTON_API void NewtonTreeCollisionSetFaceAtribute(NewtonCollision *const treeCollision, const int *const faceIndexArray, int attribute);
+NEWTON_API int NewtonTreeCollisionGetVertexListIndexListInAABB(const NewtonCollision *const treeCollision, const dFloat *const p0, const dFloat *const p1, const dFloat **const vertexArray, int *const vertexCount, int *const vertexStrideInBytes, int *const indexList, int maxIndexCount, int *const faceAttribute);
-NEWTON_API void NewtonStaticCollisionSetDebugCallback(const NewtonCollision *const staticCollision, NewtonTreeCollisionCallback userCallback);
+NEWTON_API void NewtonStaticCollisionSetDebugCallback(NewtonCollision *const staticCollision, NewtonTreeCollisionCallback userCallback);
// **********************************************************************************************
//
// General purpose collision library functions
//
// **********************************************************************************************
-NEWTON_API int NewtonCollisionPointDistance(const NewtonWorld *const newtonWorld, const dFloat *const point,
- const NewtonCollision *const collision, const dFloat *const matrix, dFloat *const contact, dFloat *const normal, int threadIndex);
+NEWTON_API int NewtonCollisionPointDistance(NewtonWorld *const newtonWorld, const dFloat *const point,
+ NewtonCollision *const collision, const dFloat *const matrix, dFloat *const contact, dFloat *const normal, int threadIndex);
-NEWTON_API int NewtonCollisionClosestPoint(const NewtonWorld *const newtonWorld,
- const NewtonCollision *const collisionA, const dFloat *const matrixA, const NewtonCollision *const collisionB, const dFloat *const matrixB,
+NEWTON_API int NewtonCollisionClosestPoint(NewtonWorld *const newtonWorld,
+ NewtonCollision *const collisionA, const dFloat *const matrixA, NewtonCollision *const collisionB, const dFloat *const matrixB,
dFloat *const contactA, dFloat *const contactB, dFloat *const normalAB, int threadIndex);
-NEWTON_API int NewtonCollisionCollide(const NewtonWorld *const newtonWorld, int maxSize,
- const NewtonCollision *const collisionA, const dFloat *const matrixA,
- const NewtonCollision *const collisionB, const dFloat *const matrixB,
+NEWTON_API int NewtonCollisionCollide(NewtonWorld *const newtonWorld, int maxSize,
+ NewtonCollision *const collisionA, const dFloat *const matrixA,
+ NewtonCollision *const collisionB, const dFloat *const matrixB,
dFloat *const contacts, dFloat *const normals, dFloat *const penetration, int threadIndex);
-NEWTON_API int NewtonCollisionCollideContinue(const NewtonWorld *const newtonWorld, int maxSize, const dFloat timestep,
- const NewtonCollision *const collisionA, const dFloat *const matrixA, const dFloat *const velocA, const dFloat *omegaA,
- const NewtonCollision *const collisionB, const dFloat *const matrixB, const dFloat *const velocB, const dFloat *const omegaB,
+NEWTON_API int NewtonCollisionCollideContinue(NewtonWorld *const newtonWorld, int maxSize, const dFloat timestep,
+ NewtonCollision *const collisionA, const dFloat *const matrixA, const dFloat *const velocA, const dFloat *omegaA,
+ NewtonCollision *const collisionB, const dFloat *const matrixB, const dFloat *const velocB, const dFloat *const omegaB,
dFloat *const timeOfImpact, dFloat *const contacts, dFloat *const normals, dFloat *const penetration, int threadIndex);
NEWTON_API void NewtonCollisionSupportVertex(const NewtonCollision *const collision, const dFloat *const dir, dFloat *const vertex);
@@ -659,28 +659,28 @@ NEWTON_API dFloat NewtonCalculateSpringDamperAcceleration(dFloat dt, dFloat ks,
// body manipulation functions
//
// **********************************************************************************************
-NEWTON_API NewtonBody *NewtonCreateBody(const NewtonWorld *const newtonWorld, const NewtonCollision *const collision, const dFloat *const matrix);
-NEWTON_API void NewtonDestroyBody(const NewtonWorld *const newtonWorld, const NewtonBody *const body);
+NEWTON_API NewtonBody *NewtonCreateBody(NewtonWorld *const newtonWorld, NewtonCollision *const collision, const dFloat *const matrix);
+NEWTON_API void NewtonDestroyBody(NewtonWorld *const newtonWorld, NewtonBody *const body);
-NEWTON_API void NewtonBodyAddForce(const NewtonBody *const body, const dFloat *const force);
-NEWTON_API void NewtonBodyAddTorque(const NewtonBody *const body, const dFloat *const torque);
+NEWTON_API void NewtonBodyAddForce(NewtonBody *const body, const dFloat *const force);
+NEWTON_API void NewtonBodyAddTorque(NewtonBody *const body, const dFloat *const torque);
NEWTON_API void NewtonBodyCalculateInverseDynamicsForce(const NewtonBody *const body, dFloat timestep, const dFloat *const desiredVeloc, dFloat *const forceOut);
-NEWTON_API void NewtonBodySetMatrix(const NewtonBody *const body, const dFloat *const matrix);
-NEWTON_API void NewtonBodySetMatrixRecursive(const NewtonBody *const body, const dFloat *const matrix);
-NEWTON_API void NewtonBodySetMassMatrix(const NewtonBody *const body, dFloat mass, dFloat Ixx, dFloat Iyy, dFloat Izz);
+NEWTON_API void NewtonBodySetMatrix(NewtonBody *const body, dFloat *const matrix);
+NEWTON_API void NewtonBodySetMatrixRecursive(NewtonBody *const body, const dFloat *const matrix);
+NEWTON_API void NewtonBodySetMassMatrix(NewtonBody *const body, dFloat mass, dFloat Ixx, dFloat Iyy, dFloat Izz);
NEWTON_API void NewtonBodySetMaterialGroupID(NewtonBody *body, int id);
NEWTON_API void NewtonBodySetContinuousCollisionMode(NewtonBody *body, unsigned state);
NEWTON_API void NewtonBodySetJointRecursiveCollision(NewtonBody *body, unsigned state);
NEWTON_API void NewtonBodySetOmega(NewtonBody *body, const dFloat *const omega);
NEWTON_API void NewtonBodySetVelocity(NewtonBody *body, const dFloat *const velocity);
-NEWTON_API void NewtonBodySetForce(const NewtonBody *const body, const dFloat *const force);
+NEWTON_API void NewtonBodySetForce(NewtonBody *const body, const dFloat *const force);
NEWTON_API void NewtonBodySetTorque(NewtonBody *body, const dFloat *const torque);
NEWTON_API void NewtonBodySetCentreOfMass(NewtonBody *body, const dFloat *const com);
NEWTON_API void NewtonBodySetLinearDamping(NewtonBody *body, dFloat linearDamp);
NEWTON_API void NewtonBodySetAngularDamping(NewtonBody *body, const dFloat *const angularDamp);
-NEWTON_API void NewtonBodySetUserData(const NewtonBody *const body, void *const userData);
+NEWTON_API void NewtonBodySetUserData(NewtonBody *const body, void *const userData);
NEWTON_API void NewtonBodySetCollision(NewtonBody *body, NewtonCollision *collision);
@@ -704,12 +704,12 @@ NEWTON_API void NewtonBodySetFreezeState(NewtonBody *body, int state);
// NEWTON_API void NewtonBodySetAutoactiveCallback (const NewtonBody* const body, NewtonBodyActivationState callback);
-NEWTON_API void NewtonBodySetDestructorCallback(const NewtonBody *const body, NewtonBodyDestructor callback);
+NEWTON_API void NewtonBodySetDestructorCallback(NewtonBody *const body, NewtonBodyDestructor callback);
-NEWTON_API void NewtonBodySetTransformCallback(const NewtonBody *const body, NewtonSetTransform callback);
+NEWTON_API void NewtonBodySetTransformCallback(NewtonBody *const body, NewtonSetTransform callback);
NEWTON_API NewtonSetTransform NewtonBodyGetTransformCallback(const NewtonBody *const body);
-NEWTON_API void NewtonBodySetForceAndTorqueCallback(const NewtonBody *const body, NewtonApplyForceAndTorque callback);
+NEWTON_API void NewtonBodySetForceAndTorqueCallback(NewtonBody *const body, NewtonApplyForceAndTorque callback);
NEWTON_API NewtonApplyForceAndTorque NewtonBodyGetForceAndTorqueCallback(const NewtonBody *const body);
NEWTON_API void *NewtonBodyGetUserData(const NewtonBody *const body);
NEWTON_API NewtonWorld *NewtonBodyGetWorld(const NewtonBody *const body);
@@ -748,7 +748,7 @@ NEWTON_API void NewtonContactJointRemoveContact(NewtonJoint *contactJoint, void
NEWTON_API NewtonMaterial *NewtonContactGetMaterial(void *const contact);
-NEWTON_API void NewtonBodyAddBuoyancyForce(const NewtonBody *const body, dFloat fluidDensity,
+NEWTON_API void NewtonBodyAddBuoyancyForce(NewtonBody *const body, dFloat fluidDensity,
dFloat fluidLinearViscosity, dFloat fluidAngularViscosity,
const dFloat *const gravityVector, NewtonGetBuoyancyPlane buoyancyPlane, void *const context);
diff --git a/engines/hpl1/engine/libraries/newton/core/dgList.h b/engines/hpl1/engine/libraries/newton/core/dgList.h
index 5d693a5b4e3..2d52f0a02e6 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgList.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgList.h
@@ -643,5 +643,3 @@ bool dgList<T>::SanityCheck() const {
#endif
-
-
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgBody.cpp b/engines/hpl1/engine/libraries/newton/physics/dgBody.cpp
index c5dc82d34a8..aeac0b28cce 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgBody.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgBody.cpp
@@ -710,7 +710,7 @@ dgConstraint *dgBody::GetFirstJoint() const {
return NULL;
}
-dgConstraint *dgBody::GetNextJoint(dgConstraint *joint) const {
+dgConstraint *dgBody::GetNextJoint(const dgConstraint *joint) const {
dgBodyMasterListRow::dgListNode *node;
node = joint->GetLink0();
@@ -744,7 +744,7 @@ dgConstraint *dgBody::GetFirstContact() const {
return NULL;
}
-dgConstraint *dgBody::GetNextContact(dgConstraint *joint) const {
+dgConstraint *dgBody::GetNextContact(const dgConstraint *joint) const {
dgBodyMasterListRow::dgListNode *node;
node = joint->GetLink0();
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgBody.h b/engines/hpl1/engine/libraries/newton/physics/dgBody.h
index a938c70437e..68ffee2ffc7 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgBody.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgBody.h
@@ -108,16 +108,16 @@ public:
void SetContinuesCollisionMode(bool mode);
void SetDestructorCallback(OnBodyDestroy destructor);
void SetMatrixUpdateCallback(OnMatrixUpdateCallback callback);
- OnMatrixUpdateCallback GetMatrixUpdateCallback();
+ OnMatrixUpdateCallback GetMatrixUpdateCallback() const;
// void SetAutoactiveNotify (OnActivation activate);
void SetExtForceAndTorqueCallback(OnApplyExtForceAndTorque callback);
OnApplyExtForceAndTorque GetExtForceAndTorqueCallback() const;
dgConstraint *GetFirstJoint() const;
- dgConstraint *GetNextJoint(dgConstraint *joint) const;
+ dgConstraint *GetNextJoint(const dgConstraint *joint) const;
dgConstraint *GetFirstContact() const;
- dgConstraint *GetNextContact(dgConstraint *joint) const;
+ dgConstraint *GetNextContact(const dgConstraint *joint) const;
void *GetUserData() const;
dgWorld *GetWorld() const;
@@ -370,7 +370,7 @@ inline void dgBody::SetMatrixUpdateCallback(OnMatrixUpdateCallback callback) {
m_matrixUpdate = callback;
}
-inline OnMatrixUpdateCallback dgBody::GetMatrixUpdateCallback() {
+inline OnMatrixUpdateCallback dgBody::GetMatrixUpdateCallback() const {
return m_matrixUpdate;
}
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
index 391ee0862b1..4cec105289e 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
@@ -1035,7 +1035,7 @@ void dgCollisionCompoundBreakable::GetCollisionInfo(dgCollisionInfo *info) const
}
dgInt32 dgCollisionCompoundBreakable::GetSegmentIndexStreamShort(
- dgDebriGraph::dgListNode *const node, dgMesh::dgListNode *subMeshNode,
+ const dgDebriGraph::dgListNode *const node, dgMesh::dgListNode *subMeshNode,
dgInt16 *const index) const {
dgInt32 currentIndex;
dgSubMesh *const subMesh = &subMeshNode->GetInfo();
@@ -1109,7 +1109,7 @@ dgInt32 dgCollisionCompoundBreakable::GetSegmentIndexStream(
dgInt32 dgCollisionCompoundBreakable::GetSegmentsInRadius(
const dgVector &origin, dgFloat32 radius,
- dgDebriGraph::dgListNode **segments, dgInt32 maxCount) {
+ dgDebriGraph::dgListNode **segments, dgInt32 maxCount) const {
dgInt32 count;
dgInt32 stack;
dgNodeBase *stackPool[DG_COMPOUND_STACK_DEPTH];
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
index 9afdb9eda48..7c6d825de87 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
@@ -218,7 +218,7 @@ public:
dgDebriGraph::dgListNode *GetFirstComponentMesh() const {
return (m_conectivity.GetCount() > 2) ? m_conectivity.GetFirst()->GetNext() : NULL;
}
- dgInt32 GetSegmentsInRadius(const dgVector &origin, dgFloat32 radius, dgDebriGraph::dgListNode **segments, dgInt32 maxCount);
+ dgInt32 GetSegmentsInRadius(const dgVector &origin, dgFloat32 radius, dgDebriGraph::dgListNode **segments, dgInt32 maxCount) const;
void ResetAnchor();
void SetAnchoredParts(dgInt32 count, const dgMatrix *const matrixArray, const dgCollision **collisionArray);
@@ -227,7 +227,7 @@ public:
// dgInt32 GetDetachedPieces (dgCollision** shapes, dgInt32 maxCount);
dgInt32 GetSegmentIndexStream(dgDebriGraph::dgListNode *const node, dgMesh::dgListNode *segment, dgInt32 *const index) const;
- dgInt32 GetSegmentIndexStreamShort(dgDebriGraph::dgListNode *const node, dgMesh::dgListNode *segment, dgInt16 *const index) const;
+ dgInt32 GetSegmentIndexStreamShort(const dgDebriGraph::dgListNode *const node, dgMesh::dgListNode *segment, dgInt16 *const index) const;
dgInt32 GetVertecCount() const {
return m_vertexBuffer->m_vertexCount;
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp b/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
index 8e4806abf70..630531820fd 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
@@ -395,7 +395,7 @@ dgCollision *dgWorld::CreateScene() {
return new (m_allocator) dgCollisionScene(this);
}
-void dgWorld::Serialize(dgCollision *shape, dgSerialize serialization,
+void dgWorld::Serialize(const dgCollision *shape, dgSerialize serialization,
void *const userData) const {
dgInt32 signature[4];
@@ -653,7 +653,7 @@ void dgWorld::ReleaseCollision(dgCollision *const collision) {
// separate collision system
//
// ********************************************************************************
-dgInt32 dgWorld::ClosestPoint(dgTriplex &point, dgCollision *const collision,
+dgInt32 dgWorld::ClosestPoint(const dgTriplex &point, dgCollision *const collision,
const dgMatrix &matrix, dgTriplex &contact, dgTriplex &normal,
dgInt32 threadIndex) const {
dgTriplex contactA;
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorld.h b/engines/hpl1/engine/libraries/newton/physics/dgWorld.h
index 3c60b101c7e..58eff75c03e 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorld.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorld.h
@@ -174,7 +174,7 @@ public:
dgFloat32 &timeStep, dgTriplex *const points, dgTriplex *const normals, dgFloat32 *const penetration, dgInt32 maxSize, dgInt32 threadIndex);
- dgInt32 ClosestPoint(dgTriplex &point, dgCollision *const collision, const dgMatrix &matrix, dgTriplex &contact, dgTriplex &normal, dgInt32 threadIndex) const;
+ dgInt32 ClosestPoint(const dgTriplex &point, dgCollision *const collision, const dgMatrix &matrix, dgTriplex &contact, dgTriplex &normal, dgInt32 threadIndex) const;
dgInt32 ClosestPoint(dgCollision *const collisionA, const dgMatrix &matrixA, dgCollision *const collisionB, const dgMatrix &matrixB,
dgTriplex &contactA, dgTriplex &contactB, dgTriplex &normalAB, dgInt32 threadIndex) const;
@@ -256,7 +256,7 @@ public:
dgCollision *CreateScene();
- void Serialize(dgCollision *shape, dgSerialize deserialization, void *const userData) const;
+ void Serialize(const dgCollision *shape, dgSerialize deserialization, void *const userData) const;
dgCollision *CreateFromSerialization(dgDeserialize deserialization, void *const userData);
void RemoveFromCache(dgCollision *const collision);
@@ -519,4 +519,3 @@ inline void dgWorld::AddToBreakQueue(const dgContact *const contactJoint, dgBody
#endif // !defined(AFX_DGPHYSICSWORLD_H__EC18C699_D48D_448F_A510_A865B2CC0789__INCLUDED_)
-
Commit: 24544e49db0b94edc0412d02cbe6fb0de009fcf1
https://github.com/scummvm/scummvm/commit/24544e49db0b94edc0412d02cbe6fb0de009fcf1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:20+01:00
Commit Message:
HPL1: Fix const correctness in Newton.cpp. Finally!
Changed paths:
engines/hpl1/engine/libraries/newton/Newton.cpp
engines/hpl1/engine/libraries/newton/Newton.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
engines/hpl1/engine/libraries/newton/physics/dgWorld.h
diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
index 94be6f8fc6e..78ec0c24112 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.cpp
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -199,7 +199,7 @@ void NewtonDestroy(const NewtonWorld *const newtonWorld) {
// using it as part of the simulation loop will severally affect the engine performance.
//
// See also: NewtonUpdate
-void NewtonInvalidateCache(const NewtonWorld *const newtonWorld) {
+void NewtonInvalidateCache(NewtonWorld *const newtonWorld) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
world->FlushCache();
@@ -250,7 +250,7 @@ void NewtonInvalidateCache(const NewtonWorld *const newtonWorld) {
// specially floating point instructions set.
//
// See also: NewtonGetPlatformArchitecture
-void NewtonSetPlatformArchitecture(const NewtonWorld *const newtonWorld,
+void NewtonSetPlatformArchitecture(NewtonWorld *const newtonWorld,
int mode) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
@@ -285,7 +285,7 @@ void NewtonSetPlatformArchitecture(const NewtonWorld *const newtonWorld,
int NewtonGetPlatformArchitecture(const NewtonWorld *const newtonWorld,
char *description) {
TRACE_FUNTION(__FUNCTION__);
- Newton *const world = (Newton *)newtonWorld;
+ const Newton *const world = (const Newton *)newtonWorld;
return world->GetHardwareMode(description);
}
@@ -313,7 +313,7 @@ int NewtonGetPlatformArchitecture(const NewtonWorld *const newtonWorld,
// Return: Nothing.
//
// See also: NewtonWorldCriticalSectionUnlock
-void NewtonWorldCriticalSectionLock(const NewtonWorld *const newtonWorld) {
+void NewtonWorldCriticalSectionLock(NewtonWorld *const newtonWorld) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
@@ -343,7 +343,7 @@ void NewtonWorldCriticalSectionLock(const NewtonWorld *const newtonWorld) {
// Return: Nothing.
//
// See also: NewtonWorldCriticalSectionLock
-void NewtonWorldCriticalSectionUnlock(const NewtonWorld *const newtonWorld) {
+void NewtonWorldCriticalSectionUnlock(NewtonWorld *const newtonWorld) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
@@ -367,7 +367,7 @@ void NewtonWorldCriticalSectionUnlock(const NewtonWorld *const newtonWorld) {
// Remarks: the function is only only have effect on the multi core version of the engine.
//
// See also: NewtonGetThreadNumber, NewtonGetThreadsCount
-void NewtonSetThreadsCount(const NewtonWorld *const newtonWorld, int threads) {
+void NewtonSetThreadsCount(NewtonWorld *const newtonWorld, int threads) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
@@ -390,7 +390,7 @@ void NewtonSetThreadsCount(const NewtonWorld *const newtonWorld, int threads) {
int NewtonGetThreadsCount(const NewtonWorld *const newtonWorld) {
TRACE_FUNTION(__FUNCTION__);
- Newton *const world = (Newton *)newtonWorld;
+ const Newton *const world = (const Newton *)newtonWorld;
return world->GetThreadsCount();
}
@@ -410,7 +410,7 @@ int NewtonGetThreadsCount(const NewtonWorld *const newtonWorld) {
int NewtonGetMaxThreadsCount(const NewtonWorld *const newtonWorld) {
TRACE_FUNTION(__FUNCTION__);
- Newton *const world = (Newton *)newtonWorld;
+ const Newton *const world = (const Newton *)newtonWorld;
return world->GetMaxThreadsCount();
}
@@ -460,7 +460,7 @@ int NewtonGetMaxThreadsCount(const NewtonWorld *const newtonWorld) {
//
// See also: NewtonGetThreadsCount, NewtonSetThreadsCount
void NewtonSetMultiThreadSolverOnSingleIsland(
- const NewtonWorld *const newtonWorld, int mode) {
+ NewtonWorld *const newtonWorld, int mode) {
Newton *world;
world = (Newton *)newtonWorld;
TRACE_FUNTION(__FUNCTION__);
@@ -469,8 +469,8 @@ void NewtonSetMultiThreadSolverOnSingleIsland(
int NewtonGetMultiThreadSolverOnSingleIsland(
const NewtonWorld *const newtonWorld) {
- Newton *world;
- world = (Newton *)newtonWorld;
+ const Newton *world;
+ world = (const Newton *)newtonWorld;
TRACE_FUNTION(__FUNCTION__);
return world->GetThreadOnSingleIsland();
}
@@ -501,7 +501,7 @@ int NewtonGetMultiThreadSolverOnSingleIsland(
// If you need the best realistic behavior, we recommend the use of the exact solver and exact friction model which are the defaults.
//
// See also: NewtonSetFrictionModel, NewtonGetThreadNumber
-void NewtonSetSolverModel(const NewtonWorld *const newtonWorld, int model) {
+void NewtonSetSolverModel(NewtonWorld *const newtonWorld, int model) {
Newton *world;
world = (Newton *)newtonWorld;
@@ -535,7 +535,7 @@ void NewtonSetSolverModel(const NewtonWorld *const newtonWorld, int model) {
// If you need the best realistic behavior, we recommend the use of the exact solver and exact friction model which are the defaults.
//
// See also: NewtonSetSolverModel
-void NewtonSetFrictionModel(const NewtonWorld *const newtonWorld, int model) {
+void NewtonSetFrictionModel(NewtonWorld *const newtonWorld, int model) {
Newton *world;
world = (Newton *)newtonWorld;
@@ -556,7 +556,7 @@ void NewtonSetFrictionModel(const NewtonWorld *const newtonWorld, int model) {
// Return: Nothing.
//
// See also: NewtonReadPerformanceTicks
-void NewtonSetPerformanceClock(const NewtonWorld *const newtonWorld,
+void NewtonSetPerformanceClock(NewtonWorld *const newtonWorld,
NewtonGetTicksCountCallback callback) {
Newton *world;
world = (Newton *)newtonWorld;
@@ -591,8 +591,8 @@ void NewtonSetPerformanceClock(const NewtonWorld *const newtonWorld,
// See also: NewtonReadPerformanceTicks, NewtonUpdate
unsigned NewtonReadPerformanceTicks(const NewtonWorld *const newtonWorld,
unsigned performanceEntry) {
- Newton *world;
- world = (Newton *)newtonWorld;
+ const Newton *world;
+ world = (const Newton *)newtonWorld;
TRACE_FUNTION(__FUNCTION__);
return world->GetPerfomanceTicks(performanceEntry);
@@ -600,7 +600,7 @@ unsigned NewtonReadPerformanceTicks(const NewtonWorld *const newtonWorld,
unsigned NewtonReadThreadPerformanceTicks(const NewtonWorld *newtonWorld,
unsigned threadIndex) {
- Newton *const world = (Newton *)newtonWorld;
+ const Newton *const world = (const Newton *)newtonWorld;
TRACE_FUNTION(__FUNCTION__);
return world->GetThreadPerfomanceTicks(threadIndex);
@@ -634,7 +634,7 @@ dgInt32 ExecptionHandler(void *exceptPtr) {
// Return: This function call NewtonCollisionUpdate at the lower level to get the colliding contacts.
//
// See also: NewtonInvalidateCache, NewtonCollisionUpdate
-void NewtonUpdate(const NewtonWorld *const newtonWorld, dFloat timestep) {
+void NewtonUpdate(NewtonWorld *const newtonWorld, dFloat timestep) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
@@ -675,7 +675,7 @@ void NewtonUpdate(const NewtonWorld *const newtonWorld, dFloat timestep) {
// Return: when calling this function the application do not need to call NetwonUpdate
//
// See also: NewtonUpdate, NewtonInvalidateCache
-void NewtonCollisionUpdate(const NewtonWorld *const newtonWorld) {
+void NewtonCollisionUpdate(NewtonWorld *const newtonWorld) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
@@ -701,7 +701,7 @@ void NewtonCollisionUpdate(const NewtonWorld *const newtonWorld) {
//
// Remarks: the default minimum frame rate of the simulation is 60 frame per second. When the simulation falls below the specified minimum frame, Newton will
// perform sub steps in order to meet the desired minimum FPS.
-void NewtonSetMinimumFrameRate(const NewtonWorld *const newtonWorld,
+void NewtonSetMinimumFrameRate(NewtonWorld *const newtonWorld,
dFloat frameRate) {
Newton *world;
@@ -745,7 +745,7 @@ void NewtonSetMinimumFrameRate(const NewtonWorld *const newtonWorld,
// Use this function for when you want to clear the world but preserve all the group IDs and material pairs.
//
// See also: NewtonMaterialDestroyAllGroupID
-void NewtonDestroyAllBodies(const NewtonWorld *const newtonWorld) {
+void NewtonDestroyAllBodies(NewtonWorld *const newtonWorld) {
dFloat p0[4];
dFloat p1[4];
Newton *world;
@@ -780,7 +780,7 @@ void NewtonDestroyAllBodies(const NewtonWorld *const newtonWorld) {
// at creation time and after a call to the function _NewtonRemoveAllBodies_
//
// See also: NewtonSetBodyLeaveWorldEvent
-void NewtonSetWorldSize(const NewtonWorld *const newtonWorld,
+void NewtonSetWorldSize(NewtonWorld *const newtonWorld,
const dFloat *const minPtr, const dFloat *const maxPtr) {
TRACE_FUNTION(__FUNCTION__);
Newton *const world = (Newton *)newtonWorld;
@@ -808,7 +808,7 @@ void NewtonSetWorldSize(const NewtonWorld *const newtonWorld,
// Remarks: The application should not modify the position, velocity, or it create or destroy any body or joint during this function call. Doing so will result in unpredictable malfunctions.
//
// See also: NewtonIslandGetBody
-void NewtonSetIslandUpdateEvent(const NewtonWorld *const newtonWorld,
+void NewtonSetIslandUpdateEvent(NewtonWorld *const newtonWorld,
NewtonIslandUpdate islandUpdate) {
Newton *world;
@@ -825,7 +825,7 @@ void NewtonSetIslandUpdateEvent(const NewtonWorld *const newtonWorld,
// *NewtonIslandUpdate* slandUpdate - application defined callback
//
// Return: Nothing.
-void NewtonSetCollisionDestructor(const NewtonWorld *const newtonWorld,
+void NewtonSetCollisionDestructor(NewtonWorld *const newtonWorld,
NewtonCollisionDestructor callback) {
Newton *world;
@@ -844,7 +844,7 @@ void NewtonSetCollisionDestructor(const NewtonWorld *const newtonWorld,
// Remarks: Only convex Hull shapes can have max brak force parameter.
//
// Return: Nothing.
-void NewtonSetDestroyBodyByExeciveForce(const NewtonWorld *const newtonWorld,
+void NewtonSetDestroyBodyByExeciveForce(NewtonWorld *const newtonWorld,
NewtonDestroyBodyByExeciveForce callback) {
Newton *world;
@@ -870,7 +870,7 @@ void NewtonSetDestroyBodyByExeciveForce(const NewtonWorld *const newtonWorld,
// The only options available to the application are: do nothing or destroy the object.
//
// See also: NewtonSetWorldSize, NewtonBodyGetFirstJoint, NewtonBodyGetNextJoint
-void NewtonSetBodyLeaveWorldEvent(const NewtonWorld *const newtonWorld,
+void NewtonSetBodyLeaveWorldEvent(NewtonWorld *const newtonWorld,
NewtonBodyLeaveWorld callback) {
Newton *world;
world = (Newton *)newtonWorld;
@@ -892,11 +892,11 @@ void NewtonSetBodyLeaveWorldEvent(const NewtonWorld *const newtonWorld,
// Remarks: The application call this function for debugging purpose
// See also: NewtonWorldGetNextBody, NewtonBodyForEachPolygonDo, NewtonWorldForEachBodyInAABBDo, NewtonWorldForEachJointDo
NewtonBody *NewtonWorldGetFirstBody(const NewtonWorld *const newtonWorld) {
- Newton *world;
+ const Newton *world;
dgBodyMasterList::dgListNode *node;
- world = (Newton *)newtonWorld;
- dgBodyMasterList &masterList = *world;
+ world = (const Newton *)newtonWorld;
+ const dgBodyMasterList &masterList = *world;
TRACE_FUNTION(__FUNCTION__);
_ASSERTE(
@@ -927,7 +927,7 @@ NewtonBody *NewtonWorldGetFirstBody(const NewtonWorld *const newtonWorld) {
// See also: NewtonWorldGetFirstBody, NewtonBodyForEachPolygonDo, NewtonWorldForEachBodyInAABBDo, NewtonWorldForEachJointDo
NewtonBody *NewtonWorldGetNextBody(const NewtonWorld *const newtonWorld,
const NewtonBody *const curBody) {
- dgBody *const body = (dgBody *)curBody;
+ const dgBody *const body = (const dgBody *)curBody;
TRACE_FUNTION(__FUNCTION__);
@@ -958,12 +958,12 @@ NewtonBody *NewtonWorldGetNextBody(const NewtonWorld *const newtonWorld,
// See also: NewtonBodyForEachPolygonDo, NewtonWorldForEachBodyInAABBDo, NewtonWorldGetFirstBody
void NewtonWorldForEachJointDo(const NewtonWorld *const newtonWorld,
NewtonJointIterator callback, void *const userData) {
- Newton *world;
+ const Newton *world;
dgBodyMasterList::dgListNode *node;
dgBodyMasterListRow::dgListNode *jointNode;
- world = (Newton *)newtonWorld;
- dgBodyMasterList &masterList = *world;
+ world = (const Newton *)newtonWorld;
+ const dgBodyMasterList &masterList = *world;
TRACE_FUNTION(__FUNCTION__);
dgTree<dgConstraint *, dgConstraint *> jointMap(world->dgWorld::GetAllocator());
@@ -1005,9 +1005,9 @@ void NewtonWorldForEachJointDo(const NewtonWorld *const newtonWorld,
void NewtonWorldForEachBodyInAABBDo(const NewtonWorld *const newtonWorld,
const dFloat *const p0, const dFloat *const p1, NewtonBodyIterator callback,
void *const userData) {
- Newton *world;
+ const Newton *world;
- world = (Newton *)newtonWorld;
+ world = (const Newton *)newtonWorld;
dgVector q0(p0[0], p0[1], p0[2], dgFloat32(0.0f));
dgVector q1(p1[0], p1[1], p1[2], dgFloat32(0.0f));
@@ -1053,7 +1053,7 @@ int NewtonWorldFloatSize() {
// object oriented classes based on the Newton API.
//
// See also: NewtonWorldGetUserData
-void NewtonWorldSetUserData(const NewtonWorld *const newtonWorld,
+void NewtonWorldSetUserData(NewtonWorld *const newtonWorld,
void *const userData) {
Newton *world;
world = (Newton *)newtonWorld;
@@ -1074,8 +1074,8 @@ void NewtonWorldSetUserData(const NewtonWorld *const newtonWorld,
//
// See also: NewtonWorldSetDestructorCallBack, NewtonWorldGetUserData
void *NewtonWorldGetUserData(const NewtonWorld *const newtonWorld) {
- Newton *world;
- world = (Newton *)newtonWorld;
+ const Newton *world;
+ world = (const Newton *)newtonWorld;
TRACE_FUNTION(__FUNCTION__);
return world->GetUserData();
@@ -1091,7 +1091,7 @@ void *NewtonWorldGetUserData(const NewtonWorld *const newtonWorld) {
// Remarks: The application can store a user defined destrutor call back function to be called at the time the world is to be destruyed
//
// See also: NewtonWorldGetUserData
-void NewtonWorldSetDestructorCallBack(const NewtonWorld *const newtonWorld,
+void NewtonWorldSetDestructorCallBack(NewtonWorld *const newtonWorld,
NewtonDestroyWorld destructor) {
Newton *world;
world = (Newton *)newtonWorld;
@@ -1112,8 +1112,8 @@ void NewtonWorldSetDestructorCallBack(const NewtonWorld *const newtonWorld,
// See also: NewtonWorldGetUserData, NewtonWorldSetDestructorCallBack
NewtonDestroyWorld NewtonWorldGetDestructorCallBack(
const NewtonWorld *const newtonWorld) {
- Newton *world;
- world = (Newton *)newtonWorld;
+ const Newton *world;
+ world = (const Newton *)newtonWorld;
TRACE_FUNTION(__FUNCTION__);
@@ -1129,10 +1129,10 @@ NewtonDestroyWorld NewtonWorldGetDestructorCallBack(
// Return: number of rigid bodies in this world.
//
int NewtonWorldGetBodyCount(const NewtonWorld *const newtonWorld) {
- Newton *world;
+ const Newton *world;
TRACE_FUNTION(__FUNCTION__);
- world = (Newton *)newtonWorld;
+ world = (const Newton *)newtonWorld;
// dgBodyMasterList &masterList = *world;
// _ASSERTE (masterList.GetFirst()->GetInfo().GetBody() == world->GetSentinelBody());
@@ -1203,7 +1203,7 @@ void NewtonWorldRayCast(const NewtonWorld *const newtonWorld,
if (filter) {
dgVector pp0(p0[0], p0[1], p0[2], dgFloat32(0.0f));
dgVector pp1(p1[0], p1[1], p1[2], dgFloat32(0.0f));
- Newton *const world = (Newton *)newtonWorld;
+ const Newton *const world = (const Newton *)newtonWorld;
world->RayCast(pp0, pp1, (OnRayCastAction)filter,
(OnRayPrecastAction)prefilter, userData);
}
@@ -1247,16 +1247,16 @@ void NewtonWorldRayCast(const NewtonWorld *const newtonWorld,
// this parameter could be NULL.
//
// See also: NewtonWorldRayCast
-int NewtonWorldConvexCast(const NewtonWorld *const newtonWorld,
+int NewtonWorldConvexCast(NewtonWorld *const newtonWorld,
const dFloat *const matrix, const dFloat *const target,
- const NewtonCollision *const shape, dFloat *const hitParam,
+ NewtonCollision *const shape, dFloat *const hitParam,
void *const userData, NewtonWorldRayPrefilterCallback prefilter,
NewtonWorldConvexCastReturnInfo *const info, int maxContactsCount,
int threadIndex) {
TRACE_FUNTION(__FUNCTION__);
dgVector destination(target[0], target[1], target[2], dgFloat32(0.0f));
Newton *const world = (Newton *)newtonWorld;
- return world->ConvexCast((dgCollision *)shape, *((dgMatrix *)matrix),
+ return world->ConvexCast((dgCollision *)shape, *((const dgMatrix *)matrix),
destination, *(dgFloat32 *)hitParam, (OnRayPrecastAction)prefilter,
userData, (dgConvexCastReturnInfo *)info, maxContactsCount, threadIndex);
}
@@ -1357,7 +1357,7 @@ int NewtonMaterialGetDefaultGroupID(const NewtonWorld *const newtonWorld) {
// Note: The only way to destroy a Group ID after its creation is by destroying all the bodies and calling the function *NewtonMaterialDestroyAllGroupID*.
//
// See also: NewtonMaterialDestroyAllGroupID
-int NewtonMaterialCreateGroupID(const NewtonWorld *const newtonWorld) {
+int NewtonMaterialCreateGroupID(NewtonWorld *const newtonWorld) {
Newton *const world = (Newton *)newtonWorld;
TRACE_FUNTION(__FUNCTION__);
@@ -1376,7 +1376,7 @@ int NewtonMaterialCreateGroupID(const NewtonWorld *const newtonWorld) {
// This function must be called after there are no more rigid bodies in the word.
//
// See also: NewtonDestroyAllBodies
-void NewtonMaterialDestroyAllGroupID(const NewtonWorld *const newtonWorld) {
+void NewtonMaterialDestroyAllGroupID(NewtonWorld *const newtonWorld) {
Newton *world;
// _ASSERTE (0);
@@ -1416,7 +1416,7 @@ void NewtonMaterialDestroyAllGroupID(const NewtonWorld *const newtonWorld) {
// Return: Nothing.
void NewtonMaterialSetDefaultCollidable(const NewtonWorld *const newtonWorld,
int id0, int id1, int state) {
- Newton *const world = (Newton *)newtonWorld;
+ const Newton *const world = (const Newton *)newtonWorld;
dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
dgUnsigned32(id1));
@@ -1463,7 +1463,7 @@ void NewtonMaterialSetDefaultCollidable(const NewtonWorld *const newtonWorld,
// See also: NewtonBodySetContinuousCollisionMode
void NewtonMaterialSetContinuousCollisionMode(
const NewtonWorld *const newtonWorld, int id0, int id1, int state) {
- Newton *const world = (Newton *)newtonWorld;
+ const Newton *const world = (const Newton *)newtonWorld;
dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
dgUnsigned32(id1));
@@ -1530,10 +1530,10 @@ void NewtonMaterialSetDefaultFriction(const NewtonWorld *const newtonWorld,
int id0, int id1, dFloat staticFriction, dFloat kineticFriction) {
dFloat stat;
dFloat kine;
- Newton *world;
+ const Newton *world;
TRACE_FUNTION(__FUNCTION__);
- world = (Newton *)newtonWorld;
+ world = (const Newton *)newtonWorld;
dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
dgUnsigned32(id1));
@@ -1572,10 +1572,10 @@ void NewtonMaterialSetDefaultFriction(const NewtonWorld *const newtonWorld,
// It is recommended that *elasticCoef* be set to a value lower or equal to 1.0
void NewtonMaterialSetDefaultElasticity(const NewtonWorld *const newtonWorld,
int id0, int id1, dFloat elasticCoef) {
- Newton *world;
+ const Newton *world;
TRACE_FUNTION(__FUNCTION__);
- world = (Newton *)newtonWorld;
+ world = (const Newton *)newtonWorld;
dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
dgUnsigned32(id1));
@@ -1599,10 +1599,10 @@ void NewtonMaterialSetDefaultElasticity(const NewtonWorld *const newtonWorld,
// A low value for *softnessCoef* will make the material soft. A typical value for *softnessCoef* is 0.15
void NewtonMaterialSetDefaultSoftness(const NewtonWorld *const newtonWorld,
int id0, int id1, dFloat softnessCoef) {
- Newton *world;
+ const Newton *world;
TRACE_FUNTION(__FUNCTION__);
- world = (Newton *)newtonWorld;
+ world = (const Newton *)newtonWorld;
dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
dgUnsigned32(id1));
@@ -1645,9 +1645,9 @@ void NewtonMaterialSetDefaultSoftness(const NewtonWorld *const newtonWorld,
void NewtonMaterialSetCollisionCallback(const NewtonWorld *const newtonWorld,
int id0, int id1, void *userData, NewtonOnAABBOverlap aabbOverlap,
NewtonContactsProcess processCallback) {
- Newton *world;
+ const Newton *world;
- world = (Newton *)newtonWorld;
+ world = (const Newton *)newtonWorld;
TRACE_FUNTION(__FUNCTION__);
dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
@@ -1692,10 +1692,10 @@ void NewtonMaterialSetCollisionCallback(const NewtonWorld *const newtonWorld,
void NewtonMaterialSetCompondCollisionCallback(
const NewtonWorld *const newtonWorld, int id0, int id1,
NewtonOnAABBOverlap aabbOverlap) {
- Newton *world;
+ const Newton *world;
TRACE_FUNTION(__FUNCTION__);
- world = (Newton *)newtonWorld;
+ world = (const Newton *)newtonWorld;
dgContactMaterial *const material = world->GetMaterial(dgUnsigned32(id0),
dgUnsigned32(id1));
@@ -1752,11 +1752,11 @@ NewtonMaterial *NewtonWorldGetFirstMaterial(
//
// See also: NewtonWorldGetFirstMaterial
NewtonMaterial *NewtonWorldGetNextMaterial(const NewtonWorld *const newtonWorld,
- const NewtonMaterial *const material) {
- Newton *world;
+ NewtonMaterial *const material) {
+ const Newton *world;
TRACE_FUNTION(__FUNCTION__);
- world = (Newton *)newtonWorld;
+ world = (const Newton *)newtonWorld;
return (NewtonMaterial *)world->GetNextMaterial((dgContactMaterial *)material);
}
@@ -1819,7 +1819,7 @@ void *NewtonMaterialGetMaterialPairUserData(
unsigned NewtonMaterialGetContactFaceAttribute(
const NewtonMaterial *const materialHandle) {
TRACE_FUNTION(__FUNCTION__);
- dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ const dgContactMaterial *const material = (const dgContactMaterial *)materialHandle;
return (unsigned)material->m_userId;
}
@@ -1861,7 +1861,7 @@ dFloat NewtonMaterialGetContactNormalSpeed(
// _ASSERTE (0);
TRACE_FUNTION(__FUNCTION__);
- dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ const dgContactMaterial *const material = (const dgContactMaterial *)materialHandle;
// contact = (dgContact*) contactlHandle;
dgBody *const body0 = material->m_body0;
@@ -1896,7 +1896,7 @@ dFloat NewtonMaterialGetContactTangentSpeed(
// _ASSERTE (0);
TRACE_FUNTION(__FUNCTION__);
- dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ const dgContactMaterial *const material = (const dgContactMaterial *)materialHandle;
// contact = (dgContact*) contactlHandle;
dgBody *const body0 = material->m_body0;
@@ -1937,7 +1937,7 @@ void NewtonMaterialGetContactPositionAndNormal(
const NewtonMaterial *const materialHandle, NewtonBody *const body,
dFloat *const positPtr, dFloat *const normalPtr) {
TRACE_FUNTION(__FUNCTION__);
- dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ const dgContactMaterial *const material = (const dgContactMaterial *)materialHandle;
positPtr[0] = material->m_point.m_x;
positPtr[1] = material->m_point.m_y;
@@ -1974,7 +1974,7 @@ void NewtonMaterialGetContactForce(const NewtonMaterial *const materialHandle,
NewtonBody *const body, dFloat *const forcePtr) {
TRACE_FUNTION(__FUNCTION__);
- dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ const dgContactMaterial *const material = (const dgContactMaterial *)materialHandle;
dgVector force(
material->m_normal.Scale(material->m_normal_Force) + material->m_dir0.Scale(material->m_dir0_Force) + material->m_dir1.Scale(material->m_dir1_Force));
@@ -2007,7 +2007,7 @@ void NewtonMaterialGetContactTangentDirections(
const NewtonMaterial *const materialHandle, NewtonBody *const body,
dFloat *const dir0, dFloat *const dir1) {
TRACE_FUNTION(__FUNCTION__);
- dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
+ const dgContactMaterial *const material = (const dgContactMaterial *)materialHandle;
dir0[0] = material->m_dir0.m_x;
dir0[1] = material->m_dir0.m_y;
@@ -2061,8 +2061,8 @@ unsigned NewtonMaterialGetBodyCollisionID(const NewtonMaterial* const material,
NewtonCollision *NewtonMaterialGetBodyCollidingShape(const NewtonMaterial *const material, const NewtonBody *const body) {
TRACE_FUNTION(__FUNCTION__);
- dgBody *const bodyPtr = (dgBody *)body;
- dgContactMaterial *const materialPtr = (dgContactMaterial *)material;
+ const dgBody *const bodyPtr = (const dgBody *)body;
+ const dgContactMaterial *const materialPtr = (const dgContactMaterial *)material;
dgCollision *collision = materialPtr->m_collision0;
if (bodyPtr == materialPtr->m_body1) {
@@ -2084,7 +2084,7 @@ NewtonCollision *NewtonMaterialGetBodyCollidingShape(const NewtonMaterial *const
//
// See also: NewtonMaterialSetCollisionCallback, NewtonMaterialSetDefaultSoftness
void NewtonMaterialSetContactSoftness(
- const NewtonMaterial *const materialHandle, dFloat softness) {
+ NewtonMaterial *const materialHandle, dFloat softness) {
TRACE_FUNTION(__FUNCTION__);
dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
material->m_softness = ClampValue(softness, dFloat(0.01f), dFloat(0.7f));
@@ -2103,7 +2103,7 @@ void NewtonMaterialSetContactSoftness(
//
// See also: NewtonMaterialSetCollisionCallback, NewtonMaterialSetDefaultElasticity
void NewtonMaterialSetContactElasticity(
- const NewtonMaterial *const materialHandle, dFloat restitution) {
+ NewtonMaterial *const materialHandle, dFloat restitution) {
TRACE_FUNTION(__FUNCTION__);
dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
@@ -2126,7 +2126,7 @@ void NewtonMaterialSetContactElasticity(
//
// See also: NewtonMaterialSetCollisionCallback
void NewtonMaterialSetContactFrictionState(
- const NewtonMaterial *const materialHandle, int state, int index) {
+ NewtonMaterial *const materialHandle, int state, int index) {
TRACE_FUNTION(__FUNCTION__);
dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
@@ -2169,7 +2169,7 @@ void NewtonMaterialSetContactFrictionState(
//
// See also: NewtonMaterialSetCollisionCallback, NewtonMaterialSetDefaultFriction, NewtonMaterialSetContactStaticFrictionCoef
void NewtonMaterialSetContactFrictionCoef(
- const NewtonMaterial *const materialHandle, dFloat staticFrictionCoef,
+ NewtonMaterial *const materialHandle, dFloat staticFrictionCoef,
dFloat kineticFrictionCoef, int index) {
TRACE_FUNTION(__FUNCTION__);
@@ -2207,7 +2207,7 @@ void NewtonMaterialSetContactFrictionCoef(
//
// See also: NewtonMaterialSetCollisionCallback
void NewtonMaterialSetContactNormalAcceleration(
- const NewtonMaterial *const materialHandle, dFloat accel) {
+ NewtonMaterial *const materialHandle, dFloat accel) {
TRACE_FUNTION(__FUNCTION__);
dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
@@ -2233,7 +2233,7 @@ void NewtonMaterialSetContactNormalAcceleration(
//
// See also: NewtonMaterialSetCollisionCallback, NewtonMaterialContactRotateTangentDirections
void NewtonMaterialSetContactTangentAcceleration(
- const NewtonMaterial *const materialHandle, dFloat accel, int index) {
+ NewtonMaterial *const materialHandle, dFloat accel, int index) {
TRACE_FUNTION(__FUNCTION__);
dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
@@ -2273,7 +2273,7 @@ void NewtonMaterialSetContactTangentAcceleration(
//
// See also: NewtonMaterialSetCollisionCallback, NewtonMaterialContactRotateTangentDirections
void NewtonMaterialSetContactNormalDirection(
- const NewtonMaterial *const materialHandle, const dFloat *const direction) {
+ NewtonMaterial *const materialHandle, const dFloat *const direction) {
TRACE_FUNTION(__FUNCTION__);
dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
dgVector normal(direction[0], direction[1], direction[2], dgFloat32(0.0f));
@@ -2308,7 +2308,7 @@ void NewtonMaterialSetContactNormalDirection(
//
// See also: NewtonMaterialSetCollisionCallback, NewtonMaterialSetContactNormalDirection
void NewtonMaterialContactRotateTangentDirections(
- const NewtonMaterial *const materialHandle, const dFloat *const alignVector) {
+ NewtonMaterial *const materialHandle, const dFloat *const alignVector) {
TRACE_FUNTION(__FUNCTION__);
dgContactMaterial *const material = (dgContactMaterial *)materialHandle;
@@ -2348,7 +2348,7 @@ void NewtonMaterialContactRotateTangentDirections(
// as speed up some calculations.
//
// See also: NewtonReleaseCollision
-NewtonCollision *NewtonCreateNull(const NewtonWorld *const newtonWorld) {
+NewtonCollision *NewtonCreateNull(NewtonWorld *const newtonWorld) {
Newton *world;
TRACE_FUNTION(__FUNCTION__);
@@ -2374,7 +2374,7 @@ NewtonCollision *NewtonCreateNull(const NewtonWorld *const newtonWorld) {
// as speed up some calculations.
//
// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
-NewtonCollision *NewtonCreateBox(const NewtonWorld *const newtonWorld,
+NewtonCollision *NewtonCreateBox(NewtonWorld *const newtonWorld,
dFloat dx, dFloat dy, dFloat dz, int shapeID,
const dFloat *const offsetMatrix) {
Newton *world;
@@ -2383,7 +2383,7 @@ NewtonCollision *NewtonCreateBox(const NewtonWorld *const newtonWorld,
world = (Newton *)newtonWorld;
dgMatrix matrix(dgGetIdentityMatrix());
if (offsetMatrix) {
- matrix = *((dgMatrix *)offsetMatrix);
+ matrix = *((const dgMatrix *)offsetMatrix);
}
return (NewtonCollision *)world->CreateBox(dx, dy, dz, shapeID, matrix);
}
@@ -2411,7 +2411,7 @@ NewtonCollision *NewtonCreateBox(const NewtonWorld *const newtonWorld,
// as speed up some calculations.
//
// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
-NewtonCollision *NewtonCreateSphere(const NewtonWorld *const newtonWorld,
+NewtonCollision *NewtonCreateSphere(NewtonWorld *const newtonWorld,
dFloat radiusX, dFloat radiusY, dFloat radiusZ, int shapeID,
const dFloat *const offsetMatrix) {
Newton *world;
@@ -2420,7 +2420,7 @@ NewtonCollision *NewtonCreateSphere(const NewtonWorld *const newtonWorld,
world = (Newton *)newtonWorld;
dgMatrix matrix(dgGetIdentityMatrix());
if (offsetMatrix) {
- matrix = *((dgMatrix *)offsetMatrix);
+ matrix = *((const dgMatrix *)offsetMatrix);
}
radiusX = dgAbsf(radiusX);
@@ -2452,7 +2452,7 @@ NewtonCollision *NewtonCreateSphere(const NewtonWorld *const newtonWorld,
// as speed up some calculations.
//
// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
-NewtonCollision *NewtonCreateCone(const NewtonWorld *const newtonWorld,
+NewtonCollision *NewtonCreateCone(NewtonWorld *const newtonWorld,
dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix) {
Newton *world;
@@ -2460,7 +2460,7 @@ NewtonCollision *NewtonCreateCone(const NewtonWorld *const newtonWorld,
world = (Newton *)newtonWorld;
dgMatrix matrix(dgGetIdentityMatrix());
if (offsetMatrix) {
- matrix = *((dgMatrix *)offsetMatrix);
+ matrix = *((const dgMatrix *)offsetMatrix);
}
return (NewtonCollision *)world->CreateCone(radius, height, shapeID, matrix);
}
@@ -2484,7 +2484,7 @@ NewtonCollision *NewtonCreateCone(const NewtonWorld *const newtonWorld,
// as speed up some calculations.
//
// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
-NewtonCollision *NewtonCreateCapsule(const NewtonWorld *const newtonWorld,
+NewtonCollision *NewtonCreateCapsule(NewtonWorld *const newtonWorld,
dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix) {
Newton *world;
@@ -2492,7 +2492,7 @@ NewtonCollision *NewtonCreateCapsule(const NewtonWorld *const newtonWorld,
world = (Newton *)newtonWorld;
dgMatrix matrix(dgGetIdentityMatrix());
if (offsetMatrix) {
- matrix = *((dgMatrix *)offsetMatrix);
+ matrix = *((const dgMatrix *)offsetMatrix);
}
return (NewtonCollision *)world->CreateCapsule(radius, height, shapeID,
matrix);
@@ -2515,7 +2515,7 @@ NewtonCollision *NewtonCreateCapsule(const NewtonWorld *const newtonWorld,
// as speed up some calculations.
//
// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
-NewtonCollision *NewtonCreateCylinder(const NewtonWorld *const newtonWorld,
+NewtonCollision *NewtonCreateCylinder(NewtonWorld *const newtonWorld,
dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix) {
Newton *world;
@@ -2523,7 +2523,7 @@ NewtonCollision *NewtonCreateCylinder(const NewtonWorld *const newtonWorld,
world = (Newton *)newtonWorld;
dgMatrix matrix(dgGetIdentityMatrix());
if (offsetMatrix) {
- matrix = *((dgMatrix *)offsetMatrix);
+ matrix = *((const dgMatrix *)offsetMatrix);
}
return (NewtonCollision *)world->CreateCylinder(radius, height, shapeID,
matrix);
@@ -2551,7 +2551,7 @@ NewtonCollision *NewtonCreateChamferCylinder(
//
// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
NewtonCollision *NewtonCreateChamferCylinder(
- const NewtonWorld *const newtonWorld, dFloat radius, dFloat height,
+ NewtonWorld *const newtonWorld, dFloat radius, dFloat height,
int shapeID, const dFloat *const offsetMatrix) {
Newton *world;
@@ -2559,7 +2559,7 @@ NewtonCollision *NewtonCreateChamferCylinder(
world = (Newton *)newtonWorld;
dgMatrix matrix(dgGetIdentityMatrix());
if (offsetMatrix) {
- matrix = *((dgMatrix *)offsetMatrix);
+ matrix = *((const dgMatrix *)offsetMatrix);
}
return (NewtonCollision *)world->CreateChamferCylinder(radius, height,
shapeID, matrix);
@@ -2607,7 +2607,7 @@ NewtonCollision *NewtonCreateChamferCylinder(
// as speed up some calculations.
//
// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonCreateConvexHullModifier
-NewtonCollision *NewtonCreateConvexHull(const NewtonWorld *const newtonWorld,
+NewtonCollision *NewtonCreateConvexHull(NewtonWorld *const newtonWorld,
int count, const dFloat *const vertexCloud, int strideInBytes,
dgFloat32 tolerance, int shapeID, const dFloat *const offsetMatrix) {
Newton *world;
@@ -2616,7 +2616,7 @@ NewtonCollision *NewtonCreateConvexHull(const NewtonWorld *const newtonWorld,
world = (Newton *)newtonWorld;
dgMatrix matrix(dgGetIdentityMatrix());
if (offsetMatrix) {
- matrix = *((dgMatrix *)offsetMatrix);
+ matrix = *((const dgMatrix *)offsetMatrix);
}
tolerance = ClampValue(tolerance, dgFloat32(0.0f), dgFloat32(0.125f));
return (NewtonCollision *)world->CreateConvexHull(count, vertexCloud,
@@ -2664,8 +2664,8 @@ NewtonCollision *NewtonCreateConvexHullFromMesh(
//
// See also: NewtonAddCollisionReference, NewtonReleaseCollision, NewtonConvexHullModifierSetMatrix, NewtonConvexHullModifierGetMatrix
NewtonCollision *NewtonCreateConvexHullModifier(
- const NewtonWorld *const newtonWorld,
- const NewtonCollision *const convexHullCollision, int shapeID) {
+ NewtonWorld *const newtonWorld,
+ NewtonCollision *const convexHullCollision, int shapeID) {
Newton *world;
dgCollision *collision;
@@ -2724,12 +2724,12 @@ void NewtonConvexHullModifierGetMatrix(
//
// See also: NewtonCreateConvexHullModifier, NewtonConvexHullModifierGetMatrix
void NewtonConvexHullModifierSetMatrix(
- const NewtonCollision *convexHullModifier, const dFloat *const matrixPtr) {
+ NewtonCollision *convexHullModifier, const dFloat *const matrixPtr) {
dgCollision *collision;
collision = (dgCollision *)convexHullModifier;
TRACE_FUNTION(__FUNCTION__);
- const dgMatrix &matrix = (*((dgMatrix *)matrixPtr));
+ const dgMatrix &matrix = (*((const dgMatrix *)matrixPtr));
collision->ModifierSetMatrix(matrix);
}
@@ -2753,12 +2753,12 @@ void NewtonConvexHullModifierSetMatrix(
//
// See also: NewtonReleaseCollision
NewtonCollision *NewtonCreateCompoundCollision(
- const NewtonWorld *const newtonWorld, int count,
+ NewtonWorld *const newtonWorld, int count,
NewtonCollision *const collisionPrimitiveArray[], int shapeID) {
TRACE_FUNTION(__FUNCTION__);
Newton *world = (Newton *)newtonWorld;
dgCollision *collision = world->CreateCollisionCompound(count,
- (dgCollision **)collisionPrimitiveArray);
+ (dgCollision * const *)collisionPrimitiveArray);
collision->SetUserDataID(dgUnsigned32(shapeID));
return (NewtonCollision *)collision;
}
@@ -2822,7 +2822,7 @@ NEWTON_API NewtonCollision *NewtonCreateCompoundCollisionFromMesh(NewtonWorld *c
}
NEWTON_API NewtonCollision *NewtonCreateCompoundBreakable(
- const NewtonWorld *const newtonWorld, int meshCount,
+ NewtonWorld *const newtonWorld, int meshCount,
const NewtonMesh **const solids, const int *const shapeIDArray,
const dFloat *const densities, const int *const internalFaceMaterial,
int shapeID, int debriID, dFloat debriSeparationGap) {
@@ -2833,15 +2833,14 @@ NEWTON_API NewtonCollision *NewtonCreateCompoundBreakable(
TRACE_FUNTION(__FUNCTION__);
collision = world->CreateCollisionCompoundBreakable(meshCount,
- (dgMeshEffect **)solids, shapeIDArray, densities, internalFaceMaterial,
+ (const dgMeshEffect **)solids, shapeIDArray, densities, internalFaceMaterial,
debriID, debriSeparationGap);
collision->SetUserDataID(dgUnsigned32(shapeID));
return (NewtonCollision *)collision;
}
-void NewtonCompoundBreakableResetAnchoredPieces(
- const NewtonCollision *const compoundBreakable) {
+void NewtonCompoundBreakableResetAnchoredPieces(NewtonCollision *const compoundBreakable) {
dgCollision *collision;
TRACE_FUNTION(__FUNCTION__);
@@ -2855,7 +2854,7 @@ void NewtonCompoundBreakableResetAnchoredPieces(
}
void NewtonCompoundBreakableSetAnchoredPieces(
- const NewtonCollision *const compoundBreakable, int fixShapesCount,
+ NewtonCollision *const compoundBreakable, int fixShapesCount,
dFloat *const matrixPallete, NewtonCollision **const fixedShapesArray) {
dgCollision *collision;
@@ -2866,7 +2865,7 @@ void NewtonCompoundBreakableSetAnchoredPieces(
dgCollisionCompoundBreakable *compound;
compound = (dgCollisionCompoundBreakable *)collision;
compound->SetAnchoredParts(fixShapesCount, (dgMatrix *)matrixPallete,
- (const dgCollision **)fixedShapesArray);
+ (const dgCollision * const *)fixedShapesArray);
}
}
@@ -2880,14 +2879,14 @@ NewtonbreakableComponentMesh *NewtonBreakableGetMainMesh(
mesh = NULL;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
- dgCollisionCompoundBreakable *compound;
- compound = (dgCollisionCompoundBreakable *)collision;
+ const dgCollisionCompoundBreakable *compound;
+ compound = (const dgCollisionCompoundBreakable *)collision;
mesh = (NewtonbreakableComponentMesh *)compound->GetMainMesh();
}
return mesh;
}
-void NewtonBreakableBeginDelete(const NewtonCollision *const compoundBreakable) {
+void NewtonBreakableBeginDelete(NewtonCollision *const compoundBreakable) {
dgCollision *collision;
TRACE_FUNTION(__FUNCTION__);
@@ -2901,8 +2900,8 @@ void NewtonBreakableBeginDelete(const NewtonCollision *const compoundBreakable)
}
NewtonBody *NewtonBreakableCreateDebrieBody(
- const NewtonCollision *const compoundBreakable,
- const NewtonbreakableComponentMesh *const component) {
+ NewtonCollision *const compoundBreakable,
+ NewtonbreakableComponentMesh *const component) {
dgBody *body;
dgCollision *collision;
@@ -2921,8 +2920,8 @@ NewtonBody *NewtonBreakableCreateDebrieBody(
}
void NewtonBreakableDeleteComponent(
- const NewtonCollision *const compoundBreakable,
- const NewtonbreakableComponentMesh *const component) {
+ NewtonCollision *const compoundBreakable,
+ NewtonbreakableComponentMesh *const component) {
dgCollision *collision;
TRACE_FUNTION(__FUNCTION__);
@@ -2936,7 +2935,7 @@ void NewtonBreakableDeleteComponent(
}
}
-void NewtonBreakableEndDelete(const NewtonCollision *const compoundBreakable) {
+void NewtonBreakableEndDelete(NewtonCollision *const compoundBreakable) {
dgCollision *collision;
TRACE_FUNTION(__FUNCTION__);
@@ -2959,22 +2958,22 @@ NewtonbreakableComponentMesh *NewtonBreakableGetFirstComponent(
mesh = NULL;
if (collision->IsType(dgCollision::dgCollisionCompoundBreakable_RTTI)) {
- dgCollisionCompoundBreakable *compound;
- compound = (dgCollisionCompoundBreakable *)collision;
+ const dgCollisionCompoundBreakable *compound;
+ compound = (const dgCollisionCompoundBreakable *)collision;
mesh = (NewtonbreakableComponentMesh *)compound->GetFirstComponentMesh();
}
return mesh;
}
-NewtonbreakableComponentMesh *NewtonBreakableGetNextComponent(
+const NewtonbreakableComponentMesh *NewtonBreakableGetNextComponent(
const NewtonbreakableComponentMesh *const component) {
- dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *node;
+ const dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *node;
TRACE_FUNTION(__FUNCTION__);
- node = (dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)component;
+ node = (const dgCollisionCompoundBreakable::dgDebriGraph::dgListNode *)component;
node = node->GetNext();
- return node->GetNext() ? (NewtonbreakableComponentMesh *)node : NULL;
+ return node->GetNext() ? (const NewtonbreakableComponentMesh *)node : NULL;
}
int NewtonCompoundBreakableGetVertexCount(
diff --git a/engines/hpl1/engine/libraries/newton/Newton.h b/engines/hpl1/engine/libraries/newton/Newton.h
index d78e7acaf1e..68de4963ac7 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.h
+++ b/engines/hpl1/engine/libraries/newton/Newton.h
@@ -336,33 +336,33 @@ NEWTON_API NewtonWorld *NewtonCreate();
NEWTON_API void NewtonDestroy(const NewtonWorld *const newtonWorld);
NEWTON_API void NewtonDestroyAllBodies(const NewtonWorld *const newtonWorld);
-NEWTON_API void NewtonUpdate(const NewtonWorld *const newtonWorld, dFloat timestep);
-NEWTON_API void NewtonInvalidateCache(const NewtonWorld *const newtonWorld);
-NEWTON_API void NewtonCollisionUpdate(const NewtonWorld *const newtonWorld);
+NEWTON_API void NewtonUpdate(NewtonWorld *const newtonWorld, dFloat timestep);
+NEWTON_API void NewtonInvalidateCache(NewtonWorld *const newtonWorld);
+NEWTON_API void NewtonCollisionUpdate(NewtonWorld *const newtonWorld);
-NEWTON_API void NewtonSetSolverModel(const NewtonWorld *const newtonWorld, int model);
-NEWTON_API void NewtonSetPlatformArchitecture(const NewtonWorld *const newtonWorld, int mode);
+NEWTON_API void NewtonSetSolverModel(NewtonWorld *const newtonWorld, int model);
+NEWTON_API void NewtonSetPlatformArchitecture(NewtonWorld *const newtonWorld, int mode);
NEWTON_API int NewtonGetPlatformArchitecture(const NewtonWorld *const newtonWorld, char *description);
-NEWTON_API void NewtonSetMultiThreadSolverOnSingleIsland(const NewtonWorld *const newtonWorld, int mode);
+NEWTON_API void NewtonSetMultiThreadSolverOnSingleIsland(NewtonWorld *const newtonWorld, int mode);
NEWTON_API int NewtonGetMultiThreadSolverOnSingleIsland(const NewtonWorld *const newtonWorld);
-NEWTON_API void NewtonSetPerformanceClock(const NewtonWorld *const newtonWorld, NewtonGetTicksCountCallback callback);
+NEWTON_API void NewtonSetPerformanceClock(NewtonWorld *const newtonWorld, NewtonGetTicksCountCallback callback);
NEWTON_API unsigned NewtonReadPerformanceTicks(const NewtonWorld *const newtonWorld, unsigned performanceEntry);
NEWTON_API unsigned NewtonReadThreadPerformanceTicks(const NewtonWorld *newtonWorld, unsigned threadIndex);
-NEWTON_API void NewtonWorldCriticalSectionLock(const NewtonWorld *const newtonWorld);
-NEWTON_API void NewtonWorldCriticalSectionUnlock(const NewtonWorld *const newtonWorld);
-NEWTON_API void NewtonSetThreadsCount(const NewtonWorld *const newtonWorld, int threads);
+NEWTON_API void NewtonWorldCriticalSectionLock(NewtonWorld *const newtonWorld);
+NEWTON_API void NewtonWorldCriticalSectionUnlock(NewtonWorld *const newtonWorld);
+NEWTON_API void NewtonSetThreadsCount(NewtonWorld *const newtonWorld, int threads);
NEWTON_API int NewtonGetThreadsCount(const NewtonWorld *const newtonWorld);
NEWTON_API int NewtonGetMaxThreadsCount(const NewtonWorld *const newtonWorld);
-NEWTON_API void NewtonSetFrictionModel(const NewtonWorld *const newtonWorld, int model);
-NEWTON_API void NewtonSetMinimumFrameRate(const NewtonWorld *const newtonWorld, dFloat frameRate);
-NEWTON_API void NewtonSetBodyLeaveWorldEvent(const NewtonWorld *const newtonWorld, NewtonBodyLeaveWorld callback);
-NEWTON_API void NewtonSetWorldSize(const NewtonWorld *const newtonWorld, const dFloat *const minPoint, const dFloat *const maxPoint);
-NEWTON_API void NewtonSetIslandUpdateEvent(const NewtonWorld *const newtonWorld, NewtonIslandUpdate islandUpdate);
-NEWTON_API void NewtonSetCollisionDestructor(const NewtonWorld *const newtonWorld, NewtonCollisionDestructor callback);
-NEWTON_API void NewtonSetDestroyBodyByExeciveForce(const NewtonWorld *const newtonWorld, NewtonDestroyBodyByExeciveForce callback);
+NEWTON_API void NewtonSetFrictionModel(NewtonWorld *const newtonWorld, int model);
+NEWTON_API void NewtonSetMinimumFrameRate(NewtonWorld *const newtonWorld, dFloat frameRate);
+NEWTON_API void NewtonSetBodyLeaveWorldEvent(NewtonWorld *const newtonWorld, NewtonBodyLeaveWorld callback);
+NEWTON_API void NewtonSetWorldSize(NewtonWorld *const newtonWorld, const dFloat *const minPoint, const dFloat *const maxPoint);
+NEWTON_API void NewtonSetIslandUpdateEvent(NewtonWorld *const newtonWorld, NewtonIslandUpdate islandUpdate);
+NEWTON_API void NewtonSetCollisionDestructor(NewtonWorld *const newtonWorld, NewtonCollisionDestructor callback);
+NEWTON_API void NewtonSetDestroyBodyByExeciveForce(NewtonWorld *const newtonWorld, NewtonDestroyBodyByExeciveForce callback);
// NEWTON_API void NewtonWorldForEachBodyDo (const NewtonWorld* const newtonWorld, NewtonBodyIterator callback);
@@ -370,14 +370,14 @@ NEWTON_API void NewtonWorldForEachJointDo(const NewtonWorld *const newtonWorld,
NEWTON_API void NewtonWorldForEachBodyInAABBDo(const NewtonWorld *const newtonWorld, const dFloat *const p0, const dFloat *const p1, NewtonBodyIterator callback, void *const userData);
-NEWTON_API void NewtonWorldSetUserData(const NewtonWorld *const newtonWorld, void *const userData);
+NEWTON_API void NewtonWorldSetUserData(NewtonWorld *const newtonWorld, void *const userData);
NEWTON_API void *NewtonWorldGetUserData(const NewtonWorld *const newtonWorld);
-NEWTON_API void NewtonWorldSetDestructorCallBack(const NewtonWorld *const newtonWorld, NewtonDestroyWorld destructor);
+NEWTON_API void NewtonWorldSetDestructorCallBack(NewtonWorld *const newtonWorld, NewtonDestroyWorld destructor);
NEWTON_API NewtonDestroyWorld NewtonWorldGetDestructorCallBack(const NewtonWorld *const newtonWorld);
NEWTON_API void NewtonWorldRayCast(const NewtonWorld *const newtonWorld, const dFloat *const p0, const dFloat *const p1, NewtonWorldRayFilterCallback filter, void *const userData,
NewtonWorldRayPrefilterCallback prefilter);
-NEWTON_API int NewtonWorldConvexCast(const NewtonWorld *const newtonWorld, const dFloat *const matrix, const dFloat *const target, const NewtonCollision *shape, dFloat *const hitParam, void *const userData,
+NEWTON_API int NewtonWorldConvexCast(NewtonWorld *const newtonWorld, const dFloat *const matrix, const dFloat *const target, NewtonCollision *shape, dFloat *const hitParam, void *const userData,
NewtonWorldRayPrefilterCallback prefilter, NewtonWorldConvexCastReturnInfo *info, int maxContactsCount, int threadIndex);
@@ -404,9 +404,9 @@ NEWTON_API void NewtonIslandGetBodyAABB(const void *const island, int bodyIndex,
// Physics Material Section
//
// **********************************************************************************************
-NEWTON_API int NewtonMaterialCreateGroupID(const NewtonWorld *const newtonWorld);
+NEWTON_API int NewtonMaterialCreateGroupID(NewtonWorld *const newtonWorld);
NEWTON_API int NewtonMaterialGetDefaultGroupID(const NewtonWorld *const newtonWorld);
-NEWTON_API void NewtonMaterialDestroyAllGroupID(const NewtonWorld *const newtonWorld);
+NEWTON_API void NewtonMaterialDestroyAllGroupID(NewtonWorld *const newtonWorld);
// material definitions that can not be overwritten in function callback
NEWTON_API void *NewtonMaterialGetUserData(const NewtonWorld *const newtonWorld, int id0, int id1);
@@ -421,7 +421,7 @@ NEWTON_API void NewtonMaterialSetDefaultCollidable(const NewtonWorld *const newt
NEWTON_API void NewtonMaterialSetDefaultFriction(const NewtonWorld *const newtonWorld, int id0, int id1, dFloat staticFriction, dFloat kineticFriction);
NEWTON_API NewtonMaterial *NewtonWorldGetFirstMaterial(const NewtonWorld *const newtonWorld);
-NEWTON_API NewtonMaterial *NewtonWorldGetNextMaterial(const NewtonWorld *const newtonWorld, const NewtonMaterial *const material);
+NEWTON_API NewtonMaterial *NewtonWorldGetNextMaterial(const NewtonWorld *const newtonWorld, NewtonMaterial *const material);
NEWTON_API NewtonBody *NewtonWorldGetFirstBody(const NewtonWorld *const newtonWorld);
NEWTON_API NewtonBody *NewtonWorldGetNextBody(const NewtonWorld *const newtonWorld, const NewtonBody *const curBody);
@@ -442,16 +442,16 @@ NEWTON_API void NewtonMaterialGetContactPositionAndNormal(const NewtonMaterial *
NEWTON_API void NewtonMaterialGetContactTangentDirections(const NewtonMaterial *const material, NewtonBody *const body, dFloat *const dir0, dFloat *const dir1);
NEWTON_API dFloat NewtonMaterialGetContactTangentSpeed(const NewtonMaterial *const material, int index);
-NEWTON_API void NewtonMaterialSetContactSoftness(const NewtonMaterial *const material, dFloat softness);
-NEWTON_API void NewtonMaterialSetContactElasticity(const NewtonMaterial *const material, dFloat restitution);
-NEWTON_API void NewtonMaterialSetContactFrictionState(const NewtonMaterial *const material, int state, int index);
-NEWTON_API void NewtonMaterialSetContactFrictionCoef(const NewtonMaterial *const material, dFloat staticFrictionCoef, dFloat kineticFrictionCoef, int index);
+NEWTON_API void NewtonMaterialSetContactSoftness(NewtonMaterial *const material, dFloat softness);
+NEWTON_API void NewtonMaterialSetContactElasticity(NewtonMaterial *const material, dFloat restitution);
+NEWTON_API void NewtonMaterialSetContactFrictionState(NewtonMaterial *const material, int state, int index);
+NEWTON_API void NewtonMaterialSetContactFrictionCoef(NewtonMaterial *const material, dFloat staticFrictionCoef, dFloat kineticFrictionCoef, int index);
-NEWTON_API void NewtonMaterialSetContactNormalAcceleration(const NewtonMaterial *const material, dFloat accel);
-NEWTON_API void NewtonMaterialSetContactNormalDirection(const NewtonMaterial *const material, const dFloat *const directionVector);
+NEWTON_API void NewtonMaterialSetContactNormalAcceleration(NewtonMaterial *const material, dFloat accel);
+NEWTON_API void NewtonMaterialSetContactNormalDirection(NewtonMaterial *const material, const dFloat *const directionVector);
-NEWTON_API void NewtonMaterialSetContactTangentAcceleration(const NewtonMaterial *const material, dFloat accel, int index);
-NEWTON_API void NewtonMaterialContactRotateTangentDirections(const NewtonMaterial *const material, const dFloat *const directionVector);
+NEWTON_API void NewtonMaterialSetContactTangentAcceleration(NewtonMaterial *const material, dFloat accel, int index);
+NEWTON_API void NewtonMaterialContactRotateTangentDirections(NewtonMaterial *const material, const dFloat *const directionVector);
@@ -460,19 +460,19 @@ NEWTON_API void NewtonMaterialContactRotateTangentDirections(const NewtonMateria
// convex collision primitives creation functions
//
// **********************************************************************************************
-NEWTON_API NewtonCollision *NewtonCreateNull(const NewtonWorld *const newtonWorld);
-NEWTON_API NewtonCollision *NewtonCreateSphere(const NewtonWorld *const newtonWorld, dFloat radiusX, dFloat radiusY, dFloat radiusZ, int shapeID, const dFloat *const offsetMatrix);
-NEWTON_API NewtonCollision *NewtonCreateBox(const NewtonWorld *const newtonWorld, dFloat dx, dFloat dy, dFloat dz, int shapeID, const dFloat *const offsetMatrix);
-NEWTON_API NewtonCollision *NewtonCreateCone(const NewtonWorld *const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix);
-NEWTON_API NewtonCollision *NewtonCreateCapsule(const NewtonWorld *const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix);
-NEWTON_API NewtonCollision *NewtonCreateCylinder(const NewtonWorld *const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix);
-NEWTON_API NewtonCollision *NewtonCreateChamferCylinder(const NewtonWorld *const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix);
-NEWTON_API NewtonCollision *NewtonCreateConvexHull(const NewtonWorld *const newtonWorld, int count, const dFloat *const vertexCloud, int strideInBytes, dFloat tolerance, int shapeID, const dFloat *const offsetMatrix);
+NEWTON_API NewtonCollision *NewtonCreateNull(NewtonWorld *const newtonWorld);
+NEWTON_API NewtonCollision *NewtonCreateSphere(NewtonWorld *const newtonWorld, dFloat radiusX, dFloat radiusY, dFloat radiusZ, int shapeID, const dFloat *const offsetMatrix);
+NEWTON_API NewtonCollision *NewtonCreateBox(NewtonWorld *const newtonWorld, dFloat dx, dFloat dy, dFloat dz, int shapeID, const dFloat *const offsetMatrix);
+NEWTON_API NewtonCollision *NewtonCreateCone(NewtonWorld *const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix);
+NEWTON_API NewtonCollision *NewtonCreateCapsule(NewtonWorld *const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix);
+NEWTON_API NewtonCollision *NewtonCreateCylinder(NewtonWorld *const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix);
+NEWTON_API NewtonCollision *NewtonCreateChamferCylinder(NewtonWorld *const newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat *const offsetMatrix);
+NEWTON_API NewtonCollision *NewtonCreateConvexHull(NewtonWorld *const newtonWorld, int count, const dFloat *const vertexCloud, int strideInBytes, dFloat tolerance, int shapeID, const dFloat *const offsetMatrix);
NEWTON_API NewtonCollision *NewtonCreateConvexHullFromMesh(const NewtonWorld *const newtonWorld, const NewtonMesh *const mesh, dFloat tolerance, int shapeID);
-NEWTON_API NewtonCollision *NewtonCreateConvexHullModifier(const NewtonWorld *const newtonWorld, const NewtonCollision *const convexHullCollision, int shapeID);
+NEWTON_API NewtonCollision *NewtonCreateConvexHullModifier(NewtonWorld *const newtonWorld, NewtonCollision *const convexHullCollision, int shapeID);
NEWTON_API void NewtonConvexHullModifierGetMatrix(const NewtonCollision *const convexHullCollision, dFloat *const matrix);
-NEWTON_API void NewtonConvexHullModifierSetMatrix(const NewtonCollision *const convexHullCollision, const dFloat *const matrix);
+NEWTON_API void NewtonConvexHullModifierSetMatrix(NewtonCollision *const convexHullCollision, const dFloat *const matrix);
NEWTON_API int NewtonCollisionIsTriggerVolume(const NewtonCollision *const convexCollision);
NEWTON_API void NewtonCollisionSetAsTriggerVolume(NewtonCollision *convexCollision, int trigger);
@@ -512,7 +512,7 @@ NEWTON_API int NewtonAddCollisionReference(NewtonCollision *const collision);
// complex collision primitives creation functions
//
// **********************************************************************************************
-NEWTON_API NewtonCollision *NewtonCreateCompoundCollision(const NewtonWorld *const newtonWorld, int count, NewtonCollision *const collisionPrimitiveArray[], int shapeID);
+NEWTON_API NewtonCollision *NewtonCreateCompoundCollision(NewtonWorld *const newtonWorld, int count, NewtonCollision *const collisionPrimitiveArray[], int shapeID);
NEWTON_API NewtonCollision *NewtonCreateCompoundCollisionFromMesh(NewtonWorld *const newtonWorld, const NewtonMesh *const mesh, dFloat hullTolerance, int shapeID, int subShapeID);
//NEWTON_API NewtonCollision* NewtonCreateCompoundCollisionFromMesh(const NewtonWorld* const newtonWorld, const NewtonMesh* const mesh, int maxSubShapesCount, int shapeID, int subShapeID);
@@ -526,14 +526,14 @@ NEWTON_API NewtonCollision *NewtonCreateCompoundCollisionFromMesh(NewtonWorld *c
// dFloat* const matrixPallete, int* const shapeIDArray, dFloat* const densities,
// int shapeID, int debriID, NewtonCollisionCompoundBreakableCallback callback, void* buildUsedData);
-NEWTON_API NewtonCollision *NewtonCreateCompoundBreakable(const NewtonWorld *const newtonWorld, int meshCount,
+NEWTON_API NewtonCollision *NewtonCreateCompoundBreakable(NewtonWorld *const newtonWorld, int meshCount,
const NewtonMesh **const solids, const int *const shapeIDArray,
const dFloat *const densities, const int *const internalFaceMaterial,
int shapeID, int debriID, dFloat debriSeparationGap);
-NEWTON_API void NewtonCompoundBreakableResetAnchoredPieces(const NewtonCollision *const compoundBreakable);
-NEWTON_API void NewtonCompoundBreakableSetAnchoredPieces(const NewtonCollision *const compoundBreakable, int fixShapesCount, dFloat *const matrixPallete, NewtonCollision **const fixedShapesArray);
+NEWTON_API void NewtonCompoundBreakableResetAnchoredPieces(NewtonCollision *const compoundBreakable);
+NEWTON_API void NewtonCompoundBreakableSetAnchoredPieces(NewtonCollision *const compoundBreakable, int fixShapesCount, dFloat *const matrixPallete, NewtonCollision **const fixedShapesArray);
NEWTON_API int NewtonCompoundBreakableGetVertexCount(const NewtonCollision *const compoundBreakable);
NEWTON_API void NewtonCompoundBreakableGetVertexStreams(const NewtonCollision *const compoundBreakable, int vertexStrideInByte, dFloat *const vertex,
@@ -542,12 +542,12 @@ NEWTON_API void NewtonCompoundBreakableGetVertexStreams(const NewtonCollision *c
NEWTON_API NewtonbreakableComponentMesh *NewtonBreakableGetMainMesh(const NewtonCollision *const compoundBreakable);
NEWTON_API NewtonbreakableComponentMesh *NewtonBreakableGetFirstComponent(const NewtonCollision *const compoundBreakable);
-NEWTON_API NewtonbreakableComponentMesh *NewtonBreakableGetNextComponent(const NewtonbreakableComponentMesh *const component);
+NEWTON_API const NewtonbreakableComponentMesh *NewtonBreakableGetNextComponent(const NewtonbreakableComponentMesh *const component);
-NEWTON_API void NewtonBreakableBeginDelete(const NewtonCollision *const compoundBreakable);
-NEWTON_API NewtonBody *NewtonBreakableCreateDebrieBody(const NewtonCollision *const compoundBreakable, const NewtonbreakableComponentMesh *const component);
-NEWTON_API void NewtonBreakableDeleteComponent(const NewtonCollision *const compoundBreakable, const NewtonbreakableComponentMesh *const component);
-NEWTON_API void NewtonBreakableEndDelete(const NewtonCollision *const compoundBreakable);
+NEWTON_API void NewtonBreakableBeginDelete(NewtonCollision *const compoundBreakable);
+NEWTON_API NewtonBody *NewtonBreakableCreateDebrieBody(NewtonCollision *const compoundBreakable, NewtonbreakableComponentMesh *const component);
+NEWTON_API void NewtonBreakableDeleteComponent(NewtonCollision *const compoundBreakable, NewtonbreakableComponentMesh *const component);
+NEWTON_API void NewtonBreakableEndDelete(NewtonCollision *const compoundBreakable);
NEWTON_API int NewtonBreakableGetComponentsInRadius(const NewtonCollision *const compoundBreakable, const dFloat *position, dFloat radius, NewtonbreakableComponentMesh **const segments, int maxCount);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
index 4cec105289e..57edfaafadd 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
@@ -1240,7 +1240,7 @@ void dgCollisionCompoundBreakable::ResetAnchor() {
}
void dgCollisionCompoundBreakable::SetAnchoredParts(dgInt32 count,
- const dgMatrix *const matrixArray, const dgCollision **collisionArray) {
+ const dgMatrix *const matrixArray, const dgCollision * const *collisionArray) {
dgDebriGraph::dgListNode *fixNode;
dgMatrix matrix(dgGetIdentityMatrix());
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
index 7c6d825de87..f3c9fd03e41 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
@@ -221,7 +221,7 @@ public:
dgInt32 GetSegmentsInRadius(const dgVector &origin, dgFloat32 radius, dgDebriGraph::dgListNode **segments, dgInt32 maxCount) const;
void ResetAnchor();
- void SetAnchoredParts(dgInt32 count, const dgMatrix *const matrixArray, const dgCollision **collisionArray);
+ void SetAnchoredParts(dgInt32 count, const dgMatrix *const matrixArray, const dgCollision * const *collisionArray);
void EnumerateIslands();
// dgInt32 GetSegmentsInRadius (const dgVector& origin, dgFloat32 radius, dgDebriGraph::dgListNode** segments, dgInt32 maxCount);
// dgInt32 GetDetachedPieces (dgCollision** shapes, dgInt32 maxCount);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp b/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
index ad04e46f1f9..66fb172ad9d 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
@@ -356,7 +356,7 @@ void dgWorld::SetHardwareMode(dgInt32 mode) {
}
}
-dgInt32 dgWorld::GetHardwareMode(char *description) {
+dgInt32 dgWorld::GetHardwareMode(char *description) const {
dgInt32 mode;
// if (0) {
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorld.h b/engines/hpl1/engine/libraries/newton/physics/dgWorld.h
index 58eff75c03e..313c8343c9f 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorld.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorld.h
@@ -147,7 +147,7 @@ public:
void SetSolverMode(dgInt32 mode);
void SetFrictionMode(dgInt32 mode);
void SetHardwareMode(dgInt32 mode);
- dgInt32 GetHardwareMode(char *description);
+ dgInt32 GetHardwareMode(char *description) const;
void SetThreadsCount(dgInt32 count);
dgInt32 GetThreadsCount() const;
Commit: 224e3fee5f680048768a219ac56a3ed179301aa7
https://github.com/scummvm/scummvm/commit/224e3fee5f680048768a219ac56a3ed179301aa7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:21+01:00
Commit Message:
HPL1: Rename Hpl1::set:: to Hpl1::Set:: namespace
Changed paths:
engines/hpl1/engine/ai/AINodeContainer.h
engines/hpl1/engine/ai/AStar.h
engines/hpl1/engine/ai/StateMachine.h
engines/hpl1/engine/game/Game.cpp
engines/hpl1/engine/game/Game.h
engines/hpl1/engine/game/GameTypes.h
engines/hpl1/engine/game/SaveGame.h
engines/hpl1/engine/game/Updater.h
engines/hpl1/engine/graphics/BackgroundImage.h
engines/hpl1/engine/graphics/GraphicsDrawer.h
engines/hpl1/engine/graphics/ImageEntityData.h
engines/hpl1/engine/graphics/Mesh.h
engines/hpl1/engine/graphics/ParticleEmitter.h
engines/hpl1/engine/graphics/RenderList.cpp
engines/hpl1/engine/graphics/RenderList.h
engines/hpl1/engine/graphics/Renderer2D.h
engines/hpl1/engine/graphics/Skeleton.h
engines/hpl1/engine/gui/Gui.cpp
engines/hpl1/engine/gui/Gui.h
engines/hpl1/engine/gui/GuiSet.h
engines/hpl1/engine/haptic/HapticTypes.h
engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
engines/hpl1/engine/input/Input.h
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/physics/Physics.h
engines/hpl1/engine/physics/PhysicsJoint.h
engines/hpl1/engine/physics/PhysicsWorld.h
engines/hpl1/engine/resources/FileSearcher.h
engines/hpl1/engine/resources/ImageManager.h
engines/hpl1/engine/resources/LanguageFile.h
engines/hpl1/engine/resources/ParticleManager.h
engines/hpl1/engine/resources/ResourceManager.h
engines/hpl1/engine/resources/Resources.h
engines/hpl1/engine/resources/TextureManager.h
engines/hpl1/engine/scene/GridMap2D.h
engines/hpl1/engine/scene/Light3D.h
engines/hpl1/engine/scene/MultiImageEntity.h
engines/hpl1/engine/scene/PortalContainer.h
engines/hpl1/engine/scene/SectorVisibility.h
engines/hpl1/engine/scene/SubMeshEntity.h
engines/hpl1/engine/scene/World3D.h
engines/hpl1/engine/sound/SoundHandler.h
engines/hpl1/engine/system/MemoryManager.h
engines/hpl1/engine/system/SerializeClass.h
engines/hpl1/engine/system/SystemTypes.h
engines/hpl1/penumbra-overture/GameEntity.h
engines/hpl1/penumbra-overture/GameMusicHandler.h
engines/hpl1/penumbra-overture/GameObject.h
engines/hpl1/penumbra-overture/GameTypes.h
engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
engines/hpl1/penumbra-overture/Inventory.h
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/MapHandler.h
engines/hpl1/penumbra-overture/PlayerHands.h
engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
engines/hpl1/penumbra-overture/TriggerHandler.h
engines/hpl1/std/map.h
engines/hpl1/std/multimap.h
engines/hpl1/std/multiset.h
engines/hpl1/std/pair.h
engines/hpl1/std/set.h
diff --git a/engines/hpl1/engine/ai/AINodeContainer.h b/engines/hpl1/engine/ai/AINodeContainer.h
index c5d7c8a92a2..39f24742da0 100644
--- a/engines/hpl1/engine/ai/AINodeContainer.h
+++ b/engines/hpl1/engine/ai/AINodeContainer.h
@@ -92,7 +92,7 @@ typedef tAINodeVec::iterator tAINodeVecIt;
typedef Common::List<cAINode *> tAINodeList;
typedef tAINodeList::iterator tAINodeListIt;
-typedef Hpl1::std::map<tString, cAINode *> tAINodeMap;
+typedef Hpl1::Std::map<tString, cAINode *> tAINodeMap;
typedef tAINodeMap::iterator tAINodeMapIt;
//--------------------------------
diff --git a/engines/hpl1/engine/ai/AStar.h b/engines/hpl1/engine/ai/AStar.h
index d51b770d360..8c38423c8e2 100644
--- a/engines/hpl1/engine/ai/AStar.h
+++ b/engines/hpl1/engine/ai/AStar.h
@@ -40,7 +40,7 @@ class cAINode;
//--------------------------------------
-typedef Hpl1::std::set<cAINode *> tAINodeSet;
+typedef Hpl1::Std::set<cAINode *> tAINodeSet;
typedef tAINodeSet::iterator tAINodeSetIt;
//--------------------------------------
@@ -66,7 +66,7 @@ public:
bool operator()(cAStarNode *apNodeA, cAStarNode *apNodeB) const;
};
-typedef Hpl1::std::set<cAStarNode *, cAStarNodeCompare> tAStarNodeSet;
+typedef Hpl1::Std::set<cAStarNode *, cAStarNodeCompare> tAStarNodeSet;
typedef tAStarNodeSet::iterator tAStarNodeSetIt;
//--------------------------------------
diff --git a/engines/hpl1/engine/ai/StateMachine.h b/engines/hpl1/engine/ai/StateMachine.h
index 4fd66b17122..c6820630840 100644
--- a/engines/hpl1/engine/ai/StateMachine.h
+++ b/engines/hpl1/engine/ai/StateMachine.h
@@ -69,7 +69,7 @@ private:
float mfTimeCount;
};
-typedef Hpl1::std::map<int, iAIState *> tAIStateMap;
+typedef Hpl1::Std::map<int, iAIState *> tAIStateMap;
typedef tAIStateMap::iterator tAIStateMapIt;
//-----------------------------------------
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index 645aa871d3a..79babf62d31 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -93,7 +93,7 @@ cSetupVarContainer::cSetupVarContainer() {
//-----------------------------------------------------------------------
void cSetupVarContainer::AddString(const tString &asName, const tString &asValue) {
- Hpl1::std::map<tString, tString>::value_type val(asName, asValue);
+ Hpl1::Std::map<tString, tString>::value_type val(asName, asValue);
m_mapVars.insert(val);
}
@@ -110,7 +110,7 @@ void cSetupVarContainer::AddBool(const tString &asName, bool abValue) {
//-----------------------------------------------------------------------
const tString &cSetupVarContainer::GetString(const tString &asName) {
- Hpl1::std::map<tString, tString>::iterator it = m_mapVars.find(asName);
+ Hpl1::Std::map<tString, tString>::iterator it = m_mapVars.find(asName);
if (it == m_mapVars.end())
return msBlank;
else
diff --git a/engines/hpl1/engine/game/Game.h b/engines/hpl1/engine/game/Game.h
index 47e3c206c56..ef14166f7df 100644
--- a/engines/hpl1/engine/game/Game.h
+++ b/engines/hpl1/engine/game/Game.h
@@ -83,7 +83,7 @@ public:
bool GetBool(const tString &asName, bool abDefault);
private:
- Hpl1::std::map<tString, tString> m_mapVars;
+ Hpl1::Std::map<tString, tString> m_mapVars;
tString msBlank;
};
diff --git a/engines/hpl1/engine/game/GameTypes.h b/engines/hpl1/engine/game/GameTypes.h
index 24fc1959fe3..c6bb345f379 100644
--- a/engines/hpl1/engine/game/GameTypes.h
+++ b/engines/hpl1/engine/game/GameTypes.h
@@ -41,7 +41,7 @@ class cScriptVar : public iSerializable {
int mlVal;
};
-typedef Hpl1::std::map<tString, cScriptVar> tScriptVarMap;
+typedef Hpl1::Std::map<tString, cScriptVar> tScriptVarMap;
typedef tScriptVarMap::iterator tScriptVarMapIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/game/SaveGame.h b/engines/hpl1/engine/game/SaveGame.h
index b6771eeef44..6c6b10e05e7 100644
--- a/engines/hpl1/engine/game/SaveGame.h
+++ b/engines/hpl1/engine/game/SaveGame.h
@@ -174,7 +174,7 @@ private:
//---------------------------------------------------------
-typedef Hpl1::std::multimap<int, iSaveObject *> tSaveObjectMap;
+typedef Hpl1::Std::multimap<int, iSaveObject *> tSaveObjectMap;
typedef tSaveObjectMap::iterator tSaveObjectMapIt;
typedef cSTLMapIterator<iSaveObject *, tSaveObjectMap, tSaveObjectMapIt> cSaveObjectIterator;
@@ -205,7 +205,7 @@ private:
//---------------------------------------------------------
-typedef Hpl1::std::multimap<int, iSaveData *> tSaveDataMap;
+typedef Hpl1::Std::multimap<int, iSaveData *> tSaveDataMap;
typedef tSaveDataMap::iterator tSaveDataMapIt;
typedef cSTLMapIterator<iSaveData *, tSaveDataMap, tSaveDataMapIt> cSaveDataIterator;
diff --git a/engines/hpl1/engine/game/Updater.h b/engines/hpl1/engine/game/Updater.h
index c2cbdea0806..89b65b75ca4 100644
--- a/engines/hpl1/engine/game/Updater.h
+++ b/engines/hpl1/engine/game/Updater.h
@@ -40,7 +40,7 @@ class LowLevelSystem;
typedef Common::List<iUpdateable *> tUpdateableList;
typedef tUpdateableList::iterator tUpdateableListIt;
-typedef Hpl1::std::map<tString, tUpdateableList> tUpdateContainerMap;
+typedef Hpl1::Std::map<tString, tUpdateableList> tUpdateContainerMap;
typedef tUpdateContainerMap::iterator tUpdateContainerMapIt;
class cUpdater {
diff --git a/engines/hpl1/engine/graphics/BackgroundImage.h b/engines/hpl1/engine/graphics/BackgroundImage.h
index 9746bc1976f..2c8b2dbcc44 100644
--- a/engines/hpl1/engine/graphics/BackgroundImage.h
+++ b/engines/hpl1/engine/graphics/BackgroundImage.h
@@ -57,7 +57,7 @@ private:
cVector2f mvVel;
};
-typedef Hpl1::std::map<float, cBackgroundImage *> tBackgroundImageMap;
+typedef Hpl1::Std::map<float, cBackgroundImage *> tBackgroundImageMap;
typedef tBackgroundImageMap::iterator tBackgroundImageMapIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/GraphicsDrawer.h b/engines/hpl1/engine/graphics/GraphicsDrawer.h
index 92f39776b6c..71cb457b25a 100644
--- a/engines/hpl1/engine/graphics/GraphicsDrawer.h
+++ b/engines/hpl1/engine/graphics/GraphicsDrawer.h
@@ -66,7 +66,7 @@ public:
bool operator()(const cGfxBufferObject &aObjectA, const cGfxBufferObject &aObjectB) const;
};
-typedef Hpl1::std::multiset<cGfxBufferObject, cGfxBufferCompare> tGfxBufferSet;
+typedef Hpl1::Std::multiset<cGfxBufferObject, cGfxBufferCompare> tGfxBufferSet;
typedef tGfxBufferSet::iterator tGfxBufferSetIt;
class cResources;
diff --git a/engines/hpl1/engine/graphics/ImageEntityData.h b/engines/hpl1/engine/graphics/ImageEntityData.h
index d80b5908d86..a969389586a 100644
--- a/engines/hpl1/engine/graphics/ImageEntityData.h
+++ b/engines/hpl1/engine/graphics/ImageEntityData.h
@@ -64,7 +64,7 @@ public:
tString msSound;
};
-typedef Hpl1::std::map<tString, cImageAnimation> tImageAnimationMap;
+typedef Hpl1::Std::map<tString, cImageAnimation> tImageAnimationMap;
typedef tImageAnimationMap::iterator tImageAnimationMapIt;
class cImageEntityData : public iResourceBase {
diff --git a/engines/hpl1/engine/graphics/Mesh.h b/engines/hpl1/engine/graphics/Mesh.h
index 55353f3b194..1f62bdc06f5 100644
--- a/engines/hpl1/engine/graphics/Mesh.h
+++ b/engines/hpl1/engine/graphics/Mesh.h
@@ -65,13 +65,13 @@ class cWorld3D;
typedef Common::Array<cAnimation *> tAnimationVec;
typedef tAnimationVec::iterator tAnimationVecIt;
-typedef Hpl1::std::map<tString, int> tAnimationIndexMap;
+typedef Hpl1::Std::map<tString, int> tAnimationIndexMap;
typedef tAnimationIndexMap::iterator tAnimationIndexMapIt;
typedef Common::Array<cSubMesh *> tSubMeshVec;
typedef Common::Array<cSubMesh *>::iterator tSubMeshVecIt;
-typedef Hpl1::std::multimap<tString, cSubMesh *> tSubMeshMap;
+typedef Hpl1::Std::multimap<tString, cSubMesh *> tSubMeshMap;
typedef tSubMeshMap::iterator tSubMeshMapIt;
typedef Common::Array<cNode3D *> tNode3DVec;
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter.h b/engines/hpl1/engine/graphics/ParticleEmitter.h
index 7f93d5887ae..b77193095ec 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter.h
+++ b/engines/hpl1/engine/graphics/ParticleEmitter.h
@@ -233,7 +233,7 @@ protected:
float mfWarmUpStepsPerSec;
};
-typedef Hpl1::std::map<tString, iParticleEmitterData *> tParticleEmitterDataMap;
+typedef Hpl1::Std::map<tString, iParticleEmitterData *> tParticleEmitterDataMap;
typedef tParticleEmitterDataMap::iterator tParticleEmitterDataMapIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/graphics/RenderList.cpp b/engines/hpl1/engine/graphics/RenderList.cpp
index 23aebfc4af6..7d570b98856 100644
--- a/engines/hpl1/engine/graphics/RenderList.cpp
+++ b/engines/hpl1/engine/graphics/RenderList.cpp
@@ -440,7 +440,7 @@ cRenderNode *cRenderList::InsertNode(cRenderNode *apListNode, cRenderNode *apTem
/*cRenderNode* cRenderList::InsertNode(cRenderNode* apListNode, cRenderNode* apTempNode)
{
- std::pair<tRenderNodeSetIt, bool> ret = apListNode->m_setNodes.insert(apTempNode);
+ Std::pair<tRenderNodeSetIt, bool> ret = apListNode->m_setNodes.insert(apTempNode);
if(ret.second == false)
{
m_poolRenderState->Release(apTempNode->mpState);
diff --git a/engines/hpl1/engine/graphics/RenderList.h b/engines/hpl1/engine/graphics/RenderList.h
index 49104f26978..e7be02a5969 100644
--- a/engines/hpl1/engine/graphics/RenderList.h
+++ b/engines/hpl1/engine/graphics/RenderList.h
@@ -64,7 +64,7 @@ public:
bool operator()(cRenderNode *apNodeA, cRenderNode *apNodeB) const;
};
-typedef Hpl1::std::set<cRenderNode *, cRenderNodeCompare> tRenderNodeSet;
+typedef Hpl1::Std::set<cRenderNode *, cRenderNodeCompare> tRenderNodeSet;
typedef tRenderNodeSet::iterator tRenderNodeSetIt;
class cRenderNode {
@@ -86,7 +86,7 @@ public:
bool operator()(iRenderable *pObjectA, iRenderable *pObjectB) const;
};
-typedef Hpl1::std::multiset<iRenderable *, cMotionBlurObject_Compare> tMotionBlurObjectSet;
+typedef Hpl1::Std::multiset<iRenderable *, cMotionBlurObject_Compare> tMotionBlurObjectSet;
typedef tMotionBlurObjectSet::iterator tMotionBlurObjectSetIt;
typedef cSTLIterator<iRenderable *, tMotionBlurObjectSet,
@@ -100,7 +100,7 @@ public:
bool operator()(iRenderable *pObjectA, iRenderable *pObjectB) const;
};
-typedef Hpl1::std::multiset<iRenderable *, cTransperantObject_Compare> tTransperantObjectSet;
+typedef Hpl1::Std::multiset<iRenderable *, cTransperantObject_Compare> tTransperantObjectSet;
typedef tTransperantObjectSet::iterator tTransperantObjectSetIt;
typedef cSTLIterator<iRenderable *, tTransperantObjectSet, tTransperantObjectSetIt> cTransperantObjectIterator;
@@ -122,7 +122,7 @@ public:
bool operator()(const cOcclusionQueryObject *pObjectA, const cOcclusionQueryObject *pObjectB) const;
};
-typedef Hpl1::std::set<cOcclusionQueryObject *, cOcclusionQueryObject_Compare> tOcclusionQueryObjectSet;
+typedef Hpl1::Std::set<cOcclusionQueryObject *, cOcclusionQueryObject_Compare> tOcclusionQueryObjectSet;
typedef tOcclusionQueryObjectSet::iterator tOcclusionQueryObjectSetIt;
typedef cSTLIterator<cOcclusionQueryObject *, tOcclusionQueryObjectSet,
@@ -131,10 +131,10 @@ typedef cSTLIterator<cOcclusionQueryObject *, tOcclusionQueryObjectSet,
//-------------------------------------------------------------
-typedef Hpl1::std::set<iRenderable *> tRenderableSet;
+typedef Hpl1::Std::set<iRenderable *> tRenderableSet;
typedef tRenderableSet::iterator tRenderableSetIt;
-typedef Hpl1::std::set<iLight3D *> tLight3DSet;
+typedef Hpl1::Std::set<iLight3D *> tLight3DSet;
typedef tLight3DSet::iterator tLight3DSetIt;
typedef cSTLIterator<iLight3D *, tLight3DSet, tLight3DSetIt> cLight3DIterator;
diff --git a/engines/hpl1/engine/graphics/Renderer2D.h b/engines/hpl1/engine/graphics/Renderer2D.h
index aafa0307806..93a5e3e7ed9 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.h
+++ b/engines/hpl1/engine/graphics/Renderer2D.h
@@ -64,10 +64,10 @@ public:
bool operator()(const cRenderObject2D &aObjectA, const cRenderObject2D &aObjectB) const;
};
-typedef Hpl1::std::multiset<cRenderObject2D, cRenderObject2DCompare> tRenderObjectSet;
+typedef Hpl1::Std::multiset<cRenderObject2D, cRenderObject2DCompare> tRenderObjectSet;
typedef tRenderObjectSet::iterator tRenderObjectSetIt;
-typedef Hpl1::std::multiset<cRenderObject2D, cRenderTransObjectCompare> tRenderTransObjectSet;
+typedef Hpl1::Std::multiset<cRenderObject2D, cRenderTransObjectCompare> tRenderTransObjectSet;
typedef tRenderTransObjectSet::iterator tRenderTransObjectSetIt;
typedef Common::List<cRenderObject2D> tRenderObjectList;
diff --git a/engines/hpl1/engine/graphics/Skeleton.h b/engines/hpl1/engine/graphics/Skeleton.h
index 90e9a3f9e32..ac915f32634 100644
--- a/engines/hpl1/engine/graphics/Skeleton.h
+++ b/engines/hpl1/engine/graphics/Skeleton.h
@@ -40,7 +40,7 @@ class cBone;
typedef Common::Array<cBone *> tBoneVec;
typedef tBoneVec::iterator tBoneVecIt;
-typedef Hpl1::std::map<tString, int> tBoneIdxNameMap;
+typedef Hpl1::Std::map<tString, int> tBoneIdxNameMap;
typedef tBoneIdxNameMap::iterator tBoneIdxNameMapIt;
class cSkeleton {
diff --git a/engines/hpl1/engine/gui/Gui.cpp b/engines/hpl1/engine/gui/Gui.cpp
index 1e1ce0932c6..ccab5672554 100644
--- a/engines/hpl1/engine/gui/Gui.cpp
+++ b/engines/hpl1/engine/gui/Gui.cpp
@@ -164,7 +164,7 @@ void cGui::OnPostSceneDraw() {
//-----------------------------------------------------------------------
void cGui::OnPostGUIDraw() {
- typedef Hpl1::std::multimap<int, cGuiSet *> tPrioMap;
+ typedef Hpl1::Std::multimap<int, cGuiSet *> tPrioMap;
tPrioMap mapSortedSets;
tGuiSetMapIt it = m_mapSets.begin();
diff --git a/engines/hpl1/engine/gui/Gui.h b/engines/hpl1/engine/gui/Gui.h
index 57a14eb8ea3..3e312900f49 100644
--- a/engines/hpl1/engine/gui/Gui.h
+++ b/engines/hpl1/engine/gui/Gui.h
@@ -49,23 +49,23 @@ class iGuiMaterial;
//------------------------------------------------
-typedef Hpl1::std::map<tString, cGuiSet *> tGuiSetMap;
+typedef Hpl1::Std::map<tString, cGuiSet *> tGuiSetMap;
typedef tGuiSetMap::iterator tGuiSetMapIt;
//-------------------------------------
-typedef Hpl1::std::map<tString, cGuiSkin *> tGuiSkinMap;
+typedef Hpl1::Std::map<tString, cGuiSkin *> tGuiSkinMap;
typedef tGuiSkinMap::iterator tGuiSkinMapIt;
//-------------------------------------
-typedef Hpl1::std::map<tString, eGuiSkinGfx> tGuiSkinGfxMap;
+typedef Hpl1::Std::map<tString, eGuiSkinGfx> tGuiSkinGfxMap;
typedef tGuiSkinGfxMap::iterator tGuiSkinGfxMapIt;
-typedef Hpl1::std::map<tString, eGuiSkinFont> tGuiSkinFontMap;
+typedef Hpl1::Std::map<tString, eGuiSkinFont> tGuiSkinFontMap;
typedef tGuiSkinFontMap::iterator tGuiSkinFontMapIt;
-typedef Hpl1::std::map<tString, eGuiSkinAttribute> tGuiSkinAttributeMap;
+typedef Hpl1::Std::map<tString, eGuiSkinAttribute> tGuiSkinAttributeMap;
typedef tGuiSkinAttributeMap::iterator tGuiSkinAttributeMapIt;
//------------------------------------------------
diff --git a/engines/hpl1/engine/gui/GuiSet.h b/engines/hpl1/engine/gui/GuiSet.h
index 414911dcb2a..92659a53eaf 100644
--- a/engines/hpl1/engine/gui/GuiSet.h
+++ b/engines/hpl1/engine/gui/GuiSet.h
@@ -85,7 +85,7 @@ public:
bool operator()(const cGuiRenderObject &aObjectA, const cGuiRenderObject &aObjectB) const;
};
-typedef Hpl1::std::multiset<cGuiRenderObject, cGuiRenderObjectCompare> tGuiRenderObjectSet;
+typedef Hpl1::Std::multiset<cGuiRenderObject, cGuiRenderObjectCompare> tGuiRenderObjectSet;
typedef tGuiRenderObjectSet::iterator tGuiRenderObjectSetIt;
//-----------------------------------------------
diff --git a/engines/hpl1/engine/haptic/HapticTypes.h b/engines/hpl1/engine/haptic/HapticTypes.h
index 152079a6361..30cd508bf23 100644
--- a/engines/hpl1/engine/haptic/HapticTypes.h
+++ b/engines/hpl1/engine/haptic/HapticTypes.h
@@ -88,7 +88,7 @@ typedef tHapticForceList::iterator tHapticForceListIt;
typedef Common::List<iHapticSurface *> tHapticSurfaceList;
typedef tHapticSurfaceList::iterator tHapticSurfaceListIt;
-typedef Hpl1::std::map<tString, iHapticSurface *> tHapticSurfaceMap;
+typedef Hpl1::Std::map<tString, iHapticSurface *> tHapticSurfaceMap;
typedef tHapticSurfaceMap::iterator tHapticSurfaceMapIt;
typedef cSTLIterator<iHapticShape *, tHapticShapeList, tHapticShapeListIt> cHapticShapeIterator;
diff --git a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
index 1e58ea4bdfa..e3d368f25ab 100644
--- a/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderColladaHelpers.cpp
@@ -96,8 +96,8 @@ public:
typedef Common::Array<cTempAnimData> tTempAnimDataVec;
-typedef Hpl1::std::set<float> tTempTimesSet;
-typedef Hpl1::std::set<float>::iterator tTempTimesSetIt;
+typedef Hpl1::Std::set<float> tTempTimesSet;
+typedef Hpl1::Std::set<float>::iterator tTempTimesSetIt;
static cTempAnimData *GetTempAnimData(float afTime, tTempAnimDataVec &avTempData) {
for (size_t i = 0; i < avTempData.size(); ++i) {
@@ -1145,7 +1145,7 @@ public:
///////////////////////////////////////////
-typedef Hpl1::std::set<cColladaTestTri, cColladaTestTriCompare> tColladaTestTriMap;
+typedef Hpl1::Std::set<cColladaTestTri, cColladaTestTriCompare> tColladaTestTriMap;
typedef tColladaTestTriMap::iterator tColladaTestTriMapIt;
///////////////////////////////////////////
diff --git a/engines/hpl1/engine/input/Input.h b/engines/hpl1/engine/input/Input.h
index d5d2c5834c4..de4f43ec605 100644
--- a/engines/hpl1/engine/input/Input.h
+++ b/engines/hpl1/engine/input/Input.h
@@ -43,10 +43,10 @@ class iLowLevelInput;
class iInputDevice;
class iAction;
-typedef Hpl1::std::map<tString, iAction *> tActionMap;
+typedef Hpl1::Std::map<tString, iAction *> tActionMap;
typedef tActionMap::iterator tActionMapIt;
-typedef Hpl1::std::multimap<tString, iAction *> tActionMultiMap;
+typedef Hpl1::Std::multimap<tString, iAction *> tActionMultiMap;
typedef tActionMultiMap::iterator tActionMultiMapIt;
typedef Common::List<iInputDevice *> tInputDeviceList;
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
index da548438a9d..ca45a1c30c1 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -17,7 +17,7 @@ struct StrComp {
}
};
-using map_t = Hpl1::std::map<const Common::String *, int, StrComp>;
+using map_t = Hpl1::Std::map<const Common::String *, int, StrComp>;
BEGIN_AS_NAMESPACE
class CStdStringFactory : public asIStringFactory {
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index 1078d3e5b56..5280a377d07 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -1391,7 +1391,7 @@ public:
tUIntList mlstIndices;
};
-typedef Hpl1::std::map<cVector3f, cVertexIndices> tVtxIdxMap;
+typedef Hpl1::Std::map<cVector3f, cVertexIndices> tVtxIdxMap;
typedef tVtxIdxMap::iterator tVtxIdxMapIt;
//////////////////////////////////////////////////////
@@ -1424,7 +1424,7 @@ public:
}
};
-typedef Hpl1::std::set<cTriEdge, cEdgeCompare> tTriEdgeListMap;
+typedef Hpl1::Std::set<cTriEdge, cEdgeCompare> tTriEdgeListMap;
typedef tTriEdgeListMap::iterator tTriEdgeListMapIt;
//////////////////////////////////////////////////////
diff --git a/engines/hpl1/engine/physics/Physics.h b/engines/hpl1/engine/physics/Physics.h
index 876196df240..204da5e5f4b 100644
--- a/engines/hpl1/engine/physics/Physics.h
+++ b/engines/hpl1/engine/physics/Physics.h
@@ -50,7 +50,7 @@ class cHaptic;
typedef Common::List<iPhysicsWorld *> tPhysicsWorldList;
typedef tPhysicsWorldList::iterator tPhysicsWorldListIt;
-typedef Hpl1::std::map<tString, cSurfaceData *> tSurfaceDataMap;
+typedef Hpl1::Std::map<tString, cSurfaceData *> tSurfaceDataMap;
typedef tSurfaceDataMap::iterator tSurfaceDataMapIt;
//------------------------------------------------
diff --git a/engines/hpl1/engine/physics/PhysicsJoint.h b/engines/hpl1/engine/physics/PhysicsJoint.h
index 8c6c8a5db59..53073aeb9e8 100644
--- a/engines/hpl1/engine/physics/PhysicsJoint.h
+++ b/engines/hpl1/engine/physics/PhysicsJoint.h
@@ -44,7 +44,7 @@ class cSoundEntity;
class iPhysicsJoint;
class iPhysicsController;
-typedef Hpl1::std::map<tString, iPhysicsController *> tPhysicsControllerMap;
+typedef Hpl1::Std::map<tString, iPhysicsController *> tPhysicsControllerMap;
typedef tPhysicsControllerMap::iterator tPhysicsControllerMapIt;
typedef cSTLMapIterator<iPhysicsController *, tPhysicsControllerMap, tPhysicsControllerMapIt> cPhysicsControllerIterator;
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.h b/engines/hpl1/engine/physics/PhysicsWorld.h
index aaeacb43d8f..f3f2c820c96 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.h
+++ b/engines/hpl1/engine/physics/PhysicsWorld.h
@@ -72,7 +72,7 @@ typedef tPhysicsControllerList::iterator tPhysicsControllerListIt;
typedef Common::List<iCharacterBody *> tCharacterBodyList;
typedef tCharacterBodyList::iterator tCharacterBodyListIt;
-typedef Hpl1::std::map<tString, iPhysicsMaterial *> tPhysicsMaterialMap;
+typedef Hpl1::Std::map<tString, iPhysicsMaterial *> tPhysicsMaterialMap;
typedef tPhysicsMaterialMap::iterator tPhysicsMaterialMapIt;
typedef cSTLMapIterator<iPhysicsMaterial *, tPhysicsMaterialMap, tPhysicsMaterialMapIt> cPhysicsMaterialIterator;
diff --git a/engines/hpl1/engine/resources/FileSearcher.h b/engines/hpl1/engine/resources/FileSearcher.h
index 575d827a47e..701aa2cac2b 100644
--- a/engines/hpl1/engine/resources/FileSearcher.h
+++ b/engines/hpl1/engine/resources/FileSearcher.h
@@ -37,7 +37,7 @@ namespace hpl {
class LowLevelResources;
-typedef Hpl1::std::multimap<tString, tString> tFilePathMap;
+typedef Hpl1::Std::multimap<tString, tString> tFilePathMap;
typedef tFilePathMap::iterator tFilePathMapIt;
class cFileSearcher {
diff --git a/engines/hpl1/engine/resources/ImageManager.h b/engines/hpl1/engine/resources/ImageManager.h
index 3461bed0851..af365355f1d 100644
--- a/engines/hpl1/engine/resources/ImageManager.h
+++ b/engines/hpl1/engine/resources/ImageManager.h
@@ -42,7 +42,7 @@ class Bitmap2D;
typedef Common::List<cFrameBitmap *> tFrameBitmapList;
typedef tFrameBitmapList::iterator tFrameBitmapListIt;
-typedef Hpl1::std::map<int, cFrameTexture *> tFrameTextureMap;
+typedef Hpl1::Std::map<int, cFrameTexture *> tFrameTextureMap;
typedef tFrameTextureMap::iterator tFrameTextureMapIt;
class cImageManager : public iResourceManager {
diff --git a/engines/hpl1/engine/resources/LanguageFile.h b/engines/hpl1/engine/resources/LanguageFile.h
index 5adcfd74cc6..a0e95f56533 100644
--- a/engines/hpl1/engine/resources/LanguageFile.h
+++ b/engines/hpl1/engine/resources/LanguageFile.h
@@ -42,7 +42,7 @@ public:
tWString mwsText;
};
-typedef Hpl1::std::map<tString, cLanguageEntry *> tLanguageEntryMap;
+typedef Hpl1::Std::map<tString, cLanguageEntry *> tLanguageEntryMap;
typedef tLanguageEntryMap::iterator tLanguageEntryMapIt;
//--------------------------------
@@ -56,7 +56,7 @@ public:
tLanguageEntryMap m_mapEntries;
};
-typedef Hpl1::std::map<tString, cLanguageCategory *> tLanguageCategoryMap;
+typedef Hpl1::Std::map<tString, cLanguageCategory *> tLanguageCategoryMap;
typedef tLanguageCategoryMap::iterator tLanguageCategoryMapIt;
//--------------------------------
diff --git a/engines/hpl1/engine/resources/ParticleManager.h b/engines/hpl1/engine/resources/ParticleManager.h
index d4f1700b7c9..a63145e885c 100644
--- a/engines/hpl1/engine/resources/ParticleManager.h
+++ b/engines/hpl1/engine/resources/ParticleManager.h
@@ -42,7 +42,7 @@ class cParticleSystemData3D;
//----------------------------------------------------
-typedef Hpl1::std::map<tString, cParticleSystemData3D *> tParticleSystemData3DMap;
+typedef Hpl1::Std::map<tString, cParticleSystemData3D *> tParticleSystemData3DMap;
typedef tParticleSystemData3DMap::iterator tParticleSystemData3DMapIt;
//----------------------------------------------------
diff --git a/engines/hpl1/engine/resources/ResourceManager.h b/engines/hpl1/engine/resources/ResourceManager.h
index b99849a2fbf..44efda89fc7 100644
--- a/engines/hpl1/engine/resources/ResourceManager.h
+++ b/engines/hpl1/engine/resources/ResourceManager.h
@@ -38,10 +38,10 @@ class LowLevelSystem;
class cFileSearcher;
class iResourceBase;
-typedef Hpl1::std::map<unsigned long, iResourceBase *> tResourceHandleMap;
+typedef Hpl1::Std::map<unsigned long, iResourceBase *> tResourceHandleMap;
typedef tResourceHandleMap::iterator tResourceHandleMapIt;
-typedef Hpl1::std::map<tString, iResourceBase *> tResourceNameMap;
+typedef Hpl1::Std::map<tString, iResourceBase *> tResourceNameMap;
typedef tResourceNameMap::iterator tResourceNameMapIt;
typedef Common::List<iResourceBase *> tResourceBaseList;
diff --git a/engines/hpl1/engine/resources/Resources.h b/engines/hpl1/engine/resources/Resources.h
index 2b03c94c1f0..c2677dbaa60 100644
--- a/engines/hpl1/engine/resources/Resources.h
+++ b/engines/hpl1/engine/resources/Resources.h
@@ -88,7 +88,7 @@ protected:
tString msName;
};
-typedef Hpl1::std::map<tString, iEntity2DLoader *> tEntity2DLoaderMap;
+typedef Hpl1::Std::map<tString, iEntity2DLoader *> tEntity2DLoaderMap;
typedef tEntity2DLoaderMap::iterator tEntity2DLoaderMapIt;
//-------------------------------------------------------
@@ -106,7 +106,7 @@ protected:
tString msName;
};
-typedef Hpl1::std::map<tString, iArea2DLoader *> tArea2DLoaderMap;
+typedef Hpl1::Std::map<tString, iArea2DLoader *> tArea2DLoaderMap;
typedef tArea2DLoaderMap::iterator tArea2DLoaderMapIt;
//-------------------------------------------------------
@@ -125,7 +125,7 @@ protected:
tString msName;
};
-typedef Hpl1::std::map<tString, iEntity3DLoader *> tEntity3DLoaderMap;
+typedef Hpl1::Std::map<tString, iEntity3DLoader *> tEntity3DLoaderMap;
typedef tEntity3DLoaderMap::iterator tEntity3DLoaderMapIt;
//-------------------------------------------------------
@@ -143,7 +143,7 @@ protected:
tString msName;
};
-typedef Hpl1::std::map<tString, iArea3DLoader *> tArea3DLoaderMap;
+typedef Hpl1::Std::map<tString, iArea3DLoader *> tArea3DLoaderMap;
typedef tArea3DLoaderMap::iterator tArea3DLoaderMapIt;
//-------------------------------------------------------
diff --git a/engines/hpl1/engine/resources/TextureManager.h b/engines/hpl1/engine/resources/TextureManager.h
index 54ad1bd48e8..93a6c23609a 100644
--- a/engines/hpl1/engine/resources/TextureManager.h
+++ b/engines/hpl1/engine/resources/TextureManager.h
@@ -39,8 +39,8 @@ class iTexture;
//------------------------------------------------------
-typedef Hpl1::std::map<tString, iTexture *> tTextureAttenuationMap;
-typedef Hpl1::std::map<tString, iTexture *>::iterator tTextureAttenuationMapIt;
+typedef Hpl1::Std::map<tString, iTexture *> tTextureAttenuationMap;
+typedef Hpl1::Std::map<tString, iTexture *>::iterator tTextureAttenuationMapIt;
//------------------------------------------------------
diff --git a/engines/hpl1/engine/scene/GridMap2D.h b/engines/hpl1/engine/scene/GridMap2D.h
index 91225099acb..2c12015141a 100644
--- a/engines/hpl1/engine/scene/GridMap2D.h
+++ b/engines/hpl1/engine/scene/GridMap2D.h
@@ -80,7 +80,7 @@ private:
/////////// GRID ////////////
-typedef Hpl1::std::map<int, cGrid2DObject *> tGrid2DObjectMap;
+typedef Hpl1::Std::map<int, cGrid2DObject *> tGrid2DObjectMap;
typedef tGrid2DObjectMap::iterator tGrid2DObjectMapIt;
class cGrid2D {
diff --git a/engines/hpl1/engine/scene/Light3D.h b/engines/hpl1/engine/scene/Light3D.h
index c8ecd56764e..f390a05a06d 100644
--- a/engines/hpl1/engine/scene/Light3D.h
+++ b/engines/hpl1/engine/scene/Light3D.h
@@ -64,7 +64,7 @@ class cFileSearcher;
class cBillboard;
class cSectorVisibilityContainer;
-typedef Hpl1::std::set<iRenderable *> tCasterCacheSet;
+typedef Hpl1::Std::set<iRenderable *> tCasterCacheSet;
typedef tCasterCacheSet::iterator tCasterCacheSetIt;
//------------------------------------------
diff --git a/engines/hpl1/engine/scene/MultiImageEntity.h b/engines/hpl1/engine/scene/MultiImageEntity.h
index 31946319f1c..4693c6beae6 100644
--- a/engines/hpl1/engine/scene/MultiImageEntity.h
+++ b/engines/hpl1/engine/scene/MultiImageEntity.h
@@ -48,7 +48,7 @@ public:
bool mbSyncFrame;
};
-typedef Hpl1::std::map<unsigned int, cMultiImagePart> tMultiImagePartMap;
+typedef Hpl1::Std::map<unsigned int, cMultiImagePart> tMultiImagePartMap;
typedef tMultiImagePartMap::iterator tMultiImagePartMapIt;
class cMultiImageEntity {
diff --git a/engines/hpl1/engine/scene/PortalContainer.h b/engines/hpl1/engine/scene/PortalContainer.h
index 58d50a86a2f..12846459c41 100644
--- a/engines/hpl1/engine/scene/PortalContainer.h
+++ b/engines/hpl1/engine/scene/PortalContainer.h
@@ -43,11 +43,11 @@ class cSectorVisibilityContainer;
typedef Common::List<iRenderable *> tRenderableList;
typedef Common::List<iRenderable *>::iterator tRenderableListIt;
-typedef Hpl1::std::set<iRenderable *> tRenderableSet;
-typedef Hpl1::std::set<iRenderable *>::iterator tRenderableSetIt;
+typedef Hpl1::Std::set<iRenderable *> tRenderableSet;
+typedef Hpl1::Std::set<iRenderable *>::iterator tRenderableSetIt;
-typedef Hpl1::std::set<iEntity3D *> tEntity3DSet;
-typedef Hpl1::std::set<iEntity3D *>::iterator tEntity3DSetIt;
+typedef Hpl1::Std::set<iEntity3D *> tEntity3DSet;
+typedef Hpl1::Std::set<iEntity3D *>::iterator tEntity3DSetIt;
//----------------------------------------------------
@@ -56,8 +56,8 @@ class cSector;
//----------------------------------------------------
-typedef Hpl1::std::map<tString, cSector *> tSectorMap;
-typedef Hpl1::std::map<tString, cSector *>::iterator tSectorMapIt;
+typedef Hpl1::Std::map<tString, cSector *> tSectorMap;
+typedef Hpl1::Std::map<tString, cSector *>::iterator tSectorMapIt;
//----------------------------------------------------
@@ -116,8 +116,8 @@ private:
class cSector;
class cPortal;
-typedef Hpl1::std::map<int, cPortal *> tPortalMap;
-typedef Hpl1::std::map<int, cPortal *>::iterator tPortalMapIt;
+typedef Hpl1::Std::map<int, cPortal *> tPortalMap;
+typedef Hpl1::Std::map<int, cPortal *>::iterator tPortalMapIt;
typedef Common::List<cPortal *> tPortalList;
typedef Common::List<cPortal *>::iterator tPortalListIt;
diff --git a/engines/hpl1/engine/scene/SectorVisibility.h b/engines/hpl1/engine/scene/SectorVisibility.h
index e914dbb4dcf..bd9c8942688 100644
--- a/engines/hpl1/engine/scene/SectorVisibility.h
+++ b/engines/hpl1/engine/scene/SectorVisibility.h
@@ -117,7 +117,7 @@ private:
cSectorVisibilityContainer *mpContainer;
};
-typedef Hpl1::std::map<cSector *, cSectorVisibility *> tSectorVisibilityMap;
+typedef Hpl1::Std::map<cSector *, cSectorVisibility *> tSectorVisibilityMap;
typedef tSectorVisibilityMap::iterator tSectorVisibilityMapIt;
//----------------------------------------------------
@@ -125,7 +125,7 @@ typedef tSectorVisibilityMap::iterator tSectorVisibilityMapIt;
typedef Common::List<cPortalVisibilitySet *> tPortalVisibilitySetList;
typedef tPortalVisibilitySetList::iterator tPortalVisibilitySetListIt;
-typedef Hpl1::std::set<cSector *> tSectorSet;
+typedef Hpl1::Std::set<cSector *> tSectorSet;
typedef tSectorSet::iterator tSectorSetIt;
typedef cSTLMapIterator<cSectorVisibility *, tSectorVisibilityMap, tSectorVisibilityMapIt> tSectorVisibilityIterator;
diff --git a/engines/hpl1/engine/scene/SubMeshEntity.h b/engines/hpl1/engine/scene/SubMeshEntity.h
index cc31460e21a..16251e6c483 100644
--- a/engines/hpl1/engine/scene/SubMeshEntity.h
+++ b/engines/hpl1/engine/scene/SubMeshEntity.h
@@ -59,13 +59,13 @@ class cBoneState;
typedef Common::Array<cAnimationState *> tAnimationStateVec;
typedef tAnimationStateVec::iterator tAnimationStateVecIt;
-typedef Hpl1::std::map<tString, int> tAnimationStateIndexMap;
+typedef Hpl1::Std::map<tString, int> tAnimationStateIndexMap;
typedef tAnimationStateIndexMap::iterator tAnimationStateIndexMapIt;
typedef Common::Array<cBoneState *> tNodeStateVec;
typedef tNodeStateVec::iterator tNodeStateVecIt;
-typedef Hpl1::std::map<tString, int> tNodeStateIndexMap;
+typedef Hpl1::Std::map<tString, int> tNodeStateIndexMap;
typedef tNodeStateIndexMap::iterator tNodeStateIndexMapIt;
//-----------------------------------------------------------------------
@@ -177,7 +177,7 @@ private:
typedef Common::Array<cSubMeshEntity *> tSubMeshEntityVec;
typedef Common::Array<cSubMeshEntity *>::iterator tSubMeshEntityVecIt;
-typedef Hpl1::std::multimap<tString, cSubMeshEntity *> tSubMeshEntityMap;
+typedef Hpl1::Std::multimap<tString, cSubMeshEntity *> tSubMeshEntityMap;
typedef tSubMeshEntityMap::iterator tSubMeshEntityMapIt;
} // namespace hpl
diff --git a/engines/hpl1/engine/scene/World3D.h b/engines/hpl1/engine/scene/World3D.h
index 995ba59e3fa..0e798f49e18 100644
--- a/engines/hpl1/engine/scene/World3D.h
+++ b/engines/hpl1/engine/scene/World3D.h
@@ -130,8 +130,8 @@ public:
tTempAiNodeList mlstNodes;
};
-typedef Hpl1::std::map<tString, cTempNodeContainer *> tTempNodeContainerMap;
-typedef Hpl1::std::map<tString, cTempNodeContainer *>::iterator tTempNodeContainerMapIt;
+typedef Hpl1::Std::map<tString, cTempNodeContainer *> tTempNodeContainerMap;
+typedef Hpl1::Std::map<tString, cTempNodeContainer *>::iterator tTempNodeContainerMapIt;
//-------------------------------------------------------------------
@@ -142,7 +142,7 @@ class cAreaEntity : public iSerializable {
cVector3f mvSize;
};
-typedef Hpl1::std::map<tString, cAreaEntity *> tAreaEntityMap;
+typedef Hpl1::Std::map<tString, cAreaEntity *> tAreaEntityMap;
typedef tAreaEntityMap::iterator tAreaEntityMapIt;
//-------------------------------------------------------------------
diff --git a/engines/hpl1/engine/sound/SoundHandler.h b/engines/hpl1/engine/sound/SoundHandler.h
index c134790a945..e9a2ed8b4e1 100644
--- a/engines/hpl1/engine/sound/SoundHandler.h
+++ b/engines/hpl1/engine/sound/SoundHandler.h
@@ -110,7 +110,7 @@ typedef cSTLIterator<cSoundEntry, tSoundEntryList, tSoundEntryListIt> tSoundEntr
//----------------------------------------
-typedef Hpl1::std::map<tString, int> tPlayedSoundNumMap;
+typedef Hpl1::Std::map<tString, int> tPlayedSoundNumMap;
typedef tPlayedSoundNumMap::iterator tPlayedSoundNumMapIt;
//----------------------------------------
diff --git a/engines/hpl1/engine/system/MemoryManager.h b/engines/hpl1/engine/system/MemoryManager.h
index 41c2ea7b465..5bd19fefa25 100644
--- a/engines/hpl1/engine/system/MemoryManager.h
+++ b/engines/hpl1/engine/system/MemoryManager.h
@@ -47,7 +47,7 @@ public:
//------------------------------------
-typedef Hpl1::std::map<void *, cAllocatedPointer> tAllocatedPointerMap;
+typedef Hpl1::Std::map<void *, cAllocatedPointer> tAllocatedPointerMap;
typedef tAllocatedPointerMap::iterator tAllocatedPointerMapIt;
//------------------------------------
diff --git a/engines/hpl1/engine/system/SerializeClass.h b/engines/hpl1/engine/system/SerializeClass.h
index 4a2f3b07e12..631c323f239 100644
--- a/engines/hpl1/engine/system/SerializeClass.h
+++ b/engines/hpl1/engine/system/SerializeClass.h
@@ -277,7 +277,7 @@ private:
//-------------------------------------------------
-typedef Hpl1::std::map<Hpl1::StaticString, cSerializeSavedClass> tSerializeSavedClassMap;
+typedef Hpl1::Std::map<Hpl1::StaticString, cSerializeSavedClass> tSerializeSavedClassMap;
typedef tSerializeSavedClassMap::iterator tSerializeSavedClassMapIt;
typedef Common::List<cSerializeSavedClass *> tSerializeSavedClassList;
diff --git a/engines/hpl1/engine/system/SystemTypes.h b/engines/hpl1/engine/system/SystemTypes.h
index 2e7bbf75803..fdae6a1dd87 100644
--- a/engines/hpl1/engine/system/SystemTypes.h
+++ b/engines/hpl1/engine/system/SystemTypes.h
@@ -82,7 +82,7 @@ typedef tStringList::iterator tStringListIt;
typedef Common::Array<tString> tStringVec;
typedef tStringVec::iterator tStringVecIt;
-typedef Hpl1::std::set<tString> tStringSet;
+typedef Hpl1::Std::set<tString> tStringSet;
typedef tStringSet::iterator tStringSetIt;
//--------------------------------------------------------
@@ -94,7 +94,7 @@ typedef tWStringList::iterator tWStringListIt;
typedef Common::Array<tWString> tWStringVec;
typedef tWStringVec::iterator tWStringVecIt;
-typedef Hpl1::std::set<tWString> tWStringSet;
+typedef Hpl1::Std::set<tWString> tWStringSet;
typedef tWStringSet::iterator tWStringSetIt;
//--------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameEntity.h b/engines/hpl1/penumbra-overture/GameEntity.h
index 66fb524f3c4..81f6a2070ee 100644
--- a/engines/hpl1/penumbra-overture/GameEntity.h
+++ b/engines/hpl1/penumbra-overture/GameEntity.h
@@ -48,12 +48,12 @@ class cGameEntityScript : public iSerializable {
tString msScriptFunc;
};
-typedef Hpl1::std::map<tString, cGameEntityScript *> tGameEntityScriptMap;
+typedef Hpl1::Std::map<tString, cGameEntityScript *> tGameEntityScriptMap;
typedef tGameEntityScriptMap::iterator tGameEntityScriptMapIt;
//-----------------------------------------
-typedef Hpl1::std::map<tString, int> tGameEntityVarMap;
+typedef Hpl1::Std::map<tString, int> tGameEntityVarMap;
typedef tGameEntityVarMap::iterator tGameEntityVarMapIt;
//------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameMusicHandler.h b/engines/hpl1/penumbra-overture/GameMusicHandler.h
index 48eb99c62dd..10e59029c73 100644
--- a/engines/hpl1/penumbra-overture/GameMusicHandler.h
+++ b/engines/hpl1/penumbra-overture/GameMusicHandler.h
@@ -58,7 +58,7 @@ private:
//----------------------------------------
-typedef Hpl1::std::set<iGameEnemy *> tAttackerSet;
+typedef Hpl1::Std::set<iGameEnemy *> tAttackerSet;
typedef tAttackerSet::iterator tAttackerSetIt;
class cGameMusicHandler : public iUpdateable {
diff --git a/engines/hpl1/penumbra-overture/GameObject.h b/engines/hpl1/penumbra-overture/GameObject.h
index fc521f6d1be..236f00164f0 100644
--- a/engines/hpl1/penumbra-overture/GameObject.h
+++ b/engines/hpl1/penumbra-overture/GameObject.h
@@ -212,7 +212,7 @@ private:
float GetPushDist();
void UpdateAttraction(float afTimeStep);
- Hpl1::std::set<iGameEnemy *> m_setAttractedEnemies;
+ Hpl1::Std::set<iGameEnemy *> m_setAttractedEnemies;
iGameEnemy *mpCurrentAttraction;
float mfAttractCount;
diff --git a/engines/hpl1/penumbra-overture/GameTypes.h b/engines/hpl1/penumbra-overture/GameTypes.h
index d9ff8d2f3e6..0e2acbe2470 100644
--- a/engines/hpl1/penumbra-overture/GameTypes.h
+++ b/engines/hpl1/penumbra-overture/GameTypes.h
@@ -243,7 +243,7 @@ class cInventoryUseCallback : public iSerializable {
tString msFunction;
};
-typedef Hpl1::std::multimap<tString, cInventoryUseCallback *> tInventoryUseCallbackMap;
+typedef Hpl1::Std::multimap<tString, cInventoryUseCallback *> tInventoryUseCallbackMap;
typedef tInventoryUseCallbackMap::iterator tInventoryUseCallbackMapIt;
//-----------------------------------------
@@ -253,7 +253,7 @@ class cInventoryPickupCallback : public iSerializable {
tString msFunction;
};
-typedef Hpl1::std::multimap<tString, cInventoryPickupCallback *> tInventoryPickupCallbackMap;
+typedef Hpl1::Std::multimap<tString, cInventoryPickupCallback *> tInventoryPickupCallbackMap;
typedef tInventoryPickupCallbackMap::iterator tInventoryPickupCallbackMapIt;
//-----------------------------------------
@@ -281,7 +281,7 @@ public:
bool mbDeleteMe;
};
-typedef Hpl1::std::map<tString, cGameCollideScript *> tGameCollideScriptMap;
+typedef Hpl1::Std::map<tString, cGameCollideScript *> tGameCollideScriptMap;
typedef tGameCollideScriptMap::iterator tGameCollideScriptMapIt;
//---------------------------------
diff --git a/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp b/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
index 6d1afc94b8f..f83a8578478 100644
--- a/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
+++ b/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
@@ -579,7 +579,7 @@ void cHudModel_WeaponMelee::Attack() {
}
}
- Hpl1::std::set<iPhysicsBody *> m_setHitBodies;
+ Hpl1::Std::set<iPhysicsBody *> m_setHitBodies;
////////////////////////////////
// Iterate bodies
diff --git a/engines/hpl1/penumbra-overture/Inventory.h b/engines/hpl1/penumbra-overture/Inventory.h
index ea20cb6c37e..35ed11e2142 100644
--- a/engines/hpl1/penumbra-overture/Inventory.h
+++ b/engines/hpl1/penumbra-overture/Inventory.h
@@ -184,7 +184,7 @@ private:
int mlCount;
};
-typedef Hpl1::std::multimap<tString, cInventoryItem *> tInventoryItemMap;
+typedef Hpl1::Std::multimap<tString, cInventoryItem *> tInventoryItemMap;
typedef tInventoryItemMap::iterator tInventoryItemMapIt;
//-----------------------------------------
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 22f8c36458a..92d2c30d463 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -2328,7 +2328,7 @@ public:
cDate mDate;
};
-typedef Hpl1::std::set<cTempFileAndData, Common::Greater<cTempFileAndData> > tTempFileAndDataSet;
+typedef Hpl1::Std::set<cTempFileAndData, Common::Greater<cTempFileAndData> > tTempFileAndDataSet;
typedef tTempFileAndDataSet::iterator tTempFileAndDataSetIt;
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/MapHandler.h b/engines/hpl1/penumbra-overture/MapHandler.h
index da7acf9d09c..e5f8810498d 100644
--- a/engines/hpl1/penumbra-overture/MapHandler.h
+++ b/engines/hpl1/penumbra-overture/MapHandler.h
@@ -44,7 +44,7 @@ class cSavedWorld;
class cGameTimer;
class cGameItem;
-typedef Hpl1::std::multimap<tString, iGameEntity *> tGameEntityMap;
+typedef Hpl1::Std::multimap<tString, iGameEntity *> tGameEntityMap;
typedef tGameEntityMap::iterator tGameEntityMapIt;
typedef Common::Array<iGameEntity *> tGameEntityVec;
diff --git a/engines/hpl1/penumbra-overture/PlayerHands.h b/engines/hpl1/penumbra-overture/PlayerHands.h
index f68dfcc460c..ef4fcff5eea 100644
--- a/engines/hpl1/penumbra-overture/PlayerHands.h
+++ b/engines/hpl1/penumbra-overture/PlayerHands.h
@@ -151,7 +151,7 @@ public:
//------------------------------------------------
-typedef Hpl1::std::map<tString, iHudModel *> tHudModelMap;
+typedef Hpl1::Std::map<tString, iHudModel *> tHudModelMap;
typedef tHudModelMap::iterator tHudModelMapIt;
//------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp b/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
index 6a797f103e8..f634df4b0ee 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
@@ -841,7 +841,7 @@ bool cPlayerState_WeaponMeleeHaptX::CheckAttack(const cMatrixf &a_mtxTransform,
}
}
- Hpl1::std::set<iPhysicsBody *> m_setHitBodies;
+ Hpl1::Std::set<iPhysicsBody *> m_setHitBodies;
////////////////////////////////
// Iterate bodies
diff --git a/engines/hpl1/penumbra-overture/TriggerHandler.h b/engines/hpl1/penumbra-overture/TriggerHandler.h
index 5ca727f6f33..c7120f80f42 100644
--- a/engines/hpl1/penumbra-overture/TriggerHandler.h
+++ b/engines/hpl1/penumbra-overture/TriggerHandler.h
@@ -66,7 +66,7 @@ private:
float mfRadius;
};
-typedef Hpl1::std::multimap<int, cGameTrigger *, Common::Greater<int> > tGameTriggerMap;
+typedef Hpl1::Std::multimap<int, cGameTrigger *, Common::Greater<int> > tGameTriggerMap;
typedef tGameTriggerMap::iterator tGameTriggerMapIt;
//----------------------------------------
diff --git a/engines/hpl1/std/map.h b/engines/hpl1/std/map.h
index 8f05a1e62cd..477cf8254a2 100644
--- a/engines/hpl1/std/map.h
+++ b/engines/hpl1/std/map.h
@@ -26,7 +26,7 @@
#include "hpl1/std/pair.h"
namespace Hpl1 {
-namespace std {
+namespace Std {
template<class Key, class Val, class CompFunc = Common::Less<Key> >
class map {
@@ -138,7 +138,7 @@ public:
return it;
}
- std::pair<iterator, bool> insert(const value_type &val) {
+ pair<iterator, bool> insert(const value_type &val) {
if (_items.begin() == nullptr) {
_items.push_back(val);
return {_items.begin(), true};
@@ -185,7 +185,7 @@ private:
CompFunc _comp;
};
-} // namespace std
+} // namespace Std
} // namespace Hpl1
-#endif
\ No newline at end of file
+#endif
diff --git a/engines/hpl1/std/multimap.h b/engines/hpl1/std/multimap.h
index 2feefd195b8..e0ca492b9f3 100644
--- a/engines/hpl1/std/multimap.h
+++ b/engines/hpl1/std/multimap.h
@@ -27,7 +27,7 @@
namespace Hpl1 {
-namespace std {
+namespace Std {
template<class Key, class Val, class CompFunc = Common::Less<Key> >
class multimap {
@@ -165,7 +165,7 @@ private:
CompFunc _comp;
};
-} // namespace std
+} // namespace Std
} // namespace Hpl1
-#endif
\ No newline at end of file
+#endif
diff --git a/engines/hpl1/std/multiset.h b/engines/hpl1/std/multiset.h
index 2d3a780dfaa..c414f6f1c9f 100644
--- a/engines/hpl1/std/multiset.h
+++ b/engines/hpl1/std/multiset.h
@@ -25,7 +25,7 @@
#include "hpl1/std/set.h"
namespace Hpl1 {
-namespace std {
+namespace Std {
template<typename T, typename Comp>
using multiset = set<T, Comp>;
@@ -34,4 +34,4 @@ using multiset = set<T, Comp>;
}
-#endif
\ No newline at end of file
+#endif
diff --git a/engines/hpl1/std/pair.h b/engines/hpl1/std/pair.h
index 4709bf57d36..c4ad76bb54e 100644
--- a/engines/hpl1/std/pair.h
+++ b/engines/hpl1/std/pair.h
@@ -23,7 +23,7 @@
#define HPL1_STD_PAIR_H
namespace Hpl1 {
-namespace std {
+namespace Std {
template<typename T1, typename T2>
struct pair {
@@ -33,8 +33,8 @@ struct pair {
T2 second;
};
-} // namespace std
+} // namespace Std
} // namespace Hpl1
-#endif
\ No newline at end of file
+#endif
diff --git a/engines/hpl1/std/set.h b/engines/hpl1/std/set.h
index 74c6c54a470..5a02cd9a3cf 100644
--- a/engines/hpl1/std/set.h
+++ b/engines/hpl1/std/set.h
@@ -25,10 +25,10 @@
#include "common/array.h"
namespace Hpl1 {
-namespace std {
+namespace Std {
/**
- * Derives the ScummVM SortedArray to match the std::set class
+ * Derives the ScummVM SortedArray to match the Std::set class
*/
template<class T, class Comparitor = Common::Less<T> >
class set : public Common::SortedArray<T, const T &> {
@@ -120,7 +120,7 @@ public:
}
};
-} // namespace std
+} // namespace Std
} // namespace Hpl1
-#endif
\ No newline at end of file
+#endif
Commit: 53e37dc6ad1b2f6a57b0f0edaa5f38245a7792e7
https://github.com/scummvm/scummvm/commit/53e37dc6ad1b2f6a57b0f0edaa5f38245a7792e7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:21+01:00
Commit Message:
HPL1: Remove system-wide includes and removed std:: usage
Changed paths:
engines/hpl1/engine/game/SaveGame.h
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/math/MathTypes.h
diff --git a/engines/hpl1/engine/game/SaveGame.h b/engines/hpl1/engine/game/SaveGame.h
index 6c6b10e05e7..596fc3b7f7e 100644
--- a/engines/hpl1/engine/game/SaveGame.h
+++ b/engines/hpl1/engine/game/SaveGame.h
@@ -28,8 +28,6 @@
#ifndef HPL_SAVE_GAME_H
#define HPL_SAVE_GAME_H
-#include <cassert>
-
#include "hpl1/engine/system/SerializeClass.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "hpl1/std/map.h"
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index 5280a377d07..8c1235a315d 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -25,7 +25,6 @@
* This file is part of HPL1 Engine.
*/
-#include <limits.h>
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/hpl1.h"
@@ -363,9 +362,9 @@ float cMath::GetFraction(float afVal) {
//-----------------------------------------------------------------------
float cMath::Modulus(float afDividend, float afDivisor) {
- float fNum = std::floor(std::abs(afDividend / afDivisor));
+ float fNum = floor(ABS(afDividend / afDivisor));
- float fRemain = std::abs(afDividend) - std::abs(afDivisor) * fNum;
+ float fRemain = ABS(afDividend) - ABS(afDivisor) * fNum;
return fRemain;
}
@@ -383,7 +382,7 @@ float cMath::Wrap(float afX, float afMin, float afMax) {
afMin = 0;
afX = afX - fOffSet;
- float fNumOfMax = std::floor(std::abs(afX / afMax));
+ float fNumOfMax = floor(std::abs(afX / afMax));
if (afX >= afMax)
afX = afX - fNumOfMax * afMax;
diff --git a/engines/hpl1/engine/math/MathTypes.h b/engines/hpl1/engine/math/MathTypes.h
index fbe0bb21d17..90443524171 100644
--- a/engines/hpl1/engine/math/MathTypes.h
+++ b/engines/hpl1/engine/math/MathTypes.h
@@ -32,7 +32,6 @@
#include "hpl1/engine/math/Vector2.h"
#include "hpl1/engine/math/Vector3.h"
#include "hpl1/engine/system/SystemTypes.h"
-#include <cmath>
#include "common/array.h"
#include "common/list.h"
Commit: ed26bf20585f945fa0dc83a69f2d8368c7d3bcba
https://github.com/scummvm/scummvm/commit/ed26bf20585f945fa0dc83a69f2d8368c7d3bcba
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:21+01:00
Commit Message:
HPL1: Fix more warnings
Changed paths:
engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
engines/hpl1/penumbra-overture/Init.cpp
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp b/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
index 33697fdd508..69c85e32802 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
@@ -694,8 +694,8 @@ void cGameEnemy_Worm::OnUpdate(float afTimeStep) {
// Calculate direction vectors
if (vMovement.SqrLength() > 0.00001f)
mvRootGoalForward = cMath::Vector3Normalize(vMovement);
- else
- mvRootGoalForward = mvRootGoalForward;
+ //else
+ // mvRootGoalForward = mvRootGoalForward;
// Rotate vectors to get closer to goal
{
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 8d05e64b261..754414ab193 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -188,8 +188,8 @@ bool CheckSupport(cInit *apInit) {
// CONSTRUCTORS
//////////////////////////////////////////////////////////////////////////
-tWString gsUserSettingsPath = _W("");
-tWString gsDefaultSettingsPath = _W("config/default_settings.cfg");
+#define gsUserSettingsPath _W("")
+#define gsDefaultSettingsPath _W("config/default_settings.cfg")
bool gbUsingUserSettings = false;
//-----------------------------------------------------------------------
Commit: d136002e3eea1eb55217704031f5320c2cee0506
https://github.com/scummvm/scummvm/commit/d136002e3eea1eb55217704031f5320c2cee0506
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:21+01:00
Commit Message:
HPL1: remove unused files
Changed paths:
R engines/hpl1/engine/math/CRC.cpp
R engines/hpl1/engine/math/CRC.h
engines/hpl1/engine/engine.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index 44fb1f19000..68aea369b46 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -135,7 +135,6 @@
#include "hpl1/engine/input/LowLevelInput.h"
#include "hpl1/engine/input/Mouse.h"
#include "hpl1/engine/math/BoundingVolume.h"
-#include "hpl1/engine/math/CRC.h"
#include "hpl1/engine/math/Frustum.h"
#include "hpl1/engine/math/Math.h"
#include "hpl1/engine/math/MathTypes.h"
diff --git a/engines/hpl1/engine/math/CRC.cpp b/engines/hpl1/engine/math/CRC.cpp
deleted file mode 100644
index 78aab5b374f..00000000000
--- a/engines/hpl1/engine/math/CRC.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#include "hpl1/engine/math/CRC.h"
-
-//----------------------------------------
-
-namespace hpl {
-
-cCRCTable cCRC::mTable;
-
-void cCRCTable::Init(tCRCKey aKey) {
- if (aKey == mKey)
- return;
-
- mKey = aKey;
-
- // for all possible byte values
- for (unsigned i = 0; i < 256; ++i) {
- tCRCKey reg = i << 24;
- // for all bits in a byte
- for (int j = 0; j < 8; ++j) {
- bool topBit = (reg & 0x80000000) != 0;
- reg <<= 1;
- if (topBit)
- reg ^= mKey;
- }
- mTable[i] = reg;
- }
-}
-
-//----------------------------------------
-
-void cCRC::PutByte(unsigned aByte) {
- unsigned top = mRegister >> 24;
- top ^= aByte;
- mRegister = (mRegister << 8) ^ mTable[top];
-}
-
-//----------------------------------------
-} // namespace hpl
diff --git a/engines/hpl1/engine/math/CRC.h b/engines/hpl1/engine/math/CRC.h
deleted file mode 100644
index 323f92553f3..00000000000
--- a/engines/hpl1/engine/math/CRC.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_CRC_H
-#define HPL_CRC_H
-
-namespace hpl {
-//----------------------------------------
-
-typedef unsigned long tCRCKey;
-
-//----------------------------------------
-
-class cCRCTable {
-public:
- cCRCTable() : mKey(0) {}
-
- void Init(tCRCKey key);
-
- tCRCKey operator[](unsigned i) { return mTable[i]; }
-
-private:
- tCRCKey mTable[256];
- tCRCKey mKey;
-};
-
-//----------------------------------------
-
-class cCRC {
-public:
- cCRC(tCRCKey key) : mRegister(0) {
- mTable.Init(key);
- }
-
- void PutByte(unsigned aByte);
-
- tCRCKey Done() {
- tCRCKey temp = mRegister;
- mRegister = 0;
- return temp;
- }
-
-private:
- static cCRCTable mTable;
- tCRCKey mRegister;
-};
-
-//----------------------------------------
-} // namespace hpl
-
-#endif // HPL_CRC_H
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index f657ca3ecaf..2f5e355670f 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -140,7 +140,6 @@ MODULE_OBJS := \
engine/input/Keyboard.o \
engine/input/Mouse.o \
engine/math/BoundingVolume.o \
- engine/math/CRC.o \
engine/math/Frustum.o \
engine/math/Math.o \
engine/math/MathTypes.o \
Commit: 14c9853dd8ae5ae1c37f3f18695498c15b8a94a2
https://github.com/scummvm/scummvm/commit/14c9853dd8ae5ae1c37f3f18695498c15b8a94a2
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:21+01:00
Commit Message:
HPL1: make Vector3 constructors constexpr
Changed paths:
engines/hpl1/engine/math/Vector3.h
diff --git a/engines/hpl1/engine/math/Vector3.h b/engines/hpl1/engine/math/Vector3.h
index 5755ff40a37..991a35acdfd 100644
--- a/engines/hpl1/engine/math/Vector3.h
+++ b/engines/hpl1/engine/math/Vector3.h
@@ -39,32 +39,17 @@ class cVector3 {
public:
T x, y, z;
- cVector3() {
- x = 0;
- y = 0;
- z = 0;
+ constexpr cVector3() : x(0), y(0), z(0) {
}
- cVector3(T aVal) {
- x = aVal;
- y = aVal;
- z = aVal;
+ constexpr cVector3(T aVal) : x(aVal), y(aVal), z(aVal) {
}
- cVector3(T aX, T aY, T aZ) {
- x = aX;
- y = aY;
- z = aZ;
+ constexpr cVector3(T aX, T aY, T aZ) : x(aX), y(aY), z(aZ) {
}
- cVector3(cVector3<T> const &aVec) {
- x = aVec.x;
- y = aVec.y;
- z = aVec.z;
+ constexpr cVector3(cVector3<T> const &aVec) : x(aVec.x), y(aVec.y), z(aVec.z) {
}
- cVector3(cVector2<T> const &aVec) {
- x = aVec.x;
- y = aVec.y;
- z = 0;
+ constexpr cVector3(cVector2<T> const &aVec) : x(aVec.x), y(aVec.y), z(0) {
}
static cVector3 fromArray(const float vec[3]) {
Commit: 286cfc695cd60cd4f6a6c2d4243346dae6d31c83
https://github.com/scummvm/scummvm/commit/286cfc695cd60cd4f6a6c2d4243346dae6d31c83
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:21+01:00
Commit Message:
HPL1: fix global constructors warnings
Changed paths:
engines/hpl1/engine/math/BoundingVolume.cpp
engines/hpl1/engine/math/MeshTypes.h
diff --git a/engines/hpl1/engine/math/BoundingVolume.cpp b/engines/hpl1/engine/math/BoundingVolume.cpp
index 4173df593d7..1dbb3d921e1 100644
--- a/engines/hpl1/engine/math/BoundingVolume.cpp
+++ b/engines/hpl1/engine/math/BoundingVolume.cpp
@@ -32,7 +32,7 @@
namespace hpl {
-static const cTriEdge kvBVEdges[12] = {
+static constexpr cTriEdge kvBVEdges[12] = {
cTriEdge(1, 0, 0, 2),
cTriEdge(3, 1, 0, 5),
cTriEdge(2, 3, 0, 3),
@@ -48,7 +48,7 @@ static const cTriEdge kvBVEdges[12] = {
cTriEdge(1, 5, 2, 5),
cTriEdge(3, 7, 5, 3)};
-static cTriangleData gvFaces[6] = {
+static constexpr cVector3f globalNormals[6] = {
cVector3f(1, 0, 0),
cVector3f(-1, 0, 0),
@@ -58,6 +58,8 @@ static cTriangleData gvFaces[6] = {
cVector3f(0, 0, 1),
cVector3f(0, 0, -1)};
+static bool globalfacingLight[6] = {false, false, false, false, false, false};
+
static const int kvFacePoints[6] = {0, 5, 5, 6, 4, 7};
//////////////////////////////////////////////////////////////////////////
@@ -289,13 +291,13 @@ cShadowVolumeBV *cBoundingVolume::GetShadowVolume(const cVector3f &avLightPos,
//int lNearPoint = -1;
mShadowVolume.mlPlaneCount = 0;
for (int face = 0; face < 6; face++) {
- gvFaces[face].facingLight = cMath::Vector3Dot(gvFaces[face].normal,
+ globalfacingLight[face] = cMath::Vector3Dot(globalNormals[face],
vCorners[kvFacePoints[face]] - avLightPos) < 0;
// Get a point for the near plane. (any edge point will do)
- if (gvFaces[face].facingLight) {
+ if (globalfacingLight[face]) {
mShadowVolume.mvPlanes[mShadowVolume.mlPlaneCount] = cPlanef(
- gvFaces[face].normal * -1.0f, vCorners[kvFacePoints[face]]);
+ globalNormals[face] * -1.0f, vCorners[kvFacePoints[face]]);
mShadowVolume.mlPlaneCount++;
}
}
@@ -313,11 +315,11 @@ cShadowVolumeBV *cBoundingVolume::GetShadowVolume(const cVector3f &avLightPos,
for (int edge = 0; edge < 12; edge++) {
const cTriEdge &Edge = kvBVEdges[edge];
- cTriangleData &Face1 = gvFaces[Edge.tri1];
- cTriangleData &Face2 = gvFaces[Edge.tri2];
+ const bool facingLight1 = globalfacingLight[Edge.tri1];
+ const bool facingLight2 = globalfacingLight[Edge.tri2];
- if ((Face1.facingLight && !Face2.facingLight) || (Face2.facingLight && !Face1.facingLight)) {
- if (Face1.facingLight) {
+ if ((facingLight1 && !facingLight2) || (facingLight2 && !facingLight1)) {
+ if (facingLight1) {
mShadowVolume.mvPoints.push_back(vCorners[Edge.point1]);
mShadowVolume.mvPoints.push_back(vCorners[Edge.point2]);
diff --git a/engines/hpl1/engine/math/MeshTypes.h b/engines/hpl1/engine/math/MeshTypes.h
index f9c25b9fa38..c2db71c81dc 100644
--- a/engines/hpl1/engine/math/MeshTypes.h
+++ b/engines/hpl1/engine/math/MeshTypes.h
@@ -57,12 +57,9 @@ public:
mutable int tri1, tri2;
bool invert_tri2;
- cTriEdge() {}
- cTriEdge(int alPoint1, int alPoint2, int alTri1, int alTri2) {
- point1 = alPoint1;
- point2 = alPoint2;
- tri1 = alTri1;
- tri2 = alTri2;
+ cTriEdge() = default;
+ constexpr cTriEdge(int alPoint1, int alPoint2, int alTri1, int alTri2) :
+ point1(alPoint1), point2(alPoint2), tri1(alTri1), tri2(alTri2), invert_tri2(false) {
}
};
@@ -71,6 +68,6 @@ typedef tTriEdgeVec::iterator tTriEdgeVecIt;
//----------------------------------------------
-} // namespace hpl
+} // namespace hpl
#endif // HPL_MESH_TYPES_H
Commit: 42f30493ee06cd3e2bbe99124529071ef7c39804
https://github.com/scummvm/scummvm/commit/42f30493ee06cd3e2bbe99124529071ef7c39804
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:21+01:00
Commit Message:
HPL1: make Matrix constructor constexpr
Changed paths:
engines/hpl1/engine/math/hplMatrix.h
diff --git a/engines/hpl1/engine/math/hplMatrix.h b/engines/hpl1/engine/math/hplMatrix.h
index f8c51207f3e..76b2ef595db 100644
--- a/engines/hpl1/engine/math/hplMatrix.h
+++ b/engines/hpl1/engine/math/hplMatrix.h
@@ -78,27 +78,15 @@ public:
//-----------------------------------------------------------------------
- inline cMatrix(
+ inline constexpr cMatrix(
T a00, T a01, T a02, T a03,
T a10, T a11, T a12, T a13,
T a20, T a21, T a22, T a23,
- T a30, T a31, T a32, T a33) {
- m[0][0] = a00;
- m[0][1] = a01;
- m[0][2] = a02;
- m[0][3] = a03;
- m[1][0] = a10;
- m[1][1] = a11;
- m[1][2] = a12;
- m[1][3] = a13;
- m[2][0] = a20;
- m[2][1] = a21;
- m[2][2] = a22;
- m[2][3] = a23;
- m[3][0] = a30;
- m[3][1] = a31;
- m[3][2] = a32;
- m[3][3] = a33;
+ T a30, T a31, T a32, T a33) : m{
+ {a00, a01, a02, a03},
+ {a10, a11, a12, a13},
+ {a20, a21, a22, a23},
+ {a30, a31, a32, a33}} {
}
static const cMatrix<T> Identity;
Commit: 5cce4db80887cc8f691d1f682a2e6b88795aa98a
https://github.com/scummvm/scummvm/commit/5cce4db80887cc8f691d1f682a2e6b88795aa98a
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:21+01:00
Commit Message:
HPL1: fix warnings
Changed paths:
engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
engines/hpl1/engine/scene/Light3DSpot.cpp
diff --git a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
index 640cd94535c..e9ace5d7ac5 100644
--- a/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
+++ b/engines/hpl1/engine/graphics/ParticleEmitter3D_UserData.cpp
@@ -430,7 +430,6 @@ bool cParticleEmitterData3D_UserData::CheckCollision(const cVector3f &avStart,
iPhysicsWorld *apPhysicsWorld,
cVector3f *apNormalVec,
cVector3f *apPosVec) {
- cVector3f vNormal;
mfShortestDist = 99999.0f;
mbIntersected = false;
diff --git a/engines/hpl1/engine/scene/Light3DSpot.cpp b/engines/hpl1/engine/scene/Light3DSpot.cpp
index da790c3f715..681958ff6a7 100644
--- a/engines/hpl1/engine/scene/Light3DSpot.cpp
+++ b/engines/hpl1/engine/scene/Light3DSpot.cpp
@@ -45,7 +45,7 @@
namespace hpl {
-static const cMatrixf g_mtxTextureUnitFix(0.5f, 0, 0, 0.5f,
+static constexpr cMatrixf g_mtxTextureUnitFix(0.5f, 0, 0, 0.5f,
0, -0.5f, 0, 0.5f,
0, 0, 0.5f, 0.5f,
0, 0, 0, 1.0f);
Commit: 4eaa2688d014dd4467f601ef3037d9937c7daf51
https://github.com/scummvm/scummvm/commit/4eaa2688d014dd4467f601ef3037d9937c7daf51
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:22+01:00
Commit Message:
HPL1: make Quaternion constructor constexpr
Changed paths:
engines/hpl1/engine/math/Quaternion.cpp
engines/hpl1/engine/math/Quaternion.h
diff --git a/engines/hpl1/engine/math/Quaternion.cpp b/engines/hpl1/engine/math/Quaternion.cpp
index 8fc46d1b4cb..9a71be83349 100644
--- a/engines/hpl1/engine/math/Quaternion.cpp
+++ b/engines/hpl1/engine/math/Quaternion.cpp
@@ -47,13 +47,6 @@ cQuaternion::cQuaternion(float afAngle, const cVector3f &avAxis) {
FromAngleAxis(afAngle, avAxis);
}
-cQuaternion::cQuaternion(float afW, float afX, float afY, float afZ) {
- w = afW;
- v.x = afX;
- v.y = afY;
- v.z = afZ;
-}
-
//-----------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/hpl1/engine/math/Quaternion.h b/engines/hpl1/engine/math/Quaternion.h
index 425651a8f47..443216b776f 100644
--- a/engines/hpl1/engine/math/Quaternion.h
+++ b/engines/hpl1/engine/math/Quaternion.h
@@ -40,7 +40,8 @@ public:
cQuaternion();
cQuaternion(float afAngle, const cVector3<float> &avAxis);
- cQuaternion(float afW, float afX, float afY, float afZ);
+ constexpr cQuaternion(float afW, float afX, float afY, float afZ) : v(afX, afY, afZ), w(afW) {
+ }
void Normalise();
void ToRotationMatrix(cMatrix<float> &a_mtxDest) const;
Commit: f7026c047ca56d508182b224678a822051864432
https://github.com/scummvm/scummvm/commit/f7026c047ca56d508182b224678a822051864432
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:22+01:00
Commit Message:
HPL1: Remove usage of std::abs
Changed paths:
engines/hpl1/engine/graphics/MeshCreator.cpp
engines/hpl1/engine/graphics/RenderState.cpp
engines/hpl1/engine/graphics/Renderer2D.cpp
engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
engines/hpl1/engine/math/Frustum.cpp
engines/hpl1/engine/math/Math.cpp
engines/hpl1/engine/math/MathTypes.h
engines/hpl1/engine/physics/CharacterBody.cpp
engines/hpl1/engine/physics/Collider2D.cpp
engines/hpl1/engine/physics/PhysicsController.cpp
engines/hpl1/engine/physics/PhysicsJoint.cpp
engines/hpl1/engine/physics/PhysicsWorld.cpp
engines/hpl1/engine/physics/SurfaceData.cpp
engines/hpl1/engine/scene/AnimationState.cpp
engines/hpl1/engine/scene/Camera2D.cpp
engines/hpl1/engine/scene/ImageEntity.cpp
engines/hpl1/engine/sound/SoundHandler.cpp
engines/hpl1/penumbra-overture/CharacterMove.cpp
engines/hpl1/penumbra-overture/GameEnemy.cpp
engines/hpl1/penumbra-overture/GameEntity.cpp
engines/hpl1/penumbra-overture/GameObject.cpp
engines/hpl1/penumbra-overture/GameSwingDoor.cpp
engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
diff --git a/engines/hpl1/engine/graphics/MeshCreator.cpp b/engines/hpl1/engine/graphics/MeshCreator.cpp
index c54b6d98f20..dcaf57b52f0 100644
--- a/engines/hpl1/engine/graphics/MeshCreator.cpp
+++ b/engines/hpl1/engine/graphics/MeshCreator.cpp
@@ -91,7 +91,7 @@ iVertexBuffer *cMeshCreator::CreateSkyBoxVertexBuffer(float afSize) {
for (int z = -1; z <= 1; z++) {
if (x == 0 && y == 0 && z == 0)
continue;
- if (std::abs(x) + std::abs(y) + std::abs(z) > 1)
+ if (ABS(x) + ABS(y) + ABS(z) > 1)
continue;
// Direction (could say inverse normal) of the quad.
@@ -99,7 +99,7 @@ iVertexBuffer *cMeshCreator::CreateSkyBoxVertexBuffer(float afSize) {
cVector3f vSide;
cVector3f vAdd[4];
- if (std::abs(x)) {
+ if (ABS(x)) {
vDir.x = (float)x;
vAdd[0].y = 1;
@@ -110,7 +110,7 @@ iVertexBuffer *cMeshCreator::CreateSkyBoxVertexBuffer(float afSize) {
vAdd[2].z = -1;
vAdd[3].y = 1;
vAdd[3].z = -1;
- } else if (std::abs(y)) {
+ } else if (ABS(y)) {
vDir.y = (float)y;
vAdd[0].z = 1;
@@ -121,7 +121,7 @@ iVertexBuffer *cMeshCreator::CreateSkyBoxVertexBuffer(float afSize) {
vAdd[2].x = -1;
vAdd[3].z = 1;
vAdd[3].x = -1;
- } else if (std::abs(z)) {
+ } else if (ABS(z)) {
vAdd[0].y = 1;
vAdd[0].x = 1;
vAdd[1].y = 1;
@@ -177,7 +177,7 @@ iVertexBuffer *cMeshCreator::CreateBoxVertexBuffer(cVector3f avSize) {
for (int z = -1; z <= 1; z++) {
if (x == 0 && y == 0 && z == 0)
continue;
- if (std::abs(x) + std::abs(y) + std::abs(z) > 1)
+ if (ABS(x) + ABS(y) + ABS(z) > 1)
continue;
// Direction (could say inverse normal) of the quad.
@@ -185,7 +185,7 @@ iVertexBuffer *cMeshCreator::CreateBoxVertexBuffer(cVector3f avSize) {
cVector3f vSide;
cVector3f vAdd[4];
- if (std::abs(x)) {
+ if (ABS(x)) {
vDir.x = (float)x;
vAdd[0].y = 1;
@@ -196,7 +196,7 @@ iVertexBuffer *cMeshCreator::CreateBoxVertexBuffer(cVector3f avSize) {
vAdd[2].z = -1;
vAdd[3].y = 1;
vAdd[3].z = -1;
- } else if (std::abs(y)) {
+ } else if (ABS(y)) {
vDir.y = (float)y;
vAdd[0].z = 1;
@@ -207,7 +207,7 @@ iVertexBuffer *cMeshCreator::CreateBoxVertexBuffer(cVector3f avSize) {
vAdd[2].x = -1;
vAdd[3].z = 1;
vAdd[3].x = -1;
- } else if (std::abs(z)) {
+ } else if (ABS(z)) {
vAdd[0].y = 1;
vAdd[0].x = 1;
vAdd[1].y = 1;
@@ -259,13 +259,13 @@ iVertexBuffer *cMeshCreator::CreateBoxVertexBuffer(cVector3f avSize) {
cVector3f cMeshCreator::GetBoxTex(int i, int x, int y, int z, cVector3f *vAdd) {
cVector3f vTex;
- if (std::abs(x)) {
+ if (ABS(x)) {
vTex.x = vAdd[i].z;
vTex.y = vAdd[i].y;
- } else if (std::abs(y)) {
+ } else if (ABS(y)) {
vTex.x = vAdd[i].x;
vTex.y = vAdd[i].z;
- } else if (std::abs(z)) {
+ } else if (ABS(z)) {
vTex.x = vAdd[i].x;
vTex.y = vAdd[i].y;
}
diff --git a/engines/hpl1/engine/graphics/RenderState.cpp b/engines/hpl1/engine/graphics/RenderState.cpp
index b1a00031293..7ccf4d5020f 100644
--- a/engines/hpl1/engine/graphics/RenderState.cpp
+++ b/engines/hpl1/engine/graphics/RenderState.cpp
@@ -641,7 +641,7 @@ int iRenderState::CompareDepthTest(const iRenderState *apState) const {
//-----------------------------------------------------------------------
int iRenderState::CompareDepth(const iRenderState *apState) const {
- if (std::abs(mfZ - apState->mfZ) < 0.00001f)
+ if (ABS(mfZ - apState->mfZ) < 0.00001f)
return 0;
else
return mfZ < apState->mfZ ? 1 : -1;
diff --git a/engines/hpl1/engine/graphics/Renderer2D.cpp b/engines/hpl1/engine/graphics/Renderer2D.cpp
index 639fb55efa8..d59623d6c63 100644
--- a/engines/hpl1/engine/graphics/Renderer2D.cpp
+++ b/engines/hpl1/engine/graphics/Renderer2D.cpp
@@ -722,22 +722,22 @@ cVector2f cRenderer2D::CalcLineEnd(cVector3f avLight, cVector3f avPoint, float a
else
kX = dX / dY;
- if (std::abs(dX) <= std::abs(dY) && dY > 0) {
+ if (ABS(dX) <= ABS(dY) && dY > 0) {
vEndPos.y = avClipPos.y + vSize.y;
float A = avPoint.y - kY * avPoint.x;
vEndPos.x = (vEndPos.y - A) / kY;
avSide.y = 1;
- } else if (std::abs(dX) <= std::abs(dY) && dY <= 0) {
+ } else if (ABS(dX) <= ABS(dY) && dY <= 0) {
vEndPos.y = avClipPos.y - vSize.y;
float A = avPoint.y - kY * avPoint.x;
vEndPos.x = (vEndPos.y - A) / kY;
avSide.y = -1;
- } else if (std::abs(dX) > std::abs(dY) && dX > 0) {
+ } else if (ABS(dX) > ABS(dY) && dX > 0) {
vEndPos.x = avClipPos.x + vSize.y;
float A = avPoint.x - kX * avPoint.y;
vEndPos.y = (vEndPos.x - A) / kX;
avSide.x = 1;
- } else if (std::abs(dX) > std::abs(dY) && dX <= 0) {
+ } else if (ABS(dX) > ABS(dY) && dX <= 0) {
vEndPos.x = avClipPos.x - vSize.y;
float A = avPoint.x - kX * avPoint.y;
vEndPos.y = (vEndPos.x - A) / kX;
diff --git a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
index cdeda481515..0a5b5ec17e2 100644
--- a/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsMaterialNewton.cpp
@@ -276,9 +276,9 @@ bool ContactProcessor::processNext() {
// Tangent speed
float fTanSpeed0 = NewtonMaterialGetContactTangentSpeed(_material, 0);
float fTanSpeed1 = NewtonMaterialGetContactTangentSpeed(_material, 1);
- if (std::abs(_contactData.mfMaxContactTangentSpeed) < std::abs(fTanSpeed0))
+ if (ABS(_contactData.mfMaxContactTangentSpeed) < ABS(fTanSpeed0))
_contactData.mfMaxContactTangentSpeed = fTanSpeed0;
- if (std::abs(_contactData.mfMaxContactTangentSpeed) < std::abs(fTanSpeed1))
+ if (ABS(_contactData.mfMaxContactTangentSpeed) < ABS(fTanSpeed1))
_contactData.mfMaxContactTangentSpeed = fTanSpeed1;
// Force
@@ -322,22 +322,22 @@ void ContactProcessor::endProcessing() {
int lPrio2 = pMaterial2->GetSurfaceData()->GetPriority();
if (lPrio1 >= lPrio2) {
- if (std::abs(_contactData.mfMaxContactNormalSpeed) > 0)
+ if (ABS(_contactData.mfMaxContactNormalSpeed) > 0)
pMaterial1->GetSurfaceData()->OnImpact(_contactData.mfMaxContactNormalSpeed,
_contactData.mvContactPosition,
_contacts, _contactBody0);
- if (std::abs(_contactData.mfMaxContactTangentSpeed) > 0)
+ if (ABS(_contactData.mfMaxContactTangentSpeed) > 0)
pMaterial1->GetSurfaceData()->OnSlide(_contactData.mfMaxContactTangentSpeed,
_contactData.mvContactPosition,
_contacts, _contactBody0, _contactBody1);
}
if (lPrio2 >= lPrio1 && pMaterial2 != pMaterial1) {
- if (std::abs(_contactData.mfMaxContactNormalSpeed) > 0)
+ if (ABS(_contactData.mfMaxContactNormalSpeed) > 0)
pMaterial2->GetSurfaceData()->OnImpact(_contactData.mfMaxContactNormalSpeed,
_contactData.mvContactPosition,
_contacts, _contactBody1);
- if (std::abs(_contactData.mfMaxContactTangentSpeed) > 0)
+ if (ABS(_contactData.mfMaxContactTangentSpeed) > 0)
pMaterial2->GetSurfaceData()->OnSlide(_contactData.mfMaxContactTangentSpeed,
_contactData.mvContactPosition,
_contacts, _contactBody1, _contactBody0);
diff --git a/engines/hpl1/engine/math/Frustum.cpp b/engines/hpl1/engine/math/Frustum.cpp
index d453639fdc2..87e7a33ee10 100644
--- a/engines/hpl1/engine/math/Frustum.cpp
+++ b/engines/hpl1/engine/math/Frustum.cpp
@@ -165,7 +165,7 @@ eFrustumCollision cFrustum::CollideBVSphere(cBoundingVolume *aBV) {
return eFrustumCollision_Outside;
}
- if (std::abs(fDist) < aBV->GetRadius()) {
+ if (ABS(fDist) < aBV->GetRadius()) {
return eFrustumCollision_Intersect;
}
}
diff --git a/engines/hpl1/engine/math/Math.cpp b/engines/hpl1/engine/math/Math.cpp
index 8c1235a315d..a32796d722b 100644
--- a/engines/hpl1/engine/math/Math.cpp
+++ b/engines/hpl1/engine/math/Math.cpp
@@ -382,7 +382,7 @@ float cMath::Wrap(float afX, float afMin, float afMax) {
afMin = 0;
afX = afX - fOffSet;
- float fNumOfMax = floor(std::abs(afX / afMax));
+ float fNumOfMax = floor(ABS(afX / afMax));
if (afX >= afMax)
afX = afX - fNumOfMax * afMax;
@@ -421,12 +421,12 @@ float cMath::GetAngleDistance(float afAngle1, float afAngle2, float afMaxAngle)
return 0;
} else {
float fDist1 = afAngle2 - afAngle1;
- float fDist2 = afMaxAngle - std::abs(fDist1);
+ float fDist2 = afMaxAngle - ABS(fDist1);
if (fDist1 > 0)
fDist2 = -fDist2;
- if (std::abs(fDist1) < std::abs(fDist2))
+ if (ABS(fDist1) < ABS(fDist2))
return fDist1;
else
return fDist2;
@@ -635,7 +635,7 @@ cVector3f cMath::ProjectVector3D(const cVector3f &avSrcVec, const cVector3f &avD
float cMath::Vector3Angle(const cVector3f &avVecA, const cVector3f &avVecB) {
float fCos = Vector3Dot(avVecA, avVecB);
- if (std::abs(fCos - 1) <= kEpsilonf)
+ if (ABS(fCos - 1) <= kEpsilonf)
return 0;
return acos(fCos);
@@ -842,7 +842,7 @@ cQuaternion cMath::QuaternionSlerp(float afT, const cQuaternion &aqA, const cQua
float fCos = QuaternionDot(aqA, aqB);
// If the rotations are the same, just return the first.
- if (std::abs(fCos - 1) <= kEpsilonf) {
+ if (ABS(fCos - 1) <= kEpsilonf) {
return aqA;
}
diff --git a/engines/hpl1/engine/math/MathTypes.h b/engines/hpl1/engine/math/MathTypes.h
index 90443524171..306635b3403 100644
--- a/engines/hpl1/engine/math/MathTypes.h
+++ b/engines/hpl1/engine/math/MathTypes.h
@@ -72,8 +72,8 @@ public:
max = afMax;
val = afVal;
- up_speed = std::abs(afUpSpeed);
- down_speed = -std::abs(afDownSpeed);
+ up_speed = ABS(afUpSpeed);
+ down_speed = -ABS(afDownSpeed);
add = up_speed;
}
diff --git a/engines/hpl1/engine/physics/CharacterBody.cpp b/engines/hpl1/engine/physics/CharacterBody.cpp
index 9284bf81031..3fb35ecfe98 100644
--- a/engines/hpl1/engine/physics/CharacterBody.cpp
+++ b/engines/hpl1/engine/physics/CharacterBody.cpp
@@ -894,7 +894,7 @@ void iCharacterBody::Update(float afTimeStep) {
// if climbing there is no gravity working but we still want foot steps.
mbOnGround = true;
} else {
- if (bCollide && vLastVelocity.y <= 0 && std::abs(mvVelolcity.y) < (std::abs(vLastVelocity.y) - 0.001f)) {
+ if (bCollide && vLastVelocity.y <= 0 && ABS(mvVelolcity.y) < (ABS(vLastVelocity.y) - 0.001f)) {
if (mbOnGround == false) {
if (mpCallback)
mpCallback->OnHitGround(this, vLastVelocity);
diff --git a/engines/hpl1/engine/physics/Collider2D.cpp b/engines/hpl1/engine/physics/Collider2D.cpp
index fd7bf00733b..1a54c904428 100644
--- a/engines/hpl1/engine/physics/Collider2D.cpp
+++ b/engines/hpl1/engine/physics/Collider2D.cpp
@@ -109,13 +109,13 @@ tFlag cCollider2D::CollideBody(cBody2D *apBody, cCollideData2D *apData) {
// reverse the latest push, maybe pos here instead?
if (lCollision) {
// If the current X push is grater use it instead.
- if (std::abs(vPushVector.x) > std::abs(vLastPushVector.x)) {
+ if (ABS(vPushVector.x) > ABS(vLastPushVector.x)) {
vPos.x -= vLastPushVector.x;
} else {
bAlterX = false;
}
// If the current Y push is grater use it instead.
- if (std::abs(vPushVector.y) > std::abs(vLastPushVector.y)) {
+ if (ABS(vPushVector.y) > ABS(vLastPushVector.y)) {
vPos.y -= vLastPushVector.y;
bAlterY = true;
} else {
diff --git a/engines/hpl1/engine/physics/PhysicsController.cpp b/engines/hpl1/engine/physics/PhysicsController.cpp
index e93023a91ca..e74f9cdf101 100644
--- a/engines/hpl1/engine/physics/PhysicsController.cpp
+++ b/engines/hpl1/engine/physics/PhysicsController.cpp
@@ -118,7 +118,7 @@ void iPhysicsController::Update(float afTimeStep) {
////////////////////////////////////////
// Check if dest vale is reached
if (mEndType == ePhysicsControllerEnd_OnDest && mpJoint) {
- if (std::abs(fValue - mfDestValue) < kEpsilonf) {
+ if (ABS(fValue - mfDestValue) < kEpsilonf) {
mbActive = false;
iPhysicsController *pNext = mpJoint->GetController(msNextController);
if (pNext)
diff --git a/engines/hpl1/engine/physics/PhysicsJoint.cpp b/engines/hpl1/engine/physics/PhysicsJoint.cpp
index 9dc9b174e55..43f2409f7d5 100644
--- a/engines/hpl1/engine/physics/PhysicsJoint.cpp
+++ b/engines/hpl1/engine/physics/PhysicsJoint.cpp
@@ -276,7 +276,7 @@ void iPhysicsJoint::OnMinLimit() {
//-----------------------------------------------------------------------
void iPhysicsJoint::CalcSoundFreq(float afSpeed, float *apFreq, float *apVol) {
- float fAbsSpeed = std::abs(afSpeed);
+ float fAbsSpeed = ABS(afSpeed);
float fFreq = 1;
float fVolume = 1;
@@ -496,8 +496,8 @@ void iPhysicsJoint::CheckLimitAutoSleep(iPhysicsJoint *apJoint,
const float afMin, const float afMax,
const float afDist) {
if (apJoint->mbLimitAutoSleep) {
- float fMinDiff = std::abs(afMin - afDist);
- float fMaxDiff = std::abs(afMax - afDist);
+ float fMinDiff = ABS(afMin - afDist);
+ float fMaxDiff = ABS(afMax - afDist);
if (fMaxDiff < apJoint->mfLimitAutoSleepDist ||
fMinDiff < apJoint->mfLimitAutoSleepDist) {
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.cpp b/engines/hpl1/engine/physics/PhysicsWorld.cpp
index c3bc3ffcf9c..3378788f68e 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.cpp
+++ b/engines/hpl1/engine/physics/PhysicsWorld.cpp
@@ -388,11 +388,11 @@ bool iPhysicsWorld::CheckShapeWorldCollision(cVector3f *apNewPos,
cVector3f vPush = point.mvNormal * point.mfDepth;
- if (std::abs(vPushVec.x) < std::abs(vPush.x))
+ if (ABS(vPushVec.x) < ABS(vPush.x))
vPushVec.x = vPush.x;
- if (std::abs(vPushVec.y) < std::abs(vPush.y))
+ if (ABS(vPushVec.y) < ABS(vPush.y))
vPushVec.y = vPush.y;
- if (std::abs(vPushVec.z) < std::abs(vPush.z))
+ if (ABS(vPushVec.z) < ABS(vPush.z))
vPushVec.z = vPush.z;
}
bCollide = true;
diff --git a/engines/hpl1/engine/physics/SurfaceData.cpp b/engines/hpl1/engine/physics/SurfaceData.cpp
index c15d2b22da2..ab52f30b160 100644
--- a/engines/hpl1/engine/physics/SurfaceData.cpp
+++ b/engines/hpl1/engine/physics/SurfaceData.cpp
@@ -166,7 +166,7 @@ void cSurfaceData::OnSlide(float afSpeed, const cVector3f &avPos, int alContacts
if (apBody->GetScrapeSoundEntity() != NULL) {
// check if the sound should be stopped
float fMin = cMath::Max(mfMinScrapeSpeed - 0.7f, 0.02f);
- if (std::abs(afSpeed) < fMin) {
+ if (ABS(afSpeed) < fMin) {
apBody->GetScrapeSoundEntity()->FadeOut(4.3f);
apBody->SetScrapeSoundEntity(NULL);
apBody->SetScrapeBody(NULL);
@@ -177,7 +177,7 @@ void cSurfaceData::OnSlide(float afSpeed, const cVector3f &avPos, int alContacts
apBody->SetHasSlide(true);
// Change frequency according to speed.
- float fAbsSpeed = std::abs(afSpeed);
+ float fAbsSpeed = ABS(afSpeed);
float fFreq = 1;
// Higher than middle
@@ -213,7 +213,7 @@ void cSurfaceData::OnSlide(float afSpeed, const cVector3f &avPos, int alContacts
}
}
} else {
- if (mfMinScrapeSpeed <= std::abs(afSpeed) && msScrapeSoundName != "") {
+ if (mfMinScrapeSpeed <= ABS(afSpeed) && msScrapeSoundName != "") {
apBody->SetHasSlide(true);
cSoundEntity *pEntity = pWorld->CreateSoundEntity("Scrape",
@@ -312,15 +312,15 @@ void cSurfaceData::UpdateRollEffect(iPhysicsBody *apBody) {
float fRollingSpeed = 0;
// X
if (mRollAxisFlags & eRollAxisFlag_X)
- fRollingSpeed = std::abs(vAngularSpeed.x);
+ fRollingSpeed = ABS(vAngularSpeed.x);
// Y
if (mRollAxisFlags & eRollAxisFlag_Y)
- if (fRollingSpeed < std::abs(vAngularSpeed.y))
- fRollingSpeed = std::abs(vAngularSpeed.y);
+ if (fRollingSpeed < ABS(vAngularSpeed.y))
+ fRollingSpeed = ABS(vAngularSpeed.y);
// Z
if (mRollAxisFlags & eRollAxisFlag_Z)
- if (fRollingSpeed < std::abs(vAngularSpeed.z))
- fRollingSpeed = std::abs(vAngularSpeed.z);
+ if (fRollingSpeed < ABS(vAngularSpeed.z))
+ fRollingSpeed = ABS(vAngularSpeed.z);
// Log("Rollspeed: %f\n",fRollingSpeed);
diff --git a/engines/hpl1/engine/scene/AnimationState.cpp b/engines/hpl1/engine/scene/AnimationState.cpp
index 467063cc76c..d9624ed9569 100644
--- a/engines/hpl1/engine/scene/AnimationState.cpp
+++ b/engines/hpl1/engine/scene/AnimationState.cpp
@@ -121,11 +121,11 @@ bool cAnimationState::IsOver() {
//-----------------------------------------------------------------------
void cAnimationState::FadeIn(float afTime) {
- mfFadeStep = 1.0f / std::abs(afTime);
+ mfFadeStep = 1.0f / ABS(afTime);
}
void cAnimationState::FadeOut(float afTime) {
- mfFadeStep = -1.0f / std::abs(afTime);
+ mfFadeStep = -1.0f / ABS(afTime);
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/scene/Camera2D.cpp b/engines/hpl1/engine/scene/Camera2D.cpp
index 3e4082d32df..68b559cdcd4 100644
--- a/engines/hpl1/engine/scene/Camera2D.cpp
+++ b/engines/hpl1/engine/scene/Camera2D.cpp
@@ -72,11 +72,11 @@ cVector3f cCamera2D::GetEyePosition() {
void cCamera2D::GetClipRect(cRect2f &aRect) {
float fDiv = 1;
if (mvPosition.z < 0) {
- fDiv = 1 - std::abs(mvPosition.z / mfZMin);
+ fDiv = 1 - ABS(mvPosition.z / mfZMin);
if (fDiv <= 0)
fDiv = 0.0001f;
} else
- fDiv = 1 + std::abs(mvPosition.z / mfZMax);
+ fDiv = 1 + ABS(mvPosition.z / mfZMax);
// Transform these depending on z
float lW = ((float)mvClipArea.x) * fDiv;
diff --git a/engines/hpl1/engine/scene/ImageEntity.cpp b/engines/hpl1/engine/scene/ImageEntity.cpp
index 92f6e6d9ca8..c84120c6fb1 100644
--- a/engines/hpl1/engine/scene/ImageEntity.cpp
+++ b/engines/hpl1/engine/scene/ImageEntity.cpp
@@ -262,8 +262,8 @@ void cImageEntity::Render() {
for (int i = 0; i < (int)mvBaseVtx.size(); i++) {
// Slow as hell!! Change this perhaps?
// This also only works on square meshes...
- mvBaseVtx[i].pos.x = std::abs(mvBaseVtx[i].pos.x) / mvBaseVtx[i].pos.x;
- mvBaseVtx[i].pos.y = std::abs(mvBaseVtx[i].pos.y) / mvBaseVtx[i].pos.y;
+ mvBaseVtx[i].pos.x = ABS(mvBaseVtx[i].pos.x) / mvBaseVtx[i].pos.x;
+ mvBaseVtx[i].pos.y = ABS(mvBaseVtx[i].pos.y) / mvBaseVtx[i].pos.y;
mvBaseVtx[i].pos.x *= mvSize.x / 2;
mvBaseVtx[i].pos.y *= mvSize.y / 2;
@@ -406,7 +406,7 @@ void cImageEntity::SetAlpha(float afX) {
void cImageEntity::Flash(float afAdd) {
mbFlashing = true;
- mfFlashAdd = -std::abs(afAdd);
+ mfFlashAdd = -ABS(afAdd);
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/sound/SoundHandler.cpp b/engines/hpl1/engine/sound/SoundHandler.cpp
index afe0e26b9e5..a5e8d26f6e2 100644
--- a/engines/hpl1/engine/sound/SoundHandler.cpp
+++ b/engines/hpl1/engine/sound/SoundHandler.cpp
@@ -133,7 +133,7 @@ void cSoundEntry::Update(float afTimeStep) {
}
}
- if (std::abs(mfNormalVolumeFadeDest) < 0.001f && std::abs(mfNormalVolumeMul) < 0.001f && mfNormalVolumeFadeSpeed <= 0) {
+ if (ABS(mfNormalVolumeFadeDest) < 0.001f && ABS(mfNormalVolumeMul) < 0.001f && mfNormalVolumeFadeSpeed <= 0) {
mpSound->Stop();
}
}
diff --git a/engines/hpl1/penumbra-overture/CharacterMove.cpp b/engines/hpl1/penumbra-overture/CharacterMove.cpp
index 43ef5323f35..14dd0f7b240 100644
--- a/engines/hpl1/penumbra-overture/CharacterMove.cpp
+++ b/engines/hpl1/penumbra-overture/CharacterMove.cpp
@@ -276,12 +276,12 @@ void cCharacterMove::Update(float afTimeStep) {
/////////////////
// Rotate the body
- if (std::abs(fAngleDist) < 0.001f) {
+ if (ABS(fAngleDist) < 0.001f) {
mbTurning = false;
mfTurnSpeed = 0;
}
if (mbTurning) {
- mfTurnSpeed = cMath::Min(mfAngleDistTurnMul * std::abs(fAngleDist), mfMaxTurnSpeed);
+ mfTurnSpeed = cMath::Min(mfAngleDistTurnMul * ABS(fAngleDist), mfMaxTurnSpeed);
if (fAngleDist < 0)
mpCharBody->AddYaw(-mfTurnSpeed * afTimeStep);
@@ -290,8 +290,8 @@ void cCharacterMove::Update(float afTimeStep) {
//////////////////////
// Break when making short turns
- if (std::abs(fAngleDist) >= mfMinBreakAngle && mpCharBody->GetMoveSpeed(eCharDir_Forward) > 0.15f) {
- float fBreakAcc = -mfBreakAngleMul * std::abs(fAngleDist);
+ if (ABS(fAngleDist) >= mfMinBreakAngle && mpCharBody->GetMoveSpeed(eCharDir_Forward) > 0.15f) {
+ float fBreakAcc = -mfBreakAngleMul * ABS(fAngleDist);
mpCharBody->Move(eCharDir_Forward, fBreakAcc, afTimeStep);
mfCurrentBreak = fBreakAcc;
@@ -314,7 +314,7 @@ void cCharacterMove::Update(float afTimeStep) {
float fCos = cMath::Vector3Dot(vWantedDir, vRealDir);
if (fRealSpeed / fWantedSpeed < mfStuckLimit ||
- (std::abs(fCos) < 0.3f && fWantedSpeed > 0.001f)) {
+ (ABS(fCos) < 0.3f && fWantedSpeed > 0.001f)) {
mfStuckCounter += afTimeStep;
// mpInit->mpEffectHandler->GetSubTitle()->Add(_W("ADD!\n"),1.0f/60.0f,false);
} else {
diff --git a/engines/hpl1/penumbra-overture/GameEnemy.cpp b/engines/hpl1/penumbra-overture/GameEnemy.cpp
index 2cf459b5904..328d1383a66 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy.cpp
@@ -1297,10 +1297,10 @@ void iGameEnemy::UpdateAnimations(float afTimeStep) {
}
if (mbAnimationIsSpeedDependant) {
- if (std::abs(fSpeed) > 0.05f)
- mpCurrentAnimation->SetSpeed(std::abs(fSpeed) * mfAnimationSpeedMul);
+ if (ABS(fSpeed) > 0.05f)
+ mpCurrentAnimation->SetSpeed(ABS(fSpeed) * mfAnimationSpeedMul);
else
- mpCurrentAnimation->SetSpeed(std::abs(fTurnSpeed) * mfAnimationSpeedMul * 2);
+ mpCurrentAnimation->SetSpeed(ABS(fTurnSpeed) * mfAnimationSpeedMul * 2);
}
}
////////////////////////////////
@@ -1322,7 +1322,7 @@ void iGameEnemy::UpdateAnimations(float afTimeStep) {
mMoveState = eEnemyMoveState_Backward;
else if (fSpeed >= mfStoppedToWalkSpeed)
mMoveState = eEnemyMoveState_Walking;
- else if (std::abs(fTurnSpeed) > 0.07f)
+ else if (ABS(fTurnSpeed) > 0.07f)
mMoveState = eEnemyMoveState_Walking;
break;
@@ -1332,7 +1332,7 @@ void iGameEnemy::UpdateAnimations(float afTimeStep) {
if (fSpeed >= mfWalkToRunSpeed)
mMoveState = eEnemyMoveState_Running;
else if (fSpeed <= mfWalkToStoppedSpeed) {
- if (std::abs(fTurnSpeed) < 0.03f)
+ if (ABS(fTurnSpeed) < 0.03f)
mMoveState = eEnemyMoveState_Stopped;
}
@@ -1379,10 +1379,10 @@ void iGameEnemy::UpdateAnimations(float afTimeStep) {
/////////////////////////////////
// Update animation speed
if (mbAnimationIsSpeedDependant) {
- if (std::abs(fSpeed) > 0.05f)
- mpCurrentAnimation->SetSpeed(std::abs(fSpeed) * mfMoveAnimSpeedMul);
+ if (ABS(fSpeed) > 0.05f)
+ mpCurrentAnimation->SetSpeed(ABS(fSpeed) * mfMoveAnimSpeedMul);
else
- mpCurrentAnimation->SetSpeed(std::abs(fTurnSpeed) * mfMoveAnimSpeedMul * 2);
+ mpCurrentAnimation->SetSpeed(ABS(fTurnSpeed) * mfMoveAnimSpeedMul * 2);
}
}
}
diff --git a/engines/hpl1/penumbra-overture/GameEntity.cpp b/engines/hpl1/penumbra-overture/GameEntity.cpp
index 81c0488b198..5e34d7f8d2d 100644
--- a/engines/hpl1/penumbra-overture/GameEntity.cpp
+++ b/engines/hpl1/penumbra-overture/GameEntity.cpp
@@ -389,7 +389,7 @@ void iGameEntity::Damage(float afDamage, int alStrength) {
afDamage *= fDamageMul;
}
- mfHealth -= std::abs(afDamage);
+ mfHealth -= ABS(afDamage);
if (mfHealth <= 0) {
OnDeath(afDamage);
diff --git a/engines/hpl1/penumbra-overture/GameObject.cpp b/engines/hpl1/penumbra-overture/GameObject.cpp
index ec06b451af6..c5c7baffda8 100644
--- a/engines/hpl1/penumbra-overture/GameObject.cpp
+++ b/engines/hpl1/penumbra-overture/GameObject.cpp
@@ -73,7 +73,7 @@ void cGameObjectBodyCallback::OnCollide(iPhysicsBody *apBody, iPhysicsBody *apCo
float fSpeed = apBody->GetLinearVelocity().Length();
float fImpulseSize = fSpeed * apBody->GetMass();
- if (fSpeed > 4.5f && fImpulseSize > 25 && std::abs(apContactData->mfMaxContactNormalSpeed) >= 1.0f) {
+ if (fSpeed > 4.5f && fImpulseSize > 25 && ABS(apContactData->mfMaxContactNormalSpeed) >= 1.0f) {
pEnemy->Damage(fImpulseSize * 0.1f, 1);
}
}
@@ -86,7 +86,7 @@ void cGameObjectBodyCallback::OnCollide(iPhysicsBody *apBody, iPhysicsBody *apCo
apCollideBody->GetLinearVelocity().Length() * apCollideBody->GetMass();
if (fImpulseSize >= mpObject->mBreakProps.mfMinImpulse &&
- std::abs(apContactData->mfMaxContactNormalSpeed) >= mpObject->mBreakProps.mfMinNormalSpeed) {
+ ABS(apContactData->mfMaxContactNormalSpeed) >= mpObject->mBreakProps.mfMinNormalSpeed) {
if (mpInit->mbDebugInteraction) {
Log("------ Breakage ----------\n");
Log(" Body '%s' by Body '%s'\n", apBody->GetName().c_str(), apCollideBody->GetName().c_str());
@@ -580,8 +580,8 @@ void cGameObject::OnPlayerGravityCollide(iCharacterBody *apCharBody, cCollideDat
for (int i = 0; i < apCollideData->mlNumOfPoints; i++) {
cCollidePoint &point = apCollideData->mvContactPoints[i];
if (point.mvNormal.y > 0.001f &&
- point.mvNormal.y > std::abs(point.mvNormal.x) &&
- point.mvNormal.y > std::abs(point.mvNormal.z)) {
+ point.mvNormal.y > ABS(point.mvNormal.x) &&
+ point.mvNormal.y > ABS(point.mvNormal.z)) {
bPushDown = true;
}
}
@@ -589,14 +589,14 @@ void cGameObject::OnPlayerGravityCollide(iCharacterBody *apCharBody, cCollideDat
if (bPushDown) {
////////////////////////////////////
// Check the impulse created by the player
- float fImpulse = apCharBody->GetMass() * std::abs(apCharBody->GetForceVelocity().y);
+ float fImpulse = apCharBody->GetMass() * ABS(apCharBody->GetForceVelocity().y);
if (mBreakProps.mfMinPlayerImpulse <= fImpulse) {
if (mpInit->mbDebugInteraction) {
Log("------ Breakage ----------\n");
Log(" Body '%s' by Player\n", mvBodies[0]->GetName().c_str());
Log(" Impulse: %f : %fm/s * %fkg (from Player)\n", fImpulse,
- std::abs(apCharBody->GetForceVelocity().y), apCharBody->GetMass());
+ ABS(apCharBody->GetForceVelocity().y), apCharBody->GetMass());
Log("-------------------------\n");
}
diff --git a/engines/hpl1/penumbra-overture/GameSwingDoor.cpp b/engines/hpl1/penumbra-overture/GameSwingDoor.cpp
index 0aad2466e23..09bbe250077 100644
--- a/engines/hpl1/penumbra-overture/GameSwingDoor.cpp
+++ b/engines/hpl1/penumbra-overture/GameSwingDoor.cpp
@@ -243,7 +243,7 @@ void cGameSwingDoor::SetLocked(bool abX) {
iPhysicsJointHinge *pHingeJoint = static_cast<iPhysicsJointHinge *>(pJoint);
if (mbLocked) {
- if (std::abs(pHingeJoint->GetMinAngle()) > std::abs(pHingeJoint->GetMaxAngle()))
+ if (ABS(pHingeJoint->GetMinAngle()) > ABS(pHingeJoint->GetMaxAngle()))
pHingeJoint->SetMinAngle(cMath::ToRad(-1));
else
pHingeJoint->SetMaxAngle(cMath::ToRad(1));
diff --git a/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp b/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
index 7d5fdd44a93..29308657b6e 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_Interact.cpp
@@ -165,7 +165,7 @@ void cPlayerState_Grab::OnUpdate(float afTimeStep) {
cVector3f vOmega = mpPushBody->GetAngularVelocity();
// Set speed to 0
- if (std::abs(mfYRotation) < 0.001f || mbRotateWithPlayer == false) {
+ if (ABS(mfYRotation) < 0.001f || mbRotateWithPlayer == false) {
cVector3f vTorque = mRotatePid.Output(cVector3f(0, 0, 0) - vOmega, afTimeStep);
vTorque = vTorque / 5.0f;
@@ -623,7 +623,7 @@ bool cPlayerState_Move::OnMoveSideways(float afMul, float afTimeStep) {
//-----------------------------------------------------------------------
bool cPlayerState_Move::OnAddYaw(float afVal) {
- if (std::abs(afVal) > kEpsilonf) {
+ if (ABS(afVal) > kEpsilonf) {
cVector3f vForce = (mvRight * (afVal * 100.0f * mpPlayer->mfRightMul));
mpPushBody->AddForceAtPosition(vForce, mvPickPoint);
mlMoveCount = 20;
@@ -638,7 +638,7 @@ bool cPlayerState_Move::OnAddYaw(float afVal) {
//-----------------------------------------------------------------------
bool cPlayerState_Move::OnAddPitch(float afVal) {
- if (std::abs(afVal) > kEpsilonf) {
+ if (ABS(afVal) > kEpsilonf) {
cVector3f vForce = (mvUp * (-afVal * 100.0f * mpPlayer->mfUpMul)) +
(mvForward * (afVal * -80.0f * mpPlayer->mfForwardUpMul));
mpPushBody->AddForceAtPosition(vForce, mvPickPoint);
diff --git a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp b/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
index 8933db7fb0a..970a520d762 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
@@ -202,7 +202,7 @@ void cPlayerState_GrabHaptX::OnUpdate(float afTimeStep) {
cVector3f vOmega = mpPushBody->GetAngularVelocity();
// Set speed to 0
- if (std::abs(mfYRotation) < 0.001f || mbRotateWithPlayer == false) {
+ if (ABS(mfYRotation) < 0.001f || mbRotateWithPlayer == false) {
mRotatePid.p = 0.8f;
mRotatePid.i = 0.0f;
mRotatePid.d = 0.0f;
@@ -718,7 +718,7 @@ bool cPlayerState_MoveHaptX::OnMoveSideways(float afMul, float afTimeStep) {
//-----------------------------------------------------------------------
bool cPlayerState_MoveHaptX::OnAddYaw(float afVal) {
- if (std::abs(afVal) > kEpsilonf) {
+ if (ABS(afVal) > kEpsilonf) {
cVector3f vForce = (mvRight * (afVal * 100.0f * mpPlayer->mfRightMul));
mpPushBody->AddForceAtPosition(vForce, mvPickPoint);
mlMoveCount = 20;
@@ -733,7 +733,7 @@ bool cPlayerState_MoveHaptX::OnAddYaw(float afVal) {
//-----------------------------------------------------------------------
bool cPlayerState_MoveHaptX::OnAddPitch(float afVal) {
- if (std::abs(afVal) > kEpsilonf) {
+ if (ABS(afVal) > kEpsilonf) {
cVector3f vForce = (mvUp * (-afVal * 100.0f * mpPlayer->mfUpMul)) +
(mvForward * (afVal * -80.0f * mpPlayer->mfForwardUpMul));
mpPushBody->AddForceAtPosition(vForce, mvPickPoint);
Commit: 9cdcde7ea5e72b4dfb8c41ea2a5ad7de52b9b44c
https://github.com/scummvm/scummvm/commit/9cdcde7ea5e72b4dfb8c41ea2a5ad7de52b9b44c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:22+01:00
Commit Message:
HPL1: Fix more warnings
Changed paths:
engines/hpl1/engine/libraries/angelscript/sources/as_context.cpp
engines/hpl1/engine/libraries/newton/Newton.cpp
engines/hpl1/engine/libraries/newton/Newton.h
engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.h
engines/hpl1/engine/libraries/newton/core/dgIntersections.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompound.cpp
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/sources/as_context.cpp b/engines/hpl1/engine/libraries/angelscript/sources/as_context.cpp
index 4341852f651..ab0c744d968 100644
--- a/engines/hpl1/engine/libraries/angelscript/sources/as_context.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/sources/as_context.cpp
@@ -5603,6 +5603,3 @@ asQWORD as_powu64(asQWORD base, asQWORD exponent, bool &isOverflow) {
}
END_AS_NAMESPACE
-
-
-
diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
index 78ec0c24112..fdd1d0dcc04 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.cpp
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -8300,13 +8300,13 @@ void *NewtonMeshGetFirstVertex(const NewtonMesh *const mesh) {
}
void *NewtonMeshGetNextVertex(const NewtonMesh *const mesh,
- const void *const vertex) {
+ void *const vertex) {
TRACE_FUNTION(__FUNCTION__);
return ((const dgMeshEffect *)mesh)->GetNextVertex(vertex);
}
int NewtonMeshGetVertexIndex(const NewtonMesh *const mesh,
- const void *const vertex) {
+ void *const vertex) {
TRACE_FUNTION(__FUNCTION__);
return ((const dgMeshEffect *)mesh)->GetVertexIndex(vertex);
}
@@ -8316,7 +8316,7 @@ void *NewtonMeshGetFirstPoint(const NewtonMesh *const mesh) {
return ((const dgMeshEffect *)mesh)->GetFirstPoint();
}
void *NewtonMeshGetNextPoint(const NewtonMesh *const mesh,
- const void *const point) {
+ void *const point) {
TRACE_FUNTION(__FUNCTION__);
return ((const dgMeshEffect *)mesh)->GetNextPoint(point);
}
@@ -8328,7 +8328,7 @@ int NewtonMeshGetPointIndex(const NewtonMesh *const mesh,
}
int NewtonMeshGetVertexIndexFromPoint(const NewtonMesh *const mesh,
- const void *const point) {
+ void *const point) {
TRACE_FUNTION(__FUNCTION__);
return ((const dgMeshEffect *)mesh)->GetVertexIndexFromPoint(point);
}
diff --git a/engines/hpl1/engine/libraries/newton/Newton.h b/engines/hpl1/engine/libraries/newton/Newton.h
index 68de4963ac7..bb7c3dc910f 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.h
+++ b/engines/hpl1/engine/libraries/newton/Newton.h
@@ -990,13 +990,13 @@ NEWTON_API dFloat64 *NewtonMeshGetVertexArray(const NewtonMesh *const mesh);
NEWTON_API void *NewtonMeshGetFirstVertex(const NewtonMesh *const mesh);
-NEWTON_API void *NewtonMeshGetNextVertex(const NewtonMesh *const mesh, const void *const vertex);
-NEWTON_API int NewtonMeshGetVertexIndex(const NewtonMesh *const mesh, const void *const vertex);
+NEWTON_API void *NewtonMeshGetNextVertex(const NewtonMesh *const mesh, void *const vertex);
+NEWTON_API int NewtonMeshGetVertexIndex(const NewtonMesh *const mesh, void *const vertex);
NEWTON_API void *NewtonMeshGetFirstPoint(const NewtonMesh *const mesh);
-NEWTON_API void *NewtonMeshGetNextPoint(const NewtonMesh *const mesh, const void *const point);
+NEWTON_API void *NewtonMeshGetNextPoint(const NewtonMesh *const mesh, void *const point);
NEWTON_API int NewtonMeshGetPointIndex(const NewtonMesh *const mesh, const void *const point);
-NEWTON_API int NewtonMeshGetVertexIndexFromPoint(const NewtonMesh *const mesh, const void *const point);
+NEWTON_API int NewtonMeshGetVertexIndexFromPoint(const NewtonMesh *const mesh, void *const point);
NEWTON_API void *NewtonMeshGetFirstEdge(const NewtonMesh *const mesh);
diff --git a/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp b/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
index ac041541b70..5c03464fe6f 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.cpp
@@ -77,8 +77,8 @@ class dgAABBTree {
| faceIndexStart;
}
- inline dgAABBTree *GetNode(const void *root) const {
- return ((dgAABBTree *) root) + m_node;
+ inline const dgAABBTree *GetNode(const void *root) const {
+ return ((const dgAABBTree *) root) + m_node;
}
union {
@@ -1328,12 +1328,12 @@ void *dgAABBPolygonSoup::GetRootNode() const {
return m_aabb;
}
-void *dgAABBPolygonSoup::GetBackNode(const void *const root) const {
+const void *dgAABBPolygonSoup::GetBackNode(const void *const root) const {
const dgAABBTree *const node = (const dgAABBTree *)root;
return node->m_back.IsLeaf() ? NULL : node->m_back.GetNode(m_aabb);
}
-void *dgAABBPolygonSoup::GetFrontNode(const void *const root) const {
+const void *dgAABBPolygonSoup::GetFrontNode(const void *const root) const {
const dgAABBTree *const node = (const dgAABBTree *)root;
return node->m_front.IsLeaf() ? NULL : node->m_front.GetNode(m_aabb);
}
diff --git a/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.h b/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.h
index 125d8fb4ffd..de29412103f 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgAABBPolygonSoup.h
@@ -53,8 +53,8 @@ protected:
~dgAABBPolygonSoup();
void *GetRootNode() const;
- void *GetBackNode(const void *const root) const;
- void *GetFrontNode(const void *const root) const;
+ const void *GetBackNode(const void *const root) const;
+ const void *GetFrontNode(const void *const root) const;
void GetNodeAABB(const void *const root, dgVector &p0, dgVector &p1) const;
void Create(const dgPolygonSoupDatabaseBuilder &builder, bool optimizedBuild);
@@ -81,5 +81,3 @@ private:
#endif
-
-
diff --git a/engines/hpl1/engine/libraries/newton/core/dgIntersections.h b/engines/hpl1/engine/libraries/newton/core/dgIntersections.h
index b11d281590e..800d2780f45 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgIntersections.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgIntersections.h
@@ -174,4 +174,3 @@ DG_INLINE dgInt32 dgOverlapTestSimd(const dgVector &p0, const dgVector &p1, cons
dgBigVector LineTriangleIntersection(const dgBigVector &l0, const dgBigVector &l1, const dgBigVector &A, const dgBigVector &B, const dgBigVector &C);
#endif
-
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompound.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompound.cpp
index 3e5f5803def..9ee71dfa384 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompound.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompound.cpp
@@ -1761,8 +1761,8 @@ dgInt32 dgCollisionCompound::CalculateContactsToCollisionTree(
} else if (me->m_type == m_leaf) {
- void *const frontNode = treeCollision->GetFrontNode(other);
- void *const backNode = treeCollision->GetBackNode(other);
+ const void *const frontNode = treeCollision->GetFrontNode(other);
+ const void *const backNode = treeCollision->GetBackNode(other);
if (backNode && frontNode) {
stackPool[stack].m_myNode = (dgNodeBase *)me;
stackPool[stack].m_treeNode = backNode;
@@ -1818,8 +1818,8 @@ dgInt32 dgCollisionCompound::CalculateContactsToCollisionTree(
} else if (nodeProxi.m_area > me->m_area) {
_ASSERTE(me->m_type == m_node);
- void *const frontNode = treeCollision->GetFrontNode(other);
- void *const backNode = treeCollision->GetBackNode(other);
+ const void *const frontNode = treeCollision->GetFrontNode(other);
+ const void *const backNode = treeCollision->GetBackNode(other);
if (backNode && frontNode) {
stackPool[stack].m_myNode = (dgNodeBase *)me;
stackPool[stack].m_treeNode = backNode;
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
index 81600f009d1..09160bdb3c4 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
@@ -1723,7 +1723,7 @@ void *dgMeshEffect::GetFirstVertex() const {
*/
}
-void *dgMeshEffect::GetNextVertex(const void *vertex) const {
+void *dgMeshEffect::GetNextVertex(void *vertex) const {
dgTreeNode *const node = (dgTreeNode *)vertex;
dgInt32 mark = node->GetInfo().m_mark;
@@ -1744,7 +1744,7 @@ void *dgMeshEffect::GetNextVertex(const void *vertex) const {
return NULL;
}
-dgInt32 dgMeshEffect::GetVertexIndex(const void *vertex) const {
+dgInt32 dgMeshEffect::GetVertexIndex(void *vertex) const {
dgTreeNode *const nodeT = (dgTreeNode *)vertex;
dgEdge *const edge = &nodeT->GetInfo();
return edge->m_incidentVertex;
@@ -1762,7 +1762,7 @@ void *dgMeshEffect::GetFirstPoint() const {
return NULL;
}
-void *dgMeshEffect::GetNextPoint(const void *const point) const {
+void *dgMeshEffect::GetNextPoint(void *const point) const {
Iterator iter(*this);
iter.Set((dgTreeNode *)point);
for (iter++; iter; iter++) {
@@ -1776,12 +1776,12 @@ void *dgMeshEffect::GetNextPoint(const void *const point) const {
}
dgInt32 dgMeshEffect::GetPointIndex(const void *point) const {
- dgTreeNode *const node = (dgTreeNode *)point;
- dgEdge *const edge = &node->GetInfo();
+ const dgTreeNode *const node = (dgTreeNode *)point;
+ const dgEdge *const edge = &node->GetInfo();
return int(edge->m_userData);
}
-dgInt32 dgMeshEffect::GetVertexIndexFromPoint(const void *point) const {
+dgInt32 dgMeshEffect::GetVertexIndexFromPoint(void *point) const {
return GetVertexIndex(point);
}
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
index 3cc64586b8d..6cca3140604 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
@@ -214,13 +214,13 @@ public:
void TransformMesh(const dgMatrix &matrix);
void *GetFirstVertex() const;
- void *GetNextVertex(const void *const vertex) const;
- int GetVertexIndex(const void *const vertex) const;
+ void *GetNextVertex(void *const vertex) const;
+ int GetVertexIndex(void *const vertex) const;
void *GetFirstPoint() const;
- void *GetNextPoint(const void *const point) const;
+ void *GetNextPoint(void *const point) const;
int GetPointIndex(const void *const point) const;
- int GetVertexIndexFromPoint(const void *const point) const;
+ int GetVertexIndexFromPoint(void *const point) const;
void *GetFirstEdge() const;
void *GetNextEdge(const void *const edge) const;
diff --git a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp b/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
index 970a520d762..610694c1a2b 100644
--- a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
+++ b/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
@@ -1014,7 +1014,7 @@ bool cPlayerState_PushHaptX::OnMoveForwards(float afMul, float afTimeStep) {
if (bCollide) {
cVector3f vPos = mpPlayer->GetCharacterBody()->GetPosition();
//cVector3f vOldPos = vPos;
- cVector3f vNewPos;
+ //cVector3f vNewPos;
vPos += mvForward * -1 * (fPosAdd + 0.1f);
mpPlayer->GetCharacterBody()->SetPosition(vPos);
Commit: 619418f4506df1409a1ba005be125e11f7ed448f
https://github.com/scummvm/scummvm/commit/619418f4506df1409a1ba005be125e11f7ed448f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:22+01:00
Commit Message:
HPL1: implement collider rendering
Changed paths:
engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
index f89f6670e81..265b1d22da6 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
@@ -376,34 +376,28 @@ bool cPhysicsBodyNewton::GetGravity() const {
//-----------------------------------------------------------------------
-//static iLowLevelGraphics *gpLowLevelGraphics;
-static cColor gDebugColor;
-
-////////////////////////////////////////////
-/*
-static void RenderDebugPolygon(const NewtonBody *apNewtonBody,
- int alVertexCount, const dFloat *apFaceVertex, int alId) {
- int i;
-
- i = alVertexCount - 1;
+struct DrawParameters {
+ iLowLevelGraphics *lowLevelGraphics;
+ cColor drawColor;
+};
+
+///////////////////////////////////////////
+static void RenderDebugPolygon(void* params, int alVertexCount, const dFloat *apFaceVertex, int alId) {
+ int i = alVertexCount - 1;
+ const DrawParameters* drawParams = static_cast<DrawParameters*>(params);
cVector3f vP0(apFaceVertex[i * 3 + 0], apFaceVertex[i * 3 + 1], apFaceVertex[i * 3 + 2]);
for (i = 0; i < alVertexCount; ++i) {
cVector3f vP1(apFaceVertex[i * 3 + 0], apFaceVertex[i * 3 + 1], apFaceVertex[i * 3 + 2]);
-
- gpLowLevelGraphics->DrawLine(vP0, vP1, gDebugColor);
-
+ drawParams->lowLevelGraphics->DrawLine(vP0, vP1, drawParams->drawColor);
vP0 = vP1;
}
}
-*/
+
////////////////////////////////////////////
void cPhysicsBodyNewton::RenderDebugGeometry(iLowLevelGraphics *apLowLevel, const cColor &aColor) {
-#if 0
- gpLowLevelGraphics = apLowLevel;
- gDebugColor = aColor;
- NewtonBodyForEachPolygonDo (mpNewtonBody, RenderDebugPolygon);
-#endif
+ DrawParameters params{apLowLevel, aColor};
+ NewtonCollisionForEachPolygonDo(NewtonBodyGetCollision(mpNewtonBody), GetLocalMatrix().GetTranspose().v, RenderDebugPolygon, static_cast<void*>(¶ms));
}
//-----------------------------------------------------------------------
Commit: 99f161cdcd6e715bd74241dbfef0a692a9d4b418
https://github.com/scummvm/scummvm/commit/99f161cdcd6e715bd74241dbfef0a692a9d4b418
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:22+01:00
Commit Message:
HPL1: make PhysicsRayParams constructor constexpr
Changed paths:
engines/hpl1/engine/physics/PhysicsWorld.h
diff --git a/engines/hpl1/engine/physics/PhysicsWorld.h b/engines/hpl1/engine/physics/PhysicsWorld.h
index f3f2c820c96..35436e227fd 100644
--- a/engines/hpl1/engine/physics/PhysicsWorld.h
+++ b/engines/hpl1/engine/physics/PhysicsWorld.h
@@ -89,12 +89,12 @@ enum ePhysicsAccuracy {
//----------------------------------------------------
-class cPhysicsRayParams {
-public:
- float mfT;
- float mfDist;
- cVector3f mvNormal;
- cVector3f mvPoint;
+struct cPhysicsRayParams {
+ constexpr cPhysicsRayParams() {}
+ float mfT = 0;
+ float mfDist = 0;
+ cVector3f mvNormal = {0,0,0};
+ cVector3f mvPoint = {0,0,0};
};
class iPhysicsRayCallback {
Commit: 71607c5efb3b85fe89a0ed86c21d583c28f773a8
https://github.com/scummvm/scummvm/commit/71607c5efb3b85fe89a0ed86c21d583c28f773a8
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:22+01:00
Commit Message:
HPL1: fix const correctness in dgTree
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgTree.cpp
engines/hpl1/engine/libraries/newton/core/dgTree.h
diff --git a/engines/hpl1/engine/libraries/newton/core/dgTree.cpp b/engines/hpl1/engine/libraries/newton/core/dgTree.cpp
index 8a9bceb36d3..094114a4db6 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgTree.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgTree.cpp
@@ -22,26 +22,26 @@
#include "dgStdafx.h"
#include "dgTree.h"
-dgRedBackNode *dgRedBackNode::Minimum() const {
- dgRedBackNode *ptr = (dgRedBackNode *) this;
+const dgRedBackNode *dgRedBackNode::Minimum() const {
+ const dgRedBackNode *ptr = this;
for (; ptr->m_left; ptr = ptr->m_left) {
}
return ptr;
}
-dgRedBackNode *dgRedBackNode::Maximum() const {
- dgRedBackNode *ptr = (dgRedBackNode *) this;
+const dgRedBackNode *dgRedBackNode::Maximum() const {
+ const dgRedBackNode *ptr = this;
for (; ptr->m_right; ptr = ptr->m_right) {
}
return ptr;
}
-dgRedBackNode *dgRedBackNode::Prev() const {
+const dgRedBackNode *dgRedBackNode::Prev() const {
if (m_left) {
return m_left->Maximum();
}
- dgRedBackNode *node = (dgRedBackNode *) this;
+ const dgRedBackNode *node = this;
dgRedBackNode *ptr = m_parent;
for (; ptr && node == ptr->m_left; ptr = ptr->m_parent) {
node = ptr;
@@ -50,13 +50,55 @@ dgRedBackNode *dgRedBackNode::Prev() const {
}
-dgRedBackNode *dgRedBackNode::Next() const {
+const dgRedBackNode *dgRedBackNode::Next() const {
if (m_right) {
return m_right->Minimum();
}
- dgRedBackNode *node = (dgRedBackNode *) this;
+ const dgRedBackNode *node = this;
+ dgRedBackNode *ptr = m_parent;
+ for (; ptr && node == ptr->m_right; ptr = ptr->m_parent) {
+ node = ptr;
+ }
+ return ptr;
+}
+
+dgRedBackNode *dgRedBackNode::Minimum() {
+ dgRedBackNode *ptr = this;
+ for (; ptr->m_left; ptr = ptr->m_left) {
+ }
+ return ptr;
+}
+
+dgRedBackNode *dgRedBackNode::Maximum() {
+ dgRedBackNode *ptr = this;
+ for (; ptr->m_right; ptr = ptr->m_right) {
+ }
+ return ptr;
+}
+
+dgRedBackNode *dgRedBackNode::Prev() {
+ if (m_left) {
+ return m_left->Maximum();
+ }
+
+ dgRedBackNode *node = this;
+ dgRedBackNode *ptr = m_parent;
+ for (; ptr && node == ptr->m_left; ptr = ptr->m_parent) {
+ node = ptr;
+ }
+ return ptr;
+
+}
+
+dgRedBackNode *dgRedBackNode::Next() {
+
+ if (m_right) {
+ return m_right->Minimum();
+ }
+
+ dgRedBackNode *node = this;
dgRedBackNode *ptr = m_parent;
for (; ptr && node == ptr->m_right; ptr = ptr->m_parent) {
node = ptr;
diff --git a/engines/hpl1/engine/libraries/newton/core/dgTree.h b/engines/hpl1/engine/libraries/newton/core/dgTree.h
index d500563cb28..3190ce27952 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgTree.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgTree.h
@@ -64,10 +64,14 @@ public:
inline void SetInTreeFlag(dgUnsigned32 flag);
void RemoveAll();
- dgRedBackNode *Prev() const;
- dgRedBackNode *Next() const;
- dgRedBackNode *Minimum() const;
- dgRedBackNode *Maximum() const;
+ const dgRedBackNode *Prev() const;
+ const dgRedBackNode *Next() const;
+ const dgRedBackNode *Minimum() const;
+ const dgRedBackNode *Maximum() const;
+ dgRedBackNode *Prev();
+ dgRedBackNode *Next();
+ dgRedBackNode *Minimum();
+ dgRedBackNode *Maximum();
void Remove(dgRedBackNode **const head);
void Unlink(dgRedBackNode **const head);
void InsertFixup(dgRedBackNode **const head);
Commit: acf96eed732de1faa69d82d9c60f1201947e2718
https://github.com/scummvm/scummvm/commit/acf96eed732de1faa69d82d9c60f1201947e2718
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:22+01:00
Commit Message:
HPL1: fix const correctness in dgNode
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgNode.cpp
engines/hpl1/engine/libraries/newton/core/dgNode.h
diff --git a/engines/hpl1/engine/libraries/newton/core/dgNode.cpp b/engines/hpl1/engine/libraries/newton/core/dgNode.cpp
index c5e8b3c6a95..5528e30e0e7 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgNode.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgNode.cpp
@@ -127,7 +127,7 @@ void dgBaseNode::Detach() {
}
}
-dgBaseNode *dgBaseNode::GetRoot() const {
+const dgBaseNode *dgBaseNode::GetRoot() const {
const dgBaseNode *root;
for (root = this; root->parent; root = root->parent) {
@@ -135,7 +135,7 @@ dgBaseNode *dgBaseNode::GetRoot() const {
return (dgBaseNode *) root;
}
-dgBaseNode *dgBaseNode::GetFirst() const {
+const dgBaseNode *dgBaseNode::GetFirst() const {
dgBaseNode *ptr;
for (ptr = (dgBaseNode *) this; ptr->child; ptr = ptr->child) {
@@ -144,7 +144,7 @@ dgBaseNode *dgBaseNode::GetFirst() const {
return ptr;
}
-dgBaseNode *dgBaseNode::GetNext() const {
+const dgBaseNode *dgBaseNode::GetNext() const {
dgBaseNode *x;
dgBaseNode *ptr;
@@ -159,7 +159,7 @@ dgBaseNode *dgBaseNode::GetNext() const {
return ptr;
}
-dgBaseNode *dgBaseNode::GetLast() const {
+const dgBaseNode *dgBaseNode::GetLast() const {
dgBaseNode *ptr;
for (ptr = (dgBaseNode *) this; ptr->sibling; ptr = ptr->sibling) {
@@ -168,7 +168,7 @@ dgBaseNode *dgBaseNode::GetLast() const {
return ptr;
}
-dgBaseNode *dgBaseNode::GetPrev() const {
+const dgBaseNode *dgBaseNode::GetPrev() const {
dgBaseNode *x;
dgBaseNode *ptr;
@@ -183,7 +183,74 @@ dgBaseNode *dgBaseNode::GetPrev() const {
return ptr;
}
-dgBaseNode *dgBaseNode::Find(dgUnsigned32 nameCRC) const {
+dgBaseNode *dgBaseNode::GetRoot() {
+ dgBaseNode *root;
+ for (root = this; root->parent; root = root->parent) {
+
+ }
+ return root;
+}
+
+dgBaseNode *dgBaseNode::GetFirst() {
+ dgBaseNode *ptr;
+
+ for (ptr = this; ptr->child; ptr = ptr->child) {
+
+ }
+ return ptr;
+}
+
+dgBaseNode *dgBaseNode::GetNext() {
+ dgBaseNode *x;
+ dgBaseNode *ptr;
+
+ if (sibling) {
+ return sibling->GetFirst();
+ }
+
+ x = this;
+ for (ptr = parent; ptr && (x == ptr->sibling); ptr = ptr->parent) {
+ x = ptr;
+ }
+ return ptr;
+}
+
+dgBaseNode *dgBaseNode::GetLast() {
+ dgBaseNode *ptr;
+
+ for (ptr = this; ptr->sibling; ptr = ptr->sibling) {
+
+ }
+ return ptr;
+}
+
+dgBaseNode *dgBaseNode::GetPrev() {
+ dgBaseNode *x;
+ dgBaseNode *ptr;
+
+ if (child) {
+ return child->GetNext();
+ }
+
+ x = this;
+ for (ptr = parent; ptr && (x == ptr->child); ptr = ptr->child) {
+ x = ptr;
+ }
+ return ptr;
+}
+
+const dgBaseNode *dgBaseNode::Find(dgUnsigned32 nameCRC) const {
+ const dgBaseNode *ptr;
+
+ for (ptr = GetFirst(); ptr; ptr = ptr->GetNext()) {
+ if (nameCRC == ptr->GetNameID()) {
+ break;
+ }
+ }
+ return ptr;
+}
+
+dgBaseNode *dgBaseNode::Find(dgUnsigned32 nameCRC) {
dgBaseNode *ptr;
for (ptr = GetFirst(); ptr; ptr = ptr->GetNext()) {
diff --git a/engines/hpl1/engine/libraries/newton/core/dgNode.h b/engines/hpl1/engine/libraries/newton/core/dgNode.h
index a5f4600f885..17ca7a84a6a 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgNode.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgNode.h
@@ -43,14 +43,21 @@ public:
void Detach();
void Attach(dgBaseNode *parent, bool addFirst = false);
- dgBaseNode *GetRoot() const;
- dgBaseNode *GetFirst() const;
- dgBaseNode *GetLast() const;
- dgBaseNode *GetNext() const;
- dgBaseNode *GetPrev() const;
-
- dgBaseNode *Find(dgUnsigned32 nameCRC) const;
- dgBaseNode *Find(const char *name) const;
+ const dgBaseNode *GetRoot() const;
+ const dgBaseNode *GetFirst() const;
+ const dgBaseNode *GetLast() const;
+ const dgBaseNode *GetNext() const;
+ const dgBaseNode *GetPrev() const;
+ dgBaseNode *GetRoot();
+ dgBaseNode *GetFirst();
+ dgBaseNode *GetLast();
+ dgBaseNode *GetNext();
+ dgBaseNode *GetPrev();
+
+ const dgBaseNode *Find(dgUnsigned32 nameCRC) const;
+ dgBaseNode *Find(dgUnsigned32 nameCRC);
+ const dgBaseNode *Find(const char *name) const;
+ dgBaseNode *Find(const char *name);
void DebugPrint(const char *fileName);
bool SanityCheck();
@@ -86,6 +93,7 @@ public:
T *GetSibling() const;
T *GetParent() const;
T *GetRoot() const;
+ T *GetRoot();
T *GetFirst() const;
T *GetLast() const;
T *GetNext() const;
@@ -135,10 +143,13 @@ inline dgBaseNode *dgBaseNode::GetParent() const {
}
-inline dgBaseNode *dgBaseNode::Find(const char *name) const {
+inline const dgBaseNode *dgBaseNode::Find(const char *name) const {
return Find(dgCRC(name));
}
+inline dgBaseNode *dgBaseNode::Find(const char *name) {
+ return Find(dgCRC(name));
+}
Commit: bcefae41b47768416ec7f138fe3ebcdc68d8ea6e
https://github.com/scummvm/scummvm/commit/bcefae41b47768416ec7f138fe3ebcdc68d8ea6e
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:23+01:00
Commit Message:
HPL1: remove unused global variable
Changed paths:
engines/hpl1/penumbra-overture/Player.cpp
diff --git a/engines/hpl1/penumbra-overture/Player.cpp b/engines/hpl1/penumbra-overture/Player.cpp
index 85f14c5b906..f939ffba2da 100644
--- a/engines/hpl1/penumbra-overture/Player.cpp
+++ b/engines/hpl1/penumbra-overture/Player.cpp
@@ -968,8 +968,6 @@ public:
}
};
-cTempCheckProxy gTempCheckProxy;
-
void cPlayer::Update(float afTimeStep) {
//cSystem *pSystem = mpInit->mpGame->GetSystem();
//unsigned int lTime = pSystem->GetLowLevel()->getTime();
Commit: 08f287f8bcf95a8f24a66fb880abd71dadc75df6
https://github.com/scummvm/scummvm/commit/08f287f8bcf95a8f24a66fb880abd71dadc75df6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:23+01:00
Commit Message:
HPL1: Fix const correctness
Changed paths:
engines/hpl1/engine/libraries/newton/Newton.cpp
engines/hpl1/engine/libraries/newton/Newton.h
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
index fdd1d0dcc04..5a0e96d40e3 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.cpp
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -8339,7 +8339,7 @@ void *NewtonMeshGetFirstEdge(const NewtonMesh *const mesh) {
}
void *NewtonMeshGetNextEdge(const NewtonMesh *const mesh,
- const void *const edge) {
+ void *const edge) {
TRACE_FUNTION(__FUNCTION__);
return ((const dgMeshEffect *)mesh)->GetNextEdge(edge);
}
@@ -8361,7 +8361,7 @@ void *NewtonMeshGetFirstFace(const NewtonMesh *const mesh) {
}
void *NewtonMeshGetNextFace(const NewtonMesh *const mesh,
- const void *const face) {
+ void *const face) {
TRACE_FUNTION(__FUNCTION__);
return ((const dgMeshEffect *)mesh)->GetNextFace(face);
}
diff --git a/engines/hpl1/engine/libraries/newton/Newton.h b/engines/hpl1/engine/libraries/newton/Newton.h
index bb7c3dc910f..400f0f11854 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.h
+++ b/engines/hpl1/engine/libraries/newton/Newton.h
@@ -1000,12 +1000,12 @@ NEWTON_API int NewtonMeshGetVertexIndexFromPoint(const NewtonMesh *const mesh, v
NEWTON_API void *NewtonMeshGetFirstEdge(const NewtonMesh *const mesh);
-NEWTON_API void *NewtonMeshGetNextEdge(const NewtonMesh *const mesh, const void *const edge);
+NEWTON_API void *NewtonMeshGetNextEdge(const NewtonMesh *const mesh, void *const edge);
NEWTON_API void NewtonMeshGetEdgeIndices(const NewtonMesh *const mesh, const void *const edge, int *const v0, int *const v1);
//NEWTON_API void NewtonMeshGetEdgePointIndices (const NewtonMesh* const mesh, const void* const edge, int* const v0, int* const v1);
NEWTON_API void *NewtonMeshGetFirstFace(const NewtonMesh *const mesh);
-NEWTON_API void *NewtonMeshGetNextFace(const NewtonMesh *const mesh, const void *const face);
+NEWTON_API void *NewtonMeshGetNextFace(const NewtonMesh *const mesh, void *const face);
NEWTON_API int NewtonMeshIsFaceOpen(const NewtonMesh *const mesh, const void *const face);
NEWTON_API int NewtonMeshGetFaceMaterial(const NewtonMesh *const mesh, const void *const face);
NEWTON_API int NewtonMeshGetFaceIndexCount(const NewtonMesh *const mesh, const void *const face);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
index 09160bdb3c4..8ef5473777e 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.cpp
@@ -1776,7 +1776,7 @@ void *dgMeshEffect::GetNextPoint(void *const point) const {
}
dgInt32 dgMeshEffect::GetPointIndex(const void *point) const {
- const dgTreeNode *const node = (dgTreeNode *)point;
+ const dgTreeNode *const node = (const dgTreeNode *)point;
const dgEdge *const edge = &node->GetInfo();
return int(edge->m_userData);
}
@@ -1839,7 +1839,7 @@ void *dgMeshEffect::GetFirstEdge() const {
return node;
}
-void *dgMeshEffect::GetNextEdge(const void *edge) const {
+void *dgMeshEffect::GetNextEdge(void *edge) const {
dgTreeNode *const node = (dgTreeNode *)edge;
dgInt32 mark = node->GetInfo().m_mark;
@@ -1858,7 +1858,7 @@ void *dgMeshEffect::GetNextEdge(const void *edge) const {
void dgMeshEffect::GetEdgeIndex(const void *edge, dgInt32 &v0,
dgInt32 &v1) const {
- dgTreeNode *const node = (dgTreeNode *)edge;
+ const dgTreeNode *const node = (const dgTreeNode *)edge;
v0 = node->GetInfo().m_incidentVertex;
v1 = node->GetInfo().m_twin->m_incidentVertex;
}
@@ -1890,7 +1890,7 @@ void *dgMeshEffect::GetFirstFace() const {
return node;
}
-void *dgMeshEffect::GetNextFace(const void *const face) const {
+void *dgMeshEffect::GetNextFace(void *const face) const {
dgTreeNode *const node = (dgTreeNode *)face;
dgInt32 mark = node->GetInfo().m_mark;
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
index 6cca3140604..3c15ba728c1 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMeshEffect.h
@@ -223,12 +223,12 @@ public:
int GetVertexIndexFromPoint(void *const point) const;
void *GetFirstEdge() const;
- void *GetNextEdge(const void *const edge) const;
+ void *GetNextEdge(void *const edge) const;
void GetEdgeIndex(const void *const edge, dgInt32 &v0, dgInt32 &v1) const;
// void GetEdgeAttributeIndex (const void* edge, dgInt32& v0, dgInt32& v1) const;
void *GetFirstFace() const;
- void *GetNextFace(const void *const face) const;
+ void *GetNextFace(void *const face) const;
int IsFaceOpen(const void *const face) const;
int GetFaceMaterial(const void *const face) const;
int GetFaceIndexCount(const void *const face) const;
Commit: a0725536cec3407d0c8fd0b0dbd0f6af14d55e13
https://github.com/scummvm/scummvm/commit/a0725536cec3407d0c8fd0b0dbd0f6af14d55e13
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:23+01:00
Commit Message:
HPL1: Fix more const correctness
Changed paths:
engines/hpl1/engine/libraries/newton/Newton.cpp
engines/hpl1/engine/libraries/newton/Newton.h
engines/hpl1/engine/libraries/newton/NewtonClass.cpp
engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.cpp
engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.cpp
engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.h
engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
engines/hpl1/engine/libraries/newton/physics/dgContact.h
engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
engines/hpl1/engine/libraries/newton/physics/dgWorld.h
engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.h
diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
index 5a0e96d40e3..7b3560abf3a 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.cpp
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -1194,7 +1194,7 @@ int NewtonWorldGetConstraintCount(const NewtonWorld *const newtonWorld) {
// as excessive use of it can degrade performance.
//
// See also: NewtonWorldConvexCast
-void NewtonWorldRayCast(const NewtonWorld *const newtonWorld,
+void NewtonWorldRayCast(NewtonWorld *const newtonWorld,
const dFloat *const p0, const dFloat *const p1,
NewtonWorldRayFilterCallback filter, void *const userData,
NewtonWorldRayPrefilterCallback prefilter) {
@@ -1203,7 +1203,7 @@ void NewtonWorldRayCast(const NewtonWorld *const newtonWorld,
if (filter) {
dgVector pp0(p0[0], p0[1], p0[2], dgFloat32(0.0f));
dgVector pp1(p1[0], p1[1], p1[2], dgFloat32(0.0f));
- const Newton *const world = (const Newton *)newtonWorld;
+ Newton *const world = (Newton *)newtonWorld;
world->RayCast(pp0, pp1, (OnRayCastAction)filter,
(OnRayPrecastAction)prefilter, userData);
}
@@ -2823,7 +2823,7 @@ NEWTON_API NewtonCollision *NewtonCreateCompoundCollisionFromMesh(NewtonWorld *c
NEWTON_API NewtonCollision *NewtonCreateCompoundBreakable(
NewtonWorld *const newtonWorld, int meshCount,
- const NewtonMesh **const solids, const int *const shapeIDArray,
+ NewtonMesh **const solids, const int *const shapeIDArray,
const dFloat *const densities, const int *const internalFaceMaterial,
int shapeID, int debriID, dFloat debriSeparationGap) {
Newton *world;
@@ -2833,7 +2833,7 @@ NEWTON_API NewtonCollision *NewtonCreateCompoundBreakable(
TRACE_FUNTION(__FUNCTION__);
collision = world->CreateCollisionCompoundBreakable(meshCount,
- (const dgMeshEffect **)solids, shapeIDArray, densities, internalFaceMaterial,
+ (dgMeshEffect **)solids, shapeIDArray, densities, internalFaceMaterial,
debriID, debriSeparationGap);
collision->SetUserDataID(dgUnsigned32(shapeID));
@@ -2865,7 +2865,7 @@ void NewtonCompoundBreakableSetAnchoredPieces(
dgCollisionCompoundBreakable *compound;
compound = (dgCollisionCompoundBreakable *)collision;
compound->SetAnchoredParts(fixShapesCount, (dgMatrix *)matrixPallete,
- (const dgCollision * const *)fixedShapesArray);
+ (dgCollision * const *)fixedShapesArray);
}
}
diff --git a/engines/hpl1/engine/libraries/newton/Newton.h b/engines/hpl1/engine/libraries/newton/Newton.h
index 400f0f11854..6b49ac94310 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.h
+++ b/engines/hpl1/engine/libraries/newton/Newton.h
@@ -375,7 +375,7 @@ NEWTON_API void *NewtonWorldGetUserData(const NewtonWorld *const newtonWorld);
NEWTON_API void NewtonWorldSetDestructorCallBack(NewtonWorld *const newtonWorld, NewtonDestroyWorld destructor);
NEWTON_API NewtonDestroyWorld NewtonWorldGetDestructorCallBack(const NewtonWorld *const newtonWorld);
-NEWTON_API void NewtonWorldRayCast(const NewtonWorld *const newtonWorld, const dFloat *const p0, const dFloat *const p1, NewtonWorldRayFilterCallback filter, void *const userData,
+NEWTON_API void NewtonWorldRayCast(NewtonWorld *const newtonWorld, const dFloat *const p0, const dFloat *const p1, NewtonWorldRayFilterCallback filter, void *const userData,
NewtonWorldRayPrefilterCallback prefilter);
NEWTON_API int NewtonWorldConvexCast(NewtonWorld *const newtonWorld, const dFloat *const matrix, const dFloat *const target, NewtonCollision *shape, dFloat *const hitParam, void *const userData,
NewtonWorldRayPrefilterCallback prefilter, NewtonWorldConvexCastReturnInfo *info, int maxContactsCount, int threadIndex);
@@ -527,7 +527,7 @@ NEWTON_API NewtonCollision *NewtonCreateCompoundCollisionFromMesh(NewtonWorld *c
// int shapeID, int debriID, NewtonCollisionCompoundBreakableCallback callback, void* buildUsedData);
NEWTON_API NewtonCollision *NewtonCreateCompoundBreakable(NewtonWorld *const newtonWorld, int meshCount,
- const NewtonMesh **const solids, const int *const shapeIDArray,
+ NewtonMesh **const solids, const int *const shapeIDArray,
const dFloat *const densities, const int *const internalFaceMaterial,
int shapeID, int debriID, dFloat debriSeparationGap);
diff --git a/engines/hpl1/engine/libraries/newton/NewtonClass.cpp b/engines/hpl1/engine/libraries/newton/NewtonClass.cpp
index 9a672e2c1fb..b9b896e9780 100644
--- a/engines/hpl1/engine/libraries/newton/NewtonClass.cpp
+++ b/engines/hpl1/engine/libraries/newton/NewtonClass.cpp
@@ -262,7 +262,7 @@ void NewtonUserJoint::GetInfo(dgConstraintInfo *const info) const {
info->clear();
if (m_getInfoCallback) {
InitInfo(info);
- m_getInfoCallback((NewtonJoint *) this, (NewtonJointRecord *) info);
+ m_getInfoCallback((const NewtonJoint *)this, (NewtonJointRecord *) info);
}
}
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.cpp b/engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.cpp
index f8fe6c68bab..dcc75ff51e3 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.cpp
@@ -446,7 +446,7 @@ void dgBroadPhaseCollision::Remove(dgBody *const body) {
void dgBroadPhaseCollision::UpdatePairs(dgBody *const body0,
dgSortArray::dgListNode *const srcnode, dgInt32 axisX,
- dgInt32 threadIndex) const {
+ dgInt32 threadIndex) {
// dgFloat32 val;
// dgBody* body1;
@@ -467,7 +467,7 @@ void dgBroadPhaseCollision::UpdatePairs(dgBody *const body0,
}
void dgBroadPhaseCollision::UpdatePairs(dgBroadPhaseCell &cellA,
- dgBroadPhaseCell &cellB, dgInt32 threadIndex) const {
+ dgBroadPhaseCell &cellB, dgInt32 threadIndex) {
dgInt32 axisX = cellA.m_lastSortArray->m_index;
dgSortArray *const listA = &cellA.m_sort[axisX];
dgSortArray *const listB = &cellB.m_sort[axisX];
@@ -488,7 +488,7 @@ void dgBroadPhaseCollision::UpdatePairs(dgBroadPhaseCell &cellA,
void dgBroadPhaseCollision::ForEachBodyInAABB(const dgVector &p0,
const dgVector &p1, OnBodiesInAABB callback, void *const userdata) const {
if (dgOverlapTest(p0, p1, m_appMinBox, m_appMaxBox)) {
- dgBody *const sentinel = ((dgWorld *)this)->GetSentinelBody();
+ dgBody *const sentinel = ((const dgWorld *)this)->GetSentinelBody();
dgFloat32 x0 = GetMax(p0.m_x - m_min.m_x, dgFloat32(0.0f));
// dgFloat32 y0 = GetMax (p0.m_y - m_min.m_y, dgFloat32 (0.0f));
dgFloat32 z0 = GetMax(p0.m_z - m_min.m_z, dgFloat32(0.0f));
@@ -529,7 +529,7 @@ dgInt32 dgBroadPhaseCollision::ConvexCast(dgCollision *const shape,
const dgMatrix &matrixOrigin, const dgVector &target,
dgFloat32 &timeToImpact, OnRayPrecastAction prefilter, void *const userData,
dgConvexCastReturnInfo *const info, dgInt32 maxContacts,
- dgInt32 threadIndex) const {
+ dgInt32 threadIndex) {
dgVector p0;
dgVector p1;
dgVector q0;
@@ -885,7 +885,7 @@ void dgBroadPhaseMaterialCallbackWorkerThread::ThreadExecute() {
void dgBroadPhaseCollision::RayCast(const dgVector &l0, const dgVector &l1,
OnRayCastAction filter, OnRayPrecastAction prefilter,
- void *const userData) const {
+ void *const userData) {
dgVector ll0(l0);
dgVector ll1(l1);
dgVector segment(l1 - l0);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.h b/engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.h
index 4208a4fa8fa..9ac721316c9 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgBroadPhaseCollision.h
@@ -171,8 +171,8 @@ class dgBroadPhaseCollision {
public:
void GetWorldSize(dgVector &p0, dgVector &p1) const;
void SetWorldSize(const dgVector &min, const dgVector &max);
- void RayCast(const dgVector &p0, const dgVector &p1, OnRayCastAction filter, OnRayPrecastAction prefilter, void *const userData) const;
- dgInt32 ConvexCast(dgCollision *const shape, const dgMatrix &p0, const dgVector &p1, dgFloat32 &timetoImpact, OnRayPrecastAction prefilter, void *const userData, dgConvexCastReturnInfo *const info, dgInt32 maxContacts, dgInt32 threadIndex) const;
+ void RayCast(const dgVector &p0, const dgVector &p1, OnRayCastAction filter, OnRayPrecastAction prefilter, void *const userData);
+ dgInt32 ConvexCast(dgCollision *const shape, const dgMatrix &p0, const dgVector &p1, dgFloat32 &timetoImpact, OnRayPrecastAction prefilter, void *const userData, dgConvexCastReturnInfo *const info, dgInt32 maxContacts, dgInt32 threadIndex);
void ForEachBodyInAABB(const dgVector &q0, const dgVector &q1, OnBodiesInAABB callback, void *const userData) const;
private:
@@ -192,8 +192,8 @@ private:
void UpdateBodyBroadphase(dgBody *const body, dgInt32 threadIndex);
- void UpdatePairs(dgBroadPhaseCell &cellA, dgBroadPhaseCell &cellB, dgInt32 threadIndex) const;
- void UpdatePairs(dgBody *const body0, dgSortArray::dgListNode *const listNode, dgInt32 axisX, dgInt32 threadIndex) const;
+ void UpdatePairs(dgBroadPhaseCell &cellA, dgBroadPhaseCell &cellB, dgInt32 threadIndex);
+ void UpdatePairs(dgBody *const body0, dgSortArray::dgListNode *const listNode, dgInt32 axisX, dgInt32 threadIndex);
dgVector m_min;
dgVector m_max;
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.cpp
index e94627151bd..de05061e590 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCapsule.cpp
@@ -325,11 +325,11 @@ dgVector dgCollisionCapsule::SupportVertexSimd(const dgVector &dir) const {
dgVector dgCollisionCapsule::SupportVertex(const dgVector &dir) const {
dgInt32 index;
- dgFloatSign *ptr;
+ const dgFloatSign *ptr;
_ASSERTE(dgAbsf(dir % dir - dgFloat32(1.0f)) < dgFloat32(1.0e-3f));
- ptr = (dgFloatSign *)&dir;
+ ptr = (const dgFloatSign *)&dir;
index = -(ptr[0].m_integer.m_iVal >> 31);
dgVector p(dir.Scale(m_radius));
p.m_x += m_height[index];
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
index 57edfaafadd..8cf81a1ab9f 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.cpp
@@ -605,7 +605,7 @@ void dgCollisionCompoundBreakable::dgDebriGraph::AddNode(
void dgCollisionCompoundBreakable::dgDebriGraph::AddMeshes(
dgFlatVertexArray &vertexArray, dgInt32 count,
- const dgMeshEffect *const solidArray[], const dgInt32 *const idArray,
+ dgMeshEffect *const solidArray[], const dgInt32 *const idArray,
const dgFloat32 *const densities, const dgInt32 *const internalFaceMaterial,
dgFloat32 padding) {
// padding = 0.0f;
@@ -620,7 +620,7 @@ void dgCollisionCompoundBreakable::dgDebriGraph::AddMeshes(
}
dgCollisionCompoundBreakable::dgCollisionCompoundBreakable(dgInt32 count,
- const dgMeshEffect *const solidArray[], const dgInt32 *const idArray,
+ dgMeshEffect *const solidArray[], const dgInt32 *const idArray,
const dgFloat32 *const densities, const dgInt32 *const internalFaceMaterial,
dgInt32 debriiId, dgFloat32 collisionPadding, dgWorld *world) : dgCollisionCompound(world), m_conectivity(world->GetAllocator()), m_detachedIslands(world->GetAllocator()) {
dgInt32 acc;
@@ -1114,7 +1114,7 @@ dgInt32 dgCollisionCompoundBreakable::GetSegmentsInRadius(
dgInt32 stack;
dgNodeBase *stackPool[DG_COMPOUND_STACK_DEPTH];
- dgTriplex &p = *((dgTriplex *)&origin.m_x);
+ const dgTriplex &p = *((const dgTriplex *)&origin.m_x);
dgVector p0(origin - dgVector(radius, radius, radius, dgFloat32(0.0f)));
dgVector p1(origin + dgVector(radius, radius, radius, dgFloat32(0.0f)));
@@ -1240,7 +1240,7 @@ void dgCollisionCompoundBreakable::ResetAnchor() {
}
void dgCollisionCompoundBreakable::SetAnchoredParts(dgInt32 count,
- const dgMatrix *const matrixArray, const dgCollision * const *collisionArray) {
+ const dgMatrix *const matrixArray, dgCollision * const *collisionArray) {
dgDebriGraph::dgListNode *fixNode;
dgMatrix matrix(dgGetIdentityMatrix());
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
index f3c9fd03e41..cc29202a06f 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionCompoundBreakable.h
@@ -125,7 +125,7 @@ public:
// void AddMeshes (dgFlatVertexArray& vertexArray, dgInt32 count, dgMeshEffect* const solidArray[], dgMeshEffect* const clipperArray[],
// dgMatrix* const matrixArray, dgInt32* const idArray, dgFloat32* const densities, dgCollisionCompoundBreakableCallback callback, void* buildUsedData);
- void AddMeshes(dgFlatVertexArray &vertexArray, dgInt32 count, const dgMeshEffect *const solidArray[],
+ void AddMeshes(dgFlatVertexArray &vertexArray, dgInt32 count, dgMeshEffect *const solidArray[],
const dgInt32 *const idArray, const dgFloat32 *const densities, const dgInt32 *const internalFaceMaterial, dgFloat32 gaps);
void Serialize(dgSerialize callback, void *const userData) const;
@@ -200,7 +200,7 @@ public:
// dgMatrix* const matrixArray, dgInt32* const idArray, dgFloat32* const densities, dgInt32 debriiId,
// dgCollisionCompoundBreakableCallback callback, void* buildUsedData, dgWorld* world);
- dgCollisionCompoundBreakable(dgInt32 count, const dgMeshEffect *const solidArray[], const dgInt32 *const idArray,
+ dgCollisionCompoundBreakable(dgInt32 count, dgMeshEffect *const solidArray[], const dgInt32 *const idArray,
const dgFloat32 *const densities, const dgInt32 *const internalFaceMaterial,
dgInt32 debriiId, dgFloat32 gaps, dgWorld *world);
@@ -221,7 +221,7 @@ public:
dgInt32 GetSegmentsInRadius(const dgVector &origin, dgFloat32 radius, dgDebriGraph::dgListNode **segments, dgInt32 maxCount) const;
void ResetAnchor();
- void SetAnchoredParts(dgInt32 count, const dgMatrix *const matrixArray, const dgCollision * const *collisionArray);
+ void SetAnchoredParts(dgInt32 count, const dgMatrix *const matrixArray, dgCollision * const *collisionArray);
void EnumerateIslands();
// dgInt32 GetSegmentsInRadius (const dgVector& origin, dgFloat32 radius, dgDebriGraph::dgListNode** segments, dgInt32 maxCount);
// dgInt32 GetDetachedPieces (dgCollision** shapes, dgInt32 maxCount);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.cpp b/engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.cpp
index 591a4f625a5..2cfaea759f5 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.cpp
@@ -74,7 +74,7 @@ void dgCollisionUserMesh::GetVertexListIndexList(const dgVector &p0,
const dgVector &p1, dgGetVertexListIndexList &data) const {
if (m_faceInAabb) {
return m_faceInAabb(m_userData, &p0[0], &p1[0],
- (const dgFloat32 **)&data.m_veterxArray, &data.m_vertexCount,
+ (const dgFloat32 * const *)&data.m_veterxArray, &data.m_vertexCount,
&data.m_vertexStrideInBytes, data.m_indexList, data.m_maxIndexCount,
data.m_userDataList);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.h b/engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.h
index 29b351c5229..b82b04e9704 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgCollisionUserMesh.h
@@ -31,7 +31,7 @@ typedef void (dgApi *OnUserMeshCollideCallback)(dgPolygonMeshDesc &collideData);
typedef dgFloat32(dgApi *OnUserMeshRayHitCallback)(dgCollisionMeshRayHitDesc &rayHitdata);
typedef void (dgApi *UserMeshCollisionInfo)(void *userData, dgCollisionInfo *infoRecord);
typedef void (dgApi *UserMeshFacesInAABB)(void *userData, const dgFloat32 *p0, const dgFloat32 *p1,
- const dgFloat32 **vertexArray, dgInt32 *vertexCount, dgInt32 *vertexStrideInBytes,
+ const dgFloat32 * const *vertexArray, dgInt32 *vertexCount, dgInt32 *vertexStrideInBytes,
const dgInt32 *indexList, dgInt32 maxIndexCount, const dgInt32 *faceAttribute);
class dgUserMeshCreation {
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgConstraint.h b/engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
index cac1bc4782c..ef57b94046c 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgConstraint.h
@@ -309,4 +309,3 @@ inline dgInt32 dgConstraint::GetMaxDOF() const {
}
#endif // !defined(AFX_DGCONSTRAINT_H__F9EC24E0_6E0F_4CD5_909E_A5F5E1AC7C0B__INCLUDED_)
-
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgContact.cpp b/engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
index 3f6811812cf..dca98a68e5d 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgContact.cpp
@@ -122,7 +122,7 @@ dgUnsigned32 dgContact::JacobianDerivative(dgContraintDescritor ¶ms) {
frictionIndex = GetCount();
for (dgList<dgContactMaterial>::dgListNode *node = GetFirst(); node; node =
node->GetNext()) {
- const dgContactMaterial &contact = node->GetInfo();
+ dgContactMaterial &contact = node->GetInfo();
JacobianContactDerivative(params, contact, i, frictionIndex);
i++;
}
@@ -132,7 +132,7 @@ dgUnsigned32 dgContact::JacobianDerivative(dgContraintDescritor ¶ms) {
}
void dgContact::JacobianContactDerivative(dgContraintDescritor ¶ms,
- const dgContactMaterial &contact, dgInt32 normalIndex,
+ dgContactMaterial &contact, dgInt32 normalIndex,
dgInt32 &frictionIndex) {
dgPointParam pointData;
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgContact.h b/engines/hpl1/engine/libraries/newton/physics/dgContact.h
index 78ef91f7aac..87fad354373 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgContact.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgContact.h
@@ -216,7 +216,7 @@ class dgContact:
virtual void SetDestructorCallback(OnConstraintDestroy destructor);
- void JacobianContactDerivative(dgContraintDescritor ¶ms, const dgContactMaterial &contact, dgInt32 normalIndex, dgInt32 &frictionIndex);
+ void JacobianContactDerivative(dgContraintDescritor ¶ms, dgContactMaterial &contact, dgInt32 normalIndex, dgInt32 &frictionIndex);
void CalculatePointDerivative(dgInt32 index, dgContraintDescritor &desc, const dgVector &dir, const dgPointParam ¶m) const;
@@ -261,4 +261,3 @@ inline void dgContact::SetDestructorCallback(OnConstraintDestroy destructor) {
}
#endif
-
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp b/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
index 120c9ecce13..3a293fa3999 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgMinkowskiConv.cpp
@@ -405,7 +405,7 @@ class dgContactSolver {
const dgVector &shapeNormal, dgUnsigned32 id, dgFloat32 penetration,
dgInt32 shape1VertexCount, dgVector *const shape1,
dgInt32 shape2VertexCount, dgVector *const shape2,
- dgContactPoint *const contactOut) const {
+ dgContactPoint *const contactOut) {
// dgInt32 i0;
// dgInt32 i1;
// dgInt32 count;
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp b/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
index 630531820fd..fcacf9c8f00 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgNarrowPhaseCollision.cpp
@@ -365,7 +365,7 @@ dgCollision *dgWorld::CreateCollisionCompound(dgInt32 count,
// dgCollisionCompoundBreakableCallback callback,
// void* buildUsedData)
dgCollision *dgWorld::CreateCollisionCompoundBreakable(dgInt32 count,
- const dgMeshEffect *const solidArray[], const dgInt32 *const idArray,
+ dgMeshEffect *const solidArray[], const dgInt32 *const idArray,
const dgFloat32 *const densities, const dgInt32 *const internalFaceMaterial,
dgInt32 debriID, dgFloat32 gap) {
// return new dgCollisionCompoundBreakable (count, solidArray, splitePlanes, matrixArray, idArray, densities, debriID, callback, buildUsedData, this);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorld.h b/engines/hpl1/engine/libraries/newton/physics/dgWorld.h
index 313c8343c9f..c81ad840773 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorld.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorld.h
@@ -245,7 +245,7 @@ public:
// dgMatrix* const matrixArray, dgInt32* const idArray, dgFloat32* const mass, dgInt32 debriID,
// dgCollisionCompoundBreakableCallback callback, void* buildUsedData);
- dgCollision *CreateCollisionCompoundBreakable(dgInt32 count, const dgMeshEffect *const solidArray[], const dgInt32 *const idArray,
+ dgCollision *CreateCollisionCompoundBreakable(dgInt32 count, dgMeshEffect *const solidArray[], const dgInt32 *const idArray,
const dgFloat32 *const densities, const dgInt32 *const internalFaceMaterial, dgInt32 debriID, dgFloat32 gap);
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.h b/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.h
index 93b9822fde3..d0e338a84a6 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.h
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.h
@@ -407,4 +407,3 @@ private:
#define DG_CHECK_ACTIVE(body) _ASSERTE (((body->m_invMass.m_w == dgFloat32 (0.0f)) && !body->m_active) || (body->m_invMass.m_w > dgFloat32 (0.0f)))
#endif
-
Commit: b6c650c320ab450ee5eabd836b292cf87a4fd1d2
https://github.com/scummvm/scummvm/commit/b6c650c320ab450ee5eabd836b292cf87a4fd1d2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-12-23T14:04:23+01:00
Commit Message:
HPL1: Fixed warnings
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.cpp
engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.h
engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.cpp
engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.h
engines/hpl1/engine/libraries/newton/core/dgNode.cpp
engines/hpl1/engine/libraries/newton/core/dgThreads.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.cpp b/engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.cpp
index 911d35634ee..fb45e4aac23 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.cpp
@@ -276,7 +276,7 @@ dgAABBPointTree3d *dgConvexHull3d::BuildTree(dgAABBPointTree3d *const parent, dg
-dgInt32 dgConvexHull3d::InitVertexArray(dgHullVertex *const points, const dgFloat64 *const vertexCloud, dgInt32 strideInBytes, dgInt32 count, void *const memoryPool, dgInt32 maxMemSize) {
+dgInt32 dgConvexHull3d::InitVertexArray(dgHullVertex *const points, const dgFloat64 *const vertexCloud, dgInt32 strideInBytes, dgInt32 count, void *memoryPool, dgInt32 maxMemSize) {
dgInt32 stride = dgInt32(strideInBytes / sizeof(dgFloat64));
if (stride >= 4) {
for (dgInt32 i = 0; i < count; i ++) {
@@ -489,7 +489,7 @@ dgInt32 dgConvexHull3d::SupportVertex(dgAABBPointTree3d **const treePointer, con
#define DG_STACK_DEPTH_3D 64
dgFloat64 aabbProjection[DG_STACK_DEPTH_3D];
- const dgAABBPointTree3d *stackPool[DG_STACK_DEPTH_3D];
+ dgAABBPointTree3d *stackPool[DG_STACK_DEPTH_3D];
dgInt32 index = -1;
dgInt32 stack = 1;
@@ -503,7 +503,7 @@ dgInt32 dgConvexHull3d::SupportVertex(dgAABBPointTree3d **const treePointer, con
stack--;
dgFloat64 boxSupportValue = aabbProjection[stack];
if (boxSupportValue > maxProj) {
- const dgAABBPointTree3d *const me = stackPool[stack];
+ dgAABBPointTree3d *const me = stackPool[stack];
if (me->m_left && me->m_right) {
dgBigVector leftSupportPoint(me->m_left->m_box[ix].m_x, me->m_left->m_box[iy].m_y, me->m_left->m_box[iz].m_z, dgFloat32(0.0));
@@ -1027,6 +1027,3 @@ dgFloat64 dgConvexHull3d::RayCast(const dgBigVector &localP0, const dgBigVector
#endif
return dgFloat64(1.2f);
}
-
-
-
diff --git a/engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.h b/engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.h
index d24cbe5f1c1..f274aec57e9 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgConvexHull3d.h
@@ -74,7 +74,7 @@ protected:
virtual dgListNode *AddFace(dgInt32 i0, dgInt32 i1, dgInt32 i2);
virtual void DeleteFace(dgListNode *const node) ;
- virtual dgInt32 InitVertexArray(dgHullVertex *const points, const dgFloat64 *const vertexCloud, dgInt32 strideInBytes, dgInt32 count, void *const memoryPool, dgInt32 maxMemSize);
+ virtual dgInt32 InitVertexArray(dgHullVertex *const points, const dgFloat64 *const vertexCloud, dgInt32 strideInBytes, dgInt32 count, void *memoryPool, dgInt32 maxMemSize);
void CalculateConvexHull(dgAABBPointTree3d *vertexTree, dgHullVertex *const points, dgInt32 count, dgFloat64 distTol, dgInt32 maxVertexCount);
dgInt32 BuildNormalList(dgBigVector *const normalArray) const;
diff --git a/engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.cpp b/engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.cpp
index 65755be61cd..54adbbf2eeb 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.cpp
@@ -395,7 +395,7 @@ dgInt32 dgConvexHull4d::SupportVertex(dgAABBPointTree4d **const treePointer,
#define DG_STACK_DEPTH_4D 64
dgFloat64 aabbProjection[DG_STACK_DEPTH_4D];
- const dgAABBPointTree4d *stackPool[DG_STACK_DEPTH_4D];
+ dgAABBPointTree4d *stackPool[DG_STACK_DEPTH_4D];
dgInt32 index = -1;
dgInt32 stack = 1;
@@ -410,7 +410,7 @@ dgInt32 dgConvexHull4d::SupportVertex(dgAABBPointTree4d **const treePointer,
stack--;
dgFloat64 boxSupportValue = aabbProjection[stack];
if (boxSupportValue > maxProj) {
- const dgAABBPointTree4d *const me = stackPool[stack];
+ dgAABBPointTree4d *const me = stackPool[stack];
if (me->m_left && me->m_right) {
dgBigVector leftSupportPoint(me->m_left->m_box[ix].m_x,
@@ -638,7 +638,7 @@ dgAABBPointTree4d *dgConvexHull4d::BuildTree(dgAABBPointTree4d *const parent,
}
dgInt32 dgConvexHull4d::InitVertexArray(dgHullVector *const points,
- const dgBigVector *const vertexCloud, dgInt32 count, void *const memoryPool,
+ const dgBigVector *const vertexCloud, dgInt32 count, void *memoryPool,
dgInt32 maxMemSize) {
for (dgInt32 i = 0; i < count; i++) {
points[i] = vertexCloud[i];
@@ -664,7 +664,7 @@ dgInt32 dgConvexHull4d::InitVertexArray(dgHullVector *const points,
}
dgAABBPointTree4d *tree = BuildTree(NULL, points, count, 0,
- (dgInt8 **) &memoryPool, maxMemSize);
+ (dgInt8 **)&memoryPool, maxMemSize);
dgBigVector boxSize(tree->m_box[1].Sub4(tree->m_box[0]));
m_diag = dgFloat32(sqrt(boxSize.DotProduct4(boxSize)));
@@ -1131,4 +1131,3 @@ dgInt32 dgConvexHull4d::AddVertex(const dgBigVector &vertex) {
return index;
}
-
diff --git a/engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.h b/engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.h
index 36e18d74a08..b13872dc88c 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgConvexHull4d.h
@@ -112,7 +112,7 @@ protected:
void BuildHull(dgMemoryAllocator *const allocator, const dgBigVector *const vertexCloud, dgInt32 count, dgFloat64 distTol);
virtual dgInt32 AddVertex(const dgBigVector &vertex);
- virtual dgInt32 InitVertexArray(dgHullVector *const points, const dgBigVector *const vertexCloud, dgInt32 count, void *const memoryPool, dgInt32 maxMemSize);
+ virtual dgInt32 InitVertexArray(dgHullVector *const points, const dgBigVector *const vertexCloud, dgInt32 count, void *memoryPool, dgInt32 maxMemSize);
virtual dgListNode *AddFace(dgInt32 i0, dgInt32 i1, dgInt32 i2, dgInt32 i3);
virtual void DeleteFace(dgListNode *const node) ;
diff --git a/engines/hpl1/engine/libraries/newton/core/dgNode.cpp b/engines/hpl1/engine/libraries/newton/core/dgNode.cpp
index 5528e30e0e7..60de1221b2d 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgNode.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgNode.cpp
@@ -132,27 +132,27 @@ const dgBaseNode *dgBaseNode::GetRoot() const {
for (root = this; root->parent; root = root->parent) {
}
- return (dgBaseNode *) root;
+ return (const dgBaseNode *) root;
}
const dgBaseNode *dgBaseNode::GetFirst() const {
- dgBaseNode *ptr;
+ const dgBaseNode *ptr;
- for (ptr = (dgBaseNode *) this; ptr->child; ptr = ptr->child) {
+ for (ptr = (const dgBaseNode *)this; ptr->child; ptr = ptr->child) {
}
return ptr;
}
const dgBaseNode *dgBaseNode::GetNext() const {
- dgBaseNode *x;
+ const dgBaseNode *x;
dgBaseNode *ptr;
if (sibling) {
return sibling->GetFirst();
}
- x = (dgBaseNode *) this;
+ x = (const dgBaseNode *)this;
for (ptr = parent; ptr && (x == ptr->sibling); ptr = ptr->parent) {
x = ptr;
}
@@ -160,23 +160,23 @@ const dgBaseNode *dgBaseNode::GetNext() const {
}
const dgBaseNode *dgBaseNode::GetLast() const {
- dgBaseNode *ptr;
+ const dgBaseNode *ptr;
- for (ptr = (dgBaseNode *) this; ptr->sibling; ptr = ptr->sibling) {
+ for (ptr = (const dgBaseNode *)this; ptr->sibling; ptr = ptr->sibling) {
}
return ptr;
}
const dgBaseNode *dgBaseNode::GetPrev() const {
- dgBaseNode *x;
+ const dgBaseNode *x;
dgBaseNode *ptr;
if (child) {
return child->GetNext();
}
- x = (dgBaseNode *) this;
+ x = (const dgBaseNode *)this;
for (ptr = parent; ptr && (x == ptr->child); ptr = ptr->child) {
x = ptr;
}
@@ -284,4 +284,3 @@ void dgBaseNode::DebugPrint(const char *fileName) {
PrintHierarchy (file, indent);
*/
}
-
diff --git a/engines/hpl1/engine/libraries/newton/core/dgThreads.cpp b/engines/hpl1/engine/libraries/newton/core/dgThreads.cpp
index 6cf4cf38f93..511a2e780e3 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgThreads.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgThreads.cpp
@@ -100,9 +100,9 @@ dgInt32 dgThreads::GetWork(dgWorkerThread **job) {
}
void dgThreads::DoWork(dgInt32 mythreadIndex) {
- dgWorkerThread *job;
+// dgWorkerThread *job;
- job->ThreadExecute();
+// job->ThreadExecute();
}
void dgThreads::SynchronizationBarrier() {
Commit: ec8cd95382fd4e568dcb40868bb7aade3be52de1
https://github.com/scummvm/scummvm/commit/ec8cd95382fd4e568dcb40868bb7aade3be52de1
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:23+01:00
Commit Message:
HPL1: remove global variable
Changed paths:
engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
engines/hpl1/engine/impl/PhysicsBodyNewton.h
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
index 265b1d22da6..f57f04e750c 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.cpp
@@ -430,14 +430,13 @@ void cPhysicsBodyNewton::OnTransformCallback(const NewtonBody *apBody, const dFl
//-----------------------------------------------------------------------
-// callback for buoyancy
-static cPlanef gSurfacePlane;
-static int BuoyancyPlaneCallback(const int alCollisionID, void *apContext,
+int cPhysicsBodyNewton::BuoyancyPlaneCallback(const int alCollisionID, void *apContext,
const float *afGlobalSpaceMatrix, float *afGlobalSpacePlane) {
- afGlobalSpacePlane[0] = gSurfacePlane.a;
- afGlobalSpacePlane[1] = gSurfacePlane.b;
- afGlobalSpacePlane[2] = gSurfacePlane.c;
- afGlobalSpacePlane[3] = gSurfacePlane.d;
+ cPlanef surfacePlane = static_cast<cPhysicsBodyNewton*>(apContext)->mBuoyancy.mSurface;
+ afGlobalSpacePlane[0] = surfacePlane.a;
+ afGlobalSpacePlane[1] = surfacePlane.b;
+ afGlobalSpacePlane[2] = surfacePlane.c;
+ afGlobalSpacePlane[3] = surfacePlane.d;
return 1;
}
@@ -461,7 +460,6 @@ void cPhysicsBodyNewton::OnUpdateCallback(NewtonBody *apBody, float, int) {
// Create Buoyancy
if (pRigidBody->mBuoyancy.mbActive) {
- gSurfacePlane = pRigidBody->mBuoyancy.mSurface;
VEC3_CONST_ARRAY(gravity, vGravity);
NewtonBodyAddBuoyancyForce(apBody,
pRigidBody->mBuoyancy.mfDensity,
diff --git a/engines/hpl1/engine/impl/PhysicsBodyNewton.h b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
index d308aa93ab0..4100edc2b60 100644
--- a/engines/hpl1/engine/impl/PhysicsBodyNewton.h
+++ b/engines/hpl1/engine/impl/PhysicsBodyNewton.h
@@ -101,6 +101,8 @@ public:
static void SetUseCallback(bool abX) { mbUseCallback = abX; }
private:
+ static int BuoyancyPlaneCallback(const int alCollisionID, void *apContext,
+ const float *afGlobalSpaceMatrix, float *afGlobalSpacePlane);
static void OnTransformCallback(const NewtonBody *apBody, const dFloat *apMatrix, int);
static void OnUpdateCallback(NewtonBody *apBody, float, int);
Commit: 53363ce2c7242b776ae217b29499f103516ae964
https://github.com/scummvm/scummvm/commit/53363ce2c7242b776ae217b29499f103516ae964
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:23+01:00
Commit Message:
HPL1: remove global cleanup class
Changed paths:
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h
engines/hpl1/engine/system/low_level_system.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
index ca45a1c30c1..c21fc2355b8 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.cpp
@@ -104,27 +104,6 @@ CStdStringFactory *GetStdStringFactorySingleton() {
return stringFactory;
}
-class CStdStringFactoryCleaner {
-public:
- ~CStdStringFactoryCleaner() {
- if (stringFactory) {
- // Only delete the string factory if the stringCache is empty
- // If it is not empty, it means that someone might still attempt
- // to release string constants, so if we delete the string factory
- // the application might crash. Not deleting the cache would
- // lead to a memory leak, but since this is only happens when the
- // application is shutting down anyway, it is not important.
- if (stringFactory->stringCache.empty()) {
- delete stringFactory;
- stringFactory = 0;
- }
- }
- }
-};
-
-static CStdStringFactoryCleaner cleaner;
-
-
static void ConstructString(Common::String *thisPointer) {
new (thisPointer) Common::String();
}
@@ -1044,4 +1023,11 @@ void RegisterStdString(asIScriptEngine *engine) {
RegisterStdString_Native(engine);
}
+void cleanupRegisteredString() {
+ if (stringFactory && stringFactory->stringCache.empty()) {
+ delete stringFactory;
+ stringFactory = nullptr;
+ }
+}
+
END_AS_NAMESPACE
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h
index 341e73a9720..3b508dbef2e 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptstdstring.h
@@ -39,6 +39,7 @@
BEGIN_AS_NAMESPACE
void RegisterStdString(asIScriptEngine *engine);
+void cleanupRegisteredString();
END_AS_NAMESPACE
diff --git a/engines/hpl1/engine/system/low_level_system.cpp b/engines/hpl1/engine/system/low_level_system.cpp
index d3651564caa..2d8cc61bd8c 100644
--- a/engines/hpl1/engine/system/low_level_system.cpp
+++ b/engines/hpl1/engine/system/low_level_system.cpp
@@ -43,6 +43,7 @@ LowLevelSystem::LowLevelSystem() {
LowLevelSystem::~LowLevelSystem() {
/*Release all runnings contexts */
+ cleanupRegisteredString();
_scriptOutput->Display();
_scriptEngine->Release();
hplDelete(_scriptOutput);
Commit: a66975186443fd1de5dc4c4a336ae520739bd3f2
https://github.com/scummvm/scummvm/commit/a66975186443fd1de5dc4c4a336ae520739bd3f2
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:23+01:00
Commit Message:
HPL1: fix warnings
could't find a better solution that doesn't need to modify library code
Changed paths:
engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
diff --git a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
index 866e801dc72..b4916651fbc 100644
--- a/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
+++ b/engines/hpl1/engine/libraries/angelscript/add-ons/scriptarray.cpp
@@ -1075,9 +1075,9 @@ bool CScriptArray::Equals(const void *a, const void *b, asIScriptContext *ctx, S
r = ctx->SetArgObject(0, *((void * const *)b));
assert(r >= 0);
} else {
- r = ctx->SetObject((void *)a);
+ r = ctx->SetObject(const_cast<void *>(a));
assert(r >= 0);
- r = ctx->SetArgObject(0, (void *)b);
+ r = ctx->SetArgObject(0, const_cast<void *>(b));
assert(r >= 0);
}
@@ -1101,9 +1101,9 @@ bool CScriptArray::Equals(const void *a, const void *b, asIScriptContext *ctx, S
r = ctx->SetArgObject(0, *((void * const *)b));
assert(r >= 0);
} else {
- r = ctx->SetObject((void *)a);
+ r = ctx->SetObject(const_cast<void *>(a));
assert(r >= 0);
- r = ctx->SetArgObject(0, (void *)b);
+ r = ctx->SetArgObject(0, const_cast<void *>(b));
assert(r >= 0);
}
Commit: 92d017e5b479bb90fe2f25a17a53f604b2d3b5de
https://github.com/scummvm/scummvm/commit/92d017e5b479bb90fe2f25a17a53f604b2d3b5de
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:23+01:00
Commit Message:
HPL1: move global initialization of static members
Changed paths:
engines/hpl1/engine/scene/SoundEntity.cpp
engines/hpl1/engine/scene/SoundEntity.h
engines/hpl1/penumbra-overture/Init.cpp
diff --git a/engines/hpl1/engine/scene/SoundEntity.cpp b/engines/hpl1/engine/scene/SoundEntity.cpp
index 3bf3cc82a88..311fc8c5320 100644
--- a/engines/hpl1/engine/scene/SoundEntity.cpp
+++ b/engines/hpl1/engine/scene/SoundEntity.cpp
@@ -41,7 +41,16 @@
namespace hpl {
-tSoundEntityGlobalCallbackList cSoundEntity::mlstGobalCallbacks;
+tSoundEntityGlobalCallbackList *cSoundEntity::mlstGlobalCallbacks = nullptr;
+
+void cSoundEntity::initGlobalCallbackList()
+{
+ cSoundEntity::mlstGlobalCallbacks = new tSoundEntityGlobalCallbackList;
+}
+void cSoundEntity::finalizeGlobalCallbackList()
+{
+ delete cSoundEntity::mlstGlobalCallbacks;
+}
//////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
@@ -380,8 +389,8 @@ void cSoundEntity::UpdateLogic(float afTimeStep) {
mbPrioRemove = false;
// Call the callbacks that the sound has started.
- tSoundEntityGlobalCallbackListIt it = mlstGobalCallbacks.begin();
- for (; it != mlstGobalCallbacks.end(); ++it) {
+ tSoundEntityGlobalCallbackListIt it = mlstGlobalCallbacks->begin();
+ for (; it != mlstGlobalCallbacks->end(); ++it) {
iSoundEntityGlobalCallback *pCallback = *it;
pCallback->OnStart(this);
}
@@ -437,16 +446,16 @@ void cSoundEntity::UpdateLogic(float afTimeStep) {
//-----------------------------------------------------------------------
void cSoundEntity::AddGlobalCallback(iSoundEntityGlobalCallback *apCallback) {
- mlstGobalCallbacks.push_back(apCallback);
+ mlstGlobalCallbacks->push_back(apCallback);
}
//-----------------------------------------------------------------------
void cSoundEntity::RemoveGlobalCallback(iSoundEntityGlobalCallback *apCallback) {
- tSoundEntityGlobalCallbackListIt it = mlstGobalCallbacks.begin();
- for (; it != mlstGobalCallbacks.end(); ++it) {
+ tSoundEntityGlobalCallbackListIt it = mlstGlobalCallbacks->begin();
+ for (; it != mlstGlobalCallbacks->end(); ++it) {
if (apCallback == *it) {
- mlstGobalCallbacks.erase(it);
+ mlstGlobalCallbacks->erase(it);
return;
}
}
diff --git a/engines/hpl1/engine/scene/SoundEntity.h b/engines/hpl1/engine/scene/SoundEntity.h
index 6f7a39e06e9..7f7a2c4b926 100644
--- a/engines/hpl1/engine/scene/SoundEntity.h
+++ b/engines/hpl1/engine/scene/SoundEntity.h
@@ -88,6 +88,9 @@ class cSoundEntity : public iEntity3D {
friend class cSoundEntityChannelCallback;
public:
+ static void initGlobalCallbackList();
+ static void finalizeGlobalCallbackList();
+
cSoundEntity(const tString &asName, cSoundEntityData *apData,
cSoundEntityManager *apSoundEntityManager,
cWorld3D *apWorld,
@@ -166,7 +169,7 @@ private:
float _fadeSpeed;
- static tSoundEntityGlobalCallbackList mlstGobalCallbacks;
+ static tSoundEntityGlobalCallbackList* mlstGlobalCallbacks;
};
} // namespace hpl
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 754414ab193..33531bd48a9 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -250,6 +250,8 @@ bool cInit::Init(tString saveToLoad) {
Hpl1::serializeInit();
Hpl1::engineSerializeInit();
Hpl1::penumbraOvertureSerializeInit();
+ cSoundEntity::initGlobalCallbackList();
+
SetWindowCaption("Penumbra Loading...");
// MAIN INIT /////////////////////
@@ -707,6 +709,8 @@ void cInit::Exit() {
Log(" Exit Demo end text\n");
hplDelete(mpDemoEndText);
+ cSoundEntity::finalizeGlobalCallbackList();
+
Log(" Saving config\n");
// Save engine stuff.
ConfMan.setBool("bloom", mpGame->GetGraphics()->GetRendererPostEffects()->GetBloomActive());
Commit: 66f620e585f35a5395adf40f575dbf27651219a9
https://github.com/scummvm/scummvm/commit/66f620e585f35a5395adf40f575dbf27651219a9
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:24+01:00
Commit Message:
HPL1: remove unused classes
Changed paths:
R engines/hpl1/engine/system/MemoryManager.cpp
engines/hpl1/engine/system/MemoryManager.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/system/MemoryManager.cpp b/engines/hpl1/engine/system/MemoryManager.cpp
deleted file mode 100644
index 7ce5b1cbfde..00000000000
--- a/engines/hpl1/engine/system/MemoryManager.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#include "hpl1/engine/system/MemoryManager.h"
-
-#include "hpl1/engine/system/low_level_system.h"
-
-namespace hpl {
-
-tAllocatedPointerMap cMemoryManager::m_mapPointers;
-size_t cMemoryManager::mlTotalMemoryUsage = 0;
-bool cMemoryManager::mbLogDeletion = false;
-bool cMemoryManager::mbLogCreation = false;
-int cMemoryManager::mlCreationCount = 0;
-
-//////////////////////////////////////////////////////////////////////////
-// ALLOCATED POINTER
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cAllocatedPointer::cAllocatedPointer(void *apData, const Common::String &asFile, int alLine, size_t alMemory) {
- mpData = apData;
- msFile = asFile;
- mlLine = alLine;
- mlMemory = alMemory;
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-void *cMemoryManager::AddPointer(const cAllocatedPointer &aAllocatedPointer) {
- m_mapPointers.insert(tAllocatedPointerMap::value_type(aAllocatedPointer.mpData, aAllocatedPointer));
- mlTotalMemoryUsage += aAllocatedPointer.mlMemory;
-
- if (mbLogCreation) {
- // Log("Creation at: %s, line %d\n",aAllocatedPointer.msFile.c_str(),aAllocatedPointer.mlLine);
- mlCreationCount++;
- }
-
- return aAllocatedPointer.mpData;
-}
-//-----------------------------------------------------------------------
-
-bool cMemoryManager::RemovePointer(void *apData) {
- bool bFound = false;
- tAllocatedPointerMapIt it = m_mapPointers.upper_bound(apData);
- it--;
- if (it != m_mapPointers.end()) {
- char *apTest = (char *)it->second.mpData;
- size_t testSize = it->second.mlMemory;
- if (apData >= apTest && apData < apTest + testSize)
- bFound = true;
- }
-
- if (bFound == false) {
- Warning("Trying to delete pointer %d created that does not exist!\n", apData);
- return false;
- }
-
- mlTotalMemoryUsage -= it->second.mlMemory;
-
- m_mapPointers.erase(it);
-
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-void cMemoryManager::LogResults() {
- Log("\n|--Memory Manager Report-------------------------------|\n");
- Log("|\n");
-
- if (m_mapPointers.empty()) {
- Log("| No memory leaks detected. Memory left: %d\n", mlTotalMemoryUsage);
- } else {
- Log("| Memory leaks detected: \n");
- Log("|\n");
-
- Log("| address\t file");
-
- // Get max length of file name
- int lMax = 0;
- tAllocatedPointerMapIt it = m_mapPointers.begin();
- for (; it != m_mapPointers.end(); ++it) {
- cAllocatedPointer &ap = it->second;
- if ((int)ap.msFile.size() > lMax)
- lMax = (int)ap.msFile.size();
- }
-
- lMax += 5;
-
- for (int i = 0; i < lMax - 4; ++i)
- Log(" ");
-
- Log("line\t\t memory usage\t \n");
-
- Log("|------------------------------------------------------------\n");
-
- it = m_mapPointers.begin();
- for (; it != m_mapPointers.end(); ++it) {
- cAllocatedPointer &ap = it->second;
- Log("| %d\t %s", ap.mpData, ap.msFile.c_str());
- for (int i = 0; i < lMax - (int)ap.msFile.size(); ++i)
- Log(" ");
- Log("%d\t\t %d\t\n", ap.mlLine, ap.mlMemory);
- }
- }
- Log("|\n");
- Log("|------------------------------------------------------|\n\n");
-}
-
-//-----------------------------------------------------------------------
-
-void cMemoryManager::SetLogCreation(bool abX) {
- mbLogCreation = abX;
-}
-
-//-----------------------------------------------------------------------
-
-} // namespace hpl
diff --git a/engines/hpl1/engine/system/MemoryManager.h b/engines/hpl1/engine/system/MemoryManager.h
index 5bd19fefa25..30f41fff808 100644
--- a/engines/hpl1/engine/system/MemoryManager.h
+++ b/engines/hpl1/engine/system/MemoryManager.h
@@ -31,101 +31,6 @@
#include "hpl1/std/map.h"
#include "common/str.h"
-namespace hpl {
-
-//------------------------------------
-
-class cAllocatedPointer {
-public:
- cAllocatedPointer(void *apData, const Common::String &asFile, int alLine, size_t alMemory);
-
- Common::String msFile;
- int mlLine;
- size_t mlMemory;
- void *mpData;
-};
-
-//------------------------------------
-
-typedef Hpl1::Std::map<void *, cAllocatedPointer> tAllocatedPointerMap;
-typedef tAllocatedPointerMap::iterator tAllocatedPointerMapIt;
-
-//------------------------------------
-
-class cMemoryManager {
-public:
- static void *AddPointer(const cAllocatedPointer &aAllocatedPointer);
-
- static bool RemovePointer(void *apData);
-
- static void LogResults();
-
- static tAllocatedPointerMap m_mapPointers;
- static size_t mlTotalMemoryUsage;
-
- static bool mbLogDeletion;
-
- template<class T>
- static T *DeleteAndReturn(T *apData) {
- delete apData;
- return apData;
- }
-
- template<class T>
- static T *DeleteArrayAndReturn(T *apData) {
- delete[] apData;
- return apData;
- }
-
- template<class T>
- static T *FreeAndReturn(T *apData) {
- free(apData);
- return apData;
- }
-
- static void SetLogCreation(bool abX);
- static bool GetLogCreation() { return mbLogCreation; }
-
- static int GetCreationCount() { return mlCreationCount; }
-
-private:
- static bool mbLogCreation;
- static int mlCreationCount;
-};
-
-//------------------------------------
-
-//#define MEMORY_MANAGER_ACTIVE
-#ifdef MEMORY_MANAGER_ACTIVE
-
-#define hplNew(classType, constructor) \
- (classType *)hpl::cMemoryManager::AddPointer(hpl::cAllocatedPointer(new classType constructor, __FILE__, __LINE__, sizeof(classType)))
-
-#define hplNewArray(classType, amount) \
- (classType *)hpl::cMemoryManager::AddPointer(hpl::cAllocatedPointer(new classType[amount], __FILE__, __LINE__, amount * sizeof(classType)))
-
-#define hplMalloc(amount) \
- hpl::cMemoryManager::AddPointer(hpl::cAllocatedPointer(malloc(amount), __FILE__, __LINE__, amount))
-
-#define hplDelete(data) \
- { \
- if (hpl::cMemoryManager::RemovePointer(hpl::cMemoryManager::DeleteAndReturn(data)) == false) \
- hpl::Log("Deleting at '%s' %d\n", __FILE__, __LINE__); \
- } // delete data;
-
-#define hplDeleteArray(data) \
- { \
- if (hpl::cMemoryManager::RemovePointer(hpl::cMemoryManager::DeleteArrayAndReturn(data)) == false) \
- hpl::Log("Deleting at '%s' %d\n", __FILE__, __LINE__); \
- } // delete [] data;
-
-#define hplFree(data) \
- { \
- if (hpl::cMemoryManager::RemovePointer(hpl::cMemoryManager::FreeAndReturn(data)) == false) \
- hpl::Log("Deleting at '%s' %d\n", __FILE__, __LINE__); \
- } // free(data);
-
-#else
#define hplNew(classType, constructor) \
new classType constructor
@@ -144,10 +49,4 @@ private:
#define hplFree(data) \
free(data);
-#endif
-
-//------------------------------------
-
-} // namespace hpl
-
#endif // HPL_MEMORY_MANAGER_H
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 2f5e355670f..7e97a865dd4 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -230,7 +230,6 @@ MODULE_OBJS := \
engine/system/Container.o \
engine/system/LogicTimer.o \
engine/system/low_level_system.o \
- engine/system/MemoryManager.o \
engine/system/SerializeClass.o \
engine/system/String.o \
engine/system/System.o \
Commit: c74813af6c6136b265af2869e4f3e1669d8b6e9f
https://github.com/scummvm/scummvm/commit/c74813af6c6136b265af2869e4f3e1669d8b6e9f
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:24+01:00
Commit Message:
HPL1: move global initialization of static member
Changed paths:
engines/hpl1/engine/system/SerializeClass.cpp
engines/hpl1/engine/system/SerializeClass.h
engines/hpl1/penumbra-overture/Init.cpp
diff --git a/engines/hpl1/engine/system/SerializeClass.cpp b/engines/hpl1/engine/system/SerializeClass.cpp
index 0f495b3c144..d226df45639 100644
--- a/engines/hpl1/engine/system/SerializeClass.cpp
+++ b/engines/hpl1/engine/system/SerializeClass.cpp
@@ -104,10 +104,19 @@ cSerializeMemberField *cSerializeMemberFieldIterator::GetNext() {
//-----------------------------------------------------------------------
// Define static variables
-tSerializeSavedClassMap cSerializeClass::m_mapSavedClasses;
+tSerializeSavedClassMap *cSerializeClass::m_mapSavedClasses;
bool cSerializeClass::mbDataSetup = false;
char cSerializeClass::msTempCharArray[2048];
+void cSerializeClass::initSaveClassesMap()
+{
+ cSerializeClass::m_mapSavedClasses = new tSerializeSavedClassMap;
+}
+void cSerializeClass::finalizeSaveClassesMap()
+{
+ delete cSerializeClass::m_mapSavedClasses;
+}
+
//-----------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////
@@ -312,8 +321,8 @@ void cSerializeClass::LoadFromElement(iSerializable *apData, TiXmlElement *apEle
cSerializeSavedClass *cSerializeClass::GetClass(const tString &asName) {
SetUpData();
- tSerializeSavedClassMapIt it = m_mapSavedClasses.find(asName.c_str());
- if (it == m_mapSavedClasses.end()) {
+ tSerializeSavedClassMapIt it = m_mapSavedClasses->find(asName.c_str());
+ if (it == m_mapSavedClasses->end()) {
Warning("Serialize class '%s' not found!\n", asName.c_str());
return NULL;
}
@@ -1038,7 +1047,7 @@ void cSerializeClass::SetUpData() {
mbDataSetup = true;
for (int i = 0; i < Hpl1::nSerializeTempClasses; i++) {
- m_mapSavedClasses.insert(tSerializeSavedClassMap::value_type(
+ m_mapSavedClasses->insert(tSerializeSavedClassMap::value_type(
Hpl1::serializeTempClasses[i].msName, Hpl1::serializeTempClasses[i]));
}
}
diff --git a/engines/hpl1/engine/system/SerializeClass.h b/engines/hpl1/engine/system/SerializeClass.h
index 631c323f239..27438800d40 100644
--- a/engines/hpl1/engine/system/SerializeClass.h
+++ b/engines/hpl1/engine/system/SerializeClass.h
@@ -285,6 +285,9 @@ typedef tSerializeSavedClassList::iterator tSerializeSavedClassListIt;
class cSerializeClass {
public:
+ static void initSaveClassesMap();
+ static void finalizeSaveClassesMap();
+
static void SetLog(bool abX);
static bool GetLog();
@@ -327,7 +330,7 @@ private:
static char msTempCharArray[2048];
static bool mbDataSetup;
- static tSerializeSavedClassMap m_mapSavedClasses;
+ static tSerializeSavedClassMap *m_mapSavedClasses;
static Common::Array<iSerializableType *> mvValueTypes;
};
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index 33531bd48a9..e79f43e2e47 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -251,6 +251,7 @@ bool cInit::Init(tString saveToLoad) {
Hpl1::engineSerializeInit();
Hpl1::penumbraOvertureSerializeInit();
cSoundEntity::initGlobalCallbackList();
+ cSerializeClass::initSaveClassesMap();
SetWindowCaption("Penumbra Loading...");
@@ -710,6 +711,7 @@ void cInit::Exit() {
hplDelete(mpDemoEndText);
cSoundEntity::finalizeGlobalCallbackList();
+ cSerializeClass::finalizeSaveClassesMap();
Log(" Saving config\n");
// Save engine stuff.
Commit: b5b3c485df4fb751f5d5552a1339584da9f06274
https://github.com/scummvm/scummvm/commit/b5b3c485df4fb751f5d5552a1339584da9f06274
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:24+01:00
Commit Message:
HPL1: fix warnings
Changed paths:
engines/hpl1/penumbra-overture/GameScripts.cpp
engines/hpl1/penumbra-overture/GameScripts.h
engines/hpl1/penumbra-overture/Init.cpp
engines/hpl1/penumbra-overture/MainMenu.cpp
diff --git a/engines/hpl1/penumbra-overture/GameScripts.cpp b/engines/hpl1/penumbra-overture/GameScripts.cpp
index ccb0bffe7a0..8a3f5e91288 100644
--- a/engines/hpl1/penumbra-overture/GameScripts.cpp
+++ b/engines/hpl1/penumbra-overture/GameScripts.cpp
@@ -82,18 +82,18 @@
//-----------------------------------------------------------------------
-tWString gsTempString = _W("");
+tWString *gsTempString = nullptr;
//-----------------------------------------------------------------------
static void AddToTempString(tString asString) {
- gsTempString += cString::To16Char(asString);
+ *gsTempString += cString::To16Char(asString);
}
SCRIPT_DEFINE_FUNC_1(void, AddToTempString, string)
static void AddToTempStringTrans(tString asCat, tString asEntry) {
cInit *mpInit = gpInit;
- gsTempString += kTranslate(asCat, asEntry);
+ *gsTempString += kTranslate(asCat, asEntry);
}
SCRIPT_DEFINE_FUNC_2(void, AddToTempStringTrans, string, string)
@@ -103,11 +103,11 @@ static void AddToTempStringAction(tString asAction) {
if (pAction) {
tWString sString = kTranslate("ButtonNames", pAction->GetInputName());
if (sString != _W(""))
- gsTempString += sString;
+ *gsTempString += sString;
else
- gsTempString += cString::To16Char(pAction->GetInputName());
+ *gsTempString += cString::To16Char(pAction->GetInputName());
} else {
- gsTempString += kTranslate("ButtonNames", "None");
+ *gsTempString += kTranslate("ButtonNames", "None");
}
}
SCRIPT_DEFINE_FUNC_1(void, AddToTempStringAction, string)
@@ -174,8 +174,8 @@ SCRIPT_DEFINE_FUNC_1(void, AddMessage, string)
//-----------------------------------------------------------------------
static void AddMessageTempString() {
- gpInit->mpGameMessageHandler->Add(gsTempString);
- gsTempString = _W("");
+ gpInit->mpGameMessageHandler->Add(*gsTempString);
+ *gsTempString = _W("");
}
SCRIPT_DEFINE_FUNC(void, AddMessageTempString)
@@ -198,8 +198,8 @@ SCRIPT_DEFINE_FUNC_2(void, AddSubTitle, string, float)
//-----------------------------------------------------------------------
static void AddSubTitleTempString(float afTime) {
- gpInit->mpEffectHandler->GetSubTitle()->Add(gsTempString, afTime, false);
- gsTempString = _W("");
+ gpInit->mpEffectHandler->GetSubTitle()->Add(*gsTempString, afTime, false);
+ *gsTempString = _W("");
}
SCRIPT_DEFINE_FUNC_1(void, AddSubTitleTempString, float)
@@ -1571,6 +1571,7 @@ SCRIPT_DEFINE_FUNC_4(void, CreateSoundEntityAt, string, string, string, string)
void cGameScripts::Init() {
LowLevelSystem *pLowLevelSystem = gpInit->mpGame->GetSystem()->GetLowLevel();
+ gsTempString = new tWString;
// Game helper
pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(AddToTempString));
@@ -1743,4 +1744,9 @@ void cGameScripts::Init() {
pLowLevelSystem->addScriptFunc(SCRIPT_REGISTER_FUNC(CreateSoundEntityAt));
}
+void cGameScripts::finalize()
+{
+ delete gsTempString;
+}
+
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/GameScripts.h b/engines/hpl1/penumbra-overture/GameScripts.h
index 8eb27d1bde1..a38da12c3a7 100644
--- a/engines/hpl1/penumbra-overture/GameScripts.h
+++ b/engines/hpl1/penumbra-overture/GameScripts.h
@@ -38,6 +38,7 @@ using namespace hpl;
class cGameScripts {
public:
static void Init();
+ static void finalize();
};
#endif // GAME_SCRIPTS_H
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index e79f43e2e47..ef33c16cd95 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -712,6 +712,7 @@ void cInit::Exit() {
cSoundEntity::finalizeGlobalCallbackList();
cSerializeClass::finalizeSaveClassesMap();
+ cGameScripts::finalize();
Log(" Saving config\n");
// Save engine stuff.
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 92d2c30d463..11f8942def3 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -688,7 +688,7 @@ void cMainMenuWidget_Resume::OnMouseDown(eMButton aButton) {
//-----------------------------------------------------------------------
-tWStringVec gvSaveGameFileVec[3];
+tWStringVec *gvSaveGameFileVec;
class cMainMenuWidget_SaveGameList : public cMainMenuWidget_List {
public:
@@ -1675,6 +1675,7 @@ private:
//-----------------------------------------------------------------------
cMainMenu::cMainMenu(cInit *apInit) : iUpdateable("MainMenu") {
+ gvSaveGameFileVec = new tWStringVec[3];
mState = eMainMenuState_Start;
mpLogo = NULL;
@@ -1727,11 +1728,7 @@ cMainMenu::cMainMenu(cInit *apInit) : iUpdateable("MainMenu") {
cMainMenu::~cMainMenu(void) {
STLDeleteAll(mlstWidgets);
- // prevents the strings from still staying
- // around after the game is closed
- gvSaveGameFileVec[0].clear();
- gvSaveGameFileVec[1].clear();
- gvSaveGameFileVec[2].clear();
+ delete[] gvSaveGameFileVec;
mpDrawer->DestroyGfxObject(mpGfxBlackQuad);
mpDrawer->DestroyGfxObject(mpGfxMouse);
Commit: 2e4a711ab223fc1013bd2c4be15950a218aba3f7
https://github.com/scummvm/scummvm/commit/2e4a711ab223fc1013bd2c4be15950a218aba3f7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-12-23T14:04:24+01:00
Commit Message:
HPL1: make global const varialbes constexpr
Changed paths:
engines/hpl1/engine/libraries/newton/core/dgMatrix.cpp
engines/hpl1/engine/libraries/newton/core/dgMatrix.h
engines/hpl1/engine/libraries/newton/core/dgVector.h
engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
diff --git a/engines/hpl1/engine/libraries/newton/core/dgMatrix.cpp b/engines/hpl1/engine/libraries/newton/core/dgMatrix.cpp
index 5300b61a85c..9b2f56ca532 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgMatrix.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgMatrix.cpp
@@ -23,7 +23,7 @@
#include "dgMatrix.h"
#include "dgQuaternion.h"
-static dgMatrix zeroMatrix(
+static constexpr dgMatrix zeroMatrix(
dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
dgFloat32(0.0f)),
dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
@@ -33,7 +33,7 @@ static dgMatrix zeroMatrix(
dgVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
dgFloat32(0.0f)));
-static dgMatrix identityMatrix(
+static constexpr dgMatrix identityMatrix(
dgVector(dgFloat32(1.0f), dgFloat32(0.0f), dgFloat32(0.0f),
dgFloat32(0.0f)),
dgVector(dgFloat32(0.0f), dgFloat32(1.0f), dgFloat32(0.0f),
diff --git a/engines/hpl1/engine/libraries/newton/core/dgMatrix.h b/engines/hpl1/engine/libraries/newton/core/dgMatrix.h
index 8ec043c8762..a53118ffdf2 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgMatrix.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgMatrix.h
@@ -43,7 +43,7 @@ public:
DG_CLASS_ALLOCATOR(allocator)
dgMatrix();
- dgMatrix(const dgVector &front, const dgVector &up, const dgVector &right, const dgVector &posit);
+ constexpr dgMatrix(const dgVector &front, const dgVector &up, const dgVector &right, const dgVector &posit);
dgMatrix(const dgQuaternion &rotation, const dgVector &position);
// create a orthonormal normal vector basis
@@ -112,7 +112,7 @@ public:
DG_INLINE dgMatrix::dgMatrix() {
}
-DG_INLINE dgMatrix::dgMatrix(const dgVector &front, const dgVector &up, const dgVector &right, const dgVector &posit)
+constexpr DG_INLINE dgMatrix::dgMatrix(const dgVector &front, const dgVector &up, const dgVector &right, const dgVector &posit)
: m_front(front), m_up(up), m_right(right), m_posit(posit) {
}
diff --git a/engines/hpl1/engine/libraries/newton/core/dgVector.h b/engines/hpl1/engine/libraries/newton/core/dgVector.h
index ea4c987155d..0563ecc4541 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgVector.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgVector.h
@@ -35,7 +35,7 @@ class dgTemplateVector {
public:
dgTemplateVector();
dgTemplateVector(const T *ptr);
- dgTemplateVector(T m_x, T m_y, T m_z, T m_w);
+ constexpr dgTemplateVector(T m_x, T m_y, T m_z, T m_w);
dgTemplateVector Scale(T s) const;
dgTemplateVector Scale4(T s) const;
@@ -91,7 +91,7 @@ public:
#endif
dgVector(const dgTemplateVector<dgFloat32> &v);
dgVector(const dgFloat32 *ptr);
- dgVector(dgFloat32 x, dgFloat32 y, dgFloat32 z, dgFloat32 w);
+ constexpr dgVector(dgFloat32 x, dgFloat32 y, dgFloat32 z, dgFloat32 w);
dgVector(const dgBigVector ©);
dgFloat32 DotProductSimd(const dgVector &A) const;
@@ -127,7 +127,7 @@ dgTemplateVector<T>::dgTemplateVector(const T *ptr)
}
template<class T>
-dgTemplateVector<T>::dgTemplateVector(T x, T y, T z, T w)
+constexpr dgTemplateVector<T>::dgTemplateVector(T x, T y, T z, T w)
: m_x(x), m_y(y), m_z(z), m_w(w) {
}
@@ -295,7 +295,7 @@ DG_INLINE dgVector::dgVector(const simd_type &val) {
}
#endif
-DG_INLINE dgVector::dgVector(dgFloat32 x, dgFloat32 y, dgFloat32 z, dgFloat32 w)
+constexpr DG_INLINE dgVector::dgVector(dgFloat32 x, dgFloat32 y, dgFloat32 z, dgFloat32 w)
: dgTemplateVector<dgFloat32>(x, y, z, w) {
_ASSERTE(dgCheckVector((*this)));
}
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp b/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
index aaf7d87cd75..f6bb5f4baf7 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorldDynamicUpdate.cpp
@@ -1464,8 +1464,6 @@ void dgWorldDynamicUpdate::BuildJacobianMatrixSimd(const dgIsland &island,
void dgWorldDynamicUpdate::BuildJacobianMatrix(const dgIsland &island,
dgInt32 threadIndex, dgFloat32 timestep) {
- dgVector zeroVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
- dgFloat32(0.0f));
_ASSERTE(island.m_bodyCount >= 2);
//_ASSERTE (island.m_jointCount >= 1);
@@ -6197,8 +6195,6 @@ dgInt32 dgWorldDynamicUpdate::GetJacobialDerivativesParallel(
void dgWorldDynamicUpdate::BuildJacobianMatrixParallel(const dgIsland &island,
dgFloat32 timestep, dgInt32 archModel) {
- dgVector zeroVector(dgFloat32(0.0f), dgFloat32(0.0f), dgFloat32(0.0f),
- dgFloat32(0.0f));
_ASSERTE(island.m_bodyCount >= 2);
//_ASSERTE (island.m_jointCount >= 1);
More information about the Scummvm-git-logs
mailing list